How to: run a do-file

1. Interactively

There are several ways of running a do-file in ACCRE. The first way is by opening STATA and using it interactively. Just open STATA and write the command for running the do-file with the appropriate file path. The issue with this process is that you cannot close your session if you want STATA to keep running the do file.

2. In session method.

Open your session and type:

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test1.do”

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test2.do”

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test3.do”

 

3. Let it run method:

This method will let you run a do-file and close the session. For this you need to write a script in SLURM or a SLURM file. You will find in the example files a version of this script but the text is the following:

 

#!/bin/bash

#SBATCH –nodes=1

labelstates fips

#SBATCH –ntasks=1

#SBATCH –time=60:00:00

#SBATCH –mem=50G

#SBATCH –output=%j.out

#SBATCH –mail-user=daniel.s.tello@vanderbilt.edu

#SBATCH –mail-type=ALL

#SBATCH –job-name=”stata_job”

 

stata-mp -b do “/gpfs22/home/tellods/test1.do”

stata-mp -b do “/gpfs22/home/tellods/test2.do”

stata-mp -b do “/gpfs22/home/tellods/test3.do”

 

 

Nodes: will be the number of nodes you want your work to tale:

Time: Specify how long you think you’ll program will run for

Mem: how much memory you think you’ll need

Mail: your email to send you a notification about the process of the job

Job Name: The job name..

 

Once you’ve written your SLURM script (which the extension should be *.slurm). Then you can open your session in PUTTY and then type

 

sbatch scriptsingletest.slurm

 

  • Or –

 

sbatch /gpfs22/home/tellods/scriptsingletest.slurm

If this was successful you will get an email with the start and end of the job.

 

4. How to run multiple do-files in ACCRE

 

This is by far the real reason to use ACCRE, it will be able to run several do files at the same time (note that in the example above it was running 3 do-files sequentially). The way I propose doing it is by assigning a number at the end of each do file as in (test1.do test2.do test3.do) and using the ARRAY syntax to run several dofiles at the same time.

 

#!/bin/bash

#SBATCH –nodes=1

#SBATCH –ntasks=1

#SBATCH –time=20:00:00

#SBATCH –mem=55G

#SBATCH –output=%j.out

#SBATCH –mail-user=daniel.s.tello@vanderbilt.edu

#SBATCH –mail-type=ALL

#SBATCH –job-name=”stata_job”

#SBATCH –array=1-3

 

echo “SLURM_JOBID: ” $SLURM_JOBID

echo “SLURM_ARRAY_TASK_ID: ” $SLURM_ARRAY_TASK_ID

echo “SLURM_ARRAY_JOB_ID: ” $SLURM_ARRAY_JOB_ID

 

stata-mp -b do “/gpfs22/home/tellods/test${SLURM_ARRAY_TASK_ID}.do”

 

In this code the “SLURM ARRAY TASK” will take the values between the arrays indicated in

 

#SBATCH –array=1-3

This means that this slurm script it will run “test1.do” test2.do” and “test3.do” at the same time.

Once you have your script written you can open you session using PUTTY and then type the name of the script after sbatch:

 

sbatch scriptarraytest.slurm

 

 

 

1. Interactively

There are several ways of running a do-file in ACCRE. The first way is by opening STATA and using it interactively. Just open STATA and write the command for running the do-file with the appropriate file path. The issue with this process is that you cannot close your session if you want STATA to keep running the do file.

 

2. In session method.

Open your session and type

 

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test1.do”

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test2.do”

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test3.do”

 

3. Let it run method:

This method will let you run a do-file and close the session. For this you need to write a script in SLURM or a SLURM file. You will find in the example files a version of this script but the text is the following:

 

#!/bin/bash

#SBATCH –nodes=1

#SBATCH –ntasks=1

#SBATCH –time=60:00:00

#SBATCH –mem=50G

#SBATCH –output=%j.out

#SBATCH –mail-user=daniel.s.tello@vanderbilt.edu

#SBATCH –mail-type=ALL

#SBATCH –job-name=”stata_job”

 

stata-mp -b do “/gpfs22/home/tellods/test1.do”

stata-mp -b do “/gpfs22/home/tellods/test2.do”

stata-mp -b do “/gpfs22/home/tellods/test3.do”

 

 

Nodes: will be the number of nodes you want your work to tale:

Time: Specify how long you think you’ll program will run for

Mem: how much memory you think you’ll need

Mail: your email to send you a notification about the process of the job

Job Name: The job name..

 

Once you’ve written your SLURM script (which the extension should be *.slurm). Then you can open your session in PUTTY and then type

 

sbatch scriptsingletest.slurm

 

  • Or –

 

sbatch /gpfs22/home/tellods/scriptsingletest.slurm

1. Interactively

There are several ways of running a do-file in ACCRE. The first way is by opening STATA and using it interactively. Just open STATA and write the command for running the do-file with the appropriate file path. The issue with this process is that you cannot close your session if you want STATA to keep running the do file.

 

2. In session method.

Open your session and type

 

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test1.do”

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test2.do”

stata-mp -b do “/gpfs22/home/username/Test/DoFiles/Test3.do”

 

3. Let it run method:

This method will let you run a do-file and close the session. For this you need to write a script in SLURM or a SLURM file. You will find in the example files a version of this script but the text is the following:

 

#!/bin/bash

#SBATCH –nodes=1

#SBATCH –ntasks=1

#SBATCH –time=60:00:00

#SBATCH –mem=50G

#SBATCH –output=%j.out

#SBATCH –mail-user=daniel.s.tello@vanderbilt.edu

#SBATCH –mail-type=ALL

#SBATCH –job-name=”stata_job”

 

stata-mp -b do “/gpfs22/home/tellods/test1.do”

stata-mp -b do “/gpfs22/home/tellods/test2.do”

stata-mp -b do “/gpfs22/home/tellods/test3.do”

 

 

Nodes: will be the number of nodes you want your work to tale:

Time: Specify how long you think you’ll program will run for

Mem: how much memory you think you’ll need

Mail: your email to send you a notification about the process of the job

Job Name: The job name..

 

Once you’ve written your SLURM script (which the extension should be *.slurm). Then you can open your session in PUTTY and then type

 

sbatch scriptsingletest.slurm

 

  • Or –

 

sbatch /gpfs22/home/tellods/scriptsingletest.slurm