This project builds the JNI layer for Java to call PyTorch C++ APIs.
You can find more information in the src
.
You need to install cmake
and C++ compiler on your machine in order to build
apt install cmake g++
Use the following task to build PyTorch JNI library:
./gradlew compileJNI
gradlew compileJNI
This task will send a Jni library copy to pytorch-engine
model to test locally.
Note: PyTorch C++ library requires CUDA path set in the system.
Use the following task to build pytorch JNI library for GPU:
./gradlew compileJNIGPU
gradlew compileJNIGPU
The task will build CUDA 10.1 by default, you can change the flavor in compileJNIGPU
to cu102
to use CUDA 10.2.
downloadBuild("win", "cu102")
It uses clang-format to format the code.
./gradlew formatCpp