From 58d305e5c39a82cab5db366a51a950896c7731ab Mon Sep 17 00:00:00 2001
From: olga <odatskov@cern.ch>
Date: Mon, 29 Jun 2020 00:16:04 +0200
Subject: [PATCH] Introducing qa pipelines and tag build

---
 .gitlab-ci.yml                      |  6 +++++-
 lhc/simpletrack/.simpletrack-ci.yml | 18 +++++-------------
 lhc/simpletrack/CHANGELOG.md        |  2 +-
 lhc/simpletrack/README.md           | 13 +++++--------
 lhc/simpletrack/lhc-simpletrack.sh  |  2 +-
 5 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2f421dc..877425b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,4 +9,8 @@ simpletrack:
     strategy: depend
   only:
     variables:
-    - $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME == "qa"
+    - $CI_COMMIT_TAG != "" || $CI_COMMIT_REF_NAME == "qa"
+    changes:
+    - lhc/simpletrack/Dockerfile.*
+    - lhc/simpletrack/lhc-simpletrack.*
+    - lhc/simpletrack/.simpletrack-ci.yml
diff --git a/lhc/simpletrack/.simpletrack-ci.yml b/lhc/simpletrack/.simpletrack-ci.yml
index e3c1c29..eb619d7 100644
--- a/lhc/simpletrack/.simpletrack-ci.yml
+++ b/lhc/simpletrack/.simpletrack-ci.yml
@@ -16,15 +16,7 @@ stages:
     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`
-  - if [ "${CI_COMMMIT_REF_NAME}" == "qa" ]; then export HEP_TAG="qa"-$HEP_TAG; export HEP_LATEST="qa-latest"; else export HEP_LATEST="latest"; fi
-  only:
-    variables:
-    - $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME == "qa"
-    changes:
-    - lhc/simpletrack/Dockerfile.*
-    - lhc/simpletrack/lhc-simpletrack.*
-    - lhc/simpletrack/.simpletrack-ci.yml
+  - export HEP_LATEST="latest"; export HEP_TAG=$CI_COMMIT_TAG; if [ "$CI_COMMIT_REF_NAME" == "qa" ]; then export HEP_LATEST=`echo ci-${CI_COMMIT_REF_NAME}-latest` ; export HEP_TAG=`echo "ci"-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}`; fi
 
 .job_template: &job_test
   stage: test
@@ -80,7 +72,7 @@ build:pocl:
 test:intel:
   <<: *job_test
   image:
-    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/intel:qa-latest
+    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/intel:ci-qa-latest
     entrypoint: [""]
   needs:
   - job: build:intel
@@ -89,7 +81,7 @@ test:intel:
 test:pocl:
   <<: *job_test
   image:
-    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/pocl:qa-latest
+    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/pocl:ci-qa-latest
     entrypoint: [""]
   needs:
   - job: build:pocl
@@ -102,7 +94,7 @@ test:pocl:
 bench:intel:
   <<: *job_bench
   image:
-    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/intel:qa-latest
+    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/intel:ci-qa-latest
     entrypoint: [""]
   needs:
   - job: test:intel
@@ -111,7 +103,7 @@ bench:intel:
 bench:pocl:
   <<: *job_bench
   image:
-    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/pocl:qa-latest
+    name: gitlab-registry.cern.ch/hep-benchmarks/hep-workloads-gpu/simpletrack/pocl:ci-qa-latest
     entrypoint: [""]
   needs:
   - job: test:pocl
diff --git a/lhc/simpletrack/CHANGELOG.md b/lhc/simpletrack/CHANGELOG.md
index 4232268..15f9636 100644
--- a/lhc/simpletrack/CHANGELOG.md
+++ b/lhc/simpletrack/CHANGELOG.md
@@ -2,10 +2,10 @@
 
 UPDATES:
 * intel: NEO version updated to 20.25.17111 and oneAPI DPC++ to 2020.10.6.0.4 (June releases).
+* ROCm container added
 
 FEATURES:
 * Switched to argument for benchmark setup instead of environment variables.
-* ROCm container added
 
 # 0.2.1 (June 25th 2020)
 
diff --git a/lhc/simpletrack/README.md b/lhc/simpletrack/README.md
index 5b29649..a05d7ab 100644
--- a/lhc/simpletrack/README.md
+++ b/lhc/simpletrack/README.md
@@ -10,7 +10,7 @@ Docker images containing OpenCL-oriented Simpletrack benchmark built for a selec
 |              | __intel__   | __rocm__  | __nvidia__ | __pocl__   |
 |--------------|:-----------:|:-----------:|:--------:|:----------:|
 | __GPU__      | :heavy_check_mark:  | :heavy_check_mark: | :heavy_check_mark: |        |       
-| __CPU__      | :heavy_check_mark:  | :white_check_mark: |                    | :heavy_check_mark: |
+| __CPU__      | :heavy_check_mark:  | :grey_question:    |                    | :heavy_check_mark: |
 
 # Usage
 
@@ -26,18 +26,15 @@ Options:
 	-d, --device		Specify the device to run on. Default: 0.0
 	-b, --benchmark		Benchmark modes: all or device. Default: device
 	-s, --show		List all available devices and exit
+        -h, --help              Prints this message
 ```
 
-To run the container for 1000 particles, 5 particles for device "1.0": ```~$ docker run --rm <image:tag> -p 1000 -t 5 -d "1.0"```
-Use the benchmark option "all" to execute runs on all available devices: ```~$ docker run --rm <image:tag> -b "all"```
+- To run the container for 1000 particles, 5 particles for device "1.0": ```~$ docker run --rm <image:tag> -p 1000 -t 5 -d "1.0"```
+- Use the benchmark option "all" to execute runs on all available devices: ```~$ docker run --rm <image:tag> -b "all"```
+- To discover available platforms use the show option: ```~$ docker run --rm <image:tag> -s```
 
 The benchmark mode allows to generate logs and output files in a default location (/simpletrack/examples/lhc/jobs or $CI_PROJECT_DIR) for either a single or all available devices.
 
-
-## Target Platform
-
-To discover and target available platform pass the desired DEVICE ...
-
 ## Docker GPU Passthrough
 
 To passthrough the device to the container, use the following options:
diff --git a/lhc/simpletrack/lhc-simpletrack.sh b/lhc/simpletrack/lhc-simpletrack.sh
index 964d789..8bf0ca1 100755
--- a/lhc/simpletrack/lhc-simpletrack.sh
+++ b/lhc/simpletrack/lhc-simpletrack.sh
@@ -41,7 +41,7 @@ parse_args() {
   do
     case $1 in
       --help|-help|-h)
-        echo -e "Usage: $0 <options>\n\nOptions:\n\t-p, --particles\t\tNumber of particles. Default: $PARTICLES\n\t-t, --turns\t\tNumber of turns. Default: $TURNS\n\t-d, --device\t\tSpecify the device to run on. Default: $DEVICE\n\t-b, --benchmark\t\tBenchmark modes: all or device. Default: $BENCHMARK\n\t-s, --show\t\tList all available devices and exit\n"; exit 0;;
+        echo -e "Usage: $0 <options>\n\nOptions:\n\t-p, --particles\t\tNumber of particles. Default: $PARTICLES\n\t-t, --turns\t\tNumber of turns. Default: $TURNS\n\t-d, --device\t\tSpecify the device to run on. Default: $DEVICE\n\t-b, --benchmark\t\tBenchmark modes: all or device. Default: $BENCHMARK\n\t-s, --show\t\tList all available devices and exit\n\t-h, --help\t\tPrints this message\n"; exit 0;;
       --particles|-p) shift 1 ; PARTICLES=$1 ;;
       --turns|-t)     shift 1 ; TURNS=$1 ;;
       --device|-d)    shift 1 ; DEVICE=$1 ;;
-- 
GitLab