[julia-users] causes of system crash?

2016-04-10 Thread K leo
These couple weeks I ran julia (0.4.5) on a Xubuntu guest of VirtualBox hosted by a Macbook Pro. During the hour-long runs, the system crashed a few times: user interface froze. This has happened a few times in the past when I ran Julia natively on a Xubuntu computer. So hardware problem can be

[julia-users] Re: causes of system crash?

2016-04-10 Thread Richard Dennis
I get crashes a lot running Julia on Windows when running long simulations. In my case, it seems to be related to @parallel as it does not happen when I take these out and run the program on one core. It happens on both my desktop and my laptop, both Windows machines.

Re: [julia-users] causes of system crash?

2016-04-10 Thread Milan Bouchet-Valat
Le dimanche 10 avril 2016 à 16:25 +0530, K leo a écrit : > These couple weeks I ran julia (0.4.5) on a Xubuntu guest of > VirtualBox hosted by a Macbook Pro.  During the hour-long runs, the > system crashed a few times: user interface froze.  This has happened > a few times in the past when I ran J

[julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
Hi, I am looking for the most efficient (fastest) way to find the indice of the element with the nearest value of a float in an array. x = [1:0.1:10] julia> x 91-element Array{Float64,1}: 1.0 1.1 1.2 1.3 1.4 ⋮ 9.4 9.5 9.6 9.7 9.8 9.9 10.0 It is very easy to find the

Re: [julia-users] Using ImageView leads to libgobject error

2016-04-10 Thread Tim Holy
Seems quite mysterious. To debug, the next thing I'd do is julia> cd(Pkg.dir("ImageView", "src")) and then copy/paste the code that's in src/ImageView.jl into the REPL. (Probably just the part that's inside the `module ImageView ... end`.) Presumably you should get error(s), and the line that t

Re: [julia-users] causes of system crash?

2016-04-10 Thread Tim Holy
When you suspect @inbounds, the much easier approach is to start julia with julia --check-bounds=yes and it will ignore all @inbounds statements. This even affects base julia itself, and is therefore both easier and more thorough. If you identify a BoundsError triggered by one of julia's fu

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Tim Holy
indmin(abs(x-val)) is easy and pretty good, but it does create two temporaries. Faster would be function closest_index(x, val) ibest = start(eachindex(x)) dxbest = abs(x[ibest]-val) for I in eachindex(x) dx = abs(x[I]-val) if dx < dxbest dxbest = dx

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Erik Schnetter
Fred Yes, the fastest way is a loop. (It might be possible to extend e.g. `minimum` by a "predicate" argument, but that would require a change to the base library.) You would write the loop slightly differently, though: ```Julia mini = 0 minx = 0.0 mindx = typemax(Float64) for (i,x) in enumerate(

[julia-users] Re: [ANN] VulkanCore

2016-04-10 Thread Jeffrey Sarnoff
> > One of the more exciting use cases of Vulkan is running Julia kernels over > GPU-Arrays and then seamlessly visualizing the results. > Enabling this will be a lot of work. > It looks like using Vulkan, when ready, it will take less work to get work done. On Saturday, April 9, 2016 at 1:32

[julia-users] Re: Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Ravi S
Not sure which is faster, but here's another way to do it: julia> reduce((x,y)->x[2](x,abs(y-8.22)),1:length(x),x)) (73,0.02135) - Ravi On Sunday, April 10, 2016 at 5:10:07 PM UTC+5:30, Fred wrote: > > Hi, > > I am looking for the most efficient (fastest) way to find the indice of

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Mauro
If your array is sorted, as your example suggests, there maybe faster methods, binary search comes to mind (implemented in searchsorted). Also, if the array is unsorted but you need to look up many values, it might be worth sorting it first. Mauro On Sun, 2016-04-10 at 13:40, Fred wrote: > Hi, >

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
Thank you very much ! I give you the results : my loop solution : 0.000419 seconds (547 allocations: 708.797 KB) 0.02135 -> 73 @time closest_index(x,8.22) 0.03 seconds (4 allocations: 160 bytes) 73 @time for (i,x) in enumerate(array)... 0.000181 seconds (821 allocations: 19.9

[julia-users] cov files not created

2016-04-10 Thread Tamas Papp
Hi, I am just learning about code coverage tools. I thought julia --code-coverage=user --inline=no -e 'Pkg.test("MyPackage")' would put .cov files in Pkg.dir("MyPackage","src") but apparently it doesn't. What should I do differently? (VERSION v"0.4.5", amd64 binaries from website.) Best, Ta

Re: [julia-users] Using ImageView leads to libgobject error

2016-04-10 Thread Colin Beckingham
Ok, I copied and pasted these lines including the "using" commands and the "using Tk" threw the subject line error. I may have muddied the water a bit by not noticing that the first time the "using Tk" is issued the error appears, but if the same command is repeated in the same REPL session it i

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
Thank you very much Mauro ! searchsorted is the simplest solution and one of the fastest but it gives two indices so another comparison is needed to find the closest value : @time searchsorted(x, 8.22) 0.04 seconds (7 allocations: 240 bytes) 74:73 abs(x[73] - 8.22) > abs(x[74] - 8.22) ?

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Steven G. Johnson
On Sunday, April 10, 2016 at 8:30:48 AM UTC-4, Fred wrote: > > my loop solution : > 0.000419 seconds (547 allocations: 708.797 KB) > 0.02135 -> 73 > Probably you are doing this wrong; it shouldn't be allocating so much memory. Is your loop using global variables? Did you remember

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
I tested my loop monre than 2 times as it is written in my post and I have always the same results. The function Tim Holy posted is much faster, I posted the results above :) > Probably you are doing this wrong; it shouldn't be allocating so much > memory. Is your loop using global variables

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Mauro
> I tested my loop monre than 2 times as it is written in my post and I have > always the same results. The function Tim Holy posted is much faster, I > posted the results above :) I seem to recall that your example loop was not in a function(?) If so, that makes it lots slower. >> Probably you

Re: [julia-users] [ANN] VulkanCore

2016-04-10 Thread Tom Breloff
This is really interesting. Thanks Simon! Clean merging of GPGPU and visualization workflows would be awesome. I hope it lives up to your hype! Tom On Sunday, April 10, 2016, Jeffrey Sarnoff wrote: > One of the more exciting use cases of Vulkan is running Julia kernels over >> GPU-Arrays and t

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
That's true ! But why a loop is faster in a function ? :) > > I seem to recall that your example loop was not in a function(?) If so, > that makes it lots slower. > >

Re: [julia-users] causes of system crash?

2016-04-10 Thread K leo
In theory, you are right. In my past case when I ran Julia on native Xubuntu laptop, you argument is really hard to dispute. But this time, it runs in VirtualBox on top of MacBook Pro, and what crashed was not Xubuntu or VirtualBox but the entire MacBook Pro. In this case, you may want to say

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Mauro
On Sun, 2016-04-10 at 15:24, Fred wrote: > That's true ! But why a loop is faster in a function ? :) Check out: http://docs.julialang.org/en/release-0.4/manual/performance-tips/#avoid-global-variables >> >> I seem to recall that your example loop was not in a function(?) If so, >> that makes it

[julia-users] Re: [ANN] VulkanCore

2016-04-10 Thread Eric Forgy
This looks really cool (was one of my first tweets on my new startup's twitter account :)) My world is currently "web". Does Vulkan fit in that world? It is not supported by Apple, so does that mean it does not work in Safari? How about other browsers? If Vulkan doesn't fit well in the "web" w

Re: [julia-users] causes of system crash?

2016-04-10 Thread Tim Holy
If you run long computations on them, some laptops (like mine) suffer from overheating+crash problems. Try the same code on a workstation. Best, --Tim On Sunday, April 10, 2016 06:40:46 AM K leo wrote: > In theory, you are right. > > In my past case when I ran Julia on native Xubuntu laptop, yo

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
Hi, I post here my best solution taking advantage that the array is sorted. I expected to be a lot much faster than other solutions, but not really. I am very impressed by the speed of searchsorted : x = [1:0.1:100] val = 8.22 function dicotomy(x, val) a = start(eachindex(x)) b = lengt

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
Hi, I post here my best solution taking advantage that the array is sorted. I expected that solution to be a lot much faster than other solutions, but not really. Indeed I am very impressed by the speed of searchsorted : x = [1:0.1:100] val = 8.22 function dicotomy(x, val) a = start(eac

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Tim Holy
Even better: get rid of the brackets around 1:0.1:10, and you'll be that much more impressed. --Tim On Sunday, April 10, 2016 07:16:16 AM Fred wrote: > Hi, > > I post here my best solution taking advantage that the array is sorted. I > expected to be a lot much faster than other solutions,

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
Maybe my array is too small to see a difference, but if I increase the size I will lack of RAM ;) julia> x = 1:0.1:100 1.0:0.1:1.0e6 julia> @time searchsorted(x, 8.22) 0.045590 seconds (33.21 k allocations: 1.535 MB) 74:73 julia> @time searchsorted(x, 8.22) 0.05 seconds (8 allocatio

Re: [julia-users] causes of system crash?

2016-04-10 Thread Milan Bouchet-Valat
Le dimanche 10 avril 2016 à 06:40 -0700, K leo a écrit : > In theory, you are right. > > In my past case when I ran Julia on native Xubuntu laptop, you > argument is really hard to dispute.  But this time, it runs in > VirtualBox on top of MacBook Pro, and what crashed was not Xubuntu or > Virtual

Re: [julia-users] Using ImageView leads to libgobject error

2016-04-10 Thread Colin Beckingham
FWIW, my tcl library on openSUSE lives in "/usr/lib64/libtcl8.6.so" which does not match any of the entries in line 6 of file Tk.jl/blob/master/deps/build.jl. Relevant? I have noted in a couple other instances that differences in paths seem to be important, unless Julia decides to load and compi

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Tim Holy
Just FYI: julia> x = 1:0.1:100 1.0:0.1:1.0e6 julia> y = collect(x); # this is the same as y = [x;] julia> sizeof(x) 32 julia> sizeof(y) 7928 --Tim On Sunday, April 10, 2016 07:26:06 AM Fred wrote: > Maybe my array is too small to see a difference, but if I increase the size > I will

Re: [julia-users] Using ImageView leads to libgobject error

2016-04-10 Thread Tim Holy
Yes, probably relevant. Try adding it and then say `Pkg.build("Tk")`. Assuming that succeeds, then `using Tk` should have a high probability of working. --Tim On Sunday, April 10, 2016 08:28:29 AM Colin Beckingham wrote: > FWIW, my tcl library on openSUSE lives in "/usr/lib64/libtcl8.6.so" which

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Fred
A huge size difference ! I have to read my array from data file so I suppose it is like Y and X is only for simulations ? Le dimanche 10 avril 2016 17:50:02 UTC+2, Tim Holy a écrit : > > Just FYI: > > julia> x = 1:0.1:100 > 1.0:0.1:1.0e6 > > julia> y = collect(x); # this is the same as y

Re: [julia-users] Using ImageView leads to libgobject error

2016-04-10 Thread Colin Beckingham
Did not work. I added an entry for tcl and tk on lines 6,7 and ran Pkg.build on Tk. Then I ran Pkg.update() where it refused to update Tk due to dirty which is good, it confirms I edited the right file. For reference here is the full error on "using Tk" INFO: Recompiling stale cache file /home/c

Re: [julia-users] Using ImageView leads to libgobject error

2016-04-10 Thread Colin Beckingham
One other oddity. openSUSE has a libcairo, libgobject and a libcairo-gobject. In cairo deps build.jl I can see references to cairo and gobject, but not to the third. Just looks a bit odd. On Sunday, 10 April 2016 12:25:12 UTC-4, Colin Beckingham wrote: > > Did not work. > I added an entry for tc

Re: [julia-users] Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Tim Holy
On Sunday, April 10, 2016 09:03:06 AM Fred wrote: > A huge size difference ! I have to read my array from data file so I > suppose it is like Y and X is only for simulations ? There turn out to be many situations in which you can take shortcuts if you know the values are sorted in increasing orde

[julia-users] Re: JuliaCon 2016: Keynote speakers

2016-04-10 Thread Waldir Pimenta
Coincidentally, just the other day a video of Guy Steele's keynote "Growing a Language" (from OOPSLA'98) made the rounds online, and while watching it I found myself noticing close parallels between the core message of his talk and the main design d

Re: [julia-users] Is there a way to convert function name to a string?

2016-04-10 Thread Seth
Simpler, perhaps: julia> foo(x) = x + 6 foo (generic function with 1 method) julia> string(foo) "foo" julia> string(foos) # just to show it's not arbitrary ERROR: UndefVarError: foos not defined On Friday, April 8, 2016 at 11:50:45 PM UTC-7, K leo wrote: > > Thanks. I have an array fo

[julia-users] Re: [ANN] VulkanCore

2016-04-10 Thread Cedric St-Jean
I haven't tried GLVisualize - isn't there a problem with high-performance 3D in a stop-the-world GC'ed language like Julia? On Sunday, April 10, 2016 at 9:45:54 AM UTC-4, Eric Forgy wrote: > > This looks really cool (was one of my first tweets on my new startup's > twitter account :)) > > My wor

[julia-users] Re: cov files not created

2016-04-10 Thread Kristoffer Carlsson
Pkg.test spawns a new instance of julia (with its own arguments'). Pkg.test("MyPackage"; coverage=true) should do it. On Sunday, April 10, 2016 at 2:36:46 PM UTC+2, Tamas Papp wrote: > > Hi, > > I am just learning about code coverage tools. I thought > > julia --code-coverage=user --inline=no

[julia-users] [ANN] Cuba.jl: library for multidimensional numerical integration

2016-04-10 Thread Mosè Giordano
Dear all, I am proud to announce Cuba.jl a library for multidimensional numerical integration with four independent algorithms: Vegas, Suave, Divonne, and Cuhre (this algorithm is the same used in Cubature.jl). This package is just a wrapper around Cuba Li

[julia-users] Re: Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread DNF
The big error you made originally is calling collect in every iteration of the loop. Just deleting collect speeds things up by 100x. The lesson is that you should (almost) never use collect. The other lesson is: don't do [1:0.1:10]. It makes your code slower, and very soon your it will stop wor

[julia-users] Re: Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread DNF
I messed up copy-paste here: >> test_dist(1:0.1:10, 8.22, 1) > 0.641741 seconds (1.82 M allocations: 749.817 MB, 7.57% gc time) > 0.007380 seconds > 0.005570 seconds > > It should be (looping 1 times) >> test_dist(1:0.1:10, 8.22, 10^4) 0.641741 seconds (1.82 M allocations: 749.817 MB, 7.57%

[julia-users] Re: Find the indice of the element with the nearest value of a float in an array

2016-04-10 Thread Cedric St-Jean
Am I alone in pining for a predicate version of findmin/findmax et al., or a `by` keyword argument? It would make this code much simpler. On Sunday, April 10, 2016 at 5:34:25 PM UTC-4, DNF wrote: > > > I messed up copy-paste here: > > >> test_dist(1:0.1:10, 8.22, 1) >> 0.641741 seconds (1.82 M a

[julia-users] Fancy integer literals

2016-04-10 Thread Júlio Hoffimann
Today I saw for the first time a code written like: a = 50_000 What is the name of this feature in the docs? -Júlio

Re: [julia-users] Fancy integer literals

2016-04-10 Thread Yichao Yu
On Sun, Apr 10, 2016 at 11:06 PM, Júlio Hoffimann wrote: > Today I saw for the first time a code written like: > > a = 50_000 > > What is the name of this feature in the docs? Right above http://julia.readthedocs.org/en/latest/manual/integers-and-floating-point-numbers/#floating-point-zero `dig

Re: [julia-users] Fancy integer literals

2016-04-10 Thread Júlio Hoffimann
Interesting, thank you Yichao! -Júlio