Пример #1
0
int main(){
	const char* rows[5] = {"SUM", "SUMSTR", "SUMCONSTSTR", 
			       "COPY", "COPYCONSTSTR"};
	const char* cols[1] = {"n=1e9 doubles"};
	const int n = 1000*1000*1000;
	double *a, *b;
	
	init_mem(a, b, n);
	
	double bw[5];
	bw[0] = time(a, b, n, SUM);
	bw[1] = time(a, b, n, SUMSTR);
	bw[2] = time(a, b, n, SUMCONSTSTR);
	bw[3] = time(a, b, n, COPY);
	bw[4] = time(a, b, n, COPYCONSTSTR);

	verify_dir("DBG/");
	char fname[200];
	sprintf(fname, "DBG/time_sc_stride_%d.txt", STR);
	link_cout(fname);

	Table tbl;
	tbl.dim(5, 1);
	tbl.rows(rows);
	tbl.cols(cols);
	tbl.data(bw);
	char banner[200];
	sprintf(banner, "memory bw in bytes/cycle, stride = %d\n", STR);
	tbl.print(banner);
	
	unlink_cout();

	release_mem(a, b);

}
Пример #2
0
int main(){
	enum leib_enum flag[7] = {LEIB, PLL, PLLX, 
				  FOR, FORCHUNK, PLLFOR, 
				  SCTN};
	const char* rows[7] = {"serial", "parallel", "parallelx",
			       "for", "forchunk", "parallelfor",
			       "section"};
	const char* cols[2] = {"pi", "cycles/term"};
	const int nthreads = atoi(getenv("OMP_NUM_THREADS"));

	std::cout<<"num of threads = "<<nthreads<<std::endl;

	const long n = 1l*1000*1000*1000*10;
	double data[14];
	struct leib_struct ans;
	for(int i=0; i < 7; i++){
		ans = time_leibniz(n, nthreads, flag[i]);
		data[i] = ans.pi;
		data[i+7] = ans.cycles/n;
	}

	Table tbl;
	tbl.dim(7, 2);
	tbl.rows(rows);
	tbl.cols(cols);
	tbl.data(data);
	verify_dir("DBG");
	link_cout("DBG/time_leibniz.txt");
	char banner[200];
	sprintf(banner, "sum of %ld terms of Leibniz", n);
	tbl.print(banner);
	unlink_cout();
}
Пример #3
0
int main(){
	int rank, nprocs;
	mpi_initialize(rank, nprocs);
	mpi_print_name(rank);

	const char *rows[6] = {"1e3", "1e4", "1e5", 
			       "1e6", "1e7", "1e8"};
	int nlist[6] = {1000, 1000*10, 1000*100, 
			1000*1000, 1000*1000*10, 1000*1000*100};
	const char* cols[2] = {"cycles", "b/w"};
	double data[12];
	
	for(int i=0; i < 6; i++){
		data[i] = time(rank, nprocs, nlist[i]);
		data[i+6] = 32.0*nlist[i]/data[i];
	}

	if(rank == 0){//output table
		char fname[200];
		verify_dir("DBG");
		sprintf(fname, "DBG/time_cycle_NP%d.txt", nprocs);
		link_cout(fname);

		Table tbl;
		tbl.dim(6, 2);
		tbl.rows(rows);
		tbl.cols(cols);
		tbl.data(data);
		tbl.print();

		unlink_cout();
	}
			
	mpi_finalize();
}
Пример #4
0
int main(){
	int dim[4] = {100, 1000, 2000, 6000};
	int count[4] = {4000, 40, 10, 1};

	verify_dir("DBG/");
	const char* fname = "DBG/cpp-mult.txt";
	link_cout(fname);
	
	for(int i=0; i < 4; i++){
		timecppmult(dim[i], count[i]); 
	}
	
	unlink_cout();
}
Пример #5
0
int main(){
	const int nrows = 12;
	int nlist[nrows] = {1, 2, 4, 
		       8, 16, 24, 
		       32, 40, 60, 
		       1000, 10*1000, 100*1000};
	const char *rows[nrows] =  {"1", "2", "4", 
				    "8", "16", "24", 
				    "32", "40", "60", 
				    "1000", "10*1000", "100*1000"};
	const int ncols = 3;
	const char *cols[ncols] = {"min", "median", "max"};
	
	double cyc2dram[nrows*ncols];
	StatVector stats(NTRIALS);
	
	for(int i=0; i < nrows; i++){
		measure_latency(nlist[i], stats);
		cyc2dram[i+0*nrows] = stats.min();
		cyc2dram[i+1*nrows] = stats.median();
		cyc2dram[i+2*nrows] = stats.max();
	}
	
	verify_dir("DBG");
#ifdef MEMWALK
	const char* fname = "DBG/latency_memwalk.txt";
#else
	const char* fname = "DBG/latency_clflush.txt";
#endif
	link_cout(fname);

	Table tbl;
	tbl.dim(nrows, ncols);
	tbl.rows(rows);
	tbl.cols(cols);
	tbl.data(cyc2dram);
	char banner[200];
	sprintf(banner, "cycles to dram, ntrials = %d, when N pages accessed",
		NTRIALS);
	tbl.print(banner);
	
	unlink_cout();
}