wiki:en/UsingGPU

How to use GPUs on NLP Centre servers

The following servers have GPUs:

  • apollo
  • ephimetheusX

Follow this actions:

  1. find available GPUs: run gpustat or nvidia-smi
  2. export CUDA_DEVICE_ORDER=PCI_BUS_ID
  3. choose a GPU with no running processes
  4. limit your process to only selected GPU: export CUDA_VISIBLE_DEVICES=GID where GID is the ID of the selected GPU (the first column in the gpustat or nvidia-smi listing).

Running jupyter notebook on Apollo (Linux)

This is a tutorial on how to run a Jupyter interface on apollo server.

Connecting to apollo server

Connecting to FI MUNI VPN

Connecting to server

  • Run command:
    ssh xsurname@apollo.fi.muni.cz
    
  • Type in secondary password

Run Jupyter notebook with virtual env

Create virtual env and run it

virtualenv myenv
source myenv/bin/activate

Connect your virtual env with the Jupyter notebook

pip install ipykernel
python -m ipykernel install --user --name=myenv

You should get the output:

Installed kernelspec myenv in /home/user/.local/share/jupyter/kernels/myenv
  • To check all your connected venvs
    jupyter kernelspec list
    

Run Jupyter notebook on a personally selected port

jupyter notebook --no-browser --port 2222

Create SSH Tunnelling

  • Open new second terminal and insert the following command
    ssh xsurname@apollo.fi.muni.cz -NL 2222:localhost:2222
    

The second port must match the port selected when starting the jupyter notebook

Open Jupyter notebook on local machine

  • Type in browser:
    localhost:2222
    

Again this port must match the first port in ssh tunelling step

  • Log into the Jupyter notebook
  • To get the token type:
    jupyter notebook list
    
  • Copy the token part and either create a password or log in with the token itself

Change the cache location of HuggingFace Datasets

  • You need to change the download location of datasets. The default location is in your home and it can easly get full
  • To change to Dataset location type:
    export HF_DATASETS_CACHE="/path/to/another/directory"
    
  • To make this change permanent so you don't need to type it every time you enter apollo add it to your .bashrc file at your home directory

References used

  1. SSH tunell: https://medium.com/@apbetahouse45/how-to-run-jupyter-notebooks-on-remote-server-part-1-ssh-a2be0232c533
  2. FI MUNI VPN: https://www.fi.muni.cz/tech/unix/vpn.html.cs
  3. Jupyter notebook with virtualenv: https://janakiev.com/blog/jupyter-virtual-envs/
  4. HuggingFace dataset location change: https://huggingface.co/docs/datasets/v1.12.0/cache.html

Last modified 7 months ago Last modified on Oct 11, 2023, 7:14:29 PM