00001
00002
00003
00004
00005
00006
00007 #include "../adio/include/adio.h"
00008 #include "../adio/include/adio_extern.h"
00009 #include "mpi.h"
00010
00011 int main (int argc, char **argv)
00012 {
00013 int i;
00014 ADIO_File fd;
00015 ADIO_Offset min_st_offset, max_end_offset;
00016 int rank;
00017 int nprocs_for_coll;
00018 int lb;
00019 int size, extent;
00020
00021 MPI_Init (&argc, &argv);
00022 MPI_Comm_rank (MPI_COMM_WORLD, &rank);
00023
00024 if (argc != 4) {
00025 if (!rank)
00026 printf ("Usage: file_realms_test <number of aggregators> <lower bound> <upper bound>\n"
00027 " simulates file_realm calculation\n");
00028 MPI_Finalize();
00029 return 1;
00030 }
00031
00032 nprocs_for_coll = atoi (argv[1]);
00033
00034 min_st_offset = atoi (argv[2]);
00035 max_end_offset = atoi (argv[3]);
00036
00037 if (max_end_offset < min_st_offset){
00038 if (!rank)
00039 printf ("end offset %lld is less then start offset %lld\n",
00040 max_end_offset, min_st_offset);
00041 MPI_Finalize();
00042 return 1;
00043 }
00044
00045 printf ("min_st_offset = %lld\nmax_end_offset = %lld\n",
00046 min_st_offset, max_end_offset);
00047
00048 fd = (ADIO_File) ADIOI_Malloc (sizeof (struct ADIOI_FileD));
00049 fd->hints = (ADIOI_Hints *)
00050 ADIOI_Malloc (sizeof(struct ADIOI_Hints_struct));
00051 fd->hints->cb_nodes = nprocs_for_coll;
00052 ADIOI_Calc_file_realms (fd, min_st_offset, max_end_offset);
00053
00054 for (i=0; i < nprocs_for_coll; i++) {
00055 printf ("file_realm_st_offs[%d] = %lld\n", i, fd->file_realm_st_offs[i]);
00056 }
00057 for (i=0; i < nprocs_for_coll; i++) {
00058 MPI_Type_size (fd->file_realm_types[i], &size);
00059 printf ("file_realm [%d] size = %d\n", i, size);
00060 }
00061 for (i=0; i < nprocs_for_coll; i++) {
00062 MPI_Type_get_extent (fd->file_realm_types[i], &lb, &extent);
00063 printf ("file_realm [%d] extent = %d\n", i, extent);
00064 }
00065
00066 for (i=0; i < nprocs_for_coll; i++)
00067 MPI_Type_free (&fd->file_realm_types[i]);
00068 ADIOI_Free (fd->file_realm_st_offs);
00069 ADIOI_Free (fd->file_realm_types);
00070 ADIOI_Free (fd->hints);
00071 ADIOI_Free (fd);
00072
00073 MPI_Finalize();
00074
00075 return 0;
00076 }