4 #ifndef DDECAL_GAIN_SOLVERS_ITERATIVE_DIAGONAL_SOLVER_CUDA_H_
5 #define DDECAL_GAIN_SOLVERS_ITERATIVE_DIAGONAL_SOLVER_CUDA_H_
9 #include <cudawrappers/cu.hpp>
19 template <
typename VisMatrix>
24 std::vector<std::vector<DComplex>>& solutions,
double time,
25 std::ostream* stat_stream)
override;
33 void DeallocateHostBuffers();
36 void CopyHostToHost(
size_t ch_block,
bool first_iteration,
38 const std::vector<DComplex>& solutions,
41 void CopyHostToDevice(
size_t ch_block,
size_t buffer_id, cu::Stream& stream,
44 void PostProcessing(
size_t& iteration,
double time,
45 bool has_previously_converged,
bool& has_converged,
46 bool& constraints_satisfied,
bool& done,
48 std::vector<std::vector<DComplex>>& solutions,
50 std::vector<double>& step_magnitudes,
51 std::ostream* stat_stream);
54 bool gpu_buffers_initialized_ =
false;
56 bool host_buffers_initialized_ =
false;
60 bool keep_buffers_ =
false;
62 std::unique_ptr<cu::Device> device_;
63 std::unique_ptr<cu::Context> context_;
64 std::unique_ptr<cu::Stream> execute_stream_;
65 std::unique_ptr<cu::Stream> host_to_device_stream_;
66 std::unique_ptr<cu::Stream> device_to_host_stream_;
95 std::vector<cu::DeviceMemory> antenna_pairs;
97 std::vector<cu::DeviceMemory> solution_map;
99 std::vector<cu::DeviceMemory> solutions;
101 std::vector<cu::DeviceMemory> next_solutions;
103 std::vector<cu::DeviceMemory> model;
105 std::vector<cu::DeviceMemory> residual;
107 std::unique_ptr<cu::DeviceMemory> numerator;
109 std::unique_ptr<cu::DeviceMemory> denominator;
124 std::vector<cu::HostMemory> model;
126 std::vector<cu::HostMemory> residual;
128 std::vector<cu::HostMemory> solutions;
130 std::unique_ptr<cu::HostMemory> next_solutions;
132 std::vector<cu::HostMemory> antenna_pairs;
134 std::vector<cu::HostMemory> solution_map;
Definition: IterativeDiagonalSolverCuda.h:20
IterativeDiagonalSolverCuda(bool keep_buffers=false)
size_t NSolutionPolarizations() const override
Definition: IterativeDiagonalSolverCuda.h:27
SolveResult Solve(const SolveData< VisMatrix > &data, std::vector< std::vector< DComplex >> &solutions, double time, std::ostream *stat_stream) override
bool SupportsDdSolutionIntervals() const override
Definition: IterativeDiagonalSolverCuda.h:29
Definition: SolveData.h:29
Definition: SolverBase.h:24
aocommon::xt::Span< std::complex< double >, 4 > SolutionSpan
Definition: Solutions.h:20
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53
Definition: SolverBase.h:61