示例#1
0
        /// <summary>
        /// Creates a 2D plan.
        /// </summary>
        /// <param name="fftType">Type of FFT.</param>
        /// <param name="dataType">Data type.</param>
        /// <param name="nx">The number of samples in x dimension.</param>
        /// <param name="ny">The number of samples in y dimension.</param>
        /// <param name="batchSize">Size of batch.</param>
        /// <returns>Plan.</returns>
        public override FFTPlan2D Plan2D(eFFTType fftType, eDataType dataType, int nx, int ny, int batchSize)
        {
            int         insize, outsize;
            CUFFTType   cuFFTType = VerifyTypes(fftType, dataType, out insize, out outsize);
            cufftHandle handle    = new cufftHandle();
            CUFFTResult res;

            if (batchSize <= 1)
            {
                res = _driver.cufftPlan2d(ref handle, nx, ny, cuFFTType);
            }
            else
            {
                res = _driver.cufftPlanMany(ref handle, 2, new int[] { nx, ny }, null, 1, 0, null, 1, 0, cuFFTType, batchSize);
            }
            if (res != CUFFTResult.Success)
            {
                throw new CudafyHostException(res.ToString());
            }
            FFTPlan2D   plan   = new FFTPlan2D(nx, ny, batchSize, this);
            FFTPlan2DEx planEx = new FFTPlan2DEx(plan)
            {
                CudaFFTHandle = handle, CudaFFTType = cuFFTType, DataType = dataType
            };

            Plans.Add(plan, planEx);
            return(plan);
        }
示例#2
0
 public cufftHandle Plan2D(int nx, int ny, CUFFTType type)
 {
     this.plan      = new cufftHandle();
     this.LastError = _driver.cufftPlan2d(ref this.plan, nx, ny, type);
     return(this.plan);
 }