Library/ManagedCuda/CudaDNN/CudaDNNContext.cs
/// <summary>
/// This function serves as a heuristic for obtaining the best suited algorithm for
/// cudnnConvolutionForward for the given layer specifications. Based on the input
/// preference, this function will either return the fastest algorithm or the fastest algorithm
/// within a given memory limit. For an exhaustive search for the fastest algorithm, please
/// use cudnnFindConvolutionForwardAlgorithm.
/// </summary>
/// <param name="xDesc">Handle to the previously initialized input tensor descriptor.</param>
/// <param name="filterDesc">Handle to a previously initialized filter descriptor.</param>
/// <param name="convDesc">Previously initialized convolution descriptor.</param>
/// <param name="yDesc">Handle to the previously initialized output tensor descriptor.</param>
/// <param name="preference">Enumerant to express the preference criteria in terms of memory
/// requirement and speed.</param>
/// <param name="memoryLimitInbytes">It is used when enumerant preference is set to
/// CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT to specify the
/// maximum amount of GPU memory the user is willing to use as a workspace</param>
/// <returns>Enumerant that specifies which convolution algorithm should be used to
/// compute the results according to the specified preference</returns>
This function serves as a heuristic for obtaining the best suited algorithm for
cudnnConvolutionForward for the given layer specifications. Based on the input
preference, this function will either return the fastest algorithm or the fastest algorithm
within a given memory limit. For an exhaustive search for the fastest algorithm, please
use cudnnFindConvolutionForwardAlgorithm.
This function serves as a heuristic for obtaining the best suited algorithm for cudnnConvolutionForward for the given layer specifications . Based on the input preference this function will either return the fastest algorithm or the fastest algorithm within a given memory limit . For an exhaustive search for the fastest algorithm please use cudnnFindConvolutionForwardAlgorithm .
public cudnnConvolutionFwdAlgo GetConvolutionForwardAlgorithm(TensorDescriptor xDesc,
                                                    FilterDescriptor filterDesc,
                                                    ConvolutionDescriptor convDesc,
                                                    TensorDescriptor yDesc,
                                                    cudnnConvolutionFwdPreference preference,
                                                    SizeT memoryLimitInbytes
                                                    )
        {
            cudnnConvolutionFwdAlgo algo = new cudnnConvolutionFwdAlgo();
            res = CudaDNNNativeMethods.cudnnGetConvolutionForwardAlgorithm(_handle, xDesc.Desc, filterDesc.Desc, convDesc.Desc, yDesc.Desc, preference, memoryLimitInbytes, ref algo);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolutionForwardAlgorithm", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
            return algo;
        }
public cudnnConvolutionFwdAlgo GetConvolutionForwardAlgorithm ( TensorDescriptor xDesc , FilterDescriptor filterDesc , ConvolutionDescriptor convDesc , TensorDescriptor yDesc , cudnnConvolutionFwdPreference preference , SizeT memoryLimitInbytes ) { cudnnConvolutionFwdAlgo algo = new cudnnConvolutionFwdAlgo ( ) ; res = CudaDNNNativeMethods . cudnnGetConvolutionForwardAlgorithm ( _handle , xDesc . Desc , filterDesc . Desc , convDesc . Desc , yDesc . Desc , preference , memoryLimitInbytes , ref algo ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cudnnStatus . Success ) throw new CudaDNNException ( res ) ; return algo ; }
This function serves as a heuristic for obtaining the best suited algorithm for
cudnnConvolutionForward for the given layer specifications.
This function serves as a heuristic for obtaining the best suited algorithm for cudnnConvolutionForward for the given layer specifications .
Enumerant that specifies which convolution algorithm should be used to
compute the results according to the specified preference
Enumerant that specifies which convolution algorithm should be used to compute the results according to the specified preference
xDesc
TensorDescriptor
Handle to the previously initialized input tensor descriptor.
Handle to the previously initialized input tensor descriptor .
filterDesc
FilterDescriptor
Handle to a previously initialized filter descriptor.
Handle to a previously initialized filter descriptor .
convDesc
ConvolutionDescriptor
Previously initialized convolution descriptor.
Previously initialized convolution descriptor .
yDesc
TensorDescriptor
Handle to the previously initialized output tensor descriptor.
Handle to the previously initialized output tensor descriptor .
preference
cudnnConvolutionFwdPreference
Enumerant to express the preference criteria in terms of memory
requirement and speed.
Enumerant to express the preference criteria in terms of memory requirement and speed .
memoryLimitInbytes
SizeT
It is used when enumerant preference is set to
CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT to specify the
maximum amount of GPU memory the user is willing to use as a workspace
It is used when enumerant preference is set to CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT to specify the maximum amount of GPU memory the user is willing to use as a workspace