Skip to content

Commit

Permalink
Darwin compile standarization/expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Prather committed Sep 25, 2023
1 parent e3ffb0b commit 125d494
Showing 1 changed file with 62 additions and 30 deletions.
92 changes: 62 additions & 30 deletions machines/darwin.sh
Original file line number Diff line number Diff line change
@@ -1,60 +1,80 @@
# LANL Darwin. A little bit of everything

# Must list which node you're compiling for:
# ampere for AMD/NVIDIA A100 nodes
# volta for x86/volta of all kinds
# Not working yet:
# arm-nv to compile for devkit ARM/NVIDIA nodes
# Must list which node you're compiling for,
# from the options below

if [[ $HOSTNAME == "cn"* || $HOSTNAME == "darwin"* ]]; then
module purge
module load cmake

# Where we're going, we don't need system libraries
ARGS="$ARGS hdf5"

# Help Darwin find the right modules in automated jobs
if [[ "$ARGS" == *"cuda"* ]]; then
if [[ "$ARGS" == *"cuda"* && "$ARGS" == *"arm-"* ]]; then
export MODULEPATH="/projects/darwin-nv/modulefiles/rhel8/aarch64:/projects/darwin-nv/modulefiles/rhel8/aarch64"
fi

# Load modules based on first argument...
if [[ "$ARGS" == *"cuda"* ]]; then
if [[ "$ARGS" == *"gcc12"* ]]; then
module load cuda/12.0.0 openmpi gcc/12.1.0
C_NATIVE=gcc
CXX_NATIVE=g++
elif [[ "$ARGS" == *"gcc"* ]]; then
module load cuda openmpi gcc/10.2.0
C_NATIVE=gcc
CXX_NATIVE=g++
else
module load nvhpc/22.1 cuda/12.0.0
# Load compiler...
if [[ "$ARGS" == *"gcc12"* ]]; then
module load openmpi gcc/12.2.0
C_NATIVE=gcc
CXX_NATIVE=g++
elif [[ "$ARGS" == *"gcc10"* ]]; then
module load openmpi gcc/10.4.0
C_NATIVE=gcc
CXX_NATIVE=g++
elif [[ "$ARGS" == *"gcc"* ]]; then
# Default GCC
module load openmpi gcc/13.1.0
C_NATIVE=gcc
CXX_NATIVE=g++
elif [[ "$ARGS" == *"aocc"* ]]; then
module load aocc openmpi
C_NATIVE=clang
CXX_NATIVE=clang++
elif [[ "$ARGS" == *"nvhpc"* ]]; then
module load nvhpc
C_NATIVE="nvc"
CXX_NATIVE="nvc++"
# New NVHPC doesn't like CUDA_HOME
export NVHPC_CUDA_HOME="$CUDA_HOME"
unset CUDA_HOME
elif [[ "$ARGS" == *"icc"* ]]; then
module load intel-classic/2021.3.0 openmpi
C_NATIVE=icc
CXX_NATIVE=icpc
else
# Default: NVHPC if cuda else IntelLLVM
if [[ "$ARGS" == *"cuda"* ]]; then
module load nvhpc
C_NATIVE="nvc"
CXX_NATIVE="nvc++"
# New NVHPC doesn't like CUDA_HOME
export NVHPC_CUDA_HOME="$CUDA_HOME"
unset CUDA_HOME
else
module load intel openmpi
C_NATIVE=icx
CXX_NATIVE=icpx
fi
fi

# ...any accelerator libraries...
if [[ "$ARGS" == *"cuda"* ]]; then
module load cuda/12.0.0
elif [[ "$ARGS" == *"hip"* ]]; then
module load rocm/5.4.3 #openmpi/5.0.0rc11-gcc_13.1.0
source ~/libs/env.sh
C_NATIVE=hipcc
CXX_NATIVE=hipcc
export CXXFLAGS="-fopenmp $CXXFLAGS"
else
if [[ "$ARGS" == *"gcc"* ]]; then
module load openmpi gcc/10.2.0
C_NATIVE=gcc
CXX_NATIVE=g++
export CXXFLAGS="-fno-builtin-memset"
else
module load openmpi intel
C_NATIVE=icx
CXX_NATIVE=icpx
fi
fi

# ...and set architecture according to second.
# ...and set architecture
# These are orthogonal to above, so long as the hardware
# supports the paradigm
# Note this also specifies cores to use for compiling
NPROC=$(($(nproc) / 2))
if [[ "$ARGS" == *"arm-ampere"* ]]; then
HOST_ARCH="ARMV81"
Expand Down Expand Up @@ -86,6 +106,18 @@ if [[ $HOSTNAME == "cn"* || $HOSTNAME == "darwin"* ]]; then
HOST_ARCH="HSW"
MPI_NUM_PROCS=1
NODE_SLICE=1
elif [[ "$ARGS" == *"skx"* ]]; then
HOST_ARCH="SKX"
MPI_NUM_PROCS=${MPI_NUM_PROCS:-$NPROC}
NODE_SLICE=${MPI_NUM_PROCS:-$NPROC}
elif [[ "$ARGS" == *"zen2"* ]]; then
HOST_ARCH=ZEN2
MPI_NUM_PROCS=1
NODE_SLICE=1
elif [[ "$ARGS" == *"zen3"* ]]; then
HOST_ARCH=ZEN3
MPI_NUM_PROCS=1
NODE_SLICE=1
elif [[ "$ARGS" == *"mi250"* ]]; then
HOST_ARCH=ZEN3
DEVICE_ARCH=VEGA90A
Expand Down

0 comments on commit 125d494

Please sign in to comment.