Library/ManagedCuda/CudaDNN/CudaDNNContext.cs
/// <summary>
/// This function serves as a heuristic for obtaining the best suited algorithm for
/// cudnnConvolutionBackwardFilter 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 cudnnFindConvolutionBackwardFilterAlgorithm.
/// </summary>
/// <param name="xDesc">Handle to the previously initialized input tensor descriptor.</param>
/// <param name="dyDesc">Handle to the previously initialized input differential tensor descriptor.</param>
/// <param name="convDesc">Previously initialized convolution descriptor.</param>
/// <param name="filterDesc">Handle to a previously initialized filter 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
cudnnConvolutionBackwardFilter 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 cudnnFindConvolutionBackwardFilterAlgorithm.
This function serves as a heuristic for obtaining the best suited algorithm for cudnnConvolutionBackwardFilter 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 cudnnFindConvolutionBackwardFilterAlgorithm .
public cudnnConvolutionBwdFilterAlgoPerf[] GetConvolutionBackwardFilterAlgorithm(TensorDescriptor xDesc,
                                                        TensorDescriptor dyDesc,
                                                    FilterDescriptor filterDesc,
                                                    ConvolutionDescriptor convDesc,
                                                    int requestedAlgoCount
                                                    )
        {
            cudnnConvolutionBwdFilterAlgoPerf[] algos = new cudnnConvolutionBwdFilterAlgoPerf[requestedAlgoCount];
            int returnedAlgoCount = 0;
            res = CudaDNNNativeMethods.cudnnGetConvolutionBackwardFilterAlgorithm_v7(_handle, xDesc.Desc, dyDesc.Desc, convDesc.Desc, filterDesc.Desc, requestedAlgoCount, ref returnedAlgoCount, algos);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnGetConvolutionBackwardFilterAlgorithm_v7", res));
            if (res != cudnnStatus.Success) throw new CudaDNNException(res);
            if (returnedAlgoCount != requestedAlgoCount)
            {
                cudnnConvolutionBwdFilterAlgoPerf[] temp = new cudnnConvolutionBwdFilterAlgoPerf[returnedAlgoCount];
                Array.Copy(algos, temp, returnedAlgoCount);
                algos = temp;
            }
            return algos;
        }
public cudnnConvolutionBwdFilterAlgoPerf [ ] GetConvolutionBackwardFilterAlgorithm ( TensorDescriptor xDesc , TensorDescriptor dyDesc , FilterDescriptor filterDesc , ConvolutionDescriptor convDesc , int requestedAlgoCount ) { cudnnConvolutionBwdFilterAlgoPerf [ ] algos = new cudnnConvolutionBwdFilterAlgoPerf [ requestedAlgoCount ] ; int returnedAlgoCount = 0 ; res = CudaDNNNativeMethods . cudnnGetConvolutionBackwardFilterAlgorithm_v7 ( _handle , xDesc . Desc , dyDesc . Desc , convDesc . Desc , filterDesc . Desc , requestedAlgoCount , ref returnedAlgoCount , algos ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != cudnnStatus . Success ) throw new CudaDNNException ( res ) ; if ( returnedAlgoCount != requestedAlgoCount ) { cudnnConvolutionBwdFilterAlgoPerf [ ] temp = new cudnnConvolutionBwdFilterAlgoPerf [ returnedAlgoCount ] ; Array . Copy ( algos , temp , returnedAlgoCount ) ; algos = temp ; } return algos ; }
This function serves as a heuristic for obtaining the best suited algorithm for
cudnnConvolutionBackwardFilter 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 cudnnFindConvolutionBackwardFilterAlgorithm.
This function serves as a heuristic for obtaining the best suited algorithm for cudnnConvolutionBackwardFilter 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 cudnnFindConvolutionBackwardFilterAlgorithm .
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 .
dyDesc
TensorDescriptor
Handle to the previously initialized input differential tensor descriptor.
Handle to the previously initialized input differential 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 .
requestedAlgoCount
int
The maximum number of elements to be stored in perfResults.
The maximum number of elements to be stored in perfResults .