changeset 27032:0ee0bb5eb381

make nproc default to "overridable" to agree with nproc shell utility * nproc.cc (Fnproc): Set default to OCTAVE_NPROC_CURRENT_OVERRIDABLE. Add BIST test. * oct-fftw.cc (fftw_planner::fftw_planner): Use OCTAVE_NPROC_CURRENT_OVERRIDABLE for default thread count. (float_fftw_planner::float_fftw_planner): Likewise.
author Mike Miller <mtmiller@octave.org>
date Sat, 06 Apr 2019 18:39:32 -0700
parents 3080dac8f660
children c76dd670a7a5
files libinterp/corefcn/nproc.cc liboctave/numeric/oct-fftw.cc
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/nproc.cc	Sat Apr 06 18:46:30 2019 -0700
+++ b/libinterp/corefcn/nproc.cc	Sat Apr 06 18:39:32 2019 -0700
@@ -54,7 +54,7 @@
   if (nargin > 1)
     print_usage ();
 
-  octave_nproc_query query = OCTAVE_NPROC_CURRENT;
+  octave_nproc_query query = OCTAVE_NPROC_CURRENT_OVERRIDABLE;
 
   if (nargin == 1)
     {
@@ -81,6 +81,9 @@
 %!assert (nproc ("all") >= 1)
 %!assert (nproc ("current") >= 1)
 
+## Test that "overridable" is the default
+%!assert (nproc ("overridable"), nproc ())
+
 %!test
 %! c = nproc ("current");
 %! unwind_protect
--- a/liboctave/numeric/oct-fftw.cc	Sat Apr 06 18:46:30 2019 -0700
+++ b/liboctave/numeric/oct-fftw.cc	Sat Apr 06 18:39:32 2019 -0700
@@ -79,7 +79,7 @@
 
     // Use number of processors available to the current process
     // This can be later changed with fftw ("threads", nthreads).
-    nthreads = octave_num_processors_wrapper (OCTAVE_NPROC_CURRENT);
+    nthreads = octave_num_processors_wrapper (OCTAVE_NPROC_CURRENT_OVERRIDABLE);
     fftw_plan_with_nthreads (nthreads);
 #endif
 
@@ -433,7 +433,7 @@
 
     // Use number of processors available to the current process
     // This can be later changed with fftw ("threads", nthreads).
-    nthreads = octave_num_processors_wrapper (OCTAVE_NPROC_CURRENT);
+    nthreads = octave_num_processors_wrapper (OCTAVE_NPROC_CURRENT_OVERRIDABLE);
     fftwf_plan_with_nthreads (nthreads);
 #endif