From d357a693118cfff80bfb60b26a9271a3c2e2d1a2 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 4 Sep 2021 18:44:24 +0200 Subject: [PATCH] testing Fortran compilation --- .github/workflows/Fortran.yml | 161 ++++++++++++++++++ .github/workflows/{.python.yml => Python.yml} | 0 2 files changed, 161 insertions(+) create mode 100644 .github/workflows/Fortran.yml rename .github/workflows/{.python.yml => Python.yml} (100%) diff --git a/.github/workflows/Fortran.yml b/.github/workflows/Fortran.yml new file mode 100644 index 000000000..a190a5671 --- /dev/null +++ b/.github/workflows/Fortran.yml @@ -0,0 +1,161 @@ +name: Fortran + +on: [push] + +env: + HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker + HOMEBREW_NO_AUTO_UPDATE: "ON" + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" + HOMEBREW_NO_GITHUB_API: "ON" + HOMEBREW_NO_INSTALL_CLEANUP: "ON" + +jobs: + gcc: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + gcc_v: [9, 10, 11] # Version of GCC compilers we want to use. + env: + GCC_V: ${{ matrix.gcc_v }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python 3.x + uses: actions/setup-python@v1 + with: + python-version: 3.x + + - name: Install GCC (Linux) + if: contains( matrix.os, 'ubuntu') + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V} g++-${GCC_V} + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ + --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_V} \ + --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} + + - name: Install GCC (macOS) + if: contains( matrix.os, 'macos') + run: | + brew install gcc@${GCC_V} || brew upgrade gcc@${GCC_V} || true + brew link gcc@${GCC_V} + + - name: Get PETSc + run: | + wget -q https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.15.4.tar.gz + tar -xf petsc-3.15.4.tar.gz + export PETSC_DIR=${PWD}/petsc-3.15.4 + export PETSC_ARCH=gcc${GCC_V} + printenv >> $GITHUB_ENV + + - name: Cache PETSc Installation + uses: actions/cache@v2 + with: + path: petsc-3.15.4 + key: ${{ matrix.os }}-gcc${{ matrix.gcc_v }}-${{ hashFiles('**/petscversion.h') }}-6 + + - name: Install PETSc (Linux) + if: contains( matrix.os, 'ubuntu') + run: | + cd petsc-3.15.4 + ./configure --with-fc=gfortran --with-cc=gcc --with-cxx=g++ \ + --download-mpich --download-fftw --download-hdf5 --download-zlib \ + --with-mpi-f90module-visibility=0 + make all + + - name: Install PETSc (macOS) + if: contains( matrix.os, 'macos') + run: | + cd petsc-3.15.4 + ./configure --with-fc=gfortran-${GCC_V} --with-cc=gcc-${GCC_V} --with-cxx=g++-${GCC_V} \ + --download-openmpi --download-fftw --download-hdf5 --download-zlib + make all + + - name: Compile DAMASK + run: | + cmake -B build/grid -DDAMASK_SOLVER=grid -DCMAKE_INSTALL_PREFIX=${PWD} + cmake --build build/grid --parallel + cmake --install build/grid + cmake -B build/mesh -DDAMASK_SOLVER=mesh -DCMAKE_INSTALL_PREFIX=${PWD} + cmake --build build/mesh --parallel + cmake --install build/mesh + + - name: Run DAMASK + run: | + ./bin/DAMASK_grid -l tensionX.yaml -g 20grains16x16x16.vti -w examples/grid + + intel: + runs-on: [ubuntu-latest] + strategy: + matrix: + intel_v: [classic, llvm] # Version of Intel compilers we want to use. + env: + INTEL_V: ${{ matrix.intel_v }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python 3.x + uses: actions/setup-python@v1 + with: + python-version: 3.x + + - name: Install Intel + run: | + wget -q https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install intel-hpckit + source /opt/intel/oneapi/setvars.sh + printenv >> $GITHUB_ENV + + - name: Get PETSc + run: | + wget -q https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.15.4.tar.gz + tar -xf petsc-3.15.4.tar.gz + export PETSC_DIR=${PWD}/petsc-3.15.4 + export PETSC_ARCH=intel-${INTEL_V} + printenv >> $GITHUB_ENV + + - name: Cache PETSc Installation + uses: actions/cache@v2 + with: + path: petsc-3.15.4 + key: ${{ matrix.os }}-gcc${{ matrix.intel_v }}-${{ hashFiles('**/petscversion.h') }}-6 + + - name: Install PETSc Intel (classic) + if: contains( matrix.intel_v, 'classic') + run: | + cd petsc-3.15.4 + ./configure --with-fc=mpiifort --with-cc=mpiicc --with-cxx=mpiicpc \ + --download-fftw --download-hdf5 --download-zlib + make all + + - name: Install PETSc Intel (LLVM) + if: contains( matrix.intel_v, 'llvm') + run: | + cd petsc-3.15.4 + ./configure --with-fc=mpiifort --with-cc="mpiicc -cc=icx" --with-cxx="mpiicpc -cxx=icpx" \ + --download-fftw --download-hdf5 --download-zlib + make all + + - name: Compile DAMASK + run: | + cmake -B build/grid -DDAMASK_SOLVER=grid -DCMAKE_INSTALL_PREFIX=${PWD} + cmake --build build/grid --parallel + cmake --install build/grid + cmake -B build/mesh -DDAMASK_SOLVER=mesh -DCMAKE_INSTALL_PREFIX=${PWD} + cmake --build build/mesh --parallel + cmake --install build/mesh + + - name: Run DAMASK + run: | + ./bin/DAMASK_grid -l tensionX.yaml -g 20grains16x16x16.vti -w examples/grid diff --git a/.github/workflows/.python.yml b/.github/workflows/Python.yml similarity index 100% rename from .github/workflows/.python.yml rename to .github/workflows/Python.yml