Kotlin / multik

Multidimensional array library for Kotlin
https://kotlin.github.io/multik/
Apache License 2.0
633 stars 38 forks source link

Race condition issue in loading of openblas #174

Closed MPopovych closed 5 months ago

MPopovych commented 11 months ago

Minimal sample to reproduce: https://github.com/MPopovych/MultikRaceConditionIssue/blob/main/src/main/kotlin/Main.kt

System: MacOS 13.0.1 M1 Pro Ide: Intellij Dependencies:

Description: Calling on any linear algebra method from multiple threads causes multiple calls on JvmNativeEngine -> Loader::load() This then leads to a collision of Files.copy and an java.nio.file.FileAlreadyExistsException is thrown

To work around this I am pre initialising the library with a Synchronized annotation, but this can be done on the library level