Testing With Graphics: Difference between revisions

From SciNet Users Documentation
Jump to navigation Jump to search
Created page with "== Testing with Graphics: X-forwarding == 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:..."
 
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Testing with Graphics: X-forwarding ==
If you need to use graphics while testing your code on a Niagara compute node, e.g. when using a debugger such as [[Parallel Debugging with DDT|DDT]] or DDD, you have the following options.
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:


<ul>
= Use the debugjob command =
<li> You can use the <code>debugjob</code> command which automatically provides X-forwarding support.
You can use the <code>debugjob</code> command, which automatically provides X-forwarding support.
<source lang="bash">
$ ssh  niagara.scinet.utoronto.ca -X
$ ssh  niagara.scinet.utoronto.ca -X
USER@nia-login07:~$ debugjob
 
debugjob: Requesting 1 nodes for 60 minutes
USER@nia-login07:~$ debugjob
salloc: Granted job allocation 189857
debugjob: Requesting 1 nodes for 60 minutes
salloc: Waiting for resource configuration
xalloc: Granted job allocation 189857
salloc: Nodes nia0030 are ready for job
xalloc: Waiting for resource configuration
[USER@nia1265 ~]$
xalloc: Nodes nia0030 are ready for job
 
[USER@nia1265 ~]$
</source>


<li> If <code>debugjob</code> 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:
= Use the regular queue =
 
If <code>debugjob</code> is not suitable for your case due to the limitations either on time or resources (see [[Niagara_Quickstart#Testing_and_Debugging | Testing and Debugging]]), then you can use the <tt>salloc</tt> command with the <tt>--x11</tt> option. For instance
You will need two terminals in order to achieve this:
<!-- must follow these steps.  You will need two terminals in order to achieve this:
<ol>
<ol>
<li>In the 1st terminal
<li> In the 1st terminal:
<ul>
<ul>
<li> ssh to <code>niagara.scinet.utoronto.ca</code> and issue your <code>salloc</code> command
<li> ssh to <code>niagara.scinet.utoronto.ca</code> and issue your <code>salloc</code> command
Line 26: Line 21:
<li> take note of the node where you are logged to, ie. the head node, let's say <code>niaWXYZ</code>
<li> take note of the node where you are logged to, ie. the head node, let's say <code>niaWXYZ</code>
</ul>
</ul>
<source lang="bash">
-->
$ ssh niagara.scinet.utoronto.ca
$ ssh -Y niagara.scinet.utoronto.ca
USER@nia-login07:~$ salloc --nodes 5 --time=2:00:00
USER@nia-login07:~$ salloc --nodes 5 --time=2:00:00 --x11
 
salloc: Granted job allocation 141862
.salloc: Granted job allocation 141862
salloc: Waiting for resource configuration
.salloc: Waiting for resource configuration
salloc: Nodes nia[1265-1271] are ready for job
.salloc: Nodes nia1265 are ready for job
[USER@nia1265 ~]$
 
<!--
[USER@nia1265 ~]$
<li> In the second terminal:
</source>
 
<li> On the second terminal:
<ul>
<ul>
<li> ssh into <code>niagara.scinet.utoronto.ca</code> now using the <code>-X</code> flag in the ssh command
<li> ssh into <code>niagara.scinet.utoronto.ca</code> now using the <code>-X</code> flag in the ssh command.
 
<li> After that, <code>ssh -X niaWXYZ</code>, ie. you will ssh carrying on the '-X' flag into the head node of the job.
<li> after that <code>ssh -X niaWXYZ</code>, ie. you will ssh carrying on the '-X' flag into the head node of the job
<li> In the <code>niaWXYZ</code> you should be able to use graphics and should be redirected by X-forwarding to your local terminal.
 
<li> in the <code>niaWXYZ</code> you should be able to use graphics and should be redirected by x-forwarding to your local terminal
</ul>
 
<source lang="bash">
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, eg. for DDT
[USER@nia1265 ~]$ ddt  ## launch DDT, the GUI should appear in your screen
</source>
 
</ol>
</ul>
</ul>
 
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, eg. for DDT
[USER@nia1265 ~]$ ddt  ## launch DDT, the GUI should appear in your screen
<!--</ol>-->


Observations:
Observations:
<ul>
<ul>
<li> If you are using ssh from a Windows machine, you need to have an X-server, a good option is to use MobaXterm, that already brings an X-server included.
<li> If you are using [[SSH]] from a Windows machine, you need to have an X-server, a good option is to use MobaXterm, that already brings an X-server included.  See the [[SSH#SSH_for_Windows_Users | Windows SSH entry]] for other options.
<li> If you are in Mac OS, substitute -X by -Y
<li> In some case you can substitute -Y by -X, but this may cause the X display to unexpectedly be disconnected.  
<li> Instead of using two terminals, you could just use <code>screen</code> to request the resources and then detach the session and ssh into the head node directly.
<!--<li> If you are in Mac OS, substitute -X by -Y
<li> Instead of using two terminals, you could just use <code>screen</code> to request the resources and then detach the session and ssh into the head node directly.-->
</ul>
</ul>

Latest revision as of 13:46, 31 July 2019

If you need to use graphics while testing your code on a Niagara compute node, e.g. when using a debugger such as DDT or DDD, you have the following options.

Use the debugjob command

You can use the debugjob command, which automatically provides X-forwarding support.

$ ssh  niagara.scinet.utoronto.ca -X
USER@nia-login07:~$ debugjob
debugjob: Requesting 1 nodes for 60 minutes
salloc: Granted job allocation 189857
salloc: Waiting for resource configuration
salloc: Nodes nia0030 are ready for job
[USER@nia1265 ~]$

Use the regular queue

If debugjob is not suitable for your case due to the limitations either on time or resources (see Testing and Debugging), then you can use the salloc command with the --x11 option. For instance

$ ssh -Y niagara.scinet.utoronto.ca
USER@nia-login07:~$ salloc --nodes 5 --time=2:00:00 --x11
salloc: Granted job allocation 141862
salloc: Waiting for resource configuration
salloc: Nodes nia[1265-1271] are ready for job
[USER@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, eg. for DDT
[USER@nia1265 ~]$ ddt  ## launch DDT, the GUI should appear in 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, that already brings an X-server included. See the Windows SSH entry for other options.
  • In some case you can substitute -Y by -X, but this may cause the X display to unexpectedly be disconnected.