Skip to content

Instantly share code, notes, and snippets.

@tibraga
Created November 2, 2024 04:00
Show Gist options
  • Save tibraga/c7f4e9276457105420414d22e45ef114 to your computer and use it in GitHub Desktop.
Save tibraga/c7f4e9276457105420414d22e45ef114 to your computer and use it in GitHub Desktop.
#!/bin/bash
DESIRED_LIBS=("libcudnn.so.9" "libcudnn_adv.so.9" "libcudnn_cnn.so.9" "libcudnn_ops.so.9")
SOURCE_DIR="/usr/local/lib/python3.11/site-packages/nvidia/cudnn/lib"
# Greet the user
echo "Hello! Starting the CUDA library symlink creation process."
# Check if source directory exists
if [[ ! -d "$SOURCE_DIR" ]]; then
echo "Source directory $SOURCE_DIR does not exist. Exiting."
exit 1
fi
# Inform the user about the source directory being used
echo "Using source directory: $SOURCE_DIR"
for lib in "${DESIRED_LIBS[@]}"; do
case $lib in
"libcudnn.so.9")
base_name="libcudnn.so.8"
;;
"libcudnn_adv.so.9")
base_name="libcudnn_adv_infer.so.8"
;;
"libcudnn_cnn.so.9")
base_name="libcudnn_cnn_infer.so.8"
;;
"libcudnn_ops.so.9")
base_name="libcudnn_ops_infer.so.8"
;;
esac
# Inform the user about the current operation
echo "Creating symlink for $lib as $base_name"
ln -sf "$SOURCE_DIR/$lib" "$SOURCE_DIR/$base_name"
if [[ $? -eq 0 ]]; then
echo "Successfully created symlink for $lib"
else
echo "Failed to create symlink for $lib"
fi
done
# Inform the user that the process is complete
echo "CUDA library symlink creation process completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment