From a35bfad44a5431fcd7fc6f360fc850036001f007 Mon Sep 17 00:00:00 2001 From: Roland Grinis Date: Sat, 21 May 2022 21:00:45 +0100 Subject: [PATCH] DL optimisers --- kmath-noa/build.gradle.kts | 2 +- .../resources/space_kscience_kmath_noa_JNoa.h | 128 ++++++++++++++++++ .../kscience/kmath/noa/TestJitModules.kt | 1 + 3 files changed, 130 insertions(+), 1 deletion(-) diff --git a/kmath-noa/build.gradle.kts b/kmath-noa/build.gradle.kts index 95dbf4c6a..8e55a2b74 100644 --- a/kmath-noa/build.gradle.kts +++ b/kmath-noa/build.gradle.kts @@ -191,7 +191,7 @@ tasks { withType{ systemProperty("java.library.path", "$cppBuildDir/jnoa") //systemProperty("java.library.path", - // "${System.getProperty("user.home")}/devspace/noa/build/jnoa") + // "${System.getProperty("user.home")}/devspace/noa/cmake-build-release/jnoa") } } diff --git a/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h b/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h index e301f240e..3238e4d09 100644 --- a/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h +++ b/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h @@ -1191,6 +1191,134 @@ JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_stepAdamOptim JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_zeroGradAdamOptim (JNIEnv *, jclass, jlong); +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: rmsOptim + * Signature: (JDDDDDZ)J + */ +JNIEXPORT jlong JNICALL Java_space_kscience_kmath_noa_JNoa_rmsOptim + (JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble, jdouble, jdouble, jboolean); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: disposeRmsOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_disposeRmsOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: stepRmsOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_stepRmsOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: zeroGradRmsOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_zeroGradRmsOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: adamWOptim + * Signature: (JDDDDDZ)J + */ +JNIEXPORT jlong JNICALL Java_space_kscience_kmath_noa_JNoa_adamWOptim + (JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble, jdouble, jdouble, jboolean); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: disposeAdamWOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_disposeAdamWOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: stepAdamWOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_stepAdamWOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: zeroGradAdamWOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_zeroGradAdamWOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: adagradOptim + * Signature: (JDDDDD)J + */ +JNIEXPORT jlong JNICALL Java_space_kscience_kmath_noa_JNoa_adagradOptim + (JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble, jdouble, jdouble); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: disposeAdagradOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_disposeAdagradOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: stepAdagradOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_stepAdagradOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: zeroGradAdagradOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_zeroGradAdagradOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: sgdOptim + * Signature: (JDDDDZ)J + */ +JNIEXPORT jlong JNICALL Java_space_kscience_kmath_noa_JNoa_sgdOptim + (JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble, jdouble, jboolean); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: disposeSgdOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_disposeSgdOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: stepSgdOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_stepSgdOptim + (JNIEnv *, jclass, jlong); + +/* + * Class: space_kscience_kmath_noa_JNoa + * Method: zeroGradSgdOptim + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_zeroGradSgdOptim + (JNIEnv *, jclass, jlong); + /* * Class: space_kscience_kmath_noa_JNoa * Method: swapTensors diff --git a/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestJitModules.kt b/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestJitModules.kt index 90088977d..f46561f8c 100644 --- a/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestJitModules.kt +++ b/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestJitModules.kt @@ -6,6 +6,7 @@ package space.kscience.kmath.noa import java.io.File +import kotlin.test.Ignore import kotlin.test.Test import kotlin.test.assertTrue