Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HPC_Tutorials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
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
patmjen
HPC_Tutorials
Commits
903a9278
Commit
903a9278
authored
2 years ago
by
patmjen
Browse files
Options
Downloads
Patches
Plain Diff
Add sample init script
parent
be9e6a7f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/init.sh
+39
-0
39 additions, 0 deletions
scripts/init.sh
with
39 additions
and
0 deletions
scripts/init.sh
0 → 100644
+
39
−
0
View file @
903a9278
#!/bin/bash
# Simple init script for Python on DTU HPC
# Patrick M. Jensen, patmjen@dtu.dk, 2022
# Configuration
# This is what you should change for your setup
PYVER
=
3.9.14
# Python version
CUVER
=
11.6
# CUDA version
VENVDIR
=
.
# Where to store your virtualenv
VENVNAME
=
venv
# Name of your virtualenv
# Load modules
module load python3/
$PYVER
module load
$(
module avail
-o
modulepath
-t
-C
"python-
${
PYVER
}
"
|
grep
"numpy/"
)
module load
$(
module avail
-o
modulepath
-t
-C
"python-
${
PYVER
}
"
|
grep
"scipy/"
)
module load
$(
module avail
-o
modulepath
-t
-C
"python-
${
PYVER
}
"
|
grep
"matplotlib/"
)
module load
$(
module avail
-o
modulepath
-t
-C
"python-
${
PYVER
}
"
|
grep
"pandas/"
)
module load cuda/
$CUVER
CUDNN_MOD
=
$(
module avail
-o
modulepath
-t
cudnn |
grep
"cuda-
${
CUVER
}
"
|
sort
|
tail
-n1
)
if
[[
${
CUDNN_MOD
}
]]
then
module load
${
CUDNN_MOD
}
fi
# Create virtualenv if needed and activate it
if
[
!
-d
"
${
VENVDIR
}
/
${
VENVNAME
}
"
]
then
echo
INFO: Did not find virtualenv. Creating...
virtualenv
${
VENVDIR
}
/
${
VENVNAME
}
fi
source
${
VENVDIR
}
/
${
VENVNAME
}
/bin/activate
# Make all GPUs visible
if
command
-v
nvidia-smi &> /dev/null
then
export
CUDA_VISIBLE_DEVICES
=
$(
nvidia-smi
--query-gpu
=
index
--format
=
csv,noheader |
tr
'\n'
','
)
echo
CUDA_VISIBLE_DEVICES
=
${
CUDA_VISIBLE_DEVICES
}
fi
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