Index: /XIOS/dev/branch_openmp/bld.cfg
===================================================================
--- /XIOS/dev/branch_openmp/bld.cfg	(revision 1554)
+++ /XIOS/dev/branch_openmp/bld.cfg	(revision 1555)
@@ -34,14 +34,14 @@
 bld::target libxios.a 
 #bld::target generate_fortran_interface.exe 
-#bld::target xios_server.exe 
+bld::target xios_server.exe 
 #bld::target test_regular.exe
 #bld::target test_expand_domain.exe
 #bld::target test_new_features.exe 
 #bld::target test_unstruct_complete.exe 
-bld::target test_omp.exe 
-bld::target test_complete_omp.exe 
+#bld::target test_omp.exe 
+#bld::target test_complete_omp.exe 
 #bld::target test_remap.exe 
 #bld::target test_remap_ref.exe 
-bld::target test_remap_omp.exe 
+#bld::target test_remap_omp.exe 
 #bld::target test_unstruct_omp.exe
 #bld::target test_netcdf_omp.exe
@@ -52,5 +52,5 @@
 #bld::target test_connectivity_expand.exe
 #bld::target toy_cmip6.exe
-bld::target toy_cmip6_omp.exe
+#bld::target toy_cmip6_omp.exe
 bld::exe_dep
 
Index: /XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp
===================================================================
--- /XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp	(revision 1554)
+++ /XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp	(revision 1555)
@@ -22,5 +22,11 @@
 int CNetCdfInterface::create(const StdString& fileName, int cMode, int& ncId)
 {
-  int status = nc_create(fileName.c_str(), cMode, &ncId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_create"<<std::endl;
+    status = nc_create(fileName.c_str(), cMode, &ncId);
+    info(100)<<"end nc_create"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -50,4 +56,5 @@
 {
   int status = xios::nc_create_par(fileName.c_str(), cMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId);
+
   if (NC_NOERR != status)
   {
@@ -74,5 +81,11 @@
 int CNetCdfInterface::open(const StdString& fileName, int oMode, int& ncId)
 {
-  int status = nc_open(fileName.c_str(), oMode, &ncId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_open"<<std::endl;
+    status = nc_open(fileName.c_str(), oMode, &ncId);
+    info(100)<<"end nc_open"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -102,7 +115,5 @@
 int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId)
 {
-  int status;
-  #pragma omp critical (_netcdf)
-  status = xios::nc_open_par(fileName.c_str(), oMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId);
+  int status = xios::nc_open_par(fileName.c_str(), oMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId);
   
   if (NC_NOERR != status)
@@ -129,17 +140,20 @@
 {
   int status = NC_NOERR;
-  #pragma omp master
-  {
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_close"<<std::endl;
     status = nc_close(ncId);
-    if (NC_NOERR != status)
-    {
-      StdString errormsg(nc_strerror(status));
-      StdStringStream sstr;
-      sstr << "Error when calling function nc_close(ncId)" << std::endl
-           << errormsg << std::endl
-           << "Unable to close file, given its id: " << ncId << std::endl;
-      StdString e = sstr.str();
-      throw CNetCdfException(e);
-    }
+    info(100)<<"end nc_close"<<std::endl;
+  }
+      
+  if (NC_NOERR != status)
+  {
+    StdString errormsg(nc_strerror(status));
+    StdStringStream sstr;
+    sstr << "Error when calling function nc_close(ncId)" << std::endl
+         << errormsg << std::endl
+         << "Unable to close file, given its id: " << ncId << std::endl;
+    StdString e = sstr.str();
+    throw CNetCdfException(e);
   }
 
@@ -154,5 +168,12 @@
 int CNetCdfInterface::reDef(int ncId)
 {
-  int status = nc_redef(ncId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_reDef"<<std::endl;
+    status = nc_redef(ncId);
+    info(100)<<"end nc_reDef"<<std::endl;
+  }
+  
   if (NC_NOERR != status)
   {
@@ -176,5 +197,11 @@
 int CNetCdfInterface::endDef(int ncId)
 {
-  int status = nc_enddef(ncId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_enddef"<<std::endl;
+    status = nc_enddef(ncId);
+    info(100)<<"end nc_enddef"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -201,5 +228,12 @@
 int CNetCdfInterface::inqNcId(int ncid, const StdString& grpName, int& grpId)
 {
-  int status = nc_inq_ncid(ncid, grpName.c_str(), &grpId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_ncid"<<std::endl;
+    status = nc_inq_ncid(ncid, grpName.c_str(), &grpId);
+    info(100)<<"end nc_inq_ncid"<<std::endl;
+  }
+  
   if (NC_NOERR != status)
   {
@@ -227,5 +261,11 @@
 int CNetCdfInterface::inqVarId(int ncid, const StdString& varName, int& varId)
 {
-  int status = nc_inq_varid(ncid, varName.c_str(), &varId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_varid"<<std::endl;
+    status = nc_inq_varid(ncid, varName.c_str(), &varId);
+    info(100)<<"end nc_inq_varid"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -252,5 +292,12 @@
 int CNetCdfInterface::inqDimId(int ncid, const StdString& dimName, int& dimId)
 {
-  int status = nc_inq_dimid(ncid, dimName.c_str(), &dimId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_dimid"<<std::endl;
+    status = nc_inq_dimid(ncid, dimName.c_str(), &dimId);
+    info(100)<<"end nc_inq_dimid"<<std::endl;
+  }
+  
   if (NC_NOERR != status)
   {
@@ -278,5 +325,11 @@
 {
   char varNameBuff[NC_MAX_NAME + 1];
-  int status = nc_inq_varname(ncid, varId, varNameBuff);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_varname"<<std::endl;
+    status = nc_inq_varname(ncid, varId, varNameBuff);
+    info(100)<<"end nc_inq_varname"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -302,5 +355,11 @@
 int CNetCdfInterface::inqUnLimDim(int ncid, int& dimId)
 {
-  int status = nc_inq_unlimdim(ncid, &dimId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_unlimdim"<<std::endl;
+    status = nc_inq_unlimdim(ncid, &dimId);
+    info(100)<<"end nc_inq_unlimdim"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -328,5 +387,11 @@
 {
   char fullNameIn[NC_MAX_NAME + 1];
-  int status = nc_inq_dimname(ncid, dimId, fullNameIn);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_dimname"<<std::endl;
+    status = nc_inq_dimname(ncid, dimId, fullNameIn);
+    info(100)<<"end nc_inq_dimname"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -353,5 +418,11 @@
 int CNetCdfInterface::inqDimLen(int ncid, int dimId, StdSize& dimLen)
 {
-  int status = nc_inq_dimlen(ncid, dimId, &dimLen);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_dimlen"<<std::endl;
+    status = nc_inq_dimlen(ncid, dimId, &dimLen);
+    info(100)<<"end nc_inq_dimlen"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -378,5 +449,11 @@
 int CNetCdfInterface::inqVarNDims(int ncid, int varId, int& nDims)
 {
-  int status = nc_inq_varndims(ncid, varId, &nDims);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_varndims"<<std::endl;
+    status = nc_inq_varndims(ncid, varId, &nDims);
+    info(100)<<"end nc_inq_varndims"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -403,5 +480,11 @@
 int CNetCdfInterface::inqVarDimId(int ncid, int varId, int* dimIds)
 {
-  int status = nc_inq_vardimid(ncid, varId, dimIds);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_vardimid"<<std::endl;
+    status = nc_inq_vardimid(ncid, varId, dimIds);
+    info(100)<<"end nc_inq_vardimid"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -429,5 +512,11 @@
 int CNetCdfInterface::inqDimIds(int ncid, int& nDims, int* dimIds, int includeParents)
 {
-  int status = nc_inq_dimids(ncid, &nDims, dimIds, includeParents);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_dimids"<<std::endl;
+    status = nc_inq_dimids(ncid, &nDims, dimIds, includeParents);
+    info(100)<<"end nc_inq_dimids"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -456,11 +545,18 @@
   StdSize strlen = 0;
   std::vector<char> buff;
-  int status = nc_inq_grpname_full(ncid, &strlen, NULL);
-  if (NC_NOERR == status)
-  {
-    buff.resize(strlen + 1);
-    status = nc_inq_grpname_full(ncid, NULL, &buff[0]);
-  }
-
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_grpname_full"<<std::endl;
+    status = nc_inq_grpname_full(ncid, &strlen, NULL);
+    info(100)<<"end nc_inq_grpname_full"<<std::endl;
+  
+    if (NC_NOERR == status)
+    {
+      buff.resize(strlen + 1);
+      status = nc_inq_grpname_full(ncid, NULL, &buff[0]);
+    }
+    info(100)<<"start nc_inq_grpname_full"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -489,5 +585,11 @@
 int CNetCdfInterface::inqGrpIds(int ncid, int& numgrps, int* ncids)
 {
-  int status = nc_inq_grps(ncid, &numgrps, ncids);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_grps"<<std::endl;
+    status = nc_inq_grps(ncid, &numgrps, ncids);
+    info(100)<<"end nc_inq_grps"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -514,5 +616,11 @@
 int CNetCdfInterface::inqVarIds(int ncid, int& nvars, int* varids)
 {
-  int status = nc_inq_varids(ncid, &nvars, varids);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_varids"<<std::endl;
+    status = nc_inq_varids(ncid, &nvars, varids);
+    info(100)<<"end nc_inq_varids"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -541,5 +649,12 @@
 int CNetCdfInterface::inqAtt(int ncid, int varid, const StdString& name, nc_type& type, size_t& len)
 {
-  int status = nc_inq_att(ncid, varid, name.c_str(), &type, &len);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_att"<<std::endl;
+    status = nc_inq_att(ncid, varid, name.c_str(), &type, &len);
+    info(100)<<"end nc_inq_att"<<std::endl;
+  }
+  
   if (NC_NOERR != status)
   {
@@ -565,5 +680,11 @@
 int CNetCdfInterface::inqNAtts(int ncid, int& ngatts)
 {
-  int status = nc_inq_natts(ncid, &ngatts);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_natts"<<std::endl;
+    status = nc_inq_natts(ncid, &ngatts);
+    info(100)<<"end nc_inq_natts"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -590,5 +711,11 @@
 int CNetCdfInterface::inqVarNAtts(int ncid, int varid, int& natts)
 {
-  int status = nc_inq_varnatts(ncid, varid, &natts);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_varnatts"<<std::endl;
+    status = nc_inq_varnatts(ncid, varid, &natts);
+    info(100)<<"end nc_inq_varnatts"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -611,5 +738,11 @@
 {
   std::vector<char> attName(NC_MAX_NAME + 1,' ');
-  int status = nc_inq_attname(ncid, varid, attnum, &attName[0]);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_inq_attname"<<std::endl;
+    status = nc_inq_attname(ncid, varid, attnum, &attName[0]);
+    info(100)<<"end nc_inq_attname"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -642,5 +775,11 @@
 int CNetCdfInterface::defGrp(int parentNcid, const StdString& grpName, int& grpId)
 {
-  int status = nc_def_grp(parentNcid, grpName.c_str(), &grpId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_def_grp"<<std::endl;
+    status = nc_def_grp(parentNcid, grpName.c_str(), &grpId);
+    info(100)<<"end nc_def_grp"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -667,5 +806,11 @@
 int CNetCdfInterface::defDim(int ncid, const StdString& dimName, StdSize dimLen, int& dimId)
 {
-  int status = nc_def_dim(ncid, dimName.c_str(), dimLen, &dimId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_def_dim"<<std::endl;
+    status = nc_def_dim(ncid, dimName.c_str(), dimLen, &dimId);
+    info(100)<<"end nc_def_dim"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -698,5 +843,11 @@
                              int nDims, const int dimIds[], int& varId)
 {
-  int status = nc_def_var(ncid, varName.c_str(), xtype, nDims, dimIds, &varId);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_def_var"<<std::endl;
+    status = nc_def_var(ncid, varName.c_str(), xtype, nDims, dimIds, &varId);
+    info(100)<<"end nc_def_var"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -727,5 +878,11 @@
 int CNetCdfInterface::defVarChunking(int ncid, int varId, int storage, StdSize chunkSize[])
 {
-  int status = nc_def_var_chunking(ncid, varId, storage, chunkSize);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_def_var_chunking"<<std::endl;
+    status = nc_def_var_chunking(ncid, varId, storage, chunkSize);
+    info(100)<<"end nc_def_var_chunking"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -755,5 +912,11 @@
   
   if (compressionLevel == 0) return NC_NOERR ;
-  int status = nc_def_var_deflate(ncid, varId, (compressionLevel > 0), (compressionLevel > 0), compressionLevel);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_def_var_deflate"<<std::endl;
+    status = nc_def_var_deflate(ncid, varId, (compressionLevel > 0), (compressionLevel > 0), compressionLevel);
+    info(100)<<"end nc_def_var_deflate"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -781,5 +944,11 @@
 {
   int old_fill_mode;
-  int status = nc_set_fill(ncid, fill ? NC_FILL: NC_NOFILL, &old_fill_mode);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_set_fill"<<std::endl;
+    status = nc_set_fill(ncid, fill ? NC_FILL: NC_NOFILL, &old_fill_mode);
+    info(100)<<"end nc_set_fill"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -808,5 +977,11 @@
 int CNetCdfInterface::defVarFill(int ncid, int varId, int noFill, void* fillValue)
 {
-  int status = nc_def_var_fill(ncid, varId, noFill, fillValue);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_def_var_fill"<<std::endl;
+    status = nc_def_var_fill(ncid, varId, noFill, fillValue);
+    info(100)<<"end nc_def_var_fill"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -836,5 +1011,11 @@
 int CNetCdfInterface::varParAccess(int ncid, int varId, int access)
 {
-  int status = nc_var_par_access(ncid, varId, access);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_var_par_access"<<std::endl;
+    status = nc_var_par_access(ncid, varId, access);
+    info(100)<<"end nc_var_par_access"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -859,5 +1040,11 @@
 int CNetCdfInterface::sync(int ncid)
 {
-  int status = nc_sync(ncid);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_sync"<<std::endl;
+    status = nc_sync(ncid);
+    info(100)<<"end nc_sync"<<std::endl;
+  }
   if (NC_NOERR != status)
   {
@@ -879,5 +1066,12 @@
 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, double* data)
 {
-  return nc_get_att_double(ncid, varid, attrName, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_att_double"<<std::endl;
+    status = nc_get_att_double(ncid, varid, attrName, data);
+    info(100)<<"end nc_get_att_double"<<std::endl;
+  }
+  return status;
 }
 
@@ -885,5 +1079,12 @@
 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, float* data)
 {
-  return nc_get_att_float(ncid, varid, attrName, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_att_float"<<std::endl;
+    status = nc_get_att_float(ncid, varid, attrName, data);
+    info(100)<<"end nc_get_att_float"<<std::endl;
+  }
+  return status;
 }
 
@@ -891,5 +1092,12 @@
 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, int* data)
 {
-  return nc_get_att_int(ncid, varid, attrName, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_att_int"<<std::endl;
+    status = nc_get_att_int(ncid, varid, attrName, data);
+    info(100)<<"end nc_get_att_int"<<std::endl;
+  }
+  return status; 
 }
 
@@ -897,5 +1105,12 @@
 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, long* data)
 {
-  return nc_get_att_long(ncid, varid, attrName, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_att_long"<<std::endl;
+    status = nc_get_att_long(ncid, varid, attrName, data);
+    info(100)<<"end nc_get_att_long"<<std::endl;
+  }
+  return status;
 }
 
@@ -903,5 +1118,12 @@
 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, short* data)
 {
-  return nc_get_att_short(ncid, varid, attrName, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_att_short"<<std::endl;
+    status = nc_get_att_short(ncid, varid, attrName, data);
+    info(100)<<"end nc_get_att_short"<<std::endl;
+  }
+  return status;
 }
 
@@ -909,5 +1131,12 @@
 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, char* data)
 {
-  return nc_get_att_text(ncid, varid, attrName, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_att_text"<<std::endl;
+    status = nc_get_att_text(ncid, varid, attrName, data);
+    info(100)<<"end nc_get_att_text"<<std::endl;
+  }
+  return status;
 }
 
@@ -917,5 +1146,12 @@
                                    StdSize numVal, const double* data)
 {
-  return nc_put_att_double(ncid, varid, attrName, NC_DOUBLE, numVal, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_att_double"<<std::endl;
+    status = nc_put_att_double(ncid, varid, attrName, NC_DOUBLE, numVal, data);
+    info(100)<<"end nc_put_att_double"<<std::endl;
+  }
+  return status;
 }
 
@@ -924,5 +1160,12 @@
                                    StdSize numVal, const float* data)
 {
-  return nc_put_att_float(ncid, varid, attrName, NC_FLOAT, numVal, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_att_float"<<std::endl;
+    status = nc_put_att_float(ncid, varid, attrName, NC_FLOAT, numVal, data);
+    info(100)<<"end nc_put_att_float"<<std::endl;
+  }
+  return status;
 }
 
@@ -931,5 +1174,12 @@
                                    StdSize numVal, const int* data)
 {
-  return nc_put_att_int(ncid, varid, attrName, NC_INT, numVal, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_att_int"<<std::endl;
+    status = nc_put_att_int(ncid, varid, attrName, NC_INT, numVal, data);
+    info(100)<<"end nc_put_att_int"<<std::endl;
+  }
+  return status;
 }
 
@@ -938,5 +1188,12 @@
                                    StdSize numVal, const long* data)
 {
-  return nc_put_att_long(ncid, varid, attrName, NC_LONG, numVal, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_att_long"<<std::endl;
+    status = nc_put_att_long(ncid, varid, attrName, NC_LONG, numVal, data);
+    info(100)<<"end nc_put_att_long"<<std::endl;
+  }
+  return status;
 }
 
@@ -945,5 +1202,12 @@
                                    StdSize numVal, const short* data)
 {
-  return nc_put_att_short(ncid, varid, attrName, NC_SHORT, numVal, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_att_short"<<std::endl;
+    status = nc_put_att_short(ncid, varid, attrName, NC_SHORT, numVal, data);
+    info(100)<<"end nc_put_att_short"<<std::endl;
+  }
+  return status;
 }
 
@@ -952,5 +1216,12 @@
                                    StdSize numVal, const char* data)
 {
-  return nc_put_att_text(ncid, varid, attrName, numVal, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_att_text"<<std::endl;
+    status = nc_put_att_text(ncid, varid, attrName, numVal, data);
+    info(100)<<"end nc_put_att_text"<<std::endl;
+  }
+  return status;
 }
 
@@ -959,5 +1230,12 @@
 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, double* data)
 {
-  return nc_get_vara_double(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_vara_double"<<std::endl;
+    status = nc_get_vara_double(ncid, varid, start, count, data);
+    info(100)<<"end nc_get_vara_double"<<std::endl;
+  }
+  return status;
 }
 
@@ -965,5 +1243,12 @@
 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, float* data)
 {
-  return nc_get_vara_float(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_vara_float"<<std::endl;
+    status = nc_get_vara_float(ncid, varid, start, count, data);
+    info(100)<<"end nc_get_vara_float"<<std::endl;
+  }
+  return status; 
 }
 
@@ -971,5 +1256,12 @@
 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, int* data)
 {
-  return nc_get_vara_int(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_vara_int"<<std::endl;
+    status = nc_get_vara_int(ncid, varid, start, count, data);
+    info(100)<<"end nc_get_vara_int"<<std::endl;
+  }
+  return status; 
 }
 
@@ -977,5 +1269,12 @@
 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, char* data)
 {
-  return nc_get_vara_text(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_get_vara_text"<<std::endl;
+    status = nc_get_vara_text(ncid, varid, start, count, data);
+    info(100)<<"end nc_get_vara_text"<<std::endl;
+  }
+  return status;
 }
 
@@ -984,5 +1283,12 @@
 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const double* data)
 {
-  return nc_put_vara_double(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_vara_double"<<std::endl;
+    status = nc_put_vara_double(ncid, varid, start, count, data);
+    info(100)<<"end nc_put_vara_double"<<std::endl;
+  }
+  return status;
 }
 
@@ -990,5 +1296,12 @@
 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const float* data)
 {
-  return nc_put_vara_float(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_vara_float"<<std::endl;
+    status = nc_put_vara_float(ncid, varid, start, count, data);
+    info(100)<<"end nc_put_vara_float"<<std::endl;
+  }
+  return status;
 }
 
@@ -996,5 +1309,12 @@
 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const int* data)
 {
-  return nc_put_vara_int(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_vara_int"<<std::endl;
+    status = nc_put_vara_int(ncid, varid, start, count, data);
+    info(100)<<"end nc_put_vara_int"<<std::endl;
+  }
+  return status;
 }
 
@@ -1002,5 +1322,12 @@
 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const char* data)
 {
-  return nc_put_vara_text(ncid, varid, start, count, data);
+  int status;
+  #pragma omp critical (_netcdf)
+  {
+    info(100)<<"start nc_put_vara_text"<<std::endl;
+    status = nc_put_vara_text(ncid, varid, start, count, data);
+    info(100)<<"end nc_put_vara_text"<<std::endl;
+  }
+  return status;
 }
 
@@ -1015,5 +1342,12 @@
 {
    int varId = 0;
-   return (NC_NOERR == (nc_inq_varid(ncId, varName.c_str(), &varId)));
+   int status;
+   #pragma omp critical (_netcdf)
+   {
+     info(100)<<"start isVarExisted"<<std::endl;
+     status = nc_inq_varid(ncId, varName.c_str(), &varId);
+     info(100)<<"end isVarExisted"<<std::endl;
+   }
+   return (NC_NOERR == status);
 }
 
@@ -1021,5 +1355,12 @@
 {
    int dimId = 0;
-   return (NC_NOERR == (nc_inq_dimid(ncId, dimName.c_str(), &dimId)));
+   int status;
+   #pragma omp critical (_netcdf)
+   {
+     info(100)<<"start isDimExisted"<<std::endl;
+     status = nc_inq_dimid(ncId, dimName.c_str(), &dimId);
+     info(100)<<"end isDimExisted"<<std::endl;
+   }
+   return (NC_NOERR == status);
 }
 
Index: /XIOS/dev/branch_openmp/src/io/netcdf.hpp
===================================================================
--- /XIOS/dev/branch_openmp/src/io/netcdf.hpp	(revision 1554)
+++ /XIOS/dev/branch_openmp/src/io/netcdf.hpp	(revision 1555)
@@ -33,5 +33,10 @@
   {
 #if defined(USING_NETCDF_PAR)
-    return ::nc_create_par(path, cmode, comm, info, ncidp) ;
+    int status;
+    #pragma omp critical (_netcdf)
+    {
+      status = ::nc_create_par(path, cmode, comm, info, ncidp) ;
+    }
+    return status;
 #else
     ERROR("int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)",
@@ -44,5 +49,10 @@
   {
 #if defined(USING_NETCDF_PAR)
-    return ::nc_open_par(path, mode, comm, info, ncidp) ;
+    int status;
+    #pragma omp critical (_netcdf)
+    {
+      status = ::nc_open_par(path, mode, comm, info, ncidp) ;
+    }
+    return status;
 #else
     ERROR("int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)",
@@ -55,5 +65,7 @@
   {
 #if defined(USING_NETCDF_PAR)
-    return ::nc_var_par_access(ncid, varid, par_access) ;
+    int status = ::nc_var_par_access(ncid, varid, par_access) ;
+    
+    return status;
 #else
     ERROR("int nc_var_par_access(int ncid, int varid, int par_access)",
Index: /XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp
===================================================================
--- /XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp	(revision 1554)
+++ /XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.cpp	(revision 1555)
@@ -807,15 +807,18 @@
   
   int my_rank_loc = client->intraComm->ep_comm_ptr->size_rank_info[1].first;
-  
-  cout<<"begin write weight info"<< endl;
+  int my_rank = client->intraComm->ep_comm_ptr->size_rank_info[0].first;
+  
+  
  
   WriteNetCdf *netCdfWriter;
 
-
   MPI_Barrier_local(client->intraComm);
+  
   if(my_rank_loc==0)
   {
-  
+    info(100)<<"rank "<< my_rank <<" create weight info file"<< std::endl;
+    
     WriteNetCdf my_writer(filename, client->intraComm);  
+    info(100)<<"rank "<< my_rank <<" file created"<< std::endl;
     netCdfWriter = &my_writer; 
   
@@ -824,4 +827,5 @@
     netCdfWriter->addDimensionWrite("n_dst", n_dst);
     netCdfWriter->addDimensionWrite("n_weight", globalNbWeight);
+    info(100)<<"rank "<< my_rank <<" addDimensionWrite : n_src, n_dst, n_weight"<< std::endl;
   
     std::vector<StdString> dims(1,"n_weight");
@@ -831,12 +835,15 @@
     netCdfWriter->addVariableWrite("dst_idx", NC_INT, dims);
     netCdfWriter->addVariableWrite("weight", NC_DOUBLE, dims);
+    
+    info(100)<<"rank "<< my_rank <<" addVariableWrite : src_idx, dst_idx, weight"<< std::endl;
 
     // End of definition
     netCdfWriter->endDefinition();
+    info(100)<<"rank "<< my_rank <<" endDefinition"<< std::endl;
   
     netCdfWriter->closeFile();
-  }
-  
-
+    info(100)<<"rank "<< my_rank <<" file closed"<< std::endl;
+  }
+  
   MPI_Barrier_local(client->intraComm);
   
@@ -844,5 +851,8 @@
   {
     // open file
+    info(100)<<"rank "<< my_rank <<" writing in weight info file"<< std::endl;
+    
     WriteNetCdf my_writer(filename, true, client->intraComm);  
+    info(100)<<"rank "<< my_rank <<" file opened"<< std::endl;
     netCdfWriter = &my_writer; 
     
@@ -853,5 +863,11 @@
       netCdfWriter->writeDataIndex(dst_idx, "dst_idx", false, 0, &start, &count);
       netCdfWriter->writeDataIndex(weights, "weight", false, 0, &start, &count);
-    }
+      
+      info(100)<<"rank "<< my_rank <<" WriteDataIndex : src_idx, dst_idx, weight"<< std::endl;
+    }
+    
+    netCdfWriter->closeFile();
+    info(100)<<"rank "<< my_rank <<" file closed"<< std::endl;
+    
   }
   
