7
$\begingroup$

I was wondering if the WolframMark Benchmark uses more than one core. This becomes relevant when comparing Benchmark scores between, say, 4-core and 8-core machines.

I looked at Benchmark's code, and none of it has any functions containing the word "Parallel" (e.g., Parallelize, Parallel Evaluate, ParallelTry ParallelMap, etc.). It has been my understanding that, unless you explicitly ask MMA to execute code in parallel (using a function such as those), it will run the process on only one core at a time*. Is that correct? If so, it would mean the Benchmark is indeed single-core.

[*I say "one core at a time" rather than "on only one core" because MMA computations may shift between cores while they are running.]

Relatedly, I'm wondering what happens when you execute LaunchKernels prior to running Benchmark. You get a higher score doing this, but I assume that is because it's running multiple versions of Benchmark simultaneously and combining them into a composite score, not because it is actually parallelizing any of the Benchmark calculations. Is that correct? If so, any score you get after using LaunchKernels isn't meaningful. [Consistent with this, using LaunchKernels significantly increases, rather than decreases, the wall clock time needed to run Benchmark.]

$\endgroup$
4
  • 6
    $\begingroup$ To answer the question in your title: Mathematica will automatically run some functions in parallel on its own if the resources are available. See for instance this question discussing how to prevent that: How to force an evaluation to use only one core; and Are built-in Mathematica functions already parallelized?. $\endgroup$
    – MarcoB
    Commented Dec 22, 2021 at 3:16
  • $\begingroup$ @MarcoB Thanks, I missed those in my own search. I tried running Benchmark with MKLThreadNumber reduced from 4->1, ParallelThreadNumber reduced from 4->1, and both reduced from 4->1. Averaging two runs, 10 Benchmarks/run, for each configuration (i.e., 20 Benchmarks/config total), I got score reductions (in quadrature) of 14%, 15%, and 24%, respectively, indicating (a) Benchmark uses multiple cores for both MKL and non-MKL operations; and (b) MMA can run MKL with multiple cores even when ParallelThreadNumber is set to 1. $\endgroup$
    – theorist
    Commented Dec 22, 2021 at 5:10
  • $\begingroup$ @MarcoB Question: I assume when I'm selecting both the ParallelThreadNumber -> 1 and MKLThreadNumber -> 1 options, what those actually mean are "run on 1 core", not "run with 1 thread", right? Because if those options really are referring to the number of threads then, e.g., ParallelThreadNumber -> 2 would mean: "Run on 1 core, with Hyperthreading enabled" and ParallelThreadNumber -> 1 would mean "Run on 1 core, with Hyperthreading disabled". And I don't think that's how those work—particularly since the default configuration with my 4-kernel license is ParallelThreadNumber -> 4. $\endgroup$
    – theorist
    Commented Dec 22, 2021 at 5:10
  • 2
    $\begingroup$ These options simply control how many parallel computation threads will be running. How those threads are distributed among available hardware resources is up to the operating system, and is not controlled by Mathematica. $\endgroup$
    – Szabolcs
    Commented Dec 22, 2021 at 15:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.