YingyiLiu / HAMS

An open-source computer program for the analysis of wave diffraction and radiation of three-dimensional floating or submerged structures
Apache License 2.0
100 stars 50 forks source link

Non-repeatable results when multi-threading #22

Closed mancellin closed 1 year ago

mancellin commented 1 year ago

I'm having issues compiling and testing HAMS on my machine (Ubuntu 20.04 with gfortran 9.4).

When I download, compile and run the code as follow

git clone https://github.com/YingyiLiu/HAMS.git
cd HAMS/SourceCode/
make
cd ../CertTest/DeepCwind/
../../SourceCode/hams

I get different results on each run of ../../SourceCode/hams.

For instance in Output/Hams_format/OAMASS1.txt, I have

 0.500   2.214    0.27740E+07   0.00000E+00   0.31715E+06   0.00000E+00  -0.33709E+08   0.00000E+00
 1.000   3.132    0.73216E+07   0.00000E+00  -0.24310E+07   0.00000E+00   0.14162E+08   0.00000E+00
 1.500   3.835    0.24118E+08   0.00000E+00   0.12985E+07   0.00000E+00  -0.10962E+09   0.00000E+00

on one run and then

  0.500   2.214    0.76511E+07   0.00000E+00  -0.50949E+06   0.00000E+00  -0.10919E+09   0.00000E+00
  1.000   3.132    0.12852E+08   0.00000E+00   0.33807E+06   0.00000E+00  -0.13791E+09   0.00000E+00
  1.500   3.835    0.19945E+08   0.00000E+00  -0.12422E+07   0.00000E+00  -0.21800E+09   0.00000E+00

on the next.

It might be a multi-threading issue: when I fix the number of threads to 1 in the ControlFile.ini, then I get repeatable results that match the reference data.

mancellin commented 1 year ago

The same seems to hold in your CI tests : https://github.com/mancellin/HAMS/pull/1 The code compiles and runs fine but the output does not seem right when the number of threads is higher than 1.

mancellin commented 1 year ago

Could be due to https://github.com/Hui-Liang/Green-function-in-deep-water/issues/1

YingyiLiu commented 1 year ago

Dear Matthieu,

Really sorry that I haven't responded promptly to your request. And I do appreciate your contribution to finding the error and solving the issue. Your commits are all accepted. Thank you.

Best regards, Yingyi