コード例 #1
0
ファイル: CudaFFT.cs プロジェクト: uzbekdev1/CUDAfy.NET-1
        private void DoExecute(FFTPlan plan, object input, object output, bool inverse = false)
        {
            FFTPlanEx     planEx = Plans[plan];
            CUDevicePtrEx inPtrEx;
            CUDevicePtrEx outPtrEx;

            inPtrEx  = _gpu.GetDeviceMemory(input) as CUDevicePtrEx;
            outPtrEx = _gpu.GetDeviceMemory(output) as CUDevicePtrEx;

            CUFFTDirection dir = inverse ? CUFFTDirection.Inverse : CUFFTDirection.Forward;
            CUFFTResult    res = CUFFTResult.ExecFailed;

            if (planEx.CudaFFTType == CUFFTType.C2C)
            {
                res = _driver.cufftExecC2C(planEx.CudaFFTHandle, inPtrEx.DevPtr, outPtrEx.DevPtr, dir);
            }
            else if (planEx.CudaFFTType == CUFFTType.C2R)
            {
                res = _driver.cufftExecC2R(planEx.CudaFFTHandle, inPtrEx.DevPtr, outPtrEx.DevPtr);
            }
            else if (planEx.CudaFFTType == CUFFTType.D2Z)
            {
                res = _driver.cufftExecD2Z(planEx.CudaFFTHandle, inPtrEx.DevPtr, outPtrEx.DevPtr);
            }
            else if (planEx.CudaFFTType == CUFFTType.R2C)
            {
                res = _driver.cufftExecR2C(planEx.CudaFFTHandle, inPtrEx.DevPtr, outPtrEx.DevPtr);
            }
            else if (planEx.CudaFFTType == CUFFTType.Z2D)
            {
                res = _driver.cufftExecZ2D(planEx.CudaFFTHandle, inPtrEx.DevPtr, outPtrEx.DevPtr);
            }
            else if (planEx.CudaFFTType == CUFFTType.Z2Z)
            {
                res = _driver.cufftExecZ2Z(planEx.CudaFFTHandle, inPtrEx.DevPtr, outPtrEx.DevPtr, dir);
            }
            if (res != CUFFTResult.Success)
            {
                throw new CudafyMathException(res.ToString());
            }
        }
コード例 #2
0
ファイル: CUFFT.cs プロジェクト: uzbekdev1/CUDAfy.NET-1
 public void ExecuteComplexToReal(cufftHandle plan, CUdeviceptr input, CUdeviceptr output)
 {
     this.LastError = _driver.cufftExecC2R(plan, input, output);
 }