Skip to content
GitLab
  • Explore
  • Sign in
  • EDA Guides
  • eda-servers-guide
  • Wiki
  • remote code

remote code · Changes

Page history
Update remote code authored Oct 04, 2023 by Daniele Jahier Pagliari's avatar Daniele Jahier Pagliari
Hide whitespace changes
Inline Side-by-side
remote-code.md
View page @ a65f8fea
# Remote Code Deployment # Remote Code Deployment
Many modern IDEs offer ways to setup your project so that you can: Many modern IDEs offer ways to setup your project so that you can:
- Use your local computer for editing source code, debugging, etc. - Use your local computer for editing source code, debugging, etc.
- Run (deploy) your program on a remote machine, such as one of the servers. - Run (deploy) your program on a remote machine, such as one of the servers.
You are welcome and encouraged to use any such kind of deployment mechanism that is compatible with ssh (i.e., the main mechanism used to access the server, see ["Connecting to the Servers"](/connection). You are welcome and encouraged to use any such kind of deployment mechanism that is compatible with ssh (i.e., the main mechanism used to access the server, see ["Connecting to the Servers"](/connection).
For people with access to `icaro.polito.it`, this automatic remote deployment is also helpful for working in folders that are periodically erased (see ["Storage Management and Quotas"](/storage)). In fact, most IDEs will automatically re-upload the local copy of your files to the remote machine if they detect that some files have been deleted.
The rest of this page contains a short guide on how to setup remote deployment on the [PyCharm](https://www.jetbrains.com/pycharm/) Python IDE by JetBrains. Instructions are similar for other JetBrain tools. If you use a different IDE, it would be very helpful if you could prepare a similar guide and share it with the sysadmins to include in this page. The rest of this page contains a short guide on how to setup remote deployment on the [PyCharm](https://www.jetbrains.com/pycharm/) Python IDE by JetBrains. Instructions are similar for other JetBrain tools. If you use a different IDE, it would be very helpful if you could prepare a similar guide and share it with the sysadmins to include in this page.
## Remote Deployment with PyCharm ## Remote Deployment with PyCharm
...@@ -28,7 +27,7 @@ Figure 1 shows an example for hostname `icaro.polito.it` and username `YOUR_ID`. ...@@ -28,7 +27,7 @@ Figure 1 shows an example for hostname `icaro.polito.it` and username `YOUR_ID`.
**Figure 1:** **Figure 1:**
<img src="./figures/pycharm1.png" width="500"> ![](./figures/pycharm1.png)
Then, insert your authentication details to connect to the target server in the next dialog. Then, insert your authentication details to connect to the target server in the next dialog.
...@@ -38,38 +37,37 @@ In the following dialog, you can select the path of the Python executable that y ...@@ -38,38 +37,37 @@ In the following dialog, you can select the path of the Python executable that y
**Figure 2:** **Figure 2:**
<img src="./figures/pycharm2.png" width="500"> ![](./figures/pycharm2.png)
You can either set this path to the system-wide installation of your preferred Python version, or (more commonly) to a project-level virtualenv (see ["Python Virtual Environments"](/virtualenv)). You can either set this path to the system-wide installation of your preferred Python version, or (more commonly) to a project-level virtualenv (see ["Python Virtual Environments"](/virtualenv)).
As shown in Figure 3, PyCharm will let you navigate graphically the directories of the server and select your preferred Python path. For virtualenvs, the executable path is `<virtualenv-root>/bin/python`. As shown in Figure 3, PyCharm will let you navigate graphically the directories of the server and select your preferred Python path. For virtualenvs, the executable path is `<virtualenv-root>/bin/python`.
**Figure 3:** **Figure 3:**
<img src="./figures/pycharm3.png" width="300"> ![](./figures/pycharm3.png)
The figure shows an example for a virtualenv located in the user's home directory and named `py`. The figure shows an example for a virtualenv located in the user's home directory and named `py`.
**IMPORTANT:** since the virtualenv is not part of your Python project, differently from your source files, it will not be synchronized automatically between local and remote machine by PyCharm. This means that you should create your virtualenvs in a folder that will *not* be deleted automatically. This is especially important for servers other than philae, where some folders are periodically erased (see ["Storage Management and Quotas"](/storage)). **IMPORTANT:** since the virtualenv is not part of your Python project, differently from your source files, it will not be synchronized automatically between local and remote machine by PyCharm.
#### Setup Automatic Synchronization of Project Files #### Setup Automatic Synchronization of Project Files
Lastly, you have to setup the automatic synchronization of Python files from your local machine to the remote server. In the window shown in Figure 2, select the option: "Automatically upload project files to the server". Then click on the folder icon at the right of "Sync Folders" and change the "Remote Path" to the location where you want your project files to reside on the server. Lastly, you have to setup the automatic synchronization of Python files from your local machine to the remote server. In the window shown in Figure 2, select the option: "Automatically upload project files to the server". Then click on the folder icon at the right of "Sync Folders" and change the "Remote Path" to the location where you want your project files to reside on the server.
Figure 4 shows an example where a local project found in `~/Documents/code/my_project` is synchronized with the remote folder `/space/<username>/my_project`. Figure 4 shows an example where a local project found in `~/Documents/code/my_project` is synchronized with the remote folder `/space/<username>/my_project`.
**Figure 4:** **Figure 4:**
<img src="./figures/pycharm4.png" width="500"> ![](./figures/pycharm4.png)
**IMPORTANT:** the Python virtualenv does *not* need to be in the same folder as your project. In fact, in many cases it could be better to have them in separate folders, for the reasons explained below. For instance, on `icaro.polito.it`, it may be convenient to have your virtualenv in `/home` and your project in `/space` **IMPORTANT:** the Python virtualenv does _not_ need to be in the same folder as your project. In fact, in many cases it could be better to have them in separate folders, for the reasons explained below. For instance, on `icaro.polito.it`, it may be convenient to have your virtualenv in `/home` and your project in `/space`
#### Finish the Interpreter Setup #### Finish the Interpreter Setup
Lastly, click "Finish" on the dialog shown in Figure 2 to complete the setup of your remote interpreter. You can now run (and debug) your Python code running on the server directly from your local machine, without the need of a permanent GUI session. Lastly, click "Finish" on the dialog shown in Figure 2 to complete the setup of your remote interpreter. You can now run (and debug) your Python code running on the server directly from your local machine, without the need of a permanent GUI session.
Notice that remote execution is interrupted if you lose your internet connection to the server. So, for long-running programs, a permanent shell could still be necessary (see ["Connecting to the Servers"](/connection)). However, this mechanism is very convenient for development, short tests, debugging, etc. Notice that remote execution is interrupted if you lose your internet connection to the server. So, for long-running programs, a permanent shell could still be necessary (see ["Connecting to the Servers"](/connection)). However, this mechanism is very convenient for development, short tests, debugging, etc.
#### Accessing Remote Files #### Accessing Remote Files
...@@ -79,6 +77,4 @@ To do so, simply select `Tools/Deployment/Browse Remote Host`. ...@@ -79,6 +77,4 @@ To do so, simply select `Tools/Deployment/Browse Remote Host`.
#### Credits #### Credits
Thanks to Giovanni Zara for providing the first draft of this guide. Thanks to Giovanni Zara for providing the first draft of this guide.
\ No newline at end of file
Clone repository
Home

Servers Information
Accounts
Connecting to the Servers
Storage Management and Quotas
Monitoring Resources
Software, Libraries and Data
  • Using Custom Software
  • Software Modules on Philae
  • Remote Code Deployment
  • Python Virtual Environments
  • EDA Technology Libraries
  • Shared Datasets
Miscellaneous Settings
  • Setting Up CUDA Libraries
  • Choosing which GPU to Use
  • Limiting GPU Memory
  • Limiting CPU Threads
Gitlab

Sidebar