Difference between revisions of "GUI Programs"

From UFRC
Jump to navigation Jump to search
m
Line 1: Line 1:
 
[[Category:Software]]
 
[[Category:Software]]
  
Xpra Client installation and connection instructions.
+
{{HPG2}}
 +
=Xpra Links =
  
=Xpra Documentation=
 
  
 
*Xpra Homepage: https://xpra.org/
 
*Xpra Homepage: https://xpra.org/
Line 31: Line 31:
 
==Windows==
 
==Windows==
 
===XP and Newer===
 
===XP and Newer===
Download and install MS Windows files: from [https://xpra.org/ https://xpra.org/], Installer file can be found at [https://xpra.org/dists/windows/Xpra_Setup.exe https://xpra.org/dists/windows/Xpra_Setup.exe].
+
Download and install MS Windows files: from [https://xpra.org/ https://xpra.org/], Installer file can be found at [https://xpra.org/dists/windows/Xpra_Setup.exe https://xpra.org/dists/windows/Xpra_Setup.exe]. Note that installation will require an account with Admin privileges.
  
= Step 2: Start software under Xpra on UFRC side=
+
==MAC OS==
Start application under xpra on one of the HPC interactive job nodes (gui1 for example) where $USER represents your username, $PORT is the desired X11 port, and $EXE is the executable you want to start, with full path if needed.
+
===OS X 10.5 and Newer===
 +
Download and install MAC installer files: from [https://xpra.org/ https://xpra.org/], Installer file can be found at [https://xpra.org/dists/osx/x86/Xpra.dmg https://xpra.org/dists/osx/x86/Xpra.dmg]. Note that installation will require an account with Admin privileges.
 +
 
 +
=Step 2: Starting your application on HiPerGator2=
 +
 
 +
Xpra allows you to connect to your GUI application, running on HiPerGator2, with you local machine client.  Xpra sessions can be launched either from an interactive session or using a job submission script.  Both Xpra job submission types run the Xpra command with a common form. 
 +
 
 +
To start an application under Xpra where $USER represents your GatorLink user-name, $PORT is the desired X11 port, and $EXE is the executable you want to start, use a command in the form of:
  
 
xpra start :{$PORT} --start-child={$EXE} --exit-with-children
 
xpra start :{$PORT} --start-child={$EXE} --exit-with-children
  
;Example:
+
;For example:
  xpra start :123 --start-child=gedit --exit-with-children
+
  xpra start :143 --start-child=gedit --exit-with-children
 +
 
 +
This command can be launched interactively or from a job submission script and other options are available. These options can be reviewed by running the "man xpra" command from the terminal of an interactive development session on the GUI partition. 
 +
 
 +
== Manual Start-up ==
 +
Start MatLab as a Xpra child process manually from inside srun controlled dev session.
 +
 
 +
<pre>
 +
[testuser@gator4 ~]$ srun -p gui --time=04:00:00 --pty -u bash -i   
 +
srun: job 423867 queued and waiting for resources
 +
srun: job 423867 has been allocated resources
 +
[testuser@i21a-s3 ~]$ xpra start :243 --start-child=~/bin/matlab.sh --exit-with-children --dpi=96
 +
[testuser@i21a-s3 ~]$ Entering daemon mode; any further errors will be reported to:
 +
  /home/testuser/.xpra/:243.log
 +
</pre>
 +
 
 +
For clarity, ~/bin/matlab.sh is a matlab start-up script to force the desktop version and not the terminal version:
 +
 
 +
<pre>
 +
[testuser@dev1 bin]$ cat matlab.sh
 +
#!/bin/bash
 +
 
 +
module load matlab;
 +
matlab -nosplash -desktop;
 +
</pre>
 +
 
 +
== Scripted Job submission ==
 +
Start MatLab via job submission script on the GUI partition of HPG2 and connect via Xpra.
 +
 
 +
;Job submission script example
 +
<pre>
 +
[testuser@gator4 ufrc-tests]$ cat matlab-xpra-slurm.sh
 +
#!/bin/bash
 +
#SBATCH --job-name="HPC Matlab Test"
 +
#SBATCH --mail-user="jstrds@ufl.edu"
 +
#SBATCH --mail-type=ALL
 +
#SBATCH --output matlab-%j.out
 +
#SBATCH --error matlab-%j.err
 +
#SBATCH --partition=gui
 +
#SBATCH --ntasks=1
 +
#SBATCH --mem-per-cpu=2G
 +
#SBATCH --time=02:00:00
 +
#SBATCH --account=ufhpc
 +
#SBATCH --qos=ufhpc
 +
 
 +
#By: Justin Richardson (jstrds@ufl.edu)
 +
#Version:1.0.2
 +
 
 +
date; hostname; pwd;
 +
 
 +
#Trapping SIGTERM for clean shutdown
 +
trap "echo Job timeout reached; xpra stop :143; exit" SIGTERM
 +
 
 +
#Starting matlab program in xpra
 +
module load matlab;
 +
xpra start :143 --start-child=/home/jstrds/bin/matlab.sh --exit-with-children --dpi=76
 +
 
 +
#Wait for interactive session to end
 +
sleep 125m &
 +
wait ${1}
 +
</pre>
 +
 
 +
;Launched with:
 +
<pre>
 +
[testuser@gator4 ufrc-tests]$ sbatch matlab-xpra-slurm.sh
 +
Submitted batch job 424296
 +
[testuser@gator4 ufrc-tests]$ scontrol show job 424296
 +
JobId=424296 JobName=HPC Matlab Test
 +
  UserId=jstrds(43535) GroupId=ufhpc(1000)
 +
  Priority=5999 Nice=0 Account=ufhpc QOS=ufhpc
 +
  JobState=RUNNING Reason=None Dependency=(null)
 +
  Requeue=0 Restarts=0 BatchFlag=1 Reboot=0 ExitCode=0:0
 +
  RunTime=00:00:22 TimeLimit=02:00:00 TimeMin=N/A
 +
  SubmitTime=2016-07-05T11:14:30 EligibleTime=2016-07-05T11:14:30
 +
  StartTime=2016-07-05T11:14:31 EndTime=2016-07-05T13:14:31
 +
  PreemptTime=None SuspendTime=None SecsPreSuspend=0
 +
  Partition=gui AllocNode:Sid=gator4:19405
 +
  ReqNodeList=(null) ExcNodeList=(null)
 +
  NodeList=i21a-s3
 +
  BatchHost=i21a-s3
 +
  NumNodes=1 NumCPUs=1 CPUs/Task=1 ReqB:S:C:T=0:0:*:*
 +
  TRES=cpu=1,mem=2048,node=1
 +
  Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=*
 +
  MinCPUsNode=1 MinMemoryCPU=2G MinTmpDiskNode=0
 +
  Features=(null) Gres=(null) Reservation=(null)
 +
  Shared=OK Contiguous=0 Licenses=(null) Network=(null)
 +
  Command=/home/jstrds/ufrc-tests/matlab-xpra-slurm.sh
 +
  WorkDir=/home/jstrds/ufrc-tests
 +
  StdErr=/home/jstrds/ufrc-tests/matlab-424296.err
 +
  StdIn=/dev/null
 +
  StdOut=/home/jstrds/ufrc-tests/matlab-424296.out
 +
  Power= SICP=0
 +
</pre>
  
 
=Step 3: Connect to Xpra Session from the client side=
 
=Step 3: Connect to Xpra Session from the client side=
==Linux==
+
==Linux:==
Xpra is typically automatically added to your path during installation, so you can connect to your running xpra instance using the following syntax where $USERNAME is your UF Research Computing username, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
+
Xpra is typically automatically added to your path during installation, so you can connect to your running xpra instance using the following syntax where $USERNAME is your UF GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
  
 
  xpra attach ssh:$USERNAME@$SERVERNAME:$PORT
 
  xpra attach ssh:$USERNAME@$SERVERNAME:$PORT
  
;Example:
+
As an example:
xpra attach ssh:testuser@gui1.rc.ufl.edu:123
+
<pre>
 +
testuser@jr-physics:~$ xpra attach ssh:testuser@i21a-s3.rc.ufl.edu:143 --desktop-scaling=on --dpi=96
 +
</pre>
 +
 
 +
[[File:Hpg2-gui-matlab2.png|thumbnail|center|MatLab running via Xpra under slurm]]
 +
 
 +
==MAC OS:==
 +
Navigate to the folder that contains the xpra executable:
 +
<pre>
 +
cd /Applications/Xpra.app/Contents/MacOS
 +
</pre>
 +
 
 +
Second, connect to your running xpra instance using the following syntax where $USERNAME is your GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
 +
<pre>
 +
./Xpra attach ssh:$USERNAME@$SERVERNAME:$PORT
 +
</pre>
 +
 
 +
Example:
 +
<pre>
 +
./Xpra attach ssh:test-user@i21a-s3.rc.ufl.edu:143 --desktop-scaling=on --dpi=96
 +
</pre>
  
==Windows==
+
==Microsoft Windows==
 
First, navigate to the install location of xpra (normally C:\Program Files (x86)\Xpra\).   
 
First, navigate to the install location of xpra (normally C:\Program Files (x86)\Xpra\).   
 
;In MobaXterm:
 
;In MobaXterm:
 
  cd /drives/c/Progam\ Files\ \(x86\)/Xpra/
 
  cd /drives/c/Progam\ Files\ \(x86\)/Xpra/
  
Second, connect to your running xpra instance using the following syntax where $USERNAME is your UF Research Computing username, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
+
Second, connect to your running xpra instance using the following syntax where $USERNAME is your GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
  
 
  ./xpra attach ssh:$USERNAME@$SERVERNAME:$PORT
 
  ./xpra attach ssh:$USERNAME@$SERVERNAME:$PORT
Line 61: Line 180:
 
;Example:
 
;Example:
  
  ./xpra attach ssh:testuser@gui1.rc.ufl.edu:123
+
<pre>
 +
  ./xpra attach ssh:testuser@i21a-s3.rc.ufl.edu:143 --desktop-scaling=on --dpi=96
 +
</pre>
 +
 
 +
[[File:Hpg2-gui-matlab-win.png|thumbnail|center|MatLab running via Xpra under slurm]]
  
 
;NOTE: If you close the window using the close button, this will exit your application just like a native application.  If you want to simply detach the session and come back later, please follow the ''detaching xpra session'' instructions below
 
;NOTE: If you close the window using the close button, this will exit your application just like a native application.  If you want to simply detach the session and come back later, please follow the ''detaching xpra session'' instructions below
Line 68: Line 191:
 
These instructions allow you to detach a running xpra client without closing the application.
 
These instructions allow you to detach a running xpra client without closing the application.
  
==Linux==
+
==Linux and MAC OS==
 
In the original terminal where you activated the client, simply press Control-C to detach the session.
 
In the original terminal where you activated the client, simply press Control-C to detach the session.
  
 
<pre>
 
<pre>
2016-04-06 15:18:17,173 Attached to ssh:testuser@gui1.rc.ufl.edu:123 (press Control-C to detach)
+
2016-04-06 15:18:17,173 Attached to ssh:testuser@i21a-s3.rc.ufl.edu:143 (press Control-C to detach)
 
^C
 
^C
 
got signal SIGINT, exiting
 
got signal SIGINT, exiting
Line 78: Line 201:
 
</pre>
 
</pre>
  
You can re-attach to the running application using the ''xpra attach' command as described in the instructions above.
+
You can re-attach to the running application using the ''xpra attach'' command as described in the instructions above.
  
 
==Windows==
 
==Windows==
 
* Start a new console and navigate to the xpra directory as shown above.
 
* Start a new console and navigate to the xpra directory as shown above.
* Run the following command where $USERNAME is your UF Research Computing username, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
+
* Run the following command where $USERNAME is your UF GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
  
 
  ./xpra detach ssh:$USERNAME@$SERVERNAME:$PORT
 
  ./xpra detach ssh:$USERNAME@$SERVERNAME:$PORT
Line 89: Line 212:
 
<pre>
 
<pre>
 
cd "C:\Program Files (x86)\Xpra"
 
cd "C:\Program Files (x86)\Xpra"
./xpra detach ssh:testuser@gui1.rc.ufl.edu:123
+
./xpra detach ssh:testuser@i21a-s3.rc.ufl.edu:143
 
</pre>
 
</pre>
  
 
;Note: If you are using mobaXterm, you can press Control-C in the mobaXterm window to detach, just like using the Linux client.
 
;Note: If you are using mobaXterm, you can press Control-C in the mobaXterm window to detach, just like using the Linux client.
 +
 +
=Startup Scripts=
 +
Some applications that require key command line parameters for launching, are more convienent to wrap with a startup script.  Here is an annotated version and some application examples.  The executable file can be downloaded here: [[File:matlab-launch.sh.txt| matlab-launch.sh]]
 +
 +
==Matlab Example==
 +
The first line of the launch script should set which shell type to use.  On HiPerGator systems, the default shell is bash.
 +
<pre>
 +
#!/bin/bash
 +
</pre>
 +
 +
Next, load the modules required for the application:
 +
<pre>
 +
module load matlab;
 +
</pre>
 +
 +
Finally, enter the launch command for the GUI application:
 +
<pre>
 +
matlab -nosplash -desktop
 +
</pre>
 +
 +
Once the script is saved, you will need to make it executable to run as an application wrapper.  This can be done with the "chmod" command:
 +
<pre>
 +
[testuser@gator3 ~]$ chmod u+x matlab-launch.sh
 +
</pre>
 +
 +
Below are some other application launch script examples:
 +
==Other Examples==
 +
===MZmine===
 +
<pre>
 +
#!/bin/bash
 +
module load mzmine;
 +
startMZmine_Linux.sh;
 +
</pre>
 +
 +
MZmine with 8GB of memory:
 +
<pre>
 +
#!/bin/bash
 +
 +
module load mzmine
 +
 +
export _JAVA_OPTIONS="-Xmx8g"
 +
 +
startMZmine_Linux.sh
 +
</pre>
 +
 +
===Rstudio===
 +
<pre>
 +
#!/bin/bash
 +
 +
module load gui rstudio;
 +
rstudio;
 +
</pre>
 +
 +
 +
===Other tested applications===
 +
;trackvis
 +
Notes: Application window appears correctly, waiting on license key in inital window
 +
 +
;xterm
 +
Notes: Works as expected
 +
 +
 +
;End current Xpra documentation slated for wiki

Revision as of 18:12, 15 July 2016

Hpg2 wiki logo.png

HiPerGator 2.0 documentation

Xpra Links

Step 1: Client Installation

Xpra client installation depends on what operating system is running on your local machine.

Linux

The recommended option is to use the distribution specific packages if possible:

Ubuntu/Debian

sudo apt-get install xpra

CentOS/RHEL

sudo su -
rpm --import https://winswitch.org/gpg.asc
cd /etc/yum.repos.d/
curl -O https://winswitch.org/downloads/CentOS/winswitch.repo
yum install xpra

Windows

XP and Newer

Download and install MS Windows files: from https://xpra.org/, Installer file can be found at https://xpra.org/dists/windows/Xpra_Setup.exe. Note that installation will require an account with Admin privileges.

MAC OS

OS X 10.5 and Newer

Download and install MAC installer files: from https://xpra.org/, Installer file can be found at https://xpra.org/dists/osx/x86/Xpra.dmg. Note that installation will require an account with Admin privileges.

Step 2: Starting your application on HiPerGator2

Xpra allows you to connect to your GUI application, running on HiPerGator2, with you local machine client. Xpra sessions can be launched either from an interactive session or using a job submission script. Both Xpra job submission types run the Xpra command with a common form.

To start an application under Xpra where $USER represents your GatorLink user-name, $PORT is the desired X11 port, and $EXE is the executable you want to start, use a command in the form of:

xpra start :{$PORT} --start-child={$EXE} --exit-with-children

For example
xpra start :143 --start-child=gedit --exit-with-children

This command can be launched interactively or from a job submission script and other options are available. These options can be reviewed by running the "man xpra" command from the terminal of an interactive development session on the GUI partition.

Manual Start-up

Start MatLab as a Xpra child process manually from inside srun controlled dev session.

[testuser@gator4 ~]$ srun -p gui --time=04:00:00 --pty -u bash -i     
srun: job 423867 queued and waiting for resources
srun: job 423867 has been allocated resources
[testuser@i21a-s3 ~]$ xpra start :243 --start-child=~/bin/matlab.sh --exit-with-children --dpi=96
[testuser@i21a-s3 ~]$ Entering daemon mode; any further errors will be reported to:
  /home/testuser/.xpra/:243.log

For clarity, ~/bin/matlab.sh is a matlab start-up script to force the desktop version and not the terminal version:

[testuser@dev1 bin]$ cat matlab.sh 
#!/bin/bash

module load matlab;
matlab -nosplash -desktop;

Scripted Job submission

Start MatLab via job submission script on the GUI partition of HPG2 and connect via Xpra.

Job submission script example
[testuser@gator4 ufrc-tests]$ cat matlab-xpra-slurm.sh 
#!/bin/bash
#SBATCH --job-name="HPC Matlab Test"
#SBATCH --mail-user="jstrds@ufl.edu"
#SBATCH --mail-type=ALL
#SBATCH --output matlab-%j.out
#SBATCH --error matlab-%j.err
#SBATCH --partition=gui
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=2G
#SBATCH --time=02:00:00
#SBATCH --account=ufhpc
#SBATCH --qos=ufhpc

#By: Justin Richardson (jstrds@ufl.edu)
#Version:1.0.2

date; hostname; pwd;

#Trapping SIGTERM for clean shutdown
trap "echo Job timeout reached; xpra stop :143; exit" SIGTERM

#Starting matlab program in xpra
module load matlab;
xpra start :143 --start-child=/home/jstrds/bin/matlab.sh --exit-with-children --dpi=76

#Wait for interactive session to end
sleep 125m &
wait ${1}
Launched with
[testuser@gator4 ufrc-tests]$ sbatch matlab-xpra-slurm.sh 
Submitted batch job 424296
[testuser@gator4 ufrc-tests]$ scontrol show job 424296
JobId=424296 JobName=HPC Matlab Test
   UserId=jstrds(43535) GroupId=ufhpc(1000)
   Priority=5999 Nice=0 Account=ufhpc QOS=ufhpc
   JobState=RUNNING Reason=None Dependency=(null)
   Requeue=0 Restarts=0 BatchFlag=1 Reboot=0 ExitCode=0:0
   RunTime=00:00:22 TimeLimit=02:00:00 TimeMin=N/A
   SubmitTime=2016-07-05T11:14:30 EligibleTime=2016-07-05T11:14:30
   StartTime=2016-07-05T11:14:31 EndTime=2016-07-05T13:14:31
   PreemptTime=None SuspendTime=None SecsPreSuspend=0
   Partition=gui AllocNode:Sid=gator4:19405
   ReqNodeList=(null) ExcNodeList=(null)
   NodeList=i21a-s3
   BatchHost=i21a-s3
   NumNodes=1 NumCPUs=1 CPUs/Task=1 ReqB:S:C:T=0:0:*:*
   TRES=cpu=1,mem=2048,node=1
   Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=*
   MinCPUsNode=1 MinMemoryCPU=2G MinTmpDiskNode=0
   Features=(null) Gres=(null) Reservation=(null)
   Shared=OK Contiguous=0 Licenses=(null) Network=(null)
   Command=/home/jstrds/ufrc-tests/matlab-xpra-slurm.sh
   WorkDir=/home/jstrds/ufrc-tests
   StdErr=/home/jstrds/ufrc-tests/matlab-424296.err
   StdIn=/dev/null
   StdOut=/home/jstrds/ufrc-tests/matlab-424296.out
   Power= SICP=0

Step 3: Connect to Xpra Session from the client side

Linux:

Xpra is typically automatically added to your path during installation, so you can connect to your running xpra instance using the following syntax where $USERNAME is your UF GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.

xpra attach ssh:$USERNAME@$SERVERNAME:$PORT

As an example:

testuser@jr-physics:~$ xpra attach ssh:testuser@i21a-s3.rc.ufl.edu:143 --desktop-scaling=on --dpi=96
MatLab running via Xpra under slurm

MAC OS:

Navigate to the folder that contains the xpra executable:

cd /Applications/Xpra.app/Contents/MacOS

Second, connect to your running xpra instance using the following syntax where $USERNAME is your GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.

./Xpra attach ssh:$USERNAME@$SERVERNAME:$PORT

Example:

./Xpra attach ssh:test-user@i21a-s3.rc.ufl.edu:143 --desktop-scaling=on --dpi=96

Microsoft Windows

First, navigate to the install location of xpra (normally C:\Program Files (x86)\Xpra\).

In MobaXterm
cd /drives/c/Progam\ Files\ \(x86\)/Xpra/

Second, connect to your running xpra instance using the following syntax where $USERNAME is your GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.

./xpra attach ssh:$USERNAME@$SERVERNAME:$PORT
Example
 ./xpra attach ssh:testuser@i21a-s3.rc.ufl.edu:143 --desktop-scaling=on --dpi=96
MatLab running via Xpra under slurm
NOTE
If you close the window using the close button, this will exit your application just like a native application. If you want to simply detach the session and come back later, please follow the detaching xpra session instructions below

Step 4: Detaching Xpra Session

These instructions allow you to detach a running xpra client without closing the application.

Linux and MAC OS

In the original terminal where you activated the client, simply press Control-C to detach the session.

2016-04-06 15:18:17,173 Attached to ssh:testuser@i21a-s3.rc.ufl.edu:143 (press Control-C to detach)
^C
got signal SIGINT, exiting
2016-04-06 15:18:42,513 Connection lost

You can re-attach to the running application using the xpra attach command as described in the instructions above.

Windows

  • Start a new console and navigate to the xpra directory as shown above.
  • Run the following command where $USERNAME is your UF GatorLink user-name, $SERVERNAME is the server where your application is running inside xpra, and $PORT is the X11 port you assigned when you started your application.
./xpra detach ssh:$USERNAME@$SERVERNAME:$PORT
Example
cd "C:\Program Files (x86)\Xpra"
./xpra detach ssh:testuser@i21a-s3.rc.ufl.edu:143
Note
If you are using mobaXterm, you can press Control-C in the mobaXterm window to detach, just like using the Linux client.

Startup Scripts

Some applications that require key command line parameters for launching, are more convienent to wrap with a startup script. Here is an annotated version and some application examples. The executable file can be downloaded here: matlab-launch.sh

Matlab Example

The first line of the launch script should set which shell type to use. On HiPerGator systems, the default shell is bash.

#!/bin/bash

Next, load the modules required for the application:

module load matlab;

Finally, enter the launch command for the GUI application:

matlab -nosplash -desktop

Once the script is saved, you will need to make it executable to run as an application wrapper. This can be done with the "chmod" command:

[testuser@gator3 ~]$ chmod u+x matlab-launch.sh

Below are some other application launch script examples:

Other Examples

MZmine

#!/bin/bash
module load mzmine;
startMZmine_Linux.sh;

MZmine with 8GB of memory:

#!/bin/bash

module load mzmine

export _JAVA_OPTIONS="-Xmx8g"

startMZmine_Linux.sh

Rstudio

#!/bin/bash

module load gui rstudio;
rstudio;


Other tested applications

trackvis

Notes: Application window appears correctly, waiting on license key in inital window

xterm

Notes: Works as expected


End current Xpra documentation slated for wiki