forked from kscience/kmath
threads setting
This commit is contained in:
parent
e17fe32ae2
commit
cadcb9916f
@ -22,5 +22,13 @@ public class JNoa {
|
||||
}
|
||||
|
||||
public static native int testException(int seed);
|
||||
|
||||
public static native boolean cudaIsAvailable();
|
||||
|
||||
public static native int getNumThreads();
|
||||
|
||||
public static native void setNumThreads(int numThreads);
|
||||
|
||||
public static native void setSeed(int seed);
|
||||
}
|
||||
|
||||
|
@ -8,3 +8,15 @@ package space.kscience.kmath.noa
|
||||
public fun cudaAvailable(): Boolean {
|
||||
return JNoa.cudaIsAvailable()
|
||||
}
|
||||
|
||||
public fun getNumThreads(): Int {
|
||||
return JNoa.getNumThreads()
|
||||
}
|
||||
|
||||
public fun setNumThreads(numThreads: Int): Unit {
|
||||
JNoa.setNumThreads(numThreads)
|
||||
}
|
||||
|
||||
public fun setSeed(seed: Int): Unit {
|
||||
JNoa.setSeed(seed)
|
||||
}
|
||||
|
@ -23,6 +23,30 @@ JNIEXPORT jint JNICALL Java_space_kscience_kmath_noa_JNoa_testException
|
||||
JNIEXPORT jboolean JNICALL Java_space_kscience_kmath_noa_JNoa_cudaIsAvailable
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: space_kscience_kmath_noa_JNoa
|
||||
* Method: getNumThreads
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_space_kscience_kmath_noa_JNoa_getNumThreads
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: space_kscience_kmath_noa_JNoa
|
||||
* Method: setNumThreads
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_setNumThreads
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: space_kscience_kmath_noa_JNoa
|
||||
* Method: setSeed
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_setSeed
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -19,4 +19,11 @@ class TestUtils {
|
||||
}
|
||||
assertEquals(i, 10)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun settingNumThreads(){
|
||||
val numThreads = 2
|
||||
setNumThreads(numThreads)
|
||||
assertEquals(numThreads, getNumThreads())
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user