Skip to content
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

Merged
merged 21 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4ab1e07
GlobPtr depending on global memory space, added GlobConstPtr
fuchsto Mar 17, 2017
d07ca2e
Pointer type defs in GlobMem, fix in MatrixTest
fuchsto Mar 17, 2017
3279cf9
Added skip check in TeamLocalityTest::SplitGroups
fuchsto Mar 18, 2017
c20d876
Added missing return statement in GlobPtr
fuchsto Mar 18, 2017
c3c747a
Merge branch 'development' into feat-globptr
fuchsto Mar 18, 2017
cbf235b
Merge branch 'development' of github.com:dash-project/dash into feat-…
fuchsto Mar 18, 2017
363e545
Merge branch 'feat-globptr' of github.com:dash-project/dash into feat…
fuchsto Mar 18, 2017
c0ccfc5
Merge branch 'development' of github.com:dash-project/dash into feat-…
fuchsto Mar 18, 2017
0da8132
Merge branch 'feat-globptr' of github.com:dash-project/dash into feat…
fuchsto Mar 18, 2017
6f59c68
Added dash::GlobUnitMem for shared local memory spaces
fuchsto Mar 18, 2017
26127d3
Integrating dash::GlobUnitMem
fuchsto Mar 18, 2017
ecbfe70
Fixed clang compiler errors
fuchsto Mar 18, 2017
b24a316
Renamed GlobMem, GlobDynamicMem to GlobStaticHeap, GlobHeap
fuchsto Mar 18, 2017
9bbec00
Renamed global allocator types
fuchsto Mar 18, 2017
567e4df
Moved memory space types to include dir dash/memory
fuchsto Mar 18, 2017
ec9fb2a
Added dash/Memory.h
fuchsto Mar 18, 2017
1573609
Merge branch 'development' into feat-globptr
fuchsto Mar 18, 2017
be17cdc
Merge branch 'development' into feat-globptr
fuchsto Mar 23, 2017
5749b1c
Fixed zealot type renamings
fuchsto Mar 23, 2017
bfaaaaf
Merge branch 'feat-globptr' of github.com:dash-project/dash into feat…
fuchsto Mar 23, 2017
8727b3c
Merge branch 'development' into feat-globptr
fuchsto Mar 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dash/examples/app.01.mindeg/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ int read_adj(
int read_mtx(const std::string & fname,
nodearray_t & nodes);

#if 0
int init_nodes(
nodearray_t & nodes,
std::deque<int> & xadj,
std::deque<int> & local_adj);
#endif

void get_reach(
nodearray_t & nodes,
Expand Down Expand Up @@ -283,7 +285,9 @@ int read_mtx(const std::string & fname,

// allocate memory of adjacency list in parallel
for (size_t i = 0; i < nodes.lsize(); ++i) {
nodes.local[i].adj = dash::memalloc<int>(nodes.local[i].adj_sz);
nodes.local[i].adj = dash::memalloc<int>(
nodes.globmem(),
nodes.local[i].adj_sz);
}

nodes.barrier();
Expand Down
13 changes: 8 additions & 5 deletions dash/examples/bench.04.histo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ int main(int argc, char **argv)
dash::Array<int> key_array(NUM_KEYS, dash::BLOCKED);
dash::Array<int> key_histo(MAX_KEY, dash::BLOCKED);

dash::Array<dash::GlobPtr<int>> work_buffers(size, dash::CYCLIC);
using glob_ptr_t = dash::GlobPtr< int, dash::GlobUnitMem<int> >;

dash::Array<glob_ptr_t> work_buffers(size, dash::CYCLIC);

work_buffers[myid] = dash::memalloc<int>(MAX_KEY);

dash::GlobPtr<int> gptr = work_buffers[myid];
int* work_buf = (int*) gptr;
glob_ptr_t gptr = work_buffers[myid];
int * work_buf = static_cast<int *>(gptr);

if(myid==0) {
for(int i=0; i<key_array.size(); i++ ) {
Expand Down Expand Up @@ -72,10 +75,10 @@ int main(int argc, char **argv)
}

for(int unit=1; unit<size; unit++ ) {
dash::GlobPtr<int> remote = work_buffers[(myid+unit)%size];
glob_ptr_t remote = work_buffers[(myid+unit)%size];

for(int i=0; i<key_histo.lsize(); i++ ) {
key_histo.local[i] += remote[goffs+i];
key_histo.local[i] += static_cast<int *>(remote)[goffs+i];
}
}
dash::barrier();
Expand Down
18 changes: 8 additions & 10 deletions dash/examples/ex.04.memalloc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ int main(int argc, char* argv[])

dash::Array< dash::GlobPtr<int> > arr(size);

arr[myid] = dash::memalloc<int>(SIZE);
arr[myid] = dash::memalloc<int>(arr.globmem(), SIZE);

for(int i=0; i<SIZE; i++ ) {
for (int i = 0; i < SIZE; i++) {
dash::GlobPtr<int> ptr = arr[myid];
ptr[i]=myid;
ptr[i] = myid;
}

dash::barrier();

cout<<myid<<": ";
for(int i=0; i<SIZE; i++ ) {
dash::GlobPtr<int> ptr = arr[(myid+1)%size];
cout<<(int)ptr[i]<<" ";
cout << myid << ": ";
for (int i = 0; i < SIZE; i++) {
dash::GlobPtr<int> ptr = arr[(myid+1) % size];
cout << (int)ptr[i] << " ";
}
cout<<endl;
cout << endl;

dash::barrier();

//dash::memfree(arr[myid]);

dash::finalize();
}
4 changes: 2 additions & 2 deletions dash/include/dash/Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define DASH__ALLOCATOR_H__INCLUDED

#include <dash/allocator/LocalAllocator.h>
#include <dash/allocator/CollectiveAllocator.h>
#include <dash/allocator/DynamicAllocator.h>
#include <dash/allocator/SymmetricAllocator.h>
#include <dash/allocator/EpochSynchronizedAllocator.h>

namespace dash {

Expand Down
15 changes: 12 additions & 3 deletions dash/include/dash/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <dash/Exception.h>
#include <dash/Cartesian.h>
#include <dash/Dimensional.h>
#include <dash/GlobMem.h>
#include <dash/memory/GlobStaticMem.h>
#include <dash/GlobRef.h>
#include <dash/GlobAsyncRef.h>
#include <dash/Shared.h>
Expand Down Expand Up @@ -621,7 +621,7 @@ class ArrayRef
* \concept{DashArrayConcept}
*
* \todo Add template parameter:
* <tt>class GlobMemType = dash::GlobMem<ElementType></tt>
* <tt>class GlobMemType = dash::GlobStaticMem<ElementType></tt>
*
* \note: Template parameter IndexType could be deduced from pattern
* type <tt>PatternT::index_type</tt>
Expand Down Expand Up @@ -662,7 +662,7 @@ class Array
typedef GlobIter< value_type, PatternType> pointer;
typedef GlobIter<const value_type, PatternType> const_pointer;

typedef dash::GlobMem<value_type> glob_mem_type;
typedef dash::GlobStaticMem<value_type> glob_mem_type;

public:
template<
Expand Down Expand Up @@ -928,6 +928,15 @@ class Array
return View(this, ViewSpec<1>(pattern().block(block_gindex)));
}

/**
* The instance of \c GlobStaticMem used by this iterator to resolve addresses
* in global memory.
*/
constexpr const glob_mem_type & globmem() const noexcept
{
return *m_globmem;
}

/**
* Global const pointer to the beginning of the array.
*/
Expand Down
46 changes: 23 additions & 23 deletions dash/include/dash/GlobAsyncRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <dash/GlobPtr.h>
#include <dash/Allocator.h>
#include <dash/GlobMem.h>
#include <dash/memory/GlobStaticMem.h>

#include <iostream>

Expand Down Expand Up @@ -47,12 +47,12 @@ class GlobAsyncRef
private:
typedef GlobAsyncRef<T>
self_t;
typedef GlobMem<T, dash::allocator::CollectiveAllocator<T> >
GlobMem_t;
typedef GlobStaticMem<T, dash::allocator::SymmetricAllocator<T> >
GlobStaticMem_t;

private:
/// Instance of GlobMem that issued this global reference
GlobMem_t * _globmem;
/// Instance of GlobStaticMem that issued this global reference
GlobStaticMem_t * _globmem;
/// Value of the referenced element, initially not loaded
mutable T _value;
/// Pointer to referenced element in global memory
Expand All @@ -72,8 +72,8 @@ class GlobAsyncRef
* global memory.
*/
GlobAsyncRef(
/// Instance of GlobMem that issued this global reference
GlobMem_t * globmem,
/// Instance of GlobStaticMem that issued this global reference
GlobStaticMem_t * globmem,
/// Pointer to referenced object in global memory
T * lptr)
: _value(*lptr),
Expand All @@ -99,15 +99,15 @@ class GlobAsyncRef
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
template<class PatternT>
template<class MemSpaceT>
GlobAsyncRef(
/// Instance of GlobMem that issued this global reference
GlobMem_t * globmem,
/// Instance of GlobStaticMem that issued this global reference
GlobStaticMem_t * globmem,
/// Pointer to referenced object in global memory
GlobPtr<T, PatternT> & gptr)
: _gptr(gptr.dart_gptr()),
_is_local(gptr.is_local())
GlobPtr<T, MemSpaceT> & gptr)
: _gptr(gptr.dart_gptr())
{
_is_local = gptr.is_local();
if (_is_local) {
_value = *gptr;
_lptr = (T*)(gptr);
Expand All @@ -119,13 +119,13 @@ class GlobAsyncRef
* Conctructor, creates an GlobRefAsync object referencing an element in
* global memory.
*/
template<class PatternT>
template<class MemSpaceT>
GlobAsyncRef(
/// Pointer to referenced object in global memory
GlobPtr<T, PatternT> & gptr)
: _gptr(gptr.dart_gptr()),
_is_local(gptr.is_local())
GlobPtr<T, MemSpaceT> & gptr)
: _gptr(gptr.dart_gptr())
{
_is_local = gptr.is_local();
if (_is_local) {
_value = *gptr;
_lptr = (T*)(gptr);
Expand All @@ -138,13 +138,13 @@ class GlobAsyncRef
* global memory.
*/
GlobAsyncRef(
/// Instance of GlobMem that issued this global reference
GlobMem_t * globmem,
/// Instance of GlobStaticMem that issued this global reference
GlobStaticMem_t * globmem,
/// Pointer to referenced object in global memory
dart_gptr_t dart_gptr)
: _gptr(dart_gptr)
{
GlobPtr<T> gptr(dart_gptr);
GlobConstPtr<T> gptr(dart_gptr);
_is_local = gptr.is_local();
if (_is_local) {
_value = *gptr;
Expand All @@ -162,7 +162,7 @@ class GlobAsyncRef
dart_gptr_t dart_gptr)
: _gptr(dart_gptr)
{
GlobPtr<T> gptr(dart_gptr);
GlobConstPtr<T> gptr(dart_gptr);
_is_local = gptr.is_local();
if (_is_local) {
_value = *gptr;
Expand All @@ -176,8 +176,8 @@ class GlobAsyncRef
* global memory.
*/
GlobAsyncRef(
/// Instance of GlobMem that issued this global reference
GlobMem_t * globmem,
/// Instance of GlobStaticMem that issued this global reference
GlobStaticMem_t * globmem,
/// Pointer to referenced object in global memory
GlobRef<T> & gref)
: GlobAsyncRef(globmem, gref.gptr())
Expand Down
Loading