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

Replace random function to make CI reproducible #665

Merged

Conversation

Koren-Brand
Copy link
Contributor

Describe the changes

This PR changes random generation to be based on rand such that bugs could be effectively reproduced.
Ctest (CI) Now outputs test log on test failure

Linked Issues

Resolves #

…d a seed that will be set and printed in the start of test_curve_api. Additionally now ctest outputs console on failed runs.

Signed-off-by: Koren-Brand <[email protected]>
Signed-off-by: Koren-Brand <[email protected]>
Copy link
Contributor

@mickeyasa mickeyasa left a comment

Choose a reason for hiding this comment

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

good initiative

Field value{};
for (unsigned i = 0; i < TLC; i++)
value.limbs_storage.limbs[i] = distribution(generator);
value.limbs_storage.limbs[i] = rand();
Copy link
Collaborator

@yshekel yshekel Nov 25, 2024

Choose a reason for hiding this comment

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

maybe assert that limbs is 4 bytes here because rand() returns int. Otherwise if limbs is 64b then you don't randomize all numbers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The implementation of limbs_storage in field is uint32 so it is an exact fit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently, rand has a maximal value of 2^15 - 1 so another solution might be better

yshekel
yshekel previously approved these changes Nov 25, 2024
Copy link
Collaborator

@yshekel yshekel left a comment

Choose a reason for hiding this comment

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

Approved but please see the comment

@yshekel yshekel changed the title Koren/change random and ctest for easier cli debug replace random function to make CI reproducible Nov 25, 2024
@@ -689,14 +689,18 @@ class Field
return rv;
}

inline static std::mt19937 field_rand_generator = std::mt19937{};
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe better if you moved all of this to utils and use it here from utils.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a good idea

@yshekel yshekel self-requested a review November 26, 2024 17:04
@yshekel yshekel dismissed their stale review November 28, 2024 08:24

commits post approve

@@ -24,6 +24,7 @@
#endif // __CUDACC__

#include "icicle/errors.h"
#include "icicle/utils/rand_gen.cpp"
Copy link
Collaborator

Choose a reason for hiding this comment

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

you need to rename it to rand_gen.h

@Koren-Brand Koren-Brand force-pushed the koren/change_random_and_ctest_for_easier_cli_debug branch from c2cbfa2 to 49334a1 Compare December 2, 2024 09:21
@Koren-Brand Koren-Brand changed the title replace random function to make CI reproducible Replace random function to make CI reproducible Dec 2, 2024
@Koren-Brand Koren-Brand merged commit 379d3e5 into main Dec 2, 2024
29 checks passed
@Koren-Brand Koren-Brand deleted the koren/change_random_and_ctest_for_easier_cli_debug branch December 2, 2024 12:52
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.

3 participants