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

Commit

Permalink
Added an intel and gnu version of the build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 14, 2024
1 parent c64e9e2 commit e25aaad
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 17 deletions.
39 changes: 39 additions & 0 deletions buildscripts/build_negishi_gnu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/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/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/gcc/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
File renamed without changes.
18 changes: 11 additions & 7 deletions buildscripts/get_platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,21 @@ esac
case $OS in
Linux)
# Currently ifx support is not great
# if command -v ifx >/dev/null 2>&1; then
# OS="Linux-ifx"

if command -v ifort >/dev/null 2>&1; then
case $FC in
*ifx)
OS="Linux-ifx"
;;
*ifort)
OS="Linux-ifort"
elif command -v gfortran >/dev/null 2>&1; then
;;
*gfortran)
OS="Linux-gnu"
else
;;
*)
echo "No Fortran compiler found on Linux"
exit 1
fi
::
esac
;;
Darwin)
OS="MacOSX"
Expand Down
14 changes: 4 additions & 10 deletions cmake/Modules/SetSwiftestFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ IF (NOT BUILD_SHARED_LIBS AND NOT WINOPT)
Fortran "-static-libquadmath"
)
ENDIF ()
SET_COMPILE_FLAG(CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS}"
Fortran "-Wl,--verbose"
)
IF (USE_OPENMP)
SET_COMPILE_FLAG(CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS}"
Fortran "-lomp"
Expand Down Expand Up @@ -419,16 +422,7 @@ IF (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "TESTING" )
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fbacktrace" # GNU (gfortran)
)
# Sanitize
IF (NOT APPLE)
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fsanitize=address, undefined" # Gnu
)
SET_COMPILE_FLAG(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}"
C "-fsanitize=address, undefined" # Gnu
)
ENDIF()
# Check everything
# # Check everything
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-fcheck=all" # GNU
)
Expand Down

0 comments on commit e25aaad

Please sign in to comment.