Hello, I am new to Julia and for research reasons I have to run a simple code for my friends. The code need Devito and JUDI:Installation · slimgroup/JUDI.jl Wiki · GitHub
Here is the source code (Julia was installed on Ubuntu 16.04.7 LTS):
#using ClusterManagers; addprocs_slurm(1)
#using Distributed; addprocs(64)
using JUDI.TimeModeling, HDF5
n, d, o, m = read(h5open("./Brain_3D_true_model.h5", "r"), "n", "d", "o", "m")
# @everywhere using PyPlot
# figure(); imshow(sqrt.(1 ./ m[:, 200, :]))
# Set up model structure
model = Model((n[1], n[2], n[3]), (d[1], d[2], d[3]), (o[1], o[2], o[3]), m)
tn = 0.2f0#200f0 # micro s
dt = 0.1f0
f0 = .25 # MHz
# set up source
nsrc, src_loc = read(h5open("./Sources_location_512.h5"), "nsrc", "src_loc")
nsrc = Integer(nsrc[1])
xsrc = convertToCell(src_loc[1:2, 1] .* d[1])
ysrc = convertToCell(src_loc[1:2, 2] .* d[2])
zsrc = convertToCell(src_loc[1:2, 3] .* d[3])
nsrc = 2
# set up receivers
xrec = Float32.(xsrc)
yrec = Float32.(ysrc)
zrec = Float32.(zsrc)
src_geometry = Geometry(xsrc, ysrc, zsrc; dt = dt, t = tn)
rec_geometry = Geometry(xrec, yrec, zrec; dt = dt, t = tn, nsrc = nsrc)
# Set up source
wavelet = ricker_wavelet(tn, dt, f0)
# Info for modeling operators
ntComp = get_computational_nt(src_geometry, rec_geometry, model)
info = Info(prod(model.n), nsrc, ntComp)
# Set up modeling options
opt = Options(save_data_to_disk = true, file_path = "./records", file_name = "brain_3D_shot")
# Set up operators
Pr = judiProjection(info, rec_geometry)
Ps = judiProjection(info, src_geometry)
A_inv = judiModeling(info, model; options=opt)
q = judiVector(src_geometry, wavelet)
# Generate data and save as individual SEG-Y files to disk
d_obs = Pr * A_inv * adjoint(Ps) * q
I have tried to install Devito4.3, Julia v0.6.4, v0.7.0, v1.4.2, v1.5.0, v1.5.4, v1.6.1 and installed JUDI subsequently, but it seems none of the Julia version above can run the code.
The error output is:
ERROR: LoadError: MethodError: no method matching Float32(::Vector{Float64})
Closest candidates are:
(::Type{T})(!Matched::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
(::Type{T})(!Matched::Base.TwicePrecision) where T<:Number at twiceprecision.jl:243
(::Type{T})(!Matched::Complex) where T<:Real at complex.jl:37
…
Stacktrace:
[1] _broadcast_getindex_evalf
@ ./broadcast.jl:648 [inlined]
[2] _broadcast_getindex
@ ./broadcast.jl:621 [inlined]
[3] getindex
@ ./broadcast.jl:575 [inlined]
[4] copy
@ ./broadcast.jl:922 [inlined]
[5] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Type{Float32}, Tuple{Vector{Vector{Float64}}}})
@ Base.Broadcast ./broadcast.jl:883
[6] top-level scope
@ /media/hp/46E0111EE0111631/jktong/brain_3D/Brain_3D_forward_new.jl:26
if I change line 26-line 29 into
xrec = xsrc
yrec = ysrc
zrec = zsrc
it will prompt: MethodError: no method matching Geometry
PS: my python version is Python 3.8.9.
Thanks a lot!