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

Fix modulo in GCL #1355

Merged
merged 1 commit into from
Oct 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/gridtools/communication/low_level/proc_grids_3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,23 @@ namespace gridtools {
int _coords[3];

if (m_cyclic.value(0))
Copy link
Contributor

Choose a reason for hiding this comment

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

What does m_cyclic mean?

Copy link
Contributor Author

@lukasm91 lukasm91 Sep 2, 2019

Choose a reason for hiding this comment

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

Whether it should be a cyclic communicator. If the communicator is not cyclic, we don't need to communicate; so we don't need the fix in the else case.

_coords[0] = (m_coordinates[0] + I) % m_dimensions[0];
_coords[0] = (m_coordinates[0] + I + m_dimensions[0]) % m_dimensions[0];
else {
_coords[0] = m_coordinates[0] + I;
if (_coords[0] < 0 || _coords[0] >= m_dimensions[0])
return -1;
}

if (m_cyclic.value(1))
_coords[1] = (m_coordinates[1] + J) % m_dimensions[1];
_coords[1] = (m_coordinates[1] + J + m_dimensions[1]) % m_dimensions[1];
else {
_coords[1] = m_coordinates[1] + J;
if (_coords[1] < 0 || _coords[1] >= m_dimensions[1])
return -1;
}

if (m_cyclic.value(2))
_coords[2] = (m_coordinates[2] + K) % m_dimensions[2];
_coords[2] = (m_coordinates[2] + K + m_dimensions[2]) % m_dimensions[2];
else {
_coords[2] = m_coordinates[2] + K;
if (_coords[2] < 0 || _coords[2] >= m_dimensions[2])
Expand Down