The HEC currently hosts sets of 2-user licences for MP8 and MP16 which offer parallel (multi-core) implementations of many core stata functions. The licenses are provided for members of the Economics Department. Please contact Professor Rob Crouchley to request access.

To view the available Stata MP versions, enter the following command:

module avail stata


You will see output similar to this:

------- /usr/shared_apps/Modules/apps ----------------
stata/12.1 stata/13.1 stata/14(default) 
stata/14-mp16 stata/14-mp8


Modules offering Stata MP licensed by Economics have the format: stata/version-mpx, where x is the number for cores supported. Versions without an -mpx prefix are the generally available versions of Stata which is currently Stata MP/4.



More information

 Stata MP License availability

To see if any Stata licenses are currently free, run the command qlic statamp:

Licenses available:
statamp8=2
statamp16=0


The output will show the current license resource types, along with their availability.




 A sample batch job script for Stata MP8

Stata batch jobs may be run by creating a batch job control script (for example, called stata_job.com) like the following:

#$ -S /bin/bash

#$ -q parallel
#$ -l np=8

#$ -l statamp8=1

source /etc/profile
module add stata/14-mp8

cd $HOME/Stata_files
stata-mp -b do filename


The script is then submitted for running by typing:

|

qsub stata_job.com


The script follows the general template for OpenMP jobs. The two lines:

  #$ -q parallel
  #$ -l np=8

indicate that this is a parallel (multi-core) job, and requests 8 cores (as this example calls Stata MP8).

The next line:

  #$ -l statamp8=1

requests a license for Stata MP8. The request ensures that no matter how many Stata MP8 jobs are submitted to the cluster, no more than the licensed maximum will run at once. Note that a job calling Stata MP won't run without a valid licence request.

The next two lines:

  source /etc/profile
  module add stata/14-mp8

set up the job's environment and adds a valid version of Stata MP8 to the job environment. (Note that as and when the application is upgraded, multiple versions of Stata MP8 may become available).

The final two lines:

  cd $HOME/Stata_files
  stata-mp -b do filename

change into the directory where the Stata input file is located then calls stata-mp in batch mode, which will read instructions from the file filename.do




 Batch script for Stata MP16

For Stata MP16, replace the relevant resource request commands in the job template above with these values:

#$ -q parallel
#$ -l np=16
#$ -l statamp16=1


Don't forget to replace the module add command with the matching Stata MP module.




 Stata MP guidelines

Not all Stata functions are multi-core, and not all multi-core functions may be efficient. To prevent wasting resource on the HEC, Stata MP should only be used for workloads that can efficiently use the number of requested cores. Please review Statacorp's Stata/MP Performance Guide.

To prevent cores being used inefficiently on jobs that cannot benefit from multicore use, please refer to the Stata documentation and run small scale tests on workloads to determine the real-world speedup. If your workload makes more efficient use of a smaller number of cores, you can change the #$ -np line in your job script to request a lower, more suitable number of cores. Your stata job will be capped automatically at the number of cores requested. When submitted to the serial queue (i.e. as a single core job), stata-mp will be capped to use a single core.



Related pages