| 73 | } |
| 74 | |
| 75 | cudnnModule::cudnnModule() |
| 76 | : module({"cudnn"}, {"", "64_8", "64_7", "64_6", "64_5", "64_4"}, {""}, |
| 77 | cudnnVersions.size(), cudnnVersions.data(), getCudnnVersion) { |
| 78 | if (!module.isLoaded()) { |
| 79 | AF_TRACE( |
| 80 | "WARNING: Unable to load cuDNN: {}" |
| 81 | "\ncuDNN failed to load. Try installing cuDNN or check if cuDNN is " |
| 82 | "in the search path. On Linux, you can set the LD_DEBUG=libs " |
| 83 | "environment variable to debug loading issues. Falling back to " |
| 84 | "matmul based implementation", |
| 85 | module.getErrorMessage()); |
| 86 | |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | MODULE_FUNCTION_INIT(cudnnGetVersion); |
| 91 | |
| 92 | size_t cudnn_rtversion_val = 0; |
| 93 | |
| 94 | Version cudnn_version = module.getVersion(); |
| 95 | if (cudnn_version < Version(6)) { |
| 96 | AF_TRACE( |
| 97 | "Warning: This version of cuDNN({}) does not support " |
| 98 | "cudnnGetCudartVersion. No runtime checks performed.", |
| 99 | cudnn_version); |
| 100 | } else { |
| 101 | MODULE_FUNCTION_INIT(cudnnGetCudartVersion); |
| 102 | cudnn_rtversion_val = this->cudnnGetCudartVersion(); |
| 103 | } |
| 104 | |
| 105 | Version cudnn_rtversion = cudaRuntimeVersionComponents(cudnn_rtversion_val); |
| 106 | |
| 107 | AF_TRACE("cuDNN Version: {} cuDNN CUDA Runtime: {}", cudnn_version, |
| 108 | cudnn_rtversion); |
| 109 | |
| 110 | Version compiled_cudnn_version = fromCudaVersion(CUDNN_VERSION); |
| 111 | |
| 112 | // Check to see if the version of cuDNN ArrayFire was compiled against |
| 113 | // is compatible with the version loaded at runtime |
| 114 | if (compiled_cudnn_version.major() <= 6 && |
| 115 | compiled_cudnn_version < cudnn_version) { |
| 116 | string error_msg = fmt::format( |
| 117 | "ArrayFire was compiled with an older version of cuDNN({}.{}) that " |
| 118 | "does not support the version that was loaded at runtime({}.{}).", |
| 119 | CUDNN_MAJOR, CUDNN_MINOR, cudnn_version.major(), |
| 120 | cudnn_version.minor()); |
| 121 | AF_ERROR(error_msg, AF_ERR_NOT_SUPPORTED); |
| 122 | } |
| 123 | |
| 124 | int afcuda_runtime_version = 0; |
| 125 | cudaRuntimeGetVersion(&afcuda_runtime_version); |
| 126 | Version afcuda_runtime = fromCudaVersion(afcuda_runtime_version); |
| 127 | if (afcuda_runtime != cudnn_rtversion) { |
| 128 | getLogger()->warn( |
| 129 | "WARNING: ArrayFire CUDA Runtime({}) and cuDNN CUDA " |
| 130 | "Runtime({}) do not match. For maximum compatibility, make sure " |
| 131 | "the two versions match.(Ignoring check)", |
| 132 | // NOTE: the int version formats from CUDA and cuDNN are different |
nothing calls this directly
no test coverage detected