Pushing a persona multiple times

Issue #63 resolved
Dan Bonachea created an issue

The following contrived example pushes a persona a second time on the same persona stack:

#include <upcxx/upcxx.hpp>

int main() {
  upcxx::init();
  {
    upcxx::persona_scope s(upcxx::default_persona());
  }
  upcxx::finalize();
  return 0;
}

This is permitted by the wording in the current spec, but fails at runtime in the current implementation, both seq and par backends:

UPC++ assertion failure on rank 0 [/home/pcp1/bonachea/UPC/inst-upcxx/upcxx.debug.gasnet1_seq.smp/include/upcxx/persona.hpp:188]: Persona already in some thread's stack.

The example above is obviously silly, but there may be more complex progress-thread codes that may want to do this (using non-default personas), without having to check if the persona in question is already pushed on the stack (especially since we don't provide a means to query the current stack contents).

We need to either fix the implementation to support this, or change the spec to prohibit it.

Comments (8)

  1. Log in to comment