Project

General

Profile

Bug #1399

TaskQ logic for randomly choosing a victim PE that is not self is incorrect

Added by Sam White over 2 years ago. Updated over 2 years ago.

Status:
Merged
Priority:
Normal
Category:
SMP
Target version:
Start date:
02/06/2017
Due date:
% Done:

0%


Description

Sanjay discovered this: the logic for randomly choosing a PE that is not self is wrong because it compares a global PE # to a node-local PE # (modulo node size):

int random_pe = CrnRand() % CkMyNodeSize();
  while (random_pe == CkMyPe()) {
    random_pe = CrnRand() % CkMyNodeSize();
  }

It is probably not even worth adding the check against the self PE #, because checking the empty local deque is probably faster than checking against the PE #, and it shouldn't cause any other issues.

History

#1 Updated by Seonmyeong Bak over 2 years ago

Yeah, this is not correct.

Probably, stealing happens more frequently if this is fixed. (In the previous codes, it is highly possible that the randomly picked local PE number is different from the global PE num.)
-> All the PEs whose global PE number is larger than the size of a node should pass this condition.

Removed the while loop and added condition so that it doesn't try to steal a task from its local task queue and push it to the queue again.
(When a thread starts stealing, it means its task queue is empty so it is meaningless to steal a task from its own queue)

#2 Updated by Seonmyeong Bak over 2 years ago

  • Status changed from New to Implemented

#4 Updated by Phil Miller over 2 years ago

  • Status changed from Implemented to Merged
  • translation missing: en.field_closed_date set to 2017-02-09 15:01:42.405526

Also available in: Atom PDF