Skip to content

Commit fb65db1

Browse files
committed
add model level heirarchy
1 parent 2fd1df8 commit fb65db1

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

.github/scripts/run_vllm_profiling.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ cleanup_server() {
5959
run_profiling_tests() {
6060
# run profiling tests using JSON configuration
6161
local profiling_test_file="$1"
62+
local base_profiler_dir="${VLLM_TORCH_PROFILER_DIR:-}"
63+
64+
if [[ -z "${base_profiler_dir}" ]]; then
65+
echo "Error: VLLM_TORCH_PROFILER_DIR is not set."
66+
exit 1
67+
fi
6268

6369
if [[ ! -f "$profiling_test_file" ]]; then
6470
echo "Error: Profiling test file $profiling_test_file not found!"
@@ -92,17 +98,27 @@ run_profiling_tests() {
9298
# Clean up any existing processes first
9399
kill_gpu_processes
94100

101+
# Create a profiling sub-directory for each test case to isolate the
102+
# generated traces (e.g. using the model name hierarchy)
103+
local sanitized_test_name="${TEST_NAME// /_}"
104+
local test_name_directory="${base_profiler_dir}/${sanitized_test_name}"
105+
mkdir -p "${test_name_directory}"
106+
chmod 755 "${test_name_directory}"
107+
108+
# Override the profiler output directory for this test only
109+
export VLLM_TORCH_PROFILER_DIR="${test_name_directory}"
110+
95111
# Run the profiling test
96112
if start_vllm_server "$server_args"; then
97113
run_profiling "$client_args"
98114
cleanup_server
99115

100116
# Debug: Check if profiling files were created
101-
echo "DEBUG: Checking profiling directory: ${VLLM_TORCH_PROFILER_DIR}"
102-
if [ -d "${VLLM_TORCH_PROFILER_DIR}" ]; then
117+
echo "DEBUG: Checking profiling directory: $test_name_directory"
118+
if [ -d "$test_name_directory" ]; then
103119
echo "DEBUG: Profiling directory exists for test $TEST_NAME"
104-
ls -la "${VLLM_TORCH_PROFILER_DIR}" || echo "DEBUG: Directory is empty or inaccessible"
105-
find "${VLLM_TORCH_PROFILER_DIR}" -type f 2>/dev/null | head -10 | while read file; do
120+
ls -la "$test_name_directory" || echo "DEBUG: Directory is empty or inaccessible"
121+
find "$test_name_directory" -type f 2>/dev/null | head -10 | while read file; do
106122
echo "DEBUG: Found profiling file: ${file}"
107123
done
108124
else
@@ -115,6 +131,9 @@ run_profiling_tests() {
115131
continue
116132
fi
117133
done
134+
135+
# Ensure the profiler directory is restored after processing all tests
136+
export VLLM_TORCH_PROFILER_DIR="${base_profiler_dir}"
118137
}
119138

120139
main() {

0 commit comments

Comments
 (0)