Exemplo n.º 1
0
		public static extern cudnnStatus cudnnFindConvolutionBackwardDataAlgorithm( cudnnHandle handle,
                                                                     cudnnFilterDescriptor       filterDesc,
                                                                     cudnnTensorDescriptor       diffDesc,
                                                                     cudnnConvolutionDescriptor  convDesc, 
                                                                     cudnnTensorDescriptor       gradDesc,
                                                                     int                           requestedAlgoCount,
                                                                     ref int                               returnedAlgoCount,
                                                                     cudnnConvolutionBwdDataAlgoPerf[] perfResults  
                                                                   );
Exemplo n.º 2
0
		/// <summary>
		/// This function attempts all cuDNN algorithms for
		/// cudnnConvolutionBackwardData_v3 and outputs performance metrics to a user-
		/// allocated array of cudnnConvolutionBwdDataAlgoPerf_t. These metrics are written
		/// in sorted fashion where the first element has the lowest compute time.
		/// </summary>
		/// <param name="filterDesc">Handle to a previously initialized filter descriptor.</param>
		/// <param name="diffDesc">Handle to the previously initialized input differential tensor descriptor.</param>
		/// <param name="convDesc">Previously initialized convolution descriptor.</param>
		/// <param name="gradDesc">Handle to the previously initialized output tensor descriptor.</param>
		/// <param name="requestedAlgoCount">The maximum number of elements to be stored in perfResults.</param>
		/// <returns>An array to store performance metrics sorted ascending by compute time.</returns>
		public cudnnConvolutionBwdDataAlgoPerf[] FindConvolutionBackwardDataAlgorithm(FilterDescriptor filterDesc,
															TensorDescriptor diffDesc,
															ConvolutionDescriptor convDesc,
															TensorDescriptor gradDesc,
															int requestedAlgoCount
														)
		{
			cudnnConvolutionBwdDataAlgoPerf[] temp = new cudnnConvolutionBwdDataAlgoPerf[requestedAlgoCount];
			int returnedAlgoCount = 0;
			res = CudaDNNNativeMethods.cudnnFindConvolutionBackwardDataAlgorithm(_handle, filterDesc.Desc, diffDesc.Desc, convDesc.Desc, gradDesc.Desc, requestedAlgoCount, ref returnedAlgoCount, temp);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cudnnFindConvolutionBackwardDataAlgorithm", res));
			if (res != cudnnStatus.Success) throw new CudaDNNException(res);
			if (returnedAlgoCount <= 0) return null;

			cudnnConvolutionBwdDataAlgoPerf[] perfResults = new cudnnConvolutionBwdDataAlgoPerf[returnedAlgoCount];
			Array.Copy(temp, perfResults, returnedAlgoCount);
			return perfResults;
		}