Skip to content

Enhacement of the macro functionalities within hpx #6419

@andreichalapco

Description

@andreichalapco

Hi,

I've currently analyzed a bit the examples in the tutorials and I found the macros for creating the boiler plate code for remote actions (e.g HPX_PLAIN_ACTION).

#include <hpx/include/actions.hpp>

std::uint64_t fibonacci(std::uint64_t n);

HPX_PLAIN_ACTION(fibonacci, fibonacci_action)

I found this macro implementation is really hard to debug or also understand for the first comers on the hpx project and I wanted to start an initial issues for enhancement ... maybe with a follow-up pull request based on this.

I used the cpp preprocessor to expand the above example and came to the following macro expansion:

struct fibonacci_action
    : hpx::actions::make_action_t<decltype(&fibonacci), &fibonacci,
                                  fibonacci_action> {};
namespace hpx::actions::detail {
template <>
__attribute__((visibility("default"))) char const *
get_action_name<fibonacci_action>() noexcept;
}
namespace hpx::actions {
extern template struct __attribute__((visibility("default")))
transfer_action<fibonacci_action>;
extern template struct __attribute__((visibility("default")))
transfer_continuation_action<fibonacci_action>;
} // namespace hpx::actions
namespace hpx::traits {
template <> struct is_action<fibonacci_action> : std::true_type {};
template <>
struct needs_automatic_registration<fibonacci_action> : std::false_type {};
} // namespace hpx::traits
namespace hpx::actions::detail {
template <>
__attribute__((visibility("default"))) char const *
get_action_name<fibonacci_action>() noexcept {
  return "fibonacci_action";
}
} // namespace hpx::actions::detail
namespace hpx {
namespace actions {
namespace detail {
template register_action_invocation_count<fibonacci_action>
    register_action_invocation_count<fibonacci_action>::instance;
}
} // namespace actions
} // namespace hpx
namespace hpx::actions {
template struct transfer_action<fibonacci_action>;
template struct transfer_continuation_action<fibonacci_action>;
} // namespace hpx::actions

My question are:

  • Does this macro expansion include everything that a hpx plain action should include?
  • Woud template<auto fn> work for replacing this entire macro?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions