30 DEFUN (nproc, args, nargout,
32 @deftypefn {Built-in Function} {} nproc ()\n\
33 @deftypefnx {Built-in Function} {} nproc (@var{query})\n\
34 Return the current number of available processors.\n\
36 If called with the optional argument @var{query}, modify how processors\n\
37 are counted as follows:\n\
41 total number of processors.\n\
44 processors available to the current process.\n\
47 likewise, but overridable through the @w{@env{OMP_NUM_THREADS}} environment\n\
54 int nargin = args.
length ();
56 if ((nargin != 0 && nargin != 1) || (nargout != 0 && nargout != 1))
62 nproc_query query = NPROC_CURRENT;
65 std::string
arg = args(0).string_value ();
71 else if (arg ==
"current")
72 query = NPROC_CURRENT;
73 else if (arg ==
"overridable")
74 query = NPROC_CURRENT_OVERRIDABLE;
77 error (
"nproc: invalid value for QUERY");
82 retval = num_processors (query);