Index: /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp	(revision 23348)
+++ /issm/trunk-jpl/src/c/toolkits/mpi/issmmpi.cpp	(revision 23349)
@@ -42,5 +42,5 @@
   assert(sendcount==recvcount || sendtype==recvtype); // we handle only identical representations
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Allgather(sendbuf,
 		    sendcount,
@@ -76,5 +76,5 @@
   assert(sendtype==recvtype); // we handle only identical representations
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Allgatherv(sendbuf,
 		     sendcount,
@@ -113,5 +113,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Allreduce(sendbuf,
 		    recvbuf,
@@ -145,5 +145,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Barrier(comm);
 # else 
@@ -159,5 +159,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Bcast(buffer, 
 		count,
@@ -181,5 +181,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   assert(0); // to be implemented
 # else 
@@ -217,6 +217,9 @@
 	int rc=0;
 	#ifdef _HAVE_MPI_
-		#ifdef _HAVE_AMPI_
-			#ifdef _HAVE_ADJOINTMPI_
+		#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
+			#if defined(_HAVE_ADJOINTMPI_)
+				rc=AMPI_Finalize();
+			#elif defined(_HAVE_MEDIPACK_)
+				TOOL::finalize();
 				rc=AMPI_Finalize();
 			#else
@@ -234,5 +237,5 @@
   assert(sendtype==recvtype && sendcnt==recvcnt); // we handle only identical representations
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Gather(sendbuf,
 		 sendcnt,
@@ -271,5 +274,5 @@
   assert(sendtype==recvtype); // we handle only identical representations
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Gatherv(sendbuf,
 		  sendcnt,
@@ -310,7 +313,10 @@
 	int rc=0;
 	#ifdef _HAVE_MPI_
-		#ifdef _HAVE_AMPI_
-			#ifdef _HAVE_ADJOINTMPI_
+		#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
+			#if defined(_HAVE_ADJOINTMPI_)
 				rc=AMPI_Init(argc,argv);
+			#elif defined(_HAVE_MEDIPACK_)
+				rc=AMPI_Init(argc,argv);
+				TOOL::init();
 			#else
 				rc=AMPI_Init_NT(argc,argv);
@@ -326,5 +332,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Recv(buf, 
 	       count,
@@ -357,5 +363,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Reduce(sendbuf,
 		 recvbuf,
@@ -392,5 +398,5 @@
   assert(sendtype==recvtype && sendcnt==recvcnt); // we handle only identical representations
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Scatter(sendbuf,
 		  sendcnt,
@@ -429,5 +435,5 @@
   assert(sendtype==recvtype); // we handle only identical representations
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Scatterv(sendbuf,
 		   sendcnts,
@@ -468,5 +474,5 @@
   int rc=0;
 #ifdef _HAVE_MPI_
-# ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
   rc=AMPI_Send(buf, 
 	       count,
@@ -512,5 +518,5 @@
 int rc=0;
 #ifdef _HAVE_MPI_
-#ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
 rc=MPI_Comm_split(comm, color, key, newcomm);
 #else
@@ -526,5 +532,5 @@
 	int rc=0;
 #ifdef _HAVE_MPI_
-#ifdef _HAVE_AMPI_
+#if defined(_HAVE_AMPI_) &&  !defined(_WRAPPERS_)
 	rc=MPI_Intercomm_create(comm,local_leader,peer_comm,remote_leader,tag,newintercomm);
 #else
