☆CUDA 出错 debug 注意点

  1. 运行程序之前,在运行程序的命令行窗口,执行 export CUDA_LAUNCH_BLOCKING=1 以获得准确的出错日志。没有运行之前的报错位置会更后面一些。

    In general, when encountering cuda runtine errors, it is advisable to run your program again using the CUDA_LAUNCH_BLOCKING=1 flag to obtain an accurate stack trace.
    来源:https://stackoverflow.com/questions/51691563/cuda-runtime-error-59-device-side-assert-triggered

    You didn't run this example with CUDA_LAUNCH_BLOCKING=1 so the backtraces are too late--if you rerun with this envvar you'll get better back traces
    来源:https://github.com/pytorch/pytorch/issues/25537#issuecomment-527452087

你可能感兴趣的:(☆CUDA 出错 debug 注意点)