#!/bin/bash # Script to patch CUDA math_functions.h for glibc 2.41 compatibility # Usage: sudo bash patch_cuda_math_functions.sh PATCH_TARGET="/usr/local/cuda/include/crt/math_functions.h" cat <<'EOF' > /tmp/cuda_glibc_241_compat.diff --- a/math_functions.h 00:02:30.815134398 +0300 +++ b/math_functions.h 00:03:30.815134398 +0300 @@ -2547,7 +2547,7 @@ * * \note_accuracy_double */ -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x); +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true); /** * \ingroup CUDA_MATH_SINGLE * \brief Calculate the sine of the input argument @@ -2570,7 +2570,7 @@ * * \note_accuracy_single */ -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x); +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true); /** * \ingroup CUDA_MATH_DOUBLE * \brief Calculate the cosine of the input argument @@ -2592,7 +2592,7 @@ * * \note_accuracy_double */ -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x); +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true); /** * \ingroup CUDA_MATH_SINGLE * \brief Calculate the cosine of the input argument @@ -2614,7 +2614,7 @@ * * \note_accuracy_single */ -extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x); +extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true); /** * \ingroup CUDA_MATH_DOUBLE * \brief Calculate the sine and cosine of the first input argument EOF patch $PATCH_TARGET /tmp/cuda_glibc_241_compat.diff