use sensible defaults if shell NUM_THREADS is not given

This commit is contained in:
Martin Diehl 2021-04-22 08:04:02 +02:00
parent 3f8bd645d8
commit 74dd9bf589
1 changed files with 4 additions and 4 deletions

View File

@ -84,13 +84,13 @@ subroutine parallelization_init
!$ call get_environment_variable(name='OMP_NUM_THREADS',value=NumThreadsString,STATUS=got_env) !$ call get_environment_variable(name='OMP_NUM_THREADS',value=NumThreadsString,STATUS=got_env)
!$ if(got_env /= 0) then !$ if(got_env /= 0) then
!$ print*, 'Could not determine value of $OMP_NUM_THREADS' !$ print*, 'Could not get $OMP_NUM_THREADS, using default'
!$ OMP_NUM_THREADS = 1_pI32 !$ OMP_NUM_THREADS = 4_pI32
!$ else !$ else
!$ read(NumThreadsString,'(i6)') OMP_NUM_THREADS !$ read(NumThreadsString,'(i6)') OMP_NUM_THREADS
!$ if (OMP_NUM_THREADS < 1_pI32) then !$ if (OMP_NUM_THREADS < 1_pI32) then
!$ print*, 'Invalid OMP_NUM_THREADS: '//trim(NumThreadsString) !$ print*, 'Invalid OMP_NUM_THREADS: "'//trim(NumThreadsString)//'", using default'
!$ OMP_NUM_THREADS = 1_pI32 !$ OMP_NUM_THREADS = 4_pI32
!$ endif !$ endif
!$ endif !$ endif
!$ print'(a,i2)', ' OMP_NUM_THREADS: ',OMP_NUM_THREADS !$ print'(a,i2)', ' OMP_NUM_THREADS: ',OMP_NUM_THREADS