-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path20_optimize-gpu.sh
More file actions
41 lines (36 loc) · 1014 Bytes
/
20_optimize-gpu.sh
File metadata and controls
41 lines (36 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# Copyright 2022-2025 The MathWorks, Inc.
# Achieve best performance on NVIDIA GPU instances.
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/optimize_gpu.html
if [[ ${OPTIMIZE_GPU} == 'Yes' ]]; then
nvidia-persistenced
INSTANCE_TYPE=$(curl -fs --retry 3 http://169.254.169.254/latest/meta-data/instance-type)
case ${INSTANCE_TYPE} in
g2*)
nvidia-smi --auto-boost-default=0
;;
g3*)
nvidia-smi --auto-boost-default=0
nvidia-smi -ac 2505,1177
;;
g4dn*)
nvidia-smi -ac 5001,1590
;;
g5*)
nvidia-smi -ac 6250,1710
;;
p2*)
nvidia-smi --auto-boost-default=0
nvidia-smi -ac 2505,875
;;
p3*)
nvidia-smi -ac 877,1530
;;
p4de*)
nvidia-smi -ac 1593,1410
;;
p4d*)
nvidia-smi -ac 1215,1410
;;
esac
fi