[julia-users] ASTs of complete modules/packages?

2016-09-23 Thread Andreas Lobinger
Hello colleagues, i'm playing around with some ideas for testing and i searching for something like this: * read-in (from the original file or via name) a complete module (or package) * transform/parse to AST * insert additional Expr/code in dedicated places (to count calls etc.) * eval, so

[julia-users] Is interrupt() supposed to kill worker processes?

2016-09-23 Thread Kevin Keys
The documentation for interrupt() when called with no arguments does the equivalent on worker processes of Ctrl + C on the local process. But in my experience, Ctrl + C does not necessarily kill the Julia instance. In contrast, it does seems like interrupt() kills worker processes. Tested on

[julia-users] Cookbook for Julia

2016-09-23 Thread Pranav Bhat
It can be frustrating to comb through docs, forums or Stack Overflow to find the code snippet you need, especially if you're trying out a language (or even programming) for the first time. I found the Perl Cookbook extremely helpful when

[julia-users] Re: can't get pyjulia to work

2016-09-23 Thread Tim Wheeler
So a temporary workaround is: export PYTHONPATH=$HOME/Desktop/pyjulia:$PYTHONPATH This just adds the pyjulia repo to my PYTHONPATH. On Friday, September 23, 2016 at 3:01:10 PM UTC-7, Tim Wheeler wrote: > > Another pyjulia call for help. > > I am using Julia 0.5 and Anaconda 2.3.0 with Python

Re: [julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
Sheehan, empty arrays are a problem in general, for now I'd say its better to handle the empty case separately for functions. Note that the only problematic case should be broadcasting with non-type stable functions over empty arrays. Unless that is extremely important for you, you might

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
Andrew, I do not understand the details but I believe there are some restrictions when using generated functions. You are not supposed to use functions with side effects, closures, comprehensions and functions like promote_op which rely on inference confuse inference when in generated

Re: [julia-users] Re: How does promote_op work?

2016-09-23 Thread Sheehan Olver
An empty array triggered a bug caused by not dispatching correctly, which I worked around with isempty. But I could have also overriden promote_op and not had to deal with empty arrays as a special case. > On 24 Sep. 2016, at 8:15 am, Pablo Zubieta wrote: > > Sheehan,

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
Sheehan, are you planning on doing a lot of operations with empty arrays? On 0.5 with your example julia> [Foo(1), Foo(2)] + [Foo(1), Foo(0)] 2-element Array{Foo,1}: Foo{Float64}(1.0) Foo{Int64}(1) The problem is empty arrays, when the type cannot be inferred broadcast uses the types of each

[julia-users] Re: can't get pyjulia to work

2016-09-23 Thread Tim Wheeler
Another pyjulia call for help. I am using Julia 0.5 and Anaconda 2.3.0 with Python 2.7. I followed the pycall install instructions . Julia is on my PATH. When I run python in the cloned pyjulia repo everything is fine. When I run python in a different

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Sheehan Olver
OK, here's a better example of the issue: in the following code I would want it to return an *Array(Foo,0)*, not an *Array(Any,0). *Is this possible without overriding promote_op? *julia> **immutable Foo{T}* *x::T* *end* *julia> **import Base.+* *julia> **+(a::Foo,b::Foo) =

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Andrew Keller
Does the promote_op mechanism in v0.5 play nicely with generated functions? In Unitful.jl, I use a generated function to determine result units after computations involving quantities with units. I seem to get errors (@inferred tests fail) if I remove my promote_op specialization. Perhaps my

Re: [julia-users] Is FMA/Muladd Working Here?

2016-09-23 Thread Erik Schnetter
It should. Yes, please open an issue. -erik On Thu, Sep 22, 2016 at 7:46 PM, Chris Rackauckas wrote: > So, in the end, is `@fastmath` supposed to be adding FMA? Should I open an > issue? > > On Wednesday, September 21, 2016 at 7:11:14 PM UTC-7, Yichao Yu wrote: >> >> On

[julia-users] Re: Problems with Memoize in Julia 0.5.0

2016-09-23 Thread Steven G. Johnson
On Friday, September 23, 2016 at 9:08:29 AM UTC-4, Ed Scheinerman wrote: > > Hello, > > I use memoization frequently and have run into two problems with the move > to Julia 0.5.0. > > The first is not too serious and I hope can be fixed readily. The first > time I memoize a function, a

Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-09-23 Thread daycaster
... @juliaheartbeat on twitter also started silent running on Sept 17...

Re: [julia-users] trivial but stubborn question on conversion to unix time and Float64

2016-09-23 Thread Yichao Yu
On Fri, Sep 23, 2016 at 11:50 AM, Yichao Yu wrote: > On Fri, Sep 23, 2016 at 11:33 AM, Reuben Brooks wrote: >> Trying to convert a datetime object to unixtime to a string for an api that >> uses unixtime. However, I cannot figure out how to get the

Re: [julia-users] trivial but stubborn question on conversion to unix time and Float64

2016-09-23 Thread Yichao Yu
On Fri, Sep 23, 2016 at 11:33 AM, Reuben Brooks wrote: > Trying to convert a datetime object to unixtime to a string for an api that > uses unixtime. However, I cannot figure out how to get the result formatted > in non-scientific notation: > > julia> a =

[julia-users] trivial but stubborn question on conversion to unix time and Float64

2016-09-23 Thread Reuben Brooks
Trying to convert a datetime object to unixtime to a string for an api that uses unixtime. However, I cannot figure out how to get the result formatted in non-scientific notation: julia> a = Dates.datetime2unix(now()); string(round(a)) "1.474626735e9" What I want is to get:

[julia-users] Re: Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Cristóvão Duarte Sousa
On the other hand, it works ok for the mean function: r = rand(10) test(r) = mean( t^2 for t in r ) @code_warntype test(r) # return type Float64 is inferred On Thursday, September 22, 2016 at 7:21:36 PM UTC+1, Christoph Ortner wrote: > > I hope that there is something I am missing, or making a

[julia-users] Problems with Memoize in Julia 0.5.0

2016-09-23 Thread Ed Scheinerman
Hello, I use memoization frequently and have run into two problems with the move to Julia 0.5.0. The first is not too serious and I hope can be fixed readily. The first time I memoize a function, a warning is generated like this: julia> using Memoize julia> @memoize f(a) = a+1 WARNING:

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Patrick Kofod Mogensen
I still don't quite get why a) inference between the generator and the comprehension is different, and b) why inference went down the drain when I added the type annotation for the return value in my example above... Sorry if the answer is in this discussion somewhere! On Friday, September 23,

[julia-users] Re: How does promote_op work?

2016-09-23 Thread Pablo Zubieta
In julia 0.5 the following should work without needing doing anything to promote_op import Base.+ immutable Foo end +(a::Foo, b::Foo) =1.0 Array{Foo}(0) + Array{Foo}(0)) promote_op is supposed to be an internal method that you wouldn't need to override. If it is not working i because the

Re: [julia-users] Re: ANN: A potential new Discourse-based Julia forum

2016-09-23 Thread Patrick Kofod Mogensen
And worst of all, no Julia-speedometer at http://nirajkadu.me/index.php/about/ either! On Thursday, September 22, 2016 at 9:23:39 PM UTC+2, Stefan Karpinski wrote: > > Yikes... recycled static IP address :| > > On Thu, Sep 22, 2016 at 1:02 PM, mmh > wrote: > >>

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Steven G. Johnson
On Friday, September 23, 2016 at 4:13:53 AM UTC-4, Christoph Ortner wrote: > > The sum of an empty set or vector is undefined it is not zero. > >> you can rewrite it in a more explicit way >> >>> >>> > Actually a sum over an empty set is normally defined to be zero while a > product over an

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Steven G. Johnson
On Friday, September 23, 2016 at 2:42:00 AM UTC-4, Michele Zaffalon wrote: > > On Fri, Sep 23, 2016 at 2:23 AM, Steven G. Johnson > wrote: >> >> >> We could use type inference on the function t -> t^2 (which is buried in >> the generator) to determine a more specific

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Tsur Herman
{We could use type inference on the function t -> t^2 (which is buried in the generator) to determine a more specific eltype.} We can declare : eltype(G::Base.Generator) = Base.code_typed(G.f,(eltype(G.iter),))[1].rettype element type of Generator G will be the inferred return type of G.f

[julia-users] Re: Julia v0.5.0 always killed on a memory limited cluster

2016-09-23 Thread Florian Oswald
This is affecting my work in exactly the same way. my jobs have been down on an SGE managed cluster since I upgraded to v0.5-xxx for other reasons. Some support on this would be very good. On Thursday, 22 September 2016 11:26:16 UTC+2, Alan Crawford wrote: > > I am using Julia v0.5.0 on a

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Michele Zaffalon
>From reading the manual , producing a value is delayed until that value is required. Is my understanding wrong? On Fri, Sep 23, 2016 at 10:14 AM, Christoph Ortner < christophortn...@gmail.com> wrote: > why would type

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Christoph Ortner
why would type inference for sum(t^2 for t in r) be different from [t^2 for t in r] ? On Friday, 23 September 2016 07:42:00 UTC+1, Michele Zaffalon wrote: > > On Fri, Sep 23, 2016 at 2:23 AM, Steven G. Johnson > wrote: >> >> >> We could use type inference on the function t

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Christoph Ortner
The sum of an empty set or vector is undefined it is not zero. > you can rewrite it in a more explicit way > >> >> Actually a sum over an empty set is normally defined to be zero while a product over an empty set is normally defined to be one.

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Michele Zaffalon
On Fri, Sep 23, 2016 at 2:23 AM, Steven G. Johnson wrote: > > > We could use type inference on the function t -> t^2 (which is buried in > the generator) to determine a more specific eltype. > Does this not require evaluating the function on all inputs thereby losing the

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Milan Bouchet-Valat
Le jeudi 22 septembre 2016 à 14:54 -0700, Tsur Herman a écrit : > By the way my test3 functions is super fast > >  @time test3(r) >   0.32 seconds (4 allocations: 160 bytes) Beware, if you don't return 'total' from the function, LLVM optimizes away the whole loops and turns the function into