Sorry,

The attached script was broken here is a correctly running version.

S.

Le mardi 5 mai 2015 20:21:57 UTC+2, Stéphane Mottelet a écrit :
>
> Hello all, 
>
> I am currently studying if it is worth migrating my project from Scilab 
> to Julia, and I have the following remarks/questions. 
> The code that is actually executed is automatically generated and the 
> most time consuming tasks consist in (large) sparse matrix updating 
> where the terms of the matrix are updated at each step of an 
> optimization algorithm. Hence, typically code is of the kind 
>
> function solve_weight_1(v,x1_input) 
> # 
> # Weight 1 cumomers 
> # 
> @inbounds M1.nzval=[-(v[18]+v[63]+v[103]) 
> v[63] 
> v[103] 
> v[18] 
> -(v[18]+v[63]+v[103]) 
> v[63] 
> v[103] 
> v[18] 
> -(v[18]+v[63]+v[103]) 
> ... 
> ] (800 lines for a 231*231 sparse matrix) 
>
>
> The code is produced during an assembly (like assembly in the finite 
> element method), driven by the structure of a metabolic network. Since 
> the structure of the network is completely arbitrary, adhoc code 
> generation seems the best solution. 
>
> I am a bit puzzled because once the functions are compiled they run very 
> fast, typically for the attached function runs in 0.000979136 s, but the 
> first run/compilation takes 4.754678495 seconds. 
>
> julia> include("solve_weight_1.jl"); 
>
> julia> @time out=solve_weight_1(v,x1_input); 
> elapsed time: 4.754678495 seconds (18975668 bytes allocated) 
>
> julia> @time out=solve_weight_1(v,x1_input); 
> elapsed time: 0.000979136 seconds (86520 bytes allocated) 
>
> How compilation time can it be improved ? There are plenty other 
> functions like this one in the generated code and most of the time the 
> code is rarely run more than a few times. Typically, the compilation of 
> the while stuff takes 40 seconds but the optimization process only takes 
> 1 second... 
>
> Thanks in advance for help 
>
> Stéphane 
>
>
>
>
>

Attachment: solve_weight_1.jl
Description: Binary data

Reply via email to