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
fi
done
export target=$(jq -Mrc '
.stack.targets
| to_entries
| .[]
| select(.key == env.environment)
| .value' ${STACK_CONFIG})
compilers_specs=$(jq -Mr '
.stack
| .system_arch as $arch
......
......@@ -26,30 +26,48 @@ then
spack/bin/spack env create ${environment}
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 ${STACK_CONFIG_PATH}/${file}_${environment}.yaml to ${SPACK_SYSTEM_CONFIG_PATH}/${file}_env.yaml"
cp "${STACK_CONFIG_PATH}/${file}_${environment}.yaml" \
${SPACK_SYSTEM_CONFIG_PATH}/${file}_env.yaml
fi
done
echo "Copying cp ${STACK_CONFIG_PATH}/spack.yaml to ${SPACK_SYSTEM_CONFIG_PATH}/"
cp ${STACK_CONFIG_PATH}/spack.yaml ${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
config:
......@@ -78,7 +96,6 @@ mirrors:
${mirrors}
EOF
cp "${SPACK_SYSTEM_CONFIG_PATH}/mirrors.yaml" spack/etc/spack
echo "Setting up packages"
......@@ -101,18 +118,6 @@ export system_arch=$(jq -Mrc '
.stack.system_arch
' ${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 '
.stack.system_packages
| map(" \(.):\n require:\n - \"%\(env.system_compiler)\"\n - \"\(env.system_arch)\"")
......@@ -126,8 +131,6 @@ then
rm packages.yaml.old
fi
cp "${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml" spack/etc/spack
echo "Setting up extra repos"
EXTERNAL_REPOS=$(jq -r '.spack.repos | keys[]' ${STACK_CONFIG})
......@@ -155,7 +158,14 @@ do
fi
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"
......
......@@ -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 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: ${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 @@
"version": "11.2.1"
}
},
"targets": {
"helvetios": "skylake_avx512",
"izar": "cascadelake",
"jed": "icelake",
"kuma-l40s": "zen4",
"kuma-h100": "zen4"
"environments": {
"helvetios": {
"target": "skylake_avx512",
"accelerator": "none"
},
"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": {
"oneapi": {
......
File moved
definitions_cuda.yaml
\ No newline at end of file
definitions_empty.yaml
\ 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