deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.14k stars 658 forks source link

support for cuda 121 #2485

Closed larochef closed 1 year ago

larochef commented 1 year ago

Description

I use pytorch, have cuda 121 installed on my computer and cannot easily downgrade. My computer is running archlinux x64.

How could I get djl to use the gpu?

Will this change the current api? How? it shouldn't change the current api

Who will benefit from this enhancement? everyone running the latest cuda version

References

frankfliu commented 1 year ago

I didn't try it myself, but you can try to set environment variable or system properties:

export PYTORCH_FLAVOR=cu117-precxx11

or

System.setProperty("PYTORCH_FLAVOR", "cu117-precxx11");
larochef commented 1 year ago

I gave it a try but got:

WARN ai.djl.pytorch.jni.LibUtils - No matching cuda flavor for linux-x86_64 found: cu121.
DEBUG ai.djl.pytorch.jni.LibUtils - Loading native library: ~/.djl.ai/pytorch/1.13.1-cpu-linux-x86_64/libc10.so
DEBUG ai.djl.pytorch.jni.LibUtils - Loading native library: ~/.djl.ai/pytorch/1.13.1-cpu-linux-x86_64/libgomp-52f2fd74.so.1
DEBUG ai.djl.pytorch.jni.LibUtils - Loading native library: ~/.djl.ai/pytorch/1.13.1-cpu-linux-x86_64/libtorch_cpu.so
DEBUG ai.djl.pytorch.jni.LibUtils - Loading native library: ~/.djl.ai/pytorch/1.13.1-cpu-linux-x86_64/libtorch.so
DEBUG ai.djl.pytorch.jni.LibUtils - Loading native library: ~/.djl.ai/pytorch/1.13.1-cpu-linux-x86_64/0.21.0-libdjl_torch.so
frankfliu commented 1 year ago

@larochef You can try it again with 0.22.0-SNAPSHOT release.

larochef commented 1 year ago

@frankfliu I tested it and it worked, thx