Skip to content

Using SIMD

echo edited this page May 3, 2025 · 2 revisions

Starting from version 2.8, Brain4J includes SIMD (Single Instruction, Multiple Data) support via the Java Vector API (JEP 448). This enables significant performance improvements by leveraging hardware-level parallelism.

For technical details and implementation discussions, refer to the related pull request.

Enabling SIMD

To take advantage of SIMD acceleration, you must explicitly enable the jdk.incubator.vector module when running your application. This can be done in two main ways:

Using Gradle

If you're using Gradle, add this piece of code to your build.gradle:

tasks.withType(JavaExec).configureEach {
    jvmArgs(['--add-modules', 'jdk.incubator.vector'])
}

Using JVM options

Alternatively, you can enable the module via JVM options. Add the following argument when launching your application:

--add-modules jdk.incubator.vector

Next Steps

Check out Benchmark & Performance

Clone this wiki locally