some polishing concerning openMP initialization
number of threads is now written to *.out file
This commit is contained in:
parent
ab82dbc99c
commit
096a4803b0
|
@ -202,7 +202,8 @@ subroutine hypela2(&
|
|||
debug_reset
|
||||
use mesh, only: mesh_FEasCP
|
||||
use CPFEM, only: CPFEM_initAll,CPFEM_general,CPFEM_init_done
|
||||
use OMP_LIB
|
||||
!$ use OMP_LIB ! the openMP function library
|
||||
!$ use numerics, only: mpieNumThreadsInt ! number of threads set by MPIE_NUMTHREADS
|
||||
implicit none
|
||||
|
||||
! ** Start of generated type statements **
|
||||
|
@ -228,22 +229,17 @@ 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, &
|
||||
defaultNumThreadsInt, & ! default value stored in environment variable OMP_NUM_THREADS
|
||||
mpieNumThreadsInt ! value stored in environment variable MPIE_NUM_THREADS
|
||||
|
||||
character(len=2) mpieNumThreadsString
|
||||
integer(pInt) computationMode, i, cp_en
|
||||
! OpenMP variable
|
||||
!$ integer(pInt) defaultNumThreadsInt ! default value set by Marc
|
||||
|
||||
|
||||
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
|
||||
|
||||
!$ defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc
|
||||
|
||||
if (.not. CPFEM_init_done) call CPFEM_initAll(t(1),n(1),nn)
|
||||
|
||||
!$ call omp_set_num_threads(mpieNumThreadsInt) ! set number of threads for parallel execution set by MPIE_NUM_THREADS
|
||||
|
||||
if (lovl == 4) then ! Marc requires stiffness in separate call
|
||||
if ( timinc < theDelta .and. theInc == inc ) then ! first after cutback
|
||||
computationMode = 7 ! --> restore tangent and return it
|
||||
|
@ -335,7 +331,7 @@ 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
|
||||
!$ call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -50,6 +50,9 @@ real(pReal) relevantStrain, & ! strain
|
|||
|
||||
!* Random seeding parameters: added <<<updated 27.08.2009>>>
|
||||
integer(pInt) fixedSeed ! fixed seeding for pseudo-random number generator
|
||||
! OpenMP variable
|
||||
!$ integer(pInt) mpieNumThreadsInt ! value stored in environment variable MPIE_NUM_THREADS
|
||||
|
||||
|
||||
CONTAINS
|
||||
|
||||
|
@ -69,6 +72,7 @@ subroutine numerics_init()
|
|||
IO_lc, &
|
||||
IO_floatValue, &
|
||||
IO_intValue
|
||||
!$ use OMP_LIB ! the openMP function library
|
||||
|
||||
implicit none
|
||||
|
||||
|
@ -83,6 +87,9 @@ subroutine numerics_init()
|
|||
character(len=64) tag
|
||||
character(len=1024) line
|
||||
|
||||
! OpenMP variable
|
||||
!$ character(len=2) mpieNumThreadsString !enironment variable MPIE_NUMTHREADS
|
||||
|
||||
write(6,*)
|
||||
write(6,*) '<<<+- numerics init -+>>>'
|
||||
write(6,*) '$Id$'
|
||||
|
@ -134,6 +141,13 @@ subroutine numerics_init()
|
|||
!* Random seeding parameters: added <<<updated 27.08.2009>>>
|
||||
fixedSeed = 0_pInt
|
||||
|
||||
|
||||
!* determin number of threads from environment variable MPIE_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
|
||||
|
||||
! try to open the config file
|
||||
if(IO_open_file(fileunit,numerics_configFile)) then
|
||||
|
||||
|
@ -294,6 +308,10 @@ subroutine numerics_init()
|
|||
write(6,'(a24,x,i8)') 'fixed_seed: ',fixedSeed
|
||||
write(6,*)
|
||||
|
||||
!* openMP parameter
|
||||
!$ write(6,'(a24,x,i8)') 'number of threads: ',OMP_get_max_threads()
|
||||
!$ write(6,*)
|
||||
|
||||
! sanity check
|
||||
if (relevantStrain <= 0.0_pReal) call IO_error(260)
|
||||
if (defgradTolerance <= 0.0_pReal) call IO_error(294)
|
||||
|
|
Loading…
Reference in New Issue