update alpine ascent and friends (#10320)

This adds a lot of fixes and updates for alpine ascent and its dependencies:

* add support for static (via ~shared) and use vtk-m 1.2
* update vtkh package to output cmake configure file and pinning it to vtkm 1.2
* make conduit respect ~python
* fix ascent python logic
* consistant cmake usage
* conditionally add tbb in ascent if vtkh
* enable openmp
* more robust handling of variants
* update ascent and conduit for static builds
* add optional support for mfem in ascent
* enable mfem conduit support for ascent
* add optional adios dep to conduit
* remove ver req from conduit
* ascent: remove confusing comment
* tweaks to conduit and ascent pkg recipes
* fix typo in conduit package
* pref conduit master
* changing mfem to depend on conduit@master to get updated relay
* restore use of conduit 0.3.1 or greater for mfem
* set master as preferred conduit version
* allow mfem to use conduit master
* adding rover package and editing ascent
* updating vtkm cmake dep
* guard ascent python support on +shared
* removing rover to simply ascent package
* add fortran variant to conduit, to allow us to turn off conduit support even when a fortran compiler is specified
* fix fortran compiler check so it can work on cray systems
* working towards cuda fix for vtkm lagrange filter
* update ascent package with more variants, and patch to avoid nvcc issue
* hdf5 flags fix for BGQ
* add post install test
* add testing to ascent
* add testing of the using-with-make example
* add ctest output on error for run_tests
This commit is contained in:
Cyrus Harrison 2019-01-12 17:43:39 -08:00 committed by Todd Gamblin
parent dc6dca3c36
commit 9350db5665
6 changed files with 467 additions and 72 deletions

View File

@ -5,19 +5,27 @@
from spack import * from spack import *
import socket import sys
import os import os
import socket
import glob
import shutil
import llnl.util.tty as tty import llnl.util.tty as tty
from os import environ as env from os import environ as env
def cmake_cache_entry(name, value): def cmake_cache_entry(name, value, vtype=None):
""" """
Helper that creates CMake cache entry strings used in Helper that creates CMake cache entry strings used in
'host-config' files. 'host-config' files.
""" """
return 'set({0} "{1}" CACHE PATH "")\n\n'.format(name, value) if vtype is None:
if value == "ON" or value == "OFF":
vtype = "BOOL"
else:
vtype = "PATH"
return 'set({0} "{1}" CACHE {2} "")\n\n'.format(name, value, vtype)
class Ascent(Package): class Ascent(Package):
@ -30,30 +38,31 @@ class Ascent(Package):
maintainers = ['cyrush'] maintainers = ['cyrush']
version('develop', branch='develop', submodules=True) version('develop',
branch='develop',
submodules=True)
########################################################################### ###########################################################################
# package variants # package variants
########################################################################### ###########################################################################
variant("shared", default=True, description="Build Conduit as shared libs") variant("shared", default=True, description="Build Ascent as shared libs")
variant('test', default=True, description='Enable Ascent unit tests')
variant("cmake", default=True,
description="Build CMake (if off, attempt to use cmake from PATH)")
variant("mpi", default=True, description="Build Ascent MPI Support") variant("mpi", default=True, description="Build Ascent MPI Support")
# variants for python support # variants for language support
variant("python", default=True, description="Build Conduit Python support") variant("python", default=True, description="Build Ascent Python support")
variant("fortran", default=True, description="Build Ascent Fortran support")
# variants for runtime features # variants for runtime features
variant("vtkh", default=True, variant("vtkh", default=True,
description="Build VTK-h filter and rendering support") description="Build VTK-h filter and rendering support")
variant("tbb", default=True, description="Build tbb support") variant("openmp", default=(sys.platform != 'darwin'),
description="build openmp support")
variant("cuda", default=False, description="Build cuda support") variant("cuda", default=False, description="Build cuda support")
variant("mfem", default=False, description="Build MFEM filter support")
variant("adios", default=False, description="Build Adios filter support") variant("adios", default=False, description="Build Adios filter support")
# variants for dev-tools (docs, etc) # variants for dev-tools (docs, etc)
@ -63,30 +72,48 @@ class Ascent(Package):
# package dependencies # package dependencies
########################################################################### ###########################################################################
depends_on("cmake", when="+cmake") depends_on("cmake@3.9.2:3.9.999", type='build')
depends_on("conduit@master") depends_on("conduit~python", when="~python")
depends_on("conduit+python", when="+python+shared")
depends_on("conduit~shared~python", when="~shared")
####################### #######################
# Python # Python
####################### #######################
# we need a shared version of python b/c linking with static python lib # we need a shared version of python b/c linking with static python lib
# causes duplicate state issues when running compiled python modules. # causes duplicate state issues when running compiled python modules.
depends_on("python+shared") depends_on("python+shared", when="+python+shared")
extends("python", when="+python") extends("python", when="+python+shared")
depends_on("py-numpy", when="+python", type=('build', 'run')) depends_on("py-numpy", when="+python+shared", type=('build', 'run'))
####################### #######################
# MPI # MPI
####################### #######################
depends_on("mpi", when="+mpi") depends_on("mpi", when="+mpi")
depends_on("py-mpi4py", when="+python+mpi") # use old version of mpi4py to avoid build issues with cython
depends_on("py-mpi4py@2.0.0:2.9.999", when="+mpi+python+shared")
############################# #############################
# TPLs for Runtime Features # TPLs for Runtime Features
############################# #############################
depends_on("vtkh", when="+vtkh") depends_on("vtkh@develop", when="+vtkh")
depends_on("vtkh+cuda", when="+vtkh+cuda") depends_on("vtkh@develop~openmp", when="+vtkh~openmp")
depends_on("vtkh@develop+cuda+openmp", when="+vtkh+cuda+openmp")
depends_on("vtkh@develop+cuda~openmp", when="+vtkh+cuda~openmp")
depends_on("vtkh@develop~shared", when="~shared+vtkh")
depends_on("vtkh@develop~shared~openmp", when="~shared+vtkh~openmp")
depends_on("vtkh@develop~shared+cuda", when="~shared+vtkh+cuda")
depends_on("vtkh@develop~shared+cuda~openmp", when="~shared+vtkh+cuda~openmp")
# mfem
depends_on("mfem+shared+mpi+conduit", when="+shared+mfem+mpi")
depends_on("mfem~shared+mpi+conduit", when="~shared+mfem+mpi")
depends_on("mfem+shared~mpi+conduit", when="+shared+mfem~mpi")
depends_on("mfem~shared~mpi+conduit", when="~shared+mfem~mpi")
depends_on("adios", when="+adios") depends_on("adios", when="+adios")
####################### #######################
@ -94,9 +121,12 @@ class Ascent(Package):
####################### #######################
depends_on("py-sphinx", when="+python+doc", type='build') depends_on("py-sphinx", when="+python+doc", type='build')
def setup_environment(self, spack_env, run_env):
spack_env.set('CTEST_OUTPUT_ON_FAILURE', '1')
def install(self, spec, prefix): def install(self, spec, prefix):
""" """
Build and install Conduit. Build and install Ascent.
""" """
with working_dir('spack-build', create=True): with working_dir('spack-build', create=True):
py_site_pkgs_dir = None py_site_pkgs_dir = None
@ -117,12 +147,59 @@ def install(self, spec, prefix):
if arg.count("RPATH") == 0: if arg.count("RPATH") == 0:
cmake_args.append(arg) cmake_args.append(arg)
cmake_args.extend(["-C", host_cfg_fname, "../src"]) cmake_args.extend(["-C", host_cfg_fname, "../src"])
print("Configuring Ascent...")
cmake(*cmake_args) cmake(*cmake_args)
print("Building Ascent...")
make() make()
# run unit tests if requested
if "+test" in spec and self.run_tests:
print("Running Ascent Unit Tests...")
make("test")
print("Installing Ascent...")
make("install") make("install")
# install copy of host config for provenance # install copy of host config for provenance
install(host_cfg_fname, prefix) install(host_cfg_fname, prefix)
@run_after('install')
@on_package_attributes(run_tests=True)
def check_install(self):
"""
Checks the spack install of ascent using ascents's
using-with-cmake example
"""
print("Checking Ascent installation...")
spec = self.spec
install_prefix = spec.prefix
example_src_dir = join_path(install_prefix,
"examples",
"ascent",
"using-with-cmake")
print("Checking using-with-cmake example...")
with working_dir("check-ascent-using-with-cmake-example",
create=True):
cmake_args = ["-DASCENT_DIR={0}".format(install_prefix),
"-DCONDUIT_DIR={0}".format(spec['conduit'].prefix),
"-DVTKM_DIR={0}".format(spec['vtkm'].prefix),
"-DVTKH_DIR={0}".format(spec['vtkh'].prefix),
example_src_dir]
cmake(*cmake_args)
make()
example = Executable('./ascent_render_example')
example()
print("Checking using-with-make example...")
example_src_dir = join_path(install_prefix,
"examples",
"ascent",
"using-with-make")
example_files = glob.glob(join_path(example_src_dir, "*"))
with working_dir("check-ascent-using-with-make-example",
create=True):
for example_file in example_files:
shutil.copy(example_file, ".")
make("ASCENT_DIR={0}".format(install_prefix))
example = Executable('./ascent_render_example')
example()
def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
""" """
This method creates a 'host-config' file that specifies This method creates a 'host-config' file that specifies
@ -151,8 +228,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
if self.compiler.fc: if self.compiler.fc:
# even if this is set, it may not exist so do one more sanity check # even if this is set, it may not exist so do one more sanity check
if os.path.isfile(env["SPACK_FC"]): f_compiler = which(env["SPACK_FC"])
f_compiler = env["SPACK_FC"]
####################################################################### #######################################################################
# By directly fetching the names of the actual compilers we appear # By directly fetching the names of the actual compilers we appear
@ -196,7 +272,6 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
####################### #######################
# Compiler Settings # Compiler Settings
####################### #######################
cfg.write("#######\n") cfg.write("#######\n")
cfg.write("# using %s compiler spec\n" % spec.compiler) cfg.write("# using %s compiler spec\n" % spec.compiler)
cfg.write("#######\n\n") cfg.write("#######\n\n")
@ -206,13 +281,28 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler))
cfg.write("# fortran compiler used by spack\n") cfg.write("# fortran compiler used by spack\n")
if f_compiler is not None: if "+fortran" in spec and f_compiler is not None:
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON")) cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON"))
cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", f_compiler)) cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER",
f_compiler.path))
else: else:
cfg.write("# no fortran compiler found\n\n") cfg.write("# no fortran compiler found\n\n")
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF")) cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF"))
# shared vs static libs
if "+shared" in spec:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON"))
else:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF"))
#######################
# Unit Tests
#######################
if "+test" in spec:
cfg.write(cmake_cache_entry("ENABLE_TESTS", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF"))
####################################################################### #######################################################################
# Core Dependencies # Core Dependencies
####################################################################### #######################################################################
@ -234,7 +324,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
cfg.write("# Python Support\n") cfg.write("# Python Support\n")
if "+python" in spec: if "+python" in spec and "+shared" in spec:
cfg.write("# Enable python module builds\n") cfg.write("# Enable python module builds\n")
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "ON")) cfg.write(cmake_cache_entry("ENABLE_PYTHON", "ON"))
cfg.write("# python from spack \n") cfg.write("# python from spack \n")
@ -247,7 +337,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
else: else:
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF")) cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF"))
if "+doc" in spec: if "+doc" in spec and "+python" in spec:
cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON")) cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON"))
cfg.write("# sphinx from spack \n") cfg.write("# sphinx from spack \n")
@ -294,24 +384,36 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
else: else:
cfg.write(cmake_cache_entry("ENABLE_CUDA", "OFF")) cfg.write(cmake_cache_entry("ENABLE_CUDA", "OFF"))
if "+openmp" in spec:
cfg.write(cmake_cache_entry("ENABLE_OPENMP", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_OPENMP", "OFF"))
####################### #######################
# VTK-h # VTK-h (and deps)
####################### #######################
cfg.write("# vtk-h support \n") cfg.write("# vtk-h support \n")
if "+vtkh" in spec: if "+vtkh" in spec:
cfg.write("# tbb from spack\n")
cfg.write(cmake_cache_entry("TBB_DIR", spec['tbb'].prefix))
cfg.write("# vtk-m from spack\n") cfg.write("# vtk-m from spack\n")
cfg.write(cmake_cache_entry("VTKM_DIR", spec['vtkm'].prefix)) cfg.write(cmake_cache_entry("VTKM_DIR", spec['vtkm'].prefix))
cfg.write("# vtk-h from spack\n") cfg.write("# vtk-h from spack\n")
cfg.write(cmake_cache_entry("VTKH_DIR", spec['vtkh'].prefix)) cfg.write(cmake_cache_entry("VTKH_DIR", spec['vtkh'].prefix))
else: else:
cfg.write("# vtk-h not built by spack \n") cfg.write("# vtk-h not built by spack \n")
#######################
# MFEM
#######################
if "+mfem" in spec:
cfg.write("# mfem from spack \n")
cfg.write(cmake_cache_entry("MFEM_DIR", spec['mfem'].prefix))
else:
cfg.write("# mfem not built by spack \n")
####################### #######################
# Adios # Adios
####################### #######################

View File

@ -7,17 +7,24 @@
import socket import socket
import os import os
import glob
import shutil
import llnl.util.tty as tty import llnl.util.tty as tty
from os import environ as env from os import environ as env
def cmake_cache_entry(name, value): def cmake_cache_entry(name, value, vtype=None):
""" """
Helper that creates CMake cache entry strings used in Helper that creates CMake cache entry strings used in
'host-config' files. 'host-config' files.
""" """
return 'set({0} "{1}" CACHE PATH "")\n\n'.format(name, value) if vtype is None:
if value == "ON" or value == "OFF":
vtype = "BOOL"
else:
vtype = "PATH"
return 'set({0} "{1}" CACHE {2} "")\n\n'.format(name, value, vtype)
class Conduit(Package): class Conduit(Package):
@ -30,7 +37,7 @@ class Conduit(Package):
url = "https://github.com/LLNL/conduit/releases/download/v0.3.0/conduit-v0.3.0-src-with-blt.tar.gz" url = "https://github.com/LLNL/conduit/releases/download/v0.3.0/conduit-v0.3.0-src-with-blt.tar.gz"
git = "https://github.com/LLNL/conduit.git" git = "https://github.com/LLNL/conduit.git"
version('master', branch='master', submodules=True) version('master', branch='master', submodules=True, preferred=True)
version('0.3.1', 'b98d1476199a46bde197220cd9cde042') version('0.3.1', 'b98d1476199a46bde197220cd9cde042')
version('0.3.0', '6396f1d1ca16594d7c66d4535d4f898e') version('0.3.0', '6396f1d1ca16594d7c66d4535d4f898e')
# note: checksums on github automatic release source tars changed ~9/17 # note: checksums on github automatic release source tars changed ~9/17
@ -44,17 +51,17 @@ class Conduit(Package):
########################################################################### ###########################################################################
variant("shared", default=True, description="Build Conduit as shared libs") variant("shared", default=True, description="Build Conduit as shared libs")
variant('test', default=True, description='Enable Conduit unit tests')
variant("cmake", default=True,
description="Build CMake (if off, attempt to use cmake from PATH)")
# variants for python support # variants for python support
variant("python", default=True, description="Build Conduit Python support") variant("python", default=True, description="Build Conduit Python support")
variant("fortran", default=True, description="Build Conduit Fortran support")
# variants for comm and i/o # variants for comm and i/o
variant("mpi", default=True, description="Build Conduit MPI Support") variant("mpi", default=True, description="Build Conduit MPI Support")
variant("hdf5", default=True, description="Build Conduit HDF5 support") variant("hdf5", default=True, description="Build Conduit HDF5 support")
variant("silo", default=False, description="Build Conduit Silo support") variant("silo", default=False, description="Build Conduit Silo support")
variant("adios", default=False, description="Build Conduit ADIOS support")
# variants for dev-tools (docs, etc) # variants for dev-tools (docs, etc)
variant("doc", default=False, description="Build Conduit's documentation") variant("doc", default=False, description="Build Conduit's documentation")
@ -70,7 +77,7 @@ class Conduit(Package):
# CMake # CMake
####################### #######################
# cmake 3.8.2 or newer # cmake 3.8.2 or newer
depends_on("cmake@3.8.2:", when="+cmake") depends_on("cmake@3.8.2:", type='build')
####################### #######################
# Python # Python
@ -97,6 +104,11 @@ class Conduit(Package):
depends_on("silo~fortran", when="+silo+shared") depends_on("silo~fortran", when="+silo+shared")
depends_on("silo~shared~fortran", when="+silo~shared") depends_on("silo~shared~fortran", when="+silo~shared")
depends_on("adios+mpi~hdf5+shared", when="+adios+mpi+shared")
depends_on("adios+mpi~hdf5~shared~blosc", when="+adios+mpi~shared")
depends_on("adios~mpi~hdf5+shared", when="+adios~mpi+shared")
depends_on("adios~mpi~hdf5~shared~blosc", when="+adios~mpi~shared")
####################### #######################
# MPI # MPI
####################### #######################
@ -108,6 +120,9 @@ class Conduit(Package):
depends_on("py-sphinx", when="+python+doc", type='build') depends_on("py-sphinx", when="+python+doc", type='build')
depends_on("doxygen", when="+doc+doxygen") depends_on("doxygen", when="+doc+doxygen")
def setup_environment(self, spack_env, run_env):
spack_env.set('CTEST_OUTPUT_ON_FAILURE', '1')
def url_for_version(self, version): def url_for_version(self, version):
""" """
Provide proper url Provide proper url
@ -148,12 +163,57 @@ def install(self, spec, prefix):
if arg.count("RPATH") == 0: if arg.count("RPATH") == 0:
cmake_args.append(arg) cmake_args.append(arg)
cmake_args.extend(["-C", host_cfg_fname, "../src"]) cmake_args.extend(["-C", host_cfg_fname, "../src"])
print("Configuring Conduit...")
cmake(*cmake_args) cmake(*cmake_args)
print("Building Conduit...")
make() make()
# run unit tests if requested
if "+test" in spec and self.run_tests:
print("Running Conduit Unit Tests...")
make("test")
print("Installing Conduit...")
make("install") make("install")
# install copy of host config for provenance # install copy of host config for provenance
print("Installing Conduit CMake Host Config File...")
install(host_cfg_fname, prefix) install(host_cfg_fname, prefix)
@run_after('install')
@on_package_attributes(run_tests=True)
def check_install(self):
"""
Checks the spack install of conduit using conduit's
using-with-cmake example
"""
print("Checking Conduit installation...")
spec = self.spec
install_prefix = spec.prefix
example_src_dir = join_path(install_prefix,
"examples",
"conduit",
"using-with-cmake")
print("Checking using-with-cmake example...")
with working_dir("check-conduit-using-with-cmake-example",
create=True):
cmake_args = ["-DCONDUIT_DIR={0}".format(install_prefix),
example_src_dir]
cmake(*cmake_args)
make()
example = Executable('./example')
example()
print("Checking using-with-make example...")
example_src_dir = join_path(install_prefix,
"examples",
"conduit",
"using-with-make")
example_files = glob.glob(join_path(example_src_dir, "*"))
with working_dir("check-conduit-using-with-make-example",
create=True):
for example_file in example_files:
shutil.copy(example_file, ".")
make("CONDUIT_DIR={0}".format(install_prefix))
example = Executable('./example')
example()
def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
""" """
This method creates a 'host-config' file that specifies This method creates a 'host-config' file that specifies
@ -182,8 +242,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
if self.compiler.fc: if self.compiler.fc:
# even if this is set, it may not exist so do one more sanity check # even if this is set, it may not exist so do one more sanity check
if os.path.isfile(env["SPACK_FC"]): f_compiler = which(env["SPACK_FC"])
f_compiler = env["SPACK_FC"]
####################################################################### #######################################################################
# By directly fetching the names of the actual compilers we appear # By directly fetching the names of the actual compilers we appear
@ -200,15 +259,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
# Find and record what CMake is used # Find and record what CMake is used
############################################## ##############################################
if "+cmake" in spec: cmake_exe = spec['cmake'].command.path
cmake_exe = spec['cmake'].command.path
else:
cmake_exe = which("cmake")
if cmake_exe is None:
msg = 'failed to find CMake (and cmake variant is off)'
raise RuntimeError(msg)
cmake_exe = cmake_exe.path
host_cfg_fname = "%s-%s-%s-conduit.cmake" % (socket.gethostname(), host_cfg_fname = "%s-%s-%s-conduit.cmake" % (socket.gethostname(),
sys_type, sys_type,
spec.compiler) spec.compiler)
@ -237,20 +288,44 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler))
cfg.write("# fortran compiler used by spack\n") cfg.write("# fortran compiler used by spack\n")
if f_compiler is not None: if "+fortran" in spec and f_compiler is not None:
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON")) cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON"))
cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", f_compiler)) cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER",
f_compiler.path))
else: else:
cfg.write("# no fortran compiler found\n\n") cfg.write("# no fortran compiler found\n\n")
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF")) cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF"))
if "+shared" in spec:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON"))
else:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF"))
# extra fun for blueos
if 'blueos_3' in sys_type and "+fortran" in spec:
if 'xl@coral' in os.getenv('SPACK_COMPILER_SPEC', ""):
# Fix missing std linker flag in xlc compiler
cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS",
"-WF,-C! -qxlf2003=polymorphic"))
# Conduit can't link C++ into fortran for this spec, but works
# fine in host code
cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF"))
#######################
# Unit Tests
#######################
if "+test" in spec:
cfg.write(cmake_cache_entry("ENABLE_TESTS", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF"))
####################### #######################
# Python # Python
####################### #######################
cfg.write("# Python Support\n") cfg.write("# Python Support\n")
if "+python" in spec: if "+python" in spec and "+shared" in spec:
cfg.write("# Enable python module builds\n") cfg.write("# Enable python module builds\n")
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "ON")) cfg.write(cmake_cache_entry("ENABLE_PYTHON", "ON"))
cfg.write("# python from spack \n") cfg.write("# python from spack \n")
@ -264,12 +339,14 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF")) cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF"))
if "+doc" in spec: if "+doc" in spec:
cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON")) if "+python" in spec:
cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON"))
cfg.write("# sphinx from spack \n") cfg.write("# sphinx from spack \n")
sphinx_build_exe = join_path(spec['py-sphinx'].prefix.bin, sphinx_build_exe = join_path(spec['py-sphinx'].prefix.bin,
"sphinx-build") "sphinx-build")
cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", sphinx_build_exe)) cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE",
sphinx_build_exe))
if "+doxygen" in spec: if "+doxygen" in spec:
cfg.write("# doxygen from uberenv\n") cfg.write("# doxygen from uberenv\n")
doxygen_exe = spec['doxygen'].command.path doxygen_exe = spec['doxygen'].command.path
@ -317,6 +394,12 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
if "+hdf5" in spec: if "+hdf5" in spec:
cfg.write(cmake_cache_entry("HDF5_DIR", spec['hdf5'].prefix)) cfg.write(cmake_cache_entry("HDF5_DIR", spec['hdf5'].prefix))
# extra fun for BG/Q
if 'bgqos_0' in sys_type:
cfg.write(cmake_cache_entry('HDF5_C_LIBRARY_m',
'-lm', 'STRING'))
cfg.write(cmake_cache_entry('HDF5_C_LIBRARY_dl',
'-ldl', 'STRING'))
else: else:
cfg.write("# hdf5 not built by spack \n") cfg.write("# hdf5 not built by spack \n")
@ -331,6 +414,17 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
else: else:
cfg.write("# silo not built by spack \n") cfg.write("# silo not built by spack \n")
#######################
# ADIOS
#######################
cfg.write("# ADIOS from spack \n")
if "+adios" in spec:
cfg.write(cmake_cache_entry("ADIOS_DIR", spec['adios'].prefix))
else:
cfg.write("# adios not built by spack \n")
cfg.write("##################################\n") cfg.write("##################################\n")
cfg.write("# end spack generated host-config\n") cfg.write("# end spack generated host-config\n")
cfg.write("##################################\n") cfg.write("##################################\n")

View File

@ -178,7 +178,7 @@ class Mfem(Package):
depends_on('unwind', when='+libunwind') depends_on('unwind', when='+libunwind')
depends_on('zlib', when='+gzstream') depends_on('zlib', when='+gzstream')
depends_on('gnutls', when='+gnutls') depends_on('gnutls', when='+gnutls')
depends_on('conduit@0.3.1:', when='+conduit') depends_on('conduit@0.3.1:,master:', when='+conduit')
depends_on('conduit+mpi', when='+conduit+mpi') depends_on('conduit+mpi', when='+conduit+mpi')
patch('mfem_ppc_build.patch', when='@3.2:3.3.0 arch=ppc64le') patch('mfem_ppc_build.patch', when='@3.2:3.3.0 arch=ppc64le')

View File

@ -5,7 +5,27 @@
from spack import * from spack import *
import sys
import os import os
import socket
import llnl.util.tty as tty
from os import environ as env
def cmake_cache_entry(name, value, vtype=None):
"""
Helper that creates CMake cache entry strings used in
'host-config' files.
"""
if vtype is None:
if value == "ON" or value == "OFF":
vtype = "BOOL"
else:
vtype = "PATH"
return 'set({0} "{1}" CACHE {2} "")\n\n'.format(name, value, vtype)
class Vtkh(Package): class Vtkh(Package):
@ -15,24 +35,42 @@ class Vtkh(Package):
homepage = "https://github.com/Alpine-DAV/vtk-h" homepage = "https://github.com/Alpine-DAV/vtk-h"
git = "https://github.com/Alpine-DAV/vtk-h.git" git = "https://github.com/Alpine-DAV/vtk-h.git"
version('master', branch='master', submodules=True)
maintainers = ['cyrush'] maintainers = ['cyrush']
variant("mpi", default=True, description="build mpi support") version('develop', branch='develop', submodules=True)
variant("tbb", default=True, description="build tbb support") version('0.1.0', branch='develop', tag='v0.1.0', submodules=True)
variant("cuda", default=False, description="build cuda support")
depends_on("cmake") variant("shared", default=True, description="Build vtk-h as shared libs")
variant("mpi", default=True, description="build mpi support")
variant("tbb", default=False, description="build tbb support")
variant("cuda", default=False, description="build cuda support")
variant("openmp", default=(sys.platform != 'darwin'),
description="build openmp support")
depends_on("cmake@3.8.2:", type='build')
depends_on("mpi", when="+mpi") depends_on("mpi", when="+mpi")
depends_on("tbb", when="+tbb") depends_on("intel-tbb", when="@0.1.0+tbb")
depends_on("cuda", when="+cuda") depends_on("cuda", when="+cuda")
depends_on("vtkm@master") depends_on("vtkm@1.2.0", when="@0.1.0")
depends_on("vtkm@master+tbb", when="+tbb") depends_on("vtkm@1.2.0+tbb", when="@0.1.0+tbb")
depends_on("vtkm@master+cuda", when="+cuda") depends_on("vtkm@1.2.0+cuda", when="@0.1.0+cuda")
depends_on("vtkm@1.2.0~shared", when="@0.1.0~shared")
depends_on("vtkm@master~tbb+openmp", when="@develop+openmp")
depends_on("vtkm@master~tbb~openmp", when="@develop~openmp")
depends_on("vtkm@master+cuda~tbb+openmp", when="@develop+cuda+openmp")
depends_on("vtkm@master+cuda~tbb~openmp", when="@develop+cuda~openmp")
depends_on("vtkm@master~tbb+openmp~shared", when="@develop+openmp~shared")
depends_on("vtkm@master~tbb~openmp~shared", when="@develop~openmp~shared")
depends_on("vtkm@master+cuda~tbb+openmp~shared", when="@develop+cuda+openmp~shared")
depends_on("vtkm@master+cuda~tbb~openmp~shared", when="@develop+cuda~openmp~shared")
patch('vtkm_lagrange_cuda_fix.patch')
def install(self, spec, prefix): def install(self, spec, prefix):
with working_dir('spack-build', create=True): with working_dir('spack-build', create=True):
@ -40,6 +78,13 @@ def install(self, spec, prefix):
"-DVTKM_DIR={0}".format(spec["vtkm"].prefix), "-DVTKM_DIR={0}".format(spec["vtkm"].prefix),
"-DENABLE_TESTS=OFF", "-DENABLE_TESTS=OFF",
"-DBUILD_TESTING=OFF"] "-DBUILD_TESTING=OFF"]
# shared vs static libs
if "+shared" in spec:
cmake_args.append('-DBUILD_SHARED_LIBS=ON')
else:
cmake_args.append('-DBUILD_SHARED_LIBS=OFF')
# mpi support # mpi support
if "+mpi" in spec: if "+mpi" in spec:
mpicc = spec['mpi'].mpicc mpicc = spec['mpi'].mpicc
@ -53,6 +98,10 @@ def install(self, spec, prefix):
if "+tbb" in spec: if "+tbb" in spec:
cmake_args.append("-DTBB_DIR={0}".format(spec["tbb"].prefix)) cmake_args.append("-DTBB_DIR={0}".format(spec["tbb"].prefix))
# openmp support
if "+openmp" in spec:
cmake_args.append("-DENABLE_OPENMP=ON")
# cuda support # cuda support
if "+cuda" in spec: if "+cuda" in spec:
cmake_args.append("-DENABLE_CUDA=ON") cmake_args.append("-DENABLE_CUDA=ON")
@ -76,3 +125,132 @@ def install(self, spec, prefix):
else: else:
make() make()
make("install") make("install")
def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
"""
This method creates a 'host-config' file that specifies
all of the options used to configure and build vtkh.
"""
#######################
# Compiler Info
#######################
c_compiler = env["SPACK_CC"]
cpp_compiler = env["SPACK_CXX"]
#######################################################################
# By directly fetching the names of the actual compilers we appear
# to doing something evil here, but this is necessary to create a
# 'host config' file that works outside of the spack install env.
#######################################################################
sys_type = spec.architecture
# if on llnl systems, we can use the SYS_TYPE
if "SYS_TYPE" in env:
sys_type = env["SYS_TYPE"]
##############################################
# Find and record what CMake is used
##############################################
cmake_exe = spec['cmake'].command.path
host_cfg_fname = "%s-%s-%s-vtkh.cmake" % (socket.gethostname(),
sys_type,
spec.compiler)
cfg = open(host_cfg_fname, "w")
cfg.write("##################################\n")
cfg.write("# spack generated host-config\n")
cfg.write("##################################\n")
cfg.write("# {0}-{1}\n".format(sys_type, spec.compiler))
cfg.write("##################################\n\n")
# Include path to cmake for reference
cfg.write("# cmake from spack \n")
cfg.write("# cmake executable path: %s\n\n" % cmake_exe)
#######################
# Compiler Settings
#######################
cfg.write("#######\n")
cfg.write("# using %s compiler spec\n" % spec.compiler)
cfg.write("#######\n\n")
cfg.write("# c compiler used by spack\n")
cfg.write(cmake_cache_entry("CMAKE_C_COMPILER", c_compiler))
cfg.write("# cpp compiler used by spack\n")
cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler))
# shared vs static libs
if "+shared" in spec:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON"))
else:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF"))
#######################################################################
# Core Dependencies
#######################################################################
#######################
# VTK-h (and deps)
#######################
cfg.write("# vtk-m support \n")
if "+openmp" in spec:
cfg.write("# enable openmp support\n")
cfg.write(cmake_cache_entry("ENABLE_OPENMP", "ON"))
cfg.write("# vtk-m from spack\n")
cfg.write(cmake_cache_entry("VTKM_DIR", spec['vtkm'].prefix))
#######################################################################
# Optional Dependencies
#######################################################################
#######################
# MPI
#######################
cfg.write("# MPI Support\n")
if "+mpi" in spec:
cfg.write(cmake_cache_entry("ENABLE_MPI", "ON"))
cfg.write(cmake_cache_entry("MPI_C_COMPILER", spec['mpi'].mpicc))
cfg.write(cmake_cache_entry("MPI_CXX_COMPILER",
spec['mpi'].mpicxx))
cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER",
spec['mpi'].mpifc))
mpiexe_bin = join_path(spec['mpi'].prefix.bin, 'mpiexec')
if os.path.isfile(mpiexe_bin):
# starting with cmake 3.10, FindMPI expects MPIEXEC_EXECUTABLE
# vs the older versions which expect MPIEXEC
if self.spec["cmake"].satisfies('@3.10:'):
cfg.write(cmake_cache_entry("MPIEXEC_EXECUTABLE",
mpiexe_bin))
else:
cfg.write(cmake_cache_entry("MPIEXEC",
mpiexe_bin))
else:
cfg.write(cmake_cache_entry("ENABLE_MPI", "OFF"))
#######################
# CUDA
#######################
cfg.write("# CUDA Support\n")
if "+cuda" in spec:
cfg.write(cmake_cache_entry("ENABLE_CUDA", "ON"))
else:
cfg.write(cmake_cache_entry("ENABLE_CUDA", "OFF"))
cfg.write("##################################\n")
cfg.write("# end spack generated host-config\n")
cfg.write("##################################\n")
cfg.close()
host_cfg_fname = os.path.abspath(host_cfg_fname)
tty.info("spack generated conduit host-config file: " + host_cfg_fname)
return host_cfg_fname

View File

@ -0,0 +1,16 @@
diff --git a/src/vtkh/filters/CMakeLists.txt b/src/vtkh/filters/CMakeLists.txt
index 4a42d61..f586155 100644
--- a/src/vtkh/filters/CMakeLists.txt
+++ b/src/vtkh/filters/CMakeLists.txt
@@ -41,6 +41,11 @@ set(vtkh_filters_deps vtkh_core vtkh_utils )
if(CUDA_FOUND)
# triggers cuda compile
list(APPEND vtkh_filters_deps cuda)
+
+ if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10.0.0)
+ set(particle_cuda_src "${CMAKE_CURRENT_SOURCE_DIR}/Lagrangian.cpp")
+ set_source_files_properties(${particle_cuda_src} PROPERTIES COMPILE_FLAGS "-Xptxas --opt-level=0")
+ endif()
endif()

View File

@ -29,6 +29,7 @@ class Vtkm(CMakePackage, CudaPackage):
# can overwhelm compilers with too many symbols # can overwhelm compilers with too many symbols
variant('build_type', default='Release', description='CMake build type', variant('build_type', default='Release', description='CMake build type',
values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')) values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
variant("shared", default=True, description="build shared libs")
variant("cuda", default=False, description="build cuda support") variant("cuda", default=False, description="build cuda support")
variant("doubleprecision", default=True, variant("doubleprecision", default=True,
description='enable double precision') description='enable double precision')
@ -51,7 +52,11 @@ def cmake_args(self):
with working_dir('spack-build', create=True): with working_dir('spack-build', create=True):
options = ["../", options = ["../",
"-DVTKm_ENABLE_TESTING:BOOL=OFF"] "-DVTKm_ENABLE_TESTING:BOOL=OFF"]
# shared vs static libs
if "+shared" in spec:
options.append('-DBUILD_SHARED_LIBS=ON')
else:
options.append('-DBUILD_SHARED_LIBS=OFF')
# cuda support # cuda support
if "+cuda" in spec: if "+cuda" in spec:
options.append("-DVTKm_ENABLE_CUDA:BOOL=ON") options.append("-DVTKm_ENABLE_CUDA:BOOL=ON")