Accéder au contenu.
Menu Sympa

starpu-devel - Re: [Starpu-devel] [patch request] Double comparison

Objet : Developers list for StarPU

Archives de la liste

Re: [Starpu-devel] [patch request] Double comparison


Chronologique Discussions 
  • From: Samuel Thibault <samuel.thibault@ens-lyon.org>
  • To: Nathalie Furmento <nathalie.furmento@labri.fr>
  • Cc: starpu-devel@lists.gforge.inria.fr
  • Subject: Re: [Starpu-devel] [patch request] Double comparison
  • Date: Mon, 30 Jan 2012 13:37:27 +0100
  • List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
  • List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>

Nathalie Furmento, le Mon 30 Jan 2012 13:25:52 +0100, a écrit :
> +int _starpu_approximately_equal(double a, double b)
> +{
> + int ai = (int) nearbyint(a * 1000.0);
> + int bi = (int) nearbyint(b * 1000.0);
> + return ai == bi;
> +}

Maybe make 1000 a parameter.

> - if (exp == -1.0 && !model->benchmarking)
> + if (_starpu_approximately_equal(exp, -1.0) && !model->benchmarking)

Mmm, no, such kind of comparisons are supposed to be exact: we really
put exactly there -1.0 as a markup. Using such a long function name
makes the code way less readable. At best we could introduce
_starpu_is_nan, and use nan instead of -1 as marker.

Same for all other occurrences.

> enum starpu_perf_archtype arch =
> starpu_worker_get_perf_archtype(w);
> - if (t1->duration[arch] == 0.)
> + if (fpclassify(t1->duration[arch]) == FP_ZERO)

I'd say introduce _starpu_is_zero.

samuel





Archives gérées par MHonArc 2.6.19+.

Haut de le page