From 9f46a008db70f9f54239c09f4513606702d6b5e7 Mon Sep 17 00:00:00 2001 From: mloubout Date: Mon, 18 Mar 2024 14:35:27 -0400 Subject: [PATCH] remove blas thread that always segfault --- src/JUDI.jl | 2 -- src/pysource/models.py | 2 +- test/runtests.jl | 2 -- test/test_adjoint.jl | 8 ++++---- test/test_linearity.jl | 2 +- test/test_modeling.jl | 5 +++-- 6 files changed, 9 insertions(+), 12 deletions(-) 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..61082cbf0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -29,7 +29,6 @@ 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") @@ -72,7 +71,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/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.))