From b177875344605f4f768290a0fa40d87612fc8335 Mon Sep 17 00:00:00 2001 From: arjun-raj-kuppala <60718144+arjun-raj-kuppala@users.noreply.github.com> Date: Wed, 14 Dec 2022 17:28:10 +0530 Subject: [PATCH 1/2] Create jenkinsfile (#3) --- .jenkins/jenkinsfile | 108 ++++++++++++++++++++++++++ catch/hipTestMain/hip_test_context.cc | 2 +- catch/include/hip_test_context.hh | 2 +- catch/include/resource_guards.hh | 2 +- catch/include/utils.hh | 2 +- catch/unit/memory/hipFree.cc | 2 +- 6 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 .jenkins/jenkinsfile diff --git a/.jenkins/jenkinsfile b/.jenkins/jenkinsfile new file mode 100644 index 0000000000..4e3ed8504f --- /dev/null +++ b/.jenkins/jenkinsfile @@ -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 + } +} diff --git a/catch/hipTestMain/hip_test_context.cc b/catch/hipTestMain/hip_test_context.cc index bc38b32f94..eb2893a00c 100644 --- a/catch/hipTestMain/hip_test_context.cc +++ b/catch/hipTestMain/hip_test_context.cc @@ -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 } -} \ No newline at end of file +} diff --git a/catch/include/hip_test_context.hh b/catch/include/hip_test_context.hh index 931593cc4d..f2e5b95757 100644 --- a/catch/include/hip_test_context.hh +++ b/catch/include/hip_test_context.hh @@ -193,4 +193,4 @@ static bool _log_enable = (!TestContext::getEnvVar("HT_LOG_ENABLE").empty() ? tr printf(format, __VA_ARGS__); \ printf("%c", '\n'); \ } \ -} \ No newline at end of file +} diff --git a/catch/include/resource_guards.hh b/catch/include/resource_guards.hh index a9c7512a3d..d50ae05baa 100644 --- a/catch/include/resource_guards.hh +++ b/catch/include/resource_guards.hh @@ -227,4 +227,4 @@ class StreamGuard { private: const Streams stream_type_; hipStream_t stream_; -}; \ No newline at end of file +}; diff --git a/catch/include/utils.hh b/catch/include/utils.hh index bbab2322fe..f3d6debb26 100644 --- a/catch/include/utils.hh +++ b/catch/include/utils.hh @@ -142,4 +142,4 @@ inline bool DeviceAttributesSupport(const int device, Attributes... attributes) return value; }; return (... && DeviceAttributeSupport(device, attributes)); -} \ No newline at end of file +} diff --git a/catch/unit/memory/hipFree.cc b/catch/unit/memory/hipFree.cc index b29854271c..b46f8ae8fb 100644 --- a/catch/unit/memory/hipFree.cc +++ b/catch/unit/memory/hipFree.cc @@ -419,4 +419,4 @@ TEMPLATE_TEST_CASE("Unit_hipFreeMultiTArray", "", char, int, float2, float4) { HIP_CHECK_THREAD_FINALIZE(); } -#endif \ No newline at end of file +#endif From fa31755c58fb4c32576a34b2eb9827e9f1bf3541 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Wed, 14 Dec 2022 21:44:26 +0000 Subject: [PATCH 2/2] SWDEV-366868 - Fix hip-catch-amd rpm installation issue --- catch/packaging/hip-tests.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/catch/packaging/hip-tests.txt b/catch/packaging/hip-tests.txt index 0c168e5192..7f1030e06c 100644 --- a/catch/packaging/hip-tests.txt +++ b/catch/packaging/hip-tests.txt @@ -78,9 +78,10 @@ set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") set(CPACK_PACKAGE_CONTACT "HIP Support ") set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_VERSION_PATCH_GITHASH@) +set (CPACK_RPM_PACKAGE_AUTOREQ 0) # to remove hip-catch-* package during uninstallation of rocm -set (CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core") -set (CPACK_RPM_PACKAGE_REQUIRES "rocm-core") +set (CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core, hip-runtime-amd") +set (CPACK_RPM_PACKAGE_REQUIRES "rocm-core, hip-runtime-amd") if(NOT WIN32) set(CPACK_GENERATOR "TGZ;DEB;RPM" CACHE STRING "Linux package types for catch tests")