Skip to content

Instantly share code, notes, and snippets.

@tbhaxor
Last active March 24, 2023 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbhaxor/2772c2c8726a56cf2719e0be259817a7 to your computer and use it in GitHub Desktop.
Save tbhaxor/2772c2c8726a56cf2719e0be259817a7 to your computer and use it in GitHub Desktop.
AthenaPK Compilation Steps
message(STATUS "Configuring cmake for Arch-based distros")
# Configure cuda install path
set(CUDA_ROOT "/opt/cuda" CACHE FILEPATH "Locate cuda compiler and libraries")
# Configure kokkos archtecture
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "Enable cuda backend for Kokkos")
set(GPU_DEVICE_ARCH "TURING75" CACHE STRING "GPU device architecture")
set(Kokkos_ARCH_${GPU_DEVICE_ARCH} ON CACHE BOOL "Enable Kokkos optimizations for ${GPU_DEVICE_ARCH} architecture only")
# Configure g++-11 and additional compile flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_ROOT}/targets/x86_64-linux/include -L${CUDA_ROOT}/targets/x86_64-linux/lib" CACHE STRING "Extra cxx flags for compilation")
set(CMAKE_CXX_COMPILER "/usr/bin/g++-11")
#!/bin/sh
set -ex
sudo pacman -Syu --no-confirm
# You can use ninja or make
# I am using ninja because it is faster than make
sudo pacman -S --no-confirm cuda cuda-tools git openmpi hdf5-openmpi gcc11 gcc11-libs ninja
git clone https://github.com/parthenon-hpc-lab/athenapk --recurse-submodules
cd athenapk
curl -fsOSL https://gist.githubusercontent.com/tbhaxor/2772c2c8726a56cf2719e0be259817a7/raw/4a322beef168fb521d637811da24d1f4fb304982/ArchMachineConfig.cmake
# You can omit "-G Ninja" to use make
cmake -Bbuild -DMACHINE_CFG=ArchMachineConfig.cmake -G Ninja
cmake --build build -- -j $(nproc)
# (Optional) if you want install the athenaPK globally
sudo install -g root -o root -m=0755 -s build/bin/athenaPK /usr/local/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment