diff --git a/.gitattributes b/.gitattributes index 0c75a5853e60d5127f940d22493781a7c7ae8b91..bde4f34a000643e003405e631b40707b37df25b7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4195,6 +4195,7 @@ RTCP/Cobalt/GPUProc/doc/scripts.txt -text RTCP/Cobalt/GPUProc/etc/parset-additions.d/default/RSPConnections_Cobalt.dat -text RTCP/Cobalt/GPUProc/etc/parset-additions.d/default/generateStationStreams.sh eol=lf RTCP/Cobalt/GPUProc/links_gcrypt.sh eol=lf +RTCP/Cobalt/GPUProc/src/Kernels/FFT_Plan.h -text RTCP/Cobalt/GPUProc/src/Station/station_stream.log_prop -text RTCP/Cobalt/GPUProc/src/backward/CL/cl.hpp -text RTCP/Cobalt/GPUProc/src/scripts/CobaltControl.sh eol=lf diff --git a/RTCP/Cobalt/GPUProc/src/CMakeLists.txt b/RTCP/Cobalt/GPUProc/src/CMakeLists.txt index 9c7b2ae11002625e5874cf4591d63ab68495b37c..03094df4b14299a6478b67672b10383c382b5557 100644 --- a/RTCP/Cobalt/GPUProc/src/CMakeLists.txt +++ b/RTCP/Cobalt/GPUProc/src/CMakeLists.txt @@ -30,30 +30,30 @@ list(APPEND _gpuproc_sources cuda/gpu_utils.cc cuda/KernelFactory.cc cuda/PerformanceCounter.cc - cuda/Kernels/Kernel.cc - cuda/Kernels/BeamFormerKernel.cc - cuda/Kernels/BeamFormerTransposeKernel.cc - cuda/Kernels/CoherentStokesTransposeKernel.cc - cuda/Kernels/CoherentStokesKernel.cc - cuda/Kernels/CorrelatorKernel.cc - #cuda/Kernels/DedispersionBackwardFFTkernel.cc - #cuda/Kernels/DedispersionChirpKernel.cc - #cuda/Kernels/DedispersionForwardFFTkernel.cc - cuda/Kernels/DelayAndBandPassKernel.cc - cuda/Kernels/BandPassCorrectionKernel.cc - cuda/Kernels/FFT_Kernel.cc - cuda/Kernels/FFT_Plan.cc - cuda/Kernels/FIR_FilterKernel.cc - cuda/Kernels/IncoherentStokesKernel.cc - cuda/Kernels/IncoherentStokesTransposeKernel.cc - cuda/Kernels/IntToFloatKernel.cc - cuda/Kernels/FFTShiftKernel.cc - cuda/Kernels/ZeroingKernel.cc - #cuda/Kernels/UHEP_BeamFormerKernel.cc - #cuda/Kernels/UHEP_InvFFT_Kernel.cc - #cuda/Kernels/UHEP_InvFIR_Kernel.cc - #cuda/Kernels/UHEP_TransposeKernel.cc - #cuda/Kernels/UHEP_TriggerKernel.cc + Kernels/Kernel.cc + Kernels/BeamFormerKernel.cc + Kernels/BeamFormerTransposeKernel.cc + Kernels/CoherentStokesTransposeKernel.cc + Kernels/CoherentStokesKernel.cc + Kernels/CorrelatorKernel.cc + #Kernels/DedispersionBackwardFFTkernel.cc + #Kernels/DedispersionChirpKernel.cc + #Kernels/DedispersionForwardFFTkernel.cc + Kernels/DelayAndBandPassKernel.cc + Kernels/BandPassCorrectionKernel.cc + Kernels/FFT_Kernel.cc + Kernels/FFT_Plan.cc + Kernels/FIR_FilterKernel.cc + Kernels/IncoherentStokesKernel.cc + Kernels/IncoherentStokesTransposeKernel.cc + Kernels/IntToFloatKernel.cc + Kernels/FFTShiftKernel.cc + Kernels/ZeroingKernel.cc + #Kernels/UHEP_BeamFormerKernel.cc + #Kernels/UHEP_InvFFT_Kernel.cc + #Kernels/UHEP_InvFIR_Kernel.cc + #Kernels/UHEP_TransposeKernel.cc + #Kernels/UHEP_TriggerKernel.cc cuda/Pipelines/Pipeline.cc # cuda/Pipelines/UHEP_Pipeline.cc cuda/SubbandProcs/SubbandProc.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BandPassCorrectionKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/BandPassCorrectionKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/BandPassCorrectionKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/BandPassCorrectionKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/BandPassCorrectionKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/BandPassCorrectionKernel.h index a21a4b88da24ec4ae36a816504e66cb09d02b762..607a3f1cd90d9a73e70ecb380f37f4d191de485e 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/BandPassCorrectionKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/BandPassCorrectionKernel.h @@ -1,6 +1,5 @@ //# BandPassCorrectionKernel.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,65 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_BAND_PASS_CORRECTION_KERNEL_H +#define LOFAR_GPUPROC_CUDA_BAND_PASS_CORRECTION_KERNEL_H -#ifndef LOFAR_GPUPROC_BAND_PASS_CORRECTION_KERNEL_H -#define LOFAR_GPUPROC_BAND_PASS_CORRECTION_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/BandPassCorrectionKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/BandPassCorrectionKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + + class BandPassCorrectionKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA, + BAND_PASS_CORRECTION_WEIGHTS + }; + + // Parameters that must be passed to the constructor of the + // BandPassCorrectionKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + unsigned nrStations; + + unsigned nrDelayCompensationChannels; + unsigned nrHighResolutionChannels; + unsigned nrSamplesPerChannel; + + bool correctBandPass; + + size_t bufferSize(BandPassCorrectionKernel::BufferType bufferType) const; + }; + + BandPassCorrectionKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + private: + // The bandpass weights to apply on each channel + gpu::DeviceMemory bandPassCorrectionWeights; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<BandPassCorrectionKernel>::compileDefinitions() const; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerKernel.h index fd5e55fc4c97dfefa53458cd8353f9757d502613..6ba5995049b8697b87c8fe4835e3c29f57cfb882 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerKernel.h @@ -1,6 +1,5 @@ //# BeamFormerKernel.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,81 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_KERNEL_H +#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_KERNEL_H -#ifndef LOFAR_GPUPROC_BEAM_FORMER_KERNEL_H -#define LOFAR_GPUPROC_BEAM_FORMER_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/BeamFormerKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/BeamFormerKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +#include <string> +#include <vector> + +namespace LOFAR +{ + namespace Cobalt + { + class BeamFormerKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA, + DELAY_INDICES, + BEAM_FORMER_DELAYS + }; + + // Parameters that must be passed to the constructor of the + // BeamFormerKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + + // The beam-former delays are indexed by their station number + // in the observation, so we need to map them to beam-former + // station numbers. + std::vector<unsigned> delayIndices; + + // Width of th observation's delay array, in stations + unsigned nrDelays; + + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + unsigned nrSAPs; + unsigned nrTABs; + double subbandBandwidth; + bool doFlysEye; + + size_t bufferSize(BufferType bufferType) const; + + size_t nrStations() const { return delayIndices.size(); } + }; + + BeamFormerKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + void enqueue(const BlockID &blockId, + double subbandFrequency, unsigned SAP); + + gpu::DeviceMemory delayIndices; + gpu::DeviceMemory beamFormerDelays; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<BeamFormerKernel>::compileDefinitions() const; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerTransposeKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerTransposeKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerTransposeKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerTransposeKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerTransposeKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerTransposeKernel.h index 1cce4ceec67d3b9ea7e408f2ef577d8fc83d6d02..dc65338ba69a0b3209b56a95d0068bfd6b79bdf7 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerTransposeKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/BeamFormerTransposeKernel.h @@ -1,6 +1,5 @@ //# BeamFormerTransposeKernel.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,58 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_BEAM_FORMER_TRANSPOSE_KERNEL_H +#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_TRANSPOSE_KERNEL_H -#ifndef LOFAR_GPUPROC_BEAM_FORMER_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_BEAM_FORMER_TRANSPOSE_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/BeamFormerTransposeKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/BeamFormerTransposeKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class BeamFormerTransposeKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Parameters that must be passed to the constructor of the + // BeamFormerKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + unsigned nrTABs; + + size_t bufferSize(BufferType bufferType) const; + }; + + BeamFormerTransposeKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<BeamFormerTransposeKernel>::compileDefinitions() const; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesKernel.h index 4edd2e84872527805de188d2f9ded5a2b5ed2688..6b12782d2ed8172f1953f6be7420a3093bf5b38c 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesKernel.h @@ -1,6 +1,5 @@ //# CoherentStokesKernel.h -//# -//# Copyright (C) 2013 ASTRON (Netherlands Institute for Radio Astronomy) +//# Copyright (C) 2012-2014 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,75 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_COHERENT_STOKES_KERNEL_H +#define LOFAR_GPUPROC_CUDA_COHERENT_STOKES_KERNEL_H -#ifndef LOFAR_GPUPROC_COHERENT_STOKES_KERNEL_H -#define LOFAR_GPUPROC_COHERENT_STOKES_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/CoherentStokesKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/CoherentStokesKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + + class CoherentStokesKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Parameters that must be passed to the constructor of the + // CoherentStokesKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + unsigned nrTABs; + unsigned nrStokes; + bool outputComplexVoltages; + unsigned timeIntegrationFactor; + + size_t bufferSize(BufferType bufferType) const; + }; + + CoherentStokesKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + struct CoherentStokesExecConfig : gpu::ExecConfig + { + unsigned nrTimeParallelThreads; + friend std::ostream& operator<<(std::ostream& os, + const CoherentStokesKernel::CoherentStokesExecConfig& execConfig); + }; + + private: + // The timeParallelFactor is not a Parameter passed in, but is a kernel + // arg, so it must be a member var to outlive kernel launches. + unsigned itsTimeParallelFactor; + + + unsigned smallestFactorOf(unsigned n) const; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<CoherentStokesKernel>::compileDefinitions() const; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesTransposeKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesTransposeKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesTransposeKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesTransposeKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesTransposeKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesTransposeKernel.h index 482a09df634504ecb7388e4612df07412c5c24f9..78c6905bfdd5919e9daf57392a09cd76f0f5dc9c 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesTransposeKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/CoherentStokesTransposeKernel.h @@ -1,6 +1,5 @@ -//# BeamFormerTransposeKernel.h -//# -//# Copyright (C) 2013 ASTRON (Netherlands Institute for Radio Astronomy) +//# CoherentStokesTransposeKernel.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. @@ -19,23 +18,58 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_COHERENT_STOKES_TRANSPOSE_KERNEL_H +#define LOFAR_GPUPROC_CUDA_COHERENT_STOKES_TRANSPOSE_KERNEL_H -#ifndef LOFAR_GPUPROC__COHERENT_STOKES_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC__COHERENT_STOKES_TRANSPOSE_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/CoherentStokesTransposeKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/CoherentStokesTransposeKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class CoherentStokesTransposeKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Parameters that must be passed to the constructor of the + // BeamFormerKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + unsigned nrTABs; + + size_t bufferSize(BufferType bufferType) const; + }; + + CoherentStokesTransposeKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<CoherentStokesTransposeKernel>::compileDefinitions() const; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CorrelatorKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/CorrelatorKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/CorrelatorKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/CorrelatorKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/CorrelatorKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/CorrelatorKernel.h index 938ada9eb3498c266a40e55016f4fb4540925c25..c4343b9d9b9556ac5e20ba657f5b55e3dcc5b61c 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/CorrelatorKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/CorrelatorKernel.h @@ -1,6 +1,5 @@ //# CorrelatorKernel.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,56 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_CORRELATOR_KERNEL_H +#define LOFAR_GPUPROC_CUDA_CORRELATOR_KERNEL_H -#ifndef LOFAR_GPUPROC_CORRELATOR_KERNEL_H -#define LOFAR_GPUPROC_CORRELATOR_KERNEL_H +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class CorrelatorKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/CorrelatorKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/CorrelatorKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + unsigned nrStations; + unsigned nrStationsPerThread; + unsigned nrBaselines() const; + + unsigned nrChannels; + unsigned nrSamplesPerIntegration; + unsigned nrIntegrationsPerBlock; + size_t nrSamplesPerBlock() const; + + size_t bufferSize(BufferType bufferType) const; + }; + + CorrelatorKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<CorrelatorKernel>::compileDefinitions() const; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionBackwardFFTkernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionBackwardFFTkernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionBackwardFFTkernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/DedispersionBackwardFFTkernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionBackwardFFTkernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionBackwardFFTkernel.h index 5d52935a353e69a5384f4d45ecce50d70404ada2..111a5d9ba59902de1784e99555c06fad082687dc 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionBackwardFFTkernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionBackwardFFTkernel.h @@ -1,6 +1,5 @@ //# DedispersionBackwardFFTkernel.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,26 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_DEDISPERSION_BACKWARD_FFTKERNEL_H +#define LOFAR_GPUPROC_CUDA_DEDISPERSION_BACKWARD_FFTKERNEL_H -#ifndef LOFAR_GPUPROC_DEDISPERSION_BACKWARD_FFTKERNEL_H -#define LOFAR_GPUPROC_DEDISPERSION_BACKWARD_FFTKERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "FFT_Kernel.h" -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/DedispersionBackwardFFTkernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/DedispersionBackwardFFTkernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class DedispersionBackwardFFTkernel : public FFT_Kernel + { + public: + DedispersionBackwardFFTkernel(const Parset &ps, gpu::Context &context, gpu::DeviceMemory &buffer); + + }; + } + +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionChirpKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionChirpKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionChirpKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/DedispersionChirpKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionChirpKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionChirpKernel.h index 6789bfef8208e381e88aa338a53ee1552a31fe75..90faf0c4b647e090c823122787faa832c97a3bf6 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionChirpKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionChirpKernel.h @@ -1,6 +1,5 @@ //# DedispersionChirpKernel.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,34 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_DEDISPERSION_CHIRP_KERNEL_H +#define LOFAR_GPUPROC_CUDA_DEDISPERSION_CHIRP_KERNEL_H -#ifndef LOFAR_GPUPROC_DEDISPERSION_CHIRP_KERNEL_H -#define LOFAR_GPUPROC_DEDISPERSION_CHIRP_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/gpu_wrapper.h> +//#include <GPUProc/PerformanceCounter.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/DedispersionChirpKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/DedispersionChirpKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + + class DedispersionChirpKernel : public CompiledKernel + { + public: + DedispersionChirpKernel(const Parset &ps, + gpu::Context &context, + gpu::DeviceMemory &buffer, + gpu::DeviceMemory &DMs); + + void enqueue(gpu::Stream &queue, double subbandFrequency); + + }; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionForwardFFTkernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionForwardFFTkernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionForwardFFTkernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/DedispersionForwardFFTkernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionForwardFFTkernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionForwardFFTkernel.h index be989eeeefe4d934b55dbccd391743ed68c141b8..b50f8a76bc6634b4f2f055a4ea74a5cf6c637368 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionForwardFFTkernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/DedispersionForwardFFTkernel.h @@ -1,6 +1,5 @@ //# DedispersionForwardFFTkernel.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,25 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_DEDISPERSION_FORWARD_FFTKERNEL_H +#define LOFAR_GPUPROC_CUDA_DEDISPERSION_FORWARD_FFTKERNEL_H -#ifndef LOFAR_GPUPROC_DEDISPERSION_FORWARD_FFTKERNEL_H -#define LOFAR_GPUPROC_DEDISPERSION_FORWARD_FFTKERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "FFT_Kernel.h" -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/DedispersionForwardFFTkernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/DedispersionForwardFFTkernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class DedispersionForwardFFTkernel : public FFT_Kernel + { + public: + DedispersionForwardFFTkernel(const Parset &ps, gpu::Context &context, gpu::DeviceMemory &buffer); + + }; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DelayAndBandPassKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/DelayAndBandPassKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/DelayAndBandPassKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/DelayAndBandPassKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/DelayAndBandPassKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/DelayAndBandPassKernel.h index 68317a239c2e28f73ad9a89f8abe7de536462f44..a2f051c6f0aef458ac27e3d96d3b58e9d50fb314 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/DelayAndBandPassKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/DelayAndBandPassKernel.h @@ -1,6 +1,5 @@ //# DelayAndBandPassKernel.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,91 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_DELAY_AND_BAND_PASS_KERNEL_H +#define LOFAR_GPUPROC_CUDA_DELAY_AND_BAND_PASS_KERNEL_H -#ifndef LOFAR_GPUPROC_DELAY_AND_BAND_PASS_KERNEL_H -#define LOFAR_GPUPROC_DELAY_AND_BAND_PASS_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> +//#include <GPUProc/PerformanceCounter.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/DelayAndBandPassKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/DelayAndBandPassKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +#include <vector> + +namespace LOFAR +{ + namespace Cobalt + { + + class DelayAndBandPassKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA, + DELAY_INDICES, + DELAYS, + PHASE_ZEROS, + BAND_PASS_CORRECTION_WEIGHTS + }; + + // Parameters that must be passed to the constructor of the + // DelayAndBandPassKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps, bool correlator); + unsigned nrStations; + std::vector<unsigned> delayIndices; + unsigned nrDelays; + unsigned nrBitsPerSample; + + unsigned nrChannels; + unsigned nrSamplesPerChannel; + double subbandBandwidth; + + unsigned nrSAPs; + + bool delayCompensation; + bool correctBandPass; + bool transpose; + + unsigned nrSamplesPerSubband() const; + unsigned nrBytesPerComplexSample() const; + + size_t bufferSize(BufferType bufferType) const; + }; + + DelayAndBandPassKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + + void enqueue(const BlockID &blockId, + double subbandFrequency, unsigned SAP); + + // Input parameters for the delay compensation + gpu::DeviceMemory delayIndices; + gpu::DeviceMemory delaysAtBegin; + gpu::DeviceMemory delaysAfterEnd; + gpu::DeviceMemory phase0s; + + private: + // The weights to correct the bandpass with, per channel + gpu::DeviceMemory bandPassCorrectionWeights; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<DelayAndBandPassKernel>::compileDefinitions() const; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFTShiftKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/FFTShiftKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFTShiftKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/FFTShiftKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/FFTShiftKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/FFTShiftKernel.h index 6591848776f8443c6b073d0a3fee155f86b00064..edfa3c6d867cd9fbb6b8e839afaa33c49e312288 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/FFTShiftKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/FFTShiftKernel.h @@ -1,6 +1,5 @@ //# FFTShiftKernel.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,63 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_FFT_SHIFT_KERNEL_H +#define LOFAR_GPUPROC_CUDA_FFT_SHIFT_KERNEL_H -#ifndef LOFAR_GPUPROC_FFT_SHIFT_KERNEL_H -#define LOFAR_GPUPROC_FFT_SHIFT_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/FFTShiftKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/FFTShiftKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class FFTShiftKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Parameters that must be passed to the constructor of the + // IntToFloatKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps, unsigned nrSTABs, unsigned nrChannels, const std::string &name = "FFT-shift"); + unsigned nrSTABs; + + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + size_t bufferSize(BufferType bufferType) const; + }; + + // Construct a FFTShift kernel. + // \pre The number of samples per channel must be even. + // \pre The product of the number of stations, the number of + // polarizations, the number of channels per subband, and the number of + // samples per channel must be divisible by the maximum number of threads + // per block (typically 1024). + FFTShiftKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<FFTShiftKernel>::compileDefinitions() const; + } + +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Kernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Kernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Kernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/FFT_Kernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Kernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Kernel.h index 11065ca17bea6c1834ff119a5c0b1b5e6d3cef64..d6740958caed4d8a09e58e83549ffb6c989bf797 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Kernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Kernel.h @@ -1,6 +1,5 @@ //# FFT_Kernel.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,65 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_FFT_KERNEL_H +#define LOFAR_GPUPROC_CUDA_FFT_KERNEL_H -#ifndef LOFAR_GPUPROC_FFT_KERNEL_H -#define LOFAR_GPUPROC_FFT_KERNEL_H +#include <GPUProc/gpu_wrapper.h> +#include "FFT_Plan.h" +#include <GPUProc/PerformanceCounter.h> +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class FFT_Kernel: public Kernel + { + public: + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/FFT_Kernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/FFT_Kernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif + // Parameters that must be passed to the constructor of the + // BandPassCorrectionKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(unsigned fftSize, unsigned nrSamples, bool forward, const std::string &name = "FFT"); -#endif + unsigned fftSize; + unsigned nrSamples; + bool forward; + + size_t bufferSize(FFT_Kernel::BufferType bufferType) const; + }; + + FFT_Kernel(const gpu::Stream &stream, + const Buffers& buffers, + const Parameters& params); + protected: + void launch() const; + + private: + const unsigned nrFFTs, nrMajorFFTs, nrMinorFFTs; + const int direction; + FFT_Plan planMajor, planMinor; + + void executePlan(const cufftHandle &plan, cufftComplex *in_data, cufftComplex *out_data) const; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + // The default KernelFactory tries to compile a source, + // but FFT_Kernel has nothing to compile, so we implement short cuts. + template<> std::string KernelFactory<FFT_Kernel>::_createPTX() const; + template<> FFT_Kernel* KernelFactory<FFT_Kernel>::create( + const gpu::Stream& stream, + gpu::DeviceMemory &inputBuffer, + gpu::DeviceMemory &outputBuffer) const; + } +} +#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Plan.cc b/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Plan.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Plan.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/FFT_Plan.cc diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Plan.h b/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Plan.h similarity index 96% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Plan.h rename to RTCP/Cobalt/GPUProc/src/Kernels/FFT_Plan.h index ab5f0618aecaf0013102e9fdbb35c4952fb70e79..55da855e5ce3b3a958076b94765c61f6b0332a4a 100644 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Plan.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/FFT_Plan.h @@ -16,7 +16,7 @@ //# 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$ +//# $Id: FFT_Plan.h 29848 2014-07-31 09:32:20Z mol $ #ifndef LOFAR_GPUPROC_CUDA_FFT_PLAN_H #define LOFAR_GPUPROC_CUDA_FFT_PLAN_H diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FIR_FilterKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/FIR_FilterKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/FIR_FilterKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/FIR_FilterKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/FIR_FilterKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/FIR_FilterKernel.h index 0dc094cdd8fddfbac21d0ab7aa4db9b2b4d84b25..8d7d8df7825fc2651038a6938f1d888568bbac4f 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/FIR_FilterKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/FIR_FilterKernel.h @@ -1,6 +1,5 @@ //# FIR_FilterKernel.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,113 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_FIR_FILTER_KERNEL_H +#define LOFAR_GPUPROC_CUDA_FIR_FILTER_KERNEL_H -#ifndef LOFAR_GPUPROC_FIR_FILTER_KERNEL_H -#define LOFAR_GPUPROC_FIR_FILTER_KERNEL_H +#include <string> +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/FilterBank.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/FIR_FilterKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/FIR_FilterKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class FIR_FilterKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA, + FILTER_WEIGHTS, + HISTORY_DATA + }; + + // Parameters that must be passed to the constructor of the + // FIR_FilterKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps, unsigned nrSTABs, bool inputIsStationData, unsigned nrSubbands, unsigned nrChannels, float scaleFactor, const std::string &name = "FIR"); + + // The number of stations or TABs to filter. The FIR filter will + // deal with either in the same way. + unsigned nrSTABs; + + unsigned nrBitsPerSample; + unsigned nrBytesPerComplexSample() const; + + unsigned nrChannels; + unsigned nrSamplesPerChannel; + unsigned nrSamplesPerSubband() const; + + + // The number of subbands \e this kernel instance will process, + // typically equal to \c nrSubbandsPerSubbandProc. + unsigned nrSubbands; + + // The number of PPF filter taps. + static const unsigned nrTaps = 16; + + // The number of history samples used for each block + unsigned nrHistorySamples() const; + + // Additional scale factor (e.g. for FFT normalization). + // Derived differently from nrChannelsPerSubband for correlation + // and beamforming, so must be passed into this class. + float scaleFactor; + + // If true, we'll read integers in the order as they're coming from the + // stations: intXX[stab][sample][pol] + // + // If false, we'll read floats in the order produced by the beam-former + // pipeline: float[stab][pol][sample] + bool inputIsStationData; + + size_t bufferSize(FIR_FilterKernel::BufferType bufferType) const; + }; + + FIR_FilterKernel(const gpu::Stream& stream, + const gpu::Module& module, + const Buffers& buffers, + const Parameters& param); + + void enqueue(const BlockID &blockId, + unsigned subbandIdx); + + // Put the historyFlags[subbandIdx] in front of the given inputFlags, + // and update historyFlags[subbandIdx] with the flags of the last samples + // in inputFlags. + void prefixHistoryFlags(MultiDimArray<SparseSet<unsigned>, 1> &inputFlags, unsigned subbandIdx); + + private: + // The Kernel parameters as given to the constructor + const Parameters params; + + // The FIR filter weights + gpu::DeviceMemory filterWeights; + + // The history samples + gpu::DeviceMemory historySamples; + + // The flags of the history samples. + // + // Dimensions: [nrSubbands][nrStations] + MultiDimArray<SparseSet<unsigned>, 2> historyFlags; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<FIR_FilterKernel>::compileDefinitions() const; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesKernel.h index a272f6857c1e1e4aba9212ce77515d882f81acc7..a50cf7ed173677ff65257cd5f1bffd432f5788ea 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesKernel.h @@ -1,6 +1,5 @@ //# IncoherentStokesKernel.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,62 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_INCOHERENT_STOKES_KERNEL_H +#define LOFAR_GPUPROC_CUDA_INCOHERENT_STOKES_KERNEL_H -#ifndef LOFAR_GPUPROC_INCOHERENT_STOKES_KERNEL_H -#define LOFAR_GPUPROC_INCOHERENT_STOKES_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/IncoherentStokesKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/IncoherentStokesKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + + class IncoherentStokesKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Parameters that must be passed to the constructor of the + // IncoherentStokesKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + unsigned nrStations; + + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + unsigned nrStokes; + unsigned timeIntegrationFactor; + + size_t bufferSize(BufferType bufferType) const; + }; + + IncoherentStokesKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<IncoherentStokesKernel>::compileDefinitions() const; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesTransposeKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesTransposeKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.h index ed8db9bc0baa2a0e0779f40fc9d6e69cc3cd09bc..b3e38f1d3f55c02872579b4d659d6adf46afbd06 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.h @@ -1,6 +1,6 @@ //# IncoherentStokesTransposeKernel.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,66 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_INCOHERENT_STOKES_TRANSPOSE_KERNEL_H +#define LOFAR_GPUPROC_CUDA_INCOHERENT_STOKES_TRANSPOSE_KERNEL_H -#ifndef LOFAR_GPUPROC_INCOHERENT_STOKES_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_INCOHERENT_STOKES_TRANSPOSE_KERNEL_H +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +namespace LOFAR +{ + namespace Cobalt + { + //# Forward declarations + class Parset; -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/IncoherentStokesTransposeKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/IncoherentStokesTransposeKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif + class IncoherentStokesTransposeKernel : public CompiledKernel + { + public: + // Name of the CUDA kernel source file. + static const std::string theirSourceFile; + + // Name of the kernel function to invoke. + static const std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Parameters that must be passed to the constructor of the + // IncoherentStokesTransposeKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps); + + unsigned nrStations; + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + // Size of the square shared memory tile to be used. + const unsigned tileSize; + + size_t bufferSize(BufferType bufferType) const; + }; + + IncoherentStokesTransposeKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<IncoherentStokesTransposeKernel>:: + compileDefinitions() const; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IntToFloatKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/IntToFloatKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/IntToFloatKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/IntToFloatKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/IntToFloatKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/IntToFloatKernel.h index b6884c0ec2a827490235272030e6ffe7571718e7..434d6f31b097ee17b94aa685120b47f61e76e5a6 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/IntToFloatKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/IntToFloatKernel.h @@ -1,6 +1,5 @@ //# IntToFloatKernel.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,71 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_INT_TO_FLOAT_KERNEL_H +#define LOFAR_GPUPROC_CUDA_INT_TO_FLOAT_KERNEL_H -#ifndef LOFAR_GPUPROC_INT_TO_FLOAT_KERNEL_H -#define LOFAR_GPUPROC_INT_TO_FLOAT_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/IntToFloatKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/IntToFloatKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +#include <string> +#include <vector> + +namespace LOFAR +{ + namespace Cobalt + { + class IntToFloatKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA, + STATION_INDICES + }; + + // Parameters that must be passed to the constructor of the + // IntToFloatKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps, bool fftShift, bool beamFormerStationSubset); + unsigned nrInputStations; + std::vector<unsigned> stationIndices; // input station nr for ewch output station + + unsigned nrBitsPerSample; + unsigned nrBytesPerComplexSample() const; + + unsigned nrSamplesPerSubband; + + bool fftShift; + bool doStationSubset; + + size_t bufferSize(BufferType bufferType) const; + + unsigned nrOutputStations() const { return doStationSubset ? stationIndices.size() : nrInputStations; } + }; + + IntToFloatKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + gpu::DeviceMemory stationIndices; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<IntToFloatKernel>::compileDefinitions() const; + } + +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/Kernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/Kernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/Kernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/Kernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/Kernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/Kernel.h index 4000ce8c0bbd0845398cfae88ec37519abdc6b2a..448703b065371590b7055b3ba8ddcb01a0760aae 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/Kernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/Kernel.h @@ -1,6 +1,5 @@ //# Kernel.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,151 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_KERNEL_H +#define LOFAR_GPUPROC_CUDA_KERNEL_H -#ifndef LOFAR_GPUPROC_KERNEL_H -#define LOFAR_GPUPROC_KERNEL_H +#include <string> +#include <iosfwd> +#include <cuda.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <GPUProc/gpu_wrapper.h> +#include <GPUProc/gpu_utils.h> +#include <GPUProc/PerformanceCounter.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/Kernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/Kernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + //# Forward declarations + struct BlockID; + + /* + * A wrapper for a generic kernel that can be executed on a GPU, and transforms + * data from an input buffer to an output buffer. + */ + class Kernel + { + public: + // Parameters that must be passed to the constructor of this Kernel class. + // TODO: more at constructor passed immediates can be turned into defines + // (blockDim/gridDim too if enforced fixed (consider conditional define) + // or drop opt) + struct Parameters + { + Parameters(const std::string &name); + + std::string name; + + bool dumpBuffers; + std::string dumpFilePattern; + }; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA + }; + + // Buffers that must be passed to the constructor of this Kernel class. + struct Buffers + { + Buffers(const gpu::DeviceMemory& in, + const gpu::DeviceMemory& out) : + input(in), output(out) + {} + gpu::DeviceMemory input; + gpu::DeviceMemory output; + }; + + void enqueue(const BlockID &blockId); + + // Warning: user has to make sure the Kernel is not running! + RunningStatistics getStats() { return itsCounter.getStats(); } + + protected: + // Construct a kernel. + Kernel(const gpu::Stream& stream, + const Buffers &buffers, + const Parameters ¶ms); + + // Explicit destructor, because the implicitly generated one is public. + virtual ~Kernel(); + + // Performance counter for work done by this kernel + PerformanceCounter itsCounter; + + size_t nrOperations, nrBytesRead, nrBytesWritten; + + // Launch the actual kernel + virtual void launch() const = 0; + + // The GPU Stream associated with this kernel. + gpu::Stream itsStream; + + // Keep a local (reference counted) copy of the buffers we're using + Buffers itsBuffers; + + // The parameters as given to the constructor. + Parameters itsParameters; + + private: + // Dump output buffer of a this kernel to disk. Use \a blockId to + // distinguish between the different blocks and subbands. + // \attention This method is for debugging purposes only, as it has a + // severe impact on performance. + void dumpBuffers(const BlockID &blockId) const; + }; + + /* + * A Kernel that is actually a CUDA JIT compiled function. + */ + class CompiledKernel : public Kernel, public gpu::Function + { + protected: + // Construct a kernel. + CompiledKernel( + const gpu::Stream& stream, + const gpu::Function& function, + const Buffers &buffers, + const Parameters ¶ms); + + // Explicit destructor, because the implicitly generated one is public. + virtual ~CompiledKernel(); + + void launch() const; + + // Set the passed execution configuration if supported on the hardware + // in the stream for this kernel. + // If not supported and NULL was passed in errorStrings, an exc is thrown. + // If not supported and errorsStrings is valid, an error string is written + // to the errorStrings pointer. + void setEnqueueWorkSizes(gpu::Grid globalWorkSize, + gpu::Block localWorkSize, + std::string* errorStrings = NULL); + + // Requires call to setEnqueueWorkSizes() first to get meaningful result. + // Idem for cache and shared memory configuration in the context. + unsigned getNrBlocksPerMultiProc(unsigned dynSharedMemBytes = 0) const; + + // "The multiprocessor occupancy is the ratio of active warps to the + // maximum number of warps supported on a multiprocessor of the GPU." + // This (tries to) mimic what NVIDIA's CUDA_Occupancy_Calculator.xls does. + // + // Requires call to setEnqueueWorkSizes() first to get meaningful result. + // Idem for cache and shared memory configuration in the context. + // Note: Higher occupancy does not necessarily mean higher performance. + double predictMultiProcOccupancy(unsigned dynSharedMemBytes = 0) const; + + const unsigned maxThreadsPerBlock; + private: + // The grid of blocks dimensions for kernel execution. + gpu::Grid itsGridDims; + + // The block of threads dimensions for kernel execution. + gpu::Block itsBlockDims; + }; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_BeamFormerKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_BeamFormerKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_BeamFormerKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/UHEP_BeamFormerKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_BeamFormerKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_BeamFormerKernel.h index f5022c32fe8cb5a705b4cf44ccf3c76e1cd663a2..963438710f62eb79b67d73f690e5a273573c3efa 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_BeamFormerKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_BeamFormerKernel.h @@ -1,6 +1,5 @@ //# UHEP_BeamFormerKernel.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,26 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_UHEP_BEAM_FORMER_KERNEL_H +#define LOFAR_GPUPROC_CUDA_UHEP_BEAM_FORMER_KERNEL_H -#ifndef LOFAR_GPUPROC_UHEP_BEAM_FORMER_KERNEL_H -#define LOFAR_GPUPROC_UHEP_BEAM_FORMER_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "Kernel.h" +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/UHEP_BeamFormerKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/UHEP_BeamFormerKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class UHEP_BeamFormerKernel : public CompiledKernel + { + public: + UHEP_BeamFormerKernel(const Parset &ps, gpu::Module &program, + gpu::DeviceMemory &devComplexVoltages, gpu::DeviceMemory &devInputSamples, gpu::DeviceMemory &devBeamFormerWeights); + }; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFFT_Kernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFFT_Kernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.h index f81a46cb30396895bb7a0a42fc1c70f7f0e47201..cec271c20d121f1ffa6eea2128282f6ddb0fffa3 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.h @@ -1,6 +1,5 @@ //# UHEP_InvFFT_Kernel.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,26 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_UHEP_INV_FFT_KERNEL_H +#define LOFAR_GPUPROC_CUDA_UHEP_INV_FFT_KERNEL_H -#ifndef LOFAR_GPUPROC_UHEP_INV_FFT_KERNEL_H -#define LOFAR_GPUPROC_UHEP_INV_FFT_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "Kernel.h" +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/UHEP_InvFFT_Kernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/UHEP_InvFFT_Kernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class UHEP_InvFFT_Kernel : public CompiledKernel + { + public: + UHEP_InvFFT_Kernel(const Parset &ps, gpu::Module &program, gpu::DeviceMemory &devFFTedData); + + }; + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFIR_Kernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFIR_Kernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFIR_Kernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFIR_Kernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFIR_Kernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFIR_Kernel.h index 7bfefe97b3f3d2bae4d1aa3b01892ddf76e6400e..92ebfee3ec42bb66b20c8c8beadbc66066faa156 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFIR_Kernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_InvFIR_Kernel.h @@ -1,6 +1,5 @@ //# UHEP_InvFIR_Kernel.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,28 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_UHEP_INV_FIR_KERNEL_H +#define LOFAR_GPUPROC_CUDA_UHEP_INV_FIR_KERNEL_H -#ifndef LOFAR_GPUPROC_UHEP_INV_FIR_KERNEL_H -#define LOFAR_GPUPROC_UHEP_INV_FIR_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "Kernel.h" +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/UHEP_InvFIR_Kernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/UHEP_InvFIR_Kernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class UHEP_InvFIR_Kernel : public CompiledKernel + { + public: + UHEP_InvFIR_Kernel(const Parset &ps, gpu::Stream &queue, + gpu::Module &program, gpu::DeviceMemory &devInvFIRfilteredData, + gpu::DeviceMemory &devFFTedData, gpu::DeviceMemory &devInvFIRfilterWeights); + }; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TransposeKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TransposeKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TransposeKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TransposeKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TransposeKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TransposeKernel.h index a72a468babca65802d0a9f8a51f852770020e6da..9a2f222c09bddc0fec0b2bb73bfa9d6c3f08887d 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TransposeKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TransposeKernel.h @@ -1,6 +1,5 @@ //# UHEP_TransposeKernel.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,27 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_UHEP_TRANSPOSE_KERNEL_H +#define LOFAR_GPUPROC_CUDA_UHEP_TRANSPOSE_KERNEL_H -#ifndef LOFAR_GPUPROC_UHEP_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_UHEP_TRANSPOSE_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "Kernel.h" +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/UHEP_TransposeKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/UHEP_TransposeKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + class UHEP_TransposeKernel : public CompiledKernel + { + public: + UHEP_TransposeKernel(const Parset &ps, gpu::Module &program, + gpu::DeviceMemory &devFFTedData, gpu::DeviceMemory &devComplexVoltages, gpu::DeviceMemory &devReverseSubbandMapping); + }; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TriggerKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TriggerKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TriggerKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TriggerKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TriggerKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TriggerKernel.h index 57e1775a8d02b9308f90d330f0ee473f48e5be5c..4f97f5fccc8a96ad72c29c5d38008832fc45b260 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TriggerKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/UHEP_TriggerKernel.h @@ -1,6 +1,5 @@ //# UHEP_TriggerKernel.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,35 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_UHEP_TRIGGER_KERNEL_H +#define LOFAR_GPUPROC_CUDA_UHEP_TRIGGER_KERNEL_H -#ifndef LOFAR_GPUPROC_UHEP_TRIGGER_KERNEL_H -#define LOFAR_GPUPROC_UHEP_TRIGGER_KERNEL_H +#include <CoInterface/Parset.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include "Kernel.h" +#include <GPUProc/gpu_wrapper.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/UHEP_TriggerKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/UHEP_TriggerKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +namespace LOFAR +{ + namespace Cobalt + { + + + struct TriggerInfo { + float mean, variance, bestValue; + unsigned bestApproxIndex; + }; + + class UHEP_TriggerKernel : public CompiledKernel + { + public: + UHEP_TriggerKernel(const Parset &ps, gpu::Module &program, + gpu::DeviceMemory &devTriggerInfo, gpu::DeviceMemory &devInvFIRfilteredData); + + }; + + } +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/ZeroingKernel.cc b/RTCP/Cobalt/GPUProc/src/Kernels/ZeroingKernel.cc similarity index 100% rename from RTCP/Cobalt/GPUProc/src/cuda/Kernels/ZeroingKernel.cc rename to RTCP/Cobalt/GPUProc/src/Kernels/ZeroingKernel.cc diff --git a/RTCP/Cobalt/GPUProc/src/Kernels/ZeroingKernel.h b/RTCP/Cobalt/GPUProc/src/Kernels/ZeroingKernel.h index b22aa3ae5535e4c7c857305b9bfacbeadf6aafbf..edf360f86f1e4d1cd0d6f83eba65a15b4d770bb4 100644 --- a/RTCP/Cobalt/GPUProc/src/Kernels/ZeroingKernel.h +++ b/RTCP/Cobalt/GPUProc/src/Kernels/ZeroingKernel.h @@ -1,6 +1,5 @@ //# ZeroingKernel.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,81 @@ //# //# $Id$ -// \file -// Include the right GPU API include with our options. +#ifndef LOFAR_GPUPROC_CUDA_ZEROING_KERNEL_H +#define LOFAR_GPUPROC_CUDA_ZEROING_KERNEL_H -#ifndef LOFAR_GPUPROC_ZEROING_KERNEL_H -#define LOFAR_GPUPROC_ZEROING_KERNEL_H +#include <Common/Timer.h> -#if defined (USE_CUDA) && defined (USE_OPENCL) -# error "Either CUDA or OpenCL must be enabled, not both" -#endif +#include <CoInterface/Parset.h> +#include <CoInterface/MultiDimArray.h> +#include <CoInterface/SparseSet.h> -#if defined (USE_CUDA) -# include <GPUProc/cuda/Kernels/ZeroingKernel.h> -#elif defined (USE_OPENCL) -# include <GPUProc/opencl/Kernels/ZeroingKernel.h> -#else -# error "Either CUDA or OpenCL must be enabled, not neither" -#endif +#include <GPUProc/Kernels/Kernel.h> +#include <GPUProc/KernelFactory.h> +#include <GPUProc/gpu_wrapper.h> + +namespace LOFAR +{ + namespace Cobalt + { + class ZeroingKernel : public CompiledKernel + { + public: + static std::string theirSourceFile; + static std::string theirFunction; + + enum BufferType + { + INPUT_DATA, + OUTPUT_DATA, + MASK + }; + + // Parameters that must be passed to the constructor of the + // IntToFloatKernel class. + struct Parameters : Kernel::Parameters + { + Parameters(const Parset& ps, unsigned nrSTABs, unsigned nrChannels, const std::string &name = "Zeroing"); + unsigned nrSTABs; + + unsigned nrChannels; + unsigned nrSamplesPerChannel; + + size_t bufferSize(BufferType bufferType) const; + }; + + // Construct a Zeroing kernel. + // \pre The number of samples per channel must be even. + // \pre The product of the number of stations, the number of + // polarizations, the number of channels per subband, and the number of + // samples per channel must be divisible by the maximum number of threads + // per block (typically 1024). + ZeroingKernel(const gpu::Stream &stream, + const gpu::Module &module, + const Buffers &buffers, + const Parameters ¶m); + + // Run the kernel. "channelFlags" is the set of flags, one for each station/tab + void enqueue(const BlockID &blockId, const MultiDimArray<SparseSet<unsigned>, 1> &channelFlags); + + private: + const unsigned nrSTABs; + const unsigned nrSamplesPerChannel; + + // The flag mask per sample (1=flagged, 0=ok) + gpu::DeviceMemory gpuMask; + gpu::HostMemory hostMask; + + NSTimer computeMaskTimer; + }; + + //# -------- Template specializations for KernelFactory -------- #// + + template<> CompileDefinitions + KernelFactory<ZeroingKernel>::compileDefinitions() const; + } + +} #endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BandPassCorrectionKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BandPassCorrectionKernel.h deleted file mode 100644 index 607a3f1cd90d9a73e70ecb380f37f4d191de485e..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BandPassCorrectionKernel.h +++ /dev/null @@ -1,82 +0,0 @@ -//# BandPassCorrectionKernel.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_BAND_PASS_CORRECTION_KERNEL_H -#define LOFAR_GPUPROC_CUDA_BAND_PASS_CORRECTION_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - - class BandPassCorrectionKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA, - BAND_PASS_CORRECTION_WEIGHTS - }; - - // Parameters that must be passed to the constructor of the - // BandPassCorrectionKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - unsigned nrStations; - - unsigned nrDelayCompensationChannels; - unsigned nrHighResolutionChannels; - unsigned nrSamplesPerChannel; - - bool correctBandPass; - - size_t bufferSize(BandPassCorrectionKernel::BufferType bufferType) const; - }; - - BandPassCorrectionKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - private: - // The bandpass weights to apply on each channel - gpu::DeviceMemory bandPassCorrectionWeights; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<BandPassCorrectionKernel>::compileDefinitions() const; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerKernel.h deleted file mode 100644 index 6ba5995049b8697b87c8fe4835e3c29f57cfb882..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerKernel.h +++ /dev/null @@ -1,98 +0,0 @@ -//# BeamFormerKernel.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_KERNEL_H -#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -#include <string> -#include <vector> - -namespace LOFAR -{ - namespace Cobalt - { - class BeamFormerKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA, - DELAY_INDICES, - BEAM_FORMER_DELAYS - }; - - // Parameters that must be passed to the constructor of the - // BeamFormerKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - - // The beam-former delays are indexed by their station number - // in the observation, so we need to map them to beam-former - // station numbers. - std::vector<unsigned> delayIndices; - - // Width of th observation's delay array, in stations - unsigned nrDelays; - - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - unsigned nrSAPs; - unsigned nrTABs; - double subbandBandwidth; - bool doFlysEye; - - size_t bufferSize(BufferType bufferType) const; - - size_t nrStations() const { return delayIndices.size(); } - }; - - BeamFormerKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - void enqueue(const BlockID &blockId, - double subbandFrequency, unsigned SAP); - - gpu::DeviceMemory delayIndices; - gpu::DeviceMemory beamFormerDelays; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<BeamFormerKernel>::compileDefinitions() const; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerTransposeKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerTransposeKernel.h deleted file mode 100644 index dc65338ba69a0b3209b56a95d0068bfd6b79bdf7..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/BeamFormerTransposeKernel.h +++ /dev/null @@ -1,75 +0,0 @@ -//# BeamFormerTransposeKernel.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_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_CUDA_BEAM_FORMER_TRANSPOSE_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class BeamFormerTransposeKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // BeamFormerKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - unsigned nrTABs; - - size_t bufferSize(BufferType bufferType) const; - }; - - BeamFormerTransposeKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<BeamFormerTransposeKernel>::compileDefinitions() const; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesKernel.h deleted file mode 100644 index 6b12782d2ed8172f1953f6be7420a3093bf5b38c..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesKernel.h +++ /dev/null @@ -1,92 +0,0 @@ -//# CoherentStokesKernel.h -//# Copyright (C) 2012-2014 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_COHERENT_STOKES_KERNEL_H -#define LOFAR_GPUPROC_CUDA_COHERENT_STOKES_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - - class CoherentStokesKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // CoherentStokesKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - unsigned nrTABs; - unsigned nrStokes; - bool outputComplexVoltages; - unsigned timeIntegrationFactor; - - size_t bufferSize(BufferType bufferType) const; - }; - - CoherentStokesKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - struct CoherentStokesExecConfig : gpu::ExecConfig - { - unsigned nrTimeParallelThreads; - friend std::ostream& operator<<(std::ostream& os, - const CoherentStokesKernel::CoherentStokesExecConfig& execConfig); - }; - - private: - // The timeParallelFactor is not a Parameter passed in, but is a kernel - // arg, so it must be a member var to outlive kernel launches. - unsigned itsTimeParallelFactor; - - - unsigned smallestFactorOf(unsigned n) const; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<CoherentStokesKernel>::compileDefinitions() const; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesTransposeKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesTransposeKernel.h deleted file mode 100644 index 78c6905bfdd5919e9daf57392a09cd76f0f5dc9c..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CoherentStokesTransposeKernel.h +++ /dev/null @@ -1,75 +0,0 @@ -//# CoherentStokesTransposeKernel.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_COHERENT_STOKES_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_CUDA_COHERENT_STOKES_TRANSPOSE_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class CoherentStokesTransposeKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // BeamFormerKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - unsigned nrTABs; - - size_t bufferSize(BufferType bufferType) const; - }; - - CoherentStokesTransposeKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<CoherentStokesTransposeKernel>::compileDefinitions() const; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CorrelatorKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CorrelatorKernel.h deleted file mode 100644 index c4343b9d9b9556ac5e20ba657f5b55e3dcc5b61c..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/CorrelatorKernel.h +++ /dev/null @@ -1,73 +0,0 @@ -//# CorrelatorKernel.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_KERNEL_H -#define LOFAR_GPUPROC_CUDA_CORRELATOR_KERNEL_H - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class CorrelatorKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - unsigned nrStations; - unsigned nrStationsPerThread; - unsigned nrBaselines() const; - - unsigned nrChannels; - unsigned nrSamplesPerIntegration; - unsigned nrIntegrationsPerBlock; - size_t nrSamplesPerBlock() const; - - size_t bufferSize(BufferType bufferType) const; - }; - - CorrelatorKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<CorrelatorKernel>::compileDefinitions() const; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionBackwardFFTkernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionBackwardFFTkernel.h deleted file mode 100644 index 111a5d9ba59902de1784e99555c06fad082687dc..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionBackwardFFTkernel.h +++ /dev/null @@ -1,43 +0,0 @@ -//# DedispersionBackwardFFTkernel.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_DEDISPERSION_BACKWARD_FFTKERNEL_H -#define LOFAR_GPUPROC_CUDA_DEDISPERSION_BACKWARD_FFTKERNEL_H - -#include <CoInterface/Parset.h> - -#include "FFT_Kernel.h" - -namespace LOFAR -{ - namespace Cobalt - { - class DedispersionBackwardFFTkernel : public FFT_Kernel - { - public: - DedispersionBackwardFFTkernel(const Parset &ps, gpu::Context &context, gpu::DeviceMemory &buffer); - - }; - } - -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionChirpKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionChirpKernel.h deleted file mode 100644 index 90faf0c4b647e090c823122787faa832c97a3bf6..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionChirpKernel.h +++ /dev/null @@ -1,51 +0,0 @@ -//# DedispersionChirpKernel.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_DEDISPERSION_CHIRP_KERNEL_H -#define LOFAR_GPUPROC_CUDA_DEDISPERSION_CHIRP_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/gpu_wrapper.h> -//#include <GPUProc/PerformanceCounter.h> - -namespace LOFAR -{ - namespace Cobalt - { - - class DedispersionChirpKernel : public CompiledKernel - { - public: - DedispersionChirpKernel(const Parset &ps, - gpu::Context &context, - gpu::DeviceMemory &buffer, - gpu::DeviceMemory &DMs); - - void enqueue(gpu::Stream &queue, double subbandFrequency); - - }; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionForwardFFTkernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionForwardFFTkernel.h deleted file mode 100644 index b50f8a76bc6634b4f2f055a4ea74a5cf6c637368..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DedispersionForwardFFTkernel.h +++ /dev/null @@ -1,42 +0,0 @@ -//# DedispersionForwardFFTkernel.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_DEDISPERSION_FORWARD_FFTKERNEL_H -#define LOFAR_GPUPROC_CUDA_DEDISPERSION_FORWARD_FFTKERNEL_H - -#include <CoInterface/Parset.h> - -#include "FFT_Kernel.h" - -namespace LOFAR -{ - namespace Cobalt - { - class DedispersionForwardFFTkernel : public FFT_Kernel - { - public: - DedispersionForwardFFTkernel(const Parset &ps, gpu::Context &context, gpu::DeviceMemory &buffer); - - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DelayAndBandPassKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DelayAndBandPassKernel.h deleted file mode 100644 index a2f051c6f0aef458ac27e3d96d3b58e9d50fb314..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/DelayAndBandPassKernel.h +++ /dev/null @@ -1,108 +0,0 @@ -//# DelayAndBandPassKernel.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_DELAY_AND_BAND_PASS_KERNEL_H -#define LOFAR_GPUPROC_CUDA_DELAY_AND_BAND_PASS_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> -//#include <GPUProc/PerformanceCounter.h> - -#include <vector> - -namespace LOFAR -{ - namespace Cobalt - { - - class DelayAndBandPassKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA, - DELAY_INDICES, - DELAYS, - PHASE_ZEROS, - BAND_PASS_CORRECTION_WEIGHTS - }; - - // Parameters that must be passed to the constructor of the - // DelayAndBandPassKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps, bool correlator); - unsigned nrStations; - std::vector<unsigned> delayIndices; - unsigned nrDelays; - unsigned nrBitsPerSample; - - unsigned nrChannels; - unsigned nrSamplesPerChannel; - double subbandBandwidth; - - unsigned nrSAPs; - - bool delayCompensation; - bool correctBandPass; - bool transpose; - - unsigned nrSamplesPerSubband() const; - unsigned nrBytesPerComplexSample() const; - - size_t bufferSize(BufferType bufferType) const; - }; - - DelayAndBandPassKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - - void enqueue(const BlockID &blockId, - double subbandFrequency, unsigned SAP); - - // Input parameters for the delay compensation - gpu::DeviceMemory delayIndices; - gpu::DeviceMemory delaysAtBegin; - gpu::DeviceMemory delaysAfterEnd; - gpu::DeviceMemory phase0s; - - private: - // The weights to correct the bandpass with, per channel - gpu::DeviceMemory bandPassCorrectionWeights; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<DelayAndBandPassKernel>::compileDefinitions() const; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFTShiftKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFTShiftKernel.h deleted file mode 100644 index edfa3c6d867cd9fbb6b8e839afaa33c49e312288..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFTShiftKernel.h +++ /dev/null @@ -1,80 +0,0 @@ -//# FFTShiftKernel.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_FFT_SHIFT_KERNEL_H -#define LOFAR_GPUPROC_CUDA_FFT_SHIFT_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class FFTShiftKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // IntToFloatKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps, unsigned nrSTABs, unsigned nrChannels, const std::string &name = "FFT-shift"); - unsigned nrSTABs; - - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - size_t bufferSize(BufferType bufferType) const; - }; - - // Construct a FFTShift kernel. - // \pre The number of samples per channel must be even. - // \pre The product of the number of stations, the number of - // polarizations, the number of channels per subband, and the number of - // samples per channel must be divisible by the maximum number of threads - // per block (typically 1024). - FFTShiftKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<FFTShiftKernel>::compileDefinitions() const; - } - -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Kernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Kernel.h deleted file mode 100644 index d6740958caed4d8a09e58e83549ffb6c989bf797..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FFT_Kernel.h +++ /dev/null @@ -1,82 +0,0 @@ -//# FFT_Kernel.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_FFT_KERNEL_H -#define LOFAR_GPUPROC_CUDA_FFT_KERNEL_H - -#include <GPUProc/gpu_wrapper.h> -#include "FFT_Plan.h" -#include <GPUProc/PerformanceCounter.h> -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> - -namespace LOFAR -{ - namespace Cobalt - { - class FFT_Kernel: public Kernel - { - public: - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // BandPassCorrectionKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(unsigned fftSize, unsigned nrSamples, bool forward, const std::string &name = "FFT"); - - unsigned fftSize; - unsigned nrSamples; - bool forward; - - size_t bufferSize(FFT_Kernel::BufferType bufferType) const; - }; - - FFT_Kernel(const gpu::Stream &stream, - const Buffers& buffers, - const Parameters& params); - - protected: - void launch() const; - - private: - const unsigned nrFFTs, nrMajorFFTs, nrMinorFFTs; - const int direction; - FFT_Plan planMajor, planMinor; - - void executePlan(const cufftHandle &plan, cufftComplex *in_data, cufftComplex *out_data) const; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - // The default KernelFactory tries to compile a source, - // but FFT_Kernel has nothing to compile, so we implement short cuts. - template<> std::string KernelFactory<FFT_Kernel>::_createPTX() const; - template<> FFT_Kernel* KernelFactory<FFT_Kernel>::create( - const gpu::Stream& stream, - gpu::DeviceMemory &inputBuffer, - gpu::DeviceMemory &outputBuffer) const; - } -} -#endif diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FIR_FilterKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FIR_FilterKernel.h deleted file mode 100644 index 8d7d8df7825fc2651038a6938f1d888568bbac4f..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/FIR_FilterKernel.h +++ /dev/null @@ -1,130 +0,0 @@ -//# FIR_FilterKernel.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_FIR_FILTER_KERNEL_H -#define LOFAR_GPUPROC_CUDA_FIR_FILTER_KERNEL_H - -#include <string> -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/FilterBank.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class FIR_FilterKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA, - FILTER_WEIGHTS, - HISTORY_DATA - }; - - // Parameters that must be passed to the constructor of the - // FIR_FilterKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps, unsigned nrSTABs, bool inputIsStationData, unsigned nrSubbands, unsigned nrChannels, float scaleFactor, const std::string &name = "FIR"); - - // The number of stations or TABs to filter. The FIR filter will - // deal with either in the same way. - unsigned nrSTABs; - - unsigned nrBitsPerSample; - unsigned nrBytesPerComplexSample() const; - - unsigned nrChannels; - unsigned nrSamplesPerChannel; - unsigned nrSamplesPerSubband() const; - - - // The number of subbands \e this kernel instance will process, - // typically equal to \c nrSubbandsPerSubbandProc. - unsigned nrSubbands; - - // The number of PPF filter taps. - static const unsigned nrTaps = 16; - - // The number of history samples used for each block - unsigned nrHistorySamples() const; - - // Additional scale factor (e.g. for FFT normalization). - // Derived differently from nrChannelsPerSubband for correlation - // and beamforming, so must be passed into this class. - float scaleFactor; - - // If true, we'll read integers in the order as they're coming from the - // stations: intXX[stab][sample][pol] - // - // If false, we'll read floats in the order produced by the beam-former - // pipeline: float[stab][pol][sample] - bool inputIsStationData; - - size_t bufferSize(FIR_FilterKernel::BufferType bufferType) const; - }; - - FIR_FilterKernel(const gpu::Stream& stream, - const gpu::Module& module, - const Buffers& buffers, - const Parameters& param); - - void enqueue(const BlockID &blockId, - unsigned subbandIdx); - - // Put the historyFlags[subbandIdx] in front of the given inputFlags, - // and update historyFlags[subbandIdx] with the flags of the last samples - // in inputFlags. - void prefixHistoryFlags(MultiDimArray<SparseSet<unsigned>, 1> &inputFlags, unsigned subbandIdx); - - private: - // The Kernel parameters as given to the constructor - const Parameters params; - - // The FIR filter weights - gpu::DeviceMemory filterWeights; - - // The history samples - gpu::DeviceMemory historySamples; - - // The flags of the history samples. - // - // Dimensions: [nrSubbands][nrStations] - MultiDimArray<SparseSet<unsigned>, 2> historyFlags; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<FIR_FilterKernel>::compileDefinitions() const; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesKernel.h deleted file mode 100644 index a50cf7ed173677ff65257cd5f1bffd432f5788ea..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesKernel.h +++ /dev/null @@ -1,79 +0,0 @@ -//# IncoherentStokesKernel.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_INCOHERENT_STOKES_KERNEL_H -#define LOFAR_GPUPROC_CUDA_INCOHERENT_STOKES_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - - class IncoherentStokesKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // IncoherentStokesKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - unsigned nrStations; - - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - unsigned nrStokes; - unsigned timeIntegrationFactor; - - size_t bufferSize(BufferType bufferType) const; - }; - - IncoherentStokesKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<IncoherentStokesKernel>::compileDefinitions() const; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesTransposeKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesTransposeKernel.h deleted file mode 100644 index b3e38f1d3f55c02872579b4d659d6adf46afbd06..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IncoherentStokesTransposeKernel.h +++ /dev/null @@ -1,84 +0,0 @@ -//# IncoherentStokesTransposeKernel.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_INCOHERENT_STOKES_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_CUDA_INCOHERENT_STOKES_TRANSPOSE_KERNEL_H - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - //# Forward declarations - class Parset; - - class IncoherentStokesTransposeKernel : public CompiledKernel - { - public: - // Name of the CUDA kernel source file. - static const std::string theirSourceFile; - - // Name of the kernel function to invoke. - static const std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Parameters that must be passed to the constructor of the - // IncoherentStokesTransposeKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps); - - unsigned nrStations; - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - // Size of the square shared memory tile to be used. - const unsigned tileSize; - - size_t bufferSize(BufferType bufferType) const; - }; - - IncoherentStokesTransposeKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<IncoherentStokesTransposeKernel>:: - compileDefinitions() const; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IntToFloatKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IntToFloatKernel.h deleted file mode 100644 index 434d6f31b097ee17b94aa685120b47f61e76e5a6..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/IntToFloatKernel.h +++ /dev/null @@ -1,88 +0,0 @@ -//# IntToFloatKernel.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_INT_TO_FLOAT_KERNEL_H -#define LOFAR_GPUPROC_CUDA_INT_TO_FLOAT_KERNEL_H - -#include <CoInterface/Parset.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -#include <string> -#include <vector> - -namespace LOFAR -{ - namespace Cobalt - { - class IntToFloatKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA, - STATION_INDICES - }; - - // Parameters that must be passed to the constructor of the - // IntToFloatKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps, bool fftShift, bool beamFormerStationSubset); - unsigned nrInputStations; - std::vector<unsigned> stationIndices; // input station nr for ewch output station - - unsigned nrBitsPerSample; - unsigned nrBytesPerComplexSample() const; - - unsigned nrSamplesPerSubband; - - bool fftShift; - bool doStationSubset; - - size_t bufferSize(BufferType bufferType) const; - - unsigned nrOutputStations() const { return doStationSubset ? stationIndices.size() : nrInputStations; } - }; - - IntToFloatKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - gpu::DeviceMemory stationIndices; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<IntToFloatKernel>::compileDefinitions() const; - } - -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/Kernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/Kernel.h deleted file mode 100644 index 448703b065371590b7055b3ba8ddcb01a0760aae..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/Kernel.h +++ /dev/null @@ -1,168 +0,0 @@ -//# Kernel.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_KERNEL_H -#define LOFAR_GPUPROC_CUDA_KERNEL_H - -#include <string> -#include <iosfwd> -#include <cuda.h> - -#include <GPUProc/gpu_wrapper.h> -#include <GPUProc/gpu_utils.h> -#include <GPUProc/PerformanceCounter.h> - -namespace LOFAR -{ - namespace Cobalt - { - //# Forward declarations - struct BlockID; - - /* - * A wrapper for a generic kernel that can be executed on a GPU, and transforms - * data from an input buffer to an output buffer. - */ - class Kernel - { - public: - // Parameters that must be passed to the constructor of this Kernel class. - // TODO: more at constructor passed immediates can be turned into defines - // (blockDim/gridDim too if enforced fixed (consider conditional define) - // or drop opt) - struct Parameters - { - Parameters(const std::string &name); - - std::string name; - - bool dumpBuffers; - std::string dumpFilePattern; - }; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA - }; - - // Buffers that must be passed to the constructor of this Kernel class. - struct Buffers - { - Buffers(const gpu::DeviceMemory& in, - const gpu::DeviceMemory& out) : - input(in), output(out) - {} - gpu::DeviceMemory input; - gpu::DeviceMemory output; - }; - - void enqueue(const BlockID &blockId); - - // Warning: user has to make sure the Kernel is not running! - RunningStatistics getStats() { return itsCounter.getStats(); } - - protected: - // Construct a kernel. - Kernel(const gpu::Stream& stream, - const Buffers &buffers, - const Parameters ¶ms); - - // Explicit destructor, because the implicitly generated one is public. - virtual ~Kernel(); - - // Performance counter for work done by this kernel - PerformanceCounter itsCounter; - - size_t nrOperations, nrBytesRead, nrBytesWritten; - - // Launch the actual kernel - virtual void launch() const = 0; - - // The GPU Stream associated with this kernel. - gpu::Stream itsStream; - - // Keep a local (reference counted) copy of the buffers we're using - Buffers itsBuffers; - - // The parameters as given to the constructor. - Parameters itsParameters; - - private: - // Dump output buffer of a this kernel to disk. Use \a blockId to - // distinguish between the different blocks and subbands. - // \attention This method is for debugging purposes only, as it has a - // severe impact on performance. - void dumpBuffers(const BlockID &blockId) const; - }; - - /* - * A Kernel that is actually a CUDA JIT compiled function. - */ - class CompiledKernel : public Kernel, public gpu::Function - { - protected: - // Construct a kernel. - CompiledKernel( - const gpu::Stream& stream, - const gpu::Function& function, - const Buffers &buffers, - const Parameters ¶ms); - - // Explicit destructor, because the implicitly generated one is public. - virtual ~CompiledKernel(); - - void launch() const; - - // Set the passed execution configuration if supported on the hardware - // in the stream for this kernel. - // If not supported and NULL was passed in errorStrings, an exc is thrown. - // If not supported and errorsStrings is valid, an error string is written - // to the errorStrings pointer. - void setEnqueueWorkSizes(gpu::Grid globalWorkSize, - gpu::Block localWorkSize, - std::string* errorStrings = NULL); - - // Requires call to setEnqueueWorkSizes() first to get meaningful result. - // Idem for cache and shared memory configuration in the context. - unsigned getNrBlocksPerMultiProc(unsigned dynSharedMemBytes = 0) const; - - // "The multiprocessor occupancy is the ratio of active warps to the - // maximum number of warps supported on a multiprocessor of the GPU." - // This (tries to) mimic what NVIDIA's CUDA_Occupancy_Calculator.xls does. - // - // Requires call to setEnqueueWorkSizes() first to get meaningful result. - // Idem for cache and shared memory configuration in the context. - // Note: Higher occupancy does not necessarily mean higher performance. - double predictMultiProcOccupancy(unsigned dynSharedMemBytes = 0) const; - - const unsigned maxThreadsPerBlock; - private: - // The grid of blocks dimensions for kernel execution. - gpu::Grid itsGridDims; - - // The block of threads dimensions for kernel execution. - gpu::Block itsBlockDims; - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_BeamFormerKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_BeamFormerKernel.h deleted file mode 100644 index 963438710f62eb79b67d73f690e5a273573c3efa..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_BeamFormerKernel.h +++ /dev/null @@ -1,43 +0,0 @@ -//# UHEP_BeamFormerKernel.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_BEAM_FORMER_KERNEL_H -#define LOFAR_GPUPROC_CUDA_UHEP_BEAM_FORMER_KERNEL_H - -#include <CoInterface/Parset.h> - -#include "Kernel.h" -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class UHEP_BeamFormerKernel : public CompiledKernel - { - public: - UHEP_BeamFormerKernel(const Parset &ps, gpu::Module &program, - gpu::DeviceMemory &devComplexVoltages, gpu::DeviceMemory &devInputSamples, gpu::DeviceMemory &devBeamFormerWeights); - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFFT_Kernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFFT_Kernel.h deleted file mode 100644 index cec271c20d121f1ffa6eea2128282f6ddb0fffa3..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFFT_Kernel.h +++ /dev/null @@ -1,43 +0,0 @@ -//# UHEP_InvFFT_Kernel.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_INV_FFT_KERNEL_H -#define LOFAR_GPUPROC_CUDA_UHEP_INV_FFT_KERNEL_H - -#include <CoInterface/Parset.h> - -#include "Kernel.h" -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class UHEP_InvFFT_Kernel : public CompiledKernel - { - public: - UHEP_InvFFT_Kernel(const Parset &ps, gpu::Module &program, gpu::DeviceMemory &devFFTedData); - - }; - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFIR_Kernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFIR_Kernel.h deleted file mode 100644 index 92ebfee3ec42bb66b20c8c8beadbc66066faa156..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_InvFIR_Kernel.h +++ /dev/null @@ -1,45 +0,0 @@ -//# UHEP_InvFIR_Kernel.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_INV_FIR_KERNEL_H -#define LOFAR_GPUPROC_CUDA_UHEP_INV_FIR_KERNEL_H - -#include <CoInterface/Parset.h> - -#include "Kernel.h" -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class UHEP_InvFIR_Kernel : public CompiledKernel - { - public: - UHEP_InvFIR_Kernel(const Parset &ps, gpu::Stream &queue, - gpu::Module &program, gpu::DeviceMemory &devInvFIRfilteredData, - gpu::DeviceMemory &devFFTedData, gpu::DeviceMemory &devInvFIRfilterWeights); - }; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TransposeKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TransposeKernel.h deleted file mode 100644 index 9a2f222c09bddc0fec0b2bb73bfa9d6c3f08887d..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TransposeKernel.h +++ /dev/null @@ -1,44 +0,0 @@ -//# UHEP_TransposeKernel.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_TRANSPOSE_KERNEL_H -#define LOFAR_GPUPROC_CUDA_UHEP_TRANSPOSE_KERNEL_H - -#include <CoInterface/Parset.h> - -#include "Kernel.h" -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class UHEP_TransposeKernel : public CompiledKernel - { - public: - UHEP_TransposeKernel(const Parset &ps, gpu::Module &program, - gpu::DeviceMemory &devFFTedData, gpu::DeviceMemory &devComplexVoltages, gpu::DeviceMemory &devReverseSubbandMapping); - }; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TriggerKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TriggerKernel.h deleted file mode 100644 index 4f97f5fccc8a96ad72c29c5d38008832fc45b260..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/UHEP_TriggerKernel.h +++ /dev/null @@ -1,52 +0,0 @@ -//# UHEP_TriggerKernel.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_TRIGGER_KERNEL_H -#define LOFAR_GPUPROC_CUDA_UHEP_TRIGGER_KERNEL_H - -#include <CoInterface/Parset.h> - -#include "Kernel.h" -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - - - struct TriggerInfo { - float mean, variance, bestValue; - unsigned bestApproxIndex; - }; - - class UHEP_TriggerKernel : public CompiledKernel - { - public: - UHEP_TriggerKernel(const Parset &ps, gpu::Module &program, - gpu::DeviceMemory &devTriggerInfo, gpu::DeviceMemory &devInvFIRfilteredData); - - }; - - } -} - -#endif - diff --git a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/ZeroingKernel.h b/RTCP/Cobalt/GPUProc/src/cuda/Kernels/ZeroingKernel.h deleted file mode 100644 index edf360f86f1e4d1cd0d6f83eba65a15b4d770bb4..0000000000000000000000000000000000000000 --- a/RTCP/Cobalt/GPUProc/src/cuda/Kernels/ZeroingKernel.h +++ /dev/null @@ -1,98 +0,0 @@ -//# ZeroingKernel.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_ZEROING_KERNEL_H -#define LOFAR_GPUPROC_CUDA_ZEROING_KERNEL_H - -#include <Common/Timer.h> - -#include <CoInterface/Parset.h> -#include <CoInterface/MultiDimArray.h> -#include <CoInterface/SparseSet.h> - -#include <GPUProc/Kernels/Kernel.h> -#include <GPUProc/KernelFactory.h> -#include <GPUProc/gpu_wrapper.h> - -namespace LOFAR -{ - namespace Cobalt - { - class ZeroingKernel : public CompiledKernel - { - public: - static std::string theirSourceFile; - static std::string theirFunction; - - enum BufferType - { - INPUT_DATA, - OUTPUT_DATA, - MASK - }; - - // Parameters that must be passed to the constructor of the - // IntToFloatKernel class. - struct Parameters : Kernel::Parameters - { - Parameters(const Parset& ps, unsigned nrSTABs, unsigned nrChannels, const std::string &name = "Zeroing"); - unsigned nrSTABs; - - unsigned nrChannels; - unsigned nrSamplesPerChannel; - - size_t bufferSize(BufferType bufferType) const; - }; - - // Construct a Zeroing kernel. - // \pre The number of samples per channel must be even. - // \pre The product of the number of stations, the number of - // polarizations, the number of channels per subband, and the number of - // samples per channel must be divisible by the maximum number of threads - // per block (typically 1024). - ZeroingKernel(const gpu::Stream &stream, - const gpu::Module &module, - const Buffers &buffers, - const Parameters ¶m); - - // Run the kernel. "channelFlags" is the set of flags, one for each station/tab - void enqueue(const BlockID &blockId, const MultiDimArray<SparseSet<unsigned>, 1> &channelFlags); - - private: - const unsigned nrSTABs; - const unsigned nrSamplesPerChannel; - - // The flag mask per sample (1=flagged, 0=ok) - gpu::DeviceMemory gpuMask; - gpu::HostMemory hostMask; - - NSTimer computeMaskTimer; - }; - - //# -------- Template specializations for KernelFactory -------- #// - - template<> CompileDefinitions - KernelFactory<ZeroingKernel>::compileDefinitions() const; - } - -} - -#endif -