Skip to content
Snippets Groups Projects
Commit 96e34180 authored by Alexander van Amesfoort's avatar Alexander van Amesfoort
Browse files

Task #9127: COBALT: fix MPI incompat with 1.10. Remain compat w/ 1.6 (missing MPI Send const qual)

parent f59f5a7d
No related branches found
No related tags found
No related merge requests found
...@@ -126,44 +126,56 @@ namespace LOFAR { ...@@ -126,44 +126,56 @@ namespace LOFAR {
MPIAllocator mpiAllocator; MPIAllocator mpiAllocator;
namespace { MPI_Request Guarded_MPI_Issend(const void *ptr, size_t numBytes, int destRank, int tag) {
typedef int (*MPI_SEND)(void *, int, MPI_Datatype, int, int, MPI_Comm, MPI_Request*);
// Generic send method
MPI_Request Guarded_MPI_Send(MPI_SEND sendMethod, const void *ptr, size_t numBytes, int destRank, int tag) {
DEBUG("SEND: size " << numBytes << " tag " << hex << tag << dec << " to " << destRank); DEBUG("SEND: size " << numBytes << " tag " << hex << tag << dec << " to " << destRank);
ASSERT(numBytes > 0); ASSERT(numBytes > 0);
ASSERT(tag >= 0); // Silly MPI requirement ASSERT(tag >= 0); // Silly MPI requirement (Reason: MPI_ANY_TAG is -1, but only for receivers)
//SmartPtr<ScopedLock> sl = MPI_threadSafe() ? 0 : new ScopedLock(MPIMutex); //SmartPtr<ScopedLock> sl = MPI_threadSafe() ? 0 : new ScopedLock(MPIMutex);
MPI_Request request; MPI_Request request;
// const_cast is for missing const in protos in OpenMPI <=1.6 (1.10 is fixed, not sure in between)
int error; int error = ::MPI_Issend(const_cast<void*>(ptr), numBytes, MPI_BYTE, destRank, tag, MPI_COMM_WORLD, &request);
error = sendMethod(const_cast<void*>(ptr), numBytes, MPI_BYTE, destRank, tag, MPI_COMM_WORLD, &request);
ASSERT(error == MPI_SUCCESS); ASSERT(error == MPI_SUCCESS);
return request; return request;
} }
}
MPI_Request Guarded_MPI_Issend(const void *ptr, size_t numBytes, int destRank, int tag) {
return Guarded_MPI_Send(::MPI_Issend, ptr, numBytes, destRank, tag);
}
MPI_Request Guarded_MPI_Irsend(const void *ptr, size_t numBytes, int destRank, int tag) { MPI_Request Guarded_MPI_Irsend(const void *ptr, size_t numBytes, int destRank, int tag) {
return Guarded_MPI_Send(::MPI_Irsend, ptr, numBytes, destRank, tag); DEBUG("SEND: size " << numBytes << " tag " << hex << tag << dec << " to " << destRank);
ASSERT(numBytes > 0);
ASSERT(tag >= 0); // Silly MPI requirement (Reason: MPI_ANY_TAG is -1, but only for receivers)
//SmartPtr<ScopedLock> sl = MPI_threadSafe() ? 0 : new ScopedLock(MPIMutex);
MPI_Request request;
// const_cast is for missing const in protos in OpenMPI <=1.6 (1.10 is fixed, not sure in between)
int error = ::MPI_Irsend(const_cast<void*>(ptr), numBytes, MPI_BYTE, destRank, tag, MPI_COMM_WORLD, &request);
ASSERT(error == MPI_SUCCESS);
return request;
} }
MPI_Request Guarded_MPI_Ibsend(const void *ptr, size_t numBytes, int destRank, int tag) { MPI_Request Guarded_MPI_Ibsend(const void *ptr, size_t numBytes, int destRank, int tag) {
return Guarded_MPI_Send(::MPI_Ibsend, ptr, numBytes, destRank, tag); DEBUG("SEND: size " << numBytes << " tag " << hex << tag << dec << " to " << destRank);
ASSERT(numBytes > 0);
ASSERT(tag >= 0); // Silly MPI requirement (Reason: MPI_ANY_TAG is -1, but only for receivers)
//SmartPtr<ScopedLock> sl = MPI_threadSafe() ? 0 : new ScopedLock(MPIMutex);
MPI_Request request;
// const_cast is for missing const in protos in OpenMPI <=1.6 (1.10 is fixed, not sure in between)
int error = ::MPI_Ibsend(const_cast<void*>(ptr), numBytes, MPI_BYTE, destRank, tag, MPI_COMM_WORLD, &request);
ASSERT(error == MPI_SUCCESS);
return request;
} }
MPI_Request Guarded_MPI_Isend(const void *ptr, size_t numBytes, int destRank, int tag) { MPI_Request Guarded_MPI_Isend(const void *ptr, size_t numBytes, int destRank, int tag) {
return Guarded_MPI_Send(::MPI_Isend, ptr, numBytes, destRank, tag); DEBUG("SEND: size " << numBytes << " tag " << hex << tag << dec << " to " << destRank);
ASSERT(numBytes > 0);
ASSERT(tag >= 0); // Silly MPI requirement (Reason: MPI_ANY_TAG is -1, but only for receivers)
//SmartPtr<ScopedLock> sl = MPI_threadSafe() ? 0 : new ScopedLock(MPIMutex);
MPI_Request request;
// const_cast is for missing const in protos in OpenMPI <=1.6 (1.10 is fixed, not sure in between)
int error = ::MPI_Isend(const_cast<void*>(ptr), numBytes, MPI_BYTE, destRank, tag, MPI_COMM_WORLD, &request);
ASSERT(error == MPI_SUCCESS);
return request;
} }
MPI_Request Guarded_MPI_Irecv(void *ptr, size_t numBytes, int srcRank, int tag) { MPI_Request Guarded_MPI_Irecv(void *ptr, size_t numBytes, int srcRank, int tag) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment