# Choosing a GPU

By default, slurm attribute a random GPU based on availabilities. If your research requires to use a specific type of GPU, you can follow this guide to help you.

WATGPU is heterogenous in term of GPU repartition. To get a specific GPU you need to specify the correct combination of node and GPU type. 

Use the command `stype <GPU_TYPE>` to get the correct combination.

For example, if you want to use a `L40S`, you can use any combination given by `stype` (The actual result of the command might be different than this example):
```sh
# stype L40S
Nodes with physical GPU type: L40S
  | --nodelist=watgpu608, --gres=yv2pantgpu:1
  | --nodelist=watgpu608, --gres=higpu:1
  | --nodelist=watgpu408, --gres=yaolianggpu:1
  | --nodelist=watgpu408, --gres=jimmygpu:1

Check the output of sresources to see which GPUs are available in each node!
```

So the command `salloc --nodelist=watgpu608, --gres=yv2pantgpu:1` will garanty the you will get assigned a `L40S` GPU.

# Check availability

Since the combination given by stype pinpoint to a specific GPU, it is important that you choose the combination that pinpoint to a free GPU.

Use the command `sresources` to show the current usage of the cluster resources:

```sh
NODE       STATE        GPUType               GPUTot     GPUAlloc   GPUFree         MEM        AllocMEM   FreeMEM         CPUTot     CPUAlloc   CPUFree   

watgpu108  IDLE         ALL                   9          0          9               940G       0G         940G            128        0          128       
                        | jimmygpu            |= 6       |= 0       |= 6                                                                                   
                        | kfountouschoolgpu   |= 1       |= 0       |= 1                                                                                   
                        | rcohengpu           |= 2       |= 0       |= 2                                                                                   

watgpu208  MIXED        ALL                   8          2          6               617G       123G       494G            32         4          28        
                        | visiongpu           |= 8       |= 2       |= 6                                                                                   

watgpu308  MIXED        ALL                   8          6          2               817G       295G       522G            32         24         8         
                        | schoolgpu           |= 8       |= 6       |= 2                                                                                   

watgpu408  MIXED        ALL                   8          6          2               916G       295G       621G            128        24         104       
                        | jimmygpu            |= 4       |= 4       |= 0                                                                                   
                        | yaolianggpu         |= 4       |= 2       |= 2                                                                                   

watgpu508  MIXED+PLANNED ALL                   6          4          2               940G       299G       641G            128        22         106       
                        | complinggpu         |= 2       |= 2       |= 0                                                                                   
                        | mligpu              |= 2       |= 1       |= 1                                                                                   
                        | jimmygpu            |= 1       |= 1       |= 0                                                                                   
                        | vzhnggpu            |= 1       |= 0       |= 1                                                                                   

watgpu608  MIXED        ALL                   6          2          4               1308G      103G       1205G           128        8          120       
                        | celiasmigpu         |= 4       |= 1       |= 3                                                                                   
                        | yv2pantgpu          |= 1       |= 1       |= 0                                                                                   
                        | higpu               |= 1       |= 0       |= 1                                                                              
```

Here I can see that the GPU `yv2pantgpu` on the node `watgpu608` is being used. So using the command `salloc --nodelist=watgpu608, --gres=yv2pantgpu:1` will place your job in the queue until this GPU is freed.

However, the GPU `higpu` on the same node is free. If we change the command to `salloc --nodelist=watgpu608, --gres=higpu:1`, our job will be executed imediately.



