int main(int argc, char **argv) { char buf[80]; int arsize; long arsize2d,memreq,nreps; size_t malloc_arg; arsize = atoi(argv[1]); arsize/=2; arsize*=2; if (arsize<10) { return -1; } arsize2d = (long)arsize*(long)arsize; memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int); malloc_arg=(size_t)memreq; if (malloc_arg!=memreq || (mempool=malloc(malloc_arg))==NULL) { return -1; } nreps=atoi(argv[2]); linpack(nreps,arsize); free(mempool); return 0; }
int main(void) { char buf[80]; int arsize; long arsize2d,memreq,nreps; size_t malloc_arg; printf("\n\nLINPACK benchmark, %s precision.\n",PREC); printf("Machine precision: %d digits.\n",BASE10DIG); printf("Average rolled and unrolled performance:\n\n"); printf("N Reps Time(s) DGEFA DGESL OVERHEAD KFLOPS\n"); printf("------------------------------------------\n"); for (arsize=16; arsize<=MAX_DIM; arsize*=2) { arsize/=2; arsize*=2; arsize2d = (long)arsize*(long)arsize; memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int); malloc_arg=(size_t)memreq; if (malloc_arg!=memreq || (mempool=malloc(malloc_arg))==NULL) { printf("Not enough memory available for given array size.\n\n"); continue; } nreps=1; while (linpack(nreps,arsize)<10.) nreps*=2; free(mempool); } return 0; }
void linpack_(void) { char buf[80]; int arsize; long arsize2d,memreq,nreps; size_t malloc_arg; /* ORIGINAL START while (1) { printf("Enter array size (q to quit) [200]: "); fgets(buf,79,stdin); if (buf[0]=='q' || buf[0]=='Q') break; if (buf[0]=='\0' || buf[0]=='\n') arsize=200; else arsize=atoi(buf); arsize/=2; arsize*=2; if (arsize<10) { printf("Too small.\n"); continue; } ORIGINAL END */ /* MOD START */ arsize = WORKLOAD; /* MOD END */ arsize2d = (long)arsize*(long)arsize; memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int); printf("Memory required: %ldK.\n",(memreq+512L)>>10); malloc_arg=(size_t)memreq; if (malloc_arg!=memreq || (mempool=malloc(malloc_arg))==NULL) { printf("Not enough memory available for given array size.\n\n"); /* continue; */ return; } printf("\n\nLINPACK benchmark, %s precision.\n",PREC); printf("Machine precision: %d digits.\n",BASE10DIG); printf("Array size %d X %d.\n",arsize,arsize); printf("Average rolled and unrolled performance:\n\n"); printf(" Reps Time(s) DGEFA DGESL OVERHEAD KFLOPS\n"); printf("----------------------------------------------------\n"); nreps=1; while (linpack(nreps,arsize)<1.) nreps*=2; free(mempool); printf("\n"); /* ORIGINAL START } ORIGINAL END */ }
char * run(void) { char buf[80]; int arsize; long arsize2d,memreq,nreps; size_t malloc_arg; while (1) { // printf("Enter array size (q to quit) [200]: "); // fgets(buf,79,stdin); // if (buf[0]=='q' || buf[0]=='Q') // break; // if (buf[0]=='\0' || buf[0]=='\n') // arsize=200; // else // arsize=atoi(buf); arsize = 200; arsize/=2; arsize*=2; if (arsize<10) { printf("Too small.\n"); continue; } arsize2d = (long)arsize*(long)arsize; memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int); printf("Memory required: %ldK.\n",(memreq+512L)>>10); malloc_arg=(size_t)memreq; if (malloc_arg!=memreq || (mempool=malloc(malloc_arg))==NULL) { printf("Not enough memory available for given array size.\n\n"); continue; } sprintf(buf, "\n\nLINPACK benchmark, %s precision.\n",PREC); pass_jni_msg(buf); sprintf(buf, "Machine precision: %d digits.\n",BASE10DIG); pass_jni_msg(buf); sprintf(buf, "Array size %d X %d.\n",arsize,arsize); pass_jni_msg(buf); sprintf(buf, "Average rolled and unrolled performance:\n\n"); pass_jni_msg(buf); sprintf(buf, " Reps Time(s) DGEFA DGESL OVERHEAD MFLOPS\n"); pass_jni_msg(buf); sprintf(buf, "----------------------------------------------------\n"); pass_jni_msg(buf); nreps=1; while (linpack(nreps,arsize)<10.) nreps*=2; free(mempool); printf("\n"); return "Done!"; } }
int MAMain ( void ) { char buf[80]; int arsize; long arsize2d,memreq,nreps; size_t malloc_arg; g_startTime = maGetMilliSecondCount( ); //while (1) { /* printf("Enter array size (q to quit) [200]: "); fgets(buf,79,stdin); if (buf[0]=='q' || buf[0]=='Q') break; if (buf[0]=='\0' || buf[0]=='\n') arsize=200; else arsize=atoi(buf); */ arsize = 200; arsize/=2; arsize*=2; if (arsize<10) { printf("Too small.\n"); //continue; } arsize2d = (long)arsize*(long)arsize; memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int); printf("Memory required: %ldK.\n",(memreq+512L)>>10); malloc_arg=(size_t)memreq; if (malloc_arg!=memreq || (mempool=malloc(malloc_arg))==NULL) { printf("Not enough memory available for given array size.\n\n"); //continue; } printf("\n\nLINPACK benchmark, %s precision.\n",PREC); //printf("Machine precision: %d digits.\n",BASE10DIG); printf("Array size %d X %d.\n",arsize,arsize); printf("Average rolled and unrolled performance:\n\n"); printf(" Reps Time(s) DGEFA DGESL OVERHEAD MFLOPS\n"); printf("----------------------------------------------------\n"); nreps=4; // linpack(nreps, arsize); while (linpack(nreps,arsize)<10.) nreps*=2; free(mempool); printf("Finished!\n"); } FREEZE; }
int main(int argc, char *argv[]) { int arsize; long arsize2d,memreq,nreps; size_t malloc_arg; #ifdef ROLL roll = 1; #else roll = 0; #endif if (argc > 1) arsize = atoi (argv[1]); else arsize = 200; arsize/=2; arsize*=2; if (arsize<10) { printf("Array size too small.\n"); exit (1); } arsize2d = (long)arsize*(long)arsize; memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int); printf("Memory required: %ldK.\n",(memreq+512L)>>10); malloc_arg=(size_t)memreq; if (malloc_arg!=memreq || (mempool=malloc(malloc_arg))==NULL) { printf("Not enough memory available for given array size.\n\n"); exit (1); } printf("\n\nLINPACK benchmark, %s precision.\n",PREC); printf("Machine precision: %d digits.\n",BASE10DIG); printf("Array size %d X %d. (n = %d)\n",arsize,arsize,arsize/2); if (roll) printf ("Rolled performance:\n\n"); else printf ("Unrolled performance:\n\n"); printf(" Reps Time(s) DGEFA DGESL OVERHEAD KFLOPS\n"); printf("----------------------------------------------------\n"); nreps=1; while (linpack(nreps,arsize)<10.) nreps*=2; free(mempool); printf("\n"); }