From 61dc649d2830849e2293242f68939d6359d65dbf Mon Sep 17 00:00:00 2001 From: Saad Rahim Date: Thu, 14 Feb 2019 09:57:00 -0800 Subject: [PATCH] Adding Jenkins support --- Jenkinsfile | 78 +++++++++++++++++++++++++++++ docker/dockerfile-build-ubuntu-rock | 50 ++++++++++++++++++ docker/dockerfile-install-ubuntu | 54 ++++++++++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 Jenkinsfile create mode 100644 docker/dockerfile-build-ubuntu-rock create mode 100755 docker/dockerfile-install-ubuntu diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..b50800542 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,78 @@ +#!/usr/bin/env groovy +@Library('rocJENKINS.develop') _ +import com.amd.project.* +import com.amd.docker.* + +//////////////////////////////////////////////////////////////////////// +// Mostly generated from snippet generator 'properties; set job properties' +// Time-based triggers added to execute nightly tests, eg '30 2 * * *' means 2:30 AM +properties([ + pipelineTriggers([cron('0 1 * * *'), [$class: 'PeriodicFolderTrigger', interval: '5m']]), + buildDiscarder(logRotator( + artifactDaysToKeepStr: '', + artifactNumToKeepStr: '', + daysToKeepStr: '', + numToKeepStr: '10')), + disableConcurrentBuilds(), + // parameters([booleanParam( name: 'push_image_to_docker_hub', defaultValue: false, description: 'Push rocprim image to rocl docker-hub' )]), + [$class: 'CopyArtifactPermissionProperty', projectNames: '*'] + ]) + + +//////////////////////////////////////////////////////////////////////// +import java.nio.file.Path; + + + +rocprimCI: +{ + + def rocprim = new rocProject('rocprim') + + def nodes = new dockerNodes(['gfx900', 'gfx906'], rocprim.paths) + + def compileCommand = + { + 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} + """ + platform.runCommand(this, command) + } + + def testCommand = + { + platform, project-> + + 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} + """ + + platform.runCommand(this, command) + } + + def packageCommand = + { + platform, project-> + + def command = """ + echo "rocPRIM is a header only library and does not need packaging" + """ + + platform.runCommand(this, command) + } + + buildProject(rocprim, nodes.dockerArray, compileCommand, testCommand, packageCommand) + +} + + diff --git a/docker/dockerfile-build-ubuntu-rock b/docker/dockerfile-build-ubuntu-rock new file mode 100644 index 000000000..fc06aa089 --- /dev/null +++ b/docker/dockerfile-build-ubuntu-rock @@ -0,0 +1,50 @@ +# Parameters related to building hip +ARG base_image + +FROM ${base_image} +LABEL maintainer="kent.knox@amd" + +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 +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + rock-dkms \ + 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 + +ARG ROCBLAS_SRC_ROOT=/usr/local/src/rocBLAS + +# Clone rocblas repo +# Build client dependencies and install into /usr/local (LAPACK & GTEST) +RUN mkdir -p ${ROCBLAS_SRC_ROOT} && cd ${ROCBLAS_SRC_ROOT} && \ + git clone -b saad/develop --depth=1 https://github.com/saadrahim/rocPRIM . #&& \ + #mkdir -p build/deps && cd build/deps && \ + #cmake -DBUILD_BOOST=OFF ${ROCBLAS_SRC_ROOT}/deps && \ + #make -j $(nproc) install && \ + #rm -rf ${ROCBLAS_SRC_ROOT} diff --git a/docker/dockerfile-install-ubuntu b/docker/dockerfile-install-ubuntu new file mode 100755 index 000000000..7d20aad61 --- /dev/null +++ b/docker/dockerfile-install-ubuntu @@ -0,0 +1,54 @@ +# Parameters related to building hip +ARG base_image + +FROM ${base_image} +LABEL maintainer="kent.knox@amd" + +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 + +ARG ROCBLAS_SRC_ROOT=/usr/local/src/rocBLAS + +# Clone rocblas repo +# Build client dependencies and install into /usr/local (LAPACK & GTEST) +RUN mkdir -p ${ROCBLAS_SRC_ROOT} && cd ${ROCBLAS_SRC_ROOT} && \ + git clone -b develop --depth=1 https://github.com/ROCmSoftwarePlatform/rocBLAS . && \ + mkdir -p build/deps && cd build/deps && \ + cmake -DBUILD_BOOST=OFF ${ROCBLAS_SRC_ROOT}/deps && \ + make -j $(nproc) install +# rm -rf ${ROCBLAS_SRC_ROOT}