From b5abd6f20337e595c22fa6df25770113e20937f1 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Wed, 3 Aug 2011 07:54:32 +0000 Subject: [PATCH] adding new option OPTIMIZATION with values OFF, DEFENSIVE and AGGRESSIVE to makefile. Polishing of makefile and DAMASK_spectral.f90 --- code/DAMASK_spectral.f90 | 12 ++++---- code/makefile | 63 +++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/code/DAMASK_spectral.f90 b/code/DAMASK_spectral.f90 index acc1eb540..7ff602b17 100644 --- a/code/DAMASK_spectral.f90 +++ b/code/DAMASK_spectral.f90 @@ -520,10 +520,10 @@ if ((N_l + N_Fdot /= N_n).or.(N_n /= N_t)) & ! sanity check temp33_Real = defgrad(i,j,k,:,:) if (velGradApplied(loadcase)) & ! using velocity gradient to calculate new deformation gradient (if not guessing) deltaF = math_mul33x33(bc_deformation(:,:,loadcase),defgradold(i,j,k,:,:)) - defgrad(i,j,k,:,:) = defgrad(i,j,k,:,:) & ! decide if guessing along former trajectory or apply homogeneous addon (addon only for applied deformation) - + guessmode * (defgrad(i,j,k,:,:) - defgradold(i,j,k,:,:))& - + (1.0_pReal-guessmode) * mask_defgrad * deltaF *timeinc - defgradold(i,j,k,:,:) = temp33_Real + defgrad(i,j,k,:,:) = defgrad(i,j,k,:,:) & ! decide if guessing along former trajectory or apply homogeneous addon (addon only for applied deformation) + + guessmode * (defgrad(i,j,k,:,:) - defgradold(i,j,k,:,:))& + + (1.0_pReal-guessmode) * mask_defgrad * deltaF *timeinc + defgradold(i,j,k,:,:) = temp33_Real enddo; enddo; enddo guessmode = 1.0_pReal ! keep guessing along former trajectory during same loadcase @@ -598,7 +598,7 @@ if ((N_l + N_Fdot /= N_n).or.(N_n /= N_t)) & ! sanity check defgradAimCorr = - (1.0_pReal - mask_defgrad) & ! allow alteration of all non-fixed defgrad components * math_mul3333xx33(s0, (mask_stress*(pstress_av - bc_stress(:,:,loadcase)))) ! residual on given stress components - do m=1,3; do n =1,3 ! calculate damper (correction is far too strong) !ToDo: Check for better values + do m=1,3; do n =1,3 ! calculate damper if (defgradAimCorr(m,n) * defgradAimCorrPrev(m,n) < -relevantStrain ** 2.0_pReal) then ! insignificant within relevantstrain around zero damper(m,n) = max(0.01_pReal,damper(m,n)*0.8) else @@ -853,7 +853,7 @@ if ((N_l + N_Fdot /= N_n).or.(N_n /= N_t)) & ! sanity check !!!!!!!!!!!!!!!!!!!!!!!! end divergence debugging print '(2(a,E8.2))', ' error stress: ',err_stress, ' Tol. = ', err_stress_tol print '(2(a,E8.2))', ' error deformation gradient: ',err_defgrad,' Tol. = ', err_defgrad_tol - + !ToDo: usefull .and. for err_div? if((err_stress > err_stress_tol .or. err_defgrad > err_defgrad_tol) .and. err_div < err_div_tol) then ! change to calculation of BCs, reset damper etc. calcmode = 0_pInt defgradAimCorr = 0.0_pReal diff --git a/code/makefile b/code/makefile index f4e4a04f8..d124d59ed 100644 --- a/code/makefile +++ b/code/makefile @@ -17,52 +17,61 @@ # VERSION = 10 (12): version of Intel compiler. More aggressive optimization if VERSION =12 # PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built - -ifeq ($(F90), gfortran) -OPENMP_FLAG =-fopenmp -OPTIMIZATION_AGGRESSIVE =-O3 -OPTIMIZATION_DEFENSIVE =-O2 -COMPILE_OPTIONS =-xf95-cpp-input -HEAP_ARRAYS = - -else +ifeq ($(F90), ) F90 =ifort +endif + +ifeq ($(OPTIMIZATION), ) +OPTIMIZATION =DEFENSIVE +endif +MAXOPTI =$(OPTIMIZATION) + +ifeq ($(F90), ifort) ifeq ($(PORTABLE), FALSE) PORTABLE_SWITCH =-xHost endif - -OPENMP_FLAG =-openmp -HEAP_ARRAYS =-heap-arrays 500000000 -COMPILE_OPTIONS =-fpp -diag-disable 8291,8290 -#fpp: for preprocessor, diag-disable: switch off messages on formatting of output -OPTIMIZATION_AGGRESSIVE =-O3 -static $(PORTABLE_SWITCH) - -ifeq ($(VERSION), 12) -OPTIMIZATION_DEFENSIVE =$(OPTIMIZATION_AGGRESIVE) -else -OPTIMIZATION_DEFENSIVE =-O2 +ifneq ($(VERSION), 12) +ifeq ($(OPTIMIZATION), AGGRESSIVE) +MAXOPTI =DEFENSIVE +endif endif endif +OPENMP_FLAG_ifort =-openmp +OPENMP_FLAG_gfortran =-fopenmp -COMPILE =$(OPENMP_FLAG) $(COMPILE_OPTIONS) $(OPTIMIZATION_AGGRESSIVE) -c -COMPILE_HEAP =$(COMPILE) $(HEAP_ARRAYS) -COMPILE_HEAP_DEFENSIVE =$(OPENMP_FLAG) $(COMPILE_OPTIONS) $(OPTIMIZATION_DEFENSIVE) -c $(HEAP_ARRAYS) +OPTIMIZATION_OFF_ifort =-O0 +OPTIMIZATION_OFF_gfortran =-O0 +OPTIMIZATION_DEFENSIVE_ifort =-O2 +OPTIMIZATION_DEFENSIVE_gfortran =-O2 +OPTIMIZATION_AGGRESSIVE_ifort =-O3 -static $(PORTABLE_SWITCH) +OPTIMIZATION_AGGRESSIVE_gfortran =-O3 + +COMPILE_OPTIONS_ifort =-fpp -diag-disable 8291,8290 +COMPILE_OPTIONS_gfortran =-xf95-cpp-input + +HEAP_ARRAYS_ifort =-heap-arrays 500000000 +HEAP_ARRAYS_gfortran = + + +COMPILE =${OPENMP_FLAG_${F90}} ${COMPILE_OPTIONS_${F90}} ${OPTIMIZATION_${OPTIMIZATION}_${F90}} -c +COMPILE_HEAP =$(COMPILE) ${HEAP_ARRAYS_${F90}} +COMPILE_HEAP_MAXOPTI =${OPENMP_FLAG_${F90}} ${COMPILE_OPTIONS_${F90}} ${OPTIMIZATION_${MAXOPTI}_${F90}} ${HEAP_ARRAYS_${F90}} -c ifeq ($(PRECISION),single) DAMASK_spectral_single.exe: DAMASK_spectral_single.o CPFEM.a - $(F90) $(OPENMP_FLAG) -o DAMASK_spectral_single.exe DAMASK_spectral_single.o CPFEM.a include/libfftw3f_threads.a include/libfftw3f.a constitutive.a advanced.a basics.a -lpthread + $(F90) ${OPENMP_FLAG_${F90}} -o DAMASK_spectral_single.exe DAMASK_spectral_single.o CPFEM.a include/libfftw3f_threads.a include/libfftw3f.a constitutive.a advanced.a basics.a -lpthread DAMASK_spectral_single.o: DAMASK_spectral_single.f90 CPFEM.o - $(F90) $(COMPILE_HEAP_DEFENSIVE) DAMASK_spectral_single.f90 + $(F90) $(COMPILE_HEAP_MAXOPTI) DAMASK_spectral_single.f90 else DAMASK_spectral.exe: DAMASK_spectral.o CPFEM.a - $(F90) $(OPENMP_FLAG) -o DAMASK_spectral.exe DAMASK_spectral.o CPFEM.a include/libfftw3_threads.a include/libfftw3.a constitutive.a advanced.a basics.a -lpthread + $(F90) ${OPENMP_FLAG_${F90}} -o DAMASK_spectral.exe DAMASK_spectral.o CPFEM.a include/libfftw3_threads.a include/libfftw3.a constitutive.a advanced.a basics.a -lpthread DAMASK_spectral.o: DAMASK_spectral.f90 CPFEM.o - $(F90) $(COMPILE_HEAP_DEFENSIVE) DAMASK_spectral.f90 + $(F90) $(COMPILE_HEAP_MAXOPTI) DAMASK_spectral.f90 endif CPFEM.a: CPFEM.o