Mohammad Saad
Mohammad Saad

Reputation: 1995

Set number of threads to be used manually in Julia Pro

I am using JuliaPro to work on julia. My test PC has,
Processor Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz, 1190 Mhz, 2 Core(s), 4 Logical Processor(s) When I try to run Threads.nthreads() it will only show the value of 2. Is this the number of cores or the treads used? I even tried going into the settings and changing the value of "Number of Threads", however it doesn't affect the number of threads utilized by the software.

Upvotes: 1

Views: 416

Answers (1)

lungben
lungben

Reputation: 1158

You can set the number of threads in 2 ways (assuming Julia 1.5):

  • Set environment variable JULIA_NUM_THREADS before (!) starting Julia. If you change it inside Julia, it will not have any effect.
  • Start Julia with option -t, e.g. julia -t 4

Note that 2 threads for 2 physical cores is probably already the optimal setting, increasing it to 4 probably reduces performace.

Upvotes: 2

Related Questions