Closed LukasSiefke closed 4 years ago
irg wie sowas
find_package(JNI REQUIRED)
add_library(jnitests SHARED ${SOURCES})
siehe https://github.com/thefangbear/JNI-By-Examples#finale-build
man kann jetzt mit cmake das kompilieren, aber beim ausführen passen die pfade aber nicht mehr
$ cmake -H. -Bcmake-build-test -DCMAKE_BUILD_TYPE=Debug
-- JNI enabled
-- Testing enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/tmp.gVdfvJITP6/cmake-build-test
$ make -C cmake-build-test/ JExampleSaxpy
$ cd cmake-build-test/java/bin
$ java -ea -Djava.library.path=../../ ExampleSaxpy
Exception in thread "main" java.nio.file.NoSuchFileException: ../examples/kernels/saxpy.cu
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:215)
at java.base/java.nio.file.Files.newByteChannel(Files.java:370)
at java.base/java.nio.file.Files.newByteChannel(Files.java:421)
at java.base/java.nio.file.Files.readAllBytes(Files.java:3205)
at Utils.loadFile(Utils.java:7)
at ExampleSaxpy.main(ExampleSaxpy.java:32)
@LukasSiefke @Olliewer
Ich hab utils nach src/java bewegt dann konnte man das einfach kompilieren ohne alles zu kopieren zu müssen
Hab noch nen script erstellt um es noch einfacher zumachen:
$ ./cudaexecutor.sh
cudaexecutor
Options: ./cudaexecutor.sh
--buildj Tries CMake build
--execute-java Tests library with java
--builds Tries CMake build
--execute-scala Tests library with scala
beschreibungen nicht so hilfreich, aber einmal baut es halt c + java und einmal c + java + scala hab euer scala zeug noch nicht gemerged ist also ungetestet.
$ ./cudaexecutor.sh --execute-scala ExampleSaxpy
Das geht auch schöner...