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

Platform specific #ifs #1966

Merged
merged 11 commits into from
Jan 10, 2025
Merged

Platform specific #ifs #1966

merged 11 commits into from
Jan 10, 2025

Conversation

varunagrawal
Copy link
Collaborator

Adding ifs for different platforms so that we can get regression tests running.

I was recently bitten by a bug that wasn't checked because these tests were commented out.

@varunagrawal varunagrawal self-assigned this Jan 8, 2025
Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s something that I don’t understand I guess.

double discrete_sum =
std::accumulate(discrete_samples.begin(), discrete_samples.end(),
decltype(discrete_samples)::value_type(0));
#if __APPLE__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t see differences between these different paths??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using the CI to understand the differences in the results since I can avoid instrumenting individual platform runs manually. I'll request a review when this is ready.

gtsam/linear/tests/testGaussianBayesNet.cpp Show resolved Hide resolved
@varunagrawal varunagrawal requested a review from dellaert January 9, 2025 15:45
@varunagrawal
Copy link
Collaborator Author

Based on our discussion, I found out that libstdc++ has an open bug that causes this difference in PRNG results.

https://stackoverflow.com/a/45767223/1236990
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60441

EXPECT(assert_equal(Vector2(20.0070499, 39.9942591), actual[X(1)], 1e-5));
EXPECT(assert_equal(Vector2(109.976501, 229.990945), actual[X(0)], 1e-5));
#elif _WIN32
EXPECT(assert_equal(Vector2(20.0129382, 40.0039798), actual[X(1)], 1e-5));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as Apple?

@varunagrawal varunagrawal merged commit 22bdd2a into develop Jan 10, 2025
33 checks passed
@varunagrawal varunagrawal deleted the cross-platform-tests branch January 10, 2025 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants