-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GlobPtr and global memory space concept (GlobHeapMem, GlobStaticMem, ...) #333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me. Now we should have a clean memory interface.
@@ -0,0 +1,470 @@ | |||
#ifndef DASH__GLOB_UNIT_MEM_H__INCLUDED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately you copied the content of the file istead of the file. So we lose the history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's what git does when you git mv
. Use git log --follow
to see the full history.
@devreal @rkowalewski
Sequential coherence of global address space can easily exceed the complexity we want to delegate to DART, therefore:
Also see #325 |
After reviewing the changes regarding pointer arithmetic I am not happy with this for two reasons.
There may possibly be more issues about that. |
dash::Array<int> array(...);
array.local[4] += 4; // <- you see my point. DART size is irrelevant. |
... so we rely on MPI/DART to detect type sizes correctly. |
Pointer arithmetics on the local view. Yes you are right, maybe I was thinking too complicated. And in general we can still overload the corresponding operators in C++. But that will be a different issue. Regarding the documentation of |
Related to #325 #246
I'm trying to ease my discontent with pointer semantics of
GlobPtr
. In brief, I want it to comply to shared-memory pointer semantics.A pointer in NUMA address space behaves nicely when it is incremented past a NUMA domain address space. Also, the distance between two pointers in separate NUMA domains (numa_dom_a_ptr - numa_dom_b_ptr) is well-defined.
The corresponding DASH global pointers, on the other hand, are not that polite at all. When a
GlobPtr
is incremented past the unit's local address range, it refers to an undefined address in global memory. Also,GlobPtr
provides distance operators, but these only give sane results if both operands refer to the same unit memory space.Implemented in this PR:
In the proposed implementation in this PR,
GlobPtr
depends on a global memory space (usually an instance ofGlobMem
orGlobDynamicMem
, the latter to be renamed toGlobHeap
for reasons I want to discuss next week).The type dependency of
GlobPtr
to a pattern type is removed.In some situations, a
GlobPtr
is initialized but no reference to a global memory space is available, for example inGlobRef
constructors. A global pointer without a coupled global memory space is valid if no pointer arithmetics are performed on it.In the vanilla shared-memory world, this corresponds to a const pointer (
T * const
, notconst T *
which is pointer-to-const).For this, I introduced the
GlobConstPtr
concept which provides all operations ofGlobPtr
apart from those that would not be well-defined without a reference global memory space.A
GlobConstPtr
can be explicitly converted to a local pointer. Pointer arithmetics on the converted local pointer then again are allowed as the restriction to local address space is obvious:Global const pointers also allow locality tests:
bool glob_const_ptr_is_local = GlobConstPtr<T>(some_dart_gptr).is_local();
The
GlobMem
concept is renamed toGlobalMemorySpace
and extended by the following methods:Global memory space maintains the local sizes of the associated units' local memory space.
As a result,
GlobPtr
is agnostic of iteration space (different fromGlobIter
types), but could traverse across the units' local memory, comparable to a bucket iterator.The virtual global address translation required for robust global pointer arithmetics is illustrated in this article in the DASH wiki:
http://doc.dash-project.org/internal/Publications/DASH-GDM