Kotlin / Kotlin/multik

Flaky: NativeLinAlg.dot matrix-matrix ComplexDouble returns wrong result on Linux

Open
#282 0 comments 0 reactions 0 assignees View on GitHub
ai-generated bug
Dominant language
Kotlin
Stars
734
Forks
51
Avg merge
9h 52m
Merged PRs (30d)
6

Description

### Multik version

0.3.0

### Module

multik-openblas

### Platform

JVM

### Operating System

Linux

### Description

`NativeLinAlg.dot` for matrix-matrix multiplication with `ComplexDouble` produces incorrect results intermittently on Linux (Ubuntu 22.04.5 LTS, gcc-12 12.3.0, JDK 21 Temurin). The test uses small integer ComplexDouble matrices with exact expected values and `assertEquals` — no tolerance. Failed in 3 out of 4 CI runs, making it the most frequently failing test.

### Reproducer

```kotlin
val matrix1 = mk.ndarray(
mk[mk[ComplexDouble(1, 2), ComplexDouble(3, 4)],
mk[ComplexDouble(2, 3), ComplexDouble(4, 5)],
mk[ComplexDouble(3, 4), ComplexDouble(5, 6)]]
)
val matrix2 = mk.ndarray(
mk[mk[ComplexDouble(9, 8), ComplexDouble(7, 6), ComplexDouble(5, 4)],
mk[ComplexDouble(8, 7), ComplexDouble(6, 5), ComplexDouble(4, 3)]]
)

val actual = NativeLinAlg.dot(matrix1, matrix2)
assertEquals(expected, actual) // Fails intermittently
```

### Additional information

```text
Flaky — failed in 3/4 CI runs.
All failures are AssertionFailedError at NativeLinAlgTest.kt:134.
CI runs: 22511673326, 22511741037, 22511767151.
Environment: Ubuntu 22.04.5 LTS, gcc-12 (12.3.0), g++-12, JDK 21 Temurin, x86_64.
```

Contributor guide

Open the contributing guide

Research direction

Start with NativeLinAlgTest.kt:134 and run the ComplexDouble matrix-matrix dot test using the reported Ubuntu, gcc-12, and JDK 21 environment. Trace the NativeLinAlg.dot path in the multik-openblas module and compare repeated runs with the provided reproducer; done means the expected exact result is returned consistently without intermittent CI failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.