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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

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 <koren@ingonyama.com>
Signed-off-by: Koren-Brand <koren@ingonyama.com>
Signed-off-by: Koren-Brand <koren@ingonyama.com>
Signed-off-by: Koren-Brand <koren@ingonyama.com>
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

icicle/include/icicle/fields/field.h Outdated Show resolved Hide resolved
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
Signed-off-by: Koren-Brand <koren@ingonyama.com>
Signed-off-by: Koren-Brand <koren@ingonyama.com>
icicle/tests/test_base.h Outdated Show resolved Hide resolved
@@ -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

Signed-off-by: Koren-Brand <koren@ingonyama.com>
Signed-off-by: Koren-Brand <koren@ingonyama.com>
@@ -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

Signed-off-by: Koren-Brand <koren@ingonyama.com>
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