Commit b81adab6 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

[PROC][SMX] Use h5::saving_params to build writer/multi & io_hdf5_node

parent 0a48955b
......@@ -42,17 +42,11 @@ namespace processing::pipelines
{
using writer_t = io::multi<io::h5::writer_sparse>;
writer_body(std::filesystem::path base_path, std::string filename_format, std::string filename_prefix,
std::string filename_suffix, int start_number, int rank,
io::file_exists_policy_enum file_exists, int nb_frames, int nb_frames_per_file,
int nb_frames_per_chunk, int nb_bins, dimensions_t const& dimensions, lima::frame radius1d,
lima::frame radius2d_mask,
io::h5::compression_enum comp = io::h5::compression_enum::bshuf_lz4) :
m_writer(std::make_shared<writer_t>(base_path, filename_format, filename_prefix, filename_suffix,
start_number, rank, file_exists, nb_frames, nb_frames_per_file,
nb_frames_per_chunk, nb_bins, dimensions, radius1d,
radius2d_mask, comp)),
m_nb_frames_per_chunk(nb_frames_per_chunk)
writer_body(io::h5::saving_params const& params, int rank, int nb_frames, int nb_bins,
dimensions_t const& dimensions, lima::frame radius1d, lima::frame radius2d_mask) :
m_writer(std::make_shared<writer_t>(params, rank, nb_frames, nb_bins, dimensions, radius1d,
radius2d_mask)),
m_nb_frames_per_chunk(params.nb_frames_per_chunk)
{
}
......@@ -72,18 +66,13 @@ namespace processing::pipelines
int m_nb_frames_per_chunk = 0;
};
io_hdf5_sparse_node(tbb::flow::graph& g, std::filesystem::path base_path, std::string filename_format,
std::string filename_prefix, std::string filename_suffix, int start_number, int rank,
io::file_exists_policy_enum file_exists, int nb_frames, int nb_frames_per_file,
int nb_frames_per_chunk, int nb_bins, dimensions_t const& dimensions,
lima::frame radius1d, lima::frame radius2d_mask,
io::h5::compression_enum comp = io::h5::compression_enum::bshuf_lz4) :
io_hdf5_sparse_node(tbb::flow::graph& g, io::h5::saving_params const& params, int rank, int nb_frames,
int nb_bins, dimensions_t const& dimensions, lima::frame radius1d,
lima::frame radius2d_mask) :
parent_t(g),
sequencer_node(g, [](auto&& frame) -> int { return frame->metadata.idx; }),
writer_node(g, 1 /*serial for now*/,
writer_body(base_path, filename_format, filename_prefix, filename_suffix, start_number,
rank, file_exists, nb_frames, nb_frames_per_file, nb_frames_per_chunk, nb_bins,
dimensions, radius1d, radius2d_mask, comp))
writer_body(params, rank, nb_frames, nb_bins, dimensions, radius1d, radius2d_mask))
{
tbb::flow::make_edge(sequencer_node, writer_node);
typename parent_t::input_ports_type input_tuple(sequencer_node);
......
......@@ -142,26 +142,16 @@ namespace processing::pipelines
int nb_bins = params.csr_indptr.size() - 1;
// Dense HDF5 node
io_hdf5_dense.emplace(
m_graph, proc_params.saving_dense.base_path, proc_params.saving_dense.filename_format,
proc_params.saving_dense.filename_prefix, proc_params.saving_dense.filename_suffix,
proc_params.saving_dense.start_number, rank, proc_params.saving_dense.file_exists_policy,
acq_params.xfer.time_slice.count, proc_params.saving_dense.nb_frames_per_file,
proc_params.saving_dense.nb_frames_per_chunk, frame_info.dimensions(), frame_info.pixel_type(),
proc_params.saving_dense.compression);
io_hdf5_dense.emplace(m_graph, proc_params.saving_dense, rank, acq_params.xfer.time_slice.count,
frame_info.dimensions(), frame_info.pixel_type());
checkpoint_hdf5_dense.emplace(m_graph, tbb::flow::unlimited, m_nb_frames_dense_saved);
auto radius = read_radius1d(proc_params.fai.radius1d_path);
auto mask = read_radius2d_mask(proc_params.fai.radius2d_path, proc_params.fai.mask_path);
// Sparse HDF5 node
io_hdf5_sparse.emplace(
m_graph, proc_params.saving_sparse.base_path, proc_params.saving_sparse.filename_format,
proc_params.saving_sparse.filename_prefix, proc_params.saving_sparse.filename_suffix,
proc_params.saving_sparse.start_number, rank, proc_params.saving_sparse.file_exists_policy,
acq_params.xfer.time_slice.count, proc_params.saving_sparse.nb_frames_per_file,
proc_params.saving_sparse.nb_frames_per_chunk, nb_bins, frame_info.dimensions(), radius, mask,
proc_params.saving_sparse.compression);
io_hdf5_sparse.emplace(m_graph, proc_params.saving_sparse, rank, acq_params.xfer.time_slice.count,
nb_bins, frame_info.dimensions(), radius, mask);
checkpoint_hdf5_sparse.emplace(m_graph, tbb::flow::unlimited, m_nb_frames_sparse_saved);
// ROI counters node (optional)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment