2022-01-13 03:21:41 +08:00
|
|
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2017-11-11 09:00:47 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
import glob
|
2021-07-09 06:12:30 +08:00
|
|
|
import os
|
2019-01-13 09:43:39 +08:00
|
|
|
import shutil
|
2021-07-09 06:12:30 +08:00
|
|
|
import socket
|
|
|
|
import sys
|
|
|
|
from os import environ as env
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
import llnl.util.tty as tty
|
2021-07-09 06:12:30 +08:00
|
|
|
|
|
|
|
from spack import *
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
def cmake_cache_entry(name, value, vtype=None):
|
2017-11-11 09:00:47 +08:00
|
|
|
"""
|
|
|
|
Helper that creates CMake cache entry strings used in
|
|
|
|
'host-config' files.
|
|
|
|
"""
|
2019-01-13 09:43:39 +08:00
|
|
|
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)
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
class Ascent(CMakePackage, CudaPackage):
|
2017-11-11 09:00:47 +08:00
|
|
|
"""Ascent is an open source many-core capable lightweight in situ
|
|
|
|
visualization and analysis infrastructure for multi-physics HPC
|
|
|
|
simulations."""
|
|
|
|
|
|
|
|
homepage = "https://github.com/Alpine-DAV/ascent"
|
2018-07-23 15:00:15 +08:00
|
|
|
git = "https://github.com/Alpine-DAV/ascent.git"
|
2020-07-18 21:53:48 +08:00
|
|
|
url = "https://github.com/Alpine-DAV/ascent/releases/download/v0.5.1/ascent-v0.5.1-src-with-blt.tar.gz"
|
2021-09-30 08:57:52 +08:00
|
|
|
tags = ['radiuss', 'e4s']
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
maintainers = ['cyrush']
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
version('develop',
|
|
|
|
branch='develop',
|
2021-02-11 02:14:16 +08:00
|
|
|
submodules=True)
|
2021-03-27 04:47:46 +08:00
|
|
|
|
2022-04-28 03:39:18 +08:00
|
|
|
version('0.8.0',
|
|
|
|
tag='v0.8.0',
|
2020-07-18 21:53:48 +08:00
|
|
|
submodules=True,
|
|
|
|
preferred=True)
|
2019-11-18 03:36:14 +08:00
|
|
|
|
2022-04-28 03:39:18 +08:00
|
|
|
version('0.7.1',
|
|
|
|
tag='v0.7.1',
|
|
|
|
submodules=True)
|
|
|
|
|
2021-05-21 05:15:10 +08:00
|
|
|
version('0.7.0',
|
|
|
|
tag='v0.7.0',
|
|
|
|
submodules=True)
|
|
|
|
|
2021-03-27 04:47:46 +08:00
|
|
|
version('0.6.0',
|
|
|
|
tag='v0.6.0',
|
|
|
|
submodules=True)
|
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
###########################################################################
|
|
|
|
# package variants
|
|
|
|
###########################################################################
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
variant("shared", default=True, description="Build Ascent as shared libs")
|
2020-07-18 21:53:48 +08:00
|
|
|
variant('test', default=True, description='Enable Ascent unit tests')
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
variant("mpi", default=True, description="Build Ascent MPI Support")
|
2019-11-18 03:36:14 +08:00
|
|
|
variant("serial", default=True, description="build serial (non-mpi) libraries")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
# variants for language support
|
2020-06-26 09:14:57 +08:00
|
|
|
variant("python", default=False, description="Build Ascent Python support")
|
2019-01-13 09:43:39 +08:00
|
|
|
variant("fortran", default=True, description="Build Ascent Fortran support")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
# variants for runtime features
|
|
|
|
variant("vtkh", default=True,
|
|
|
|
description="Build VTK-h filter and rendering support")
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
variant("openmp", default=(sys.platform != 'darwin'),
|
|
|
|
description="build openmp support")
|
|
|
|
variant("mfem", default=False, description="Build MFEM filter support")
|
2020-07-18 21:53:48 +08:00
|
|
|
variant("dray", default=False, description="Build with Devil Ray support")
|
2021-09-18 01:37:16 +08:00
|
|
|
variant("adios2", default=False, description="Build Adios2 filter support")
|
|
|
|
variant("fides", default=False, description="Build Fides filter support")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
# variants for dev-tools (docs, etc)
|
2020-07-18 21:53:48 +08:00
|
|
|
variant("doc", default=False, description="Build Ascent's documentation")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2020-07-18 21:53:48 +08:00
|
|
|
# variant for BabelFlow runtime
|
|
|
|
variant("babelflow", default=False, description="Build with BabelFlow")
|
|
|
|
|
2022-02-01 19:18:48 +08:00
|
|
|
##########################################################################
|
|
|
|
# patches
|
|
|
|
###########################################################################
|
|
|
|
# patch for gcc 10 and 11, changes already on develop, here
|
|
|
|
# so folks can build 0.7.1 with those compilers
|
|
|
|
patch("ascent-gcc-11-pr753.patch", when="@0.7.1")
|
|
|
|
|
2022-04-28 03:39:18 +08:00
|
|
|
# patch for allowing +shared+cuda
|
|
|
|
# https://github.com/Alpine-DAV/ascent/pull/903
|
|
|
|
patch('ascent-shared-cuda-pr903.patch', when='@0.8.0')
|
|
|
|
|
2020-07-18 21:53:48 +08:00
|
|
|
##########################################################################
|
2017-11-11 09:00:47 +08:00
|
|
|
# package dependencies
|
|
|
|
###########################################################################
|
2022-04-28 03:39:18 +08:00
|
|
|
def propagate_cuda_arch(package, spec=None):
|
|
|
|
if not spec:
|
|
|
|
spec = ''
|
|
|
|
for cuda_arch in CudaPackage.cuda_arch_values:
|
|
|
|
depends_on('{0} +cuda cuda_arch={1}'
|
|
|
|
.format(package, cuda_arch),
|
|
|
|
when='{0} +cuda cuda_arch={1}'
|
|
|
|
.format(spec, cuda_arch))
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2021-03-13 03:37:43 +08:00
|
|
|
# Certain CMake versions have been found to break for our use cases
|
2021-10-03 21:09:02 +08:00
|
|
|
depends_on("cmake@3.14.1:3.14,3.18.2:", type='build')
|
2022-04-28 03:39:18 +08:00
|
|
|
|
|
|
|
#######################
|
|
|
|
# Conduit
|
|
|
|
#######################
|
2021-12-24 21:46:56 +08:00
|
|
|
depends_on("conduit@:0.7.2", when="@:0.7.1")
|
2022-04-28 03:39:18 +08:00
|
|
|
depends_on("conduit@0.8.2:", when="@0.8:")
|
2021-08-22 00:01:27 +08:00
|
|
|
depends_on("conduit+python", when="+python")
|
2022-02-11 16:14:06 +08:00
|
|
|
depends_on("conduit~python", when="~python")
|
2021-08-22 00:01:27 +08:00
|
|
|
depends_on("conduit+mpi", when="+mpi")
|
|
|
|
depends_on("conduit~mpi", when="~mpi")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
#######################
|
|
|
|
# Python
|
|
|
|
#######################
|
|
|
|
# we need a shared version of python b/c linking with static python lib
|
|
|
|
# causes duplicate state issues when running compiled python modules.
|
2021-09-18 01:37:16 +08:00
|
|
|
with when('+python'):
|
|
|
|
depends_on("python+shared")
|
|
|
|
extends("python")
|
|
|
|
depends_on("py-numpy", type=('build', 'run'))
|
|
|
|
depends_on("py-pip", type=('build', 'run'))
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
#######################
|
|
|
|
# MPI
|
|
|
|
#######################
|
|
|
|
depends_on("mpi", when="+mpi")
|
2021-08-22 00:01:27 +08:00
|
|
|
depends_on("py-mpi4py", when="+mpi+python")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2020-07-18 21:53:48 +08:00
|
|
|
#######################
|
|
|
|
# BabelFlow
|
|
|
|
#######################
|
2021-03-27 04:47:46 +08:00
|
|
|
depends_on('babelflow', when='+babelflow+mpi')
|
|
|
|
depends_on('parallelmergetree', when='+babelflow+mpi')
|
2020-07-18 21:53:48 +08:00
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
#############################
|
|
|
|
# TPLs for Runtime Features
|
|
|
|
#############################
|
|
|
|
|
2022-02-11 16:14:06 +08:00
|
|
|
depends_on("vtk-h", when="+vtkh")
|
2022-04-28 03:39:18 +08:00
|
|
|
depends_on("vtk-h@:0.7", when="@:0.7 +vtkh")
|
|
|
|
depends_on("vtk-h@0.8.1:", when="@0.8: +vtkh")
|
2022-02-11 16:14:06 +08:00
|
|
|
# propagate relevent variants to vtk-h
|
|
|
|
depends_on("vtk-h+openmp", when="+vtkh+openmp")
|
|
|
|
depends_on("vtk-h~openmp", when="+vtkh~openmp")
|
|
|
|
depends_on("vtk-h+cuda", when="+vtkh+cuda")
|
|
|
|
depends_on("vtk-h~cuda", when="+vtkh~cuda")
|
2022-04-28 03:39:18 +08:00
|
|
|
propagate_cuda_arch('vtk-h', '+vtkh')
|
2022-02-11 16:14:06 +08:00
|
|
|
depends_on("vtk-h+shared", when="+vtkh+shared")
|
|
|
|
depends_on("vtk-h~shared", when="+vtkh~shared")
|
2022-04-28 03:39:18 +08:00
|
|
|
# When using VTK-h ascent also needs VTK-m
|
|
|
|
depends_on("vtk-m", when="+vtkh")
|
|
|
|
depends_on("vtk-m+testlib", when="+vtkh+test^vtk-m")
|
2019-01-13 09:43:39 +08:00
|
|
|
|
|
|
|
# mfem
|
2022-02-11 16:14:06 +08:00
|
|
|
depends_on("mfem~threadsafe~openmp+conduit", when="+mfem")
|
|
|
|
# propagate relevent variants to mfem
|
|
|
|
depends_on("mfem+mpi", when="+mfem+mpi")
|
|
|
|
depends_on("mfem~mpi", when="+mfem~mpi")
|
|
|
|
depends_on("mfem+shared", when="+mfem+shared")
|
|
|
|
depends_on("mfem~shared", when="+mfem~shared")
|
2019-01-13 09:43:39 +08:00
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
# fides
|
|
|
|
depends_on("fides", when="+fides")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2020-07-18 21:53:48 +08:00
|
|
|
# devil ray variants with mpi
|
|
|
|
# we have to specify both because mfem makes us
|
2022-02-11 16:14:06 +08:00
|
|
|
depends_on('dray~test~utils', when='+dray')
|
2022-04-28 03:39:18 +08:00
|
|
|
depends_on('dray@0.1.8:', when='@0.8: +dray')
|
2022-02-11 16:14:06 +08:00
|
|
|
# propagate relevent variants to dray
|
|
|
|
depends_on('dray+cuda', when='+dray+cuda')
|
|
|
|
depends_on('dray~cuda', when='+dray~cuda')
|
2022-04-28 03:39:18 +08:00
|
|
|
propagate_cuda_arch('dray', '+dray')
|
2022-02-11 16:14:06 +08:00
|
|
|
depends_on('dray+mpi', when='+dray+mpi')
|
|
|
|
depends_on('dray~mpi', when='+dray~mpi')
|
|
|
|
depends_on('dray+shared', when='+dray+shared')
|
|
|
|
depends_on('dray~shared', when='+dray~shared')
|
|
|
|
depends_on('dray+openmp', when='+dray+openmp')
|
|
|
|
depends_on('dray~openmp', when='+dray~openmp')
|
|
|
|
|
|
|
|
# Adios2
|
|
|
|
depends_on('adios2', when='+adios2')
|
|
|
|
# propagate relevent variants to adios2
|
|
|
|
depends_on('adios2+mpi', when='+adios2+mpi')
|
|
|
|
depends_on('adios2~mpi', when='+adios2~mpi')
|
|
|
|
depends_on('adios2+shared', when='+adios2+shared')
|
|
|
|
depends_on('adios2~shared', when='+adios2~shared')
|
2020-07-18 21:53:48 +08:00
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################
|
|
|
|
# Documentation related
|
|
|
|
#######################
|
|
|
|
depends_on("py-sphinx", when="+python+doc", type='build')
|
2019-11-18 03:36:14 +08:00
|
|
|
depends_on("py-sphinx-rtd-theme", when="+python+doc", type='build')
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2021-04-03 03:16:27 +08:00
|
|
|
###########
|
|
|
|
# Conflicts
|
|
|
|
###########
|
2022-04-28 03:39:18 +08:00
|
|
|
conflicts("+shared", when="@:0.7 +cuda",
|
2021-04-03 03:16:27 +08:00
|
|
|
msg="Ascent needs to be built with ~shared for CUDA builds.")
|
|
|
|
|
2019-10-29 06:32:16 +08:00
|
|
|
def setup_build_environment(self, env):
|
|
|
|
env.set('CTEST_OUTPUT_ON_FAILURE', '1')
|
2019-01-13 09:43:39 +08:00
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
####################################################################
|
|
|
|
# Note: cmake, build, and install stages are handled by CMakePackage
|
|
|
|
####################################################################
|
|
|
|
|
|
|
|
# provide cmake args (pass host config as cmake cache file)
|
|
|
|
def cmake_args(self):
|
|
|
|
host_config = self._get_host_config_path(self.spec)
|
|
|
|
options = []
|
|
|
|
options.extend(['-C', host_config, "../spack-src/src/"])
|
|
|
|
return options
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
@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),
|
2019-10-29 09:27:54 +08:00
|
|
|
"-DVTKM_DIR={0}".format(spec['vtk-m'].prefix),
|
|
|
|
"-DVTKH_DIR={0}".format(spec['vtk-h'].prefix),
|
2019-01-13 09:43:39 +08:00
|
|
|
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()
|
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
def _get_host_config_path(self, spec):
|
|
|
|
sys_type = spec.architecture
|
|
|
|
# if on llnl systems, we can use the SYS_TYPE
|
|
|
|
if "SYS_TYPE" in env:
|
|
|
|
sys_type = env["SYS_TYPE"]
|
|
|
|
host_config_path = "{0}-{1}-{2}-ascent-{3}.cmake".format(socket.gethostname(),
|
|
|
|
sys_type,
|
|
|
|
spec.compiler,
|
|
|
|
spec.dag_hash())
|
|
|
|
dest_dir = spec.prefix
|
|
|
|
host_config_path = os.path.abspath(join_path(dest_dir,
|
|
|
|
host_config_path))
|
|
|
|
return host_config_path
|
|
|
|
|
2022-04-11 17:39:50 +08:00
|
|
|
@run_before('cmake')
|
|
|
|
def hostconfig(self):
|
2017-11-11 09:00:47 +08:00
|
|
|
"""
|
|
|
|
This method creates a 'host-config' file that specifies
|
|
|
|
all of the options used to configure and build ascent.
|
2017-12-09 05:43:12 +08:00
|
|
|
|
|
|
|
For more details about 'host-config' files see:
|
2021-09-14 00:21:35 +08:00
|
|
|
https://ascent.readthedocs.io/en/latest/BuildingAscent.html
|
2017-12-09 05:43:12 +08:00
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
"""
|
2022-04-11 17:39:50 +08:00
|
|
|
spec = self.spec
|
2021-09-18 01:37:16 +08:00
|
|
|
if not os.path.isdir(spec.prefix):
|
|
|
|
os.mkdir(spec.prefix)
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
#######################
|
|
|
|
# Compiler Info
|
|
|
|
#######################
|
|
|
|
c_compiler = env["SPACK_CC"]
|
|
|
|
cpp_compiler = env["SPACK_CXX"]
|
2022-05-11 01:19:03 +08:00
|
|
|
if "+fortran" in spec:
|
|
|
|
f_compiler = env["SPACK_FC"]
|
|
|
|
else:
|
|
|
|
f_compiler = None
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
#######################################################################
|
2021-09-18 01:37:16 +08:00
|
|
|
# Directly fetch the names of the actual compilers to create a
|
2017-11-11 09:00:47 +08:00
|
|
|
# '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
|
|
|
|
##############################################
|
|
|
|
|
|
|
|
if "+cmake" in spec:
|
|
|
|
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
|
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
# get hostconfig name
|
|
|
|
host_cfg_fname = self._get_host_config_path(spec)
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
cfg.write("# fortran compiler used by spack\n")
|
2022-02-01 22:44:48 +08:00
|
|
|
if "+fortran" in spec:
|
2017-11-11 09:00:47 +08:00
|
|
|
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON"))
|
2022-04-28 22:09:40 +08:00
|
|
|
cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER",
|
|
|
|
f_compiler))
|
2017-11-11 09:00:47 +08:00
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF"))
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
# 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"))
|
|
|
|
|
2021-05-25 07:50:38 +08:00
|
|
|
# use global spack compiler flags
|
|
|
|
cppflags = ' '.join(spec.compiler_flags['cppflags'])
|
|
|
|
if cppflags:
|
|
|
|
# avoid always ending up with ' ' with no flags defined
|
|
|
|
cppflags += ' '
|
|
|
|
cflags = cppflags + ' '.join(spec.compiler_flags['cflags'])
|
|
|
|
if cflags:
|
|
|
|
cfg.write(cmake_cache_entry("CMAKE_C_FLAGS", cflags))
|
|
|
|
cxxflags = cppflags + ' '.join(spec.compiler_flags['cxxflags'])
|
|
|
|
if cxxflags:
|
|
|
|
cfg.write(cmake_cache_entry("CMAKE_CXX_FLAGS", cxxflags))
|
|
|
|
fflags = ' '.join(spec.compiler_flags['fflags'])
|
|
|
|
if self.spec.satisfies('%cce'):
|
|
|
|
fflags += " -ef"
|
|
|
|
if fflags:
|
|
|
|
cfg.write(cmake_cache_entry("CMAKE_Fortran_FLAGS", fflags))
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
#######################
|
|
|
|
# Unit Tests
|
|
|
|
#######################
|
|
|
|
if "+test" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_TESTS", "ON"))
|
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF"))
|
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################################################################
|
|
|
|
# Core Dependencies
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
#######################
|
|
|
|
# Conduit
|
|
|
|
#######################
|
|
|
|
|
|
|
|
cfg.write("# conduit from spack \n")
|
|
|
|
cfg.write(cmake_cache_entry("CONDUIT_DIR", spec['conduit'].prefix))
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Optional Dependencies
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
#######################
|
|
|
|
# Python
|
|
|
|
#######################
|
|
|
|
|
|
|
|
cfg.write("# Python Support\n")
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
if "+python" in spec and "+shared" in spec:
|
2017-11-11 09:00:47 +08:00
|
|
|
cfg.write("# Enable python module builds\n")
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "ON"))
|
|
|
|
cfg.write("# python from spack \n")
|
|
|
|
cfg.write(cmake_cache_entry("PYTHON_EXECUTABLE",
|
|
|
|
spec['python'].command.path))
|
2021-09-18 01:37:16 +08:00
|
|
|
try:
|
|
|
|
cfg.write("# python module install dir\n")
|
2017-12-09 05:43:12 +08:00
|
|
|
cfg.write(cmake_cache_entry("PYTHON_MODULE_INSTALL_PREFIX",
|
2022-01-14 10:11:16 +08:00
|
|
|
python_platlib))
|
2021-09-18 01:37:16 +08:00
|
|
|
except NameError:
|
|
|
|
# spack's won't exist in a subclass
|
|
|
|
pass
|
2017-11-11 09:00:47 +08:00
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF"))
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
if "+doc" in spec and "+python" in spec:
|
2017-11-11 09:00:47 +08:00
|
|
|
cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON"))
|
|
|
|
|
|
|
|
cfg.write("# sphinx from spack \n")
|
|
|
|
sphinx_build_exe = join_path(spec['py-sphinx'].prefix.bin,
|
|
|
|
"sphinx-build")
|
|
|
|
cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", sphinx_build_exe))
|
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_DOCS", "OFF"))
|
|
|
|
|
2019-11-18 03:36:14 +08:00
|
|
|
#######################
|
|
|
|
# Serial
|
|
|
|
#######################
|
|
|
|
|
|
|
|
if "+serial" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_SERIAL", "ON"))
|
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_SERIAL", "OFF"))
|
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################
|
|
|
|
# MPI
|
|
|
|
#######################
|
|
|
|
|
|
|
|
cfg.write("# MPI Support\n")
|
|
|
|
|
|
|
|
if "+mpi" in spec:
|
2019-10-29 06:32:16 +08:00
|
|
|
mpicc_path = spec['mpi'].mpicc
|
|
|
|
mpicxx_path = spec['mpi'].mpicxx
|
|
|
|
mpifc_path = spec['mpi'].mpifc
|
|
|
|
# if we are using compiler wrappers on cray systems
|
|
|
|
# use those for mpi wrappers, b/c spec['mpi'].mpicxx
|
|
|
|
# etc make return the spack compiler wrappers
|
|
|
|
# which can trip up mpi detection in CMake 3.14
|
|
|
|
if cpp_compiler == "CC":
|
|
|
|
mpicc_path = "cc"
|
|
|
|
mpicxx_path = "CC"
|
|
|
|
mpifc_path = "ftn"
|
2017-11-11 09:00:47 +08:00
|
|
|
cfg.write(cmake_cache_entry("ENABLE_MPI", "ON"))
|
2019-10-29 06:32:16 +08:00
|
|
|
cfg.write(cmake_cache_entry("MPI_C_COMPILER", mpicc_path))
|
|
|
|
cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", mpicxx_path))
|
|
|
|
cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", mpifc_path))
|
2017-12-09 05:43:12 +08:00
|
|
|
mpiexe_bin = join_path(spec['mpi'].prefix.bin, 'mpiexec')
|
|
|
|
if os.path.isfile(mpiexe_bin):
|
2018-02-13 02:20:46 +08:00
|
|
|
# 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))
|
2020-07-18 21:53:48 +08:00
|
|
|
|
|
|
|
###################################
|
|
|
|
# BABELFLOW (also depends on mpi)
|
|
|
|
###################################
|
|
|
|
if "+babelflow" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_BABELFLOW", "ON"))
|
|
|
|
cfg.write(cmake_cache_entry("BabelFlow_DIR",
|
|
|
|
spec['babelflow'].prefix))
|
|
|
|
cfg.write(cmake_cache_entry("PMT_DIR",
|
|
|
|
spec['parallelmergetree'].prefix))
|
2017-11-11 09:00:47 +08:00
|
|
|
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"))
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
if "+openmp" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_OPENMP", "ON"))
|
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("ENABLE_OPENMP", "OFF"))
|
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################
|
2019-01-13 09:43:39 +08:00
|
|
|
# VTK-h (and deps)
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################
|
|
|
|
|
|
|
|
cfg.write("# vtk-h support \n")
|
|
|
|
|
|
|
|
if "+vtkh" in spec:
|
|
|
|
cfg.write("# vtk-m from spack\n")
|
2019-10-29 09:27:54 +08:00
|
|
|
cfg.write(cmake_cache_entry("VTKM_DIR", spec['vtk-m'].prefix))
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
cfg.write("# vtk-h from spack\n")
|
2019-10-29 09:27:54 +08:00
|
|
|
cfg.write(cmake_cache_entry("VTKH_DIR", spec['vtk-h'].prefix))
|
2019-01-13 09:43:39 +08:00
|
|
|
|
2019-11-18 03:36:14 +08:00
|
|
|
if "+cuda" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("VTKm_ENABLE_CUDA", "ON"))
|
|
|
|
cfg.write(cmake_cache_entry("CMAKE_CUDA_HOST_COMPILER",
|
|
|
|
env["SPACK_CXX"]))
|
|
|
|
else:
|
|
|
|
cfg.write(cmake_cache_entry("VTKm_ENABLE_CUDA", "OFF"))
|
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
else:
|
|
|
|
cfg.write("# vtk-h not built by spack \n")
|
|
|
|
|
2019-01-13 09:43:39 +08:00
|
|
|
#######################
|
|
|
|
# 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")
|
|
|
|
|
2020-07-18 21:53:48 +08:00
|
|
|
#######################
|
|
|
|
# Devil Ray
|
|
|
|
#######################
|
|
|
|
if "+dray" in spec:
|
|
|
|
cfg.write("# devil ray from spack \n")
|
|
|
|
cfg.write(cmake_cache_entry("DRAY_DIR", spec['dray'].prefix))
|
|
|
|
else:
|
|
|
|
cfg.write("# devil ray not built by spack \n")
|
|
|
|
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################
|
2021-09-18 01:37:16 +08:00
|
|
|
# Adios2
|
2017-11-11 09:00:47 +08:00
|
|
|
#######################
|
2021-09-18 01:37:16 +08:00
|
|
|
cfg.write("# adios2 support\n")
|
|
|
|
|
|
|
|
if "+adios2" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("ADIOS2_DIR", spec['adios2'].prefix))
|
|
|
|
else:
|
|
|
|
cfg.write("# adios2 not built by spack \n")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
#######################
|
|
|
|
# Fides
|
|
|
|
#######################
|
|
|
|
cfg.write("# Fides support\n")
|
2017-11-11 09:00:47 +08:00
|
|
|
|
2021-09-18 01:37:16 +08:00
|
|
|
if "+fides" in spec:
|
|
|
|
cfg.write(cmake_cache_entry("FIDES_DIR", spec['fides'].prefix))
|
2017-11-11 09:00:47 +08:00
|
|
|
else:
|
2021-09-18 01:37:16 +08:00
|
|
|
cfg.write("# fides not built by spack \n")
|
|
|
|
|
|
|
|
#######################
|
|
|
|
# Finish host-config
|
|
|
|
#######################
|
2017-11-11 09:00:47 +08:00
|
|
|
|
|
|
|
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)
|
2021-09-18 01:37:16 +08:00
|
|
|
tty.info("spack generated ascent host-config file: " + host_cfg_fname)
|