/***************************************************************** * This is a sample program that shows how the panda library * * is going to be used by the application programs. * * The example command line format is in test7.script. * * This example shows the interface with only disk layout * * info but no stride or subchunking schema. The value for * * those schemas use the default ones. * * The current test varies the size of arrays. However, the * * wrapper function allows the number of the nodes to be * * changed as well. * * The first iteration loads all the code in memory. * * The second run does the simulated disk simulation. * * From the third run on, the values are the real writes. * *****************************************************************/ #include #include #include #include #include "definitions.h" #include "StopWatch.h" #include "ArrayGroup.h" #include "ArrayLayout.h" #include "Array.h" #include "Panda.h" #include "mpirun.h" int Num_of_Arrays = 1; int Num_Simulate_Read = 0; int Num_Read = 0; int Num_Simulate_Write = 2; int Num_Write = 2 ; int interleave = 0; Panda *global_bear; extern int BRANCHING_FACTOR; extern int SUBCHUNK_SIZE; int STRATEGY = 1; void test_timestep(ArrayGroup *t1, int arraysize, Array **arrays) { StopWatch timer; int i; int flag=0; char time_message[100]; #ifdef VERIFYBF for (int j=0; jset_byte_pattern(); t1->set_verify(); #endif global_bear->cleanfiles(); global_bear->createfiles(); for (i=0; iset_simulate_mode(); flag=0; } else { t1->reset_simulate_mode(); flag=1; } global_bear->global_barrier(); t1->set_io_strategy(STRATEGY); timer.start(); t1->timestep(); timer.stop(":"); sprintf(time_message,"App_id %d: %s Write: SIZE: %d, Time %i %s", MPIRUN_APP_ID, (flag==0? "Simulated":"Real"), arraysize, i, timer.get_description()); printf("%s", time_message); if (Num_Read + Num_Simulate_Read == 0 || i < Num_Simulate_Write + Num_Write-1 ) { global_bear->cleanfiles(); global_bear->createfiles(); } } } void test_readtimestep(ArrayGroup *r1, int arraysize, Array **arrays) { StopWatch timer; int i; int flag; char time_message[100]; #ifdef VERIFYBF for (int j=0; jreset_byte_pattern(); #endif if (Num_Write + Num_Simulate_Write == 0) { global_bear->cleanfiles(); global_bear->createfiles(); } for (i=0; iset_simulate_mode(); flag=0; } else {r1->reset_simulate_mode(); flag=1; global_bear->flushfiles(); } global_bear->global_barrier(); r1->set_io_strategy(STRATEGY); timer.start(); r1->read_timestep(); timer.stop(":"); sprintf(time_message,"App_id %d: %s Read: SIZE: %d, Time %i %s ", MPIRUN_APP_ID, (flag==0? "Simulated":"Real"), arraysize, i, timer.get_description()); printf("%s", time_message); } #ifdef VERIFYBF for(i=0;iverify_byte_pattern()) printf("Byte pattern verified for array %d\n", i); else printf("Byte pattern incorrect for array %d\n", i); #endif global_bear->cleanfiles(); } int gemein(Panda *bear, int io_nodes, int arrayrank, int *arraysize, int esize, int mrank, int *mlayout, int drank, int *dlayout, Distribution *mem_dist, Distribution *disk_dist, int cost_model) { ArrayLayout *mem1; // Memory array layout ArrayLayout *disk1; // Disk array layout int i; Array **arrays; arrays = (Array **)malloc(sizeof(Array*)*Num_of_Arrays); // Set up memory and disk layouts mem1 = new ArrayLayout (mrank,mlayout); disk1 = new ArrayLayout(drank,dlayout); // Create an Array for computation. char *name; name = (char *)malloc(sizeof(char)*(strlen("z1Array")+5)); char temp[5]; for (i=0; i< Num_of_Arrays; i++) { strcpy(name,"z1Array"); sprintf(temp, "%d", i); strcat(name, temp); arrays[i] = new Array(name,arrayrank,arraysize,esize, mem1,mem_dist,disk1, disk_dist); } free(name); if (Num_Simulate_Write + Num_Write > 0) { ArrayGroup *t1 = new ArrayGroup("z4timestep"); for (i= 0; iinsert(arrays[i]); test_timestep(t1, arraysize[arrayrank-1], arrays); delete t1; if (Num_Simulate_Read + Num_Read > 0) { ArrayGroup *r1 = new ArrayGroup("z4timestep"); for (i= 0; iinsert(arrays[i]); test_readtimestep(r1, arraysize[arrayrank-1], arrays); delete r1; } } else { ArrayGroup *r1 = new ArrayGroup("z4timestep"); for (i= 0; iinsert(arrays[i]); test_readtimestep(r1, arraysize[arrayrank-1], arrays); delete r1; } // delete all objects created for (i=0; i