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

Use C++ random #632

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Use C++ random #632

merged 1 commit into from
Sep 25, 2024

Conversation

tpadioleau
Copy link
Member

No description provided.

@tpadioleau tpadioleau self-assigned this Sep 9, 2024
@tpadioleau tpadioleau marked this pull request as ready for review September 10, 2024 08:54
@tpadioleau tpadioleau force-pushed the use-c++-random branch 2 times, most recently from e516956 to 5f8e0ac Compare September 25, 2024 06:18
@tpadioleau
Copy link
Member Author

@EmilyBourne Can you review ? I thought using std::uniform_real_distribution dis(0, 1) would work but it failed randomly. So I have just tried to make a C++ equivalent.

EmilyBourne
EmilyBourne previously approved these changes Sep 25, 2024
@EmilyBourne
Copy link
Collaborator

Any idea why uniform_real_distribution was failing?

@tpadioleau
Copy link
Member Author

Any idea why uniform_real_distribution was failing?

Seems to me it was only a question of threshold, you can have a look at it here https://github.com/CExA-project/ddc/actions/runs/10960987200/job/30438477342.

I can revert to using uniform_real_distribution, I was just not sure it was the original intent.

@EmilyBourne
Copy link
Collaborator

Any idea why uniform_real_distribution was failing?

Seems to me it was only a question of threshold, you can have a look at it here https://github.com/CExA-project/ddc/actions/runs/10960987200/job/30438477342.

I can revert to using uniform_real_distribution, I was just not sure it was the original intent.

The original intent is simply to create a polynomial whose coefficients are between 0.0 and 1.0. Limiting the coefficients to this range stops the max norm from becoming excessively large.

The tolerance for the threshold should be an analytical bound so it is a bit odd if we are going over it. That said in the example that you linked to we are not over the threshold by much. The tolerance is:

std:: max(error_bounds.error_bound_on_deriv_12( dx<I1>(ncells), dx<I2>(ncells), s_degree, s_degree), 1e-12 * max_norm_diff12))
                                                    ^                                                             ^
                                            analytical bound                                            machine error handling

Maybe it would be sufficient to increase the 1e-12 to 1e-11

@tpadioleau tpadioleau merged commit 148a84f into main Sep 25, 2024
56 checks passed
@tpadioleau tpadioleau deleted the use-c++-random branch September 25, 2024 13:21
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