[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] application's execution time
another question, what kernel configuration option should be added to use the command time ./<app_name> ? (it doesn't work with the default one)
(Up to one I used the time.h library in my programs to evaluate execution time but I'd like to have more accurate results)
----- Mail Original -----
De: "John Williams" <john.williams@xxxxxxxxxxxxx>
À: microblaze-uclinux@xxxxxxxxxxxxxx
Envoyé: Jeudi 27 Août 2009 11h10:05 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [microblaze-uclinux] application's execution time
On Thu, Aug 27, 2009 at 5:57 PM, Faiza Ait-Kaci<faiza.ak@xxxxxxxxxx> wrote:
> Hi,
>
> Well actually, it is worse than that, the program hadn't stopped execution (even two hours after) I thought it took only one hour because I got a result on the screen but it was only an intermediate one.
> I added another application which takes 0.02s to execute on my host (a matrix multiplication of 100*100 matrices). after two hours, the program was still running on target! I stopped the execution and tried a matrix multiplication of 10*4 matrices. the execution time on the target was of 0.01s.
> Can this mean that only small programs can be run on target? Is that because of no MMU?
What is the datatype of the matrix code? single precision floating
point? doubles?
Are you using the MicroBlaze FPU? It only accelerates single
precision floating point, so you have to be very careful about
implicit casts from float to double.
pop quiz - what's wrong with the following code?
float f(float a, float b)
{
return 2.0*(a*b);
}
Answer: The compiler will multiply 'a' and 'b' as single precision
values, and if you have the FPU and appropriate CFLAGS, it will be
accelerated.
But, the compiler implicitly casts 2.0 to a *double*, which means that
when you multiply the (a*b) result by 2, it promotes the intermediate
result to a double, then does a double precision multiplication of 2.0
by that value, fully software emulated.
Then, it casts the result down to single precision. Ouch.
The solution is to add an 'f' suffix to all float constants, like this
return 2.0f * (a*b);
Regards,
John
--
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663 f: +61-7-30090663
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/