Welcome!
Link to this document: https://hackmd.io/IoseeprATrWH0ZI7z6wJ-w?view
Link to the last sessions: https://hackmd.io/@bclaremar/HPC-python
Lecture Zoom link: https://umu.zoom.us/j/68897489502?pwd=TXlraXI5UkFvNWxIV0xGcWZ4M1lQdz09
Separate UPPMAX session Zoom: https://uu-se.zoom.us/j/68160935750
Password: 298853
Separate HPC2N session Zoom: https://umu.zoom.us/j/64721465122?pwd=NGtZM2h0bmJBTU4xNThjT0t5eFZndz09
Course material: https://uppmax.github.io/HPC-python/index.html
Q: Are the lectures being recorded? Will they be made available?
Q: Where do I find the examples to be used during the course?
/proj/nobackup/snic2022-22-641/bbrydsoe/examples.tar.gz
/proj/snic2022-22-641/nobackup/examples.tar.gz
Q: How to I untar these files?
tar -xvzf examples.tar.gz
But please copy it to your directory first.Q: Did you manage to get the files? (Add a + sign)
Q: Can docker be used to manage environments? I was thinking of pulling my own environment as a docker image instead of setting up everything from scratch.
Q: Are the python/3.9.5 and python3/3.9.5 modules the same?
python3/3.9.5
, python
will point to the python2
version. If you are unsure which version of python
or python3
you have, it's a very good idea to double check using some of these commands:
which python
which python3
python -V
Q: Does SNIC have a Jupyter Hub server similar to for example notebooks.egi.eu
Q: How do I find out which python modules are available on the system?
module avail python
or module spider python
if you're unsure about the spellingwhich python
>>> help("modules")
in a python shell prints everything available in the python path, regardless how it was installed (pip, conda, or manually) - it is complete list.Q: Is it possible to run Jupyter notebooks at HPC2N?
Q: Can one run jupyter using: jupyter notebook –no-browser –port=XXXX and then logging in to it?
Q: How can I get a prompt asking me to confirm removal of file?
alias rm='rm -i
. This can however be a bit dangerous if you are on another system and have gotten used to getting a prompt. See https://superuser.com/questions/382407/best-practices-to-alias-the-rm-command-and-make-it-safer for some best practices.Q: Can one use Kebnekaise for computing an UPPMAX project?
Q: Because we might often be using "outdated" versions of packages to ensure reproducibility, is there a good way to automatically suppress warnings or prompts to upgrade?
pip install --user -U package==1.3.4 another_package
orpip <command> --disable-pip-version-check [options]
Q: If / when a user installs a package with pip install without explicitly creating a virtual env: will the install be preserved until next login or is it temporary?
Q: Can venv use global packages from cluster if we don’t install packages in venv?
--system-site-packages
includes the packages already installed in the loaded python module. This can be good if you require lots of packages and those available global packages are compatible. The packages you install in the venv will be taken in favor of the same global packages with different version.
Q: I just used pip install whitebox and it worked. Is this now avalible for all users in a project?
~/.local/lib/python3.9/site-packages
, so you will need to specify a different location for the packages to make them easier accessible. You may do so via: pip install <package> --target <dir>
or -t <dir>
, which will install the <package>
in <dir>
but please note that the best practice is to use virtual envrironments, see additional answer below.venv
in your project folder, then everybody in the project just activate this enviroment and use it.Q: Are there any guidelines and restrictions how virtualenv can be used? I tend to use these kind of terminal functions
Q: what's the difference between venev and conda? in terms of virtual environment
venv
and similar can manage only python packages, while conda
can install non python packages, binaries, and libraries.Q: can viritual environments be created using a script sort of like a dockerfile?
Q: When developing a python script, what ide do you recommend to use on HPC2N?
do you have experience with vim or emacs as ide for python? Do you reccomend them (vim or emacs)?
ipython
for debugging. If the code is not running in parallel ipython -i python_program.py
will execute and leave you in the python shell where you can debug the main of the program (i.e. can not jump in functions and modules).Q: How can I monitor the CPU and memory usage of a job?
jobstats -p <jobid>
which will generate a .png plot of the CPU and memory usage vs. time. More info at https://www.uppmax.uu.se/support/user-guides/jobstats-user-guide/.Q: I am stuck in vim, send help :(. :q! worked.
:q!
(=exit without saving). Some times (if in edit or visual mode) you may need to press ESC key a couple of times before you type :q!
. Does it help? Feel free to use your favourite editor for editing files.I have been using Vim for two years now, mostly because I dont know how to exit. Anonymous user
Q: Is there a clever way of keeping track of the dependecies of a package? I mean, when creating an environment how would I know whether a package will conflict with another one?
pip install somepackage --only-list-deps
pip freeze > requirements.txt
. This is especially useful if you move your project to anther machine or in another environment, you may re-install the dependencies listed in the file requirements.txt
using the command pip install -r requirements.txt
.Q: What is the difference between CPU and GPU calculation?
https://uppmax.github.io/HPC-python/isolatedUPPMAX.html#prepare-the-course-environment
Task: create and activate the venv-python-course
environment
If you get stuck, please write your BO room number here.
Q: Can we just move the virtual environment to another directory?
Q: Do we have to go via python setup.py build
or does pip install (options) .
work?
python setup.py ...
) but if pip install
works then it should be OK to use itpip install
nowadays so its probably safe for up-to-date packagespip
, so for these you would have to use setup.py
, but it is worth trying with pip
firstpip install
should work right?Q: When I have logged in on the cluster, I can get information about different partitions with sinfo
and about specific nodes with scontrol show node
. Is there a way to get a summarised info on the whole cluster, i.e. how many nodes are there, number of cores per each node, memory and total number of cores available on the cluster? Something like lscpu
but for the whole cluster
sinfo
with additional options: sinfo -e -o '%D %N %C %m'
. On Rackham, for example, you getwhich means there are 450 nodes with 128GB/node and 4 nodes with 1TB/node, for example. For more options, please check https://slurm.schedmd.com/sinfo.html.
The example above shows that Rackham has 10878 allocated and 940 idle (=not allocated by Slurm) cores at this moment.