Skip to content

Commit

Permalink
Fix crash when pairing an odd number of devices without P2P (BVLC/git…
Browse files Browse the repository at this point in the history
…hub issue BVLC#3531,BVLC#3586)
  • Loading branch information
deepali-c committed May 13, 2016
1 parent 38651f2 commit 1c99519
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/caffe/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ void DevicePair::compute(const vector<int> devices, vector<DevicePair>* pairs) {
DLOG(INFO) << "GPUs paired by P2P access, remaining: " << s.str();

// Group remaining
remaining_depth = ceil(log2(remaining.size()));
for (int d = 0; d < remaining_depth; ++d) {
for (int i = 0; i < remaining.size(); ++i) {
while (remaining.size() > 1) {
for (int i = 0; i+1 < remaining.size(); ++i) {
pairs->push_back(DevicePair(remaining[i], remaining[i + 1]));
DLOG(INFO) << "Remaining pair: " << remaining[i] << ":"
<< remaining[i + 1];
Expand Down

0 comments on commit 1c99519

Please sign in to comment.