Create jenkinsfile (#3)
This commit is contained in:
committed by
GitHub
parent
0571115bed
commit
b177875344
@@ -0,0 +1,108 @@
|
||||
def hipBuildTest(String backendLabel) {
|
||||
node(backendLabel) {
|
||||
stage("Source sync ${backendLabel}") {
|
||||
|
||||
// Checkout hip repository with the PR patch
|
||||
dir("${WORKSPACE}/hip-tests") {
|
||||
checkout scm
|
||||
env.HIP_TESTS_DIR = "${WORKSPACE}" + "/hip-tests"
|
||||
}
|
||||
|
||||
// Clone HIP repository
|
||||
dir("${WORKSPACE}/hip") {
|
||||
git branch: 'develop',
|
||||
url: 'https://github.com/ROCm-Developer-Tools/HIP'
|
||||
env.HIP_DIR = "${WORKSPACE}" + "/hip"
|
||||
}
|
||||
|
||||
// Clone hipamd repository
|
||||
dir("${WORKSPACE}/hipamd") {
|
||||
git branch: 'develop',
|
||||
url: 'https://github.com/ROCm-Developer-Tools/hipamd'
|
||||
env.HIPAMD_DIR = "${WORKSPACE}" + "/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 - 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_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
|
||||
cmake -DHIP_PLATFORM=nvidia -DHIP_COMMON_DIR=\$HIP_DIR -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
|
||||
fi
|
||||
make -j\$(nproc)
|
||||
make install -j\$(nproc)
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build - HIP TESTS") {
|
||||
// Running the build on HIP TESTS workspace
|
||||
dir("${WORKSPACE}/hip-tests") {
|
||||
env.HIP_PATH = "${HIPAMD_DIR}" + "/build/install"
|
||||
sh """#!/usr/bin/env bash
|
||||
set -x
|
||||
rm -rf build
|
||||
mkdir -p build
|
||||
cd build
|
||||
echo "testing $HIP_PATH"
|
||||
# Check if backend label contains string "amd" or backend host is a server with amd gpu
|
||||
if [[ $backendLabel =~ amd ]]; then
|
||||
cmake -DHIP_PLATFORM=amd ../catch
|
||||
else
|
||||
export HIP_PLATFORM=nvidia
|
||||
cmake -DHIP_PLATFORM=nvidia ../catch
|
||||
fi
|
||||
make -j\$(nproc) build_tests
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('HIP Unit Tests - Catch2 framework') {
|
||||
dir("${WORKSPACE}/hip-tests") {
|
||||
sh """#!/usr/bin/env bash
|
||||
set -x
|
||||
cd build
|
||||
ctest
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -270,4 +270,4 @@ TestContext::~TestContext() {
|
||||
std::abort(); // Crash to bring users attention to this message and avoid accidental passing of
|
||||
// tests without checking for errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,4 +193,4 @@ static bool _log_enable = (!TestContext::getEnvVar("HT_LOG_ENABLE").empty() ? tr
|
||||
printf(format, __VA_ARGS__); \
|
||||
printf("%c", '\n'); \
|
||||
} \
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,4 +227,4 @@ class StreamGuard {
|
||||
private:
|
||||
const Streams stream_type_;
|
||||
hipStream_t stream_;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -142,4 +142,4 @@ inline bool DeviceAttributesSupport(const int device, Attributes... attributes)
|
||||
return value;
|
||||
};
|
||||
return (... && DeviceAttributeSupport(device, attributes));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,4 +419,4 @@ TEMPLATE_TEST_CASE("Unit_hipFreeMultiTArray", "", char, int, float2, float4) {
|
||||
HIP_CHECK_THREAD_FINALIZE();
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user