1function [nthreads chunk] = nthreads_set (nthreads, chunk)
2%NTHREADS_SET set # of threads and chunk to use in GraphBLAS
3%
4% [nthreads chunk] = nthreads_set (nthreads, chunk)
5%
6% If nthreads is empty, or if no input arguments, nthreads is set to 1.
7% If chunk is empty, or if no input arguments, chunk is not modified.
8
9% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
10% SPDX-License-Identifier: Apache-2.0
11
12global GraphBLAS_nthreads
13if (nargin < 1)
14    nthreads = [ ] ;
15end
16if (isempty (nthreads))
17    nthreads = int32 (1) ;
18end
19nthreads = int32 (nthreads) ;
20GraphBLAS_nthreads = nthreads ;
21
22if (nargin > 1 || nargout > 1)
23    global GraphBLAS_chunk
24    if (nargin > 1)
25        GraphBLAS_chunk = chunk ;
26    elseif (isempty (GraphBLAS_chunk))
27        GraphBLAS_chunk = 64*1024 ;
28    end
29    if (nargout > 1)
30        chunk = GraphBLAS_chunk ;
31    end
32end
33
34