Process finished with exit code -1073740791 (0xC0000409) error solution

1. Problem description

When using Pycharm to run a deep learning network, the following error occurs:

Process finished with exit code -1073740791 (0xC0000409)

2. Problem Analysis

The above error occurs, generally caused by insufficient video memory of the graphics card. So you can go through the following steps to check one by one:

  1. Judge whether your environment is well configured, especially cuda and cudnn
  2. Determine if the graphics card driver is installed or needs to be updated
  3. If it is under Windows, you can open the task manager and check the GPU memory.

As shown in the picture below, you can find that my computer has two GPUs, where GPU 0 is the integrated graphics card and GPU 1 is the discrete graphics card. In general, we use more powerful discrete graphics cards to train the network. Therefore, in the main program, it is best to specify the graphics card when training for the first time; if not, the system may use GPU 0 by default, resulting in insufficient video memory.
insert image description here

3. Solutions

Specify to use GPU 1 for training, generally need to add the following code before the main program:

import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "1"

Of course, if you have multiple graphics cards, you can also specify them together:

import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,2,3"  #指定第2,3,4张显卡处理

Guess you like

Origin blog.csdn.net/wjinjie/article/details/124024926