MPI build fails
In file included from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.h:7:0,
from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.cc:1:
/home/mhouston/caffe2/caffe2/mpi/mpi_ops.h: In instantiation of ‘bool caffe2::MPISendTensorOp
^
In file included from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.h:4:0,
from /home/mhouston/caffe2/caffe2/mpi/mpi_ops.cc:1:
/usr/lib/openmpi/include/mpi.h:1384:20: error: initializing argument 1 of ‘int MPI_Send(void*, int, MPI_Datatype, int, int, MPI_Comm)’ [-fpermissive]
OMPI_DECLSPEC int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest,
I don't like the simple workaround, changing tesor.h:raw_data() from const void* to void*. I assume there was a some reason for that to be const. One would think based on documentation that we should be using raw_mutable_data() here but a different problem of "this" now being of the wrong type.
Suggestions on desired path to fix?
Hmm, this seems to pass the contbuild so I think there might be a specific MPI version that causes the bug. In any case, if we trust that MPI_Send won't change the data, I guess we can use const_cast<void*> to go around that issue - we do it in e.g. the nervana engine, and blindly trust the other software (which might not be the best solution):
https://github.com/caffe2/caffe2/blob/master/caffe2/contrib/nervana/nervana_math_gpu.cc#L25
@slayton58 I installed the packages as listed in the README.md
I'll check what exactly I have later today. This was on 2 different Ubuntu 14.04 installs.
From googling, 14.04 includes OpenMPI 1.6.x, and that has the non-const function signature. 1.7 and beyond have the const void * as C2 expects. Looks like we can use MPI_Get_version to handle this.