Skip to content

Commit b6649c8

Browse files
committedDec 1, 2022
Update config scripts.
This commit enhances our config/profile scripts to support: 1. A place to put building software manually without easybuild. These builds will be referred to as "banalbuild". The manual builds will be located in $CCR_PREFIX/banalbuild. Banal == devoid of freshness or originality :) 2. Allow users to override the default CCR_VERSION so they can pin their profile to a specific version of our software stack. 3. Start to standardize a way for custom user/group modules and how they dispaly in `module avail`.
1 parent 5387e10 commit b6649c8

11 files changed

+130
-158
lines changed
 

‎config/easybuild/eb_hooks.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_ccr_envvar(ccr_envvar):
4848
return ccr_envvar_value
4949

5050
def set_modluafooter(ec):
51-
software_path = get_ccr_envvar('CCR_SOFTWARE_PATH')
51+
software_path = get_ccr_envvar('CCR_EASYBUILD_PATH')
5252
ccr_version = get_ccr_envvar('CCR_VERSION')
5353
eprefix = get_ccr_envvar('EPREFIX')
5454
moduleclass = ec.get('moduleclass','')
@@ -78,8 +78,8 @@ def pre_module_hook(self, *args, **kwargs):
7878
self.cfg.enhance_sanity_check = True
7979

8080
def get_rpath_override_dirs(software_name):
81-
# determine path to installations in software layer via $CCR_SOFTWARE_PATH
82-
ccr_software_path = get_ccr_envvar('CCR_SOFTWARE_PATH')
81+
# determine path to installations in software layer via $CCR_EASYBUILD_PATH
82+
ccr_software_path = get_ccr_envvar('CCR_EASYBUILD_PATH')
8383
ccr_version = get_ccr_envvar('CCR_VERSION')
8484

8585
# construct the rpath override directory stub

‎config/easybuild/init.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export EASYBUILD_MODULE_NAMING_SCHEME=CCRHierarchicalMNS
3535

3636
export EASYBUILD_ALLOW_LOADED_MODULES=StdEnv,gentoo,easybuild
3737
export EASYBUILD_PREFIX=${WORKDIR}/easybuild
38-
export EASYBUILD_INSTALLPATH=${CCR_SOFTWARE_PATH}
38+
export EASYBUILD_INSTALLPATH=${CCR_EASYBUILD_PATH}
3939
export EASYBUILD_SUFFIX_MODULES_PATH=""
4040
export EASYBUILD_SOURCEPATH=${WORKDIR}/easybuild/sources:${CCR_SOURCEPATH}
4141

‎config/lmod/SitePackage.lua

+30-18
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,17 @@ function dofile (filename)
119119
return f()
120120
end
121121

122-
local ccr_soft_path = os.getenv("CCR_SOFTWARE_PATH")
122+
local ccr_version =os.getenv("CCR_VERSION")
123123
local ccr_prefix = os.getenv("CCR_PREFIX")
124+
125+
-- NOTE: this matches CCR_PREFIX/easybuild and CCR_PREFIX/banalbuild
126+
local ccr_soft_path = pathJoin(ccr_prefix, ".*build")
127+
124128
local lmod_package_path = os.getenv("LMOD_PACKAGE_PATH")
125129
dofile(pathJoin(lmod_package_path,"SitePackage_logging.lua"))
126130
dofile(pathJoin(lmod_package_path,"SitePackage_licenses.lua"))
127131
dofile(pathJoin(lmod_package_path,"SitePackage_families.lua"))
128132
dofile(pathJoin(lmod_package_path,"SitePackage_properties.lua"))
129-
dofile(pathJoin(lmod_package_path,"SitePackage_localpaths.lua"))
130133

131134
sandbox_registration{ loadfile = loadfile, assert = assert, loaded_modules = loaded_modules, serializeTbl = serializeTbl, clearWarningFlag = clearWarningFlag }
132135

@@ -233,20 +236,17 @@ sandbox_registration{ get_installed_cuda_driver_version = get_installed_cuda_dri
233236

234237
local function unload_hook(t)
235238
set_family(t)
236-
set_local_paths(t)
237239
end
238240

239241
local function load_hook(t)
240242
local valid = validate_license(t)
241243
set_props(t)
242244
set_family(t)
243-
log_module_load(t,true)
244-
set_local_paths(t)
245+
log_module_load(t,true)
245246
end
246247

247248
local function spider_hook(t)
248249
set_props(t)
249-
set_local_paths(t)
250250
end
251251

252252
hook.register("unload", unload_hook)
@@ -257,7 +257,7 @@ hook.register("load_spider", spider_hook)
257257
local mapT =
258258
{
259259
grouped = {
260-
[ccr_soft_path .. '/modules/Core.*'] = "Core Modules",
260+
[ccr_soft_path .. '/modules/Core.*'] = "Core modules",
261261
[ccr_soft_path .. '/modules/CUDA.*'] = "Cuda-dependent modules",
262262
[ccr_soft_path .. '/modules/avx512/Core.*'] = "Core avx512 modules",
263263
[ccr_soft_path .. '/modules/avx512/Compiler.*'] = "Compiler-dependent avx512 modules",
@@ -271,10 +271,11 @@ local mapT =
271271
[ccr_soft_path .. '/modules/sse3/Core.*'] = "Core sse modules",
272272
[ccr_soft_path .. '/modules/sse3/Compiler.*'] = "Compiler-dependent sse3 modules",
273273
[ccr_soft_path .. '/modules/sse3/MPI.*'] = "MPI-dependent sse3 modules",
274-
[ccr_prefix .. '/config/modulefiles$'] = "Custom CCR modules",
275-
['/srv/software.*layer/config/modulefiles$'] = "Custom CCR modules",
276-
['/project/.*'] = "Your groups' modules",
277-
['/user/.*'] = "Your personal modules",
274+
[ccr_prefix .. '/config/modulefiles$'] = "Core modules",
275+
['/srv/software.*layer/config/modulefiles$'] = "Core modules",
276+
['/projects/.*'] = "Your groups' modules",
277+
['/user/.*/modules/.*'] = "Your personal modules",
278+
['/home/.*/modules/.*'] = "Your personal modules",
278279
},
279280
}
280281

@@ -284,13 +285,24 @@ function avail_hook(t)
284285
if (not availStyle or availStyle == "system" or styleT == nil) then
285286
return
286287
end
287-
local localModulePaths = os.getenv("CCR_LOCAL_MODULEPATHS") or nil
288-
if localModulePaths ~= nil then
289-
for localModulePathRoot in localModulePaths:split(":") do
290-
styleT[localModulePathRoot .. "/.*/Core.*"] = "Cluster specific Core modules"
291-
styleT[localModulePathRoot .. "/.*/CUDA.*"] = "Cluster specific Cuda-dependent modules"
292-
styleT[localModulePathRoot .. "/.*/Compiler.*"] = "Cluster specific Compiler-dependent modules"
293-
styleT[localModulePathRoot .. "/.*/MPI.*"] = "Cluster specific MPI-dependent modules"
288+
local customBuildPaths = os.getenv("CCR_CUSTOM_BUILD_PATHS") or nil
289+
if customBuildPaths ~= nil then
290+
for customPath in customBuildPaths:split(":") do
291+
local customModulePathRoot = pathJoin(customPath, ccr_version)
292+
styleT[customModulePathRoot .. "/modules/Core.*"] = "Your Core modules"
293+
styleT[customModulePathRoot .. "/modules/CUDA.*"] = "Your Cuda-dependent modules"
294+
styleT[customModulePathRoot .. "/modules/avx512/Core.*"] = "Your avx512 modules"
295+
styleT[customModulePathRoot .. "/modules/avx512/Compiler.*"] = "Your Compiler-dependent avx512 modules"
296+
styleT[customModulePathRoot .. "/modules/avx512/MPI.*"] = "Your MPI-dependent avx512 modules"
297+
styleT[customModulePathRoot .. "/modules/avx2/Core.*"] = "Your avx2 modules"
298+
styleT[customModulePathRoot .. "/modules/avx2/Compiler.*"] = "Your Compiler-dependent avx2 modules"
299+
styleT[customModulePathRoot .. "/modules/avx2/MPI.*"] = "Your MPI-dependent avx2 modules"
300+
styleT[customModulePathRoot .. "/modules/avx/Core.*"] = "Your avx modules"
301+
styleT[customModulePathRoot .. "/modules/avx/Compiler.*"] = "Your Compiler-dependent avx modules"
302+
styleT[customModulePathRoot .. "/modules/avx/MPI.*"] = "Your MPI-dependent avx modules"
303+
styleT[customModulePathRoot .. "/modules/sse3/Core.*"] = "Your sse3 modules"
304+
styleT[customModulePathRoot .. "/modules/sse3/Compiler.*"] = "Your Compiler-dependent sse3 modules"
305+
styleT[customModulePathRoot .. "/modules/sse3/MPI.*"] = "Your MPI-dependent sse3 modules"
294306
end
295307
end
296308
for k,v in pairs(t) do

‎config/lmod/SitePackage_localpaths.lua

-92
This file was deleted.

‎config/modulefiles/gentoo/2022.05.lua.core

+28-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ whatis("Gentoo prefix is Gentoo Linux installed in a prefix - Homepage: https://
55

66
add_property( "lmod", "sticky")
77

8-
local root = os.getenv("EPREFIX")
9-
local ccr_soft_path = os.getenv("CCR_SOFTWARE_PATH")
8+
local ccr_version ="2022.05"
9+
local ccr_repo_path = os.getenv("CCR_CVMFS_REPO")
10+
local ccr_prefix = pathJoin(ccr_repo_path, "versions", ccr_version)
11+
local ccr_easybuild_path = pathJoin(ccr_prefix, "easybuild")
12+
local ccr_banalbuild_path = pathJoin(ccr_prefix, "banalbuild")
13+
local root = pathJoin(ccr_prefix, "compat")
14+
15+
setenv("CCR_VERSION", ccr_version)
16+
setenv("CCR_PREFIX", ccr_prefix)
17+
setenv("CCR_EASYBUILD_PATH", ccr_easybuild_path)
18+
setenv("CCR_BANALBUILD_PATH", ccr_banalbuild_path)
19+
setenv("EPREFIX", root)
1020

1121
prepend_path("PATH", pathJoin(root, "bin"))
1222
prepend_path("PATH", pathJoin(root, "sbin"))
@@ -18,6 +28,20 @@ prepend_path("MANPATH", pathJoin(root, "usr/share/binutils-data/x86_64-pc-linux-
1828
prepend_path("MANPATH", pathJoin(root, "usr/share/gcc-data/x86_64-pc-linux-gnu/9.3.0/man"))
1929

2030
if (mode() ~= "spider") then
21-
prepend_path("MODULEPATH", pathJoin(ccr_soft_path, "modules/Core"))
22-
prepend_path("MODULEPATH", pathJoin(ccr_soft_path, "modules", arch, "Core"))
31+
prepend_path("MODULEPATH", pathJoin(ccr_easybuild_path, "modules/Core"))
32+
prepend_path("MODULEPATH", pathJoin(ccr_easybuild_path, "modules", arch, "Core"))
33+
prepend_path("MODULEPATH", pathJoin(ccr_banalbuild_path, "modules/Core"))
34+
prepend_path("MODULEPATH", pathJoin(ccr_banalbuild_path, "modules", arch, "Core"))
35+
local customBuildPaths = os.getenv("CCR_CUSTOM_BUILD_PATHS") or nil
36+
if customBuildPaths ~= nil then
37+
for customPath in customBuildPaths:split(":") do
38+
if isDir(pathJoin(customPath, ccr_version, "modules")) then
39+
prepend_path("MODULEPATH", pathJoin(customPath, ccr_version, "modules/Core"))
40+
prepend_path("MODULEPATH", pathJoin(customPath, ccr_version, "modules", arch, "Core"))
41+
end
42+
end
43+
end
44+
if isDir(pathJoin(os.getenv("HOME"), "modules", ccr_version)) then
45+
prepend_path("MODULEPATH", pathJoin(os.getenv("HOME"), "modules", ccr_version))
46+
end
2347
end

‎config/modulefiles/gentoo/2023.01.lua.core

+23-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ whatis("Gentoo prefix is Gentoo Linux installed in a prefix - Homepage: https://
55

66
add_property( "lmod", "sticky")
77

8+
local ccr_version ="2023.01"
89
local ccr_repo_path = os.getenv("CCR_CVMFS_REPO")
9-
local ccr_prefix = pathJoin(ccr_repo_path, "versions/2023.01")
10-
local ccr_soft_path = pathJoin(ccr_prefix, "easybuild")
10+
local ccr_prefix = pathJoin(ccr_repo_path, "versions", ccr_version)
11+
local ccr_easybuild_path = pathJoin(ccr_prefix, "easybuild")
12+
local ccr_banalbuild_path = pathJoin(ccr_prefix, "banalbuild")
1113
local root = pathJoin(ccr_prefix, "compat")
1214

15+
setenv("CCR_VERSION", ccr_version)
1316
setenv("CCR_PREFIX", ccr_prefix)
14-
setenv("CCR_SOFTWARE_PATH", ccr_soft_path)
17+
setenv("CCR_EASYBUILD_PATH", ccr_easybuild_path)
18+
setenv("CCR_BANALBUILD_PATH", ccr_banalbuild_path)
1519
setenv("EPREFIX", root)
1620

1721
prepend_path("PATH", pathJoin(root, "bin"))
@@ -25,6 +29,20 @@ prepend_path("MANPATH", pathJoin(root, "usr/share/binutils-data/x86_64-pc-linux-
2529
prepend_path("MANPATH", pathJoin(root, "usr/share/gcc-data/x86_64-pc-linux-gnu/11.3.0/man"))
2630

2731
if (mode() ~= "spider") then
28-
prepend_path("MODULEPATH", pathJoin(ccr_soft_path, "modules/Core"))
29-
prepend_path("MODULEPATH", pathJoin(ccr_soft_path, "modules", arch, "Core"))
32+
prepend_path("MODULEPATH", pathJoin(ccr_easybuild_path, "modules/Core"))
33+
prepend_path("MODULEPATH", pathJoin(ccr_easybuild_path, "modules", arch, "Core"))
34+
prepend_path("MODULEPATH", pathJoin(ccr_banalbuild_path, "modules/Core"))
35+
prepend_path("MODULEPATH", pathJoin(ccr_banalbuild_path, "modules", arch, "Core"))
36+
local customBuildPaths = os.getenv("CCR_CUSTOM_BUILD_PATHS") or nil
37+
if customBuildPaths ~= nil then
38+
for customPath in customBuildPaths:split(":") do
39+
if isDir(pathJoin(customPath, ccr_version, "modules")) then
40+
prepend_path("MODULEPATH", pathJoin(customPath, ccr_version, "modules/Core"))
41+
prepend_path("MODULEPATH", pathJoin(customPath, ccr_version, "modules", arch, "Core"))
42+
end
43+
end
44+
end
45+
if isDir(pathJoin(os.getenv("HOME"), "modules", ccr_version)) then
46+
prepend_path("MODULEPATH", pathJoin(os.getenv("HOME"), "modules", ccr_version))
47+
end
3048
end

‎config/profile/bash.sh

+21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
CCR_CVMFS_REPO="/cvmfs/soft.ccr.buffalo.edu"
2+
CCR_VERSION="2023.01"
13
CCR_INIT_DIR=$(dirname "$(dirname "$(readlink -f "$BASH_SOURCE")")")
4+
5+
# Allow users to override CCR_VERSION
6+
if [ -f ${HOME}/.ccrversion ]; then
7+
read -r ccrver<${HOME}/.ccrversion
8+
9+
if echo "${ccrver}" | egrep -q '^20[0-9][0-9]\.(0[0-9]|1[0-2])$'; then
10+
if [ -d $CCR_CVMFS_REPO/versions/$ccrver ]; then
11+
CCR_VERSION="${ccrver}"
12+
CCR_INIT_DIR="${CCR_CVMFS_REPO}/versions/${ccrver}/config"
13+
fi
14+
fi
15+
fi
16+
17+
# Defines base CCR environment variables. These will be used by everything
218
export CCR_INIT_DIR
19+
export CCR_VERSION
20+
export CCR_CVMFS_REPO
21+
export CCR_PREFIX=$CCR_CVMFS_REPO/versions/$CCR_VERSION
22+
export CCR_EASYBUILD_PATH=$CCR_PREFIX/easybuild
23+
export CCR_BANALBUILD_PATH=$CCR_PREFIX/banalbuild
324

425
if [[ $UID -ge 1000 ]]; then
526
for file in ${CCR_INIT_DIR}/profile/profile.d/*.sh; do

‎config/profile/profile.d/z-000-init.sh

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# Defines base CCR environment variables. These will be used by everything
2-
3-
export CCR_CVMFS_REPO="/cvmfs/soft.ccr.buffalo.edu"
4-
export CCR_VERSION="2023.01"
5-
export CCR_PREFIX=$CCR_CVMFS_REPO/versions/$CCR_VERSION
6-
export CCR_SOFTWARE_PATH=$CCR_PREFIX/easybuild
7-
81
# Set custom prompt
92
# export PS1="(CCRv${CCR_VERSION}) [\u@\h:\w]$ "
103

‎config/profile/profile.d/z-20-lmod.sh

+17-21
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,22 @@ export LMOD_RC=${LMOD_PACKAGE_PATH}/lmodrc.lua
88
export LMOD_SHORT_TIME=3600
99

1010
if [[ -z "$__Init_Default_Modules" ]]; then
11-
NEWMODULERCFILE=${LMOD_PACKAGE_PATH}/modulerc.lua
12-
if [[ ! -z "$CCR_CLUSTER" && -f ${LMOD_PACKAGE_PATH}/modulerc_${CCR_CLUSTER}.lua ]]; then
13-
NEWMODULERCFILE=${LMOD_PACKAGE_PATH}/modulerc_${CCR_CLUSTER}.lua:${NEWMODULERCFILE}
14-
fi
15-
export MODULERCFILE=${MODULERCFILE:+:$MODULERCFILE}:${NEWMODULERCFILE}
16-
unset NEWMODULERCFILE
17-
export MODULEPATH=${CCR_INIT_DIR}/modulefiles
18-
__Init_Default_Modules=1; export __Init_Default_Modules;
19-
if [[ -z "$LMOD_SYSTEM_DEFAULT_MODULES" ]]; then
20-
export LMOD_SYSTEM_DEFAULT_MODULES="StdEnv"
21-
fi
22-
if [[ $- == *i* ]]; then
23-
module --initial_load restore
24-
else
25-
module -q --initial_load restore
26-
fi
11+
NEWMODULERCFILE=${LMOD_PACKAGE_PATH}/modulerc.lua
12+
if [[ ! -z "$CCR_CLUSTER" && -f ${LMOD_PACKAGE_PATH}/modulerc_${CCR_CLUSTER}.lua ]]; then
13+
NEWMODULERCFILE=${LMOD_PACKAGE_PATH}/modulerc_${CCR_CLUSTER}.lua:${NEWMODULERCFILE}
14+
fi
15+
export MODULERCFILE=${MODULERCFILE:+:$MODULERCFILE}:${NEWMODULERCFILE}
16+
unset NEWMODULERCFILE
17+
export MODULEPATH=${CCR_INIT_DIR}/modulefiles
18+
__Init_Default_Modules=1; export __Init_Default_Modules;
19+
if [[ -z "$LMOD_SYSTEM_DEFAULT_MODULES" ]]; then
20+
export LMOD_SYSTEM_DEFAULT_MODULES="StdEnv"
21+
fi
22+
if [[ $- == *i* ]]; then
23+
module --initial_load restore
24+
else
25+
module -q --initial_load restore
26+
fi
2727
else
28-
module refresh
29-
fi
30-
31-
if [[ -d $HOME/modulefiles ]]; then
32-
module -q use --priority 100 ${HOME}/modulefiles
28+
module refresh
3329
fi

0 commit comments

Comments
 (0)