Welcome to Julia!

Can you clarify the precise nature of your concern? I'm not sure I see a 
problem. To make sure you're interpreting this right, it's indicating that 
741/839 = 88% of your execution time is in gemm!, which is the core routine 
for matrix-matrix multiplication.

The "unsafe" calls refer to the fact that these functions assume that the 
indexes are in bounds...which is fine if the algorithm is guaranteed to stay 
in-bounds, or if a previous function already checked to make sure that 
everything is OK. In other words, these are just internal functions that get 
called in the course of multiplication.

Best,
--Tim

On Wednesday, September 23, 2015 06:33:55 AM Benjamin Born wrote:
> Hey everybody,
> 
> I'm a Julia beginner slowly transitioning from Matlab to Julia (0.4 RC2 on
> Win 7 64bit) and I haven't been able to figure out the following problem.
> Profiling my code I have received the following message for a line of my
> code that multiplies three matrices D=A*B*C:
> 
> ++++
> 
> 839  ...on\run_bbeg_check.jl; vfi_smart; line: 284
>      5   cartesian.jl; _unsafe_batchsetindex!; line: 34
>      4   multidimensional.jl; _unsafe_batchsetindex!; line: 322
>       4 operators.jl; setindex_shape_check; line: 256
>      11  multidimensional.jl; _unsafe_batchsetindex!; line: 328
>      5   multidimensional.jl; _unsafe_batchsetindex!; line: 329
>      15  multidimensional.jl; _unsafe_getindex; line: 193
>      42  multidimensional.jl; _unsafe_getindex; line: 195
>      757 operators.jl; *; line: 103
>       1   linalg/matmul.jl; gemm_wrapper!; line: 321
>       1   linalg/matmul.jl; gemm_wrapper!; line: 327
>        1 abstractarray.jl; stride; line: 80
>       741 linalg/matmul.jl; gemm_wrapper!; line: 328
>        741 linalg/blas.jl; gemm!; line: 632
> 
> ++++
> 
> My code runs and I also get the same results as in Matlab but I would still
> like to know whether I do something wrong or inefficient.
> 
> Unfortunately I could not exactly reproduce the message with a simplified
> example code but the following code at least produces the
> "_unsafe_getindex" message:
> 
> function matmult_test()
>     A=rand(20,20,5)
>     B=rand(20,700,5)
>     C=eye(700,700)
>     D=zeros(20,700,5);
>     for ii=1:5
>         D[:,:,ii] = A[:,:,ii]*B[:,:,ii]*C;
>     end
> end
> matmult_test()
> Profile.clear()
> @profile matmult_test()
> Profile.print()
> 
> Thanks for your help,
> 
> Benjamin

Reply via email to