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

Einstein Toolkit trac-noreply at einsteintoolkit.org
Mon Oct 8 10:56:43 CDT 2012


#928: openmp parallelization within Exact broken
------------------------------------+---------------------------------------
  Reporter:  knarf                  |       Owner:                     
      Type:  defect                 |      Status:  confirmed          
  Priority:  minor                  |   Milestone:  ET_2012_11         
 Component:  EinsteinToolkit thorn  |     Version:  development version
Resolution:                         |    Keywords:                     
------------------------------------+---------------------------------------

Comment (by eschnett):

 {{{
 if (first_call) then
    !$omp critical
    if (first_call) then
       initialise stuff
       !$omp flush
       first_call = .false.
    end if
    !$omp end critical
 end if
 }}}

 I believe (would need to check the standard) that another flush is implied
 at the end of the critical region.

 I am not sure whether it is legal to read first_call while it may
 simultaneously be written inside the critical region. I believe this is
 not legal. One would need to move the read of first_call into the critical
 region as well (very expensive, bad idea), or use an atomic operation to
 read/write first_call:

 {{{
 !$omp atomic
 my_first_call = first_call
 if (my_first_call) then
    !$omp critical
    if (first_call) then
       initialise stuff
    end if
    !$omp end critical
    !$omp atomic
    first_call = .false.
 end if
 }}}

 In any way, this is getting way more complicated than it should be.
 Threadprivate variables are clearly much simpler, and if they work, I
 would prefer to use them.

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


More information about the Trac mailing list