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

Commit

Permalink
Replaced OneAPI with v19 in the Intel build scripts on Negishi. Also …
Browse files Browse the repository at this point in the history
…fixed a bug in the Fortran Cmake that was preventing preprocessor flags being set properly in the library build
  • Loading branch information
daminton committed Feb 15, 2024
1 parent 9373b2e commit 78d9d77
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 22 deletions.
4 changes: 3 additions & 1 deletion buildscripts/_build_getopts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ set -a
SCRIPT_DIR=$(realpath $(dirname $0))
ROOT_DIR=$(realpath ${SCRIPT_DIR}/..)

echo "Getting the OS and ARCH values"
# Get platform and architecture
read -r OS ARCH < <($SCRIPT_DIR/get_platform.sh)
echo "Gotem! OS: $OS, ARCH: $ARCH"

# Parse arguments
USTMT="Usage: ${0} [-d /path/to/dependency/source] [-p /prefix/path] [-m MACOSX_DEPLOYMENT_TARGET]"
Expand Down Expand Up @@ -55,7 +57,7 @@ DEPENDENCY_DIR=${DEPENDENCY_DIR:-${BUILD_DIR}}


case $OS in
Linux-gnu|Linux-ifx|Linux-ifort)
Linux-gnu|Linux-ifx|Linux-ifort|Linux-mpiifort|MacOSX)
. ${SCRIPT_DIR}/set_environment_linux.sh
;;
MacOSX)
Expand Down
21 changes: 10 additions & 11 deletions buildscripts/build_rcac_intel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ if [[ $MACHINE_NAME == "bell" ]]; then
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 intel/19.1.3.304
module load intel-mkl/2019.9.304
module load impi/2019.9.304
module load shtools/intel19/4.11.10
module load cmake/3.24.3
module load ninja/1.11.1
module load hdf5/1.13.2
module load netcdf-c/4.9.0
module load netcdf-fortran/4.6.0
module load use.own
module load conda-env/swiftest-env-py3.9.13
MACHINE_CODE_VALUE="SSE2"
Expand All @@ -63,18 +64,16 @@ if [[ $BUILD_TYPE == "Release" ]]; then
--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="-DCMAKE_Fortran_COMPILER=${FC}" \
--config-settings=cmake.args="-DMACHINE_CODE_VALUE=$MACHINE_CODE_VALUE" \
--config-settings=install.strip=false \
--no-build-isolation \
-ve .
else
cmake -B ${ROOT_DIR}/build -S . -G Ninja \
-DMACHINE_CODE_VALUE=$MACHINE_CODE_VALUE \
-DMACHINE_CODE_VALUE=${MACHINE_CODE_VALUE} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_Fortran_COMPILER=mpiifort \
-DCMAKE_Fortran_FLAGS="-f90=ifort"
-DCMAKE_Fortran_COMPILER=${FC} \

cmake --build ${ROOT_DIR}/build -j${OMP_NUM_THREADS} -v
fi
3 changes: 3 additions & 0 deletions buildscripts/get_platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ case $OS in
*ifx)
OS="Linux-ifx"
;;
*mpiifort)
OS="Linux-mpiifort"
;;
*ifort)
OS="Linux-ifort"
;;
Expand Down
12 changes: 9 additions & 3 deletions buildscripts/set_compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
SCRIPT_DIR=$(realpath $(dirname $0))
ROOT_DIR=$(realpath ${SCRIPT_DIR}/..)
case "$OS" in
Linux-gnu|Linux-ifx|Linux-ifort|MacOSX)
Linux-gnu|Linux-ifx|Linux-ifort|Linux-mpiifort|MacOSX)
;;
*)
echo "Unknown compiler type: $OS"
Expand All @@ -42,8 +42,14 @@ case $OS in
;;
Linux-ifort)
FC=$(command -v ifort)
CC=$(command -v icx)
CXX=$(command -v icpx)
CC=$(command -v icc)
CXX=$(command -v icpc)
CPP=$(command -v cpp)
;;
Linux-mpiifort)
FC=$(command -v mpiifort)
CC=$(command -v mpiicc)
CXX=$(command -v mpiicpc)
CPP=$(command -v cpp)
;;
MacOSX)
Expand Down
6 changes: 0 additions & 6 deletions cmake/Modules/SetSwiftestFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,6 @@ IF (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "TESTING" )
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-check all" # Intel
)
SET_COMPILE_FLAG(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}"
C "-fcheck=conversions,stack,uninit" # Intel
)
# Initializes matrices/arrays with NaN values
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran "-init=snan,arrays" # Intel
Expand Down Expand Up @@ -560,9 +557,6 @@ IF (CMAKE_BUILD_TYPE STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE STREQUAL "PROFILE")
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}"
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}"
Fortran "-ip" # Intel
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ end program TestDoConcurrentLoc
TRY_COMPILE(DOCONLOC_WORKS ${CMAKE_BINARY_DIR} ${TESTFILE} COMPILE_DEFINITIONS "${CMAKE_Fortran_FLAGS}" OUTPUT_VARIABLE OUTPUT)
IF (DOCONLOC_WORKS)
MESSAGE(STATUS "DO CONCURRENT supports locality-spec")
TARGET_COMPILE_DEFINITIONS(${SWIFTEST_LIBRARY} PRIVATE -DDOCONLOC)
TARGET_COMPILE_DEFINITIONS(${SWIFTEST_DRIVER} PRIVATE -DDOCONLOC)
ELSE ()
MESSAGE(STATUS "DO CONCURRENT does not support locality-spec")
Expand All @@ -192,6 +193,7 @@ end program TestQuadPrecisionReal
TRY_COMPILE(QUADPREC ${CMAKE_BINARY_DIR} ${TESTFILE} COMPILE_DEFINITIONS "${CMAKE_Fortran_FLAGS}" OUTPUT_VARIABLE OUTPUT)
IF (QUADPREC)
MESSAGE(STATUS "Quad precision real is supported")
TARGET_COMPILE_DEFINITIONS(${SWIFTEST_LIBRARY} PRIVATE -DQUADPREC)
TARGET_COMPILE_DEFINITIONS(${SWIFTEST_DRIVER} PRIVATE -DQUADPREC)
ELSE ()
MESSAGE(STATUS "Quad precision real is not supported")
Expand Down
2 changes: 1 addition & 1 deletion src/swiftest/swiftest_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ module subroutine swiftest_util_get_energy_and_momentum_system(self, param)
Lcborbit(:) = cb%mass * (cb%rb(:) .cross. cb%vb(:))

#ifdef DOCONLOC
do concurrent (i = 1:npl, pl%lmask(i)) shared(pl,Lplorbit,kepl) local(h)
do concurrent (i = 1:npl, pl%lmask(i)) shared(pl,Lplorbit,kepl,npl) local(h)
#else
do concurrent (i = 1:npl, pl%lmask(i))
#endif
Expand Down

0 comments on commit 78d9d77

Please sign in to comment.