Commit fdba5bf0 authored by Bram Veenboer's avatar Bram Veenboer

Apply clang formatting

parent 088faa3c
Pipeline #8169 passed with stages
in 17 minutes and 41 seconds
......@@ -65,18 +65,14 @@ std::unique_ptr<Plan> CPU::make_plan(
}
}
void CPU::init_wtiles(float subgrid_size)
{
void CPU::init_wtiles(float subgrid_size) {
m_wtiles = WTiles(kernel::cpu::InstanceCPU::kNrWTiles,
kernel::cpu::InstanceCPU::kWTileSize);
kernels.init_wtiles(subgrid_size);
}
void CPU::flush_wtiles(int subgrid_size,
float image_size,
float w_step,
const Array1D<float> &shift)
{
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()) {
......@@ -651,7 +647,7 @@ void CPU::do_transform(DomainAtoDomainB direction) {
#endif
try {
const auto& grid = get_grid();
const auto &grid = get_grid();
// Constants
unsigned int nr_w_layers = grid->get_w_dim();
......@@ -662,13 +658,12 @@ void CPU::do_transform(DomainAtoDomainB direction) {
report.initialize(0, 0, grid_size);
kernels.set_report(report);
for (unsigned int w = 0; w < nr_w_layers; w++)
{
for (unsigned int w = 0; w < nr_w_layers; w++) {
int sign = (direction == FourierDomainToImageDomain) ? 1 : -1;
// Grid pointer
idg::Array3D<std::complex<float>> grid_ptr(grid->data(w), nr_correlations,
grid_size, grid_size);
grid_size, grid_size);
// Constants
auto grid_size = grid->get_x_dim();
......
......@@ -49,10 +49,8 @@ class CPU : public Proxy {
virtual void init_wtiles(float subgrid_size) override;
virtual void flush_wtiles(int subgrid_size,
float image_size,
float w_step,
const Array1D<float> &shift) 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,
......
......@@ -451,8 +451,7 @@ void CUDA::initialize(
marker.end();
} // end initialize
void CUDA::do_transform(DomainAtoDomainB direction)
{
void CUDA::do_transform(DomainAtoDomainB direction) {
#if defined(DEBUG)
std::cout << "CUDA::" << __func__ << std::endl;
#endif
......@@ -468,7 +467,7 @@ void CUDA::do_transform(DomainAtoDomainB direction)
// Grid pointer (4D to 3D, assume nr_w_layers == 1)
idg::Array3D<std::complex<float>> grid_ptr(grid->data(), nr_correlations,
grid_size, grid_size);
grid_size, grid_size);
// Load device
InstanceCUDA& device = get_device(0);
......@@ -518,7 +517,6 @@ void CUDA::do_transform(DomainAtoDomainB direction)
report.update_host(powerStates[0], powerStates[1]);
report.print_total();
report.print_device(powerStates[2], powerStates[3]);
}
void CUDA::do_compute_avg_beam(
......
......@@ -182,10 +182,10 @@ void GenericOptimized::run_gridding(
cpuKernels.run_adder(current_nr_subgrids, grid_size, subgrid_size,
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, shift.data(),
subgrid_offset, wtile_flush_set,
metadata_ptr, h_subgrids, grid_ptr);
cpuKernels.run_adder_wtiles(
current_nr_subgrids, grid_size, subgrid_size, image_size, w_step,
shift.data(), subgrid_offset, wtile_flush_set, metadata_ptr,
h_subgrids, grid_ptr);
subgrid_offset += current_nr_subgrids;
} else {
cpuKernels.run_adder_wstack(current_nr_subgrids, grid_size,
......@@ -725,9 +725,9 @@ 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, shift.data(),
0 /* subgrid_offset */, wtile_initialize_set, metadata_ptr,
subgrids_ptr, grid_ptr);
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 {
cpuKernels.run_splitter_wstack(nr_subgrids, grid_size, subgrid_size,
metadata_ptr, subgrids_ptr, grid_ptr);
......
......@@ -412,9 +412,7 @@ void Proxy::set_avg_aterm_correction(
void Proxy::unset_avg_aterm_correction() { m_avg_aterm_correction.resize(0); }
void Proxy::transform(DomainAtoDomainB direction) {
do_transform(direction);
}
void Proxy::transform(DomainAtoDomainB direction) { do_transform(direction); }
void Proxy::transform(DomainAtoDomainB direction, std::complex<float>* grid_ptr,
unsigned int grid_nr_correlations,
......@@ -424,8 +422,9 @@ void Proxy::transform(DomainAtoDomainB direction, std::complex<float>* grid_ptr,
unsigned int grid_nr_w_layers = 1; // TODO: make this a parameter
auto grid = std::shared_ptr<Grid>(
new Grid(grid_ptr, grid_nr_w_layers, grid_nr_correlations, grid_height, grid_width));
auto grid = std::shared_ptr<Grid>(new Grid(grid_ptr, grid_nr_w_layers,
grid_nr_correlations, grid_height,
grid_width));
set_grid(grid);
......@@ -535,8 +534,7 @@ std::shared_ptr<Grid> Proxy::allocate_grid(size_t nr_w_layers,
void Proxy::set_grid(std::shared_ptr<idg::Grid> grid) {
// Don't create a new shared_ptr when the grid data pointer is
// the same. This can be the case when the C-interface is used.
if (!m_grid || m_grid->data() != grid->data())
{
if (!m_grid || m_grid->data() != grid->data()) {
m_grid = grid;
}
}
......
......@@ -231,12 +231,10 @@ class Proxy {
virtual std::shared_ptr<Grid> get_grid();
virtual void init_wtiles(float subgrid_size) {};
virtual void init_wtiles(float subgrid_size){};
virtual void flush_wtiles(int subgrid_size,
float image_size,
float w_step,
const Array1D<float> &shift) {};
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(
......@@ -318,7 +316,7 @@ class Proxy {
Array2D<float>& parameter_vector) {}
//! Applyies (inverse) Fourier transform to grid
virtual void do_transform(DomainAtoDomainB direction) {};
virtual void do_transform(DomainAtoDomainB direction){};
virtual void do_compute_avg_beam(
const unsigned int nr_antennas, const unsigned int nr_channels,
......
......@@ -181,32 +181,24 @@ void* Proxy_allocate_grid(Proxy* p, unsigned int nr_correlations,
return grid->data();
}
void Proxy_set_grid(Proxy* p,
std::complex<float>* grid_ptr,
unsigned int nr_w_layers,
unsigned int nr_correlations,
unsigned int height,
unsigned int width)
{
std::shared_ptr<idg::Grid> grid =
std::shared_ptr<idg::Grid>(new idg::Grid(grid_ptr, nr_w_layers, nr_correlations, height, width));
reinterpret_cast<idg::proxy::Proxy*>(p)->set_grid(grid);
void Proxy_set_grid(Proxy* p, std::complex<float>* grid_ptr,
unsigned int nr_w_layers, unsigned int nr_correlations,
unsigned int height, unsigned int width) {
std::shared_ptr<idg::Grid> grid = std::shared_ptr<idg::Grid>(
new idg::Grid(grid_ptr, nr_w_layers, nr_correlations, height, width));
reinterpret_cast<idg::proxy::Proxy*>(p)->set_grid(grid);
}
void Proxy_get_grid(Proxy* p,
std::complex<float>* grid_ptr,
unsigned int nr_w_layers,
unsigned int nr_correlations,
unsigned int height,
unsigned int width)
{
std::shared_ptr<idg::Grid> grid =
reinterpret_cast<idg::proxy::Proxy*>(p)->get_grid();
assert(grid->get_w_dim() == nr_w_layers);
assert(grid->get_z_dim() == nr_correlations);
assert(grid->get_y_dim() == height);
assert(grid->get_x_dim() == width);
memcpy(grid_ptr, grid->data(), grid->bytes());
void Proxy_get_grid(Proxy* p, std::complex<float>* grid_ptr,
unsigned int nr_w_layers, unsigned int nr_correlations,
unsigned int height, unsigned int width) {
std::shared_ptr<idg::Grid> grid =
reinterpret_cast<idg::proxy::Proxy*>(p)->get_grid();
assert(grid->get_w_dim() == nr_w_layers);
assert(grid->get_z_dim() == nr_correlations);
assert(grid->get_y_dim() == height);
assert(grid->get_x_dim() == width);
memcpy(grid_ptr, grid->data(), grid->bytes());
}
} // end extern "C"
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