Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional gpu tests (New) #1359

Merged
merged 18 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions providers/gpgpu/bin/gpu_burn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
CUDA_PATH=$(find /usr/local -maxdepth 1 -type d -iname "cuda*")/bin
export PATH=$PATH:$CUDA_PATH
gpu_burn -c "$PLAINBOX_PROVIDER_DATA/compare.ptx" 14400 | grep -v -e '^[[:space:]]*$' -e "errors:" -e "Summary at"
3 changes: 3 additions & 0 deletions providers/gpgpu/bin/matrixMulDrv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
cp "$PLAINBOX_PROVIDER_DATA/matrixMul_kernel64.fatbin" .
matrixMulDrv
5 changes: 5 additions & 0 deletions providers/gpgpu/bin/simpleTextureDrv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
cp "$PLAINBOX_PROVIDER_DATA/simpleTexture_kernel64.fatbin" .
cp "$PLAINBOX_PROVIDER_DATA/teapot512.pgm" .
cp "$PLAINBOX_PROVIDER_DATA/ref_rotated.pgm" .
simpleTextureDrv
3 changes: 3 additions & 0 deletions providers/gpgpu/bin/vectorAddDrv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
cp "$PLAINBOX_PROVIDER_DATA/vectorAdd_kernel64.fatbin" .
vectorAddDrv
5 changes: 5 additions & 0 deletions providers/gpgpu/src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.PHONY: all
all: gpu-setup

gpu-setup:
../../tools/gpu-setup
89 changes: 69 additions & 20 deletions providers/gpgpu/tools/gpu-setup
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

if [[ $EUID -ne 0 ]]; then
echo "ERROR: This script must be run as root"
exit 1
fi

echo "Configuring system for GPU Testing"
echo "**********************************"
echo "*"
Expand Down Expand Up @@ -43,35 +38,89 @@ echo "* Adding nVidia package repository"
# SAUCE: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=debnetwork

OSRELEASE=ubuntu`lsb_release -r | cut -f2 |sed -e 's/\.//'`
REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/x86_64"
PINFILE="cuda-$OSRELEASE.pin"
if [[ "$OSRELEASE" =~ "2004" ]] || [[ "$OSRELEASE" =~ "1804" ]]; then
KEYFILE="cuda-$OSRELEASE-keyring.gpg"
else
KEYFILE="cuda-archive-keyring.gpg"
ARCH=`uname -m`
case $ARCH in
arm)
;&
aarch64_be)
;&
aarch64)
ARCH="arm64"
;;
x86_64)
;;
*)
echo "ERROR: Unsupported architecture $ARCH"
exit 0
;;
esac
REPO_URL="https://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/$ARCH"

# Import and verify cuda gpg key
wget -O cuda-archive-keyring.gpg "$REPO_URL/3bf863cc.pub"
if [[ $? -eq 8 ]] ; then
echo "ERROR: wget failed. Check networking or $OSRELEASE/$ARCH not supported?"
exit 0
fi
gpg --no-default-keyring --keyring ./temp-keyring.gpg \
--import cuda-archive-keyring.gpg
gpg --no-default-keyring --keyring ./temp-keyring.gpg \
--fingerprint "EB693B3035CD5710E231E123A4B469963BF863CC"
if [[ $? -ne 0 ]] ; then
echo "ERROR: GPG key import failed. Invalid gpg key?"
exit 1
fi
wget -O /etc/apt/preferences.d/cuda-repository-pin-600 "$REPO_URL/$PINFILE"
wget -O /etc/apt/trusted.gpg.d/$KEYFILE "$REPO_URL/$KEYFILE"
add-apt-repository -y "deb http://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/x86_64/ /"
sudo gpg --yes --no-default-keyring --keyring ./temp-keyring.gpg --export \
--output /usr/share/keyrings/cuda-archive-keyring.gpg
rm ./temp-keyring.gpg
rm ./temp-keyring.gpg~
rm ./cuda-archive-keyring.gpg

PINFILE="cuda-$OSRELEASE.pin"
sudo wget -O /etc/apt/preferences.d/cuda-repository-pin-600 "$REPO_URL/$PINFILE"

sudo tee /etc/apt/sources.list.d/cuda-$OSRELEASE-$ARCH.list << 'EOF'
deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] http://developer.download.nvidia.com/compute/cuda/repos/$OSRELEASE/$ARCH/ /
EOF

# Install necessary files
#apt update
echo "* Installing necessary pacakges"
apt install -y build-essential git
sudo apt install -y build-essential git
## need to break this out to fix issue where cuda installs gdm3
apt install -y --no-install-recommends cuda-toolkit
sudo apt install -y --no-install-recommends cuda-toolkit

#fix the path to get nvcc from the cuda package
CUDA_PATH=$(find /usr/local -maxdepth 1 -type d -iname "cuda*")/bin
export PATH=$PATH:$CUDA_PATH

mkdir -p ../../bin ../../data

# clone cuda-samples repo
echo "* Cloning cuda-samples repo"
git clone https://github.com/nvidia/cuda-samples.git
echo "* Building cuda-samples tests"
make -C cuda-samples/Samples/0_Introduction/matrixMulDrv
cp cuda-samples/Samples/0_Introduction/matrixMulDrv/matrixMulDrv ../../bin/
cp -r cuda-samples/Samples/0_Introduction/matrixMulDrv/data/* ../../data/
make -C cuda-samples/Samples/0_Introduction/vectorAddDrv
cp cuda-samples/Samples/0_Introduction/vectorAddDrv/vectorAddDrv ../../bin/
cp -r cuda-samples/Samples/0_Introduction/vectorAddDrv/data/* ../../data/
make -C cuda-samples/Samples/1_Utilities/deviceQueryDrv
cp cuda-samples/Samples/1_Utilities/deviceQueryDrv/deviceQueryDrv ../../bin/
make -C cuda-samples/Samples/0_Introduction/simpleTextureDrv
cp -r cuda-samples/Samples/0_Introduction/simpleTextureDrv/data/* ../../data/
cp cuda-samples/Samples/0_Introduction/simpleTextureDrv/simpleTextureDrv ../../bin/
echo "* Building cuda-samples tests completed..."

# get the gpu-burn repo and build it
echo "* Cloning gpu-burn repo"
GPU_BURN_DIR=/opt/gpu-burn
git clone https://github.com/wilicc/gpu-burn.git $GPU_BURN_DIR
cd $GPU_BURN_DIR
git clone https://github.com/wilicc/gpu-burn.git
echo "* Building gpu-burn"
make && echo "* Build completed..."
make -C gpu-burn
cp gpu-burn/gpu_burn ../../bin/
cp gpu-burn/compare.ptx ../../data/
echo "* Build completed..."
echo "*"
echo "* Completed installation. Please reboot the machine now"
echo "* to load the nVidia proprietary drivers"
3 changes: 2 additions & 1 deletion providers/gpgpu/units/gpgpu-only.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ nested_part:
com.canonical.certification::server-info-attachment-automated
com.canonical.certification::server-firmware
com.canonical.certification::server-miscellaneous
com.canonical.certification::gpgpu-tests
com.canonical.certification::gpgpu-stress
com.canonical.certification::gpgpu-automated
include:
bootstrap_include:
device
Expand Down
43 changes: 42 additions & 1 deletion providers/gpgpu/units/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,46 @@ plugin: shell
estimated_duration: 300
requires:
package.name == 'cuda-toolkit'
uname.machine == 'x86_64'
_summary: GPGPU stress testing
command: cd /opt/gpu-burn/ && ./gpu_burn 14400 | grep -v -e '^[[:space:]]*$' -e "errors:" -e "Summary at"
command: gpu_burn.sh

id: gpgpu/matrix-mul-drv
category_id: gpgpu
plugin: shell
estimated_duration: 4
requires:
package.name == 'cuda-toolkit'
uname.machine == 'x86_64'
_summary: GPGPU matrix multiplication
command: matrixMulDrv.sh

id: gpgpu/vector-add-drv
category_id: gpgpu
plugin: shell
estimated_duration: 4
requires:
package.name == 'cuda-toolkit'
uname.machine == 'x86_64'
_summary: GPGPU vector addition
command: vectorAddDrv.sh

id: gpgpu/device-query-drv
category_id: gpgpu
plugin: shell
estimated_duration: 4
requires:
package.name == 'cuda-toolkit'
uname.machine == 'x86_64'
_summary: GPGPU query device
command: deviceQueryDrv

id: gpgpu/simple-texture-drv
category_id: gpgpu
plugin: shell
estimated_duration: 4
requires:
package.name == 'cuda-toolkit'
uname.machine == 'x86_64'
_summary: GPGPU simple textures
command: simpleTextureDrv.sh
17 changes: 14 additions & 3 deletions providers/gpgpu/units/test-plan.pxu
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
id: gpgpu-tests
id: gpgpu-stress
unit: test plan
_name: GPGPU Compute Testing
_name: GPGPU Compute Stress Testing
_description:
Tests for GPGPU Computations (non-graphical)
Stress Tests for GPGPU Computations (non-graphical)
mandatory_include:
gpgpu/gpu-burn
include:

id: gpgpu-automated
unit: test plan
_name: GPGPU Compute Automated Testing
_description:
Automated Tests for GPGPU Computations (non-graphical)
include:
gpgpu/matrix-mul-drv
gpgpu/vector-add-drv
gpgpu/device-query-drv
gpgpu/simple-texture-drv
Loading