##============================================================================
##  The contents of this file are covered by the Viskores license. See
##  LICENSE.txt for details.
##
##  By contributing to this file, all contributors agree to the Developer
##  Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
##============================================================================

##=============================================================================
##
##  Copyright (c) Kitware, Inc.
##  All rights reserved.
##  See LICENSE.txt for details.
##
##  This software is distributed WITHOUT ANY WARRANTY; without even
##  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
##  PURPOSE.  See the above copyright notice for more information.
##
##=============================================================================

.kokkos_rocm_vars: &kokkos_rocm_vars
  variables:
    CCACHE_BASEDIR:          "$CI_PROJECT_DIR"
    CCACHE_COMPILERCHECK:    "content"
    # -isystem= is not affected by CCACHE_BASEDIR, thus we must ignore it
    CCACHE_IGNOREOPTIONS:    "-isystem=*"
    CCACHE_NOHASHDIR:        "true"
    CCACHE_RESHARE:          "true"

    CMAKE_BUILD_TYPE:        "RelWithDebInfo"
    CMAKE_HIP_COMPILER:      "/opt/rocm/llvm/bin/clang++"
    Kokkos_CXX_COMPILER:     "/opt/rocm/llvm/bin/clang++"
    LD_LIBRARY_PATH:         "/opt/rocm/lib"
    CXX:                     "hipcc"

ubuntu2204_hip_kokkos37:
  tags:
    - gfx908
    - uo-gpu
    - x86_64-amdgpu
    - instinct
  extends:
    - .ubuntu2204_hip_kokkos
    - .cmake_build_linux
    - .kokkos_rocm_vars
    - .run_automatically
  variables:
    CMAKE_BUILD_TYPE:        "RelWithDebInfo"
    CMAKE_HIP_ARCHITECTURES: "gfx908"
    Kokkos_DIR:              "/opt/kokkos/3.7.01/"
    VISKORES_SETTINGS:       "benchmarks+kokkos+hip+no_rendering+ccache"
    NO_TESTING:              "ON"
  after_script:
    - ccache -v -s
    - ccache -z

ubuntu2204_hip_kokkos43:
  tags:
    - gfx908
    - uo-gpu
    - x86_64-amdgpu
    - instinct
  extends:
    - .ubuntu2204_hip_kokkos
    - .cmake_build_linux
    - .kokkos_rocm_vars
    - .run_automatically
  variables:
    CMAKE_BUILD_TYPE:        "RelWithDebInfo"
    CMAKE_HIP_ARCHITECTURES: "gfx906"
    Kokkos_DIR:              "/opt/kokkos/4.3.01/"
    VISKORES_SETTINGS:       "benchmarks+kokkos+hip+no_rendering+no_testing+ccache"
    NO_TESTING:              "ON"
  after_script:
    - ccache -v -s
    - ccache -z

ubuntu2204_clang11_cuda122:
  tags:
    - nvidia-a100
    - uo-gpu
    - x86_64-nvidiagpu
    - voltar
  extends:
    - .ubuntu2204_cuda122
    - .cmake_build_linux
    - .run_automatically
  variables:
    CC: "clang-11"
    CXX: "clang++-11"
    CUDAHOSTCXX: "clang++-11"
    VISKORES_SETTINGS: "cuda+ampere+tbb+examples+shared+ccache"
    CTEST_EXCLUSIONS: "UnitTestTimer"

#ubuntu2204_gcc10_cuda122:
#  tags:
#    - nvidia-h100
#    - uo-gpu
#    - x86_64-nvidiagpu
#  extends:
#    - .ubuntu2204_cuda122
#    - .cmake_build_linux
#    - .run_automatically
#  variables:
#    CC: "gcc-10"
#    CXX: "g++-10"
#    CUDAFLAGS: "-Xcompiler -fno-lto"
#    CUDAHOSTCXX: "g++-10"
#    VISKORES_SETTINGS: "cuda+hopper+mpi+64bit_floats+shared+ccache"

ubuntu2204_clang12:
  extends:
    - .ubuntu2204
    - .cmake_build_linux
    - .run_automatically
    - .uo_cpu_tags
  variables:
    CC: "clang-12"
    CXX: "clang++-12"
    CMAKE_BUILD_TYPE: Debug
    VISKORES_SETTINGS: "tbb+shared+examples+ccache"

ubuntu2204_kokkos37_cuda122:
  tags:
    - nvidia-a100
    - uo-gpu
    - x86_64-nvidiagpu
    - voltar
  extends:
    - .ubuntu2204_cuda122_kokkos
    - .cmake_build_linux
    - .run_automatically
  variables:
    CMAKE_GENERATOR: "Ninja"
    CMAKE_BUILD_TYPE: Release
    VISKORES_SETTINGS: "benchmarks+kokkos+ampere+64bit_floats+shared+ccache"

ubuntu2204_gcc12:
  extends:
    - .ubuntu2204
    - .cmake_build_linux
    - .run_automatically
    - .uo_cpu_tags
  variables:
    # Restrict OpenMP number of threads since multiple test stages
    # execute on the same hardware concurrently
    OMP_NUM_THREADS: 3
    CC: "gcc-12"
    CXX: "g++-12"
    VISKORES_SETTINGS: "openmp+shared+examples+ccache"
    CTEST_EXCLUSIONS: "UnitTestArrayPortalValueReference"
