From FarmShare

Revision as of 19:09, 2 February 2016 by Chekh (Talk | contribs)
Jump to: navigation, search

We now have Stata version 13 installed. Try the commands 'module avail', 'module load statase':

$ module help statase

-------------------- Module Specific Help for "statase/13" ---------------------
This is Stata/SE version 13

        xstata-se           (Run windowed version of Stata/SE)
        stata-se            (Run console  version of Stata/SE)

We actually have three versions installed. If you run 'stata', you get Stata/IC, if you run 'stata-se', you get 'Stata/SE', if you 'module load statamp && stata-mp', you get Stata/MP.

batch mode

Running stata in batch mode in general, use the '-b do' parameter.

Running stata in batch mode on the barley via qsub.

[] /mnt/glusterfs/chekh [0] 
$ cat 
sysuse auto
[] /mnt/glusterfs/chekh [0] 
$ echo "stata -b do" | qsub -cwd -l hostname=barley05 
Your job 5725 ("STDIN") has been submitted
[] /mnt/glusterfs/chekh [0] 
$ ls -ltr |tail -n 4
-rw-r--r-- 1 chekh root      27 Nov  7 17:27
-rw-r--r-- 1 chekh root       0 Nov  7 17:28 STDIN.o5725
-rw-r--r-- 1 chekh root       0 Nov  7 17:28 STDIN.e5725
-rw-r--r-- 1 chekh root    2400 Nov  7 17:28 test2.log

Looks like stata doesn't print anything to stdin or stderr, but does create a .log file with the same name as your .do file.

Job script:

source /mnt/glusterfs/software/free/modules/tcl/init/bash
module load StataSE-12.1
stata -b do test

Full session:

[] /mnt/glusterfs/chekh [0] 
$ qsub -cwd -l mem_free=10M script2.submit 
Your job 167221 ("script2.submit") has been submitted
[] /mnt/glusterfs/chekh [0] 
$ qstat
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
 167221 0.00000 chekh        qw    04/27/2012 15:21:30                                    1        
[] /mnt/glusterfs/chekh [0] 
$ cat test.log 

  ___  ____  ____  ____  ____ (R)
 /__    /   ____/   /   ____/
___/   /   /___/   /   /___/   12.1   Copyright 1985-2011 StataCorp LP
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
                                      College Station, Texas 77845 USA
                                      979-696-4601 (fax)

23-user Stata network perpetual license:
       Serial number:  40120564988
         Licensed to:  Jane Tansuwan
                       Stanford University

      1.  Command line editing disabled
      2.  Stata running in batch mode

Note:  Your site can add messages to the introduction by editing the file
       stata.msg in the directory where Stata is installed.

. do test 

. clear

. sysuse auto
(1978 Automobile Data)

. describe

Contains data from /mnt/glusterfs/software/non-free/stata-se-12/ado/base/a/auto
> .dta
  obs:            74                          1978 Automobile Data
 vars:            12                          13 Apr 2011 17:45
 size:         3,182                          (_dta has notes)
              storage  display     value
variable name   type   format      label      variable label
make            str18  %-18s                  Make and Model
price           int    %8.0gc                 Price
mpg             int    %8.0g                  Mileage (mpg)
rep78           int    %8.0g                  Repair Record 1978
headroom        float  %6.1f                  Headroom (in.)
trunk           int    %8.0g                  Trunk space (cu. ft.)
weight          int    %8.0gc                 Weight (lbs.)
length          int    %8.0g                  Length (in.)
turn            int    %8.0g                  Turn Circle (ft.)
displacement    int    %8.0g                  Displacement (cu. in.)
gear_ratio      float  %6.2f                  Gear Ratio
foreign         byte   %8.0g       origin     Car type
Sorted by:  foreign

end of do-file

stata-mp test

 cd /mnt/glusterfs/chekh/stata-mp-test

My :

sysuse auto

My job.script:

# use the current directory
#$ -cwd
# mail this address
#$ -M
# send mail on begin, end, suspend
#$ -m bes
# copy current env vars to job
#$ -V
stata-mp -b do 

The job script uses '-V' to copy the env vars from your current session, so need to load the right module first:

[] /mnt/glusterfs/chekh/stata-mp-test [0] 
$ module load StataMP-12.1
[] /mnt/glusterfs/chekh/stata-mp-test [0] 
$ which stata-mp

Test that the command works outside of grid engine:

 stata-mp -b do

It produces a test.log as expected.

Submit the job:

[] /mnt/glusterfs/chekh/stata-mp-test [0] 
$ qsub job.script 
Your job 416828 ("job.script") has been submitted

The job is sitting there a long time because the cluster is busy and there are no immediately open slots:

$ qstat 
job-ID  prior   name       user         state submit/start at     queue                          slots ja-task-ID 
 416828 0.37250 job.script chekh        qw    09/04/2012 17:04:24              

Submit to the test queue instead:

 qsub -l testq=1 job.script

It runs immediately and produces the expected test.log file.

[] /mnt/glusterfs/chekh/stata-mp-test [0] 
$ ls -ltr
total 16
-rw-r--r-- 1 chekh root   27 Sep  4 16:59
-rw-r--r-- 1 chekh root  199 Sep  4 17:00 job.script
-rw-r--r-- 1 chekh root 2434 Sep  4 17:02 test.log.orig
-rw-r--r-- 1 chekh root    0 Sep  4 17:06 job.script.o416829
-rw-r--r-- 1 chekh root    0 Sep  4 17:06 job.script.e416829
-rw-r--r-- 1 chekh root 2434 Sep  4 17:06 test.log


We've had a report of a user having trouble with Stata v14 and they fixed it by modifying their file:


So double-check your Stata settings files. Probably an easy thing to do is just to delete your .stata14 directory and start fresh, or you can compare to your ~/.stata13/console/stata13.rc

Personal tools