Example #1
0
        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());
            }
        }
Example #2
0
 public void ExecuteComplexToComplex(cufftHandle plan, CUdeviceptr input, CUdeviceptr output, CUFFTDirection direction)
 {
     this.LastError = _driver.cufftExecC2C(plan, input, output, direction);
 }