From 170c605d6a582fae3e09c995a25043d3e4ff67de Mon Sep 17 00:00:00 2001
From: David Beckingsale <davidbeckingsale@gmail.com>
Date: Tue, 28 Jun 2022 12:15:53 -0700
Subject: AWS RADIUSS builds (#31114)

* Add AWS RADIUSS builds

* Correct variable naming

* Add two more MFEM specs

* Updates to MFEM spec suggested by @v-dobrev

* Simplify MFEM specs
---
 share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml  |  79 ++++++++++
 .../stacks/radiuss-aws-aarch64/spack.yaml          | 160 +++++++++++++++++++++
 .../cloud_pipelines/stacks/radiuss-aws/spack.yaml  | 159 ++++++++++++++++++++
 3 files changed, 398 insertions(+)
 create mode 100644 share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws-aarch64/spack.yaml
 create mode 100644 share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws/spack.yaml

diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index e1867ac943..7ced336cf5 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -401,6 +401,85 @@ radiuss-protected-build:
     - artifacts: True
       job: radiuss-protected-generate
 
+########################################
+# RADIUSS for AWS
+########################################
+
+# Call this AFTER .*-generate
+.radiuss-aws-overrides:
+  # This controls image for generate step; build step is controlled by spack.yaml
+  # Note that generator emits OS info for build so these should be the same.
+  image: { "name": "ghcr.io/spack/e4s-amazonlinux-2:v2022-03-21", "entrypoint": [""] }
+
+.radiuss-aws:
+  variables:
+    SPACK_CI_STACK_NAME: radiuss-aws
+
+radiuss-aws-pr-generate:
+  extends: [ ".radiuss-aws", ".pr-generate", ".radiuss-aws-overrides" ]
+  tags: ["spack", "public", "medium", "x86_64_v4"]
+
+radiuss-aws-protected-generate:
+  extends: [ ".radiuss-aws", ".protected-generate", ".radiuss-aws-overrides" ]
+  tags: ["spack", "public", "medium", "x86_64_v4"]
+
+radiuss-aws-pr-build:
+  extends: [ ".radiuss-aws", ".pr-build" ]
+  trigger:
+    include:
+      - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml
+        job: radiuss-aws-pr-generate
+    strategy: depend
+  needs:
+    - artifacts: True
+      job: radiuss-aws-pr-generate
+
+radiuss-aws-protected-build:
+  extends: [ ".radiuss-aws", ".protected-build" ]
+  trigger:
+    include:
+      - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml
+        job: radiuss-aws-protected-generate
+    strategy: depend
+  needs:
+    - artifacts: True
+      job: radiuss-aws-protected-generate
+
+
+# Parallel Pipeline for aarch64 (reuses override image, but generates and builds on aarch64)
+
+.radiuss-aws-aarch64:
+  variables:
+    SPACK_CI_STACK_NAME: radiuss-aws-aarch64
+
+radiuss-aws-aarch64-pr-generate:
+  extends: [ ".radiuss-aws-aarch64", ".pr-generate-aarch64", ".radiuss-aws-overrides" ]
+
+radiuss-aws-aarch64-protected-generate:
+  extends: [ ".radiuss-aws-aarch64", ".protected-generate-aarch64", ".radiuss-aws-overrides" ]
+
+radiuss-aws-aarch64-pr-build:
+  extends: [ ".radiuss-aws-aarch64", ".pr-build" ]
+  trigger:
+    include:
+      - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml
+        job: radiuss-aws-aarch64-pr-generate
+    strategy: depend
+  needs:
+    - artifacts: True
+      job: radiuss-aws-aarch64-pr-generate
+
+radiuss-aws-aarch64-protected-build:
+  extends: [ ".radiuss-aws-aarch64", ".protected-build" ]
+  trigger:
+    include:
+      - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml
+        job: radiuss-aws-aarch64-protected-generate
+    strategy: depend
+  needs:
+    - artifacts: True
+      job: radiuss-aws-aarch64-protected-generate
+
 ########################################
 # ECP Data & Vis SDK
 ########################################
diff --git a/share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws-aarch64/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws-aarch64/spack.yaml
new file mode 100644
index 0000000000..880cc58f67
--- /dev/null
+++ b/share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws-aarch64/spack.yaml
@@ -0,0 +1,160 @@
+spack:
+  view: false
+
+  concretizer:
+    reuse: false
+    unify: false
+
+  config:
+    concretizer: clingo
+    install_tree:
+      root: /home/software/spack
+      padded_length: 384
+      projections:
+        all: '{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}'
+
+  packages:
+    all:
+      providers:
+        blas:
+          - openblas
+        mkl:
+          - intel-oneapi-mkl
+        mpi:
+          - openmpi
+          - mpich
+      variants: +mpi
+
+  definitions:
+  - radiuss:
+    - ascent
+    - blt
+    - caliper
+    - caliper +cuda cuda_arch=70
+    - camp
+    - camp +cuda
+    - chai
+    - chai +cuda +raja
+    - mfem
+    - mfem +superlu-dist+petsc+sundials
+    - mfem +cuda cuda_arch=70 ^hypre+cuda
+    - raja
+    - raja +cuda cuda_arch=70
+    - umpire 
+    - umpire +cuda
+
+  - compiler:
+    - '%gcc@7.3.1'
+
+  - target:
+    - 'target=aarch64'
+    - 'target=graviton2'
+
+  specs:
+
+  - matrix:
+    - - $radiuss
+    - - $compiler
+    - - $target
+
+  mirrors: { "mirror": "s3://spack-binaries/develop/radiuss-aws" }
+
+  gitlab-ci:
+
+    script:
+      - . "./share/spack/setup-env.sh"
+      - spack --version
+      - cd ${SPACK_CONCRETE_ENV_DIR}
+      - spack env activate --without-view .
+      - spack config add "config:install_tree:projections:${SPACK_JOB_SPEC_PKG_NAME}:'morepadding/{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}'"
+      - mkdir -p ${SPACK_ARTIFACTS_ROOT}/user_data
+      - if [[ -r /mnt/key/intermediate_ci_signing_key.gpg ]]; then spack gpg trust /mnt/key/intermediate_ci_signing_key.gpg; fi
+      - if [[ -r /mnt/key/spack_public_key.gpg ]]; then spack gpg trust /mnt/key/spack_public_key.gpg; fi
+      - spack -d ci rebuild > >(tee ${SPACK_ARTIFACTS_ROOT}/user_data/pipeline_out.txt) 2> >(tee ${SPACK_ARTIFACTS_ROOT}/user_data/pipeline_err.txt >&2)
+
+    image: { "name": "ghcr.io/spack/e4s-amazonlinux-2:v2022-03-21", "entrypoint": [""] }
+    mappings:
+      - match:
+        - llvm
+        - llvm-amdgpu
+        - pango
+        - paraview
+        runner-attributes:
+          tags: [ "spack", "huge", "aarch64" ]
+          variables:
+            CI_JOB_SIZE: huge
+            KUBERNETES_CPU_REQUEST: 11000m
+            KUBERNETES_MEMORY_REQUEST: 42G
+
+
+      - match:
+        - ascent
+        - atk
+        - axom
+        - cistem
+        - ctffind
+        - cuda
+        - dyninst
+        - gcc
+        - ginkgo
+        - hdf5
+        - hpx
+        - kokkos-kernels
+        - kokkos-nvcc-wrapper
+        - magma
+        - mfem
+        - mpich
+        - openturns
+        - parallelio
+        - precice
+        - raja
+        - relion
+        - rocblas
+        - rocsolver
+        - rust
+        - slate
+        - strumpack
+        - sundials
+        - trilinos
+        - umpire
+        - vtk
+        - vtk-h
+        - vtk-m
+        - warpx
+        - wrf
+        - wxwidgets
+        runner-attributes:
+          tags: [ "spack", "large", "aarch64" ]
+          variables:
+            CI_JOB_SIZE: large
+            KUBERNETES_CPU_REQUEST: 8000m
+            KUBERNETES_MEMORY_REQUEST: 12G
+
+      - match: ['os=amzn2']
+        runner-attributes:
+          tags: ["spack", "aarch64"]
+          variables:
+            CI_JOB_SIZE: "default"
+
+    broken-specs-url: "s3://spack-binaries/broken-specs"
+
+    service-job-attributes:
+      before_script:
+        - . "./share/spack/setup-env.sh"
+        - spack --version
+      image: { "name": "ghcr.io/spack/e4s-amazonlinux-2:v2022-03-21", "entrypoint": [""] }
+      tags: ["spack", "public", "aarch64"]
+
+    signing-job-attributes:
+      image: { "name": "ghcr.io/spack/notary:latest", "entrypoint": [""] }
+      tags: ["spack", "aws"]
+      script:
+        - aws s3 sync --exclude "*" --include "*spec.json*" ${SPACK_REMOTE_MIRROR_OVERRIDE}/build_cache /tmp
+        - /sign.sh
+        - aws s3 sync --exclude "*" --include "*spec.json.sig*" /tmp ${SPACK_REMOTE_MIRROR_OVERRIDE}/build_cache
+
+  cdash:
+    build-group: RADIUSS AWS Packages
+    url: https://cdash.spack.io
+    project: Spack Testing
+    site: Cloud Gitlab Infrastructure
diff --git a/share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws/spack.yaml
new file mode 100644
index 0000000000..c6c895bd36
--- /dev/null
+++ b/share/spack/gitlab/cloud_pipelines/stacks/radiuss-aws/spack.yaml
@@ -0,0 +1,159 @@
+spack:
+  view: false
+
+  concretizer:
+    reuse: false
+    unify: false
+
+  config:
+    concretizer: clingo
+    install_tree:
+      root: /home/software/spack
+      padded_length: 384
+      projections:
+        all: '{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}'
+
+  packages:
+    all:
+      providers:
+        blas:
+          - openblas
+        mkl:
+          - intel-oneapi-mkl
+        mpi:
+          - openmpi
+          - mpich
+      variants: +mpi
+
+  definitions:
+  - radiuss:
+    - ascent
+    - blt
+    - caliper
+    - caliper +cuda cuda_arch=70
+    - camp
+    - camp +cuda
+    - chai
+    - chai +cuda +raja
+    - mfem
+    - mfem +superlu-dist+petsc+sundials
+    - mfem +cuda cuda_arch=70 ^hypre+cuda
+    - raja
+    - raja +cuda cuda_arch=70
+    - umpire 
+    - umpire +cuda
+
+  - compiler:
+    - '%gcc@7.3.1'
+
+  - target:
+    - 'target=x86_64_v3'
+
+  specs:
+
+  - matrix:
+    - - $radiuss
+    - - $compiler
+    - - $target
+
+  mirrors: { "mirror": "s3://spack-binaries/develop/radiuss-aws" }
+
+  gitlab-ci:
+
+    script:
+      - . "./share/spack/setup-env.sh"
+      - spack --version
+      - cd ${SPACK_CONCRETE_ENV_DIR}
+      - spack env activate --without-view .
+      - spack config add "config:install_tree:projections:${SPACK_JOB_SPEC_PKG_NAME}:'morepadding/{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}'"
+      - mkdir -p ${SPACK_ARTIFACTS_ROOT}/user_data
+      - if [[ -r /mnt/key/intermediate_ci_signing_key.gpg ]]; then spack gpg trust /mnt/key/intermediate_ci_signing_key.gpg; fi
+      - if [[ -r /mnt/key/spack_public_key.gpg ]]; then spack gpg trust /mnt/key/spack_public_key.gpg; fi
+      - spack -d ci rebuild > >(tee ${SPACK_ARTIFACTS_ROOT}/user_data/pipeline_out.txt) 2> >(tee ${SPACK_ARTIFACTS_ROOT}/user_data/pipeline_err.txt >&2)
+
+    image: { "name": "ghcr.io/spack/e4s-amazonlinux-2:v2022-03-21", "entrypoint": [""] }
+    mappings:
+      - match:
+        - llvm
+        - llvm-amdgpu
+        - pango
+        - paraview
+        runner-attributes:
+          tags: [ "spack", "huge", "x86_64_v4" ]
+          variables:
+            CI_JOB_SIZE: huge
+            KUBERNETES_CPU_REQUEST: 11000m
+            KUBERNETES_MEMORY_REQUEST: 42G
+
+
+      - match:
+        - ascent
+        - atk
+        - axom
+        - cistem
+        - ctffind
+        - cuda
+        - dyninst
+        - gcc
+        - ginkgo
+        - hdf5
+        - hpx
+        - kokkos-kernels
+        - kokkos-nvcc-wrapper
+        - magma
+        - mfem
+        - mpich
+        - openturns
+        - parallelio
+        - precice
+        - raja
+        - relion
+        - rocblas
+        - rocsolver
+        - rust
+        - slate
+        - strumpack
+        - sundials
+        - trilinos
+        - umpire
+        - vtk
+        - vtk-h
+        - vtk-m
+        - warpx
+        - wrf
+        - wxwidgets
+        runner-attributes:
+          tags: [ "spack", "large", "x86_64_v4" ]
+          variables:
+            CI_JOB_SIZE: large
+            KUBERNETES_CPU_REQUEST: 8000m
+            KUBERNETES_MEMORY_REQUEST: 12G
+
+      - match: ['os=amzn2']
+        runner-attributes:
+          tags: ["spack", "x86_64_v4"]
+          variables:
+            CI_JOB_SIZE: "default"
+
+    broken-specs-url: "s3://spack-binaries/broken-specs"
+
+    service-job-attributes:
+      before_script:
+        - . "./share/spack/setup-env.sh"
+        - spack --version
+      image: { "name": "ghcr.io/spack/e4s-amazonlinux-2:v2022-03-21", "entrypoint": [""] }
+      tags: ["spack", "public", "x86_64_v4"]
+
+    signing-job-attributes:
+      image: { "name": "ghcr.io/spack/notary:latest", "entrypoint": [""] }
+      tags: ["spack", "aws"]
+      script:
+        - aws s3 sync --exclude "*" --include "*spec.json*" ${SPACK_REMOTE_MIRROR_OVERRIDE}/build_cache /tmp
+        - /sign.sh
+        - aws s3 sync --exclude "*" --include "*spec.json.sig*" /tmp ${SPACK_REMOTE_MIRROR_OVERRIDE}/build_cache
+
+  cdash:
+    build-group: RADIUSS AWS Packages
+    url: https://cdash.spack.io
+    project: Spack Testing
+    site: Cloud Gitlab Infrastructure
-- 
cgit v1.2.3-70-g09d2