set num threads back and forth between abaqus and DAMASK (like marc)

This commit is contained in:
Martin Diehl 2014-04-29 16:11:13 +00:00
parent 2346a0841e
commit 01416b7ab6
3 changed files with 18 additions and 2 deletions

View File

@ -106,6 +106,8 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, &
use prec, only: & use prec, only: &
pReal, & pReal, &
pInt pInt
!$ use numerics, only: &
!$ DAMASK_NumThreadsInt
use FEsolving, only: & use FEsolving, only: &
cycleCounter, & cycleCounter, &
theTime, & theTime, &
@ -192,7 +194,14 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, &
real(pReal), dimension(6,6) :: ddsdde real(pReal), dimension(6,6) :: ddsdde
real(pReal) :: temp, timeInc real(pReal) :: temp, timeInc
integer(pInt) :: computationMode, n, i, cp_en integer(pInt) :: computationMode, n, i, cp_en
!$ integer :: defaultNumThreadsInt !< default value set by Abaqus
!$ include "omp_lib.h"
!$ defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc
!$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution set by DAMASK_NUM_THREADS
enerInternNew = 0.0_pReal
enerInelasNew = 0.0_pReal
computationMode = CPFEM_CALCRESULTS ! always calculate computationMode = CPFEM_CALCRESULTS ! always calculate
do n = 1,nblock(1) ! loop over vector of IPs do n = 1,nblock(1) ! loop over vector of IPs
temp = tempOld(n) temp = tempOld(n)
@ -279,6 +288,7 @@ subroutine vumat(nBlock, nDir, nshr, nStateV, nFieldV, nProps, lAnneal, &
nBlock(2),mesh_FEasCP('elem', nBlock(4_pInt+n))) nBlock(2),mesh_FEasCP('elem', nBlock(4_pInt+n)))
enddo enddo
!$ call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value
end subroutine vumat end subroutine vumat

View File

@ -101,11 +101,11 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,&
TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,CMNAME,NDI,NSHR,NTENS,& TIME,DTIME,TEMP,DTEMP,PREDEF,DPRED,CMNAME,NDI,NSHR,NTENS,&
NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,& NSTATV,PROPS,NPROPS,COORDS,DROT,PNEWDT,CELENT,&
DFGRD0,DFGRD1,NOEL,NPT,KSLAY,KSPT,KSTEP,KINC) DFGRD0,DFGRD1,NOEL,NPT,KSLAY,KSPT,KSTEP,KINC)
use prec, only: & use prec, only: &
pReal, & pReal, &
pInt pInt
use numerics, only: & use numerics, only: &
!$ DAMASK_NumThreadsInt, &
usePingPong usePingPong
use FEsolving, only: & use FEsolving, only: &
cycleCounter, & cycleCounter, &
@ -202,11 +202,16 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,&
real(pReal), dimension(6,6) :: ddsdde_h real(pReal), dimension(6,6) :: ddsdde_h
integer(pInt) :: computationMode, i, cp_en integer(pInt) :: computationMode, i, cp_en
logical :: cutBack logical :: cutBack
!$ integer :: defaultNumThreadsInt !< default value set by Abaqus
!$ include "omp_lib.h"
temperature = temp ! temp is intent(in) temperature = temp ! temp is intent(in)
DDSDDT = 0.0_pReal DDSDDT = 0.0_pReal
DRPLDE = 0.0_pReal DRPLDE = 0.0_pReal
!$ defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc
!$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution set by DAMASK_NUM_THREADS
if (iand(debug_level(debug_abaqus),debug_levelBasic) /= 0 .and. noel == 1 .and. npt == 1) then if (iand(debug_level(debug_abaqus),debug_levelBasic) /= 0 .and. noel == 1 .and. npt == 1) then
!$OMP CRITICAL (write2out) !$OMP CRITICAL (write2out)
write(6,*) 'el',noel,'ip',npt write(6,*) 'el',noel,'ip',npt
@ -342,6 +347,7 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,&
statev = materialpoint_results(1:min(nstatv,materialpoint_sizeResults),npt,mesh_FEasCP('elem', noel)) statev = materialpoint_results(1:min(nstatv,materialpoint_sizeResults),npt,mesh_FEasCP('elem', noel))
if ( terminallyIll ) pnewdt = 0.5_pReal ! force cutback directly ? if ( terminallyIll ) pnewdt = 0.5_pReal ! force cutback directly ?
!$ call omp_set_num_threads(defaultNumThreadsInt) ! reset number of threads to stored default value
end subroutine UMAT end subroutine UMAT

View File

@ -123,7 +123,7 @@ subroutine numerics_init
IO_EOF IO_EOF
#ifdef Spectral #ifdef Spectral
!$ use OMP_LIB, only: omp_set_num_threads ! Use the standard conforming module file for omp if not using MSC.Marc !$ use OMP_LIB, only: omp_set_num_threads ! Use the standard conforming module file for omp if using the spectral solver
#endif #endif
implicit none implicit none
#ifndef Spectral #ifndef Spectral