hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_omp_set_num_threads (x06aa)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_omp_set_num_threads (x06aa) sets the number of threads to use in subsequent multi-threaded NAG routines.

Syntax

[ifail] = x06aa(num)
[ifail] = nag_omp_set_num_threads(num)

Description

nag_omp_set_num_threads (x06aa), for multi-threaded implementations, sets the number of threads to use in subsequent multi-threaded NAG Toolbox routines. Please see Multi-threaded Functions for a description of multi-threading in the NAG Toolbox.
In serial implementations of the NAG Toolbox this function has no effect.

References

None.

Parameters

Compulsory Input Parameters

1:     num int64int32nag_int scalar
The number of threads to use in subsequent multi-threaded NAG routines.
Constraint: num1.

Optional Input Parameters

None.

Output Parameters

1:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
Constraint: num1.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

None.

Example

In this example we presume a multi-threaded implementation of the NAG Toolbox. We set the number of threads to use in the Toolbox to 5 with a call to nag_omp_set_num_threads (x06aa) and retrieve it again with nag_omp_get_max_threads (x06ac).
function x06aa_example


fprintf('x06aa example results\n\n');

% The number of threads to set
num_set = int64(5);

% Set the number of threads to use
ifail = x06aa(num_set);

% Retrieve the number of threads to use
num_max = x06ac();

if (ifail == 0)
  fprintf('\nThe number of threads to use for NAG routines:  %d\n', num_max);
end


x06aa example results


The number of threads to use for NAG routines:  5

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015