diff --git a/Project.toml b/Project.toml index 86d126c1d..a619697db 100644 --- a/Project.toml +++ b/Project.toml @@ -39,7 +39,6 @@ ZygoteJUDIExt = "Zygote" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" -ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" @@ -47,7 +46,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" [targets] -test = ["Aqua", "ArgParse", "JLD2", "Printf", "Test", "TimerOutputs", "Flux"] +test = ["Aqua", "JLD2", "Printf", "Test", "TimerOutputs", "Flux"] [weakdeps] Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" diff --git a/src/JUDI.jl b/src/JUDI.jl index 91ba28d9c..cadd66172 100644 --- a/src/JUDI.jl +++ b/src/JUDI.jl @@ -210,8 +210,6 @@ function __init__() end end - # BLAS num threads for dense LA such as sinc interpolation - BLAS.set_num_threads(Threads.nthreads()) end end diff --git a/src/pysource/models.py b/src/pysource/models.py index d7d5f0084..3d84d971f 100644 --- a/src/pysource/models.py +++ b/src/pysource/models.py @@ -427,7 +427,7 @@ def _cfl_coeff(self): c_fd = sum(np.abs(coeffs[-1][-1])) / 2 return .9 * np.sqrt(self.dim) / self.dim / c_fd a1 = 4 # 2nd order in time - so = max(self._space_order, 4) + so = max(self._space_order // 2, 4) coeffs = fd_w(2, range(-so, so), 0)[-1][-1] return .9 * np.sqrt(a1/float(self.grid.dim * sum(np.abs(coeffs)))) diff --git a/test/runtests.jl b/test/runtests.jl index 0c3bfd421..3124b328b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,7 +7,7 @@ # Updated July 2020 using JUDI -using ArgParse, Test, Printf, Aqua +using Test, Printf, Aqua using SegyIO, LinearAlgebra, Distributed, JOLI using TimerOutputs: TimerOutputs, @timeit @@ -25,13 +25,10 @@ const GROUP = get(ENV, "GROUP", "JUDI") # JUDI seismic utils include("seismic_utils.jl") -parsed_args = parse_commandline() -const nlayer = parsed_args["nlayer"] -const tti = parsed_args["tti"] || contains(GROUP, "TTI") -const fs = parsed_args["fs"] || contains(GROUP, "FS") -const nw = (GROUP == "BASICS" || GROUP == "ISO_OP") ? 2 : 0 -const viscoacoustic = parsed_args["viscoacoustic"] || contains(GROUP, "VISCO") - +const nlayer = 2 +const tti = contains(GROUP, "TTI") +const fs = contains(GROUP, "FS") +const viscoacoustic = true #contains(GROUP, "VISCO") # Utility macro to run block of code with a single omp threa macro single_threaded(expr) @@ -72,7 +69,6 @@ issues = ["test_issues.jl"] # custom if endswith(GROUP, ".jl") - # VERSION >= v"1.7" && push!(Base.ARGS, "-p 2") timeit_include(GROUP) end diff --git a/test/seismic_utils.jl b/test/seismic_utils.jl index 771033e47..7cd5c6859 100644 --- a/test/seismic_utils.jl +++ b/test/seismic_utils.jl @@ -99,32 +99,6 @@ function setup_geom(model; nsrc=1, tn=1500f0, dt=nothing) end -### Process command line args -function parse_commandline() - s = ArgParseSettings() - @add_arg_table! s begin - "--tti" - help = "TTI, default False" - action = :store_true - "--viscoacoustic" - help = "Viscoacoustic, default False" - action = :store_true - "--fs" - help = "Free surface, default False" - action = :store_true - "--nlayer", "-n" - help = "Number of layers" - arg_type = Int - default = 2 - "--parallel", "-p" - help = "Number of workers" - arg_type = Int - default = 1 - end - return parse_args(s) -end - - # Example structures example_model(; n=(120,100), d=(10f0, 10f0), o=(0f0, 0f0), m=randn(Float32, n)) = Model(n, d, o, m) diff --git a/test/shot_record_250.0_0.0_20.0.segy b/test/shot_record_250.0_0.0_20.0.segy index 504dc24ea..8b08497a6 100644 Binary files a/test/shot_record_250.0_0.0_20.0.segy and b/test/shot_record_250.0_0.0_20.0.segy differ diff --git a/test/shot_record_750.0_0.0_20.0.segy b/test/shot_record_750.0_0.0_20.0.segy index b3e26b1a4..5fa440977 100644 Binary files a/test/shot_record_750.0_0.0_20.0.segy and b/test/shot_record_750.0_0.0_20.0.segy differ diff --git a/test/test_adjoint.jl b/test/test_adjoint.jl index d9034ef82..8e26939c6 100644 --- a/test/test_adjoint.jl +++ b/test/test_adjoint.jl @@ -3,7 +3,7 @@ # Date: May 2020 # -using Distributed +nw = 2 # # Set parallel if specified if nw > 1 && nworkers() < nw @@ -60,9 +60,9 @@ test_adjoint(adj::Bool, last::Bool) = (adj || last) ? (@test adj) : (@test_skip # Modeling operators @testset "Adjoint test with $(nlayer) layers and tti $(tti) and viscoacoustic $(viscoacoustic) and freesurface $(fs)" begin @timeit TIMEROUTPUT "Adjoint" begin - opt = Options(sum_padding=true, dt_comp=dt, free_surface=parsed_args["fs"], f0=f0) + opt = Options(sum_padding=true, dt_comp=dt, free_surface=fs, f0=f0) F = judiModeling(model0, srcGeometry, recGeometry; options=opt) - + @show q.nsrc # Nonlinear modeling y = F*q @@ -84,7 +84,7 @@ end # Extended source modeling @testset "Extended source adjoint test with $(nlayer) layers and tti $(tti) and viscoacoustic $(viscoacoustic) and freesurface $(fs)" begin @timeit TIMEROUTPUT "Extended source adjoint" begin - opt = Options(sum_padding=true, dt_comp=dt, free_surface=parsed_args["fs"], f0=f0) + opt = Options(sum_padding=true, dt_comp=dt, free_surface=fs, f0=f0) F = judiModeling(model0, srcGeometry, recGeometry; options=opt) Pr = judiProjection(recGeometry) Fw = judiModeling(model0; options=opt) diff --git a/test/test_linearity.jl b/test/test_linearity.jl index cd90dcf4a..c7849e926 100644 --- a/test/test_linearity.jl +++ b/test/test_linearity.jl @@ -138,7 +138,7 @@ end ####################### Extended source operators ########################################## -if parsed_args["tti"] +if tti ftol = 5f-4 end diff --git a/test/test_modeling.jl b/test/test_modeling.jl index 6e1688c9f..f8c53b3cc 100644 --- a/test/test_modeling.jl +++ b/test/test_modeling.jl @@ -6,13 +6,14 @@ # Mathias Louboutin, mlouboutin3@gatech.edu # Updated July 2020 +nw = 2 + # Set parallel if specified if nw > 1 && nworkers() < nw addprocs(nw-nworkers() + 1; exeflags=["--code-coverage=user", "--inline=no", "--check-bounds=yes"]) end -@everywhere using JOLI -@everywhere using JUDI, LinearAlgebra, Test, Distributed +@everywhere using JOLI, JUDI, LinearAlgebra, Test, Distributed ### Model model, model0, dm = setup_model(tti, viscoacoustic, nlayer; n=(101, 101), d=(10., 10.))