Skip to content

Instantly share code, notes, and snippets.

@tbhaxor
Last active March 24, 2023 11:56
Show Gist options
  • Select an option

  • Save tbhaxor/2772c2c8726a56cf2719e0be259817a7 to your computer and use it in GitHub Desktop.

Select an option

Save tbhaxor/2772c2c8726a56cf2719e0be259817a7 to your computer and use it in GitHub Desktop.

Revisions

  1. tbhaxor revised this gist Mar 24, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion compile.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ sudo pacman -S --no-confirm cuda cuda-tools git openmpi hdf5-openmpi gcc11 gcc11
    git clone https://github.com/parthenon-hpc-lab/athenapk --recurse-submodules
    cd athenapk

    curl -fsOSL https://gist.githubusercontent.com/tbhaxor/2772c2c8726a56cf2719e0be259817a7/raw/722076bf1e61be7fe6b667e02119e985e39ec149/ArchMachineConfig.cmake
    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
  2. tbhaxor revised this gist Mar 24, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions compile.sh
    Original file line number Diff line number Diff line change
    @@ -2,11 +2,11 @@

    set -ex

    sudo pacman -Syu
    sudo pacman -Syu --no-confirm

    # You can use ninja or make
    # I am using ninja because it is faster than make
    sudo pacman -S cuda cuda-tools git openmpi hdf5-openmpi gcc11 gcc11-libs ninja
    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
  3. tbhaxor revised this gist Mar 24, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion compile.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ sudo pacman -S cuda cuda-tools git openmpi hdf5-openmpi gcc11 gcc11-libs ninja
    git clone https://github.com/parthenon-hpc-lab/athenapk --recurse-submodules
    cd athenapk

    wget $PATH HERE
    curl -fsOSL https://gist.githubusercontent.com/tbhaxor/2772c2c8726a56cf2719e0be259817a7/raw/722076bf1e61be7fe6b667e02119e985e39ec149/ArchMachineConfig.cmake

    # You can omit "-G Ninja" to use make
    cmake -Bbuild -DMACHINE_CFG=ArchMachineConfig.cmake -G Ninja
  4. tbhaxor created this gist Mar 24, 2023.
    13 changes: 13 additions & 0 deletions ArchMachineConfig.cmake
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    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")
    22 changes: 22 additions & 0 deletions compile.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/bin/sh

    set -ex

    sudo pacman -Syu

    # You can use ninja or make
    # I am using ninja because it is faster than make
    sudo pacman -S cuda cuda-tools git openmpi hdf5-openmpi gcc11 gcc11-libs ninja

    git clone https://github.com/parthenon-hpc-lab/athenapk --recurse-submodules
    cd athenapk

    wget $PATH HERE

    # 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