PURIFY
Next-generation radio interferometric imaging
Classes | Functions
measurement_operator_af.cc File Reference
#include <chrono>
#include <benchmark/benchmark.h>
#include "benchmarks/utilities.h"
#include "purify/operators_gpu.h"
+ Include dependency graph for measurement_operator_af.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 ({256, 500000, 4}) -> Args({512, 500000, 4}) ->Args({1024, 500000, 4}) ->Args({2048, 500000, 4}) ->UseManualTime() ->Repetitions(10) ->ReportAggregatesOnly(true) ->Unit(benchmark::kMillisecond)
 
 BENCHMARK_MAIN ()
 

Function Documentation

◆ Args()

Args ( {256, 500000, 4}  ) -> Args({512, 500000, 4}) ->Args({1024, 500000, 4}) ->Args({2048, 500000, 4}) ->UseManualTime() ->Repetitions(10) ->ReportAggregatesOnly(true) ->Unit(benchmark::kMillisecond)

◆ BENCHMARK_DEFINE_F() [1/2]

BENCHMARK_DEFINE_F ( DegridOperatorAdjointFixture  ,
Apply   
)

Definition at line 135 of file measurement_operator_af.cc.

135  {
136  // Benchmark the application of the adjoint operator
137  if ((m_counter % 10) == 1) {
138  m_image = m_degridOperator->adjoint() * m_uv_data.vis;
139  }
140  while (state.KeepRunning()) {
141  auto start = std::chrono::high_resolution_clock::now();
142  m_image = m_degridOperator->adjoint() * m_uv_data.vis;
143  auto end = std::chrono::high_resolution_clock::now();
144  state.SetIterationTime(b_utilities::duration(start, end));
145  }
146 
147  state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
148  sizeof(t_complex));
149 }
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 119 of file measurement_operator_af.cc.

119  {
120  // Benchmark the application of the operator
121  if ((m_counter % 10) == 1) {
122  m_uv_data.vis = (*m_degridOperator) * Image<t_complex>::Map(m_image.data(), m_image.size(), 1);
123  }
124  while (state.KeepRunning()) {
125  auto start = std::chrono::high_resolution_clock::now();
126  m_uv_data.vis = (*m_degridOperator) * Image<t_complex>::Map(m_image.data(), m_image.size(), 1);
127  auto end = std::chrono::high_resolution_clock::now();
128  state.SetIterationTime(b_utilities::duration(start, end));
129  }
130 
131  state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
132  sizeof(t_complex));
133 }

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_af.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  // benchmark the creation of measurement operator
21  while (state.KeepRunning()) {
22  auto start = std::chrono::high_resolution_clock::now();
23 #ifdef PURIFY_CPU
24  auto sky_measurements = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
25  uv_data, rows, cols, cellsize, cellsize, 2, kernels::kernel::kb, state.range(2),
26  state.range(2), w_term);
27 #else
29  uv_data, rows, cols, cellsize, cellsize, 2, kernels::kernel::kb, state.range(2),
30  state.range(2), w_term);
31 
32 #endif
33  auto end = std::chrono::high_resolution_clock::now();
34 
35  state.SetIterationTime(b_utilities::duration(start, end));
36  }
37 
38  state.SetBytesProcessed(int64_t(state.iterations()) * (number_of_vis + rows * cols) *
39  sizeof(t_complex));
40 }
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
std::shared_ptr< sopt::LinearTransform< T > > init_degrid_operator_2d(const Vector< t_real > &u, const Vector< t_real > &v, const Vector< t_real > &w, const Vector< t_complex > &weights, const t_uint &imsizey, const t_uint &imsizex, const t_real &oversample_ratio=2, const kernels::kernel kernel=kernels::kernel::kb, const t_uint Ju=4, const t_uint Jv=4, const bool w_stacking=false, const t_real &cellx=1, const t_real &celly=1)
Returns linear transform that is the standard degridding operator.
Definition: operators.h:608

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