How to launch research software applications (Matlab, Stata, R) on Andes and Polaris high-performance linux machines (HPC's)

Launching software from Andes, Polaris:  

See https://services.dartmouth.edu/TDClient/KB/ArticleDet?ID=64641  for more details on running research software on our Linux HPC's such as Andes and Polaris.  

Begin by ensuring that you have FastX installed on your Mac/Win system: https://services.dartmouth.edu/TDClient/KB/ArticleDet?ID=81595
and that you are able to open an Xterm session on andes.dartmouth.edu or polaris.dartmouth.edu

Once you get the Xterm window open and the '$' prompt, do a quick test to make sure your terminal command line can also open up an external X window by typing xclock& at the command line: 

       $ xclock&

In a few seconds, you should see a new window open with a small clock in it.  Close the clock window when it appears.  If not, re-install your X Window software (FastX, MobaXterm, XQuartz)

Click back inside the terminal window, and press the Enter/Return key to get a new command prompt ($).  Then, type the following command below to load the software you'd like to use (matlab, stata, R, etc) at the "$" prompt in your terminal window: 

       $ module load matlab

And then the software name to launch the interactive software in a new terminal X Window. 

       $ matlab ​​​​ 

Some software packages have more than one version installed.  Stata is one example.  Type module avail stata to see available versions

       $ module avail stata

       $ module load stata/15 ​​​​ 

       $ xstata 

       $ spss

       $ sas

Your DartFS file storage system is available at this same command prompt.  You can drag and drop files in, or use a Unix cp or mv command.  Type  ls to view files:
       $    ls

       mydata_on_dartfs_netid.csv
       myRscript.R
       myMatlabMfiles.M  

You can run R script files using the Rscript command.  mmand prompt.
       $    Rscript myRscript.R

Matlab can be run without the graphical interface
       $    matlab -nodisplay -nojvm -nosplash -nodesktop 

                      <  M A T L A B >  

       >>>  

 

Matlab scripts can be run at the prompt without the graphical interface

          Author a script on your desktop installation of Matlab, and save it to DartFS.  Samlpe script titled "testmfile.m", which contains the following code: 

                       

This script can then be run by logging with your DartFS account and navigating to the directory 
         $ module load matlab       

         $ matlab -nodisplay -nodesktop -nosplash -nojvm -r "run testmfile.m"

Scripts can be written to accept parameters and write to files  

                        
         $  matlab -nodisplay -nodesktop -nosplash -nojvm -r "matlabfunctionwritefile(25)" ​​​​​​​​​​​​​​​​​​​​​

Scripts can also be written to export data out to your DartFS file storage: 

Example:  a script called "script.m" containing the following:
A = magic(5);
outputfile1 = 'output1.xlsx';
writematrix(A,outputfile1,'Sheet',1,'Range','E1:I5');
outputfile2 = '//dartfs-hpc/rc/home/2/username2/output2.xlsx';
writematrix(A,outputfile2,'Sheet',1,'Range','E1:I5');

Then run on Polaris at the command line like this:
[usrname@polaris ~]$ module load matlab
[usrname@polaris ~]$ matlab -nodisplay -nodesktop -nosplash -nojvm -r "run script.m"

This will output files "output1.xlsx" and "output2.xlsx" to the user's home directory.  Note the use of the full file path in the second file - this method could be used to write to subfolders on your DartFS file system.

SSH Terminal and X Window Clients

     Windows / Mac / Linux "FastX" https://services.dartmouth.edu/TDClient/KB/ArticleDet?ID=81595

     Windows:  Gitbash  https://git-scm.com/downloads 

     Mac:  use built-in 'Terminal' Unix Shell 

     See this link for more help with the Andes Polaris Linux HPC machines:  https://services.dartmouth.edu/TDClient/KB/ArticleDet?ID=64641 

 

Details

Article ID: 78493
Created
Fri 5/17/19 12:34 PM
Modified
Fri 2/14/20 11:26 AM