3. Serial Implementation
serial.c:// run a function serially N times // // run time is sum of the run times for each function call // #include "common.c" // run the functions // for( int i = 0; i < N; ++i) f( &D[i].i); } --- $ gcc -std=c11 -pedantic -Wall -g -O -o serial serial.c $ time ./serial f 0 start = 0, size = 6 f 0 done f 1 start = 10, size = 5 f 1 done f 2 start = 20, size = 4 f 2 done f 3 start = 30, size = 3 f 3 done real 0m18.007s # 6+5+4+3 = 18 seconds user 0m0.002s sys 0m0.001s