Project

General

Profile

Cleanup #1967

Section creation API should take its arguments as std::vector's instead of arrays

Added by Sam White 11 months ago. Updated 11 months ago.

Status:
Merged
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
08/17/2018
Due date:
% Done:

0%

Tags:

Description

The API currently takes several C-style arrays, but could be cleaned up to take std::vector's instead (or as well, can leave the old API in place for compatibility).

Also, examples/charm++/hello/xarraySection/hello.C currently leaks all of the memory from those C-style arrays...

     // Create a multicast manager group
     CkGroupID mcastMgrGID = CProxy_CkMulticastMgr::ckNew();
     CkMulticastMgr *mcastMgr = CProxy_CkMulticastMgr(mcastMgrGID).ckLocalBranch();

     // Allocate space
     CProxy_Hello *arrayOfArrays = new CProxy_Hello[numArrays];
     CkArrayID *arrID            = new CkArrayID[numArrays];
     int *nelems                 = new int[numArrays];
     CkArrayIndex **elems     = new CkArrayIndex*[numArrays];

     // Create a list of array section members
     for(int k=0; k < numArrays; k++)
     {
         // Create the array
         arrayOfArrays[k] = CProxy_Hello::ckNew(k, mcastMgrGID, numElements);
         // Store the AID
         arrID[k]  = arrayOfArrays[k].ckGetArrayID();
         // Create a list of section member indices in this array
         nelems[k] = sectionSize;
         elems[k]  = new CkArrayIndex[sectionSize];
         for(int i=afloor,j=0; i <= aceiling; i++,j++)
             elems[k][j] = CkArrayIndex1D(i);
     }
     // Create the x-array-section
     sectionProxy = CProxySection_Hello(numArrays, arrID, elems, nelems);

     // Delegate the section comm to the CkMulticast library
     sectionProxy.ckSectionDelegate(mcastMgr);

     // Start the test by pinging the section
     pingMsg *msg = new pingMsg(numIter);
     sectionProxy.mcastPing(msg);

History

#1 Updated by Sam White 11 months ago

Fixed memory leaks in example here: https://charm.cs.illinois.edu/gerrit/#/c/charm/+/4482/

#2 Updated by Sam White 11 months ago

  • Assignee set to Sam White
  • Status changed from New to Implemented
  • Tags set to section

#3 Updated by Sam White 11 months ago

  • Status changed from Implemented to Merged

#4 Updated by Sam White 11 months ago

  • Target version set to 6.9.0

Also available in: Atom PDF