diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 98ff3d69c..598c4f243 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/.github/workflows/spack.sh b/.github/workflows/spack.sh new file mode 100755 index 000000000..5c05d27f1 --- /dev/null +++ b/.github/workflows/spack.sh @@ -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 + diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml new file mode 100644 index 000000000..912826435 --- /dev/null +++ b/.github/workflows/spack.yml @@ -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}} diff --git a/.github/workflows/spack_packages_yaml b/.github/workflows/spack_packages_yaml new file mode 100644 index 000000000..e4d0c99fc --- /dev/null +++ b/.github/workflows/spack_packages_yaml @@ -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/ + diff --git a/unit_test/test_internal_blas.cc b/unit_test/test_internal_blas.cc index a2cbac79c..fed5b1c3e 100644 --- a/unit_test/test_internal_blas.cc +++ b/unit_test/test_internal_blas.cc @@ -53,6 +53,7 @@ const char* target_name(slate::Target target) case slate::Target::Devices: return "Devices"; default: assert(false); } + return "Error"; } // -----------------------------------------------------------------------------