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

hpx simple component docs #752

Closed
mariomulansky opened this issue Apr 15, 2013 · 6 comments
Closed

hpx simple component docs #752

mariomulansky opened this issue Apr 15, 2013 · 6 comments

Comments

@mariomulansky
Copy link
Contributor

add a descriptive example on how to use a simple_component. For example there: http://stellar.cct.lsu.edu/files/hpx_master/docs/html/hpx/manual/applying_actions/action_invocation/apply.html describe how to get the global address of an instance, how to create such an instance in the first place. One is completely lost at that point. A short walk-through for simple components (maybe also managed components) would be very helpful in the docs.

@hkaiser
Copy link
Member

hkaiser commented Apr 16, 2013

@mariomulansky
Copy link
Contributor Author

Yes, but is this the simplest way of using components? In the action invocations it sounds like one just has to register a member function, while the allocator consists of server, stubs and client.

@hkaiser
Copy link
Member

hkaiser commented Apr 16, 2013

The docs need updating here and there, but essentially that's it, yes. Note that the stub/client classes are just thin wrappers around a hpx::id_type, making the calls more type safe. The plain (and simplest) way to work with components is:

hpx::id_type target_locality = hpx::find_here();
hpx::id_type acc = hpx::components::new_<accumulator_component_type>(target_locality).get();

accumulator_component_type::add_action add;
add(acc, 5);    // adds 5 to the accumulator instance referred to by acc;

@mariomulansky
Copy link
Contributor Author

ok i got a trivial example running, based on the quickstart/component_in_executable.cpp example. In your code above I think new_ returns a future, so it should be

hpx::lcos::future<hpx::id_type> acc = hpx::components::new_<accumulator_component_type>(target_locality);

and then

add(acc.get(), 5);

It took me way more time than it should, the docs in http://stellar.cct.lsu.edu/files/hpx_master/docs/html/hpx/manual/applying_actions/action_type_definition.html are very misleading, e.g. why is there the macro HPX_COMPONENT_EXPORT that never appears in the examples? Then it even says a note on the second argument for the HPX_REGISTER_ACTION_DECLARATION, but the line below doesn't have a second argument?

@hkaiser
Copy link
Member

hkaiser commented Apr 16, 2013

Yes, I added the .get() in my example above to compensate for that.

Could you provide a patch for the docs based on your experience? You will know best what you missed and what's wrong there.

@hkaiser
Copy link
Member

hkaiser commented Apr 22, 2013

Can this be closed now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants