|
4 | 4 | * See COPYRIGHT notice in top-level directory. |
5 | 5 | * |
6 | 6 | *********************************************************************/ |
7 | | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
8 | | - * This example shows how to use nc_put_vara_int() to write a 2D 4-byte integer |
9 | | - * array in parallel and read it back using the same array partitioning pattern. |
10 | | - * It first defines a netCDF variable of size global_nx * global_ny where |
11 | | - * global_ny == NY and |
12 | | - * global_nx == (NX * number of MPI processes). |
13 | | - * The data partitioning pattern is a column-wise partitioning across all |
14 | | - * processes. Each process writes a subarray of size ny * nx. |
| 7 | +/** |
| 8 | + * @file |
| 9 | + * Example of parallel I/O using nc_put_vara_int() and nc_get_vara_int(). |
15 | 10 | * |
16 | | - * To compile: |
17 | | - * mpicc -O2 parallel_vara.c -o parallel_vara -lnetcdf -lpnetcdf |
| 11 | + * This example shows how to use nc_put_vara_int() to write a 2D |
| 12 | + * 4-byte integer array in parallel and read it back using the same |
| 13 | + * array partitioning pattern. It first defines a netCDF variable of |
| 14 | + * size global_nx * global_ny where global_ny == NY and global_nx == |
| 15 | + * (NX * number of MPI processes). The data partitioning pattern is a |
| 16 | + * column-wise partitioning across all processes. Each process writes a |
| 17 | + * subarray of size ny * nx. |
| 18 | + * |
| 19 | + * To compile: |
| 20 | + * mpicc -O2 parallel_vara.c -o parallel_vara -lnetcdf -lpnetcdf |
18 | 21 | * |
19 | 22 | * Example commands for MPI run and outputs from running ncdump on the |
20 | 23 | * NC file produced by this example program: |
21 | 24 | * |
22 | | - * % mpiexec -n 4 ./parallel_vara /pvfs2/wkliao/testfile.nc |
| 25 | + * % mpiexec -n 4 ./parallel_vara /pvfs2/wkliao/testfile.nc |
| 26 | + * |
| 27 | + * % ncdump /pvfs2/wkliao/testfile.nc |
| 28 | + * netcdf testfile { |
| 29 | + * dimensions: |
| 30 | + * y = 10 ; |
| 31 | + * x = 16 ; |
| 32 | + * variables: |
| 33 | + * int var(y, x) ; |
| 34 | + * var:str_att_name = "example attribute of type text." ; |
| 35 | + * var:float_att_name = 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f ; |
| 36 | + * // global attributes: |
| 37 | + * :history = "Wed Apr 30 11:18:58 2014" ; |
| 38 | + * data: |
23 | 39 | * |
24 | | - * % ncdump /pvfs2/wkliao/testfile.nc |
25 | | - * netcdf testfile { |
26 | | - * dimensions: |
27 | | - * y = 10 ; |
28 | | - * x = 16 ; |
29 | | - * variables: |
30 | | - * int var(y, x) ; |
31 | | - * var:str_att_name = "example attribute of type text." ; |
32 | | - * var:float_att_name = 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f ; |
33 | | - * // global attributes: |
34 | | - * :history = "Wed Apr 30 11:18:58 2014\n", |
35 | | - * "" ; |
36 | | - * data: |
| 40 | + * var = |
| 41 | + * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
| 42 | + * ... |
| 43 | + * } |
37 | 44 | * |
38 | | - * var = |
39 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
40 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
41 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
42 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
43 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
44 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
45 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
46 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
47 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, |
48 | | - * 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3 ; |
49 | | - * } |
50 | | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 45 | + * @author Edward Hartnett |
| 46 | + */ |
51 | 47 |
|
52 | 48 | #include <stdio.h> |
53 | 49 | #include <stdlib.h> |
|
0 commit comments