Performance--Dual Core

59 views
Skip to first unread message

opar...@princeton.edu

unread,
Oct 3, 2006, 6:21:44 AM10/3/06
to
I have just bought a new system (AMD 64 X2 Dual Core 4200+) thinking it would improve computations with mathematica 5.2. I am mainly running symbolic computation problems (Solve,Reduce,FullSimplify stuff) involving a system of nonlinear equations with domain restrictions over parameters...

I am puzzled by the fact mathematica seems to be using the CPU resources from a single core at the time even though the problem it tries to solve is very complicated (takes 1 day approx.). While computing, windows' task manager shows "MathKernel" using 50% of CPU and "System Idle Process" using the remaining 50%.

I have 2 questions. First, what's going on ? Is Mathematica really unable to use both cores at the same time ? Second, how can one deal with this ? Is there a way to force mathematica to somehow split the task between both cores ?

I know some of the previous posts have dealt with similar issues but they don't quite seem to answer my specific problem.

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=14120#p14120
Posted through http://www.mathematica-users.org [[postId=14120]]


Antti Penttilä

unread,
Oct 4, 2006, 6:10:57 AM10/4/06
to
opar...@princeton.edu wrote:
...
> I am puzzled by the fact mathematica seems to be using the CPU resources from a single core at the time even though the problem it tries to solve is very complicated (takes 1 day approx.). While computing, windows' task manager shows "MathKernel" using 50% of CPU and "System Idle Process" using the remaining 50%.

Hi,

I had the same problem, and this trick from Pratik Desai from Wolfram
solved the problem:

"Mathematica 5.2 defaults to using only one thread for linear algebra on
Windows. To use multiple threads and take advantage of multiple
processors or cores, you will need to set OMP_NUM_THREADS to a value of
% NUMBER_OF_PROCESSORS% in your environment. You can do this by going to
My Computer and get to the properties template by right clicking and
clicking Properties, click the Advanced Tab and then click on
Environment Variables. Click on New right below the System Variables
list. In the the variable name type in OMP_NUM_THREADS and variable
value type in % NUMBER_OF_PROCESSORS%

----------------------------------------
Variable Name : OMP_NUM_THREADS
Variable Value: % NUMBER_OF_PROCESSORS%
----------------------------------------

Now you can try your linear algebra operations. Dot on two matrices is
the best indicator of your multiprocessing capabilities.

Pratik"

After this fix the dual-core should work with Mathematica. However, only
some operations, typically linear algebra, are threaded to parallel use.

Antti


Christoph Lhotka

unread,
Oct 4, 2006, 6:32:18 AM10/4/06
to
Hi !

When using Windows you have to tell the OS the following:

> ----------------------------------------
> Variable Name : OMP_NUM_THREADS
> Variable Value: % NUMBER_OF_PROCESSORS% (e.g. 2)
> ----------------------------------------

(first create a new variable OMP_NUM_THREADS as a System Variable in the
Device Manager, then set the NUMBER_OF_PROCESSORS to 2 (or 3, ...). The values
of OMP_NUM_THREADS should be equal to the value of NUMBER_OF_PROCESSORS...


After doing so, you will see, that Mathematica will use both cores for its
computation...

Christoph


On Tue, 3 Oct 2006 06:16:29 -0400 (EDT)
opar...@princeton.edu wrote:
> I have just bought a new system (AMD 64 X2 Dual Core 4200+) thinking it
> would improve computations with mathematica 5.2. I am mainly running
> symbolic computation problems (Solve,Reduce,FullSimplify stuff) involving a
> system of nonlinear equations with domain restrictions over parameters...
>

> I am puzzled by the fact mathematica seems to be using the CPU resources
> from a single core at the time even though the problem it tries to solve is
> very complicated (takes 1 day approx.). While computing, windows' task
> manager shows "MathKernel" using 50% of CPU and "System Idle Process" using
> the remaining 50%.
>

> I have 2 questions. First, what's going on ? Is Mathematica really unable
> to use both cores at the same time ? Second, how can one deal with this ?
> Is there a way to force mathematica to somehow split the task between both
> cores ?
>
> I know some of the previous posts have dealt with similar issues but they
> don't quite seem to answer my specific problem.
>
>
>
> Link to the forum page for this post:
> http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=14120#p14120
> Posted through http://www.mathematica-users.org [[postId=14120]]
>
>

-- Mag. Christoph Lhotka --
University of Vienna / Department of Astronomy
Tuerkenschanzstrasse 17, A-1180 Vienna, Austria
fon. +43 (1) 4277 51841
mail. lho...@astro.univie.ac.at

Coleman, Mark

unread,
Oct 5, 2006, 4:12:41 AM10/5/06
to
Thanks for posting this. I'm curious, Does the same default to one core apply to the Intel-based Mac's as well?

Regards,

Mark


-----Original Message-----
From: Antti Penttilä [mailto:Antti.I....@invalid.helsinki.fi]
Subject: Re: Performance--Dual Core

opar...@princeton.edu wrote:
...
> I am puzzled by the fact mathematica seems to be using the CPU resources from a single core at the time even though the problem it tries to solve is very complicated (takes 1 day approx.). While computing, windows' task manager shows "MathKernel" using 50% of CPU and "System Idle Process" using the remaining 50%.

Hi,

I had the same problem, and this trick from Pratik Desai from Wolfram solved the problem:

"Mathematica 5.2 defaults to using only one thread for linear algebra on Windows. To use multiple threads and take advantage of multiple processors or cores, you will need to set OMP_NUM_THREADS to a value of % NUMBER_OF_PROCESSORS% in your environment. You can do this by going to My Computer and get to the properties template by right clicking and clicking Properties, click the Advanced Tab and then click on Environment Variables. Click on New right below the System Variables list. In the the variable name type in OMP_NUM_THREADS and variable value type in % NUMBER_OF_PROCESSORS%

----------------------------------------


Variable Name : OMP_NUM_THREADS
Variable Value: % NUMBER_OF_PROCESSORS%

Reply all
Reply to author
Forward
0 new messages