-
Notifications
You must be signed in to change notification settings - Fork 68
opal/memory: Move Memory Allocation Hooks usage from openib #967
Conversation
Test PASSed. |
Per open-mpi/ompi#1351 (diff), this PR contains an abstraction violation that needs to be fixed. 👎 |
@jsquyres could you please propose correct way. |
Typically, you have to do these kinds of things via indirection (e.g., via the framework base). This will also allow you to get rid of the |
868e077
to
22f0a75
Compare
Test PASSed. |
@jsquyres could you check this update |
@@ -107,6 +122,16 @@ int mca_btl_base_select(bool enable_progress_threads, | |||
"select: no init function; ignoring component %s", | |||
component->btl_version.mca_component_name); | |||
} else { | |||
#if MEMORY_LINUX_MALLOC_ALIGN_ENABLED | |||
if (strcmp(component->btl_version.mca_component_name, "openib") == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't put a check for a specific component in a framework base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah -- I see the problem: I think I wasn't clear in my comment to you before about doing this "through the framework base." Sorry. It was clear in my head! 😉 Here's what I meant:
I was actually referring to the opal/mca/memory
base (not the BTL base). I.e., make an OPAL memory framework function to set a memalign hook. This function would be located in opal/mca/memory/base
, and openib (and oshmem, and... whoever else needs it) can just call it directly, without needing to directly include opal/mca/memory/linux/something.h
or directly invoke a function in opal/mca/memory/linux
. Instead, the memory/base function will lookup and see if the selected memory component supports setting a memalign hook, and if so, set it (e.g., perhaps by calling a new member function on the memory module structure). The linux memory hook component will support this functionality; I don't know if the solaris one will (i.e., it needs to be safe for the solaris memory component to not support this functionality).
Does that make more sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsquyres thank you for sharing details. Actually my initial local version did something you described. Reason I did not push one was in necessity to use #ifdef inside memory/base that relates memory/linux component only. It seems that solaris does not use hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. Perhaps this could be exposed as a function pointer on the module -- hence, the solaris module can provide a NULL pointer, and the linux one can provide a non-NULL pointer.
@igor-ivanov Can you please revert the master commit? The abstraction violation is causing problems for others: http://www.open-mpi.org/community/lists/devel/2016/02/18598.php. Thanks. |
mca_memory_linux_component.use_memalign = -1; | ||
ret = mca_base_component_var_register(&mca_memory_linux_component.super.memoryc_version, | ||
"memalign", | ||
"[64 | 32 | 0] - Enable memory alignment for all malloc calls (default: disabled).", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to use an MCA var enumeration here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems @ggouaillardet solved issue in master. Thanks.
only reason is to minimize changes with original code. Moreover using enumeration requires additional variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, but this is exactly the case that enumerated MCA vars were intended for.
Any idea why Jenkins/Travis did not catch this?
|
I think @ggouaillardet did a workaround on master that's probably good enough for the moment, but the final result should probably be synchronized between master and v2.x. |
@jsquyres Could you advice. |
Does this also need to go in to 1.10.X? |
once open-mpi/ompi#1376 is merged, my last three commits can be cherry-picked into this PR and it should be good to go |
One point here. |
if memory alignment is not specific to the Linux component, then it should be moved to base. |
minimal component can be disabled as --memory-manager=none up layer option. So it seems not good way. As for the second option that I asked @jsquyres to check. |
well, if the only role of the minimal memory manager is to align memory, then you cannot have memory aligned with --memory-manager=none |
After looking at old openib code more I realized that malloc hook did not work w/o memory manager. Setting such hook was controled by opal_mem_hooks_support_level(). Only memory/linux and memory/malloc_solaris set hooks support level calling opal_mem_hooks_set_support(). |
@hppritcha - yes, we would like to port it into v1.10.x once ready. |
👍 |
Test FAILed. |
These changes fix issue open-mpi/ompi#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.
cc69baf
to
b5f8583
Compare
Test PASSed. |
👍 |
👎 |
👍 |
coool :) |
@ggouaillardet could you check if you see any issue |
@igor-ivanov I think this looks good; nice job. I'd still like to see the MCA enumeration, though. @ggouaillardet Does it look good to you? |
@jsquyres so far so good, i made open-mpi/ompi#1420 for the MCA enumeration |
@jsquyres i pronounce ready to go. |
@hppritcha I'd like to see a v2.0.0 PR corresponding to open-mpi/ompi#1420 first. |
Thanks Igor Ivanov for the review.
Test PASSed. |
👍 |
OMPIBot error: Label "reviewed" is already set on issue 967. |
opal/memory: Move Memory Allocation Hooks usage from openib
See related PR in ompi/trunk open-mpi/ompi#1351
:bot:assign: @jsquyres
:bot🏷️bug
:bot:milestone:v2.0.0
ompi-trunk:
open-mpi/ompi@d9eefef
open-mpi/ompi@477991b
open-mpi/ompi@5c685e23