diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca1649..da9702f9e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-torch/build.gradle.kts b/kmath-torch/build.gradle.kts index 8f75a4140..7ef0ec52c 100644 --- a/kmath-torch/build.gradle.kts +++ b/kmath-torch/build.gradle.kts @@ -119,6 +119,8 @@ kotlin { "-Wl,-rpath=$cppBuildDir", "-lctorch" ) + optimized = true + debuggable = false } } } diff --git a/kmath-torch/src/nativeTest/kotlin/kscience/kmath/torch/BenchmarksDouble.kt b/kmath-torch/src/nativeTest/kotlin/kscience/kmath/torch/BenchmarkMatrixMultiplicationDouble.kt similarity index 80% rename from kmath-torch/src/nativeTest/kotlin/kscience/kmath/torch/BenchmarksDouble.kt rename to kmath-torch/src/nativeTest/kotlin/kscience/kmath/torch/BenchmarkMatrixMultiplicationDouble.kt index 8024b3eb3..f1999a29b 100644 --- a/kmath-torch/src/nativeTest/kotlin/kscience/kmath/torch/BenchmarksDouble.kt +++ b/kmath-torch/src/nativeTest/kotlin/kscience/kmath/torch/BenchmarkMatrixMultiplicationDouble.kt @@ -5,6 +5,7 @@ import kotlin.time.measureTime internal fun benchmarkingDoubleMatrixMultiplication( scale: Int, + numWarmUp: Int, numIter: Int, device: TorchDevice = TorchDevice.TorchCPU ): Unit { @@ -13,20 +14,21 @@ internal fun benchmarkingDoubleMatrixMultiplication( setSeed(SEED) val lhs = randNormal(shape = intArrayOf(scale, scale), device = device) val rhs = randNormal(shape = intArrayOf(scale, scale), device = device) - lhs dotAssign rhs + repeat(numWarmUp) { lhs dotAssign rhs } val measuredTime = measureTime { repeat(numIter) { lhs dotAssign rhs } } println(" ${measuredTime / numIter} p.o. with $numIter iterations") } } -class BenchmarksDouble { +class BenchmarkMatrixMultiplicationDouble { @Test - fun benchmarkMatrixMultiplication20() = benchmarkingDoubleMatrixMultiplication(20, 100000) - @Test - fun benchmarkMatrixMultiplication200() = benchmarkingDoubleMatrixMultiplication(200, 10000) - @Test - fun benchmarkMatrixMultiplication2000() = benchmarkingDoubleMatrixMultiplication(2000, 10) + fun benchmarkMatrixMultiplication20() = benchmarkingDoubleMatrixMultiplication(20, 10, 100000) + @Test + fun benchmarkMatrixMultiplication200() = benchmarkingDoubleMatrixMultiplication(200, 10, 10000) + + @Test + fun benchmarkMatrixMultiplication2000() = benchmarkingDoubleMatrixMultiplication(2000, 3, 20) } \ No newline at end of file