Files
rocm-systems/.jenkins/Jenkinsfile
T
arjun-raj-kuppala dd4e1f23c2 Add timeout for tests stage (#2660)
* Add timeout for tests stage

* Update Jenkinsfile
2022-05-05 11:56:09 +05:30

128 line
5.6 KiB
Groovy

def hipBuildTest(String backendLabel) {
node(backendLabel) {
stage("Source sync ${backendLabel}") {
// Checkout hip repository with the PR patch
dir("${WORKSPACE}/hip") {
checkout scm
env.HIP_DIR = "${WORKSPACE}" + "/hip"
}
// Clone hipamd repository
dir("${WORKSPACE}/hipamd") {
git branch: 'develop',
url: 'https://github.com/ROCm-Developer-Tools/hipamd'
}
// Clone vdi and opencl for only amd backend server
if (backendLabel =~ /.*amd.*/) {
dir("${WORKSPACE}/ROCm-OpenCL-Runtime") {
git branch:'develop',
url: 'https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime'
env.OPENCL_DIR = "${WORKSPACE}" + "/ROCm-OpenCL-Runtime"
}
dir("${WORKSPACE}/ROCclr") {
git branch:'develop',
url: 'https://github.com/ROCm-Developer-Tools/ROCclr'
env.ROCclr_DIR = "${WORKSPACE}" + "/ROCclr"
}
}
}
stage("Build - HIT framework") {
// Running the build on hipamd workspace
dir("${WORKSPACE}/hipamd") {
sh """#!/usr/bin/env bash
set -x
rm -rf build
mkdir build
cd build
# Check if backend label contains string "amd" or backend host is a server with amd gpu
if [[ $backendLabel =~ amd ]]; then
cmake -DHIP_CATCH_TEST=0 -DHIP_COMMON_DIR=$HIP_DIR -DAMD_OPENCL_PATH=\$OPENCL_DIR -DROCCLR_PATH=\$ROCclr_DIR -DCMAKE_PREFIX_PATH="/opt/rocm/" -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
else
cmake -DHIP_CATCH_TEST=0 -DHIP_PLATFORM=nvidia -DHIP_COMMON_DIR=$HIP_DIR -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
fi
make install -j\$(nproc)
if [[ $backendLabel =~ amd ]]; then
make build_tests -j\$(nproc)
else
HIP_COMPILER=nvcc HIP_PLATFORM=nvidia make build_tests -j\$(nproc)
fi
"""
}
}
timeout(time: 1, unit: 'HOURS') {
stage('HIP Unit Tests - HIT framework') {
dir("${WORKSPACE}/hipamd/build") {
sh """#!/usr/bin/env bash
set -x
# Check if backend label contains string "amd" or backend host is a server with amd gpu
if [[ $backendLabel =~ amd ]]; then
LLVM_PATH=/opt/rocm/llvm ctest -E 'cooperative_streams_least_capacity.tst|cooperative_streams_half_capacity.tst|cooperative_streams_full_capacity.tst|grid_group_data_sharing.tst'
else
make test
fi
"""
}
}
}
stage("Build - Catch2 framework") {
// Running the build on hipamd workspace
dir("${WORKSPACE}/hipamd") {
sh """#!/usr/bin/env bash
set -x
mkdir -p build
cd build
# Check if backend label contains string "amd" or backend host is a server with amd gpu
if [[ $backendLabel =~ amd ]]; then
cmake -DHIP_CATCH_TEST=1 -DHIP_PATH=\$PWD/install -DHIP_COMMON_DIR=$HIP_DIR -DAMD_OPENCL_PATH=\$OPENCL_DIR -DROCCLR_PATH=\$ROCclr_DIR -DCMAKE_PREFIX_PATH="/opt/rocm/" -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
else
export HIP_PLATFORM=nvidia
export HIP_COMPILER=nvcc
export HIP_RUNTIME=cuda
cmake -DHIP_CATCH_TEST=1 -DHIP_PATH=\$PWD/install -DHIP_COMMON_DIR=$HIP_DIR -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
fi
make install -j\$(nproc)
if [[ $backendLabel =~ amd ]]; then
make build_tests -j\$(nproc)
else
HIP_COMPILER=nvcc HIP_PLATFORM=nvidia make build_tests -j\$(nproc)
fi
"""
}
}
timeout(time: 1, unit: 'HOURS') {
stage('HIP Unit Tests - Catch2 framework') {
dir("${WORKSPACE}/hipamd/build") {
sh """#!/usr/bin/env bash
set -x
# Check if backend label contains string "amd" or backend host is a server with amd gpu
if [[ $backendLabel =~ amd ]]; then
LLVM_PATH=/opt/rocm/llvm ctest -E 'Unit_hipGraphChildGraphNodeGetGraph_Functional|Unit_hipGraphExecMemcpyNodeSetParamsFromSymbol_Negative'
else
make test
fi
"""
}
}
}
}
}
timestamps {
node('external-bootstrap') {
skipDefaultCheckout()
// labels belonging to each backend - AMD, NVIDIA
String[] labels = ['hip-amd-vg20-ubu1804', 'hip-nvidia-rtx5000-ubu1804']
buildMap = [:]
labels.each { backendLabel ->
echo "backendLabel: ${backendLabel}"
buildMap[backendLabel] = { hipBuildTest(backendLabel) }
}
buildMap['failFast'] = false
parallel buildMap
}
}