提交 c0c2e159 编写于 作者: Y Yu Yang

NCCL AllReduce

上级 3f88fad0
...@@ -50,10 +50,6 @@ void NCCLAllReduceOpHandle::RunImpl() { ...@@ -50,10 +50,6 @@ void NCCLAllReduceOpHandle::RunImpl() {
auto &lod_tensor = s->FindVar(var_name)->Get<LoDTensor>(); auto &lod_tensor = s->FindVar(var_name)->Get<LoDTensor>();
void *buffer = const_cast<void *>(lod_tensor.data<void>()); void *buffer = const_cast<void *>(lod_tensor.data<void>());
uintptr_t buf = reinterpret_cast<uintptr_t>(buffer);
if (buf % sizeof(float) != 0) {
VLOG(3) << "Buffer is not aligned " << buf;
}
if (dtype == -1) { if (dtype == -1) {
dtype = platform::ToNCCLDataType(lod_tensor.type()); dtype = platform::ToNCCLDataType(lod_tensor.type());
......
...@@ -36,12 +36,10 @@ inline ncclDataType_t ToNCCLDataType(std::type_index type) { ...@@ -36,12 +36,10 @@ inline ncclDataType_t ToNCCLDataType(std::type_index type) {
class NCCLGroupGuard { class NCCLGroupGuard {
public: public:
inline NCCLGroupGuard() { inline NCCLGroupGuard() { PADDLE_ENFORCE(dynload::ncclGroupStart()); }
mutex().lock();
PADDLE_ENFORCE(dynload::ncclGroupStart());
}
inline ~NCCLGroupGuard() { inline ~NCCLGroupGuard() {
mutex().lock();
PADDLE_ENFORCE(dynload::ncclGroupEnd()); PADDLE_ENFORCE(dynload::ncclGroupEnd());
mutex().unlock(); mutex().unlock();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册