2 #include <benchmark/benchmark.h>
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);
18 const t_real cellsize = FoV / cols * 60. * 60.;
19 const bool w_term =
false;
21 static t_uint counter = 0;
24 if ((counter % 10) == 1) {
25 auto sky_measurements = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
27 state.range(2), w_term);
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>>(
33 state.range(2), w_term);
34 auto end = std::chrono::high_resolution_clock::now();
39 state.SetBytesProcessed(int64_t(state.iterations()) * (number_of_vis + rows * cols) *
47 void SetUp(const ::benchmark::State &state) {
55 bool newMeasurements = m_uv_data.size() != state.range(1);
56 if (newMeasurements) {
62 bool newKernel = m_kernel != state.range(2);
63 if (newImage || newMeasurements || newKernel) {
65 const t_real cellsize = FoV / m_imsizex * 60. * 60.;
66 const bool w_term =
false;
67 m_kernel = state.range(2);
68 m_degridOperator = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
74 void TearDown(const ::benchmark::State &state) {}
109 if ((m_counter % 10) == 1) {
110 m_uv_data.vis = (*m_degridOperator) * Image<t_complex>::Map(m_image.data(), m_image.size(), 1);
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();
119 state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
125 if ((m_counter % 10) == 1) {
126 m_image = m_degridOperator->adjoint() * m_uv_data.vis;
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();
135 state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
141 ->Args({1024, 1000000, 4})
142 ->
Args({1024, 10000000, 4})
146 ->Unit(benchmark::kMillisecond);
150 ->Args({1024, 1000000, 4})
151 ->
Args({1024, 10000000, 4})
155 ->Unit(benchmark::kMillisecond);
void degrid_operator_ctor(benchmark::State &state)
BENCHMARK_DEFINE_F(DegridOperatorDirectFixture, Apply)(benchmark
Args({1024, 1000000, 4}) -> Args({1024, 10000000, 4}) ->UseManualTime() ->Repetitions(10) ->Unit(benchmark::kMillisecond)
Vector< t_complex > m_image
virtual bool updateImage(t_uint newSize)
virtual bool updateImage(t_uint newSize)
Image< t_complex > m_image
virtual bool updateImage(t_uint newSize)=0
void TearDown(const ::benchmark::State &state)
void SetUp(const ::benchmark::State &state)
utilities::vis_params m_uv_data
std::shared_ptr< sopt::LinearTransform< Vector< t_complex > > const > m_degridOperator
bool updateImage(t_uint newSize, Image< t_complex > &image, t_uint &sizex, t_uint &sizey)
bool updateEmptyImage(t_uint newSize, Vector< t_complex > &image, t_uint &sizex, t_uint &sizey)
double duration(std::chrono::high_resolution_clock::time_point start, std::chrono::high_resolution_clock::time_point end)
utilities::vis_params random_measurements(t_int size, const t_real max_w, const t_int id, const bool cache_visibilities)
const t_real pi
mathematical constant
utilities::vis_params random_sample_density(const t_int vis_num, const t_real mean, const t_real standard_deviation, const t_real rms_w)
Generates a random visibility coverage.