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

Drop Coordinate Basis from IJacobian (without breaking IDL) #1380

Merged
merged 20 commits into from
Oct 30, 2023

Conversation

KennethEJansen
Copy link
Collaborator

@KennethEJansen KennethEJansen commented Oct 13, 2023

On some platforms, there is a large performance drop for having coordinate basis in IJacobian. This branch will compute IDL coefficient in IFunction that has access to coordinates, append this to jac_data so that IJacobian can avoid pulling coordinates through basis.

…append this to jac_data so that IJacobian can avoid pulling coordinates through basis to apply IDL
@KennethEJansen
Copy link
Collaborator Author

KennethEJansen commented Oct 13, 2023

This is 2 files and only about 10ish lines of code. The place I could use some help is that currently I have bumped jac_data by 1 whether we have IDL or not. I assume we don't want that performance penalty but it is currently a declared constant so I guess we would need to make it not that so that as soon as we can use context->idl_enable to decide to bump it up?

@KennethEJansen
Copy link
Collaborator Author

It looks like I finally got all the spaces in the right places for the style requirements.

This is following exactly @jedbrown suggested mod. I don't yet see a way to only increase the size of jac_data when IDL is needed so it is just on all the time.

@KennethEJansen
Copy link
Collaborator Author

I think I figured out how to do the bump by 1 on jac_data only when idl_enable is true.

@KennethEJansen
Copy link
Collaborator Author

FWIW, we are setting up restriction operators for jac_data without checking that it is implicit. I am sure its not a big deal but just an observation.

@KennethEJansen
Copy link
Collaborator Author

KennethEJansen commented Oct 14, 2023

Passing all tests before the last style spacing change so I think this is now complete (assuming there is not a better way than pulling the context out to determine if idl_enabled). I suppose we could also wrap the jac_data restriction creation in the same conditional to save a trivial amount of setup work for explicit problems (had to do it here as the context I am checking does not exist for explicit problems).

Copy link
Collaborator

@jrwrigh jrwrigh left a comment

Choose a reason for hiding this comment

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

A few minor style comments. Otherwise good to me!

examples/fluids/src/setuplibceed.c Show resolved Hide resolved
examples/fluids/qfunctions/newtonian.h Outdated Show resolved Hide resolved
examples/fluids/src/setuplibceed.c Outdated Show resolved Hide resolved
Co-authored-by: James Wright <james@jameswright.xyz>
@KennethEJansen
Copy link
Collaborator Author

KennethEJansen commented Oct 18, 2023

So the suggested replacement (that I took without checking) with StoredValuesPack does not compile. I am going to revert that change. Here is the error

In file included from /lus/gila/projects/PHASTA_aesp_CNDA/MainInOrder/libCEED/examples/fluids/problems/newtonian.c:11:
/lus/gila/projects/PHASTA_aesp_CNDA/MainInOrder/libCEED/examples/fluids/problems/../qfunctions/newtonian.h:234:38: error: passing 'const CeedScalar' (aka 'const double') to parameter of incompatible type 'const CeedScalar *' (aka 'const double *'); take the address with &
       StoredValuesPack(Q, i, 14, 1, sigma, jac_data);
                                     ^~~~~
                                     &
/lus/gila/projects/PHASTA_aesp_CNDA/MainInOrder/libCEED/examples/fluids/problems/../qfunctions/utils.h:195:117: note: passing argument to parameter 'values_at_qpnt' here
CEED_QFUNCTION_HELPER int StoredValuesPack(CeedInt Q, CeedInt i, CeedInt start, CeedInt num_comp, const CeedScalar *values_at_qpnt,
                                                                                                                    ^
1 error generated.

@jrwrigh
Copy link
Collaborator

jrwrigh commented Oct 18, 2023

Yep, you're right. The line needs to be:

StoredValuesPack(Q, i, 14, 1, &sigma, jac_data);

@jrwrigh
Copy link
Collaborator

jrwrigh commented Oct 18, 2023

Also, for documentations sake, what were the performance gains we saw moving to this? IIRC It was around 4-8% on Polaris and SunSpot also saw a significant improvement (I don't think "percent improvement" is under NDA, but being on the cautious side of things).

@KennethEJansen KennethEJansen merged commit 1d2a965 into main Oct 30, 2023
26 checks passed
@KennethEJansen KennethEJansen deleted the kjansen/DropCoordinatesFromIJacobian branch October 30, 2023 19:54
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