Exemplo n.º 1
0
void cupti_assert(int loc, CUptiResult res)
{
    if (CUPTI_SUCCESS == res) return;

    // Get error message
    const char *err = "Unknown error";
    cuptiGetResultString(res, &err);

    // Output. Don't do anything else - we expect this to not happen,
    // and it's certainly not worth crashing the program for.
    fprintf(stderr, "Unexpected CUPTI error at cupti_metrics.c:%d: %s\n", loc, err);
}
/*
 * Handles errors returned from CUPTI function calls.
 * 
 * @param ecode the CUDA driver API error code
 * @param msg a message to get more detailed information about the error
 * @param the corresponding file
 * @param the line the error occurred
 */
void vt_cupti_handleError(CUptiResult err, const char* msg,
                          const char *file, const int line)
{
  const char *errstr;
  
  if(msg != NULL) vt_cntl_msg(1, msg);
  
  cuptiGetResultString(err, &errstr);
  
  if(vt_gpu_error){
    vt_error_msg("[CUPTI] %s:%d:'%s'", file, line, errstr);
  }else{
    vt_warning("[CUPTI] %s:%d:'%s'", file, line, errstr);
  }
}