Skip to content

Commit

Permalink
Merge pull request #272 from LLNL/update/update_TPLs
Browse files Browse the repository at this point in the history
Update Spack to 0.22
  • Loading branch information
ldowen authored Jun 18, 2024
2 parents d40e795 + 2427793 commit 28fb2fc
Show file tree
Hide file tree
Showing 30 changed files with 512 additions and 743 deletions.
2 changes: 1 addition & 1 deletion .gitlab/os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.sys_config:
variables:
LLNL_SERVICE_USER: sphapp
UPSTREAM_DIR: /usr/WS2/wciuser/Spheral/spheral-spack-tpls
UPSTREAM_DIR: /usr/WS2/sduser/Spheral/spack_upstream/0.22
DISPLAY: ':0.0'

.on_toss_3_x86:
Expand Down
1 change: 0 additions & 1 deletion .gitlab/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- cd $CI_BUILD_DIR
- echo $SPEC

- ml load python/3
- $BUILD_ALLOC ./$SCRIPT_DIR/gitlab/build_and_install.py --spec="$SPEC" --extra-cmake-args="$EXTRA_CMAKE_ARGS"

.build_and_test:
Expand Down
2 changes: 1 addition & 1 deletion .uberenv_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"package_version" : "develop",
"package_source_dir" : "../../..",
"spack_url" : "https://github.com/spack/spack",
"spack_commit" : "5e0d2107348eed6cbe6deca43a30f5b06c5e40af",
"spack_commit" : "5fe93fee1eec46a0750bd340198bffcb92ff9eec",
"spack_configs_path" : "scripts/spack/configs",
"spack_packages_path" : "scripts/spack/packages"
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ARG HOST_CONFIG=docker-$SPEC
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y build-essential git gfortran mpich autotools-dev autoconf sqlite pkg-config uuid gettext cmake libncurses-dev libgdbm-dev libffi-dev libssl-dev libexpat-dev libreadline-dev liblapack-dev libbz2-dev locales python python3 unzip libtool wget curl tk-dev
RUN apt-get install -y build-essential git gfortran mpich autotools-dev autoconf sqlite pkg-config uuid gettext cmake libncurses-dev libgdbm-dev libffi-dev libssl-dev libexpat-dev libreadline-dev libbz2-dev locales python python3 unzip libtool wget curl tk-dev

# Setup system locale for pip package encoding/decoding
RUN locale-gen en_US.UTF-8
Expand Down
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Notable changes include:
* Multiple Spheral Python modules / CMake targets can be specified for a single directory.
* KernelIntegrator and FieldList directories are divided into 2 modules / targets.
* tpl-manager.py will no longer use generic x86_64 configs for non LC systems. Users will be required to supply their own configs for pointing spack at external packages.
* Spack version is increased from 0.19 to 0.22.
* Spack upstream is updated.
* Removed the python 3 module load for the Gitlab CI to fix an issue with pkg-config changing.
* Zlib target and TPL cmake file is removed.
* PYB11Generator repo is updated.
* Spack config and package files inside Spheral are updated to accommodate Spack 0.22.
* Package recipes for py-numpy-stl, py-pillow, py-pipreqs, td, and tk are removed.
* Versions for python dependencies in the Spheral spack recipe are fixed and updated (in some cases).

* Bug Fixes / improvements:

Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeDefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ if (ENABLE_TIMER)
endif()

if (ENABLE_MPI)
add_definitions(-DUSE_MPI=1)
add_definitions(-DUSE_MPI=1)
endif()
3 changes: 2 additions & 1 deletion cmake/InstallTPLs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ foreach(_comp ${AXOM_COMPONENTS_ENABLED})
endforeach()

# TPLs that must be imported
list(APPEND SPHERAL_EXTERN_LIBS zlib boost eigen qhull silo hdf5 polytope)
list(APPEND SPHERAL_EXTERN_LIBS boost eigen qhull silo hdf5 polytope)

blt_list_append( TO SPHERAL_EXTERN_LIBS ELEMENTS aneos IF ENABLE_ANEOS)
blt_list_append( TO SPHERAL_EXTERN_LIBS ELEMENTS opensubdiv IF ENABLE_OPENSUBDIV)
Expand All @@ -108,6 +108,7 @@ endforeach()
if (EXISTS ${EXTERNAL_SPHERAL_TPL_CMAKE})
include(${EXTERNAL_SPHERAL_TPL_CMAKE})
endif()

# Copied from serac, needed to bypass generator expression issue during export
set(_props)
if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" )
Expand Down
3 changes: 0 additions & 3 deletions cmake/SetupSpheral.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include(ExternalProject)
#-------------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS On)
set(CMAKE_EXPORT_COMPILE_COMMANDS On)

if (NOT SPHERAL_CMAKE_MODULE_PATH)
set(SPHERAL_CMAKE_MODULE_PATH "${SPHERAL_ROOT_DIR}/cmake")
Expand Down Expand Up @@ -83,8 +82,6 @@ if(ENABLE_CUDA)
list(APPEND SPHERAL_CXX_DEPENDS cuda)
endif()

option(BOOST_HEADER_ONLY "only use the header only components of Boost" OFF)

#-------------------------------------------------------------------------------#
# Set a default build type if none was specified
#-------------------------------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion cmake/blt
Submodule blt updated 183 files
2 changes: 1 addition & 1 deletion cmake/spheral/InstantiateCXX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function(instantiate _inst_var _source_var)
# Uses BLT's python for instantiations to work when building CXX_ONLY as well as with python
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
DEPENDS ${_inst_py}
COMMAND ${PYTHON_EXECUTABLE} ${SPHERAL_ROOT_DIR}/src/helpers/InstantiationGenerator.py ${_inst_py} ${_inst_file} ${_dim}
COMMAND ${Python3_EXECUTABLE} ${SPHERAL_ROOT_DIR}/src/helpers/InstantiationGenerator.py ${_inst_py} ${_inst_file} ${_dim}
BYPRODUCTS ${_inst_file}
COMMENT "Generating instantiation ${_inst_file}..."
)
Expand Down
70 changes: 40 additions & 30 deletions cmake/spheral_cxx-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@

@PACKAGE_INIT@

if(NOT axom_DIR)
set(axom_DIR "@axom_DIR@" CACHE PATH "")
endif()
set(SPHERAL_CXX_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
set(SPHERAL_CXX_INCLUDE_DIRS "${SPHERAL_CXX_INSTALL_PREFIX}/include")
if(NOT @ENABLE_CXXONLY@ AND NOT TARGET Python3)
set(python_DIR "@python_DIR@")
set(Python_EXECUTABLE ${python_DIR}/bin/python3)
set(Python3_EXECUTABLE ${python_DIR}/bin/python3)
find_package(Python3 COMPONENTS Interpreter Development)
set(PYTHON_EXE ${Python3_EXECUTABLE})
endif()
if(NOT SPHERAL_FOUND)
#----------------------------------------------------------------------------
# Set user configuration options and features
#----------------------------------------------------------------------------

# Guard these assignments to not interfere with projects that use Spheral and SpheralC as TPLs
if(SPHERALC_STANDALONE)
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE PATH "Spheral C compiler path")
set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE PATH "Spheral C++ compiler path")
set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "Spheral C++ compiler path")
set(ENABLE_MPI @ENABLE_MPI@ CACHE BOOL "")
if(SPHERAL_ENABLE_MPI)
set(MPI_C_COMPILER "@MPI_C_COMPILER@" CACHE PATH "")
set(MPI_CXX_COMPILER "@MPI_CXX_COMPILER@" CACHE PATH "")
set(MPI_Fortran_COMPILER "@MPI_Fortran_COMPILER@" CACHE PATH "")
# Language features
set(SPHERAL_ENABLE_MPI "@ENABLE_MPI@")
set(SPHERAL_ENABLE_OPENMP "@ENABLE_OPENMP@")
set(SPHERAL_ENABLE_CUDA "@ENABLE_CUDA@")
if(NOT axom_DIR)
set(axom_DIR "@axom_DIR@" CACHE PATH "")
endif()
endif()

if(NOT TARGET axom)
find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR} ${axom_DIR}/lib ${axom_DIR}/lib/cmake)
endif()
include("${SPHERAL_CXX_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake")
set(SPHERAL_CXX_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
set(SPHERAL_CXX_INCLUDE_DIRS "${SPHERAL_CXX_INSTALL_PREFIX}/include")
if(NOT @ENABLE_CXXONLY@ AND NOT TARGET Python3)
set(python_DIR "@python_DIR@")
set(Python_EXECUTABLE ${python_DIR}/bin/python3)
set(Python3_EXECUTABLE ${python_DIR}/bin/python3)
find_package(Python3 COMPONENTS Interpreter Development)
set(PYTHON_EXE ${Python3_EXECUTABLE})
endif()

set_property(TARGET Spheral_CXX
APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS})
if(NOT TARGET axom)
find_package(axom REQUIRED QUIET NO_DEFAULT_PATH PATHS ${axom_DIR} ${axom_DIR}/lib ${axom_DIR}/lib/cmake)
endif()
if(SPHERALC_STANDALONE)
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE PATH "Spheral C compiler path")
set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE PATH "Spheral C++ compiler path")
set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "Spheral C++ compiler path")
set(ENABLE_MPI @ENABLE_MPI@ CACHE BOOL "")
if(SPHERAL_ENABLE_MPI)
set(MPI_C_COMPILER "@MPI_C_COMPILER@" CACHE PATH "")
set(MPI_CXX_COMPILER "@MPI_CXX_COMPILER@" CACHE PATH "")
set(MPI_Fortran_COMPILER "@MPI_Fortran_COMPILER@" CACHE PATH "")
endif()
endif()
include("${SPHERAL_CXX_INSTALL_PREFIX}/lib/cmake/spheral_cxx-targets.cmake")

set_property(TARGET Spheral_CXX
APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SPHERAL_CXX_INCLUDE_DIRS})
set(SPHERAL_FOUND TRUE)
endif()
5 changes: 0 additions & 5 deletions cmake/tpl/zlib.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion extern/PYB11Generator
82 changes: 43 additions & 39 deletions scripts/devtools/tpl-manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project_dir=os.path.abspath(os.path.join(os.path.realpath(__file__), "../../../"))

default_spheral_spack_dir=os.path.join(os.getcwd(), "../spheral-spack-tpls")
default_upstream_dir="/usr/WS2/wciuser/Spheral/spheral-spack-tpls/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_p/"
default_upstream_dir="/usr/WS2/sduser/Spheral/spack_upstream/0.22/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_p"

uberenv_path = os.path.join(project_dir, "scripts/devtools/uberenv/uberenv.py")
uberenv_project_json = os.path.join(os.getcwd(), ".uberenv_config.json")
Expand Down Expand Up @@ -59,24 +59,24 @@ def parse_args():
parser.add_argument('--no-spec', action='store_true',
help='Skip output of the dependency graph.')

parser.add_argument('--skip-init', action='store_true',
help='Skip setting up and configuring Spack.')

return parser.parse_args()


# Helper function for executing commands stolen from uberenv
def sexe(cmd,ret_output=False,echo=False):
def sexe(cmd,ret_output=False,echo=True):
""" Helper for executing shell commands. """
if echo:
print("[exe: {0}]".format(cmd))
print("[exe: {0}]".format(cmd))
p = subprocess.run(cmd, shell=True,
capture_output=ret_output,
check=True, text=True)
if ret_output:
p = subprocess.Popen(cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out = p.communicate()[0]
out = out.decode('utf8')
return p.returncode,out
else:
return subprocess.call(cmd,shell=True)
if echo:
print(p.stdout)
return p.stdout


# Parse the json formatted spec list...
Expand All @@ -89,26 +89,13 @@ def parse_spec_list(file_path):
#------------------------------
# Dependencies
#------------------------------
def build_deps(args):
def build_spack(args):
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("~~~~~ Building Dependencies")
print("~~~~~ Configuring Spack")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("")
print("{0}".format(project_dir))


# Figure out what specs this script is building TPLs for.
spec_list=[]
if args.spec_list:
spec_list = parse_spec_list(args.spec_list)
elif args.spec:
spec_list.append(args.spec)
else:
print("ERROR: Please define --spec or --spec-list, aborting...")
sys.exit(1)
for s in spec_list:
print("** SPEC : {0}".format(s))

spack_upstream_opt=""
if os.path.isdir(args.upstream_dir) and not args.no_upstream:
spack_upstream_opt="--upstream {0}".format(args.upstream_dir)
Expand Down Expand Up @@ -137,9 +124,9 @@ def build_deps(args):
# We need to install spack without any configuration files so we can use
# spack arch to determine the OS of the system and later to use spack find
# for generating external package files on external systems.
if sexe("python3 {0} --setup-only {1} {2} {3} {4}".format(uberenv_path, prefix_opt, uberenv_project_json_opt, spack_upstream_opt, uberenv_spack_url_opt), echo=True): sys.exit(1)
sexe("python3 {0} --setup-only {1} {2} {3} {4}".format(uberenv_path, prefix_opt, uberenv_project_json_opt, spack_upstream_opt, uberenv_spack_url_opt))

spack_arch_os = sexe("{0} arch -o".format(spack_cmd), ret_output=True)[1].strip()
spack_arch_os = sexe("{0} arch -o".format(spack_cmd), ret_output=True, echo=False).strip()
print("INFO : Detected Operating System :{0}".format(spack_arch_os))

spheral_config_dir += spack_arch_os
Expand All @@ -150,12 +137,31 @@ def build_deps(args):


# Setup spack w/ Uberenv and the appropriate external package/compiler configs.
if sexe("python3 {0} --setup-only {1} {2} {3} {4} {5}".format(uberenv_path, prefix_opt, uberenv_project_json_opt, spack_config_dir_opt, spack_upstream_opt, uberenv_spack_url_opt), echo=True): sys.exit(1)
sexe("python3 {0} --setup-only {1} {2} {3} {4} {5}".format(uberenv_path, prefix_opt, uberenv_project_json_opt, spack_config_dir_opt, spack_upstream_opt, uberenv_spack_url_opt))

# Uberenv doesn't copy the concretizer.yaml options...
if os.path.exists(spheral_config_dir+"/concretizer.yaml"):
sexe("cp {0}/concretizer.yaml {1}".format(spheral_config_dir, os.path.join(args.spheral_spack_dir, "spack/etc/spack/defaults")), echo=True)
sexe("cp {0}/concretizer.yaml {1}".format(spheral_config_dir, os.path.join(args.spheral_spack_dir, "spack/etc/spack/defaults")))

def build_deps(args):
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("~~~~~ Building Dependencies")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("")
print("{0}".format(project_dir))
# Figure out what specs this script is building TPLs for.
spec_list=[]
if args.spec_list:
spec_list = parse_spec_list(args.spec_list)
elif args.spec:
spec_list.append(args.spec)
else:
print("ERROR: Please define --spec or --spec-list, aborting...")
sys.exit(1)
for s in spec_list:
print("** SPEC : {0}".format(s))
spack_cmd=os.path.join(args.spheral_spack_dir, "spack/bin/spack")

# Optionally add a parallel job number for spack builds
if args.spack_jobs:
spack_cmd += " --jobs={0}".format(args.spack_jobs)
Expand All @@ -170,27 +176,25 @@ def build_deps(args):
# Loop through the specs we want TPLs for and build/install/get them as necessary.
if not args.init_only:
for s in spec_list:

print("** Building TPL's and generating host-config for {0}%{1} ...".format(package_name,s))
os.environ["SPEC"] = s
os.environ["LC_ALL"] = "en_US.UTF-8"

if not args.no_spec:
if sexe("{0} spec --fresh -I {1}@develop%{2}".format(spack_cmd, package_name, s), echo=True) : sys.exit(1)

# Install only the dependencies for Spheral
if sexe("{0} install --fail-fast --fresh --deprecated --only dependencies {2}@develop%{3} 2>&1 | tee -a \"dev-build-{3}-out.txt\"".format(spack_cmd, os.getcwd(), package_name, s), echo=True) : sys.exit(1)
sexe("{0} spec --fresh -IL {1}@develop%{2} 2>&1 | tee -a \"spec-info-{2}-out.txt\"".format(spack_cmd, package_name, s))

# Using dev-build we can have spack generate an init-config with the local source files for spheral.
if sexe("{0} dev-build --fresh --deprecated -u initconfig {2}@develop%{3} 2>&1 | tee -a \"dev-build-{3}-out.txt\"".format(spack_cmd, os.getcwd(), package_name, s), echo=True) : sys.exit(1)
# Install only the dependencies for Spheral and create CMake configure file
sexe("{0} dev-build -q --fresh -u initconfig {1}@develop%{2} 2>&1 | tee -a \"tpl-build-{2}-out.txt\"".format(spack_cmd, package_name, s))

if not args.no_clean:
sexe("rm dev-build-* spack-build-* spack-configure-args.txt")
sexe("rm -f spec-info-* tpl-build-* spack-build-* spack-configure-args.txt")

#------------------------------------------------------------------------------

def main():
args = parse_args()
if (not args.skip_init):
build_spack(args)
build_deps(args)


Expand Down
Loading

0 comments on commit 28fb2fc

Please sign in to comment.