Changes between Initial Version and Version 1 of cypress/STATA-Singularity


Ignore:
Timestamp:
09/17/2026 05:09:10 PM (3 days ago)
Author:
fuji
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • cypress/STATA-Singularity

    v1 v1  
     1= Run STATA with Singularity =
     2The 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.
     3
     4
     5== Run on commandline interactively ==
     6
     7Start an interactive session on the CentOS7 partition,
     8{{{#!bash
     9[uid@cypress2 ~]$ idev --partition=centos7
     10Requesting 1 node(s)  task(s) to normal queue of centos7partition
     111 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node
     12Time: 0 (hr) 60 (min).
     13Submitted batch job 47343
     14JOBID=47343 begin on cypress01-066
     15--> Creating interactive terminal session (login) on node cypress01-063.
     16--> You have 0 (hr) 60 (min).
     17Last login: Mon Jun  8 20:18:50 2015 from cypress1.cm.cluster
     18}}}
     19The 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]].
     20
     21Load the module
     22{{{#!bash
     23[uid@cypress01-066 ~]$ module load singularity
     24}}}
     25Set up the environment and run Rocky Linux with Singularity.
     26{{{#!bash
     27[uid@cypress01-066 ~]$ source $SingularityImageDir/setup_cypress.sh
     28[uid@cypress01-066 ~]$ singularity shell -s /bin/bash $SingularityImageDir/rockylinux-9.2.sif
     29}}}
     30You will get a command line prompt, `Apptainer>`.
     31Assuming `stata` is in your $PATH directory, run STATA on the command line,
     32{{{#!bash
     33Apptainer> stata
     34
     35  ___  ____  ____  ____  ____ ®
     36 /__    /   ____/   /   ____/      StataNow 19.5
     37___/   /   /___/   /   /___/       BE—Basic Edition
     38
     39 Statistics and Data Science       Copyright 1985-2025 StataCorp LLC
     40                                   StataCorp
     41                                   4905 Lakeway Drive
     42                                   College Station, Texas 77845 USA
     43                                   800-782-8272        https://www.stata.com
     44                                   979-696-4600        [email protected]
     45
     46Stata license: Unlimited-user network, expiring 14 Dec 2026
     47Serial number: 501909301438
     48  Licensed to: Tulane University
     49               New Orleans, LA
     50
     51Notes:
     52      1. Unicode is supported; see help unicode_advice.
     53.
     54}}}
     55
     56Use `exit` command to finalize STATA.
     57Use `exit` command to finalize Rocky Linux.
     58
     59'''Note that when `idev` session expires, your STATA session will be killed and all unsaved data will be lost. '''
     60
     61== Run STATA in batch mode ==
     62
     63Make 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.
     64
     65Suppose we have `hello.do` file that contains:
     66{{{#!bash
     67[uid@cypress2 ~]$ cat hello.do
     68clear
     69display "Hello, STATA!!!"
     70exit
     71}}}
     72
     73SLURM script will be:
     74{{{#!bash
     75#!/bin/bash
     76#SBATCH --partition=centos7     # Partition
     77#SBATCH --qos=normal            # Quality of Service
     78#SBATCH --job-name=STATA        # Job Name
     79#SBATCH --time=24:00:00         # WallTime
     80#SBATCH --nodes=1               # Number of Nodes
     81#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
     82#SBATCH --cpus-per-task=2       # Number of processors per task OpenMP threads()
     83#SBATCH --gres=mic:0            # Number of Co-Processors
     84
     85# SETUP SINGULARITY
     86module load singularity
     87source $SingularityImageDir/setup_cypress.sh
     88
     89# SET YOUR STATA DIRECTORY
     90STATA_DIR=/lustre/project/eisaac/opt/stata19
     91
     92# RUN STATA
     93singularity exec $SingularityImageDir/rockylinux-9.2.sif $STATA_DIR/stata -b do hello
     94
     95}}}
     96
     97Submit a job
     98{{{#!bash
     99[uid@cypress2 ~]$ sbatch slurmscript
     100}}}
     101
     102''''slurmscript'''' is the file name of the above SLURM script. The results will be stored in ''''hello.log''''.
     103
     104=== STATA-MP ===
     105
     106
     107Stata can run with multiple threads. You can check the license info by 'creturn list' command on stata-window.
     108
     109{{{
     110      c(processors) = 8                          (Stata/MP, set processors)
     111      c(processors_lic) = 8
     112}}}
     113
     114The example above shows that the default is 8 cores. So
     115{{{#!bash
     116#!/bin/bash
     117#SBATCH --partition=defq        # Partition
     118#SBATCH --qos=normal            # Quality of Service
     119#SBATCH --job-name=STATA        # Job Name
     120#SBATCH --time=24:00:00         # WallTime
     121#SBATCH --nodes=1               # Number of Nodes
     122#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
     123#SBATCH --cpus-per-task=8       # Number of processors per task OpenMP threads()
     124#SBATCH --gres=mic:0            # Number of Co-Processors
     125
     126module load stata
     127
     128stata-mp -b do parappelcode
     129}}}