Control: retitle -1 libspooles2.2: multithreaded factor/solve race gives 
silently wrong results (arm64 often, amd64 rarely)

Dear Maintainer,

an addition to this report: the problem is not limited to arm64.

A third party measured it on x86_64 with the same upstream code (ccx 2.23 built 
with -DUSE_MT against stock
SPOOLES 2.2, GCC 14.3.1, Intel Xeon Platinum 8592+, linear static shell model 
with about 3.8k nodes):
 - 4 solver threads (CCX_NPROC_EQUATION_SOLVER=4): 19 of 600 runs wrong; one 
run at a time: 3 of 300
 - only the stiffness or result threads at 4: 0 of 600 each
 - solver at 1 thread (OMP_NUM_THREADS=4, CCX_NPROC_EQUATION_SOLVER=1): 0 of 
2000
 - buckling, another small model: 9 of 600 wrong with 4 solver threads, 0 of 
900 with 1
Wrong reaction forces were 54-232 instead of 50.69, every run exited with code 
0, and in several wrong runs one
of the reactions was still exact. Source:
https://github.com/Dhondtguido/CalculiX/issues/74

So amd64 is affected as well, at a rate of about 1-3 % per run instead of 
20-100 % on arm64. My own amd64 check in
the original report (0 of 20 runs under QEMU) was too small to show this. A 
likely mechanism on x86 is compiler
reordering of the plain, non-atomic loads and stores in the same places (list 
hand-off in ChvList/SubMtxList,
frontIsDone and the solve barriers); whether the patches remove it on x86 has 
not been tested yet.

Until a fixed libspooles2.2 is available, calculix-ccx users on any 
architecture can avoid the problem with
CCX_NPROC_EQUATION_SOLVER=1; the assembly and result threads are not affected. 
It may be worth documenting this
in calculix-ccx's README.Debian.

Kind regards
Maximilian Güttinger

Reply via email to