Refactor for build tools 0.13.0

This commit is contained in:
Alexander Nozik 2022-09-04 20:59:30 +03:00
parent 0c1d0aa64e
commit ad97751327
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
37 changed files with 136 additions and 64 deletions

View File

@ -1,3 +1,6 @@
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam
plugins { plugins {
id("space.kscience.gradle.project") id("space.kscience.gradle.project")
id("org.jetbrains.kotlinx.kover") version "0.5.0" id("org.jetbrains.kotlinx.kover") version "0.5.0"
@ -68,8 +71,12 @@ subprojects {
readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md") readme.readmeTemplate = file("docs/templates/README-TEMPLATE.md")
ksciencePublish { ksciencePublish {
github("kmath", addToRelease = false) pom("https://github.com/SciProgCentre/kmath") {
space() useApache2Licence()
useSPCTeam()
}
github("kmath", "SciProgCentre", addToRelease = false)
space("https://maven.pkg.jetbrains.space/mipt-npm/p/sci/dev")
sonatype() sonatype()
} }

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.structures package space.kscience.kmath.structures
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.nd.* import space.kscience.kmath.nd.*
import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.DoubleField
import space.kscience.kmath.operations.ExtendedField import space.kscience.kmath.operations.ExtendedField
@ -49,6 +50,7 @@ class StreamDoubleFieldND(override val shape: IntArray) : FieldND<Double, Double
return BufferND(strides, array.asBuffer()) return BufferND(strides, array.asBuffer())
} }
@OptIn(PerformancePitfall::class)
override fun StructureND<Double>.map( override fun StructureND<Double>.map(
transform: DoubleField.(Double) -> Double, transform: DoubleField.(Double) -> Double,
): BufferND<Double> { ): BufferND<Double> {
@ -56,6 +58,7 @@ class StreamDoubleFieldND(override val shape: IntArray) : FieldND<Double, Double
return BufferND(strides, array.asBuffer()) return BufferND(strides, array.asBuffer())
} }
@OptIn(PerformancePitfall::class)
override fun StructureND<Double>.mapIndexed( override fun StructureND<Double>.mapIndexed(
transform: DoubleField.(index: IntArray, Double) -> Double, transform: DoubleField.(index: IntArray, Double) -> Double,
): BufferND<Double> { ): BufferND<Double> {
@ -69,6 +72,7 @@ class StreamDoubleFieldND(override val shape: IntArray) : FieldND<Double, Double
return BufferND(strides, array.asBuffer()) return BufferND(strides, array.asBuffer())
} }
@OptIn(PerformancePitfall::class)
override fun zip( override fun zip(
left: StructureND<Double>, left: StructureND<Double>,
right: StructureND<Double>, right: StructureND<Double>,

View File

@ -5,6 +5,7 @@
package space.kscience.kmath.tensors package space.kscience.kmath.tensors
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.operations.invoke import space.kscience.kmath.operations.invoke
import space.kscience.kmath.tensors.core.DoubleTensor import space.kscience.kmath.tensors.core.DoubleTensor
import space.kscience.kmath.tensors.core.DoubleTensorAlgebra import space.kscience.kmath.tensors.core.DoubleTensorAlgebra
@ -13,6 +14,7 @@ import kotlin.math.abs
// OLS estimator using SVD // OLS estimator using SVD
@OptIn(PerformancePitfall::class)
fun main() { fun main() {
//seed for random //seed for random
val randSeed = 100500L val randSeed = 100500L

View File

@ -3,8 +3,11 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@file:OptIn(PerformancePitfall::class)
package space.kscience.kmath.tensors package space.kscience.kmath.tensors
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.operations.invoke import space.kscience.kmath.operations.invoke
import space.kscience.kmath.tensors.core.BroadcastDoubleTensorAlgebra import space.kscience.kmath.tensors.core.BroadcastDoubleTensorAlgebra
import space.kscience.kmath.tensors.core.DoubleTensor import space.kscience.kmath.tensors.core.DoubleTensor

View File

@ -12,4 +12,4 @@ org.gradle.configureondemand=true
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096m org.gradle.jvmargs=-Xmx4096m
toolsVersion=0.12.0-kotlin-1.7.20-Beta toolsVersion=0.13.0-kotlin-1.7.20-Beta

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -1,6 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
kscience{
native()
} }
kotlin.js { kotlin.js {

View File

@ -0,0 +1,9 @@
/*
* Copyright 2018-2022 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.
*/
package space.kscience.kmath.ast.rendering
internal actual fun Double.multiplatformToString(): String = toString()
internal actual fun Float.multiplatformToString(): String = toString()

View File

@ -0,0 +1,10 @@
/*
* Copyright 2018-2022 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.
*/
package space.kscience.kmath.ast
internal actual inline fun runCompilerTest(action: CompilerTestContext.() -> Unit) {
//doNothing
}

View File

@ -1,6 +1,5 @@
plugins { plugins {
kotlin("jvm") id("space.kscience.gradle.jvm")
id("space.kscience.gradle.common")
} }
description = "Commons math binding for kmath" description = "Commons math binding for kmath"

View File

@ -1,7 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
id("space.kscience.gradle.native")
kscience {
native()
} }
kotlin.sourceSets { kotlin.sourceSets {

View File

@ -1,6 +1,13 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
dependencies {
api(project(":kmath-memory"))
}
} }
kotlin.sourceSets { kotlin.sourceSets {
@ -10,19 +17,7 @@ kotlin.sourceSets {
it.optIn("space.kscience.kmath.misc.PerformancePitfall") it.optIn("space.kscience.kmath.misc.PerformancePitfall")
it.optIn("space.kscience.kmath.misc.UnstableKMathAPI") it.optIn("space.kscience.kmath.misc.UnstableKMathAPI")
} }
commonMain {
dependencies {
api(project(":kmath-memory"))
} }
}
}
//generateUml {
// classTree {
//
// }
//}
readme { readme {
description = "Core classes, algebra definitions, basic linear algebra" description = "Core classes, algebra definitions, basic linear algebra"

View File

@ -1,7 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
id("space.kscience.gradle.native")
kscience{
native()
} }
kotlin.sourceSets { kotlin.sourceSets {

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
} }
description = "A proof of concept module for adding type-safe dimensions to structures" description = "A proof of concept module for adding type-safe dimensions to structures"

View File

@ -1,8 +1,7 @@
import space.kscience.kmath.ejml.codegen.ejmlCodegen import space.kscience.kmath.ejml.codegen.ejmlCodegen
plugins { plugins {
kotlin("jvm") id("space.kscience.gradle.jvm")
id("space.kscience.gradle.common")
} }
dependencies { dependencies {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright 2018-2022 KMath contributors. * 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. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/ */
/* This file is generated with buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt */ /* This file is generated with buildSrc/src/main/kotlin/space/kscience/kmath/ejml/codegen/ejmlCodegen.kt */

View File

@ -1,7 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
id("space.kscience.gradle.native")
kscience{
native()
} }
kotlin.sourceSets.commonMain { kotlin.sourceSets.commonMain {

View File

@ -1,7 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
id("space.kscience.gradle.native")
kscience{
native()
} }
description = "Functions, integration and interpolation" description = "Functions, integration and interpolation"

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
} }
kotlin.sourceSets.commonMain { kotlin.sourceSets.commonMain {

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
} }
//apply(plugin = "kotlinx-atomicfu") //apply(plugin = "kotlinx-atomicfu")

View File

@ -1,6 +1,5 @@
plugins { plugins {
kotlin("jvm") id("space.kscience.gradle.jvm")
id("space.kscience.gradle.common")
} }
kotlin.sourceSets kotlin.sourceSets

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience {
native()
} }
readme { readme {

View File

@ -6,6 +6,7 @@
package space.kscience.kmath.multik package space.kscience.kmath.multik
import org.jetbrains.kotlinx.multik.default.DefaultEngine import org.jetbrains.kotlinx.multik.default.DefaultEngine
import space.kscience.kmath.misc.PerformancePitfall
import space.kscience.kmath.nd.StructureND import space.kscience.kmath.nd.StructureND
import space.kscience.kmath.nd.one import space.kscience.kmath.nd.one
import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.DoubleField
@ -14,6 +15,7 @@ import space.kscience.kmath.tensors.core.tensorAlgebra
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertTrue import kotlin.test.assertTrue
@OptIn(PerformancePitfall::class)
internal class MultikNDTest { internal class MultikNDTest {
val multikAlgebra = MultikDoubleAlgebra(DefaultEngine()) val multikAlgebra = MultikDoubleAlgebra(DefaultEngine())

View File

@ -1,6 +1,5 @@
plugins { plugins {
kotlin("jvm") id("space.kscience.gradle.jvm")
id("space.kscience.gradle.common")
} }
description = "ND4J NDStructure implementation and according NDAlgebra classes" description = "ND4J NDStructure implementation and according NDAlgebra classes"

View File

@ -45,6 +45,7 @@ public sealed interface Nd4jArrayAlgebra<T, out C : Algebra<T>> : AlgebraND<T, C
return newStruct return newStruct
} }
@OptIn(PerformancePitfall::class)
override fun StructureND<T>.mapIndexed( override fun StructureND<T>.mapIndexed(
transform: C.(index: IntArray, T) -> T, transform: C.(index: IntArray, T) -> T,
): Nd4jArrayStructure<T> { ): Nd4jArrayStructure<T> {
@ -53,6 +54,7 @@ public sealed interface Nd4jArrayAlgebra<T, out C : Algebra<T>> : AlgebraND<T, C
return new return new
} }
@OptIn(PerformancePitfall::class)
override fun zip( override fun zip(
left: StructureND<T>, left: StructureND<T>,
right: StructureND<T>, right: StructureND<T>,

View File

@ -40,12 +40,15 @@ public sealed interface Nd4jTensorAlgebra<T : Number, A : Field<T>> : AnalyticTe
override fun structureND(shape: Shape, initializer: A.(IntArray) -> T): Nd4jArrayStructure<T> override fun structureND(shape: Shape, initializer: A.(IntArray) -> T): Nd4jArrayStructure<T>
@OptIn(PerformancePitfall::class)
override fun StructureND<T>.map(transform: A.(T) -> T): Nd4jArrayStructure<T> = override fun StructureND<T>.map(transform: A.(T) -> T): Nd4jArrayStructure<T> =
structureND(shape) { index -> elementAlgebra.transform(get(index)) } structureND(shape) { index -> elementAlgebra.transform(get(index)) }
@OptIn(PerformancePitfall::class)
override fun StructureND<T>.mapIndexed(transform: A.(index: IntArray, T) -> T): Nd4jArrayStructure<T> = override fun StructureND<T>.mapIndexed(transform: A.(index: IntArray, T) -> T): Nd4jArrayStructure<T> =
structureND(shape) { index -> elementAlgebra.transform(index, get(index)) } structureND(shape) { index -> elementAlgebra.transform(index, get(index)) }
@OptIn(PerformancePitfall::class)
override fun zip(left: StructureND<T>, right: StructureND<T>, transform: A.(T, T) -> T): Nd4jArrayStructure<T> { override fun zip(left: StructureND<T>, right: StructureND<T>, transform: A.(T, T) -> T): Nd4jArrayStructure<T> {
require(left.shape.contentEquals(right.shape)) require(left.shape.contentEquals(right.shape))
return structureND(left.shape) { index -> elementAlgebra.transform(left[index], right[index]) } return structureND(left.shape) { index -> elementAlgebra.transform(left[index], right[index]) }

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
} }
kotlin.sourceSets { kotlin.sourceSets {

View File

@ -1,7 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
// Disable native target to avoid CI crashes }
// id("space.kscience.gradle.native")
kscience{
native()
} }
description = "Polynomials, rational functions, and utilities" description = "Polynomials, rational functions, and utilities"

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
} }
kotlin.sourceSets { kotlin.sourceSets {

View File

@ -4,8 +4,7 @@
*/ */
plugins { plugins {
kotlin("jvm") id("space.kscience.gradle.jvm")
id("space.kscience.gradle.common")
} }
description = "Symja integration module" description = "Symja integration module"

View File

@ -93,6 +93,7 @@ public fun DoubleField.produceWithTF(
* *
* The resulting tensors are available outside of scope * The resulting tensors are available outside of scope
*/ */
@OptIn(UnstableKMathAPI::class)
public fun DoubleField.produceMapWithTF( public fun DoubleField.produceMapWithTF(
block: DoubleTensorFlowAlgebra.() -> Map<Symbol, StructureND<Double>>, block: DoubleTensorFlowAlgebra.() -> Map<Symbol, StructureND<Double>>,
): Map<Symbol, StructureND<Double>> = Graph().use { graph -> ): Map<Symbol, StructureND<Double>> = Graph().use { graph ->

View File

@ -6,6 +6,7 @@
package space.kscience.kmath.tensorflow package space.kscience.kmath.tensorflow
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import space.kscience.kmath.misc.UnstableKMathAPI
import space.kscience.kmath.nd.get import space.kscience.kmath.nd.get
import space.kscience.kmath.nd.structureND import space.kscience.kmath.nd.structureND
import space.kscience.kmath.operations.DoubleField import space.kscience.kmath.operations.DoubleField
@ -13,6 +14,7 @@ import space.kscience.kmath.tensors.core.DoubleTensorAlgebra
import space.kscience.kmath.tensors.core.DoubleTensorAlgebra.Companion.sum import space.kscience.kmath.tensors.core.DoubleTensorAlgebra.Companion.sum
import kotlin.test.assertEquals import kotlin.test.assertEquals
@OptIn(UnstableKMathAPI::class)
class DoubleTensorFlowOps { class DoubleTensorFlowOps {
@Test @Test
fun basicOps() { fun basicOps() {

View File

@ -1,7 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
id("space.kscience.gradle.native")
kscience{
native()
} }
kotlin.sourceSets { kotlin.sourceSets {

View File

@ -1,7 +1,9 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.common") }
id("space.kscience.gradle.native")
kscience{
native()
} }
kotlin.sourceSets.commonMain { kotlin.sourceSets.commonMain {

View File

@ -1,13 +1,12 @@
plugins { plugins {
kotlin("jvm") id("space.kscience.gradle.jvm")
id("space.kscience.gradle.common")
} }
description = "Binding for https://github.com/JetBrains-Research/viktor" description = "Binding for https://github.com/JetBrains-Research/viktor"
dependencies { dependencies {
api(project(":kmath-core")) api(project(":kmath-core"))
api("org.jetbrains.bio:viktor:1.1.0") api("org.jetbrains.bio:viktor:1.2.0")
} }
readme { readme {

View File

@ -13,7 +13,7 @@ import space.kscience.kmath.structures.MutableBuffer
@JvmInline @JvmInline
public value class ViktorBuffer(public val flatArray: F64FlatArray) : MutableBuffer<Double> { public value class ViktorBuffer(public val flatArray: F64FlatArray) : MutableBuffer<Double> {
override val size: Int override val size: Int
get() = flatArray.size get() = flatArray.length
override inline fun get(index: Int): Double = flatArray[index] override inline fun get(index: Int): Double = flatArray[index]

View File

@ -1,6 +1,9 @@
plugins { plugins {
id("space.kscience.gradle.mpp") id("space.kscience.gradle.mpp")
id("space.kscience.gradle.native") }
kscience{
native()
} }
kotlin.sourceSets { kotlin.sourceSets {