Skip to content

Commit fdef8d0

Browse files
committed
Merge branch 'use_upstream_cc_tools' into 'main'
Use upstream gpu_cc_tool from nvtrust See merge request nvidia/cloud-native/k8s-cc-manager!2
2 parents a550169 + ec92c28 commit fdef8d0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

deployments/container/Dockerfile.ubi8

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ ARG GIT_COMMIT="unknown"
2929

3030
RUN go build -o /artifacts/k8s-cc-manager ./cmd
3131
RUN cp ./scripts/cc-manager.sh /artifacts/cc-manager.sh
32-
#RUN cp ./scripts/nvidia-gpu-tools.py /artifacts/nvidia-gpu-tools.py
3332

3433
RUN OS_ARCH=${TARGETARCH/x86_64/amd64} && OS_ARCH=${OS_ARCH/aarch64/arm64} && curl -o /artifacts/kubectl -L "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${OS_ARCH}/kubectl";
3534
RUN chmod a+x /artifacts/kubectl
@@ -50,10 +49,13 @@ LABEL description="See summary"
5049
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
5150

5251
COPY --from=build /artifacts/k8s-cc-manager /usr/bin/k8s-cc-manager
53-
COPY --from=build /artifacts/cc-manager.sh /usr/bin/cc-manager.sh
54-
#COPY --from=build /artifacts/nvidia-gpu-tools.py /usr/bin/nvidia-gpu-tools.py
5552
COPY --from=build /artifacts/kubectl /usr/bin/kubectl
5653

54+
# Setup CC tools and licenses
55+
COPY --from=build /artifacts/cc-manager.sh /usr/bin/cc-manager.sh
56+
RUN curl -o /usr/bin/gpu_cc_tool.py -L https://raw.githubusercontent.com/NVIDIA/nvtrust/main/host_tools/python/gpu_cc_tool.py && chmod a+x /usr/bin/gpu_cc_tool.py
57+
RUN curl -o /licenses/LICENSE.txt -L https://raw.githubusercontent.com/NVIDIA/nvtrust/main/host_tools/python/LICENSE.txt
58+
5759
# Install / upgrade packages here that are required to resolve CVEs
5860
ARG CVE_UPDATES
5961
RUN if [ -n "${CVE_UPDATES}" ]; then \

scripts/cc-manager.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ _populate_cc_capable_device_ids() {
2828

2929
_reset_gpu_after_cc_mode() {
3030
local gpu=$1
31-
python3 /usr/bin/nvidia-gpu-tools.py --reset-after-cc-mode-switch --gpu-bdf=$gpu
31+
python3 /usr/bin/gpu_cc_tool.py --reset-after-cc-mode-switch --gpu-bdf=$gpu
3232
if [ $? -ne 0 ]; then
3333
echo "unable to reset gpu $gpu for cc mode switch, output"
3434
return 1
@@ -149,7 +149,7 @@ _assert_gpu_cc_mode() {
149149
local gpu=$1
150150
local mode=$2
151151

152-
output=$(python3 /usr/bin/nvidia-gpu-tools.py --query-cc-mode --gpu-bdf=$gpu 2>&1)
152+
output=$(python3 /usr/bin/gpu_cc_tool.py --query-cc-mode --gpu-bdf=$gpu 2>&1)
153153
if [ $? -ne 0 ]; then
154154
_exit_failed
155155
fi
@@ -386,7 +386,7 @@ set_gpu_cc_mode() {
386386
local mode=$CC_MODE
387387

388388
if ! _assert_gpu_cc_mode $gpu $mode; then
389-
output=$(python3 /usr/bin/nvidia-gpu-tools.py --set-cc-mode=$mode --reset-after-cc-mode-switch --gpu-bdf=$gpu 2>&1)
389+
output=$(python3 /usr/bin/gpu_cc_tool.py --set-cc-mode=$mode --reset-after-cc-mode-switch --gpu-bdf=$gpu 2>&1)
390390
if [ $? -ne 0 ]; then
391391
echo "unable to set cc mode of gpu $gpu to $mode, output $output"
392392
return 1
@@ -434,7 +434,7 @@ get_cc_mode() {
434434

435435
get_gpu_cc_mode() {
436436
local gpu=$1
437-
output=$(python3 /usr/bin/nvidia-gpu-tools.py --query-cc-mode --gpu-bdf=$gpu 2>&1)
437+
output=$(python3 /usr/bin/gpu_cc_tool.py --query-cc-mode --gpu-bdf=$gpu 2>&1)
438438
if [ $? -ne 0 ]; then
439439
echo "unable to get cc mode of gpu $gpu, output $output"
440440
return 1

0 commit comments

Comments
 (0)