[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] application's execution time
On Thu, Aug 27, 2009 at 5:57 PM, Faiza Ait-Kaci<faiza.ak@xxxxxxxxxx> wrote:
> 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
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)
Answer: The compiler will multiply 'a' and 'b' as single precision
values, and if you have the FPU and appropriate CFLAGS, it will be
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);
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
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/