@@ -1317,7 +1317,11 @@ UNLOCK_COMMAND(&alloc_lock);
13171317 error :
13181318 printf ("OpenBLAS : Program will terminate because you tried to allocate too many TLS memory regions.\n" );
13191319 printf ("This library was built to support a maximum of %d threads - either rebuild OpenBLAS\n" , NUM_BUFFERS );
1320- printf ("with a larger NUM_THREADS value or set the environment variable OPENBLAS_NUM_THREADS to\n" );
1320+ #ifdef USE_OPENMP
1321+ printf ("with a larger NUM_THREADS value or set the environment variable OMP_NUM_THREADS to\n" );
1322+ #else
1323+ printf ("with a larger NUM_THREADS value or set the environment variable OPENBLAS_NUM_THREADS to\n" );
1324+ #endif
13211325 printf ("a sufficiently small number. This error typically occurs when the software that relies on\n" );
13221326 printf ("OpenBLAS calls BLAS functions from many threads in parallel, or when your computer has more\n" );
13231327 printf ("cpu cores than what OpenBLAS was configured to handle.\n" );
@@ -3039,8 +3043,13 @@ void *blas_memory_alloc(int procpos){
30393043#endif
30403044 if (memory_overflowed ) goto terminate ;
30413045 fprintf (stderr ,"OpenBLAS warning: precompiled NUM_THREADS exceeded, adding auxiliary array for thread metadata.\n" );
3046+ fprintf (stderr ,"Note that your application may still crash, if it is calling OpenBLAS from multiple threads in parallel\n" );
30423047 fprintf (stderr ,"To avoid this warning, please rebuild your copy of OpenBLAS with a larger NUM_THREADS setting\n" );
3048+ #ifdef USE_OPENMP
3049+ fprintf (stderr ,"or set the environment variable OMP_NUM_THREADS to %d or lower\n" , MAX_CPU_NUMBER );
3050+ #else
30433051 fprintf (stderr ,"or set the environment variable OPENBLAS_NUM_THREADS to %d or lower\n" , MAX_CPU_NUMBER );
3052+ #endif
30443053 memory_overflowed = 1 ;
30453054 MB ;
30463055 new_release_info = (struct release_t * ) malloc (NEW_BUFFERS * sizeof (struct release_t ));
@@ -3142,7 +3151,11 @@ void *blas_memory_alloc(int procpos){
31423151#endif
31433152 printf ("OpenBLAS : Program is Terminated. Because you tried to allocate too many memory regions.\n" );
31443153 printf ("This library was built to support a maximum of %d threads - either rebuild OpenBLAS\n" , NUM_BUFFERS );
3145- printf ("with a larger NUM_THREADS value or set the environment variable OPENBLAS_NUM_THREADS to\n" );
3154+ #ifdef USE_OPENMP
3155+ printf ("with a larger NUM_THREADS value or set the environment variable OMP_NUM_THREADS to\n" );
3156+ #else
3157+ printf ("with a larger NUM_THREADS value or set the environment variable OPENBLAS_NUM_THREADS to\n" );
3158+ #endif
31463159 printf ("a sufficiently small number. This error typically occurs when the software that relies on\n" );
31473160 printf ("OpenBLAS calls BLAS functions from many threads in parallel, or when your computer has more\n" );
31483161 printf ("cpu cores than what OpenBLAS was configured to handle.\n" );
0 commit comments