/***************************************************************************** C-DAC Tech Workshop : hyPACK-2013 October 15-18, 2013 Example 1.1 : single-core-prg-loop-unroll.c Objective : Write a program to demonstrate the execution time for the following loop with/without Loop Unrolling. for (i=0; i #include #include #define seed 10000 main(int argc, char *argv[]) { int CounterI, Size, Remain; int VectorAorig[10000], VectorBorig[10000], VectorCorig[10000]; int VectorAmod[10000], VectorBmod[10000], VectorCmod[10000]; struct timeval TimeValue_Start; struct timezone TimeZone_Start; struct timeval TimeValue_Final; struct timezone TimeZone_Final; double time_start, time_end, time_overheadorig,time_overheadmod; if (argc<2){ printf(" Please provide a positive integer for the size of the vectors as command-line argument\n"); return (-1); } Size=atoi(argv[1]); Size=abs(Size); if (Size>10000){ printf(" Please provide a positive integer less than equal to 10000 for the size of the vectors\n"); return (-1); } printf("\n Size is taken as %d", Size); /* Populating the matrices B and C, Matrix A consists of random values */ srand(seed); for(CounterI=0; CounterI