KomaMRI.jl icon indicating copy to clipboard operation
KomaMRI.jl copied to clipboard

Applying @time to simulate reveals discrepancies on resources and timing reports

Open gsahonero opened this issue 1 month ago • 2 comments

Hi,

I simulated some sequences using simulate and found that the timed data differed from what @time provides. Check this screenshot for reference:

image

There, the last line refers to the data that @time produces, and the previous one refers to what simulate provides. To reproduce this, the following code can be used:

using KomaMRI

x_range = [0]
y_range = [0]
z_range = [0]
T1_range = [1000e-3]
T2_range = [35e-3]
T2s_range = [20e-3]
rho_range = [1]
obj = Phantom{Float64}(name="Test phantom", x = x_range, y = y_range, z = z_range, T1 = T1_range, T2 = T2_range, T2s = T2s_range, ρ=rho_range);

seq = read_seq("...\\ge.seq")

plot_seq(seq)
sys = Scanner()
@time raw_x = simulate(obj, seq, sys)

I think the differences are due to other functions unrelated to run_sime_time_iter which is the one with @time on the simulate function, but it would be useful to trace them and check what could be optimized even further (~2GB is way much larger than 300 MB!). Also, it would be useful to clarify that the timing information returned by simulate considers only the simulation. Thinking of end-users, they might get confused - like me - by the reported and the perceived time.

Best, Guillermo

gsahonero avatar May 15 '24 21:05 gsahonero