Project

General

Profile

Feature #858

improve efficiency of exclusive entry methods

Added by Jim Phillips almost 4 years ago. Updated over 1 year ago.

Status:
In Progress
Priority:
Normal
Category:
-
Target version:
-
Start date:
10/14/2015
Due date:
% Done:

0%


Description

From tests/charm++/pingpong/pingpong.def.h:

 void CkIndex_PingN::_call_recvRDMA_void(void* impl_msg, void* impl_obj_void)
 {
  PingN* impl_obj = static_cast<PingN *>(impl_obj_void);
  if(CmiTryLock(impl_obj->__nodelock)) {
    CkSendMsgNodeBranch(CkIndex_PingN::idx_recvRDMA_void(),impl_msg,CkMyNode(),impl_obj->CkGetNodeGroupID());
    return;
  }
  CkFreeSysMsg(impl_msg);
  impl_obj->recvRDMA();
  CmiUnlock(impl_obj->__nodelock);
 }

The CkFreeSysMsg() call should be moved after CmiUnlock().

Of course, this only fixes exclusive entries without arguments, since an entry taking a message is responsible for deleting that message, which probably happens inside the lock.

Marshalled parameters are even worse, since they copy the message if they can't get a lock because they are considered nokeep:

 void CkIndex_PingN::_call_recvHandle_marshall6(void* impl_msg, void* impl_obj_void)
 {
  PingN* impl_obj = static_cast<PingN *>(impl_obj_void);
  if(CmiTryLock(impl_obj->__nodelock)) {
    impl_msg = CkCopyMsg(&impl_msg);
    CkSendMsgNodeBranch(CkIndex_PingN::idx_recvHandle_marshall6(),impl_msg,CkMyNode(),impl_obj->CkGetNodeGroupID());
    return;
  }
  ...unmarshall parameters...
  impl_obj->recvHandle(ptr, size);
  CmiUnlock(impl_obj->__nodelock);
 }

The larger issue is that the message will be repeatedly resubmitted until the lock is free. It would be better to attach a message queue to the nodegroup object to hold all exclusive messages that arrive while the lock is held, and then have the pe holding the lock re-enqueue only the single highest-priority exclusive message.


Related issues

Related to Charm++ - Feature #1184: SMP-safe CmiReference and CmiFree Implemented 08/24/2016

History

#1 Updated by Nikhil Jain over 3 years ago

  • Assignee set to Seonmyeong Bak

#2 Updated by Sam White over 2 years ago

  • Assignee changed from Seonmyeong Bak to Nitin Bhat

Moving this to Nitin since he has more experience with charmxi. I think it should be easy to do what Jim has pointed out for exclusive entry methods that take no arguments, and the more complicated cases we can work out later.

#3 Updated by Sam White over 2 years ago

Some progress on at least the simple case here before the 6.8.0 release would be valuable.

#4 Updated by Phil Miller over 2 years ago

  • Description updated (diff)

#5 Updated by Phil Miller over 2 years ago

In the parameter marshalling case, it seems like CmiReference(impl_msg) would suffice to balance out the deletion that will happen in the calling code. Then the original message can be queued up, rather than a copy.

#6 Updated by Phil Miller about 2 years ago

  • Target version changed from 6.8.0 to 6.8.1

#7 Updated by Eric Bohm almost 2 years ago

  • Target version changed from 6.8.1 to 6.9.0

#8 Updated by Sam White over 1 year ago

  • Assignee changed from Nitin Bhat to Kavitha Chandrasekar

#9 Updated by Phil Miller over 1 year ago

  • Related to Feature #1184: SMP-safe CmiReference and CmiFree added

#10 Updated by Kavitha Chandrasekar over 1 year ago

This commit https://charm.cs.illinois.edu/gerrit/#/c/3344/ is a fix for exclusive entry methods without arguments.

#11 Updated by Kavitha Chandrasekar over 1 year ago

  • Status changed from New to In Progress

#12 Updated by Sam White over 1 year ago

  • Target version deleted (6.9.0)

Also available in: Atom PDF