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

Alloc membind #2923

Merged
merged 7 commits into from Oct 28, 2017
Merged

Alloc membind #2923

merged 7 commits into from Oct 28, 2017

Conversation

biddisco
Copy link
Contributor

@biddisco biddisco commented Oct 1, 2017

This provides an interface to the hwloc_alloc_membind function and requires a numa nodeset to be passed that the memory is bound to.
This in turn requires a nodeset and rather than using a mask and converting to and from hwloc types, it is less error prone to use an hwloc bitmap object wrapped in a c++ holder to manage deletion.

@hkaiser hkaiser added this to the 1.1.0 milestone Oct 1, 2017
@biddisco biddisco force-pushed the alloc_membind branch 3 times, most recently from c14fa15 to 489d456 Compare October 4, 2017 05:43
hpx_hwloc_bitmap_wrapper const* bmp);

// the raw bitmap object
hwloc_bitmap_t bmp_;
Copy link
Member

Choose a reason for hiding this comment

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

Please make the bmp_ member private.

@@ -41,6 +42,35 @@ namespace hpx { namespace resource

namespace hpx { namespace threads
{
struct hpx_hwloc_bitmap_wrapper {
Copy link
Member

Choose a reason for hiding this comment

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

This class will things make blow up if an instance of it is copied:

    hpx_hwloc_bitmap_wrapper hwlw1 (...);
    hpx_hwloc_bitmap_wrapper hwlw2 = hwlw1;

which will cause a double-free.

Please add proper copy constructor/assignment operator or alternatively proper move semantics.

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively you can make the class non-copyable (and non-movable).

/// \brief Please see hwloc documentation for the corresponding
/// enums HWLOC_MEMBIND_XXX
enum hpx_hwloc_membind_policy : int {
HPX_MEMBIND_DEFAULT = 0,
Copy link
Member

Choose a reason for hiding this comment

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

Please use the original hwloc constants to initialize the values of this enumerator. I also think that there is no need to prefix the enumerator value names with HPX_. Lastly, we usually use ALL_CAPTIAL_NAMES for macros only.

static_cast<unsigned int>(pu_obj->os_index));
}
}
// std::cout << "mask_to_bitmap mask_cref is " << mask;
Copy link
Member

Choose a reason for hiding this comment

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

Please remove non-used code.

if (hwloc_bitmap_isset(bitmap, idx) != 0)
set(mask, detail::get_index(pu_obj));
}
// std::cout << "bitmap_to_mask mask_cref is " << mask;
Copy link
Member

Choose a reason for hiding this comment

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

Same here, please remove the non-used code sections.

@hkaiser
Copy link
Member

hkaiser commented Oct 12, 2017

@biddisco Do you plan to work on this further?

@biddisco
Copy link
Contributor Author

Yes of course. All my work is based on this.
Is this branch cluttering up github too much for you?

@hkaiser
Copy link
Member

hkaiser commented Oct 13, 2017

Yes of course. All my work is based on this.

Great.

Is this branch cluttering up github too much for you?

No worries, I was just wondering while going through all tickets and PRs.

@@ -92,6 +93,15 @@ namespace hpx { namespace threads
}

///////////////////////////////////////////////////////////////////////////
std::ostream& operator<<(std::ostream& os, hpx_hwloc_bitmap_wrapper const* bmp)
{
char buffer[256];
Copy link
Member

Choose a reason for hiding this comment

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

Is this buffer large enough for a large number of PUs? Is the generated string hex formatted or binary?

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, it's a hex output. 256 chars should be more than enough for any multi-core chips we see for the foreseeable future.

@hkaiser
Copy link
Member

hkaiser commented Oct 16, 2017

Should we also make HWLOC mandatory, remove the abstract topology base class, and remove the no-topology placeholder class?

@biddisco
Copy link
Contributor Author

I think we should, but it should appear as a separate PR. I will create an issue for it. hwloc 2.0 is due to be released soon, we should target that API and timeframe.

I would like to continue with this PR independently of that work and have it merged and ready before attempting the hwloc refactoring.

@hkaiser
Copy link
Member

hkaiser commented Oct 27, 2017

I would like to continue with this PR independently of that work and have it merged and ready before attempting the hwloc refactoring.

Fine by me, would you mind addressing/responding to the other comments before that?

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@hkaiser hkaiser merged commit 083a303 into master Oct 28, 2017
@hkaiser hkaiser deleted the alloc_membind branch October 28, 2017 13:55
@khuck
Copy link
Contributor

khuck commented Oct 30, 2017

FYI, I think this broke the Clang 5.0 build on POWER8. see http://ktau.nic.uoregon.edu:8020/builders/ppc64le-clang5-release/builds/62/steps/Compile%20HPX/logs/stdio for errors. Specifically:

/home/users/khuck/buildbot/slaves/phylanx/ppc64le-clang5-release/build/tools/buildbot/src/hpx/src/runtime/threads/policies/hwloc_topology_info.cpp:1172:35: error: use of undeclared identifier 'HWLOC_OBJ_NUMANODE'; did you mean 'HWLOC_OBJ_NODE'?
/home/users/khuck/buildbot/slaves/phylanx/ppc64le-clang5-release/build/tools/buildbot/src/hpx/src/runtime/threads/policies/hwloc_topology_info.cpp:1179:13: error: use of undeclared identifier 'HWLOC_MEMBIND_BYNODESET'
release/build/tools/buildbot/src/hpx/src/runtime/threads/policies/hwloc_topology_info.cpp:1186:54: error: use of undeclared identifier 'HWLOC_OBJ_NUMANODE'; did you mean 'HWLOC_OBJ_NODE'?

@biddisco
Copy link
Contributor Author

biddisco commented Oct 30, 2017

This morning I added a #define check for hwloc version so that older hwloc installations will disable the new feature.
Unfortunately, I am told by the hwloc developers that the version information is not correct in recent hwloc releases and so the check may still fail on some systems.
I will monitor the builds on the dashboard and if necessary implement a cmake check that should fix it properly.

@hkaiser
Copy link
Member

hkaiser commented Oct 30, 2017

@biddisco the worst that can happen is that the feature in HPX gets disabled even if its theoretically supported in hwloc. I don't think this is a problem.

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.

None yet

3 participants