VS2022 svdComplexDevice1.dll called by Java application svdComplexDevice1X64

Home and Applets > Download SVD-GPU Application Source Code > svdComplexDevice1.dll Called by Java Application svdComplexDevice1X64

A Visual Studio 2022 project and a Java application project are presented. The VS2022 project generates a DLL file that is called by the Java application via JNA in Windows 11 environment. CUDA and CULA are involved.

This Java application is used in:
Denoising NMR time-domain signal by singular-value decomposition accelerated by graphics processing units,
Pascal P. Man, Christian Bonhomme, and Florence Babonneau
Solid State Nucl. Magn. Reson. 61-62, 28-34 (2014). Abstract

CULA installation

Install CULA Dense R15 for Windows (Universal).
Its folder location is C:\Program Files\CULA\R15.

svdComplexDevice1 DLL project in MS Visual Studio 2022

  1. In Visual Studio 2022 panel, select Create a new Project.
  2. In Create a new project panel, select Dynamic-Link Library (DLL)

    Click Next button.
  3. In Configure a new project panel, provid the name of the project: svdComplexDevice1

    Click Create button.
  4. The Visual Studio editor appears with a dllmain.cpp file.

    Four files are generated: dllmain.cpp, pch.cpp, pch.h, and framework.h
  5. Right click the folder of Source Files in Solution Explorer for adding a new item.
    Select Add then New Item...
    Add New Item panel appears.
    Select C++ File (.cpp).
    Provid the Name: svdComplexDevice1.cpp
    Click Add button.
  6. An empty svdComplexDevice1.cpp file is created.
    Open svdComplexDevice1.cpp.
    Copy and paste its content into the empty source file svdComplexDevice1.cpp.
  7. Right click the folder of Header Files in Solution Explorer for adding a new item...
    Select Add then New Item.
    Add New Item panel appears.
    Select Header File (.h).
    Provid the Name: svdComplexDevice1.h
    Click Add button.
  8. An empty svdComplexDevice1.h file is created.
    Open svdComplexDevice1.h.
    Copy and paste its content into the empty Header File svdComplexDevice1.h.
  9. Right click the file svdComplexDevice1.cpp in Solution Explorer. Select Properties.
    The Item Type is C/C++ compiler. Close the panel.
  10. Right click the file svdComplexDevice1.h in Solution Explorer. Select Properties.
    The Item Type is C/C++ header. Close the panel.
  11. Right click the project svdComplexDevice1 in Solution Explorer. Select Properties, then VC++ Directories.

    Add C:\Program Files\CULA\R15\bin64; in Executable Directories.

    Add C:\Program Files\CULA\R15\include;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.5\include; in Include Directories.

    Add C:\Program Files\CULA\R15\lib64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.5\lib\x64; in Library Directories.

  12. Select Linker then Input.
    Add cula_core.lib;cula_lapack.lib;cudart.lib; in Additional Dependencies.

    Click Appliquer button then OK button.
  13. Select Build menu then Build Solution.

    The file svdComplexDevice1.dll with 71 kbit size is generated in the folder C:\Users\pm\source\repos\svdComplexDevice1\x64\Debug.

Java environment installation

  1. Install Eclipse IDE 2024-09 R Packages for Windows with Eclipse Installer 2024-09 R: eclipse-inst-jre-win64.exe.

    Select Eclipse IDE for Java Developers.
  2. Install Oracle JDK Development Kit 21.0.5 for 64-bit Windows: jdk-21_windows-x64_bin.exe
    Interface Observer and class Observable are depreciated since Java version 9.
  3. Download two Java Native Access executable files: jna-5.15.0.jar and jna-platform-5.15.0.jar.
  4. The four CULA DLL files, cula_lapack.dll, cula_core.dll, cublas64_42_6.dll, and cudart64_42_6.dll, are located at C:\Program Files\CULA\R15\bin64.
  5. My Java application folder location is C:\Users\pm\eclipse-workspace.

svdComplexDevice1X64 Java application project in Eclipse IDE

  1. Open Eclipse IDE 2024-09.

  2. Select Window menu then Preferences.
    Click Java then Installed JREs.
    Click Add button. Select Standard VM then click Next > button.
    Click Directory.. button. Select JRE folder or JDK folder. Click Finish button.
    Tick jdk-21 (default)

    Click Apply button.
  3. Click Compiler.
    Choose 21 for Compiler compliance level.

    Click Apply and Close button.
    These settings will be effective for new projects.
  4. Select Create a Java project in Eclipse IDE.
    Provid the project name: svdComplexDeviceX64

    Click Finish button.
  5. The project folder appears in Package Explorer.

  6. The file .classpath in the project folder located at C:\Users\pm\eclipse-workspace\svdComplexDevice1X64 is filled.

  7. Open the project folder.
    Transfer seven files into the project folder: svdComplexDevice1.dll, cula_lapack.dll, cula_core.dll, cudart64_42_6.dll, cublas64_42_6.dll, jna-platform-5.5.jar, and jna-5.5.0.jar.

  8. Right click the project name in Project Explorer then select Refresh.

    The seven files appear in Package Explorer.
  9. Right click the source folder src in Project Explorer.
    Select New then Package. Provid the package name: nmrsvd

    Click Finish button.
  10. Right click the package folder nmrsvd in Project Explorer.
    Select New then class. Provid the class name: fidsvd

    Click Finish button.
  11. Similarly, generate four Java classes: Frame1, Graph, ListGentle, and SVDMVCModelGPU

  12. Copy and paste fidsvd.java, Frame1.java, Graph.java, ListGentle.java, and SVDMVCModelGPU.java into the five newly generated java files, respectively.
  13. Right click the project folder svdComplexDevice1X64 in Project Explorer.
    Select Properties, Java Build Path, Library.

  14. Select Classpath to activate Add buttons.
    Click Add JARs... button.
    Click the project folder in JAR Selection panel.
    Select the two jar files.

    Click OK button.

  15. Click Apply and Close button.

  16. A new folder, Referenced Libraries containing the two jna files, is added to the project in Package Explorer.
  17. The file .classpath in the project folder located at C:\Users\pm\eclipse-workspace\svdComplexDevice1X64 is filled.

    Two lines concerning with jna files are added.
  18. Select Run menu then Run Configuration...
    Click Java Application then New_configuration.

    Click Run button.
  19. Save and Launch panel appears.

    Click OK button.
  20. The Java application panel appears.

References

  1. Creating a jar File in Eclipse
  2. Creating an executable Jar file
  3. Tutoriel pour exécuter du code natif en Java : JNI VS JNA
  4. YouTube: How to setup Eclipse for C/C++ developers in Windows 8.1
  5. How to install Eclipse CDT 8.2 and get started
  6. Eclipse CDT (C/C++ Development Tooling)
  7. Add .dll to java.library.path in Eclipse/PyDev Jython projec
  8. Tutoriel pour exécuter du code natif à partir de Java avec JNA, en 5 minutes
  9. How to change Eclipse Java version for compiler and JRE
  10. How to change Java Version in an Eclipse project
  11. Tout savoir sur Eclipse
  12. Setting up the code for development and compilation
  13. Eclipse managed build
  14. [Learning] CUDA C/C++ (Part 1) - Visual Studio project setup (Visual Studio 2017 15.5 version) from Win32 empty project
  15. CULA programmer’s guide, release R15 (CUDA 4.2) (PDF file)
  16. CULA reference manual, release R15 (CUDA 4.2) (PDF file)
  17. CUDA C++ programming guide (PDF file)
  18. CUDA quick start guide (PDF file)
  19. CUDA sample (PDF file)
  20. Learning CUDA (PDF file) from FREE eBook created from Stack Overflow contributors
  21. JavaBeans
  22. Nvidia: CUDA toolkit documentation 12.6 update 3

References cusolver

  1. Nvidia Developer: CUDA libraries documentation
  2. Stackoverflow: Singular values calculation only with CUDA
  3. CUDA: cuSOLVER API Reference v12.6
  4. Nvidia: CUSOLVER library DU-06709-001_v10.1 | April 2019
  5. Nvidia: Cusolver SVD for general complex matrix
  6. Nvidia: cusolverDnSgesvd svd of matrix with m<n
  7. Nvidia: [cusolverDn] Fail to compute the singular values only in Cuda 7.0
  8. Nvidia Developer zone, CUDA Toolkit v10.1.168: G. Examples of Singular Value Decomposition
  9. Nvidia cuQuantum : Define SVD decomposition
  10. github: CUDALibrarySamples/cuSOLVER/Xgesvd/cusolver_Xgesvd_example.cu
  11. github: cuSOLVER Singular Value Decomposition example
  12. github: cuSOLVER library - APIs examples
  13. OGeek 极客中国: cuda - Cusolver SVD does not give correct U and VT outputs for complex inputs
  14. Blue Waters: cuSolver
  15. Andrzej Chrzęszczyk and Jacob Anders: Matrix computations on the GPU, CUBLAS, CUSOLVER and MAGMA by example
  16. DP3: Complex.h

Solid-state NMR bibliography for:

Aluminum-27
Antimony-121/123
Arsenic-75
Barium-135/137
Beryllium-9
Bismuth-209
Boron-11
Bromine-79/81
Calcium-43
Cesium-133
Chlorine-35/37
Chromium-53
Cobalt-59
Copper-63/65
Deuterium-2
Gallium-69/71
Germanium-73
Gold-197
Hafnium-177/179
Indium-113/115
Iodine-127
Iridium-191/193
Krypton-83
Lanthanum-139
Lithium-7
Magnesium-25
Manganese-55
Mercury-201
Molybdenum-95/97
Neon-21
Nickel-61
Niobium-93
Nitrogen-14
Osmium-189
Oxygen-17
Palladium-105
Potassium-39/41
Rhenium-185/187
Rubidium-85/87
Ruthenium-99/101
Scandium-45
Sodium-23
Strontium-87
Sulfur-33
Tantalum-181
Titanium-47/49
Vanadium-51
Xenon-131
Zinc-67
Zirconium-91
[Contact me] - Last updated November 23, 2024
Copyright © 2002-2024 pascal-man.com. All rights reserved.