MathGroup Archive 2006

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

Search the Archive

Re: dynamic Blocking and thread safeness (in general)

  • To: mathgroup at
  • Subject: [mg71609] Re: dynamic Blocking and thread safeness (in general)
  • From: Jens-Peer Kuska <kuska at>
  • Date: Sat, 25 Nov 2006 05:36:46 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <ek63nk$8vf$>
  • Reply-to: kuska at


a) Mathematica uses MathLink to implement a distributed memory
    parallel programming model. That is done with the Parallel Computing
    Toolkit and Block[]/Module[] has no effect on distributed memory
    systems but you need a master kernel and more than a single
    worker kernel to see some speedup, i.e., more than dual-core or
    more than two kernels
b) you realy ask for thread programming in a system that does not
    know what a pointer is ??
c) Mathematicas main data structure is a (expression) tree and
    is very complicated to do parallel programming with trees
    and I would not expect that symbolic computations will benefit
    form multithreading
d) you don't need Block[] to mixup a multi-threaded program
    just say
    Map[If[#>1,myCount++,myCount--] &, Table[Random[Integer,{-100,100}]]]
    and the threads that apply If[#>1,myCount++,myCount--] & to the
    list elements will access myCount in undefined order and will try
    to change myCount at the same time
e) the hardest problem would be, that Mathematica copy data on and on or 

    generate new symbols. That is a global operation in the program to
    get more memory from the heap and this will either slow down the
    parallel execution or (as in the most C/C++ programms) generate
    invalid adresses when the pointer is acessed.


Chris Chiasson wrote:
> Some internal routines (for Export) use Block to pass "data" between
> functions - actually, I have witnessed the blocking of functions so
> that they are taken over by data-appropriate routines.
> In general it seems that any code that dynamically blocks a variable
> (or function) would be unsafe to run in parallel with other code that
> uses the same variable (or function).
> As we move forward with multi-core CPUs becoming the norm, does WRI
> have a plan for tapping into the multi-threaded power of the new x86
> chips from Intel and AMD?
> Is the technology in your grid computing software able to help here?

  • Prev by Date: Re: draw vertical cylinder with no surface lines
  • Next by Date: Re: pattern matching: rules that stop other rules?
  • Previous by thread: dynamic Blocking and thread safeness (in general)
  • Next by thread: pattern matching: rules that stop other rules?