Hi Samuel,
Thanks for updating the build instructions, https://github.com/bytedeco/javacpp-presets/wiki/Build-Environments#linux-x86-and-x86_64
However, within the CentOS7 container I found cuda has build failure. I attached the complete build log for your reference.
And could you please add some example file to explain what's the input and output files of "The Builder --> 3.Generator", https://github.com/bytedeco/javacpp/wiki/Basic-Architecture. I was trying to find "Outputs native JNI code in C++ (.cpp, .cu, .mm, etc)" but couldn't find any generated code after build one of the javacpp-presets, such as opencv. Does the generator output file contain code like below?
JNIEXPORT jlong JNICALL Java_come_xxx_Cuda_cudaMallocHost(JNIEnv *env, jclass, jlong size) {try {cudf::jni::auto_set_device(env);void * ret = nullptr;JNI_CUDA_TRY(env, 0, cudaMallocHost(&ret, size));return reinterpret_cast<jlong>(ret);} CATCH_STD(env, 0);}And cudaMallocHost is the C++ function name read from C++ header files hence will match that in the binary .so, right?
Thanks,Yin
Hi Samuel,
I do have CUDA 10.2 installed on my host, and because I used your command to launch the CentOS 7 container which has volume mount to the cuda directory in host. And I checked the cuda.h does exist. But the build failure message is cannot find cuda.h.
$ sudo docker run --privileged -it -v /usr/local/lib/bazel:/usr/local/lib/bazel -v /usr/local/cuda:/usr/local/cuda centos:7 /bin/bash
I did read these two docs before, but seems they're about how JavaCpp Parser convert C++ header files .h to .java file(definition in C++ to definition in Java with native keyword, which is the part I understand). The question I was trying to ask is after this, JavaCpp Generator will convert the .java definition file to "native JNI code in C++ (.cpp, .cu, .mm, etc)". The unclear thing is what are these "native JNI code in C++ (.cpp, .cu, .mm, etc)" in JavaCpp. Are they the medium C++ layer that route into the existing C++ binary or they're the self complete new implementation?
Namely, please allow me to comment my questions on the doc to make it easier to express:
- Runs optional external build scripts, such as
cppbuild.shfrom the JavaCPP Presets,
- Outputs native libraries (.so, .dylib, .dll, etc), <Yin>At this step, are output native libraries the original libs that has nothing to do with JavaCpp yet, or the libs built from injected/modified source code somehow manipulated by the cppbuild.sh?</Yin>
- Runs the
Parseron the givenInfoMapand the header files listed in the@Platformannotation,
- Outputs native Java interfaces (.java), as explained further in the Mapping Recipes, <Yin>Is this Java methods definitions(no any implementation) with native keyword? Are they the file under gen directory in existing presets?</Yin>
- Runs the
Generatoron the Java interfaces,
- Outputs native JNI code in C++ (.cpp, .cu, .mm, etc), <Yin>Are they the medium C++ layer that route into the existing C++ binary or they're the self complete new entire implementation? I am asking because I see it could be cuda kernel source code which should be the native implementation</Yin>
- Runs the native C++ compiler (GCC, Clang, MSVC, NVCC, etc) on the JNI code,
- Outputs native libraries containing JNI wrappers, optionally archived in a JAR file. <Yin>What does this "JNI wrappers" refer to?</Yin>
Thank you so much for reading it,Yin