Skip to content

Commit

Permalink
renamed Scheduler and related files and structs
Browse files Browse the repository at this point in the history
  • Loading branch information
RalphSteinhagen committed Oct 11, 2023
1 parent b33ba38 commit 8c54244
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 157 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ if (ENABLE_TESTING AND UNIX AND NOT APPLE)
setup_target_for_coverage_gcovr_xml(
NAME coverage
EXECUTABLE ctest
DEPENDENCIES qa_buffer qa_data_sink qa_DynamicPort qa_DynamicBlock qa_HierBlock qa_filter qa_settings qa_tags qa_scheduler qa_thread_pool qa_thread_affinity
DEPENDENCIES qa_buffer qa_data_sink qa_DynamicPort qa_DynamicBlock qa_HierBlock qa_filter qa_settings qa_tags qa_Scheduler qa_thread_pool qa_thread_affinity
EXCLUDE "$CMAKE_BUILD_DIR/*" "concepts/.*" ".*/test/.*")
setup_target_for_coverage_gcovr_html(
NAME coverage_html
EXECUTABLE ctest
DEPENDENCIES qa_buffer qa_data_sink qa_DynamicPort qa_DynamicBlock qa_HierBlock qa_filter qa_settings qa_tags qa_scheduler qa_thread_pool qa_thread_affinity
DEPENDENCIES qa_buffer qa_data_sink qa_DynamicPort qa_DynamicBlock qa_HierBlock qa_filter qa_settings qa_tags qa_Scheduler qa_thread_pool qa_thread_affinity
EXCLUDE "$CMAKE_BUILD_DIR/*" "concepts/.*" ".*/test/.*")
endif ()
message("Building Tests and benchmarks.")
Expand Down
34 changes: 17 additions & 17 deletions blocks/basic/test/qa_data_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <gnuradio-4.0/buffer.hpp>
#include <gnuradio-4.0/Graph.hpp>
#include <gnuradio-4.0/reflection.hpp>
#include <gnuradio-4.0/scheduler.hpp>
#include <gnuradio-4.0/Scheduler.hpp>

#include <gnuradio-4.0/basic/data_sink.hpp>

Expand Down Expand Up @@ -300,8 +300,8 @@ const boost::ut::suite DataSinkTests = [] {
expect(data_sink_registry::instance().register_streaming_callback<float>(data_sink_query::sink_name("test_sink"), chunk_size, callback_with_tags));
expect(data_sink_registry::instance().register_streaming_callback<float>(data_sink_query::sink_name("test_sink"), chunk_size, callback_with_tags_and_sink));

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -362,8 +362,8 @@ const boost::ut::suite DataSinkTests = [] {
return std::make_tuple(received, received_tags);
});

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -429,8 +429,8 @@ const boost::ut::suite DataSinkTests = [] {
return std::make_tuple(received_data, received_tags);
});

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -502,8 +502,8 @@ const boost::ut::suite DataSinkTests = [] {
return received_data;
});

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -584,8 +584,8 @@ const boost::ut::suite DataSinkTests = [] {
results.push_back(std::move(f));
}

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -637,8 +637,8 @@ const boost::ut::suite DataSinkTests = [] {
return std::make_tuple(received_data, received_tags);
});

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -679,8 +679,8 @@ const boost::ut::suite DataSinkTests = [] {

data_sink_registry::instance().register_trigger_callback<float>(data_sink_query::sink_name("test_sink"), is_trigger, 3000, 2000, callback);

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down Expand Up @@ -721,8 +721,8 @@ const boost::ut::suite DataSinkTests = [] {
return samples_seen;
});

gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();

sink.stop(); // TODO the scheduler should call this

Expand Down
6 changes: 3 additions & 3 deletions blocks/basic/test/qa_sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <gnuradio-4.0/Block.hpp>
#include <gnuradio-4.0/Graph.hpp>
#include <gnuradio-4.0/scheduler.hpp>
#include <gnuradio-4.0/Scheduler.hpp>
#include <gnuradio-4.0/tag.hpp>

#include <gnuradio-4.0/basic/clock_source.hpp>
Expand Down Expand Up @@ -41,11 +41,11 @@ const boost::ut::suite TagTests = [] {
expect(eq(ConnectionResult::SUCCESS, testGraph.connect<"out">(src).to<"in">(sink1)));
expect(eq(ConnectionResult::SUCCESS, testGraph.connect<"out">(src).to<"in">(sink2)));

scheduler::simple sched{ std::move(testGraph) };
scheduler::Simple sched{ std::move(testGraph) };
if constexpr (!useIoThreadPool) {
src.tryStartThread();
}
sched.run_and_wait();
sched.runAndWait();
if constexpr (!useIoThreadPool) {
src.stopThread();
}
Expand Down
8 changes: 4 additions & 4 deletions blocks/fourier/test/qa_fourier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <gnuradio-4.0/Block.hpp>
#include <gnuradio-4.0/Graph.hpp>
#include <gnuradio-4.0/scheduler.hpp>
#include <gnuradio-4.0/Scheduler.hpp>

#include <gnuradio-4.0/algorithm/fourier/fft.hpp>
#include <gnuradio-4.0/algorithm/fourier/fftw.hpp>
Expand Down Expand Up @@ -276,7 +276,7 @@ const boost::ut::suite<"Fourier Transforms"> fftTests = [] {
"FFT flow graph example"_test = [] {
// This test checks how fftw works if one creates and destroys several fft blocks in different graph flows
using namespace boost::ut;
using Scheduler = gr::scheduler::simple<>;
using Scheduler = gr::scheduler::Simple<>;
auto threadPool = std::make_shared<gr::thread_pool::BasicThreadPool>("custom pool", gr::thread_pool::CPU_BOUND, 2, 2);
gr::Graph flow1;
auto &source1 = flow1.emplaceBlock<CountSource<double>>();
Expand All @@ -291,10 +291,10 @@ const boost::ut::suite<"Fourier Transforms"> fftTests = [] {
auto &fft2 = flow2.emplaceBlock<FFT<double>>({ { "fftSize", static_cast<std::uint32_t>(16) } });
std::ignore = flow2.connect<"out">(source2).to<"in">(fft2);
auto sched2 = Scheduler(std::move(flow2), threadPool);
sched2.run_and_wait();
sched2.runAndWait();
expect(approx(source2.count, source2.nSamples, 1e-4));
}
sched1.run_and_wait();
sched1.runAndWait();
expect(approx(source1.count, source1.nSamples, 1e-4));
};

Expand Down
34 changes: 17 additions & 17 deletions core/benchmarks/bm_node_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// #include <gnuradio-4.0/BlockTraits.hpp> // TODO: fix header recursion (if this is enabled instead of the next one)
#include <gnuradio-4.0/Block.hpp>
#include <gnuradio-4.0/Graph.hpp>
#include <gnuradio-4.0/scheduler.hpp>
#include <gnuradio-4.0/Scheduler.hpp>

#include <gnuradio-4.0/testing/bm_test_helper.hpp>

Expand Down Expand Up @@ -480,7 +480,7 @@ invoke_work(auto &sched) {
using namespace benchmark;
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
sched.run_and_wait();
sched.runAndWait();
expect(eq(test::n_samples_produced, N_SAMPLES)) << "did not produce enough output samples";
expect(eq(test::n_samples_consumed, N_SAMPLES)) << "did not consume enough input samples";
}
Expand All @@ -495,7 +495,7 @@ inline const boost::ut::suite _runtime_tests = [] {
auto &sink = testGraph.emplaceBlock<test::sink<float>>();
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(src).to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

"runtime src->sink overhead"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched]() { invoke_work(sched); };
}
Expand All @@ -509,7 +509,7 @@ inline const boost::ut::suite _runtime_tests = [] {
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect(src, &test::source<float>::out).to<"in">(cpy)));
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(cpy).to(sink, &test::sink<float>::in)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

"runtime src->copy->sink"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched]() { invoke_work(sched); };
}
Expand All @@ -533,7 +533,7 @@ inline const boost::ut::suite _runtime_tests = [] {

expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(*cpy[cpy.size() - 1]).to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

"runtime src->copy^10->sink"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched]() { invoke_work(sched); };
}
Expand All @@ -551,7 +551,7 @@ inline const boost::ut::suite _runtime_tests = [] {
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(b2).to<"in">(b3)));
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(b3).to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

"runtime src(N=1024)->b1(N≤128)->b2(N=1024)->b3(N=32...128)->sink"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched]() { invoke_work(sched); };
}
Expand All @@ -569,7 +569,7 @@ inline const boost::ut::suite _runtime_tests = [] {
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(div).template to<"in">(add1)));
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(add1).template to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

::benchmark::benchmark<1LU>{ test_name }.repeat<N_ITER>(N_SAMPLES) = [&sched]() { invoke_work(sched); };
};
Expand Down Expand Up @@ -601,12 +601,12 @@ inline const boost::ut::suite _runtime_tests = [] {
}
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(*add1[add1.size() - 1]).template to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

::benchmark::benchmark<1LU>{ test_name }.repeat<N_ITER>(N_SAMPLES) = [&sched]() {
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
sched.run_and_wait();
sched.runAndWait();
expect(eq(test::n_samples_produced, N_SAMPLES)) << "did not produce enough output samples";
expect(eq(test::n_samples_consumed, N_SAMPLES)) << "did not consume enough input samples";
};
Expand All @@ -632,12 +632,12 @@ inline const boost::ut::suite _simd_tests = [] {
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(mult2).to<"in">(add1)));
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(add1).to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

"runtime src->mult(2.0)->mult(0.5)->add(-1)->sink (SIMD)"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched]() {
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
sched.run_and_wait();
sched.runAndWait();
expect(eq(test::n_samples_produced, N_SAMPLES)) << "did not produce enough output samples";
expect(eq(test::n_samples_consumed, N_SAMPLES)) << "did not consume enough input samples";
};
Expand Down Expand Up @@ -668,12 +668,12 @@ inline const boost::ut::suite _simd_tests = [] {
}
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(*add1[add1.size() - 1]).to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

"runtime src->(mult(2.0)->mult(0.5)->add(-1))^10->sink (SIMD)"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched]() {
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
sched.run_and_wait();
sched.runAndWait();
sched.reset();
expect(eq(test::n_samples_produced, N_SAMPLES)) << "did not produce enough output samples";
expect(eq(test::n_samples_consumed, N_SAMPLES)) << "did not consume enough input samples";
Expand Down Expand Up @@ -701,8 +701,8 @@ inline const boost::ut::suite _sample_by_sample_vs_bulk_access_tests = [] {
::benchmark::benchmark<1LU>{ test_name }.repeat<N_ITER>(N_SAMPLES) = [&testGraph]() {
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
gr::scheduler::simple sched{ std::move(testGraph) };
sched.run_and_wait();
gr::scheduler::Simple sched{ std::move(testGraph) };
sched.runAndWait();
expect(eq(test::n_samples_produced, N_SAMPLES)) << "did not produce enough output samples";
expect(eq(test::n_samples_consumed, N_SAMPLES)) << "did not consume enough input samples";
};
Expand All @@ -723,12 +723,12 @@ inline const boost::ut::suite _sample_by_sample_vs_bulk_access_tests = [] {
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(div).template to<"in">(add1)));
expect(eq(gr::ConnectionResult::SUCCESS, testGraph.connect<"out">(add1).template to<"in">(sink)));

gr::scheduler::simple sched{ std::move(testGraph) };
gr::scheduler::Simple sched{ std::move(testGraph) };

::benchmark::benchmark<1LU>{ test_name }.repeat<N_ITER>(N_SAMPLES) = [&sched]() {
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
sched.run_and_wait();
sched.runAndWait();
expect(eq(test::n_samples_produced, N_SAMPLES)) << "did not produce enough output samples";
expect(eq(test::n_samples_consumed, N_SAMPLES)) << "did not consume enough input samples";
};
Expand Down
24 changes: 12 additions & 12 deletions core/benchmarks/bm_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <gnuradio-4.0/Graph.hpp>
#include <gnuradio-4.0/profiler.hpp>
#include <gnuradio-4.0/scheduler.hpp>
#include <gnuradio-4.0/Scheduler.hpp>

#include <gnuradio-4.0/testing/bm_test_helper.hpp>

Expand Down Expand Up @@ -101,7 +101,7 @@ exec_bm(auto &scheduler, const std::string &test_case) {
using namespace benchmark;
test::n_samples_produced = 0LU;
test::n_samples_consumed = 0LU;
scheduler.run_and_wait();
scheduler.runAndWait();
expect(eq(test::n_samples_produced, N_SAMPLES)) << fmt::format("did not produce enough output samples for {}", test_case);
expect(ge(test::n_samples_consumed, N_SAMPLES)) << fmt::format("did not consume enough input samples for {}", test_case);
}
Expand All @@ -111,35 +111,35 @@ exec_bm(auto &scheduler, const std::string &test_case) {
using namespace boost::ut;
using namespace benchmark;
using thread_pool = gr::thread_pool::BasicThreadPool;
using gr::scheduler::execution_policy::multi_threaded;
using gr::scheduler::ExecutionPolicy::multiThreaded;

auto pool = std::make_shared<thread_pool>("custom-pool", gr::thread_pool::CPU_BOUND, 2, 2);

gr::scheduler::simple sched1(test_graph_linear<float>(2 * N_NODES), pool);
gr::scheduler::Simple sched1(test_graph_linear<float>(2 * N_NODES), pool);
"linear graph - simple scheduler"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched1]() { exec_bm(sched1, "linear-graph simple-sched"); };

gr::scheduler::breadth_first sched2(test_graph_linear<float>(2 * N_NODES), pool);
gr::scheduler::BreadthFirst sched2(test_graph_linear<float>(2 * N_NODES), pool);
"linear graph - BFS scheduler"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched2]() { exec_bm(sched2, "linear-graph BFS-sched"); };

gr::scheduler::simple sched3(test_graph_bifurcated<float>(N_NODES), pool);
gr::scheduler::Simple sched3(test_graph_bifurcated<float>(N_NODES), pool);
"bifurcated graph - simple scheduler"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched3]() { exec_bm(sched3, "bifurcated-graph simple-sched"); };

gr::scheduler::breadth_first sched4(test_graph_bifurcated<float>(N_NODES), pool);
gr::scheduler::BreadthFirst sched4(test_graph_bifurcated<float>(N_NODES), pool);
"bifurcated graph - BFS scheduler"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched4]() { exec_bm(sched4, "bifurcated-graph BFS-sched"); };

gr::scheduler::simple<multi_threaded> sched1_mt(test_graph_linear<float>(2 * N_NODES), pool);
gr::scheduler::Simple<multiThreaded> sched1_mt(test_graph_linear<float>(2 * N_NODES), pool);
"linear graph - simple scheduler (multi-threaded)"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched1_mt]() { exec_bm(sched1_mt, "linear-graph simple-sched (multi-threaded)"); };

gr::scheduler::breadth_first<multi_threaded> sched2_mt(test_graph_linear<float>(2 * N_NODES), pool);
gr::scheduler::BreadthFirst<multiThreaded> sched2_mt(test_graph_linear<float>(2 * N_NODES), pool);
"linear graph - BFS scheduler (multi-threaded)"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched2_mt]() { exec_bm(sched2_mt, "linear-graph BFS-sched (multi-threaded)"); };

gr::scheduler::simple<multi_threaded> sched3_mt(test_graph_bifurcated<float>(N_NODES), pool);
gr::scheduler::Simple<multiThreaded> sched3_mt(test_graph_bifurcated<float>(N_NODES), pool);
"bifurcated graph - simple scheduler (multi-threaded)"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched3_mt]() { exec_bm(sched3_mt, "bifurcated-graph simple-sched (multi-threaded)"); };

gr::scheduler::breadth_first<multi_threaded> sched4_mt(test_graph_bifurcated<float>(N_NODES), pool);
gr::scheduler::BreadthFirst<multiThreaded> sched4_mt(test_graph_bifurcated<float>(N_NODES), pool);
"bifurcated graph - BFS scheduler (multi-threaded)"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched4_mt]() { exec_bm(sched4_mt, "bifurcated-graph BFS-sched (multi-threaded)"); };

gr::scheduler::breadth_first<multi_threaded, profiler> sched4_mt_prof(test_graph_bifurcated<float>(N_NODES), pool);
gr::scheduler::BreadthFirst<multiThreaded, profiler> sched4_mt_prof(test_graph_bifurcated<float>(N_NODES), pool);
"bifurcated graph - BFS scheduler (multi-threaded) with profiling"_benchmark.repeat<N_ITER>(N_SAMPLES) = [&sched4_mt_prof]() {
exec_bm(sched4_mt_prof, "bifurcated-graph BFS-sched (multi-threaded) with profiling");
};
Expand Down
Loading

0 comments on commit 8c54244

Please sign in to comment.