Skip to content

Commit f5b0488

Browse files
authored
Merge pull request #271 from LLNL/devops/docker-envs
Devops/docker envs
2 parents ea0df9b + 93fa90e commit f5b0488

23 files changed

+389
-64
lines changed

RELEASE_NOTES.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
Version vX.Y.Z -- Release date xxxx-xx-xx
1+
Version vYYYY.MM.p -- Release date YYYY-MM-DD
2+
==============================================
3+
* Important Notes:
4+
* External users of the code will need to supply config files for tpl-manager to find system libraries correctly. Steps to do this are detailed in the external user build guide.
5+
6+
Notable changes include:
7+
8+
* New features/ API changes:
9+
10+
* Build changes / improvements:
11+
* 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.
12+
13+
* Bug Fixes / improvements:
14+
15+
Version v2024.01.1 -- Release date 2024-02-17
216
==============================================
317
* Important Notes:
4-
*
18+
* This is a patch release for v2024.01.0.
519

620
Notable changes include:
721

@@ -15,6 +29,8 @@ Notable changes include:
1529

1630
* Bug Fixes / improvements:
1731
* Fixed bug with ConstantBoundary in the presence of porosity with the new porosity models introduced in v2024.01.00.
32+
* Updating header lists for including Spheral modules in external projects.
33+
* Adding effective viscous pressure back to FSISPH.
1834
* Initial volumes for damage models were incorrectly not taking into account pore space when computing failure statistics for seeding flaws. Fixed.
1935

2036
Version v2024.01.00 -- Release date 2024-01-19

cmake/InstallTPLs.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if (NOT ENABLE_CXXONLY)
1919
# Find the appropriate Python
2020
find_package(Python3 COMPONENTS Interpreter Development)
2121
set(PYTHON_EXE ${Python3_EXECUTABLE})
22+
set(SPHERAL_SITE_PACKAGES_PATH "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" )
2223
list(APPEND SPHERAL_BLT_DEPENDS Python3::Python)
2324

2425
# Set the PYB11Generator path

cmake/SpheralVersion.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
set(SPHERAL_VERSION 2024.01.0)
1+
set(SPHERAL_VERSION 2024.01.1)

cmake/spheral/SpheralAddLibs.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function(spheral_add_pybind11_library package_name)
233233
target_compile_options(${MODULE_NAME} PRIVATE ${SPHERAL_PYB11_TARGET_FLAGS})
234234

235235
install(TARGETS ${MODULE_NAME}
236-
DESTINATION Spheral
236+
DESTINATION ${SPHERAL_SITE_PACKAGES_PATH}/Spheral
237237
)
238238

239239
# Set the r-path of the C++ lib such that it is independent of the build dir when installed

cmake/spheral/SpheralInstallPythonFiles.cmake

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
# Note, if ENABLE_CXXONLY is set, this function does nothing
88
#-----------------------------------------------------------------------------------
99

10+
1011
function(spheral_install_python_files)
1112

1213
if (NOT ENABLE_CXXONLY)
1314
install(FILES ${ARGV}
14-
DESTINATION Spheral)
15+
DESTINATION DESTINATION ${SPHERAL_SITE_PACKAGES_PATH}/Spheral)
1516
install(CODE "execute_process( \
16-
COMMAND ${PYTHON_EXE} -m compileall Spheral \
17+
COMMAND ${PYTHON_EXE} -m compileall DESTINATION ${SPHERAL_SITE_PACKAGES_PATH}/Spheral \
1718
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})")
1819
endif()
1920

docs/build_guide/external/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This guide is designed to help external users build and install Spheral on non L
99
:caption: External Building Guide:
1010

1111
quickstart.rst
12-
ubuntu_update.rst
12+
system_packages.rst
1313
cloning.rst
1414
updating.rst
1515
tpls.rst
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. _required system packages:
2+
3+
Required System Packages
4+
########################
5+
6+
This guide assumes the use of an Ubuntu 20.04 system using ``apt`` as the package manager. For other other operating systems please install the corresponding packages as seen below.
7+
8+
::
9+
10+
sudo apt update
11+
sudo apt upgrade
12+
sudo apt install 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

docs/build_guide/external/ubuntu_update.rst

-14
This file was deleted.

docs/build_guide/include/quickstart.rst.inc

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ Update and install necessary package dependencies.
1212
sudo apt upgrade
1313
sudo apt install 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
1414

15-
.. warning::
16-
For alternative Linux distros your mileage may vary, ensure you are installing compatible packages to the ones listed above.
17-
1815
[ex_update_sys-section-end]
1916

2017
..
@@ -47,6 +44,12 @@ Build our TPL dependencies from source with the Spheral tpl-management tool (``t
4744
.. note::
4845
This command will generate a ``.cmake`` file with the naming convention ``<system-type>-<compiler-spec>``. The following commands will refer to this format as ``<host-config>`` for generalization across operating systems and architectures. You will need to substitute the correct format in the following commands.
4946

47+
.. warning::
48+
For operating systems other than Ubuntu 20.04 you should get an error to the effect of:
49+
``[ERROR: invalid spack config dir: /<path>/scripts/spack/configs/<OperatingSystem><Version> ]``
50+
You will **need** to follow the steps outlined in :ref:`ERROR: invalid spack config dir` before proceeding with this quickstart guide.
51+
52+
5053
[ex_tpl-section-end]
5154

5255
[lc_tpl-section-start]

docs/build_guide/include/tpls.rst.inc

+32
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,38 @@ Above we are telling ``tpl-manager`` to build our TPLs with the ``gcc`` that is
6666
.. note::
6767
Spheral minimally requires a C++14 compliant compiler.
6868

69+
ERROR: invalid spack config dir
70+
===============================
71+
72+
If you are trying to run ``tpl-manager.py`` on an operating system other than Ubuntu20.04, you will
73+
see an error to the effect of:
74+
``[ERROR: invalid spack config dir: /<path>/scripts/spack/configs/<OperatingSystem><Version> ]``
75+
76+
We define configuration files for Ubuntu20.04, as well as our common LLNL operating systems.
77+
You will need to create a set of files for your own system.
78+
79+
The configuration files tell spack where the packages installed in :ref:`Required System Packages`
80+
are located and what version they are. We have provided a ``generic`` set of config files to
81+
help in setting this up for you.
82+
83+
#. Copy the directory ``scripts/spack/configs/generic`` to ``scripts/spack/config/<OperatingSystem><Version>`` (you want to match the name of the directory to the one ``tpl-manager.py`` expects to find).
84+
85+
86+
#. For each package within the ``packages.py`` file of your new folder edit the version number to be the same as
87+
what is installed on your system. There are a number of ways to retrieve versions for a given package:
88+
89+
* Most version numbers should be searchable through your package manager, there are however, some system libraries that may not be managed by your package manager.
90+
91+
* If the package has an executable, often you can run with some form of ``-V`` or ``--version``. e.g. for mpich:``mpiexec --version`` will report the MPI version.
92+
93+
* For packages that only provide libraries, often the system library will be symlinked to one with the version as the extension. e.g. ``ls -lha /usr/lib/x86_64_gnu-linux/libreadlines.so`` will show it is symlinked to ``libreadlines.so.8.1``.
94+
95+
96+
#. Each package requires the ``prefix:`` of the installation be provided. In most cases ``/usr`` is sufficient. Typically packages installed with a package manager will place files in: ``/usr/bin``, ``/usr/share``, ``/usr/lib``, ``/usr/lib64``, sometimes ``/usr/lib/x86_64.../``. Here the common prefix is ``/usr``.
97+
98+
* If you are building Spheral on a system where you don't have permissions to run package manager and install to ``/usr``, then you might have installed the system packages somewhere else. In that case, replace the ``prefix:`` path for those given packages as necessary.
99+
100+
69101
[ex_running_tpl_manager-end]
70102

71103
[lc_running_tpl_manager-start]

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
author = 'J. Michael Owen'
2727

2828
# The short X.Y version
29-
version = '2024.01.0'
29+
version = '2024.01.1'
3030
# The full version, including alpha/beta/rc tags
31-
release = '2024.01.0'
31+
release = '2024.01.1'
3232

3333

3434
# -- General configuration ---------------------------------------------------

docs/conf.py.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ copyright = '2012, LLNS'
2626
author = 'J. Michael Owen'
2727

2828
# The short X.Y version
29-
version = '2024.01.0'
29+
version = '2024.01.1'
3030
# The full version, including alpha/beta/rc tags
31-
release = '2024.01.0'
31+
release = '2024.01.1'
3232

3333

3434
# -- General configuration ---------------------------------------------------

docs/developer/dev/continuous_deployment.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ to their environment.
99

1010
On LC systems we maintain:
1111
* ``Spheral/risky``
12-
* ``Spheral/2024.01.0``
12+
* ``Spheral/2024.01.1``
1313
* ``Spheral/2023.06.0``
1414
* ``Spheral/2023.03.1``
1515
* ``Spheral/2023.03.0`` (deprecated as of TOSS4 upgrade)

docs/developer/dev/docker_dev_env.rst

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
*******************************************
2+
Docker Development Environment
3+
*******************************************
4+
5+
Spheral builds an up-to-date docker container for every merge-request
6+
on ``develop``. Developers can use this container to do development tasks
7+
on local machines.
8+
9+
===========================
10+
Creating a Dev Environment
11+
===========================
12+
13+
We will use ``docker dev create`` with our spheral docker image and a
14+
local repository. This will allow us to skip setting up a linux system with
15+
external packages, gives us pre-built TPLs and allows us to edit a cloned
16+
repository from our local machines IDE/text editor.bash::
17+
18+
> rm <path_to_local_repo>/compose-dev.yaml
19+
> docker dev create --base-image ghcr.io/llnl/spheral --name <name_your_env> --path <path_to_local_repo> -o <path_to_local_repo>
20+
21+
.. note::
22+
You need to have **Docker Desktop**, **VSCode** and the **VSCode Dev Environment Extension** installed for this to work. You do not need to use VSCode to access the container, but the extension seems to do some of the lifting for us when setting up the volume to our local repo.
23+
24+
**Output** ::
25+
26+
spheral-recursing_darwin <---- Name of dev environment
27+
Creating Dev Environment "spheral-recursing_darwin"
28+
populating volume from /Users/davis291/Projects/spheral
29+
Creating Dev Environment "spheral-recursing_darwin"
30+
detecting language
31+
Detecting main repo language...
32+
building compose stack
33+
building compose stack
34+
starting compose stack
35+
starting compose stack
36+
Network spheral-recursing_darwin_default Creating
37+
Network spheral-recursing_darwin_default Created
38+
Container spheral-recursing_darwin-app-1 Creating
39+
Container spheral-recursing_darwin-app-1 Created
40+
Container spheral-recursing_darwin-app-1 Starting
41+
Container spheral-recursing_darwin-app-1 Started <---- Name of running container to connect to.
42+
Dev Environment "spheral-recursing_darwin" (5bd37219d27eb68a77ce6fd8fee05a533a52017d8dcc72430867e2471e428e58) is running!%
43+
44+
45+
=============================
46+
Connecting to a Dev Container
47+
=============================
48+
49+
Once the continaer has ben started you can connect directly through the terminal
50+
with the **Container** name (**NOT** the **Dev Environment** name).::
51+
52+
> docker exec -it spheral-recursing_darwin-app-1 /bin/bash
53+
root@671dab5d0b00:/home/spheral/workspace/build_docker-gcc/install#
54+
55+
This drops you into the install location of the ``spheral@develop`` build from
56+
github, this is a fully installed version of the latest ``develop`` spheral.
57+
58+
.. tip::
59+
VSCode & Docker Desktop:
60+
* Open **Docker Desktop** and navigate to the **Dev Environment** tab.
61+
* Find the container name and select **OPEN IN VSCODE**.
62+
63+
64+
=============================
65+
Development Work
66+
=============================
67+
68+
Your local Spheral repo is mounted from your local filesystem. You can develop directly from your
69+
IDE or text editor of choice. Then you can compile and run from within the container itself.
70+
71+
- The local Spheral repository will be mounted in the container at ``/com.docker.devenvironments.code/``.
72+
73+
- There already exists a full build and install of Spheral at ``develop`` in ``/home/spheral/workspace/build_docker-gcc/install``.
74+
75+
- An updated host config file can be found at ``/home/spheral/wokspace/docker-gcc.cmake``.

docs/developer/development_docs.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Welcome to Spheral's developer documentation. This documentation is a work in pr
99

1010
dev/submodules.rst
1111
dev/diagnostic_tools.rst
12+
dev/docker_dev_env.rst
1213
dev/release_process.rst
1314
dev/continuous_deployment.rst
1415

scripts/devtools/tpl-manager.py

+34-6
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ def build_deps(args):
109109
for s in spec_list:
110110
print("** SPEC : {0}".format(s))
111111

112-
spack_config_dir_opt=""
113-
if "SYS_TYPE" not in os.environ.keys():
114-
spack_config_dir_opt="--spack-config-dir={0}".format(os.path.join(project_dir, "scripts/spack/configs/x86_64"))
115-
116112
spack_upstream_opt=""
117113
if os.path.isdir(args.upstream_dir) and not args.no_upstream:
118114
spack_upstream_opt="--upstream {0}".format(args.upstream_dir)
@@ -124,17 +120,42 @@ def build_deps(args):
124120
# We use uberenv to set up our spack instance with our respective package.yaml files
125121
# config.yaml and custom spack packages recipes.
126122
print("** Running uberenv...")
123+
127124
prefix_opt="--prefix=" + args.spheral_spack_dir
128125
uberenv_project_json_opt="--project-json={0}".format(uberenv_project_json)
129126

130127
print("** Spheral Spack Dir : {0}".format(args.spheral_spack_dir))
131-
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)
132128

133129
# We just want to use the spac instance directly to generate our TPLs, we don't want
134130
# to have the spack instance take over our environment.
135131
os.environ["SPACK_DISABLE_LOCAL_CONFIG"] = "1"
136132
spack_cmd=os.path.join(args.spheral_spack_dir, "spack/bin/spack")
137133

134+
spheral_config_dir="scripts/spack/configs/"
135+
spack_config_dir_opt=""
136+
if "SYS_TYPE" not in os.environ.keys():
137+
# We need to install spack without any configuration files so we can use
138+
# spack arch to determine the OS of the system and later to use spack find
139+
# for generating external package files on external systems.
140+
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)
141+
142+
spack_arch_os = sexe("{0} arch -o".format(spack_cmd), ret_output=True)[1].strip()
143+
print("INFO : Detected Operating System :{0}".format(spack_arch_os))
144+
145+
spheral_config_dir += spack_arch_os
146+
147+
spack_config_dir_opt="--spack-config-dir={0}".format(os.path.join(project_dir, spheral_config_dir))
148+
else:
149+
spheral_config_dir += os.environ["SYS_TYPE"]
150+
151+
152+
# Setup spack w/ Uberenv and the appropriate external package/compiler configs.
153+
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)
154+
155+
# Uberenv doesn't copy the concretizer.yaml options...
156+
if os.path.exists(spheral_config_dir+"/concretizer.yaml"):
157+
sexe("cp {0}/concretizer.yaml {1}".format(spheral_config_dir, os.path.join(args.spheral_spack_dir, "spack/etc/spack/defaults")), echo=True)
158+
138159
# Optionally add a parallel job number for spack builds
139160
if args.spack_jobs:
140161
spack_cmd += " --jobs={0}".format(args.spack_jobs)
@@ -149,12 +170,19 @@ def build_deps(args):
149170
# Loop through the specs we want TPLs for and build/install/get them as necessary.
150171
if not args.init_only:
151172
for s in spec_list:
173+
152174
print("** Building TPL's and generating host-config for {0}%{1} ...".format(package_name,s))
153175
os.environ["SPEC"] = s
154176
os.environ["LC_ALL"] = "en_US.UTF-8"
177+
155178
if not args.no_spec:
156179
if sexe("{0} spec --fresh -I {1}@develop%{2}".format(spack_cmd, package_name, s), echo=True) : sys.exit(1)
157-
if sexe("{0} dev-build --fresh --quiet --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)
180+
181+
# Install only the dependencies for Spheral
182+
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)
183+
184+
# Using dev-build we can have spack generate an init-config with the local source files for spheral.
185+
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)
158186

159187
if not args.no_clean:
160188
sexe("rm dev-build-* spack-build-* spack-configure-args.txt")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -------------------------------------------------------------------------
2+
# This is the default spack configuration file.
3+
#
4+
# Settings here are versioned with Spack and are intended to provide
5+
# sensible defaults out of the box. Spack maintainers should edit this
6+
# file to keep it current.
7+
#
8+
# Users can override these settings by editing
9+
# `$SPACK_ROOT/etc/spack/concretizer.yaml`, `~/.spack/concretizer.yaml`,
10+
# or by adding a `concretizer:` section to an environment.
11+
# -------------------------------------------------------------------------
12+
concretizer:
13+
# Whether to consider installed packages or packages from buildcaches when
14+
# concretizing specs. If `true`, we'll try to use as many installs/binaries
15+
# as possible, rather than building. If `false`, we'll always give you a fresh
16+
# concretization.
17+
reuse: true
18+
# Options that tune which targets are considered for concretization. The
19+
# concretization process is very sensitive to the number targets, and the time
20+
# needed to reach a solution increases noticeably with the number of targets
21+
# considered.
22+
targets:
23+
# Determine whether we want to target specific or generic microarchitectures.
24+
# An example of the first kind might be for instance "skylake" or "bulldozer",
25+
# while generic microarchitectures are for instance "aarch64" or "x86_64_v4".
26+
granularity: generic
27+
# If "false" allow targets that are incompatible with the current host (for
28+
# instance concretize with target "icelake" while running on "haswell").
29+
# If "true" only allow targets that are compatible with the host.
30+
host_compatible: true
31+
# When "true" concretize root specs of environments together, so that each unique
32+
# package in an environment corresponds to one concrete spec. This ensures
33+
# environments can always be activated. When "false" perform concretization separately
34+
# on each root spec, allowing different versions and variants of the same package in
35+
# an environment.
36+
unify: true

0 commit comments

Comments
 (0)