From a0af68588355b906241c0df2492d7c420d82fc6f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 25 Apr 2017 12:34:14 +0200 Subject: [PATCH 1/2] compiler complained --- src/lattice.f90 | 2 -- src/material.f90 | 6 ++++-- src/mesh.f90 | 33 +++++++++++++++------------------ src/numerics.f90 | 6 ++---- src/spectral_interface.f90 | 2 ++ 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/lattice.f90 b/src/lattice.f90 index 55be144ac..7726c772d 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -1266,8 +1266,6 @@ subroutine lattice_init debug_level, & debug_lattice, & debug_levelBasic - use numerics, only: & - worldrank implicit none integer(pInt), parameter :: FILEUNIT = 200_pInt diff --git a/src/material.f90 b/src/material.f90 index 1945bb7da..a77c4871a 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -729,6 +729,8 @@ end subroutine material_parseHomogenization !> @brief parses the microstructure part in the material configuration file !-------------------------------------------------------------------------------------------------- subroutine material_parseMicrostructure(fileUnit,myPart) + use prec, only: & + dNeq use IO use mesh, only: & mesh_element, & @@ -738,7 +740,6 @@ subroutine material_parseMicrostructure(fileUnit,myPart) character(len=*), intent(in) :: myPart integer(pInt), intent(in) :: fileUnit - integer(pInt), allocatable, dimension(:) :: chunkPos integer(pInt) :: Nsections, section, constituent, e, i character(len=65536) :: & @@ -818,9 +819,10 @@ subroutine material_parseMicrostructure(fileUnit,myPart) !sanity check do section = 1_pInt, Nsections - if (sum(microstructure_fraction(:,section)) /= 1.0_pReal) & + if (dNeq(sum(microstructure_fraction(:,section)),1.0_pReal)) & call IO_error(153_pInt,ext_msg=microstructure_name(section)) enddo + end subroutine material_parseMicrostructure diff --git a/src/mesh.f90 b/src/mesh.f90 index c0d3cf862..b7b1ad8da 100644 --- a/src/mesh.f90 +++ b/src/mesh.f90 @@ -921,24 +921,22 @@ subroutine mesh_build_ipCoordinates integer(pInt) :: e,t,g,c,i,n real(pReal), dimension(3) :: myCoords - if (.not. allocated(mesh_ipCoordinates)) then - allocate(mesh_ipCoordinates(3,mesh_maxNips,mesh_NcpElems)) - mesh_ipCoordinates = 0.0_pReal - endif + if (.not. allocated(mesh_ipCoordinates)) & + allocate(mesh_ipCoordinates(3,mesh_maxNips,mesh_NcpElems),source=0.0_pReal) !$OMP PARALLEL DO PRIVATE(t,g,c,myCoords) - do e = 1_pInt,mesh_NcpElems ! loop over cpElems - t = mesh_element(2_pInt,e) ! get element type - g = FE_geomtype(t) ! get geometry type - c = FE_celltype(g) ! get cell type - do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element - myCoords = 0.0_pReal - do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell - myCoords = myCoords + mesh_cellnode(1:3,mesh_cell(n,i,e)) - enddo - mesh_ipCoordinates(1:3,i,e) = myCoords / FE_NcellnodesPerCell(c) + do e = 1_pInt,mesh_NcpElems ! loop over cpElems + t = mesh_element(2_pInt,e) ! get element type + g = FE_geomtype(t) ! get geometry type + c = FE_celltype(g) ! get cell type + do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element + myCoords = 0.0_pReal + do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell + myCoords = myCoords + mesh_cellnode(1:3,mesh_cell(n,i,e)) enddo + mesh_ipCoordinates(1:3,i,e) = myCoords / real(FE_NcellnodesPerCell(c),pReal) enddo + enddo !$OMP END PARALLEL DO end subroutine mesh_build_ipCoordinates @@ -955,7 +953,6 @@ pure function mesh_cellCenterCoordinates(ip,el) real(pReal), dimension(3) :: mesh_cellCenterCoordinates !< x,y,z coordinates of the cell center of the requested IP cell integer(pInt) :: t,g,c,n - t = mesh_element(2_pInt,el) ! get element type g = FE_geomtype(t) ! get geometry type c = FE_celltype(g) ! get cell type @@ -963,7 +960,7 @@ pure function mesh_cellCenterCoordinates(ip,el) do n = 1_pInt,FE_NcellnodesPerCell(c) ! loop over cell nodes in this cell mesh_cellCenterCoordinates = mesh_cellCenterCoordinates + mesh_cellnode(1:3,mesh_cell(n,ip,el)) enddo - mesh_cellCenterCoordinates = mesh_cellCenterCoordinates / FE_NcellnodesPerCell(c) + mesh_cellCenterCoordinates = mesh_cellCenterCoordinates / real(FE_NcellnodesPerCell(c),pReal) end function mesh_cellCenterCoordinates @@ -1511,8 +1508,8 @@ function mesh_nodesAroundCentres(gDim,Favg,centres) result(nodes) shift = sign(abs(iRes+diag-2_pInt*me)/(iRes+diag),iRes+diag-2_pInt*me) lookup = me-diag+shift*iRes wrappedCentres(1:3,i+1_pInt, j+1_pInt, k+1_pInt) = & - centres(1:3,lookup(1)+1_pInt,lookup(2)+1_pInt,lookup(3)+1_pInt) - & - math_mul33x3(Favg, shift*gDim) + centres(1:3,lookup(1)+1_pInt,lookup(2)+1_pInt,lookup(3)+1_pInt) & + - math_mul33x3(Favg, real(shift,pReal)*gDim) endif enddo; enddo; enddo diff --git a/src/numerics.f90 b/src/numerics.f90 index 4358624de..eb974b3c4 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -251,10 +251,8 @@ subroutine numerics_init !-------------------------------------------------------------------------------------------------- ! try to open the config file fileExists: if(IO_open_file_stat(FILEUNIT,numerics_configFile)) then - mainProcess2: if (worldrank == 0) then - write(6,'(a,/)') ' using values from config file' - flush(6) - endif mainProcess2 + write(6,'(a,/)') ' using values from config file' + flush(6) !-------------------------------------------------------------------------------------------------- ! read variables from config file and overwrite default parameters if keyword is present diff --git a/src/spectral_interface.f90 b/src/spectral_interface.f90 index f37f083d6..80a109a10 100644 --- a/src/spectral_interface.f90 +++ b/src/spectral_interface.f90 @@ -57,7 +57,9 @@ subroutine DAMASK_interface_init() tag integer :: & i, & +#ifdef _OPENMP threadLevel, & +#endif worldrank = 0, & worldsize = 0 integer, allocatable, dimension(:) :: & From 69dba834cb8257113a41813e9a5e2f2afe255dba Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 25 Apr 2017 12:35:19 +0200 Subject: [PATCH 2/2] build type (and, hence openMP) was not set correctly --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 134e98dda..9712ab1d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_conf OUTPUT_VARIABLE petsc_includes OUTPUT_STRIP_TRAILING_WHITESPACE) # Find the PETSc external linking directory settings -# //required for final linking, must be appended after the executable +# required for final linking, must be appended after the executable execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "extlibs" RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN OUTPUT_VARIABLE petsc_external_lib @@ -110,6 +110,10 @@ elseif ("${DAMASK_SOLVER}" STREQUAL "FEM") message ("Building FEM Solver\n") endif () +if ("${CMAKE_BUILD_TYPE}" STREQUAL "") + set (CMAKE_BUILD_TYPE "RELEASE") +endif () + # set compiler and linker commands (need to be done after defining the project) # https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F set (CMAKE_Fortran_COMPILER "${PETSC_MPIFC}") @@ -177,7 +181,6 @@ add_definitions (-DFLOAT=8) add_definitions (-DINT=4) set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES}") -set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} -I${PROJECT_SOURCE_DIR}/lib") ################################################################################################### # Intel Compiler @@ -447,9 +450,7 @@ endif () set (CMAKE_Fortran_FLAGS "${BUILDCMD_PRE} ${OPENMP_FLAGS} ${STANDARD_CHECK} ${OPTIMIZATION_FLAGS} ${COMPILE_FLAGS} ${PRECISION_FLAGS}") set (CMAKE_Fortran_LINK_EXECUTABLE "${BUILDCMD_PRE} ${CMAKE_LINKER} ${OPENMP_FLAGS} ${OPTIMIZATION_FLAGS} ${LINKER_FLAGS}") -if ("${CMAKE_BUILD_TYPE}" STREQUAL "") - set (CMAKE_BUILD_TYPE "RELEASE") -elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") +if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${DEBUG_FLAGS}") set (CMAKE_Fortran_LINK_EXECUTABLE "${CMAKE_Fortran_LINK_EXECUTABLE} ${DEBUG_FLAGS}") endif ()