#include #include #include #include #include #include #include int main(argc,argv) int argc; char *argv[]; { unsigned *buf[128]; unsigned ncheck[129],jcheck[128]; unsigned bsz,stp; clock_t rstart,rend,cstart,cend,istart,iend; struct tms tm; char *pname; double srun,sela,crun,cela,cper,scre; long clk_tck=sysconf(_SC_CLK_TCK); istart=times(&tm); if(pname=rindex(argv[0],'/')) pname++; else pname=argv[0]; printf("%s - Eric's memory/cache benchmark v2.0-cilk\n",pname); if(argc!=3){ fprintf(stderr,"Usage: %s size steps\n\n" "where size is the size of the memory buffer to allocate and\n" "steps is the number of memory accesses to make.\n",pname); exit(1); } bsz=atoi(argv[1]); stp=atoi(argv[2]); int ncpu = __cilkrts_get_nworkers(); printf("CILK_NWORKERS=%d\nsizeof(unsigned)=%u\n", ncpu,(unsigned)sizeof(unsigned)); printf( "Performing test: size=%d, steps=%d, sizeof(int)=%d...", bsz,stp,sizeof(int)); for(int cpu=0;cpu