[ET Trac] [Einstein Toolkit] #928: openmp parallelization within Exact broken

Einstein Toolkit trac-noreply at einsteintoolkit.org
Fri May 25 10:08:21 CDT 2012


#928: openmp parallelization within Exact broken
---------------------+------------------------------------------------------
  Reporter:  knarf   |       Owner:            
      Type:  defect  |      Status:  new       
  Priority:  major   |   Milestone:  ET_2012_05
 Component:  Other   |     Version:            
Resolution:          |    Keywords:            
---------------------+------------------------------------------------------

Comment (by eschnett):

 No, this is not safe. Concurrent write access is not permitted by OpenMP.
 For example, a compiler may detect that this variable will be written to,
 and then use it as temporary storage for some other quantity, which may
 even have a different type. I believe gcc 4.7 has a respective
 optimisation (re-use of stack slots to reduce the size of stack frames),
 although I don't know whether it would be triggered in this case.

 In this case, the problem is that thread A begins to initialise this
 variable, then thread B notices this and will skip the initialisation and
 go on to use the presumed-initialised value only it hasn't actually
 finished being initialised.

 There are two other ways to correct this: either one does not "save" these
 variables (because the initialisation is very cheap anyway), or one
 initialises them in an "openmp single" region.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/928#comment:4>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list