JuliaLang/julia

Cannot combine @simd and @threads on a loop

Open

#32,684 opened on Jul 25, 2019

View on GitHub
 (5 comments) (2 reactions) (0 assignees)Julia (5,773 forks)batch import
good first issuehelp wantedmultithreading

Repository metrics

Stars
 (48,709 stars)
PR merge metrics
 (Avg merge 20d 6h) (157 merged PRs in 30d)

Description

julia> import Base: Threads

julia> @simd Threads.@threads for i in 1:10 end
ERROR: LoadError: Base.SimdLoop.SimdError("for loop expected")
Stacktrace:
 [1] compile(::Expr, ::Bool) at ./simdloop.jl:54
 [2] @simd(::LineNumberNode, ::Module, ::Any) at ./simdloop.jl:124
in expression starting at REPL[2]:1

julia> Threads.@threads @simd for i in 1:10 end
ERROR: LoadError: ArgumentError: unrecognized argument to @threads
Stacktrace:
 [1] @threads(::LineNumberNode, ::Module, ::Vararg{Any,N} where N) at ./threadingconstructs.jl:101
in expression starting at REPL[4]:1

Contributor guide