org.bytedeco.javacpp.ClassProperties Java Examples

The following examples show how to use org.bytedeco.javacpp.ClassProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Nd4jCudaPresets.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override public void init(ClassProperties properties) {
    String platform = properties.getProperty("platform");
    List<String> preloads = properties.get("platform.preload");
    List<String> resources = properties.get("platform.preloadresource");

    // Only apply this at load time since we don't want to copy the CUDA libraries here
    if (!Loader.isLoadLibraries()) {
        return;
    }
    int i = 0;
    String[] libs = {"cudart", "cublasLt", "cublas", "cusolver", "cusparse", "cudnn"};
    for (String lib : libs) {
        switch (platform) {
            case "linux-arm64":
            case "linux-ppc64le":
            case "linux-x86_64":
            case "macosx-x86_64":
                lib += lib.equals("cudnn") ? "@.7" : lib.equals("cudart") ? "@.10.2" : "@.10";
                break;
            case "windows-x86_64":
                lib += lib.equals("cudnn") ? "64_7" : lib.equals("cudart") ? "64_102" : "64_10";
                break;
            default:
                continue; // no CUDA
        }
        if (!preloads.contains(lib)) {
            preloads.add(i++, lib);
        }
    }
    if (i > 0) {
        resources.add("/org/bytedeco/cuda/");
    }
}
 
Example #2
Source File: Generator.java    From tapir with MIT License 4 votes vote down vote up
public Generator(Logger logger, ClassProperties properties) {
    this.logger = logger;
    this.properties = properties;
}