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){
29222922 blas_unlock (& memory [position ].lock );
29232923#endif
29242924 if (!memory [position ].addr ) {
2925+ int failcount = 0 ;
29252926 do {
29262927#ifdef DEBUG
29272928 printf ("Allocation Start : %lx\n" , base_address );
@@ -2973,8 +2974,16 @@ void *blas_memory_alloc(int procpos){
29732974#ifdef DEBUG
29742975 printf (" Success -> %08lx\n" , map_address );
29752976#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+ }
29782987 if (base_address ) base_address += BUFFER_SIZE + FIXED_PAGESIZE ;
29792988
29802989 } while ((BLASLONG )map_address == -1 );
You can’t perform that action at this time.
0 commit comments