Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove straggling references to JSubeventMailbox #304

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/examples/SubeventCUDAExample/SubeventCUDAExample.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <JANA/JApplication.h>
#include <JANA/JObject.h>
#include <JANA/Engine/JSubeventMailbox.h>
#include <JANA/Engine/JSubeventArrow.h>
#include <JANA/JEventSource.h>
#include <JANA/JEventProcessor.h>
Expand Down
84 changes: 1 addition & 83 deletions src/programs/unit_tests/Topology/SubeventTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,88 +42,6 @@ TEST_CASE("Create subevent processor") {
REQUIRE(output->z == 29.6f);
}

#if 0
TEST_CASE("Simplest working SubeventMailbox") {

std::vector<SubeventWrapper<MyOutput>> unmerged;
auto event1 = std::make_shared<JEvent>();
auto event2 = std::make_shared<JEvent>();

unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(2), 1, 5));
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(4), 2, 5));
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(6), 3, 5));

JSubeventMailbox<MyOutput> mailbox;
mailbox.push(unmerged);

unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(8), 4, 5));
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(10), 5, 5));
mailbox.push(unmerged);

std::vector<std::shared_ptr<JEvent>*> merged;
JSubeventMailbox<MyOutput>::Status result = mailbox.pop(merged, 1);

REQUIRE(result == JSubeventMailbox<MyOutput>::Status::Empty);
REQUIRE(merged.size() == 1);
auto items_in_event = (*(merged[0]))->Get<MyOutput>();
REQUIRE(items_in_event.size() == 5);
}


TEST_CASE("SubeventMailbox with two overlapping events") {

JSubeventMailbox<MyOutput> mailbox;
std::vector<SubeventWrapper<MyOutput>> unmerged;
std::vector<std::shared_ptr<JEvent>*> merged;

auto event1 = std::make_shared<JEvent>();
auto event2 = std::make_shared<JEvent>();

unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(2), 1, 5));
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(4), 2, 5));
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(6), 3, 5));

mailbox.push(unmerged);

// We don't have a complete event merged yet
JSubeventMailbox<MyOutput>::Status result = mailbox.pop(merged, 1);
REQUIRE(result == JSubeventMailbox<MyOutput>::Status::Empty);


// Now we mix in some subevents from event 2
unmerged.push_back(SubeventWrapper<MyOutput>(&event2, new MyOutput(1), 1, 4));
unmerged.push_back(SubeventWrapper<MyOutput>(&event2, new MyOutput(3), 2, 4));
unmerged.push_back(SubeventWrapper<MyOutput>(&event2, new MyOutput(5), 3, 4));

// Still not able to pop anything because neither of the events are complete
JSubeventMailbox<MyOutput>::Status result1 = mailbox.pop(merged, 1);
REQUIRE(result1 == JSubeventMailbox<MyOutput>::Status::Empty);

// Now we receive the rest of the subevents from event 1
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(8), 4, 5));
unmerged.push_back(SubeventWrapper<MyOutput>(&event1, new MyOutput(10), 5, 5));
mailbox.push(unmerged);

// We were able to get event1 out, but not event 2
JSubeventMailbox<MyOutput>::Status result2 = mailbox.pop(merged, 2);
REQUIRE(result2 == JSubeventMailbox<MyOutput>::Status::Empty);
REQUIRE(merged.size() == 1);
REQUIRE(merged[0] == &event1);
merged.clear();

// Now we add the remaining subevents from event 2
unmerged.push_back(SubeventWrapper<MyOutput>(&event2, new MyOutput(7), 4, 4));
mailbox.push(unmerged);

// Now we can pop event2
JSubeventMailbox<MyOutput>::Status result3 = mailbox.pop(merged, 2);
REQUIRE(result3 == JSubeventMailbox<MyOutput>::Status::Empty);
REQUIRE(merged.size() == 1);
REQUIRE(merged[0] == &event2);
auto items_in_event = (*(merged[0]))->Get<MyOutput>();
REQUIRE(items_in_event.size() == 4);
}
#endif

TEST_CASE("Basic subevent arrow functionality") {

Expand Down Expand Up @@ -174,7 +92,7 @@ TEST_CASE("Basic subevent arrow functionality") {
}
};

SECTION("Execute subevent arrows end-to-end using same example as in JSubeventMailbox") {
SECTION("Execute subevent arrows end-to-end") {

JApplication app;
app.SetParameterValue("log:info", "JWorker,JScheduler,JArrow,JArrowProcessingController,JEventProcessorArrow");
Expand Down
Loading