> Ran into an issue where an HPX action that I've been executing under
> hpx::parallel::transform (in lieu of hpx::parallel::for_each) hangs on the
> hpx::finalize() call. Are there any troubleshooting or debugging
> techniques that could be used to figure out how to resolve this issue? I'm
> using 1.0.0.
> static void run(const size_t idx) {
>   hpx::cout << idx << hpx::endl;
> }
> HPX_PLAIN_ACTION(run, run_action);
> int hpx_main(int argc, char **argv) {
> std::vector<size_t> idx_list;
> // fill idx_list with numbers to print ...
> 
> std::vector< hpx::future<void> > futures;
> futures.reserve(idx_list.size());
> hpx::parallel::transform(
>   hpx::parallel::par,
>   std::begin(idx_list),
>   std::end(idx_list),
>   [&localities, &distarr] (idx) {
>     auto loc = localities[distarr.get_partition(idx)];
>     return hpx::async<run_action>(loc, idx);
>   });
> hpx::wait_all(futures);
> // printing debug statements after the hpx::wait_all demonstrate the
> hpx::wait_all has completed successfully
> 
> hpx::finalize();
> 
> }

>From what I can see you actually never store the futures returned from 
>async<run_action>() in to the 'futures' vector. 

Also, I'm surprised this code even compiles as the lambda returns a 
future<void> which transform will attempt to assign to the current element 
(which is a size_t).

I'd assume the actual code you're running looks like:

int hpx_main(int argc, char **argv) {
  std::vector<size_t> idx_list;
  // fill idx_list with numbers to print ...
 
  std::vector< hpx::future<void> > futures;
  futures.reserve(idx_list.size());

  hpx::parallel::transform(
    hpx::parallel::par,
    std::begin(idx_list),
    std::end(idx_list),
    std::begin(futures), // <-- is this missing above?
    [&localities, &distarr] (idx) {
      auto loc = localities[distarr.get_partition(idx)];
      return hpx::async<run_action>(loc, idx);
    });
  hpx::wait_all(futures);

  return hpx::finalize();
}

In which case I wouldn't see any problems with the code :/ Can you show me the 
full code, please (feel free to send it to me privately, if you don't want to 
share it on the list).

Hold on - there is an idea. We just fixed a shutdown problem (hang) which was 
occurring under certain circumstances (see 
https://github.com/STEllAR-GROUP/hpx/commit/ab353f656a08f3426224b4e86fa9715a52afd8ec),
 that was about 10 days ago. What version of HPX do you use?

Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu


_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to