Batching jobs is essential to fully utilize your hardware and software resources. It is satisfying to relax during the off-hours knowing that the huge series of jobs you created during the daytime will run continuously throughout the night (and sometimes weekends). Please note that we’ll only discuss two relatively primitive techniques to setup batch runs on local machines only using batch files. If you want to learn how to get your workstation to keep working after you leave the office, pay attention!

Input files and the command line

1-creating-inputfiles-300x183

Fig 1: Creating input files from the CAE

The main ingredient for these techniques are the input files (input decks, .inp). In the Abaqus/CAE you can create the input files by right-clicking the job, select ‘write inputfile’ or ‘datacheck’ – both commands create an input file in the current work directory.

If you are not familiar with running jobs from the command line, you are highly encouraged to read about this in the documentation [1]. Anyhow, we can submit a job from the command line by writing:

abaqus job=yourjobname(.inp)

Note that specifying the ‘.inp’ postfix is optional and that jobs does not support spaces within the name. The command will start to solve the job in background using one core. If several jobs are started in the same manner, they will run in parallel as long as there is enough tokens. Here is a screenshot of two jobs that will run in parallel as background processes:

Fig 2: Running two jobs in parallel

Fig 2: Running two jobs in parallel

When we want to run a big batch of jobs, it is far from ideal that all the jobs are submitted at once, it is almost always more efficient to run jobs in a sequential manner on workstations. If we add the “interactive” argument to the command we will get a summary log written to the command line, causing the next command to start when the first job has finished, et volia; the jobs now run sequentially. On top of that, we can use the arguments ‘cpus=X’ and ‘gpus=X’ to specify what computational resources we want the solver to use. Now, let’s put this together in bat files.

Technique 1: Specified Batch

3-batch-run-notepad

Fig 3: batch_run.bat

This bat file will simply call hard-coded commands that will initiate the solver. In this file we have to manually specify each command including job name and computational resources, and call them from within our bat file. Shown below is a clean folder that I have copied some input files into. Then I created a bat file  (called “batch_run.bat”) that contains one command for each of the jobs in the folder. The file looks like this:

call abaqus job=Frame cpus=2 interactive
call abaqus job=expFrame cpus=1 interactive

4-batch_run

 

 

 

 

Double-click the batch_run.bat file to run “expFrame” and “Frame”.

Simple, right? This file can contain as many commands as you like. The best thing about this technique is that it provides total control on an job-by-job basis. Sometimes you may want to run an explicit job on a specific amount of cpu cores and then proceed to run several standard job with all cpus and gpus available. When that is the case, this is the way to go!

Technique 2: Dynamic Batch

If you have a many jobs that will run with the exact same configuration, number of CPUs and GPUs, we can use a more dynamic approach. All we need is a bat file that loops through all the input files in the folder an

Fig 4: batch_run_dyn.bat

Fig 4: batch_run_dyn.bat

d spawn a Abaqus  job command for each file. Here is an example of such a bat file with uses 2 cpus for each job:

FOR %%i IN (*.inp) DO call abaqus job=%%i cpus=2 int


ECHO job(s) done

6-dynamic_batch

 

 

 

 

 

Note that ‘interactive’ has been replaced with it’s short-form ‘int’. This script can be copied into new folders that contains jobs.

Make sure it can run forever!

These two batch files does not guarantee that your workstation stays busy during the long weekend. There is especially two things that might cause the batch runs to stop.

 

Fig 5: Overwrite?

Fig 5: Overwrite?

The first one is the “Old job files exist. Overwrite= (y/n):” prompt. This can be avoided by only running batches in folders that does not contain any previous results that has to be overwritten. The most robust solution is however to add the line “ask_delete=OFF” to your environment file [2], which forces Abaqus to always overwrite by default. The prompt will never appear again.

The second one is that your computer goes in hibernation during your off-hours. You don’t want that! Review your power options to make sure that it never sleeps.

Fig 6: Power Options

Fig 6: Power Options

Enjoy!

References

[1] Abaqus Analysis Users’s Guide 3 Job Execution
[2] Abaqus Installation and Licensing Guide 4.1 Using the Abaqus environment file