Merge pull request #951 from paulromano/runtime-sched

Allow OMP_SCHEDULE to control schedule of main parallel do loop
This commit is contained in:
salcedop 2018-01-13 12:03:31 -05:00 committed by GitHub
commit b9286c0322
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -45,6 +45,9 @@ contains
integer, intent(in), optional :: intracomm ! MPI intracommunicator
integer :: err
#ifdef _OPENMP
character(MAX_WORD_LEN) :: envvar
#endif
! Copy the communicator to a new variable. This is done to avoid changing
! the signature of this subroutine. If MPI is being used but no communicator
@ -76,6 +79,14 @@ contains
call initialize_mpi(comm)
#endif
#ifdef _OPENMP
! Change schedule of main parallel-do loop if OMP_SCHEDULE is set
call get_environment_variable("OMP_SCHEDULE", envvar)
if (len_trim(envvar) == 0) then
call omp_set_schedule(omp_sched_static, 0)
end if
#endif
! Initialize HDF5 interface
call hdf5_initialize()

View file

@ -101,7 +101,7 @@ contains
! ====================================================================
! LOOP OVER PARTICLES
!$omp parallel do schedule(static) firstprivate(p) copyin(tally_derivs)
!$omp parallel do schedule(runtime) firstprivate(p) copyin(tally_derivs)
PARTICLE_LOOP: do i_work = 1, work
current_work = i_work