I'm running deep learning codes.
My pc is poor so I'm using pycharm which connects remote server by ssh.
Here comes the problem:
- The default server environment doesn't connect to gpu
- I need to use commond like
salloc --cpus-per-task=4 --gres=gpu:tesla_v100-pcie-32gb:1 -t 20:0:0to getting into a new environment which connect to gpu. - When I press RUN or DEBUG in pycharm, it will start a new ssh connection, rushing into the default environment which doesn't connect to gpu. RUN button and DEBUG button
What I know is that: I can use terminal to salloc and then use commond python xx.py to run the script. But what I really want is to use the fantastic DEBUG function of pycharm.What I know about terminal
What I have tried are as follows:
- I tried to use
os.system("salloc --cpus-per-task=4 --gres=gpu:tesla_v100-pcie-32gb:1 -t 20:0:0")at the beginning of python script. But unfortunately, the program stuck after this command, and getting into a shell openned bysallocmy code result after pressing RUN the program didn't stop - I assumed after the operation of 1, the ssh connection should on the salloced session. So I annotated the os code, and stop and RE-RUN. It failed. Maybe pycharm reconnect ssh to the default environment which doesn't connect to gpu.my modified code result after RE-RUN
Here is my final question: How to let pycharm use some command to salloc an environment on the ssh server first and then RUN or DEBUG my code?
Similar discussions can be found here: Running remote interpreter on a cluster with srun