Skip to content

Conversation

@lysnikolaou
Copy link
Member

After talking to Pablo and Thomas about this, they suggested that we start at a 1ns switch interval and go up to 100ns for every time setting it fails. After three failures, we go back to original switch interval.

This makes sure that the tests will run in parallel, even if the switch interval is not changed.

After talking to Pablo and Thomas about this, they suggested that
we start at a 1ns switch interval and go up to 100ns for every time
setting it fails. After three failures, we go back to original
switch interval.

This makes sure that the tests will run in parallel, even if the
switch interval is not changed.
failed = None
barrier = threading.Barrier(n_workers)
original_switch = sys.getswitchinterval()
new_switch = 1e-6
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
new_switch = 1e-6
new_switch = 1e-9

The PR description says nanoseconds

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh yeah, sorry. Meant microseconds instead. The plan was to start with the original value and increase by an order of magnitude if it fails.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just out of curiosity - when can this code get triggered? Or I guess said another way, when can sys.setswitchinterval fail? I've never had any issues setting the switch interval to a small number.

Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding is that on i386 and i586 (and especially the latter), there has always been some weird behavior around floats. This can lead to a rounding error, where the C implementation of sys.getswitchinterval effectively sees a 0 and raises a ValueError.

@ngoldbaum ngoldbaum merged commit 9c7d4de into Quansight-Labs:main May 22, 2025
9 checks passed
@lysnikolaou lysnikolaou deleted the gracefully-set-switch-interval branch June 10, 2025 17:37
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