-
Notifications
You must be signed in to change notification settings - Fork 6
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
SubproblemManager #57
Comments
|
@ValentinKaisermayer this is strange. The only way where it could happen is if you solve several subproblems of the main optimization problem, but I do not see how you can have access to this feature via If you use parallelism, try to avoid it, as mixing |
Ok, it is the mutli-threading. Would downgrading Julia to the LTS version help? |
I am not sure it will change something. Correctly calling C/C++ code in a multithread environment of If you have a short example which triggers this issue, I could maybe use it to investigate further. Otherwise, you can directly use the |
I was using multi-threading to solve multiple optimization problems in parallel. I'm not able to share my original code but maybe I can come up with a MWE. |
import GalacticOptim
import NOMAD
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
p = [1.0, 100.0]
sols = Dict()
Threads.@threads for i in 1:10
x0 = -1 .+ 2 .* rand(2)
optprob = GalacticOptim.OptimizationFunction(rosenbrock)
prob = GalacticOptim.OptimizationProblem(optprob, x0, p, lb=[-1.0, -1.0], ub=[1.0, 1.0])
sol = GalacticOptim.solve(prob, GalacticOptim.NOMADOpt())
sols[i] = sol
end Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffa513a7192 -- local_Rb_tree_rotate_left at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/src/c++98\tree.cc:138 [inlined]
_Rb_tree_insert_and_rebalance at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/src/c++98\tree.cc:278
in expression starting at test_NOMAD.jl:8
local_Rb_tree_rotate_left at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/src/c++98\tree.cc:138 [inlined]
_Rb_tree_insert_and_rebalance at /workspace/srcdir/gcc-11.1.0/libstdc++-v3/src/c++98\tree.cc:278
_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE16_M_insert_uniqueIRS6_IS5_S5_EEES6_ISt17_Rb_tree_iteratorIS8_EbEOT_.constprop.1025 at .julia\artifacts\afc55cad05cdd4def2b270e9e0e8261c242e5645\bin\libnomadUtils.dll (unknown line)
_ZN11NOMAD_4_0_010Parameters17registerAttributeIbJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S9_EEEvS7_T_bbbDpOT0_ at .julia\artifacts\afc55cad05cdd4def2b270e9e0e8261c242e5645\bin\libnomadUtils.dll (unknown line)
_ZN11NOMAD_4_0_010Parameters18registerAttributesERKSt6vectorINS_19AttributeDefinitionESaIS2_EE at .julia\artifacts\afc55cad05cdd4def2b270e9e0e8261c242e5645\bin\libnomadUtils.dll (unknown line)
_ZN11NOMAD_4_0_013RunParameters4initEv at .julia\artifacts\afc55cad05cdd4def2b270e9e0e8261c242e5645\bin\libnomadUtils.dll (unknown line)
createNomadProblem at .julia\artifacts\afc55cad05cdd4def2b270e9e0e8261c242e5645\bin\libnomadCInterface.dll (unknown line)
create_c_nomad_problem at .julia\packages\NOMAD\sZkMd\src\c_wrappers.jl:65
unknown function (ip: 000000003f72e96f)
solve at .julia\packages\NOMAD\sZkMd\src\core.jl:608
#__solve#146 at .julia\packages\GalacticOptim\diXWZ\src\solve\nomad.jl:80
__solve at .julia\packages\GalacticOptim\diXWZ\src\solve\nomad.jl:44 [inlined]
#solve#480 at .julia\packages\SciMLBase\jj8Ix\src\solve.jl:3 [inlined]
solve at .julia\packages\SciMLBase\jj8Ix\src\solve.jl:3
unknown function (ip: 000000003f72d370)
macro expansion at test_NOMAD.jl:12 [inlined]
#221#threadsfor_fun at .\threadingconstructs.jl:85
#221#threadsfor_fun at .\threadingconstructs.jl:52
unknown function (ip: 000000003f6f1da3)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1788 [inlined]
start_task at /cygdrive/c/buildbot/worker/package_win64/build/src\task.c:877
Allocations: 42927396 (Pool: 42910858; Big: 16538); GC: 40 julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_PKG_PRECOMPILE_AUTO = 0
[a75be94c] GalacticOptim v2.3.1
[02130f1c] NOMAD v2.2.0 With an sols = Dict()
Threads.@threads for i in 1:10
x0 = -1 .+ 2 .* rand(2)
optprob = GalacticOptim.OptimizationFunction(rosenbrock, GalacticOptim.AutoForwardDiff())
prob = GalacticOptim.OptimizationProblem(optprob, x0, p, lb=[-1.0, -1.0], ub=[1.0, 1.0])
sol = GalacticOptim.solve(prob, Optim.Fminbox(Optim.NelderMead()))
sols[i] = sol.u
end
julia> sols
Dict{Any, Any} with 10 entries:
5 => [1.0, 1.0]
4 => [1.0, 1.0]
6 => [-0.628642, 1.49224]
7 => [-1.11821, -0.90395]
2 => [-0.14978, -1.2824]
10 => [1.0, 1.0]
9 => [1.0, 1.0]
8 => [1.0, 1.0]
3 => [1.0, 1.0]
1 => [1.0, 1.0] |
Ok I confirm I can reproduce the bug on my machine (MacOS). By using a I will keep this example and investigate it, but there is an important risk the modifications (if they are done) are considerable. Hence it will take a lot of time. I will add a message in the documentation noting that one should not use thread parallelism with this package. With Thanks once again for the example and your feedback. |
Can you share the |
import GalacticOptim
import NOMAD
import Distributed
import SharedArrays
Distributed.@everywhere begin
rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
p = [1.0, 100.0]
end
sols = SharedArrays.SharedArray{Float64}(2,10)
Distributed.@sync Distributed.@distributed for i in 1:10
x0 = -1 .+ 2 .* rand(2)
optprob = GalacticOptim.OptimizationFunction(rosenbrock)
prob = GalacticOptim.OptimizationProblem(optprob, x0, p, lb=[-1.0, -1.0], ub=[1.0, 1.0])
sol = GalacticOptim.solve(prob, GalacticOptim.NOMADOpt())
sols[:,i] = sol.u
end
println(sols) Machine version
Running this script with four processors: julia -p 4 script.jl
|
It crashed Julia. What does this mean?
Source in C++ code:
https://github.com/bbopt/nomad/blob/cb3bb3543b14d9eb8aee270e9ef3b80a67f7708c/src/Algos/SubproblemManager.cpp#L117
The text was updated successfully, but these errors were encountered: