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 same MPB phase on all processes #578

Merged
merged 1 commit into from
Oct 23, 2018
Merged

use same MPB phase on all processes #578

merged 1 commit into from
Oct 23, 2018

Conversation

stevengj
Copy link
Collaborator

@stevengj stevengj commented Oct 23, 2018

Hopefully fixes #568 … this looks like it has been a longstanding bug, I'm surprised we didn't notice it before now.

The basic problem I noticed is that MPB computes modes with a "random" phase, but it is a different random phase on every processor. Therefore, in any situation where we are using the same mode calculation distributed across multiple processors (either an eigenmode source that spans multiple chunks or a mode overlap integral that spans multiple chunks), the different processors will be doing the calculation with inconsistent phases.

(The fix uses the POSIX rand_r function, which should be okay since I think we only run on POSIX platforms anyway? We don't require high-quality random numbers here, since we are only initializing to "random" values to make sure the starting vectors are not accidentally nearly orthogonal to the desired modes.)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 81.977% when pulling 213393c on parallelmodephase into 871a13c on master.

@stevengj stevengj merged commit aa6d51e into master Oct 23, 2018
@stevengj stevengj deleted the parallelmodephase branch October 23, 2018 19:44
@stevengj stevengj mentioned this pull request Oct 24, 2018
@oskooi oskooi mentioned this pull request Oct 25, 2018
bencbartlett pushed a commit to bencbartlett/meep that referenced this pull request Sep 9, 2021
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.

fix binary_grating test
2 participants