Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Updated build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 15, 2024
1 parent 9647c1a commit 59977aa
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 89 deletions.
39 changes: 0 additions & 39 deletions buildscripts/build_bell_gnu.sh

This file was deleted.

45 changes: 0 additions & 45 deletions buildscripts/build_bell_intel.sh

This file was deleted.

74 changes: 74 additions & 0 deletions buildscripts/build_rcac_gnu.sh
Original file line number Diff line number Diff line change
@@ -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
82 changes: 82 additions & 0 deletions buildscripts/build_rcac_intel.sh
Original file line number Diff line number Diff line change
@@ -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
14 changes: 9 additions & 5 deletions cmake/Modules/SetSwiftestFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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}"
Expand Down
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ dependencies:
- pip
- flake8
- pyshtools
- scikit-build-core
- ipykernel

0 comments on commit 59977aa

Please sign in to comment.