File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -823,6 +823,8 @@ void gotoblas_affinity_init(void) {
823823
824824 if (numprocs == 0 ) numprocs = readenv_atoi ("OMP_NUM_THREADS" );
825825
826+ if (numprocs == 0 ) numprocs = readenv_atoi ("OPENBLAS_DEFAULT_NUM_THREADS" );
827+
826828 numnodes = 1 ;
827829
828830 if (numprocs == 1 ) {
Original file line number Diff line number Diff line change @@ -67,10 +67,16 @@ void openblas_read_env() {
6767 openblas_env_thread_timeout = (unsigned int )ret ;
6868
6969 ret = 0 ;
70- if (readenv (p ,"OPENBLAS_NUM_THREADS " )) ret = atoi (p );
70+ if (readenv (p ,"OPENBLAS_DEFAULT_NUM_THREADS " )) ret = atoi (p );
7171 if (ret < 0 ) ret = 0 ;
7272 openblas_env_openblas_num_threads = ret ;
7373
74+ ret = 0 ;
75+ if (readenv (p ,"OPENBLAS_NUM_THREADS" )) ret = atoi (p );
76+ if (ret < 0 ) ret = 0 ;
77+ if (ret != 0 || openblas_env_openblas_num_threads == 0 )
78+ openblas_env_openblas_num_threads = ret ;
79+
7480 ret = 0 ;
7581 if (readenv (p ,"GOTO_NUM_THREADS" )) ret = atoi (p );
7682 if (ret < 0 ) ret = 0 ;
You can’t perform that action at this time.
0 commit comments