I am trying to run the same simulation on different threads in Julia. My computer has 4 cores.
I checked that Threads.nthreads() =4, and added processes so that nprocs() = 4.
Now I am trying to run the same simulation:simulation() in parallel.
My code is
@spawnat 1 simulation()
@spawnat 2 simulation()
@spawnat 3 simulation()
@spawnat 4 simulation()
the simulation function displays as well on which threads it runs thanks to a println(Threads.threadid())
The problem is that all processes run on the same thread - thread number 1.
I thought that creating workers and using the @spawnat macro should be enough for the simulation to run on all threads.
Would you have any idea on what to do, and what I did wrong? Thanks in advance