From 16a9464b5cb5ba9765cb06a129aa71a82882298e Mon Sep 17 00:00:00 2001
From: Cody Balos <balos1@llnl.gov>
Date: Fri, 21 Feb 2020 12:54:27 -0800
Subject: [PATCH] sundials: add version 5.1.0 and trilinos variant (#15155)

* sundials: add version 5.1.0 and trilinos variant

* sundials: add version 5.1.0 and trilinos variant
---
 .../builtin/packages/sundials/package.py      | 55 +++++++++++++++++--
 1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py
index db1dd42753..a76b36eacb 100644
--- a/var/spack/repos/builtin/packages/sundials/package.py
+++ b/var/spack/repos/builtin/packages/sundials/package.py
@@ -21,6 +21,7 @@ class Sundials(CMakePackage):
     # Versions
     # ==========================================================================
     version('develop', branch='develop')
+    version('5.1.0', sha256='fb22d14fad42203809dc46d046b001149ec4e901b23882bd4a80619157fd9b21')
     version('5.0.0', sha256='345141ec01c641d0bdfb3476c478b7e74fd6a7192a478a27cafe75d9da2d7dd3')
     version('4.1.0', sha256='280de1c27b2360170a6f46cb3799b2aee9dff3bddbafc8b08c291a47ab258aa5')
     version('4.0.1', sha256='29e409c8620e803990edbda1ebf49e03a38c08b9187b90658d86bddae913aed4')
@@ -65,9 +66,9 @@ class Sundials(CMakePackage):
     variant('pthread', default=False,
             description='Enable Pthreads parallel vector')
     variant('cuda',    default=False,
-            description='Enable CUDA parallel vector')
+            description='Enable CUDA vector and solvers')
     variant('raja',    default=False,
-            description='Enable RAJA parallel vector')
+            description='Enable RAJA vector')
 
     # External libraries
     variant('hypre',        default=False,
@@ -77,11 +78,13 @@ class Sundials(CMakePackage):
     variant('klu',          default=False,
             description='Enable KLU sparse, direct solver')
     variant('petsc',        default=False,
-            description='Enable PETSc MPI parallel vector')
+            description='Enable PETSc interfaces')
     variant('superlu-mt',   default=False,
             description='Enable SuperLU_MT sparse, direct solver')
     variant('superlu-dist', default=False,
             description='Enable SuperLU_DIST sparse, direct solver')
+    variant('trilinos', default=False,
+            description='Enable Trilinos interfaces')
 
     # Library type
     variant('shared', default=True,
@@ -130,6 +133,7 @@ class Sundials(CMakePackage):
     conflicts('+examples-cuda', when='@:2.7.0')
     conflicts('+superlu-dist',  when='@:4.1.0')
     conflicts('+f2003',         when='@:4.1.0')
+    conflicts('+trilinos',      when='@:4.1.0')
 
     # External libraries incompatible with 64-bit indices
     conflicts('+lapack', when='@3.0.0: +int64')
@@ -173,6 +177,7 @@ class Sundials(CMakePackage):
     depends_on('petsc +mpi',          when='+petsc')
     depends_on('hypre +mpi',          when='+hypre')
     depends_on('superlu-dist@6.1.1:', when='+superlu-dist')
+    depends_on('trilinos+tpetra',     when='+trilinos')
 
     # Require that external libraries built with the same precision
     depends_on('petsc~double~complex', when='+petsc precision=single')
@@ -253,8 +258,7 @@ def on_off(varstr):
             '-DMPI_ENABLE=%s'     % on_off('+mpi'),
             '-DOPENMP_ENABLE=%s'  % on_off('+openmp'),
             '-DPTHREAD_ENABLE=%s' % on_off('+pthread'),
-            '-DCUDA_ENABLE=%s'    % on_off('+cuda'),
-            '-DRAJA_ENABLE=%s'    % on_off('+raja')
+            '-DCUDA_ENABLE=%s'    % on_off('+cuda')
         ])
 
         # MPI support
@@ -274,6 +278,10 @@ def on_off(varstr):
                 '-DHYPRE_INCLUDE_DIR=%s' % spec['hypre'].prefix.include,
                 '-DHYPRE_LIBRARY_DIR=%s' % spec['hypre'].prefix.lib
             ])
+        else:
+            args.extend([
+                '-DHYPRE_ENABLE=OFF'
+            ])
 
         # Building with KLU
         if '+klu' in spec:
@@ -282,6 +290,10 @@ def on_off(varstr):
                 '-DKLU_INCLUDE_DIR=%s' % spec['suite-sparse'].prefix.include,
                 '-DKLU_LIBRARY_DIR=%s' % spec['suite-sparse'].prefix.lib
             ])
+        else:
+            args.extend([
+                '-DKLU_ENABLE=OFF'
+            ])
 
         # Building with LAPACK
         if '+lapack' in spec:
@@ -290,6 +302,10 @@ def on_off(varstr):
                 '-DLAPACK_LIBRARIES=%s'
                 % (spec['lapack'].libs + spec['blas'].libs).joined(';')
             ])
+        else:
+            args.extend([
+                '-DLAPACK_ENABLE=OFF'
+            ])
 
         # Building with PETSc
         if '+petsc' in spec:
@@ -302,12 +318,21 @@ def on_off(varstr):
                 '-DPETSC_INCLUDE_DIR=%s' % spec['petsc'].prefix.include,
                 '-DPETSC_LIBRARY_DIR=%s' % spec['petsc'].prefix.lib
             ])
+        else:
+            args.extend([
+                '-DPETSC_ENABLE=OFF'
+            ])
 
         # Building with RAJA
         if '+raja' in spec:
             args.extend([
+                '-DRAJA_ENABLE=ON',
                 '-DRAJA_DIR=%s' % spec['raja'].prefix.share.raja.cmake
             ])
+        else:
+            args.extend([
+                '-DRAJA_ENABLE=OFF'
+            ])
 
         # Building with SuperLU_MT
         if '+superlu-mt' in spec:
@@ -327,6 +352,10 @@ def on_off(varstr):
                 args.append('-DSUPERLUMT_THREAD_TYPE=OpenMP')
             else:
                 args.append('-DSUPERLUMT_THREAD_TYPE=Pthread')
+        else:
+            args.extend([
+                '-DSUPERLUMT_ENABLE=OFF'
+            ])
 
         # Building with SuperLU_DIST
         if '+superlu-dist' in spec:
@@ -341,6 +370,22 @@ def on_off(varstr):
                 '-DSUPERLUDIST_OpenMP=%s'
                 % on_off('^superlu-dist+openmp')
             ])
+        else:
+            args.extend([
+                '-DSUPERLUDIST_ENABLE=OFF'
+            ])
+
+        # Building with Trilinos
+        if '+trilinos' in spec:
+            args.extend([
+                '-DTrilinos_ENABLE=ON',
+                '-DTrilinos_DIR=%s'
+                % spec['trilinos'].prefix
+            ])
+        else:
+            args.extend([
+                '-DTrilinos_ENABLE=OFF'
+            ])
 
         # Examples
         if spec.satisfies('@3.0.0:'):
-- 
GitLab