diff options
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/ascent/package.py | 168 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/conduit/package.py | 146 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/mfem/package.py | 2 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/vtkh/package.py | 196 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/vtkh/vtkm_lagrange_cuda_fix.patch | 16 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/vtkm/package.py | 7 |
6 files changed, 465 insertions, 70 deletions
diff --git a/var/spack/repos/builtin/packages/ascent/package.py b/var/spack/repos/builtin/packages/ascent/package.py index 1c3ada5c5e..60b02849ed 100644 --- a/var/spack/repos/builtin/packages/ascent/package.py +++ b/var/spack/repos/builtin/packages/ascent/package.py @@ -5,19 +5,27 @@ from spack import * -import socket +import sys import os +import socket +import glob +import shutil import llnl.util.tty as tty 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 '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): @@ -30,30 +38,31 @@ class Ascent(Package): maintainers = ['cyrush'] - version('develop', branch='develop', submodules=True) + version('develop', + branch='develop', + submodules=True) ########################################################################### # package variants ########################################################################### - variant("shared", default=True, description="Build Conduit as shared libs") - - variant("cmake", default=True, - description="Build CMake (if off, attempt to use cmake from PATH)") + variant("shared", default=True, description="Build Ascent as shared libs") + variant('test', default=True, description='Enable Ascent unit tests') variant("mpi", default=True, description="Build Ascent MPI Support") - # variants for python support - variant("python", default=True, description="Build Conduit Python support") + # variants for language support + variant("python", default=True, description="Build Ascent Python support") + variant("fortran", default=True, description="Build Ascent Fortran support") # variants for runtime features - variant("vtkh", default=True, 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("mfem", default=False, description="Build MFEM filter support") variant("adios", default=False, description="Build Adios filter support") # variants for dev-tools (docs, etc) @@ -63,30 +72,48 @@ class Ascent(Package): # package dependencies ########################################################################### - depends_on("cmake", when="+cmake") - depends_on("conduit@master") + depends_on("cmake@3.9.2:3.9.999", type='build') + depends_on("conduit~python", when="~python") + depends_on("conduit+python", when="+python+shared") + depends_on("conduit~shared~python", when="~shared") ####################### # Python ####################### # we need a shared version of python b/c linking with static python lib # causes duplicate state issues when running compiled python modules. - depends_on("python+shared") - extends("python", when="+python") - depends_on("py-numpy", when="+python", type=('build', 'run')) + depends_on("python+shared", when="+python+shared") + extends("python", when="+python+shared") + depends_on("py-numpy", when="+python+shared", type=('build', 'run')) ####################### # 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 ############################# - depends_on("vtkh", when="+vtkh") - depends_on("vtkh+cuda", when="+vtkh+cuda") + depends_on("vtkh@develop", when="+vtkh") + 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") ####################### @@ -94,9 +121,12 @@ class Ascent(Package): ####################### 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): """ - Build and install Conduit. + Build and install Ascent. """ with working_dir('spack-build', create=True): py_site_pkgs_dir = None @@ -117,12 +147,59 @@ class Ascent(Package): if arg.count("RPATH") == 0: cmake_args.append(arg) cmake_args.extend(["-C", host_cfg_fname, "../src"]) + print("Configuring Ascent...") cmake(*cmake_args) + print("Building Ascent...") 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") # install copy of host config for provenance 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): """ This method creates a 'host-config' file that specifies @@ -151,8 +228,7 @@ class Ascent(Package): if self.compiler.fc: # even if this is set, it may not exist so do one more sanity check - if os.path.isfile(env["SPACK_FC"]): - f_compiler = env["SPACK_FC"] + f_compiler = which(env["SPACK_FC"]) ####################################################################### # By directly fetching the names of the actual compilers we appear @@ -196,7 +272,6 @@ class Ascent(Package): ####################### # Compiler Settings ####################### - cfg.write("#######\n") cfg.write("# using %s compiler spec\n" % spec.compiler) cfg.write("#######\n\n") @@ -206,13 +281,28 @@ class Ascent(Package): cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) 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("CMAKE_Fortran_COMPILER", f_compiler)) + cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", + f_compiler.path)) else: cfg.write("# no fortran compiler found\n\n") 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 ####################################################################### @@ -234,7 +324,7 @@ class Ascent(Package): 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(cmake_cache_entry("ENABLE_PYTHON", "ON")) cfg.write("# python from spack \n") @@ -247,7 +337,7 @@ class Ascent(Package): else: 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("# sphinx from spack \n") @@ -294,25 +384,37 @@ class Ascent(Package): else: 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") 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(cmake_cache_entry("VTKM_DIR", spec['vtkm'].prefix)) cfg.write("# vtk-h from spack\n") cfg.write(cmake_cache_entry("VTKH_DIR", spec['vtkh'].prefix)) + else: 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 ####################### diff --git a/var/spack/repos/builtin/packages/conduit/package.py b/var/spack/repos/builtin/packages/conduit/package.py index 5674a83b48..dd730d4f3d 100644 --- a/var/spack/repos/builtin/packages/conduit/package.py +++ b/var/spack/repos/builtin/packages/conduit/package.py @@ -7,17 +7,24 @@ from spack import * import socket import os +import glob +import shutil import llnl.util.tty as tty 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 '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): @@ -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" 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.0', '6396f1d1ca16594d7c66d4535d4f898e') # 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("cmake", default=True, - description="Build CMake (if off, attempt to use cmake from PATH)") + variant('test', default=True, description='Enable Conduit unit tests') # variants for 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 variant("mpi", default=True, description="Build Conduit MPI Support") variant("hdf5", default=True, description="Build Conduit HDF5 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) variant("doc", default=False, description="Build Conduit's documentation") @@ -70,7 +77,7 @@ class Conduit(Package): # CMake ####################### # cmake 3.8.2 or newer - depends_on("cmake@3.8.2:", when="+cmake") + depends_on("cmake@3.8.2:", type='build') ####################### # Python @@ -97,6 +104,11 @@ class Conduit(Package): depends_on("silo~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 ####################### @@ -108,6 +120,9 @@ class Conduit(Package): depends_on("py-sphinx", when="+python+doc", type='build') 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): """ Provide proper url @@ -148,12 +163,57 @@ class Conduit(Package): if arg.count("RPATH") == 0: cmake_args.append(arg) cmake_args.extend(["-C", host_cfg_fname, "../src"]) + print("Configuring Conduit...") cmake(*cmake_args) + print("Building Conduit...") 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") # install copy of host config for provenance + print("Installing Conduit CMake Host Config File...") 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): """ This method creates a 'host-config' file that specifies @@ -182,8 +242,7 @@ class Conduit(Package): if self.compiler.fc: # even if this is set, it may not exist so do one more sanity check - if os.path.isfile(env["SPACK_FC"]): - f_compiler = env["SPACK_FC"] + f_compiler = which(env["SPACK_FC"]) ####################################################################### # By directly fetching the names of the actual compilers we appear @@ -200,15 +259,7 @@ class Conduit(Package): # 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 - + cmake_exe = spec['cmake'].command.path host_cfg_fname = "%s-%s-%s-conduit.cmake" % (socket.gethostname(), sys_type, spec.compiler) @@ -237,20 +288,44 @@ class Conduit(Package): cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) 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("CMAKE_Fortran_COMPILER", f_compiler)) + cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", + f_compiler.path)) else: cfg.write("# no fortran compiler found\n\n") 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 ####################### 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(cmake_cache_entry("ENABLE_PYTHON", "ON")) cfg.write("# python from spack \n") @@ -264,12 +339,14 @@ class Conduit(Package): cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF")) 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") - sphinx_build_exe = join_path(spec['py-sphinx'].prefix.bin, - "sphinx-build") - cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", sphinx_build_exe)) + 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)) if "+doxygen" in spec: cfg.write("# doxygen from uberenv\n") doxygen_exe = spec['doxygen'].command.path @@ -317,6 +394,12 @@ class Conduit(Package): if "+hdf5" in spec: 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: cfg.write("# hdf5 not built by spack \n") @@ -331,6 +414,17 @@ class Conduit(Package): else: 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("# end spack generated host-config\n") cfg.write("##################################\n") diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py index 6a9fac9b22..f471b37de0 100644 --- a/var/spack/repos/builtin/packages/mfem/package.py +++ b/var/spack/repos/builtin/packages/mfem/package.py @@ -178,7 +178,7 @@ class Mfem(Package): depends_on('unwind', when='+libunwind') depends_on('zlib', when='+gzstream') 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') patch('mfem_ppc_build.patch', when='@3.2:3.3.0 arch=ppc64le') diff --git a/var/spack/repos/builtin/packages/vtkh/package.py b/var/spack/repos/builtin/packages/vtkh/package.py index bd91b06e31..3d60ee9a50 100644 --- a/var/spack/repos/builtin/packages/vtkh/package.py +++ b/var/spack/repos/builtin/packages/vtkh/package.py @@ -5,7 +5,27 @@ from spack import * + +import sys 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): @@ -15,24 +35,42 @@ class Vtkh(Package): homepage = "https://github.com/Alpine-DAV/vtk-h" git = "https://github.com/Alpine-DAV/vtk-h.git" - - version('master', branch='master', submodules=True) - maintainers = ['cyrush'] + version('develop', branch='develop', submodules=True) + version('0.1.0', branch='develop', tag='v0.1.0', submodules=True) + + variant("shared", default=True, description="Build vtk-h as shared libs") variant("mpi", default=True, description="build mpi support") - variant("tbb", default=True, description="build tbb 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") + depends_on("cmake@3.8.2:", type='build') 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("vtkm@master") - depends_on("vtkm@master+tbb", when="+tbb") - depends_on("vtkm@master+cuda", when="+cuda") + depends_on("vtkm@1.2.0", when="@0.1.0") + depends_on("vtkm@1.2.0+tbb", when="@0.1.0+tbb") + 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): with working_dir('spack-build', create=True): @@ -40,6 +78,13 @@ class Vtkh(Package): "-DVTKM_DIR={0}".format(spec["vtkm"].prefix), "-DENABLE_TESTS=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 if "+mpi" in spec: mpicc = spec['mpi'].mpicc @@ -53,6 +98,10 @@ class Vtkh(Package): if "+tbb" in spec: cmake_args.append("-DTBB_DIR={0}".format(spec["tbb"].prefix)) + # openmp support + if "+openmp" in spec: + cmake_args.append("-DENABLE_OPENMP=ON") + # cuda support if "+cuda" in spec: cmake_args.append("-DENABLE_CUDA=ON") @@ -76,3 +125,132 @@ class Vtkh(Package): else: make() 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 diff --git a/var/spack/repos/builtin/packages/vtkh/vtkm_lagrange_cuda_fix.patch b/var/spack/repos/builtin/packages/vtkh/vtkm_lagrange_cuda_fix.patch new file mode 100644 index 0000000000..2f90477e76 --- /dev/null +++ b/var/spack/repos/builtin/packages/vtkh/vtkm_lagrange_cuda_fix.patch @@ -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() + + diff --git a/var/spack/repos/builtin/packages/vtkm/package.py b/var/spack/repos/builtin/packages/vtkm/package.py index 2a59095dd9..eb23aa3a33 100644 --- a/var/spack/repos/builtin/packages/vtkm/package.py +++ b/var/spack/repos/builtin/packages/vtkm/package.py @@ -29,6 +29,7 @@ class Vtkm(CMakePackage, CudaPackage): # can overwhelm compilers with too many symbols variant('build_type', default='Release', description='CMake build type', values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')) + variant("shared", default=True, description="build shared libs") variant("cuda", default=False, description="build cuda support") variant("doubleprecision", default=True, description='enable double precision') @@ -51,7 +52,11 @@ class Vtkm(CMakePackage, CudaPackage): with working_dir('spack-build', create=True): options = ["../", "-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 if "+cuda" in spec: options.append("-DVTKm_ENABLE_CUDA:BOOL=ON") |