-
Notifications
You must be signed in to change notification settings - Fork 551
/
Copy pathJenkinsfile
114 lines (104 loc) · 4.51 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
def hipBuildTest(String backendLabel) {
node(backendLabel) {
stage("SYNC - ${backendLabel}") {
// Delete the workspace
sh "rm ${env.WORKSPACE}/* -fr"
sh "ls -lart ${env.WORKSPACE}"
// Checkout hip repository with the PR patch
dir("${WORKSPACE}/hip") {
checkout scm
env.HIP_DIR = "${WORKSPACE}" + "/hip"
}
// Clone hip-tests repository
dir("${WORKSPACE}/hip-tests") {
git branch: 'develop',
url: 'https://github.com/ROCm-Developer-Tools/hip-tests'
env.HIP_TESTS_DIR = "${WORKSPACE}" + "/hip-tests"
}
// Clone clr repository
dir("${WORKSPACE}/clr") {
git branch: 'develop',
credentialsId: 'branch-credentials',
url: 'https://github.com/ROCm-Developer-Tools/clr'
env.CLR_DIR = "${WORKSPACE}" + "/clr"
}
// Clone hipcc repspoitory
dir("${WORKSPACE}/hipcc") {
git branch: 'develop',
credentialsId: 'branch-credentials',
url: 'https://github.com/ROCm-Developer-Tools/hipcc'
env.HIPCC_DIR = "${WORKSPACE}" + "/hipcc"
}
}
stage("BUILD HIP - ${backendLabel}") {
// Running the build on clr workspace
dir("${WORKSPACE}/clr") {
sh """#!/usr/bin/env bash
set -x
rm -rf build
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
sleep 120
cmake -DCLR_BUILD_HIP=ON -DHIP_PATH=\$PWD/install -DHIPCC_BIN_DIR=\$HIPCC_DIR/bin -DHIP_COMMON_DIR=\$HIP_DIR -DCMAKE_PREFIX_PATH="/opt/rocm/" -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
else
cmake -DCLR_BUILD_HIP=ON -DHIP_PLATFORM=nvidia -DHIPCC_BIN_DIR=\$HIPCC_DIR/bin -DHIP_COMMON_DIR=\$HIP_DIR -DCMAKE_INSTALL_PREFIX=\$PWD/install ..
fi
make -j\$(nproc)
make install -j\$(nproc)
"""
}
}
stage("BUILD HIP TESTS - ${backendLabel}") {
// Running the build on HIP TESTS workspace
dir("${WORKSPACE}/hip-tests") {
env.HIP_PATH = "${CLR_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 -DHIP_PATH=\$CLR_DIR/build/install ../catch
else
export HIP_PLATFORM=nvidia
cmake -DHIP_PLATFORM=nvidia -DHIP_PATH=\$CLR_DIR/build/install ../catch
fi
make -j\$(nproc) build_tests
"""
}
}
timeout(time: 1, unit: 'HOURS') {
stage("TEST - ${backendLabel}") {
dir("${WORKSPACE}/hip-tests") {
sh """#!/usr/bin/env bash
set -x
cd build
if [[ $backendLabel =~ amd ]]; then
ctest --overwrite BuildDirectory=. --output-junit hiptest_output_catch_amd.xml
else
ctest --overwrite BuildDirectory=. --output-junit hiptest_output_catch_nvidia.xml -E 'Unit_hipMemcpyHtoD_Positive_Synchronization_Behavior|Unit_hipMemcpy_Positive_Synchronization_Behavior|Unit_hipFreeNegativeHost'
fi
"""
}
}
}
}
}
timestamps {
node('external-bootstrap') {
skipDefaultCheckout()
// labels belonging to each backend - AMD, NVIDIA
String[] labels = ['hip-amd-mi100-ubu2004', 'hip-nvidia-rtx5000-ubu2004']
buildMap = [:]
labels.each { backendLabel ->
echo "backendLabel: ${backendLabel}"
buildMap[backendLabel] = { hipBuildTest(backendLabel) }
}
buildMap['failFast'] = false
parallel buildMap
}
}