Stopping a GPU Process

I am running my deep learning code on GPU and my OS is ubuntu. How to stop the code when it is in the middle of the execution so the process stops occupying the GPU? in simpler term, what is the correct way to stop the code? I use ctrl+Z but the processes pile up on the GPU and I need to kill them at some point.
I appreciate your guidance.

Hi @papoo13,

Using Ctrl + Z suspends a job (which can then be resumed). You can cancel a job via Ctrl + C. If you want to resume a job, which has been suspended via Ctrl + Z, you can type fg to resume the job.

1 Like

but Ctrl+C only gives me --KeyboardIntrrupt–

Ctrl + C kills a job. Can’t resume that.

Ctrl + Z suspends a job, which you can resume via fg

When I type Ctrl+C, I see the message I mentioned above. So the terminal is inaccessible. What should ones do after typing Ctrl+C and seeing KeyboardIntrupt?