[julia-users] FE solver in Julia fast and faster

2015-01-09 Thread Petr Krysl
Hello all,

Big thanks to  Tim Holy and Andreas Noack. The FE solver implemented in 
Julia as described previously 
(https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/Krysl/julia-users/dgNqrJBZx5U/oGeXMZFjToMJ)
 
has  been further optimized with their helpful hints and pointers.   The 
comparison problem now runs  in around 9.6 seconds, compared to  16 seconds 
solve phase achieved with the commercial FEA software .

Not bad, Julia!

Petr


Re: [julia-users] Re: Sort performance depends on Array type in a strange way

2015-01-09 Thread Stefan Karpinski
For arrays of numbers, it's assumed that an unstable sort is ok, so
quicksort is used and no temporary array needs to be allocated. For other
kinds of objects, we default to mergesort, which needs a temporary array.

On Fri, Jan 9, 2015 at 7:23 PM, Páll Haraldsson pall.haralds...@gmail.com
wrote:


 I'm not sure why it matters if I added Numbers:
 type Pair : Number
  x
  y
end

 I got a little lower time and 0 bytes allocated:

 julia @time sort_Pair()
 elapsed time: 0.006614108 seconds (488 bytes allocated)
 elapsed time: 0.041584405 seconds (31991872 bytes allocated)
 elapsed time: 1.732269097 seconds (0 bytes allocated)
 Array{Pair,1}
 elapsed time: 1.951577918 seconds (35993216 bytes allocated, 8.71% gc time)

 --
 Palli.


 On Saturday, January 10, 2015 at 12:05:03 AM UTC, Páll Haraldsson wrote:


 Hi,

 This is my first answer here, I'm not an expert on Julia.. Seems tuple is
 slow. It's more general,

 On my machine this beats Python:

 function sort_Pair()
   gc(); @time temp = rand(500_000)
   gc(); @time temp2 = [Pair(temp[i],i) for i=1:length(temp)]
   gc(); @time sort!(temp2); println(typeof(temp2))
 end

 julia @time sort_pair()
 elapsed time: 0.006823427 seconds (488 bytes allocated)
 elapsed time: 0.035921609 seconds (31991872 bytes allocated)
 elapsed time: 1.975542283 seconds (448 bytes allocated)
 Array{Pair,1}
 elapsed time: 2.20708157 seconds (40892612 bytes allocated, 7.46% gc time)

 compared to (or 2.7 sec total in Python):

 julia @time sort_any()
 elapsed time: 0.006287604 seconds (488 bytes allocated)
 elapsed time: 0.047933539 seconds (35991872 bytes allocated)
 elapsed time: 5.989875809 seconds (191154832 bytes allocated)
 Array{Any,1}
 elapsed time: 6.247331383 seconds (231803748 bytes allocated, 2.76% gc
 time)


 I used:

 type Pair
   x
   y
 end

 import Base.isless

 function isless(a, b)
   if a.x  b.x
 true
   elseif a.x == b.x  a.y  b.y
 true
   else
 false
   end
 end

 You can maybe think of a tuple as a type, but I'm not sure where to look
 for code for it nor looked into the profiler (use @profile, not @time). A
 tuple can of course be a 2-tupel (pair), 3-tuple, etc. And I could change
 the function for each case, just not sure how I would make my own type that
 would handle n-tuples.. Julia does that and maybe just has to be optimized.
 Maybe in 0.4 it is..

 Types in Julia are supposed to be abstraction-free, but included tuples
 seem to have a 231803748/40892612 = 5.6 times overhead compared to my Pair
 judging by the memory allocations.

 --
 Palli.

 On Friday, January 9, 2015 at 10:06:30 AM UTC, Andras Niedermayer wrote:



 The performance of the sort algorithm varies largely with the element
 type of an Array, in an unexpected (at least for me) way. Sorting time is
 ordered like this: Vector{(Any,Any)}  Vector{Any} 
 Vector{(Float64,Int64}). Is this a bug or is this behavior intended? Here's
 the code:

 ---

 julia function sort_floatint_tuple()
  temp = rand(500_000)
  temp2 = (Float64,Int64)[(temp[i],i) for i=1:length(temp)]
  sort!(temp2)
end
 sort_floatint_tuple (generic function with 1 method)

 julia gc(); @time sort_floatint_tuple();
 elapsed time: 5.371570706 seconds (2187115768 bytes allocated, 44.77%
 gc time)

 julia gc(); @time sort_floatint_tuple();
 elapsed time: 7.522759215 seconds (2184593304 bytes allocated, 57.48%
 gc time)

 julia function sort_any_tuple()
  temp = rand(500_000)
  temp2 = (Any,Any)[(temp[i],i) for i=1:length(temp)]
  sort!(temp2)
end
 sort_any_tuple (generic function with 1 method)

 julia gc(); @time sort_any_tuple();
 elapsed time: 2.705974449 seconds (526135400 bytes allocated, 23.32% gc
 time)

 julia gc(); @time sort_any_tuple();
 elapsed time: 3.215082563 seconds (523241560 bytes allocated, 37.72% gc
 time)

 julia function sort_any()
  temp = rand(500_000)
  temp2 = Any[(temp[i],i) for i=1:length(temp)]
  sort!(temp2)
end
 sort_any (generic function with 1 method)

 julia gc(); @time sort_any();
 elapsed time: 3.591829528 seconds (231327824 bytes allocated, 6.01% gc
 time)

 julia gc(); @time sort_any();
 elapsed time: 3.932805966 seconds (231203560 bytes allocated, 12.54% gc
 time)

 ---


 Python is much faster here:
 ---
 %timeit  temp=np.random.rand(50); temp2=zip(temp,range(len(temp)));
 temp2.sort()
 1 loops, best of 3: 1.33 s per loop

 ---

 PS: Type inference gives Vector{(Float64,Int64)} if I write the for
 comprehension in a function and Vector{(Any,Any)} if I run it outside of a
 function.

 PPS: After looking at this in detail, I found out that sortperm would
 have been a better option for this. But it is still surprising to me that
 losing type information ((Any,Any) instead of (Float64,Int64)) speeds up
 the code.




[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?

2015-01-09 Thread Kaj Wiik
Julia 0.3.5
Gadfly 0.3.10

julia plot(sin, 0, 2pi, Guide.annotation(compose(context(), circle([pi/2, 
3*pi/2], [1.0, -1.0], [2mm]), fill(nothing), stroke(orange
ERROR: annotation not defined

??

Kaj


On Friday, January 9, 2015 at 6:28:03 AM UTC+2, Sheehan Olver wrote:

 I came across this which answers my question:

 http://gadflyjl.org/guide_annotation.html

 On Wednesday, December 10, 2014 at 8:05:02 AM UTC+11, Sheehan Olver wrote:


 I want to add, say, a triangle or circle to a Gadfly plot.  The following 
 works

 compose(render(plot(x=1:10,y=1:10)),circle(0.5,0.5,0.1))

 But I want the circle to use the same coordinate system as the plot.  Any 
 advice?




Re: [julia-users] Running mean/median in Julia

2015-01-09 Thread Stefan Karpinski
I assume you're on 0.3.x – this may simply be due to SubArrays kind of
sucking for performance. The new ArrayView stuff is much better.

On Fri, Jan 9, 2015 at 7:33 PM, Tomas Mikoviny tomas.mikov...@gmail.com
wrote:

 yes, that was my negligence, change type is first thing I usually check...
 however it has no significant impact on performance...

 I've got caught with some different things last days but continuing to
 play with online methods

 tm

 On Wednesday, January 7, 2015 at 7:49:43 PM UTC+1, Stefan Karpinski wrote:

 Try deleting the line where you initially assign to subset – it isn't
 necessary and causes that variable to change type over the course of your
 loop.

 On Tue, Jan 6, 2015 at 6:50 PM, Tomas Mikoviny tomas.m...@gmail.com
 wrote:

 Hi Stefan,

 you are right. But the moment I try to do this for any subset along the
 array it gets inefficient.
 Here is the simplest code for running median of one dimensional array.
 Time consuming...

 function runmed(input::Array, w::Int)
 L = length(input)
 output = zeros(input)
 subset = zeros(w+1)
 for i in 1:L-w
 subset = sub(input, i:i+w)
 output[i] = median!(subset)
 end
 return output
 end

 a = zeros(30);

 runmed(a, 200);

 @time runmed(a, 200);
 elapsed time: 1.460171594 seconds (43174976 bytes allocated)


 On Tuesday, January 6, 2015 10:10:39 PM UTC+1, Stefan Karpinski wrote:

 You may not need online methods at all. Sorting the rows of a 200 x
 30 matrix doesn't take very long on my laptop:

 julia X = randn(200,30);

 julia @time X = sortrows(X);
 elapsed time: 0.297998739 seconds (480053384 bytes allocated)




 On Tue, Jan 6, 2015 at 2:33 PM, Tomas Mikoviny tomas.m...@gmail.com
 wrote:

 Hi Kevin,

 generally I'm trying to do baseline correction on mass spectra with
 ~30 bins. I've tried several algorithms to evaluate baseline but the
 ones working the best implement running median and mean. I've just got 
 mean
 sorted out via cumsum trick in coincidence with Tim's suggestion (found
 some MATLAB discussion on that). Although I'll check Tamas' suggestion 
 too.

 I've got stacked with running median that would have reasonable
 performance since computer has to crunch runmed of array of 200 x 30
 within couple of seconds (max) to manage online analysis.

 On Tuesday, January 6, 2015 6:18:02 PM UTC+1, Kevin Squire wrote:

 Hi Tomas,
 I'm bit aware of any (though they might exist). It might help if you
 gave a little more context--what kind of data are you working with?

 Cheers,
Kevin

 On Tuesday, January 6, 2015, Tomas Mikoviny tomas.m...@gmail.com
 wrote:

 Hi,
 I was just wondering if anyone knows if there is a package that
 implements *fast* running median/mean algorithms?

 Thanks a lot...







Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Petr Krysl
Thanks, that was very helpful. 

The problem was eliminated by parameterizing wrt the type S:FESet. The 
lesson I learned was that knowing the abstract type is not enough: the 
compiler needs to know the concrete type. That is something I was not used 
to and it tripped me up again this time. I hope I will remember from now on.

Thanks again,

Petr

On Friday, January 9, 2015 at 12:08:58 PM UTC-8, Tim Holy wrote:

 On Friday, January 09, 2015 11:51:15 AM Petr Krysl wrote: 
  The size() function is from the base. fes.conn is a 2D array of ints. 

 No it's not, it's a JFIntMat :-). But seriously, _you_ might know that 
 corresponds to a 2D array of ints, but the key question is if you've given 
 enough information in your declaration of JFIntMat for the _compiler_ to 
 know 
 that. 

 Bottom line is that the behavior you're observing isn't normal. It's also 
 extremely unlikely to be a bug in julia, because we do this kind of stuff 
 all 
 over julia without the kind of allocations you're observing. So it's 
 almost 
 certainly something in your code. @code_warntype is your best way of 
 finding 
 out. 

 --Tim 

  
  P 
  
  On Friday, January 9, 2015 at 11:25:34 AM UTC-8, Tim Holy wrote: 
   I wonder if your `size` function isn't returning an Int, or that the 
   compiler 
   can't infer that. Did you try this on julia 0.4 with @code_warntype? 
   
   --Tim 
   
   On Friday, January 09, 2015 08:06:43 AM Petr Krysl wrote: 
Actually, I realized that  the example shows the same problem, but 
 for a 
different function. This time the allocation occurs  in the function 
CALLING getconn!. 

P 

On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote: 
 Tim, 
 
 Your explanation is very helpful.  There is a complication though: 
 The function is actually called from another  function (from a 
 chain 
   
   of 
   
 functions). Here is the measurement from a simplified situation: 
 - using JFFoundationModule 
 - using FESetModule 
 - 
 - n=100; 
 - function test(n) 
 0 fes=FESetH8(conn=rand(JFInt,n, 
 
 8)) 
 
   112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1); 
   
   6383704 for j=1:size(fes.conn,1) 
   
 0 getconn!(fes,conn1,j); 
 - end 
 0 return true 
 - end 
 - 
 - test(n) 
 - clear_malloc_data() 
 - n=10; 
 - test(n) 
 
 As you can see the loop over the rows of the array fes.conn 
 allocates 
 substantial amount of memory. 
 
 Here is the type: 
 https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e 
 
 Petr 



Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Petr Krysl
Thanks Andreas, that was helpful. See message to Tim in this thread.

P

On Friday, January 9, 2015 at 11:55:20 AM UTC-8, Andreas Noack wrote:

 Sometimes Julia can have problems inferring the type of fields of types 
 which is what conn is. Using @code_warntype as suggested by Tim could give 
 an indication if it is the case.

 2015-01-09 14:51 GMT-05:00 Petr Krysl krysl...@gmail.com javascript::

 The size() function is from the base. fes.conn is a 2D array of ints.

 P


 On Friday, January 9, 2015 at 11:25:34 AM UTC-8, Tim Holy wrote:

 I wonder if your `size` function isn't returning an Int, or that the 
 compiler 
 can't infer that. Did you try this on julia 0.4 with @code_warntype? 

 --Tim 

 On Friday, January 09, 2015 08:06:43 AM Petr Krysl wrote: 
  Actually, I realized that  the example shows the same problem, but for 
 a 
  different function. This time the allocation occurs  in the function 
  CALLING getconn!. 
  
  P 
  
  On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote: 
   Tim, 
   
   Your explanation is very helpful.  There is a complication though: 
   The function is actually called from another  function (from a chain 
 of 
   
   functions). Here is the measurement from a simplified situation: 
   - using JFFoundationModule 
   - using FESetModule 
   - 
   - n=100; 
   - function test(n) 
   0 fes=FESetH8(conn=rand(JFInt,n, 
   
   8)) 
   
 112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1); 
 
 6383704 for j=1:size(fes.conn,1) 
 
   0 getconn!(fes,conn1,j); 
   - end 
   0 return true 
   - end 
   - 
   - test(n) 
   - clear_malloc_data() 
   - n=10; 
   - test(n) 
   
   As you can see the loop over the rows of the array fes.conn 
 allocates 
   substantial amount of memory. 
   
   Here is the type: 
   https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e 
   
   Petr 




Re: [julia-users] Re: Julia 0.3.4 - problem installing packages

2015-01-09 Thread Test This
No, I had not run Pkg.update on that computer. But as I said in my message, 
deleting ~/.julia, and then trying to install them again, worked.

Thanks so much for creating/maintaining these binaries. 




On Thursday, January 8, 2015 at 3:25:24 PM UTC-5, Elliot Saba wrote:

 Have you run `Pkg.update()` recently?

 On Thu, Jan 8, 2015 at 10:34 AM, Test This curiou...@gmail.com 
 javascript: wrote:

 This might have been because I did not delete ~/.julia. I have not tried 
 yet by deleting it on my Mac. 

 However, I just installed 0.3.4 on Ubuntu and installed the above 
 packages without any problem. On Ubuntu, I did delete ~/.julia before 
 installing the packages, so I am thinking that will work on Mac too.



 On Thursday, January 8, 2015 11:35:23 AM UTC-5, Test This wrote:

 Hello,

 I downloaded Julia 0.3.4 (dmg version) recently for Mac. I am using OS X 
 10.9.5. Today I tried installing some packages. 
 Package Distributions and ArgParse installed fine (have not used them 
 yet, but they did not throw any error). 

 However, DataFrames and PyCall did not install. Here is the error output 
 form repl:

 Pkg.add(PyCall)
 ERROR: unknown package PyCall
  in wait at task.jl:51
  in sync_end at /Applications/Julia-0.3.4.app/
 Contents/Resources/julia/lib/julia/sys.dylib
  in add at pkg/entry.jl:319
  in add at pkg/entry.jl:71
  in anonymous at pkg/dir.jl:28
  in cd at /Applications/Julia-0.3.4.app/Contents/Resources/julia/lib/
 julia/sys.dylib
  in __cd#227__ at /Applications/Julia-0.3.4.app/
 Contents/Resources/julia/lib/julia/sys.dylib
  in add at pkg.jl:20

 Any solutions?

 Thank you.




Re: [julia-users] Re: Julia v0.3.5

2015-01-09 Thread elextr
Now matches the tagged commit 'n all.
Thanks
Lex

On Saturday, January 10, 2015 at 9:19:35 AM UTC+10, Elliot Saba wrote:

 We noticed that as well 
 https://github.com/JuliaLang/julia/commit/a05f87b79ad62beb033817fdfdefa270c9557aaf.
   
 An `apt-get update  apt-get upgrade` should fix it.
 -E

 On Fri, Jan 9, 2015 at 3:15 PM, cdm cdmcle...@gmail.com javascript: 
 wrote:


 yeah ...

 that parenthetical has
 been static since at
 least version 0.3.3

 curious ...



 On Friday, January 9, 2015 at 3:06:29 PM UTC-8, ele...@gmail.com wrote:

 Thank you all the people who bring these updates.

 One question, the versioninfo() for theJulia release on the Ubuntu PPA 
 says:

 Version 0.3.5
 Commit 21d5433* (2014-10-21 20:18 UTC)

 The commit and date/time hasn't changed.

 Cheers
 Lex

 On Saturday, January 10, 2015 at 5:11:13 AM UTC+10, Elliot Saba wrote:

 Hello all!  The latest bugfix release of the 0.3.x Julia line has been 
 released.  Binaries are available from the usual place 
 http://julialang.org/downloads/, and as is typical with such things, 
 please report all issues to either the issue tracker 
 https://github.com/JuliaLang/julia/issues, or email this list.

 As this is a bugfix release, there are not too many new big-item 
 features to announce, but if you are interested in the bugs fixed since 
 0.3.4, this commit log 
 https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 should 
 give you an idea of the effort put in by our team of backporters.

 This is a recommended upgrade for anyone using any of the previous 
 0.3.x releases, and should act as a drop-in replacement for any of the 
 0.3.x line. We would like to get feedback if someone has a correctly 
 working program that doesn't work after this upgrade.

 Happy Hacking,
 -E




[julia-users] Re: Sort performance depends on Array type in a strange way

2015-01-09 Thread Páll Haraldsson

Hi,

This is my first answer here, I'm not an expert on Julia.. Seems tuple is 
slow. It's more general, 

On my machine this beats Python:

function sort_Pair()
  gc(); @time temp = rand(500_000)
  gc(); @time temp2 = [Pair(temp[i],i) for i=1:length(temp)]
  gc(); @time sort!(temp2); println(typeof(temp2))
end

julia @time sort_pair()
elapsed time: 0.006823427 seconds (488 bytes allocated)
elapsed time: 0.035921609 seconds (31991872 bytes allocated)
elapsed time: 1.975542283 seconds (448 bytes allocated)
Array{Pair,1}
elapsed time: 2.20708157 seconds (40892612 bytes allocated, 7.46% gc time)

compared to (or 2.7 sec total in Python):

julia @time sort_any()
elapsed time: 0.006287604 seconds (488 bytes allocated)
elapsed time: 0.047933539 seconds (35991872 bytes allocated)
elapsed time: 5.989875809 seconds (191154832 bytes allocated)
Array{Any,1}
elapsed time: 6.247331383 seconds (231803748 bytes allocated, 2.76% gc time)


I used:

type Pair
  x
  y
end

import Base.isless

function isless(a, b)
  if a.x  b.x
true
  elseif a.x == b.x  a.y  b.y
true
  else
false
  end
end

You can maybe think of a tuple as a type, but I'm not sure where to look 
for code for it nor looked into the profiler (use @profile, not @time). A 
tuple can of course be a 2-tupel (pair), 3-tuple, etc. And I could change 
the function for each case, just not sure how I would make my own type that 
would handle n-tuples.. Julia does that and maybe just has to be optimized. 
Maybe in 0.4 it is..

Types in Julia are supposed to be abstraction-free, but included tuples 
seem to have a 231803748/40892612 = 5.6 times overhead compared to my Pair 
judging by the memory allocations.

-- 
Palli.

On Friday, January 9, 2015 at 10:06:30 AM UTC, Andras Niedermayer wrote:



 The performance of the sort algorithm varies largely with the element type 
 of an Array, in an unexpected (at least for me) way. Sorting time is 
 ordered like this: Vector{(Any,Any)}  Vector{Any}  
 Vector{(Float64,Int64}). Is this a bug or is this behavior intended? Here's 
 the code:

 ---

 julia function sort_floatint_tuple()
  temp = rand(500_000)
  temp2 = (Float64,Int64)[(temp[i],i) for i=1:length(temp)]
  sort!(temp2)
end
 sort_floatint_tuple (generic function with 1 method)

 julia gc(); @time sort_floatint_tuple();
 elapsed time: 5.371570706 seconds (2187115768 bytes allocated, 44.77% gc 
 time)

 julia gc(); @time sort_floatint_tuple();
 elapsed time: 7.522759215 seconds (2184593304 bytes allocated, 57.48% gc 
 time)

 julia function sort_any_tuple()
  temp = rand(500_000)
  temp2 = (Any,Any)[(temp[i],i) for i=1:length(temp)]
  sort!(temp2)
end
 sort_any_tuple (generic function with 1 method)

 julia gc(); @time sort_any_tuple();
 elapsed time: 2.705974449 seconds (526135400 bytes allocated, 23.32% gc 
 time)

 julia gc(); @time sort_any_tuple();
 elapsed time: 3.215082563 seconds (523241560 bytes allocated, 37.72% gc 
 time)

 julia function sort_any()
  temp = rand(500_000)
  temp2 = Any[(temp[i],i) for i=1:length(temp)]
  sort!(temp2)
end
 sort_any (generic function with 1 method)

 julia gc(); @time sort_any();
 elapsed time: 3.591829528 seconds (231327824 bytes allocated, 6.01% gc 
 time)

 julia gc(); @time sort_any();
 elapsed time: 3.932805966 seconds (231203560 bytes allocated, 12.54% gc 
 time)

 ---


 Python is much faster here:
 ---
 %timeit  temp=np.random.rand(50); temp2=zip(temp,range(len(temp))); 
 temp2.sort()
 1 loops, best of 3: 1.33 s per loop

 ---

 PS: Type inference gives Vector{(Float64,Int64)} if I write the for 
 comprehension in a function and Vector{(Any,Any)} if I run it outside of a 
 function.

 PPS: After looking at this in detail, I found out that sortperm would 
 have been a better option for this. But it is still surprising to me that 
 losing type information ((Any,Any) instead of (Float64,Int64)) speeds up 
 the code.



Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Michael Hatherly


Hi Jan,

If you run into any problems or have any suggestions for improvements feel 
free to open an issue in the Docile repo.

— Mike
​

On Friday, 9 January 2015 16:49:53 UTC+2, Ján Dolinský wrote:

 Thanks a lot. I'll check it out.

 Jan

 Dňa piatok, 9. januára 2015 10:53:10 UTC+1 Tim Holy napísal(-a):

 If you're running julia 0.3, see the Docile package. If you're running 
 julia 
 0.4, there's some in-progress documentation here: 
 https://github.com/JuliaLang/julia/pull/9447 

 --Tim 

 On Friday, January 09, 2015 12:41:33 AM Ján Dolinský wrote: 
  Hi, 
  
  I would like to know how to write a help (comment) text e.g. for a 
 module 
  function so that once module is loaded it is displayed if in REPL help 
 mode. 
  E.g. for sum function 
  help?sum 
  displays brief help text for sum 
  
  Thanks, 
  Jan 



Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Petr Krysl
Actually, I realized that  the example shows the same problem, but for a 
different function. This time the allocation occurs  in the function 
CALLING getconn!.

P

On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote:

 Tim,

 Your explanation is very helpful.  There is a complication though:
 The function is actually called from another  function (from a chain of 
 functions). Here is the measurement from a simplified situation:

 - using JFFoundationModule 
 - using FESetModule 
 -  
 - n=100; 
 - function test(n) 
 0 fes=FESetH8(conn=rand(JFInt,n,
 8)) 
   112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1); 
   6383704 for j=1:size(fes.conn,1) 
 0 getconn!(fes,conn1,j); 
 - end 
 0 return true 
 - end 
 -  
 - test(n) 
 - clear_malloc_data() 
 - n=10; 
 - test(n) 

 As you can see the loop over the rows of the array fes.conn allocates 
 substantial amount of memory.

 Here is the type: 
 https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e

 Petr



Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Petr Krysl
Tim,

Your explanation is very helpful.  There is a complication though:
The function is actually called from another  function (from a chain of 
functions). Here is the measurement from a simplified situation:

- using JFFoundationModule 
- using FESetModule 
-  
- n=100; 
- function test(n) 
0 fes=FESetH8(conn=rand(JFInt,n,
8)) 
  112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1); 
  6383704 for j=1:size(fes.conn,1) 
0 getconn!(fes,conn1,j); 
- end 
0 return true 
- end 
-  
- test(n) 
- clear_malloc_data() 
- n=10; 
- test(n) 

As you can see the loop over the rows of the array fes.conn allocates 
substantial amount of memory.

Here is the type: https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e

Petr



Re: [julia-users] Re: Where is documentation on { } notation for creating an Array(Any,1) ??

2015-01-09 Thread Ivar Nesje
Yes, but he is looking at the 0.4 documentation,  so naturally he won't find it 
there. Try the 0.3 documentation. 

Re: [julia-users] Installing packages system-wide

2015-01-09 Thread Ján Dolinský
In addition, I assume if JULIA_PKGDIR is identical for all users that 
everyone installs packages in the same directory (if they can write to it) 
which is not desired in my situation. There should be some system-wide 
packages available and then a user should be still able to install packages 
individually.

Jan 

Dňa štvrtok, 8. januára 2015 16:13:40 UTC+1 Tim Holy napísal(-a):

 There's a second way to install system-wide (at least, on Unix): set the 
 environment variable JULIA_PKGDIR for all users. If you do it that way, 
 tab 
 completion works. 

 Still, it would be nice if tab completion also worked with LOAD_PATH. Care 
 to 
 open an issue about that? 

 --Tim 

 On Thursday, January 08, 2015 07:08:32 AM Ján Dolinský wrote: 
  I noticed that if packages are installed system-wide than 
 auto-completion 
  for a regular user does not work e.g. typing 
  julia using Arr 
  will not auto-complete Arr (after pressing the Tab key) to 
 ArrayViews. 
  This is not the case if packages are installed in user's home directory. 
 Is 
  there any fix for this ? 
  
  Thanks, 
  Jan 
  
  Dňa streda, 10. decembra 2014 16:28:15 UTC+1 Stefan Karpinski 
 napísal(-a): 
   There's a Julia variable called LOAD_PATH that is arranged to point at 
 two 
   system directories under your julia installation. E.g.: 
   
   julia LOAD_PATH 
   
   2-element Array{Union(ASCIIString,UTF8String),1}: 
/opt/julia-0.3.3/usr/local/share/julia/site/v0.3 
/opt/julia-0.3.3/usr/share/julia/site/v0.3 
   
   If you install packages under either of those directories, then 
 everyone 
   using that Julia will see them. One way to do this is to run julia as 
 a 
   user who can write to those directories after doing `export 
   JULIA_PKGDIR=/opt/julia-0.3.3/usr/share/julia/site` in the shell. That 
 way 
   Julia will use that as it's package directory and normal package 
 commands 
   will allow you to install packages for everyone. Or you can just copy 
 your 
   installed packages and change the ownership and permissions so that 
   everyone can access the files. 
   
   On Wed, Dec 10, 2014 at 8:16 AM, Ján Dolinský jan.do...@2bridgz.com 
   
   javascript: wrote: 
   Hello, 
   
   I'd like to ask how to install Julia packages system-wide so that 
 users 
   do not have to install packages individually on their own but rather 
 just 
   once by an admin. 
   
   Thanks, 
   Jan 



Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Tim Holy
BTW, all that is (briefly) described here:
http://docs.julialang.org/en/latest/manual/profile/#memory-allocation-analysis

Petr, if you nevertheless found my more detailed explanation useful, please 
weave it into the documentation and submit a pull request (click-and-edit 
instructions here: 
https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md#improving-documentation)

--Tim

On Thursday, January 08, 2015 10:38:03 PM Andreas Noack wrote:
 Im not sure, but I don't think this allocation is of the same kind as the
 global variable issue from last mail. Sometimes allocation in connection
 with the arguments or the function it self is written in front of the first
 code line in the function whatever that is. You could try to insert a dummy
 line, e.g. tmp = 1 before the loop and see if the allocation moves to that
 line.
 
 2015-01-08 22:34 GMT-05:00 Petr Krysl krysl.p...@gmail.com:
  Sorry:  I forgot that  this function got called thousands of times.  I
  guess in that case calling the size()  function  might result in some
  allocation which would then get magnified by the number of calls.  (Am I
  on
  the right track?)
  
  On Thursday, January 8, 2015 at 7:19:52 PM UTC-8, Petr Krysl wrote:
  Andreas,,
  
  Good point about the global scope. What I was  really trying to
  
  understand was  this observation:
  - function getconn!{T:FESet}(self::T,conn::JFIntMat,j::JFInt)

5959808 for i=1:size(self.conn,2)

  0 conn[i]=self.conn[j,i];
  - end
  0 return self
  - end
  
  Isn't  the size  here in  the local context, and also  of a definite
  type?
  
  Petr
  
  On Thursday, January 8, 2015 at 7:09:35 PM UTC-8, Andreas Noack wrote:
  The reason is the usual global variable problem. Because n is global the
  type is not inferred well and the loop is therefore not well optimized.
  This doesn't happen in local scope e.g.
  
  julia let
  
 m = 100
 
 @allocated for i = 1:m end
 
 end
  
  0
  
  and it can also be avoided if you specify the type in the loop range
  
  julia @allocated for i = 1:n::Int
  
 end
  
  0
  
  2015-01-08 22:02 GMT-05:00 Petr Krysl krysl...@gmail.com:
  julia a=rand(100);
  
  julia n=length(a);
  
  julia @allocated for j=1:n
  
 end
  
  63983688
  
  64 MB to run this loop?  Is that expected?
  
  Thanks for any insight.
  
  Petr



[julia-users] Re: MPI.jl issue

2015-01-09 Thread Viral Shah
How about trying out some other MPI library? Mac support may vary across 
multiple open source implementations.

-viral

On Thursday, January 8, 2015 at 9:28:21 PM UTC+5:30, Amit Murthy wrote:

 Hello,

 On a Ubuntu 14.10 system, I am having trouble getting MPI.jl up and 
 running.

 The deps build goes through fine, but fails on running tests with the 
 following error:

 amitm@amitm-macbookpro:~/.julia/v0.4/MPI/test$ mpirun -np 4 julia 
 test_bcast.jl 


 WARNING: deprecated syntax {a=b, ...} at /home/amitm/.julia/v0.4/MPI/
 src/mpi-base.jl:19.
 Use Dict{Any,Any}(a=b, ...) instead.


 .
 Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion `ptr 
 == alloc_last_block' failed!

 




 systeminfo:

   | | |_| | | | (_| |  |  Version 0.4.0-dev+2558 (2015-01-08 07:21 UTC)
  _/ |\__'_|_|_|\__'_|  |  Commit 2bb647a (0 days old master)
 |__/   |  x86_64-linux-gnu


 It is actually a MacbookPro running Ubuntu.


 FWIW, it works fine on a different Ubuntu 14.04 Core i5 system.

   Amit



Re: [julia-users] MPI.jl issue

2015-01-09 Thread Viral Shah
Oops - realized that you are running in fact in linux. Sorry - ignore my 
comment then. Could it be a julia issue, or some MPI call that is not being 
used correctly and is corrupting memory?

-viral



 On 09-Jan-2015, at 3:18 pm, Viral Shah vi...@mayin.org wrote:
 
 How about trying out some other MPI library? Mac support may vary across 
 multiple open source implementations.
 
 -viral
 
 On Thursday, January 8, 2015 at 9:28:21 PM UTC+5:30, Amit Murthy wrote:
 Hello,
 
 On a Ubuntu 14.10 system, I am having trouble getting MPI.jl up and running.
 
 The deps build goes through fine, but fails on running tests with the 
 following error:
 
 amitm@amitm-macbookpro:~/.julia/v0.4/MPI/test$ mpirun -np 4 julia 
 test_bcast.jl 
 
 
 WARNING: deprecated syntax {a=b, ...} at 
 /home/amitm/.julia/v0.4/MPI/src/mpi-base.jl:19.
 Use Dict{Any,Any}(a=b, ...) instead.
 
 
 .
 Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion `ptr 
 == alloc_last_block' failed!
 
 
 
 
 
 
 systeminfo:
 
   | | |_| | | | (_| |  |  Version 0.4.0-dev+2558 (2015-01-08 07:21 UTC)
  _/ |\__'_|_|_|\__'_|  |  Commit 2bb647a (0 days old master)
 |__/   |  x86_64-linux-gnu
 
 
 It is actually a MacbookPro running Ubuntu.
 
 
 FWIW, it works fine on a different Ubuntu 14.04 Core i5 system.
 
   Amit
 



Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Tim Holy
arg, the hazards of replying to a big batch of emails without checking what's 
come in since the initial check...
--Tim

On Friday, January 09, 2015 01:26:55 AM ele...@gmail.com wrote:
 On Friday, January 9, 2015 at 7:08:03 PM UTC+10, Ivar Nesje wrote:
  Compat.jl doesn't have doc, but there is a package that is reported to do
  this for 0.3. I think it was Doctile.jl, but I might remember wrong.
 
 See https://github.com/JuliaLang/julia/pull/9447 for first pass at
 documentation.
 
 Cheers
 Lex



[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?

2015-01-09 Thread Nils Gudat
That's a nice feature to know about, but it seems to suffer from the 
problem that it doesn't scale with the rest of the graph if one uses the 
zoom functionality (i.e. the circles don't stay in position relative to the 
graph if you change the display of the graph). 


Re: [julia-users] Installing packages system-wide

2015-01-09 Thread Ján Dolinský
Hi,

Thanks for the tip. How do I open an issue about this problem ?

Jan

Dňa štvrtok, 8. januára 2015 16:13:40 UTC+1 Tim Holy napísal(-a):

 There's a second way to install system-wide (at least, on Unix): set the 
 environment variable JULIA_PKGDIR for all users. If you do it that way, 
 tab 
 completion works. 

 Still, it would be nice if tab completion also worked with LOAD_PATH. Care 
 to 
 open an issue about that? 

 --Tim 

 On Thursday, January 08, 2015 07:08:32 AM Ján Dolinský wrote: 
  I noticed that if packages are installed system-wide than 
 auto-completion 
  for a regular user does not work e.g. typing 
  julia using Arr 
  will not auto-complete Arr (after pressing the Tab key) to 
 ArrayViews. 
  This is not the case if packages are installed in user's home directory. 
 Is 
  there any fix for this ? 
  
  Thanks, 
  Jan 
  
  Dňa streda, 10. decembra 2014 16:28:15 UTC+1 Stefan Karpinski 
 napísal(-a): 
   There's a Julia variable called LOAD_PATH that is arranged to point at 
 two 
   system directories under your julia installation. E.g.: 
   
   julia LOAD_PATH 
   
   2-element Array{Union(ASCIIString,UTF8String),1}: 
/opt/julia-0.3.3/usr/local/share/julia/site/v0.3 
/opt/julia-0.3.3/usr/share/julia/site/v0.3 
   
   If you install packages under either of those directories, then 
 everyone 
   using that Julia will see them. One way to do this is to run julia as 
 a 
   user who can write to those directories after doing `export 
   JULIA_PKGDIR=/opt/julia-0.3.3/usr/share/julia/site` in the shell. That 
 way 
   Julia will use that as it's package directory and normal package 
 commands 
   will allow you to install packages for everyone. Or you can just copy 
 your 
   installed packages and change the ownership and permissions so that 
   everyone can access the files. 
   
   On Wed, Dec 10, 2014 at 8:16 AM, Ján Dolinský jan.do...@2bridgz.com 
   
   javascript: wrote: 
   Hello, 
   
   I'd like to ask how to install Julia packages system-wide so that 
 users 
   do not have to install packages individually on their own but rather 
 just 
   once by an admin. 
   
   Thanks, 
   Jan 



Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Mauro
A help/doc system is in place in 0.4 (unstable) which allows to do that
(although no documentation about it yet...).  It has not been backported
to 0.3 (yet?).  But I guess you could use Compat.jl and start
documenting and have it all in place once 0.4 is released.

On Fri, 2015-01-09 at 09:41, Ján Dolinský jan.dolin...@2bridgz.com wrote:
 Hi,

 I would like to know how to write a help (comment) text e.g. for a module 
 function so that once module is loaded it is displayed if in REPL help mode.
 E.g. for sum function
 help?sum
 displays brief help text for sum

 Thanks,
 Jan 



Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Ivar Nesje
Compat.jl doesn't have doc, but there is a package that is reported to do this 
for 0.3. I think it was Doctile.jl, but I might remember wrong.

Re: [julia-users] Re: Where is documentation on { } notation for creating an Array(Any,1) ??

2015-01-09 Thread Ivar Nesje
See 
https://github.com/JuliaLang/julia/commit/be0f0dafa798c26279f4ece2f70afa9fc078772c

Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Tim Holy
It's just an artifact of calling the function from the REPL. If that function 
is called from another function, you won't see that.

It might help if you understand how `--track-allocation` works: each time you 
get to a new line of code, you ask julia's memory allocator how much memory 
has been allocated since that last time you checked. With `--track-
allocation=user`, you only check when you are inside user code. So when you 
go back and forth between the REPL and your functions, your functions are 
getting blamed for anything that happens in the code that runs the REPL. If 
you place the call to your function inside another function (one that perhaps 
also does the looping to call your function many times), then you shift the 
REPL-blame higher up the call chain, and you'll see that `getconn!` is 
clean.

When you see confusing things like this, another approach is to insert some 
trivial statement, e.g., `dummy = 0`, as the first line of a function.

--Tim

On Thursday, January 08, 2015 10:38:03 PM Andreas Noack wrote:
 Im not sure, but I don't think this allocation is of the same kind as the
 global variable issue from last mail. Sometimes allocation in connection
 with the arguments or the function it self is written in front of the first
 code line in the function whatever that is. You could try to insert a dummy
 line, e.g. tmp = 1 before the loop and see if the allocation moves to that
 line.
 
 2015-01-08 22:34 GMT-05:00 Petr Krysl krysl.p...@gmail.com:
  Sorry:  I forgot that  this function got called thousands of times.  I
  guess in that case calling the size()  function  might result in some
  allocation which would then get magnified by the number of calls.  (Am I
  on
  the right track?)
  
  On Thursday, January 8, 2015 at 7:19:52 PM UTC-8, Petr Krysl wrote:
  Andreas,,
  
  Good point about the global scope. What I was  really trying to
  
  understand was  this observation:
  - function getconn!{T:FESet}(self::T,conn::JFIntMat,j::JFInt)

5959808 for i=1:size(self.conn,2)

  0 conn[i]=self.conn[j,i];
  - end
  0 return self
  - end
  
  Isn't  the size  here in  the local context, and also  of a definite
  type?
  
  Petr
  
  On Thursday, January 8, 2015 at 7:09:35 PM UTC-8, Andreas Noack wrote:
  The reason is the usual global variable problem. Because n is global the
  type is not inferred well and the loop is therefore not well optimized.
  This doesn't happen in local scope e.g.
  
  julia let
  
 m = 100
 
 @allocated for i = 1:m end
 
 end
  
  0
  
  and it can also be avoided if you specify the type in the loop range
  
  julia @allocated for i = 1:n::Int
  
 end
  
  0
  
  2015-01-08 22:02 GMT-05:00 Petr Krysl krysl...@gmail.com:
  julia a=rand(100);
  
  julia n=length(a);
  
  julia @allocated for j=1:n
  
 end
  
  63983688
  
  64 MB to run this loop?  Is that expected?
  
  Thanks for any insight.
  
  Petr



Re: [julia-users] Installing packages system-wide

2015-01-09 Thread Tim Holy
On Friday, January 09, 2015 12:34:12 AM Ján Dolinský wrote:
 Hi,
 
 Thanks for the tip. How do I open an issue about this problem ?

https://github.com/JuliaLang/julia, then click on the Issues link near the 
top-right. It's a kindness to busy developers to first search to see if your 
issue has been reported previously (I haven't done so for this problem, so 
please do).

--Tim

 
 Jan
 
 Dňa štvrtok, 8. januára 2015 16:13:40 UTC+1 Tim Holy napísal(-a):
  There's a second way to install system-wide (at least, on Unix): set the
  environment variable JULIA_PKGDIR for all users. If you do it that way,
  tab
  completion works.
  
  Still, it would be nice if tab completion also worked with LOAD_PATH. Care
  to
  open an issue about that?
  
  --Tim
  
  On Thursday, January 08, 2015 07:08:32 AM Ján Dolinský wrote:
   I noticed that if packages are installed system-wide than
  
  auto-completion
  
   for a regular user does not work e.g. typing
   julia using Arr
   will not auto-complete Arr (after pressing the Tab key) to
  
  ArrayViews.
  
   This is not the case if packages are installed in user's home directory.
  
  Is
  
   there any fix for this ?
   
   Thanks,
   Jan
   
   Dňa streda, 10. decembra 2014 16:28:15 UTC+1 Stefan Karpinski
  
  napísal(-a):
There's a Julia variable called LOAD_PATH that is arranged to point at
  
  two
  
system directories under your julia installation. E.g.:

julia LOAD_PATH

2-element Array{Union(ASCIIString,UTF8String),1}:
 /opt/julia-0.3.3/usr/local/share/julia/site/v0.3
 /opt/julia-0.3.3/usr/share/julia/site/v0.3

If you install packages under either of those directories, then
  
  everyone
  
using that Julia will see them. One way to do this is to run julia as
  
  a
  
user who can write to those directories after doing `export
JULIA_PKGDIR=/opt/julia-0.3.3/usr/share/julia/site` in the shell. That
  
  way
  
Julia will use that as it's package directory and normal package
  
  commands
  
will allow you to install packages for everyone. Or you can just copy
  
  your
  
installed packages and change the ownership and permissions so that
everyone can access the files.

On Wed, Dec 10, 2014 at 8:16 AM, Ján Dolinský jan.do...@2bridgz.com

javascript: wrote:
Hello,

I'd like to ask how to install Julia packages system-wide so that
  
  users
  
do not have to install packages individually on their own but rather
  
  just
  
once by an admin.

Thanks,
Jan



[julia-users] Sort performance depends on Array type in a strange way

2015-01-09 Thread Andras Niedermayer


The performance of the sort algorithm varies largely with the element type 
of an Array, in an unexpected (at least for me) way. Sorting time is 
ordered like this: Vector{(Any,Any)}  Vector{Any}  
Vector{(Float64,Int64}). Is this a bug or is this behavior intended? Here's 
the code:

---

julia function sort_floatint_tuple()
 temp = rand(500_000)
 temp2 = (Float64,Int64)[(temp[i],i) for i=1:length(temp)]
 sort!(temp2)
   end
sort_floatint_tuple (generic function with 1 method)

julia gc(); @time sort_floatint_tuple();
elapsed time: 5.371570706 seconds (2187115768 bytes allocated, 44.77% gc 
time)

julia gc(); @time sort_floatint_tuple();
elapsed time: 7.522759215 seconds (2184593304 bytes allocated, 57.48% gc 
time)

julia function sort_any_tuple()
 temp = rand(500_000)
 temp2 = (Any,Any)[(temp[i],i) for i=1:length(temp)]
 sort!(temp2)
   end
sort_any_tuple (generic function with 1 method)

julia gc(); @time sort_any_tuple();
elapsed time: 2.705974449 seconds (526135400 bytes allocated, 23.32% gc 
time)

julia gc(); @time sort_any_tuple();
elapsed time: 3.215082563 seconds (523241560 bytes allocated, 37.72% gc 
time)

julia function sort_any()
 temp = rand(500_000)
 temp2 = Any[(temp[i],i) for i=1:length(temp)]
 sort!(temp2)
   end
sort_any (generic function with 1 method)

julia gc(); @time sort_any();
elapsed time: 3.591829528 seconds (231327824 bytes allocated, 6.01% gc time)

julia gc(); @time sort_any();
elapsed time: 3.932805966 seconds (231203560 bytes allocated, 12.54% gc 
time)

---


Python is much faster here:
---
%timeit  temp=np.random.rand(50); temp2=zip(temp,range(len(temp))); 
temp2.sort()
1 loops, best of 3: 1.33 s per loop

---

PS: Type inference gives Vector{(Float64,Int64)} if I write the for 
comprehension in a function and Vector{(Any,Any)} if I run it outside of a 
function.

PPS: After looking at this in detail, I found out that sortperm would 
have been a better option for this. But it is still surprising to me that 
losing type information ((Any,Any) instead of (Float64,Int64)) speeds up 
the code.


[julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Ján Dolinský
Hi,

I would like to know how to write a help (comment) text e.g. for a module 
function so that once module is loaded it is displayed if in REPL help mode.
E.g. for sum function
help?sum
displays brief help text for sum

Thanks,
Jan 


Re: [julia-users] Re: Where is documentation on { } notation for creating an Array(Any,1) ??

2015-01-09 Thread elextr


On Friday, January 9, 2015 at 6:02:21 PM UTC+10, Ivar Nesje wrote:

 Yes, but he is looking at the 0.4 documentation,  so naturally he won't 
 find it there. Try the 0.3 documentation.


Its in http://docs.julialang.org/en/latest/stdlib/punctuation/#punctuation 
in both 0.3 and 0.4 docs, so 0.4 indeed needs to remove it.

Cheers
Lex 


Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Tim Holy
If you're running julia 0.3, see the Docile package. If you're running julia 
0.4, there's some in-progress documentation here:
https://github.com/JuliaLang/julia/pull/9447

--Tim

On Friday, January 09, 2015 12:41:33 AM Ján Dolinský wrote:
 Hi,
 
 I would like to know how to write a help (comment) text e.g. for a module
 function so that once module is loaded it is displayed if in REPL help mode.
 E.g. for sum function
 help?sum
 displays brief help text for sum
 
 Thanks,
 Jan



Re: [julia-users] numpy vs julia benchmarking for random matrix-vector multiplication

2015-01-09 Thread Tim Holy
There's already a certain amount of automatic bounds-checking removal, but it 
does that only when it can prove that it's safe. It's not hard to cook up 
situations where the compiler can't do that.

See also the `--check-bounds` command line option for starting julia.

--Tim

On Thursday, January 08, 2015 07:19:36 PM Joshua Adelman wrote:
 Hi Steven,
 
 I added your version (vander3) to my benchmark and updated the IJulia
 notebook:
 
 http://nbviewer.ipython.org/gist/synapticarbors/26910166ab775c04c47b
 
 As you mentioned it's a lot faster than the other version I wrote and evens
 out the underperformance vs numpy for the larger arrays on my machine. The
 @inbounds macro makes a small difference, but not dramatic. One of the
 things that I wonder is if there would be interest in having a way of
 globally turning off bounds checking either at the function level or
 module/file level, similar to cython's decorators and file-level compiler
 directives.
 
 Josh
 
 On Thursday, January 8, 2015 at 4:36:52 PM UTC-5, Steven G. Johnson wrote:
  For comparison, the NumPy vander function
  
  
  https://github.com/numpy/numpy/blob/f4be1039d6fe3e4fdc157a22e8c071ac106519
  97/numpy/lib/twodim_base.py#L490-L577
  
  does all its work in multiply.accumulate.   Here is the outer loop of
  multiply.accumulate (written in C):
  
  
  https://github.com/numpy/numpy/blob/3b22d87050ab63db0dcd2d763644d924a69c52
  54/numpy/core/src/umath/ufunc_object.c#L2936-L3264
  
  and the inner loops (I think) are generated from this source file for
  various numeric types:
  
  
  https://github.com/numpy/numpy/blob/3b22d87050ab63db0dcd2d763644d924a69c52
  54/numpy/core/src/umath/loops.c.src
  
  A quick glance at these will tell you the price in code complexity that
  NumPy is paying for the performance they manage to get.



[julia-users] startswith not defined

2015-01-09 Thread Tim Wheeler
When I try to use the startswith 
http://julia.readthedocs.org/en/latest/stdlib/strings/ function Julia 
cannot locate it. endswith seems to work fine. Am I doing something wrong?

Thanks!

   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.4 (2014-10-21 20:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
|__/   |  x86_64-linux-gnu

julia startswith(asdfas, asd)
ERROR: startswith not defined

julia startswith
ERROR: startswith not defined

julia endswith(blah, ah)
true


[julia-users] Re: Vector Fields in Julia

2015-01-09 Thread Jake Bolewski
PyPlot can do this, see the documentation for Matplotlib.

On Friday, January 9, 2015 at 1:38:24 PM UTC-5, Pileas wrote:

 Hi all,

 I was wondering how one can make vector fields in Julia similar to those 
 in Matlab. To put it simple, is there any intrinsic routine that does the 
 job or should we program it from scratch?

 Matlab example here: 
 http://www.mathworks.com/help/symbolic/mupad_ref/plot-vectorfield2d.html

 Thank you



[julia-users] Re: Adding Compose circles/lines/polygons to Gadfly plots?

2015-01-09 Thread Daniel Jones
Fixed in master now. Thanks for pointing that out.

On Friday, January 9, 2015 at 2:22:46 AM UTC-8, Nils Gudat wrote:

 That's a nice feature to know about, but it seems to suffer from the 
 problem that it doesn't scale with the rest of the graph if one uses the 
 zoom functionality (i.e. the circles don't stay in position relative to the 
 graph if you change the display of the graph). 



Re: [julia-users] Installing packages system-wide

2015-01-09 Thread Daniel Høegh
I have made a pull-request on it. See 
https://github.com/JuliaLang/julia/pull/9699

[julia-users] Julia v0.3.5

2015-01-09 Thread Elliot Saba
Hello all!  The latest bugfix release of the 0.3.x Julia line has been
released.  Binaries are available from the usual place
http://julialang.org/downloads/, and as is typical with such things,
please report all issues to either the issue tracker
https://github.com/JuliaLang/julia/issues, or email this list.

As this is a bugfix release, there are not too many new big-item features
to announce, but if you are interested in the bugs fixed since 0.3.4, this
commit log https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 should
give you an idea of the effort put in by our team of backporters.

This is a recommended upgrade for anyone using any of the previous 0.3.x
releases, and should act as a drop-in replacement for any of the 0.3.x
line. We would like to get feedback if someone has a correctly working
program that doesn't work after this upgrade.

Happy Hacking,
-E


Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Tim Holy
I wonder if your `size` function isn't returning an Int, or that the compiler 
can't infer that. Did you try this on julia 0.4 with @code_warntype?

--Tim

On Friday, January 09, 2015 08:06:43 AM Petr Krysl wrote:
 Actually, I realized that  the example shows the same problem, but for a
 different function. This time the allocation occurs  in the function
 CALLING getconn!.
 
 P
 
 On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote:
  Tim,
  
  Your explanation is very helpful.  There is a complication though:
  The function is actually called from another  function (from a chain of
  
  functions). Here is the measurement from a simplified situation:
  - using JFFoundationModule
  - using FESetModule
  -
  - n=100;
  - function test(n)
  0 fes=FESetH8(conn=rand(JFInt,n,
  
  8))
  
112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1);

6383704 for j=1:size(fes.conn,1)

  0 getconn!(fes,conn1,j);
  - end
  0 return true
  - end
  -
  - test(n)
  - clear_malloc_data()
  - n=10;
  - test(n)
  
  As you can see the loop over the rows of the array fes.conn allocates
  substantial amount of memory.
  
  Here is the type:
  https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e
  
  Petr



[julia-users] Vector Fields in Julia

2015-01-09 Thread Pileas
Hi all,

I was wondering how one can make vector fields in Julia similar to those in 
Matlab. To put it simple, is there any intrinsic routine that does the job 
or should we program it from scratch?

Matlab example 
here: http://www.mathworks.com/help/symbolic/mupad_ref/plot-vectorfield2d.html

Thank you


[julia-users] Re: startswith not defined

2015-01-09 Thread Simon Kornblith
You probably want beginswith, which was recently renamed to startswith but 
only in Julia 0.4. (Make sure you look at the appropriate docs 
http://julia.readthedocs.org/en/release-0.3/stdlib/strings/ for Julia 
0.3; there's a version selector in the bottom right.) You can also use the 
Compat package, which makes startswith available on Julia 0.3.

On Friday, January 9, 2015 at 1:44:29 PM UTC-5, Tim Wheeler wrote:

 When I try to use the startswith 
 http://julia.readthedocs.org/en/latest/stdlib/strings/ function Julia 
 cannot locate it. endswith seems to work fine. Am I doing something wrong?

 Thanks!

_   _ _(_)_ |  A fresh approach to technical computing
   (_) | (_) (_)|  Documentation: http://docs.julialang.org
_ _   _| |_  __ _   |  Type help() for help.
   | | | | | | |/ _` |  |
   | | |_| | | | (_| |  |  Version 0.3.4 (2014-10-21 20:18 UTC)
  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
 |__/   |  x86_64-linux-gnu

 julia startswith(asdfas, asd)
 ERROR: startswith not defined

 julia startswith
 ERROR: startswith not defined

 julia endswith(blah, ah)
 true



[julia-users] Re: Julia v0.3.5

2015-01-09 Thread Pileas
Looking forward for the Linux version!

Τη Παρασκευή, 9 Ιανουαρίου 2015 - 2:11:13 μ.μ. UTC-5, ο χρήστης Elliot Saba 
έγραψε:

 Hello all!  The latest bugfix release of the 0.3.x Julia line has been 
 released.  Binaries are available from the usual place 
 http://julialang.org/downloads/, and as is typical with such things, 
 please report all issues to either the issue tracker 
 https://github.com/JuliaLang/julia/issues, or email this list.

 As this is a bugfix release, there are not too many new big-item features 
 to announce, but if you are interested in the bugs fixed since 0.3.4, this 
 commit log https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 
 should 
 give you an idea of the effort put in by our team of backporters.

 This is a recommended upgrade for anyone using any of the previous 0.3.x 
 releases, and should act as a drop-in replacement for any of the 0.3.x 
 line. We would like to get feedback if someone has a correctly working 
 program that doesn't work after this upgrade.

 Happy Hacking,
 -E



Re: [julia-users] MPI.jl issue

2015-01-09 Thread Amit Murthy
The other closest explanation is here -
https://code.google.com/p/chromium/issues/detail?id=31809#c31 . Though, I
still don't know what to fix to get MPI.jl up and running on my system

On Fri, Jan 9, 2015 at 5:53 PM, Amit Murthy amit.mur...@gmail.com wrote:

 A google search for that error all showed up issues related to either a)
 cross-compiling or b) memory allocated by one library being
 freed/realloc'ed by another. Issue -
 https://github.com/JuliaParallel/MPI.jl/issues/25

 On Fri, Jan 9, 2015 at 3:20 PM, Viral Shah vi...@mayin.org wrote:

 Oops - realized that you are running in fact in linux. Sorry - ignore my
 comment then. Could it be a julia issue, or some MPI call that is not being
 used correctly and is corrupting memory?

 -viral



  On 09-Jan-2015, at 3:18 pm, Viral Shah vi...@mayin.org wrote:
 
  How about trying out some other MPI library? Mac support may vary
 across multiple open source implementations.
 
  -viral
 
  On Thursday, January 8, 2015 at 9:28:21 PM UTC+5:30, Amit Murthy wrote:
  Hello,
 
  On a Ubuntu 14.10 system, I am having trouble getting MPI.jl up and
 running.
 
  The deps build goes through fine, but fails on running tests with the
 following error:
 
  amitm@amitm-macbookpro:~/.julia/v0.4/MPI/test$ mpirun -np 4 julia
 test_bcast.jl
 
 
  WARNING: deprecated syntax {a=b, ...} at
 /home/amitm/.julia/v0.4/MPI/src/mpi-base.jl:19.
  Use Dict{Any,Any}(a=b, ...) instead.
 
 
  .
  Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion
 `ptr == alloc_last_block' failed!
 
  
 
 
 
 
  systeminfo:
 
| | |_| | | | (_| |  |  Version 0.4.0-dev+2558 (2015-01-08 07:21 UTC)
   _/ |\__'_|_|_|\__'_|  |  Commit 2bb647a (0 days old master)
  |__/   |  x86_64-linux-gnu
 
 
  It is actually a MacbookPro running Ubuntu.
 
 
  FWIW, it works fine on a different Ubuntu 14.04 Core i5 system.
 
Amit
 





[julia-users] Problems understanding the usage of SharedArrays

2015-01-09 Thread Nils Gudat
Sorry for asking the umptiest question on parallelization, but I can't seem 
to get even the most basic calculations to run, so here's hoping someone 
can enlighten me.
I'd like to make an interpolant created with Dierckx available on all my 
processors. I figured this would be possible using SharedArrays in the 
following way:

addprocs(3)

@everywhere using Dierckx

xgrid = linspace(0.1, 100.0, 200)

f_val = [xgrid[i]^(-0.25) for i in length(xgrid)]

convert(SharedArray, xgrid)
convert(SharedArray, f_val)

@everywhere interpolant = Spline1D(xgrid, f_val)


However, this attempt fails with two errors (or six, two for each core):

Spline1D has not method matching Spline1D(::SharedArray{Float64, 1}, 
::SharedArray{Float64, 1})

and

xgrid_irr not defined

I have a question on each:
1. How can I use SharedArrays in functions that don't have a method for 
them? 
2. Why would xgrid not be defined on the other cores? My understanding from 
reading the SharedArray part 
http://julia.readthedocs.org/en/latest/manual/parallel-computing/#shared-arrays-experimental
 of 
the documentation was that their whole purpose is to make an array 
available to all cores?

Any hints or tips would be greatly appreciated!


Re: [julia-users] Problems understanding the usage of SharedArrays

2015-01-09 Thread Tim Holy
1. You (or someone) needs to write those methods. Since the Spline1D function 
is defined in the Dierckx package, that's where the SharedArray version should 
go, too (if you don't just maintain it on your own).

2. After
convert(SharedArray, xgrid)
xgrid will still be an ordinary array. You've not captured the output of the 
convert function.

--Tim

On Friday, January 09, 2015 08:33:20 AM Nils Gudat wrote:
 Sorry for asking the umptiest question on parallelization, but I can't seem
 to get even the most basic calculations to run, so here's hoping someone
 can enlighten me.
 I'd like to make an interpolant created with Dierckx available on all my
 processors. I figured this would be possible using SharedArrays in the
 following way:
 
 addprocs(3)
 
 @everywhere using Dierckx
 
 xgrid = linspace(0.1, 100.0, 200)
 
 f_val = [xgrid[i]^(-0.25) for i in length(xgrid)]
 
 convert(SharedArray, xgrid)
 convert(SharedArray, f_val)
 
 @everywhere interpolant = Spline1D(xgrid, f_val)
 
 
 However, this attempt fails with two errors (or six, two for each core):
 
 Spline1D has not method matching Spline1D(::SharedArray{Float64, 1},
 
 ::SharedArray{Float64, 1})
 
 and
 
 xgrid_irr not defined
 
 I have a question on each:
 1. How can I use SharedArrays in functions that don't have a method for
 them?
 2. Why would xgrid not be defined on the other cores? My understanding from
 reading the SharedArray part
 http://julia.readthedocs.org/en/latest/manual/parallel-computing/#shared-ar
 rays-experimental of the documentation was that their whole purpose is to
 make an array available to all cores?
 
 Any hints or tips would be greatly appreciated!



[julia-users] Re: string literals split to multilines?

2015-01-09 Thread Ismael VC
Note that in Python if there is whitespace after the `\` it will be an 
error:

In [1]: s = 'one\
  File ipython-input-1-270c132ab6d9, line 1
s = 'one\
  ^
SyntaxError: EOL while scanning string literal

I think it's safer to just use the implicit string literal concatenation 
and implicit line continuation:

In [2]: s = (
   ...: 'one'
   ...: 'two'
   ...: 'tree'
   ...: )

In [3]: s
Out[3]: 'onetwotree'

Which lets you order the strings with the desired indentation level, 
without forcing you to write them flush to the left, as in your example.

El martes, 6 de enero de 2015, 4:15:13 (UTC-6), Andreas Lobinger escribió:

 Hello colleagues,

 is there a counterpart for the string literal split to multiple lines like 
 in python?

 d = '09ab\
 eff1\
 a2a4'

 Wishing a happy day,
Andreas



[julia-users] working with dense parallel matrices

2015-01-09 Thread Francis Poulin
Hello,

I am very new to Julia and trying to learn how to do some very basic linear 
algebra in parallel.  

As a simple example I wanted to be able to define a dense matrix in 
parallel and then multiply it to a vector.  

I have seen how this works in mpi4py at the following tutorial

http://mpi4py.scipy.org/docs/usrman/tutorial.html

and am wondering how this can be accomplished in julia.  I did find a 
number of posts that discussed how to do this with sparse matrices, which 
seems more complicated than it should be.

I did read about distributed arrays and that seems like it should be able 
to do something along these lines but I didn't seen any examples and am 
unsure of the syntax.  Is this the best direction to go or is there 
something else I should be looking into?

I am sorry for asking such a simple question but would appreciate any 
assistance.

Cheers, Francis



Re: [julia-users] How can I achieve C-like ## in Julia

2015-01-09 Thread Josh Langsfeld
https://github.com/JuliaLang/julia/pull/9700

On Thursday, January 8, 2015 at 10:29:20 AM UTC-5, Josh Langsfeld wrote:

 Thanks, I might do that sometime in the next few days if I can make it 
 look a bit nicer.

 On Wednesday, January 7, 2015 4:24:32 PM UTC-5, Ivar Nesje wrote:

 The problem is where we should stop adding methods to allow symbols to 
 work as strings. 

 * might be fine though, so please submit your code as a pull request, so 
 we can get more opinions on the matter. (Be sure to link to this discussion 
 and to post a link to the PR here)



[julia-users] Strange random NaN's

2015-01-09 Thread Peter Brady
I'm using julia-0.3.3 installed via yum on Fedora 21 (I saw similar 
behavior on Fedora 20 as well) and I'm encountering behavior I can't 
explain.  I haven't been able to come up with a simple reproducible case 
because this weirdness with NaN's appears to be non-deterministic and 
restarting my julia kernel fixes the problem more often than not but I'm 
hoping that someone can shed some light on what's going on.

Here's the relevant part of my notebook session (I apologize for the 
strange formatting):


anynan{T}(x::Array{T}) = any(isnan, x)

anynan (generic function with 3 methods)



typeof(rkvar2.w.f1), typeof(rkvar2.sol), typeof(rkvar2.w.rk2)

(Array{Float64,2},Array{Float64,2},Array{Float64,2})



anynan(rkvar2.w.f1), minimum(rkvar2.w.f1), maximum(rkvar2.w.f1)

(false,-1.1317244376193704e-5,5.1067129405671126e-5)



anynan(rkvar2.sol), minimum(rkvar2.sol), maximum(rkvar2.sol)

(false,-2.789562122325811e-7,4.2592881099528343e-7)



rkvar2.w.rk2[:,:] = rkvar2.sol + 0.5t.dt*rkvar.w.f1

241x241 Array{Float64,2}:
  3.38286e-48   1.52057e-48  -9.05314e-48  …   1.52057e-48   3.38286e-48
  1.52057e-48  -8.61345e-48  -3.74648e-47 -8.61345e-48   1.52057e-48
 -9.05314e-48  -3.74648e-47  -9.55565e-47 -3.74648e-47  -9.05314e-48
 -3.83165e-47  -9.43884e-47  -1.73654e-46 -9.43884e-47  -3.83165e-47
 -9.57104e-47  -1.7154e-46   -2.02324e-46 -1.7154e-46   -9.57104e-47
 -1.73204e-46  -2.02326e-46   2.34406e-47  …  -2.02326e-46  -1.73204e-46
 -2.05281e-46   7.70356e-48   9.17989e-46  7.70356e-48  -2.05281e-46
 -1.58991e-48   8.52933e-46   3.06846e-45  8.52933e-46  -1.58991e-48
  8.2321e-462.89897e-45   6.82077e-45  2.89897e-45   8.2321e-46 
  2.8249e-456.51202e-45   1.10477e-44  6.51202e-45   2.8249e-45 
  6.38329e-45   1.07416e-44   1.06454e-44  …   1.07416e-44   6.38329e-45
  1.06528e-44   1.10276e-44  -7.09009e-45  1.10276e-44   1.06528e-44
  1.13985e-44  -4.18965e-45  -6.50745e-44 -4.18965e-45   1.13985e-44
  ⋮⋱ ⋮  
  1.06528e-44   1.10276e-44  -7.09009e-45  1.10276e-44   1.06528e-44
  6.38329e-45   1.07416e-44   1.06454e-44  …   1.07416e-44   6.38329e-45
  2.8249e-456.51202e-45   1.10477e-44  6.51202e-45   2.8249e-45 
  8.2321e-462.89897e-45   6.82077e-45  2.89897e-45   8.2321e-46 
 -1.58991e-48   8.52933e-46   3.06846e-45  8.52933e-46  -1.58991e-48
 -2.05281e-46   7.70356e-48   9.17989e-46  7.70356e-48  -2.05281e-46
 -1.73204e-46  -2.02326e-46   2.34406e-47  …  -2.02326e-46  -1.73204e-46
 -9.57104e-47  -1.7154e-46   -2.02324e-46 -1.7154e-46   -9.57104e-47
 -3.83165e-47  -9.43884e-47  -1.73654e-46 -9.43884e-47  -3.83165e-47
 -9.05314e-48  -3.74648e-47  -9.55565e-47 -3.74648e-47  -9.05314e-48
  1.52057e-48  -8.61345e-48  -3.74648e-47 -8.61345e-48   1.52057e-48
  3.38286e-48   1.52057e-48  -9.05314e-48  …   1.52057e-48   3.38286e-48




anynan(rkvar2.w.rk2)

true



anynan(rkvar2.sol + 0.5t.dt*rkvar.w.f1)

true


0.5t.dt

0.005001


anynan(rkvar2.sol + rkvar.w.f1)

true



idx2d(find(isnan(rkvar2.w.rk2)), rkvar2.w.rk2)

([(122,86),(125,87)],[NaN,NaN])



i, j = 122, 86
rkvar2.w.rk2[i,j]

NaN


rkvar2.w.rk2[i,j] = rkvar2.sol[i,j] + 0.5t.dt*rkvar2.w.f1[i,j]

0.0



for jj=1:size(rkvar2.sol, 2), ii=1:size(rkvar2.sol,1)
rkvar2.w.rk2[ii,jj] = rkvar2.sol[ii,jj] + 0.5t.dt*rkvar2.w.f1[ii,jj]
end
rkvar2.w.rk2[i,j]

0.0


Where are these NaN's coming from?  In the actual code that's failing the 
updates are written using @nloops and @nref but I'm still getting NaN's. 
 Any ideas on what I can do?

thanks,
Peter.



[julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?

2015-01-09 Thread Steven G. Johnson
See the manual on how to use git from behind a firewall:

 http://docs.julialang.org/en/latest/manual/packages/

In particular, you can run

 git config --global url.https://.insteadOf git://

to tell git to use https instead of git protocol, in order to work with 
your firewall.


Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?

2015-01-09 Thread John Hall
I've seen both the git manual and the https/git workaround before. Neither
seem to work. The method for configuring git is also discussed here
https://groups.google.com/forum/#!msg/julia-users/W-H6ZxjXYSI/RWnc6bk6e-EJ
and tried running
C:\Julia-0.3.4\Git\cmdgit config --global http.proxy http://[autoproxy
thingy from IE]
C:\Julia-0.3.4\Git\cmdgit config --global http.proxy http://@[autoproxy
thiny from IE]
C:\Julia-0.3.4\Git\cmdgit config --global http.proxy
http://[userid]@[autoproxy
thingy from IE]
and nothing even remotely works. I spent some time on the phone with tech
support and might as well have poked myself in the eye.


On Fri, Jan 9, 2015 at 4:47 PM, Steven G. Johnson stevenj@gmail.com
wrote:

 See the manual on how to use git from behind a firewall:

  http://docs.julialang.org/en/latest/manual/packages/

 In particular, you can run

  git config --global url.https://.insteadOf git://

 to tell git to use https instead of git protocol, in order to work with
 your firewall.



Re: [julia-users] Julia v0.3.5

2015-01-09 Thread Tim Holy
Man, that is an impressive amount of backporting in just a few weeks. You guys 
are amazing.

--Tim

On Friday, January 09, 2015 11:10:30 AM Elliot Saba wrote:
 Hello all!  The latest bugfix release of the 0.3.x Julia line has been
 released.  Binaries are available from the usual place
 http://julialang.org/downloads/, and as is typical with such things,
 please report all issues to either the issue tracker
 https://github.com/JuliaLang/julia/issues, or email this list.
 
 As this is a bugfix release, there are not too many new big-item features
 to announce, but if you are interested in the bugs fixed since 0.3.4, this
 commit log https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5
 should give you an idea of the effort put in by our team of backporters.
 
 This is a recommended upgrade for anyone using any of the previous 0.3.x
 releases, and should act as a drop-in replacement for any of the 0.3.x
 line. We would like to get feedback if someone has a correctly working
 program that doesn't work after this upgrade.
 
 Happy Hacking,
 -E



[julia-users] Re: startswith not defined

2015-01-09 Thread Tim Wheeler
Yes, that was it. Thank you

On Friday, January 9, 2015 at 11:04:17 AM UTC-8, Simon Kornblith wrote:

 You probably want beginswith, which was recently renamed to startswith but 
 only in Julia 0.4. (Make sure you look at the appropriate docs 
 http://julia.readthedocs.org/en/release-0.3/stdlib/strings/ for Julia 
 0.3; there's a version selector in the bottom right.) You can also use the 
 Compat package, which makes startswith available on Julia 0.3.

 On Friday, January 9, 2015 at 1:44:29 PM UTC-5, Tim Wheeler wrote:

 When I try to use the startswith 
 http://julia.readthedocs.org/en/latest/stdlib/strings/ function Julia 
 cannot locate it. endswith seems to work fine. Am I doing something wrong?

 Thanks!

_   _ _(_)_ |  A fresh approach to technical computing
   (_) | (_) (_)|  Documentation: http://docs.julialang.org
_ _   _| |_  __ _   |  Type help() for help.
   | | | | | | |/ _` |  |
   | | |_| | | | (_| |  |  Version 0.3.4 (2014-10-21 20:18 UTC)
  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org release
 |__/   |  x86_64-linux-gnu

 julia startswith(asdfas, asd)
 ERROR: startswith not defined

 julia startswith
 ERROR: startswith not defined

 julia endswith(blah, ah)
 true



Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Tim Holy
On Friday, January 09, 2015 11:51:15 AM Petr Krysl wrote:
 The size() function is from the base. fes.conn is a 2D array of ints.

No it's not, it's a JFIntMat :-). But seriously, _you_ might know that 
corresponds to a 2D array of ints, but the key question is if you've given 
enough information in your declaration of JFIntMat for the _compiler_ to know 
that.

Bottom line is that the behavior you're observing isn't normal. It's also 
extremely unlikely to be a bug in julia, because we do this kind of stuff all 
over julia without the kind of allocations you're observing. So it's almost 
certainly something in your code. @code_warntype is your best way of finding 
out.

--Tim

 
 P
 
 On Friday, January 9, 2015 at 11:25:34 AM UTC-8, Tim Holy wrote:
  I wonder if your `size` function isn't returning an Int, or that the
  compiler
  can't infer that. Did you try this on julia 0.4 with @code_warntype?
  
  --Tim
  
  On Friday, January 09, 2015 08:06:43 AM Petr Krysl wrote:
   Actually, I realized that  the example shows the same problem, but for a
   different function. This time the allocation occurs  in the function
   CALLING getconn!.
   
   P
   
   On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote:
Tim,

Your explanation is very helpful.  There is a complication though:
The function is actually called from another  function (from a chain
  
  of
  
functions). Here is the measurement from a simplified situation:
- using JFFoundationModule
- using FESetModule
-
- n=100;
- function test(n)
0 fes=FESetH8(conn=rand(JFInt,n,

8))

  112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1);
  
  6383704 for j=1:size(fes.conn,1)
  
0 getconn!(fes,conn1,j);
- end
0 return true
- end
-
- test(n)
- clear_malloc_data()
- n=10;
- test(n)

As you can see the loop over the rows of the array fes.conn allocates
substantial amount of memory.

Here is the type:
https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e

Petr



Re: [julia-users] Why is memory allocated to run loop?

2015-01-09 Thread Andreas Noack
Sometimes Julia can have problems inferring the type of fields of types
which is what conn is. Using @code_warntype as suggested by Tim could give
an indication if it is the case.

2015-01-09 14:51 GMT-05:00 Petr Krysl krysl.p...@gmail.com:

 The size() function is from the base. fes.conn is a 2D array of ints.

 P


 On Friday, January 9, 2015 at 11:25:34 AM UTC-8, Tim Holy wrote:

 I wonder if your `size` function isn't returning an Int, or that the
 compiler
 can't infer that. Did you try this on julia 0.4 with @code_warntype?

 --Tim

 On Friday, January 09, 2015 08:06:43 AM Petr Krysl wrote:
  Actually, I realized that  the example shows the same problem, but for
 a
  different function. This time the allocation occurs  in the function
  CALLING getconn!.
 
  P
 
  On Friday, January 9, 2015 at 8:03:00 AM UTC-8, Petr Krysl wrote:
   Tim,
  
   Your explanation is very helpful.  There is a complication though:
   The function is actually called from another  function (from a chain
 of
  
   functions). Here is the measurement from a simplified situation:
   - using JFFoundationModule
   - using FESetModule
   -
   - n=100;
   - function test(n)
   0 fes=FESetH8(conn=rand(JFInt,n,
  
   8))
  
 112 conn1::JFIntMat=zeros(JFInt,nfense(fes),1);
  
 6383704 for j=1:size(fes.conn,1)
  
   0 getconn!(fes,conn1,j);
   - end
   0 return true
   - end
   -
   - test(n)
   - clear_malloc_data()
   - n=10;
   - test(n)
  
   As you can see the loop over the rows of the array fes.conn allocates
   substantial amount of memory.
  
   Here is the type:
   https://gist.github.com/PetrKryslUCSD/794f521a8e5b057e5e4e
  
   Petr




Re: [julia-users] Problems understanding the usage of SharedArrays

2015-01-09 Thread Kyle Barbary
Hi Nils,

We could add a SharedArray method to the Dierckx methods as Tim suggests,
perhaps by changing the signatures from Vector{Float64} to
Union(Vector{Float64},
SharedArray{Float64, 1}).

I’ve never really used SharedArrays myself, but an easier option might be
to use the sdata function. For example, the following works for me:

xgrid = convert(SharedArray, linspace(0.1, 100., 200))

fval = convert(SharedArray, Float64[xgrid[i]^(-0.25) for i in 1:length(xgrid)])

spl = Spline1D(sdata(xgrid), sdata(fval))

Best,
Kyle
​

On Fri, Jan 9, 2015 at 11:47 AM, Tim Holy tim.h...@gmail.com wrote:

 1. You (or someone) needs to write those methods. Since the Spline1D
 function
 is defined in the Dierckx package, that's where the SharedArray version
 should
 go, too (if you don't just maintain it on your own).

 2. After
 convert(SharedArray, xgrid)
 xgrid will still be an ordinary array. You've not captured the output of
 the
 convert function.

 --Tim

 On Friday, January 09, 2015 08:33:20 AM Nils Gudat wrote:
  Sorry for asking the umptiest question on parallelization, but I can't
 seem
  to get even the most basic calculations to run, so here's hoping someone
  can enlighten me.
  I'd like to make an interpolant created with Dierckx available on all my
  processors. I figured this would be possible using SharedArrays in the
  following way:
 
  addprocs(3)
 
  @everywhere using Dierckx
 
  xgrid = linspace(0.1, 100.0, 200)
 
  f_val = [xgrid[i]^(-0.25) for i in length(xgrid)]
 
  convert(SharedArray, xgrid)
  convert(SharedArray, f_val)
 
  @everywhere interpolant = Spline1D(xgrid, f_val)
 
 
  However, this attempt fails with two errors (or six, two for each core):
 
  Spline1D has not method matching Spline1D(::SharedArray{Float64, 1},
 
  ::SharedArray{Float64, 1})
 
  and
 
  xgrid_irr not defined
 
  I have a question on each:
  1. How can I use SharedArrays in functions that don't have a method for
  them?
  2. Why would xgrid not be defined on the other cores? My understanding
 from
  reading the SharedArray part
  
 http://julia.readthedocs.org/en/latest/manual/parallel-computing/#shared-ar
  rays-experimental of the documentation was that their whole purpose is
 to
  make an array available to all cores?
 
  Any hints or tips would be greatly appreciated!




[julia-users] REQUIRES and a specific branch?

2015-01-09 Thread Seth
I find myself frequently using features in other packages that haven't been 
tagged yet. Is there a way to specify in REQUIRES that, say, the master 
branch of the package should be used instead of the latest tagged version? 
This way others, including Travis and Coveralls, can get the correct 
functionality until the maintainers create a new tag for the required 
package.


Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?

2015-01-09 Thread Steven G. Johnson
On Friday, January 9, 2015 at 4:56:29 PM UTC-5, John Hall wrote:

 I've seen both the git manual and the https/git workaround before. Neither 
 seem to work. 


If you do git clone manually from the command line with an https or http 
URL, does it work?  It would be good to diagnose the specific problem.


[julia-users] Re: Julia v0.3.5

2015-01-09 Thread cdm

yeah ...

that parenthetical has
been static since at
least version 0.3.3

curious ...



On Friday, January 9, 2015 at 3:06:29 PM UTC-8, ele...@gmail.com wrote:

 Thank you all the people who bring these updates.

 One question, the versioninfo() for theJulia release on the Ubuntu PPA 
 says:

 Version 0.3.5
 Commit 21d5433* (2014-10-21 20:18 UTC)

 The commit and date/time hasn't changed.

 Cheers
 Lex

 On Saturday, January 10, 2015 at 5:11:13 AM UTC+10, Elliot Saba wrote:

 Hello all!  The latest bugfix release of the 0.3.x Julia line has been 
 released.  Binaries are available from the usual place 
 http://julialang.org/downloads/, and as is typical with such things, 
 please report all issues to either the issue tracker 
 https://github.com/JuliaLang/julia/issues, or email this list.

 As this is a bugfix release, there are not too many new big-item 
 features to announce, but if you are interested in the bugs fixed since 
 0.3.4, this commit log 
 https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 should give 
 you an idea of the effort put in by our team of backporters.

 This is a recommended upgrade for anyone using any of the previous 0.3.x 
 releases, and should act as a drop-in replacement for any of the 0.3.x 
 line. We would like to get feedback if someone has a correctly working 
 program that doesn't work after this upgrade.

 Happy Hacking,
 -E



Re: [julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?

2015-01-09 Thread John Hall
Tried before. Doesn't work.

On Fri, Jan 9, 2015 at 5:23 PM, Steven G. Johnson stevenj@gmail.com
wrote:

 On Friday, January 9, 2015 at 4:56:29 PM UTC-5, John Hall wrote:

 I've seen both the git manual and the https/git workaround before.
 Neither seem to work.


 If you do git clone manually from the command line with an https or http
 URL, does it work?  It would be good to diagnose the specific problem.



Re: [julia-users] Re: Julia v0.3.5

2015-01-09 Thread Elliot Saba
We noticed that as well
https://github.com/JuliaLang/julia/commit/a05f87b79ad62beb033817fdfdefa270c9557aaf.
An `apt-get update  apt-get upgrade` should fix it.
-E

On Fri, Jan 9, 2015 at 3:15 PM, cdm cdmclean@gmail.com wrote:


 yeah ...

 that parenthetical has
 been static since at
 least version 0.3.3

 curious ...



 On Friday, January 9, 2015 at 3:06:29 PM UTC-8, ele...@gmail.com wrote:

 Thank you all the people who bring these updates.

 One question, the versioninfo() for theJulia release on the Ubuntu PPA
 says:

 Version 0.3.5
 Commit 21d5433* (2014-10-21 20:18 UTC)

 The commit and date/time hasn't changed.

 Cheers
 Lex

 On Saturday, January 10, 2015 at 5:11:13 AM UTC+10, Elliot Saba wrote:

 Hello all!  The latest bugfix release of the 0.3.x Julia line has been
 released.  Binaries are available from the usual place
 http://julialang.org/downloads/, and as is typical with such things,
 please report all issues to either the issue tracker
 https://github.com/JuliaLang/julia/issues, or email this list.

 As this is a bugfix release, there are not too many new big-item
 features to announce, but if you are interested in the bugs fixed since
 0.3.4, this commit log
 https://github.com/JuliaLang/julia/compare/v0.3.4...v0.3.5 should
 give you an idea of the effort put in by our team of backporters.

 This is a recommended upgrade for anyone using any of the previous 0.3.x
 releases, and should act as a drop-in replacement for any of the 0.3.x
 line. We would like to get feedback if someone has a correctly working
 program that doesn't work after this upgrade.

 Happy Hacking,
 -E




[julia-users] Re: I cannot reach GitHub because of a firewall at work, how do I install Gadfly?

2015-01-09 Thread John Hall
My issue is that same as the OPs, but I'm trying to install NLopt.jl rather 
than Gadfly. I perennially have this issue with Python files, but it seems 
that I've had better luck getting stuff to work manually with Python than 
Julia. 

Pkg.init() doesn't work for me. 

I first looked in the require file for NLopt. It has BinDeps and 
MathProgBase 0.3.0 0.4.0-. BinDeps requires URIParser and SHA. So my .julia 
folder contains each of those .zip files and the unzipped folders that 
include the directories. However, when I try to start with the ones without 
dependencies, I run
require(MathProgBase) 
then I get an error about it not being found. I tried a bunch of variations 
on this (and following the first answer on 
http://stackoverflow.com/questions/14092316/simplest-ways-to-make-a-julia-package-available-to-others)
 
without much luck.

On Tuesday, November 26, 2013 at 1:07:30 PM UTC-5, Connor Johnson wrote:

 Aha! I am on the trail. I called Pkg.init() from the Julia command line 
 interpreter, is that what you meant? At any rate, it gave me an error about 
 a failed process, which I think is due to the firewall. I went ahead and 
 made a .julia directroy in the directory output by `homedir()` as you 
 suggested, and I got a dependency error instead of a process error, so 
 that's good news.

 Thanks for your help!

 On Tuesday, November 26, 2013 11:28:58 AM UTC-6, Connor Johnson wrote:

 I saw on stackoverflow 
 http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F14092316%2Fsimplest-ways-to-make-a-julia-package-available-to-otherssa=Dsntz=1usg=AFQjCNGf-64GBqjIckQilbXbAUq-Ns7dBA
  
 that I could `require` a package that was placed in `.julia/`, so I 
 downloaded the Gadfly zip file from GitHub manually, and then started 
 putting it different places in my C:\julia directory, and tried to 
 `require` it from the command line, but to no avail. Is there a way to 
 install packages manually like you do in Python with `python setup.py 
 install`?

 I am using Windows 7 (because I'm at work), and Pkg.add(Gadfly) won't 
 work because of a firewall or something. (I can use Invoke-WebRequest via 
 Windows PowerShell, but I can't use pip, the Python installer for some 
 reason.)

 Thanks!



[julia-users] Re: QZ Decomposition Reordering

2015-01-09 Thread Chase Coleman
See this pull request https://github.com/JuliaLang/julia/pull/9701, it 
will hopefully provide this functionality

On Friday, October 10, 2014 at 5:16:30 PM UTC-4, Ricardo Mayer wrote:

 Can the schurfact(A,B) function reorder its output such that generalized 
 eigenvalues appear in descending (or ascending) magnitude order?

 I'm thinking on something like MATLAB's ordqz or R's ordqz (in QZ 
 package). 

 I'm really new to Julia (installed it just a few minutes ago, actually), 
 but as far as I can tell there is no select  option for this function.

 best,
 Ricardo




Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread elextr


On Friday, January 9, 2015 at 7:08:03 PM UTC+10, Ivar Nesje wrote:

 Compat.jl doesn't have doc, but there is a package that is reported to do 
 this for 0.3. I think it was Doctile.jl, but I might remember wrong.


See https://github.com/JuliaLang/julia/pull/9447 for first pass at 
documentation.

Cheers
Lex 


[julia-users] Re: How to create a composite type of function pointers

2015-01-09 Thread J Luis
No, unfortunately changing to immutable does no good either.
The problem originally is that I get a 'no method' error in this code

@show typeof(cd_canvas)
@show methods(cdCanvasActivate)
cdCanvasActivate(cd_canvas);

which prints

typeof(cd_canvas) = Ptr{cdCanvas}
methods(cdCanvasActivate) = # 1 method for generic function 
cdCanvasActivate:
cdCanvasActivate(canvas::Ptr{cdCanvas}) at 
C:\programs\Gits\IUP.jl\src\libcd.jl:278
ERROR: `cdCanvasActivate` has no method matching 
cdCanvasActivate(::Ptr{cdCanvas})

I have once crossed a similar situation that turned out to be due to the 
type being defined in two files, but multiple-checked and that's not the 
case here.
Actually the error is not restricted to this cdCanvasActivate() function 
but happens with any function that has the same signature. Hence my 
suspicious with cdCanvas Type.
 

quinta-feira, 8 de Janeiro de 2015 às 23:40:47 UTC, J Luis escreveu:

 Hi,

 I need to convert a structure of function pointers into a composite type. 
 The struct looks like this

 struct cdCanvas {
   void   (*cxPixel)(cdCtxCanvas* ctxcanvas, int x, int y, long color);
   void   (*cxLine)(cdCtxCanvas* ctxcanvas, int x1, int y1, int x2, int y2);
   void   (*cxPoly)(cdCtxCanvas* ctxcanvas, int mode, cdPoint* points, int 
 n);
 ...

 used Clang.jl but it converted it to

 type cdCanvas
 cxPixel::Ptr{Void}
 cxLine::Ptr{Void}
 cxPoly::Ptr{Void}
 ...

 which is not correct (ccall crash when using this type), but I don't know 
 either how to write it manually.

 Any advise?

 Thanks



[julia-users] Re: How to create a composite type of function pointers

2015-01-09 Thread J Luis
No shit (well, nice) I fall in the same trap again. It turns up that the 
file where cdCanvas is declared was included twice and so I apparently had 
two declarations of cdCanvas. Once I fixed this situation the program runs 
fine but this is  a hell of a slippery ground.

quinta-feira, 8 de Janeiro de 2015 às 23:40:47 UTC, J Luis escreveu:

 Hi,

 I need to convert a structure of function pointers into a composite type. 
 The struct looks like this

 struct cdCanvas {
   void   (*cxPixel)(cdCtxCanvas* ctxcanvas, int x, int y, long color);
   void   (*cxLine)(cdCtxCanvas* ctxcanvas, int x1, int y1, int x2, int y2);
   void   (*cxPoly)(cdCtxCanvas* ctxcanvas, int mode, cdPoint* points, int 
 n);
 ...

 used Clang.jl but it converted it to

 type cdCanvas
 cxPixel::Ptr{Void}
 cxLine::Ptr{Void}
 cxPoly::Ptr{Void}
 ...

 which is not correct (ccall crash when using this type), but I don't know 
 either how to write it manually.

 Any advise?

 Thanks



Re: [julia-users] MPI.jl issue

2015-01-09 Thread Amit Murthy
A google search for that error all showed up issues related to either a)
cross-compiling or b) memory allocated by one library being
freed/realloc'ed by another. Issue -
https://github.com/JuliaParallel/MPI.jl/issues/25

On Fri, Jan 9, 2015 at 3:20 PM, Viral Shah vi...@mayin.org wrote:

 Oops - realized that you are running in fact in linux. Sorry - ignore my
 comment then. Could it be a julia issue, or some MPI call that is not being
 used correctly and is corrupting memory?

 -viral



  On 09-Jan-2015, at 3:18 pm, Viral Shah vi...@mayin.org wrote:
 
  How about trying out some other MPI library? Mac support may vary across
 multiple open source implementations.
 
  -viral
 
  On Thursday, January 8, 2015 at 9:28:21 PM UTC+5:30, Amit Murthy wrote:
  Hello,
 
  On a Ubuntu 14.10 system, I am having trouble getting MPI.jl up and
 running.
 
  The deps build goes through fine, but fails on running tests with the
 following error:
 
  amitm@amitm-macbookpro:~/.julia/v0.4/MPI/test$ mpirun -np 4 julia
 test_bcast.jl
 
 
  WARNING: deprecated syntax {a=b, ...} at
 /home/amitm/.julia/v0.4/MPI/src/mpi-base.jl:19.
  Use Dict{Any,Any}(a=b, ...) instead.
 
 
  .
  Inconsistency detected by ld.so: dl-minimal.c: 136: realloc: Assertion
 `ptr == alloc_last_block' failed!
 
  
 
 
 
 
  systeminfo:
 
| | |_| | | | (_| |  |  Version 0.4.0-dev+2558 (2015-01-08 07:21 UTC)
   _/ |\__'_|_|_|\__'_|  |  Commit 2bb647a (0 days old master)
  |__/   |  x86_64-linux-gnu
 
 
  It is actually a MacbookPro running Ubuntu.
 
 
  FWIW, it works fine on a different Ubuntu 14.04 Core i5 system.
 
Amit
 




Re: [julia-users] How to define help text for a module function so that it displays in REPL

2015-01-09 Thread Ján Dolinský
Thanks a lot. I'll check it out.

Jan

Dňa piatok, 9. januára 2015 10:53:10 UTC+1 Tim Holy napísal(-a):

 If you're running julia 0.3, see the Docile package. If you're running 
 julia 
 0.4, there's some in-progress documentation here: 
 https://github.com/JuliaLang/julia/pull/9447 

 --Tim 

 On Friday, January 09, 2015 12:41:33 AM Ján Dolinský wrote: 
  Hi, 
  
  I would like to know how to write a help (comment) text e.g. for a 
 module 
  function so that once module is loaded it is displayed if in REPL help 
 mode. 
  E.g. for sum function 
  help?sum 
  displays brief help text for sum 
  
  Thanks, 
  Jan 



Re: [julia-users] Installing packages system-wide

2015-01-09 Thread Ján Dolinský
All right.

Dňa piatok, 9. januára 2015 10:46:54 UTC+1 Tim Holy napísal(-a):

 On Friday, January 09, 2015 12:34:12 AM Ján Dolinský wrote: 
  Hi, 
  
  Thanks for the tip. How do I open an issue about this problem ? 

 https://github.com/JuliaLang/julia, then click on the Issues link near 
 the 
 top-right. It's a kindness to busy developers to first search to see if 
 your 
 issue has been reported previously (I haven't done so for this problem, so 
 please do). 

 --Tim 

  
  Jan 
  
  Dňa štvrtok, 8. januára 2015 16:13:40 UTC+1 Tim Holy napísal(-a): 
   There's a second way to install system-wide (at least, on Unix): set 
 the 
   environment variable JULIA_PKGDIR for all users. If you do it that 
 way, 
   tab 
   completion works. 
   
   Still, it would be nice if tab completion also worked with LOAD_PATH. 
 Care 
   to 
   open an issue about that? 
   
   --Tim 
   
   On Thursday, January 08, 2015 07:08:32 AM Ján Dolinský wrote: 
I noticed that if packages are installed system-wide than 
   
   auto-completion 
   
for a regular user does not work e.g. typing 
julia using Arr 
will not auto-complete Arr (after pressing the Tab key) to 
   
   ArrayViews. 
   
This is not the case if packages are installed in user's home 
 directory. 
   
   Is 
   
there any fix for this ? 

Thanks, 
Jan 

Dňa streda, 10. decembra 2014 16:28:15 UTC+1 Stefan Karpinski 
   
   napísal(-a): 
 There's a Julia variable called LOAD_PATH that is arranged to 
 point at 
   
   two 
   
 system directories under your julia installation. E.g.: 
 
 julia LOAD_PATH 
 
 2-element Array{Union(ASCIIString,UTF8String),1}: 
  /opt/julia-0.3.3/usr/local/share/julia/site/v0.3 
  /opt/julia-0.3.3/usr/share/julia/site/v0.3 
 
 If you install packages under either of those directories, then 
   
   everyone 
   
 using that Julia will see them. One way to do this is to run julia 
 as 
   
   a 
   
 user who can write to those directories after doing `export 
 JULIA_PKGDIR=/opt/julia-0.3.3/usr/share/julia/site` in the shell. 
 That 
   
   way 
   
 Julia will use that as it's package directory and normal package 
   
   commands 
   
 will allow you to install packages for everyone. Or you can just 
 copy 
   
   your 
   
 installed packages and change the ownership and permissions so 
 that 
 everyone can access the files. 
 
 On Wed, Dec 10, 2014 at 8:16 AM, Ján Dolinský 
 jan.do...@2bridgz.com 
 
 javascript: wrote: 
 Hello, 
 
 I'd like to ask how to install Julia packages system-wide so that 
   
   users 
   
 do not have to install packages individually on their own but 
 rather 
   
   just 
   
 once by an admin. 
 
 Thanks, 
 Jan