upcxx::rget with completion

Issue #37 resolved
mathias jacquelin created an issue

I can't get rget with remote completion to compile with g++-7.

Here is a reproducer code:

#include <upcxx/upcxx.hpp>
#include <stdlib.h>
#include <iostream>

using namespace std;
using namespace upcxx;

template <typename T>
upcxx::future<T> fetch(upcxx::dist_object<T> &dobj, upcxx::intrank_t rank) {
  return upcxx::rpc(rank, [](upcxx::dist_object<T> &rdobj) { return *rdobj; }, dobj);
}

int main(int argc, char **argv)
{
  upcxx::init();
  intrank_t myrank = upcxx::rank_me();
  intrank_t nranks = upcxx::rank_n();
  global_ptr<double> U  = new_<double>(myrank);
  upcxx::dist_object<global_ptr<double>> dU(U);
  upcxx::future<global_ptr<double>> fR = fetch(dU,(myrank+1)%nranks);
  global_ptr<double> uR = upcxx::wait(fR);

  barrier();

  //upcxx::future<double> done_f = rget( uR );
  //double val = wait(done_f);
  upcxx::future<double> done_g = rget( uR, remote_cx_as_rpc([]{ cout<<"RGET IS DONE\n"<<endl; }) | operxn_cx_as_future );
  double val = wait(done_g);

  cout<<myrank<<" has fetched value "<<val<<endl;

  barrier();        // ensures dist_object lifetime
  delete_(U);
  upcxx::finalize();

  return 0;
}

Comments (3)

  1. Dan Bonachea

    Only local, future-based completion is supported in this release. Remote completion on a get might never be supported.

    Also, wait(future) is now future.wait().

  2. Log in to comment