Skip to content

Commit

Permalink
Reverted reordering of f32/f64 and gpu.
Browse files Browse the repository at this point in the history
  • Loading branch information
cncastillo committed Jan 5, 2023
1 parent d40e589 commit e090350
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/simulation/SimulatorCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,15 @@ function simulate(obj::Phantom, seq::Sequence, sys::Scanner; simParams=Dict{Stri
Nadc = sum(seq.ADC.N)
Ncoils = 1 #This should consider the input Scanner type
sig = zeros(ComplexF64, Nadc, Ncoils, Nthreads)
#Change precision: Only for CPU simulations
# Objects to GPU
if enable_gpu #Default
device!(gpu_device)
gpu_name = name.(devices())[gpu_device+1]
obj = obj |> gpu #Phantom
seqd = seqd |> gpu #DiscreteSequence
Xt = Xt |> gpu #SpinStateRepresentation
sig = sig |> gpu #Signal
end
if precision == "f32" #Default
obj = obj |> f32 #Phantom
seqd = seqd |> f32 #DiscreteSequence
Expand All @@ -206,15 +214,6 @@ function simulate(obj::Phantom, seq::Sequence, sys::Scanner; simParams=Dict{Stri
Xt = Xt |> f64 #SpinStateRepresentation
sig = sig |> f64 #Signal
end
# Objects to GPU
if enable_gpu #Default
device!(gpu_device)
gpu_name = name.(devices())[gpu_device+1]
obj = obj |> gpu #Phantom
seqd = seqd |> gpu #DiscreteSequence
Xt = Xt |> gpu #SpinStateRepresentation
sig = sig |> gpu #Signal
end
# Simulation
koma_version = VersionNumber(Pkg.TOML.parsefile(joinpath(@__DIR__, "..", "..", "Project.toml"))["version"])
@info "Running simulation in the $(enable_gpu ? "GPU ($gpu_name)" : "CPU with $Nthreads thread(s)")" koma_version=koma_version sim_method = sim_method spins = length(obj) time_points = length(t) adc_points=Nadc
Expand Down

2 comments on commit e090350

@cncastillo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/75180

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.3 -m "<description of version>" e090350525fd4d3a1326dbe9343d0ebdb954e4f9
git push origin v0.7.3

Please sign in to comment.