/* FLASH usecase on multiple ranks but all the writes and mappings happen on rank 0, all the processes have their local handles, and local information, we need to see how we want to do this for larger runs. */ #include #include #include //#include "test-flash.h" #include "damsel-hdf5.h" #include "damsel.h" #include "damsel-internal.h" #include "damsel-ndc.h" #include "damsel-debug.h" #include "damsel-connectivity.h" #include "damsel-types.h" #include "mpi.h" #define TOTAL_BLOCKS 17 #define FILENAME "output/test-flash-parallel.h5" /*Since its just a test case I am creating three arrays here and each rank will use corresponding subarray for tagging local blocks, * I think it is ok to do like that because we dont need any communication for these three arrays. I just want to use correct values * instead of made up values I have for coords, size, unk and bounding box. nodetype 1 = root, 3 = leaf and 2 is all the others*/ int nodetype[17] = {1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3}; int level[17] = {1, 2, 3, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 3, 3, 3, 3}; int which_child[17] = {-1, 1, 1, 1, 2, 3, 4, 2, 3, 4, 2, 3, 4, 1, 2, 3, 4}; damsel_err_t define_tags(damsel_model model, damsel_data_type *types, damsel_handle *tag_handles); void set_parenthandles(int myrank, int *proc_ranks, damsel_handle *block_id, damsel_handle *local_parent); int main(int argc, char **argv) { #ifndef DAMSEL_SINGLETHREAD int res; #endif int myrank, i, j, local_blocks; #ifndef DAMSEL_SINGLETHREAD MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &res); assert(res == MPI_THREAD_MULTIPLE); #else MPI_Init(&argc, &argv); #endif MPI_Comm_rank(MPI_COMM_WORLD, &myrank); if(myrank == 0) local_blocks = 5; //nothing special about it, only following our 17 block example tree/node using 4 ranks else local_blocks = 4; /*Local arrays for holding metadata, etc*/ double unk[local_blocks][24]; double coords[local_blocks][2]; double size[local_blocks][2]; double bndbox[local_blocks][4]; int local_nodetype[local_blocks]; int local_level[local_blocks]; int local_which_child[local_blocks]; damsel_handle local_parent[local_blocks]; damsel_handle block_id[local_blocks]; int num; /*just a quick and dirty way to ensure the block number sequence on each rank*/ if(myrank == 0) num =1; else num = 2; for(i=0;i