#!/bin/bash # push_battery.sh - push every CUDA battery binary from tools/cuda-ab/run/ # to the running guest via scp over the SSH hostfwd (port 2222). # Usage: push_battery.sh [guest_dir] (default /tmp) set -u HERE="$(cd "$(dirname "$0")" && pwd)" RUN="$HERE/run" GUEST_DIR="${1:-/tmp}" CLIENTS="victory_mail smiley vecadd_loop streams2 memcpy_roundtrip multikernel victory_saxpy victory_reduce victory_matmul victory_strided victory_memset2d victory_atomics victory_streams_events victory_math vector_add" export SSHPASS="${VGPU_GUEST_PASS:-ubuntu}" FILES="" for c in $CLIENTS; do [ -x "$RUN/$c" ] && FILES="$FILES $RUN/$c"; done [ -n "$FILES" ] || { echo "no binaries in $RUN"; exit 1; } # shellcheck disable=SC2086 sshpass -e scp -P "${VGPU_GUEST_PORT:-2222}" \ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -o PubkeyAuthentication=no -o PreferredAuthentications=password \ -o ConnectTimeout=15 $FILES "ubuntu@127.0.0.1:$GUEST_DIR/" && \ sshpass -e ssh -p "${VGPU_GUEST_PORT:-2222}" \ -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -o PubkeyAuthentication=no -o PreferredAuthentications=password \ "ubuntu@127.0.0.1" "chmod +x $GUEST_DIR/* 2>/dev/null; ls $GUEST_DIR | wc -l; echo BATTERY_PUSHED"