2021-04-16 22:43:10 +03:00
|
|
|
plugins {
|
|
|
|
kotlin("multiplatform")
|
|
|
|
kotlin("plugin.allopen")
|
|
|
|
id("org.jetbrains.kotlinx.benchmark")
|
|
|
|
}
|
|
|
|
|
|
|
|
allOpen.annotation("org.openjdk.jmh.annotations.State")
|
|
|
|
sourceSets.register("benchmarks")
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven("https://repo.kotlin.link")
|
|
|
|
maven("https://clojars.org/repo")
|
|
|
|
maven("https://jitpack.io")
|
2021-04-28 14:03:28 +03:00
|
|
|
maven("http://logicrunch.research.it.uu.se/maven") {
|
2021-04-16 22:43:10 +03:00
|
|
|
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"))
|
2021-06-08 16:49:55 +03:00
|
|
|
implementation(project(":kmath-jafama"))
|
2021-04-16 22:43:10 +03:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
2021-04-20 17:39:45 +03:00
|
|
|
fun kotlinx.benchmark.gradle.BenchmarkConfiguration.commonConfiguration() {
|
|
|
|
warmups = 1
|
|
|
|
iterations = 5
|
|
|
|
iterationTime = 1000
|
|
|
|
iterationTimeUnit = "ms"
|
|
|
|
}
|
|
|
|
|
2021-04-16 22:43:10 +03:00
|
|
|
configurations.register("buffer") {
|
2021-04-20 17:39:45 +03:00
|
|
|
commonConfiguration()
|
2021-04-16 22:43:10 +03:00
|
|
|
include("BufferBenchmark")
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations.register("dot") {
|
2021-04-20 17:39:45 +03:00
|
|
|
commonConfiguration()
|
2021-04-16 22:43:10 +03:00
|
|
|
include("DotBenchmark")
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations.register("expressions") {
|
2021-04-20 17:39:45 +03:00
|
|
|
commonConfiguration()
|
2021-04-16 22:43:10 +03:00
|
|
|
include("ExpressionsInterpretersBenchmark")
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations.register("matrixInverse") {
|
2021-04-20 17:39:45 +03:00
|
|
|
commonConfiguration()
|
2021-04-16 22:43:10 +03:00
|
|
|
include("MatrixInverseBenchmark")
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations.register("bigInt") {
|
2021-04-20 17:39:45 +03:00
|
|
|
commonConfiguration()
|
2021-04-16 22:43:10 +03:00
|
|
|
include("BigIntBenchmark")
|
|
|
|
}
|
2021-06-08 16:49:55 +03:00
|
|
|
|
|
|
|
configurations.register("jafamaDouble") {
|
|
|
|
commonConfiguration()
|
|
|
|
include("JafamaBenchmark")
|
|
|
|
}
|
2021-04-16 22:43:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fix kotlinx-benchmarks bug
|
|
|
|
afterEvaluate {
|
|
|
|
val jvmBenchmarkJar by tasks.getting(org.gradle.jvm.tasks.Jar::class) {
|
2021-04-20 17:39:45 +03:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2021-04-16 22:43:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kotlin.sourceSets.all {
|
|
|
|
with(languageSettings) {
|
|
|
|
useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
|
|
|
|
useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
|
|
|
useExperimentalAnnotation("space.kscience.kmath.misc.UnstableKMathAPI")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "11"
|
|
|
|
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
readme {
|
2021-04-20 17:39:45 +03:00
|
|
|
maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL
|
2021-04-16 22:43:10 +03:00
|
|
|
}
|