Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoicon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
w2w
autoicon
Commits
fea28292
Commit
fea28292
authored
2 years ago
by
Oriol Tintó Prims
Browse files
Options
Downloads
Patches
Plain Diff
Adapt build_python_environment.sh to use the new spack_utils.sh functions.
parent
ba3ea1bb
No related branches found
No related tags found
1 merge request
!4
Switching to the advanced configuration method and fixing spack build.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/common/build_python_environment.sh
+7
-20
7 additions, 20 deletions
templates/common/build_python_environment.sh
with
7 additions
and
20 deletions
templates/common/build_python_environment.sh
+
7
−
20
View file @
fea28292
...
...
@@ -6,33 +6,20 @@ SPACK_URL=%spack.url%
SPACK_BRANCH
=
%spack.branch%
SPACK_COMPILER
=
%spack.compiler%
# If the workdir directory does not exist create it
if
[
!
-d
${
WORKDIR
}
]
;
then
mkdir
-p
${
WORKDIR
}
fi
# Go to the working directory
cd
${
WORKDIR
}
# Check if experiment's spack installation already exists, if it doesn't, clone it.
SPACK_ENV
=
spack/share/spack/setup-env.sh
if
[
!
-f
${
SPACK_ENV
}
]
;
then
echo
"Spack folder not found!"
exit
1
fi
.
${
WORKDIR
}
/proj/platforms/common/spack_utils.sh
load_spack
"%spack.init%"
"%spack.root%"
"%spack.url%"
"%spack.branch%"
"%spack.compiler%"
"%spack.disable_local_config%"
"%spack.user_cache_path%"
"%spack.user_config_path%"
# Setup the spack environment
source
${
SPACK_ENV
}
# Use spack to get a recent enough version of python3
if
[
$(
spack find python@3.8: &>/dev/null
echo
$?
)
-ne
0
]
;
then
if
[
$(
spack find python@3.8: &>/dev/null
)
]
;
then
echo
"python@3.8: already installed!"
else
echo
"Installing a version of python3"
# Compile openmpi with schedulers=slurm
spack
install
python@3.8:
else
echo
"python@3.8: already installed!"
fi
# Load the python module
...
...
@@ -56,7 +43,7 @@ ln -sf $(which python3) ${WORKDIR}/python3
requirements
=
"%python_environment.requirements%"
# Convert list with python format to a bash array
requirements
=(
$(
echo
${
requirements
}
|
sed
"s/'//g"
|
tr
-d
'[],'
)
)
requirements
=(
$(
echo
${
requirements
}
|
sed
"s/'//g"
|
tr
-d
'[],'
)
)
#TODO: Shouldn't be necessary but it is for now to overcome an issue with a repetition of the requirements.
# Use sort and uniq to get the unique elements
...
...
@@ -66,6 +53,6 @@ unique_requirements=($(printf "%s\n" "${requirements[@]}" | sort -u))
echo
"
${
unique_requirements
[@]
}
"
# Install requirements.
for
requirement
in
${
unique_requirements
[@]
}
;
do
for
requirement
in
"
${
unique_requirements
[@]
}
"
;
do
python
-m
pip
install
${
requirement
}
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment