This source file includes following definitions.
- main
1
2
3
4
5
6
7 #include "../adio/include/adio.h"
8 #include "../adio/include/adio_extern.h"
9 #include "mpi.h"
10
11 int main (int argc, char **argv)
12 {
13 int i;
14 ADIO_File fd;
15 ADIO_Offset min_st_offset, max_end_offset;
16 int rank;
17 int nprocs_for_coll;
18 int lb;
19 MPI_Count size, extent;
20
21 MPI_Init (&argc, &argv);
22 MPI_Comm_rank (MPI_COMM_WORLD, &rank);
23
24 if (argc != 4) {
25 if (!rank)
26 printf ("Usage: file_realms_test <number of aggregators> <lower bound> <upper bound>\n"
27 " simulates file_realm calculation\n");
28 MPI_Finalize();
29 return 1;
30 }
31
32 nprocs_for_coll = atoi (argv[1]);
33
34 min_st_offset = atoi (argv[2]);
35 max_end_offset = atoi (argv[3]);
36
37 if (max_end_offset < min_st_offset){
38 if (!rank)
39 printf ("end offset %lld is less then start offset %lld\n",
40 max_end_offset, min_st_offset);
41 MPI_Finalize();
42 return 1;
43 }
44
45 printf ("min_st_offset = %lld\nmax_end_offset = %lld\n",
46 min_st_offset, max_end_offset);
47
48 fd = (ADIO_File) ADIOI_Malloc (sizeof (struct ADIOI_FileD));
49 fd->hints = (ADIOI_Hints *)
50 ADIOI_Malloc (sizeof(struct ADIOI_Hints_struct));
51 fd->hints->cb_nodes = nprocs_for_coll;
52 ADIOI_Calc_file_realms (fd, min_st_offset, max_end_offset);
53
54 for (i=0; i < nprocs_for_coll; i++) {
55 printf ("file_realm_st_offs[%d] = %lld\n", i, fd->file_realm_st_offs[i]);
56 }
57 for (i=0; i < nprocs_for_coll; i++) {
58 MPI_Type_size_x (fd->file_realm_types[i], &size);
59 printf ("file_realm [%d] size = %d\n", i, size);
60 }
61 for (i=0; i < nprocs_for_coll; i++) {
62 MPI_Type_get_extent (fd->file_realm_types[i], &lb, &extent);
63 printf ("file_realm [%d] extent = %d\n", i, extent);
64 }
65
66 for (i=0; i < nprocs_for_coll; i++)
67 MPI_Type_free (&fd->file_realm_types[i]);
68 ADIOI_Free (fd->file_realm_st_offs);
69 ADIOI_Free (fd->file_realm_types);
70 ADIOI_Free (fd->hints);
71 ADIOI_Free (fd);
72
73 MPI_Finalize();
74
75 return 0;
76 }