Re: Enable multicore calculation ?

*To*: mathgroup at smc.vnet.net*Subject*: [mg88263] Re: Enable multicore calculation ?*From*: David Bailey <dave at Remove_Thisdbailey.co.uk>*Date*: Wed, 30 Apr 2008 04:23:22 -0400 (EDT)*References*: <fuumac$877$1@smc.vnet.net> <fuv09k$eje$1@smc.vnet.net> <fv1fhg$esj$1@smc.vnet.net> <fv42n8$62f$1@smc.vnet.net>

Michael Weyrauch wrote: > Hello Szbolcs, > > I am not competent enough to answer such questions, as I have no > knowledge how the various functions you mention are implemented. > > It is just my experience that "analytic" calculations using Map, Apply > Inner and all that never seem to use multicores (in my particular > applications). > > Up to now I only experienced multicore use in calculations using > NDSolve, where the calculation of the "right hand side" of a large set > of coupled ordinary differential equations requires the inversion of > matrices. So I must say that I do not even know which part > of the numerical calculation uses multicore, Inverse[] or NDSolve[] > itselve. I just see from the Linux process monitor that CPU usage > is nearly 400% on an eight processor machine, from which I conclude tha= t > my calculation uses 4 processors (hopefully correct). > > I guess we would need somebody from WRI to enlighten us here... > > Michael > > > > Szabolcs Horv=E1t schrieb: >> Michael Weyrauch wrote: >>> Hello, >>> >>> I run some larger calculations on Linux with Mathematica 6.0.2.1 a= nd >>> 8 cores essentially using NDSolve, and these calculations definitly u= se >>> usually 4 cores without any interference from my side. Mathematica >>> seems to detect the multicore environment automatically and the >>> software acts then accordingly. In a sense I was (positively) surpris= ed. >>> >>> However, not everything in Mathematica supports multicore, and it = is >>> my guess and partly my experience that it is mostly (maybe only) >>> numerical stuff which uses multicores. >>> >> Dear Michael, >> >> I do not have access to any multiprocessor machines which have >> Mathematica. I am curious: do functions like Map or Inner use multip= le >> processors (in principle it is easy to parallellize these)? More >> generally, can those functions that call other Mathematica functions u= se >> more than one processor? Or is this capability restricted to built-in= >> operations that are implemented at a lower level than the Mathematica >> language (such as numerical linear algebra)? >> >> Is it guaranteed that Map evaluates the elements of a list in order? >> What about misuses such as the following: >> >> a = 123; >> Map[(a = 100 + Mod[a, #]) &, {5, 6, 7, 8}]; >> a >> >> (Actually this one must be pretty hard to parallellize even if there a= re >> no guarantees about evaluation order.) >> >> Szabolcs >> > Obviously I have no inside knowledge on this, but I would imagine that it would be extremely hard for Mathematica to use multiple cores for anything symbolic. Imagine, for example, code that accessed a function f at the same time as another core was updating the definition of the function f! By the time you had engineered in all the extra checks to avoid a collision, you would have probably wiped out any gain in extra red tape! Possibly compiled code could, in principle, do better because the compiler can note the larger context in which an operation will be executing. David Bailey http://www.dbaileyconsultancy.co.uk