MathGroup Archive 2003

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

Search the Archive

Re: Mathlink performance and task switches

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41940] Re: Mathlink performance and task switches
  • From: "John Jowett" <John.Jowett at cern.ch>
  • Date: Wed, 11 Jun 2003 03:49:24 -0400 (EDT)
  • Organization: CERN
  • References: <bbq85s$d4v$1@smc.vnet.net> <bc46dc$ksh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Jens' argument against Bruno Daniel's suggestion seems to be that:

(a) Task-switching itself is not slow, only some things that are necessarily
associated with it.
(b) There is a way to speed things up.  But it wouldn't work on Jens'
computers so it is a clever idea to prevent users of other (very common and
cheap) computers from taking advantage of it

More seriously, once you are using Mathlink things are somewhat
system-dependent anyway, and I really hope that somebody (Wolfram?) follows
up Bruno's excellent proposal.   It could bring very useful performance
gains in many applications.

John Jowett


"Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de> wrote in message
news:bc46dc$ksh$1 at smc.vnet.net...
> Hi,
>
> a) short C/C++ functions are not faster than in Mathematica because
>    Mathematica is so lighting fast
> b) the overhead of the protocol, i.e., convert the data, place it in
>    a shared memory area, read it from a shared memory area, check the
> arguments,
>    write the result to a shared memory area read it back to the kernel,
> will cause
>    the delay, not the task switch
>
> I would like to see the DLL's running on my SGI, Linux and Sun boxes
> and the "speed gain" from the dynamical linker ;-)
>
> And I would like to see how a program running on my SGI can be loaded
> form a Windows kernel ..
> I would alos like to see how my SGI kernel load some Windows DLL's
> and some Linux *.so ...
>
> Using processes and not dynamic librarys was one of the most clever
> decisions of the Mathematica developers !
>
> Regards
>   Jens
>
>
> Bruno Daniel wrote:
> >
> > Dear colleagues
> >
> > I'm worried about task switches limiting the performance of Mathlink
> > functions that are either short or need to call back the MathKernel
> > for Mathematica functions.
> >
> > Unfortunately, such implementations in general aren't faster on faster
> > computers, because of the design of multitasking systems: A Mathlink
> > call needs about at least half a millisecond independent of the
> > hardware. This makes it impossible to speed up short functions (or
> > functions involving calls to other Mathematica functions) by recoding
> > them in C or C++.
> >
> > Task switches could be avoided if the C-function was loaded as a DLL
> > directly into the Kernel, just like the Mathlink-DLL itself
> >
> > ml32i2.dll
> >
> > is.
> >
> > I wonder why this isn't possible in Mathematica. I think in order to
> > enable it, one would only have to extend the Mathlink code (especially
> > the DLL ml32i2.dll), not the Mathematica code itself. I noticed that
> > it's easy to replace this library by another version (e.g. the version
in
> >
AddOns\MathLink\DeveloperKit\Windows\AlternativeComponents\DebugLibraries\).
> > A new version of the Mathlink-DLL could on its part load the C-function
> > as a DLL to its executable and thus to the Mathematica-Kernel. So no
> > change of the Kernel would be needed.
> >
> > What do you think of this idea? Is there any way to license the Mathlink
> > source code for realising this implementation of s-functions in
Mathematica?
> >
> > Best regards
> >   Bruno Daniel
>



  • Prev by Date: Re: Fourier series interpolation
  • Next by Date: RE: "Sloppy Union"? (Union of a list with *nearly* equ
  • Previous by thread: Re: Mathlink performance and task switches
  • Next by thread: Re: Mathlink performance and task switches