Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_exscan.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_exscan.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_exscan.cpp	(revision 1540)
@@ -122,8 +122,19 @@
           reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);    
       }
-
-      else printf("datatype Error\n");
-
       
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=0; i<ep_rank_loc; i++)
+          reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+
+      
     }
 
@@ -172,8 +183,19 @@
       }
      
-      else printf("datatype Error\n");
-    }
-
-    else //if(op == MPI_MIN)
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=0; i<ep_rank_loc; i++)
+          reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+    }
+
+    else if(op == MPI_MIN)
     {
       if(datatype == MPI_INT )
@@ -219,5 +241,22 @@
       }
 
-      else printf("datatype Error\n");
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=0; i<ep_rank_loc; i++)
+          reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+    }
+    
+    else
+    {
+      printf("op type Error in ep_exscan : MPI_MAX, MPI_MIN, MPI_SUM\n");
+      MPI_Abort(comm, 0);
     }
 
@@ -231,5 +270,6 @@
     if(comm->is_intercomm) return MPI_Exscan_intercomm(sendbuf, recvbuf, count, datatype, op, comm);
     
-    valid_type(datatype);
+    assert(valid_type(datatype));
+    assert(valid_op(op));
 
     int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first;
Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.cpp	(revision 1540)
@@ -418,11 +418,11 @@
     }
 
-    int my_turn = ownership==1? ep_rank_loc : ep_rank_loc+repeated;
-
-#ifdef _showinfo
-
-    MPI_Barrier(peer_comm);
-    MPI_Barrier(peer_comm);
-    printf("peer_rank = %d, ep_rank_loc = %d, ownership = %d, repeated = %d, my_turn = %d\n", peer_comm->ep_comm_ptr->size_rank_info[0].first, ep_rank_loc, ownership, repeated, my_turn);
+    int new_ep_rank_loc = ownership==1? ep_rank_loc : ep_rank_loc+repeated;
+
+#ifdef _showinfo
+
+    MPI_Barrier(peer_comm);
+    MPI_Barrier(peer_comm);
+    printf("peer_rank = %d, ep_rank_loc = %d, ownership = %d, repeated = %d, new_ep_rank_loc = %d\n", peer_comm->ep_comm_ptr->size_rank_info[0].first, ep_rank_loc, ownership, repeated, new_ep_rank_loc);
     MPI_Barrier(peer_comm);
     MPI_Barrier(peer_comm);
@@ -441,5 +441,5 @@
           if(iter->first == make_pair(tag, min(local_leader_rank_in_world, remote_leader_rank_in_world)))
           {
-            *newintercomm = iter->second.first[my_turn];
+            *newintercomm = iter->second.first[new_ep_rank_loc];
             
             iter->second.second.second++;
Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp	(revision 1540)
@@ -137,5 +137,5 @@
        || datatype == MPI_LONG 
        || datatype == MPI_UNSIGNED_LONG
-       || datatype == MPI_UINT64_T)
+       || datatype == MPI_LONG_LONG)
     {
       return true;
Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_merge.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_merge.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_merge.cpp	(revision 1540)
@@ -31,4 +31,21 @@
 
     (*newintracomm)->ep_comm_ptr->size_rank_info[0].second = ep_size + remote_ep_size;
+    
+    ///////////////////////////////////
+    int int_high = high? 1 : 0;
+    int sum_high;
+    
+    MPI_Allreduce(&int_high, &sum_high, 1, MPI_INT, MPI_SUM, *newintracomm);
+
+    if(sum_high==0 || sum_high==ep_size+remote_ep_size)
+    {
+      printf("MPI_Intercomm_merge error: please define high with different value...\n");
+      MPI_Abort(inter_comm, 0);
+    }
+    
+    
+    
+    ///////////////////////////////////
+    
     (*newintracomm)->ep_comm_ptr->size_rank_info[0].first = new_ep_rank;
 
@@ -83,4 +100,5 @@
 
     delete[] my_triple_list;
+
   }
   
Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp	(revision 1540)
@@ -124,11 +124,4 @@
         }
 
-        else if(datatype == MPI_UINT64_T)
-        {
-          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);
-        }
-        
         else if(datatype == MPI_LONG_LONG_INT)
         {
@@ -138,9 +131,13 @@
         }
 
-        else printf("datatype Error\n");
-
-      }
-
-      if(op == MPI_MIN)
+        else 
+        {
+          printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+
+      }
+
+      else if(op == MPI_MIN)
       {
         if(datatype ==MPI_INT)
@@ -186,11 +183,4 @@
         }
 
-        else if(datatype == MPI_UINT64_T)
-        {
-          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);
-        }
-        
         else if(datatype == MPI_LONG_LONG_INT)
         {
@@ -200,10 +190,14 @@
         }
 
-        else printf("datatype Error\n");
-
-      }
-
-
-      if(op == MPI_SUM)
+        else 
+        {
+          printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+
+      }
+
+
+      else if(op == MPI_SUM)
       {
         if(datatype==MPI_INT)
@@ -247,11 +241,4 @@
           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);
-        }
-
-        else if(datatype ==MPI_UINT64_T)
-        {
-          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);
         }
         
@@ -263,9 +250,13 @@
         }
 
-        else printf("datatype Error\n");
-
-      }
-
-      if(op == MPI_LOR)
+        else 
+        {
+          printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+
+      }
+
+      else if(op == MPI_LOR)
       {
         if(datatype != MPI_INT)
@@ -277,4 +268,10 @@
             reduce_lor<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
         }
+      }
+      
+      else
+      {
+        printf("op type Error in ep_reduce : MPI_MAX, MPI_MIN, MPI_SUM, MPI_LOR\n");
+        MPI_Abort(comm, 0);
       }
     }
Index: XIOS/dev/branch_openmp/extern/ep_dev/ep_scan.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/ep_dev/ep_scan.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/ep_dev/ep_scan.cpp	(revision 1540)
@@ -98,6 +98,16 @@
           reduce_sum<unsigned long>(static_cast<unsigned long*>(const_cast<void*>(sendbuf)), static_cast<unsigned long*>(recvbuf), count);    
         }
-            
-        else printf("datatype Error\n");
+        
+        else if(datatype == MPI_LONG_LONG_INT)
+        {
+          assert(datasize == sizeof(long long int));
+          reduce_sum<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count);    
+        }
+            
+        else 
+        {
+          printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
       }
 
@@ -140,8 +150,18 @@
         } 
             
-        else printf("datatype Error\n");
-      }
-
-      else //(op == MPI_MIN)
+        else if(datatype == MPI_LONG_LONG_INT)
+        {
+          assert(datasize == sizeof(long long int));
+          reduce_max<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count);    
+        }
+            
+        else 
+        {
+          printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+      }
+
+      else if(op == MPI_MIN)
       {
         if(datatype == MPI_INT )
@@ -181,5 +201,21 @@
         }
             
-        else printf("datatype Error\n");
+        else if(datatype == MPI_LONG_LONG_INT)
+        {
+          assert(datasize == sizeof(long long int));
+          reduce_min<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count);    
+        }
+            
+        else 
+        {
+          printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+      }
+      
+      else
+      {
+        printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n");
+        MPI_Abort(comm, 0);
       }
 
@@ -243,6 +279,17 @@
           reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);    
       }
-
-      else printf("datatype Error\n");
+      
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=1; i<ep_rank_loc+1; i++)
+          reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
 
       
@@ -293,8 +340,20 @@
       }
      
-      else printf("datatype Error\n");
-    }
-
-    else //if(op == MPI_MIN)
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=1; i<ep_rank_loc+1; i++)
+          reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+
+    }
+
+    else if(op == MPI_MIN)
     {
       if(datatype == MPI_INT )
@@ -340,5 +399,23 @@
       }
 
-      else printf("datatype Error\n");
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=1; i<ep_rank_loc+1; i++)
+          reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+
+    }
+    
+    else
+    {
+      printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n");
+      MPI_Abort(comm, 0);
     }
 
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_exscan.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_exscan.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_exscan.cpp	(revision 1540)
@@ -122,8 +122,19 @@
           reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);    
       }
-
-      else printf("datatype Error\n");
-
       
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=0; i<ep_rank_loc; i++)
+          reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+
+      
     }
 
@@ -172,8 +183,19 @@
       }
      
-      else printf("datatype Error\n");
-    }
-
-    else //if(op == MPI_MIN)
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=0; i<ep_rank_loc; i++)
+          reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+    }
+
+    else if(op == MPI_MIN)
     {
       if(datatype == MPI_INT )
@@ -219,5 +241,22 @@
       }
 
-      else printf("datatype Error\n");
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=0; i<ep_rank_loc; i++)
+          reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_exscan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+    }
+    
+    else
+    {
+      printf("op type Error in ep_exscan : MPI_MAX, MPI_MIN, MPI_SUM\n");
+      MPI_Abort(comm, 0);
     }
 
@@ -231,5 +270,6 @@
     if(comm->is_intercomm) return MPI_Exscan_intercomm(sendbuf, recvbuf, count, datatype, op, comm);
     
-    valid_type(datatype);
+    assert(valid_type(datatype));
+    assert(valid_op(op));
 
     int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first;
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp	(revision 1540)
@@ -137,5 +137,5 @@
        || datatype == MPI_LONG 
        || datatype == MPI_UNSIGNED_LONG
-       || datatype == MPI_UINT64_T)
+       || datatype == MPI_LONG_LONG)
     {
       return true;
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp	(revision 1540)
@@ -124,11 +124,4 @@
         }
 
-        else if(datatype == MPI_UINT64_T)
-        {
-          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);
-        }
-        
         else if(datatype == MPI_LONG_LONG_INT)
         {
@@ -138,9 +131,13 @@
         }
 
-        else printf("datatype Error\n");
-
-      }
-
-      if(op == MPI_MIN)
+        else 
+        {
+          printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+
+      }
+
+      else if(op == MPI_MIN)
       {
         if(datatype ==MPI_INT)
@@ -186,11 +183,4 @@
         }
 
-        else if(datatype == MPI_UINT64_T)
-        {
-          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);
-        }
-        
         else if(datatype == MPI_LONG_LONG_INT)
         {
@@ -200,10 +190,14 @@
         }
 
-        else printf("datatype Error\n");
-
-      }
-
-
-      if(op == MPI_SUM)
+        else 
+        {
+          printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+
+      }
+
+
+      else if(op == MPI_SUM)
       {
         if(datatype==MPI_INT)
@@ -247,11 +241,4 @@
           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);
-        }
-
-        else if(datatype ==MPI_UINT64_T)
-        {
-          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);
         }
         
@@ -263,9 +250,13 @@
         }
 
-        else printf("datatype Error\n");
-
-      }
-
-      if(op == MPI_LOR)
+        else 
+        {
+          printf("datatype Error in ep_reduce : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+
+      }
+
+      else if(op == MPI_LOR)
       {
         if(datatype != MPI_INT)
@@ -277,4 +268,10 @@
             reduce_lor<int>(static_cast<int*>(comm->my_buffer->void_buffer[i]), static_cast<int*>(recvbuf), count);
         }
+      }
+      
+      else
+      {
+        printf("op type Error in ep_reduce : MPI_MAX, MPI_MIN, MPI_SUM, MPI_LOR\n");
+        MPI_Abort(comm, 0);
       }
     }
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_scan.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_scan.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_scan.cpp	(revision 1540)
@@ -98,6 +98,16 @@
           reduce_sum<unsigned long>(static_cast<unsigned long*>(const_cast<void*>(sendbuf)), static_cast<unsigned long*>(recvbuf), count);    
         }
-            
-        else printf("datatype Error\n");
+        
+        else if(datatype == MPI_LONG_LONG_INT)
+        {
+          assert(datasize == sizeof(long long int));
+          reduce_sum<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count);    
+        }
+            
+        else 
+        {
+          printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
       }
 
@@ -140,8 +150,18 @@
         } 
             
-        else printf("datatype Error\n");
-      }
-
-      else //(op == MPI_MIN)
+        else if(datatype == MPI_LONG_LONG_INT)
+        {
+          assert(datasize == sizeof(long long int));
+          reduce_max<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count);    
+        }
+            
+        else 
+        {
+          printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+      }
+
+      else if(op == MPI_MIN)
       {
         if(datatype == MPI_INT )
@@ -181,5 +201,21 @@
         }
             
-        else printf("datatype Error\n");
+        else if(datatype == MPI_LONG_LONG_INT)
+        {
+          assert(datasize == sizeof(long long int));
+          reduce_min<long long int>(static_cast<long long int*>(const_cast<void*>(sendbuf)), static_cast<long long int*>(recvbuf), count);    
+        }
+            
+        else 
+        {
+          printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+          MPI_Abort(comm, 0);
+        }
+      }
+      
+      else
+      {
+        printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n");
+        MPI_Abort(comm, 0);
       }
 
@@ -243,6 +279,17 @@
           reduce_sum<unsigned long>(static_cast<unsigned long*>(comm->my_buffer->void_buffer[i]), static_cast<unsigned long*>(recvbuf), count);    
       }
-
-      else printf("datatype Error\n");
+      
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=1; i<ep_rank_loc+1; i++)
+          reduce_sum<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
 
       
@@ -293,8 +340,20 @@
       }
      
-      else printf("datatype Error\n");
-    }
-
-    else //if(op == MPI_MIN)
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=1; i<ep_rank_loc+1; i++)
+          reduce_max<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+
+    }
+
+    else if(op == MPI_MIN)
     {
       if(datatype == MPI_INT )
@@ -340,5 +399,23 @@
       }
 
-      else printf("datatype Error\n");
+      else if(datatype == MPI_LONG_LONG_INT )
+      {
+        assert(datasize == sizeof(long long int));
+        for(int i=1; i<ep_rank_loc+1; i++)
+          reduce_min<long long int>(static_cast<long long int*>(comm->my_buffer->void_buffer[i]), static_cast<long long int*>(recvbuf), count);    
+      }
+
+      else 
+      {
+        printf("datatype Error in ep_scan : INT, FLOAT, DOUBLE, CHAR, LONG, UNSIGNED_LONG, LONG_LONG_INT\n");
+        MPI_Abort(comm, 0);
+      }
+
+    }
+    
+    else
+    {
+      printf("op type Error in ep_scan : MPI_MAX, MPI_MIN, MPI_SUM\n");
+      MPI_Abort(comm, 0);
     }
 
Index: XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp	(revision 1539)
+++ XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp	(revision 1540)
@@ -714,4 +714,8 @@
 CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, const ep_lib::MPI_Comm comm)
   : CNc4DataOutput(NULL, filename, false, false, true, comm, false, true) {}
+  
+CDomainAlgorithmInterpolate::WriteNetCdf::WriteNetCdf(const StdString& filename, bool exist, const ep_lib::MPI_Comm comm)
+  : CNc4DataOutput(NULL, filename, exist, false, true, comm, false, true) {}
+  
 int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name, 
                                                                 const StdSize size)
@@ -806,30 +810,59 @@
   std::vector<StdSize> count(1, localNbWeight);
   
-  WriteNetCdf netCdfWriter(filename, client->intraComm);  
-
-  // Define some dimensions
-  netCdfWriter.addDimensionWrite("n_src", n_src);
-  netCdfWriter.addDimensionWrite("n_dst", n_dst);
-  netCdfWriter.addDimensionWrite("n_weight", globalNbWeight);
-  
-  std::vector<StdString> dims(1,"n_weight");
-
-  // Add some variables
-  netCdfWriter.addVariableWrite("src_idx", NC_INT, dims);
-  netCdfWriter.addVariableWrite("dst_idx", NC_INT, dims);
-  netCdfWriter.addVariableWrite("weight", NC_DOUBLE, dims);
-
-  // End of definition
-  netCdfWriter.endDefinition();
-
-  // // Write variables
-  if (0 != localNbWeight)
-  {
-    netCdfWriter.writeDataIndex(src_idx, "src_idx", false, 0, &start, &count);
-    netCdfWriter.writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count);
-    netCdfWriter.writeDataIndex(weights, "weight", false, 0, &start, &count);
-  }
-
-  netCdfWriter.closeFile();
+  int my_rank_loc = client->intraComm->ep_comm_ptr->size_rank_info[1].first;
+  
+  cout<<"begin write weight info"<< endl;
+ 
+  WriteNetCdf *netCdfWriter;
+
+//  #pragma omp barrier
+//  #pragma omp master
+  MPI_Barrier_local(client->intraComm);
+  if(my_rank_loc==0)
+  {
+  
+    WriteNetCdf my_writer(filename, client->intraComm);  
+    netCdfWriter = &my_writer; 
+  
+    // Define some dimensions
+    netCdfWriter->addDimensionWrite("n_src", n_src);
+    netCdfWriter->addDimensionWrite("n_dst", n_dst);
+    netCdfWriter->addDimensionWrite("n_weight", globalNbWeight);
+  
+    std::vector<StdString> dims(1,"n_weight");
+
+    // Add some variables
+    netCdfWriter->addVariableWrite("src_idx", NC_INT, dims);
+    netCdfWriter->addVariableWrite("dst_idx", NC_INT, dims);
+    netCdfWriter->addVariableWrite("weight", NC_DOUBLE, dims);
+
+    // End of definition
+    netCdfWriter->endDefinition();
+  
+    netCdfWriter->closeFile();
+  }
+  
+//  #pragma omp barrier
+  MPI_Barrier_local(client->intraComm);
+  
+  #pragma omp critical (write_weight_data)
+  {
+    // open file
+    WriteNetCdf my_writer(filename, true, client->intraComm);  
+    netCdfWriter = &my_writer; 
+    
+    // // Write variables
+    if (0 != localNbWeight)
+    {
+      netCdfWriter->writeDataIndex(src_idx, "src_idx", false, 0, &start, &count);
+      netCdfWriter->writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count);
+      netCdfWriter->writeDataIndex(weights, "weight", false, 0, &start, &count);
+    }
+  }
+  
+  MPI_Barrier_local(client->intraComm);
+  
+//  #pragma omp barrier
+  cout<<"end write weight info"<< endl;
 }
 
@@ -861,43 +894,46 @@
   }
                   
-  nc_open(filename.c_str(),NC_NOWRITE, &ncid) ;
-  nc_inq_dimid(ncid,"n_weight",&weightDimId) ;
-  nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ;
-
-  size_t nbWeight ;
-  size_t start ;
-  size_t div = nbWeightGlo/clientSize ;
-  size_t mod = nbWeightGlo%clientSize ;
-  if (clientRank < mod)
-  {
-    nbWeight=div+1 ;
-    start=clientRank*(div+1) ;
-  }
-  else
-  {
-    nbWeight=div ;
-    start= mod * (div+1) + (clientRank-mod) * div ;
-  }
-
-  double* weight=new double[nbWeight] ;
-  int weightId ;
-  nc_inq_varid (ncid, "weight", &weightId) ;
-  nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ;
-
-  long* srcIndex=new long[nbWeight] ;
-  int srcIndexId ;
-  nc_inq_varid (ncid, "src_idx", &srcIndexId) ;
-  nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ;
-
-  long* dstIndex=new long[nbWeight] ;
-  int dstIndexId ;
-  nc_inq_varid (ncid, "dst_idx", &dstIndexId) ;
-  nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ;
-
-  int indexOffset=0 ;
-  if (fortranConvention) indexOffset=1 ;
-    for(size_t ind=0; ind<nbWeight;++ind)
-      interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind]));
- }
+  #pragma omp critical (read_weight_data)
+  {
+    nc_open(filename.c_str(),NC_NOWRITE, &ncid) ;
+    nc_inq_dimid(ncid,"n_weight",&weightDimId) ;
+    nc_inq_dimlen(ncid,weightDimId,&nbWeightGlo) ;
+
+    size_t nbWeight ;
+    size_t start ;
+    size_t div = nbWeightGlo/clientSize ;
+    size_t mod = nbWeightGlo%clientSize ;
+    if (clientRank < mod)
+    {
+      nbWeight=div+1 ;
+      start=clientRank*(div+1) ;
+    }
+    else
+    {
+      nbWeight=div ;
+      start= mod * (div+1) + (clientRank-mod) * div ;
+    }
+
+    double* weight=new double[nbWeight] ;
+    int weightId ;
+    nc_inq_varid (ncid, "weight", &weightId) ;
+    nc_get_vara_double(ncid, weightId, &start, &nbWeight, weight) ;
+
+    long* srcIndex=new long[nbWeight] ;
+    int srcIndexId ;
+    nc_inq_varid (ncid, "src_idx", &srcIndexId) ;
+    nc_get_vara_long(ncid, srcIndexId, &start, &nbWeight, srcIndex) ;
+
+    long* dstIndex=new long[nbWeight] ;
+    int dstIndexId ;
+    nc_inq_varid (ncid, "dst_idx", &dstIndexId) ;
+    nc_get_vara_long(ncid, dstIndexId, &start, &nbWeight, dstIndex) ;
+
+    int indexOffset=0 ;
+    if (fortranConvention) indexOffset=1 ;
+      for(size_t ind=0; ind<nbWeight;++ind)
+        interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind]));
+  }
+}
 
 void CDomainAlgorithmInterpolate::apply(const std::vector<std::pair<int,double> >& localIndex,
Index: XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.hpp
===================================================================
--- XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.hpp	(revision 1539)
+++ XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.hpp	(revision 1540)
@@ -71,4 +71,5 @@
   public:
     WriteNetCdf(const StdString& filename, const ep_lib::MPI_Comm comm);
+    WriteNetCdf(const StdString& filename, bool exist, const ep_lib::MPI_Comm comm);
     int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM);
     int addVariableWrite(const StdString& name, nc_type type,
