Difference between revisions of "GPUs EMBO 2016"
(15 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
and then you can connect to the computing machine called <tt>daint</tt>, again you will be requested to type in your credentials. | and then you can connect to the computing machine called <tt>daint</tt>, again you will be requested to type in your credentials. | ||
− | <pre> | + | <pre>course27@ela2:~> ssh -Y daint</pre> |
== Installing ''Dynamo'' == | == Installing ''Dynamo'' == | ||
An installation is ready in the account <tt>course27</tt>. Just copy it onto your own account. | An installation is ready in the account <tt>course27</tt>. Just copy it onto your own account. | ||
− | <tt>scp -r /users/course27/dynamo ~</tt> | + | <tt>scp -r /users/course27/dynamo ~</tt> |
Afterwards you will be able to activate ''Dynamo'' in your linux session by: | Afterwards you will be able to activate ''Dynamo'' in your linux session by: | ||
− | <tt>source /users/courseXX/dynamo/ | + | <tt>source /users/courseXX/dynamo/dynamo_activate_linux_shipped_MCR.sh</tt> |
+ | Please place your account number instead of the placeholder <tt>XX</tt>! | ||
== Using ''Dynamo'' == | == Using ''Dynamo'' == | ||
Line 30: | Line 31: | ||
=== Creating a remote ''Dynamo'' console === | === Creating a remote ''Dynamo'' console === | ||
* <tt>ssh</tt> to <tt>daint</tt> | * <tt>ssh</tt> to <tt>daint</tt> | ||
− | * activate ''Dynamo'' in the shell | + | * activate ''Dynamo'' in the shell: |
− | : <tt>source /users/courseXX/dynamo/ | + | : <tt>source /users/courseXX/dynamo/dynamo_activate_linux_shipped_MCR.sh</tt> |
− | * launch the console | + | * launch the console: |
: <tt>dynamo</tt> | : <tt>dynamo</tt> | ||
=== Creating a remote ''Dynamo'' computing shell === | === Creating a remote ''Dynamo'' computing shell === | ||
* <tt>ssh</tt> to <tt>daint</tt> (in a different shell) | * <tt>ssh</tt> to <tt>daint</tt> (in a different shell) | ||
− | * request an interactive session | + | * request an interactive session: |
: <tt>salloc --gres=gpu:1</tt> | : <tt>salloc --gres=gpu:1</tt> | ||
− | * enable the CUDA environment | + | * Remark: during the course we should have a reservation for priority use of the nodes. In theory you should be able to use the syntax: |
+ | : <tt>salloc --gres=gpu:1 --reservation=gpu --time=04:00:00</tt> | ||
+ | : should allocate a session of uninterrumpted GPU usage for 4 hours. | ||
+ | * enable the CUDA environment: | ||
: <tt>module load cudatoolkit</tt> | : <tt>module load cudatoolkit</tt> | ||
* optional: check that the environment "sees" the gpu: | * optional: check that the environment "sees" the gpu: | ||
− | : srun nvidia-smi | + | : <tt>srun nvidia-smi</tt> |
* activate ''Dynamo'' in the shell | * activate ''Dynamo'' in the shell | ||
− | : <tt>source /users/courseXX/dynamo/ | + | : <tt>source /users/courseXX/dynamo/dynamo_activate_linux_shipped_MCR.sh</tt> |
==Exercises== | ==Exercises== | ||
Line 52: | Line 56: | ||
* open a ''Dynamo'' [[Dynamo console|console]] by typing: | * open a ''Dynamo'' [[Dynamo console|console]] by typing: | ||
: <tt> dynamo </tt> | : <tt> dynamo </tt> | ||
− | in a linux shell (you'll need to source ''Dynamo'' activation script on that shell beforehand). | + | : in a linux shell (you'll need to source ''Dynamo'' activation script on that shell beforehand). |
* create a tutorial project. For this, type inside the ''Dynamo'' console: | * create a tutorial project. For this, type inside the ''Dynamo'' console: | ||
: <tt> dtutorial myTest -p ptest -M 128</tt> | : <tt> dtutorial myTest -p ptest -M 128</tt> | ||
Line 60: | Line 64: | ||
: <tt> dvunfold ptest</tt> inside the ''Dynamo'' [[Dynamo console | '''console''']] | : <tt> dvunfold ptest</tt> inside the ''Dynamo'' [[Dynamo console | '''console''']] | ||
* run the project with <tt>srun</tt> in a ''computing shell'' | * run the project with <tt>srun</tt> in a ''computing shell'' | ||
− | : <tt> srun ptest | + | : <tt> srun dynamo_execute_project ptest</tt> in a '''terminal shell''', i.e., '''not''' inside the ''Dynamo'' console |
+ | : It can take a long time for starting the project, as it needs to awaken the MCR libraries. After this initial latency, there is no additional overhead for the use of the standalone. | ||
+ | : <tt> srun </tt> its a syntax required by CSCS: all commands that will talk to a GPU need to be preceded by this routing command. | ||
+ | : the syntax <tt>dynamo_execute_project <projectname></tt> is non-standard just for this exercise. | ||
+ | * while the project is running in ''computing shell'', you can check its progress in the ''console shell'' by: | ||
+ | : <tt>dvstatus ptest</tt> | ||
* when it finishes, the averages can be also accessed programmatically with the database tool. For instance, to access the last computed average and view it with <tt>dview</tt>, type: | * when it finishes, the averages can be also accessed programmatically with the database tool. For instance, to access the last computed average and view it with <tt>dview</tt>, type: | ||
: <tt> ddb ptest:a -v</tt> | : <tt> ddb ptest:a -v</tt> | ||
Line 77: | Line 86: | ||
;On CSCS, | ;On CSCS, | ||
# type <br /><tt>salloc --gres=gpu:1</tt> <br /> to get a node with a gpu. It can take some time till the system allocates you a node. You can allocate up to two nodes. <br /> you can check the GPU on your node by: <br /> <tt>srun nvidia-smi</tt> | # type <br /><tt>salloc --gres=gpu:1</tt> <br /> to get a node with a gpu. It can take some time till the system allocates you a node. You can allocate up to two nodes. <br /> you can check the GPU on your node by: <br /> <tt>srun nvidia-smi</tt> | ||
− | # type <br /><tt>source ~/ | + | # type <br /><tt>source ~/dynamo/dynamo_activate_linux_shipped_MCR.sh</tt><br /> to activate ''Dynamo'' in your shell. |
#open ''Dynamo'' with <tt>dynamo &</tt> | #open ''Dynamo'' with <tt>dynamo &</tt> | ||
#open your project, and re-unfold it (make sure standalone GPU is selected and make sure your data is in the same relative location as on the local machine) | #open your project, and re-unfold it (make sure standalone GPU is selected and make sure your data is in the same relative location as on the local machine) | ||
#: ''Note'' | #: ''Note'' | ||
#: if the graphical interface is too slow, you can use the command line instead: | #: if the graphical interface is too slow, you can use the command line instead: | ||
− | #: open a ''Dynamo'' console in your shell with <tt>dynamo | + | #: open a ''Dynamo'' console in your shell with <tt>dynamo</tt> |
− | #: <tt>dvput my_project -destination | + | #: <tt>dvput my_project -data dataFolderInRemoteHost </tt> |
+ | #: <tt>dvput my_project -destination matlab_gpu</tt> | ||
#: <tt>dvunfold my_project</tt> | #: <tt>dvunfold my_project</tt> | ||
− | #run your alignment by typing <tt>srun my_project | + | #run your alignment by typing <tt>srun dynamo_execute_project my_project</tt> |
− | |||
− | |||
Latest revision as of 08:58, 31 August 2016
CSCS in Lugano is the Swiss Nacional Supercomputing Centre. CSCS kindly provides the EMBO course with 20 accounts. Each account should be able to submit jobs to a single node connected to a K20 GPU and four CPU cores.
Contents
Connecting with CSCS
First you need to connect to the gate node ela using your cscs credentials from the credentials handout.
ssh -Y course27@ela.cscs.ch
and then you can connect to the computing machine called daint, again you will be requested to type in your credentials.
course27@ela2:~> ssh -Y daint
Installing Dynamo
An installation is ready in the account course27. Just copy it onto your own account.
scp -r /users/course27/dynamo ~
Afterwards you will be able to activate Dynamo in your linux session by:
source /users/courseXX/dynamo/dynamo_activate_linux_shipped_MCR.sh
Please place your account number instead of the placeholder XX!
Using Dynamo
We are using a slightly older version of Dynamo on the supercomputer GPUs for compatibility reasons.
In a remote machine, things run differently: computing power is orders of magnitude higher, at the price of interfaces running slower and Matlab normally not being available. This makes the way you interact with Dynamo slightly more complicated. Commandline management of projects is often a more efficient way than using GUIs. We recommend to use two shells in the remote machine.
- One remote shell is used to open a Dynamo console.
In this shell, we can create and manage projects, inspect files, even show moderately complex graphics. We call this the console shell. In this console shell, we don't have don't need to have access to a GPU.
- Another the shell is used for number crunching, we call it a computing shell. This needs to "see" the GPU.
Creating a remote Dynamo console
- ssh to daint
- activate Dynamo in the shell:
- source /users/courseXX/dynamo/dynamo_activate_linux_shipped_MCR.sh
- launch the console:
- dynamo
Creating a remote Dynamo computing shell
- ssh to daint (in a different shell)
- request an interactive session:
- salloc --gres=gpu:1
- Remark: during the course we should have a reservation for priority use of the nodes. In theory you should be able to use the syntax:
- salloc --gres=gpu:1 --reservation=gpu --time=04:00:00
- should allocate a session of uninterrumpted GPU usage for 4 hours.
- enable the CUDA environment:
- module load cudatoolkit
- optional: check that the environment "sees" the gpu:
- srun nvidia-smi
- activate Dynamo in the shell
- source /users/courseXX/dynamo/dynamo_activate_linux_shipped_MCR.sh
Exercises
Exercise 1: Creating tutorial projects
We can use the system terminal as an equivalent of the Matlab terminal using the Dynamo standalone. This is an example on how to use it to create a phantom project like the one we did yesterday.
- open a Dynamo console by typing:
- dynamo
- in a linux shell (you'll need to source Dynamo activation script on that shell beforehand).
- create a tutorial project. For this, type inside the Dynamo console:
- dtutorial myTest -p ptest -M 128
- tune the project to work in a GPU
- dvput ptest -destination matlab_gpu
- unfold the project
- dvunfold ptest inside the Dynamo console
- run the project with srun in a computing shell
- srun dynamo_execute_project ptest in a terminal shell, i.e., not inside the Dynamo console
- It can take a long time for starting the project, as it needs to awaken the MCR libraries. After this initial latency, there is no additional overhead for the use of the standalone.
- srun its a syntax required by CSCS: all commands that will talk to a GPU need to be preceded by this routing command.
- the syntax dynamo_execute_project <projectname> is non-standard just for this exercise.
- while the project is running in computing shell, you can check its progress in the console shell by:
- dvstatus ptest
- when it finishes, the averages can be also accessed programmatically with the database tool. For instance, to access the last computed average and view it with dview, type:
- ddb ptest:a -v
Exercise 2: Transferring projects
In this example, we show how to transfer a project from a local machine into the remote system, by Dynamo-tarring a project in a local machine, copying it into a remote machine and untarring it there.
- On the local machine
- tar your project in Dynamo (in Dynamo wizard >> Tools >> Create a tarball
- rsync -avr my_project.tar stud##@ela.cscs.ch:~/
- Also rsync your data to CSCS
- Untar your Dynamo project
- You will need the Dynamo terminal for this:
- dynamo &
- dvuntar myProject
- On CSCS,
- type
salloc --gres=gpu:1
to get a node with a gpu. It can take some time till the system allocates you a node. You can allocate up to two nodes.
you can check the GPU on your node by:
srun nvidia-smi - type
source ~/dynamo/dynamo_activate_linux_shipped_MCR.sh
to activate Dynamo in your shell. - open Dynamo with dynamo &
- open your project, and re-unfold it (make sure standalone GPU is selected and make sure your data is in the same relative location as on the local machine)
- Note
- if the graphical interface is too slow, you can use the command line instead:
- open a Dynamo console in your shell with dynamo
- dvput my_project -data dataFolderInRemoteHost
- dvput my_project -destination matlab_gpu
- dvunfold my_project
- run your alignment by typing srun dynamo_execute_project my_project
Note about performance
You will notice that the project stops at several points during execution. Those are the points where the project accesses the MCR libraries. This overhead is a constant, and is a very small fraction of the computing time for a real project with thousands of particles.
We are using an old Dynamo version. Modern Dynamo versions don't access the MCR library several times.