diff --git a/RTCP/Cobalt/GPUProc/src/CMakeLists.txt b/RTCP/Cobalt/GPUProc/src/CMakeLists.txt index 33fb73b240310e3201e3d041b9eadf2b1c358c09..8b52611b0b5575c31663cee132ca1fd1255d8b06 100644 --- a/RTCP/Cobalt/GPUProc/src/CMakeLists.txt +++ b/RTCP/Cobalt/GPUProc/src/CMakeLists.txt @@ -56,16 +56,16 @@ list(APPEND _gpuproc_sources #Kernels/UHEP_TriggerKernel.cc Pipelines/Pipeline.cc # Pipelines/UHEP_Pipeline.cc - cuda/SubbandProcs/SubbandProc.cc - cuda/SubbandProcs/SubbandProcInputData.cc - cuda/SubbandProcs/SubbandProcOutputData.cc - cuda/SubbandProcs/KernelFactories.cc - cuda/SubbandProcs/CorrelatorStep.cc - cuda/SubbandProcs/BeamFormerPreprocessingStep.cc - cuda/SubbandProcs/BeamFormerCoherentStep.cc - cuda/SubbandProcs/BeamFormerIncoherentStep.cc + SubbandProcs/SubbandProc.cc + SubbandProcs/SubbandProcInputData.cc + SubbandProcs/SubbandProcOutputData.cc + SubbandProcs/KernelFactories.cc + SubbandProcs/CorrelatorStep.cc + SubbandProcs/BeamFormerPreprocessingStep.cc + SubbandProcs/BeamFormerCoherentStep.cc + SubbandProcs/BeamFormerIncoherentStep.cc -# cuda/SubbandProcs/UHEP_SubbandProc.cc +# SubbandProcs/UHEP_SubbandProc.cc ) add_subdirectory(cuda) diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerCoherentStep.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/BeamFormerCoherentStep.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerCoherentStep.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/BeamFormerCoherentStep.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerIncoherentStep.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/BeamFormerIncoherentStep.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerIncoherentStep.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/BeamFormerIncoherentStep.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerPreprocessingStep.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/BeamFormerPreprocessingStep.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerPreprocessingStep.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/BeamFormerPreprocessingStep.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/CorrelatorStep.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/CorrelatorStep.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/CorrelatorStep.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/CorrelatorStep.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/KernelFactories.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/KernelFactories.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/KernelFactories.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/KernelFactories.cc diff --git a/RTCP/Cobalt/GPUProc/src/SubbandProcs/KernelFactories.h b/RTCP/Cobalt/GPUProc/src/SubbandProcs/KernelFactories.h index 5990243f2e857132790dbbdacd2d7e581ecb42f8..c58eaaf914f60d33d3d8b718175b779d5581cc70 100644 --- a/RTCP/Cobalt/GPUProc/src/SubbandProcs/KernelFactories.h +++ b/RTCP/Cobalt/GPUProc/src/SubbandProcs/KernelFactories.h @@ -1,6 +1,6 @@ //# KernelFactories.h //# -//# Copyright (C) 2013 ASTRON (Netherlands Institute for Radio Astronomy) +//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) //# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands //# //# This file is part of the LOFAR software suite. @@ -19,23 +19,35 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_FACTORIES_H +#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_FACTORIES_H -#ifndef LOFAR_GPUPROC_BEAM_FORMER_FACTORIES_H -#define LOFAR_GPUPROC_BEAM_FORMER_FACTORIES_H +#include <CoInterface/Parset.h> +#include <CoInterface/SmartPtr.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "CorrelatorStep.h" +#include "BeamFormerPreprocessingStep.h" +#include "BeamFormerCoherentStep.h" +#include "BeamFormerIncoherentStep.h" -#if defined (USE_CUDA) -# include <GPUProc/cuda/SubbandProcs/KernelFactories.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/SubbandProcs/KernelFactories.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + struct KernelFactories + { + KernelFactories(const Parset &ps, + size_t nrSubbandsPerSubbandProc = 1); -#endif + SmartPtr<CorrelatorStep::Factories> correlator; + + SmartPtr<BeamFormerPreprocessingStep::Factories> preprocessing; + SmartPtr<BeamFormerCoherentStep::Factories> coherentStokes; + SmartPtr<BeamFormerIncoherentStep::Factories> incoherentStokes; + }; + + } +} + +#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProc.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProc.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProc.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProc.cc diff --git a/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProc.h b/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProc.h index a988863c3c53cb10d3b7731b4bdc05258a7bee81..608606c2c1d15661473441b58641fabfd50fba0f 100644 --- a/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProc.h +++ b/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProc.h @@ -1,6 +1,5 @@ //# SubbandProc.h -//# -//# Copyright (C) 2013 ASTRON (Netherlands Institute for Radio Astronomy) +//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) //# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands //# //# This file is part of the LOFAR software suite. @@ -19,23 +18,142 @@ //# //# $Id$ +#ifndef LOFAR_GPUPROC_CUDA_SUBBAND_PROC_H +#define LOFAR_GPUPROC_CUDA_SUBBAND_PROC_H + +#include <string> +#include <map> +#include <complex> +#include <memory> + +#include <boost/shared_ptr.hpp> +#include <Common/LofarLogger.h> +#include <CoInterface/BudgetTimer.h> +#include <CoInterface/CorrelatedData.h> +#include <CoInterface/Parset.h> +#include <CoInterface/Pool.h> +#include <CoInterface/SmartPtr.h> +#include <CoInterface/BlockID.h> +#include <CoInterface/Config.h> +#include <CoInterface/SubbandMetaData.h> +#include <GPUProc/PerformanceCounter.h> +#include <GPUProc/gpu_wrapper.h> +#include <GPUProc/MultiDimArrayHostBuffer.h> + +#include "SubbandProcInputData.h" +#include "SubbandProcOutputData.h" +#include "CorrelatorStep.h" +#include "BeamFormerPreprocessingStep.h" +#include "BeamFormerCoherentStep.h" +#include "BeamFormerIncoherentStep.h" + // \file -// Include the right GPU API include with our options. +// TODO: Update documentation -#ifndef LOFAR_GPUPROC_SUBBAND_PROC_H -#define LOFAR_GPUPROC_SUBBAND_PROC_H +namespace LOFAR +{ + namespace Cobalt + { + //# Forward declarations + struct KernelFactories; -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif + /* + * The SubbandProc does the following transformation: + * SubbandProcInputData -> SubbandProcOutputData + * + * The SubbandProcInputData represents one block of one subband + * of input data, and the SubbandProcOutputData (for example) the complex + * visibilities of such a block. + * + * For both input and output, a fixed set of objects is created, + * tied to the GPU specific for the SubbandProc, for increased + * performance. The objects are recycled by using Pool objects. + * + * The data flows as follows: + * + * // Fetch the next input object to fill + * SmartPtr<SubbandProcInputData> input = queue.inputPool.free.remove(); + * + * // Provide input + * receiveInput(input); + * + * // Annotate input + * input->blockID.block = block; + * input->blockID.globalSubbandIdx = subband; + * input->blockID.localSubbandIdx = subbandIdx; + * + * // Fetch the next output object to fill + * SmartPtr<SubbandProcOutputData> output = queue.outputPool.free.remove(); + * + * // Process block + * queue.processSubband(input, output); + * + * // Give back input and output objects to queue + * queue.inputPool.free.append(input); + * queue.outputPool.free.append(output); + * + * The queue.inputPool.filled and queue.outputPool.filled can be used to + * temporarily store filled input and output objects. Such is needed to + * obtain parallellism (i.e. read/process/write in separate threads). + */ + class SubbandProc { + public: + SubbandProc(const Parset &ps, gpu::Context &context, + KernelFactories &factories, + size_t nrSubbandsPerSubbandProc = 1); -#if defined (USE_CUDA) -# include <GPUProc/cuda/SubbandProcs/SubbandProc.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/SubbandProcs/SubbandProc.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif + // A pool of input data, to allow items to be filled and + // computed on in parallel. + Pool<SubbandProcInputData> inputPool; + + // A pool of input data, that has been pre processed. + Pool<SubbandProcInputData> processPool; + + // A pool of output data, to allow items to be filled + // and written in parallel. + Pool<SubbandProcOutputData> outputPool; + + // Correlate the data found in the input data buffer + void processSubband(SubbandProcInputData &input, SubbandProcOutputData &output); + + // Do post processing on the CPU. + void postprocessSubband(SubbandProcOutputData &output); + + protected: + const Parset &ps; + const size_t nrSubbandsPerSubbandProc; + + gpu::Stream queue; + + // The previously processed SAP/block, or -1 if nothing has been + // processed yet. Used in order to determine if new delays have + // to be uploaded. + ssize_t prevBlock; + signed int prevSAP; + + // @{ + // Device memory buffers. These buffers are used interleaved. For details, + // please refer to the document bf-pipeline.txt in the directory + // GPUProc/doc. + boost::shared_ptr<gpu::DeviceMemory> devA; + boost::shared_ptr<gpu::DeviceMemory> devB; + // @} + + PerformanceCounter totalCounter; + PerformanceCounter inputCounter; + BudgetTimer processCPUTimer; + + std::unique_ptr<CorrelatorStep> correlatorStep; + std::unique_ptr<BeamFormerPreprocessingStep> preprocessingStep; + std::unique_ptr<BeamFormerCoherentStep> coherentStep; + std::unique_ptr<BeamFormerIncoherentStep> incoherentStep; + + // Returns the number of output elements to create to get a smooth + // running pipeline. + size_t nrOutputElements() const; + }; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcInputData.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProcInputData.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcInputData.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProcInputData.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcOutputData.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProcOutputData.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcOutputData.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/SubbandProcOutputData.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/UHEP_SubbandProc.cc b/RTCP/Cobalt/GPUProc/src/SubbandProcs/UHEP_SubbandProc.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/UHEP_SubbandProc.cc rename to RTCP/Cobalt/GPUProc/src/SubbandProcs/UHEP_SubbandProc.cc diff --git a/RTCP/Cobalt/GPUProc/src/SubbandProcs/UHEP_SubbandProc.h b/RTCP/Cobalt/GPUProc/src/SubbandProcs/UHEP_SubbandProc.h index 9f7ebd9c4fdf1460a9fd59642e18cd17732b7dbe..03169c57f7175a537efe47ffa7dba49fa05c0507 100644 --- a/RTCP/Cobalt/GPUProc/src/SubbandProcs/UHEP_SubbandProc.h +++ b/RTCP/Cobalt/GPUProc/src/SubbandProcs/UHEP_SubbandProc.h @@ -1,6 +1,5 @@ //# UHEP_SubbandProc.h -//# -//# Copyright (C) 2013 ASTRON (Netherlands Institute for Radio Astronomy) +//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) //# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands //# //# This file is part of the LOFAR software suite. @@ -19,23 +18,52 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_UHEP_SUBBAND_PROC_H +#define LOFAR_GPUPROC_CUDA_UHEP_SUBBAND_PROC_H -#ifndef LOFAR_GPUPROC_UHEP_SUBBAND_PROC_H -#define LOFAR_GPUPROC_UHEP_SUBBAND_PROC_H +#include <complex> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <Common/LofarLogger.h> +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/SubbandProcs/UHEP_SubbandProc.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/SubbandProcs/UHEP_SubbandProc.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +#include <GPUProc/global_defines.h> +#include <GPUProc/MultiDimArrayHostBuffer.h> +#include <GPUProc/Pipelines/UHEP_Pipeline.h> +#include <GPUProc/Kernels/UHEP_TriggerKernel.h> +#include "SubbandProc.h" + +namespace LOFAR +{ + namespace Cobalt + { + class UHEP_SubbandProc : public SubbandProc + { + public: + UHEP_SubbandProc(UHEP_Pipeline &, unsigned queueNumber); + + void doWork(const float *delaysAtBegin, const float *delaysAfterEnd, const float *phaseOffsets); + + UHEP_Pipeline &pipeline; + gpu::Event inputSamplesEvent, beamFormerWeightsEvent; + + gpu::DeviceMemory devBuffers[2]; + gpu::DeviceMemory devInputSamples; + MultiArrayHostBuffer<char, 5> hostInputSamples; + + gpu::DeviceMemory devBeamFormerWeights; + MultiArrayHostBuffer<std::complex<float>, 3> hostBeamFormerWeights; + + gpu::DeviceMemory devComplexVoltages; + gpu::DeviceMemory devReverseSubbandMapping; + gpu::DeviceMemory devFFTedData; + gpu::DeviceMemory devInvFIRfilteredData; + gpu::DeviceMemory devInvFIRfilterWeights; + + gpu::DeviceMemory devTriggerInfo; + MultiArraySharedBuffer<TriggerInfo, 1> hostTriggerInfo; + }; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerCoherentStep.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerCoherentStep.h deleted file mode 100644 index c96eec1ce5f24c95fd9cb6eb5cbb1549e9c521e7..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerCoherentStep.h +++ /dev/null @@ -1,124 +0,0 @@ -//# BeamFormerPreprocessingStep.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_COHERENT_STEP_H -#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_COHERENT_STEP_H - - -#include <complex> - -#include <Common/LofarLogger.h> -#include <CoInterface/Parset.h> - -#include <boost/shared_ptr.hpp> -#include <GPUProc/gpu_wrapper.h> - -#include <GPUProc/MultiDimArrayHostBuffer.h> -#include <CoInterface/BlockID.h> - -#include "SubbandProcInputData.h" -#include "SubbandProcOutputData.h" -#include "ProcessStep.h" - -#include <GPUProc/Kernels/BeamFormerKernel.h> -#include <GPUProc/Kernels/CoherentStokesTransposeKernel.h> -#include <GPUProc/Kernels/DelayAndBandPassKernel.h> -#include <GPUProc/Kernels/FFTShiftKernel.h> -#include <GPUProc/Kernels/FFT_Kernel.h> -#include <GPUProc/Kernels/FIR_FilterKernel.h> -#include <GPUProc/Kernels/CoherentStokesKernel.h> - -namespace LOFAR -{ - namespace Cobalt - { - //# Forward declarations - struct KernelFactories; - - class BeamFormerCoherentStep: public ProcessStep - { - public: - struct Factories - { - Factories(const Parset &ps, size_t nrSubbandsPerSubbandProc = 1); - - KernelFactory<BeamFormerKernel> beamFormer; - KernelFactory<CoherentStokesTransposeKernel> coherentTranspose; - KernelFactory<FFT_Kernel> coherentInverseFFT; - KernelFactory<FFTShiftKernel> coherentInverseFFTShift; - SmartPtr< KernelFactory<FIR_FilterKernel> > coherentFirFilter; - SmartPtr< KernelFactory<FFT_Kernel> > coherentFinalFFT; - KernelFactory<CoherentStokesKernel> coherentStokes; - }; - - BeamFormerCoherentStep(const Parset &parset, - gpu::Stream &i_queue, - gpu::Context &context, - Factories &factories, - boost::shared_ptr<gpu::DeviceMemory> i_devB); - - gpu::DeviceMemory outputBuffer(); - - void writeInput(const SubbandProcInputData &input); - - void process(const SubbandProcInputData &input); - - void readOutput(SubbandProcOutputData &output); - - private: - - const bool coherentStokesPPF; - - // Data members - boost::shared_ptr<gpu::DeviceMemory> devB; - gpu::DeviceMemory devC; - gpu::DeviceMemory devD; - - // Kernel members - std::unique_ptr<BeamFormerKernel> beamFormerKernel; - - // Transpose - std::unique_ptr<CoherentStokesTransposeKernel> coherentTransposeKernel; - - // inverse (4k points) FFT - std::unique_ptr<FFT_Kernel> inverseFFT; - - // inverse FFT-shift - std::unique_ptr<FFTShiftKernel> inverseFFTShiftKernel; - - // Poly-phase filter (FIR + FFT) - std::unique_ptr<FIR_FilterKernel> firFilterKernel; - std::unique_ptr<FFT_Kernel> coherentFinalFFT; - - // Coherent Stokes - std::unique_ptr<CoherentStokesKernel> coherentStokesKernel; - - PerformanceCounter outputCounter; - - size_t nrCoherent(const BlockID &blockID) const; - }; - - - } -} - -#endif - - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerIncoherentStep.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerIncoherentStep.h deleted file mode 100644 index 30e9c1062e7bf3aacecf5b7828e0db387597eb60..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerIncoherentStep.h +++ /dev/null @@ -1,114 +0,0 @@ -//# BeamFormerIncoherentStep.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_INCOHERENT_STEP_H -#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_INCOHERENT_STEP_H - - -#include <complex> - -#include <Common/LofarLogger.h> -#include <CoInterface/Parset.h> - -#include <boost/shared_ptr.hpp> -#include <GPUProc/gpu_wrapper.h> - -#include <GPUProc/MultiDimArrayHostBuffer.h> -#include <CoInterface/BlockID.h> - -#include "SubbandProcInputData.h" -#include "SubbandProcOutputData.h" -#include "ProcessStep.h" - -#include <GPUProc/Kernels/FFT_Kernel.h> -#include <GPUProc/Kernels/FFTShiftKernel.h> -#include <GPUProc/Kernels/FIR_FilterKernel.h> -#include <GPUProc/Kernels/IncoherentStokesKernel.h> -#include <GPUProc/Kernels/IncoherentStokesTransposeKernel.h> - - -namespace LOFAR -{ - namespace Cobalt - { - class BeamFormerIncoherentStep : public ProcessStep - { - public: - struct Factories - { - Factories(const Parset &ps, size_t nrSubbandsPerSubbandProc = 1); - - KernelFactory<IncoherentStokesTransposeKernel> incoherentStokesTranspose; - KernelFactory<FFT_Kernel> incoherentInverseFFT; - KernelFactory<FFTShiftKernel> incoherentInverseFFTShift; - SmartPtr< KernelFactory<FIR_FilterKernel> > incoherentFirFilter; - SmartPtr< KernelFactory<FFT_Kernel> > incoherentFinalFFT; - KernelFactory<IncoherentStokesKernel> incoherentStokes; - }; - - BeamFormerIncoherentStep(const Parset &parset, - gpu::Stream &i_queue, - gpu::Context &context, - Factories &factories, - boost::shared_ptr<gpu::DeviceMemory> i_devA, - boost::shared_ptr<gpu::DeviceMemory> i_devB - ); - - gpu::DeviceMemory outputBuffer(); - - void process(const SubbandProcInputData &input); - - void readOutput(SubbandProcOutputData &output); - - private: - - // Data members - boost::shared_ptr<gpu::DeviceMemory> devA; - boost::shared_ptr<gpu::DeviceMemory> devB; - - // ***************************************************************** - // Objects needed to produce incoherent stokes output - const bool incoherentStokesPPF; - - // Transpose - std::unique_ptr<IncoherentStokesTransposeKernel> incoherentTranspose; - - // Inverse (4k points) FFT - std::unique_ptr<FFT_Kernel> incoherentInverseFFT; - - // Inverse FFT-shift - std::unique_ptr<FFTShiftKernel> incoherentInverseFFTShiftKernel; - - // Poly-phase filter (FIR + FFT) - std::unique_ptr<FIR_FilterKernel> incoherentFirFilterKernel; - std::unique_ptr<FFT_Kernel> incoherentFinalFFT; - - // Incoherent Stokes - std::unique_ptr<IncoherentStokesKernel> incoherentStokesKernel; - - PerformanceCounter outputCounter; - - size_t nrIncoherent(const BlockID &blockID) const; - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerPreprocessingStep.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerPreprocessingStep.h deleted file mode 100644 index f5fb0ac09dfe905c89549cfdde307aeb4c877e11..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/BeamFormerPreprocessingStep.h +++ /dev/null @@ -1,108 +0,0 @@ -//# BeamFormerPreprocessingStep.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_PREPROCESSING_STEP_H -#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_PREPROCESSING_STEP_H - -#include <complex> - -#include <Common/LofarLogger.h> -#include <CoInterface/Parset.h> - -#include <boost/shared_ptr.hpp> -#include <GPUProc/gpu_wrapper.h> - -#include <GPUProc/MultiDimArrayHostBuffer.h> -#include <CoInterface/BlockID.h> -#include <CoInterface/SparseSet.h> -#include <CoInterface/MultiDimArray.h> - -#include "SubbandProcInputData.h" -#include "SubbandProcOutputData.h" -#include "ProcessStep.h" - -#include <GPUProc/KernelFactory.h> -#include <GPUProc/Kernels/BandPassCorrectionKernel.h> -#include <GPUProc/Kernels/DelayAndBandPassKernel.h> -#include <GPUProc/Kernels/FFTShiftKernel.h> -#include <GPUProc/Kernels/FFT_Kernel.h> -#include <GPUProc/Kernels/IntToFloatKernel.h> -#include <GPUProc/Kernels/ZeroingKernel.h> - -namespace LOFAR -{ - namespace Cobalt - { - class BeamFormerPreprocessingStep: public ProcessStep - { - public: - struct Factories { - Factories(const Parset &ps); - - KernelFactory<IntToFloatKernel> intToFloat; - - KernelFactory<FFT_Kernel> firstFFT; - KernelFactory<FFTShiftKernel> fftShift; - - KernelFactory<ZeroingKernel> zeroing; - - KernelFactory<DelayAndBandPassKernel> delayCompensation; - - KernelFactory<BandPassCorrectionKernel> bandPassCorrection; - }; - - BeamFormerPreprocessingStep(const Parset &parset, - gpu::Stream &i_queue, - gpu::Context &context, - Factories &factories, - boost::shared_ptr<gpu::DeviceMemory> i_devA, - boost::shared_ptr<gpu::DeviceMemory> i_devB); - - void writeInput(const SubbandProcInputData &input); - - void process(const SubbandProcInputData &input); - - private: - // Preallocated flags for FFT-ed data -- used locally - MultiDimArray<SparseSet<unsigned>, 1> flagsPerChannel; - - //Data members - boost::shared_ptr<gpu::DeviceMemory> devA; - boost::shared_ptr<gpu::DeviceMemory> devB; - - // Int -> Float conversion - std::unique_ptr<IntToFloatKernel> intToFloatKernel; - - // First (64 points) FFT - std::unique_ptr<FFT_Kernel> firstFFT; - - // Zeroing flagged samples - std::unique_ptr<ZeroingKernel> zeroingKernel; - - // Delay compensation - std::unique_ptr<DelayAndBandPassKernel> delayCompensationKernel; - - // Bandpass correction and tranpose - std::unique_ptr<BandPassCorrectionKernel> bandPassCorrectionKernel; - }; - } -} - -#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/CorrelatorStep.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/CorrelatorStep.h deleted file mode 100644 index 3fa9e3d79cd2a1e51820e56d5d33130fdea66fe0..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/CorrelatorStep.h +++ /dev/null @@ -1,180 +0,0 @@ -//# CorrelatorStep.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_CORRELATOR_STEP_H -#define LOFAR_GPUPROC_CUDA_CORRELATOR_STEP_H - -#include <complex> -#include <vector> -#include <utility> // for std::pair - -#include <CoInterface/Parset.h> -#include <CoInterface/SmartPtr.h> - -#include <boost/shared_ptr.hpp> -#include <GPUProc/gpu_wrapper.h> - -#include <GPUProc/MultiDimArrayHostBuffer.h> -#include <CoInterface/BlockID.h> -#include <CoInterface/CorrelatedData.h> - -#include "SubbandProcInputData.h" -#include "SubbandProcOutputData.h" -#include "ProcessStep.h" - -#include <GPUProc/PerformanceCounter.h> -#include <GPUProc/Flagger.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/Kernels/DelayAndBandPassKernel.h> -#include <GPUProc/Kernels/FIR_FilterKernel.h> -#include <GPUProc/Kernels/FFT_Kernel.h> -#include <GPUProc/Kernels/IntToFloatKernel.h> -#include <GPUProc/Kernels/ZeroingKernel.h> -#include <GPUProc/Kernels/CorrelatorKernel.h> - - -namespace LOFAR -{ - namespace Cobalt - { - class CorrelatorStep: public ProcessStep - { - public: - struct Factories { - Factories(const Parset &ps, size_t nrSubbandsPerSubbandProc); - - SmartPtr< KernelFactory<FFT_Kernel> > fft; - SmartPtr< KernelFactory<FIR_FilterKernel> > firFilter; - SmartPtr< KernelFactory<IntToFloatKernel> > intToFloat; - - KernelFactory<ZeroingKernel> zeroing; - - KernelFactory<DelayAndBandPassKernel> delayAndBandPass; - - KernelFactory<CorrelatorKernel> correlator; - }; - - CorrelatorStep(const Parset &parset, - gpu::Stream &i_queue, - gpu::Context &context, - Factories &factories, - boost::shared_ptr<gpu::DeviceMemory> i_devA, - boost::shared_ptr<gpu::DeviceMemory> i_devB, - size_t nrSubbandsPerSubbandProc); - - void writeInput(const SubbandProcInputData &input); - - void process(const SubbandProcInputData &input); - void processCPU(const SubbandProcInputData &input, SubbandProcOutputData &output); - - void readOutput(SubbandProcOutputData &output); - - bool postprocessSubband(SubbandProcOutputData &output); - - // Collection of functions to tranfer the input flags to the output. - // \c propagateFlags can be called parallel to the kernels. - // After the data is copied from the the shared buffer - // \c applyNrValidSamples can be used to weight the visibilities - class Flagger: public Cobalt::Flagger - { - public: - // 1.1 Convert the flags per station to channel flags, change time scale - // if nchannel > 1 - // (Uses convertFlagsToChannelFlags) - - // 2. Calculate the weight based on the number of flags and apply this - // weighting to all output values - static void applyNrValidSamples(Parset const &parset, LOFAR::Cobalt::CorrelatedData &output); - - // 1.2 Calculate the number of flagged samples and set this on the - // output dataproduct This function is aware of the used filter width a - // corrects for this. - static void - calcNrValidSamples(Parset const &parset, - MultiDimArray<SparseSet<unsigned>, 1> const &flagsPerChannel, - SubbandProcOutputData::CorrelatedData &output); - - // 2.1 Apply the supplied weight to the complex values in the channels - // for the given baseline. If nrChannels > 1, visibilities for channel 0 will be set to 0.0. - static void applyWeight(unsigned baseline, unsigned nrChannels, - float weight, LOFAR::Cobalt::CorrelatedData &output); - private: - template<typename T> - static void applyNrValidSamples(Parset const &parset, LOFAR::Cobalt::CorrelatedData &output); - - template<typename T> - static void - calcNrValidSamples(Parset const &parset, - MultiDimArray<SparseSet<unsigned>, 1> const &flagsPerChannel, - SubbandProcOutputData::CorrelatedData &output); - - }; - - private: - const bool correlatorPPF; - - // Preallocated flags for input data, to prefix with FIR history -- used locally - MultiDimArray<SparseSet<unsigned>, 1> flagsWithHistorySamples; - - // Preallocated flags for FFT-ed data -- used locally - MultiDimArray<SparseSet<unsigned>, 1> flagsPerChannel; - - //Data members - boost::shared_ptr<gpu::DeviceMemory> devA; - boost::shared_ptr<gpu::DeviceMemory> devB; - gpu::DeviceMemory devE; - - /* - * Kernels - */ - - // FIR filter - SmartPtr<FIR_FilterKernel> firFilterKernel; - - // FFT - SmartPtr<FFT_Kernel> fftKernel; - - // IntToFloat (in case of no FFT) - SmartPtr<IntToFloatKernel> intToFloatKernel; - - // Zeroing - SmartPtr<ZeroingKernel> zeroingKernel; - - // Delay and Bandpass - std::unique_ptr<DelayAndBandPassKernel> delayAndBandPassKernel; - - // Correlator - std::unique_ptr<CorrelatorKernel> correlatorKernel; - - PerformanceCounter outputCounter; - - // Buffers for long-time integration; one buffer for each subband that - // will be processed by this class instance. Each element of the vector - // contains a counter that tracks the number of additions made to the data - // buffer and the data buffer itself. - std::vector< std::pair< size_t, SmartPtr<LOFAR::Cobalt::CorrelatedData> > > - integratedData; - - bool integrate(SubbandProcOutputData &output); - }; - } -} - -#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/KernelFactories.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/KernelFactories.h deleted file mode 100644 index c58eaaf914f60d33d3d8b718175b779d5581cc70..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/KernelFactories.h +++ /dev/null @@ -1,53 +0,0 @@ -//# KernelFactories.h -//# -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_FACTORIES_H -#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_FACTORIES_H - -#include <CoInterface/Parset.h> -#include <CoInterface/SmartPtr.h> - -#include "CorrelatorStep.h" -#include "BeamFormerPreprocessingStep.h" -#include "BeamFormerCoherentStep.h" -#include "BeamFormerIncoherentStep.h" - -namespace LOFAR -{ - namespace Cobalt - { - struct KernelFactories - { - KernelFactories(const Parset &ps, - size_t nrSubbandsPerSubbandProc = 1); - - SmartPtr<CorrelatorStep::Factories> correlator; - - SmartPtr<BeamFormerPreprocessingStep::Factories> preprocessing; - - SmartPtr<BeamFormerCoherentStep::Factories> coherentStokes; - SmartPtr<BeamFormerIncoherentStep::Factories> incoherentStokes; - }; - - } -} - -#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/ProcessStep.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/ProcessStep.h deleted file mode 100644 index 63ed74a484c0e26e788636737c52be38afe17630..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/ProcessStep.h +++ /dev/null @@ -1,56 +0,0 @@ -//# ProcessStep.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_PROCESS_STEP_H -#define LOFAR_GPUPROC_CUDA_PROCESS_STEP_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/gpu_wrapper.h> - -#include "SubbandProcInputData.h" - -namespace LOFAR -{ - namespace Cobalt - { - class ProcessStep - { - public: - virtual void process(const SubbandProcInputData &input) = 0; - - virtual ~ProcessStep() - {} - - protected: - ProcessStep(const Parset &parset, - gpu::Stream &queue) - : - ps(parset), - queue(queue) - {}; - - const Parset ps; - gpu::Stream queue; - }; - } -} - -#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProc.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProc.h deleted file mode 100644 index 608606c2c1d15661473441b58641fabfd50fba0f..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProc.h +++ /dev/null @@ -1,159 +0,0 @@ -//# SubbandProc.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_SUBBAND_PROC_H -#define LOFAR_GPUPROC_CUDA_SUBBAND_PROC_H - -#include <string> -#include <map> -#include <complex> -#include <memory> - -#include <boost/shared_ptr.hpp> -#include <Common/LofarLogger.h> -#include <CoInterface/BudgetTimer.h> -#include <CoInterface/CorrelatedData.h> -#include <CoInterface/Parset.h> -#include <CoInterface/Pool.h> -#include <CoInterface/SmartPtr.h> -#include <CoInterface/BlockID.h> -#include <CoInterface/Config.h> -#include <CoInterface/SubbandMetaData.h> -#include <GPUProc/PerformanceCounter.h> -#include <GPUProc/gpu_wrapper.h> -#include <GPUProc/MultiDimArrayHostBuffer.h> - -#include "SubbandProcInputData.h" -#include "SubbandProcOutputData.h" -#include "CorrelatorStep.h" -#include "BeamFormerPreprocessingStep.h" -#include "BeamFormerCoherentStep.h" -#include "BeamFormerIncoherentStep.h" - -// \file -// TODO: Update documentation - -namespace LOFAR -{ - namespace Cobalt - { - //# Forward declarations - struct KernelFactories; - - /* - * The SubbandProc does the following transformation: - * SubbandProcInputData -> SubbandProcOutputData - * - * The SubbandProcInputData represents one block of one subband - * of input data, and the SubbandProcOutputData (for example) the complex - * visibilities of such a block. - * - * For both input and output, a fixed set of objects is created, - * tied to the GPU specific for the SubbandProc, for increased - * performance. The objects are recycled by using Pool objects. - * - * The data flows as follows: - * - * // Fetch the next input object to fill - * SmartPtr<SubbandProcInputData> input = queue.inputPool.free.remove(); - * - * // Provide input - * receiveInput(input); - * - * // Annotate input - * input->blockID.block = block; - * input->blockID.globalSubbandIdx = subband; - * input->blockID.localSubbandIdx = subbandIdx; - * - * // Fetch the next output object to fill - * SmartPtr<SubbandProcOutputData> output = queue.outputPool.free.remove(); - * - * // Process block - * queue.processSubband(input, output); - * - * // Give back input and output objects to queue - * queue.inputPool.free.append(input); - * queue.outputPool.free.append(output); - * - * The queue.inputPool.filled and queue.outputPool.filled can be used to - * temporarily store filled input and output objects. Such is needed to - * obtain parallellism (i.e. read/process/write in separate threads). - */ - class SubbandProc { - public: - SubbandProc(const Parset &ps, gpu::Context &context, - KernelFactories &factories, - size_t nrSubbandsPerSubbandProc = 1); - - // A pool of input data, to allow items to be filled and - // computed on in parallel. - Pool<SubbandProcInputData> inputPool; - - // A pool of input data, that has been pre processed. - Pool<SubbandProcInputData> processPool; - - // A pool of output data, to allow items to be filled - // and written in parallel. - Pool<SubbandProcOutputData> outputPool; - - // Correlate the data found in the input data buffer - void processSubband(SubbandProcInputData &input, SubbandProcOutputData &output); - - // Do post processing on the CPU. - void postprocessSubband(SubbandProcOutputData &output); - - protected: - const Parset &ps; - const size_t nrSubbandsPerSubbandProc; - - gpu::Stream queue; - - // The previously processed SAP/block, or -1 if nothing has been - // processed yet. Used in order to determine if new delays have - // to be uploaded. - ssize_t prevBlock; - signed int prevSAP; - - // @{ - // Device memory buffers. These buffers are used interleaved. For details, - // please refer to the document bf-pipeline.txt in the directory - // GPUProc/doc. - boost::shared_ptr<gpu::DeviceMemory> devA; - boost::shared_ptr<gpu::DeviceMemory> devB; - // @} - - PerformanceCounter totalCounter; - PerformanceCounter inputCounter; - BudgetTimer processCPUTimer; - - std::unique_ptr<CorrelatorStep> correlatorStep; - std::unique_ptr<BeamFormerPreprocessingStep> preprocessingStep; - std::unique_ptr<BeamFormerCoherentStep> coherentStep; - std::unique_ptr<BeamFormerIncoherentStep> incoherentStep; - - // Returns the number of output elements to create to get a smooth - // running pipeline. - size_t nrOutputElements() const; - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcInputData.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcInputData.h deleted file mode 100644 index a002bf5b75111b862dfdba844e2e234454fb0270..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcInputData.h +++ /dev/null @@ -1,99 +0,0 @@ -//# SubbandProcInputData.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_SUBBAND_PROC_INPUT_DATA_H -#define LOFAR_GPUPROC_CUDA_SUBBAND_PROC_INPUT_DATA_H - -#include <vector> - -#include <CoInterface/BlockID.h> -#include <CoInterface/Parset.h> -#include <CoInterface/SubbandMetaData.h> -#include <GPUProc/MultiDimArrayHostBuffer.h> -#include <GPUProc/gpu_wrapper.h> - -// \file -// TODO: Update documentation - -namespace LOFAR -{ - namespace Cobalt - { - // Collect all inputData for the correlatorSubbandProc item: - // \arg inputsamples - // \arg delays - // \arg phaseOffSets - // \arg flags - // It also contains a read function parsing all this data from an input stream. - class SubbandProcInputData - { - public: - // Which block this InputData represents - struct BlockID blockID; - - // Delays are computed and applied in double precision, - // otherwise the to be computed phase shifts become too inprecise. - - //!< Whole sample delays at the start of the workitem - MultiDimArrayHostBuffer<double, 3> delaysAtBegin; - - //!< Whole sample delays at the end of the workitem - MultiDimArrayHostBuffer<double, 3> delaysAfterEnd; - - //!< Remainder of delays - MultiDimArrayHostBuffer<double, 2> phase0s; - - //!< Delays for TABs (aka pencil beams) after station beam correction - MultiDimArrayHostBuffer<double, 3> tabDelays; - - // inputdata with flagged data set to zero - MultiDimArrayHostBuffer<char, 4> inputSamples; - - // The input flags - MultiDimArray<SparseSet<unsigned>, 1> inputFlags; - - // CPU-side holder for the Meta Data - std::vector<SubbandMetaData> metaData; // [station] - - // Create the inputData object we need shared host/device memory on the - // supplied devicequeue - SubbandProcInputData(size_t n_beams, size_t n_stations, - size_t n_polarizations, size_t n_coherent_tabs, - size_t n_samples, size_t bytes_per_complex_sample, - gpu::Context &context, - unsigned int hostBufferFlags = 0); - - // Short-hand constructor pulling all relevant values from a Parset - SubbandProcInputData(const Parset &ps, - gpu::Context &context, - unsigned int hostBufferFlags = 0); - - // process the given meta data - void applyMetaData(const Parset &ps, unsigned station, - unsigned SAP, const SubbandMetaData &metaData); - - // set all flagged inputSamples to zero. - void flagInputSamples(unsigned station, const SubbandMetaData& metaData); - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcOutputData.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcOutputData.h deleted file mode 100644 index 5f29ad3ea2cc5a7a0329c3c1be6c5c0bf0847702..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/SubbandProcOutputData.h +++ /dev/null @@ -1,68 +0,0 @@ -//# SubbandProcOutputData.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_SUBBAND_PROC_OUTPUT_DATA_H -#define LOFAR_GPUPROC_CUDA_SUBBAND_PROC_OUTPUT_DATA_H - -#include <CoInterface/BlockID.h> -#include <CoInterface/Parset.h> -#include <CoInterface/CorrelatedData.h> -#include <CoInterface/SmartPtr.h> -#include <GPUProc/gpu_wrapper.h> -#include <GPUProc/MultiDimArrayHostBuffer.h> - -// \file -// TODO: Update documentation - -namespace LOFAR -{ - namespace Cobalt - { - // Our output data type - class SubbandProcOutputData - { - public: - struct BlockID blockID; - - MultiDimArrayHostBuffer<float, 4> coherentData; - MultiDimArrayHostBuffer<float, 4> incoherentData; - - struct CorrelatedData - { - CorrelatedData(unsigned nrIntegrations, - unsigned nrStations, - unsigned nrChannels, - unsigned maxNrValidSamples, - gpu::Context &context); - - MultiDimArrayHostBuffer<fcomplex, 5> data; - std::vector< SmartPtr<LOFAR::Cobalt::CorrelatedData> > subblocks; - }; - - CorrelatedData correlatedData; - bool emit_correlatedData; - - SubbandProcOutputData(const Parset &ps, gpu::Context &context); - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/UHEP_SubbandProc.h b/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/UHEP_SubbandProc.h deleted file mode 100644 index 03169c57f7175a537efe47ffa7dba49fa05c0507..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/SubbandProcs/UHEP_SubbandProc.h +++ /dev/null @@ -1,69 +0,0 @@ -//# UHEP_SubbandProc.h -//# Copyright (C) 2012-2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite is free software: you can redistribute it and/or -//# modify it under the terms of the GNU General Public License as published -//# by the Free Software Foundation, either version 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License along -//# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_GPUPROC_CUDA_UHEP_SUBBAND_PROC_H -#define LOFAR_GPUPROC_CUDA_UHEP_SUBBAND_PROC_H - -#include <complex> - -#include <Common/LofarLogger.h> -#include <CoInterface/Parset.h> - -#include <GPUProc/global_defines.h> -#include <GPUProc/MultiDimArrayHostBuffer.h> -#include <GPUProc/Pipelines/UHEP_Pipeline.h> -#include <GPUProc/Kernels/UHEP_TriggerKernel.h> -#include "SubbandProc.h" - -namespace LOFAR -{ - namespace Cobalt - { - class UHEP_SubbandProc : public SubbandProc - { - public: - UHEP_SubbandProc(UHEP_Pipeline &, unsigned queueNumber); - - void doWork(const float *delaysAtBegin, const float *delaysAfterEnd, const float *phaseOffsets); - - UHEP_Pipeline &pipeline; - gpu::Event inputSamplesEvent, beamFormerWeightsEvent; - - gpu::DeviceMemory devBuffers[2]; - gpu::DeviceMemory devInputSamples; - MultiArrayHostBuffer<char, 5> hostInputSamples; - - gpu::DeviceMemory devBeamFormerWeights; - MultiArrayHostBuffer<std::complex<float>, 3> hostBeamFormerWeights; - - gpu::DeviceMemory devComplexVoltages; - gpu::DeviceMemory devReverseSubbandMapping; - gpu::DeviceMemory devFFTedData; - gpu::DeviceMemory devInvFIRfilteredData; - gpu::DeviceMemory devInvFIRfilterWeights; - - gpu::DeviceMemory devTriggerInfo; - MultiArraySharedBuffer<TriggerInfo, 1> hostTriggerInfo; - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorStep.cc b/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorStep.cc index 9f435aab1e240a3bf4070a9f9d9621571f3ae2a0..6f78be3eb99f49c884699401abef9ccfe6f45df3 100644 --- a/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorStep.cc +++ b/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorStep.cc @@ -21,7 +21,7 @@ #include <lofar_config.h> #include <CoInterface/BudgetTimer.h> -#include <GPUProc/cuda/SubbandProcs/CorrelatorStep.h> +#include <GPUProc/SubbandProcs/CorrelatorStep.h> #include <GPUProc/cuda/gpu_wrapper.h> #include <UnitTest++.h> diff --git a/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorSubbandProc.cc b/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorSubbandProc.cc index 6b13abf34283a269158a4134ca684a166ef6f258..faba46123b8a11e881710bac73a9c332a244471b 100644 --- a/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorSubbandProc.cc +++ b/RTCP/Cobalt/GPUProc/test/SubbandProcs/tCorrelatorSubbandProc.cc @@ -20,7 +20,7 @@ #include <lofar_config.h> -#include <GPUProc/cuda/SubbandProcs/CorrelatorStep.h> +#include <GPUProc/SubbandProcs/CorrelatorStep.h> #include <UnitTest++.h> #include <iostream>