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 <
gaswmskkory...@ciencias.unam.mx> 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
> hpx-users@stellar.cct.lsu.edu
> https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
>
_______________________________________________
hpx-users mailing list
hpx-users@stellar.cct.lsu.edu
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to