Skip to content

Commit

Permalink
Merge pull request #95 from icl-utk-edu/gragghia/ci_spack
Browse files Browse the repository at this point in the history
Adding new files for github actions testing of spack package
  • Loading branch information
mgates3 authored Jun 6, 2024
2 parents 890b36f + dc3114c commit 1bae2c8
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.device }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure
run: .github/workflows/configure.sh ${{matrix.maker}} ${{matrix.device}}
- name: Build
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/spack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash -e

bstage=$1
device=$2

set +x
trap 'echo "# $BASH_COMMAND"' DEBUG

source /etc/profile

COMPILER=gcc@11
MPI=intel-oneapi-mpi
BLAS=intel-oneapi-mkl

# Get the system-install ROCM version
ROCM_VER=$(ls /opt | grep rocm- | sed s/rocm-//)
# Get the system-install CUDA version
CUDA_VER=$(cd /usr/local && ls -d cuda-*.* | sed "s/cuda-//")

if [ "${bstage}" = "deps" ]; then
git clone https://github.com/spack/spack
cp .github/workflows/spack_packages_yaml spack/etc/spack/packages.yaml
# Use $ROCM_VER in the spack package config
sed -i "s/ROCMVER/$ROCM_VER/" spack/etc/spack/packages.yaml
# Use $CUDA_VER in the spack package config
sed -i "s/CUDAVER/$CUDA_VER/" spack/etc/spack/packages.yaml
fi

export HOME=$(pwd)
source spack/share/spack/setup-env.sh
module load $COMPILER
spack compiler find --scope=site

if [ "${device}" = "cpu" ]; then
SPEC=""
elif [ "${device}" = "gpu_nvidia" ]; then
ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -1 | sed -e 's/\.//')
SPEC="+cuda cuda_arch=$ARCH"
elif [ "${device}" = "gpu_amd" ]; then
TARGET=$(rocminfo | grep Name | grep gfx | head -1 | awk '{print $2}')
SPEC="+rocm amdgpu_target=$TARGET ^hip@$ROCM_VER"
else
SPEC="+sycl"
COMPILER=oneapi
module load intel-oneapi-compilers
spack compiler find --scope=site
fi
SPEC="slate@master $SPEC %$COMPILER ^$MPI ^$BLAS"
echo SPEC=$SPEC

if [ "${bstage}" = "deps" ]; then
# Change the stage directory so we can find it later
spack config --scope=site add config:build_stage:`pwd`/spack-stage
spack spec $SPEC
spack install --only=dependencies --fail-fast $SPEC
elif [ "${bstage}" = "build" ]; then
spack dev-build -i $SPEC
elif [ "${bstage}" = "test" ]; then
spack uninstall -y slate
spack dev-build --test=root $SPEC || (
cat spack-stage/github/spack-stage-slate-master-*/install-time-test-log.txt
exit 22
)
elif [ "${bstage}" = "smoke" ]; then
spack test run slate
fi

26 changes: 26 additions & 0 deletions .github/workflows/spack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Spack

# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
slate_spack:
timeout-minutes: 360
strategy:
matrix:
device: [gpu_nvidia, gpu_amd, cpu]
fail-fast: false
runs-on: ${{ matrix.device }}
steps:
- uses: actions/checkout@v4
- name: Build Dependencies
run: .github/workflows/spack.sh deps ${{matrix.device}}
- name: Build SLATE
run: .github/workflows/spack.sh build ${{matrix.device}}
- name: Pre-install Test
run: .github/workflows/spack.sh test ${{matrix.device}}
- name: Post-install Test
run: .github/workflows/spack.sh smoke ${{matrix.device}}
39 changes: 39 additions & 0 deletions .github/workflows/spack_packages_yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
packages:
all:
target: ['x86_64']
cuda:
buildable: false
externals:
- spec: cuda@CUDAVER
prefix: /usr/local/cuda-CUDAVER/
hip:
buildable: false
externals:
- spec: hip@ROCMVER
prefix: /opt/rocm-ROCMVER/
rocblas:
buildable: false
externals:
- spec: rocblas@ROCMVER
prefix: /opt/rocm-ROCMVER/rocblas/
llvm-amdgpu:
buildable: false
externals:
- spec: llvm-amdgpu@ROCMVER
prefix: /opt/rocm-ROCMVER
comgr:
buildable: false
externals:
- spec: comgr@ROCMVER
prefix: /opt/rocm-ROCMVER
rocsolver:
buildable: false
externals:
- spec: rocsolver@ROCMVER
prefix: /opt/rocm-ROCMVER/rocsolver
hsa-rocr-dev:
buildable: false
externals:
- spec: hsa-rocr-dev@ROCMVER
prefix: /opt/rocm-ROCMVER/hsa/

1 change: 1 addition & 0 deletions unit_test/test_internal_blas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const char* target_name(slate::Target target)
case slate::Target::Devices: return "Devices";
default: assert(false);
}
return "Error";
}

// -----------------------------------------------------------------------------
Expand Down

0 comments on commit 1bae2c8

Please sign in to comment.