Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 
Previous: Example of Simple Parallel I/O Access Next: Unidata's Common Data Model and NetCDF Java Library API Overview Table of contents Frames User guide
2008 Unidata NetCDF Workshop for Developers and Data Providers > Parallel I/O with NetCDF

13.9 Example of Simple Parallel I/O Access (part 2)
The nc_test4/tst_parallel3.c program provides an example of parallel I/O.

 

    /* Set up slab for this process. */
    start[0] = 0;
    start[1] = mpi_rank * DIMSIZE/mpi_size;
    count[0] = DIMSIZE2;
    count[1] = DIMSIZE/mpi_size;

    /* Create some test data. */
    data      = malloc(sizeof(int)*count[1]*count[0]);
    tempdata  = data;
    for (j = 0; j < count[0];j++){
      for (i=0; i < count[1]; i++){
        *tempdata = mpi_rank*(j+1);
        tempdata ++;
      }
    }

    /* Write two dimensional integer data */
    if ((res = nc_put_vara_int(ncid, nvid, start, count, data))){
       free(data);
       BAIL(res);
    }

 


Previous: Example of Simple Parallel I/O Access Next: Unidata's Common Data Model and NetCDF Java Library API Overview Table of contents Frames User guide
2008 Unidata NetCDF Workshop for Developers and Data Providers > Parallel I/O with NetCDF

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690