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

Assertion failure when using bulk hpx::new_ in asynchronous mode #3054

Closed
krivenko opened this issue Dec 6, 2017 · 4 comments · Fixed by #3087
Closed

Assertion failure when using bulk hpx::new_ in asynchronous mode #3054

krivenko opened this issue Dec 6, 2017 · 4 comments · Fixed by #3087

Comments

@krivenko
Copy link

krivenko commented Dec 6, 2017

I stumbled upon a weird assertion failure in hpx/runtime/components/default_distribution_policy.hpp.
You can reproduce it by adding the following lines to tests/regressions/components/new_2848.cpp

    {
    auto locs = hpx::find_all_localities();
    
    std::vector<hpx::id_type> ids =
        hpx::new_<test_server[]>(hpx::default_layout(locs), 10, 42).get();

    hpx::future<std::vector<hpx::id_type>> ids_f =
        hpx::new_<test_server[]>(hpx::default_layout(locs), 10, 42);
    }

and running new_2848_test on more than one locality.

new_2848_test: /home/igor/hpx/hpx.git/hpx/runtime/components/default_distribution_policy.hpp:163: hpx::components::default_distribution_policy::bulk_create(std::size_t, Ts&& ...) const::<lambda(std::vector<hpx::lcos::future<std::vector<hpx::naming::id_type> > >&&)> mutable [with Component = test_server; Ts = {int}]: Assertion `localities_.size() == v.size()' failed.

The weird part here is that ids are returned normally, and only the second call to hpx::new_ crashes.

@hkaiser
Copy link
Member

hkaiser commented Dec 26, 2017

@krivenko my apologies for the long delay in fixing this problem... Please have a look at #3087 to see if this resolves the issue for you.

@krivenko
Copy link
Author

@hkaiser No problem, it's holiday season after all.

Clang 5.0 does not want to compile #3087...

In file included from /home/igor/hpx/hpx.git/hpx/components/containers/unordered/unordered_map.hpp:26:0,
                 from /home/igor/hpx/hpx.git/src/components/containers/unordered/partition_unordered_map_component.cpp:15:
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp: In member function ‘hpx::container_distribution_policy hpx::container_distribution_policy::operator()(std::size_t) const’:
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:38:77: error: no matching function for call to ‘hpx::container_distribution_policy::container_distribution_policy(std::size_t&, const std::shared_ptr<std::vector<hpx::naming::id_type> >&)’
             return container_distribution_policy(num_partitions, localities_);
                                                                             ^
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:114:9: note: candidate: hpx::container_distribution_policy::container_distribution_policy(const hpx::naming::id_type&)
         container_distribution_policy(hpx::id_type const& locality)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:114:9: note:   candidate expects 1 argument, 2 provided
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:108:9: note: candidate: hpx::container_distribution_policy::container_distribution_policy(std::size_t, std::vector<hpx::naming::id_type>&&)
         container_distribution_policy(std::size_t num_partitions,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:108:9: note:   no known conversion for argument 2 from ‘const std::shared_ptr<std::vector<hpx::naming::id_type> >’ to ‘std::vector<hpx::naming::id_type>&&’
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:101:9: note: candidate: hpx::container_distribution_policy::container_distribution_policy(std::size_t, const std::vector<hpx::naming::id_type>&)
         container_distribution_policy(std::size_t num_partitions,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:101:9: note:   no known conversion for argument 2 from ‘const std::shared_ptr<std::vector<hpx::naming::id_type> >’ to ‘const std::vector<hpx::naming::id_type>&’
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:32:9: note: candidate: hpx::container_distribution_policy::container_distribution_policy()
         container_distribution_policy()
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:32:9: note:   candidate expects 0 arguments, 2 provided
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:28:12: note: candidate: hpx::container_distribution_policy::container_distribution_policy(const hpx::container_distribution_policy&)
     struct container_distribution_policy
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:28:12: note:   candidate expects 1 argument, 2 provided
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:28:12: note: candidate: hpx::container_distribution_policy::container_distribution_policy(hpx::container_distribution_policy&&)
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:28:12: note:   candidate expects 1 argument, 2 provided
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp: In member function ‘std::size_t hpx::container_distribution_policy::get_num_partitions() const’:
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:83:29: error: ‘const class std::shared_ptr<std::vector<hpx::naming::id_type> >’ has no member named ‘size’
                 localities_.size() : num_partitions_;
                             ^~~~
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp: In member function ‘const std::vector<hpx::naming::id_type>& hpx::container_distribution_policy::get_localities() const’:
/home/igor/hpx/hpx.git/hpx/components/containers/container_distribution_policy.hpp:89:20: error: invalid initialization of reference of type ‘const std::vector<hpx::naming::id_type>&’ from expression of type ‘const std::shared_ptr<std::vector<hpx::naming::id_type> >’
             return localities_;
                    ^~~~~~~~~~~

@hkaiser
Copy link
Member

hkaiser commented Dec 28, 2017

@krivenko should be fine now. Thanks!

@krivenko
Copy link
Author

krivenko commented Jan 1, 2018

@hkaiser Thanks a lot for fixing this issue!

I rechecked the test case from the first comment, as well as my HPX-based application. Neither of them exhibit the failure when compiled against fixing_3054.

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

Successfully merging a pull request may close this issue.

2 participants