Re: [julia-users] Re: Does Julia 0.5 leak memory?

2016-09-21 Thread Yichao Yu
On Wed, Sep 21, 2016 at 7:44 PM, K leo wrote: > I am running the 0.5 release now and it behaves in the same way - not > releasing memory. I can't say if this only has to do with 0.5 but not 0.4. > Probably it happened in the same way with 0.4 but I just didn't pay > attention then. > > Since ther

Re: [julia-users] Does Julia 0.5 leak memory?

2016-09-21 Thread Yichao Yu
On Mon, Sep 19, 2016 at 9:14 PM, Luke Stagner wrote: > I actually ran into this issue too. I have a routine that calculates fast > ion orbits that uses a lot of memory (90%). Here is the code (sorry its not > very clean). I tried to run the function `make_distribution_file` in a loop > in julia b

Re: [julia-users] Does Julia 0.5 leak memory?

2016-09-21 Thread Yichao Yu
On Wed, Sep 21, 2016 at 8:50 PM, Yichao Yu wrote: > On Mon, Sep 19, 2016 at 9:14 PM, Luke Stagner wrote: >> I actually ran into this issue too. I have a routine that calculates fast >> ion orbits that uses a lot of memory (90%). Here is the code (sorry its not >> very clean)

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

2016-09-21 Thread Yichao Yu
On Wed, Sep 21, 2016 at 9:29 PM, Erik Schnetter wrote: > On Wed, Sep 21, 2016 at 9:22 PM, Chris Rackauckas > wrote: >> >> I'm not seeing `@fastmath` apply fma/muladd. I rebuilt the sysimg and now >> I get results where g and h apply muladd/fma in the native code, but a new >> function k which is

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

2016-09-21 Thread Yichao Yu
On Wed, Sep 21, 2016 at 9:33 PM, Yichao Yu wrote: > On Wed, Sep 21, 2016 at 9:29 PM, Erik Schnetter wrote: >> On Wed, Sep 21, 2016 at 9:22 PM, Chris Rackauckas >> wrote: >>> >>> I'm not seeing `@fastmath` apply fma/muladd. I rebuilt the sysimg and now

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

2016-09-21 Thread Yichao Yu
ation (this is not a llvm ir optimization pass) to do this is llc options -mcpu=haswell and function attribute unsafe-fp-math=true. > > -erik > > On Wed, Sep 21, 2016 at 9:33 PM, Yichao Yu wrote: >> >> On Wed, Sep 21, 2016 at 9:29 PM, Erik Schnetter >> wrote: &g

Re: [julia-users] Does Julia 0.5 leak memory?

2016-09-21 Thread Yichao Yu
s.jl fixed the > issue for me. And good to know it's fixed. > > K Leo, if you are using any external library, that may be the cause of the > memory leak you are seeing. > > -Luke > > On Wednesday, September 21, 2016 at 5:52:23 PM UTC-7, Yichao Yu wrote: >> >> On

Re: [julia-users] Re: Debugging stack allocation

2016-09-22 Thread Yichao Yu
On Thu, Sep 22, 2016 at 8:44 AM, Jamie Brandon wrote: > Well, I managed to answer the first part of my question. A variable won't be > stack-allocated unless the compiler can prove it is always defined before > being used. Mine were, but the control flow was too complex for the compiler > to deal

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

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

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

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

Re: [julia-users] How to call macro stored in variable

2016-09-25 Thread Yichao Yu
On Sun, Sep 25, 2016 at 7:25 AM, Marius Millea wrote: > I can store a macro to a variable (let use the identity macro "id" as an > example), > > julia> idmacro = macro id(ex) >:($(esc(ex))) >end > @id (macro with 1 method) > > > How can I use this macro now? I can *almost* do i

Re: [julia-users] How to call macro stored in variable

2016-09-25 Thread Yichao Yu
rent global scope) since it runs in the parser and has no idea about any local bindings. This means that you might as well just assign the value to a global starts with `@` and call it directly with normal macro syntax. > > > On Sunday, September 25, 2016 at 2:08:46 PM UTC+2, Yichao Yu

Re: [julia-users] Minor troubles with quasiquoting syntax

2016-09-25 Thread Yichao Yu
On Sun, Sep 25, 2016 at 12:39 PM, Jamie Brandon wrote: > I'm doing a lot of code-generation. There are two patterns that come up all > over the place - adding a suffix to a symbol and interpolating from an array > comprehension. This is pretty verbose even in the simplest case: > > quote > ... >

Re: [julia-users] Minor troubles with quasiquoting syntax

2016-09-25 Thread Yichao Yu
reach(keys_i) do key_i > index_ip1 = index_1[key_i] > $body > end > end > > The macros in Base.Cartesian almost solve the comprehension problem too, if > I make a version that can take arbitrary iters rather than just a number... > > On 25 September 2016 at 18:53

Re: [julia-users] Is this a bug (related to scoping / nested macros)?

2016-09-25 Thread Yichao Yu
On Sep 25, 2016 6:57 PM, "Marius Millea" wrote: > > I can't figure out why this doesn't work: > > julia> macro outer() >quote >macro inner() >end >@inner >end >end > > > julia> @outer > ERROR: UndefVarError: @inner not

Re: [julia-users] control inline at callsite?

2016-09-26 Thread Yichao Yu
On Mon, Sep 26, 2016 at 5:50 AM, jw3126 wrote: > Is it possible to control inline behaviour of a function purely from the > callsite? > > I have a function f and I call it at several places. At some places I want > it to get it inlined and at others not. I do not want to touch the code of f > at a

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

2016-09-26 Thread Yichao Yu
On Mon, Sep 26, 2016 at 8:31 AM, Cedric St-Jean wrote: > It would make sense to put .jl file-parsing code in a separate, > community-maintained module, because the rules for finding which file a > module corresponds to are not trivial, and can change over time (they became > case-sensitive in 0.5)

Re: [julia-users] row vector from array in 0.5.0

2016-09-26 Thread Yichao Yu
On Mon, Sep 26, 2016 at 9:49 AM, Ferran Mazzanti wrote: > Hi, > > just installed 0.5.0 and have noticed something I seem to remember was > discussed here a few times, but can't remember exactly what it was. > I'm wondering what is now the best way to get a row vector from an array. I > ask because

Re: [julia-users] 'translate' not defined

2016-09-26 Thread Yichao Yu
https://github.com/JuliaLang/julia/issues/14787 On Mon, Sep 26, 2016 at 4:00 PM, DNF wrote: > I am seeing an odd warning/error during tab-completion: > > In the Julia REPL, whenever I am using tab-completion I get the following > warning: > > WARNING: both JLD and Plots export "translate"; uses o

Re: [julia-users] 'translate' not defined

2016-09-26 Thread Yichao Yu
er 26, 2016 at 10:14:44 PM UTC+2, Yichao Yu wrote: >> >> https://github.com/JuliaLang/julia/issues/14787 >> >> On Mon, Sep 26, 2016 at 4:00 PM, DNF wrote: >> > I am seeing an odd warning/error during tab-completion: >> > >> > In the Julia REPL, when

Re: [julia-users] Re: eval in current scope

2016-09-27 Thread Yichao Yu
On Tue, Sep 27, 2016 at 7:47 AM, Marius Millea wrote: >> Macros are functions evaluated at parse-time. The runtime scope doesn't >> even exist when the macro is called. > > > That's right, the answer may well have nothing to do with marcos (maybe I > obscured the question by even mentioning them

Re: [julia-users] Current file name

2016-09-27 Thread Yichao Yu
On Tue, Sep 27, 2016 at 3:56 PM, Tsur Herman wrote: > is there a way to know in run-time from which file the code that is > currently executing comes from? @__FILE__ gives you the current file name Base.source_path() gives you the current toplevel file. >

Re: [julia-users] Return structure-like elements from a function

2016-09-27 Thread Yichao Yu
On Tue, Sep 27, 2016 at 6:28 PM, Zhilong Liu wrote: > Hello All, > > I am trying to return values to elements inside a structure-like matrix. > Here is the code snippet: > What you actually meant to write is paths = [Array{Float64,2}() for i in 1:4] And you might as well do paths = Matrix{Flo

Re: [julia-users] Return structure-like elements from a function

2016-09-27 Thread Yichao Yu
On Tue, Sep 27, 2016 at 10:11 PM, Dan wrote: > That last line was probably meant to be > > paths = Vector{Matrix{Float64}}(4) Ah, yeah, that's exactly what I meant Thx for the correction > > On Tuesday, September 27, 2016 at 7:01:14 PM UTC-4, Yichao Yu wrote: >&g

Re: [julia-users] norm() is slow when variables are arguments

2016-09-27 Thread Yichao Yu
On Wed, Sep 28, 2016 at 12:32 AM, Zhilong Liu wrote: > Hello all, > > I tried to compare two norm() computations as shown below: > > u = 1.; v = 1.; > > # case 1: constants as arguments > @time for i = 1 : 1 > g = k * norm([1.; 1.])^3 > end > > # case 2: variables as arguments > @time for i

Re: [julia-users] Re: cfunction result garbage collected

2016-09-28 Thread Yichao Yu
On Wed, Sep 28, 2016 at 4:36 PM, Christian Rorvik wrote: > GC of code turned out to be a red herring. After isolating the instance of a > call that was crashing, and getting right up to it, GDB was kind enough to > get its knickers in a twist and segfault itself every time I stepped > instruction

Re: [julia-users] Re: cfunction result garbage collected

2016-09-28 Thread Yichao Yu
I had to change call_wrapper to > receive the closure as Ptr{T} and call unsafe_pointer_to_objref and then > call it. > > > On Wednesday, September 28, 2016 at 9:50:47 PM UTC+1, Yichao Yu wrote: >> >> On Wed, Sep 28, 2016 at 4:36 PM, Christian Rorvik >> wrote: >

Re: [julia-users] Re: cfunction result garbage collected

2016-09-28 Thread Yichao Yu
> On Wednesday, September 28, 2016 at 10:06:51 PM UTC+1, Yichao Yu wrote: >> >> On Wed, Sep 28, 2016 at 5:00 PM, Christian Rorvik >> wrote: >> > I don't have the code at hand right now (it's at work), but what I was >> > doing >> > was som

Re: [julia-users] What is the deal with macros that do not return expressions?

2016-10-01 Thread Yichao Yu
On Sat, Oct 1, 2016 at 5:26 AM, Lyndon White wrote: > I was generally under the impression that a macro always had the return a > `Expr` > and that doing otherwise would make the compiler yell at me. > > Apparently I was wrong, at least about the second part: > https://github.com/ChrisRackauckas/P

Re: [julia-users] Re: Best compile and benchmark for haswell and broadwell architectures?

2016-10-01 Thread Yichao Yu
On Sat, Oct 1, 2016 at 8:51 PM, David Gleich wrote: > Thanks for that pointer. I'll take a look! I have a collection of really simple ones here[1]. It's not systematic or comprehensive in any sense but does check a few operations that I care about (simd and math functions) and was able catch a fe

Re: [julia-users] efficiently add floats to a particular element of a vector

2016-10-04 Thread Yichao Yu
On Tue, Oct 4, 2016 at 3:11 PM, Jeff wrote: > Adding floats to an element of a vector takes about twice as long as adding > float to a variable. For example, > > ``` > val = zeros(1) > for i in 1:1000 > val[1] += 9. > end > ``` > finishes in 0.034 seconds whereas > ``` >

Re: [julia-users] Calling DLL function

2016-10-05 Thread Yichao Yu
On Oct 5, 2016 12:51 PM, "Jérémy Béjanin" wrote: > > Hello, > > I am trying to call a DLL function to allocate a page aligned array from julia. Here is a C++ example using that function. Note that the DLL function is wrapped into this uvAPI api, but is otherwise the same except for the name. The D

Re: [julia-users] What is the goal of -> with @doc macro and Julia 0.5

2016-10-06 Thread Yichao Yu
On Thu, Oct 6, 2016 at 2:19 AM, Sébastien Celles wrote: > Hello, > > In this SO question > http://stackoverflow.com/questions/36191766/metaprogramming-within-docstring-with-eval/36209841#36209841 > > the following code > > for (f, name) in ((:add, "addition"), (:sub, "subtraction")) > @eval be

Re: [julia-users] call compiled Julia image from multiple threads in C++

2016-10-06 Thread Yichao Yu
On Thu, Oct 6, 2016 at 11:02 AM, Igor Cerovsky wrote: > Hello, > > Calling compiled Julia 0.5 code from C++ (MSVS15) from multiple threads a > code that follows fails. > > Consider following example under WIN using Julia 0.5: > #include > #include > #include "julia.h" > > //@Base.ccallable Int64

Re: [julia-users] Calling DLL function

2016-10-06 Thread Yichao Yu
On Thu, Oct 6, 2016 at 5:40 PM, Jérémy Béjanin wrote: > Thanks! this works perfectly. > > The pointer_to_array() function seems to be deprecated, however, do you know > how to use the suggested replacement, unsafe_wrap()? Yes. > > And if it's not too much to ask, I am wondering how I can do the

Re: [julia-users] Calling DLL function

2016-10-07 Thread Yichao Yu
>> 16) & 0xfff should do it. You need to adjust to the actual bits location of course. If you have never done anything with bits before, this might be useful in general. https://en.wikipedia.org/wiki/Bitwise_operation > > On Thursday, October 6, 2016 at 8:15:41 PM UTC-4, Yichao Yu

Re: [julia-users] Indexing an Float64 scalar

2016-10-07 Thread Yichao Yu
On Fri, Oct 7, 2016 at 1:59 PM, Eduardo Lenz wrote: > Hi. > > What is exactly the point of a construction like > > " > julia> a = 33.33 > 33.33 > > julia> a[1] > 33.33 > " > be valid ? I think it should rise an error, but there is a > getindex(::Float64, ::Int64) defined in the core language (v0.5

Re: [julia-users] Threads.@threads and throw ErrorException interaction

2016-10-07 Thread Yichao Yu
On Fri, Oct 7, 2016 at 4:02 PM, Diego Javier Zea wrote: > Hi, > I was starting to play with Threads.@threads and I noticed a strange > behaviour when the macro is used together with throw and ErrorException: > > | | |_| | | | (_| | | Version 0.5.0 (2016-09-19 18:14 UTC) > _/ |\__'_|_|_|\__'_|

Re: [julia-users] help with syntax for Function-like objects for parametric types

2016-10-07 Thread Yichao Yu
On Fri, Oct 7, 2016 at 4:05 PM, Chris Stook wrote: > Calling objects of type T is only valid if N arguments are provided. What > is the correct syntax for this? > > immutable T{N} > t :: NTuple{N,Any} > end > > (x::T)(args...) = error("wrong number of arguments") function (x::T{N}){N}(args::Va

Re: [julia-users] @testset in v0.4 testing?

2016-10-08 Thread Yichao Yu
On Sat, Oct 8, 2016 at 7:19 AM, Andreas Lobinger wrote: > Hello colleagues, > > it's quite nice to structure testing with @testset in v0.5 (and higher), but > it doesn't exist in 0.4. And it's not expected to be backported. > Could Compat be a place for this? Or just build two blocks (>0.4 and <=

Re: [julia-users] Must we reinstall all packages after updating to v0.5?

2016-10-08 Thread Yichao Yu
On Sat, Oct 8, 2016 at 2:39 PM, wrote: > Hi, I'm not sure if anyone else has this problem but apparently, after > updating to v0.5, I can no longer find the packages that I had previously This is expected since packages might use different code on different julia versions and simply copying the

Re: [julia-users] Must we reinstall all packages after updating to v0.5?

2016-10-08 Thread Yichao Yu
On Sat, Oct 8, 2016 at 2:41 PM, Yichao Yu wrote: > On Sat, Oct 8, 2016 at 2:39 PM, wrote: >> Hi, I'm not sure if anyone else has this problem but apparently, after >> updating to v0.5, I can no longer find the packages that I had previously > > This is expecte

Re: [julia-users] Must we reinstall all packages after updating to v0.5?

2016-10-08 Thread Yichao Yu
elete the data for the older version because you can use multiple versions simultaneously. > > On Saturday, 8 October 2016 20:43:57 UTC+2, Yichao Yu wrote: >> >> On Sat, Oct 8, 2016 at 2:41 PM, Yichao Yu wrote: >> > On Sat, Oct 8, 2016 at 2:39 PM, wrote: >> &

Re: [julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Yichao Yu
On Oct 11, 2016 12:34 PM, "Evan Fields" wrote: > > Let's say I have a type MyType and function f(mt::MyType) which is slow and stochastic. I have an object y::MyType, and I'd like to compute f(y) many times. > > If I write a loop like > fvals = Vector{Float64}(100) > Threads.@threads for i in 1:le

Re: [julia-users] Do threads in a threaded loop have their own scope?

2016-10-11 Thread Yichao Yu
On Tue, Oct 11, 2016 at 1:13 PM, Evan Fields wrote: > I'm unsure if "bit shared" is a technical term I should know, or if "bit > shared" is a smartphone typo for "not shared" which would describe my > understanding of normal loops, where it seems each iteration doesn't have > access to loop-only

Re: [julia-users] Question about type ambiguity

2016-10-12 Thread Yichao Yu
On Wed, Oct 12, 2016 at 1:22 PM, esproff wrote: > Consider the code: > > abstract AbstractFoo > > type Foo <: AbstractFoo > end > > f(x::AbstractFoo, y::Integer) = "method 1" > f(x::Foo, y::Real) = "method 2" > > foo = Foo() > f(foo, 1) > > This code results in an ambiguity error, since both meth

Re: [julia-users] Question about type ambiguity

2016-10-12 Thread Yichao Yu
On Wed, Oct 12, 2016 at 2:41 PM, Mauro wrote: > On Wed, 2016-10-12 at 20:03, Yichao Yu wrote: > > On Wed, Oct 12, 2016 at 1:22 PM, esproff wrote: > > > >> Consider the code: > >> > >> abstract AbstractFoo > >> > >> type Foo &l

Re: [julia-users] Memory allocation issue when using external packages in module

2016-10-13 Thread Yichao Yu
Likely https://github.com/JuliaLang/julia/issues/18465 On Thu, Oct 13, 2016 at 11:56 AM, Jan wrote: > Hi! > > I´ve tried to reduce my problem to a smaller one, but I didn´t succeed. > However, I hope someone can help me even though the problem description is > a bit long and involves github. To

Re: [julia-users] Memory allocation issue when using external packages in module

2016-10-14 Thread Yichao Yu
On Fri, Oct 14, 2016 at 4:14 AM, Jan wrote: > Thanks for the hint. That seems to be the reason! > > I have a couple of follow up questions so that I learn more about Julia. > Would be nice if someone takes a couple of minutes to educate me. > > I found a simple example reproducing my issue: > > m

Re: [julia-users] GC rooting for embedding: what is safe and unsafe?

2016-10-14 Thread Yichao Yu
On Fri, Oct 14, 2016 at 7:03 AM, Bart Janssens wrote: > Hi, > > Replies below, to the best of my understanding of the Julia C interface: > > On Fri, Oct 14, 2016 at 11:47 AM Gunnar Farnebäck > wrote: > >> Reading through the threads and issues on gc rooting for embedded code, >> as well as the c

Re: [julia-users] FactCheck.jl bundled with Julia?

2016-10-14 Thread Yichao Yu
On Oct 14, 2016 8:52 PM, "Júlio Hoffimann" wrote: > > Oh really? I'm not following it closely. Please let me know why that is the case, I was planning to switch to FactCheck. Afaict the new test in base is a improved version of FactCheck. > > -Júlio

Re: [julia-users] FactCheck.jl bundled with Julia?

2016-10-14 Thread Yichao Yu
On Fri, Oct 14, 2016 at 9:28 PM, Júlio Hoffimann wrote: > Ok, I am not switching to FactCheck then, didn't knew it is being > deprecated in a sense. > You can switch to BaseTestNext if you need 0.4 compatibility. > > Thank you, > -Júlio > > 2016-10-14 18:05 GMT-

Re: [julia-users] Type-stable global variables?

2016-10-15 Thread Yichao Yu
On Sat, Oct 15, 2016 at 8:59 AM, Andrei Zh wrote: > What is the most straightforward way to make a variable in the global > scope that can change it's value, but not its type? So far I use this: > > const GLOBAL_VAR = [MyType[]] # array with single element > > set_global_var(x::MyType) = GLOBAL_

Re: [julia-users] Reductions sometimes not typestable?

2016-10-15 Thread Yichao Yu
2016-10-15 18:06 GMT-04:00 jw3126 : > myop(::Int16, ::Int16) = Int32(1) > myop(::Int16, ::Int32) = Int64(1) > myop(::Int16, ::Int64) = Int128(1) > myop(::Int16, ::Int128) = Int128(1) > > foldr(myop, Int16[1]) |> typeof |> println > foldr(myop, Int16[1,1]) |> typeof |> println > foldr(myop, Int16[1

Re: [julia-users] Reductions sometimes not typestable?

2016-10-15 Thread Yichao Yu
On Sat, Oct 15, 2016 at 6:21 PM, jw3126 wrote: > > > On Sunday, October 16, 2016 at 12:12:14 AM UTC+2, Yichao Yu wrote: >> >> >> >> 2016-10-15 18:06 GMT-04:00 jw3126 : >> >>> myop(::Int16, ::Int16) = Int32(1) >>> myop(::Int16, ::Int32) =

Re: [julia-users] Some questions on array comprehensions; e.g. disabling bounds checking possible? And correct way for non-1-based

2016-10-16 Thread Yichao Yu
On Sun, Oct 16, 2016 at 12:01 PM, Páll Haraldsson wrote: > > I was prototyping: > > julia> a=[1,2,3,1,2] > > julia> b=[a[i] 4-element Array{Bool,1}: > true > true > false > true > > > In the beginning when trying stuff out I used: > > for i in a[1:end-1] > > or > > for i in a[2:end] > > an

Re: [julia-users] row of a matrix

2016-10-17 Thread Yichao Yu
On Mon, Oct 17, 2016 at 9:22 AM, Chang Kwon wrote: > > It seems that the way Julia handles A[1,:] changed in v0.5. > > *julia> **A = [1 2 3; 4 5 6]* > > *2×3 Array{Int64,2}:* > > * 1 2 3* > > * 4 5 6* > > > *julia> **A[1,:]* > > *3-element Array{Int64,1}:* > > * 1* > > * 2* > > * 3* > > > *ju

Re: [julia-users] Recasting arrays

2016-10-18 Thread Yichao Yu
On Tue, Oct 18, 2016 at 1:38 PM, Jérémy Béjanin wrote: > I have seen the rem(a,b) function being used to recast numbers, but I was > wondering if there was a way to recast arrays as in C. > Do note that this is undefined in standard C. > > Say, for example, that I have an array of bytes, is it

Re: [julia-users] thread safe locks and Julia 0.4

2016-10-18 Thread Yichao Yu
On Tue, Oct 18, 2016 at 3:53 PM, Ryan Gardner wrote: > The documentation for Julia 0.5.0 says that the lock returned by > ReentrantLock() "is NOT threadsafe" ( http://docs.julialang.org/en/ > release-0.5/stdlib/parallel/ see ReentrantLock()) . What does that > mean? I interpret it to mean that

Re: [julia-users] Embedding Julia in C++ - Determining returned array types

2016-10-18 Thread Yichao Yu
On Tue, Oct 18, 2016 at 8:57 PM, Isaiah Norton wrote: > The issue here is that `jl_array_eltype` is already returning a type. > > `jl_typeis(v, t)` becomes `jl_typeof(v) == t`, so your checks become: > > jl_typeof(array_type) == jl_int64_type > > But > > jl_typeof(array_type) -> DataType

Re: [julia-users] variable scope inside @threads loop?

2016-10-19 Thread Yichao Yu
On Wed, Oct 19, 2016 at 10:08 AM, Jingpeng Wu wrote: > > > Currently, it seems that every variable was shared to all threads, which > limit the application range a lot. Is there anyway to define private > variable to each threads? similar with OpenMP. > Same as normal loop. Use let.

Re: [julia-users] Embedding Julia in C++ - Determining returned array types

2016-10-19 Thread Yichao Yu
On Wed, Oct 19, 2016 at 12:54 PM, Kyle Kotowick wrote: > Aha, that fixed it! > > I'm running into one issue though. What do I do with the data when it's a > "Float16" type? C++ has no way to represent a 16-bit float, so I'm having > difficulty converting it to a regular 32-bit float. > Find a co

Re: [julia-users] Can't overwrite some methods in 0.5.0

2016-10-19 Thread Yichao Yu
On Oct 19, 2016 7:26 PM, "Alex Mellnik" wrote: > > Here's my bizarre find of the day. Most functions can be overwritten without problems: > > function add7(i) > 7 + i > end > Out[1]: > add7 (generic function with 1 method) > In [2]: > > add7(0) > add7(0) > Out[2]: > 7 > In [3]: > > function a

Re: [julia-users] Can't overwrite some methods in 0.5.0

2016-10-19 Thread Yichao Yu
On Wed, Oct 19, 2016 at 10:33 PM, Alex Mellnik wrote: > Yichao, > > I'm afraid I'm not following -- could you expand on that a bit? Thanks, > https://github.com/JuliaLang/julia/issues/265 > > Alex > > On Wednesday, October 19, 2016 at 4:41:30 PM UTC-7, Yicha

Re: [julia-users] Julia crashes on using PyPlot after workspace() on Mac OSX Yosemite

2016-10-20 Thread Yichao Yu
https://github.com/JuliaLang/julia/issues/16467 On Thu, Oct 20, 2016 at 3:10 AM, Vishnu Raj wrote: > Hi, > > I'm in OSX 10.10 and is facing the following problem. First I import > PyPlot by 'using PyPlot' and plot some stuff, it works. Now if i call a > workspace() and try 'using PyPlot', julia

Re: [julia-users] Testing uncommitted changes to a package

2016-10-21 Thread Yichao Yu
Add $PWD/src to LOAD_PATH instead. This way you can also make sure you are not using Pkg incorrectly in your package. On Fri, Oct 21, 2016 at 11:11 AM, Chandrakant G < chandrakant.gopa...@gmail.com> wrote: > Hi guys, > I am getting my feet wet with Julia and its pretty nice so far. > I am testing

Re: [julia-users] A "two-languages" problem when embedding Julia

2016-10-22 Thread Yichao Yu
> Now, let me ask two questions. > - Will the current thread support development allow embedding Julia into > multiple threads (even if it is as multiple instances)? > No. > - What are my options **today**, if any, to somehow overcome this > limitation? > You can only call julia runtime/code fr

Re: [julia-users] A "two-languages" problem when embedding Julia

2016-10-22 Thread Yichao Yu
support development". We'll likely add that later but the first "stable" version of threading support will unlikely support that. Relevant issues, https://github.com/JuliaLang/julia/issues/16134 and (more accurately) https://github.com/JuliaLang/julia/issues/17573 > > >

Re: [julia-users] String escape when ccall-ing DLL functions on Windows

2016-10-23 Thread Yichao Yu
On Sun, Oct 23, 2016 at 1:22 PM, 中山慎太郎 wrote: > Hello, > > I'm trying to ccall my DLL as follows : > > function start(args :: Array{String, 1}) > return ccall((:TestFunction, "mydll.dll"), Int32, (Int32, > Ptr{Ptr{UInt8}}), length(args), args) > end > > The C declaration is as follows : > > ex

Re: [julia-users] ERROR: UndefVarError: PkgDev not defined

2016-10-24 Thread Yichao Yu
On Mon, Oct 24, 2016 at 5:57 PM, J Luis wrote: > Hi, > > I'm trying to tag a new version of a package for the first time (initial tag > was done with 0.4) but > > Pkg.update() > ... > WARNING: julia is fixed at 0.5.0-rc4+0 conflicting with requirement for > GLFW: [0.5.0,∞) > INFO: Upgrading ArgPar

Re: [julia-users] llvm call error

2016-10-25 Thread Yichao Yu
On Mon, Oct 24, 2016 at 8:15 PM, wrote: > Hi All, > > I am trying to call llvm ir generated from julia. > > Here is my function: > > function incr(a::Array{Int64}) a+1; end > > > thus: > > @code_llvm(incr([1 2 5 6 7])) > > returns: > > define %jl_value_t* @julia_incr_62127(%jl_value_t*) #0 { > t

Re: [julia-users] llvm call error

2016-10-25 Thread Yichao Yu
t;> jl_value_t appears. is it possible to do the same with arrays? >>> Array{Float32,2} genrates a jl_value_t? Is there an array type that can do >>> this? For example fixed arrays? >>> >>> Finally, is this features planned to be supported if julia statically >

Re: [julia-users] Binary read

2016-10-25 Thread Yichao Yu
On Tue, Oct 25, 2016 at 4:05 PM, Aleksandr Mikheev wrote: > Hello, sorry if this question have already been asked, but I could not find > a similar thread. So, I have a .dat ("numbers.dat") file, which I should > open. I believe I should do something like this: > >> f = open("numbers.dat") > > > A

Re: [julia-users] Re: a default module name?

2016-10-26 Thread Yichao Yu
On Wed, Oct 26, 2016 at 3:46 PM, Ryan Gardner wrote: > Oh, Main > > import Main.foo import ..foo > > Thanks. > > > On Wednesday, October 26, 2016 at 3:27:50 PM UTC-4, Ryan Gardner wrote: >> >> say I have code: >> >> >> type foo >>a >> end >> >> module MyModule >>#how do I use foo here?

Re: [julia-users] Re: How do the file name / module name mapping rules work?

2016-10-26 Thread Yichao Yu
FWIW I dont think this question has anything to do with naming conventions and package organizations. > On Wednesday, October 26, 2016 at 1:44:34 PM UTC-4, ma...@maasha.dk wrote: >> >> Using the example package https://github.com/JuliaLang/Example.jl/ I am >> wondering: >> >> >> the root level nam

Re: [julia-users] Using -args to execute a function for different parameters

2016-10-27 Thread Yichao Yu
On Thu, Oct 27, 2016 at 8:48 AM, wrote: > Hi Josef, > > I shall paste a function that I used for my python files. Would it be okay > if I asked you for some help to do the same in Julia? I've implemented most > of the code but this still remains to be done in Julia and I wasn't aware > such a pac

Re: [julia-users] Re: Input a data from the console

2016-10-27 Thread Yichao Yu
On Fri, Oct 28, 2016 at 12:01 AM, Jeffrey Sarnoff wrote: > And although readline() yields a String, if you are asking for, say, a Int > or a Float64 value, you can add a second version of `input`: > > ``` > typealias ParseableNumber Union{Float64, Float32, Signed, Unsigned, Bool} > > """ > `in

Re: [julia-users] CPU_CORES is deprecated

2016-10-28 Thread Yichao Yu
Sys.CPU_CORES On Fri, Oct 28, 2016 at 8:14 AM, Nils Gudat wrote: > As the title says - getting a warning but the constant still exist. There's > none of the ususal "use ... instead" in the warning, what's the replacement > (if any) for this in 0.5?

Re: [julia-users] CPU_CORES is deprecated

2016-10-28 Thread Yichao Yu
https://github.com/JuliaLang/julia/blob/master/NEWS.md#library-improvements-1 On Fri, Oct 28, 2016 at 8:27 AM, Yichao Yu wrote: > Sys.CPU_CORES > > On Fri, Oct 28, 2016 at 8:14 AM, Nils Gudat wrote: >> As the title says - getting a warning but the constant still exist. There&#

Re: [julia-users] anonymous function

2016-10-28 Thread Yichao Yu
On Fri, Oct 28, 2016 at 2:12 PM, digxx wrote: > So an anonymous function I can write like this > > f=x->x^2 > > is it also possible to make an anonymous function out of this: > > function f(x) > > x^2 > > end No. What are you trying to do?

Re: [julia-users] anonymous function

2016-10-28 Thread Yichao Yu
On Fri, Oct 28, 2016 at 2:19 PM, Michele Zaffalon wrote: > I have read somewhere that your second approach is doing two things at the > same time: defining an anonymous function and assigning the name f to it. No it's not. It defines a function named `f` f = function () end defines an anonymous

Re: [julia-users] anonymous function

2016-10-28 Thread Yichao Yu
On Fri, Oct 28, 2016 at 2:30 PM, digxx wrote: > ok: > > f(x)=x^2 is not an anonymous function > however > f=x->x^2 is an anonymous function > > unfortunately my function is not just one line so I cant use f=x->x^2 and I > have to use something like > > function f(x) > > > end > > this however is n

Re: [julia-users] anonymous function

2016-10-28 Thread Yichao Yu
On Fri, Oct 28, 2016 at 2:59 PM, digxx wrote: > I didnt see it > f = function () > end > > defines an anonymous function and assigns it to a variable f.

Re: [julia-users] Parsing complex numbers

2016-10-28 Thread Yichao Yu
On Fri, Oct 28, 2016 at 3:53 PM, Jérémy Béjanin wrote: > I've noticed that parsing a string representing a real number yields a real > number, but parsing a string representing a complex number yields an > expression that must subsequently be evaluated. Is there a reason for that > behaviour? I'd

Re: [julia-users] Using -args to execute a function for different parameters

2016-10-29 Thread Yichao Yu
> 3. This is the most confusing part for me. I really don't get the Julia > equivalent of these two lines. if __name__ == "__main__": > main(sys.argv[1:]) None. > > Could you please clarify my questions? > > > On Thursday, 27 October 2016 15:05:57 UTC+2

Re: [julia-users] Using -args to execute a function for different parameters

2016-10-29 Thread Yichao Yu
On Sat, Oct 29, 2016 at 4:21 PM, wrote: > I don't understand what the post means. Could you please elaborate a bit? > > > On Saturday, 29 October 2016 22:04:32 UTC+2, Yichao Yu wrote: >> >> > 3. This is the most confusing part for me. I really don't get t

Re: [julia-users] Array horizontal concatenation

2016-10-30 Thread Yichao Yu
On Oct 30, 2016 12:30 PM, "Anthony Ashley" wrote: > > Hello, > > I noticed that implied hcat does not work if a space is omitted between the arrays to be concatenated. For example: > > [[1 2][3 4]] > > gives: > > ERROR: MethodError: `typed_hcat` has no method matching typed_hcat(::Array{Int64,2},

Re: [julia-users] inconsistent 'unique' in Atom

2016-10-30 Thread Yichao Yu
On Sun, Oct 30, 2016 at 10:05 PM, wrote: > Hi folks, > > I've noticed that in v5 the expression > > > unique([122 122.5 10 10.3]) > > > gives as result the following vector: > > 122 123 10 10.3 > > > Any device? Is there any maximum number of characters displayed in the > console, or something si

Re: [julia-users] inconsistent 'unique' in Atom

2016-10-30 Thread Yichao Yu
instead. (I believe they have their own more specific forum). There should be enough Atom users here to verify your issue too if it's not urgent. > > thanks a lot, > > On Sunday, October 30, 2016 at 7:14:07 PM UTC-7, Yichao Yu wrote: >> >> On Sun, Oct 30, 2016 at 10:05 P

Re: [julia-users] 0.5 new generators syntax question

2016-10-31 Thread Yichao Yu
On Mon, Oct 31, 2016 at 3:42 PM, Jesse Jaanila wrote: > Hi, > > I was experimenting with the new 0.5 features and they are great! But to my > surprise, > the generator syntax doesn't work as I'm expecting. Let's say I want to > calculate > some summation. With the old syntax I could do > > @time s

Re: [julia-users] Indexing a large matrix is MUCH slower (~ 150x) slower in 0.5 (and 0.6) than 0.4.7

2016-10-31 Thread Yichao Yu
On Mon, Oct 31, 2016 at 6:34 PM, Ian Butterworth wrote: > I'm not sure of the etiquette, but I'm cross-posting this from stackoverflow > as it seems like quite a significant issue... > > As an example: > > x = rand(10,10,100,4,4,1000) #Dummy array > > tic() > r = squeeze(mean(x[:,:,1:80,:,:,56:8

Re: [julia-users] Indexing a large matrix is MUCH slower (~ 150x) slower in 0.5 (and 0.6) than 0.4.7

2016-10-31 Thread Yichao Yu
> evals/sample: 1 > time tolerance: 5.00% > memory tolerance: 1.00% > memory estimate: 727.55 mb > allocs estimate: 79 > minimum time: 425.82 ms (0.06% GC) > median time: 485.95 ms (11.31% GC) > mean time: 482.67 ms (10.37% GC) >

Re: [julia-users] best way to reinstall packages after upgrading Julia?

2016-11-01 Thread Yichao Yu
On Nov 1, 2016 4:32 PM, "Steven G. Johnson" wrote: > > When you upgrade from (say) Julia 0.4 to 0.5, you have to re-install all of the packages because the package directory changes. It seems like there should be an automated way to do this. Does something like this exist? Seems like it should

Re: [julia-users] Where can I put code that will be run every time "using Module" is executed, and not just the first time?

2016-11-02 Thread Yichao Yu
On Nov 2, 2016 8:12 PM, "Scott Lundberg" wrote: > > In Jupyter it is convenient to dump JS library code to the notebook when "using Module" is run. This is simple to do in the Module's __init__(), and saves a ton of memory since later visualizations can share this common JS library code. > > Howev

Re: [julia-users] create command with spaces without quoting

2016-11-03 Thread Yichao Yu
On Thu, Nov 3, 2016 at 12:17 PM, Andre Bieler wrote: > I want to generate a command for imagemagick and use options loaded from a > file. > So the number of utilized options is not known beforehand. > > An example might look like: > > convert -density 300 somefile.pdf -depth 10 somefile.jpeg > > I

Re: [julia-users] Equivalance of SymbolNode in Julia-0.5

2016-11-04 Thread Yichao Yu
On Fri, Nov 4, 2016 at 4:37 AM, AStupidbear wrote: > According to this issue, the definition of SymbolNode disappears in > Julia-0.5. Since there's no response from the author, I want to know the > equivalence of SymbolNode in Julia-0.5, how I can fix this deprecation. I don't think there's a dir

Re: [julia-users] Passing N-D Julia arrays to C functions

2016-11-04 Thread Yichao Yu
On Fri, Nov 4, 2016 at 9:22 AM, Alexander Lyapin wrote: > There is a topic: > https://groups.google.com/d/msg/julia-users/EK9oNzzaoAk/kJqagPL0Ku0J > > However could some one give an example how to pass 3-d or 4-d array to C > function. > > I have Array{Float64, 4} and for ccall I use Ptr{Ptr{Ptr{P

Re: [julia-users] Re-export variable define in __init__ of submodule with precompilation

2016-11-04 Thread Yichao Yu
On Fri, Nov 4, 2016 at 12:30 PM, Simon Byrne wrote: > How can I reexport a variable defined in the __init__ method of a > submodule, to play nice with precompilation. > > The following gives me a "WARNING: could not import Foo.bar into > TestExport": > > __precompile__() > module TestExport >

Re: [julia-users] Getting parameter names from Method

2016-11-04 Thread Yichao Yu
On Fri, Nov 4, 2016 at 6:31 PM, David Anthoff wrote: > Is there a way to get the names of the parameters of a method from a Method > type instance on julia 0.5? Roughly: nargs tell you how many arguments the method accepts, the first one being the object (function) being called. The local variab

Re: [julia-users] Equivalance of SymbolNode in Julia-0.5

2016-11-05 Thread Yichao Yu
On Sat, Nov 5, 2016 at 2:12 AM, AStupidbear wrote: > Thanks. Though there are still confusing errors after replacing "SymbolNode" > to "Slot". As I said, simply replacing `SymbolNode` with `Slot` won't work.

  1   2   3   4   5   6   7   8   9   10   >