Loading...
Searching...
No Matches
omp_threads.c File Reference
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <grass/gis.h>`
`#include <grass/glocale.h>`
Include dependency graph for omp_threads.c:

Go to the source code of this file.

## Functions

int | G_set_omp_num_threads (struct Option *opt)
| Set the number of threads for OpenMP The intended usage is at the beginning of a C tool when parameters are processed, namely the G_OPT_M_NPROCS standard option.

## Function Documentation

## G_set_omp_num_threads()

int G_set_omp_num_threads | ( | struct Option * | opt | ) |

Set the number of threads for OpenMP The intended usage is at the beginning of a C tool when parameters are processed, namely the G_OPT_M_NPROCS standard option.

If nprocs is set to 0, default OpenMP internal logic is used. If nprocs is a positive number, specified number of threads is used. If nprocs is a negative number, then maximum threads - number is used instead (e.g. to keep number of cores free for other use.

Parameters

  opt | A nprocs Option struct to specify the number of threads

Returns
  the number of threads set up for OpenMP parallel computing

Since
  version 8.5

Definition at line 26 of file omp_threads.c.

References G_fatal_error(), G_verbose_message(), G_warning(), and NULL.