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:

(* 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:

(* 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?


enter image description here

  • 3
    $\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$ – ktm May 22 '18 at 13:21
  • 1
    $\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$ – ktm May 23 '18 at 15:08
  • $\begingroup$ @user6014 Perhaps you could add that as an answer! I want to upvote you for it :) $\endgroup$ – Carl Lange Nov 17 '19 at 11:29

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.