Skip to content

Commit

Permalink
Add a new nvidia-gpu-services.target to ensure proper startup order
Browse files Browse the repository at this point in the history
  • Loading branch information
KeithMnemonic committed Aug 2, 2024
1 parent f4acac9 commit 728ca2d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
5 changes: 5 additions & 0 deletions deployments/systemd/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
SERVICE_ROOT="nvidia-mig-manager"
SERVICE_NAME="${SERVICE_ROOT}.service"

GPU_TARGET_ROOT="nvidia-gpu-services"
GPU_TARGET_NAME="${GPU_TARGET_ROOT}.target"

MIG_PARTED_NAME="nvidia-mig-parted"
MIG_PARTED_GO_GET_PATH="github.com/NVIDIA/mig-parted/cmd/${MIG_PARTED_NAME}"

Expand Down Expand Up @@ -52,6 +55,7 @@ ${DOCKER} run --rm \
"

cp ${SERVICE_NAME} ${SYSTEMD_DIR}
cp ${GPU_TARGET_NAME} ${SYSTEMD_DIR}
cp ${MIG_PARTED_NAME}.sh ${PROFILED_DIR}
cp override.conf ${OVERRIDE_DIR}
cp service.sh ${CONFIG_DIR}
Expand All @@ -62,6 +66,7 @@ cp hooks-minimal.yaml ${CONFIG_DIR}
cp config-default.yaml ${CONFIG_DIR}

chmod a+r ${SYSTEMD_DIR}/${SERVICE_NAME}
chmod a+r ${SYSTEMD_DIR}/${GPU_TARGET_NAME}
chmod a+r ${PROFILED_DIR}/${MIG_PARTED_NAME}.sh
chmod a+r ${OVERRIDE_DIR}/override.conf
chmod a+r ${CONFIG_DIR}/service.sh
Expand Down
16 changes: 16 additions & 0 deletions deployments/systemd/nvidia-gpu-services.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
#
# 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.

[Unit]
Description=Nvidia GPU System Target
7 changes: 4 additions & 3 deletions deployments/systemd/nvidia-mig-manager.service
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
[Unit]
Description=Configure MIG on NVIDIA GPUs
DefaultDependencies=no
After=sysinit.target local-fs.target
Before=basic.target nvidia-persistenced.service systemd-resolved.service
Wants=nvidia-persistenced.service nvidia-fabricmanager.service
After=nvidia-persistenced.service nvidia-fabricmanager.service
Before=nvidia-gpu-services.target

[Service]
Type=oneshot
ExecStart=-/bin/bash /etc/nvidia-mig-manager/service.sh

[Install]
WantedBy=multi-user.target
WantedBy=nvidia-gpu-services.target
4 changes: 4 additions & 0 deletions deployments/systemd/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
SERVICE_ROOT="nvidia-mig-manager"
SERVICE_NAME="${SERVICE_ROOT}.service"

GPU_TARGET_ROOT="nvidia-gpu-services"
GPU_TARGET_NAME="${GPU_TARGET_ROOT}.target"

MIG_PARTED_NAME="nvidia-mig-parted"
MIG_PARTED_GO_GET_PATH="github.com/NVIDIA/mig-parted/cmd/${MIG_PARTED_NAME}"

Expand All @@ -36,4 +39,5 @@ rm -rf ${OVERRIDE_DIR}

rm ${BINARY_DIR}/${MIG_PARTED_NAME}
rm ${SYSTEMD_DIR}/${SERVICE_NAME}
rm ${SYSTEMD_DIR}/${GPU_TARGET_NAME}
rm ${PROFILED_DIR}/${MIG_PARTED_NAME}.sh

0 comments on commit 728ca2d

Please sign in to comment.