Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
**/target
**/.classpath
**/.project
Expand Down
2 changes: 2 additions & 0 deletions arpack/src/main/java/dev/ludovic/netlib/arpack/ARPACK.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

public interface ARPACK {

public static final String ALLOW_NATIVE_ARPACK = "dev.ludovic.netlib.arpack.allowNative";

public static ARPACK getInstance() {
return InstanceBuilder.arpack();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ final class InstanceBuilder {
private static final JavaARPACK javaArpack;

static {
nativeArpack = initializeNative();
String allowNativeArpack = System.getProperty(ARPACK.ALLOW_NATIVE_ARPACK, "true");
if (Boolean.parseBoolean(allowNativeArpack)) {
nativeArpack = initializeNative();
} else {
log.info("Skip trying to load native BLAS implementation because system property " +
ARPACK.ALLOW_NATIVE_ARPACK + " is " + allowNativeArpack);
nativeArpack = null;
}
javaArpack = initializeJava();
arpack = nativeArpack != null ? nativeArpack : javaArpack;

Expand All @@ -52,7 +59,7 @@ private static NativeARPACK initializeNative() {
try {
return JNIARPACK.getInstance();
} catch (Throwable t) {
log.log(Level.FINE, "Failed to load implementation from:" + JNIARPACK.class.getName(), t);
log.log(Level.FINE, "Failed to load implementation from: " + JNIARPACK.class.getName(), t);
return null;
}
}
Expand Down
2 changes: 2 additions & 0 deletions blas/src/main/java/dev/ludovic/netlib/blas/BLAS.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

public interface BLAS {

public static final String ALLOW_NATIVE_BLAS = "dev.ludovic.netlib.blas.allowNative";

public static BLAS getInstance() {
return InstanceBuilder.blas();
}
Expand Down
11 changes: 9 additions & 2 deletions blas/src/main/java/dev/ludovic/netlib/blas/InstanceBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ final class InstanceBuilder {
private static final JavaBLAS javaBlas;

static {
nativeBlas = initializeNative();
String allowNativeBlas = System.getProperty(BLAS.ALLOW_NATIVE_BLAS, "true");
if (Boolean.parseBoolean(allowNativeBlas)) {
nativeBlas = initializeNative();
} else {
log.info("Skip trying to load native BLAS implementation because system property " +
BLAS.ALLOW_NATIVE_BLAS + " is " + allowNativeBlas);
nativeBlas = null;
}
javaBlas = initializeJava();
blas = nativeBlas != null ? nativeBlas : javaBlas;

Expand All @@ -52,7 +59,7 @@ private static NativeBLAS initializeNative() {
try {
return JNIBLAS.getInstance();
} catch (Throwable t) {
log.log(Level.FINE, "Failed to load implementation from:" + JNIBLAS.class.getName(), t);
log.log(Level.FINE, "Failed to load implementation from: " + JNIBLAS.class.getName(), t);
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ final class InstanceBuilder {
private static final JavaLAPACK javaLapack;

static {
nativeLapack = initializeNative();
String allowNativeLapack = System.getProperty(LAPACK.ALLOW_NATIVE_LAPACK, "true");
if (Boolean.parseBoolean(allowNativeLapack)) {
nativeLapack = initializeNative();
} else {
log.info("Skip trying to load native LAPACK implementation because system property " +
LAPACK.ALLOW_NATIVE_LAPACK + " is " + allowNativeLapack);
nativeLapack = null;
}
javaLapack = initializeJava();
lapack = nativeLapack != null ? nativeLapack : javaLapack;

Expand All @@ -52,7 +59,7 @@ private static NativeLAPACK initializeNative() {
try {
return JNILAPACK.getInstance();
} catch (Throwable t) {
log.log(Level.FINE, "Failed to load implementation from:" + JNILAPACK.class.getName(), t);
log.log(Level.FINE, "Failed to load implementation from: " + JNILAPACK.class.getName(), t);
return null;
}
}
Expand Down
2 changes: 2 additions & 0 deletions lapack/src/main/java/dev/ludovic/netlib/lapack/LAPACK.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

public interface LAPACK {

public static final String ALLOW_NATIVE_LAPACK = "dev.ludovic.netlib.lapack.allowNative";

public static LAPACK getInstance() {
return InstanceBuilder.lapack();
}
Expand Down