Skip to content

opal/memory: Move Memory Allocation Hooks usage from openib #1351

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
Feb 15, 2016

Conversation

igor-ivanov
Copy link
Member

These changes fix issue #1336

opal/memory/linux component should be single place that opeartes with
Memory Allocation Hooks. It is safe because it is linked statically.

@ggouaillardet @yosefe could you please look at it.

@@ -98,7 +98,7 @@
#endif
#include "ompi/runtime/ompi_cr.h"

#if defined(MEMORY_LINUX_PTMALLOC2) && MEMORY_LINUX_PTMALLOC2
#if defined(MEMORY_LINUX_HAVE_MALLOC_HOOK_SUPPORT) && (MEMORY_LINUX_HAVE_MALLOC_HOOK_SUPPORT == 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be replaced with
#if MEMORY_LINUX_HAVE_MALLOC_HOOK_SUPPORT

If this macro is not defined, then this is a configure issue

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed


/* This function is called from MPI_Init in case system has Memory Allocation Hooks
* (see ompi/runtime/ompi_mpi_init.c)
*/
Copy link
Member

Choose a reason for hiding this comment

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

Does OSHMEM need this functionality, too?

Copy link
Member Author

Choose a reason for hiding this comment

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

OSHMEM can use too.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. Should probably update the comment to be a bit more generic. And per my other comments, we might want to make this functionality opt-in vs. global.

@jsquyres
Copy link
Member

General comment on this PR: I see why you moved it from the BTL down to here -- that makes sense.

But it does make a global change: if memory hooks are enabled, then this memalign functionality will be enabled, even if you're using a network that doesn't care about aligned memory. Shouldn't the BTL (or whatever transport) have to request to turn this functionality on if it wants it (vs. unconditionally turning it on for all BTLs/etc.)?

@hppritcha
Copy link
Member

@jsquyres what milestone would you suggest for this PR. Its not going in to 2.0.0

@igor-ivanov
Copy link
Member Author

@jsquyres __malloc_hook is a global variable so
in current ompi code setting opal_btl_openib_memalign in case btl/openib is open changes malloc() behaivour for all components. Setting opal_btl_openib_memalign does not impact other components if ompi is built w/o openib or openib is not loaded.
So PR`s changes are honest and safe. You can control this using opal_memory_linux_memalign. It is off by default.

@hppritcha hppritcha added the bug label Feb 10, 2016
@hppritcha hppritcha added this to the v2.0.0 milestone Feb 10, 2016
@jsquyres
Copy link
Member

@igor-ivanov That's not quite what I mean. What I mean is: if openib (or UCX or ...) wants this functionality, they should request that it be enabled. It shouldn't be enabled unconditionally if the support for malloc hooks is compiled in to Open MPI.

Second note: @hppritcha and I talked in IM. This is a bug fix, and therefore is suitable for v2.0.0. Howard updated the labels and milestone.

@igor-ivanov
Copy link
Member Author

@jsquyres this capability is OFF by default. You must enable this from command line.

@jsquyres
Copy link
Member

@igor-ivanov Gotcha. Should it be on by default for BTLs/etc. that would benefit from its use?

@igor-ivanov igor-ivanov force-pushed the pr/issue-1336 branch 2 times, most recently from 1af7c9b to 4e64ad8 Compare February 11, 2016 10:24
These changes fix issue open-mpi#1336

- improve abstractions: opal/memory/linux component should be single place that opeartes with
Memory Allocation Hooks.
- avoid collisions in case dynamic component open/close: it is safe because it is linked statically.
- does not change original behaivour.
@igor-ivanov
Copy link
Member Author

@jsquyres You are right. I realized that changes broke default logic for btl/opeinb. So I am updating the commit to save original btl/openib behaivour.
Now updated patch should:

  • improve abstractions;
  • avoid collisions in case open/close of dynamic component;
  • does not change original behaivour for openib;

igor-ivanov added a commit that referenced this pull request Feb 15, 2016
opal/memory: Move Memory Allocation Hooks usage from openib
@igor-ivanov igor-ivanov merged commit d9eefef into open-mpi:master Feb 15, 2016
@mike-dubman
Copy link
Member

thanks @igor-ivanov
could you please PR it to v1.10 and v2.x

@igor-ivanov
Copy link
Member Author

v2.x open-mpi/ompi-release#967

#endif
want most of the allocated resources be aligned.
*/
opal_memory_linux_malloc_set_alignment(32, mca_btl_openib_module.super.btl_eager_limit);
Copy link
Member

Choose a reason for hiding this comment

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

This is a huge abstraction violation: you cannot have one component directly call another component.

@ggouaillardet
Copy link
Contributor

fwiw, there is a similar abstraction violation in ompi/runtime/ompi_mpi_init.c

jsquyres pushed a commit to jsquyres/ompi that referenced this pull request Sep 19, 2016
…dates

v1.10 README: update for new mailman and main web sites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants