From 3bb5ae3d9ec03059e7e18b96544ab431984e1883 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Jul 2021 13:20:39 +0200 Subject: [PATCH 1/6] concurrent/parallel execution is possible here --- src/math.f90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index 36fe91bac..aeab47093 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -736,9 +736,9 @@ pure function math_3333to99(m3333) integer :: i,j - do i=1,9; do j=1,9 + do concurrent(i=1:9, j=1:9) math_3333to99(i,j) = m3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) - enddo; enddo + enddo end function math_3333to99 @@ -753,9 +753,9 @@ pure function math_99to3333(m99) integer :: i,j - do i=1,9; do j=1,9 + do concurrent(i=1:9, j=1:9) math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j) - enddo; enddo + enddo end function math_99to3333 From 31a40006553b87cea43090ac43702606dd3ddbad Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Jul 2021 13:32:11 +0200 Subject: [PATCH 2/6] no need for arbitrary dimension not sure if correct, not used at all (even identity4th for 3 dim is not used, but now at least tested) --- src/math.f90 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/math.f90 b/src/math.f90 index aeab47093..110af5128 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -233,7 +233,7 @@ end function math_range !-------------------------------------------------------------------------------------------------- -!> @brief second rank identity tensor of specified dimension +!> @brief Rank two identity tensor of specified dimension. !-------------------------------------------------------------------------------------------------- pure function math_eye(d) @@ -250,20 +250,18 @@ end function math_eye !-------------------------------------------------------------------------------------------------- -!> @brief symmetric fourth rank identity tensor of specified dimension +!> @brief Symmetric rank four identity tensor. ! from http://en.wikipedia.org/wiki/Tensor_derivative_(continuum_mechanics)#Derivative_of_a_second-order_tensor_with_respect_to_itself !-------------------------------------------------------------------------------------------------- -pure function math_identity4th(d) +pure function math_identity4th() + + real(pReal), dimension(3,3,3,3) :: math_identity4th - integer, intent(in) :: d !< tensor dimension integer :: i,j,k,l - real(pReal), dimension(d,d,d,d) :: math_identity4th - real(pReal), dimension(d,d) :: identity2nd - identity2nd = math_eye(d) - do i=1,d; do j=1,d; do k=1,d; do l=1,d - math_identity4th(i,j,k,l) = 0.5_pReal & - *(identity2nd(i,k)*identity2nd(j,l)+identity2nd(i,l)*identity2nd(j,k)) + + do i=1,3; do j=1,3; do k=1,3; do l=1,3 + math_identity4th(i,j,k,l) = 0.5_pReal*(math_I3(i,k)*math_I3(j,l)+math_I3(i,l)*math_I3(j,k)) enddo; enddo; enddo; enddo end function math_identity4th @@ -1242,6 +1240,9 @@ subroutine selfTest if(dNeq(math_det33(math_symmetric33(t33)),math_detSym33(math_symmetric33(t33)),tol=1.0e-12_pReal)) & error stop 'math_det33/math_detSym33' + if(any(dNeq0(t33+transpose(t33)-math_mul3333xx33(math_identity4th(),t33+transpose(t33))))) & + error stop 'math_mul3333xx33/math_identity4th' + if(any(dNeq0(math_eye(3),math_inv33(math_I3)))) & error stop 'math_inv33(math_I3)' From d19ab4c4f62977bcfafccda895656f35774ba126 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 25 Jul 2021 13:38:56 +0200 Subject: [PATCH 3/6] co concurrent possible here note: do concurrent cannot be used for the double loops for 66 to 3333! --- PRIVATE | 2 +- src/math.f90 | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/PRIVATE b/PRIVATE index 174ecac2d..d92b030e5 160000 --- a/PRIVATE +++ b/PRIVATE @@ -1 +1 @@ -Subproject commit 174ecac2d3ab7596bdb60184d6bb9e1a52cb7378 +Subproject commit d92b030e5777e718c77edc2e1e93abfa0981b024 diff --git a/src/math.f90 b/src/math.f90 index 110af5128..89ee7abfe 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -260,9 +260,9 @@ pure function math_identity4th() integer :: i,j,k,l - do i=1,3; do j=1,3; do k=1,3; do l=1,3 + do concurrent(i=1:3, j=1:3, k=1:3, l=1:3) math_identity4th(i,j,k,l) = 0.5_pReal*(math_I3(i,k)*math_I3(j,l)+math_I3(i,l)*math_I3(j,k)) - enddo; enddo; enddo; enddo + enddo end function math_identity4th @@ -329,9 +329,10 @@ pure function math_outer(A,B) real(pReal), dimension(size(A,1),size(B,1)) :: math_outer integer :: i,j - do i=1,size(A,1); do j=1,size(B,1) + + do concurrent(i=1:size(A,1), j=1:size(B,1)) math_outer(i,j) = A(i)*B(j) - enddo; enddo + enddo end function math_outer @@ -371,9 +372,10 @@ pure function math_mul3333xx33(A,B) real(pReal), dimension(3,3) :: math_mul3333xx33 integer :: i,j - do i=1,3; do j=1,3 + + do concurrent(i=1:3, j=1:3) math_mul3333xx33(i,j) = sum(A(i,j,1:3,1:3)*B(1:3,1:3)) - enddo; enddo + enddo end function math_mul3333xx33 @@ -388,9 +390,9 @@ pure function math_mul3333xx3333(A,B) real(pReal), dimension(3,3,3,3), intent(in) :: B real(pReal), dimension(3,3,3,3) :: math_mul3333xx3333 - do i=1,3; do j=1,3; do k=1,3; do l=1,3 + do concurrent(i=1:3, j=1:3, k=1:3, l=1:3) math_mul3333xx3333(i,j,k,l) = sum(A(i,j,1:3,1:3)*B(1:3,1:3,k,l)) - enddo; enddo; enddo; enddo + enddo end function math_mul3333xx3333 @@ -710,6 +712,7 @@ pure function math_6toSym33(v6,weighted) real(pReal), dimension(6) :: w integer :: i + if(present(weighted)) then w = merge(INVNRMMANDEL,1.0_pReal,weighted) else @@ -734,6 +737,7 @@ pure function math_3333to99(m3333) integer :: i,j + do concurrent(i=1:9, j=1:9) math_3333to99(i,j) = m3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) enddo @@ -751,6 +755,7 @@ pure function math_99to3333(m99) integer :: i,j + do concurrent(i=1:9, j=1:9) math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j) enddo @@ -773,15 +778,16 @@ pure function math_sym3333to66(m3333,weighted) real(pReal), dimension(6) :: w integer :: i,j + if(present(weighted)) then w = merge(NRMMANDEL,1.0_pReal,weighted) else w = NRMMANDEL endif - do i=1,6; do j=1,6 + do concurrent(i=1:6, j=1:6) math_sym3333to66(i,j) = w(i)*w(j)*m3333(MAPNYE(1,i),MAPNYE(2,i),MAPNYE(1,j),MAPNYE(2,j)) - enddo; enddo + enddo end function math_sym3333to66 @@ -801,6 +807,7 @@ pure function math_66toSym3333(m66,weighted) real(pReal), dimension(6) :: w integer :: i,j + if(present(weighted)) then w = merge(INVNRMMANDEL,1.0_pReal,weighted) else @@ -826,6 +833,7 @@ pure function math_Voigt66to3333(m66) real(pReal), dimension(6,6), intent(in) :: m66 !< 6x6 matrix integer :: i,j + do i=1,6; do j=1, 6 math_Voigt66to3333(MAPVOIGT(1,i),MAPVOIGT(2,i),MAPVOIGT(1,j),MAPVOIGT(2,j)) = m66(i,j) math_Voigt66to3333(MAPVOIGT(2,i),MAPVOIGT(1,i),MAPVOIGT(1,j),MAPVOIGT(2,j)) = m66(i,j) @@ -1240,7 +1248,7 @@ subroutine selfTest if(dNeq(math_det33(math_symmetric33(t33)),math_detSym33(math_symmetric33(t33)),tol=1.0e-12_pReal)) & error stop 'math_det33/math_detSym33' - if(any(dNeq0(t33+transpose(t33)-math_mul3333xx33(math_identity4th(),t33+transpose(t33))))) & + if(any(dNeq(t33+transpose(t33),math_mul3333xx33(math_identity4th(),t33+transpose(t33))))) & error stop 'math_mul3333xx33/math_identity4th' if(any(dNeq0(math_eye(3),math_inv33(math_I3)))) & From af714cfd5b2a2e1d12c28cb0c3b83bce108f4469 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Jul 2021 13:56:07 +0200 Subject: [PATCH 4/6] broken Intel compiler (do concurrent) errors occur under unclear conditions, better avoid at the moment: https://community.intel.com/t5/Intel-Fortran-Compiler/do-concurrent-broken-with-openmp/m-p/1301528#M156942 https://community.intel.com/t5/Intel-Fortran-Compiler/Bug-with-do-concurrent-and-openmp/m-p/1173473m --- src/element.f90 | 1 + src/math.f90 | 51 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/element.f90 b/src/element.f90 index 5b7af36bd..b061f942d 100644 --- a/src/element.f90 +++ b/src/element.f90 @@ -151,6 +151,7 @@ module element integer, dimension(NIPNEIGHBOR(CELLTYPE(1)),NIP(1)), parameter :: IPNEIGHBOR1 = & reshape([& -2,-3,-1 & +! Note: This fix is for gfortran 9 only. gfortran 8 supports neither, gfortran > 9 both variants #if !defined(__GFORTRAN__) ],shape(IPNEIGHBOR1)) #else diff --git a/src/math.f90 b/src/math.f90 index cbc924f08..71cbcffec 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -90,12 +90,12 @@ subroutine math_init integer, dimension(:), allocatable :: randInit class(tNode), pointer :: & num_generic - + print'(/,a)', ' <<<+- math init -+>>>'; flush(IO_STDOUT) num_generic => config_numerics%get('generic',defaultVal=emptyDict) randomSeed = num_generic%get_asInt('random_seed', defaultVal = 0) - + call random_seed(size=randSize) allocate(randInit(randSize)) if (randomSeed > 0) then @@ -260,9 +260,15 @@ pure function math_identity4th() integer :: i,j,k,l +#ifndef __INTEL_COMPILER do concurrent(i=1:3, j=1:3, k=1:3, l=1:3) math_identity4th(i,j,k,l) = 0.5_pReal*(math_I3(i,k)*math_I3(j,l)+math_I3(i,l)*math_I3(j,k)) enddo +#else + do i=1,3; do j=1,3; do k=1,3; do l=1,3 + math_identity4th(i,j,k,l) = 0.5_pReal*(math_I3(i,k)*math_I3(j,l)+math_I3(i,l)*math_I3(j,k)) + enddo; enddo; enddo; enddo +#endif end function math_identity4th @@ -330,9 +336,15 @@ pure function math_outer(A,B) integer :: i,j +#ifndef __INTEL_COMPILER do concurrent(i=1:size(A,1), j=1:size(B,1)) math_outer(i,j) = A(i)*B(j) enddo +#else + do i=1,size(A,1); do j=1,size(B,1) + math_outer(i,j) = A(i)*B(j) + enddo; enddo +#endif end function math_outer @@ -373,9 +385,15 @@ pure function math_mul3333xx33(A,B) integer :: i,j +#ifndef __INTEL_COMPILER do concurrent(i=1:3, j=1:3) math_mul3333xx33(i,j) = sum(A(i,j,1:3,1:3)*B(1:3,1:3)) enddo +#else + do i=1,3; do j=1,3 + math_mul3333xx33(i,j) = sum(A(i,j,1:3,1:3)*B(1:3,1:3)) + enddo; enddo +#endif end function math_mul3333xx33 @@ -390,9 +408,16 @@ pure function math_mul3333xx3333(A,B) real(pReal), dimension(3,3,3,3), intent(in) :: B real(pReal), dimension(3,3,3,3) :: math_mul3333xx3333 + +#ifndef __INTEL_COMPILER do concurrent(i=1:3, j=1:3, k=1:3, l=1:3) math_mul3333xx3333(i,j,k,l) = sum(A(i,j,1:3,1:3)*B(1:3,1:3,k,l)) enddo +#else + do i=1,3; do j=1,3; do k=1,3; do l=1,3 + math_mul3333xx3333(i,j,k,l) = sum(A(i,j,1:3,1:3)*B(1:3,1:3,k,l)) + enddo; enddo; enddo; enddo +#endif end function math_mul3333xx3333 @@ -725,9 +750,15 @@ pure function math_3333to99(m3333) integer :: i,j +#ifndef __INTEL_COMPILER do concurrent(i=1:9, j=1:9) math_3333to99(i,j) = m3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) enddo +#else + do i=1,9; do j=1,9 + math_3333to99(i,j) = m3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) + enddo; enddo +#endif end function math_3333to99 @@ -742,10 +773,15 @@ pure function math_99to3333(m99) integer :: i,j - +#ifndef __INTEL_COMPILER do concurrent(i=1:9, j=1:9) math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j) enddo +#else + do i=1,9; do j=1,9 + math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j) + enddo; enddo +#endif end function math_99to3333 @@ -772,9 +808,15 @@ pure function math_sym3333to66(m3333,weighted) w = NRMMANDEL endif +#ifndef __INTEL_COMPILER do concurrent(i=1:6, j=1:6) math_sym3333to66(i,j) = w(i)*w(j)*m3333(MAPNYE(1,i),MAPNYE(2,i),MAPNYE(1,j),MAPNYE(2,j)) enddo +#else + do i=1,6; do j=1,6 + math_sym3333to66(i,j) = w(i)*w(j)*m3333(MAPNYE(1,i),MAPNYE(2,i),MAPNYE(1,j),MAPNYE(2,j)) + enddo; enddo +#endif end function math_sym3333to66 @@ -874,10 +916,11 @@ subroutine math_eigh(w,v,error,m) real(pReal), dimension(size(m,1)), intent(out) :: w !< eigenvalues real(pReal), dimension(size(m,1),size(m,1)), intent(out) :: v !< eigenvectors logical, intent(out) :: error - + integer :: ierr real(pReal), dimension(size(m,1)**2) :: work + v = m ! copy matrix to input (doubles as output) array call dsyev('V','U',size(m,1),v,size(m,1),w,work,size(work,1),ierr) error = (ierr /= 0) From 5d0c0f42831fd740c8dcf34651d738a2d8d24c02 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 27 Jul 2021 16:44:52 +0200 Subject: [PATCH 5/6] outdated instructions --- src/DAMASK_interface.f90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DAMASK_interface.f90 b/src/DAMASK_interface.f90 index 52f58d363..ca3179afc 100644 --- a/src/DAMASK_interface.f90 +++ b/src/DAMASK_interface.f90 @@ -139,10 +139,10 @@ subroutine DAMASK_interface_init print'(a)', ' Optional arguments:' print'(/,a)',' --workingdirectory PathToWorkingDirectory' print'(a)', ' Specifies the working directory and overwrites the default ./' - print'(a)', ' Make sure the file "material.config" exists in the working' + print'(a)', ' Make sure the file "material.yaml" exists in the working' print'(a)', ' directory.' - print'(a)', ' For further configuration place "numerics.config"' - print'(a)',' and "debug.config" in that directory.' + print'(a)', ' For further configuration place "numerics.yaml"' + print'(a)',' and "debug.yaml" in that directory.' print'(/,a)',' --restart N' print'(a)', ' Reads in increment N and continues with calculating' print'(a)', ' increment N+1 based on this.' From 29155e325f9bc9c8a31d5c338438f5e8424cea5f Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 29 Jul 2021 12:58:11 +0200 Subject: [PATCH 6/6] [skip ci] updated version information after successful test of v3.0.0-alpha4-205-g5d0c0f428 --- python/damask/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/damask/VERSION b/python/damask/VERSION index 13d57229b..2a51b3669 100644 --- a/python/damask/VERSION +++ b/python/damask/VERSION @@ -1 +1 @@ -v3.0.0-alpha4-182-gac6d31b1f +v3.0.0-alpha4-205-g5d0c0f428