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

Errors with loggers #87

Open
Arkoniak opened this issue Aug 7, 2021 · 1 comment
Open

Errors with loggers #87

Arkoniak opened this issue Aug 7, 2021 · 1 comment

Comments

@Arkoniak
Copy link

Arkoniak commented Aug 7, 2021

This is probably intended, but I get strange errors, when trying to use loggers inside @floop

This code

using FLoops

function foo(ex = ThreadedEx())
    @floop ex for i in 1:10
        @info "" i Threads.threadid()
    end
end

produces error (during compilation, I didn't even had a chance to execute the code

ERROR: LoadError: deepcopy of Modules not supported
Stacktrace:
[1]  FLoops ~/.julia/packages/FLoops/yli1G/src/macro.jl:51
  var"@floop"(__source__::LineNumberNode, __module__::Module, executor::Any, ex::Any)
[2]  FLoops ~/.julia/packages/FLoops/yli1G/src/reduce.jl:269
  floop_parallel(ctx::FLoops.MacroContext, ex::Expr, simd::Bool, executor::Symbol)
[3]  FLoops ~/.julia/packages/FLoops/yli1G/src/reduce.jl:385
  as_parallel_loop(ctx::FLoops.MacroContext, rf_arg::Symbol, coll::Expr, body0::Expr, simd::Bool
, executor::Symbol)
[4]  ./deepcopy.jl:26 [inlined]
  deepcopy
[5]  Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[6]  Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[7]  Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[8]  Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[9]  Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[10] Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[11] Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[12] Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[13] Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[14] Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[15] Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[16] Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[17] Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[18] Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[19] Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[20] Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[21] Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[22] Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[23] Base ./deepcopy.jl:65
  deepcopy_internal(x::Any, stackdict::IdDict{Any, Any})
[24] Base ./deepcopy.jl:92
  deepcopy_internal(x::Vector{Any}, stackdict::IdDict{Any, Any})
[25] Base ./deepcopy.jl:105
  _deepcopy_array_t(x::Array, T::Type, stackdict::IdDict{Any, Any})
[26] Base ./deepcopy.jl:33
  deepcopy_internal(x::Module, stackdict::IdDict{Any, Any})
[27] Base ./error.jl:33
  error(s::String)

N.B.: ThreadsX do not have this problem

using ThreadsX

julia> ThreadsX.foreach(1:10) do i
           @info "" i Threads.threadid()
       end
[2021-08-07 22:53:35] Info: i = 1, Threads.threadid() = 2
[2021-08-07 22:53:35] Info: i = 2, Threads.threadid() = 3
[2021-08-07 22:53:35] Info: i = 9, Threads.threadid() = 4
[2021-08-07 22:53:35] Info: i = 3, Threads.threadid() = 1
[2021-08-07 22:53:35] Info: i = 5, Threads.threadid() = 4
[2021-08-07 22:53:35] Info: i = 4, Threads.threadid() = 3
[2021-08-07 22:53:35] Info: i = 6, Threads.threadid() = 1
[2021-08-07 22:53:35] Info: i = 10, Threads.threadid() = 2
[2021-08-07 22:53:35] Info: i = 7, Threads.threadid() = 4
[2021-08-07 22:53:35] Info: i = 8, Threads.threadid() = 3
@jeffpollock9
Copy link

+1 I would also like to know if @info etc should be supported inside @floop or what the recommended pattern is. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants