Repository: spack/spack

Issue:
Add chai package, link with raja and umpire
- added a spack package for chai
- added appropriate build options to raja so raja can be built with chai.
- updated the umpire revisions, as chai requires newer versions of umpire in order to compile.
- disabled blt tests in chai + umpire, as the google test they use is incompatible with gcc@9.1.0



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/chai/package.py b/var/spack/repos/builtin/packages/chai/package.py
new file mode 100644
--- /dev/null
+++ b/var/spack/repos/builtin/packages/chai/package.py
@@ -0,0 +1,61 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Chai(CMakePackage, CudaPackage):
+    """
+    Copy-hiding array interface for data migration between memory spaces
+    """
+
+    homepage = "https://github.com/LLNL/CHAI"
+    git      = "https://github.com/LLNL/CHAI.git"
+
+    version('develop', branch='develop', submodules='True')
+    version('master', branch='main', submodules='True')
+    version('2.1.1', tag='v2.1.1', submodules='True')
+    version('2.1.0', tag='v2.1.0', submodules='True')
+    version('2.0.0', tag='v2.0.0', submodules='True')
+    version('1.2.0', tag='v1.2.0', submodules='True')
+    version('1.1.0', tag='v1.1.0', submodules='True')
+    version('1.0', tag='v1.0', submodules='True')
+
+    variant('shared', default=True, description='Build Shared Libs')
+    variant('raja', default=False, description='Build plugin for RAJA')
+
+    depends_on('cmake@3.8:', type='build')
+    depends_on('umpire')
+    depends_on('raja', when="+raja")
+
+    depends_on('cmake@3.9:', type='build', when="+cuda")
+    depends_on('umpire+cuda', when="+cuda")
+    depends_on('raja+cuda', when="+raja+cuda")
+
+    def cmake_args(self):
+        spec = self.spec
+
+        options = []
+
+        if '+cuda' in spec:
+            options.extend([
+                '-DENABLE_CUDA=ON',
+                '-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)])
+
+            if not spec.satisfies('cuda_arch=none'):
+                cuda_arch = spec.variants['cuda_arch'].value
+                options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0]))
+                flag = '-arch sm_{0}'.format(cuda_arch[0])
+                options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag))
+        else:
+            options.append('-DENABLE_CUDA=OFF')
+
+        options.append('-Dumpire_DIR:PATH='
+                       + spec['umpire'].prefix.share.umpire.cmake)
+
+        options.append('-DENABLE_TESTS={0}'.format(
+            'ON' if self.run_tests else 'OFF'))
+
+        return options
diff --git a/var/spack/repos/builtin/packages/raja/package.py b/var/spack/repos/builtin/packages/raja/package.py
--- a/var/spack/repos/builtin/packages/raja/package.py
+++ b/var/spack/repos/builtin/packages/raja/package.py
@@ -13,7 +13,7 @@ class Raja(CMakePackage, CudaPackage):
     git      = "https://github.com/LLNL/RAJA.git"
 
     version('develop', branch='develop', submodules='True')
-    version('main',  branch='main',  submodules='True')
+    version('master',  branch='main',  submodules='True')
     version('0.11.0', tag='v0.11.0', submodules="True")
     version('0.10.1', tag='v0.10.1', submodules="True")
     version('0.10.0', tag='v0.10.0', submodules="True")
@@ -39,20 +39,27 @@ def cmake_args(self):
 
         options = []
         options.append('-DENABLE_OPENMP={0}'.format(
-            'On' if '+openmp' in spec else 'Off'))
+            'ON' if '+openmp' in spec else 'Off'))
 
         if '+cuda' in spec:
             options.extend([
-                '-DENABLE_CUDA=On',
+                '-DENABLE_CUDA=ON',
                 '-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)])
+
             if not spec.satisfies('cuda_arch=none'):
                 cuda_arch = spec.variants['cuda_arch'].value
                 options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0]))
-        # shared vs static libs
-        if "+shared" in spec:
-            options.append('-DBUILD_SHARED_LIBS=ON')
+                flag = '-arch sm_{0}'.format(cuda_arch[0])
+                options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag))
         else:
-            options.append('-DBUILD_SHARED_LIBS=OFF')
+            options.append('-DENABLE_CUDA=OFF')
+
+        options.append('-DBUILD_SHARED_LIBS={0}'.format(
+            'ON' if '+shared' in spec else 'OFF'))
+
+        options.append('-DENABLE_CHAI={0}'.format(
+            'ON' if '+chai' in spec else 'OFF'))
+
         # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which
         # is used by the spack compiler wrapper.  This can go away when BLT
         # removes -Werror from GTest flags
@@ -61,4 +68,8 @@ def cmake_args(self):
         else:
             options.append('-DENABLE_TESTS=ON')
 
+        if '+chai' in spec:
+            options.extend([
+                '-DENABLE_CHAI=ON'])
+
         return options
diff --git a/var/spack/repos/builtin/packages/umpire/package.py b/var/spack/repos/builtin/packages/umpire/package.py
--- a/var/spack/repos/builtin/packages/umpire/package.py
+++ b/var/spack/repos/builtin/packages/umpire/package.py
@@ -15,7 +15,8 @@ class Umpire(CMakePackage, CudaPackage):
     git      = 'https://github.com/LLNL/Umpire.git'
 
     version('develop', branch='develop', submodules='True')
-    version('main', branch='main', submodules='True')
+    version('master', branch='main', submodules='True')
+    version('3.0.0', tag='v3.0.0', submodules='True')
     version('2.1.0', tag='v2.1.0', submodules='True')
     version('2.0.0', tag='v2.0.0', submodules='True')
     version('1.1.0', tag='v1.1.0', submodules='True')
@@ -35,6 +36,8 @@ class Umpire(CMakePackage, CudaPackage):
     version('0.1.4', tag='v0.1.4', submodules='True')
     version('0.1.3', tag='v0.1.3', submodules='True')
 
+    patch('camp_target_umpire_3.0.0.patch', when='@3.0.0')
+
     variant('fortran', default=False, description='Build C/Fortran API')
     variant('c', default=True, description='Build C API')
     variant('numa', default=False, description='Enable NUMA support')
@@ -61,6 +64,7 @@ def cmake_args(self):
 
             if not spec.satisfies('cuda_arch=none'):
                 cuda_arch = spec.variants['cuda_arch'].value
+                options.append('-DCUDA_ARCH=sm_{0}'.format(cuda_arch[0]))
                 flag = '-arch sm_{0}'.format(cuda_arch[0])
                 options.append('-DCMAKE_CUDA_FLAGS:STRING={0}'.format(flag))
 


Test patch: