/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this C++ g++ program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500 | 0.24 | 0.25 | 264 | 452 | 0% 0% 4% 100% |
| 3,000 | 8.48 | 8.48 | 872 | 452 | 0% 1% 1% 100% |
| 5,500 | 28.47 | 28.48 | 872 | 452 | 0% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read spectral-norm benchmark to see what this program should do.
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // Original C contributed by Sebastien Loisel // Conversion to C++ by Jon Harrop // Compile: g++ -O3 -o spectralnorm spectralnorm.cpp #include <stdio.h> #include <stdlib.h> #include <cmath> #include <vector> #include <iostream> #include <iomanip> using namespace std; double eval_A(int i, int j) { return 1.0 / ((i+j)*(i+j+1)/2 + i + 1); } void eval_A_times_u(const vector<double> &u, vector<double> &Au) { for(int i=0; i<u.size(); i++) for(int j=0; j<u.size(); j++) Au[i] += eval_A(i,j) * u[j]; } void eval_At_times_u(const vector<double> &u, vector<double> &Au) { for(int i=0; i<u.size(); i++) for(int j=0; j<u.size(); j++) Au[i] += eval_A(j,i) * u[j]; } void eval_AtA_times_u(const vector<double> &u, vector<double> &AtAu) { vector<double> v(u.size()); eval_A_times_u(u, v); eval_At_times_u(v, AtAu); } int main(int argc, char *argv[]) { int N = ((argc == 2) ? atoi(argv[1]) : 2000); vector<double> u(N), v(N); fill(u.begin(), u.end(), 1); for(int i=0; i<10; i++) { eval_AtA_times_u(u, v); fill(u.begin(), u.end(), 0); eval_AtA_times_u(v, u); } double vBv=0, vv=0; for(int i=0; i<N; i++) { vBv += u[i]*v[i]; vv += v[i]*v[i]; } cout << setprecision(10) << sqrt(vBv/vv) << endl; return 0; }
Tue, 30 Apr 2013 05:50:38 GMT
MAKE:
/usr/bin/g++ -c -pipe -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse2 -fopenmp -O0 spectralnorm.c++ -o spectralnorm.c++.o && \
/usr/bin/g++ spectralnorm.c++.o -o spectralnorm.gpp_run -fopenmp
rm spectralnorm.c++
0.38s to complete and log all make actions
COMMAND LINE:
./spectralnorm.gpp_run 5500
PROGRAM OUTPUT:
1.274224153