Incorrect behavior for global_ptr<T>(nullptr).is_local() in multi-node jobs

Issue #323 resolved
Dan Bonachea created an issue

From spec 2019.9.0:

gptr-null.png

This clause in particular:

Returns true if this is a null pointer, regardless of the context in which this query is called.

dates back to spec draft 4 (2017.9). However it appears this semantic has never been implemented correctly in any public release, as revealed by the following program:

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

int main() {
  upcxx::init();

  upcxx::global_ptr<int> gp(nullptr);

  assert(gp.is_local());

  upcxx::barrier();
  if (!upcxx::rank_me()) std::cout<<"SUCCESS"<<std::endl;

  upcxx::finalize();
  return 0;
}

In all releases up to and including 2019.9.4, global_ptr<T>(nullptr).is_local() returns true for ranks sharing the local_team() of rank 0, and incorrectly returns false for other ranks. This means the behavior is non-compliant for any multi-node jobs.

Comments (2)

  1. Log in to comment