diff --git a/.idea/copyright/kmath.xml b/.idea/copyright/kmath.xml deleted file mode 100644 index 6fe438777..000000000 --- a/.idea/copyright/kmath.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index 6cc25cb4a..000000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c3bd2641a..f1d33a75a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Redesign advanced Chain API - Redesign MST. Remove MSTExpression. - Move MST to core +- Separated benchmarks and examples ### Deprecated diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts new file mode 100644 index 000000000..f8e85395b --- /dev/null +++ b/benchmarks/build.gradle.kts @@ -0,0 +1,147 @@ +/* + * Copyright 2018-2021 KMath contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +import ru.mipt.npm.gradle.Maturity + +plugins { + kotlin("multiplatform") + kotlin("plugin.allopen") + id("org.jetbrains.kotlinx.benchmark") +} + +allOpen.annotation("org.openjdk.jmh.annotations.State") +sourceSets.register("benchmarks") + + + +repositories { + mavenCentral() + jcenter() + maven("https://repo.kotlin.link") + maven("https://clojars.org/repo") + maven("https://dl.bintray.com/egor-bogomolov/astminer/") + maven("https://dl.bintray.com/hotkeytlt/maven") + maven("https://jitpack.io") + maven { + setUrl("http://logicrunch.research.it.uu.se/maven/") + isAllowInsecureProtocol = true + } +} + +kotlin { + jvm() + + sourceSets { + val commonMain by getting { + dependencies { + implementation(project(":kmath-ast")) + implementation(project(":kmath-core")) + implementation(project(":kmath-coroutines")) + implementation(project(":kmath-complex")) + implementation(project(":kmath-stat")) + implementation(project(":kmath-dimensions")) + implementation(project(":kmath-for-real")) + implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.3.0") + } + } + + val jvmMain by getting { + dependencies { + implementation(project(":kmath-commons")) + implementation(project(":kmath-ejml")) + implementation(project(":kmath-nd4j")) + implementation(project(":kmath-kotlingrad")) + implementation(project(":kmath-viktor")) + implementation("org.nd4j:nd4j-native:1.0.0-beta7") + + // uncomment if your system supports AVX2 + // val os = System.getProperty("os.name") + // + // if (System.getProperty("os.arch") in arrayOf("x86_64", "amd64")) when { + // os.startsWith("Windows") -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:windows-x86_64-avx2") + // os == "Linux" -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:linux-x86_64-avx2") + // os == "Mac OS X" -> implementation("org.nd4j:nd4j-native:1.0.0-beta7:macosx-x86_64-avx2") + // } else + // implementation("org.nd4j:nd4j-native-platform:1.0.0-beta7") + } + } + } +} + +// Configure benchmark +benchmark { + // Setup configurations + targets { + register("jvm") + } + + configurations.register("buffer") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("BufferBenchmark") + } + + configurations.register("dot") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("DotBenchmark") + } + + configurations.register("expressions") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("ExpressionsInterpretersBenchmark") + } + + configurations.register("matrixInverse") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("MatrixInverseBenchmark") + } + + configurations.register("bigInt") { + warmups = 1 // number of warmup iterations + iterations = 3 // number of iterations + iterationTime = 500 // time in seconds per iteration + iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds + include("BigIntBenchmark") + } +} + +// Fix kotlinx-benchmarks bug +afterEvaluate { + val jvmBenchmarkJar by tasks.getting(org.gradle.jvm.tasks.Jar::class) { + duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.EXCLUDE + } +} + + +kotlin.sourceSets.all { + with(languageSettings) { + useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts") + useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes") + useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI") + } +} + +tasks.withType { + kotlinOptions { + jvmTarget = "11" + freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all" + } +} + + +readme { + maturity = Maturity.EXPERIMENTAL +} diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ArrayBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/BufferBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/DotBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ExpressionsInterpretersBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/MatrixInverseBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/NDFieldBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorBenchmark.kt diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt b/benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt similarity index 100% rename from examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt rename to benchmarks/src/jvmMain/kotlin/space/kscience/kmath/benchmarks/ViktorLogBenchmark.kt diff --git a/build.gradle.kts b/build.gradle.kts index 9b2200cb4..aeb4a6061 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ allprojects { } group = "space.kscience" - version = "0.3.0-dev-6" + version = "0.3.0-dev-7" } subprojects { diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 98d7b7073..8bd9423fe 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -8,29 +8,20 @@ import ru.mipt.npm.gradle.Maturity plugins { kotlin("jvm") - kotlin("plugin.allopen") - id("org.jetbrains.kotlinx.benchmark") } -allOpen.annotation("org.openjdk.jmh.annotations.State") -sourceSets.register("benchmarks") - repositories { + mavenCentral() jcenter() maven("https://repo.kotlin.link") maven("https://clojars.org/repo") maven("https://dl.bintray.com/egor-bogomolov/astminer/") maven("https://dl.bintray.com/hotkeytlt/maven") - maven("https://dl.bintray.com/kotlin/kotlin-eap") - maven("https://dl.bintray.com/kotlin/kotlinx") - maven("https://dl.bintray.com/mipt-npm/dev") - maven("https://dl.bintray.com/mipt-npm/kscience") maven("https://jitpack.io") maven{ setUrl("http://logicrunch.research.it.uu.se/maven/") isAllowInsecureProtocol = true } - mavenCentral() } dependencies { @@ -48,7 +39,6 @@ dependencies { implementation(project(":kmath-for-real")) - implementation("org.deeplearning4j:deeplearning4j-core:1.0.0-beta7") implementation("org.nd4j:nd4j-native:1.0.0-beta7") // uncomment if your system supports AVX2 @@ -61,62 +51,9 @@ dependencies { // } else implementation("org.nd4j:nd4j-native-platform:1.0.0-beta7") - implementation("org.jetbrains.kotlinx:kotlinx-io:0.2.0-npm-dev-11") - implementation("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.3.0") implementation("org.slf4j:slf4j-simple:1.7.30") - // plotting - implementation("kscience.plotlykt:plotlykt-server:0.3.1-dev") - - "benchmarksImplementation"("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-20") - "benchmarksImplementation"(sourceSets.main.get().output + sourceSets.main.get().runtimeClasspath) -} - -// Configure benchmark -benchmark { - // Setup configurations - targets.register("benchmarks") - // This one matches sourceSet name above - - configurations.register("buffer") { - warmups = 1 // number of warmup iterations - iterations = 3 // number of iterations - iterationTime = 500 // time in seconds per iteration - iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds - include("BufferBenchmark") - } - - configurations.register("dot") { - warmups = 1 // number of warmup iterations - iterations = 3 // number of iterations - iterationTime = 500 // time in seconds per iteration - iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds - include("DotBenchmark") - } - - configurations.register("expressions") { - warmups = 1 // number of warmup iterations - iterations = 3 // number of iterations - iterationTime = 500 // time in seconds per iteration - iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds - include("ExpressionsInterpretersBenchmark") - } - - configurations.register("matrixInverse") { - warmups = 1 // number of warmup iterations - iterations = 3 // number of iterations - iterationTime = 500 // time in seconds per iteration - iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds - include("MatrixInverseBenchmark") - } - - configurations.register("bigInt") { - warmups = 1 // number of warmup iterations - iterations = 3 // number of iterations - iterationTime = 500 // time in seconds per iteration - iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds - include("BigIntBenchmark") - } + implementation("space.kscience:plotlykt-server:0.4.0-dev-2") } kotlin.sourceSets.all { diff --git a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt index be4dc461b..028985260 100644 --- a/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt +++ b/examples/src/main/kotlin/space/kscience/kmath/commons/fit/fitWithAutoDiff.kt @@ -7,9 +7,6 @@ package space.kscience.kmath.commons.fit import kotlinx.html.br import kotlinx.html.h3 -import kscience.plotly.* -import kscience.plotly.models.ScatterMode -import kscience.plotly.models.TraceValues import space.kscience.kmath.commons.optimization.chiSquared import space.kscience.kmath.commons.optimization.minimize import space.kscience.kmath.distributions.NormalDistribution @@ -22,6 +19,9 @@ import space.kscience.kmath.real.step import space.kscience.kmath.stat.RandomGenerator import space.kscience.kmath.structures.asIterable import space.kscience.kmath.structures.toList +import space.kscience.plotly.* +import space.kscience.plotly.models.ScatterMode +import space.kscience.plotly.models.TraceValues import kotlin.math.pow import kotlin.math.sqrt diff --git a/kmath-complex/build.gradle.kts b/kmath-complex/build.gradle.kts index 43911e70d..1c2e8a0a2 100644 --- a/kmath-complex/build.gradle.kts +++ b/kmath-complex/build.gradle.kts @@ -12,10 +12,6 @@ plugins { } kotlin.sourceSets { - all { - languageSettings.useExperimentalAnnotation("kscience.kmath.misc.UnstableKMathAPI") - } - commonMain { dependencies { api(project(":kmath-core")) diff --git a/kmath-dimensions/build.gradle.kts b/kmath-dimensions/build.gradle.kts index a9a9177c0..885f3c227 100644 --- a/kmath-dimensions/build.gradle.kts +++ b/kmath-dimensions/build.gradle.kts @@ -1,8 +1,3 @@ -/* - * Copyright 2018-2021 KMath contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - plugins { kotlin("multiplatform") id("ru.mipt.npm.gradle.common") diff --git a/kmath-ejml/build.gradle.kts b/kmath-ejml/build.gradle.kts index 6ae0dcec6..d3a49aeb0 100644 --- a/kmath-ejml/build.gradle.kts +++ b/kmath-ejml/build.gradle.kts @@ -1,10 +1,3 @@ -/* - * Copyright 2018-2021 KMath contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -import ru.mipt.npm.gradle.Maturity - plugins { kotlin("jvm") id("ru.mipt.npm.gradle.common") @@ -16,7 +9,7 @@ dependencies { } readme { - maturity = Maturity.PROTOTYPE + maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) feature( diff --git a/kmath-for-real/build.gradle.kts b/kmath-for-real/build.gradle.kts index fc454205b..f6d12decd 100644 --- a/kmath-for-real/build.gradle.kts +++ b/kmath-for-real/build.gradle.kts @@ -1,10 +1,3 @@ -/* - * Copyright 2018-2021 KMath contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -import ru.mipt.npm.gradle.Maturity - plugins { kotlin("multiplatform") id("ru.mipt.npm.gradle.common") @@ -22,7 +15,7 @@ readme { All operations are specialized to work with `Double` numbers without declaring algebraic contexts. One can still use generic algebras though. """.trimIndent() - maturity = Maturity.EXPERIMENTAL + maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL propertyByTemplate("artifact", rootProject.file("docs/templates/ARTIFACT-TEMPLATE.md")) feature( diff --git a/settings.gradle.kts b/settings.gradle.kts index babad3672..553367a22 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -44,5 +44,6 @@ include( ":kmath-ast", ":kmath-ejml", ":kmath-kotlingrad", - ":examples" + ":examples", + ":benchmarks" )