Changeset 605 for XIOS/branchs


Ignore:
Timestamp:
06/03/15 15:06:24 (9 years ago)
Author:
rlacroix
Message:

Don't enable NETCDF parallel mode when only one server is used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/branchs/xios-1.0/src/output/onetcdf4.cpp

    r501 r605  
    1313         (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile) 
    1414            : path() 
    15       { 
    16          this->wmpi = (comm != NULL) && !multifile; 
     15            , wmpi(false) 
     16      { 
    1717         this->initialize(filename, exist, comm,multifile); 
    1818      } 
     
    3131         (const StdString & filename, bool exist, const MPI_Comm * comm, bool multifile) 
    3232      { 
     33         // Don't use parallel mode if there is only one process 
     34         if (comm) 
     35         { 
     36            int commSize = 0; 
     37            MPI_Comm_size(*comm, &commSize); 
     38            if (commSize <= 1) 
     39               comm = NULL; 
     40         } 
     41         wmpi = comm && !multifile; 
     42 
    3343         if (!exist) 
    3444         { 
    35             if (comm != NULL) 
    36             { 
    37                if (!multifile) (CNetCdfInterface::createPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, (this->ncidp))); 
    38                else (CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp)); 
    39             } 
    40             else (CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp)); 
     45            if (wmpi) 
     46               CNetCdfInterface::createPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp); 
     47            else 
     48               CNetCdfInterface::create(filename, NC_NETCDF4, this->ncidp); 
    4149         } 
    4250         else 
    4351         { 
    44             if (comm != NULL) 
    45             { 
    46                if (!multifile) (CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp)); 
    47                else (CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp)); 
    48             } 
    49             else  (CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp)); 
     52            if (wmpi) 
     53               CNetCdfInterface::openPar(filename, NC_NETCDF4|NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp); 
     54            else 
     55               CNetCdfInterface::open(filename, NC_NETCDF4, this->ncidp); 
    5056         } 
    5157      } 
Note: See TracChangeset for help on using the changeset viewer.