Skip to content

Conversation

@bangerth
Copy link
Contributor

I was reading through this code with @danieldouglas92 last week and when you look, you will always find places that can be improved.

@Djneu FYI.

{
// add a declare for kd
std::vector<double> bedrock_transport_coefficient_array(fastscape_array_size);
// TODO: where is the receive for this???
Copy link
Member

Choose a reason for hiding this comment

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

I think it is inside fill_fastscape_arrays a function that is only executed on rank 0 and receives the transmissions from all other ranks. Of course this is quite confusing to read, maybe it could be restructured.

Copy link
Member

Choose a reason for hiding this comment

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

But maybe @Djneu could confirm this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I meant to take that out of the patch again. I did want to investigate the issue, but not as part of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes that sounds correct, I supposed it used to be called directly within the overarching function but I moved it into fastscape_fill_arrays when I was doing an initial clean up of the code. Would it make more sense to also call fastscape_fill_arrays on the non-root processors, but then within that function have processors that aren't the root send the data?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take a look at some point in the future. Or if you'd like to either change it or at least document in this place where the corresponding receive is, that's fine with me. I don't think it is particularly important.

The place mainly caught my eye because it uses Ssend, which is quite expensive compared to the other send variants. Do you recall why you picked that one?

Copy link
Contributor

Choose a reason for hiding this comment

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

It has been awhile, but if I recall during initial testing we were actually getting relatively significant speedups from using ssend over the normal send. Individually ssend from each processor was a bit slower, however using send there would often be occasional delays for an individual processor and with these the total time for send was longer than ssend.

This was in a much earlier version of the code, and we only tested ssend and send so I am not sure if it would still be relevant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Djneu Huh, strange. ssend definitely has a higher overhead.

Do we have tests these days that execute these sends? If so, I could try to change this to Isend, which is generally the more efficient approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately I don't have any good tests for this, I would be really curious to see how much of a difference all the different sends make though. Maybe I can try to set some simple model at some point that we can use to test these.

throw aspect::QuietException();

// This is called solely so we can set the timer and will return immediately.
// (The kd array is a dummy array.)
Copy link
Member

Choose a reason for hiding this comment

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

What is kd?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, good catch kd is now named bedrock_transport_coefficient_array!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it refers to $k_d$ in a formula. I would assume that someone reading this code knows this, so didn't change it -- but I'd be happy to rename it here as well. @tjhei Preference?

Copy link
Member

Choose a reason for hiding this comment

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

How about renaming the array to contain the word "dummy"? Then you can delete the comment. Alternatively: "// this array is unused:"

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this again, I am not sure why I sent mesh_velocity_z for all the other arrays and then the kd array. As this only enters for the timer and then exits, maybe a dummy should be sent for all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed the variable as suggested. I will track the other issues separately.

@bangerth
Copy link
Contributor Author

I made the changes as suggested. Everything not already done will be tracked in follow-up issues.

@gassmoeller
Copy link
Member

👍 Looks good to me.

@gassmoeller gassmoeller merged commit 120b4ea into geodynamics:main Nov 3, 2025
9 checks passed
@bangerth bangerth deleted the x-4 branch November 3, 2025 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants