Changeset 707

Show
Ignore:
Timestamp:
10/30/09 14:43:48 (3 weeks ago)
Author:
kgao
Message:

added the type check in ncmpii_comp_attrs function of header.c

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/header.c

    r706 r707  
    8686ncmpii_NC_computeshapes(NC *ncp) 
    8787{ 
    88         NC_var **vpp = (NC_var **)ncp->vars.value; 
    89         NC_var *const *const end = &vpp[ncp->vars.nelems]; 
    90         NC_var *first_var = NULL;       /* first "non-record" var */ 
    91         NC_var *first_rec = NULL;       /* first "record" var */ 
    92         int status; 
    93   
    94         ncp->begin_var = (MPI_Offset) ncp->xsz; 
    95         ncp->begin_rec = (MPI_Offset) ncp->xsz; 
    96         ncp->recsize = 0; 
    97   
    98         if(ncp->vars.nelems == 0) 
    99                 return(0); 
    100  
    101  
    102  
    103  
    104         for( /*NADA*/; vpp < end; vpp++) 
    105         {        
    106                 status = ncmpii_NC_var_shape64(*vpp, &ncp->dims); 
    107  
    108  
    109                 if(status != ENOERR) 
    110                         return(status); 
    111   
    112                 if(IS_RECVAR(*vpp)) 
    113                 { 
    114                         if(first_rec == NULL) 
    115                                 first_rec = *vpp; 
    116                         ncp->recsize += (*vpp)->len; 
    117                 } 
    118                 else if(first_var == NULL) 
    119                 { 
    120                         first_var = *vpp; 
    121                         /* 
    122                          * Overwritten each time thru. 
    123                          * Usually overwritten in first_rec != NULL clause. 
    124                          */ 
    125                         ncp->begin_rec = (*vpp)->begin + (MPI_Offset)(*vpp)->len; 
    126                 } 
     88    NC_var **vpp = (NC_var **)ncp->vars.value; 
     89    NC_var *const *const end = &vpp[ncp->vars.nelems]; 
     90    NC_var *first_var = NULL;       /* first "non-record" var */ 
     91    NC_var *first_rec = NULL;       /* first "record" var */ 
     92    int status; 
     93  
     94    ncp->begin_var = (MPI_Offset) ncp->xsz; 
     95    ncp->begin_rec = (MPI_Offset) ncp->xsz; 
     96    ncp->recsize = 0; 
     97  
     98    if(ncp->vars.nelems == 0) return(0); 
     99 
     100    for ( /*NADA*/; vpp < end; vpp++) {     
     101        status = ncmpii_NC_var_shape64(*vpp, &ncp->dims); 
     102 
     103        if(status != ENOERR) return(status); 
     104  
     105        if (IS_RECVAR(*vpp)) { 
     106            if (first_rec == NULL) 
     107                first_rec = *vpp; 
     108            ncp->recsize += (*vpp)->len; 
    127109        } 
    128   
    129         if(first_rec != NULL) 
    130         { 
    131                 assert(ncp->begin_rec <= first_rec->begin); 
    132                 ncp->begin_rec = first_rec->begin; 
    133                 /* 
    134                  * for special case of exactly one record variable, pack value 
    135                  */ 
    136                 if(ncp->recsize == first_rec->len) 
    137                         ncp->recsize = *first_rec->dsizes * first_rec->xsz; 
     110        else if (first_var == NULL) { 
     111            first_var = *vpp; 
     112            /* 
     113             * Overwritten each time thru. 
     114             * Usually overwritten in first_rec != NULL clause. 
     115             */ 
     116            ncp->begin_rec = (*vpp)->begin + (MPI_Offset)(*vpp)->len; 
    138117        } 
    139   
    140         if(first_var != NULL) 
    141         { 
    142                 ncp->begin_var = first_var->begin; 
    143         } 
    144         else 
    145         { 
    146                 ncp->begin_var = ncp->begin_rec; 
    147         } 
    148  
    149         assert(ncp->begin_var > 0); 
    150         assert(ncp->xsz <= ncp->begin_var); 
    151         assert(ncp->begin_rec > 0); 
    152         assert(ncp->begin_var <= ncp->begin_rec); 
    153   
    154         return(ENOERR); 
     118    } 
     119  
     120    if (first_rec != NULL) { 
     121        assert(ncp->begin_rec <= first_rec->begin); 
     122        ncp->begin_rec = first_rec->begin; 
     123        /* 
     124         * for special case of exactly one record variable, pack value 
     125         */ 
     126        if (ncp->recsize == first_rec->len) 
     127            ncp->recsize = *first_rec->dsizes * first_rec->xsz; 
     128    } 
     129  
     130    if (first_var != NULL) 
     131        ncp->begin_var = first_var->begin; 
     132    else 
     133        ncp->begin_var = ncp->begin_rec; 
     134 
     135    assert(ncp->begin_var > 0); 
     136    assert(ncp->xsz <= ncp->begin_var); 
     137    assert(ncp->begin_rec > 0); 
     138    assert(ncp->begin_var <= ncp->begin_rec); 
     139  
     140    return(ENOERR); 
    155141}  
    156142 
     
    165151hdr_len_NC_string(const NC_string *ncstrp, MPI_Offset sizeof_t) 
    166152{ 
    167 //      MPI_Offset sz = X_SIZEOF_SIZE_T; /* nchars */ 
    168         int sz = sizeof_t; /* nchars */ 
    169   
    170         assert(ncstrp != NULL); 
    171   
    172         if(ncstrp->nchars != 0) 
    173                 sz += _RNDUP(ncstrp->nchars, X_ALIGN); 
    174   
    175         return sz; 
     153//  MPI_Offset sz = X_SIZEOF_SIZE_T; /* nchars */ 
     154    int sz = sizeof_t; /* nchars */ 
     155  
     156    assert(ncstrp != NULL); 
     157  
     158    if (ncstrp->nchars != 0) 
     159        sz += _RNDUP(ncstrp->nchars, X_ALIGN); 
     160  
     161    return sz; 
    176162} 
    177163  
     
    252238  
    253239        assert(varp != NULL); 
    254         assert(sizeof_off_t == 4 || sizeof_off_t == 8); 
     240    assert(sizeof_off_t == 4 || sizeof_off_t == 8); 
    255241  
    256242        sz = hdr_len_NC_string(varp->name,sizeof_t); 
     
    258244        sz += sizeof_t; /* ndims */ 
    259245        if (sizeof_t == 8) 
    260                 sz += ncmpix_len_long(varp->ndims); /* dimids */ 
     246        sz += ncmpix_len_long(varp->ndims); /* dimids */ 
    261247        else 
    262                 sz += ncmpix_len_int(varp->ndims); /* dimids */ 
     248        sz += ncmpix_len_int(varp->ndims); /* dimids */ 
    263249        sz += hdr_len_NC_attrarray(&varp->attrs, sizeof_t); 
    264250        sz += X_SIZEOF_NC_TYPE; /* type */ 
     
    296282  
    297283        assert(ncp != NULL); 
    298         if (fIsSet(ncp->flags, NC_64BIT_DATA)) { 
    299                 xlen += X_SIZEOF_LONG; /* numrecs */ 
     284    if (fIsSet(ncp->flags, NC_64BIT_DATA)) { 
     285            xlen += X_SIZEOF_LONG; /* numrecs */ 
    300286                xlen += hdr_len_NC_dimarray(&ncp->dims, 8);/* int-> long????????*/ 
    301287                xlen += hdr_len_NC_attrarray(&ncp->attrs, 8); 
    302288                xlen += hdr_len_NC_vararray(&ncp->vars, sizeof_off_t, 8); 
    303         } else { 
    304                 xlen += X_SIZEOF_SIZE_T; 
     289    } else { 
     290            xlen += X_SIZEOF_SIZE_T; 
    305291                xlen += hdr_len_NC_dimarray(&ncp->dims, 4); 
    306292                xlen += hdr_len_NC_attrarray(&ncp->attrs, 4); 
    307293                xlen += hdr_len_NC_vararray(&ncp->vars, sizeof_off_t, 4); 
    308         } 
     294    } 
    309295 
    310296//        xlen += hdr_len_NC_dimarray(&ncp->dims, sizeof_off_t);/* int-> long????????*/ 
     
    428414  for (i=0; i< varp->ndims; i++){   
    429415        const MPI_Offset dim_id  = (const MPI_Offset) varp->dimids[i]; 
    430         status = ncmpix_put_size_t(&pbp->pos, &dim_id, pbp->version == 5 ? 8 : 4); 
     416     status = ncmpix_put_size_t(&pbp->pos, &dim_id, pbp->version == 5 ? 8 : 4); 
    431417  } 
    432418/* 
     
    589575 
    590576  if (ncp->flags & NC_64BIT_DATA) 
    591           putbuf.version = 5; 
     577      putbuf.version = 5; 
    592578  else if (ncp->flags & NC_64BIT_OFFSET) 
    593           putbuf.version = 2; 
     579      putbuf.version = 2; 
    594580  else 
    595           putbuf.version = 1; 
     581      putbuf.version = 1; 
    596582 
    597583  if (putbuf.version == 5) 
    598           status = ncmpix_putn_schar_schar(&putbuf.pos, sizeof(ncmagic2), ncmagic2); 
     584      status = ncmpix_putn_schar_schar(&putbuf.pos, sizeof(ncmagic2), ncmagic2); 
    599585  else if (putbuf.version == 2) 
    600           status = ncmpix_putn_schar_schar(&putbuf.pos, sizeof(ncmagic), ncmagic); 
     586      status = ncmpix_putn_schar_schar(&putbuf.pos, sizeof(ncmagic), ncmagic); 
    601587  else 
    602           status = ncmpix_putn_schar_schar(&putbuf.pos, sizeof(ncmagic1), ncmagic1); 
    603  
    604   if (status != ENOERR) 
    605           return status; 
     588      status = ncmpix_putn_schar_schar(&putbuf.pos, sizeof(ncmagic1), ncmagic1); 
     589 
     590  if (status != ENOERR) 
     591      return status; 
    606592 
    607593  nrecs = ncp->numrecs;  
     
    646632  MPI_Comm comm; 
    647633  int mpireturn; 
    648   MPI_Offset slack;             /* any leftover data in the buffer */ 
     634  MPI_Offset slack;        /* any leftover data in the buffer */ 
    649635 
    650636  assert(gbp->base != NULL); 
     
    666652  gbp->index = 0; 
    667653  mpireturn = MPI_File_set_view(gbp->nciop->collective_fh, 0, MPI_BYTE, MPI_BYTE,  
    668                     "native", gbp->nciop->mpiinfo); 
     654            "native", gbp->nciop->mpiinfo); 
    669655  if (mpireturn != MPI_SUCCESS) { 
    670         ncmpii_handle_error(rank, mpireturn, "MPI_File_set_view"); 
     656    ncmpii_handle_error(rank, mpireturn, "MPI_File_set_view"); 
    671657        MPI_Finalize(); 
    672658        return NC_EREAD; 
     
    676662    MPI_Status mpistatus; 
    677663    mpireturn = MPI_File_read_at(gbp->nciop->collective_fh, (gbp->offset)-slack, gbp->base,  
    678                      gbp->size, MPI_BYTE, &mpistatus);   
     664                 gbp->size, MPI_BYTE, &mpistatus);   
    679665    if (mpireturn != MPI_SUCCESS) { 
    680         ncmpii_handle_error(rank, mpireturn, "MPI_File_read_at"); 
     666    ncmpii_handle_error(rank, mpireturn, "MPI_File_read_at"); 
    681667        MPI_Finalize(); 
    682668        return NC_EREAD; 
     
    899885        return X_SIZEOF_DOUBLE; 
    900886    default:  
    901         assert("ncmpix_len_nctype bad type" == 0); 
     887    assert("ncmpix_len_nctype bad type" == 0); 
    902888  } 
    903889  return 0;                 
     
    10721058/*   
    10731059    if (gbp->version == 5) { 
    1074         status = ncmpix_getn_long_long((const void **)(&gbp->pos),  
     1060    status = ncmpix_getn_long_long((const void **)(&gbp->pos),  
    10751061                              1, (MPI_Offset*)varp->dimids + dim); 
    10761062    } else { 
    1077         status = ncmpix_getn_int_int((const void **)(&gbp->pos),  
     1063    status = ncmpix_getn_int_int((const void **)(&gbp->pos),  
    10781064                              1, (int*) varp->dimids + dim); 
    10791065    } 
     
    11811167 
    11821168  getbuf.nciop = ncp->nciop; 
    1183   getbuf.offset = 0;    /* read from start of the file */ 
     1169  getbuf.offset = 0;     /* read from start of the file */ 
    11841170  getbuf.size = _RNDUP( MAX(MIN_NC_XSZ, ncp->chunk), X_ALIGN ); 
    11851171  if (getbuf.size > 4096) 
     
    11981184  getbuf.index += sizeof(magic); 
    11991185  /* don't need to worry about CDF-1 or CDF-2  
    1200    *    if the first bits are not 'CDF-'  */ 
     1186   *     if the first bits are not 'CDF-'  */ 
    12011187  if(memcmp(magic, ncmagic, sizeof(ncmagic)-1) != 0) { 
    12021188    free(getbuf.base); 
     
    12051191  /* check version number in last byte of magic */ 
    12061192  if (magic[sizeof(ncmagic)-1] == 0x1) { 
    1207           getbuf.version = 1; 
     1193      getbuf.version = 1; 
    12081194  } else if (magic[sizeof(ncmagic)-1] == 0x2) { 
    1209           getbuf.version = 2; 
    1210           fSet(ncp->flags, NC_64BIT_OFFSET); 
    1211           if (sizeof(MPI_Offset) != 8) { 
    1212                   /* take the easy way out: if we can't support all CDF-2 
    1213                    * files, return immediately */ 
    1214                   free(getbuf.base); 
    1215                   return NC_ESMALL; 
    1216           } 
     1195      getbuf.version = 2; 
     1196      fSet(ncp->flags, NC_64BIT_OFFSET); 
     1197      if (sizeof(MPI_Offset) != 8) { 
     1198          /* take the easy way out: if we can't support all CDF-2 
     1199           * files, return immediately */ 
     1200          free(getbuf.base); 
     1201          return NC_ESMALL; 
     1202      } 
    12171203  } else if (magic[sizeof(ncmagic)-1] == 0x5) { 
    1218           getbuf.version = 5; 
    1219           fSet(ncp->flags, NC_64BIT_DATA); 
    1220           if (sizeof(MPI_Offset) != 8) { 
    1221                   free(getbuf.base); 
    1222                   return NC_ESMALL; 
    1223           } 
     1204      getbuf.version = 5; 
     1205      fSet(ncp->flags, NC_64BIT_DATA); 
     1206      if (sizeof(MPI_Offset) != 8) { 
     1207          free(getbuf.base); 
     1208          return NC_ESMALL; 
     1209      } 
    12241210  } else { 
    1225           free(getbuf.base); 
    1226           return NC_ENOTNC; 
     1211      free(getbuf.base); 
     1212      return NC_ENOTNC; 
    12271213  } 
    12281214   
     
    12361222 
    12371223  if (getbuf.version == 5) { 
    1238         getbuf.index += X_SIZEOF_LONG; 
     1224    getbuf.index += X_SIZEOF_LONG; 
    12391225  } else { 
    1240         getbuf.index += X_SIZEOF_SIZE_T; 
     1226    getbuf.index += X_SIZEOF_SIZE_T; 
    12411227  } 
    12421228  if(status != ENOERR) { 
     
    12531239    return status; 
    12541240  } 
    1255          
     1241     
    12561242  
    12571243 
     
    12811267 
    12821268int ncmpii_comp_dims(NC_dimarray *nc_dim1, NC_dimarray *nc_dim2){ 
    1283         int i; 
    1284         if (nc_dim1->nelems != nc_dim2->nelems){ 
     1269    int i; 
     1270    if (nc_dim1->nelems != nc_dim2->nelems){ 
    12851271           return NC_EDIMS_NELEMS_MULTIDEFINE; 
    1286         } else {         
     1272    } else {     
    12871273           for (i=0; i<nc_dim1->nelems; i++){ 
    1288               if (nc_dim1->value[i]->size != nc_dim2->value[i]->size) 
    1289                 return NC_EDIMS_SIZE_MULTIDEFINE; 
     1274          if (nc_dim1->value[i]->size != nc_dim2->value[i]->size) 
     1275        return NC_EDIMS_SIZE_MULTIDEFINE; 
    12901276#define METADATA_CONSISTENCY_CHECK 
    12911277#ifdef METADATA_CONSISTENCY_CHECK 
    1292               else { 
    1293                    if ((nc_dim1->value[i]->name->nchars != nc_dim1->value[i]->name->nchars)||(strcmp(nc_dim1->value[i]->name->cp, nc_dim2->value[i]->name->cp)!=0)){ 
    1294                       printf("Warning: The dimination name %s of NC definations on multiprocesses inconsistent.\n",nc_dim1->value[i]->name->cp); 
    1295                    }  
    1296              } 
     1278          else { 
     1279               if ((nc_dim1->value[i]->name->nchars != nc_dim1->value[i]->name->nchars)||(strcmp(nc_dim1->value[i]->name->cp, nc_dim2->value[i]->name->cp)!=0)){ 
     1280                      printf("Warning (inconsistent metadata): dimension name %s != %s\n",nc_dim1->value[i]->name->cp,nc_dim2->value[i]->name->cp); 
     1281           }  
     1282         } 
    12971283#endif 
    1298            }  
     1284       }  
    12991285 
    13001286        } 
    1301         return NC_NOERR; 
     1287    return NC_NOERR; 
    13021288} 
    13031289 
    13041290int ncmpii_comp_attrs(NC_attrarray *nc_attr1, NC_attrarray *nc_attr2){ 
    1305         int i; 
     1291    int     i, j, num; 
     1292    int    *ia, *ib; 
     1293    short int *sa, *sb; 
     1294    float  *fa, *fb; 
     1295    double *da, *db; 
    13061296#ifdef METADATA_CONSISTENCY_CHECK 
    1307         if (nc_attr1->nelems != nc_attr2->nelems){ 
    1308            printf("Warning: The number of attributes (root=%lld != %lld) of NC definations on multiprocesses inconsistent.\n",lld(nc_attr1->nelems),lld(nc_attr2->nelems)); 
    1309         } else { 
    1310                 for (i=0; i<nc_attr1->nelems; i++){ 
    1311                    if (nc_attr1->value[i]->xsz != nc_attr2->value[i]->xsz){ 
    1312                        printf("Warning: The size of attribute (root=%lld != %lld) of NC definations on multiprocesses inconsistent.\n",lld(nc_attr1->value[i]->xsz),lld(nc_attr2->value[i]->xsz)); 
    1313                    } 
    1314                    if ((nc_attr1->value[i]->name->nchars != nc_attr2->value[i]->name->nchars)||(strcmp(nc_attr1->value[i]->name->cp, nc_attr2->value[i]->name->cp))){ 
    1315                        printf("Warning: The name of attribute (root=%s != %s) of NC definations on multiprocesses inconsistent.\n",nc_attr1->value[i]->name->cp,nc_attr2->value[i]->name->cp); 
    1316                    } 
    1317                    if (strcmp(nc_attr1->value[i]->xvalue, nc_attr2->value[i]->xvalue)){ 
    1318                     printf("Warning: The value of attribute (root=%s !=%s) of NC definations on multiprocesses inconsistent.\n",nc_attr1->value[i]->xvalue, nc_attr2->value[i]->xvalue); 
    1319                    }     
    1320                    if (nc_attr1->value[i]->type != nc_attr2->value[i]->type){ 
    1321                     printf("Warning: The type of attribute (root=%d != %d) of NC definations on multiprocesses inconsistent.\n",nc_attr1->value[i]->type,nc_attr2->value[i]->type); 
    1322                    } 
    1323                    if (nc_attr1->value[i]->nelems != nc_attr2->value[i]->nelems){ 
    1324                     printf("Warning: The length of attribute (root=%lld != %lld) of NC definations on multiprocesses inconsistent.\n",lld(nc_attr1->value[i]->nelems),lld(nc_attr2->value[i]->nelems)); 
    1325                    } 
    1326                 } 
    1327         }        
     1297    if (nc_attr1->nelems != nc_attr2->nelems){ 
     1298        printf("Warning (inconsistent metadata):: number of attributes %lld != %lld\n",lld(nc_attr1->nelems),lld(nc_attr2->nelems)); 
     1299    } 
     1300    else { 
     1301        for (i=0; i<nc_attr1->nelems; i++){ 
     1302           if (nc_attr1->value[i]->xsz != nc_attr2->value[i]->xsz) 
     1303               printf("Warning (inconsistent metadata): attribute size %lld != %lld\n",lld(nc_attr1->value[i]->xsz),lld(nc_attr2->value[i]->xsz)); 
     1304           if ((nc_attr1->value[i]->name->nchars != nc_attr2->value[i]->name->nchars)||(strcmp(nc_attr1->value[i]->name->cp, nc_attr2->value[i]->name->cp))) 
     1305               printf("Warning (inconsistent metadata): attribute name %s != %s\n",nc_attr1->value[i]->name->cp,nc_attr2->value[i]->name->cp); 
     1306           if (nc_attr1->value[i]->type != nc_attr2->value[i]->type) 
     1307               printf("Warning (inconsistent metadata): attribute type %d != %d\n",nc_attr1->value[i]->type,nc_attr2->value[i]->type); 
     1308           if (nc_attr1->value[i]->nelems != nc_attr2->value[i]->nelems) 
     1309               printf("Warning (inconsistent metadata): attribute length %lld != %lld\n",lld(nc_attr1->value[i]->nelems),lld(nc_attr2->value[i]->nelems)); 
     1310 
     1311           num = MIN(nc_attr1->value[i]->nelems, nc_attr2->value[i]->nelems); 
     1312           switch (nc_attr1->value[i]->type) { 
     1313               case NC_CHAR: 
     1314               case NC_BYTE: 
     1315                   if (strcmp(nc_attr1->value[i]->xvalue, nc_attr2->value[i]->xvalue)) 
     1316                       printf("Warning (inconsistent metadata): attribute value %s !=%s\n",nc_attr1->value[i]->xvalue, nc_attr2->value[i]->xvalue); 
     1317                   break; 
     1318               case NC_SHORT: 
     1319                   sa = nc_attr1->value[i]->xvalue; 
     1320                   sb = nc_attr2->value[i]->xvalue; 
     1321                   for (j=0; j<num; j++) { 
     1322                       if (sa[j] != sb[j]) { 
     1323                           printf("Warning (inconsistent metadata): attribute value %d !=%d\n",sa[j],sb[j]); 
     1324                           break; 
     1325                       } 
     1326                   } 
     1327                   break; 
     1328               case NC_INT: 
     1329                   ia = nc_attr1->value[i]->xvalue; 
     1330                   ib = nc_attr2->value[i]->xvalue; 
     1331                   for (j=0; j<num; j++) { 
     1332                       if (ia[j] != ib[j]) { 
     1333                           printf("Warning (inconsistent metadata): attribute value %d !=%d\n",ia[j],ib[j]); 
     1334                           break; 
     1335                       } 
     1336                   } 
     1337                   break; 
     1338               case NC_FLOAT: 
     1339                   fa = nc_attr1->value[i]->xvalue; 
     1340                   fb = nc_attr2->value[i]->xvalue; 
     1341                   for (j=0; j<num; j++) { 
     1342                       if (fa[j] != fb[j]) { 
     1343                           printf("Warning (inconsistent metadata): attribute value %f !=%f\n",fa[j],fb[j]); 
     1344                           break; 
     1345                       } 
     1346                   } 
     1347               case NC_DOUBLE: 
     1348                   da = nc_attr1->value[i]->xvalue; 
     1349                   db = nc_attr2->value[i]->xvalue; 
     1350                   for (j=0; j<num; j++) { 
     1351                       if (da[j] != db[j]) { 
     1352                           printf("Warning (inconsistent metadata): attribute value %f !=%f\n",da[j],db[j]); 
     1353                           break; 
     1354                       } 
     1355                   } 
     1356               default: 
     1357                   break; 
     1358            } 
     1359        } 
     1360    } 
    13281361#endif 
    13291362    return NC_NOERR; 
     
    13311364 
    13321365int ncmpii_comp_vars(NC_vararray *nc_var1, NC_vararray *nc_var2){ 
    1333        int i, j; 
    1334         if (nc_var1->nelems != nc_var2->nelems){ 
     1366    int i, j; 
     1367    if (nc_var1->nelems != nc_var2->nelems){ 
    13351368           return NC_EVARS_NELEMS_MULTIDEFINE; 
    1336         } else { 
    1337                 for (i=0; i<nc_var1->nelems; i++){ 
     1369    } else { 
     1370        for (i=0; i<nc_var1->nelems; i++){ 
    13381371#ifdef METADATA_CONSISTENCY_CHECK 
    1339                    if ((nc_var1->value[i]->name->nchars !=  nc_var2->value[i]->name->nchars)||strcmp(nc_var1->value[i]->name->cp,nc_var2->value[i]->name->cp)) 
    1340                    { 
    1341                     printf("Warning: The name of variable (root=%s) of NC definations on multiprocesses inconsistent.\n",nc_var1->value[i]->name->cp); 
    1342                    } 
     1372           if ((nc_var1->value[i]->name->nchars !=  nc_var2->value[i]->name->nchars)||strcmp(nc_var1->value[i]->name->cp,nc_var2->value[i]->name->cp)) 
     1373           { 
     1374                    printf("Warning (inconsistent metadata): variable name %s != %s\n",nc_var1->value[i]->name->cp,nc_var2->value[i]->name->cp); 
     1375           } 
    13431376#endif 
    1344                    if ((nc_var1->value[i]->ndims != nc_var2->value[i]->ndims)){ 
    1345                         return NC_EVARS_NDIMS_MULTIDEFINE; 
    1346                    } 
     1377           if ((nc_var1->value[i]->ndims != nc_var2->value[i]->ndims)){ 
     1378                   return NC_EVARS_NDIMS_MULTIDEFINE; 
     1379           } 
    13471380                   for (j=0; j<nc_var1->value[i]->ndims; j++){ 
    1348                      if (nc_var1->value[i]->dimids[j] != nc_var2->value[i]->dimids[j]){ 
    1349                         return NC_EVARS_DIMIDS_MULTIDEFINE; 
    1350                      } 
    1351                    } 
    1352                    if (nc_var1->value[i]->type != nc_var2->value[i]->type){ 
    1353                         return NC_EVARS_TYPE_MULTIDEFINE; 
    1354                    } 
    1355                    if (nc_var1->value[i]->len != nc_var2->value[i]->len){ 
    1356                         return NC_EVARS_LEN_MULTIDEFINE; 
    1357                    } 
    1358                    if (nc_var1->value[i]->begin != nc_var2->value[i]->begin){ 
    1359                         return NC_EVARS_BEGIN_MULTIDEFINE; 
     1381             if (nc_var1->value[i]->dimids[j] != nc_var2->value[i]->dimids[j]){ 
     1382                   return NC_EVARS_DIMIDS_MULTIDEFINE; 
     1383             } 
     1384           } 
     1385           if (nc_var1->value[i]->type != nc_var2->value[i]->type){ 
     1386                   return NC_EVARS_TYPE_MULTIDEFINE; 
     1387           } 
     1388           if (nc_var1->value[i]->len != nc_var2->value[i]->len){ 
     1389                   return NC_EVARS_LEN_MULTIDEFINE; 
     1390           } 
     1391           if (nc_var1->value[i]->begin != nc_var2->value[i]->begin){ 
     1392                   return NC_EVARS_BEGIN_MULTIDEFINE; 
    13601393                   } 
    1361                    ncmpii_comp_attrs(&nc_var1->value[i]->attrs, &nc_var2->value[i]->attrs); 
    1362                 } 
    1363         } 
     1394           ncmpii_comp_attrs(&nc_var1->value[i]->attrs, &nc_var2->value[i]->attrs); 
     1395        } 
     1396    } 
    13641397      return NC_NOERR; 
    13651398};