| 1 | [[PageOutline]] |
| 2 | = STATA = |
| 3 | STATA is a general-purpose statistical software package created in 1985 by [http://www.stata.com/ StataCorp] |
| 4 | |
| 5 | '''STATA on cypress is licensed to Freeman School of Business.''' |
| 6 | |
| 7 | == Run with GUI interactively == |
| 8 | You must have X-window and ssh with X-window forwarding. See [[cypress/SshUsage#TunnelingXWindowsSessionviaSSH]]. |
| 9 | |
| 10 | GUI needs faster network connection. It is not good idea to do this at outside of Campus. |
| 11 | |
| 12 | Start an interactive session, |
| 13 | {{{#!bash |
| 14 | [fuji@cypress2 ~]$ idev |
| 15 | Requesting 1 node(s) task(s) to normal queue of defq partition |
| 16 | 1 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node |
| 17 | Time: 0 (hr) 60 (min). |
| 18 | Submitted batch job 47343 |
| 19 | JOBID=47343 begin on cypress01-063 |
| 20 | --> Creating interactive terminal session (login) on node cypress01-063. |
| 21 | --> You have 0 (hr) 60 (min). |
| 22 | Last login: Mon Jun 8 20:18:50 2015 from cypress1.cm.cluster |
| 23 | }}} |
| 24 | The default `idev` session reserve a node for '''one hour'''. If you want to work on for longer time, use `-t` option. See [[cypress/using#SubmittingInteractiveJobs]]. |
| 25 | |
| 26 | Load the module |
| 27 | {{{#!bash |
| 28 | [fuji@cypress01-063 ~]$ module load stata |
| 29 | }}} |
| 30 | |
| 31 | Run STATA with GUI, |
| 32 | {{{#!bash |
| 33 | [fuji@cypress01-063 ~]$ xstata & |
| 34 | }}} |
| 35 | |
| 36 | GUI window will show up. |
| 37 | |
| 38 | [[Image(xstata.png, 50%)]] |
| 39 | |
| 40 | '''Note that when `idev` session expires, your STATA session will be killed and all unsaved data will be lost. ''' |
| 41 | |
| 42 | == Run on commandline interactively == |
| 43 | |
| 44 | Start an interactive session, |
| 45 | {{{#!bash |
| 46 | [fuji@cypress2 ~]$ idev |
| 47 | Requesting 1 node(s) task(s) to normal queue of defq partition |
| 48 | 1 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node |
| 49 | Time: 0 (hr) 60 (min). |
| 50 | Submitted batch job 47343 |
| 51 | JOBID=47343 begin on cypress01-063 |
| 52 | --> Creating interactive terminal session (login) on node cypress01-063. |
| 53 | --> You have 0 (hr) 60 (min). |
| 54 | Last login: Mon Jun 8 20:18:50 2015 from cypress1.cm.cluster |
| 55 | }}} |
| 56 | The default `idev` session reserve a node for '''one hour'''. If you want to work on for longer time, use `-t` option. See [[cypress/using#SubmittingInteractiveJobs]]. |
| 57 | |
| 58 | Load the module |
| 59 | {{{#!bash |
| 60 | [fuji@cypress01-063 ~]$ module load stata |
| 61 | }}} |
| 62 | |
| 63 | Run STATA on commandline, |
| 64 | {{{#!bash |
| 65 | [fuji@cypress01-063 ~]$ stata |
| 66 | ___ ____ ____ ____ ____ (R) |
| 67 | /__ / ____/ / ____/ |
| 68 | ___/ / /___/ / /___/ 14.1 Copyright 1985-2015 StataCorp LP |
| 69 | Statistics/Data Analysis StataCorp |
| 70 | 4905 Lakeway Drive |
| 71 | College Station, Texas 77845 USA |
| 72 | 800-STATA-PC http://www.stata.com |
| 73 | 979-696-4600 stata@stata.com |
| 74 | 979-696-4601 (fax) |
| 75 | |
| 76 | Single-user Stata network license expires 29 Feb 2016: |
| 77 | Serial number: 501409275699 |
| 78 | Licensed to: Freeman School of Business |
| 79 | Tulane University |
| 80 | |
| 81 | Notes: |
| 82 | 1. Unicode is supported; see help unicode_advice. |
| 83 | |
| 84 | . |
| 85 | }}} |
| 86 | |
| 87 | Use `exit` command to finalize STATA. |
| 88 | |
| 89 | '''Note that when `idev` session expires, your STATA session will be killed and all unsaved data will be lost. ''' |
| 90 | |
| 91 | == Run STATA in batch mode == |
| 92 | |
| 93 | First, you should become familiar with do-files. |
| 94 | |
| 95 | Make sure your do-files work correctly. It is recommended to test your do-files on local machine or on an interactive session with a small data for a short time. |
| 96 | |
| 97 | Suppose we have `hello.do` file that contains: |
| 98 | {{{#!bash |
| 99 | [fuji@cypress2 ~]$ cat hello.do |
| 100 | clear |
| 101 | display "Hello, STATA!!!" |
| 102 | exit |
| 103 | }}} |
| 104 | |
| 105 | SLURM script will be: |
| 106 | {{{#!bash |
| 107 | #!/bin/bash |
| 108 | #SBATCH --partition=defq # Partition |
| 109 | #SBATCH --qos=normal # Quality of Service |
| 110 | #SBATCH --job-name=STATA # Job Name |
| 111 | #SBATCH --time=24:00:00 # WallTime |
| 112 | #SBATCH --nodes=1 # Number of Nodes |
| 113 | #SBATCH --ntasks-per-node=1 # Number of tasks (MPI presseces) |
| 114 | #SBATCH --cpus-per-task=2 # Number of processors per task OpenMP threads() |
| 115 | #SBATCH --gres=mic:0 # Number of Co-Processors |
| 116 | |
| 117 | module load stata |
| 118 | |
| 119 | stata -b do hello |
| 120 | }}} |
| 121 | |
| 122 | Submit a job |
| 123 | {{{#!bash |
| 124 | [fuji@cypress2 ~]$ sbatch slurmscript |
| 125 | }}} |
| 126 | |
| 127 | ''''slurmscript'''' is the file name of above SLURM script. The results will be stored in ''''hello.log''''. |