Back to main menu

## Program behaviour: nthreads

#### Syntax

`-nthreads <n>`

#### Description

This option controls the maximum number of threads allowed for the parts of the code that are parallelized with OpenMP. The number <n> must be an integer greater than zero. For better efficiency, <n> should be smaller or equal to the number of CPUs available on the machine.

Note that only some specific parts of the code are actually parallelized. This option will have no effect on the parts of the code that are not programmed to run in parallel.

To make this change permanent, you may set up a configuration file.

#### Default

By default, the number of threads used by OpenMP is controlled by the environment variable OMP_NUM_THREADS. If it is not defined, then OpenMP will use as many threads as possible on the running machine. Note that Atomsk must have been compiled with OpenMP enabled in order to use several threads (see this page for more information).

#### Examples

- `atomsk initial.gin cfg -nthreads 1`

  This will force Atomsk to run on only one thread.

- `atomsk initial.gin cfg -nthreads 4`

  This will allow Atomsk to run in parallel, but with a maximum of 4 OpenMP threads.

Back to main menu