Running Stata

Taken  from Wesleyan Cluster Wiki: https://dokuwiki.wesleyan.edu/doku.php?id=cluster:103

Stata

Some general information for Stata users.

Sample

* save in a script say called run and submit to scheduler bsub < run

#!/bin/bash

rm -rf err out 

# relevant commands
# find available hosts: bhosts 
# find queues: bqueues 
# submit job: bsub < run
# show jobs submitted: bjobs

#BSUB -q stata
#BSUB -J test
#BSUB -o out
#BSUB -e err

# use n cores (job slots) ... a license limitation of 6
#BSUB -n 6
# force using all on one node (hosts=1) 
#BSUB -R "span[hosts=1]"

# can stata-mp work across nodes? 
# it appears not 

# scratch dirs
MYSANSCRATCH=/sanscratch/$LSB_JOBID
MYLOCALSCRATCH=/localscratch/$LSB_JOBID

# required in 12
export PATH=/share/apps/stata/12:$PATH

# alternate workdir, stage data and/or retrieve results
# cd $MYSANSCRATCH
# cp ~/stata/AllRegions2.dta  ~/stata/nikkei1.dta  .
# /share/apps/stata/10/stata-mp -b do wagepan80_87
# assumes output is written back to home, else copy results to ~/stata/

# working in home dir
cd ~/stata/
/share/apps/stata/12/stata-mp -b do firm_analysis_cluster