Menu Close

Remotely use server GPU and deep learning development environment with local PyCharm and SSH

Remote data crunching machine

Step1: Setup SSH (if you did not install or use ssh before)

Note: In most cases, your machine should already be able to connect the server with ssh. Thus, this step may be not needed for you.

In order to be able to communicate with your local-machine, you need to install SSH on it. Open up a terminal on your stationary computer and get it:

sudo apt-get install ssh

Enable SSH X11-forwarding so that you can plot things, open the configuration file like this.

sudo vim /etc/ssh/sshd_config
X11Forwarding yes

Step2: Install GPU driver, Cuda, Cudnn (if you did not install)

Step3: Install Anaconda with Keras, Tensorflow, Pytorch on the server (if you did not install)

Set your local computer

Open up your laptop and connect it to the same local network as your stationary machine.

Step 4: PyCharm professional version IDE.https://www.jetbrains.com/pycharm/download/#section=mac

Step 5: Setup PyCharm

setup it by following the PyCharm tutorial of the remote connection to the server, which is shown as below:

PyCharm->Preference->Project: nameofyourproject->Project Interpreter:

PyCharm->Preference->Build, Execu….-> Deployment->Console:

Run->Edit Configuration:

Testing the setup

Now we should be all done, it’s time to test our setup. First open a terminal and make sure that you have at least one SHH channel connected your server. If you have had a connections open for a while, you may have to exit and restart them:

ssh [remote username here]@[remote Ip here]
you can do this by following in PyCharm:

Console

Then open the “Python Console” in the lower bar in PyCharm and type import tensorflow. if no error, it should tell your work is done well.

Running script

Let’s do some plotting, change your test.py file to this:

import tensorflow
import matplotlib.pyplot as plt
import numpy as np
print "Tensorflow Imported"
plt.plot(np.arange(100))
plt.show()

And then run it with your run configuration “Test”, you should get this plot.

https://medium.com/@erikhallstrm/work-remotely-with-pycharm-tensorflow-and-ssh-c60564be862d