[autotest-client-tests][PATCH 1/2] UBUNTU: SAUCE: ubuntu_nvidia_server_driver: nvidia-fs: optimizing CUDA image looping efficiency

Taihsiang Ho (tai271828) taihsiang.ho at canonical.com
Fri Jul 8 10:31:18 UTC 2022


This is a following optimized work for commit
c169fe864b0dc278554390da009bb13c35f8d5e1 See its commit message for more
details. With this following commit, we query dockerhub with the partial
name of image tag instead of walking through the whole list of available
images. Thus we can speed up the query of image type by reducing the
page number to query from hundreds pages down to a few of them only.

Signed-off-by: Taihsiang Ho (tai271828) <taihsiang.ho at canonical.com>
---
 ubuntu_nvidia_server_driver/nvidia-fs/01-run-test.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ubuntu_nvidia_server_driver/nvidia-fs/01-run-test.sh b/ubuntu_nvidia_server_driver/nvidia-fs/01-run-test.sh
index 884dd346..9d6670c6 100755
--- a/ubuntu_nvidia_server_driver/nvidia-fs/01-run-test.sh
+++ b/ubuntu_nvidia_server_driver/nvidia-fs/01-run-test.sh
@@ -24,8 +24,10 @@ driver_recommended_cuda_version() {
 find_latest_cuda_container_tag_by_branch() {
     local branch="$1" # e.g. 11.4
     local tmpfile="$(mktemp)"
-    local url="https://registry.hub.docker.com/v2/repositories/nvidia/cuda/tags"
+    local url_api_base="https://registry.hub.docker.com/v2/repositories/nvidia/cuda/tags"
     source ./00-vars.gen # pick up LXD_OS_VER
+    local search_tag=devel-ubuntu"${LXD_OS_VER}"
+    local url=${url_api_base}"?name="-"${search_tag}"
 
     # List all of the available nvidia cuda image tags, filter for
     # devel/ubuntu images that match our cuda x.y, and sort numerically
@@ -38,7 +40,7 @@ find_latest_cuda_container_tag_by_branch() {
         jq '."results"[]["name"]' < "$tmpfile" |
             tr -d \"
     done |
-        grep -E "^${branch}(\.[0-9]+)*-devel-ubuntu${LXD_OS_VER}$" | \
+        grep -E "^${branch}(\.[0-9]+)*-${search_tag}$" | \
         sort -n | tail -1
     rm -f "$tmpfile"
 }
-- 
2.36.1




More information about the kernel-team mailing list