Skip to content

add reordering to/from DIR_C with openMP #101

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

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

Nanoseb
Copy link
Collaborator

@Nanoseb Nanoseb commented Jun 24, 2024

closes #100

@Nanoseb Nanoseb requested a review from semi-h June 24, 2024 13:20
@Nanoseb Nanoseb self-assigned this Jun 24, 2024
Copy link
Member

@pbartholomew08 pbartholomew08 left a comment

Choose a reason for hiding this comment

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

LGTM. To check my understanding, the two new indexing cases are simply stating "If you want the Cartesian coordinates of the Cartesian layout you already have them"?

@Nanoseb
Copy link
Collaborator Author

Nanoseb commented Jun 24, 2024

Yes, exactly

src/common.f90 Outdated
integer, intent(out) :: dir_from, dir_to
integer, intent(in) :: rdr_dir

select case (rdr_dir)
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about using findloc intrinsic in Fortran instead of the select case block? Haven't really experimented with this before but looks like we can use it to obtain dir_from and dir_to indices easily with a single query using the rdr_map array.

https://gcc.gnu.org/onlinedocs/gcc-12.3.0/gfortran/FINDLOC.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, that's what I was wondering too. Performance wise I am not sure what's the best. The other option would be two lut for from_dir and to_dir of size 31 (with lots of zeros).

Copy link
Member

Choose a reason for hiding this comment

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

You're right, it can be bad for performance, this one is called very often inside the reorder loop. Maybe its better to explore different options later when we're investigating the performance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually, that call wasn't needed so I removed it. It should be better now performance wise, regardless of the implementation

@Nanoseb
Copy link
Collaborator Author

Nanoseb commented Jun 24, 2024

I believe it is ready now

@Nanoseb Nanoseb merged commit ee078c8 into xcompact3d:main Jun 24, 2024
2 checks passed
ia267 pushed a commit to ia267/x3d2 that referenced this pull request Feb 5, 2025
add reordering to/from DIR_C with openMP
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.

implement reorder to/from cartesian with openMP backend
3 participants