Skip to content

Commit 89d882b

Browse files
committed
* Allow setting "org.bytedeco.openblas.load" system property to "none" (issue #1203)
1 parent bc08f1b commit 89d882b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
* Allow setting "org.bytedeco.openblas.load" system property to "none" ([issue #1203](https://github.com/bytedeco/javacpp-presets/issues/1203))
23
* Fix presets for the CUPTI module of CUDA on Windows ([pull #1576](https://github.com/bytedeco/javacpp-presets/pull/1576))
34
* Introduce `macosx-arm64` builds for ARPACK-NG, CMINPACK, FFTW, GSL, TensorFlow Lite, ONNX, ONNX Runtime ([issue #1069](https://github.com/bytedeco/javacpp-presets/issues/1069))
45
* Upgrade presets for OpenCV 4.11.0, DNNL 3.6.2, CPython 3.13.1, NumPy 2.2.1, SciPy 1.15.1, LLVM 19.1.6, PyTorch 2.6.0, ONNX Runtime 1.20.1

openblas/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Java API documentation is available here:
2020

2121
* http://bytedeco.org/javacpp-presets/openblas/apidocs/
2222

23-
∗ The JNI bindings can instead link with [Intel MKL](https://software.intel.com/mkl), or any other arbitrary library found on the "java.library.path" or on the class path, by specifying it with the "org.bytedeco.openblas.load" system property. For example, to use the BLAS library from the [Accelerate framework](https://developer.apple.com/documentation/accelerate) on Mac OS X, we can pass options such as `-Djava.library.path=/usr/lib/ -Dorg.bytedeco.openblas.load=blas`, while for a default installation of MKL that would be `-Dorg.bytedeco.openblas.load=mkl_rt`.
23+
∗ The JNI bindings can instead link with [Intel MKL](https://software.intel.com/mkl), or any other arbitrary library found on the "java.library.path" or on the class path, by specifying it with the "org.bytedeco.openblas.load" system property. For example, to use the BLAS library from the [Accelerate framework](https://developer.apple.com/documentation/accelerate) on Mac OS X, we can pass options such as `-Djava.library.path=/usr/lib/ -Dorg.bytedeco.openblas.load=blas`, while for a default installation of MKL that would be `-Dorg.bytedeco.openblas.load=mkl_rt`. The system property can also be set to "none" to avoid loading OpenBLAS at all.
2424

2525
Intel also offers a stripped-down but free version of MKL named "MKLML" that is bundled with the [JavaCPP Presets for MKL-DNN](../mkl-dnn). After adding the JAR files for MKL-DNN to the class path, it can be accessed with an option like `-Dorg.bytedeco.openblas.load=mklml`. Moreover, it is now possible to do the same with the full version of MKL and the [JavaCPP Presets for MKL](../mkl) with the `-redist` artifacts in the class path and an option like `-Dorg.bytedeco.openblas.load=mkl_rt`.
2626

openblas/src/main/java/org/bytedeco/openblas/presets/openblas_nolapack.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2016-2024 Samuel Audet
2+
* Copyright (C) 2016-2025 Samuel Audet
33
*
44
* Licensed either under the Apache License, Version 2.0, or (at your option)
55
* under the terms of the GNU General Public License as published by
@@ -68,6 +68,7 @@ public class openblas_nolapack implements LoadEnabled, InfoMapper {
6868

6969
@Override public void init(ClassProperties properties) {
7070
String platform = properties.getProperty("platform");
71+
List<String> links = properties.get("platform.link");
7172
List<String> preloads = properties.get("platform.preload");
7273
List<String> resources = properties.get("platform.preloadresource");
7374
String className = getClass().getSimpleName(); // "openblas_nolapack" or "openblas"
@@ -105,7 +106,11 @@ public class openblas_nolapack implements LoadEnabled, InfoMapper {
105106
}
106107
}
107108

108-
if (lib.length() > 0) {
109+
if (lib.equals("none")) {
110+
links.clear();
111+
preloads.clear();
112+
properties.setProperty("platform.library", "#none#");
113+
} else if (lib.length() > 0) {
109114
if (platform.startsWith("linux")) {
110115
preloads.add(i, lib + "#" + className + "@.0");
111116
} else if (platform.startsWith("macosx")) {

0 commit comments

Comments
 (0)