Skip to content

Commit

Permalink
Merge branch 'gdrcopy' into 'main'
Browse files Browse the repository at this point in the history
Add support for building GDRcopy driver in the OCP DTK sidecar container

See merge request nvidia/container-images/driver!290
  • Loading branch information
cdesiniotis committed Jan 31, 2024
2 parents 81eb3e5 + 538db93 commit 2f17c02
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rhel8/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

GPU_DIRECT_RDMA_ENABLED="${GPU_DIRECT_RDMA_ENABLED:-false}"
GDS_ENABLED="${GDS_ENABLED:-false}"
GDRCOPY_ENABLED="${GDRCOPY_ENABLED:-false}"

# Check if mellanox devices are present
_mellanox_devices_present() {
Expand Down Expand Up @@ -32,7 +33,15 @@ _gpu_direct_rdma_enabled() {
# Check if GDS is enabled
_gpu_direct_storage_enabled() {
if [ "${GDS_ENABLED}" = "true" ]; then
return 0
return 0
fi
return 1
}

# Check if GDRCopy is enabled
_gdrcopy_enabled() {
if [ "${GDRCOPY_ENABLED}" = "true" ]; then
return 0
fi
return 1
}
25 changes: 25 additions & 0 deletions rhel8/ocp_dtk_entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,26 @@ dtk-build-driver() {
echo "#"
fi

if _gdrcopy_enabled; then
echo "#"
echo "# Executing gdrcopy driver build."
echo "#"
# Make nvidia driver sources accessible for building nvidia-fs
nvidia_src_dir=$(find /usr/src/nvidia-* -name "nv-p2p.c" -print -quit | xargs dirname || echo "NVIDIA_DRIVER_MISSING" 2>/dev/null)
if [ "nvidia_src_dir" = "NVIDIA_DRIVER_MISSING" ]; then
echo "Failed to find NVIDIA driver source, exiting."
return 1
fi
export NVIDIA_SRC_DIR=$nvidia_src_dir

# Build gdrdrv kernel module
make -C $DRIVER_TOOLKIT_SHARED_DIR/gdrcopy driver

echo "#"
echo "# gdrcopy build script completed."
echo "#"
fi

MODULES_SHARED="${DRIVER_TOOLKIT_SHARED_DIR}/modules"
mkdir -p "${MODULES_SHARED}"

Expand Down Expand Up @@ -223,6 +243,11 @@ dtk-build-driver() {
touch "${DRIVER_TOOLKIT_SHARED_DIR}/nvidia_fs_built"
fi

if _gdrcopy_enabled; then
echo "gdrcopy driver built, inform nvidia-gdrcopy-ctr container about it and sleep forever."
touch "${DRIVER_TOOLKIT_SHARED_DIR}/gdrcopy_built"
fi

while [ -f "$DRIVER_TOOLKIT_SHARED_DIR/driver_built" ]; do
sleep 30
done
Expand Down

0 comments on commit 2f17c02

Please sign in to comment.