Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp	(revision 1499)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp	(revision 1500)
@@ -66,10 +66,10 @@
     ::MPI_Type_get_extent(to_mpi_type(datatype), &lb, &datasize);
 
-    int ep_rank = comm.ep_comm_ptr->size_rank_info[0].first;
-    int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first;
-    int num_ep = comm.ep_comm_ptr->size_rank_info[1].second;
+    int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first;
+    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first;
+    int num_ep = comm->ep_comm_ptr->size_rank_info[1].second;
 
     #pragma omp critical (_reduce)
-    comm.my_buffer->void_buffer[ep_rank_loc] = const_cast< void* >(sendbuf);
+    comm->my_buffer->void_buffer[ep_rank_loc] = const_cast< void* >(sendbuf);
 
     MPI_Barrier_local(comm);
@@ -78,5 +78,5 @@
     {
 
-      memcpy(recvbuf, comm.my_buffer->void_buffer[0], datasize * count);
+      memcpy(recvbuf, comm->my_buffer->void_buffer[0], datasize * count);
 
       if(op == MPI_MAX)
@@ -86,5 +86,5 @@
           assert(datasize == sizeof(int));
           for(int i=1; i<num_ep; i++)
-            reduce_max<int>(static_cast<int*>(comm.my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
+            reduce_max<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
         }
 
@@ -93,5 +93,5 @@
           assert(datasize == sizeof(float));
           for(int i=1; i<num_ep; i++)
-            reduce_max<float>(static_cast<float*>(comm.my_buffer->void_buffer[i]), static_cast<float*>(recvbuf), count);
+            reduce_max<float>(static_cast<float*>(comm->my_buffer->void_buffer[i]), static_cast<float*>(recvbuf), count);
         }
 
@@ -100,5 +100,5 @@
           assert(datasize == sizeof(double));
           for(int i=1; i<num_ep; i++)
-            reduce_max<double>(static_cast<double*>(comm.my_buffer->void_buffer[i]), static_cast<double*>(recvbuf), count);
+            reduce_max<double>(static_cast<double*>(comm->my_buffer->void_buffer[i]), static_cast<double*>(recvbuf), count);
         }
 
@@ -107,5 +107,5 @@
           assert(datasize == sizeof(char));
           for(int i=1; i<num_ep; i++)
-            reduce_max<char>(static_cast<char*>(comm.my_buffer->void_buffer[i]), static_cast<char*>(recvbuf), count);
+            reduce_max<char>(static_cast<char*>(comm->my_buffer->void_buffer[i]), static_cast<char*>(recvbuf), count);
         }
 
@@ -114,5 +114,5 @@
           assert(datasize == sizeof(long));
           for(int i=1; i<num_ep; i++)
-            reduce_max<long>(static_cast<long*>(comm.my_buffer->void_buffer[i]), static_cast<long*>(recvbuf), count);
+            reduce_max<long>(static_cast<long*>(comm->my_buffer->void_buffer[i]), static_cast<long*>(recvbuf), count);
         }
 
@@ -121,5 +121,5 @@
           assert(datasize == sizeof(unsigned long));
           for(int i=1; i<num_ep; i++)
-            reduce_max<unsigned long>(static_cast<unsigned long*>(comm.my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);
+            reduce_max<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);
         }
 
@@ -128,5 +128,5 @@
           assert(datasize == sizeof(uint64_t));
           for(int i=1; i<num_ep; i++)
-            reduce_max<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count);
+            reduce_max<uint64_t>(static_cast<uint64_t*>(comm->my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count);
         }
         
@@ -135,5 +135,5 @@
           assert(datasize == sizeof(long long));
           for(int i=1; i<num_ep; i++)
-            reduce_max<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count);
+            reduce_max<long long>(static_cast<long long*>(comm->my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count);
         }
 
@@ -148,5 +148,5 @@
           assert(datasize == sizeof(int));
           for(int i=1; i<num_ep; i++)
-            reduce_min<int>(static_cast<int*>(comm.my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
+            reduce_min<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
         }
 
@@ -155,5 +155,5 @@
           assert(datasize == sizeof(float));
           for(int i=1; i<num_ep; i++)
-            reduce_min<float>(static_cast<float*>(comm.my_buffer->void_buffer[i]), static_cast<float*>(recvbuf), count);
+            reduce_min<float>(static_cast<float*>(comm->my_buffer->void_buffer[i]), static_cast<float*>(recvbuf), count);
         }
 
@@ -162,5 +162,5 @@
           assert(datasize == sizeof(double));
           for(int i=1; i<num_ep; i++)
-            reduce_min<double>(static_cast<double*>(comm.my_buffer->void_buffer[i]), static_cast<double*>(recvbuf), count);
+            reduce_min<double>(static_cast<double*>(comm->my_buffer->void_buffer[i]), static_cast<double*>(recvbuf), count);
         }
 
@@ -169,5 +169,5 @@
           assert(datasize == sizeof(char));
           for(int i=1; i<num_ep; i++)
-            reduce_min<char>(static_cast<char*>(comm.my_buffer->void_buffer[i]), static_cast<char*>(recvbuf), count);
+            reduce_min<char>(static_cast<char*>(comm->my_buffer->void_buffer[i]), static_cast<char*>(recvbuf), count);
         }
 
@@ -176,5 +176,5 @@
           assert(datasize == sizeof(long));
           for(int i=1; i<num_ep; i++)
-            reduce_min<long>(static_cast<long*>(comm.my_buffer->void_buffer[i]), static_cast<long*>(recvbuf), count);
+            reduce_min<long>(static_cast<long*>(comm->my_buffer->void_buffer[i]), static_cast<long*>(recvbuf), count);
         }
 
@@ -183,5 +183,5 @@
           assert(datasize == sizeof(unsigned long));
           for(int i=1; i<num_ep; i++)
-            reduce_min<unsigned long>(static_cast<unsigned long*>(comm.my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);
+            reduce_min<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);
         }
 
@@ -190,5 +190,5 @@
           assert(datasize == sizeof(uint64_t));
           for(int i=1; i<num_ep; i++)
-            reduce_min<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count);
+            reduce_min<uint64_t>(static_cast<uint64_t*>(comm->my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count);
         }
         
@@ -197,5 +197,5 @@
           assert(datasize == sizeof(long long));
           for(int i=1; i<num_ep; i++)
-            reduce_min<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count);
+            reduce_min<long long>(static_cast<long long*>(comm->my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count);
         }
 
@@ -211,5 +211,5 @@
           assert(datasize == sizeof(int));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<int>(static_cast<int*>(comm.my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
+            reduce_sum<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
         }
 
@@ -218,5 +218,5 @@
           assert(datasize == sizeof(float));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<float>(static_cast<float*>(comm.my_buffer->void_buffer[i]), static_cast<float*>(recvbuf), count);
+            reduce_sum<float>(static_cast<float*>(comm->my_buffer->void_buffer[i]), static_cast<float*>(recvbuf), count);
         }
 
@@ -225,5 +225,5 @@
           assert(datasize == sizeof(double));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<double>(static_cast<double*>(comm.my_buffer->void_buffer[i]), static_cast<double*>(recvbuf), count);
+            reduce_sum<double>(static_cast<double*>(comm->my_buffer->void_buffer[i]), static_cast<double*>(recvbuf), count);
         }
 
@@ -232,5 +232,5 @@
           assert(datasize == sizeof(char));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<char>(static_cast<char*>(comm.my_buffer->void_buffer[i]), static_cast<char*>(recvbuf), count);
+            reduce_sum<char>(static_cast<char*>(comm->my_buffer->void_buffer[i]), static_cast<char*>(recvbuf), count);
         }
 
@@ -239,5 +239,5 @@
           assert(datasize == sizeof(long));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<long>(static_cast<long*>(comm.my_buffer->void_buffer[i]), static_cast<long*>(recvbuf), count);
+            reduce_sum<long>(static_cast<long*>(comm->my_buffer->void_buffer[i]), static_cast<long*>(recvbuf), count);
         }
 
@@ -246,5 +246,5 @@
           assert(datasize == sizeof(unsigned long));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<unsigned long>(static_cast<unsigned long*>(comm.my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);
+            reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);
         }
 
@@ -253,5 +253,5 @@
           assert(datasize == sizeof(uint64_t));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<uint64_t>(static_cast<uint64_t*>(comm.my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count);
+            reduce_sum<uint64_t>(static_cast<uint64_t*>(comm->my_buffer->void_buffer[i]), static_cast<uint64_t*>(recvbuf), count);
         }
         
@@ -260,5 +260,5 @@
           assert(datasize == sizeof(long long));
           for(int i=1; i<num_ep; i++)
-            reduce_sum<long long>(static_cast<long long*>(comm.my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count);
+            reduce_sum<long long>(static_cast<long long*>(comm->my_buffer->void_buffer[i]), static_cast<long long*>(recvbuf), count);
         }
 
@@ -275,5 +275,5 @@
           assert(datasize == sizeof(int));
           for(int i=1; i<num_ep; i++)
-            reduce_lor<int>(static_cast<int*>(comm.my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
+            reduce_lor<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
         }
       }
@@ -288,20 +288,20 @@
   {
 
-    if(!comm.is_ep && comm.mpi_comm)
-    {
-      return ::MPI_Reduce(sendbuf, recvbuf, count, to_mpi_type(datatype), to_mpi_op(op), root, to_mpi_comm(comm.mpi_comm));
-    }
-
-
-
-    int ep_rank = comm.ep_comm_ptr->size_rank_info[0].first;
-    int ep_rank_loc = comm.ep_comm_ptr->size_rank_info[1].first;
-    int mpi_rank = comm.ep_comm_ptr->size_rank_info[2].first;
-    int ep_size = comm.ep_comm_ptr->size_rank_info[0].second;
-    int num_ep = comm.ep_comm_ptr->size_rank_info[1].second;
-    int mpi_size = comm.ep_comm_ptr->size_rank_info[2].second;
-
-    int root_mpi_rank = comm.rank_map->at(root).second;
-    int root_ep_loc = comm.rank_map->at(root).first;
+    if(!comm->is_ep && comm->mpi_comm)
+    {
+      return ::MPI_Reduce(sendbuf, recvbuf, count, to_mpi_type(datatype), to_mpi_op(op), root, to_mpi_comm(comm->mpi_comm));
+    }
+
+
+
+    int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first;
+    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first;
+    int mpi_rank = comm->ep_comm_ptr->size_rank_info[2].first;
+    int ep_size = comm->ep_comm_ptr->size_rank_info[0].second;
+    int num_ep = comm->ep_comm_ptr->size_rank_info[1].second;
+    int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second;
+
+    int root_mpi_rank = comm->rank_map->at(root).second;
+    int root_ep_loc = comm->rank_map->at(root).first;
 
     ::MPI_Aint datasize, lb;
@@ -326,5 +326,5 @@
     if(is_master)
     {
-      ::MPI_Reduce(local_recvbuf, recvbuf, count, to_mpi_type(datatype), to_mpi_op(op), root_mpi_rank, to_mpi_comm(comm.mpi_comm));
+      ::MPI_Reduce(local_recvbuf, recvbuf, count, to_mpi_type(datatype), to_mpi_op(op), root_mpi_rank, to_mpi_comm(comm->mpi_comm));
       
     }
