2
* ADIOS is freely available under the terms of the BSD license described
3
* in the COPYING file in the top level directory of this source distribution.
5
* Copyright (c) 2008 - 2009. UT-BATTELLE, LLC. All rights reserved.
13
/*************************************************************/
14
/* Example of writing arrays in ADIOS */
16
/* Similar example is manual/2_adios_write.c */
17
/*************************************************************/
18
int main (int argc, char ** argv)
25
MPI_Comm comm = MPI_COMM_WORLD;
29
MPI_Init (&argc, &argv);
30
MPI_Comm_rank (comm, &rank);
31
MPI_Comm_size (comm, &size);
33
strcpy (filename, "arrays");
34
adios_init ("arrays.xml", comm);
36
int test_scalar = rank * 1000;
38
for(ii = 0; ii<200; ii++){
39
for (i = 0; i < NX; i++)
40
t[i] = rank * NX + i*ii;
42
adios_open (&adios_handle, "temperature", filename, "w", comm);
44
adios_write (adios_handle, "NX", &NX);
45
adios_write (adios_handle, "NY", &NY);
46
adios_write (adios_handle, "test_scalar", &test_scalar);
47
adios_write (adios_handle, "size", &size);
48
adios_write (adios_handle, "rank", &rank);
49
adios_write (adios_handle, "var_2d_array", t);
51
adios_close (adios_handle);
52
fprintf(stderr, "Rank=%d commited write %d\n", rank, ii);
54
adios_finalize (rank);