Adding support for space sharing based on communicators for MPI-Interoperability
authorNikhil Jain <nikhil@illinois.edu>
Tue, 7 Aug 2012 05:05:07 +0000 (00:05 -0500)
committerNikhil Jain <nikhil@illinois.edu>
Tue, 7 Aug 2012 05:05:07 +0000 (00:05 -0500)
src/arch/mpi/machine.c
src/ck-core/mpi-interoperate.C
src/ck-core/mpi-interoperate.h

index 39ba2bacfc6fec58f5aa6f01aee3e3e55cca6761..ec8d0eb9b5b5f46a507dc0ab3a5663564ec4dcfc 100644 (file)
@@ -56,7 +56,7 @@ static int CMI_DYNAMIC_RECV_CAPSIZE=3;
 /* initial values, -1 indiates there's no cap */
 static int dynamicSendCap = CMI_DYNAMIC_MAXCAPSIZE;
 static int dynamicRecvCap = CMI_DYNAMIC_MAXCAPSIZE;
-static MPI_Comm charmComm;
+MPI_Comm charmComm;
 
 #if CMI_EXERT_SEND_CAP
 static int SEND_CAP=3;
index 74df0b7032f7cb73de5da664cf7c7712cab31cc9..3de87a57f0069e0ef8e48e91bb07fbfcff697824 100644 (file)
@@ -61,11 +61,12 @@ void _libExitHandler(envelope *env)
        }
 }
 
-void CharmLibInit(int peid, int numpes, int argc, char **argv){
+void CharmLibInit(MPI_Comm userComm, int argc, char **argv){
 #if CMK_CONVERSE_MPI
        //note CmiNumNodes and CmiMyNode should just be macros
-       _Cmi_numnodes = numpes;
-       _Cmi_mynode = peid;
+  charmComm = userComm;
+  MPI_Comm_size(charmComm, &_Cmi_numnodes);
+  MPI_Comm_rank(charmComm, &_Cmi_mynode);
 
        CharmLibInterOperate = 1;
        ConverseInit(argc, argv, (CmiStartFn)_initCharm, 1, 0);
index 2d8126e27f9dff8413f1d095d3d0d6c412bb2cdc..cd02692997ebe5f61e69a9e172d3f9d8b63f4c46 100644 (file)
@@ -4,14 +4,16 @@
 #include "converse.h"
 #include "ck.h"
 #include "trace.h"
+#include <mpi.h>
 
-void CharmLibInit(int peid, int numpes, int argc, char **argv);
+void CharmLibInit(MPI_Comm userComm, int argc, char **argv);
 void CharmLibExit();
 
 extern "C" void LibCkExit(void);
 
 extern int _ringexit;              // for charm exit
 extern int _ringtoken;
+extern MPI_Comm charmComm;
 extern void _initCharm(int unused_argc, char **argv);
 extern void CkExit(void);