= Run STATA with Singularity = The glibc version on CentOS 6.5 nodes is 2.12. The glibc version on CentOS 7.4 nodes is 2.17. The latest STATA requires a more up-to-date glibc version. If you have a newer version of STATA and encounter a [[cypress/glibc-version-problems|glibc version problem]], follow the steps below. == Run on commandline interactively == Start an interactive session on the CentOS7 partition, {{{#!bash [uid@cypress2 ~]$ idev --partition=centos7 Requesting 1 node(s) task(s) to normal queue of centos7partition 1 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node Time: 0 (hr) 60 (min). Submitted batch job 47343 JOBID=47343 begin on cypress01-066 --> Creating interactive terminal session (login) on node cypress01-063. --> You have 0 (hr) 60 (min). Last login: Mon Jun 8 20:18:50 2015 from cypress1.cm.cluster }}} The default `idev` session reserves a node for '''one hour'''. If you want to work on it for a longer time, use `-t` option. See [[cypress/using#SubmittingInteractiveJobs]]. Load the module {{{#!bash [uid@cypress01-066 ~]$ module load singularity }}} Set up the environment and run Rocky Linux with Singularity. {{{#!bash [uid@cypress01-066 ~]$ source $SingularityImageDir/setup_cypress.sh [uid@cypress01-066 ~]$ singularity shell -s /bin/bash $SingularityImageDir/rockylinux-9.2.sif }}} You will get a command line prompt, `Apptainer>`. Assuming `stata` is in your $PATH directory, run STATA on the command line, {{{#!bash Apptainer> stata ___ ____ ____ ____ ____ ® /__ / ____/ / ____/ StataNow 19.5 ___/ / /___/ / /___/ BE—Basic Edition Statistics and Data Science Copyright 1985-2025 StataCorp LLC StataCorp 4905 Lakeway Drive College Station, Texas 77845 USA 800-782-8272 https://www.stata.com 979-696-4600 service@stata.com Stata license: Unlimited-user network, expiring 14 Dec 2026 Serial number: 501909301438 Licensed to: Tulane University New Orleans, LA Notes: 1. Unicode is supported; see help unicode_advice. . }}} Use `exit` command to finalize STATA. Use `exit` command to finalize Rocky Linux. '''Note that when `idev` session expires, your STATA session will be killed and all unsaved data will be lost. ''' == Run STATA in batch mode == Make sure your do-files work correctly. It is recommended to test your do-files on the local machine or on an interactive session with a small dataset for a short time. Suppose we have `hello.do` file that contains: {{{#!bash [uid@cypress2 ~]$ cat hello.do clear display "Hello, STATA!!!" exit }}} SLURM script will be: {{{#!bash #!/bin/bash #SBATCH --partition=centos7 # Partition #SBATCH --qos=normal # Quality of Service #SBATCH --job-name=STATA # Job Name #SBATCH --time=24:00:00 # WallTime #SBATCH --nodes=1 # Number of Nodes #SBATCH --ntasks-per-node=1 # Number of tasks (MPI processes) #SBATCH --cpus-per-task=2 # Number of processors per task OpenMP threads() #SBATCH --gres=mic:0 # Number of Co-Processors # SETUP SINGULARITY module load singularity source $SingularityImageDir/setup_cypress.sh # SET YOUR STATA DIRECTORY STATA_DIR=/lustre/project/eisaac/opt/stata19 # RUN STATA singularity exec $SingularityImageDir/rockylinux-9.2.sif $STATA_DIR/stata -b do hello }}} Submit a job {{{#!bash [uid@cypress2 ~]$ sbatch slurmscript }}} ''''slurmscript'''' is the file name of the above SLURM script. The results will be stored in ''''hello.log''''. === STATA-MP === Stata can run with multiple threads. You can check the license info by 'creturn list' command on stata-window. {{{ c(processors) = 8 (Stata/MP, set processors) c(processors_lic) = 8 }}} The example above shows that the default is 8 cores. So {{{#!bash #!/bin/bash #SBATCH --partition=defq # Partition #SBATCH --qos=normal # Quality of Service #SBATCH --job-name=STATA # Job Name #SBATCH --time=24:00:00 # WallTime #SBATCH --nodes=1 # Number of Nodes #SBATCH --ntasks-per-node=1 # Number of tasks (MPI processes) #SBATCH --cpus-per-task=8 # Number of processors per task OpenMP threads() #SBATCH --gres=mic:0 # Number of Co-Processors module load stata stata-mp -b do parappelcode }}}