File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -392,12 +392,18 @@ void jl_init_threading(void)
392
392
393
393
// how many threads available, usable
394
394
jl_n_threads = JULIA_NUM_THREADS ;
395
- if (jl_options .nthreads < 0 ) // --threads=auto
395
+ if (jl_options .nthreads < 0 ) { // --threads=auto
396
396
jl_n_threads = jl_cpu_threads ();
397
- else if (jl_options .nthreads > 0 ) // --threads=N
397
+ }
398
+ else if (jl_options .nthreads > 0 ) { // --threads=N
398
399
jl_n_threads = jl_options .nthreads ;
399
- else if ((cp = getenv (NUM_THREADS_NAME )))
400
- jl_n_threads = (uint64_t )strtol (cp , NULL , 10 );
400
+ }
401
+ else if ((cp = getenv (NUM_THREADS_NAME ))) {
402
+ if (strcmp (cp , "auto" ))
403
+ jl_n_threads = (uint64_t )strtol (cp , NULL , 10 ); // ENV[NUM_THREADS_NAME] == "N"
404
+ else
405
+ jl_n_threads = jl_cpu_threads (); // ENV[NUM_THREADS_NAME] == "auto"
406
+ }
401
407
if (jl_n_threads <= 0 )
402
408
jl_n_threads = 1 ;
403
409
#ifndef __clang_analyzer__
You can’t perform that action at this time.
0 commit comments