paddlepaddle to train the model, there is a problem that the model training has ended, but the GPU memory is still occupied, which affects the next training. In order to be able to automatically release the GPU memory after the model training is over, refer to the method of releasing memory by multi-process by Tensorflow. The model training of
paddlepaddle can be put into multi-process, so that the GPU resources will be automatically executed after the training process is over. Release.
But sometimes when using
multiprocessing to train
paddlepaddle model, will get
CUDA error(3), initialization error.
Refer to the issue discussion of
paddlepaddle on github and found that
all the modules related to
paddleare imported in
multiprocessingand do not import outside of the multi-process. These modules can run normally, so that the corresponding resources will be automatically after the end of the process. freed.