Difference between revisions of "VS Code Remote Development"
Jump to navigation
Jump to search
Jack.eakle (talk | contribs) |
(The name of the program is "Visual Studio Code" which is typically abbreviated as "VS Code", not "VSCode") |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | This guide provides information on running | + | This guide provides information on running VS Code Remote Development on HiPerGator, including running Jupyter notebooks. This has been updated in December 2022 when Microsoft [https://code.visualstudio.com/blogs/2022/12/07/remote-even-better integrated Remote Development into VS Code]. |
Why might you want to do this? | Why might you want to do this? | ||
− | * | + | * VS Code is a nice IDE with many great features, including [https://github.com/features/copilot GitHub Copilot] (which most UF users should be able to access for free--via either student or faculty/staff [https://education.github.com/ GitHub Education] plans). |
* [https://www.rc.ufl.edu/get-started/hipergator/ HiPerGator] provides a powerful compute environment with thousands of cores, petabytes of storage, and powerful GPUs. | * [https://www.rc.ufl.edu/get-started/hipergator/ HiPerGator] provides a powerful compute environment with thousands of cores, petabytes of storage, and powerful GPUs. | ||
* But, combining the two can be problematic... | * 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. | ** 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. | ** You can accidentally end up running scripts on the login servers and have your account suspended. | ||
− | ** Running | + | ** Running VS Code on HiPerGator through OOD is kind of slow and limiting in terms of extensions and updates. |
− | * With | + | * With VS Code 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 | + | == Install VS Code in your ~/bin folder == |
− | This may become somewhat optional as Research Computing updates | + | This may become somewhat optional as Research Computing updates VS Code, but this does give you full control over the version to use. |
If missing ~/bin, create it with | If missing ~/bin, create it with | ||
mkdir ~/bin | mkdir ~/bin | ||
− | # Download the x64 CLI for Linux package from the [https://code.visualstudio.com/#alt-downloads | + | # Download the x64 CLI for Linux package from the [https://code.visualstudio.com/#alt-downloads VS Code Downloads site ]. |
# Transfer the download to HiPerGator. | # Transfer the download to HiPerGator. | ||
# Extract the tar.gz file and copy the binary to ~/bin: | # Extract the tar.gz file and copy the binary to ~/bin: | ||
Line 27: | Line 27: | ||
cp code ~/bin/ | cp code ~/bin/ | ||
− | == First run: Launch a development session and start | + | == First run: Launch a development session and start VS Code tunnel== |
# See [https://help.rc.ufl.edu/doc/Development_and_Testing this page for information on development sessions HiPerGator], but something like this should work: <code>srun --mem=4gb --time=01:00:00 --pty bash -i</code> | # See [https://help.rc.ufl.edu/doc/Development_and_Testing this page for information on development sessions HiPerGator], but something like this should work: <code>srun --mem=4gb --time=01:00:00 --pty bash -i</code> | ||
− | # Start | + | # Start VS Code Server: <code>code tunnel</code> |
== For daily use == | == For daily use == | ||
− | Now that | + | Now that VS Code is setup, it should be relatively easy to start. For the most part, the process is: |
# Log into HiPerGator | # Log into HiPerGator | ||
Line 42: | Line 42: | ||
#* Load Jupyter and the module you need for the kernel you want to use, e.g. for Tensorflow: <code>module load jupyter tensorflow/2.7.0</code> | #* Load Jupyter and the module you need for the kernel you want to use, e.g. for Tensorflow: <code>module load jupyter tensorflow/2.7.0</code> | ||
#* Export the <code>XDG_RUNTIME_DIR</code> to set temp directory (otherwise it tries to use <code>/run/user/</code>, which you can't be written to!): <code>export XDG_RUNTIME_DIR=${SLURM_TMPDIR}</code> | #* Export the <code>XDG_RUNTIME_DIR</code> to set temp directory (otherwise it tries to use <code>/run/user/</code>, which you can't be written to!): <code>export XDG_RUNTIME_DIR=${SLURM_TMPDIR}</code> | ||
− | # Start | + | # Start VS Code tunnel: <code>code tunnel</code> |
#*This can all be done with this line: <code>'''module load jupyter tensorflow/2.7.0; export XDG_RUNTIME_DIR=${SLURM_TMPDIR}; code tunnel'''</code> | #*This can all be done with this line: <code>'''module load jupyter tensorflow/2.7.0; export XDG_RUNTIME_DIR=${SLURM_TMPDIR}; code tunnel'''</code> | ||
# Connect to the URL provided in your browser. | # Connect to the URL provided in your browser. | ||
− | #*Once you open VS | + | #*Once you open VS Code in the browser, open the command palette (ctrl+shift+p) and select the appropriate Jupyter Interpreter. |
# Code away! | # Code away! |
Revision as of 16:24, 30 January 2024
This guide provides information on running VS Code Remote Development on HiPerGator, including running Jupyter notebooks. This has been updated in December 2022 when Microsoft integrated Remote Development into VS Code.
Why might you want to do this?
- VS Code 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 VS Code on HiPerGator through OOD is kind of slow and limiting in terms of extensions and updates.
- With VS Code 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 VS Code in your ~/bin folder
This may become somewhat optional as Research Computing updates VS Code, but this does give you full control over the version to use.
If missing ~/bin, create it with
mkdir ~/bin
- Download the x64 CLI for Linux package from the VS Code 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 VS Code tunnel
- See this page for information on development sessions HiPerGator, but something like this should work:
srun --mem=4gb --time=01:00:00 --pty bash -i
- Start VS Code Server:
code tunnel
For daily use
Now that VS Code 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 example, for a session requesting 4 cores, 15GB of RAM, an A100 GPU for 1 hour:
srun -c 4 --mem 15gb -p gpu --gres gpu:a100:1 -t 60 --pty bash -i
- For example, for a session requesting 4 cores, 15GB of RAM, an A100 GPU for 1 hour:
- 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 VS Code 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!