File: threads.m

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 506; asm: 369; python: 125; awk: 10
file content (33 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function nthreads = threads (nthreads)
%GRB.THREADS get/set the max number of threads to use in GraphBLAS.
%
%   nthreads = GrB.threads ;      % get the current maximum # of threads
%   GrB.threads (nthreads) ;      % set the maximum # of threads
%
% GrB.threads gets and/or sets the maximum number of threads to use in
% GraphBLAS.  By default, if GraphBLAS has been compiled with OpenMP, it
% uses the number of threads returned by omp_get_max_threads.  Otherwise,
% it can only use a single thread.
%
% Changing the number of threads with GrB.threads(nthreads) causes all
% subsequent GraphBLAS operations to use at most the given number of
% threads.  GraphBLAS may use fewer threads, if the problem is small (see
% GrB.chunk).  The setting is kept for the remainder of the current
% session, or until 'clear all' or GrB.clear is used, at which point the
% setting reverts to the default number of threads.
%
% Example:
%
%   GrB.threads (8) ;  % GraphBLAS will use at most 8 threads
%
% See also GrB.chunk.

% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0

if (nargin == 0)
    nthreads = gbthreads ;
else
    nthreads = gbthreads (nthreads) ;
end