4
$\begingroup$

Here is the problem, there are two ways to launch Mathematica in Linux:

  1. Double click a notebook file in Desktop (GUI mode).

It gives:

$ProcessorCount
(* 4 *)

ParallelTable is very efficient. (4 time faster than Table)

  1. Use command “./bin/mathematica” in terminal, (or “./bin/math” , “./bin/wolfram” in command-line mode).

It gives:

$ProcessorCount  
(* 1 *)

ParallelTable then takes the same time as Table.

What causes this difference? Does this mean that one can only access one processor within Mathematica when started in a Linux system terminal?

$\endgroup$
  • 2
    $\begingroup$ Oftentimes when I've seen similar issues in the past (specifically, $ProcessorCount returning incorrect values on Linux) it has been because of a incorrectly set environment variable. For example, OMP_NUM_THREADS = 1, or something. Any chance you may have something similar influencing things? $\endgroup$ – user6014 May 22 '18 at 13:21
  • $\begingroup$ @user6014 , thanks for your suggestion. This problem were solved by reseting OMP_NUM_THREADS = 4. $\endgroup$ – ted.l May 23 '18 at 15:07
  • $\begingroup$ glad to hear :) $\endgroup$ – user6014 May 23 '18 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.