Skip to content
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

Added parameter to not use the Julia worker pool #200

Merged
merged 4 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/JUDI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__precompile__()
module JUDI

export JUDIPATH, set_verbosity, ftp_data
export JUDIPATH, set_verbosity, ftp_data, get_serial, set_serial, set_parallel
JUDIPATH = dirname(pathof(JUDI))

# Dependencies
Expand Down Expand Up @@ -85,7 +85,16 @@ function rlock_pycall(meth, ::Type{T}, args...; kw...) where T
end

# Constants
_serial = false
get_serial() = _serial
set_serial(x::Bool) = begin global _serial = x; end
set_serial() = begin global _serial = true; end
set_parallel() = begin global _serial = false; end

function _worker_pool()
if _serial
return nothing
end
p = default_worker_pool()
pool = length(p) < 2 ? nothing : p
return pool
Expand Down
16 changes: 15 additions & 1 deletion test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,23 @@ function test_ftp()
rm("$(JUDI.JUDI_DATA)/overthrust_model_2D.h5")
end

function test_serial()
@test !get_serial()

set_serial()
@test get_serial()

set_parallel()
@test !get_serial()

set_serial(true)
@test get_serial()
gbruer15 marked this conversation as resolved.
Show resolved Hide resolved
end

@testset "Test basic utilities" begin
@timeit TIMEROUTPUT "Basic setup utilities" begin
test_ftp()
test_serial()
setup_3d()
for ndim=[2, 3]
test_padding(ndim)
Expand Down Expand Up @@ -193,7 +207,7 @@ end
modelPy = devito_model(model, Options(dt_comp=.5f0))
@test modelPy.critical_dt == .5f0

# Verify nt
# Verify nt
srcGeometry = example_src_geometry()
recGeometry = example_rec_geometry(cut=true)
nt1 = get_computational_nt(srcGeometry, recGeometry, model)
Expand Down
Loading