You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//below, please modify if you find a way to persuade behaviour of those different cases to be better if they return different number of threads.
851
+
switch (modifier) {
852
+
case TP_DEFAULT: //the same as IDL, reserved for routines that use the thread pool, ideally check the special thread pool keywords.
853
+
case TP_ARRAY_INITIALISATION: // used by GDL array initialisation (new, convert, gdlarray): need to concern only 1 thread/code whicj is not possible AFAIK.
854
+
case TP_MEMORY_ACCESS: // concurrent memory access, probably needs to be capped to preserve bandwidth
855
+
{
856
+
if (nThreads == 1) return nThreads;
857
+
// here we have more than 1 thread, so n operations will be divided between nt threads. It becomes inefficient if nt is large, to start so many threads for diminishing returns.
858
+
// I propose to enable as many threads as necessary so that each thread will compute at least CpuTPOOL_MIN_ELTS:
859
+
if (CpuTPOOL_MIN_ELTS < 1) return CpuTPOOL_NTHREADS; // the user did not understand IDL's doc about threadpools?.
860
+
int nchunk = nEl / CpuTPOOL_MIN_ELTS;
861
+
nchunk++; //to be sure
862
+
if (nThreads > nchunk) nThreads = nchunk;
863
+
// std::cerr << nThreads;
864
+
return nThreads;
865
+
}
866
+
case TP_CPU_INTENSIVE: // benefit from max number of threads if possible given MIN and MAX elts etc
Copy file name to clipboardExpand all lines: src/gdl.cpp
+13-3
Original file line number
Diff line number
Diff line change
@@ -368,14 +368,16 @@ int main(int argc, char *argv[])
368
368
cerr << " --sloppy Sets the traditional (default) compiling option where \"()\" can be used both with functions and arrays." << endl;
369
369
cerr << " Needed to counteract temporarily the effect of the enviromnment variable \"GDL_IS_FUSSY\"." << endl;
370
370
cerr << " --MAC Graphic device will be called 'MAC' on MacOSX. (default: 'X')" << endl;
371
-
cerr << " --no-use-wx Tells GDL not to use WxWidgets graphics." << endl;
371
+
cerr << "[--no-use-wx | -X] Tells GDL not to use WxWidgets graphics and resort to X11 (if available)." << endl;
372
372
cerr << " Also enabled by setting the environment variable GDL_DISABLE_WX_PLOTS to a non-null value." << endl;
373
373
cerr << " --notebook Force SVG-only device, used only when GDL is a Python Notebook Kernel." << endl;
374
374
cerr << " --widget-compat Tells GDL to use a default (rather ugly) fixed pitch font for compatiblity with IDL widgets." << endl;
375
375
cerr << " Also enabled by setting the environment variable GDL_WIDGET_COMPAT to a non-null value." << endl;
376
-
cerr << " Using this option may render some historical widgets unworkable (as they are based on fixed sizes)." << endl;
376
+
cerr << " Using this option may render some historical widgets more readable (as they are based on fixed sizes)." << endl;
377
377
cerr << " --no-dSFMT Tells GDL not to use double precision SIMD oriented Fast Mersenne Twister(dSFMT) for random doubles." << endl;
378
378
cerr << " Also disable by setting the environment variable GDL_NO_DSFMT to a non-null value." << endl;
379
+
cerr << " --with-eigen-transpose lets GDL use Eigen::transpose and related functions instead of our accelerated transpose function. Normally slower." <<endl;
380
+
cerr << " --smart-tpool switch to a mode where the number of threads is adaptive (experimental). Should enable better perfs on many core machines." <<endl;
379
381
#ifdef _WIN32
380
382
cerr << " --posix (Windows only): paths will be posix paths (experimental)." << endl;
381
383
#endif
@@ -483,10 +485,18 @@ int main(int argc, char *argv[])
0 commit comments