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

Reconstruction Kernel Fusion 2: New Loading and Conversion Utility Functions #375

Merged
merged 22 commits into from
May 22, 2024

Conversation

bcaddy
Copy link
Collaborator

@bcaddy bcaddy commented Feb 13, 2024

Summary

The primary purpose of this PR is to introduce 4 new utility functions for loading grid data and converting between the primitive and conserved variables. This builds off of PR #371 and will show changes from both that PR and this PR until #371 is merged into dev. Most of the relevant changes are in the following files:

  • hydro_utilities.h
  • plmc_cuda.h and .cu
  • ppmc_cuda.h and .cu

The data loading functions are both templates that take the direction as a template parameter and default to dir = 0. Per Issue #308 we've seen that this can improve performance noticeably. After integrating these new templated functions into PLMC and PPMC (and making them templates in the same way) I found a ~6% improvement in performance on a single V100. (timing data)

hydro_utilities::Load_Cell_Conserved

This function loads the conserved data from the dev_conserved array and returns an assembled Conserved object.

hydro_utilities::Load_Cell_Primitive

This function calls hydro_utilities::Load_Cell_Conserved and then hydro_utilities::Conserved_2_Primitive to load the conserved data, convert it to primitive, and returns a Primitive object.

hydro_utilities::Conserved_2_Primitive

Converts the conserved variables in a Conserved object into primitive variables in a Primitive object and returns it.

hydro_utilities::Primitive_2_Conserved

Converts the primitive variables in a Primitive object into conserved variables in a Conserved object and returns it.

math_utils::Cyclic_Permute_Once and math_utils::Cyclic_Permute_Twice

These two functions take a hydro_utilities::Vector object and cyclically permute its members once or twice. It's used in the Load_Cell_Conserved function and I split it out on its own for clarity and because I thought it might be more generally useful. I tried to think of a single function that would do this more elegantly but I couldn't figure out a way, if you have suggestions I would be happy to hear them.

Other

  • Added a constructor for hydro_utilities::Conserved
  • Fixed a bug in reconstruction::Kind, it had PLMC twice when one of them should have been PPMC.

@bcaddy bcaddy force-pushed the dev-pcmFusion-2 branch from 009313c to c423e48 Compare March 8, 2024 16:14
@bcaddy bcaddy changed the base branch from dev to dev-fusedReconstruction March 13, 2024 15:23
@bcaddy bcaddy changed the base branch from dev-fusedReconstruction to dev March 13, 2024 18:52
bcaddy added 19 commits April 29, 2024 13:36
Some variables were accidentally misnamed and there was a typo in part
of VL_3D related to the exact solver. Both issues have been fixed
Added functions for cyclically permutting a hydro_utililties::Vector.
One function permutes it once, the second permutes it twice
hydro_utilities::Load_Cell_Conserved loads all the data from a cell,
uses cell centered magnetic fields
Replace the `reconstruction::Load_Data` with
`hydro_utilities::Load_Cell_Primitive` in the PLMC reconstructor. This
required templating `PLMC_cuda` for the value of `dir` and netted about
a 6.5% improvement in performance
Replace the `reconstruction::Load_Data` with
`hydro_utilities::Load_Cell_Primitive` in the PPMC_VL reconstructor. This
required templating `PPMC_VL` for the value of `dir` and netted about
a 6.0% improvement in performance
Replace the `reconstruction::Load_Data` with
`hydro_utilities::Load_Cell_Primitive` in the PPMC_CTU reconstructor. This
required templating `PPMC_CTU` for the value of `dir`
@evaneschneider evaneschneider marked this pull request as ready for review May 22, 2024 18:21
Copy link
Collaborator

@evaneschneider evaneschneider left a comment

Choose a reason for hiding this comment

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

This all looks good.

@evaneschneider evaneschneider merged commit 3a383a4 into cholla-hydro:dev May 22, 2024
10 checks passed
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