PURIFY
Next-generation radio interferometric imaging
Classes | Functions
measurement_operator.cc File Reference
#include <chrono>
#include <benchmark/benchmark.h>
#include "benchmarks/utilities.h"
#include "purify/operators.h"
+ Include dependency graph for measurement_operator.cc:

Go to the source code of this file.

Classes

class  DegridOperatorFixture
 
class  DegridOperatorDirectFixture
 
class  DegridOperatorAdjointFixture
 

Functions

void degrid_operator_ctor (benchmark::State &state)
 
 BENCHMARK_DEFINE_F (DegridOperatorDirectFixture, Apply)(benchmark
 
 BENCHMARK_DEFINE_F (DegridOperatorAdjointFixture, Apply)(benchmark
 
 Args ({1024, 1000000, 4}) -> Args({1024, 10000000, 4}) ->UseManualTime() ->Repetitions(10) ->Unit(benchmark::kMillisecond)
 
 BENCHMARK_MAIN ()
 

Function Documentation

◆ Args()

Args ( {1024, 1000000, 4}  ) -> Args({1024, 10000000, 4}) ->UseManualTime() ->Repetitions(10) ->Unit(benchmark::kMillisecond)

◆ BENCHMARK_DEFINE_F() [1/2]

BENCHMARK_DEFINE_F ( DegridOperatorAdjointFixture  ,
Apply   
)

Definition at line 123 of file measurement_operator.cc.

123  {
124  // Benchmark the application of the adjoint operator
125  if ((m_counter % 10) == 1) {
126  m_image = m_degridOperator->adjoint() * m_uv_data.vis;
127  }
128  while (state.KeepRunning()) {
129  auto start = std::chrono::high_resolution_clock::now();
130  m_image = m_degridOperator->adjoint() * m_uv_data.vis;
131  auto end = std::chrono::high_resolution_clock::now();
132  state.SetIterationTime(b_utilities::duration(start, end));
133  }
134 
135  state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
136  sizeof(t_complex));
137 }
double duration(std::chrono::high_resolution_clock::time_point start, std::chrono::high_resolution_clock::time_point end)
Definition: utilities.cc:26

References b_utilities::duration().

◆ BENCHMARK_DEFINE_F() [2/2]

BENCHMARK_DEFINE_F ( DegridOperatorDirectFixture  ,
Apply   
)

Definition at line 107 of file measurement_operator.cc.

107  {
108  // Benchmark the application of the operator
109  if ((m_counter % 10) == 1) {
110  m_uv_data.vis = (*m_degridOperator) * Image<t_complex>::Map(m_image.data(), m_image.size(), 1);
111  }
112  while (state.KeepRunning()) {
113  auto start = std::chrono::high_resolution_clock::now();
114  m_uv_data.vis = (*m_degridOperator) * Image<t_complex>::Map(m_image.data(), m_image.size(), 1);
115  auto end = std::chrono::high_resolution_clock::now();
116  state.SetIterationTime(b_utilities::duration(start, end));
117  }
118 
119  state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
120  sizeof(t_complex));
121 }

References b_utilities::duration().

◆ BENCHMARK_MAIN()

BENCHMARK_MAIN ( )

◆ degrid_operator_ctor()

void degrid_operator_ctor ( benchmark::State &  state)

Definition at line 10 of file measurement_operator.cc.

10  {
11  // Generating random uv(w) coverage
12  t_int const rows = state.range(0);
13  t_int const cols = state.range(0);
14  t_int const number_of_vis = state.range(1);
15  auto uv_data = b_utilities::random_measurements(number_of_vis);
16 
17  const t_real FoV = 1; // deg
18  const t_real cellsize = FoV / cols * 60. * 60.;
19  const bool w_term = false;
20  // Keep count of the benchmark repetitions
21  static t_uint counter = 0;
22  counter++;
23  // benchmark the creation of measurement operator
24  if ((counter % 10) == 1) {
25  auto sky_measurements = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
26  uv_data, rows, cols, cellsize, cellsize, 2, kernels::kernel::kb, state.range(2),
27  state.range(2), w_term);
28  }
29  while (state.KeepRunning()) {
30  auto start = std::chrono::high_resolution_clock::now();
31  auto sky_measurements = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
32  uv_data, rows, cols, cellsize, cellsize, 2, kernels::kernel::kb, state.range(2),
33  state.range(2), w_term);
34  auto end = std::chrono::high_resolution_clock::now();
35 
36  state.SetIterationTime(b_utilities::duration(start, end));
37  }
38 
39  state.SetBytesProcessed(int64_t(state.iterations()) * (number_of_vis + rows * cols) *
40  sizeof(t_complex));
41 }
utilities::vis_params random_measurements(t_int size, const t_real max_w, const t_int id, const bool cache_visibilities)
Definition: utilities.cc:96

References b_utilities::duration(), purify::kernels::kb, and b_utilities::random_measurements().