LocalGPU VS Code Extension
LocalGPU is a Visual Studio Code extension designed to seamlessly connect your local or cloud-based GPU to Jupyter notebooks within the VS Code environment. With this extension, you can execute Python and machine learning code on a remote GPU by simply providing an SSH connection to the remote server. The extension automates the process of setting up Jupyter on the remote machine for local access.
Features
- Remote GPU Access: Connect your VS Code environment to any remote GPU via SSH.
- Automated Jupyter Setup: The extension automatically sets up Jupyter on the remote server if it’s not already installed.
- Seamless Execution: Execute Jupyter notebooks on a remote server while interacting with them locally in VS Code.
Prerequisites
Before using the LocalGPU extension, ensure you have the following:
- Visual Studio Code installed on your local machine.
- Jupyter Extension for VS Code (
ms-toolsai.jupyter
).
- A remote server (local machine, cloud GPU, or on-premise server) that has SSH enabled.
- The SSH login credentials to the remote server.
- Python and Jupyter installed on the remote machine. If not, the plugin will install them for you.
Installation
- Install the LocalGPU Extension:
- Open Visual Studio Code.
- Navigate to the Extensions tab (or press
Ctrl+Shift+X
).
- Search for localGPU and install the extension.
How to Use
Step 1: Connect to Remote GPU
Press Ctrl+Shift+P
to open the Command Palette in VS Code.
Type LocalGPU: Connect GPU
and select it from the list.
Enter your SSH command in the prompt. The format should be:
ssh <user>@<remote-server-address> -p <port-number>
Example:
ssh ubuntu@192.168.1.100 -p 22
Once the command is entered, the extension will attempt to connect to the remote server. If successful, it will show a notification:
Connected to GPU successfully.
Step 2: Access Jupyter Notebooks Locally
After Jupyter is set up and the server is running:
- Open a new Jupyter notebook in VS Code.
- You should see a Local GPU Server as a kernel option in the Jupyter notebooks.
- Select the kernel to run all your Jupyter cells on the connected remote GPU.
Troubleshooting
Connection Issues
- If you see the message
Failed to connect to GPU
, ensure that:
- The SSH server is running on the remote machine.
- The SSH port (usually
22
) is open and accessible.
- You have the correct username, password, or key file for authentication.
FAQs
1. How do I know if my GPU is connected?
Once connected, you will receive a notification in VS Code. You can also verify the connection by running a command in a Jupyter notebook cell and ensuring that the kernel is connected to the Local GPU Server.
2. What happens if the remote port is already in use?
please kill the process running on your local 8888 port.
Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Push the branch and create a pull request.
License
This project is licensed under the MIT License. See the LICENSE
file for more information.
By using LocalGPU, you can easily leverage the power of remote GPUs for your Jupyter notebooks within the VS Code environment. Happy coding! 🚀