Skip to content
Snippets Groups Projects
Commit 96e55dd5 authored by Sarod Yatawatta's avatar Sarod Yatawatta
Browse files

COB-153: remove phase0 from FIR_Filter, add clockMHz to DelayAndBandPass

parent 2d550287
No related branches found
No related tags found
1 merge request!249COB 153 - Doppler correction in correlator pipeline
......@@ -51,6 +51,7 @@ namespace LOFAR
unsigned nrBitsPerSample_,
unsigned nrChannels_,
unsigned nrSamplesPerChannel_,
unsigned clockMHz_,
double subbandBandwidth_,
unsigned nrSAPs_,
bool correlator_,
......@@ -67,6 +68,7 @@ namespace LOFAR
nrBitsPerSample(nrBitsPerSample_),
nrChannels(nrChannels_),
nrSamplesPerChannel(nrSamplesPerChannel_),
clockMHz(clockMHz_),
subbandBandwidth(subbandBandwidth_),
nrSAPs(nrSAPs_),
delayCompensation(delayCompensation_),
......@@ -227,8 +229,10 @@ namespace LOFAR
if (itsParameters.transpose)
defs["DO_TRANSPOSE"] = "1";
if (itsParameters.dopplerCorrection)
if (itsParameters.dopplerCorrection) {
defs["DOPPLER_CORRECTION"] = "1";
defs["CLOCK_MHZ"] = lexical_cast<string>(itsParameters.clockMHz);
}
return defs;
}
......
......@@ -62,6 +62,7 @@ namespace LOFAR
unsigned nrBitsPerSample,
unsigned nrChannels,
unsigned nrSamplesPerChannel,
unsigned clockMHz,
double subbandBandwidth,
unsigned nrSAPs,
bool correlator,
......@@ -79,6 +80,9 @@ namespace LOFAR
unsigned nrChannels;
unsigned nrSamplesPerChannel;
// Clock freq used to calculate input samplie freq=clockMHz/1024 MHz
// for Doppler correction
unsigned clockMHz;
double subbandBandwidth;
unsigned nrSAPs;
......
......@@ -121,9 +121,6 @@ namespace LOFAR
return (dopplerCorrection?
(size_t) 1 * nrSTABs * // nrSAPs=1 here
NR_POLARIZATIONS * sizeof(double) : 0);
case FIR_FilterKernel::PHASE_ZEROS:
return (dopplerCorrection?
(size_t) nrSTABs * NR_POLARIZATIONS * sizeof(double): 0);
default:
THROW(GPUProcException, "Invalid bufferType (" << bufferType << ")");
}
......@@ -140,8 +137,7 @@ namespace LOFAR
historySamples(stream.getContext(), params.bufferSize(HISTORY_DATA)),
historyFlags(boost::extents[params.nrSubbands][params.nrSTABs]),
delaysAtBegin(stream.getContext(), params.bufferSize(DELAYS)),
delaysAfterEnd(stream.getContext(), params.bufferSize(DELAYS)),
phase0s(stream.getContext(), params.bufferSize(PHASE_ZEROS))
delaysAfterEnd(stream.getContext(), params.bufferSize(DELAYS))
{
setArg(0, buffers.output);
setArg(1, buffers.input);
......@@ -149,7 +145,6 @@ namespace LOFAR
setArg(3, historySamples);
setArg(4, delaysAtBegin);
setArg(5, delaysAfterEnd);
setArg(6, phase0s);
unsigned totalNrThreads = params.nrChannels * NR_POLARIZATIONS * 2;
unsigned nrPasses = ceilDiv(totalNrThreads, maxThreadsPerBlock);
......@@ -195,8 +190,8 @@ namespace LOFAR
void FIR_FilterKernel::enqueue(const BlockID &blockId,
unsigned subbandIdx, double subbandFrequency)
{
setArg(7, subbandIdx);
setArg(8, subbandFrequency);
setArg(6, subbandIdx);
setArg(7, subbandFrequency);
Kernel::enqueue(blockId);
}
......
......@@ -45,8 +45,7 @@ namespace LOFAR
OUTPUT_DATA,
FILTER_WEIGHTS,
HISTORY_DATA,
DELAYS,
PHASE_ZEROS
DELAYS
};
// Parameters that must be passed to the constructor of the
......@@ -144,7 +143,7 @@ namespace LOFAR
public:
// Delay compensation constants to be written by the caller before enqueue()
gpu::DeviceMemory delaysAtBegin, delaysAfterEnd, phase0s;
gpu::DeviceMemory delaysAtBegin, delaysAfterEnd;
};
//# -------- Template specializations for KernelFactory -------- #//
......
......@@ -84,6 +84,7 @@ namespace LOFAR
obsParameters.nrBitsPerSample,
preParameters.nrDelayCompensationChannels,
obsParameters.blockSize / preParameters.nrDelayCompensationChannels,
obsParameters.clockMHz, //not needed in beamformer pipeline
obsParameters.subbandWidth,
obsParameters.nrSAPs,
false, // correlator
......
......@@ -98,6 +98,7 @@ namespace LOFAR
obsParameters.nrBitsPerSample,
corParameters.nrChannels,
obsParameters.blockSize / corParameters.nrChannels,
obsParameters.clockMHz,
obsParameters.subbandWidth,
obsParameters.nrSAPs,
true, // correlator
......@@ -355,8 +356,6 @@ namespace LOFAR
input.delaysAtBegin, false);
htodStream->writeBuffer(firFilterKernel->delaysAfterEnd,
input.delaysAfterEnd, false);
htodStream->writeBuffer(firFilterKernel->phase0s,
input.phase0s, false);
}
if (preParameters.delayCompensationEnabled) {
......
......@@ -67,6 +67,7 @@ int main(int argc, char *argv[])
ps.settings.nrBitsPerSample,
ps.settings.beamFormer.nrDelayCompensationChannels,
ps.settings.blockSize / ps.settings.beamFormer.nrDelayCompensationChannels,
ps.settings.clockMHz,
ps.settings.subbandWidth(),
ps.settings.SAPs.size(),
ps.settings.delayCompensation.enabled,
......
......@@ -37,6 +37,7 @@ struct TestFixture
ps.settings.nrBitsPerSample,
ps.settings.correlator.nrChannels,
ps.settings.blockSize / ps.settings.correlator.nrChannels,
ps.settings.clockMHz,
ps.settings.subbandWidth(),
ps.settings.SAPs.size(),
ps.settings.delayCompensation.enabled,
......
......@@ -130,7 +130,6 @@ int test()
// Empty data for Doppler correction
DeviceMemory devDelaysAtBegin(ctx, 0);
DeviceMemory devDelaysAfterEnd(ctx, 0);
DeviceMemory devPhase0s(ctx, 0);
unsigned station, sample, ch, pol;
......@@ -192,19 +191,20 @@ int test()
stream.writeBuffer(devFirWeights, rawFirWeights, true);
stream.writeBuffer(devHistoryData, rawHistoryData, true);
unsigned subbandIdx = 0;
double subbandFrequency=0.0; // Not used unless Doppler corr. enabled
// Run the kernel on the created data
hKernel.setArg(0, devFilteredData);
hKernel.setArg(1, devSampledData);
hKernel.setArg(2, devFirWeights);
hKernel.setArg(3, devHistoryData);
// Just pass empty buffers
// Just pass empty buffers for the following two
hKernel.setArg(4, devDelaysAtBegin);
hKernel.setArg(5, devDelaysAfterEnd);
hKernel.setArg(6, devPhase0s);
unsigned subbandIdx = 0;
hKernel.setArg(7, subbandIdx);
double subbandFrequency=0.0; // Not used unless Doppler corr. enabled
hKernel.setArg(8, subbandFrequency);
// standard values
hKernel.setArg(6, subbandIdx);
hKernel.setArg(7, subbandFrequency);
// Run the kernel
stream.synchronize();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment