Commit 088faa3c authored by Bram Veenboer's avatar Bram Veenboer

Fix (member) variables for wtiling

parent 6e4ae49a
......@@ -73,13 +73,15 @@ BufferSetImpl::BufferSetImpl(Type architecture)
m_avg_aterm_correction(0, 0, 0, 0),
m_grid(new Grid(0, 0, 0, 0)),
m_proxy(create_proxy(architecture)),
m_shift{0.0},
m_shift(3),
m_get_image_watch(Stopwatch::create()),
m_set_image_watch(Stopwatch::create()),
m_avg_beam_watch(Stopwatch::create()),
m_plan_watch(Stopwatch::create()),
m_gridding_watch(Stopwatch::create()),
m_degridding_watch(Stopwatch::create()) {}
m_degridding_watch(Stopwatch::create()) {
m_shift.zero();
}
BufferSetImpl::~BufferSetImpl() {
// Free all objects allocated via the proxy before destroying the proxy.
......@@ -241,9 +243,9 @@ void BufferSetImpl::init(size_t size, float cell_size, float max_w,
std::cout << "nr_w_layers: " << nr_w_layers << std::endl;
#endif
m_shift[0] = shiftl;
m_shift[1] = shiftm;
m_shift[2] = shiftp;
m_shift(0) = shiftl;
m_shift(1) = shiftm;
m_shift(2) = shiftp;
m_kernel_size = taper_kernel_size + w_kernel_size + a_term_kernel_size;
......@@ -585,7 +587,7 @@ void BufferSetImpl::get_image(double* image) {
m_get_image_watch->Start();
// Flush all pending operations on the grid
m_proxy->flush_wtiles();
m_proxy->flush_wtiles(m_subgridsize, m_image_size, m_w_step, m_shift);
m_proxy->get_grid();
double runtime = -omp_get_wtime();
......
......@@ -76,7 +76,7 @@ class BufferSetImpl : public virtual BufferSet {
float get_cell_size() const { return m_cell_size; }
float get_w_step() const { return m_w_step; }
const std::array<float, 3>& get_shift() const { return m_shift; }
const idg::Array1D<float>& get_shift() const { return m_shift; }
float get_kernel_size() const { return m_kernel_size; }
const Array2D<float>& get_spheroidal() const { return m_spheroidal; }
const std::shared_ptr<Grid>& get_grid() const { return m_grid; }
......@@ -116,7 +116,7 @@ class BufferSetImpl : public virtual BufferSet {
float m_image_size;
float m_cell_size;
float m_w_step;
std::array<float, 3> m_shift;
Array1D<float> m_shift;
size_t m_size;
size_t m_padded_size;
float m_kernel_size;
......
......@@ -72,12 +72,17 @@ void CPU::init_wtiles(float subgrid_size)
kernels.init_wtiles(subgrid_size);
}
void CPU::flush_wtiles() {
void CPU::flush_wtiles(int subgrid_size,
float image_size,
float w_step,
const Array1D<float> &shift)
{
// flush all pending Wtiles
WTileUpdateInfo wtile_flush_info = m_wtiles.clear();
if (wtile_flush_info.wtile_ids.size()) {
int grid_size = m_grid->get_x_dim();
kernels.run_adder_wtiles_to_grid(
m_grid_size, m_subgrid_size, m_image_size, m_w_step, m_shift,
grid_size, subgrid_size, image_size, w_step, shift.data(),
wtile_flush_info.wtile_ids.size(), wtile_flush_info.wtile_ids.data(),
wtile_flush_info.wtile_coordinates.data(), m_grid->data());
}
......
......@@ -49,7 +49,10 @@ class CPU : public Proxy {
virtual void init_wtiles(float subgrid_size) override;
virtual void flush_wtiles() override;
virtual void flush_wtiles(int subgrid_size,
float image_size,
float w_step,
const Array1D<float> &shift) override;
private:
unsigned int compute_jobsize(const Plan& plan,
......
......@@ -183,7 +183,7 @@ void GenericOptimized::run_gridding(
metadata_ptr, h_subgrids, grid_ptr);
} else if (plan.get_use_wtiles()) {
cpuKernels.run_adder_wtiles(current_nr_subgrids, grid_size,
subgrid_size, image_size, w_step, m_shift,
subgrid_size, image_size, w_step, shift.data(),
subgrid_offset, wtile_flush_set,
metadata_ptr, h_subgrids, grid_ptr);
subgrid_offset += current_nr_subgrids;
......@@ -472,7 +472,7 @@ void GenericOptimized::run_degridding(
} else if (plan.get_use_wtiles()) {
cpuKernels.run_splitter_wtiles(
current_nr_subgrids, grid_size, subgrid_size, image_size, w_step,
m_shift, subgrid_offset, wtile_initialize_set, metadata_ptr,
shift.data(), subgrid_offset, wtile_initialize_set, metadata_ptr,
h_subgrids, grid_ptr);
subgrid_offset += current_nr_subgrids;
} else {
......@@ -725,7 +725,7 @@ void GenericOptimized::do_calibrate_init(
WTileUpdateSet wtile_initialize_set =
plans[antenna_nr]->get_wtile_initialize_set();
cpuKernels.run_splitter_wtiles(
nr_subgrids, grid_size, subgrid_size, image_size, w_step, m_shift,
nr_subgrids, grid_size, subgrid_size, image_size, w_step, shift.data(),
0 /* subgrid_offset */, wtile_initialize_set, metadata_ptr,
subgrids_ptr, grid_ptr);
} else {
......
......@@ -233,7 +233,10 @@ class Proxy {
virtual void init_wtiles(float subgrid_size) {};
virtual void flush_wtiles() {};
virtual void flush_wtiles(int subgrid_size,
float image_size,
float w_step,
const Array1D<float> &shift) {};
//! Method W-tiling
virtual std::unique_ptr<Plan> make_plan(
......@@ -363,11 +366,6 @@ class Proxy {
virtual bool do_supports_wtiles() { return false; }
std::shared_ptr<Grid> m_grid = nullptr;
int m_grid_size;
int m_subgrid_size;
float m_image_size;
float m_w_step;
float m_shift[3];
Report report;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment