Commit 5866b65e authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by Generic Bliss account for Control Software
Browse files

[PROC][SMX] Add independent saving stream activation

parent 6fa5fe08
Pipeline #77041 failed with stages
in 10 minutes and 8 seconds
......@@ -168,6 +168,14 @@ namespace processing::pipelines
(doc, "The path to the OpenCL kernels"))
// clang-format on
BOOST_DESCRIBE_STRUCT(saving_params, (io::h5::saving_params), (enabled))
// clang-format off
BOOST_ANNOTATE_MEMBER(saving_params, enabled,
(desc, "enabled"),
(doc, "Enable/disable the saving stream"))
// clang-format on
BOOST_DESCRIBE_STRUCT(proc_params, (),
(fifo, buffers, saving_dense, saving_sparse, saving_accumulation_corrected,
saving_accumulation_peak, gpu, jfrau, fai, counters))
......
......@@ -77,14 +77,19 @@ namespace processing::pipelines
std::filesystem::path cl_source_path = "detectors/processing/psi/src"; // CL source file path
};
struct saving_params : io::h5::saving_params
{
bool enabled = true;
};
struct proc_params
{
fifo_params fifo;
buffer_params buffers;
io::h5::saving_params saving_dense;
io::h5::saving_params saving_sparse;
io::h5::saving_params saving_accumulation_corrected;
io::h5::saving_params saving_accumulation_peak;
saving_params saving_dense;
saving_params saving_sparse;
saving_params saving_accumulation_corrected;
saving_params saving_accumulation_peak;
gpu_params gpu;
gain_pedestal_params jfrau;
fai_params fai;
......
......@@ -133,30 +133,42 @@ namespace processing::pipelines
int nb_bins = params.csr_indptr.size() - 1;
// Dense HDF5 node
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);
if (proc_params.saving_dense.enabled) {
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);
} else
m_nb_frames_dense_saved = -1;
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, 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);
if (proc_params.saving_sparse.enabled) {
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);
} else
m_nb_frames_sparse_saved = -1;
// Accumulation HDF5 node
auto do_acc = (proc_params.fai.acc_update_freq > 0);
if (do_acc) {
accum_split.emplace(m_graph);
auto acc_frames = (acq_params.xfer.time_slice.count - 1) / proc_params.fai.acc_update_freq + 1;
acc_saving_corrected.emplace(m_graph, proc_params.saving_accumulation_corrected, rank, acc_frames,
frame_info.dimensions(), pixel_enum::gray32f);
checkpoint_hdf5_acc_corrected.emplace(m_graph, tbb::flow::unlimited,
m_nb_frames_acc_corrected_saved);
acc_saving_peak.emplace(m_graph, proc_params.saving_accumulation_peak, rank, acc_frames,
frame_info.dimensions(), pixel_enum::gray32f);
checkpoint_hdf5_acc_peak.emplace(m_graph, tbb::flow::unlimited, m_nb_frames_acc_peak_saved);
if (proc_params.saving_accumulation_corrected.enabled) {
acc_saving_corrected.emplace(m_graph, proc_params.saving_accumulation_corrected, rank,
acc_frames, frame_info.dimensions(), pixel_enum::gray32f);
checkpoint_hdf5_acc_corrected.emplace(m_graph, tbb::flow::unlimited,
m_nb_frames_acc_corrected_saved);
} else
m_nb_frames_acc_corrected_saved = -1;
if (proc_params.saving_accumulation_peak.enabled) {
acc_saving_peak.emplace(m_graph, proc_params.saving_accumulation_peak, rank, acc_frames,
frame_info.dimensions(), pixel_enum::gray32f);
checkpoint_hdf5_acc_peak.emplace(m_graph, tbb::flow::unlimited, m_nb_frames_acc_peak_saved);
} else
m_nb_frames_acc_peak_saved = -1;
}
// ROI counters node (optional)
......@@ -170,21 +182,29 @@ namespace processing::pipelines
// Graph topology
tbb::flow::make_edge(*src, *peak_finder);
auto&& [sparse, acc] = peak_finder->output_ports();
tbb::flow::make_edge(sparse, *io_hdf5_sparse);
if (proc_params.saving_sparse.enabled) {
tbb::flow::make_edge(sparse, *io_hdf5_sparse);
tbb::flow::make_edge(*io_hdf5_sparse, *checkpoint_hdf5_sparse);
}
tbb::flow::make_edge(sparse, *peak_counter);
tbb::flow::make_edge(*peak_counter, *peak_counters_buffer);
tbb::flow::make_edge(sparse, *checkpoint_peak_finder);
tbb::flow::make_edge(*io_hdf5_sparse, *checkpoint_hdf5_sparse);
if (do_acc) {
tbb::flow::make_edge(acc, *accum_split);
auto&& [corr, peak] = accum_split->output_ports();
tbb::flow::make_edge(corr, *acc_saving_corrected);
tbb::flow::make_edge(*acc_saving_corrected, *checkpoint_hdf5_acc_corrected);
tbb::flow::make_edge(peak, *acc_saving_peak);
tbb::flow::make_edge(*acc_saving_peak, *checkpoint_hdf5_acc_peak);
if (proc_params.saving_accumulation_corrected.enabled) {
tbb::flow::make_edge(corr, *acc_saving_corrected);
tbb::flow::make_edge(*acc_saving_corrected, *checkpoint_hdf5_acc_corrected);
}
if (proc_params.saving_accumulation_peak.enabled) {
tbb::flow::make_edge(peak, *acc_saving_peak);
tbb::flow::make_edge(*acc_saving_peak, *checkpoint_hdf5_acc_peak);
}
}
if (proc_params.saving_dense.enabled) {
tbb::flow::make_edge(*src, *io_hdf5_dense);
tbb::flow::make_edge(*io_hdf5_dense, *checkpoint_hdf5_dense);
}
tbb::flow::make_edge(*src, *io_hdf5_dense);
tbb::flow::make_edge(*io_hdf5_dense, *checkpoint_hdf5_dense);
if (roi_counters) {
tbb::flow::make_edge(*src, *roi_counters);
......
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