File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2922,6 +2922,7 @@ void *blas_memory_alloc(int procpos){
2922
2922
blas_unlock (& memory [position ].lock );
2923
2923
#endif
2924
2924
if (!memory [position ].addr ) {
2925
+ int failcount = 0 ;
2925
2926
do {
2926
2927
#ifdef DEBUG
2927
2928
printf ("Allocation Start : %lx\n" , base_address );
@@ -2973,8 +2974,16 @@ void *blas_memory_alloc(int procpos){
2973
2974
#ifdef DEBUG
2974
2975
printf (" Success -> %08lx\n" , map_address );
2975
2976
#endif
2976
- if (((BLASLONG ) map_address ) == -1 ) base_address = 0UL ;
2977
-
2977
+ if (((BLASLONG ) map_address ) == -1 ) {
2978
+ base_address = 0UL ;
2979
+ failcount ++ ;
2980
+ if (failcount > 10 ) {
2981
+ fprintf (stderr , "OpenBLAS error: Memory allocation still failed after 10 retries, giving up.\n" );
2982
+ exit (1 );
2983
+ }
2984
+ } else {
2985
+ failcount = 0 ;
2986
+ }
2978
2987
if (base_address ) base_address += BUFFER_SIZE + FIXED_PAGESIZE ;
2979
2988
2980
2989
} while ((BLASLONG )map_address == -1 );
You can’t perform that action at this time.
0 commit comments