From f8d70438fe4d08698a5132998705ebdcd6d54d4b Mon Sep 17 00:00:00 2001 From: olga <odatskov@cern.ch> Date: Sat, 13 Jun 2020 15:57:14 +0200 Subject: [PATCH] Adding OneAPI CPU runtimes to the Intel container. Improving the build process with versioning and multi-tags. --- .gitlab-ci.yml | 38 +++++----------- lhc/simpletrack/.simpletrack-ci.yml | 30 +++++++++++++ lhc/simpletrack/Dockerfile.intel | 40 ++++++++++++++--- lhc/simpletrack/README.md | 65 ++++++++++++++++++++++------ lhc/simpletrack/lhc-simpletrack.spec | 7 +++ 5 files changed, 134 insertions(+), 46 deletions(-) create mode 100644 lhc/simpletrack/.simpletrack-ci.yml create mode 100644 lhc/simpletrack/lhc-simpletrack.spec diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 73c339d..e26e978 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,31 +1,13 @@ --- stages: -- build - -.job_template: &job_build - stage: build - image: - name: gitlab-registry.cern.ch/ci-tools/docker-image-builder - entrypoint: [""] - environment: - name: build/$CI_COMMIT_REF_NAME +- triggers + +simpletrack: + stage: triggers + trigger: + include: lhc/simpletrack/.simpletrack-ci.yml + except: + - branches only: - - master - -build:nvidia: - <<: *job_build - script: - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/lhc/simpletrack/Dockerfile.nvidia --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:nvidia-latest - -build:intel: - <<: *job_build - script: - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/lhc/simpletrack/Dockerfile.intel --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:intel-latest - -build:pocl: - <<: *job_build - script: - - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/lhc/simpletrack/Dockerfile.pocl --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:pocl-latest + changes: + - lhc/simpletrack/* diff --git a/lhc/simpletrack/.simpletrack-ci.yml b/lhc/simpletrack/.simpletrack-ci.yml new file mode 100644 index 0000000..a67ff6c --- /dev/null +++ b/lhc/simpletrack/.simpletrack-ci.yml @@ -0,0 +1,30 @@ +--- +stages: +- build + +.job_template: &job_build + stage: build + image: + name: gitlab-registry.cern.ch/ci-tools/docker-image-builder + entrypoint: [""] + environment: + name: build/$CI_COMMIT_REF_NAME + before_script: + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - export HEP_TAG=`grep HEPWL_DOCKERIMAGETAG lhc/simpletrack/lhc-simpletrack.spec | cut -d "=" -f 2` + +build:nvidia: + <<: *job_build + script: + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/lhc/simpletrack/Dockerfile.nvidia --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:nvidia-$HEP_TAG --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:nvidia-latest + +build:intel: + <<: *job_build + script: + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/lhc/simpletrack/Dockerfile.intel --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:intel-$HEP_TAG --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:intel-latest + +build:pocl: + <<: *job_build + script: + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/lhc/simpletrack/Dockerfile.pocl --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:pocl-$HEP_TAG --destination ${CI_REGISTRY_IMAGE}/lhc/simpletrack:pocl-latest + diff --git a/lhc/simpletrack/Dockerfile.intel b/lhc/simpletrack/Dockerfile.intel index 44edea0..e42a0b0 100644 --- a/lhc/simpletrack/Dockerfile.intel +++ b/lhc/simpletrack/Dockerfile.intel @@ -1,12 +1,42 @@ -FROM docker.io/intelopencl/intel-opencl:centos-7-copr +FROM debian:latest ENV PARTICLES 20000 ENV TURNS 15 ENV DEVICE "0.0" -RUN yum install -y python3 python3-devel python3-pip git gcc && pip3 install pyopencl \ - && mkdir /.cache && chmod -R 777 /.cache/ \ +ENV INTEL_OCL_DIR "/opt/intel/oclcpuexp" +ENV INTEL_TBB_DIR "/opt/intel/tbb" +ENV INTEL_OCL_VER "2020.10.4.0.15" +ENV INTEL_TBB_VER "2020.2" + +ENV INTEL_COMPUTE_URL "https://github.com/intel/compute-runtime/releases/download/20.22.16952" +ENV INTEL_NEO_DIR "/opt/intel/neo" +ENV INTEL_NEO_VER "20.22.16952" + +RUN apt-get update && apt upgrade -y && apt-get -y install python3-pip clinfo wget git \ + && mkdir -p ${INTEL_OCL_DIR} ${INTEL_TBB_DIR} /etc/OpenCL/vendors \ + && cd ${INTEL_OCL_DIR} \ + && wget https://github.com/intel/llvm/releases/download/2020-05/oclcpuexp-${INTEL_OCL_VER}_rel.tar.gz \ + && tar zxvf oclcpuexp-*.tar.gz && rm oclcpuexp-*.tar.gz \ + && echo ${INTEL_OCL_DIR}/x64/libintelocl.so > /etc/OpenCL/vendors/intel_expcpu.icd \ + && cd ${INTEL_TBB_DIR} \ + && wget https://github.com/oneapi-src/oneTBB/releases/download/v2020.2/tbb-${INTEL_TBB_VER}-lin.tgz \ + && tar zxvf tbb*.tgz && rm tbb*.tgz \ + && cd ${INTEL_OCL_DIR}/x64 && ln -s ${INTEL_TBB_DIR}/tbb/lib/intel64/gcc4.8/libtbb.so . \ + && ln -s ${INTEL_TBB_DIR}/tbb/lib/intel64/gcc4.8/libtbbmalloc.so . \ + && ln -s ${INTEL_TBB_DIR}/tbb/lib/intel64/gcc4.8/libtbb.so.2 . \ + && ln -s ${INTEL_TBB_DIR}/tbb/lib/intel64/gcc4.8/libtbbmalloc.so.2 . \ + && echo ${INTEL_OCL_DIR}/x64 > /etc/ld.so.conf.d/libintelopenclexp.conf \ + && ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf + +RUN mkdir -p ${INTEL_NEO_DIR} && cd ${INTEL_NEO_DIR} \ + && wget ${INTEL_COMPUTE_URL}/intel-gmmlib_20.1.1_amd64.deb && dpkg -i intel-gmmlib_20.1.1_amd64.deb && rm *.deb \ + && wget ${INTEL_COMPUTE_URL}/intel-igc-core_1.0.4062_amd64.deb && dpkg -i intel-igc-core_1.0.4062_amd64.deb && rm *.deb \ + && wget ${INTEL_COMPUTE_URL}/intel-igc-opencl_1.0.4062_amd64.deb && dpkg -i intel-igc-opencl_1.0.4062_amd64.deb && rm *.deb \ + && wget ${INTEL_COMPUTE_URL}/intel-opencl_${INTEL_NEO_VER}_amd64.deb && dpkg -i intel-opencl_${INTEL_NEO_VER}_amd64.deb && rm *.deb + +RUN mkdir /.cache && chmod -R 777 /.cache \ && git clone https://github.com/rdemaria/simpletrack \ - && cd simpletrack && pip3 install -e . + && cd simpletrack && pip3 install pyopencl && pip3 install -e . -ENTRYPOINT [ "/bin/bash", "-c", "cd /simpletrack/examples/lhc/ && python3 benchmark_opencl.py -p $PARTICLES -t $TURNS -d $DEVICE" ] +ENTRYPOINT [ "/bin/bash", "-c", "cd /simpletrack/examples/lhc && python3 benchmark_opencl.py -p $PARTICLES -t $TURNS -d $DEVICE" ] diff --git a/lhc/simpletrack/README.md b/lhc/simpletrack/README.md index 0d65596..d13364f 100644 --- a/lhc/simpletrack/README.md +++ b/lhc/simpletrack/README.md @@ -1,31 +1,70 @@ -# SimpleTrack +# Overview -Docker images meant to build versions with the simpletrack benchmark for nvidia GPU and intel and pocl runtimes. To be specify custom number of particles and turns use the environment variables: +Docker images containing Simpletrack benchmark built a selection of GPU/CPU targets: -``` -~$ docker run --rm -e PARTICLES=100 -e TURNS=5 gitlab-registry.cern.ch/hep-workloads-gpu/... -``` +- __Intel__: contains [GPU NEO runtime](https://github.com/intel/compute-runtime) and OneAPI version i.e. DPC++ and SYCL support contains only the [OpenCL CPU runtimes](https://software.intel.com/content/www/us/en/develop/articles/opencl-drivers.html). +- __Nvidia__: contains OpenCL runtime from [this](https://nvidia.github.io/nvidia-container-runtime/) repository. +- __POCL__: Portable Computing Language implementation built with this [repo](https://github.com/pocl/pocl) + +| Version | intel | nvidia | pocl | +|---------|:-------:|:-------:|:------:| +| GPU | x | x | | +| CPU | x | | x | +| Base OS | Debian | CC7 | Debian | + +# Usage -* __Nvidia__: To run the benchmark through the container image entrypoint make sure to enable GPU passthrough. +## Benchmark Setup + +Default entrypoint accepts the following environment for benchmark execution: + +| | Default | Description | +|-----------|----------|---------------------| +| PARTICLES | 20000 | Number of particles | +| TURNS | 15 | Number of turns | +| DEVICE | "0.0" | Platform ID | + +Docker example: ``` -~$ docker run --rm --gpus all gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:nvidia-latest +~$ docker run --rm -e PARTICLES=100 -e TURNS=5 -e DEVICE="1.0" <image:tag> ``` -* __Intel__: Make sure to passthrough the /dev/dri into the container. +## Target Platform + +To discover and target available platform pass the desired DEVICE environment variable into the container, for example: ``` -~$ docker run --rm --device /dev/dri:/dev/dri gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:intel-latest +~$ docker run --rm --device /dev/dri:/dev/dri --entrypoint="/bin/bash" \ + gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:intel-0.1.0 \ + -c "cd /simpletrack/examples/lhc && python3 benchmark_opencl.py --show" + +Platform : Intel(R) OpenCL HD Graphics + Device '0.0': Intel(R) Gen9 HD Graphics NEO +Platform : Intel(R) OpenCL + Device '1.0': Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz + +~$ docker run --rm --device /dev/dri:/dev/dri -e DEVICE "0.0" gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:intel-0.1.0 + +29820 particles*turns/seconds, 20000 particles, 15 turns, device '0.0', Intel(R) Gen9 HD Graphics NEO + +~$ docker run --rm --device /dev/dri:/dev/dri -e DEVICE "1.0" gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:intel-0.1.0 + +5856 particles*turns/seconds, 20000 particles, 15 turns, device '1.0', Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz ``` -* __POCL__: Portable Computing Language with built ICD extensions of OpenCL. Example execution using the cpu device: +For a full list of available platforms use _clinfo_ tool as follows: ``` -~$ docker run --rm gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:pocl-latest +~$ docker run --rm --entrypoint "/usr/bin/clinfo" gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:intel-0.1.0 ``` -To check for available devices: +## Docker Passthrough + +To enable GPU passthrough use "--gpus all" or "--device /dev/dri:/dev/dri" for Nvidia and Intel targets as follows: ``` -~$ docker run --rm --entrypoint "/usr/bin/clinfo" gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:pocl-latest +~$ docker run --rm --gpus all gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:nvidia-0.1.0 + +~$ docker run --rm --device /dev/dri:/dev/dri gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/lhc/simpletrack:intel-0.1.0 ``` diff --git a/lhc/simpletrack/lhc-simpletrack.spec b/lhc/simpletrack/lhc-simpletrack.spec new file mode 100644 index 0000000..33a0bb2 --- /dev/null +++ b/lhc/simpletrack/lhc-simpletrack.spec @@ -0,0 +1,7 @@ +HEPWL_BMKEXE=/simpletrack/examples/lhc/benchmark_opencl.py +HEPWL_BMKOPTS="-p 20000 -t 15 -d \"0.0\"" +HEPWL_BMKDIR= +HEPWL_BMKDESCRIPTION="Simpletrack OpenCL WIP of SixTrack" +HEPWL_DOCKERIMAGENAME=lhc/simpletrack +HEPWL_DOCKERIMAGETAG=0.1.0 +HEPWL_CVMFSREPOS= -- GitLab