001package com.nativelibs4java.opencl.util.fft; 002import com.nativelibs4java.opencl.CLAbstractUserProgram; 003import com.nativelibs4java.opencl.CLBuffer; 004import com.nativelibs4java.opencl.CLBuildException; 005import com.nativelibs4java.opencl.CLContext; 006import com.nativelibs4java.opencl.CLEvent; 007import com.nativelibs4java.opencl.CLKernel; 008import com.nativelibs4java.opencl.CLProgram; 009import com.nativelibs4java.opencl.CLQueue; 010import java.io.IOException; 011/** Wrapper around the OpenCL program DoubleFFTProgram */ 012public class DoubleFFTProgram extends CLAbstractUserProgram { 013 public DoubleFFTProgram(CLContext context) throws IOException { 014 super(context, readRawSourceForClass(DoubleFFTProgram.class)); 015 } 016 public DoubleFFTProgram(CLProgram program) throws IOException { 017 super(program, readRawSourceForClass(DoubleFFTProgram.class)); 018 } 019 CLKernel rotateValue2_kernel; 020 public synchronized CLEvent rotateValue2(CLQueue commandQueue, double value[], double sinCos[], int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 021 if ((rotateValue2_kernel == null)) 022 rotateValue2_kernel = createKernel("rotateValue2"); 023 checkArrayLength(value, 2, "value"); 024 checkArrayLength(sinCos, 2, "sinCos"); 025 rotateValue2_kernel.setArgs(value, sinCos); 026 return rotateValue2_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 027 } 028 CLKernel cooleyTukeyFFTCopy_kernel; 029 public synchronized CLEvent cooleyTukeyFFTCopy(CLQueue commandQueue, CLBuffer<Double > X, CLBuffer<Double > Y, int N, CLBuffer<Integer > offsetsX, double factor, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 030 if ((cooleyTukeyFFTCopy_kernel == null)) 031 cooleyTukeyFFTCopy_kernel = createKernel("cooleyTukeyFFTCopy"); 032 cooleyTukeyFFTCopy_kernel.setArgs(X, Y, N, offsetsX, factor); 033 return cooleyTukeyFFTCopy_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 034 } 035 CLKernel cooleyTukeyFFTTwiddleFactors_kernel; 036 public synchronized CLEvent cooleyTukeyFFTTwiddleFactors(CLQueue commandQueue, int N, CLBuffer<Double > twiddleFactors, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 037 if ((cooleyTukeyFFTTwiddleFactors_kernel == null)) 038 cooleyTukeyFFTTwiddleFactors_kernel = createKernel("cooleyTukeyFFTTwiddleFactors"); 039 cooleyTukeyFFTTwiddleFactors_kernel.setArgs(N, twiddleFactors); 040 return cooleyTukeyFFTTwiddleFactors_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 041 } 042 CLKernel cooleyTukeyFFT_kernel; 043 public synchronized CLEvent cooleyTukeyFFT(CLQueue commandQueue, CLBuffer<Double > Y, int N, CLBuffer<Double > twiddleFactors, int inverse, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException { 044 if ((cooleyTukeyFFT_kernel == null)) 045 cooleyTukeyFFT_kernel = createKernel("cooleyTukeyFFT"); 046 cooleyTukeyFFT_kernel.setArgs(Y, N, twiddleFactors, inverse); 047 return cooleyTukeyFFT_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor); 048 } 049}