Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1014 Bytes

README.md

File metadata and controls

62 lines (41 loc) · 1014 Bytes

DJL - PyTorch native Library

Introduction

This project builds the JNI layer for Java to call PyTorch C++ APIs. You can find more information in the src.

Prerequisite

You need to install cmake and C++ compiler on your machine in order to build

Linux

apt install cmake g++

CPU Build

Use the following task to build PyTorch JNI library:

Mac/Linux

./gradlew compileJNI

Windows

gradlew compileJNI

This task will send a Jni library copy to pytorch-engine model to test locally.

GPU build

Note: PyTorch C++ library requires CUDA path set in the system.

Use the following task to build pytorch JNI library for GPU:

Mac/Linux

./gradlew compileJNIGPU

Windows

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")

Format C++ code

It uses clang-format to format the code.

./gradlew formatCpp