Changeset 3852


Ignore:
Timestamp:
Jul 16, 2025, 4:10:15 PM (6 weeks ago)
Author:
jmauxion
Message:

Mars PCM:
Improve the omp_chunk computation to fix a MPI request error arising for some combinations of llm/omp_size:

  • Make sure that the omp_chunk is not too large so that the last thread do nothing.
  • Check and raise a warning if the chunk is so small that the loop distribution require a second cycle over the threads (which is not optimum).

JM

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/dyn3dpar/parallel_lmdz.F90

    r1683 r3852  
    191191      omp_chunk=(llm+1)/omp_size
    192192      IF (MOD(llm+1,omp_size)/=0) omp_chunk=omp_chunk+1
     193     
     194      ! Jonah: for some combinations of llm/omp_size, the chunk
     195      ! is such that at least one thread is given no task inside
     196      ! "DO SCHEDULE" (e.g when filling MPI buffers to send/recv).
     197      ! This leads these "idle" threads to trigger MPI_Waitall
     198      ! while no instruction send/recv was emitted, resulting in a request error.
     199      ! Fix:
     200      do while (((omp_chunk*(omp_size-1))>=(llm+1)).and.(omp_chunk>=1))
     201        omp_chunk=omp_chunk-1
     202      end do
     203      ! Jonah: connected to the above, one must check that the chunk is
     204      ! still big enough to prevent cyclic distribution of tasks
     205      ! (i.e. first thread is distributed two packs of iterations due to
     206      ! the last thread being unable to complete the loop), which is not optimum
     207      if ((omp_chunk*omp_size)<(llm+1)) then
     208         print *, 'Warning: the current OMP chunk is too small and would trigger ', &
     209                  'cycling scheduling. You should consider reducing the number of OMP threads.'
     210      endif
    193211      CALL getin('omp_chunk',omp_chunk)
    194212!$OMP END MASTER
  • trunk/LMDZ.MARS/changelog.txt

    r3849 r3852  
    49134913== 15/07/2025 == JBC
    49144914Simplification and generalization of the "display_netcdf.py" script which can now handle more cases of shapes/dimensions in the variables + using 'pcolormesh' instead of 'imshow' to better stick to the original data.
     4915
     4916== 16/07/2025 == JM
     4917Improve the omp_chunk computation to fix a MPI request error arising for some combinations of llm/omp_size:
     4918- Make sure that the omp_chunk is not too large so that the last thread do nothing.
     4919- Check and raise a warning if the chunk is so small that the loop distribution require a second cycle over the threads (which is not optimum).
     4920
Note: See TracChangeset for help on using the changeset viewer.