Debian Codegraph @

hip/.jenkins/Jenkinsfile

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