/// <summary> /// Frees the specified plan. /// </summary> /// <param name="plan">The plan.</param> public override void Remove(FFTPlan plan) { FFTPlanEx planEx = Plans[plan]; CUFFTResult res = _driver.cufftDestroy(planEx.CudaFFTHandle); if (res != CUFFTResult.Success) { //throw new CudafyHostException(res.ToString()); Debug.WriteLine("remove plan failed: " + res.ToString()); } else { Debug.WriteLine("remove plan succeeded: " + res.ToString()); } Plans.Remove(plan); }
/// <summary> /// Configures the layout of CUFFT output in FFTW‐compatible modes. /// When FFTW compatibility is desired, it can be configured for padding /// only, for asymmetric complex inputs only, or to be fully compatible. /// </summary> /// <param name="plan">The plan.</param> /// <param name="mode">The mode.</param> public override void SetCompatibilityMode(FFTPlan plan, eCompatibilityMode mode) { CUFFTCompatibility cumode = (CUFFTCompatibility)mode; FFTPlanEx planEx = Plans[plan]; CUFFTResult res = _driver.cufftSetCompatibilityMode(planEx.CudaFFTHandle, cumode); if (res != CUFFTResult.Success) { throw new CudafyHostException(res.ToString()); } }
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()); } }