Re: Compiling JNI sources on RHEL

Hi folks,
I’m developing a real-time image processing application on RHEL 5.6 (32bit, and 64bit) that will use JCUDA for implementing the image processing algorithm and JNI to access the camera (note. this is for the 200 inch telescope at the Palomar Observatory). I got JCUDA working correctly on my Mac but I need to deploy on Linux (the camera runs on a Linux platform but not on Mac). I’m trying to compile the JCUDA source but I’m running into a large number of compilation errors. Are there any instructions on building the JNI sources?
Jennifer Milburn
jwm@astro.caltech.edu

Here is the ouput from make (note I ran cmake -G “Unix Makefiles” CMakeLists.txt and the make files were generated)
When I run make however I get a large number of errors. The CommonJNI compiles correctly but the system stop when it tries to compile JCudaDriverJNI.
Sincerely,
Jennifer Milburn

make
[ 27%] Built target CommonJNI
[ 36%] Building CXX object JCudaDriverJNI/CMakeFiles/JCudaDriver-linux-x86.dir/src/JCudaDriver.cpp.o
In file included from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver_common.hpp:52,
from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:29:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/…/CommonJNI/src/Logger.hpp:48:7: warning: no newline at end of file
In file included from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/…/CommonJNI/src/PointerUtils.hpp:31,
from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver_common.hpp:53,
from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:29:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/…/CommonJNI/src/JNIUtils.hpp:62:7: warning: no newline at end of file
In file included from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver_common.hpp:53,
from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:29:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/…/CommonJNI/src/PointerUtils.hpp:573:7: warning: no newline at end of file
In file included from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver_common.hpp:54,
from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:29:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/…/CommonJNI/src/JNIUtils.hpp:62:7: warning: no newline at end of file
In file included from /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:29:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver_common.hpp:132:7: warning: no newline at end of file
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:5806:5: warning: no newline at end of file
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:670: error: ‘CUipcEventHandle’ does not name a type
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:691: error: ‘CUipcEventHandle’ has not been declared
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘void setCUipcEventHandle(JNIEnv*, __jobject*, int&)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:699: error: request for member ‘reserved’ in ‘nativeHandle’, which is of non-class type ‘int’
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: At global scope:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:708: error: ‘CUipcMemHandle’ does not name a type
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:729: error: ‘CUipcMemHandle’ has not been declared
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘void setCUipcMemHandle(JNIEnv*, __jobject*, int&)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:737: error: request for member ‘reserved’ in ‘nativeHandle’, which is of non-class type ‘int’
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘bool setOptionValue(JNIEnv*, __jobject*, CUjit_option, void*)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:1461: warning: converting to non-pointer type ‘bool’ from NULL
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuDeviceGetByPCIBusIdNative(JNIEnv*, __jclass*, __jobject*, __jstring*)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:1971: error: ‘cuDeviceGetByPCIBusId’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuDeviceGetPCIBusIdNative(JNIEnv*, __jclass*, __jobjectArray*, jint, __jobject*)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2000: error: ‘cuDeviceGetPCIBusId’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuIpcGetEventHandleNative(JNIEnv*, __jclass*, __jobject*, __jobject*)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2039: error: ‘CUipcEventHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2039: error: expected ;' before ‘nativePHandle’ /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2041: error: ‘nativePHandle’ was not declared in this scope /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2041: error: ‘cuIpcGetEventHandle’ was not declared in this scope /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuIpcOpenEventHandleNative(JNIEnv*, __jclass*, __jobject*, __jobject*)’: /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2067: error: ‘CUipcEventHandle’ was not declared in this scope /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2067: error: expected;’ before ‘nativeHandle’
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2068: error: ‘nativeHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2068: error: ‘cuIpcOpenEventHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuIpcGetMemHandleNative(JNIEnv*, __jclass*, __jobject*, __jobject*)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2094: error: ‘CUipcMemHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2094: error: expected ;' before ‘nativePHandle’ /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2097: error: ‘nativePHandle’ was not declared in this scope /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2097: error: ‘cuIpcGetMemHandle’ was not declared in this scope /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuIpcOpenMemHandleNative(JNIEnv*, __jclass*, __jobject*, __jobject*, jint)’: /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2122: error: ‘CUipcMemHandle’ was not declared in this scope /opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2122: error: expected;’ before ‘nativeHandle’
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2123: warning: converting to non-pointer type ‘CUdeviceptr’ from NULL
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2125: error: ‘nativeHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2125: error: ‘cuIpcOpenMemHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuIpcCloseMemHandleNative(JNIEnv*, __jclass*, __jobject*)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:2148: error: ‘cuIpcCloseMemHandle’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp: In function ‘jint Java_jcuda_driver_JCudaDriver_cuGLGetDevicesNative(JNIEnv*, __jclass*, __jintArray*, __jobjectArray*, jint, jint)’:
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:5243: error: ‘CUGLDeviceList’ was not declared in this scope
/opt/development/CUDA/JCUDA2/JCuda-All-0.4.1RC2b-src/JCudaDriverJNI/src/JCudaDriver.cpp:5243: error: ‘cuGLGetDevices’ was not declared in this scope
make[2]: *** [JCudaDriverJNI/CMakeFiles/JCudaDriver-linux-x86.dir/src/JCudaDriver.cpp.o] Error 1
make[1]: *** [JCudaDriverJNI/CMakeFiles/JCudaDriver-linux-x86.dir/all] Error 2
make: *** [all] Error 2

Hello

The first line that is reported as an ‘error’ is
… JCudaDriver.cpp:670: error: ‘CUipcEventHandle’ does not name a type
The “CUipcEventHandle” type was introduced in CUDA 4.1. So you will not be able to compile it with CUDA 4.0, of course.

You wrote in your mail that you had first tried to compile it with CUDA 4.1, but then downgraded to 4.0. I’m not sure about your current state:

  • If you have installed CUDA 4.0, you can use JCuda 0.4.0-beta1 (which is still available on the download page - also the binaries for Linux 64 bit)
  • If you have installed CUDA 4.1, it should be possible to compile the libraries. You have to make sure that the include directory for CUDA really points to the ‘include’ directory of the CUDA 4.1 toolkit (and not to the 4.0 one).

The contributor who regularly provides the MacOS- and Linux binaries told me that he wanted to build the Linux64 binaries for version 4.1 soon, I’ll ask him about that - in the best case, you don’t have to build the binaries on your own then.

bye
Marco

The binaries for Linux 64bit have just been uploaded at http://jcuda.org/downloads/downloads.html Thanks again to Kashif Rasul for his contribution!

Hi Marco,
You gave me EXACTLY the hint I needed to get things working. :slight_smile: I’ve compiled and tested the all of the JCuda libraries on RHEL 5.6 (32 bit) and almost everything is working. I had a mismatch between the CUDA toolkit version (4.0) and the source code. After I updated to 4.1 the source compiled without issue. I have a slightly different OpenGL configuration (without awt) so the OpenGL samples (java) don’t compile (not an issue for what I’m doing). However, I did run ALL of the samples and I’m only having a problem with a few .
(1) JCudaDriverGLSample3 - requires the JOGL with awt
(2) JCudaDriverTextureSample - problems locating and/or parsing the cubin file
(3) JCudppSample - I don’t and the correct include directory setup for compiling JCudppJNI
All of the other samples work without issue. I’ll be glad to send you the libraries (i.e. jars and *.a, *.so) for 32 bit Linux if your interested. What form would you like the libraries in? Do you only want the jars and *.a, *.so or are you interested in the development tree, Netbeans project, etc?
Sincerely,
Jennifer Milburn

Good to hear that :slight_smile:

Concerning the problems:
(1) The GL sample should be running once JOGL is installed (I already planned to create an LWJGL sample, too)
(2) The JCudaDriverTextureSample is still using CUBIN files. Once it is updated to use PTX files, it should be working as well (maybe I should allocate a day or two in order to update all samples…)
(3) JCudpp is difficult: The CUDPP library is no longer part of the CUDA SDK, and has to be compiled manually from the source code at http://code.google.com/p/cudpp/ I have done this only for Windows until now, but since it uses CMake, it should not be too hard to compile on Linux as well. However, if you don’t need JCudpp, the library may be omitted.

It would be great if you could provide the Linux32 binaries. For the upload, only the .SO files are required.

bye
Marco

By the way: NVIDIA has just released CUDA 4.1 final - so the binaries will have to be updated… I’ll see whether there are any significant changes in the API, and upload version 0.4.1 as soon as possible.

Hi Marco,
The binaries I sent you were compiled with the new release.
Jennifer