spack/var/spack/repos/builtin/packages/occa/package.py
Veselin Dobrev 49334f006d [WIP] CEED 2.0 (#10903)
* Initial commit for v2.0 of the CEED software suite.

* Update Nek packages and gslib

* Help spack concretize the hypre version for ceed-2.0.

* Fix nekcem install error

* Add support for gfortran v8 in nek5000 and nekcem.

* Split Nek5000 into Nek5000 and Nektools

* Get Nektools to build fine in Theta

* Fix travis failure: remove unused 'import numbers' from nek5000.

* Check for gfortran if it is wrapped

* Tweak the detection of gfortran in nek5000.

* Fix Nek packages to add -std=legacy when FC=gcc

* spack install ceed~petsc works fine on Theta

* Fix flake8 errors

* Fix more flake8 tests

* Fix an import issue

* Tweak the suite-sparse package to avoid interaction with existing system
installations of suite-sparse.

* petsc: update superlu-dist dependency

* Updates in the packages: occa, libceed, and ceed.

* In the libceed package, explicitly tell nvcc which host compiler to use.

* Fix python formatting.

* Simplify the test for gfortran in nek* packages.

* ceed: 2.0 uses petsc@3.11.0

* hpgmg-0.4; use from ceed@2.0.0

* Update the hypre dependency for ceed 2.0.

* Disable the superlu-dist dependency (through hypre) when using a
+quickbuild of ceed 2.0.

* petsc-3.11.0: add xlf fix

* nekcem: has a build dependency on Python 2.7+

* hpgmg: better setting of compiler options and use python for configure

* libceed: use v0.4 tag

* libceed: fix 0.4 release oops (pkgconfig version)

* Add a patch for magma-2.5.0 that brings it up the current 'master'.

* In the mfem package, install the examples, miniapps, and data under
$prefix/share/mfem.

* In the magma package, apply a patch to v2.5.0 that disables
magma_sparse - for testing purposes.

* In the magma package, link the 'magma' library with the
'nvToolsExt' library.

* In the magma package, update the 'magma-2.5.0.patch' with the latest
commits from the magma source repository. Also, remove the library
'nvToolsExt' from the 'magma-2.5.0-cmake.patch' - now it is not
needed.

* In the magma package, disable OpenMP when using v2.5.0 with the
IBM XL compiler.

 Please enter the commit message for your changes. Lines starting

* In the mfem package, add version for the 'laghos-v2.0' tag; also,
prefix the versions `laghos-v*` with their respective development
version numbers -- this way they are properly ordered within spack
relative to the official numbered versions.

* petsc: add version 3.11.1 (#11179)


(cherry picked from commit 1eab6e3c86)

* ceed-2.0: use petsc-3.11.1

* this-is-so-dumb.f -> empty.f
2019-04-17 17:37:41 -07:00

113 lines
4.4 KiB
Python

# 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 Occa(Package):
"""OCCA is an open-source (MIT license) library used to program current
multi-core/many-core architectures. Devices (such as CPUs, GPUs,
Intel's Xeon Phi, FPGAs, etc) are abstracted using an offload-model
for application development and programming for the devices is done
through a C-based (OKL) or Fortran-based kernel language (OFL).
OCCA gives developers the ability to target devices at run-time by
using run-time compilation for device kernels.
"""
homepage = "http://libocca.org"
git = 'https://github.com/libocca/occa.git'
version('develop')
version('1.0.8', tag='v1.0.8')
version('1.0.0-alpha.5', tag='v1.0.0-alpha.5')
version('0.2.0', tag='v0.2.0')
version('0.1.0', tag='v0.1.0')
variant('cuda',
default=True,
description='Activates support for CUDA')
variant('openmp',
default=True,
description='Activates support for OpenMP')
variant('opencl',
default=True,
description='Activates support for OpenCL')
depends_on('cuda', when='+cuda')
conflicts('%gcc@6:', when='^cuda@:8')
conflicts('%gcc@7:', when='^cuda@:9')
def install(self, spec, prefix):
# The build environment is set by the 'setup_environment' method.
# Copy the source to the installation directory and build OCCA there.
install_tree('.', prefix)
make('-C', prefix)
if self.run_tests:
make('-C', prefix, 'test', parallel=False)
def _setup_runtime_flags(self, s_env):
spec = self.spec
s_env.set('OCCA_DIR', self.prefix)
s_env.set('OCCA_CXX', self.compiler.cxx)
cxxflags = spec.compiler_flags['cxxflags']
if cxxflags:
# Run-time compiler flags:
s_env.set('OCCA_CXXFLAGS', ' '.join(cxxflags))
if '+cuda' in spec:
cuda_dir = spec['cuda'].prefix
# Run-time CUDA compiler:
s_env.set('OCCA_CUDA_COMPILER',
join_path(cuda_dir, 'bin', 'nvcc'))
def setup_environment(self, spack_env, run_env):
spec = self.spec
# The environment variable CXX is automatically set to the Spack
# compiler wrapper.
# The cxxflags, if specified, will be set by the Spack compiler wrapper
# while the environment variable CXXFLAGS will remain undefined.
# We define CXXFLAGS in the environment to tell OCCA to use the user
# specified flags instead of its defaults. This way the compiler will
# get the cxxflags twice - once from the Spack compiler wrapper and
# second time from OCCA - however, only the second one will be seen in
# the verbose output, so we keep both.
cxxflags = spec.compiler_flags['cxxflags']
if cxxflags:
spack_env.set('CXXFLAGS', ' '.join(cxxflags))
# For the cuda, openmp, and opencl variants, set the environment
# variable OCCA_{CUDA,OPENMP,OPENCL}_ENABLED only if the variant is
# disabled. Otherwise, let OCCA autodetect what is available.
if '+cuda' in spec:
cuda_dir = spec['cuda'].prefix
cuda_libs_list = ['libcuda', 'libcudart', 'libOpenCL']
cuda_libs = find_libraries(cuda_libs_list,
cuda_dir,
shared=True,
recursive=True)
spack_env.set('OCCA_INCLUDE_PATH', cuda_dir.include)
spack_env.set('OCCA_LIBRARY_PATH', ':'.join(cuda_libs.directories))
else:
spack_env.set('OCCA_CUDA_ENABLED', '0')
if '~opencl' in spec:
spack_env.set('OCCA_OPENCL_ENABLED', '0')
# Setup run-time environment for testing.
spack_env.set('OCCA_VERBOSE', '1')
self._setup_runtime_flags(spack_env)
# The 'run_env' is included in the Spack generated module files.
self._setup_runtime_flags(run_env)
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
# Export OCCA_* variables for everyone using this package from within
# Spack.
self._setup_runtime_flags(spack_env)