|
9 | 9 | #ifndef __APR_CONVERTER_HPP__ |
10 | 10 | #define __APR_CONVERTER_HPP__ |
11 | 11 |
|
| 12 | +#include <list> |
| 13 | + |
12 | 14 | #include "data_structures/APR/APR.hpp" |
13 | 15 | #include "data_structures/Mesh/PixelData.hpp" |
14 | 16 | #include "io/TiffUtils.hpp" |
@@ -234,38 +236,68 @@ inline bool APRConverter<ImageType>::get_apr_method(APR<ImageType> &aAPR, PixelD |
234 | 236 | APRTimer t(true); |
235 | 237 | t.start_timer(" =========== ALL"); |
236 | 238 | { |
237 | | - GpuProcessingTask<ImageType> gpt1(image_temp, local_scale_temp, par, bspline_offset, (*apr).level_max()); |
238 | | - gpt1.doAll(); |
239 | | - } |
240 | | - t.stop_timer(); |
241 | | - method_timer.stop_timer(); |
242 | | -#endif |
243 | 239 |
|
244 | | - method_timer.start_timer("initialize_particle_cell_tree"); |
245 | | - iPullingScheme.initialize_particle_cell_tree(aAPR.apr_access); |
246 | | - method_timer.stop_timer(); |
247 | 240 |
|
248 | | - method_timer.start_timer("compute_local_particle_set"); |
249 | | - get_local_particle_cell_set(local_scale_temp, local_scale_temp2); |
250 | | - method_timer.stop_timer(); |
| 241 | + std::vector<GpuProcessingTask<ImageType>> gpts; |
251 | 242 |
|
252 | | - method_timer.start_timer("compute_pulling_scheme"); |
253 | | - iPullingScheme.pulling_scheme_main(); |
254 | | - method_timer.stop_timer(); |
| 243 | + int n = 3; |
| 244 | + for (int i = 0; i < n; ++i) { |
| 245 | + gpts.emplace_back(GpuProcessingTask<ImageType>(image_temp, local_scale_temp, par, bspline_offset, (*apr).level_max())); |
| 246 | + gpts.back().sendDataToGpu(); |
| 247 | + gpts.back().processOnGpu(); |
| 248 | + } |
255 | 249 |
|
256 | | - method_timer.start_timer("downsample_pyramid"); |
257 | | - std::vector<PixelData<T>> downsampled_img; |
258 | | - //Down-sample the image for particle intensity estimation |
259 | | - downsamplePyrmaid(input_image, downsampled_img, aAPR.level_max(), aAPR.level_min()); |
260 | | - method_timer.stop_timer(); |
| 250 | + for (int i = 0; i < n * 2; ++i) { |
| 251 | + int c = i % n; |
| 252 | + gpts[c].getDataFromGpu(); |
| 253 | + |
| 254 | + // in theory we get new data and send them to task |
| 255 | + gpts[c].sendDataToGpu(); |
| 256 | + gpts[c].processOnGpu(); |
| 257 | + |
| 258 | + init_apr(aAPR, input_image); |
| 259 | + iPullingScheme.initialize_particle_cell_tree(aAPR.apr_access); |
| 260 | + PixelData<float> lst(local_scale_temp, true); |
| 261 | + get_local_particle_cell_set(lst, local_scale_temp2); |
| 262 | + iPullingScheme.pulling_scheme_main(); |
| 263 | + PixelData<T> inImg(input_image, true); |
| 264 | + std::vector<PixelData<T>> downsampled_img; |
| 265 | + downsamplePyrmaid(inImg, downsampled_img, aAPR.level_max(), aAPR.level_min()); |
| 266 | + aAPR.apr_access.initialize_structure_from_particle_cell_tree(aAPR.parameters, iPullingScheme.getParticleCellTree()); |
| 267 | + aAPR.get_parts_from_img(downsampled_img, aAPR.particles_intensities); |
| 268 | + } |
| 269 | + std::cout << "Total n ENDED" << std::endl; |
261 | 270 |
|
262 | | - method_timer.start_timer("compute_apr_datastructure"); |
263 | | - aAPR.apr_access.initialize_structure_from_particle_cell_tree(aAPR.parameters, iPullingScheme.getParticleCellTree()); |
| 271 | + } |
| 272 | + t.stop_timer(); |
264 | 273 | method_timer.stop_timer(); |
| 274 | +#endif |
265 | 275 |
|
266 | | - method_timer.start_timer("sample_particles"); |
267 | | - aAPR.get_parts_from_img(downsampled_img,aAPR.particles_intensities); |
268 | | - method_timer.stop_timer(); |
| 276 | +// method_timer.start_timer("initialize_particle_cell_tree"); |
| 277 | +// iPullingScheme.initialize_particle_cell_tree(aAPR.apr_access); |
| 278 | +// method_timer.stop_timer(); |
| 279 | +// |
| 280 | +// method_timer.start_timer("compute_local_particle_set"); |
| 281 | +// get_local_particle_cell_set(local_scale_temp, local_scale_temp2); |
| 282 | +// method_timer.stop_timer(); |
| 283 | +// |
| 284 | +// method_timer.start_timer("compute_pulling_scheme"); |
| 285 | +// iPullingScheme.pulling_scheme_main(); |
| 286 | +// method_timer.stop_timer(); |
| 287 | +// |
| 288 | +// method_timer.start_timer("downsample_pyramid"); |
| 289 | +// std::vector<PixelData<T>> downsampled_img; |
| 290 | +// //Down-sample the image for particle intensity estimation |
| 291 | +// downsamplePyrmaid(input_image, downsampled_img, aAPR.level_max(), aAPR.level_min()); |
| 292 | +// method_timer.stop_timer(); |
| 293 | +// |
| 294 | +// method_timer.start_timer("compute_apr_datastructure"); |
| 295 | +// aAPR.apr_access.initialize_structure_from_particle_cell_tree(aAPR.parameters, iPullingScheme.getParticleCellTree()); |
| 296 | +// method_timer.stop_timer(); |
| 297 | +// |
| 298 | +// method_timer.start_timer("sample_particles"); |
| 299 | +// aAPR.get_parts_from_img(downsampled_img,aAPR.particles_intensities); |
| 300 | +// method_timer.stop_timer(); |
269 | 301 |
|
270 | 302 | computation_timer.stop_timer(); |
271 | 303 |
|
|
0 commit comments