Skip to content

Commit

Permalink
Ready to land
Browse files Browse the repository at this point in the history
  • Loading branch information
huydhn committed Dec 25, 2024
1 parent e78ab24 commit 04f3ad2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
3 changes: 0 additions & 3 deletions .github/scripts/nova_prescript.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ if [[ $CU_VERSION = cu* ]]; then
CUDNN_INCLUDE_DIR="${CUDA_HOME}/include" \
CUDNN_LIBRARY="${CUDA_HOME}/lib64"

# Use Nova CUDA installation, but needs to apply some fixes from FBGEMM
fix_libcuda "${BUILD_ENV_NAME}" "${CUDA_HOME}"

echo "[NOVA] -------- Finding NVML_LIB_PATH -----------"
if [[ ${NVML_LIB_PATH} == "" ]]; then
NVML_LIB_PATH=$(find "${CUDA_HOME}" -name libnvidia-ml.so) &&
Expand Down
37 changes: 11 additions & 26 deletions .github/scripts/utils_cuda.bash
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,19 @@ install_cuda () {
(test_filepath "${env_name}" libnvToolsExt.so) || return 1
(test_filepath "${env_name}" libnvidia-ml.so) || return 1

echo "[INSTALL] Appending libcuda.so path to LD_LIBRARY_PATH ..."
# shellcheck disable=SC2155,SC2086
local conda_prefix=$(conda run ${env_prefix} printenv CONDA_PREFIX)
(fix_libcuda "${env_name}" "${conda_prefix}") || return 1
# shellcheck disable=SC2155
local libcuda_path=$(find "${conda_prefix}" -type f -name libcuda.so)
nm -gDC "${libcuda_path}"
append_to_library_path "${env_name}" "$(dirname "$libcuda_path")"

# The symlink appears to be missing when we attempt to run FBGEMM_GPU on the
# `ubuntu-latest` runners on GitHub, so we have to manually add this in.
if [ "$ADD_LIBCUDA_SYMLINK" == "1" ]; then
print_exec ln "${libcuda_path}" -s "$(dirname "$libcuda_path")/libcuda.so.1"
fi

echo "[INSTALL] Set environment variable NVML_LIB_PATH ..."
# shellcheck disable=SC2155,SC2086
Expand Down Expand Up @@ -124,31 +134,6 @@ install_cuda () {
echo "[INSTALL] Successfully installed CUDA ${cuda_version}"
}

fix_libcuda () {
local env_name="$1"
local search_path="$2"

for lib_name in libcuda.so libnvidia-ml.so
do
echo "[INSTALL] Appending ${lib_name} path to LD_LIBRARY_PATH ..."
# shellcheck disable=SC2155
local lib_path=$(find "${search_path}" -type f -name "${lib_name}")
nm -gDC "${lib_path}"
append_to_library_path "${env_name}" "$(dirname "$lib_path")"

# The symlink appears to be missing when we attempt to run FBGEMM_GPU on the
# `ubuntu-latest` runners on GitHub, so we have to manually add this in.
if [ "$ADD_LIBCUDA_SYMLINK" == "1" ] || [[ ! -f "$(dirname "$lib_path")/${lib_name}.1" ]]; then
local lib_owner=$(stat -c '%U' "${lib_path}")
if [ "${lib_owner}" == "root" ]; then
print_exec sudo ln "${lib_path}" -s "$(dirname "$lib_path")/${lib_name}.1"
else
print_exec ln "${lib_path}" -s "$(dirname "$lib_path")/${lib_name}.1"
fi
fi
done
}

install_cudnn () {
local env_name="$1"
local install_path="$2"
Expand Down

0 comments on commit 04f3ad2

Please sign in to comment.