int main() { int numBenchmarks = 6; #ifndef BENCHMARK_VALARRAY numBenchmarks--; // No valarray #endif #ifndef FORTRAN_90 numBenchmarks--; // No fortran 90 #endif BenchmarkExt<int> bench("DAXPY Benchmark", numBenchmarks); const int numSizes = 19; bench.setNumParameters(numSizes); Vector<int> parameters(numSizes); Vector<long> iters(numSizes); Vector<double> flops(numSizes); for (int i=0; i < numSizes; ++i) { parameters(i) = static_cast<int>(pow(10.0, 0.25*(i+1))); iters(i) = 50000000L / parameters(i); if (iters(i) < 2) iters(i) = 2; flops(i) = 2 * parameters(i) * 2; } bench.setParameterVector(parameters); bench.setIterations(iters); bench.setOpsPerIteration(flops); bench.beginBenchmarking(); float a = .398498293819823; daxpyVectorVersion(bench, a, -a); daxpyArrayVersion(bench, a); daxpyF77Version(bench, a); daxpyBLASVersion(bench, a); #ifdef FORTRAN_90 daxpyF90Version(bench, a); #endif #ifdef BENCHMARK_VALARRAY daxpyValarrayVersion(bench, a); #endif bench.endBenchmarking(); bench.saveMatlabGraph("daxpy.m"); return 0; }
int main() { //menu driven program while(1){ int numberOfThreads; printf("\nEnter the no of threads:(1/2/4) /(Enter 8 for 600 Samples /Exit-0: "); scanf("%d",&numberOfThreads); // Enter 1/2/3 threads for GFLOPS/GIOPS // Incase to get 600 samples for GFLOPS/GIOPS Enter 8 // To exit press 0 if(numberOfThreads!=1 && numberOfThreads!=2 && numberOfThreads!=4 && numberOfThreads!=0 && numberOfThreads!=8) { printf("\nInvalid choice..Please enter again"); } else if(numberOfThreads==8) { flops(4); iops(4); } else if(numberOfThreads==0) { exit(0); } else { flopsCal(numberOfThreads); iopsCal(numberOfThreads); } } return 0; }
int main() { BenchmarkExt<int> bench("Array DAXPY", 2); const int numSizes = 128; bench.setNumParameters(numSizes); bench.setRateDescription("Mflops/s"); Vector<int> parameters(numSizes); Vector<long> iters(numSizes); Vector<double> flops(numSizes); for (int i=0; i < numSizes; ++i) { parameters[i] = (i+1); iters[i] = 16*32*8*8*8/(i+1)/(i+1)/(i+1); float npoints = parameters[i]; flops[i] = npoints * npoints * npoints * 2 * 2; } bench.setParameterVector(parameters); bench.setIterations(iters); bench.setFlopsPerIteration(flops); bench.beginBenchmarking(); arrdaxpyBlitzVersion(bench); arrdaxpyFortran77Version(bench); bench.endBenchmarking(); bench.saveMatlabGraph("arrdaxpy.m"); return 0; }
int main() { int numBenchmarks = 5; if (runvector) numBenchmarks++; #ifdef BENCHMARK_VALARRAY numBenchmarks++; #endif #ifdef FORTRAN_90 numBenchmarks++; #endif BenchmarkExt<int> bench("loop100: $x=(1.0-$c*$c)/((4*w)*sin(1.0+$c*$c-2*v*$c))*$a*$b*u*exp(-z*$d)", numBenchmarks); bench.setNumParameters(numSizes); Array<int,1> parameters(numSizes); Array<long,1> iters(numSizes); Array<double,1> flops(numSizes); parameters=pow(pow(2.,0.25),tensor::i)+tensor::i; flops = 18 * parameters; iters = 100000000L / flops; iters = where(iters<2, 2, iters); cout << iters << endl; bench.setParameterVector(parameters); bench.setIterations(iters); bench.setOpsPerIteration(flops); bench.setDependentVariable("flops"); bench.beginBenchmarking(); double u = 0.39123982498157938742; double v = 0.39123982498157938742; double w = 0.39123982498157938742; double z = 0.39123982498157938742; ArrayVersion(bench, u, v, w, z); ArrayVersion_unaligned(bench, u, v, w, z); ArrayVersion_misaligned(bench, u, v, w, z); ArrayVersion_index(bench, u, v, w, z); //doTinyVectorVersion(bench, u, v, w, z); F77Version(bench, u, v, w, z); #ifdef FORTRAN_90 F90Version(bench, u, v, w, z); #endif #ifdef BENCHMARK_VALARRAY ValarrayVersion(bench, u, v, w, z); #endif if(runvector) VectorVersion(bench, u, v, w, z); bench.endBenchmarking(); bench.saveMatlabGraph("loop100.m"); return 0; }
int main() { int numBenchmarks = 5; if (runvector) numBenchmarks++; #ifdef BENCHMARK_VALARRAY numBenchmarks++; #endif #ifdef FORTRAN_90 numBenchmarks++; #endif BenchmarkExt<int> bench("floop3: $y = $y + a*$x", numBenchmarks); bench.setNumParameters(numSizes); Array<int,1> parameters(numSizes); Array<long,1> iters(numSizes); Array<double,1> flops(numSizes); parameters=pow(pow(2.,0.25),tensor::i)+tensor::i; flops = 2 * parameters; iters = 100000000L / flops; iters = where(iters<2, 2, iters); cout << iters << endl; bench.setParameterVector(parameters); bench.setIterations(iters); bench.setOpsPerIteration(flops); bench.setDependentVariable("flops"); bench.beginBenchmarking(); float a = 0.39123982498157938742; ArrayVersion(bench, a); ArrayVersion_unaligned(bench, a); ArrayVersion_misaligned(bench, a); ArrayVersion_index(bench, a); //doTinyVectorVersion(bench, a); F77Version(bench, a); #ifdef FORTRAN_90 F90Version(bench, a); #endif #ifdef BENCHMARK_VALARRAY ValarrayVersion(bench, a); #endif if(runvector) VectorVersion(bench, a); bench.endBenchmarking(); bench.saveMatlabGraph("floop3.m"); return 0; }
int main() { if (dontActuallyRunBenchmark()) return 0; int numBenchmarks = 2; BenchmarkExt<int> bench("loop1: $x=sqrt($y)", numBenchmarks); const int numSizes = 26; bench.setNumParameters(numSizes); //bench.setRateDescription("Mflops/s"); removed Vector<int> parameters(numSizes); Vector<long> iters(numSizes); Vector<double> flops(numSizes); for (int i=0; i < numSizes; ++i) { parameters(i) = (int)pow(10.0, (i+1)/4.0); iters[i] = 50000000L / parameters(i); if (iters(i) < 2) iters(i) = 2; flops(i) = 1 * parameters(i); } bench.setParameterVector(parameters); bench.setIterations(iters); bench.setOpsPerIteration(flops); bench.beginBenchmarking(); VectorVersion(bench); ArrayVersion(bench); bench.endBenchmarking(); bench.saveMatlabGraph("loop1.m"); return 0; }
int main() { int numBenchmarks = 5; #ifndef BENCHMARK_VALARRAY numBenchmarks--; // No valarray #endif #ifndef FORTRAN_90 numBenchmarks--; // No fortran 90 #endif BenchmarkExt<int> bench("loop18: $x=(u+$a)*(v+$b)", numBenchmarks); const int numSizes = 23; bench.setNumParameters(numSizes); bench.setRateDescription("Mflops/s"); Vector<int> parameters(numSizes); Vector<long> iters(numSizes); Vector<double> flops(numSizes); for (int i=0; i < numSizes; ++i) { parameters[i] = (int)pow(10.0, (i+1)/4.0); iters[i] = 10000000L / parameters[i]; if (iters[i] < 2) iters[i] = 2; flops[i] = 3 * parameters[i]; } bench.setParameterVector(parameters); bench.setIterations(iters); bench.setFlopsPerIteration(flops); bench.beginBenchmarking(); double u = 0.39123982498157938742; double v = 0.39123982498157938742; VectorVersion(bench, u, v); ArrayVersion(bench, u, v); F77Version(bench, u, v); #ifdef FORTRAN_90 F90Version(bench, u, v); #endif #ifdef BENCHMARK_VALARRAY ValarrayVersion(bench, u, v); #endif bench.endBenchmarking(); bench.saveMatlabGraph("loop18.m"); return 0; }
int main() { #ifdef BENCHMARK_VALARRAY int numBenchmarks = 6; #else int numBenchmarks = 5; #endif BenchmarkExt<int> bench("DAXPY Benchmark", numBenchmarks); const int numSizes = 19; bench.setNumParameters(numSizes); bench.setRateDescription("Mflops/s"); Vector<int> parameters(numSizes); Vector<long> iters(numSizes); Vector<double> flops(numSizes); for (int i=0; i < numSizes; ++i) { parameters[i] = pow(10.0, (i+1)/4.0); iters[i] = 50000000L / parameters[i]; if (iters[i] < 2) iters[i] = 2; flops[i] = 2 * parameters[i] * 2; } bench.setParameterVector(parameters); bench.setIterations(iters); bench.setOpsPerIteration(flops); bench.beginBenchmarking(); float a = .398498293819823; daxpyVectorVersion(bench, a, -a); daxpyArrayVersion(bench, a); daxpyF77Version(bench, a); daxpyBLASVersion(bench, a); daxpyF90Version(bench, a); #ifdef BENCHMARK_VALARRAY daxpyValarrayVersion(bench, a); #endif bench.endBenchmarking(); bench.saveMatlabGraph("daxpy2.m"); return 0; }
int main() { int numBenchmarks = 10; #ifndef FORTRAN_90 numBenchmarks--; // No fortran 90 #endif BenchmarkExt<int> bench("Array stencil", numBenchmarks); const int numSizes = 28; bench.setNumParameters(numSizes); bench.setRateDescription("Mflops/s"); Vector<int> parameters(numSizes); Vector<long> iters(numSizes); Vector<double> flops(numSizes); for (int i=0; i < numSizes; ++i) { parameters[i] = (i+1) * 8; iters[i] = 32*8*8*8/(i+1)/(i+1)/(i+1)/4; if (iters[i] < 2) iters[i] = 2; int npoints = parameters[i] - 2; flops[i] = npoints * npoints * npoints * 7 * 2; } bench.setParameterVector(parameters); bench.setIterations(iters); bench.setFlopsPerIteration(flops); bench.beginBenchmarking(); #ifdef FORTRAN_90 stencilFortran90Version(bench); #endif stencilBlitzVersion(bench); stencilBlitzStencilVersion(bench); stencilBlitzExpressionVersion(bench); stencilBlitzProductVersion(bench); stencilBlitzProductVersion2(bench); stencilBlitzProductVersion3(bench); stencilBlitzIndexVersion(bench); stencilFortran77Version(bench); stencilFortran77VersionTiled(bench); bench.endBenchmarking(); bench.saveMatlabGraph("stencil.m","plot"); return 0; }