MCPcopy Create free account
hub / github.com/Kitware/VTK / AllReduceUniqueList

Method AllReduceUniqueList

Parallel/Core/vtkSubGroup.cxx:399–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397#endif
398
399int vtkSubGroup::AllReduceUniqueList(int* list, int len, int** newList)
400{
401 int transferLen, myListLen, lastListLen, nextListLen;
402
403 int* myList = nullptr;
404 myListLen = vtkSubGroup::MakeSortedUnique(list, len, &myList);
405
406 if (this->nmembers == 1)
407 {
408 *newList = myList;
409 return myListLen;
410 }
411
412 int* lastList = myList;
413 lastListLen = myListLen;
414
415 for (int i = 0; i < this->nFrom; i++)
416 {
417 this->comm->Receive(&transferLen, 1, this->members[this->fanInFrom[i]], this->tag);
418
419 int* buf = new int[transferLen];
420
421 this->comm->Receive(buf, transferLen, this->members[this->fanInFrom[i]], this->tag + 1);
422
423 int* nextList = nullptr;
424 nextListLen =
425 vtkSubGroup::MergeSortedUnique(lastList, lastListLen, buf, transferLen, &nextList);
426
427 delete[] buf;
428 delete[] lastList;
429
430 lastList = nextList;
431 lastListLen = nextListLen;
432 }
433
434 if (this->nTo > 0)
435 {
436 this->comm->Send(&lastListLen, 1, this->members[this->fanInTo], this->tag);
437
438 this->comm->Send(lastList, lastListLen, this->members[this->fanInTo], this->tag + 1);
439 }
440
441 this->Broadcast(&lastListLen, 1, 0);
442
443 if (this->myLocalRank > 0)
444 {
445 delete[] lastList;
446 lastList = new int[lastListLen];
447 }
448
449 this->Broadcast(lastList, lastListLen, 0);
450
451 *newList = lastList;
452
453 return lastListLen;
454}
455int vtkSubGroup::MergeSortedUnique(int* list1, int len1, int* list2, int len2, int** newList)
456{

Callers

nothing calls this directly

Calls 3

ReceiveMethod · 0.45
SendMethod · 0.45
BroadcastMethod · 0.45

Tested by

no test coverage detected