Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5025
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!news-xxxfer.readnews.com!216.40.28.145.MISMATCH!novia!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | DmitryG <einschlag@gmail.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Compilation: Avoiding inlining |
| Date | Sat, 17 Sep 2011 10:31:23 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <j51str$pg4$1@smc.vnet.net> (permalink) |
| References | <201109160946.FAA12301@smc.vnet.net> <j4vana$dal$1@smc.vnet.net> |
| Lines | 53 |
| NNTP-Posting-Date | 17 Sep 2011 09:34:24 GMT |
| NNTP-Posting-Host | 9b6058a6.news.twtelecom.net |
| X-Trace | DXC=QF=JZJV^\7232fYY\=>JD;C_A=>8kQj6==_1NR_H?JP=b95`<gFe:D:EFiONJ7[Go6HoN5ahciJ=9 |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:5025 |
Show key headers only | View raw
Hi Oliver,
thank you for your response! I am interested now in the systems of
equations that are non-vectorizable. By mistake, in my first post I
have used a system of equations that can be vectorized and this turned
the discussion away from the topic. But in my second post, I have a
non-vectorizable system of equations.
I have identified three ways to define the system of equations. Below
are the results with Mathematica compilation.
1)
(* Definition of the equations *)
NN = 1000;
F = Function[{t, x}, Table[ -x[[i]] Sin[0.1 t]^2/(1 +100 Sum[x[[i +
j]], {j, 1, Min[3, NN - i]}]^2), {i, 1, NN}]];
>> Evaluation time 24.4983979 - slow execution. No inlining. Compiled code 189 lines independently of NN. Compilation in C gives practically the same speed
2)
(* Definition of the equations *)
NN = 1000;
F = Function[{t, x}, Table[ Unevaluated[-x[[i]] Sin[0.1 t]^2/(1 +100
Sum[x[[i + j]], {j, 1, Min[3, NN - i]}]^2)], {i, 1, NN}]];
>> Evaluation time 4.7582721. No inlining. Compiled code 93 lines independently of NN. Compilation in C gives practically the same speed
3)
(* Definition of the equations *)
NN = 1000;
F = Function[{t, x}, Evaluate[Table[ -x[[i]] Sin[0.1 t]^2/(1 +100
Sum[x[[i + j]], {j, 1, Min[3, NN - i]}]^2), {i, 1, NN}]]];
>> Evaluation time 1.0680555 - fastest execution. Here we have inlining of the code, the size of the compiled code increases with NN. Compilation in C is impossible.
One can see that there are many different ways with very different
results, and it is very important to find the best one - more
important than to buy a faster computer;-))
Does in make sense to introduce F as a compiled function, as you have
done in your response? We already make compilation of the RK-4
procedure with F injected into it.
Best,
Dmitry
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Compilation: Avoiding inlining Oliver Ruebenkoenig <ruebenko@wolfram.com> - 2011-09-16 11:08 +0000
Re: Compilation: Avoiding inlining DmitryG <einschlag@gmail.com> - 2011-09-17 10:31 +0000
Re: Compilation: Avoiding inlining DmitryG <einschlag@gmail.com> - 2011-09-19 11:12 +0000
Re: Compilation: Avoiding inlining David Bailey <dave@removedbailey.co.uk> - 2011-09-20 10:08 +0000
Re: Compilation: Avoiding inlining DmitryG <einschlag@gmail.com> - 2011-09-21 09:41 +0000
Re: Compilation: Avoiding inlining DmitryG <einschlag@gmail.com> - 2011-09-22 11:34 +0000
csiph-web