* environment variable MPIE_NUM_THREADS now determines number of threads used in parallel regions
* default value of the OMP_NUM_THREADS variable has to be restored at the end of mpie subroutine, since marc also seems to use and change(!) this * usage: "export MPIE_NUM_THREADS=<number of threads>" to set variable in shell, then restart mentat and compile with option 3 (at the moment this does only work on ws 6, since all other workstations use compiler option "-save"; this puts all local variables by default in static memory, which is a killer for parallelization!)
This commit is contained in:
parent
b9b226548c
commit
ea6a6c9503
|
@ -202,6 +202,7 @@ subroutine hypela2(&
|
|||
debug_reset
|
||||
use mesh, only: mesh_FEasCP
|
||||
use CPFEM, only: CPFEM_initAll,CPFEM_general,CPFEM_init_done
|
||||
use OMP_LIB
|
||||
implicit none
|
||||
|
||||
! ** Start of generated type statements **
|
||||
|
@ -227,7 +228,19 @@ subroutine hypela2(&
|
|||
real(pReal), dimension (3,3) :: pstress ! dummy argument for call of cpfem_general (used by mpie_spectral)
|
||||
real(pReal), dimension (3,3,3,3) :: dPdF ! dummy argument for call of cpfem_general (used by mpie_spectral)
|
||||
|
||||
integer(pInt) computationMode, i, cp_en
|
||||
integer(pInt) computationMode, i, cp_en, &
|
||||
defaultNumThreadsInt, & ! default value stored in environment variable OMP_NUM_THREADS
|
||||
mpieNumThreadsInt ! value stored in environment variable MPIE_NUM_THREADS
|
||||
|
||||
character mpieNumThreadsString
|
||||
|
||||
|
||||
defaultNumThreadsInt = omp_get_num_threads() ! remember default number of available threads defined by environment variable OMP_NUM_THREADS
|
||||
call GetEnv('MPIE_NUM_THREADS',mpieNumThreadsString) ! get environment variable MPIE_NUM_THREADS...
|
||||
read(mpieNumThreadsString,'(i2)') mpieNumThreadsInt ! ...convert it to integer...
|
||||
if (mpieNumThreadsInt < 1) mpieNumThreadsInt = 1 ! ...ensure that its at least one...
|
||||
call omp_set_num_threads(mpieNumThreadsInt) ! ...and use it as number of threads for parallel execution
|
||||
|
||||
|
||||
if (.not. CPFEM_init_done) call CPFEM_initAll(t(1),n(1),nn)
|
||||
|
||||
|
@ -322,6 +335,8 @@ subroutine hypela2(&
|
|||
s(1:ngens) = stress(1:ngens)*invnrmMandel(1:ngens)
|
||||
if(symmetricSolver) d(1:ngens,1:ngens) = 0.5_pReal*(d(1:ngens,1:ngens)+transpose(d(1:ngens,1:ngens)))
|
||||
|
||||
call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value
|
||||
|
||||
return
|
||||
|
||||
end subroutine
|
||||
|
|
Loading…
Reference in New Issue