Commit 38f63ce9 authored by Martin Reinecke's avatar Martin Reinecke

save memory during gridding

parent 6e7e6690
...@@ -651,7 +651,7 @@ class GridderConfig ...@@ -651,7 +651,7 @@ class GridderConfig
grid2dirty_post(tmav, dirty); grid2dirty_post(tmav, dirty);
} }
template<typename T> void grid2dirty_c(const mav<const complex<T>,2> &grid, mav<complex<T>,2> &dirty) const template<typename T> void grid2dirty_c(const const_mav<complex<T>,2> &grid, mav<complex<T>,2> &dirty) const
{ {
checkShape(grid.shape(), {nu,nv}); checkShape(grid.shape(), {nu,nv});
tmpStorage<complex<T>,2> tmpdat({nu,nv}); tmpStorage<complex<T>,2> tmpdat({nu,nv});
...@@ -663,6 +663,16 @@ class GridderConfig ...@@ -663,6 +663,16 @@ class GridderConfig
grid2dirty_post(tmp, dirty); grid2dirty_post(tmp, dirty);
} }
template<typename T> void grid2dirty_c_overwrite(const mav<complex<T>,2> &grid, mav<complex<T>,2> &dirty) const
{
checkShape(grid.shape(), {nu,nv});
constexpr auto sc = ptrdiff_t(sizeof(complex<T>));
pocketfft::c2c({nu,nv},{grid.stride(0)*sc,grid.stride(1)*sc},
{grid.stride(0)*sc, grid.stride(1)*sc}, {0,1}, pocketfft::BACKWARD,
grid.data(), grid.data(), T(1), nthreads);
grid2dirty_post(grid, dirty);
}
template<typename T> void dirty2grid_pre(const const_mav<T,2> &dirty, mav<T,2> &grid) const template<typename T> void dirty2grid_pre(const const_mav<T,2> &dirty, mav<T,2> &grid) const
{ {
checkShape(dirty.shape(), {nx_dirty, ny_dirty}); checkShape(dirty.shape(), {nx_dirty, ny_dirty});
...@@ -1448,7 +1458,7 @@ template<typename T, typename Serv> void x2dirty( ...@@ -1448,7 +1458,7 @@ template<typename T, typename Serv> void x2dirty(
if (hlp.Nvis()==0) continue; if (hlp.Nvis()==0) continue;
grid.fill(0); grid.fill(0);
x2grid_c(gconf, hlp.getSubserv(), grid, hlp.W(), dw); x2grid_c(gconf, hlp.getSubserv(), grid, hlp.W(), dw);
gconf.grid2dirty_c(cmav(grid), tdirty); gconf.grid2dirty_c_overwrite(grid, tdirty);
gconf.apply_wscreen(cmav(tdirty), tdirty, hlp.W(), true); gconf.apply_wscreen(cmav(tdirty), tdirty, hlp.W(), true);
#pragma omp parallel for num_threads(nthreads) #pragma omp parallel for num_threads(nthreads)
for (size_t i=0; i<gconf.Nxdirty(); ++i) for (size_t i=0; i<gconf.Nxdirty(); ++i)
......
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