---
# System prepended metadata

title: VSC

---

# VSC
[VSC Document](https://docs.vscentrum.be/en/latest/)

## How to start
1. Generate a public key (press enter for several times)
    ```
    ssh-keygen -t ed25519 -b 256
    ssh-keygen -t rsa -b 4096
    ```
2. Add the public key to [VSC - edit account](https://account.vscentrum.be/django/).
3. Add the following to  ~/.ssh/config (change User to your Uid)
    ```
    Host vsc
      HostName login-genius.hpc.kuleuven.be
      User vsc35642
    ```
    You can also add lovelace and gauss here. (I don't remember the name of the third NUMA server.)
4. Connect VSC in a terminal
    ```
    ssh vsc
    ```
    
    


## Some command for login node
check credits
```
$ sam-balance  
```

Take up a node and a CPU on it
```
$ srun --account=lp_edu_alg_parallel_comp -N1 -n1 --partition=batch --mem=10GB --time=0-01:00:00 --pty bash -i 
```

Commands I can do on the login node
```
$ ssh r22giide(node)    # Login to the node
$ sinfo                 # Check all the node
$ squeue                # Check my queue
$ scancel JOBID         # Cancel a job
```


## Some commands for tmux
Open a terminal-similar thing which won't be closed (green bar will occur if success)
```
tmux
```

List all the terminals
```
tmux ls
```

Go back to tmux
```
tmux a -d -t No.
tmux a 	# go back to the most recent terminal
```


Go out of tmux
```
ctrl+B
D
```

Change the name of a terminal/tmux
```
ctrl+B 
shift+4
```


## Configure conda on VSC (e.g. python)
[Document for installing conda](https://docs.vscentrum.be/en/latest/software/python_package_management.html?highlight=conda#install-python-packages-using-conda) is not recommended. Use the following commands:

```
$ myquota         # check the quota
$ cd $VSC_DATA    # enter the path for data

# It is suggested to install everything in $VSC_DATA
$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ sh Miniconda3-latest-Linux-x86_64.sh 
```

Manage conda environment. (VSC might not show the conda env.)
```
which python                        # check the present conda env
conda create --name py310
conda install python=3.10
conda activate py310                      # enter env py310
conda install -c anaconda numpy     # install a package in py310
conda env list                      # list all the conda env
```

## What I should do
- Open vscode
- Click Remote Explorer
- Login VSC (automatically)
- Store everything in  **$VSC_DATA**
- Open tmux and take up a node to run code 
    ```
    tmux                                        # open tmux
    srun --account=lp_edu_alg_parallel_comp -N1 -n1 --partition=batch --mem=10GB --time=1-00:00:00 --pty bash -i 
    srun --account=intro_vsc35642 -N1 -n1 --partition=batch --mem=10GB --time=0-06:00:00 --pty bash -i 
    which python                                # Check which python env I am using
    conda env list                              # list all the conda env
    conda activate py310                        # or other conda env
    python -u QMC_test.py > QMC_test.log        # save all the print to log file
    ```


# Server in NUMA
Log in the server
```
ssh Gauss
ssh -X Gauss     # with graphic inference
```
If you use graphic inference, then you can use MATLAB with graphici inference.
```
matlab
```