yes I have read the example you pointed to. I understand what you are saying, however the type created by HPX_PLAIN_ACTION macro contains a reference to a component_type. This suggested to me that HPX_PLAIN_ACTION wraps the supplied function and creates a document. Hello_world_distributed shows a similar case, however it makes use of std::find_all_localities . What I want is just any locality that can run my action. I could use find_all_localities and grab any of the return id's. This is why I thought hpx::find_locality function would be a better fit.
Thanks. Gleiry Agustin El jue., 5 sept. 2019 a las 13:39, Parsa Amini (<[email protected]>) escribió: > Hello, > > An example code like you described is available in the HPX documentation: > https://stellar-group.github.io/hpx/docs/sphinx/branches/master/html/manual/creating_hpx_projects.html?highlight=find_here > You can also look at this code in the repository: > https://github.com/STEllAR-GROUP/hpx/blob/master/examples/quickstart/hello_world_distributed.cpp > hpx::find_locality > <https://stellar-group.github.io/hpx/docs/sphinx/branches/master/html/api.html?highlight=find_locality#_CPPv4N3hpx13find_localityEN10components14component_typeER10error_code> > works on components. You haven't passed a component (or declared a > component anywhere in your code) to find_locality so it can't work. > > > - Parsa Amini > > On Thu, Sep 5, 2019 at 1:17 PM Gleiry Agustín Serrano Wong < > [email protected]> wrote: > >> All, >> >> Basically I am asking for information on how to use hpx::find_locality. I >> am trying to write a simple program that runs an action on a random >> locality and then terminates. This seems to be simple but I am not getting >> this code to work. This is a small program to test what I want: >> >> #include <hpx/hpx_main.hpp> >> #include <hpx/include/iostreams.hpp> >> >> void sayhello(){ >> hpx::cout << "hello\n"; >> } >> >> HPX_PLAIN_ACTION(sayhello,sayhello_action); >> >> int main(){ >> >> hpx::async<sayhello_action>(hpx::find_locality(sayhello_action::get_component_type())); >> return 0; >> } >> >> >> The previous code compiles however I get this error: >> >> my_hpx_program: /usr/local/include/boost/smart_ptr/intrusive_ptr.hpp:193: >> T& boost::intrusive_ptr<T>::operator*() const [with T = >> hpx::naming::detail::id_type_impl]: Assertion `px != 0' failed. >> >> This tells me that maybe I need to register or instantiate a component >> implementing the plain action somewhere. However I cannot find any code, >> documentation or reference to the use of hpx::find_locality .Changing to >> hpx::find_here works normally which makes it more confusing to me. >> >> Thanks. >> >> Gleiry Agustin >> >> _______________________________________________ >> hpx-users mailing list >> [email protected] >> https://mail.cct.lsu.edu/mailman/listinfo/hpx-users >> > _______________________________________________ > hpx-users mailing list > [email protected] > https://mail.cct.lsu.edu/mailman/listinfo/hpx-users >
_______________________________________________ hpx-users mailing list [email protected] https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
