Exemplo n.º 1
0
int main(int argc, char *argv[])
{
    double tfirst, t;
    int i;
    int repeat_count = 1;
    int current_repeat = 0;
    double average = 0.0;

    if (argc >= 2)
    {
        repeat_count = atoi(argv[1]);
    }

    /* First run: warmup */
    tfirst = hpctimer_wtime();
    blend_map(z, x, y, n, 0);
    tfirst = hpctimer_wtime() - tfirst;

        srand(time(NULL));

    while (current_repeat < repeat_count)
    {
        /* Measures */
        t = hpctimer_wtime();
        for (i = 0; i < nreps; i++) {
            blend_map(z, x, y, n, rand());
        }
        t = (hpctimer_wtime() - t) / nreps;

        //printf("First run (sec.): %.6f\n", tfirst);
        //printf("Mean of %d runs (sec.): %.6f\n", nreps, t);
        average += t;

        current_repeat++;
    }

    average /= repeat_count;

    printf("%.6f\n", average);

    return 0;
}
Exemplo n.º 2
0
int main()
{
    double t;
    int i;
        
   	t = hpctimer_wtime();
    for (i = 0; i < nreps; i++) {
        blend_map(z, x, y, n, 0);
    }
    t = (hpctimer_wtime() - t) / nreps;

    printf("Elapsed time: %.6f sec.\n", t);
    
	return 0;
}