Testing With Graphics
If you need to use graphics while testing your code, e.g., when using a debugger such as DDT or DDD, you have the following options:
Use the debugjob command¶
- You can use the
debugjobcommand which automatically provides X-forwarding support.
$ ssh niagara.scinet.utoronto.ca -X
USER@nia-login07:~$ debugjob
debugjob: Requesting 1 nodes for 60 minutes
xalloc: Granted job allocation 189857
xalloc: Waiting for resource configuration
xalloc: Nodes nia0030 are ready for job
[USER@nia1265 ~]$
Use the regular queue¶
Note
If debugjob is not suitable for your case due to the limitations either on time or resources (see above Testing), then you have to follow these steps:
You will need two terminals in order to achieve this:
- In the first terminal:
- SSH to
niagara.scinet.utoronto.caand issue yoursalloccommand. - Wait until your resources are allocated and you are assigned the nodes.
- Take note of the node where you are logged into, i.e., the head node. Let's say
niaWXYZ.
- SSH to
$ ssh niagara.scinet.utoronto.ca
USER@nia-login07:~$ salloc --nodes 5 --time=2:00:00
.salloc: Granted job allocation 141862
.salloc: Waiting for resource configuration
.salloc: Nodes nia1265 are ready for job
[USER@nia1265 ~]$
- On the second terminal:
- SSH into
niagara.scinet.utoronto.canow using the-Xflag in the SSH command. - After that,
ssh -X niaWXYZ, i.e., you will SSH carrying on the-Xflag into the head node of the job. - In
niaWXYZ, you should be able to use graphics and should be redirected by X-forwarding to your local terminal.
- SSH into
ssh niagara.scinet.utoronto.ca -X
USER@nia-login07:~$ ssh -X nia1265
[USER@nia1265 ~]$ xclock ## just an example to test the graphics; a clock should pop up. Close it to exit.
[USER@nia1265 ~]$ module load ddt ## load corresponding modules, e.g., for DDT
[USER@nia1265 ~]$ ddt ## launch DDT; the GUI should appear on your screen
Observations
- If you are using SSH from a Windows machine, you need to have an X-server. A good option is to use MobaXterm, which already includes an X-server.
- If you are on Mac OS, substitute
-Xwith-Y. - Instead of using two terminals, you could just use
screento request the resources and then detach the session and SSH into the head node directly.