Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Multiple Kernels

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74132] Multiple Kernels
  • From: "Ernst H.K. Stelzer" <stelzer at embl.de>
  • Date: Mon, 12 Mar 2007 22:01:38 -0500 (EST)

Hi,

Using Mathematica since Version 2 for the Mac I have been following many
different threads on this server.  However one thing that really struck me
is the multi-core capability of which I was totally un-aware.  I went
through the Mathematica book and whatever other information I could lay my
hand on, but was unable to find any reference on how to use it.  Just last
week I received a complete and new package and I am sure it contains no
reference to it whatsoever.  This really surprises me since it certainly
distinguishes Mathematica from another system, which is very popular with my
students.  Below is an excerpt from my "Notebook". My computer is a double
Quadcore Xeon Intel ES345 @ 2.33 GHz (16GByte RAM) running Windows Vista.
Mathematica was just installed fresh last week.

 

 

Mathematica is multi-core capable.  The following code below takes about
22.6 seconds with a single core.  If, however, Mathematica is made aware of
the number of processors (8 on my machine) the speed reduces to 3.1 seconds,
which is more than 7 times faster.

 

In order to make Mathematica aware, a system variable (in the environment)
has to be set.  Variable Name: OMP_NUM_THREADS, Variable Number:
%NUMBER_OF_THREADS%, which can be set to any number between 1 and the number
of processors.  Unluckily, Mathematica does not set this variable during the
installation process.

 

Needs["Statistics`ContinuousDistributions`"]

 

n=4000;

{m, p} = {

    RandomArray[UniformDistribution[0.0, 1.0],{n, n}],
RandomArray[UniformDistribution[0.0, 1.0],{n, n}]

    };Timing[m.p]//First

 3.089 Second

 22.6/3.089

 7.31628

 

 

The effect is truly stunning.  Essentially the same calculation on a 3GHz
Pentium machine (16GByte RAM) with the other system took 28 seconds.

 

Ernst H.K. Stelzer

 

 


  • Prev by Date: [Admin] Missing Posts
  • Next by Date: Re: Matching two patterns?
  • Previous by thread: [Admin] Missing Posts
  • Next by thread: Re: Multiple Kernels