On Fri, Oct 14, 2016 at 4:14 AM, Jan <jan.magnus...@gmail.com> wrote:

> Thanks for the hint. That seems to be the reason!
>
> I have a couple of follow up questions so that I learn more about Julia.
> Would be nice if someone takes a couple of minutes to educate me.
>
> I found a simple example reproducing my issue:
>
> module FooBar
>
> # Including BlackBoxOptim causes type instability for exponents
>
> using BlackBoxOptim
>
> # Multiplying instead of exponentiating works fine, even when using
> BlackBoxOptim
>
> f(a::Float64, b::Float64) = a^b
>
> end
>
> If I run @code_warntype with and without BlackBoxOptim for the code above,
> it is clear that it causes the type instability.
>
> With BlackBoxOptim:
>
>
> <https://lh3.googleusercontent.com/-nMINsUdVczQ/WACQBV0dbKI/AAAAAAAAAbM/tjGkVdRnZyokgT437RE36epcLaXko6zBgCLcB/s1600/type_instable.PNG>
>
>
> Without BlackBoxOptim:
>
>
>
> <https://lh3.googleusercontent.com/-22PONOOPYAk/WACQIi_fZOI/AAAAAAAAAbQ/WHDojaNHKPk-6u3fmeIOERTntO74eo0jQCLcB/s1600/type_stable.PNG>
>
>
> For my real code, the @code_warntype macro produces identical results
> whether I use BlackBoxOptim or not even though one is type unstable.
>
> *Question 1 + related ones :) :* Is there an alternative way to check
> type instability which is more detailed but still halfway easily readable?
> Would it be possible to detect the issue with @code_llvm or similar? I
> tried to write @code_llvm to a file since the output is very long, but
> never succeeded. Is this possible?
>

code_warntype is as much detail as you can get about type instability. This
is a compiler bug, which is likely why it might looks non-obvious from the
output.
I strongly recommend **against** using code_llvm to check type stability
unless you are really familiar with llvm IR. It indeed gives you more
(lower level) information but rarely (never) about why type instability
happens.


>
> *Question 2:* When the issue 18465 is fixed, will that end up in Julia
> 0.5.1 or is a fixed version available already before that somewhere?
>

The source with the fix will be on the release-0.5 branch so you can
compile it yourself. Ideally you don't have to wait too long before it is
released though.


>
> Many thanks for any help. I really like to work with Julia so some input
> would be highly appreciated.
>
> Jan
>
>
>

Reply via email to