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 while (state.KeepRunning()) {
22 auto start = std::chrono::high_resolution_clock::now();
24 auto sky_measurements = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
26 state.range(2), w_term);
30 state.range(2), w_term);
33 auto end = std::chrono::high_resolution_clock::now();
38 state.SetBytesProcessed(int64_t(state.iterations()) * (number_of_vis + rows * cols) *
55 void SetUp(const ::benchmark::State &state) {
57 af::setBackend(AF_BACKEND_CUDA);
68 bool newKernel = m_kernel != state.range(2);
69 if (newImage || newMeasurements || newKernel) {
71 const t_real cellsize = FoV / m_imsizex * 60. * 60.;
72 const bool w_term =
false;
73 m_kernel = state.range(2);
75 m_degridOperator = measurementoperator::init_degrid_operator_2d<Vector<t_complex>>(
86 void TearDown(const ::benchmark::State &state) {}
98 std::shared_ptr<sopt::LinearTransform<Vector<t_complex>>
const> m_degridOperator;
107 Image<t_complex> m_image;
116 Vector<t_complex> m_image;
121 if ((m_counter % 10) == 1) {
122 m_uv_data.vis = (*m_degridOperator) * Image<t_complex>::Map(m_image.data(), m_image.size(), 1);
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();
131 state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
137 if ((m_counter % 10) == 1) {
138 m_image = m_degridOperator->adjoint() * m_uv_data.vis;
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();
147 state.SetBytesProcessed(int64_t(state.iterations()) * (state.range(1) + m_imsizey * m_imsizex) *
153 ->Args({256, 500000, 4})
154 ->
Args({512, 500000, 4})
155 ->
Args({1024, 500000, 4})
156 ->
Args({2048, 500000, 4})
160 ->ReportAggregatesOnly(
true)
161 ->Unit(benchmark::kMillisecond);
165 ->Args({256, 500000, 4})
166 ->
Args({512, 500000, 4})
167 ->
Args({1024, 500000, 4})
168 ->
Args({2048, 500000, 4})
172 ->ReportAggregatesOnly(
true)
173 ->Unit(benchmark::kMillisecond);
virtual bool updateImage(t_uint newSize)
virtual bool updateImage(t_uint newSize)
virtual bool updateImage(t_uint newSize)=0
void TearDown(const ::benchmark::State &state)
void SetUp(const ::benchmark::State &state)
Args({256, 500000, 4}) -> Args({512, 500000, 4}) ->Args({1024, 500000, 4}) ->Args({2048, 500000, 4}) ->UseManualTime() ->Repetitions(10) ->ReportAggregatesOnly(true) ->Unit(benchmark::kMillisecond)
void degrid_operator_ctor(benchmark::State &state)
BENCHMARK_DEFINE_F(DegridOperatorDirectFixture, Apply)(benchmark
bool updateMeasurements(t_uint newSize, utilities::vis_params &data)
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)
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.