xuewanqi commented on a change in pull request #468: Distributted module
URL: https://github.com/apache/incubator-singa/pull/468#discussion_r300556964
 
 

 ##########
 File path: include/singa/dist/communicator.h
 ##########
 @@ -0,0 +1,66 @@
+#ifndef SINGA_DIST_COMMUNICATOR_H_
+#define SINGA_DIST_COMMUNICATOR_H_
+
+#include <iostream>
+#include <cstdint>
+#include <unistd.h>
+
+#include <cuda_runtime.h>
+#include <nccl.h>
+#include <mpi.h>
+#include "singa/core/tensor.h"
+
+namespace singa{
+
+#define MPICHECK(cmd) do {                          \
+  int e = cmd;                                      \
+  if( e != MPI_SUCCESS ) {                          \
+    printf("Failed: MPI error %s:%d '%d'\n",        \
+        __FILE__,__LINE__, e);   \
+    exit(EXIT_FAILURE);                             \
+  }                                                 \
+} while(0)
+
+
+#define CUDACHECK(cmd) do {                         \
+  cudaError_t e = cmd;                              \
+  if( e != cudaSuccess ) {                          \
+    printf("Failed: Cuda error %s:%d '%s'\n",             \
+        __FILE__,__LINE__,cudaGetErrorString(e));   \
+    exit(EXIT_FAILURE);                             \
+  }                                                 \
+} while(0)
+
+
+#define NCCLCHECK(cmd) do {                         \
+  ncclResult_t r = cmd;                             \
+  if (r!= ncclSuccess) {                            \
+    printf("Failed, NCCL error %s:%d '%s'\n",             \
+        __FILE__,__LINE__,ncclGetErrorString(r));   \
+    exit(EXIT_FAILURE);                             \
+  }                                                 \
+} while(0)
+
+
+class Communicator {
+public:
+  int MPIRankInGlobal;
 
 Review comment:
   nDev means number of device a process use/control. it is set to 1: one 
process use one gpu

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to