Skip to content

Commit f48ae5c

Browse files
committed
Added hip-clang options to install script, and openmp/pthread options to CMakeLists.txt
1 parent 6759660 commit f48ae5c

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

Jenkinsfile

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env groovy
22
// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
33
// This shared library is available at https://github.com/ROCmSoftwarePlatform/rccl
4-
@Library('rocJenkins@noDocker') _
4+
@Library('rocJenkins') _
55

66
// This is file for internal AMD use.
77
// If you are interested in running your own Jenkins, please raise a github issue for assistance.
@@ -32,7 +32,7 @@ rcclCI:
3232

3333
def rccl = new rocProject('rccl')
3434
// customize for project
35-
rccl.paths.build_command = './install.sh -t'
35+
rccl.paths.build_command = './install.sh'
3636

3737
// Define test architectures, optional rocm version argument is available
3838
def nodes = new dockerNodes(['RCCL'], rccl)
@@ -47,10 +47,10 @@ rcclCI:
4747
def command = """#!/usr/bin/env bash
4848
set -x
4949
cd ${project.paths.project_build_prefix}
50-
LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=${project.compiler.compiler_path} ${project.paths.build_command}
50+
LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX= ${project.paths.build_command} -t --hip-clang
5151
"""
5252

53-
sh command
53+
platform.runCommand(this,command)
5454
}
5555

5656
def testCommand =
@@ -59,11 +59,11 @@ rcclCI:
5959

6060
def command = """#!/usr/bin/env bash
6161
set -x
62-
cd ${project.paths.project_build_prefix}/build/release/test
63-
HSA_FORCE_FINE_GRAIN_PCIE=1 ./UnitTests --gtest_output=xml --gtest_color=yes
62+
cd ${project.paths.project_build_prefix}
63+
${project.paths.project_build_prefix} -r --hip-clang
6464
"""
6565

66-
sh command
66+
platform.runCommand(this,command)
6767
//junit "${project.paths.project_build_prefix}/build/release/*.xml"
6868
}
6969

@@ -79,11 +79,10 @@ rcclCI:
7979
mv *.deb package/
8080
sudo dpkg -i package/*.deb
8181
"""
82-
83-
84-
//platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""")
82+
platform.runCommand(this,command)
83+
platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""")
8584
}
8685

87-
buildProjectNoDocker(rccl, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
86+
buildProject(rccl, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand)
8887

89-
}
88+
}

install.sh

+21-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function display_help()
1313
echo " [-p|--package_build] Build RCCL package."
1414
echo " [-t|--tests_build] Build unit tests, but do not run."
1515
echo " [-r|--run_tests] Run unit tests (must be built already.)"
16+
echo " [--hip-clang] Build library using hip-clang compiler."
1617
echo " [--prefix] Specify custom directory to install RCCL to (default: /opt/rocm)."
1718
}
1819

@@ -26,6 +27,7 @@ build_tests=false
2627
run_tests=false
2728
build_release=true
2829
install_library=false
30+
build_hip_clang=false
2931

3032
# #################################################
3133
# Parameter parsing
@@ -34,7 +36,7 @@ install_library=false
3436
# check if we have a modern version of getopt that can handle whitespace and long parameters
3537
getopt -T
3638
if [[ $? -eq 4 ]]; then
37-
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,package_build,tests_build,run_tests,prefix: --options hiptr -- "$@")
39+
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,package_build,tests_build,run_tests,hip-clang,prefix: --options hiptr -- "$@")
3840
else
3941
echo "Need a new version of getopt"
4042
exit 1
@@ -65,6 +67,9 @@ while true; do
6567
-r|--run_tests)
6668
run_tests=true
6769
shift ;;
70+
--hip-clang)
71+
build_hip_clang=true
72+
shift ;;
6873
--prefix)
6974
install_prefix=${2}
7075
shift 2 ;;
@@ -97,18 +102,30 @@ else
97102
mkdir -p debug; cd debug
98103
fi
99104

100-
101105
# build type
102106
if [[ "${build_release}" == true ]]; then
103107
cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Release"
104108
else
105109
cmake_common_options="${cmake_common_options} -DCMAKE_BUILD_TYPE=Debug"
106110
fi
107111

112+
compiler=hcc
113+
if [[ "${build_hip_clang}" == true ]]; then
114+
compiler=hipcc
115+
fi
116+
117+
cmake_executable=cmake
118+
if [[ -e /etc/redhat-release ]]; then
119+
yum install chrpath libgomp
120+
cmake_executable=cmake3
121+
else
122+
apt install chrpath libomp-dev
123+
fi
124+
108125
if ($build_tests); then
109-
CXX=$rocm_path/hcc cmake -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
126+
CXX=$rocm_path/$compiler $cmake_executable -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
110127
else
111-
CXX=$rocm_path/hcc cmake -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
128+
CXX=$rocm_path/$compiler $cmake_executable -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
112129
fi
113130

114131
if ($install_library); then

test/CMakeLists.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ if(BUILD_TESTS)
1111
endif()
1212

1313
# OpenMP is used to drive GPUs (one per thread)
14-
find_package(OpenMP REQUIRED)
15-
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
16-
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
17-
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
14+
if(EXISTS /etc/redhat-release)
15+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp=libgomp -pthread")
16+
else()
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -pthread")
18+
endif()
1819

1920
# Download and unpack googletest at configure time
2021
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)

0 commit comments

Comments
 (0)