diff --git a/paddle/math/RowBuffer.h b/paddle/math/RowBuffer.h index 9ef5b89680b00981188d78cb312dc75e2c0a79ee..e457d71f1b357aecae48107688499edd7271a5db 100644 --- a/paddle/math/RowBuffer.h +++ b/paddle/math/RowBuffer.h @@ -60,7 +60,7 @@ public: */ inline real* get(int row) const { if (preallocatedBuf_) { - CHECK_LE((row + 1) * width_ * sizeof(real), preallocatedBuf_->getSize()); + CHECK_LE((row)*width_ * sizeof(real), preallocatedBuf_->getSize()); return reinterpret_cast(preallocatedBuf_->getBuf()) + row * width_; } else { CHECK_LE((row + 1) * width_, rowStore_.size()); diff --git a/paddle/pserver/ParameterClient2.cpp b/paddle/pserver/ParameterClient2.cpp index 54063a809a4f9e558f8d364f5c437f2b6d98925b..9562c649867a8f82f0262a049398b2f17026a983 100644 --- a/paddle/pserver/ParameterClient2.cpp +++ b/paddle/pserver/ParameterClient2.cpp @@ -186,6 +186,7 @@ void ParameterClient2::sendParallel(int tid, parameter->getMat(recvParameterType).get()); CHECK(recvMat); size_t width = parameter->getConfig().dims(1); + // TODO(wuyi): need add lock here? may also cause resize. buf = recvMat->getLocalRow(block.begin_pos() / width); } /// sparse_id is not useful while receiving data since sparse data @@ -265,9 +266,9 @@ void ParameterClient2::prepareSendData( uint64_t beginDim = 0; uint64_t endDim = 0; - // FIXME(typhoonzero): let it resize first - prefetchMat->getLocalRow(nLocalBlocks + 1); - sendMat->getLocalRow(nLocalBlocks + 1); + // HACK(typhoonzero): let it resize first + prefetchMat->getLocalRow(nLocalBlocks); + sendMat->getLocalRow(nLocalBlocks); for (size_t row = 0; row < nLocalBlocks; ++row) { int64_t blockId = localIndices[row]; // local row -> sparse row