homer512 icon

NVML leak test

homer512 | PRO | 07/09/24 08:53:04 PM UTC | 0 ⭐ | 14277 👁️ | Never ⏰ | []
C |

1 KB

|

Source Code

|

0 👍

/

0 👎

/* Based on the CUDA example */
 
#include <stdio.h>
#include <nvml.h>
 
int main(void)
{
    nvmlReturn_t result;
    int i;
 
    /* Change loop counter to see if there is a leak */
    for(i = 0; i < 1000; ++i) {
        result = nvmlInit();
        if (NVML_SUCCESS != result) { 
            printf("Failed to initialize NVML: %s\n", nvmlErrorString(result));
      
            printf("Press ENTER to continue...\n");
            getchar();
            return 1;
        }
 
        result = nvmlShutdown();
        if (NVML_SUCCESS != result) {
            printf("Failed to shutdown NVML: %s\n", nvmlErrorString(result));
            return 1;
        }
    }
    printf("All done.\n");
 
    printf("Press ENTER to continue...\n");
    getchar();
    return 0;
 
Error:
    result = nvmlShutdown();
    if (NVML_SUCCESS != result)
        printf("Failed to shutdown NVML: %s\n", nvmlErrorString(result));
 
    printf("Press ENTER to continue...\n");
    getchar();
    return 1;
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎