VS Code Development

From TAMUQ Research Computing User Documentation Wiki
Jump to navigation Jump to search


Vscdev.png


Context

In recent years, Visual Studio Code (VS Code) has skyrocketed in popularity, becoming a go-to choice for developers of all experience levels.
This free, Microsoft open-source code editor, displays a user-friendly interface together with an extensive language support, and numerous features that keep growing.
From syntax highlighting to debugging and integrated Git control, VS Code empowers developers to write clean code while providing them a unique interface for all their coding-related activities.

==> That's why, RC Team is encouraging all TAMUQ members to use this IDE through their software development journey (even if they don't plan to port their code to Raad2).

VS Code Installation

  • As it is a Microsoft product, its installation is straight forward as shown in the below video:

Vscodeinstall2.png

  • Notice that, if you are under Windows but you intend to develop your software on Linux, you can still install VS Code on your Windows machine and then start a Remote Development session.
    • This is the topic of the next chapter.

Remote Development

  • In the recent year, Microsoft has became more and more friendly toward Linux users, offering them a panel of tools to simplify the use of Linux, directly from within Windows OS.
  • So, if you are on Windows but you intend to develop your software on Linux, you simply need to start a Remote Development session, from VS Code.
  • From such session, you can SSH into :
  • In this chapter we will focus on the former, as we want to demonstrate how to remotely develop software, from your local machine, to Raad2 HPC, utilising VS Code as Gateway:

Vscodebridge2.png

  • Here is the simple procedure to set up such kind of environment on your Windows machine:

Remotemin2.png

  • At the end of the procedure, you shall be able to leverage VS Code features, in a remote environment
  • For instance, from your Windows machine, you will be able to remotely connect to any Linux instance and have the below workspace:

Mainbenefvscode.png

SSH Key authentication

  • In general, using an encryption key mechanism to authenticate yourself, is more secure (and also more handy) than only relying on a username and a password.
    • For more details, please take a look at this nice explanation: SSH Keys
  • This holds true in our context, when we want to remotely connect to Raad2 HPC, the preferred way is to use the so-called SSH Keys
  • This approach will solve 2 issues:
    • It will help to establish a more secured connection
    • It will prevent VS Code to keep prompting for your password every once in a while, as you have noticed in the previous video
  • This is a simple way to generate and use SSH Keys to connect to Raad2 via VS Code:

Minsshkey2.png

VS Code gems

  • There are different ways to develop software through VS code, as it provides so many free-to-use "Extensions"
    • These extensions are either developed by Microsoft or, by other regular users
    • In fact, you can develop your own VS Code extension if you want !
  • This makes the tool so powerful and versatile, that all its interesting features can't be highlighted in a single wiki page
  • However, we will focus on a few essential ones

Essential features

  • Code writing (Python, C/C++, Fortran, Julia, R, Java...)
    • Semantic highlighting and code completion
    • As-you-type code errors detection
    • Code navigation
    • Package Management (e.g: Python Environment Manager)
  • Debugging
    • Breakpoints setting
    • Line by line navigation
    • Variables monitoring
    • Call stack view
  • Version control
    • Git Branching, Merging, Committing, Pushing/Pulling
    • Code modification highlight
    • Code Rollback
  • SLURM
    • Job View (status, output, source)
    • Job Actions (run, cancel)
    • Syntax highlight

==> An upcoming Video will highlight these features

Additional Extensions to explore

Scientific applications

  • ANSYS APDL
  • MATLAB for VS Code
  • Wolfram language for VS Code (Mathematica)
  • ROOT File Viewer
  • LAMMPS Syntax Highlighting
  • GROMACS gmxhelper
  • Topas Syntax Highlighting
  • Abaqus Syntax Highlighting
  • md-highlighter
    • syntax highlight for most types dealing with modeling and molecular dynamics simulation; for tools like NAMD, Gromacs, Small molecul...
  • CMG Syntax

Development tools

  • Jupyter for VS Code
  • Intel Development toolkits (OneAPI)
    • Profiling and Analysing (Intel VTune)
    • OneAPI environment configurator
  • CMake for VS Code
  • OpenJDK Development
  • LaTeX for VS Code

GPU-related

  • Python Image Preview
    • display Pyhton image data from librairies like PyTorch, NumPy, Matplotlib, TensorFlow, Pillow...
  • TensorFlow Snippets
  • CUDA Syntax Highlighting (C++)
  • INTEL GPU Debug
  • GPU Environment
  • Nvidia Status Bar

Tool Environment

  • Python Environment Manager
    • install and display all Pyhton environments grouped by type: Conda, Venv, Pip, PyEnv...
  • WSL for VS Code
  • VirtualBox for VS Code
  • HDF5 Viewer