Skip to content
Snippets Groups Projects
Commit cb9e27d0 authored by Nicolas Richart's avatar Nicolas Richart
Browse files

Refactoring configuration

parent 07ba3046
No related branches found
No related tags found
1 merge request!3Feat/stack pinot noir
Pipeline #203730 failed
This commit is part of merge request !3. Comments created here will be created in the context of that merge request.
Showing
with 88 additions and 54 deletions
...@@ -73,13 +73,6 @@ for c in "core_compilers" "compilers"; do ...@@ -73,13 +73,6 @@ for c in "core_compilers" "compilers"; do
fi fi
done done
export target=$(jq -Mrc '
.stack.targets
| to_entries
| .[]
| select(.key == env.environment)
| .value' ${STACK_CONFIG})
compilers_specs=$(jq -Mr ' compilers_specs=$(jq -Mr '
.stack .stack
| .system_arch as $arch | .system_arch as $arch
......
...@@ -26,30 +26,48 @@ then ...@@ -26,30 +26,48 @@ then
spack/bin/spack env create ${environment} spack/bin/spack env create ${environment}
fi fi
for file in mirrors packages concretizer config spack definitions modules
do
if [ -e "${STACK_CONFIG_PATH}/${file}.yaml" ]; then
echo "Copying ${STACK_CONFIG_PATH}/${file}.yaml to ${SPACK_SYSTEM_CONFIG_PATH}"
cp "${STACK_CONFIG_PATH}/${file}.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}
cp "${STACK_CONFIG_PATH}/${file}.yaml" spack/etc/spack
fi
if [ -e "${STACK_CONFIG_PATH}/${file}_stack.yaml" ]; then
echo "Copying ${STACK_CONFIG_PATH}/${file}_stack.yaml to ${SPACK_SYSTEM_CONFIG_PATH}"
cp "${STACK_CONFIG_PATH}/${file}_stack.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}
fi
if [ -e "${STACK_CONFIG_PATH}/${file}_${environment}.yaml" ]; then echo "Copying cp ${STACK_CONFIG_PATH}/spack.yaml to ${SPACK_SYSTEM_CONFIG_PATH}/"
echo "Copying ${STACK_CONFIG_PATH}/${file}_${environment}.yaml to ${SPACK_SYSTEM_CONFIG_PATH}/${file}_env.yaml" cp ${STACK_CONFIG_PATH}/spack.yaml ${SPACK_SYSTEM_CONFIG_PATH}
cp "${STACK_CONFIG_PATH}/${file}_${environment}.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}/${file}_env.yaml
fi
done
cp -r "${STACK_CONFIG_PATH}/templates" ${SPACK_SYSTEM_CONFIG_PATH} cp -r "${STACK_CONFIG_PATH}/templates" ${SPACK_SYSTEM_CONFIG_PATH}
declare -A file_mapping
file_mapping["_common"]=""
file_mapping["_stack"]="_stack"
file_mapping["_acc_${acc_type}"]="_accel"
file_mapping["_${environment}"]="_env"
declare -A placeholders
placeholders["{target}"]="${target}"
placeholders["{gcc_version}"]=$(jq -Mrc '.stack.compilers.gcc.version' ${STACK_CONFIG})
if [ "${accelerator}" != "none" ]
then
placeholders["{${acc_type}_arch}"]="${acc_arch}"
fi
echo blip
for file in mirrors packages concretizer config definitions modules
do
for suffix in ${!file_mapping[@]}
do
src=${STACK_CONFIG_PATH}/${file}${suffix}.yaml
dst=${SPACK_SYSTEM_CONFIG_PATH}/${file}"${file_mapping[$suffix]}".yaml
if [ -e "${STACK_CONFIG_PATH}/${file}${suffix}.yaml" ]
then
echo "Copying $src to $dst"
cp "$src" "$dst"
for ph in ${!placeholders[@]}
do
rep=${placeholders[$ph]}
sed -i -e "s/$ph/$rep/g" "$dst"
done
fi
done
done
cat <<EOF > ${SPACK_SYSTEM_CONFIG_PATH}/config_stack.yaml cat <<EOF > ${SPACK_SYSTEM_CONFIG_PATH}/config_stack.yaml
config: config:
...@@ -78,7 +96,6 @@ mirrors: ...@@ -78,7 +96,6 @@ mirrors:
${mirrors} ${mirrors}
EOF EOF
cp "${SPACK_SYSTEM_CONFIG_PATH}/mirrors.yaml" spack/etc/spack
echo "Setting up packages" echo "Setting up packages"
...@@ -101,18 +118,6 @@ export system_arch=$(jq -Mrc ' ...@@ -101,18 +118,6 @@ export system_arch=$(jq -Mrc '
.stack.system_arch .stack.system_arch
' ${STACK_CONFIG}) ' ${STACK_CONFIG})
# cat <<EOF >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
# all:
# prefer:
# EOF
# jq -Mrc '
# .stack.system_packages
# | map(" - spec: \"^\(.)%\(env.system_compiler)\"\n when: \"%nvhpc ^\(.)\"")
# | .[]
# ' ${STACK_CONFIG} >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml
jq -Mrc ' jq -Mrc '
.stack.system_packages .stack.system_packages
| map(" \(.):\n require:\n - \"%\(env.system_compiler)\"\n - \"\(env.system_arch)\"") | map(" \(.):\n require:\n - \"%\(env.system_compiler)\"\n - \"\(env.system_arch)\"")
...@@ -126,8 +131,6 @@ then ...@@ -126,8 +131,6 @@ then
rm packages.yaml.old rm packages.yaml.old
fi fi
cp "${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml" spack/etc/spack
echo "Setting up extra repos" echo "Setting up extra repos"
EXTERNAL_REPOS=$(jq -r '.spack.repos | keys[]' ${STACK_CONFIG}) EXTERNAL_REPOS=$(jq -r '.spack.repos | keys[]' ${STACK_CONFIG})
...@@ -155,7 +158,14 @@ do ...@@ -155,7 +158,14 @@ do
fi fi
done done
cp "${SPACK_SYSTEM_CONFIG_PATH}/repos.yaml" spack/etc/spack for file in mirrors packages concretizer config modules repos
do
if [ -e "${SPACK_SYSTEM_CONFIG_PATH}/${file}.yaml" ]
then
cp "${SPACK_SYSTEM_CONFIG_PATH}/${file}.yaml" spack/etc/spack
fi
done
echo "Setting up buildcache" echo "Setting up buildcache"
......
...@@ -14,6 +14,18 @@ export SPACK_SYSTEM_CONFIG_PATH=${STACK_LOCATION}/spack/var/spack/environments/$ ...@@ -14,6 +14,18 @@ export SPACK_SYSTEM_CONFIG_PATH=${STACK_LOCATION}/spack/var/spack/environments/$
#export SPACK_USER_CONFIG_PATH=$(mktemp -p /tmp -d slurm_user_config_XXXXXXX) #export SPACK_USER_CONFIG_PATH=$(mktemp -p /tmp -d slurm_user_config_XXXXXXX)
export environment_type="local_cluster" export environment_type="local_cluster"
export SPACK_VERSION=$(jq -r .spack.version ${STACK_CONFIG})
env_json=$(jq '.stack.environments | to_entries | .[] | select(.key == env.environment) | .value' ${STACK_CONFIG})
export target=$(echo $env_json | jq -Mrc '.target')
export accelerator=$(echo $env_json | jq -Mrc '.accelerator // "none"')
if [ "$accelerator" != "none" ]
then
export acc_type=$(echo $env_json | jq -Mrc '.accelerator.type')
export acc_arch=$(echo $env_json | jq -Mrc '.accelerator.arch')
fi
echo "STACK_CONFIG_PATH: ${STACK_CONFIG_PATH}" echo "STACK_CONFIG_PATH: ${STACK_CONFIG_PATH}"
echo "STACK_CONFIG: ${STACK_CONFIG}" echo "STACK_CONFIG: ${STACK_CONFIG}"
......
definitions_cuda.yaml
\ No newline at end of file
definitions_cuda.yaml
\ No newline at end of file
definitions_cuda.yaml
\ No newline at end of file
mirrors: {}
...@@ -33,12 +33,35 @@ ...@@ -33,12 +33,35 @@
"version": "11.2.1" "version": "11.2.1"
} }
}, },
"targets": { "environments": {
"helvetios": "skylake_avx512", "helvetios": {
"izar": "cascadelake", "target": "skylake_avx512",
"jed": "icelake", "accelerator": "none"
"kuma-l40s": "zen4", },
"kuma-h100": "zen4" "izar": {
"target": "cascadelake",
"accelerator": {
"type": "cuda",
"arch": "75"
}
},
"jed": {
"target": "icelake"
},
"kuma-l40s": {
"target": "zen4",
"accelerator": {
"type": "cuda",
"arch": "89"
}
},
"kuma-h100": {
"target": "zen4",
"accelerator": {
"type": "cuda",
"arch": "90"
}
}
}, },
"compilers": { "compilers": {
"oneapi": { "oneapi": {
......
File moved
definitions_cuda.yaml definitions_empty.yaml
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment