Speed up Mathematica for Windows 95
- To: mathgroup at smc.vnet.net
- Subject: [mg2967] Speed up Mathematica for Windows 95
- From: jpk at apex.mpe.FTA-Berlin.de (Jens-Peer Kuska)
- Date: Wed, 17 Jan 1996 03:09:28 -0500
Hi, Windows 95 users of Mathematica
I have just finished a small MathLink program that lets You change
the process priorities of the Mathematica Kernel and the Frontend
with Mathematica commands. The 32Bit MathLink-Exe, the source code
and a sample notebook can be down loaded via anonymous-ftp from:
www.mpe.FTA-Berlin.de/incoming/MmaWin95/mpri95.zip
the mpri95.zip includes all what You need.
The notebook in the zip-file show how to install the MathLink
executable.
To use mpri95.exe You *must* have TCP/IP installed.
The speed up is shown below. Set the frontend priority
to idle makes
the CALCULATIONS THREE TIMES OR MORE FASTER.
Mail me if You like the program,
Jens
-------------------------------------------------------------
-- Speed test -----------------------------------------------
-------------------------------------------------------------
Install the Windows 32 bit MathLink Program
In[]:=lnk=LinkOpen[LinkMode->Listen,LinkProtocol->"TCP"]
Out[]=LinkObject["1024 at caligula.mpe.fta-berlin.de", 2, 2]
In[]:=Run["e:\\test\\mpri95.exe -linkname " <> First[lnk] <> " -linkmode connect -linkprotocol tcp"];
In[]:= lnk=Install[lnk];
Get the Timing with normal priority, to get comparable results
the MathLink-EXE must be installed.
In[]:= f[x_]:= BesselJ[0,x];
Timing[Nest[f,0.6,2500]][[1]]
Out[]=86.604 Second
In[]:= kdv[q_]:= D[q,t] - 1/4 D[q,{x,3}] -3/2 q D[q,x]
q3:= (-5*E^((11*t)/8) - 45*E^(2*x) - 18*E^((11*t)/16 + x) +
162*E^((3*t)/2 + 2*x) - 188*E^((13*t)/16 + 3*x) +
162*E^(t/8 + 4*x) - 45*E^((13*t)/8 + 4*x) -
18*E^((15*t)/16 + 5*x) - 5*E^(t/4 + 6*x))/
(8*(-E^((11*t)/16) + 3*E^x - 3*E^((13*t)/16 + 2*x) +
E^(t/8 + 3*x))^2);
Timing[Simplify[kdv[q3]]]
Out[]={352.775 Second, 0}
Frontend is Idle, Kernel is Normal
In[]:=$SetFrontendPriority[$IdlePriority];
In[]:= f[x_]:= BesselJ[0,x];
Timing[Nest[f,0.6,2500]][[1]]
Out[]= 23.89 Second
In[]:= Timing[Simplify[kdv[q3]]]
Out[]= {97.6 Second, 0}
Frontend is Normal, Kernel is High
$SetFrontendPriority[$NormalPriority];
$SetKernelPriority[$HighPriority];
In[]:= f[x_]:= BesselJ[0,x];
Timing[Nest[f,0.6,2500]][[1]]
Out[]=21.933 Second
In[]:=Timing[Simplify[kdv[q3]]]
Out[]=
{90.914 Second, 0}
Frontend Idle, Kernel High
$SetFrontendPriority[$IdlePriority];
$SetKernelPriority[$HighPriority];
In[]:= f[x_]:= BesselJ[0,x];
Timing[Nest[f,0.6,2500]][[1]]
Out[]=21.462 Second
In[]:= Timing[Simplify[kdv[q3]]]
Out[]={89.257 Second, 0}
Remove the MathLink Program
In[]:=Uninstall[lnk];
I hope the results are use full. A very long calculation may be
best perform with $IdlePriority of the frontend and $HighPriority
of the kernel. For daly use $IdlePriority of the frontend and
$NormalPriority of the kernel may be the best.
Please send comments and bugs to:
jpk at mpe.fta-berlin.de
==== [MESSAGE SEPARATOR] ====