Skip to content

JetBrains-Research/viktor

Repository files navigation

JetBrains Research tests

Maven Central

viktor

viktor implements a restricted subset of NumPy ndarray features in Kotlin using Java Vector API. Here are some highlights:

  • A single core data type --- F64Array, an n-dimensional primitive array.

  • Efficient vectorized operations, which are accelerated using SIMD whenever possible.

  • Semi-sweet syntax.

    val m = F64Array(4, 3)
    m.V[0] = F64Array.full(3, 42.0)  // row-view.
    m.V[_I, 0]                       // column-view.
    m.V[0] = 42.0                    // broadcasting.
    m + 0.5 * m                      // arithmetic operations.
    m.V[0].exp() + 1.0               // math functions.

Installation

The latest version of viktor is available on Maven Central. If you're using Gradle, just add the following to your build.gradle dependencies:

implementation 'org.jetbrains.bio:viktor:2.0.0'

or, equivalently, add the following to your build.gradle.kts dependencies:

implementation("org.jetbrains.bio:viktor:2.0.0")

With Maven, use the dependency

<dependency>
    <groupId>org.jetbrains.bio</groupId>
    <artifactId>viktor</artifactId>
    <version>2.0.0</version>
</dependency>

Versions

  • Viktor 2.0.0 relies fully on Java Vector API and requires at least Java 21.

    • Supports Vector API acceleration on all Java compatible platforms.
    • --add-modules jdk.incubator.vector is required since the API is still in incubator.
  • Viktor 1.2.0 supports Java 8, and relies on the boost.simd for SIMD acceleration.

    • SSE2 and AVX,
    • amd64 / x86-64,
    • Linux, Windows and MacOS.

Versions older than 1.1.0 can be downloaded from GitHub Releases.

Should you have any problems feel free to file an issue to the bug tracker.

Logging

viktor uses slf4j logging API to provide error messages. To see them, you have to add a slf4j implementation (also called a binding) to your project. For example, add the following Gradle dependency to use log4j:

dependencies {
    compile('org.slf4j:slf4j-log4j12:2.0.17')
}

Building from source

Use the following command line:

./gradlew jar

Note: don't use ./gradlew assemble, since it includes the signing of the artifacts and will fail if the correct credentials are not provided.

Testing

No extra configuration is required for running the tests from Gradle:

./gradlew test

Benchmarking

See benchmarking document for more details.

Publishing

Publishing to Maven Central is currently done via a dedicated build configuration of an internal TeamCity server. This allows us to deploy a cross-platform version.

Documentation

Visit viktor Documentation for an extensive feature overview, instructive code examples and benchmarking data.

About

Efficient f64-only ndarray in Kotlin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5