What is the difference between `Threads.@threads' and `Threads@threads'?

parallel
multithreading

#1

Hello.
I’m wondering what is the difference between Threads.@threads and Threads@threads?
for example in :

Threads.@threads for i=1:N
            A[i] = i
        end

Thank you.


#2

Where have you seen Threads@threads, without the dot?


#3

Please comment your code properly using `, see PSA: how to quote code with backticks.


#4

Thank you.


#5

Can you tell me What this dot means?
I have seen it in someone’s code on the internet.


#6

The macro @threads (macros are identified by the leading at-sign) is defined inside the Threads module, but it’s not exported. Thus, in order to call it, you have use the syntax module.function, with the dot between the module’s name and the function’s name. You’ll find more in the manual: https://docs.julialang.org/en/stable/manual/modules.

In addition, note that Threads@threads is parsed as:

Threads * @threads

that is, multiplication between a module name and a non-existent macro (because it’s not exported).


#7

Thank you.