From 42329a4ca463120474447af86bcd9a2ec1882ea2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 17 Dec 2022 14:52:41 +0100 Subject: [PATCH 1/4] ensure recent compiler --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fb3f2d1b..9950b629a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,14 +90,21 @@ endif() list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -if (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") - include(Compiler-Intel) -elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") +if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") include(Compiler-GNU) + set(Fortran_COMPILER_VERSION_MIN 9.1) +elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + include(Compiler-Intel) + set(Fortran_COMPILER_VERSION_MIN 19) elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM") include(Compiler-IntelLLVM) + set(Fortran_COMPILER_VERSION_MIN 19) else() - message(FATAL_ERROR "Compiler type(CMAKE_Fortran_COMPILER_ID) not recognized") + message(FATAL_ERROR "Compiler '${CMAKE_Fortran_COMPILER_ID}' not supported") +endif() + +if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS Fortran_COMPILER_VERSION_MIN) + message(FATAL_ERROR "Version '${CMAKE_Fortran_COMPILER_VERSION}' of '${CMAKE_Fortran_COMPILER_ID}' is not supported") endif() file(STRINGS "$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_EXTERNAL_LIB_BASIC = .*$?") From 548857c6a697301eb9f108ae194fc2397b379c93 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 17 Dec 2022 14:55:17 +0100 Subject: [PATCH 2/4] not needed --- src/CLI.f90 | 1 - src/mesh/discretization_mesh.f90 | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/CLI.f90 b/src/CLI.f90 index a6a70b2e9..ad458c34b 100644 --- a/src/CLI.f90 +++ b/src/CLI.f90 @@ -5,7 +5,6 @@ !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Parse command line interface for PETSc-based solvers !-------------------------------------------------------------------------------------------------- -#define PETSC_MAJOR 3 #define PETSC_MINOR_MIN 12 #define PETSC_MINOR_MAX 18 diff --git a/src/mesh/discretization_mesh.f90 b/src/mesh/discretization_mesh.f90 index abda549b7..9682a6fb6 100644 --- a/src/mesh/discretization_mesh.f90 +++ b/src/mesh/discretization_mesh.f90 @@ -56,11 +56,10 @@ module discretization_mesh real(pReal), dimension(:,:,:), allocatable :: & mesh_ipCoordinates !< IP x,y,z coordinates (after deformation!) - external :: & #ifdef PETSC_USE_64BIT_INDICES - DMDestroy, & + external :: & + DMDestroy #endif - DMView ! ToDo: write interface public :: & discretization_mesh_init, & mesh_FEM_build_ipVolumes, & @@ -120,8 +119,6 @@ subroutine discretization_mesh_init(restart) call DMGetStratumSize(globalMesh,'depth',dimPlex,NelemsGlobal,err_PETSc) CHKERRQ(err_PETSc) mesh_NcpElemsGlobal = int(NelemsGlobal) - call DMView(globalMesh, PETSC_VIEWER_STDOUT_WORLD,err_PETSc) - CHKERRQ(err_PETSc) ! get number of IDs in face sets (for boundary conditions?) call DMGetLabelSize(globalMesh,'Face Sets',Nboundaries,err_PETSc) From 3a643d04c4570e5fa11a219bc8b2d6dc8c6029f9 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 17 Dec 2022 16:13:35 +0100 Subject: [PATCH 3/4] only valid/needed for GNU --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d0a95fa23..c1466ebdd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,7 +18,7 @@ endif() foreach(solver-source ${solver-sources}) file(READ ${solver-source} content) string(FIND "${content}" "CHKERR" found) - if(NOT ${found} EQUAL -1) + if((NOT ${found} EQUAL -1) AND (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")) set_source_files_properties(${solver-source} PROPERTIES COMPILE_FLAGS "-ffree-line-length-none") endif() endforeach() From c2d63532dffe78f2e2b7a74405b68c3526130d2a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 18 Dec 2022 09:45:33 +0100 Subject: [PATCH 4/4] macos installation of PETSc does not work --- .github/workflows/Fortran.yml | 42 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml index 3fa4426dc..4229b097a 100644 --- a/.github/workflows/Fortran.yml +++ b/.github/workflows/Fortran.yml @@ -2,7 +2,7 @@ name: Grid and Mesh Solver on: [push] env: - PETSC_VERSION: '3.18.1' + PETSC_VERSION: '3.18.2' HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker HOMEBREW_NO_AUTO_UPDATE: 'ON' HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON' @@ -11,14 +11,14 @@ env: jobs: - gcc: + gcc_ubuntu: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-22.04 strategy: matrix: - os: [ubuntu-latest, macos-latest] - gcc_v: [9, 10, 11] # Version of GCC compilers + gcc_v: [9, 10, 11, 12] + fail-fast: false env: GCC_V: ${{ matrix.gcc_v }} @@ -27,8 +27,7 @@ jobs: - uses: actions/checkout@v3 - - name: GCC - Install (Linux) - if: contains( matrix.os, 'ubuntu') + - name: GCC - Install run: | sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update @@ -38,12 +37,6 @@ jobs: --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V} \ --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} - - name: GCC - Install (macOS) - if: contains( matrix.os, 'macos') - run: | - brew install gcc@${GCC_V} || brew upgrade gcc@${GCC_V} || true - brew link gcc@${GCC_V} - - name: PETSc - Cache download id: petsc-download uses: actions/cache@v3 @@ -63,28 +56,19 @@ jobs: export PETSC_ARCH=gcc${GCC_V} printenv >> $GITHUB_ENV - - name: PETSc - Cache installation + - name: PETSc - Cache Installation id: petsc-install uses: actions/cache@v3 with: path: petsc-${{ env.PETSC_VERSION }} - key: petsc-${{ env.PETSC_VERSION }}-${{ matrix.os }}-gcc${{ matrix.gcc_v }}-${{ hashFiles('**/petscversion.h') }} + key: petsc-${{ env.PETSC_VERSION }}-gcc${{ matrix.gcc_v }}-${{ hashFiles('**/petscversion.h') }} - - name: PETSc - Install (Linux) - if: contains( matrix.os, 'ubuntu') + - name: PETSc - Installation run: | cd petsc-${PETSC_VERSION} ./configure --with-fc=gfortran --with-cc=gcc --with-cxx=g++ \ - --download-mpich --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib \ - --with-mpi-f90module-visibility=0 - make all - - - name: PETSc - Install (macOS) - if: contains( matrix.os, 'macos') - run: | - cd petsc-${PETSC_VERSION} - ./configure --with-fc=gfortran-${GCC_V} --with-cc=gcc-${GCC_V} --with-cxx=g++-${GCC_V} \ - --download-openmpi --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib + --download-openmpi --download-fftw --download-hdf5 --download-hdf5-fortran-bindings=1 --download-zlib \ + --with-mpi-f90module-visibility=1 make all - name: DAMASK - Compile @@ -100,6 +84,7 @@ jobs: run: | ./bin/DAMASK_grid -l tensionX.yaml -g 20grains16x16x16.vti -w examples/grid + intel: runs-on: [ubuntu-22.04] @@ -107,6 +92,7 @@ jobs: strategy: matrix: intel_v: [classic, llvm] # Variant of Intel compilers + fail-fast: false env: INTEL_V: ${{ matrix.intel_v }} @@ -143,7 +129,7 @@ jobs: - name: PETSc - Prepare run: | tar -xf download/petsc-${PETSC_VERSION}.tar.gz -C . - sed -i "1715s/if not os.path.isfile(os.path.join(self.packageDir,'configure')):/if True:/g" \ + sed -i "1718s/if not os.path.isfile(os.path.join(self.packageDir,'configure')):/if True:/g" \ ./petsc-${PETSC_VERSION}/config/BuildSystem/config/package.py export PETSC_DIR=${PWD}/petsc-${PETSC_VERSION} export PETSC_ARCH=intel-${INTEL_V}