# Billing

## Billing information

In order to ensure users fair share of the cluster and to consider the differences in the used resources, Vega uses Slurm accounting and fairshare system. Slurmâ€™s Trackable RESources (TRES) allows the scheduler to charge users for how much resources they have used. On Vega system we set TRES for CPU, GPU and Memory usage.

To view the configured TRES charge, you can run:

```
scontrol show partition <name>
```

For CPU partition the weights are:

```
CPU=1.0,Mem=1G
```

For CPU Large memory the weights are:

```
CPU=1,Mem=0.25G
```

For GPU partition the weights are:

```
CPU=1.0,Mem=0.5G,GRES/gpu=64.0
```

Since all CPUs are of the same type, we normalise TRES to 1.0. The theoretical performance of AMD EPYC 7H12 processor is 2 TFLOPs per socket and the theoretical peak performance with double precision of NVIDIA A100 is 9.5 TFLOPs.

Resource | Type TRES for cpu/longcpu partition | Type TRES for gpu partition | Type TRES for largemem partition |
---|---|---|---|

AMD Epyc | 1.0 | 1.0 | 1.0 |

NVIDIA A100 | 0 | 64.0 | 0 |

Memory | 1GB | 0.5GB | 0.25GB |

## Usage calculation

Users can easily calculate their usage with the following formula:

```
TRESBillingJobValue = JobWalltime * TRESBillingJobWeight
```

Where the **JobWalltime** is real time job duration and **TRESBillingJobWeight** is calculated with the following formula:

```
TRESBillingJobWeight = MAX(TRESAllocatedCPUs*TRESBillingCPU,TRESAllocatedMem*TRESBillingMem,TRESAllocatedGPUs*TRESBillingGPU)
```

Usage in **CoreHours** is calculated with the following formula:

```
JobUsageCost[CoreHours] = 1/2 TRESBillingJobValue
```

Usage in **NodeHours** is calculated with the following formula:

```
JobUsageCost[NodeHours] = 1/256 TRESBillingJobValue
```

## Example

If the job required:

```
Cores = 256
Memory = 250GB
GPU Nodes = 4
```

and **JobWalltime** is 1h

```
JobWalltime=1
```

The **TRESBillingJobWeight** is calculated with the following formula:

```
TRESAllocatedCPUs=256
TRESBillingCPU=1
TRESAllocatedMem=250
TRESBillingMem=0.5
TRESAllocatedGPUs=4
TRESBillingGPU=64
TRESBillingJobWeight = MAX(256*1, 250*0.5, 4*64)= 256
```

So, now we can calculate **TRESBillingJobValue** with the following formula:

```
TRESBillingJobValue = JobWalltime * TRESBillingJobWeight
TRESBillingJobValue = 1*256 =256
```

Usage in **CoreHours** is:

```
JobUsageCost[CoreHours] = 256/2 = 128
```

Usage in **NodeHours** is:

```
JobUsageCost[NodeHours] = 256/256 = 1
```

To see your accounting data click on this link.