nalu-wind: updates (#44046)
This commit is contained in:
		| @@ -3,8 +3,6 @@ | ||||
| # | ||||
| # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||
| 
 | ||||
| import sys | ||||
| 
 | ||||
| from spack.package import * | ||||
| 
 | ||||
| 
 | ||||
| @@ -53,31 +51,17 @@ class NaluWind(CMakePackage, CudaPackage, ROCmPackage): | ||||
|     variant("gpu-aware-mpi", default=False, description="gpu-aware-mpi") | ||||
|     variant("wind-utils", default=False, description="Build wind-utils") | ||||
|     variant("umpire", default=False, description="Enable Umpire") | ||||
|     conflicts( | ||||
|         "+shared", | ||||
|         when="+cuda", | ||||
|         msg="invalid device functions are generated with shared libs and cuda", | ||||
|     ) | ||||
|     conflicts( | ||||
|         "+shared", | ||||
|         when="+rocm", | ||||
|         msg="invalid device functions are generated with shared libs and rocm", | ||||
|     ) | ||||
|     conflicts("+cuda", when="+rocm") | ||||
|     conflicts("+rocm", when="+cuda") | ||||
| 
 | ||||
|     depends_on("mpi") | ||||
|     depends_on("yaml-cpp@0.5.3:") | ||||
|     depends_on("openfast@4.0.0:+cxx+netcdf", when="+fsi") | ||||
|     depends_on("trilinos@13.4.1+exodus+zoltan+stk", when="@=2.0.0") | ||||
|     depends_on("trilinos@13.4.1", when="@=2.0.0") | ||||
|     depends_on("hypre@2.29.0:", when="@2.0.0:+hypre") | ||||
|     depends_on( | ||||
|         "trilinos@13:+exodus+tpetra+zoltan+stk~superlu-dist~superlu+hdf5+shards~hypre+gtest" | ||||
|         "trilinos@13:+exodus+tpetra+zoltan+stk~superlu-dist~superlu+hdf5+shards~hypre+gtest " | ||||
|         "gotype=long cxxstd=17" | ||||
|     ) | ||||
|     depends_on("trilinos~cuda~wrapper", when="~cuda") | ||||
|     # Cannot build Trilinos as a shared library with STK on Darwin | ||||
|     # https://github.com/trilinos/Trilinos/issues/2994 | ||||
|     depends_on("trilinos~shared", when=(sys.platform == "darwin")) | ||||
|     depends_on("openfast@2.6.0: +cxx", when="+openfast") | ||||
|     depends_on("tioga@master:", when="+tioga") | ||||
|     depends_on("hypre@2.18.2: ~int64+mpi~superlu-dist", when="+hypre") | ||||
| @@ -98,9 +82,7 @@ class NaluWind(CMakePackage, CudaPackage, ROCmPackage): | ||||
|         ) | ||||
|     for _arch in ROCmPackage.amdgpu_targets: | ||||
|         depends_on( | ||||
|             "trilinos@13.4.0.2022.10.27: " | ||||
|             "~shared+exodus+tpetra+zoltan+stk~superlu-dist~superlu" | ||||
|             "+hdf5+shards~hypre+gtest+rocm amdgpu_target={0}".format(_arch), | ||||
|             "trilinos@13.4: ~shared+rocm amdgpu_target={0}".format(_arch), | ||||
|             when="+rocm amdgpu_target={0}".format(_arch), | ||||
|         ) | ||||
|         depends_on( | ||||
| @@ -114,23 +96,38 @@ class NaluWind(CMakePackage, CudaPackage, ROCmPackage): | ||||
|     # indirect dependency needed to make original concretizer work | ||||
|     depends_on("netcdf-c+parallel-netcdf") | ||||
|     depends_on("boost +filesystem +iostreams cxxstd=14", when="+boost") | ||||
|     supported_cxxstd = ["17"] | ||||
|     variant( | ||||
|         "cxxstd", default="17", values=supported_cxxstd, multi=False, description="cxx standard" | ||||
|     depends_on("hypre+gpu-aware-mpi", when="+gpu-aware-mpi") | ||||
|     depends_on("hypre+umpire", when="+umpire") | ||||
|     depends_on("trilinos~shared", when="+trilinos-solvers platform=darwin") | ||||
| 
 | ||||
|     conflicts( | ||||
|         "+shared", | ||||
|         when="+cuda", | ||||
|         msg="invalid device functions are generated with shared libs and cuda", | ||||
|     ) | ||||
|     for std in supported_cxxstd: | ||||
|         depends_on("trilinos cxxstd=%s" % std, when="cxxstd=%s" % std) | ||||
|     conflicts( | ||||
|         "+shared", | ||||
|         when="+rocm", | ||||
|         msg="invalid device functions are generated with shared libs and rocm", | ||||
|     ) | ||||
|     conflicts("+cuda", when="+rocm") | ||||
|     conflicts("+rocm", when="+cuda") | ||||
|     conflicts("^hypre+cuda", when="~cuda") | ||||
|     conflicts("^hypre+rocm", when="~rocm") | ||||
|     conflicts("^hypre+sycl") | ||||
|     conflicts("^trilinos+cuda", when="~cuda") | ||||
|     conflicts("^trilinos+rocm", when="~rocm") | ||||
| 
 | ||||
|     def setup_build_environment(self, env): | ||||
|         if "~stk_simd" in self.spec: | ||||
|             env.append_flags("CXXFLAGS", "-DUSE_STK_SIMD_NONE") | ||||
|         if "+cuda" in self.spec: | ||||
|         spec = self.spec | ||||
|         env.append_flags("CXXFLAGS", "-DUSE_STK_SIMD_NONE") | ||||
|         if spec.satisfies("+cuda"): | ||||
|             env.set("CUDA_LAUNCH_BLOCKING", "1") | ||||
|             env.set("CUDA_MANAGED_FORCE_DEVICE_ALLOC", "1") | ||||
|             env.set("OMPI_CXX", self.spec["kokkos-nvcc-wrapper"].kokkos_cxx) | ||||
|             env.set("MPICH_CXX", self.spec["kokkos-nvcc-wrapper"].kokkos_cxx) | ||||
|             env.set("MPICXX_CXX", self.spec["kokkos-nvcc-wrapper"].kokkos_cxx) | ||||
|         if "+rocm" in self.spec: | ||||
|         if spec.satisfies("+rocm"): | ||||
|             env.append_flags("CXXFLAGS", "-fgpu-rdc") | ||||
| 
 | ||||
|     def cmake_args(self): | ||||
| @@ -145,7 +142,7 @@ def cmake_args(self): | ||||
|             self.define_from_variant("ENABLE_CUDA", "cuda"), | ||||
|             self.define_from_variant("ENABLE_WIND_UTILS", "wind-utils"), | ||||
|             self.define_from_variant("ENABLE_BOOST", "boost"), | ||||
|             self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"), | ||||
|             self.define_from_variant("CMAKE_CXX_STANDARD", "17"), | ||||
|             self.define_from_variant("BUILD_SHARED_LIBS", "shared"), | ||||
|             self.define_from_variant("ENABLE_OPENFAST", "openfast"), | ||||
|             self.define_from_variant("ENABLE_TIOGA", "tioga"), | ||||
| @@ -156,23 +153,23 @@ def cmake_args(self): | ||||
|             self.define_from_variant("ENABLE_UMPIRE", "umpire"), | ||||
|         ] | ||||
| 
 | ||||
|         if "+openfast" in spec: | ||||
|         if spec.satisfies("+openfast"): | ||||
|             args.append(self.define("OpenFAST_DIR", spec["openfast"].prefix)) | ||||
| 
 | ||||
|         if "+tioga" in spec: | ||||
|         if spec.satisfies("+tioga"): | ||||
|             args.append(self.define("TIOGA_DIR", spec["tioga"].prefix)) | ||||
| 
 | ||||
|         if "+hypre" in spec: | ||||
|         if spec.satisfies("+hypre"): | ||||
|             args.append(self.define("HYPRE_DIR", spec["hypre"].prefix)) | ||||
| 
 | ||||
|         if "+catalyst" in spec: | ||||
|         if spec.satisfies("+catalyst"): | ||||
|             args.append( | ||||
|                 self.define( | ||||
|                     "PARAVIEW_CATALYST_INSTALL_PATH", spec["trilinos-catalyst-ioss-adapter"].prefix | ||||
|                 ) | ||||
|             ) | ||||
| 
 | ||||
|         if "+fftw" in spec: | ||||
|         if spec.satisfies("+fftw"): | ||||
|             args.append(self.define("FFTW_DIR", spec["fftw"].prefix)) | ||||
| 
 | ||||
|         args.append(self.define("ENABLE_TESTS", self.run_tests)) | ||||
| @@ -184,10 +181,10 @@ def cmake_args(self): | ||||
|                 ] | ||||
|             ) | ||||
| 
 | ||||
|         if "+umpire" in spec: | ||||
|         if spec.satisfies("+umpire"): | ||||
|             args.append(self.define("UMPIRE_DIR", spec["umpire"].prefix)) | ||||
| 
 | ||||
|         if "+rocm" in spec: | ||||
|         if spec.satisfies("+rocm"): | ||||
|             args.append(self.define("CMAKE_CXX_COMPILER", spec["hip"].hipcc)) | ||||
|             args.append(self.define("ENABLE_ROCM", True)) | ||||
|             targets = spec.variants["amdgpu_target"].value | ||||
| @@ -200,6 +197,6 @@ def cmake_args(self): | ||||
| 
 | ||||
|     @run_before("cmake") | ||||
|     def add_submodules(self): | ||||
|         if self.run_tests or "+wind-utils" in self.spec: | ||||
|         if self.run_tests or self.spec.satisfies("+wind-utils"): | ||||
|             git = which("git") | ||||
|             git("submodule", "update", "--init", "--recursive") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jon Rood
					Jon Rood