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

Distributed define_spmd_block #2633

Merged
merged 16 commits into from Jun 1, 2017

Conversation

atrantan
Copy link

@atrantan atrantan commented May 16, 2017

This patch tries to implement a distributed version of define_spmd_block().Here are the following changes:

  • local define_spmd_block() and local spmd_block() have been moved to hpx::lcos::local
  • hpx::parallel::v2::spmd_block is now defined as a type alias
  • hpx::parallel::v2::define_spmd_block() is now wrapping a call to hpx::lcos::local::define_spmd_block()
  • global define_spmd_block() and global spmd_block() (based on broadcast and hpx::lcos::barrier ) added and located in hpx::lcos


int * dummy = nullptr;
hpx::util::invoke(
reinterpret_cast<const F&>(*dummy),
Copy link
Member

Choose a reason for hiding this comment

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

How should this work? invoke will certainly dereference a nullptr. This is UB.

Copy link
Author

Choose a reason for hiding this comment

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

Lambda overload removed in 4657f0e

decltype( &helper_type::call ), &helper_type::call >::type;

// Initialize f at compile-time in case when f is a lambda function
hpx::lcos::detail::initialize_if_lambda(f);
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't really work. It only might work if f has no state. This limits the usefulness of spmd_block tremenedously.The nullptr dereference and that you don't transfer the callable to the remote is just calling for trouble.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in 4657f0e


// Asynchronous version
template <typename ExPolicy, typename F, typename ... Args,
typename = typename std::enable_if<
hpx::parallel::v1::is_async_execution_policy<ExPolicy>::value>::type
>
std::vector<hpx::future<void>>
inline std::vector<hpx::future<void>>
Copy link
Contributor

Choose a reason for hiding this comment

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

templated functions have inline linkage by default

Copy link
Author

@atrantan atrantan May 16, 2017

Choose a reason for hiding this comment

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

Fix done in 2fbc1d6

@atrantan atrantan force-pushed the lcos_define_spmd_block branch 5 times, most recently from f48b87e to 062db7f Compare May 19, 2017 19:42
@atrantan
Copy link
Author

@sithhell Is the PR now good for U?

Copy link
Member

@sithhell sithhell left a comment

Choose a reason for hiding this comment

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

LGTM, expect for the extract_first_argument helper.

{
using type = typename std::decay<Arg0>::type;
};
}
Copy link
Member

Choose a reason for hiding this comment

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

This should be factored out and merged with the one defined in hpx/lcos/local/spmd_block.hpp

Copy link
Author

@atrantan atrantan May 29, 2017

Choose a reason for hiding this comment

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

@sithhell Done in 7d6afc1, but not sure if I'm covering all the cases and if the proposed approach is good.

@atrantan atrantan force-pushed the lcos_define_spmd_block branch 2 times, most recently from 77ecb48 to 0b2d5ae Compare May 29, 2017 19:10
Copy link
Member

@sithhell sithhell left a comment

Choose a reason for hiding this comment

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

LGTM now, thanks!

@hkaiser hkaiser merged commit 9df93c3 into STEllAR-GROUP:master Jun 1, 2017
@atrantan atrantan deleted the lcos_define_spmd_block branch June 1, 2017 16:16
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

4 participants