From 9992d908b634a86572dcad09d57232ed34fab99a Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 14:26:59 -0600 Subject: [PATCH 1/8] Added centos and hip-clang support --- Jenkinsfile | 96 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 73 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fba8cef39..701b31218 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ rocprimCI: def rocprim = new rocProject('rocprim') - def nodes = new dockerNodes(['gfx803', 'gfx900', 'gfx906'], rocprim) + def nodes = new dockerNodes(['gfx803 && ubuntu', 'gfx900 && ubuntu', 'gfx906 && ubuntu', 'gfx900 && centos7', 'gfx803 && ubuntu && hip-clang', 'gfx900 && ubuntu && hip-clang', 'gfx906 && ubuntu && hip-clang'], rocprim) boolean formatCheck = false @@ -20,12 +20,26 @@ rocprimCI: platform, project-> project.paths.construct_build_prefix() - def command = """#!/usr/bin/env bash - set -x - cd ${project.paths.project_build_prefix} - LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=${project.compiler.compiler_path} ${project.paths.build_command} + + def command + + if(platform.jenkinsLabel.contains('hip-clang')) + { + command = """#!/usr/bin/env bash + set -x + cd ${project.paths.project_build_prefix} + LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hipcc ${project.paths.build_command} """ - platform.runCommand(this, command) + } + + else + { + command = """#!/usr/bin/env bash + set -x + cd ${project.paths.project_build_prefix} + LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hcc ${project.paths.build_command} --hip-clang + """ + } } def testCommand = @@ -34,12 +48,26 @@ rocprimCI: def testCommand = 'ctest --output-on-failure -E rocprim.hip.device_merge_sort' - def command = """#!/usr/bin/env bash - set -x - cd ${project.paths.project_build_prefix} - cd ${project.testDirectory} - LD_LIBRARY_PATH=/opt/rocm/hcc/lib ${testCommand} - """ + def command + + if(platform.jenkinsLabel.contains('centos')) + { + command = """#!/usr/bin/env bash + set -x + cd ${project.paths.project_build_prefix} + cd ${project.testDirectory} + LD_LIBRARY_PATH=/opt/rocm/hcc/lib sudo ${testCommand} + """ + } + else + { + command = """#!/usr/bin/env bash + set -x + cd ${project.paths.project_build_prefix} + cd ${project.testDirectory} + LD_LIBRARY_PATH=/opt/rocm/hcc/lib ${testCommand} + """ + } platform.runCommand(this, command) } @@ -48,21 +76,43 @@ rocprimCI: { platform, project-> - def command = """ - set -x - cd ${project.paths.project_build_prefix}/build - make package - rm -rf package && mkdir -p package - mv *.deb package/ - dpkg -c package/*.deb - """ + def command + + if(platform.jenkinsLabel.contains('centos')) + { + command = """ + set -x + cd ${project.paths.project_build_prefix}/build + sudo make package + rm -rf package && mkdir -p package + mv *.rpm package/ + rpm -qlp package/*.rpm + """ - platform.runCommand(this, command) - platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""") + platform.runCommand(this, command) + platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.rpm""") + } + else if(platform.jenkinsLabel.contains('hip-clang')) + { + packageCommand = null + } + else + { + command = """ + set -x + cd ${project.paths.project_build_prefix}/build + sudo make package + rm -rf package && mkdir -p package + mv *.rpm package/ + rpm -qlp package/*.rpm + """ + + platform.runCommand(this, command) + platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""") + } } buildProject(rocprim, formatCheck, nodes.dockerArray, compileCommand, testCommand, packageCommand) } - From 38e9ab529a67ba725111ab564ad30cc058141977 Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 14:35:16 -0600 Subject: [PATCH 2/8] Added second line for docker ndoes --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 701b31218..44a88aade 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,8 @@ rocprimCI: def rocprim = new rocProject('rocprim') - def nodes = new dockerNodes(['gfx803 && ubuntu', 'gfx900 && ubuntu', 'gfx906 && ubuntu', 'gfx900 && centos7', 'gfx803 && ubuntu && hip-clang', 'gfx900 && ubuntu && hip-clang', 'gfx906 && ubuntu && hip-clang'], rocprim) + def nodes = new dockerNodes(['gfx803 && ubuntu', 'gfx900 && ubuntu', 'gfx906 && ubuntu', 'gfx900 && centos7', + 'gfx803 && ubuntu && hip-clang', 'gfx900 && ubuntu && hip-clang', 'gfx906 && ubuntu && hip-clang'], rocprim) boolean formatCheck = false From 6a511b28d86a3ab262b975df81cb22e1a9d0f956 Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 15:49:21 -0600 Subject: [PATCH 3/8] Added dockerfiles for centos --- Jenkinsfile | 6 ++-- docker/dockerfile-build-centos | 39 +++++++++++++++++++++++ docker/dockerfile-install-centos | 19 ++++++++++++ docker/dockerfile-install-ubuntu | 53 +++++++++----------------------- 4 files changed, 75 insertions(+), 42 deletions(-) create mode 100644 docker/dockerfile-build-centos create mode 100644 docker/dockerfile-install-centos diff --git a/Jenkinsfile b/Jenkinsfile index 44a88aade..a0bda087a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,10 +102,10 @@ rocprimCI: command = """ set -x cd ${project.paths.project_build_prefix}/build - sudo make package + make package rm -rf package && mkdir -p package - mv *.rpm package/ - rpm -qlp package/*.rpm + mv *.deb package/ + dpkg -c package/*.deb """ platform.runCommand(this, command) diff --git a/docker/dockerfile-build-centos b/docker/dockerfile-build-centos new file mode 100644 index 000000000..45ec9d116 --- /dev/null +++ b/docker/dockerfile-build-centos @@ -0,0 +1,39 @@ +# Parameters related to building hip +ARG base_image + +FROM ${base_image} +LABEL maintainer="saad.rahim@amd.com" + +USER root +ARG user_uid + +RUN yum install -y \ + sudo \ + rock-dkms \ + centos-release-scl \ + devtoolset-7 \ + ca-certificates \ + git \ + cmake3 \ + make \ + clang \ + clang-devel \ + gcc-c++ \ + gcc-gfortran \ + pkgconfig \ + python27 \ + PyYAML \ + boost-devel \ + numactl-libs \ + rpm-build + +RUN echo '#!/bin/bash' | tee /etc/profile.d/devtoolset7.sh && echo \ + 'source scl_source enable devtoolset-7' >>/etc/profile.d/devtoolset7.sh + +# docker pipeline runs containers with particular uid +# create a jenkins user with this specific uid so it can use sudo priviledges +# Grant any member of sudo group password-less sudo privileges +RUN useradd --create-home -u ${user_uid} -o -G video --shell /bin/bash jenkins && \ + echo '%video ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd && \ + chmod 400 /etc/sudoers.d/sudo-nopasswd + \ No newline at end of file diff --git a/docker/dockerfile-install-centos b/docker/dockerfile-install-centos new file mode 100644 index 000000000..87c997489 --- /dev/null +++ b/docker/dockerfile-install-centos @@ -0,0 +1,19 @@ +# Parameters related to building rocprim +ARG base_image + +FROM ${base_image} +LABEL maintainer="saad.rahim@amd.com" + +# Copy the rpm package of rocprim into the container from host +COPY *.rpm /tmp/ + +# Install the rpm package, and print out contents of expected changed locations +RUN yum -y update && yum install -y\ + /tmp/rocprim-*.rpm \ + && rm -f /tmp/*.rpm \ + && yum -y clean all \ + && rm -rf /var/lib/apt/lists/* \ + && printf "ls -la /etc/ld.so.conf.d/\n" && ls -la /etc/ld.so.conf.d/ \ + && printf "ls -la /opt/rocm/include\n" && ls -la /opt/rocm/include \ + && printf "ls -la /opt/rocm/lib\n" && ls -la /opt/rocm/lib \ + && printf "ls -la /opt/rocm/lib/cmake\n" && ls -la /opt/rocm/lib/cmake \ No newline at end of file diff --git a/docker/dockerfile-install-ubuntu b/docker/dockerfile-install-ubuntu index 45e329901..9f7920b35 100755 --- a/docker/dockerfile-install-ubuntu +++ b/docker/dockerfile-install-ubuntu @@ -1,44 +1,19 @@ -# Parameters related to building hip +# Parameters related to building rocprim ARG base_image FROM ${base_image} -LABEL maintainer="kent.knox@amd" +LABEL maintainer="saad.rahim@amd.com" -ARG user_uid - -# Install dependent packages -# Dependencies: -# * hcc-config.cmake: pkg-config -# * tensile: python2.7, python-yaml -# * rocblas-test: gfortran, googletest -# * rocblas-bench: libboost-program-options-dev -# * libhsakmt.so: libnuma1 - -USER root - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - python2.7-minimal -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - sudo \ - ca-certificates \ - git \ - make \ - cmake \ - clang-format-3.8 \ - pkg-config \ - python2.7 \ - python-yaml \ - gfortran \ - libboost-program-options-dev \ - libnuma1 \ - && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# docker pipeline runs containers with particular uid -# create a jenkins user with this specific uid so it can use sudo priviledges -# Grant any member of sudo group password-less sudo privileges -RUN useradd --create-home -u ${user_uid} -o -G sudo --shell /bin/bash jenkins && \ - mkdir -p /etc/sudoers.d/ && \ - echo '%sudo ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd +# Copy the deb package of rocprim into the container from host +COPY *.deb /tmp/ +# Install the deb package, and print out contents of expected changed locations +RUN yum -y update && yum install -y\ + /tmp/rocprim-*.deb \ + && rm -f /tmp/*.deb \ + && yum -y clean all \ + && rm -rf /var/lib/apt/lists/* \ + && printf "ls -la /etc/ld.so.conf.d/\n" && ls -la /etc/ld.so.conf.d/ \ + && printf "ls -la /opt/rocm/include\n" && ls -la /opt/rocm/include \ + && printf "ls -la /opt/rocm/lib\n" && ls -la /opt/rocm/lib \ + && printf "ls -la /opt/rocm/lib/cmake\n" && ls -la /opt/rocm/lib/cmake From d5076e801fb550db8763cb4980678c75b12f657f Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 16:00:57 -0600 Subject: [PATCH 4/8] Changed maintainers and fixed package directory --- Jenkinsfile | 4 ++-- docker/dockerfile-build-centos | 6 +++--- docker/dockerfile-build-ubuntu-rock | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0bda087a..5884db040 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -83,7 +83,7 @@ rocprimCI: { command = """ set -x - cd ${project.paths.project_build_prefix}/build + cd ${project.paths.project_build_prefix}/${project.testDirectory} sudo make package rm -rf package && mkdir -p package mv *.rpm package/ @@ -101,7 +101,7 @@ rocprimCI: { command = """ set -x - cd ${project.paths.project_build_prefix}/build + cd ${project.paths.project_build_prefix}/${project.testDirectory} make package rm -rf package && mkdir -p package mv *.deb package/ diff --git a/docker/dockerfile-build-centos b/docker/dockerfile-build-centos index 45ec9d116..1bb0b2491 100644 --- a/docker/dockerfile-build-centos +++ b/docker/dockerfile-build-centos @@ -1,8 +1,8 @@ -# Parameters related to building hip +# Parameters related to building rocPRIM ARG base_image FROM ${base_image} -LABEL maintainer="saad.rahim@amd.com" +LABEL maintainer="rocprim-maintainer@amd.com" USER root ARG user_uid @@ -36,4 +36,4 @@ RUN echo '#!/bin/bash' | tee /etc/profile.d/devtoolset7.sh && echo \ RUN useradd --create-home -u ${user_uid} -o -G video --shell /bin/bash jenkins && \ echo '%video ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd && \ chmod 400 /etc/sudoers.d/sudo-nopasswd - \ No newline at end of file + diff --git a/docker/dockerfile-build-ubuntu-rock b/docker/dockerfile-build-ubuntu-rock index e8a463361..75d893eb3 100644 --- a/docker/dockerfile-build-ubuntu-rock +++ b/docker/dockerfile-build-ubuntu-rock @@ -1,8 +1,8 @@ -# Parameters related to building hip +# Parameters related to building rocPRIM ARG base_image FROM ${base_image} -LABEL maintainer="kent.knox@amd" +LABEL maintainer="rocprim-maintainer@amd.com" ARG user_uid From 078e4bb86f844ec8ce9fd66efff6a3009db68c15 Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 16:52:04 -0600 Subject: [PATCH 5/8] Should compile this time --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5884db040..61d0f446b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,18 +29,19 @@ rocprimCI: command = """#!/usr/bin/env bash set -x cd ${project.paths.project_build_prefix} - LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hipcc ${project.paths.build_command} + LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hipcc ${project.paths.build_command} --hip-clang """ } - else { command = """#!/usr/bin/env bash set -x cd ${project.paths.project_build_prefix} - LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hcc ${project.paths.build_command} --hip-clang + LD_LIBRARY_PATH=/opt/rocm/hcc/lib CXX=/opt/rocm/bin/hcc ${project.paths.build_command} """ } + + platform.runCommand(this, command) } def testCommand = From e6821f798bf3815860ee6631e81ac6053437ced4 Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 17:12:39 -0600 Subject: [PATCH 6/8] Changed archive directory --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 61d0f446b..4f326bf5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -92,7 +92,7 @@ rocprimCI: """ platform.runCommand(this, command) - platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.rpm""") + platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/${project.testDirectory}/package/*.rpm""") } else if(platform.jenkinsLabel.contains('hip-clang')) { @@ -110,7 +110,7 @@ rocprimCI: """ platform.runCommand(this, command) - platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/build/package/*.deb""") + platform.archiveArtifacts(this, """${project.paths.project_build_prefix}/${project.testDirectory}/package/*.deb""") } } From 0c75805899a8e617d9191dc2fd05ae0b00e3eda6 Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 18:28:33 -0600 Subject: [PATCH 7/8] force cmake3 --- install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/install b/install index 8876ceeab..9423228da 100755 --- a/install +++ b/install @@ -110,7 +110,10 @@ if [[ "${build_hip_clang}" == true ]]; then compiler="hipcc" fi -CXX=$rocm_path/${compiler} cmake -DBUILD_BENCHMARK=ON ../../. # or cmake-gui ../. +if [ -e /etc/redhat-release ] ; then + CXX=$rocm_path/${compiler} cmake3 -DBUILD_BENCHMARK=ON ../../. # or cmake-gui ../. +else + CXX=$rocm_path/${compiler} cmake -DBUILD_BENCHMARK=ON ../../. # or cmake-gui ../. # Build make -j$(nproc) From b35874f55d70f0923b3c6442ce8fc9757fae025a Mon Sep 17 00:00:00 2001 From: Akila Premachandra Date: Tue, 25 Jun 2019 18:34:38 -0600 Subject: [PATCH 8/8] minor install script fix --- install | 1 + 1 file changed, 1 insertion(+) diff --git a/install b/install index 9423228da..b99d32826 100755 --- a/install +++ b/install @@ -114,6 +114,7 @@ if [ -e /etc/redhat-release ] ; then CXX=$rocm_path/${compiler} cmake3 -DBUILD_BENCHMARK=ON ../../. # or cmake-gui ../. else CXX=$rocm_path/${compiler} cmake -DBUILD_BENCHMARK=ON ../../. # or cmake-gui ../. +fi # Build make -j$(nproc)