In order to run a graphics application in a PBS batch job, you must provide a value for the DISPLAY environment variable—even if you do not have or need an actual display for the job. If the batch job cannot find this value, it will quit and return an error such as "Can't open display" or "Display not set."
To provide a value for the DISPLAY variable, you can set up a display connection using either X11 forwarding or a VNC session, or you can run the job on the NAS GPU nodes, which include graphics cards. Each of these methods is described below.
Method 1: Use X11 Forwarding to Set Up a Display
Complete these steps to use your local system as an remote X11 server, which acts as the display:
In the above example, using the -V option will export the DISPLAY environment variable (with its value set to 10.150.27.21:30.0) from your PFE login session to the PBS batch job.
Drawbacks to using this method:
Because the connection from the PBS job to your local system must be maintained, you cannot exit from either your local system or from the PFE login window until the job completes.
Application performance on remote X11 servers deteriorates with latency, so unless your local system is physically close to the NAS facility, job performance may not be optimal.
Method 2: Use a VNC Session to Set Up a Display
Complete these steps on a PFE to set up a VNC viewer, which acts as the display:
Once the VNC viewer is set up and running, you will see the following messages (or something similar) in the PFE login window:
pfe25% vncserver
New 'X' desktop is pfe25:9
Starting applications specified in /u/username/.vnc/xstartup
Log file is /u/username/.vnc/pfe25:9.log
This information indicates that the DISPLAY value pfe25:9.0 is set, providing a valid display that your PBS batch jobs can access.
In your PBS batch job script, add the following line to instruct the job to use this display:
For csh: setenv DISPLAY pfe25:9.0
For bash: export DISPLAY=pfe25:9.0
Submit your PBS batch job from the PFE connection window where the VNC session is running.
Benefits of using this method:
Job performance is not impacted.
The VNC viewer will be maintained as long as the PFE you started it on (pfe25 in this example) is online. The session will stay open even if you exit from your local system or from the PFE connection window where the viewer is running. To reconnect to the session, simply log in to the PFE and repeat steps 3 and 4 in the VNC instructions with the same port number (5909 in this example).
Note: The number of VNC ports on each PFE is limited. You must stop the vncserver script after your PBS job completes, or the port will remain open and owned by you, which prevents other users from using it. Remember to complete step 5 in the VNC instructions to properly shut down your VNC session.
Method 3: Run Your Job on the NAS GPU Nodes
When you run a job on a GPU node, a display is enabled automatically.
Complete these steps to run your job on a GPU node:
Modify your PBS script to run startx and set DISPLAY to :0.0 by adding these lines:
/bin/startx /usr/bin/Xvnc :1 -s 0 -ac -br -listen tcp passwordFile=$HOME/.vnc/passwd &
setenv DISPLAY :1.0 (for csh)
or
export DISPLAY=:1.0 (for bash)
sleep 15 # wait 15 seconds to allow the startx to fully start up before using the display
Submit a batch job to request a GPU node using the correct queue: