Chang
Chang

Reputation: 876

number of processes in Julia

I have a quad-core CPU in my local machine. If I run julia as

julia -p 4

and a run a script with parallel computing, my understanding is:

Is this correct?

In addition, what happens if I more processes than the number of cores? For example

julia -p 8

Is it something like the following?

Upvotes: 3

Views: 1655

Answers (2)

Daniel Arndt
Daniel Arndt

Reputation: 2543

This is a loaded question, but in short it isn't left to Julia. It is up to the scheduler to decide which resources do the work. The processes (workers) may even switch cores (ie. worker 2 could start on core 3, and later continue on core 4). There is no relation between the worker and the core on your processor.

In general, a scheduler will likely try to keep a process running on the same core as long as possible to avoid the increased cost of context switching.

Upvotes: 5

StefanKarpinski
StefanKarpinski

Reputation: 33249

Unless you manually associate workers with specific cores, the association will be whatever your OS decides and it may change over time.

Upvotes: 6

Related Questions