Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11187 > unrolled thread

Strange runtime error in Compiled function

Started byAxel <axel.kowald@gmail.com>
First post2012-08-03 08:19 +0000
Last post2012-08-06 08:49 +0000
Articles 5 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Strange runtime error in Compiled function Axel <axel.kowald@gmail.com> - 2012-08-03 08:19 +0000
    Re: Strange runtime error in Compiled function Frank K <fkampas@gmail.com> - 2012-08-04 10:05 +0000
      Re: Strange runtime error in Compiled function Axel <axel.kowald@gmail.com> - 2012-08-05 01:56 +0000
    Re: Strange runtime error in Compiled function David Bailey <dave@removedbailey.co.uk> - 2012-08-05 01:54 +0000
      Re: Strange runtime error in Compiled function Axel <axel.kowald@gmail.com> - 2012-08-06 08:49 +0000

#11187 — Strange runtime error in Compiled function

FromAxel <axel.kowald@gmail.com>
Date2012-08-03 08:19 +0000
SubjectStrange runtime error in Compiled function
Message-ID<jvg1i7$rkd$1@smc.vnet.net>
Hi everybody,
I'm using Mathematica 8.0.1 on a 32bit Win7 system and I have strange problems with the Compile function.
I have this simple function:

compileTestC = Compile[{{paramList, _Integer, 1}},
   Module[{a, b},
    Print[paramList[[1]]];
    a = paramList[[1]];
    
    If[False,
     b = 1,
     b = 0
     ] ;
    Return[5]
    ] 
   ] ; 
   
When I compile and run it the first time, it produces the expected results:
compileTestC[{100}] 
100
5

But for all subsequent calls I get this strange error message:
compileTestC[{100}] 
100
CompiledFunction::cflist: Nontensor object generated; proceeding with uncompiled evaluation. >>
100
5

Furthermore, small changes to the source code make the error disappear. 
For instance deleting the line "a = paramList[[1]];" or deleting the If statement.

This sounds really crazy for me and I have no idea what's going on.
Can anybody help ?  Maybe it's a bug in Mathematica ?

Thanks,
  Axel

[toc] | [next] | [standalone]


#11203

FromFrank K <fkampas@gmail.com>
Date2012-08-04 10:05 +0000
Message-ID<jvis5n$2uk$1@smc.vnet.net>
In reply to#11187
I am also having problems with Print statements inside Compile, although not in all circumstances.  The Print statement seems to prevent the next statement from being evaluated, even though I have in wrapped in Evaluate[].  I suspect it is a bug.  

[toc] | [prev] | [next] | [standalone]


#11217

FromAxel <axel.kowald@gmail.com>
Date2012-08-05 01:56 +0000
Message-ID<jvkjsk$5uv$1@smc.vnet.net>
In reply to#11203
Well, the error also occurs if the Print statement is deleted...

[toc] | [prev] | [next] | [standalone]


#11212

FromDavid Bailey <dave@removedbailey.co.uk>
Date2012-08-05 01:54 +0000
Message-ID<jvkjnt$5ue$1@smc.vnet.net>
In reply to#11187
On 03/08/2012 09:19, Axel wrote:
> Hi everybody,
> I'm using Mathematica 8.0.1 on a 32bit Win7 system and I have strange problems with the Compile function.
> I have this simple function:
>
> compileTestC = Compile[{{paramList, _Integer, 1}},
>     Module[{a, b},
>      Print[paramList[[1]]];
>      a = paramList[[1]];
>
>      If[False,
>       b = 1,
>       b = 0
>       ] ;
>      Return[5]
>      ]
>     ] ;
>
> When I compile and run it the first time, it produces the expected results:
> compileTestC[{100}]
> 100
> 5
>
> But for all subsequent calls I get this strange error message:
> compileTestC[{100}]
> 100
> CompiledFunction::cflist: Nontensor object generated; proceeding with uncompiled evaluation.>>
> 100
> 5
>

Admitedly I am using the 64-bit version of 8.0.4, but I don't think that 
is relevant. For me your code runs in the same way however many times I 
run it:

In[791]:=
compileTestC =
   Compile[{{paramList, _Integer, 1}},
    Module[{a, b}, Print[paramList[[1]]];
     a = paramList[[1]];
     If[False, b = 1, b = 0];
     Return[5]]];

In[792]:= compileTestC[{100}]

  100

Out[792]= 5

In[797]:= compileTestC[{100}]

  100

Out[797]= 5

I am guessing that you actually do something else between the first and 
second calls!

Post some code that actually fails, and someone will tell you what is 
wrong! Preferably start from a clean kernel, so that whatever code you 
post, is not affected by something we cannot see.

David Bailey
http://www.dbaileyconsultancy.co.uk

[toc] | [prev] | [next] | [standalone]


#11244

FromAxel <axel.kowald@gmail.com>
Date2012-08-06 08:49 +0000
Message-ID<jvo0f0$cfl$1@smc.vnet.net>
In reply to#11212
Hi,


> Admitedly I am using the 64-bit version of 8.0.4, but I don't think that 
> is relevant. For me your code runs in the same way however many times I 
> run it:

ah, I upgraded to 8.0.4 and the error disappeared !
So it is a bug in 8.0.1.

Axel 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web