From 59977aa18c1c108e94e7e8799e695703f4111a62 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Thu, 15 Feb 2024 00:41:25 -0500 Subject: [PATCH] Updated build scripts --- buildscripts/build_bell_gnu.sh | 39 ------------- buildscripts/build_bell_intel.sh | 45 --------------- buildscripts/build_rcac_gnu.sh | 74 +++++++++++++++++++++++++ buildscripts/build_rcac_intel.sh | 82 ++++++++++++++++++++++++++++ cmake/Modules/SetSwiftestFlags.cmake | 14 +++-- environment.yml | 2 + 6 files changed, 167 insertions(+), 89 deletions(-) delete mode 100755 buildscripts/build_bell_gnu.sh delete mode 100755 buildscripts/build_bell_intel.sh create mode 100755 buildscripts/build_rcac_gnu.sh create mode 100755 buildscripts/build_rcac_intel.sh diff --git a/buildscripts/build_bell_gnu.sh b/buildscripts/build_bell_gnu.sh deleted file mode 100755 index e9bece5ca..000000000 --- a/buildscripts/build_bell_gnu.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/zsh -l -# installs an editable (local) package in release mode on Negishi -# This is a convenience script for Kaustub - -set -a -SCRIPT_DIR=$(realpath $(dirname $0)) -ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) -cd ${ROOT_DIR} -BUILD_TYPE=${1:-"Release"} - -module purge -module use /depot/daminton/etc/modules -module load use.own -module load conda-env/mintongroup-py3.9.13 -module load gcc/10.2.0 -module load hdf5/1.10.6 -module load netcdf-c/4.4.4 -module load netcdf-fortran/4.5.3 -module load shtools/gcc10.2.0/4.11.10 -cmake -P distclean.cmake -if [[ BUILD_TYPE == "Release" ]]; then - pip install --config-settings=build-dir="build" \ - --config-settings=cmake.build-type="${BUILD_TYPE}" \ - --config-settings=cmake.args="-DUSE_SIMD=ON" \ - --config-settings=cmake.args="-DUSE_OPENMP=ON" \ - --config-settings=cmake.args="-DCMAKE_Fortran_COMPILER=gfortran" \ - --config-settings=cmake.args="-DMACHINE_CODE_VALUE=\"Host\" " \ - --config-settings=install.strip=false \ - --no-build-isolation \ - -ve . -else - pip uninstall swiftest -y - cmake -P distclean.cmake - cmake -B ${ROOT_DIR}/build -S . -G Ninja \ - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DCMAKE_Fortran_COMPILER=gfortran - - cmake --build ${ROOT_DIR}/build -j${OMP_NUM_THREADS} -v -fi \ No newline at end of file diff --git a/buildscripts/build_bell_intel.sh b/buildscripts/build_bell_intel.sh deleted file mode 100755 index e99ae9e60..000000000 --- a/buildscripts/build_bell_intel.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/zsh -l -# installs an editable (local) package in release mode on Negishi -# This is a convenience script for Kaustub - -set -a -SCRIPT_DIR=$(realpath $(dirname $0)) -ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) -cd ${ROOT_DIR} -BUILD_TYPE=${1:-"Release"} - -module purge -module load intel/19.0.5.281 -module load intel-mkl/2019.5.281 -module load impi/2019.5.281 -source ${INTEL_ONEAPI_COMPILERS_HOME}/setvars.sh > /dev/null 2>&1 -module use /depot/daminton/etc/modules -module load use.own -module load conda-env/mintongroup-py3.9.13 -module load hdf5/1.10.6 -module load netcdf-c/4.4.4 -module load netcdf-fortran/4.5.3 -module load shtools/intel19.0.5.281/4.11.10 -cmake -P distclean.cmake -if [[ BUILD_TYPE == "Release" ]]; then - pip install --config-settings=build-dir="build" \ - --config-settings=cmake.build-type="${BUILD_TYPE}" \ - --config-settings=cmake.args="-DUSE_SIMD=ON" \ - --config-settings=cmake.args="-DUSE_OPENMP=ON" \ - --config-settings=cmake.args="-DCMAKE_Fortran_COMPILER=mpiifort" \ - --config-settings=cmake.args="-DCMAKE_Fortran_FLAGS=\"-f90=ifort\"" \ - --config-settings=cmake.args="-DMACHINE_CODE_VALUE=\"Host\" " \ - --config-settings=install.strip=false \ - --no-build-isolation \ - -ve . -else - pip uninstall swiftest -y - cmake -P distclean.cmake - cmake -B ${ROOT_DIR}/build -S . -G Ninja \ - -DMACHINE_CODE_VALUE="SSE2" \ - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DCMAKE_Fortran_COMPILER=mpiifort \ - -DCMAKE_Fortran_FLAGS="-f90=ifort" - - cmake --build ${ROOT_DIR}/build -j${OMP_NUM_THREADS} -v -fi \ No newline at end of file diff --git a/buildscripts/build_rcac_gnu.sh b/buildscripts/build_rcac_gnu.sh new file mode 100755 index 000000000..f0722967a --- /dev/null +++ b/buildscripts/build_rcac_gnu.sh @@ -0,0 +1,74 @@ +#!/bin/zsh -l +# installs an editable (local) package in release mode on Negishi +# This is a convenience script for Kaustub + + + +set -a +SCRIPT_DIR=$(realpath $(dirname $0)) +ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) +cd ${ROOT_DIR} +BUILD_TYPE=${1:-"Release"} + +MACHINE_NAME=$(uname -n | awk -F. '{ + if ($2 == "negishi" || $2 == "bell") + print $2; + else { + split($1, a, "-"); + if (length(a) > 1) + print a[1]; + else + print "Unknown"; + } +}') + +if [[ $MACHINE_NAME == "bell" ]]; then + module purge + module use /depot/daminton/etc/modules/bell + module load gcc/10.2.0 + module load hdf5/1.10.6 + module load netcdf/4.7.4 + module load netcdf-fortran/4.5.3 + module load shtools/gcc10/4.11.10 + module load cmake/3.20.6 + module load ninja/1.11.1 + if [[ $BUILD_TYPE == "Release" ]]; then + module load use.own + module load conda-env/swiftest-env-py3.8.5 + fi +elif [[ $MACHINE_NAME == "negishi" ]]; then + module purge + module use /depot/daminton/etc/modules/negishi + module load gcc/12.2.0 + module load hdf5/1.13.2 + module load netcdf-c/4.9.0 + module load netcdf-fortran/4.6.0 + module load shtools/gcc12/4.11.10 + module load cmake/3.24.3 + module load ninja/1.11.1 + if [[ $BUILD_TYPE == "Release" ]]; then + module load use.own + module load conda-env/swiftest-env-py3.9.13 + fi +fi + +cmake -P distclean.cmake +if [[ BUILD_TYPE == "Release" ]]; then + pip install --config-settings=build-dir="build" \ + --config-settings=cmake.build-type="${BUILD_TYPE}" \ + --config-settings=cmake.args="-DUSE_SIMD=ON" \ + --config-settings=cmake.args="-DUSE_OPENMP=ON" \ + --config-settings=cmake.args="-DCMAKE_Fortran_COMPILER=gfortran" \ + --config-settings=cmake.args="-DMACHINE_CODE_VALUE=\"Host\" " \ + --config-settings=install.strip=false \ + --no-build-isolation \ + -ve . +else + pip uninstall swiftest -y + cmake -P distclean.cmake + cmake -B ${ROOT_DIR}/build -S . -G Ninja \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_Fortran_COMPILER=gfortran + + cmake --build ${ROOT_DIR}/build -j${OMP_NUM_THREADS} -v +fi \ No newline at end of file diff --git a/buildscripts/build_rcac_intel.sh b/buildscripts/build_rcac_intel.sh new file mode 100755 index 000000000..cf47122e8 --- /dev/null +++ b/buildscripts/build_rcac_intel.sh @@ -0,0 +1,82 @@ +#!/bin/zsh -l +# installs an editable (local) package on Bell +# This is a convenience script for Kaustub +# To use in Release mode, be sure to create the swiftest-env module first. Using the RCAC tools it's the following commands: +# $ conda env create -f environment.yml +# $ conda-env-mod module -n swiftest-env --jupyter + + +set -a +SCRIPT_DIR=$(realpath $(dirname $0)) +ROOT_DIR=$(realpath ${SCRIPT_DIR}/..) +cd ${ROOT_DIR} +BUILD_TYPE=${1:-"Release"} + +MACHINE_NAME=$(uname -n | awk -F. '{ + if ($2 == "negishi" || $2 == "bell") + print $2; + else { + split($1, a, "-"); + if (length(a) > 1) + print a[1]; + else + print "Unknown"; + } +}') + + +if [[ $MACHINE_NAME == "bell" ]]; then + module purge + module use /depot/daminton/etc/modules/bell + module load intel/19.0.5.281 + module load intel-mkl/2019.5.281 + module load impi/2019.5.281 + module load shtools/intel19/4.11.10 + module load cmake/3.20.6 + module load ninja/1.11.1 + module load hdf5/1.10.6 + module load netcdf/4.7.4 + module load netcdf-fortran/4.5.3 + if [[ $BUILD_TYPE == "Release" ]]; then + module load use.own + module load conda-env/swiftest-env-py3.8.5 + fi +elif [[ $MACHINE_NAME == "negishi" ]]; then + module purge + module use /depot/daminton/etc/modules/negishi + module load intel-oneapi-compilers/2023.0.0 + module load intel-oneapi-mkl/2023.0.0 + module load intel-oneapi-mpi/2021.8.0 + source ${INTEL_ONEAPI_COMPILERS_HOME}/setvars.sh > /dev/null 2>&1 + module load netcdf-fortran/intel-oneapi/4.6.1 + module load shtools/intel-oneapi/4.11.10 + module load cmake/3.24.3 + module load ninja/1.11.1 + if [[ $BUILD_TYPE == "Release" ]]; then + module load use.own + module load conda-env/mintongroup-py3.9.13 + fi +fi + + +cmake -P distclean.cmake +if [[ $BUILD_TYPE == "Release" ]]; then + pip install --config-settings=build-dir="build" \ + --config-settings=cmake.build-type="${BUILD_TYPE}" \ + --config-settings=cmake.args="-DUSE_SIMD=ON" \ + --config-settings=cmake.args="-DUSE_OPENMP=ON" \ + --config-settings=cmake.args="-DCMAKE_Fortran_COMPILER=mpiifort" \ + --config-settings=cmake.args="-DCMAKE_Fortran_FLAGS=\"-f90=ifort\"" \ + --config-settings=cmake.args="-DMACHINE_CODE_VALUE=\"Host\" " \ + --config-settings=install.strip=false \ + --no-build-isolation \ + -ve . +else + cmake -B ${ROOT_DIR}/build -S . -G Ninja \ + -DMACHINE_CODE_VALUE="SSE2" \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DCMAKE_Fortran_COMPILER=mpiifort \ + -DCMAKE_Fortran_FLAGS="-f90=ifort" + + cmake --build ${ROOT_DIR}/build -j${OMP_NUM_THREADS} -v +fi \ No newline at end of file diff --git a/cmake/Modules/SetSwiftestFlags.cmake b/cmake/Modules/SetSwiftestFlags.cmake index 41472fa4c..bcd73a0ba 100644 --- a/cmake/Modules/SetSwiftestFlags.cmake +++ b/cmake/Modules/SetSwiftestFlags.cmake @@ -162,7 +162,10 @@ IF (NOT BUILD_SHARED_LIBS AND NOT WINOPT) IF (USE_OPENMP) SET_COMPILE_FLAG(CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS}" Fortran "-lomp" - "-lgomp" + + ) + SET_COMPILE_FLAG(CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS}" + Fortran "-lgomp" ) ENDIF (USE_OPENMP) ENDIF () @@ -520,8 +523,7 @@ IF (CMAKE_BUILD_TYPE STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE STREQUAL "PROFILE") ) # Tells the compiler to link to certain libraries in the Intel oneAPI Math Kernel Library (oneMKL). SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" - Fortran "/Qmkl:cluster" # Intel Windows - "/Qmkl" # Intel Windows + Fortran "/Qmkl" # Intel Windows ) # Enables additional interprocedural optimizations for a single file compilation SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" @@ -556,8 +558,10 @@ IF (CMAKE_BUILD_TYPE STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE STREQUAL "PROFILE") ) # Tells the compiler to link to certain libraries in the Intel oneAPI Math Kernel Library (oneMKL). SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" - Fortran "-qmkl=cluster" - "-qmkl" + Fortran "-mkl" + ) + SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + Fortran "-qmkl" ) # Enables additional interprocedural optimizations for a single file compilation SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" diff --git a/environment.yml b/environment.yml index fd5ff0316..9c6b1d9b8 100644 --- a/environment.yml +++ b/environment.yml @@ -38,3 +38,5 @@ dependencies: - pip - flake8 - pyshtools + - scikit-build-core + - ipykernel