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

Rayon support #127

Open
v4ray opened this issue Nov 22, 2023 · 1 comment
Open

Rayon support #127

v4ray opened this issue Nov 22, 2023 · 1 comment

Comments

@v4ray
Copy link

v4ray commented Nov 22, 2023

Hi! How to use shuttle to test packages based on Rayon? My understanding is that shuttle has no direct support for Rayon primitives, so we need to change source code of Rayon. Is it true? Or is there any existing code base of Rayon adapted for shuttle?

Also, it will be great to add direct Rayon support.

@sarsko
Copy link
Contributor

sarsko commented Nov 22, 2023

Hi, your understanding is correct, Shuttle has no direct support for Rayon primitives. There is as far as I am aware no existing code base which has a model of Rayon / no fork of Rayon adapted for Shuttle. If you want to exercise code using Rayon under Shuttle you would need to either extend Shuttle to offer the APIs you need, or have a fork / model of Rayon which uses Shuttle's primitives. This would mean swapping out imports of things like Mutexes, Atomics, Rand etc. to use the Shuttle equivalent version.

A few general tips if you want to do this:

  1. See if there is some common primitive(s) you can add, make that "Shuttle-aware", and then model things as usages of that /those primitive(s)
  2. Make a wrapper crate around Rayon which conditionally enables either the regular Rayon or the Shuttle-aware version, depending on some flag (ie #[cfg(feature = "shuttle")]).
  3. Only model the subset of Rayon you are actually using.

Hope that helps, and thanks for your interest :)

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

No branches or pull requests

2 participants