Changes between Initial Version and Version 1 of en/UsingGPU


Ignore:
Timestamp:
Oct 11, 2023, 2:53:46 PM (7 months ago)
Author:
pary
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • en/UsingGPU

    v1 v1  
     1= How to use GPUs on NLP Centre servers =
     2
     3The following servers have GPUs:
     4* apollo
     5* ephimetheusX
     6
     7
     8
     91. find available GPUs: run `gpustat` or `nvidia-smi`
     102. `export CUDA_DEVICE_ORDER=PCI_BUS_ID`
     113. choose a GPU with no running processes
     124. limit your process to only selected GPU:
     13   `export CUDA_VISIBLE_DEVICES=GID` where GID is the ID of the selected GPU (the first column in the `gpustat` or `nvidia-smi` listing).
     14
     15
     16
     17= Running jupyter notebook on Apollo (Linux) =
     18
     19This is a tutorial on how to run a Jupyter interface on apollo server.
     20
     21== Connecting to apollo server ==
     22==== Connecting to FI MUNI VPN ====
     23- Download VPN configuration for FI MUNI here: https://www.fi.muni.cz/tech/unix/vpn.html.cs
     24- As login use facilty credentials (xsurname and secondary password)
     25==== Connecting to server ====
     26* Run command:
     27{{{
     28ssh xsurname@apollo.fi.muni.cz
     29}}}
     30* Type in secondary password
     31
     32== Run Jupyter notebook with virtual env ==
     33==== Create virtual env and run it ====
     34{{{
     35virtualenv myenv
     36source myenv/bin/activate
     37}}}
     38==== Connect your virtual env with the Jupyter notebook ====
     39{{{
     40pip install ipykernel
     41python -m ipykernel install --user --name=myenv
     42}}}
     43You should get the output:
     44{{{
     45Installed kernelspec myenv in /home/user/.local/share/jupyter/kernels/myenv
     46}}}
     47* To check all your connected venvs
     48{{{
     49jupyter kernelspec list
     50}}}
     51
     52==== Run Jupyter notebook on a personally selected port ====
     53{{{
     54jupyter notebook --no-browser --port 2222
     55}}}
     56==== Create SSH Tunnelling ====
     57* Open new second terminal and insert the following command
     58{{{
     59ssh xsurname@apollo.fi.muni.cz -NL 2222:localhost:2222
     60}}}
     61The second port must match the port selected when starting the jupyter notebook
     62
     63==== Open Jupyter notebook on local machine ====
     64* Type in browser:
     65{{{
     66localhost:2222
     67}}}
     68Again this port must match the first port in ssh tunelling step
     69* Log  into the Jupyter notebook
     70* To get the token type:
     71{{{
     72jupyter notebook list
     73}}}
     74* Copy the token part and either create a password or log in with the token itself
     75
     76== Change the cache location of !HuggingFace Datasets ==
     77* You need to change the download location of datasets. The default location is in your home and it can easly get full
     78* To change to Dataset location type:
     79{{{
     80export HF_DATASETS_CACHE="/path/to/another/directory"
     81}}}
     82* 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
     83
     84
     85== References used ==
     861. SSH tunell: https://medium.com/@apbetahouse45/how-to-run-jupyter-notebooks-on-remote-server-part-1-ssh-a2be0232c533
     872. FI MUNI VPN: https://www.fi.muni.cz/tech/unix/vpn.html.cs
     883. Jupyter notebook with virtualenv: https://janakiev.com/blog/jupyter-virtual-envs/
     894. !HuggingFace dataset location change: https://huggingface.co/docs/datasets/v1.12.0/cache.html
     90