-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathtest_bandwidth.sh
More file actions
executable file
·121 lines (108 loc) · 4.3 KB
/
Copy pathtest_bandwidth.sh
File metadata and controls
executable file
·121 lines (108 loc) · 4.3 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
# Load configuration from config.env
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_FILE="${SCRIPT_DIR}/config.env"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Error: config.env not found!"
echo "Please create config.env from config.env.sample:"
echo " cp config.env.sample config.env"
echo "Then edit config.env with your API key and function ID."
exit 1
fi
source "$CONFIG_FILE"
# Validate required variables
if [ -z "$KEY" ] || [ "$KEY" = "your-api-key-here" ]; then
echo "Error: KEY not set in config.env"
exit 1
fi
if [ -z "$FUNCTION_ID" ] || [ "$FUNCTION_ID" = "your-multi-node-function-id" ] || [ "$FUNCTION_ID" = "your-single-node-function-id" ]; then
echo "Error: FUNCTION_ID not set in config.env"
exit 1
fi
# Test 1: Run all bandwidth tests with default settings
# echo "======================================================================================================"
# echo " Test 1: Running all bandwidth tests with default settings"
# echo "======================================================================================================"
# RESPONSE=$(curl --silent --request POST \
# --url https://${FUNCTION_ID}.invocation.api.nvcf.nvidia.com/bandwidth-test \
# --header "Authorization: Bearer ${KEY}" \
# --header 'NVCF-POLL-SECONDS: 300' \
# --header 'Content-Type: application/json' \
# --data '{
# "bufferSize": 512,
# "testSamples": 3,
# "json": true
# }')
#
# echo "$RESPONSE" | jq -r '.command'
# echo "$RESPONSE" | jq -r '.output'
# echo ""
echo "======================================================================================================"
echo " Test 2: Running device-to-device memcpy test"
echo "======================================================================================================"
RESPONSE=$(curl --silent --request POST \
--url https://${FUNCTION_ID}.invocation.api.nvcf.nvidia.com/bandwidth-test \
--header "Authorization: Bearer ${KEY}" \
--header 'NVCF-POLL-SECONDS: 300' \
--header 'Content-Type: application/json' \
--data '{
"bufferSize": 256,
"testcase": "device_to_device_memcpy_read_ce",
"testSamples": 3,
"json": true
}')
echo "$RESPONSE" | jq -r '.command'
echo "$RESPONSE" | jq -r '.output'
echo ""
echo "======================================================================================================"
echo " Test 3: Running host-to-device tests"
echo "======================================================================================================"
RESPONSE=$(curl --silent --request POST \
--url https://${FUNCTION_ID}.invocation.api.nvcf.nvidia.com/bandwidth-test \
--header "Authorization: Bearer ${KEY}" \
--header 'NVCF-POLL-SECONDS: 300' \
--header 'Content-Type: application/json' \
--data '{
"bufferSize": 128,
"testcasePrefix": "host_to_device",
"testSamples": 2,
"json": true
}')
echo "$RESPONSE" | jq -r '.command'
echo "$RESPONSE" | jq -r '.output'
echo ""
echo "======================================================================================================"
echo " Test 4: Running multinode bandwidth tests"
echo "======================================================================================================"
RESPONSE=$(curl --silent --request POST \
--url https://${FUNCTION_ID}.invocation.api.nvcf.nvidia.com/bandwidth-test \
--header "Authorization: Bearer ${KEY}" \
--header 'NVCF-POLL-SECONDS: 300' \
--header 'Content-Type: application/json' \
--data '{
"bufferSize": 64,
"testcasePrefix": "multinode",
"testSamples": 3,
"multinode": true,
"np": 2,
"json": true,
"verbose": true
}')
echo "$RESPONSE" | jq -r '.command'
echo "$RESPONSE" | jq -r '.output'
echo ""