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.This function will return
/// all algorithms sorted by expected (based on internal heuristic) relative performance with
/// fastest being index 0 of perfResults.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="requestedAlgoCount">The maximum number of elements to be stored in perfResults.</param>
/// <returns>array to store performance metrics sorted ascending by compute time.</returns>
This function serves as a heuristic for obtaining the best suited algorithm for
cudnnConvolutionForward for the given layer specifications.This function will return
all algorithms sorted by expected (based on internal heuristic) relative performance with
fastest being index 0 of perfResults.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 . This function will return all algorithms sorted by expected ( based on internal heuristic ) relative performance with fastest being index 0 of perfResults . For an exhaustive search for the fastest algorithm please use cudnnFindConvolutionForwardAlgorithm .
public cudnnConvolutionFwdAlgoPerf[] GetConvolutionForwardAlgorithm(TensorDescriptor xDesc,
                                                    FilterDescriptor filterDesc,
                                                    ConvolutionDescriptor convDesc,
                                                    TensorDescriptor yDesc,
                                                    int requestedAlgoCount
                                                    )
        {
            cudnnConvolutionFwdAlgoPerf[] algos = new cudnnConvolutionFwdAlgoPerf[requestedAlgoCount];
            int returnedAlgoCount = 0;
            res = CudaDNNNativeMethods.cudnnGetConvolutionForwardAlgorithm_v7(_handle, xDesc.Desc, filterDesc.Desc, convDesc.Desc, yDesc.Desc, requestedAlgoCount, ref returnedAlgoCount, algos);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolutionForwardAlgorithm_v7", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
            if (returnedAlgoCount != requestedAlgoCount)
            {
                cudnnConvolutionFwdAlgoPerf[] temp = new cudnnConvolutionFwdAlgoPerf[returnedAlgoCount];
                Array.Copy(algos, temp, returnedAlgoCount);
                algos = temp;
            }
            return algos;
        }
public cudnnConvolutionFwdAlgoPerf [ ] GetConvolutionForwardAlgorithm ( TensorDescriptor xDesc , FilterDescriptor filterDesc , ConvolutionDescriptor convDesc , TensorDescriptor yDesc , int requestedAlgoCount ) { cudnnConvolutionFwdAlgoPerf [ ] algos = new cudnnConvolutionFwdAlgoPerf [ requestedAlgoCount ] ; int returnedAlgoCount = 0 ; res = CudaDNNNativeMethods . cudnnGetConvolutionForwardAlgorithm_v7 ( _handle , xDesc . Desc , filterDesc . Desc , convDesc . Desc , yDesc . Desc , requestedAlgoCount , ref returnedAlgoCount , algos ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cudnnStatus . Success ) throw new CudaDNNException ( res ) ; if ( returnedAlgoCount != requestedAlgoCount ) { cudnnConvolutionFwdAlgoPerf [ ] temp = new cudnnConvolutionFwdAlgoPerf [ returnedAlgoCount ] ; Array . Copy ( algos , temp , returnedAlgoCount ) ; algos = temp ; } return algos ; }
This function serves as a heuristic for obtaining the best suited algorithm for
cudnnConvolutionForward for the given layer specifications.This function will return
all algorithms sorted by expected (based on internal heuristic) relative performance with
fastest being index 0 of perfResults.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 . This function will return all algorithms sorted by expected ( based on internal heuristic ) relative performance with fastest being index 0 of perfResults . For an exhaustive search for the fastest algorithm please use cudnnFindConvolutionForwardAlgorithm .
array to store performance metrics sorted ascending by compute time.
array to store performance metrics sorted ascending by compute time .
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 .
requestedAlgoCount
int
The maximum number of elements to be stored in perfResults.
The maximum number of elements to be stored in perfResults .