-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Motion #442
New Motion #442
Conversation
I think I've found the cause of the Simple and Arbitrary Motion test failures for Metal: in UnitTime.jl, this line is processed incorrectly:
It seems as if Metal has issues compiling the min and max broadcast together. However, if they are separated then it works as expected:
Making this change fixed the failing tests on my computer. I've also written JuliaGPU/Metal.jl#389 since this appears to be a Metal issue with Julia 1.10. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KomaMRI Benchmarks
Benchmark suite | Current: e416800 | Previous: a26d598 | Ratio |
---|---|---|---|
MRI Lab/Bloch/CPU/2 thread(s) |
226540521 ns |
224991845.5 ns |
1.01 |
MRI Lab/Bloch/CPU/4 thread(s) |
137009550 ns |
174863887 ns |
0.78 |
MRI Lab/Bloch/CPU/8 thread(s) |
143972736.5 ns |
90572834 ns |
1.59 |
MRI Lab/Bloch/CPU/1 thread(s) |
414395326 ns |
347400444 ns |
1.19 |
MRI Lab/Bloch/GPU/CUDA |
56269762.5 ns |
57092571.5 ns |
0.99 |
MRI Lab/Bloch/GPU/oneAPI |
500507813 ns |
522866366 ns |
0.96 |
MRI Lab/Bloch/GPU/Metal |
551246770.5 ns |
568303458 ns |
0.97 |
MRI Lab/Bloch/GPU/AMDGPU |
34821151 ns |
36981171 ns |
0.94 |
Slice Selection 3D/Bloch/CPU/2 thread(s) |
1019622442 ns |
1151416902 ns |
0.89 |
Slice Selection 3D/Bloch/CPU/4 thread(s) |
624166270 ns |
580233533 ns |
1.08 |
Slice Selection 3D/Bloch/CPU/8 thread(s) |
390068757.5 ns |
341164837 ns |
1.14 |
Slice Selection 3D/Bloch/CPU/1 thread(s) |
2262459750.5 ns |
1930414196.5 ns |
1.17 |
Slice Selection 3D/Bloch/GPU/CUDA |
100820723.5 ns |
101438582.5 ns |
0.99 |
Slice Selection 3D/Bloch/GPU/oneAPI |
640338956 ns |
636188156.5 ns |
1.01 |
Slice Selection 3D/Bloch/GPU/Metal |
554214166.5 ns |
565478250 ns |
0.98 |
Slice Selection 3D/Bloch/GPU/AMDGPU |
59085335 ns |
60929383 ns |
0.97 |
This comment was automatically generated by workflow using github-action-benchmark.
You can preview the docs here (when they run): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor comments, most of them are renaming stuff. The documentation part can be a different PR, but we may want to create an issue so we don't forget. At least let's make the CI happy.
Also, I'm not sure if writing/reading phantoms work. I assume it does as it is passing the tests.
I am not sure yet about the best way to specific to which part of the object the motion applies, it would be better for another PR.
Did you try Bloch and BlochSimple?
We may want to add a benchmark that includes motion.
KomaMRIBase/src/datatypes/phantom/motion/arbitrarymotion/FlowTrajectory.jl
Outdated
Show resolved
Hide resolved
Btw, the min(max) problem was already fixed in GPUCompiler.jl (JuliaGPU/GPUCompiler.jl#602), thanks to Ryan's report. So this is no longer necessary: tmp = max.((t .- t_start) ./ (t_end - t_start), zero(T))
return min.(tmp, oneunit(T)) |
How can I apply those changes? Tests are still failing if I don't define the |
Nothing, the latest version of all the packages will be used. If the latest version of GPUCompiler is not being used (v0.27.0) that means there are some compatibility issues, and the Project.toml of KomaMRICore needs to be updated. In the CI there are some errors due to renaming LoadError: UndefVarError: `AbstractMotionList` not defined |
Metal and oneAPI changed their compact to Julia 1.10 (next LTS), so we may want to do the same. If the problems are in Julia 1.9 that could be the reason. Edit: metal has not registered a new version compatible with GPUcompiler 0.27 yet, so you can leave that part as it was for now. |
oneAPI is now the one that fails. I should revise it |
Also @pvillacorta, I just remembered, but there needs to be a pretty important change in how the Phantoms are plotted. Please dispatch based on |
@cncastillo Okay, I will take this into account. I remember when I tried to solve this problem with the
In terms of code stability, option 1 is better, with the disadvantage that we would lose the slider... |
I prefer to have a separate method for There will be code repetition, unless we refactor the functions, or make the slider work. For now this is the easiest way, we can clean it up later. |
KomaMRIBase/src/motion/motionlist/actions/arbitraryactions/FlowPath.jl
Outdated
Show resolved
Hide resolved
CUDA seems to be segfaulting on BuildKite, but I don't think that is our fault, so I re-run that job to see if it passes, also for Github's CI (Julia 1 / Ubuntu). |
@pvillacorta The CI is saying this ┌ KomaMRICore
│ WARNING: method definition for #outflow_spin_reset!#54 at /var/lib/buildkite-agent/builds/gpuci-15/julialang/komamri-dot-jl/KomaMRICore/src/simulation/Flow.jl:18 declares type variable T but does not use it.
└ Also, the CodeCov is failing because there's no test for the new plot_phantom_map with motion. |
Yep, I removed it in the commits where I tried to make Everything passes now, except one random test for oneAPI in buildkite. It is due to a |
commit 3662bfbcaf07669e658d0b5a9d0b000bc9b3d748 Author: Pablo Villacorta <[email protected]> Date: Thu Sep 19 10:46:20 2024 +0200 Modify `naive_cumsum!` kernel (@rkierulf) commit 88e63e42aea4d3fe1d283b1596a94177a81aa874 Author: Pablo Villacorta Aylagas <[email protected]> Date: Wed Sep 18 19:25:20 2024 +0200 Change ArbitraryAction.jl to allow for using scalars as query times commit 8f636623b09c05cef15f1a9cc0eaa5138ab28f88 Author: Pablo Villacorta Aylagas <[email protected]> Date: Wed Sep 18 19:07:16 2024 +0200 Allow interpolation nodes and coefficients to have different eltype
It looks like a proper error, but I will re-run it. EDIT: It may have been a fluke, as I realized that we are running Julia 1.10 twice now, as 1.11 is not out yet. |
I am a little worried about this @pvillacorta
There seems to be a performance regression. I will merge it anyway, but if this is still the case (after the benchmarks are performed in master), I would need to ask you to investigate. |
This PR is intended to address #410
Still to be done:
Nspins
parameter for all motion types (I don't know if for this PR) -> EDIT: Now calledSpinRange
(solves #376)