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

Zcurve mpi fix #128

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Zcurve mpi fix #128

wants to merge 2 commits into from

Conversation

pelahi
Copy link
Collaborator

@pelahi pelahi commented Aug 28, 2023

Fixes an issue with redoing the mpi decomposition when running with a baryon search. Tested with flamingo input.

Might need to test the configuration file produced to see if appropriate entry added if configuration file has specific parameter set.

pelahi added 2 commits August 25, 2023 21:46
This fixes a regresseion where the initial MPI decomposition and number per mpi
domain is called twice, which wipes out the load balanced decomposition.
This is a prelimary commit. Requires further testing to be certain all
changes from another fork are present
@pelahi pelahi added the bug Something isn't working label Aug 28, 2023
@pelahi pelahi requested a review from rtobar August 28, 2023 13:36
@pelahi pelahi self-assigned this Aug 28, 2023
Copy link

@rtobar rtobar left a comment

Choose a reason for hiding this comment

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

At first I was a bit taken aback by the big line count of the diff, but after some inspection it turns out most of it is removal of commented code. I think we can take that, but I still sprinkled some questions here and there about some changes that seem inoffensive, but for which I'd like some confirmation.

I also haven't really tested these changes myself. I think Chris said he was going to play with them, so I'll leave that testing to him.

@@ -324,6 +324,11 @@ typedef void (*ExtraPropFunc)(double, double, double&);
#define Grav_in_kpc_kms_solarmasses 4.3022682e-6
//@}

///\defgroup Z-curve Mesh constants
//@{
#define MESH_MINCELLSPERDIM 4
Copy link

Choose a reason for hiding this comment

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

is this change in value (8 -> 4) intentional and part of the fix?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I found for very small sims you didn't need to have a mesh size of 8^3 so 4^3 seemed like a good min size. This change is itself unrelated to the bug fix but does at least also remove a constant that I had hardcoded with a defined constant.

if (ThisTask==0) {
/*
Copy link

Choose a reason for hiding this comment

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

this if (and the correspondig closing }) are all what's left in this function; do you want to remove them as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I can remove this as well.

MPIInitialDomainDecomposition(opt);
MPIDomainDecompositionGadget(opt);
}
Int_t i,k,n;
Copy link

Choose a reason for hiding this comment

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

Changes from this line onwards in this function seem like an unrelated change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did have some small changes cleaning up the gadget code. Not related to the fix and so can remove this if desired so it is a separate PR.

//PredType HDFREALTYPE(PredType::NATIVE_FLOAT);
int ireaderror = 0;

LOG(debug) <<" running domain extent";
Copy link

Choose a reason for hiding this comment

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

All changes in this file look only like formatting changes (removing commented code, re-indenting after removing a {/} block), is that correct? As such, it seems like an unrelated change to this MR. Just want to understand if there's something I'm missing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is correct.


Int_t i,j,k;
unsigned long long n,nchunk;
char buf[2000];
MPI_Status status;
Copy link

Choose a reason for hiding this comment

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

Again, from this line onwards in this function it looks like all changes are unrelated to the mesh/mpi decomposition fixes, is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is not itself related to the mesh, just a code clean-up. Again, happy to revert this and leave the PR to just those related to the mesh.

// is set such that the cells per dim grows as (log(N)/log(2))^(y). Currently y=1
// unless the numcellsperdim has been set, in which case that is used.
if (opt.numcellsperdim == 0) {
unsigned int NProcfac = std::ceil(log(static_cast<double>(NProcs))/log(2.0));
Copy link

Choose a reason for hiding this comment

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

Suggested change
unsigned int NProcfac = std::ceil(log(static_cast<double>(NProcs))/log(2.0));
unsigned int NProcfac = std::ceil(std::log2(static_cast<double>(NProcs)));

the comment would also need adjusting

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, yes I'll update the comment too.

@@ -1145,6 +1145,8 @@ void GetParamFile(Options &opt)
opt.impiusemesh = (atoi(vbuff)>0);
else if (strcmp(tbuff, "MPI_zcurve_mesh_decomposition_min_num_cells_per_dim")==0)
opt.minnumcellperdim = atoi(vbuff);
else if (strcmp(tbuff, "MPI_zcurve_mesh_decomposition_num_cells_per_dim")==0)
Copy link

Choose a reason for hiding this comment

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

if this is a new option it would need documentation (don't remember where that lives). Also, is it being already dumped when writing a configuration file from the Options?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the portion that I need to check, hence it still being in draft. The documentation would also need a change.

@MatthieuSchaller
Copy link

FWIW we don't have big problems in large volumes. (say 1Gpc with 2x2000^3 particles)
But big imblanace in cases like EAGLE. So 50Mpc with 2x700^3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants