too simple Intel C program
source code
/* The Computer Language Benchmarks Game
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
*/
#include<stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
// mtime side-effect
FILE* f = fopen("./one", "w"); fclose(f);
long n = atol(argv[1]);
double sum = 0.0;
double flip = -1.0;
for (long i = 1; i <= n; i++) {
flip *= -1.0;
sum += flip / (2*i - 1);
}
printf("%.9f\n", sum*4.0);
// mtime side-effect
f = fopen("./two", "w"); fclose(f);
return 0;
}
notes, command-line, and program output
NOTES:
64-bit Ubuntu quad core
Intel(R) oneAPI DPC++/C++ Compiler
2024.1.0.20240308
Sat, 21 Sep 2024 22:05:45 GMT
MAKE:
~/intel/oneapi/compiler/latest/bin/icx -pipe -Wall -O3 -fomit-frame-pointer -march=ivybridge toosimple.c -o toosimple.icx_run
rm toosimple.c
4.70s to complete and log all make actions
COMMAND LINE:
./toosimple.icx_run 10000000000
PROGRAM OUTPUT:
3.141592649