Browse Source

Merge pull request #3773 from staticfloat/sf/openblas_default_num_threads

Add `OPENBLAS_DEFAULT_NUM_THREADS`
tags/v0.3.22^2
Martin Kroeker GitHub 3 years ago
parent
commit
ab6009b0b6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions
  1. +2
    -0
      driver/others/init.c
  2. +7
    -1
      driver/others/openblas_env.c

+ 2
- 0
driver/others/init.c View File

@@ -823,6 +823,8 @@ void gotoblas_affinity_init(void) {

if (numprocs == 0) numprocs = readenv_atoi("OMP_NUM_THREADS");

if (numprocs == 0) numprocs = readenv_atoi("OPENBLAS_DEFAULT_NUM_THREADS");

numnodes = 1;

if (numprocs == 1) {


+ 7
- 1
driver/others/openblas_env.c View File

@@ -67,10 +67,16 @@ void openblas_read_env() {
openblas_env_thread_timeout=(unsigned int)ret;

ret=0;
if (readenv(p,"OPENBLAS_NUM_THREADS")) ret = atoi(p);
if (readenv(p,"OPENBLAS_DEFAULT_NUM_THREADS")) ret = atoi(p);
if(ret<0) ret=0;
openblas_env_openblas_num_threads=ret;

ret=0;
if (readenv(p,"OPENBLAS_NUM_THREADS")) ret = atoi(p);
if(ret<0) ret=0;
if(ret != 0 || openblas_env_openblas_num_threads == 0)
openblas_env_openblas_num_threads=ret;

ret=0;
if (readenv(p,"GOTO_NUM_THREADS")) ret = atoi(p);
if(ret<0) ret=0;


Loading…
Cancel
Save