Biowulf at the NIH
RSS Feed
Mathematica on Biowulf
Mathematcia logo

Mathematica is a fully integrated environment for technical and scientific computing. Mathematica combines numerical and symbolic computation, visualization, and programming in a single, flexible interactive system. The Mathematica system is very broad, and provides a systematic interface to all sorts of computations, from traditional numeric and symbolic computation, to visualization, to data format conversion, and the creation of user interfaces.

There are a total of 7 Mathematica licenses available on Biowulf. If you plan to use Mathematica for interactive or occasional jobs, Helix is the most appropriate platform. Mathematica jobs are only suited for the Biowulf cluster if you have many jobs to run via batch.

Mathematica resources

The PBS Batch system on Biowulf keeps track of the Mathematica licenses, and will start a Mathematica job only when a license is available. All Mathematica batch jobs must therefore specify the appropriate 'resource' (as in the example below) when the job is submitted, otherwise the batch system may start the job which will immediately exit because there is no license available. The command:

qsub -l nodes=1,math=1 my_job_script
will submit the job and tell PBS that a Mathematica license (math=1) is required.

Total and free licenses, the resource name, and the per-user license limit can be seen by typing 'licenses' at the Biowulf prompt or by checking the current license status webpage at any time.

Submitting a single Mathematica batch job
  1. Create a Mathematica command file: You can insert Mathematica commands into a math command file, and submit it to the Biowulf batch system. Below is a sample math command file (rmsd.math). This file creates an pdf output plot, which will appear in the same directory as the rmsd.math file.
    ----------------------------file rmsd.math----------------------------------
     (* file geomanal/rmsdplot.math  -- make a plot rmsd vs residue     *)
     (*===>*)    data=ReadList["rmsdplot.list",{Number,Number,Number}];
    SetOptions[Plot,DisplayFunction->Identity]
         column0 = Transpose[data][[1]]; 
         column1 = Transpose[data][[2]]; 
         column2 = Transpose[data][[3]];
         len=Length[column0];
         b1=Join[column0,column1];
         b2=Partition[b1,len];
         b3=Transpose[b2];
         xmax=Max[column0];
         xmin=Min[column0];
         y1max=Max[column1];
         y1min=Min[column1];
         y2max=Max[column2];
         y2min=Min[column2];
         plot1=     ListPlot[b3,  
           AxesLabel->{"Res. No.","RMSD"}, 
           Ticks->{Range[0,xmax+5,50],Range[0.0, y1max+0.2 ,0.5]},
           PlotLabel->"Backbone",Axes->{0,0},PlotJoined->True, 
           PlotRange->{{0,xmax+2 }, {0., y1max +0.1 }},
           AxesStyle->{PostScript
              ["/Times-Roman findfont 13 scalefont setfont"]} ];
              s1=Join[column0,column2];
              s2=Partition[s1,len];
              s3=Transpose[s2];
              Export["/data/username/mydir/a.pdf",plot1]
              Exit[]
    ------------------------------------------------------------------------------
    
  2. Create a Biowulf batch script. Sample batch script:
    ------- file myrun.batch ------------------------------------------------
    #!/bin/bash
    #
    #PBS -N Math
    #PBS -m be 
    #PBS -k oe
     
    module load math 
    cd /data/username/mymathdir          #enter the appropriate directory here
    math -run "<<rmsd.math"
    
    
  3. Submit this job to the batch system
    qsub -l nodes=1,math=1 myrun.batch
    
Running Mathematica interactively without the GUI

For debugging purposes, it may be most convenient to run Mathematica interactively with your Notebook file. This is done by allocating an interactive node, and typing the Mathematica command that you would normally put into your batch script. Sample session (user input in bold):

[user@biowulf mydir]$ qsub -I -l nodes=1,math=1
qsub: waiting for job 591449.biobos to start
qsub: job 591449.biobos ready

p227    job-busy           interactive
[user@p227 ~]$ module load math
[user@p227 ~]$ cd /data/user/mydir
[user@p227 mydir]$ math -run "<<rmsdplot.math"
Mathematica 5.0 for Linux
Copyright 1988-2003 Wolfram Research, Inc.
 -- Terminal graphics initialized -- 
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
 RMSD                                                                         
   #                             Backbone                                     
  3#                                                                #         
   #                                                                #         
   #                                                                #         
   #                                                                #         
2.5#                                                               ##         
   #                                   #                           #          
   #                                   #                           #          
  2#                                   #                           #          
   #                                   #                           #          
   #                                   #                           #          
1.5#                                   #                           #          
   #                                  ##                           #          
   #          #           ##          ###             ##          ##          
   #          #           ##          # ##            ##          #           
  1#      #   #           ###         #  ##    #      ##      #   #           
   ###   ##   #        #######    ##  #  #######     ###   ## ### #           
   #########  #        ###  ## #  #####  # ## ###    # ######## ###           
0.5######  # #######  ##     # ## # ###    ## ###  ###  #### #   ##           
   # ##    ######### ###     ###### #      ## # ####             #            
   #        ##     ###           #                                            
   ################################################################### Res. No
                                                                              
                            50                       100                      
                                                                              
[user@p227 mydir]$ exit
qsub: job 591449.biobos completed

[user@biowulf mydir]
Documentation

Wolfram Mathematica Documentation Center

Wolfram Support Center