Revert creation of page array in cache group constructor
authorPhil Miller <mille121@illinois.edu>
Sun, 12 Jul 2009 22:21:36 +0000 (17:21 -0500)
committerPhil Miller <mille121@illinois.edu>
Thu, 10 Dec 2009 22:22:57 +0000 (16:22 -0600)
The 'refactoring' that I did treated these constructors as sequential
code, when it's really being called on each PE. Making a page array
per PE was not the intended effect.

src/libs/ck-libs/multiphaseSharedArrays/msa-DistPageMgr.ci
src/libs/ck-libs/multiphaseSharedArrays/msa-DistPageMgr.h
src/libs/ck-libs/multiphaseSharedArrays/msa-distArray.h

index f1e464e5173fdd98a563a27fff64f6f76e05c8a8..4a6353dbd29d3a3930c38b12a9cd5ce79c624e30 100644 (file)
@@ -6,11 +6,9 @@ module msa
     // this is the per processor cache of pages.
     template<class ENTRY_TYPE, class ENTRY_OPS_CLASS,unsigned int ENTRIES_PER_PAGE> group MSA_CacheGroup
     {
-           entry MSA_CacheGroup(unsigned int nPages,
-                                                        unsigned int max_bytes,
-                                                        unsigned int nEntries,
-                                                        unsigned int numberOfWorkerThreads);
-           entry void AckPage(unsigned int page);
+        entry MSA_CacheGroup(unsigned int nPages, CkArrayID pageArrayID,
+                         unsigned int max_bytes, unsigned int nEntries, unsigned int numberOfWorkerThreads);
+        entry void AckPage(unsigned int page);
         entry void ReceivePage(unsigned int page, ENTRY_TYPE pageData[size], int size);
         entry void ReceivePageWithPUP(unsigned int page, MSA_PageT<ENTRY_TYPE, ENTRY_OPS_CLASS, ENTRIES_PER_PAGE> pageData, int size);
         entry void enroll(unsigned int numberOfWorkerThreads);
index 8be1a4310d4d89a001923e851f2825c8a133a912..7ea63f9c3147c51907e50cf845cab2df7fc40a21 100644 (file)
@@ -785,16 +785,15 @@ public:
     // 
     //
     // MSA_CacheGroup::
-       inline MSA_CacheGroup(unsigned int nPages_,
-                                                 unsigned int max_bytes_,
-                                                 unsigned int nEntries_,
+       inline MSA_CacheGroup(unsigned int nPages_, CkArrayID pageArrayID,
+                                                 unsigned int max_bytes_, unsigned int nEntries_, 
                                                  unsigned int numberOfWorkerThreads_)
                : numberOfWorkerThreads(numberOfWorkerThreads_),
                  nPages(nPages_),
                  nEntries(nEntries_), 
                  pageTable(nPages, NULL),
                  pageStateStorage(nPages, NULL),
-                 pageArray(CProxy_PageArray_t::ckNew(nPages_)),
+                 pageArray(pageArrayID),
                  thisProxy(thisgroup),
                  max_resident_pages(max_bytes_/(sizeof(ENTRY_TYPE)*ENTRIES_PER_PAGE)),
                  entryOpsObject(new ENTRY_OPS_CLASS),
@@ -802,9 +801,6 @@ public:
                  outOfBufferInPrefetch(0), syncAckCount(0),syncThreadCount(0),
                  resident_pages(0),numberLocalWorkerThreads(0), enrollDoneq(0)
                {
-                       pageArray.setCacheProxy(thisProxy);
-                       pageArray.ckSetReductionClient(new CkCallback(CkIndex_MSA_CacheGroup<ENTRY_TYPE, ENTRY_OPS_CLASS, ENTRIES_PER_PAGE>::SyncDone(), thisProxy));
-
                        MSADEBPRINT(printf("MSA_CacheGroup nEntries %d \n",nEntries););
                }
 
index 760f3d42fc9dcbfecd84a21577f7c497240f47be..06c3199cbdb90a7320c329dcd9163bf5923ef283 100644 (file)
@@ -57,6 +57,7 @@ class MSA1D
 public:
     typedef MSA_CacheGroup<ENTRY, ENTRY_OPS_CLASS, ENTRIES_PER_PAGE> CacheGroup_t;
     typedef CProxy_MSA_CacheGroup<ENTRY, ENTRY_OPS_CLASS, ENTRIES_PER_PAGE> CProxy_CacheGroup_t;
+    typedef CProxy_MSA_PageArray<ENTRY, ENTRY_OPS_CLASS, ENTRIES_PER_PAGE> CProxy_PageArray_t;
 
     // Sun's C++ compiler doesn't understand that nested classes are
     // members for the sake of access to private data. (2008-10-23)
@@ -215,8 +216,12 @@ public:
                  unsigned int maxBytes=MSA_DEFAULT_MAX_BYTES) 
         : nEntries(nEntries_), initHandleGiven(false)
     {
+        // first create the Page Array and the Page Group
         unsigned int nPages = (nEntries + ENTRIES_PER_PAGE - 1)/ENTRIES_PER_PAGE;
-        cg = CProxy_CacheGroup_t::ckNew(nPages, maxBytes, nEntries, num_wrkrs);
+        CProxy_PageArray_t pageArray = CProxy_PageArray_t::ckNew(nPages);
+        cg = CProxy_CacheGroup_t::ckNew(nPages, pageArray, maxBytes, nEntries, num_wrkrs);
+        pageArray.setCacheProxy(cg);
+        pageArray.ckSetReductionClient(new CkCallback(CkIndex_MSA_CacheGroup<ENTRY, ENTRY_OPS_CLASS, ENTRIES_PER_PAGE>::SyncDone(), cg));
         cache = cg.ckLocalBranch();
     }