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: [mg41927] Re: Mathlink performance and task switches
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 10 Jun 2003 04:46:57 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <bbq85s$d4v$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

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: O(n^2) complexity of ToCycles in Combinatorica
  • Next by Date: Re: help on color function!
  • Previous by thread: Mathlink performance and task switches
  • Next by thread: Re: Mathlink performance and task switches