Fixed in 
https://github.com/open-mpi/ompi/commit/46aa20a9191db2f5cc1850c0f4f881ac51653cb4.

Thanks!

> On Apr 22, 2015, at 3:01 PM, Paul Hargrove <phhargr...@lbl.gov> wrote:
> 
> I had reason to look at the linux timer code today and noticed what I believe 
> to be a subtle error.
> This is in both 'master' and v1.8.5rc2
> 
> Since casts bind tighter than multiplication in C, I believe that the 1-line 
> patch below is required to produce the desired result of conversion to an 
> integer *after* the multiplication.
> While I don't see how to exercise the code, I can see that cpu_f=2692.841 
> will yield opal_timer_linux_freq=2,692,000,000 rather than 2,692,841,000.
> 
> -Paul
> 
> 
> diff --git a/opal/mca/timer/linux/timer_linux_component.c 
> b/opal/mca/timer/linux/timer_linux_component.c
> index b130826..7abe578 100644
> --- a/opal/mca/timer/linux/timer_linux_component.c
> +++ b/opal/mca/timer/linux/timer_linux_component.c
> @@ -128,7 +128,7 @@ static int opal_timer_linux_find_freq(void)
>              ret = sscanf(loc, "%f", &cpu_f);
>              if (1 == ret) {
>                  /* numer is in MHz - convert to Hz and make an integer */
> -                opal_timer_linux_freq = (opal_timer_t) cpu_f * 1000000;
> +                opal_timer_linux_freq = (opal_timer_t) (cpu_f * 1000000);
>              }
>          }
>      }
> 
> -- 
> Paul H. Hargrove                          phhargr...@lbl.gov
> Computer Languages & Systems Software (CLaSS) Group
> Computer Science Department               Tel: +1-510-495-2352
> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2015/04/17312.php


-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

Reply via email to