Allow variables and arrays to be shared across teams

Issue #12 resolved
Amir Kamil created an issue

In the current design, shared variables and arrays are global. It would be useful to be able to create shared variables and arrays that are distributed across teams rather than globally.

In order to allow this, we would need to loosen the restriction on shared-object lifetime mentioned in issue #10. We would also have to allow construction of shared objects in any collective context rather than just at namespace/class scope. We could continue to specify that shared objects are never destroyed, but it probably makes more sense to provide some sort of destruction mechanism. (We don't currently have a destruction mechanism for teams, but if we did, we could also specify that team shared objects are destroyed when the associated team is.)

Comments (4)

  1. Yili Zheng

    I think this is a very good suggestion and actually our code can almost do that with some minor modification to use "current_team" for internal collective creation. I think I can get the implementation working very soon.

    Amir, can you please help with specifying "collective context"?

    For example,

    void foo()
    {
      shared_var<int> a; // OK if all ranks in the team enter foo() collectively
      shared_array<int> b(ranks()); // OK if all ranks in the team enter foo() collectively
    
      // use a and b within the team
    
    } // the destructors of a and b actually will free them, which seems OK to me
    
  2. Amir Kamil reporter

    I think it's only necessary to specify that creating a shared object is a collective operation. Issue #13 discusses what it means for collective operations to be properly aligned.

  3. Log in to comment