GlobalArrays / ga

Partitioned Global Address Space (PGAS) library for distributed arrays
http://hpc.pnl.gov/globalarrays/
Other
96 stars 38 forks source link

Question about Thread safe with openmp #305

Closed jsboer closed 1 year ago

jsboer commented 1 year ago

Hi, Does GA support mulithreads call? I mean, in the following situations, can they all get right result?

thank you!

jeffhammond commented 1 year ago

Probably not, based on the last time I checked and the static arrays GA used. It's also likely that even if it's thread-safe, it uses coarse-grain locking to do so, and thus you're better off just using OpenMP critical or equivalent.

The problem with thread safety in Comm libs is that they have to do it unconditionally. If you do it, you don't apply any overhead unless you need it. That is, GA calls outside of threaded regions don't need any thread safety overhead.

jsboer commented 1 year ago

Probably not, based on the last time I checked and the static arrays GA used. It's also likely that even if it's thread-safe, it uses coarse-grain locking to do so, and thus you're better off just using OpenMP critical or equivalent.

The problem with thread safety in Comm libs is that they have to do it unconditionally. If you do it, you don't apply any overhead unless you need it. That is, GA calls outside of threaded regions don't need any thread safety overhead.

Ok, that's help, thank you!