VS Code Remote Development
Revision as of 20:54, 30 January 2023 by Riteshchowdhry (talk | contribs) (Adding extra step to be able to run jupyter notebook)
This guide provides information on running VSCode Remote Development on HiPerGator, including running Jupyter notebooks. This has been updated in December 2022 when Microsoft integrated Remote Development into VSCode.
Why might you want to do this?
- VSCode is a nice IDE with many great features, including GitHub Copilot (which most UF users should be able to access for free--via either student or faculty/staff GitHub Education plans).
- HiPerGator provides a powerful compute environment with thousands of cores, petabytes of storage, and powerful GPUs.
- But, combining the two can be problematic...
- Remote SSH setup is complicated by MFA and the need to tunnel into a compute server with your running job. This can be worked out, but is a bit cumbersome.
- You can accidentally end up running scripts on the login servers and have your account suspended.
- Running VSCode on HiPerGator through OOD is kind of slow and limiting in terms of extensions and updates.
- With VSCode Remote Development, you can startup the server within an interactive job with whatever resources you have requested and connect to it in your web browser. No MFA issues, install your desired extensions, connect to GitHub Copilot, run and debug your code easily!
Install VSCode in your ~/bin folder
This may become somewhat optional as Research Computing updates VSCode, but this does give you full control over the version to use.
- Download the x64 CLI for Linux package from the VSCode Downloads site .
- Transfer the download to HiPerGator.
- Extract the tar.gz file and copy the binary to ~/bin:
tar -xvf vscode_cli_alpine_x64_cli.tar.gz cp code ~/bin/
First run: Launch a development session and start VSCode tunnel
- See [this page for information on development sessions HiPerGator](Development_and_Testing), but something like this should work:
srun --mem=4gb --time=01:00:00 --pty bash -i
- Start VSCode Server:
code tunnel
For daily use
Now that VSCode is setup, it should be relatively easy to start. For the most part, the process is:
- Log into HiPerGator
- Start a development session, requesting GPUs if needed, and other resources for the time you want to work.
- For Jupyter notebooks it is important to:
- Load Jupyter and the module you need for the kernel you want to use, e.g. for Tensorflow:
module load jupyter tensorflow/2.7.0
- Export the
XDG_RUNTIME_DIR
to set temp directory (otherwise it tries to use/run/user/
, which you can't be written to!):export XDG_RUNTIME_DIR=${SLURM_TMPDIR}
- Load Jupyter and the module you need for the kernel you want to use, e.g. for Tensorflow:
- Start VSCode tunnel:
code tunnel
- This can all be done with this line:
module load jupyter tensorflow/2.7.0; export XDG_RUNTIME_DIR=${SLURM_TMPDIR}; code tunnel
- This can all be done with this line:
- Connect to the URL provided in your browser.
- Once you open VS code in the browser, open the command palette (ctrl+shift+p) and select the appropriate Jupyter Interpreter.
- Code away!