Skip to content

Commit 7901035

Browse files
committed
Added dev_pkg spack environment, changed buildcache generation so it no longer uses upstream spack instance and uses the dev_pkg spack environment, all this is necessary because we not longer directly change the spack instance with uberenv, updated spheral spack package to allow for spack to correctly do an install
1 parent 05c6a6a commit 7901035

File tree

7 files changed

+60
-37
lines changed

7 files changed

+60
-37
lines changed

.gitlab-ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ variables:
1010
SPHERAL_MODULE: "Spheral"
1111
SPACK_NAME: spheral
1212
SPACK_PKG_NAME: spheral
13+
DEV_PKG_SPEC: "spheral@develop%gcc+mpi~caliper~network"
1314

1415
.spheral_rev_str:
1516
before_script:

.gitlab/scripts.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
- INSTALL_DIR=/usr/gapps/Spheral/$SYS_TYPE/spheral-$SPHERAL_REV_STR
146146
- DEV_PKG_NAME=$SYS_TYPE-spheral-dev-pkg-$SPHERAL_REV_STR
147147

148-
- env SPHERAL_REV_STR=$SPHERAL_REV_STR STAGE_DIR=$INSTALL_DIR SPEC=$SPEC SPACK_PKG_NAME=$SPACK_PKG_NAME SCRIPT_DIR=$SCRIPT_DIR
148+
- env SPHERAL_REV_STR=$SPHERAL_REV_STR STAGE_DIR=$INSTALL_DIR SPACK_PKG_NAME=$SPACK_PKG_NAME SCRIPT_DIR=$SCRIPT_DIR
149149
bash ./$SCRIPT_DIR/lc/generate-buildcache.sh
150150

151151
- echo $INSTALL_DIR &> install-dir.txt
@@ -169,7 +169,7 @@
169169
- tar -xzf $DEV_PKG_NAME.tar.gz
170170
- cd $DEV_PKG_NAME
171171

172-
- env INSTALL_DIR=$INSTALL_DIR SPEC=$SPEC SPACK_PKG_NAME=$SPACK_PKG_NAME BUILD_ALLOC="" SCRIPT_DIR=$SCRIPT_DIR
172+
- env INSTALL_DIR=$INSTALL_DIR DEV_PKG_SPEC=$DEV_PKG_SPEC SPACK_PKG_NAME=$SPACK_PKG_NAME BUILD_ALLOC="" SCRIPT_DIR=$SCRIPT_DIR
173173
bash ./$SCRIPT_DIR/lc/install-from-dev-pkg.sh
174174

175175
artifacts:

scripts/devtools/tpl-manager.py

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def parse_args(self):
6767
help="Use to do everything but actually install. For testing purposes.")
6868
parser.add_argument("--id", type=str, default=None,
6969
help="ID string to postfix an initconfig file.")
70+
parser.add_argument("--dev-pkg", action="store_true",
71+
help="Tells tpl-manager to use the dev_pkg environment.")
7072

7173
self.args = parser.parse_args()
7274

@@ -223,6 +225,8 @@ def activate_spack_env(self):
223225
config_env_dir = os.path.join(get_config_dir(base_dir), "environments")
224226
# Check if we are on an LC machine and the environment exists
225227
default_env = os.getenv("SYS_TYPE")
228+
if (self.args.dev_pkg):
229+
default_env = "dev_pkg"
226230
if default_env and os.path.exists(os.path.join(config_env_dir, default_env)):
227231
# For LC systems
228232
env_dir = os.path.join(config_env_dir, default_env)

scripts/lc/generate-buildcache.sh

+10-23
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@ trap 'echo "# $BASH_COMMAND"' DEBUG
1717
# The expected spack package name for what we are packing up.
1818
SPACK_PKG_NAME=${SPACK_PKG_NAME:-spheral}
1919

20-
# What spec are we targetting.
21-
SPEC=${SPEC:-gcc@10.3.1}
22-
2320
# What is the version of spehral.
2421
SPHERAL_REV_STR=${SPHERAL_REV_STR:-undefined}
2522

2623
# Where will we be staging the package as it is being compiled together.
2724
STAGE_DIR=${STAGE_DIR:-$PWD/../$SYS_TYPE/spheral-cache}
2825

29-
# Where is the spack upstream located.
30-
UPSTREAM_DIR=${UPSTREAM_DIR:-/usr/WS2/sduser/Spheral/spack_upstream/0.22}
31-
3226
# Where does the spheral pip_cache dir live.
3327
SPHERAL_PIP_CACHE_DIR=${SPHERAL_PIP_CACHE_DIR:-~/.cache/spheral_pip}
3428

@@ -49,15 +43,11 @@ DEV_PKG_NAME=$SYS_TYPE-spheral-dev-pkg-$SPHERAL_REV_STR
4943
# Full path of what the package directory will look like as we compiler the dev pkg.
5044
DEV_PKG_DIR=$STAGE_DIR/$DEV_PKG_NAME
5145

52-
# Full Spack spec.
53-
SPHERAL_SPEC=$SPACK_PKG_NAME@develop$SPEC
54-
5546
# RESOURCE_DIR is a directory created internally to maintain spack & pip
5647
# resources required for building and running Spheral
5748
RESOURCE_DIR=$DEV_PKG_DIR/resources
5849

5950
# Print for sanity check.
60-
echo $SPHERAL_SPEC
6151
echo $RESOURCE_DIR
6252
echo $STAGE_DIR
6353
echo $DEV_PKG_DIR
@@ -72,23 +62,20 @@ mkdir -p $RESOURCE_DIR && cp -a $CI_PROJECT_DIR/. $DEV_PKG_DIR
7262
mkdir -p $RESOURCE_DIR/pip_cache
7363
cp -a $SPHERAL_PIP_CACHE_DIR/. $RESOURCE_DIR/pip_cache
7464

75-
# Initialize the upstream spack repo.
76-
./$SCRIPT_DIR/devtools/tpl-manager.py --init-only --spack-dir=$UPSTREAM_DIR
77-
source $UPSTREAM_DIR/spack/share/spack/setup-env.sh
78-
79-
# Delete any semblance of a spack env in the STAGE_DIR.
80-
spack env rm -y -f $STAGE_DIR
65+
# tpl-manager --dev-pkg does the following:
66+
# Creates a local Spack repo
67+
# Activates and concretizes the dev_pkg Spheral Spack environment
68+
# Installs the Spheral dependencies
69+
./$SCRIPT_DIR/devtools/tpl-manager.py --dev-pkg
8170

82-
# Create a spack env in STAGE_DIR and activate it.
83-
spack env create -d $STAGE_DIR
84-
spack env activate $STAGE_DIR
71+
# Source Spack for the current terminal
72+
source ../spheral-spack-tpls/spack/share/spack/setup-env.sh
8573

86-
# Concretize our targetted SPHERAL_SPEC.
87-
spack add $SPHERAL_SPEC
88-
spack concretize -f --fresh --deprecated
74+
# Activate our dev spack environment
75+
spack env activate ./$SCRIPT_DIR/spack/environments/dev_pkg
8976

9077
# Create a mirror of all tpl specs in our environment
91-
# (should only be our deps for SPHERAL_SPEC in the env).
78+
# (should only be our deps for a single spec in the env).
9279
spack mirror create -a -d $RESOURCE_DIR/mirror --exclude-specs "llnlspheral spheral"
9380

9481
# Use spack to list all specs in the mirror and push them to the buildcache.

scripts/lc/install-from-dev-pkg.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ BUILD_ALLOC=${BUILD_ALLOC}
66
SCRIPT_DIR=${SCRIPT_DIR:-'scripts'}
77
SPHERAL_PIP_CACHE_DIR=${SPHERAL_PIP_CACHE_DIR:-~/.cache/spheral_pip}
88

9-
if [[ -z "${SPEC}" ]]; then
10-
echo "SPEC var must be set."
9+
if [[ -z "${DEV_PKG_SPEC}" ]]; then
10+
echo "DEV_PKG_SPEC var must be set."
1111
exit 1
1212
fi
1313

@@ -17,7 +17,7 @@ if [[ -z "${INSTALL_DIR}" ]]; then
1717
fi
1818

1919
echo $SPACK_PKG_NAME
20-
echo $SPEC
20+
echo $DEV_PKG_SPEC
2121
echo $SPACK_URL
2222
echo $INSTALL_DIR
2323
echo $SCRIPT_DIR
@@ -39,9 +39,9 @@ spack mirror add --unsigned spheral-mirror $PWD/resources/mirror
3939
spack mirror add --unsigned spheral-cache $PWD/resources
4040
spack buildcache update-index $PWD/resources/mirror
4141

42-
$BUILD_ALLOC spack install --fresh --deprecated --no-check-signature --only dependencies $SPACK_PKG_NAME@develop%$SPEC
42+
$BUILD_ALLOC spack install --fresh --deprecated --no-check-signature --only dependencies $DEV_PKG_SPEC
4343

44-
$BUILD_ALLOC ./$SCRIPT_DIR/devtools/tpl-manager.py --spack-url $SPACK_URL --no-upstream --spack-dir $INSTALL_DIR/spheral-spack-tpls --spec "${SPACK_PKG_NAME}${SPEC}" --skip-init
44+
$BUILD_ALLOC ./$SCRIPT_DIR/devtools/tpl-manager.py --no-upstream --spack-dir $INSTALL_DIR/spheral-spack-tpls --spec $DEV_PKG_SPEC --skip-init --dev-pkg
4545

4646
HOST_CONFIG_FILE=$(ls -t | grep -E "*\.cmake" | head -1)
4747
$BUILD_ALLOC ./$SCRIPT_DIR/devtools/host-config-build.py --host-config $HOST_CONFIG_FILE -i $INSTALL_DIR --build --no-clean -DSPHERAL_PIP_CACHE_DIR=$SPHERAL_PIP_CACHE_DIR -DSPHERAL_NETWORK_CONNECTED=Off
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
spack:
2+
specs:
3+
- "spheral@develop%gcc+mpi~caliper~network"
4+
- "spheral@develop%gcc+mpi~caliper+network"
5+
view: false
6+
concretizer:
7+
unify: false
8+
develop:
9+
spheral:
10+
path: ../../../../
11+
spec: spheral@=develop
12+
include:
13+
- ../../configs/toss_4_x86_64_ib/packages.yaml
14+
- ../../configs/toss_4_x86_64_ib/compilers.yaml
15+
- ../../configs/config.yaml
16+
- ../../configs/upstreams.yaml
17+
repos:
18+
- ../../

scripts/spack/packages/spheral/package.py

+20-7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class Spheral(CachedCMakePackage, CudaPackage, ROCmPackage):
3131
variant('docs', default=False, description='Enable building Docs.')
3232
variant('shared', default=True, description='Build C++ libs as shared.')
3333
variant('python', default=True, description='Build Python Dependencies.')
34+
variant('caliper', default=True, description='Enable Caliper timers.')
35+
variant('opensubdiv', default=True, description='Enable use of opensubdiv to do refinement.')
36+
variant('network', default=True, description='Disable to build Spheral from a local buildcache.')
3437

3538
# -------------------------------------------------------------------------
3639
# DEPENDS
@@ -59,16 +62,19 @@ class Spheral(CachedCMakePackage, CudaPackage, ROCmPackage):
5962
depends_on('axom +shared', when='~cuda', type='build')
6063
depends_on('axom ~shared', when='+cuda', type='build')
6164

62-
depends_on('[email protected] ~shared +adiak +gotcha ~libdw ~papi ~libunwind +pic', type='build')
65+
with when("+caliper"):
66+
depends_on("[email protected] ~shared +adiak +gotcha ~libdw ~papi ~libunwind +pic", type="build")
67+
depends_on("caliper+mpi", type="build", when="+mpi")
68+
depends_on("caliper~mpi", type="build", when="~mpi")
6369

6470
depends_on("[email protected]", type="build")
6571

66-
depends_on('[email protected]+pic', type='build')
72+
depends_on('[email protected]+pic', type='build', when="+opensubdiv")
6773

68-
depends_on('polytope +python', type='build', when='+python')
74+
depends_on('polytope +python', type='build')
6975

7076
# Forward MPI Variants
71-
mpi_tpl_list = ["hdf5", "conduit", "axom", "caliper", "adiak~shared"]
77+
mpi_tpl_list = ["hdf5", "conduit", "axom", "adiak~shared"]
7278
for ctpl in mpi_tpl_list:
7379
for mpiv in ["+mpi", "~mpi"]:
7480
depends_on(f"{ctpl} {mpiv}", type='build', when=f"{mpiv}")
@@ -174,15 +180,17 @@ def initconfig_package_entries(self):
174180
spec = self.spec
175181
entries = []
176182

177-
entries.append(cmake_cache_option('ENABLE_CXXONLY', False))
183+
entries.append(cmake_cache_option('ENABLE_CXXONLY', not spec.satisfies("+python")))
178184
entries.append(cmake_cache_option('TPL_VERBOSE', False))
179185
entries.append(cmake_cache_option('BUILD_TPL', True))
180186

181187
entries.append(cmake_cache_string('SPHERAL_SYS_ARCH', self._get_sys_type(spec)))
182188
entries.append(cmake_cache_string('SPHERAL_CONFIGURATION', self._get_config_name(spec)))
183189

184190
# TPL locations
185-
entries.append(cmake_cache_path('caliper_DIR', spec['caliper'].prefix))
191+
if (spec.satisfies("+caliper")):
192+
entries.append(cmake_cache_path('caliper_DIR', spec['caliper'].prefix))
193+
entries.append(cmake_cache_option('ENABLE_TIMER', True))
186194

187195
entries.append(cmake_cache_path('adiak_DIR', spec['adiak'].prefix))
188196

@@ -207,7 +215,12 @@ def initconfig_package_entries(self):
207215
entries.append(cmake_cache_path('eigen_DIR', spec['eigen'].prefix))
208216
entries.append(cmake_cache_path('eigen_INCLUDES',spec['eigen'].prefix.include.eigen3))
209217

210-
entries.append(cmake_cache_path('opensubdiv_DIR', spec['opensubdiv'].prefix))
218+
if (spec.satisfies("+opensubdiv")):
219+
entries.append(cmake_cache_path('opensubdiv_DIR', spec['opensubdiv'].prefix))
220+
entries.append(cmake_cache_path('ENABLE_OPENSUBDIV', True))
221+
222+
if (spec.satisfies("~network")):
223+
entries.append(cmake_cache_path('SPHERAL_NETWORK_CONNECTED', False))
211224

212225
entries.append(cmake_cache_path('polytope_DIR', spec['polytope'].prefix))
213226

0 commit comments

Comments
 (0)