Skip to content
Snippets Groups Projects
Unverified Commit 1b0f14f0 authored by André Offringa's avatar André Offringa Committed by GitHub
Browse files

Account for nterms in calculating size of visbuffer for IDG (#215)

parent 9cacb42e
Branches
No related tags found
No related merge requests found
...@@ -90,6 +90,7 @@ public: ...@@ -90,6 +90,7 @@ public:
{ {
_buffersets.clear(); _buffersets.clear();
idg::api::Type proxyType = idg::api::Type::CPU_OPTIMIZED; idg::api::Type proxyType = idg::api::Type::CPU_OPTIMIZED;
size_t nTerms = _readers.size();
size_t maxChannels = 0; size_t maxChannels = 0;
for(std::vector<double>& band : _bands) for(std::vector<double>& band : _bands)
...@@ -99,14 +100,14 @@ public: ...@@ -99,14 +100,14 @@ public:
uint64_t memPerTimestep = idg::api::BufferSet::get_memory_per_timestep(_nr_stations, maxChannels); uint64_t memPerTimestep = idg::api::BufferSet::get_memory_per_timestep(_nr_stations, maxChannels);
memPerTimestep *= 2; // IDG uses two internal buffer memPerTimestep *= 2; // IDG uses two internal buffer
// Allow the directions together to use 1/4th of the available memory for the vis buffers. // Allow the directions together to use 1/4th of the available memory for the vis buffers.
size_t allocatableTimesteps = memory/4/_images.size() / memPerTimestep; size_t allocatableTimesteps = memory/4/_images.size()/nTerms / memPerTimestep;
// TODO once a-terms are supported, this should include the size required for the a-terms. // TODO once a-terms are supported, this should include the size required for the a-terms.
std::cout << "Allocatable timesteps per direction: " << allocatableTimesteps << '\n'; std::cout << "Allocatable timesteps per direction: " << allocatableTimesteps << '\n';
int buffersize = std::max(allocatableTimesteps, size_t(1)); int buffersize = std::max(allocatableTimesteps, size_t(1));
idg::api::options_type options; idg::api::options_type options;
IdgConfiguration::Read(proxyType, buffersize, options); IdgConfiguration::Read(proxyType, buffersize, options);
std::vector<ao::uvector<double>> data(_readers.size()); std::vector<ao::uvector<double>> data(nTerms);
_metaData.clear(); _metaData.clear();
FitsReader& reader = _readers.front(); FitsReader& reader = _readers.front();
for(FacetImage& img : _images) for(FacetImage& img : _images)
...@@ -118,7 +119,7 @@ public: ...@@ -118,7 +119,7 @@ public:
std::cout << "Initializing gridder " << _buffersets.size() << " (" << img.Width() << " x " << img.Height() << ", +" << img.OffsetX() << "," << img.OffsetY() << ", dl=" << dl*180.0/M_PI << " deg, dm=" << dm*180.0/M_PI << " deg)\n"; std::cout << "Initializing gridder " << _buffersets.size() << " (" << img.Width() << " x " << img.Height() << ", +" << img.OffsetX() << "," << img.OffsetY() << ", dl=" << dl*180.0/M_PI << " deg, dm=" << dm*180.0/M_PI << " deg)\n";
// TODO make full polarization // TODO make full polarization
for(size_t term=0; term!=data.size(); ++term) for(size_t term=0; term!=nTerms; ++term)
{ {
data[term].assign(img.Width() * img.Height() * 4, 0.0); data[term].assign(img.Width() * img.Height() * 4, 0.0);
std::copy(img.Data(term), img.Data(term)+img.Width()*img.Height(), data[term].data()); std::copy(img.Data(term), img.Data(term)+img.Width()*img.Height(), data[term].data());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment