Skip to content

ompi: Avoid unnecessary PMIx lookups when adding procs (step 2). #3181

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 1 commit into from
Mar 16, 2017

Conversation

artpol84
Copy link
Contributor

Follow-up for 717f3fe.

Signed-off-by: Artem Polyakov [email protected]

@artpol84
Copy link
Contributor Author

As it was suggested in #3011 this PR removes some unnecessary overhead during ompi add proc.

I consider this as a perf bug and we would like to have it in v2.1.1.

@artpol84 artpol84 requested a review from jladd-mlnx March 15, 2017 22:53
ompi/proc/proc.c Outdated
}
}

/* TODO: do we need to lock here ? */
opal_mutex_lock (&ompi_proc_lock);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you do need the lock in order to sort the proc list. However, I would suggest removing the unlock just above this loop and remaining locked until the end. The cost of unlock/relock likely outweighs any benefit as we only execute that loop if we are below the cutoff, and the cutoff defaults to zero (if that isn't true yet, then please ask that we put it on the telecon agenda).

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 believe that here the cost of the lock/unlock is negligible - no contention.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that the probability of contention is low, and shouldn't exist during initial launch (might occur later during a connect/accept operation), so I think the issue is minor. I was only pointing it out as something minor to consider. One thing you could do, though, is move the unlock to right after the if statement, and then relock before leaving that clause. This way, you'd only unlock/relock if you actually need to do so.

Again, minor point, so I'm okay if you'd rather not do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!
will update now.

opal_process_name_t proc_name;
proc_name.jobid = OMPI_PROC_MY_NAME->jobid;
proc_name.vpid = i;
(void) ompi_proc_for_name (proc_name);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhc54 we need to unlock because ompi_proc_for_name is locking internally.

@artpol84 artpol84 force-pushed the add_proc_fix_2/master branch from 5a143ef to 9e1c0d8 Compare March 16, 2017 00:46
@artpol84 artpol84 force-pushed the add_proc_fix_2/master branch from 9e1c0d8 to 1f7a3a2 Compare March 16, 2017 00:47
Copy link
Contributor

@rhc54 rhc54 left a comment

Choose a reason for hiding this comment

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

Looks great - thanks!

@hppritcha hppritcha added this to the v3.0.0 milestone Mar 16, 2017
@rhc54 rhc54 merged commit 45b46dc into open-mpi:master Mar 16, 2017
@hppritcha hppritcha removed this from the v3.0.0 milestone Apr 7, 2017
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.

3 participants