New Package Wonton (#17882)

* new package Wonton

* remove the flecsi variant because flecsi-sp does not have a spackage

* fix url, clean up whitespaces

* formatting

* put in explicit else clauses for variants in CMake section because CMake's behavior is system-dependent

Co-authored-by: Rao Garimella <rao@abyzou.lanl.gov>
This commit is contained in:
Rao Garimella 2020-08-06 12:55:24 -06:00 committed by GitHub
parent 051e124533
commit 9a7834949d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,127 @@
# Copyright 2013-2020 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 Wonton(CMakePackage):
"""Wonton is a support package for the Portage
(https://github.com/laristra/portage) and Tangram
(https://github.com/laristra/tangram) libraries. It contains some
mesh/state classes, wrappers for other mesh/state libraries and
some utilities required by Portage and Tangram.
"""
homepage = "https://portage.lanl.gov"
git = "https://github.com/laristra/wonton.git"
url = "https://github.com/laristra/wonton/releases/download/1.2.1/wonton-1.2.1.tar.gz"
maintainers = ['raovgarimella']
version('1.2.1', sha256='e103844b6c086ec4326970099e9dff2d2fa55c960eb2ecb0c76fabfe3b7305e8')
variant('lapacke', default=True, description='Use LAPACKE solvers')
# Variants for controlling parallelism
variant('mpi', default=False, description='Enable distributed meshes with MPI')
variant('thrust', default=False, description='Enable on-node parallelism using NVidia Thrust library')
variant('kokkos', default=False, description='Enable on-node or device parallelism with Kokkos')
variant('openmp', default=False, description="Enable on-node parallelism using OpenMP")
variant('cuda', default=False, description="Enable GPU parallelism using CUDA")
# wrappers to external mesh/state libraries
variant('jali', default=False, description='Enable Jali mesh wrappers')
conflicts('+jali ~mpi') # Jali needs MPI
conflicts('+thrust +cuda') # Thrust with CUDA does not work as yet
conflicts('+thrust +kokkos') # Don't enable Kokkos, Thrust simultaneously
# dependencies
depends_on('cmake@3.13:', type='build')
depends_on('netlib-lapack +lapacke', when='+lapacke')
depends_on('mpi', when='+mpi')
depends_on('jali +mstk', when='+jali')
depends_on('mpi', when='+jali')
# We need boost only when no thrust option
depends_on('boost', when='~thrust')
# NVidia thrust library
depends_on('thrust@1.8.3', when='+thrust')
# CUDA library
depends_on('cuda', when='+cuda')
# Kokkos with appropriate option
depends_on('kokkos +openmp', when='+kokkos +openmp')
depends_on('kokkos +cuda', when='+kokkos +cuda')
def cmake_args(self):
options = []
if '+mpi' in self.spec:
options.append('-DWONTON_ENABLE_MPI=ON')
else:
options.append('-DWONTON_ENABLE_MPI=OFF')
if '+lapacke' in self.spec:
options.append('-DWONTON_ENABLE_LAPACKE=ON')
options.append('-DBLA_VENDOR=' + self.spec['blas'].name.upper())
options.append(
'-DBLAS_LIBRARIES=' + self.spec['blas'].libs.joined()
)
else:
options.append('-DWONTON_ENABLE_LAPACKE=OFF')
if '+thrust' in self.spec:
options.append('-DWONTON_ENABLE_THRUST=ON')
if '+cuda' in self.spec:
options.append(
'-DTHRUST_HOST_BACKEND:STRING=THRUST_HOST_SYSTEM_CPP'
)
options.append(
'-DTHRUST_DEVICE_BACKEND:STRING=THRUST_DEVICE_SYSTEM_CUDA'
)
else:
options.append(
'-DTHRUST_HOST_BACKEND:STRING=THRUST_HOST_SYSTEM_CPP'
)
options.append(
'-DTHRUST_DEVICE_BACKEND:STRING=THRUST_DEVICE_SYSTEM_OMP'
)
else:
options.append('-DWONTON_ENABLE_THRUST=OFF')
if '+kokkos' in self.spec:
options.append('-DWONTON_ENABLE_Kokkos=ON')
if '+cuda' in self.spec:
options.append('-DWONTON_ENABLE_Kokkos_CUDA=ON')
elif '+openmp' in self.spec:
options.append('-DWONTON_ENABLE_Kokkos_OpenMP=ON')
else:
options.append('-DWONTON_ENABLE_Kokkos=OFF')
if '+jali' in self.spec:
options.append('-DWONTON_ENABLE_Jali=ON')
else:
options.append('-DWONTON_ENABLE_Jali=OFF')
if '+flecsi' in self.spec:
options.append('-DWONTON_ENABLE_FleCSI=ON')
else:
options.append('-DWONTON_ENABLE_FleCSI=OFF')
# Unit test variant
if self.run_tests:
options.append('-DENABLE_UNIT_TESTS=ON')
options.append('-DENABLE_APP_TESTS=ON')
else:
options.append('-DENABLE_UNIT_TESTS=OFF')
options.append('-DENABLE_APP_TESTS=OFF')
return options