Re: [julia-users] how to do push! on a fieldname?

2016-10-10 Thread K leo
Thanks so much Mauro.  That does it.

On Monday, October 10, 2016 at 10:58:30 PM UTC+8, Mauro wrote:
>
> Try 
>
> for fl in fieldnames(myt) 
>push!(getfield(myt,fl), 0.) 
> end 
>
> `fieldnames` returns the name of the field as a symbol, thus your error. 
>
> On Mon, 2016-10-10 at 16:41, K leo <cnbi...@gmail.com > 
> wrote: 
> > I hope to expand all arrays in a type using something like the 
> following: 
> > 
> > fields=fieldnames(myType) 
> >> for i=1:length(fields) 
> >> push!(fields[i], 0.) 
> >> end 
> > 
> > 
> > But I get error saying no method matching push!(::Symbol, ::Float64) 
> > 
> > What else can I do for my purpose? 
>


[julia-users] how to do push! on a fieldname?

2016-10-10 Thread K leo
I hope to expand all arrays in a type using something like the following:

fields=fieldnames(myType)
> for i=1:length(fields)
> push!(fields[i], 0.)
> end


But I get error saying no method matching push!(::Symbol, ::Float64)

What else can I do for my purpose?



Re: [julia-users] Is there a way to export all functions defined in a module?

2016-09-29 Thread K leo
Thanks for the reply.

I want to be able to export all symbols of module X from within X.  But 
reexport seems to do something different:

@reexport using X
# all of X's exported symbols available here


On Friday, September 30, 2016 at 9:08:03 AM UTC+8, Erik Schnetter wrote:
>
> Yes; see <https://github.com/simonster/Reexport.jl>.
>
> -erik
>
> On Thu, Sep 29, 2016 at 5:35 PM, K leo <cnbi...@gmail.com > 
> wrote:
>
>> without retyping all the names.
>>
>
>
>
> -- 
> Erik Schnetter <schn...@gmail.com > 
> http://www.perimeterinstitute.ca/personal/eschnetter/
>


[julia-users] Is there a way to export all functions defined in a module?

2016-09-29 Thread K leo
without retyping all the names.


[julia-users] Re: Any 0.5 performance tips?

2016-09-28 Thread K leo
Just discovered a few days ago that keyword arguments in functions are very 
slow, but I guess they are not slower in 0.5.

On Thursday, September 29, 2016 at 10:15:20 AM UTC+8, Andrew wrote:
>
> My large project is much (3-4x?) slower under 0.5. I know there are a 
> variety of open issues about this to be hopefully fixed in the 0.5.x 
> timeframe, but are there any general workarounds at the moment?
>
> My project includes the following in case it's relevant:
>
>- Many nested functions forming closures, which I pass to optimization 
>and equation solving functions. In 0.4 I used the Base.call trick on 
> custom 
>types to make performant closures. I rewrote the code for 0.5 to just use 
>regular anonymous functions since they are fast now.
>- ForwardDiff, splines (Dierckx mostly)
>- Large custom immutable types which carry parameters. These get 
>passed around. I have been considering just making all my parameters 
> global 
>constants rather than passing them around. It seems that this could get 
>them inlined into my functions and save time. However, all my simple tests 
>show global constants perform exactly the same as explicitly passing the 
>parameters, so as long as this still holds in big codes this shouldn't 
>matter.
>- A lot of nested function calls. I prefer to write lots of small 
>functions instead of one big one
>
>

Re: [julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-28 Thread K leo
julia> Pkg.checkout("ClobberingReload")
ERROR: ClobberingReload is not a git repo
 in checkout(::String, ::String, ::Bool, ::Bool) at ./pkg/entry.jl:225
 in 
(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#checkout,Tuple{String,String,Bool,Bool}})()
 
at ./pkg/dir.jl:31
 in 
cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#checkout,Tuple{String,String,Bool,Bool}},
 
::String) at ./file.jl:59
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, 
::Vararg{Any,N}) at ./pkg/dir.jl:31
 in checkout(::String) at ./pkg/pkg.jl:170

Thanks for the tip on IJulia/Jupyter.  Will try them.

On Wednesday, September 28, 2016 at 8:25:37 PM UTC+8, Cedric St-Jean wrote:
>
> I just removed the IJulia dependency from ClobberingReload.jl (made it 
> optional - autoreload still works for IJulia users). Thank you for the 
> feedback. If you `Pkg.checkout("ClobberingReload")`, it should 
> automatically remove IJulia and its dependencies.
>
> BTW, if you haven't tried IJulia/Jupyter notebooks, I would strongly 
> recommend giving it a shot. It's the #2 most popular Julia package for a 
> reason.
>
> Cédric
>
> On Wednesday, September 28, 2016 at 12:55:53 AM UTC-4, K leo wrote:
>>
>>
>> On Wednesday, September 28, 2016 at 12:53:12 PM UTC+8, K leo wrote:
>>>
>>> This a very heavy install.  It's fetching tons of things that I have not 
>>> used.  Not sure what they are, but seems like trashing my system.
>>>
>>
>> julia> Pkg.clone("git://github.com/cstjean/ClobberingReload.jl.git")
>> INFO: Cloning ClobberingReload from git://
>> github.com/cstjean/ClobberingReload.jl.git
>> INFO: Computing changes...
>> INFO: Cloning cache of IJulia from 
>> https://github.com/JuliaLang/IJulia.jl.git
>> INFO: Cloning cache of Nettle from 
>> https://github.com/staticfloat/Nettle.jl.git
>> INFO: Cloning cache of ZMQ from https://github.com/JuliaLang/ZMQ.jl.git
>> INFO: Installing Conda v0.3.2
>> INFO: Installing IJulia v1.3.2
>> INFO: Installing Nettle v0.2.4
>> INFO: Installing ZMQ v0.3.4
>> INFO: Building Nettle
>> INFO: Building ZMQ
>> INFO: Building IJulia
>> INFO: Installing Jupyter via the Conda package.
>> INFO: Downloading miniconda installer ...
>>   % Total% Received % Xferd  Average Speed   TimeTime Time 
>>  Current
>>  Dload  Upload   Total   SpentLeft 
>>  Speed
>> 100 25.9M  100 25.9M0 0  1104k  0  0:00:24  0:00:24 --:--:-- 
>> 2297k
>> INFO: Installing miniconda ...
>> PREFIX=/home/xxx/.julia/v0.5/Conda/deps/usr
>> installing: _cache-0.0-py27_x0 ...
>> installing: python-2.7.11-0 ...
>> installing: conda-env-2.4.5-py27_0 ...
>> installing: openssl-1.0.2g-0 ...
>> installing: pycosat-0.6.1-py27_0 ...
>> installing: pyyaml-3.11-py27_1 ...
>> installing: readline-6.2-2 ...
>> installing: requests-2.9.1-py27_0 ...
>> installing: sqlite-3.9.2-0 ...
>> installing: tk-8.5.18-0 ...
>> installing: yaml-0.1.6-0 ...
>> installing: zlib-1.2.8-0 ...
>> installing: conda-4.0.5-py27_0 ...
>> installing: pycrypto-2.6.1-py27_0 ...
>> installing: pip-8.1.1-py27_1 ...
>> installing: wheel-0.29.0-py27_0 ...
>> installing: setuptools-20.3-py27_0 ...
>> Python 2.7.11 :: Continuum Analytics, Inc.
>> creating default environment...
>> installation finished.
>> Fetching package metadata: 
>> Solving package specifications: .
>>
>> Package plan for installation in environment 
>> /home/xxx/.julia/v0.5/Conda/deps/usr:
>>
>> The following packages will be downloaded:
>>
>> package|build
>> ---|-
>> conda-env-2.6.0|0  502 B
>> expat-2.1.0|0 365 KB
>> icu-54.1   |011.3 MB
>> jpeg-8d|1 806 KB
>> libffi-3.2.1   |0  36 KB
>> libgcc-5.2.0   |0 1.1 MB
>> libsodium-1.0.10   |0 1.2 MB
>> libxcb-1.12|0 1.5 MB
>> sqlite-3.13.0  |0 4.0 MB
>> dbus-1.10.10   |0 2.4 MB
>> glib-2.43.0|1 5.4 MB
>> libpng-1.6.22  |0 214 KB
>> libxml2-2.9.2  |0 4

[julia-users] Re: help understanding different ways of wrapping functions

2016-09-28 Thread K leo
Thanks so much for the tips.  The culprit is the keyword argument 
(xRat=0.).  Declaring it made the wrapped code twice as fast, but still way 
slower than the inline code.  But making it positional made the wrapped 
code just a little slower than the inline code - big improvement.

On Wednesday, September 28, 2016 at 2:50:40 PM UTC+8, Gunnar Farnebäck 
wrote:
>
> It's normal that manually inlined code of this kind is faster than wrapped 
> code unless the compiler manages to see the full inlining potential. In 
> this case the huge memory allocations for the wrapped solutions indicates 
> that it's nowhere near doing that at all. I doubt it will take you all the 
> way but start with modifying your inner M_CPS function to only take 
> positional arguments or declaring the type of the keyword argument as 
> suggested in the performance tips section of the manual.
>
> Den onsdag 28 september 2016 kl. 06:29:37 UTC+2 skrev K leo:
>>
>> I tested a few different ways of wrapping functions.  It looks different 
>> ways of wrapping has slightly different costs.  But the most confusing to 
>> me is that putting everything inline looks much faster than wrapping things 
>> up.  I would understand this in other languages, but I thought Julia 
>> advocates simple wrapping.  Can anyone help explain what is happening 
>> below, and how I can do most efficient wrapping in the demo code?
>>
>> Demo code is included below.
>>
>> julia> versioninfo()
>> Julia Version 0.5.0
>> Commit 3c9d753 (2016-09-19 18:14 UTC)
>> Platform Info:
>>   System: Linux (x86_64-pc-linux-gnu)
>>   CPU: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
>>   WORD_SIZE: 64
>>   BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
>>   LAPACK: libopenblas64_
>>   LIBM: libopenlibm
>>   LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)
>>
>> julia> testFunc()
>> calling LoopCP (everything inline)
>>   0.097556 seconds (2.10 k allocations: 290.625 KB)
>> elapsed time (ns): 97555896
>> bytes allocated:   297600
>> pool allocs:   2100
>> [0.0,4200.0,0.0,0.0,4200.0,4200.0,4200.0,4200.0,0.0,4200.0,4200.0]
>>
>> calling LoopCP0 (slightly wrapped)
>>   4.173830 seconds (49.78 M allocations: 2.232 GB, 5.83% gc time)
>> elapsed time (ns): 4173830495
>> gc time (ns):  243516584
>> bytes allocated:   2396838538
>> pool allocs:   49783357
>> GC pauses: 104
>> full collections:  1
>> [4200.0,0.0,4200.0,4200.0,0.0,0.0,0.0,0.0,4200.0,0.0,0.0]
>>
>> calling LoopCP1 (wrapped one way)
>>   5.274723 seconds (59.59 M allocations: 2.378 GB, 3.62% gc time)
>> elapsed time (ns): 5274722983
>> gc time (ns):  191036337
>> bytes allocated:   2553752638
>> pool allocs:   59585834
>> GC pauses: 112
>> [8400.0,0.0,8400.0,8400.0,0.0,0.0,0.0,0.0,8400.0,0.0,0.0]
>>
>> calling LoopCP2 (wrapped another way)
>>   5.212895 seconds (59.58 M allocations: 2.378 GB, 3.60% gc time)
>> elapsed time (ns): 5212894550
>> gc time (ns):  187696529
>> bytes allocated:   2553577600
>> pool allocs:   59582100
>> GC pauses: 111
>> [0.0,8400.0,0.0,0.0,8400.0,8400.0,8400.0,8400.0,0.0,8400.0,8400.0]
>>
>> const dim=1000
>>>
>>>
>>>> type Tech
>>>
>>> a::Array{Float64,1}
>>>
>>> c::Array{Int,1}
>>>
>>>
>>>> function Tech()
>>>
>>> this = new()
>>>
>>> this.a = zeros(Float64, dim)
>>>
>>> this.c = rand([0,1;], dim)
>>>
>>> this
>>>
>>> end
>>>
>>> end
>>>
>>>
>>>> function LoopCP(csign::Int, tech::Tech)
>>>
>>> for j=1:10
>>>
>>> for xRat in [1.:20.;]
>>>
>>> @inbounds for i = 1:dim
>>>
>>> if csign == tech.c[i]
>>>
>>> tech.a[i] += 2.*xRat
>>>
>>> else
>>>
>>> tech.a[i] = 0.
>>>
>>> end
>>>
>>> end
>>>
>>> end #
>>>
>>> end
>>>
>>> nothing
>>>
>>> end
>>>
>>>
>>>> function M_CPS(i::Int, csign::Int, tech::Tech; xRat=0.)
>>>
>>> if csign == tech.c[i]
>>>
>>> tech.a[i] += 2.*xRat
>>>
>>> else
>>>
>>>

[julia-users] Re: "both DataArrays and StatsBase export "rle"; uses of it in module DataFrames must be qualified"

2016-09-28 Thread K leo
Thanks for the reply.  Then this is an issue in DataFrames.

On Wednesday, September 28, 2016 at 5:47:03 PM UTC+8, Patrick Kofod 
Mogensen wrote:
>
> As the error says, they both export a function called rle, so it is not 
> possible to know which one you're trying to call, if you don't qualify 
> them. Qualifying means writing "package name dot" and then the function, as 
> seen below
>
> module A
> export f
> f(x::Int64) = x
> end
>
> module B
> export f
> f(x::Int64) = x+1
> end
>
> using A, B
>
> f(3) # error
> A.f(3) # returns x = 3
> B.f(3) # returns x + 1 = 3 + 1
>
>
>
> On Sunday, September 25, 2016 at 3:15:57 PM UTC+2, K leo wrote:
>>
>> I get a few warning messages like this often.  Does it mean that 
>> DataFrames package need to be updated, or that I need to do something in my 
>> user code?
>>
>

Re: [julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-27 Thread K leo

On Wednesday, September 28, 2016 at 12:53:12 PM UTC+8, K leo wrote:
>
> This a very heavy install.  It's fetching tons of things that I have not 
> used.  Not sure what they are, but seems like trashing my system.
>

julia> Pkg.clone("git://github.com/cstjean/ClobberingReload.jl.git")
INFO: Cloning ClobberingReload from 
git://github.com/cstjean/ClobberingReload.jl.git
INFO: Computing changes...
INFO: Cloning cache of IJulia from 
https://github.com/JuliaLang/IJulia.jl.git
INFO: Cloning cache of Nettle from 
https://github.com/staticfloat/Nettle.jl.git
INFO: Cloning cache of ZMQ from https://github.com/JuliaLang/ZMQ.jl.git
INFO: Installing Conda v0.3.2
INFO: Installing IJulia v1.3.2
INFO: Installing Nettle v0.2.4
INFO: Installing ZMQ v0.3.4
INFO: Building Nettle
INFO: Building ZMQ
INFO: Building IJulia
INFO: Installing Jupyter via the Conda package.
INFO: Downloading miniconda installer ...
  % Total% Received % Xferd  Average Speed   TimeTime Time 
 Current
 Dload  Upload   Total   SpentLeft 
 Speed
100 25.9M  100 25.9M0 0  1104k  0  0:00:24  0:00:24 --:--:-- 
2297k
INFO: Installing miniconda ...
PREFIX=/home/xxx/.julia/v0.5/Conda/deps/usr
installing: _cache-0.0-py27_x0 ...
installing: python-2.7.11-0 ...
installing: conda-env-2.4.5-py27_0 ...
installing: openssl-1.0.2g-0 ...
installing: pycosat-0.6.1-py27_0 ...
installing: pyyaml-3.11-py27_1 ...
installing: readline-6.2-2 ...
installing: requests-2.9.1-py27_0 ...
installing: sqlite-3.9.2-0 ...
installing: tk-8.5.18-0 ...
installing: yaml-0.1.6-0 ...
installing: zlib-1.2.8-0 ...
installing: conda-4.0.5-py27_0 ...
installing: pycrypto-2.6.1-py27_0 ...
installing: pip-8.1.1-py27_1 ...
installing: wheel-0.29.0-py27_0 ...
installing: setuptools-20.3-py27_0 ...
Python 2.7.11 :: Continuum Analytics, Inc.
creating default environment...
installation finished.
Fetching package metadata: 
Solving package specifications: .

Package plan for installation in environment 
/home/xxx/.julia/v0.5/Conda/deps/usr:

The following packages will be downloaded:

package|build
---|-
conda-env-2.6.0|0  502 B
expat-2.1.0|0 365 KB
icu-54.1   |011.3 MB
jpeg-8d|1 806 KB
libffi-3.2.1   |0  36 KB
libgcc-5.2.0   |0 1.1 MB
libsodium-1.0.10   |0 1.2 MB
libxcb-1.12|0 1.5 MB
sqlite-3.13.0  |0 4.0 MB
dbus-1.10.10   |0 2.4 MB
glib-2.43.0|1 5.4 MB
libpng-1.6.22  |0 214 KB
libxml2-2.9.2  |0 4.2 MB
python-2.7.12  |112.1 MB
zeromq-4.1.4   |0 4.1 MB
backports-1.0  |   py27_0   1 KB
backports_abc-0.4  |   py27_0   5 KB
decorator-4.0.10   |   py27_0  12 KB
enum34-1.1.6   |   py27_0  53 KB
freetype-2.5.5 |1 2.5 MB
functools32-3.2.3.2|   py27_0  15 KB
gstreamer-1.8.0|0 2.6 MB
ipython_genutils-0.1.0 |   py27_0  32 KB
markupsafe-0.23|   py27_2  31 KB
mistune-0.7.3  |   py27_0 560 KB
path.py-8.2.1  |   py27_0  45 KB
ptyprocess-0.5.1   |   py27_0  19 KB
pygments-2.1.3 |   py27_0 1.2 MB
pytz-2016.6.1  |   py27_0 178 KB
pyzmq-15.4.0   |   py27_0 705 KB
ruamel_yaml-0.11.14|   py27_0 352 KB
simplegeneric-0.8.1|   py27_1   7 KB
sip-4.18   |   py27_0 264 KB
six-1.10.0 |   py27_0  16 KB
wcwidth-0.1.7  |   py27_0  21 KB
clyent-1.2.2   |   py27_0  15 KB
conda-4.2.9|   py27_0 360 KB
configparser-3.5.0 |   py27_0  31 KB
fontconfig-2.11.1  |6 405 KB
get_terminal_size-1.0.0|   py27_0   4 KB
gst-plugins-base-1.8.0 |0 3.1 MB
jinja2-2.8 |   py27_1 264 KB
jsonschema-2.5.1   |   

Re: [julia-users] Re: Why does Julia 0.5 keep complaining about method re-definitions?

2016-09-27 Thread K leo
This a very heavy install.  It's fetching tons of things that I have not 
used.  Not sure what they are, but seems like trashing my system.

On Wednesday, September 28, 2016 at 4:30:32 AM UTC+8, Cedric St-Jean wrote:
>
> Yeah, it's because of IJulia, sorry about that. I need it to support 
> autoreloading. I could split the package in two, but it's small enough 
> already that it doesn't feel like the right call. 
>
> One day we'll get conditional imports...
>
> On Tue, Sep 27, 2016 at 4:14 PM, Daniel Carrera  > wrote:
>
>> Thanks! You are a savior!
>>
>> Here is something odd: when I installed it with Pkg.clone(...) my Julia 
>> decided that it also had to update Conda and install Jupyter. Is this some 
>> weird quirk of my setup. I notice that you import IJulia, so I guess that 
>> has something to do with it. It's not a big deal; I just thought it was 
>> weird to see the package manager installing stuff like Qt, fontconfig, SSL, 
>> and libxml just to clobber include().
>>
>> But other than that, it works fabulously. Thank you so much!
>>
>> Cheers,
>> Daniel.
>>
>>
>>
>> On 27 September 2016 at 21:45, Cedric St-Jean > > wrote:
>>
>>> I wrote a work-around earlier today:
>>>
>>> Pkg.clone("git://github.com/cstjean/ClobberingReload.jl.git")
>>>
>>> using ClobberingReload: sinclude # silent include
>>> sinclude("foo.jl")   # no redefinition warnings
>>>
>>>
>>> It's fresh off the press, so please file an issue if you encounter a 
>>> problem. It calls `include` under the hood; there's no magic involved. I 
>>> just intercept STDERR and remove the redefinition warnings.
>>>
>>> On Tuesday, September 27, 2016 at 3:13:00 PM UTC-4, Andrew wrote:

 It seems like a lot of people are complaining about this. Is there some 
 way to suppress method overwritten warnings for an include() statement? 
 Perhaps a keyword like include("foo.jl", quietly = true)?

 On Tuesday, September 27, 2016 at 1:56:27 PM UTC-4, Daniel Carrera 
 wrote:
>
> Hello,
>
> I'm not sure when I upgraded, but I am using Julia 0.5 and now it 
> complains every time I redefine a method, which is basically all the 
> time. 
> When I'm developing ideas I usually have a file with a script that I 
> modify 
> and reload all the time:
>
> julia> include("foo.jl");
>
> ... see the results, edit file ...
>
> julia> include("foo.jl");
>
> ... see the results, edit file ...
> julia> include("foo.jl");
>
> ... see the results, edit file ...
>
>
> And so on. This is what I do most of the time. But now every time I 
> `include("foo.jl")` I get warnings for every method that has been 
> redefined 
> (which is all of them):
>
> julia> include("foo.jl");
>
> WARNING: Method definition (::Type{Main.Line})(Float64, Float64) in 
> module Main at /home/daniel/Data/Science/Thesis/SI.jl:4 overwritten at 
> /home/daniel/Data/Science/Thesis/SI.jl:4.
> WARNING: Method definition (::Type{Main.Line})(Any, Any) in module 
> Main at /home/daniel/Data/Science/Thesis/SI.jl:4 overwritten at 
> /home/daniel/Data/Science/Thesis/SI.jl:4.
> WARNING: Method definition new_line(Any, Any, Any) in module Main at 
> /home/daniel/Data/Science/Thesis/SI.jl:8 overwritten at 
> /home/daniel/Data/Science/Thesis/SI.jl:8.
>
>
> Is there a way that this can be fixed? How can I recover Julia's 
> earlier behaviour? This is very irritating, and I don't think it makes 
> sense for a functional language like Julia. If I wrote a method as a 
> variable assignment (e.g. "foo = x -> 2*x") Julia wouldn't complain.
>
>
> Thanks for the help,
> Daniel.
>

>>
>

[julia-users] help understanding different ways of wrapping functions

2016-09-27 Thread K leo
I tested a few different ways of wrapping functions.  It looks different 
ways of wrapping has slightly different costs.  But the most confusing to 
me is that putting everything inline looks much faster than wrapping things 
up.  I would understand this in other languages, but I thought Julia 
advocates simple wrapping.  Can anyone help explain what is happening 
below, and how I can do most efficient wrapping in the demo code?

Demo code is included below.

julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)

julia> testFunc()
calling LoopCP (everything inline)
  0.097556 seconds (2.10 k allocations: 290.625 KB)
elapsed time (ns): 97555896
bytes allocated:   297600
pool allocs:   2100
[0.0,4200.0,0.0,0.0,4200.0,4200.0,4200.0,4200.0,0.0,4200.0,4200.0]

calling LoopCP0 (slightly wrapped)
  4.173830 seconds (49.78 M allocations: 2.232 GB, 5.83% gc time)
elapsed time (ns): 4173830495
gc time (ns):  243516584
bytes allocated:   2396838538
pool allocs:   49783357
GC pauses: 104
full collections:  1
[4200.0,0.0,4200.0,4200.0,0.0,0.0,0.0,0.0,4200.0,0.0,0.0]

calling LoopCP1 (wrapped one way)
  5.274723 seconds (59.59 M allocations: 2.378 GB, 3.62% gc time)
elapsed time (ns): 5274722983
gc time (ns):  191036337
bytes allocated:   2553752638
pool allocs:   59585834
GC pauses: 112
[8400.0,0.0,8400.0,8400.0,0.0,0.0,0.0,0.0,8400.0,0.0,0.0]

calling LoopCP2 (wrapped another way)
  5.212895 seconds (59.58 M allocations: 2.378 GB, 3.60% gc time)
elapsed time (ns): 5212894550
gc time (ns):  187696529
bytes allocated:   2553577600
pool allocs:   59582100
GC pauses: 111
[0.0,8400.0,0.0,0.0,8400.0,8400.0,8400.0,8400.0,0.0,8400.0,8400.0]

const dim=1000
>
>
>> type Tech
>
> a::Array{Float64,1}
>
> c::Array{Int,1}
>
>
>> function Tech()
>
> this = new()
>
> this.a = zeros(Float64, dim)
>
> this.c = rand([0,1;], dim)
>
> this
>
> end
>
> end
>
>
>> function LoopCP(csign::Int, tech::Tech)
>
> for j=1:10
>
> for xRat in [1.:20.;]
>
> @inbounds for i = 1:dim
>
> if csign == tech.c[i]
>
> tech.a[i] += 2.*xRat
>
> else
>
> tech.a[i] = 0.
>
> end
>
> end
>
> end #
>
> end
>
> nothing
>
> end
>
>
>> function M_CPS(i::Int, csign::Int, tech::Tech; xRat=0.)
>
> if csign == tech.c[i]
>
> tech.a[i] += 2.*xRat
>
> else
>
> tech.a[i] = 0.
>
> end
>
> nothing
>
> end
>
>
>> function LoopCP0(csign::Int, tech::Tech)
>
> for j=1:10
>
> for xRat in [1.:20.;]
>
> @inbounds for i = 1:dim
>
> M_CPS(i, csign, tech, xRat=xRat)
>
> end
>
> end #
>
> end
>
> nothing
>
> end
>
>
>> function MoleculeWrapS(csign::Int, tech::Tech, molecule::Function, 
>> xRat=0.)
>
> @inbounds for i = 1:dim
>
> molecule(i, csign, tech; xRat=xRat)
>
> end
>
> nothing
>
> end
>
>
>> function LoopRunnerM1(csign::Int, tech::Tech, molecule::Function)
>
> for j=1:10
>
> for xRat in [1.:20.;]
>
> MoleculeWrapS(csign, tech, molecule, xRat)
>
> end #
>
> end
>
> nothing
>
> end
>
>
>> LoopCP1(csign::Int, tech::Tech) = LoopRunnerM1(csign, tech, M_CPS)
>
>
>> WrapCPS(csign::Int, tech::Tech, xRat=0.) = MoleculeWrapS(csign, tech, 
>> M_CPS, xRat)
>
>
>> function LoopRunnerM2(csign::Int, tech::Tech, loop::Function)
>
> for j=1:10
>
> for xRat in [1.:20.;]
>
> loop(csign, tech, xRat)
>
> end #
>
> end
>
> nothing
>
> end
>
>
>> LoopCP2(csign::Int, tech::Tech) = LoopRunnerM2(csign, tech, WrapCPS)
>
>
>> function testFunc()
>
> tech = Tech()
>
> nloops = 100
>
>
>> println("calling LoopCP (everything inline)")
>
> tech.a = zeros(tech.a)
>
> @timev for i=1:nloops
>
> LoopCP(rand([0,1]), tech)
>
> end
>
> println(tech.a[10:20], "\n")
>
>
>> println("calling LoopCP0 (slightly wrapped)")
>
> tech.a = zeros(tech.a)
>
> @timev for i=1:nloops
>
> LoopCP0(rand([0,1]), tech)
>
> end
>
> println(tech.a[10:20], "\n")
>
>
>> println("calling LoopCP1 (wrapped one way)")
>
> tech.a = zeros(tech.a)
>
> @timev for i=1:nloops
>
> LoopCP1(rand([0,1]), tech)
>
> end
>
> println(tech.a[10:20], "\n")
>
>
>> println("calling LoopCP2 (wrapped another way)")
>
> tech.a = zeros(tech.a)
>
> @timev for i=1:nloops
>
> LoopCP2(rand([0,1]), tech)
>
> end
>
> println(tech.a[10:20], "\n")
>
> 
>
> nothing
>
> end
>
>
>

[julia-users] help understanding memory allocation results

2016-09-26 Thread K leo
I did a memory allocation analysis with "julia --track-allocation=user", 
and got a strange result about a statement (below).  Can anyone help me 
understand what that means?  The function is pretty short and is called 
from within a loop with "i".

- function M_CPB(i::Int, strsys::StrSys; fRet=0.)
- te = strsys.te
128721810672 if strsys.csign == strsys.StrCond[i]
0 baseVal = te.ci[i]*strsys.fRet
 0 RecordBT(strsys)
- else
0 NoUpdate(strsys)
- end
0 nothing
- end



[julia-users] "both DataArrays and StatsBase export "rle"; uses of it in module DataFrames must be qualified"

2016-09-25 Thread K leo
I get a few warning messages like this often.  Does it mean that DataFrames 
package need to be updated, or that I need to do something in my user code?


[julia-users] Is there a way to download a copy of Plots' documentation?

2016-09-25 Thread K leo
in epub or even in pdf


Re: [julia-users] Re: Dict get destroys global variable?

2016-09-22 Thread K leo
Thank you Isaiah for pointing that out!

On Friday, September 23, 2016 at 12:06:17 PM UTC+8, Isaiah wrote:
>
> Use `global a = ...`
> Please see: 
> http://docs.julialang.org/en/latest/manual/variables-and-scoping/#hard-local-scope
>
> global variables are only inherited for reading but not for writing
>
>
>  
>


[julia-users] Re: Dict get destroys global variable?

2016-09-22 Thread K leo
Sorry, this is not related to Dict at all.  If I replace the "a=get..." 
statement with simply "a=2", the global variable is no longer accessible. 
 What is wrong?

On Friday, September 23, 2016 at 11:52:24 AM UTC+8, K leo wrote:
>
> Calling "get" anywhere in a function makes a global variable undefined. 
>  Can anyone please help explaining the following?
>
> 1) without calling "get", the global variable is fine:
>
> a=0
>>
>> Dicta = Dict{Int,Int}()
>>
>> function testGlobal()
>>
>> println(a)
>>
>> merge!(Dicta, Dict(1=>1))
>>
>> # a=get(Dicta, 1, 0)
>>
>> println(a)  
>>
>> nothing
>>
>> end
>>
>>
>> julia> testGlobal()
> 0
> 0
>
> 2) calling "get" (same code as above except uncommenting the "get" 
> statement) and the global variable becomes undefined:
>
> a=0
>>
>> Dicta = Dict{Int,Int}()
>>
>> function testGlobal()
>>
>> println(a)
>>
>> merge!(Dicta, Dict(1=>1))
>>
>> a=get(Dicta, 1, 0)
>>
>> println(a)  
>>
>> nothing
>>
>> end
>>
>>
>> julia> testGlobal()
> ERROR: UndefVarError: a not defined
>  in testGlobal() at /xxx/testType.jl:4
>
> 3) not calling the first println, the code works, but the global a is not 
> set:
>
> a=0
>>
>> Dicta = Dict{Int,Int}()
>>
>> function testGlobal()
>>
>> # println(a)
>>
>> merge!(Dicta, Dict(1=>1))
>>
>> a=get(Dicta, 1, 0)
>>
>> println(a)  
>>
>> nothing
>>
>> end
>>
>>
>>
> julia> testGlobal()
> 1
>
>
>

[julia-users] Dict get destroys global variable?

2016-09-22 Thread K leo
Calling "get" anywhere in a function makes a global variable undefined. 
 Can anyone please help explaining the following?

1) without calling "get", the global variable is fine:

a=0
>
> Dicta = Dict{Int,Int}()
>
> function testGlobal()
>
> println(a)
>
> merge!(Dicta, Dict(1=>1))
>
> # a=get(Dicta, 1, 0)
>
> println(a)  
>
> nothing
>
> end
>
>
> julia> testGlobal()
0
0

2) calling "get" (same code as above except uncommenting the "get" 
statement) and the global variable becomes undefined:

a=0
>
> Dicta = Dict{Int,Int}()
>
> function testGlobal()
>
> println(a)
>
> merge!(Dicta, Dict(1=>1))
>
> a=get(Dicta, 1, 0)
>
> println(a)  
>
> nothing
>
> end
>
>
> julia> testGlobal()
ERROR: UndefVarError: a not defined
 in testGlobal() at /xxx/testType.jl:4

3) not calling the first println, the code works, but the global a is not 
set:

a=0
>
> Dicta = Dict{Int,Int}()
>
> function testGlobal()
>
> # println(a)
>
> merge!(Dicta, Dict(1=>1))
>
> a=get(Dicta, 1, 0)
>
> println(a)  
>
> nothing
>
> end
>
>
>
julia> testGlobal()
1




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

2016-09-21 Thread K leo
I ran some more tests with both my original code and some test codes, now 
with the 0.5 release version.  I would conclude that memory is not leaking. 
 The memory usage as reported by top is the actual memory used or having 
been just used.  Although the usage number does not drop after the code 
finishes, it does not further grow with new runs.  Actually with new runs 
the memory usage starts afresh.

It could be that the release version of 0.5 fixes this.  Anyway before any 
further evidence, we can disregard this thread now.

On Thursday, September 22, 2016 at 10:11:46 AM UTC+8, Yichao Yu wrote:
>
> On Wed, Sep 21, 2016 at 10:04 PM, Luke Stagner <lstag...@gmail.com 
> > wrote: 
> > In trying to create a reduced test case I figured out the source of my 
> > memory leak. It wasn't caused by Julia but by an external library I was 
>
> Good to know. 
>
> > calling (Sundials.jl). Pulling the dev version of Sundials.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 Wed, Sep 21, 2016 at 8:50 PM, Yichao Yu <yyc...@gmail.com> wrote: 
> >> > On Mon, Sep 19, 2016 at 9:14 PM, Luke Stagner <lstag...@gmail.com> 
> >> > 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 but it never released the memory between calls. I tried 
> >> >> inserting 
> >> >> `gc()` manually but that didn't do anything either. 
> >> > 
> >> > I don't have time currently but I'll try to reproduce it in a few 
> days. 
> >> > What's your versioninfo() and how did you install julia? 
> >> 
> >> In the mean time, I would also appreciate if you can reduce it a 
> >> little, especially if you can remove some of the external 
> >> dependencies. 
> >> 
> >> > 
> >> >> 
> >> >> -Luke 
> >> >> 
> >> >> 
> >> >> On Monday, September 19, 2016 at 3:08:52 PM UTC-7, K leo wrote: 
> >> >>> 
> >> >>> The only package used (at the global level) is DataFrames.  Does 
> that 
> >> >>> not 
> >> >>> release memory? 
> >> >>> 
> >> >>> On Tuesday, September 20, 2016 at 6:05:58 AM UTC+8, K leo wrote: 
> >> >>>> 
> >> >>>> No.  After myfunction() finished and I am at the REPL prompt, top 
> >> >>>> shows 
> >> >>>> Julia taking 49%.  And after I did gc(), it shows Julia taking 
> 48%. 
> >> >>>> 
> >> >>>> On Tuesday, September 20, 2016 at 4:05:56 AM UTC+8, Randy Zwitch 
> >> >>>> wrote: 
> >> >>>>> 
> >> >>>>> Does the problem go away if you run gc()? 
> >> >>>>> 
> >> >>>>> 
> >> >>>>> 
> >> >>>>> On Monday, September 19, 2016 at 3:55:14 PM UTC-4, K leo wrote: 
> >> >>>>>> 
> >> >>>>>> Thanks for the suggestion about valgrind. 
> >> >>>>>> 
> >> >>>>>> Can someone please let me first understand the expected 
> behaviour 
> >> >>>>>> for 
> >> >>>>>> memory usage. 
> >> >>>>>> 
> >> >>>>>> Let's say when I first starts Julia REPL it takes 5% of RAM 
> >> >>>>>> (according 
> >> >>>>>> to top).  Then I include "myfile.jl" and run myfunction(). 
>  During 
> >> >>>>>> the 
> >> >>>>>> execution of myfunction(), memory allocation of Julia reaches 
> 40% 
> >> >>>>>> of RAM 
> >> >>>>>> (again according to top).  Say running myfunction() involves no 
> >> >>>>>> allocation 
> >> >>>>>> of global objects - all object used are local.  Then when 
> >> >>>>>> myfunction() 
> >> >>>>>> finished and I am at the REPL prompt, should top show the memory 
> >> >>>>>> usage of 
> >> >>>>>> Julia drops down to the previous level (5% of RAM)?  My current 
> >> >>>>>> observation 
> >> >>>>>> is that it doesn't.  Is this the expected behaviour? 
> >> >>>>>> 
> >> >> 
>


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

2016-09-21 Thread K leo
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 there is no mechanism in Julia like in C/C++ for the programmer to 
free previously allocated memory, I don't believe that this is due to my 
coding errors (I only allocate memory without freeing them in the code).  I 
hope someone can point out to situations where this problem might occur so 
that I can check them out.  For now all I know is that my code allocates 
memory when it runs and those memory are not getting released even after 
the code has finished.

I will try to see if I can cook up some demo code.

On Wednesday, September 21, 2016 at 9:53:07 PM UTC+8, Páll Haraldsson wrote:
>
> On Sunday, September 18, 2016 at 12:53:19 PM UTC, K leo wrote:
>
>> Any thoughts on what might be the culprit?
>>
>>   | | |_| | | | (_| |  |  Version 0.5.0-rc4+0 (2016-09-09 01:43 UTC)
>>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
>>
>
> You say 0.5 in the title (when 0.5 wasn't out). Your later posts are after 
> 0.5 is out. Maybe it doesn't matter, I don't know, maybe the final version 
> is identical (except for versioninfo function..), I just do not know that 
> for a fact, so might as well upgrade just in case.
>
> -- 
> Palli.
>
>
>
>

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

2016-09-20 Thread K leo
@Luke Stagner

Since this appears a problem.  Perhaps you can file an issue with your demo 
code.

On Tuesday, September 20, 2016 at 9:14:44 AM UTC+8, 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 
> <https://gist.github.com/lstagner/52cb5a2ec88b7b734035f013ca41e650> (sorry 
> its not very clean).  I tried to run the function `make_distribution_file` 
> in a loop in julia but it never released the memory between calls. I tried 
> inserting `gc()` manually but that didn't do anything either.
>
> -Luke 
>
> On Monday, September 19, 2016 at 3:08:52 PM UTC-7, K leo wrote:
>>
>> The only package used (at the global level) is DataFrames.  Does that not 
>> release memory?
>>
>> On Tuesday, September 20, 2016 at 6:05:58 AM UTC+8, K leo wrote:
>>>
>>> No.  After myfunction() finished and I am at the REPL prompt, top shows 
>>> Julia taking 49%.  And after I did gc(), it shows Julia taking 48%. 
>>>
>>> On Tuesday, September 20, 2016 at 4:05:56 AM UTC+8, Randy Zwitch wrote:
>>>>
>>>> Does the problem go away if you run gc()?
>>>>
>>>>
>>>>
>>>> On Monday, September 19, 2016 at 3:55:14 PM UTC-4, K leo wrote:
>>>>>
>>>>> Thanks for the suggestion about valgrind.
>>>>>
>>>>> Can someone please let me first understand the expected behaviour for 
>>>>> memory usage.
>>>>>
>>>>> Let's say when I first starts Julia REPL it takes 5% of RAM (according 
>>>>> to top).  Then I include "myfile.jl" and run myfunction().  During the 
>>>>> execution of myfunction(), memory allocation of Julia reaches 40% of RAM 
>>>>> (again according to top).  Say running myfunction() involves no 
>>>>> allocation 
>>>>> of global objects - all object used are local.  Then when myfunction() 
>>>>> finished and I am at the REPL prompt, should top show the memory usage of 
>>>>> Julia drops down to the previous level (5% of RAM)?  My current 
>>>>> observation 
>>>>> is that it doesn't.  Is this the expected behaviour?
>>>>>
>>>>>

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

2016-09-19 Thread K leo
The only package used (at the global level) is DataFrames.  Does that not 
release memory?

On Tuesday, September 20, 2016 at 6:05:58 AM UTC+8, K leo wrote:
>
> No.  After myfunction() finished and I am at the REPL prompt, top shows 
> Julia taking 49%.  And after I did gc(), it shows Julia taking 48%. 
>
> On Tuesday, September 20, 2016 at 4:05:56 AM UTC+8, Randy Zwitch wrote:
>>
>> Does the problem go away if you run gc()?
>>
>>
>>
>> On Monday, September 19, 2016 at 3:55:14 PM UTC-4, K leo wrote:
>>>
>>> Thanks for the suggestion about valgrind.
>>>
>>> Can someone please let me first understand the expected behaviour for 
>>> memory usage.
>>>
>>> Let's say when I first starts Julia REPL it takes 5% of RAM (according 
>>> to top).  Then I include "myfile.jl" and run myfunction().  During the 
>>> execution of myfunction(), memory allocation of Julia reaches 40% of RAM 
>>> (again according to top).  Say running myfunction() involves no allocation 
>>> of global objects - all object used are local.  Then when myfunction() 
>>> finished and I am at the REPL prompt, should top show the memory usage of 
>>> Julia drops down to the previous level (5% of RAM)?  My current observation 
>>> is that it doesn't.  Is this the expected behaviour?
>>>
>>>

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

2016-09-19 Thread K leo
No.  After myfunction() finished and I am at the REPL prompt, top shows 
Julia taking 49%.  And after I did gc(), it shows Julia taking 48%. 

On Tuesday, September 20, 2016 at 4:05:56 AM UTC+8, Randy Zwitch wrote:
>
> Does the problem go away if you run gc()?
>
>
>
> On Monday, September 19, 2016 at 3:55:14 PM UTC-4, K leo wrote:
>>
>> Thanks for the suggestion about valgrind.
>>
>> Can someone please let me first understand the expected behaviour for 
>> memory usage.
>>
>> Let's say when I first starts Julia REPL it takes 5% of RAM (according to 
>> top).  Then I include "myfile.jl" and run myfunction().  During the 
>> execution of myfunction(), memory allocation of Julia reaches 40% of RAM 
>> (again according to top).  Say running myfunction() involves no allocation 
>> of global objects - all object used are local.  Then when myfunction() 
>> finished and I am at the REPL prompt, should top show the memory usage of 
>> Julia drops down to the previous level (5% of RAM)?  My current observation 
>> is that it doesn't.  Is this the expected behaviour?
>>
>>

[julia-users] Re: How to deal with methods redefinition warnings in 0.5?

2016-09-19 Thread K leo
To me, these methods redefinition warnings are pretty annoying - there are 
zillions of them.  Why should they be there?  Look, when I do a include 
again, I know I am overriding those methods in my file.  

On Monday, September 12, 2016 at 9:50:27 PM UTC+8, K leo wrote:
>
> After calling workspace(), there are even a lot of warnings regarding 
> methods in packages.
>
>

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

2016-09-19 Thread K leo
Thanks for the suggestion about valgrind.

Can someone please let me first understand the expected behaviour for 
memory usage.

Let's say when I first starts Julia REPL it takes 5% of RAM (according to 
top).  Then I include "myfile.jl" and run myfunction().  During the 
execution of myfunction(), memory allocation of Julia reaches 40% of RAM 
(again according to top).  Say running myfunction() involves no allocation 
of global objects - all object used are local.  Then when myfunction() 
finished and I am at the REPL prompt, should top show the memory usage of 
Julia drops down to the previous level (5% of RAM)?  My current observation 
is that it doesn't.  Is this the expected behaviour?



[julia-users] Re: What is the best way to element-wise right shift an array?

2016-09-18 Thread K leo
OK, ran a test.  And the difference is pretty dramatic.  Look:

  | | |_| | | | (_| |  |  Version 0.5.0-rc4+0 (2016-09-09 01:43 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-pc-linux-gnu

julia> include("testArray.jl")

julia> testShift()
using: A=[0; A[1:end-1]]
elapsed time: *5.341734653* seconds
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] 9
using unshift! and deleteat!
elapsed time: *0.00066514* seconds
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] 9

function testShift()
>
> A=[1:10;]
>
> println("using: A=[0; A[1:end-1]]")
>
> tic()
>
> for i=1:1
>
> A=[0; A[1:end-1]]
>
> end
>
> toc()
>
> println(A[1:20], " ", A[10009])
>
> 
>
> B=[1:10;]
>
> println("using unshift! and deleteat!")
>
> tic()
>
> for i=1:1
>
> unshift!(B, 0)
>
> deleteat!(B, length(A))
>
> end
>
> toc()
>
> println(B[1:20], " ", B[10009])
>
> nothing
>
> end
>
>
>
On Sunday, September 18, 2016 at 9:17:11 PM UTC+8, David P. Sanders wrote:
>
> You should also benchmark the simple for loop. Please report back with the 
> results. 



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

2016-09-18 Thread K leo
I am also wondering what information I should look into.

On Sunday, September 18, 2016 at 9:30:00 PM UTC+8, Yichao Yu wrote:
>
>
> Impossible to tell without any information provided. 
>


[julia-users] Does Julia 0.5 leak memory?

2016-09-18 Thread K leo
I run Julia through repl.  The procedure is simple: include("myfile.jl"), 
then run myfunction() (I might do a Ctrl-C to interrupt the function), edit 
something in myfile.jl, then repeat.  Initially, julia processes normally 
take less than 10% RAM, then after some time, one main Julia process takes 
over 70% of the 4GB RAM.  Even myfunction finishes running with real 
idling, it still takes that much RAM.  My code uses nearly no global 
objects, and myfunction ends with nothing as the last statement.

myfunction isn't new though I keep modifying it from time to time.  Julia 
0.4.6 does not appear to have this issue.

Any thoughts on what might be the culprit?

  | | |_| | | | (_| |  |  Version 0.5.0-rc4+0 (2016-09-09 01:43 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-pc-linux-gnu



[julia-users] What is the best way to element-wise right shift an array?

2016-09-18 Thread K leo
I have been using simply A=[0; A[1:end-1]], but found it to be somehow 
quite expensive.  I saw that there is unshift! but it has to be followed up 
with deleteat! to make the array the same size, i.e. there need to be two 
operations.  So how can I get a better performance doing the shift?


Re: [julia-users] Does anyone know how jl_calls may have to do with SIGUSER1?

2016-09-12 Thread K leo
Thanks for the reply.
I registered a signal handler before calling these and the code now does 
not terminate and appears to run fine.  Will my handler cause problems to 
the jl_calls?
The documentation mentions about SIGUSER2 with the profiler BTW.

On Monday, September 12, 2016 at 10:06:04 PM UTC+8, Yichao Yu wrote:
>
>
>
> On Mon, Sep 12, 2016 at 10:03 AM, K leo <cnbi...@gmail.com > 
> wrote:
>
>> I put the following lines in my C++ code. These are only executed once 
>> near the beginning of the code 
>> and run fine. There are no other julia related statements in the code. 
>> But with the presence of these statements in the code, whenever the code 
>> does some communications requests on the Internet 
>> later on, the code gets a user defined signal 1 and terminates. If I 
>> comment out these lines, then the code 
>> does not get the signal and runs fine. Anyone can shed some light on what 
>> might be going on?
>>
>
> This registers signal handler for SIGUSR1 (which is also used for 
> profiling) and the origin of the signal is probably from elsewhere (e.g. 
> the library you are using).
>  
>
>>
>> jl_init(NULL);
>>
>> jl_load(filename);
>> mod = (jl_value_t*)jl_eval_string(moduleName);
>> JuliaFunc = jl_get_function((jl_module_t*)mod,"TestFunc");
>>
>>
>>
>

[julia-users] Does anyone know how jl_calls may have to do with SIGUSER1?

2016-09-12 Thread K leo
I put the following lines in my C++ code. These are only executed once near 
the beginning of the code 
and run fine. There are no other julia related statements in the code. 
But with the presence of these statements in the code, whenever the code 
does some communications requests on the Internet 
later on, the code gets a user defined signal 1 and terminates. If I 
comment out these lines, then the code 
does not get the signal and runs fine. Anyone can shed some light on what 
might be going on?

jl_init(NULL);

jl_load(filename);
mod = (jl_value_t*)jl_eval_string(moduleName);
JuliaFunc = jl_get_function((jl_module_t*)mod,"TestFunc");




[julia-users] Re: How to deal with methods redefinition warnings in 0.5?

2016-09-12 Thread K leo
After calling workspace(), there are even a lot of warnings regarding 
methods in packages.

On Monday, September 12, 2016 at 6:57:47 PM UTC+8, felip...@gmail.com wrote:
>
> Try calling workspace() before repeating include.



[julia-users] How to deal with methods redefinition warnings in 0.5?

2016-09-11 Thread K leo
I see the new behavior in 0.5 when I do include("file.jl") again on REPL, I 
get a bunch of warnings about methods definition overwritten.  What can I 
do?  Am I supposed to be able to include("file.jl") after I modify 
something in it?



Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-11 Thread K leo
Thanks so much for the guide, Bart.  Will study.

On Monday, September 12, 2016 at 5:18:52 AM UTC+8, Bart Janssens wrote:
>
> On Sun, Sep 11, 2016 at 2:47 AM K leo <cnbi...@gmail.com > 
> wrote:
>
>> Hi Bart,
>>
>> These are meant to call Julia code from C++.  You mentioned "there may be 
>> easier ways using Cxx.jl or CxxWrap.jl".  Are the two packages only for 
>> calling C/C++ from Julia, and not the otherway around?  Am I missing 
>> something?
>>
>>
> Yes, both are initialized from Julia. So you would use them to start your 
> C++ framework, but then you can call back into Julia from there (you don't 
> need the jl_init stuff then, a nice bonus). I've added a test replicating 
> your example to CxxWrap.jl:
>
> https://github.com/barche/CxxWrap.jl/commit/9711b4d6baca99c2c30280d197bba3168167ed59
>
> In Cxx.jl, as Keno said you can implement a C++ (member) function using 
> Julia code, like this for example:
>
> using Cxx
> using Base.Test
>
> type JuliaTestType
>   a::Float64
>   b::Float64
> end
>
> function julia_test_func(data)
>   println("a: ", data.a, ", b: ", data.b)
>   @test data.a == 2.
>   @test data.b == 3.
>   nothing
> end
>
> # Declare a C++ class
> cxx"""
> class CppClass {
> public:
>   void call_julia();
> };
> """
>
> # Implement member function in Julia
> @cxxm "void CppClass::call_julia()" begin
>   A = JuliaTestType(2.,3.)
>   julia_test_func(A)
> end
>
> # Call C++ function
> icxx"""
> CppClass a;
> a.call_julia();
> """
>
>

Re: [julia-users] Re: There is very little overhead calling Julia from C++

2016-09-11 Thread K leo
Sorry, how to tell from these numbers that using jl_call from C++ is about 
25 times slower than using ccall from Julia?

On Monday, September 12, 2016 at 5:33:02 AM UTC+8, Bart Janssens wrote:
>
> On Fri, Sep 9, 2016 at 1:40 AM Steven G. Johnson  > wrote:
>
>> Except that in your example code, you aren't calling the Julia code 
>> through a raw C function pointer.   You are calling it through jl_call0, 
>> which *does* have a fair amount of overhead (which you aren't seeing 
>> because the function execution is expensive enough to hide the call 
>> overhead).
>>
>>
> To confirm this, I added it to my worst-case benchmark in CxxWrap.jl. 
> Using jl_call from C++ is about 25 times slower than using ccall from 
> Julia. The function here just divides a number by 2, so it needs boxing and 
> unboxing. Test code here:
>
> https://github.com/barche/CxxWrap.jl/blob/master/deps/src/examples/functions.cpp#L103-L111
>
> Timings:
> Pure Julia test:
>   0.061723 seconds (4 allocations: 160 bytes)
> ccall test:
>   0.092434 seconds (4 allocations: 160 bytes)
> CxxWrap.jl test:
>   0.139052 seconds (4 allocations: 160 bytes)
> Pure C++:
>   0.057972 seconds (4 allocations: 160 bytes)
> jl_call inside C++ loop (array is 100 times smaller than other tests):
>   0.025484 seconds (1.00 M allocations: 15.259 MB, 4.84% gc time)
>
> That said, if the test you did is representative of your real-world 
> problem, it should be fine.
>
> Cheers,
>
> Bart
>
>

Re: [julia-users] How does garbage collection really work in Julia?

2016-09-10 Thread K leo
Thanks for clearing.  I see that I used wrong word, "clear" instead of 
"collect".  Then can I rephrase my questions below:

On Sunday, September 11, 2016 at 9:31:35 AM UTC+8, Yichao Yu wrote:
>
>
>
> On Sat, Sep 10, 2016 at 8:00 PM, K leo <cnbi...@gmail.com > 
> wrote:
>
>>
>>
>> On Sunday, September 11, 2016 at 7:35:41 AM UTC+8, Yichao Yu wrote:
>>>
>>>
>>>
>>> On Sat, Sep 10, 2016 at 6:46 PM, K leo <cnbi...@gmail.com> wrote:
>>>
>>>> Thanks for the reply.  A couple questions: 
>>>>
>>>
>>>> 1) When I quit Julia and do a fresh start, is the tally set to zero?
>>>>
>>>
>>> Memory in different processes are totally unrelated.
>>>
>> So when I start a new Julia process, the tally starts at zero?
>>
>
> The GC uses a number of counters to decide when to do a collection. They 
> are maintained differently and "start at zero" is almost a meaningless. 
> They are independent and almost start in the same state.
>  
>
>>  
>>
>>>  
>>>
>>>> 2) When GC does a pass, does it clear out everything so the tally is 
>>>> set to zero, or does it do a partial clearance?
>>>>
>>>
>>> Neither
>>>
>> How can it be neither?  What can be a third choice with this question?
>>
>
> Nothing is cleared. Dead objects are collected to be reused later without 
> clearing.
>  
>
 
When GC does a pass, does it collect everything so the tally is set to 
zero, or does it do a partial collection?
 

>  
>>
>>>  
>>>
>>>> 3) I presume it is the latter case in question 2).  So does GC clear 
>>>> out things on first-in-first-out bases or what?
>>>>
>>>
>>> Not applicable.
>>>
>>
I presume it is the latter case in question 2).  So does GC collect things 
on first-in-first-out bases or what?
 

>  
>>>
>>>> 4) When the tally becomes big enough, does GC make sure to keep objects 
>>>> that are referenced for future use in (Julia) code?
>>>>
>>>
>>> See the link below
>>>  
>>>
>>>> 5) Do local objects (things allocated and only used within functions 
>>>> for instance) get cleared out immediately when the functions terminate so 
>>>> they don't take up quota in the tally?
>>>>
>>>>
>>> No
>>>
>> Or perhaps those local objects have higher priorities of getting cleared 
>> out?
>>
>
> No.
>

 Do local objects (things allocated and only used within functions for 
instance) get collected immediately when the functions terminate so they 
don't take up quota in the tally?  Or perhaps those local objects have 
higher priorities of getting collected?

 
>
>>  
>>
>>>  
>>>
>>>
>>> Please check https://en.wikipedia.org/wiki/Tracing_garbage_collection 
>>> for basic concepts related to garbage collection.
>>>
>>>  
>>>
>>>>
>>>>

Re: [julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-10 Thread K leo
Then how do we protect different objects that get allocated at different 
points in code?

On Sunday, September 11, 2016 at 9:33:00 AM UTC+8, Yichao Yu wrote:
>
>
>
> No, there can only be one `JL_GC_PUSH` in a C scope (and the corresponding 
> `JL_GC_POP` must happen before the program exit from the scope)
>  
>
>>
>>

Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-10 Thread K leo
Hi Bart,

These are meant to call Julia code from C++.  You mentioned "there may be 
easier ways using Cxx.jl or CxxWrap.jl".  Are the two packages only for 
calling C/C++ from Julia, and not the otherway around?  Am I missing 
something?

On Saturday, September 10, 2016 at 3:38:27 AM UTC+8, Bart Janssens wrote:
>
>
>
> On Fri, Sep 9, 2016 at 6:44 PM Isaiah Norton  > wrote:
>
>>// construct a TestType instance
>>
>> jl_value_t* jl_A = 
>> jl_new_struct((jl_datatype_t*)jl_get_function((jl_module_t*)mod, 
>> "TestType"),
>>  jl_box_float64(A.a), 
>> jl_box_float64(A.b));
>>
>>
> The arguments to jl_new_struct need to be rooted, so you should do 
> something like:
> jl_value_t* a = NULL;
> jl_value_t* b = NULL;
> JL_GC_PUSH2(a,b);
> a = jl_box_float64(A.a);
> b = jl_box_float64(A.b);
> // use a and b in the new struct call
> JL_GC_POP();
>
> What is the objective here? If this is still to be used from C++, there 
> may be easier ways using Cxx.jl or CxxWrap.jl.
>
> Cheers,
>
> Bart
>


Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-10 Thread K leo
Hi Bart,

Do you think "jl_A" should also be rooted as it is later used as the 
argument?

On Saturday, September 10, 2016 at 3:38:27 AM UTC+8, Bart Janssens wrote:
>
>
>
> On Fri, Sep 9, 2016 at 6:44 PM Isaiah Norton  > wrote:
>
>>// construct a TestType instance
>>
>> jl_value_t* jl_A = 
>> jl_new_struct((jl_datatype_t*)jl_get_function((jl_module_t*)mod, 
>> "TestType"),
>>  jl_box_float64(A.a), 
>> jl_box_float64(A.b));
>>
>>
> The arguments to jl_new_struct need to be rooted, so you should do 
> something like:
> jl_value_t* a = NULL;
> jl_value_t* b = NULL;
> JL_GC_PUSH2(a,b);
> a = jl_box_float64(A.a);
> b = jl_box_float64(A.b);
> // use a and b in the new struct call
> JL_GC_POP();
>
> What is the objective here? If this is still to be used from C++, there 
> may be easier ways using Cxx.jl or CxxWrap.jl.
>
> Cheers,
>
> Bart
>


[julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-10 Thread K leo
I tried to nest the GC pairs (JL_GC_PUSH, JL_GC_POP), but got some compile 
errors regarding julia.h.

In file included from test6.cpp:11:0:
> test6.cpp: In function ‘int main(int, char**)’:
> /home/xxx/Software/julia-9c76c3e89a/include/julia/julia.h:609:19: error: 
> redeclaration of ‘void* __gc_stkf []’
>void *__gc_stkf[] = {(void*)3, jl_pgcstack, arg1}; 
>  \
>^
> test6.cpp:44:5: note: in expansion of macro ‘JL_GC_PUSH1’
>  JL_GC_PUSH1();
>  ^
> /home/xxx/Software/julia-9c76c3e89a/include/julia/julia.h:613:9: note: 
> ‘void* __gc_stkf [4]’ previously declared here
>void *__gc_stkf[] = {(void*)5, jl_pgcstack, arg1, arg2};   
>  \
>  ^
> test6.cpp:35:5: note: in expansion of macro ‘JL_GC_PUSH2’
>  JL_GC_PUSH2(,);


So is nesting them not allowed, or is it a bug in julia.h?

My test C++ code is here:

#include 
#include 
#include 
using namespace std;
#include 
#include 
using namespace std;
struct TestType {
double a;
double b;
};
int main(int argc, char *argv[])
{
TestType A, *ret;
A.a=2.;
A.b=3.;
jl_init(NULL);
jl_load("TestArg.jl");
jl_value_t * mod = (jl_value_t*)jl_eval_string("TestArg");
jl_value_t* a=NULL;
jl_value_t* b=NULL;
JL_GC_PUSH2(,);
a = jl_box_float64(A.a);
b = jl_box_float64(A.b);
jl_value_t* jl_A = 
jl_new_struct((jl_datatype_t*)jl_get_function((jl_module_t*)mod, 
"TestType"), a, b);
   // construct a TestType instance
jl_function_t * func = jl_get_function((jl_module_t*)mod,"TestFunc");
ret = (TestType*) jl_call1(func, jl_A);
JL_GC_PUSH1();
cout

Re: [julia-users] How does garbage collection really work in Julia?

2016-09-10 Thread K leo


On Sunday, September 11, 2016 at 7:35:41 AM UTC+8, Yichao Yu wrote:
>
>
>
> On Sat, Sep 10, 2016 at 6:46 PM, K leo <cnbi...@gmail.com > 
> wrote:
>
>> Thanks for the reply.  A couple questions: 
>>
>
>> 1) When I quit Julia and do a fresh start, is the tally set to zero?
>>
>
> Memory in different processes are totally unrelated.
>
So when I start a new Julia process, the tally starts at zero?
 

>  
>
>> 2) When GC does a pass, does it clear out everything so the tally is set 
>> to zero, or does it do a partial clearance?
>>
>
> Neither
>
How can it be neither?  What can be a third choice with this question?
 

>  
>
>> 3) I presume it is the latter case in question 2).  So does GC clear out 
>> things on first-in-first-out bases or what?
>>
>
> Not applicable.
>  
>
>> 4) When the tally becomes big enough, does GC make sure to keep objects 
>> that are referenced for future use in (Julia) code?
>>
>
> See the link below
>  
>
>> 5) Do local objects (things allocated and only used within functions for 
>> instance) get cleared out immediately when the functions terminate so they 
>> don't take up quota in the tally?
>>
>>
> No
>
Or perhaps those local objects have higher priorities of getting cleared 
out?
 

>  
>
>
> Please check https://en.wikipedia.org/wiki/Tracing_garbage_collection for 
> basic concepts related to garbage collection.
>
>  
>
>>
>> On Sunday, September 11, 2016 at 12:16:05 AM UTC+8, Tim Holy wrote:
>>>
>>> Every time julia allocates memory, it adds the number of bytes to a 
>>> running tally; once that tally gets big enough, it does a 
>>> garbage-collection pass (and resets the tally). Consequently GC is 
>>> triggered only when you allocate, but even the smallest allocation can 
>>> trigger GC if it pushes the tally over the threshold. It thus depends on 
>>> where that tally was when you started. Keep in mind that there are many 
>>> uses of memory that may not be obvious; for example, JIT compilation uses 
>>> memory because julia code is compiled by julia code.
>>>
>>>  
>>>
>>> Best,
>>>
>>> --Tim
>>>
>>>  
>>>
>>> On Saturday, September 10, 2016 7:05:18 AM CDT K leo wrote:
>>>
>>> > Let's say in REPL you define an object, then after many many other
>>>
>>> > operations, Julia's GC wouldn't free the object you defined earlier 
>>> until
>>>
>>> > you exit Julia or you somehow really run out of memory or something. Is
>>>
>>> > that the correct understanding?
>>>
>>> > 
>>>
>>> > Now I am trying to think what happens with the jl_... calls one 
>>> performs
>>>
>>> > from C/C++ code. The procedure is that one calls jl_init first to 
>>> start a
>>>
>>> > Julia session, then a bunch other jl_... calls to handle some data, and
>>>
>>> > then at last jl_atexit_hook to stop using Julia. Is the mechanism here
>>>
>>> > similar to REPL in the sense that the Julia session is up and running
>>>
>>> > before one calls jl_atexit_hook? So Julia GC would not free objects you
>>>
>>> > created with jl_... calls until you exit or you somehow really run out 
>>> of
>>>
>>> > memory or something.
>>>
>>> > 
>>>
>>> > Having read the section in Embedding Julia, I get the sense that it is 
>>> the
>>>
>>> > case. So we only need to worry about GC after all jl_... calls, not in
>>>
>>> > 
>>>
>>> > between jl_... calls. So here it says :
>>>
>>> > > “However, it is generally safe to use pointers in between jl_... 
>>> calls.
>>>
>>> > > 
>>>
>>> > >> But in order to make sure that values can survive jl_... calls, we 
>>> have
>>>
>>> > >> to
>>>
>>> > >> tell Julia that we hold a reference to a Julia value. ”
>>>
>>> > > 
>>>
>>> > > Excerpt From: unknown. “Julia Language 0.6.0-dev documentation.” 
>>> iBooks.
>>>
>>> > > 
>>>
>>> > > Is my understanding correct? Or can anyone please explain otherwise?
>>>
>>>  
>>>
>>>  
>>>
>>
>

Re: [julia-users] How does garbage collection really work in Julia?

2016-09-10 Thread K leo
Thanks for the reply.  A couple questions:

1) When I quit Julia and do a fresh start, is the tally set to zero?
2) When GC does a pass, does it clear out everything so the tally is set to 
zero, or does it do a partial clearance?
3) I presume it is the latter case in question 2).  So does GC clear out 
things on first-in-first-out bases or what?
4) When the tally becomes big enough, does GC make sure to keep objects 
that are referenced for future use in (Julia) code?
5) Do local objects (things allocated and only used within functions for 
instance) get cleared out immediately when the functions terminate so they 
don't take up quota in the tally?

On Sunday, September 11, 2016 at 12:16:05 AM UTC+8, Tim Holy wrote:
>
> Every time julia allocates memory, it adds the number of bytes to a 
> running tally; once that tally gets big enough, it does a 
> garbage-collection pass (and resets the tally). Consequently GC is 
> triggered only when you allocate, but even the smallest allocation can 
> trigger GC if it pushes the tally over the threshold. It thus depends on 
> where that tally was when you started. Keep in mind that there are many 
> uses of memory that may not be obvious; for example, JIT compilation uses 
> memory because julia code is compiled by julia code.
>
>  
>
> Best,
>
> --Tim
>
>  
>
> On Saturday, September 10, 2016 7:05:18 AM CDT K leo wrote:
>
> > Let's say in REPL you define an object, then after many many other
>
> > operations, Julia's GC wouldn't free the object you defined earlier until
>
> > you exit Julia or you somehow really run out of memory or something. Is
>
> > that the correct understanding?
>
> > 
>
> > Now I am trying to think what happens with the jl_... calls one performs
>
> > from C/C++ code. The procedure is that one calls jl_init first to start a
>
> > Julia session, then a bunch other jl_... calls to handle some data, and
>
> > then at last jl_atexit_hook to stop using Julia. Is the mechanism here
>
> > similar to REPL in the sense that the Julia session is up and running
>
> > before one calls jl_atexit_hook? So Julia GC would not free objects you
>
> > created with jl_... calls until you exit or you somehow really run out of
>
> > memory or something.
>
> > 
>
> > Having read the section in Embedding Julia, I get the sense that it is 
> the
>
> > case. So we only need to worry about GC after all jl_... calls, not in
>
> > 
>
> > between jl_... calls. So here it says :
>
> > > “However, it is generally safe to use pointers in between jl_... calls.
>
> > > 
>
> > >> But in order to make sure that values can survive jl_... calls, we 
> have
>
> > >> to
>
> > >> tell Julia that we hold a reference to a Julia value. ”
>
> > > 
>
> > > Excerpt From: unknown. “Julia Language 0.6.0-dev documentation.” 
> iBooks.
>
> > > 
>
> > > Is my understanding correct? Or can anyone please explain otherwise?
>
>  
>
>  
>


[julia-users] How does garbage collection really work in Julia?

2016-09-10 Thread K leo
Let's say in REPL you define an object, then after many many other 
operations, Julia's GC wouldn't free the object you defined earlier until 
you exit Julia or you somehow really run out of memory or something.  Is 
that the correct understanding?

Now I am trying to think what happens with the jl_... calls one performs 
from C/C++ code.  The procedure is that one calls jl_init first to start a 
Julia session, then a bunch other jl_... calls to handle some data, and 
then at last jl_atexit_hook to stop using Julia.  Is the mechanism here 
similar to REPL in the sense that the Julia session is up and running 
before one calls  jl_atexit_hook?  So Julia GC would not free objects you 
created with jl_... calls until you exit or you somehow really run out of 
memory or something.

Having read the section in Embedding Julia, I get the sense that it is the 
case.  So we only need to worry about GC after all jl_... calls, not in 
between jl_... calls.  So here it says :
>
> “However, it is generally safe to use pointers in between jl_... calls. 
>> But in order to make sure that values can survive jl_... calls, we have to 
>> tell Julia that we hold a reference to a Julia value. ”
>
> Excerpt From: unknown. “Julia Language 0.6.0-dev documentation.” iBooks. 
>
> Is my understanding correct?  Or can anyone please explain otherwise?



Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-10 Thread K leo


On Saturday, September 10, 2016 at 9:12:10 PM UTC+8, Yichao Yu wrote:
>
>
>
> On Sat, Sep 10, 2016 at 8:53 AM, K leo <cnbi...@gmail.com > 
> wrote:
>
>>  julia-config.jl is hardly useful at all.  I unpacked the Linux binary of 
>> Julia (0.5) in ~/Software/julia-9c76c3e89a, and I set JULIA_DIR 
>> accordingly. When I execute julia-config in the following way, I got all 
>> kinds of "undefined reference to" error messages.
>>
>> > $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs | 
>> xargs g++ test6.cpp
>> /usr/bin/ld: warning: libLLVM-3.7.1.so, needed by 
>> /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so, not found (try using 
>> -rpath or -rpath-link)
>> /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference 
>> to `llvm::AttributeSet::hasAttribute(unsigned int, 
>> llvm::Attribute::AttrKind) const'
>> /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference 
>> to `llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getLoopLatch() const'
>> .
>>
>> If I only execute julia-config for flags, and I use these flags to cook 
>> up g++ script, and the g++ script got me the same problems.
>>
>> > $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs 
>> -DJULIA_ENABLE_THREADING=1 -fPIC 
>> -DJULIA_INIT_DIR=\"/home/xxx/Software/julia-9c76c3e89a/lib\" 
>> -I/home/xxx/Software/julia-9c76c3e89a/include/julia
>> -L/home/xxx/Software/julia-9c76c3e89a/lib
>> -Wl,-rpath,/home/xxx/Software/julia-9c76c3e89a/lib -ljulia
>>
>> The output for --ldflags is clearly incorrect or incomplete for my 
>> installation on Ubuntu.  The script that generally works for me is the 
>> following, where some extra things have to be set.
>>
>> > g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp 
>> -L$JULIA_DIR/lib/ -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
>> $JULIA_DIR/lib/julia/libstdc++.so.6
>>
>
>
> The two compilation appears to be running against two independent 
> installation and they are not comparable. Assuming the private libraries 
> are found in lib/julia the julia-config.jl script should probably be 
> updated to include it though.
>  
>

I do have two installation of Julia (0.4.6 and 0.5), but as I set JULIA_DIR 
to the 0.5 dir, the two compilations apply to the same installation.


>>
>> On Saturday, September 10, 2016 at 7:06:34 PM UTC+8, Yichao Yu wrote:
>>>
>>>
>>>
>>> On Sat, Sep 10, 2016 at 6:56 AM, K leo <cnbi...@gmail.com> wrote:
>>>
>>>> I tried to compile the code with the GC statements, but got a bunch of 
>>>> error regarding jl_tls_states:
>>>>
>>>
>>>
>>> Use julia-config.jl to determine your compile flags.
>>>  
>>>
>>>>
>>>> test6.cpp:(.text+0xd5): undefined reference to `jl_tls_states'
>>>>
>>>> The compile script is as follows:
>>>> g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp 
>>>> -L$JULIA_DIR/lib/ -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
>>>> $JULIA_DIR/lib/julia/libstdc++.so.6
>>>>
>>>> Where is `jl_tls_states' defined?
>>>>
>>>>
>>>> On Saturday, September 10, 2016 at 5:20:02 PM UTC+8, Bart Janssens 
>>>> wrote:
>>>>>
>>>>> I just realise I made a typo, the rooting should be done using:  (note 
>>>>> the &)
>>>>>
>>>>> JL_GC_PUSH2(,);
>>>>>
>>>>> Op za 10 sep. 2016 02:36 schreef K leo <cnbi...@gmail.com>:
>>>>>
>>>>>> Bart,
>>>>>>
>>>>>> Can you explain what you mean by "need to be rooted"?  The 
>>>>>> jl_new_struct statement as Isaiah suggested works, why do we need the 
>>>>>> additional statements as you suggested?
>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>>
>>>
>

Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-10 Thread K leo
I need to add "-L/home/djia/Software/julia-9c76c3e89a/lib/julia 
-lLLVM-3.7.1" into the script cooked up based on julia-config output, and 
then it works.
Should I file an issue on julia-config?

On Saturday, September 10, 2016 at 8:53:39 PM UTC+8, K leo wrote:
>
>  julia-config.jl is hardly useful at all.  I unpacked the Linux binary of 
> Julia (0.5) in ~/Software/julia-9c76c3e89a, and I set JULIA_DIR 
> accordingly. When I execute julia-config in the following way, I got all 
> kinds of "undefined reference to" error messages.
>
> > $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs | 
> xargs g++ test6.cpp
> /usr/bin/ld: warning: libLLVM-3.7.1.so, needed by 
> /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so, not found (try using 
> -rpath or -rpath-link)
> /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference 
> to `llvm::AttributeSet::hasAttribute(unsigned int, 
> llvm::Attribute::AttrKind) const'
> /home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference 
> to `llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getLoopLatch() const'
> .
>
> If I only execute julia-config for flags, and I use these flags to cook up 
> g++ script, and the g++ script got me the same problems.
>
> > $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs 
> -DJULIA_ENABLE_THREADING=1 -fPIC 
> -DJULIA_INIT_DIR=\"/home/xxx/Software/julia-9c76c3e89a/lib\" 
> -I/home/xxx/Software/julia-9c76c3e89a/include/julia
> -L/home/xxx/Software/julia-9c76c3e89a/lib
> -Wl,-rpath,/home/xxx/Software/julia-9c76c3e89a/lib -ljulia
>
> The output for --ldflags is clearly incorrect or incomplete for my 
> installation on Ubuntu.  The script that generally works for me is the 
> following, where some extra things have to be set.
>
> > g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ 
> -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
> $JULIA_DIR/lib/julia/libstdc++.so.6
>
>
> On Saturday, September 10, 2016 at 7:06:34 PM UTC+8, Yichao Yu wrote:
>>
>>
>>
>> On Sat, Sep 10, 2016 at 6:56 AM, K leo <cnbi...@gmail.com> wrote:
>>
>>> I tried to compile the code with the GC statements, but got a bunch of 
>>> error regarding jl_tls_states:
>>>
>>
>>
>> Use julia-config.jl to determine your compile flags.
>>  
>>
>>>
>>> test6.cpp:(.text+0xd5): undefined reference to `jl_tls_states'
>>>
>>> The compile script is as follows:
>>> g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ 
>>> -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
>>> $JULIA_DIR/lib/julia/libstdc++.so.6
>>>
>>> Where is `jl_tls_states' defined?
>>>
>>>
>>> On Saturday, September 10, 2016 at 5:20:02 PM UTC+8, Bart Janssens wrote:
>>>>
>>>> I just realise I made a typo, the rooting should be done using:  (note 
>>>> the &)
>>>>
>>>> JL_GC_PUSH2(,);
>>>>
>>>> Op za 10 sep. 2016 02:36 schreef K leo <cnbi...@gmail.com>:
>>>>
>>>>> Bart,
>>>>>
>>>>> Can you explain what you mean by "need to be rooted"?  The 
>>>>> jl_new_struct statement as Isaiah suggested works, why do we need the 
>>>>> additional statements as you suggested?
>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>>>>
>>

Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-10 Thread K leo
 julia-config.jl is hardly useful at all.  I unpacked the Linux binary of 
Julia (0.5) in ~/Software/julia-9c76c3e89a, and I set JULIA_DIR 
accordingly. When I execute julia-config in the following way, I got all 
kinds of "undefined reference to" error messages.

> $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs | 
xargs g++ test6.cpp
/usr/bin/ld: warning: libLLVM-3.7.1.so, needed by 
/home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so, not found (try using 
-rpath or -rpath-link)
/home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference to 
`llvm::AttributeSet::hasAttribute(unsigned int, llvm::Attribute::AttrKind) 
const'
/home/xxx/Software/julia-9c76c3e89a/lib/libjulia.so: undefined reference to 
`llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getLoopLatch() const'
.

If I only execute julia-config for flags, and I use these flags to cook up 
g++ script, and the g++ script got me the same problems.

> $JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs 
-DJULIA_ENABLE_THREADING=1 -fPIC 
-DJULIA_INIT_DIR=\"/home/xxx/Software/julia-9c76c3e89a/lib\" 
-I/home/xxx/Software/julia-9c76c3e89a/include/julia
-L/home/xxx/Software/julia-9c76c3e89a/lib
-Wl,-rpath,/home/xxx/Software/julia-9c76c3e89a/lib -ljulia

The output for --ldflags is clearly incorrect or incomplete for my 
installation on Ubuntu.  The script that generally works for me is the 
following, where some extra things have to be set.

> g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ 
-L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
$JULIA_DIR/lib/julia/libstdc++.so.6


On Saturday, September 10, 2016 at 7:06:34 PM UTC+8, Yichao Yu wrote:
>
>
>
> On Sat, Sep 10, 2016 at 6:56 AM, K leo <cnbi...@gmail.com > 
> wrote:
>
>> I tried to compile the code with the GC statements, but got a bunch of 
>> error regarding jl_tls_states:
>>
>
>
> Use julia-config.jl to determine your compile flags.
>  
>
>>
>> test6.cpp:(.text+0xd5): undefined reference to `jl_tls_states'
>>
>> The compile script is as follows:
>> g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ 
>> -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
>> $JULIA_DIR/lib/julia/libstdc++.so.6
>>
>> Where is `jl_tls_states' defined?
>>
>>
>> On Saturday, September 10, 2016 at 5:20:02 PM UTC+8, Bart Janssens wrote:
>>>
>>> I just realise I made a typo, the rooting should be done using:  (note 
>>> the &)
>>>
>>> JL_GC_PUSH2(,);
>>>
>>> Op za 10 sep. 2016 02:36 schreef K leo <cnbi...@gmail.com>:
>>>
>>>> Bart,
>>>>
>>>> Can you explain what you mean by "need to be rooted"?  The 
>>>> jl_new_struct statement as Isaiah suggested works, why do we need the 
>>>> additional statements as you suggested?
>>>>
>>>>>
>>>
>>>
>>>
>>>>>
>

Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-10 Thread K leo
I tried to compile the code with the GC statements, but got a bunch of 
error regarding jl_tls_states:

test6.cpp:(.text+0xd5): undefined reference to `jl_tls_states'

The compile script is as follows:
g++ -o test -fPIC -I$JULIA_DIR/include/julia test6.cpp -L$JULIA_DIR/lib/ 
-L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
$JULIA_DIR/lib/julia/libstdc++.so.6

Where is `jl_tls_states' defined?


On Saturday, September 10, 2016 at 5:20:02 PM UTC+8, Bart Janssens wrote:
>
> I just realise I made a typo, the rooting should be done using:  (note the 
> &)
>
> JL_GC_PUSH2(,);
>
> Op za 10 sep. 2016 02:36 schreef K leo <cnbi...@gmail.com >:
>
>> Bart,
>>
>> Can you explain what you mean by "need to be rooted"?  The jl_new_struct 
>> statement as Isaiah suggested works, why do we need the additional 
>> statements as you suggested?
>>
>>>
>
>
>
>>>

Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-09 Thread K leo
Bart,

Can you explain what you mean by "need to be rooted"?  The jl_new_struct 
statement as Isaiah suggested works, why do we need the additional 
statements as you suggested?


On Saturday, September 10, 2016 at 3:38:27 AM UTC+8, Bart Janssens wrote:
>
>
>
> On Fri, Sep 9, 2016 at 6:44 PM Isaiah Norton  > wrote:
>
>>// construct a TestType instance
>>
>> jl_value_t* jl_A = 
>> jl_new_struct((jl_datatype_t*)jl_get_function((jl_module_t*)mod, 
>> "TestType"),
>>  jl_box_float64(A.a), 
>> jl_box_float64(A.b));
>>
>>
> The arguments to jl_new_struct need to be rooted, so you should do 
> something like:
> jl_value_t* a = NULL;
> jl_value_t* b = NULL;
> JL_GC_PUSH2(a,b);
> a = jl_box_float64(A.a);
> b = jl_box_float64(A.b);
> // use a and b in the new struct call
> JL_GC_POP();
>
> What is the objective here? If this is still to be used from C++, there 
> may be easier ways using Cxx.jl or CxxWrap.jl.
>
> Cheers,
>
> Bart
>


Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-09 Thread K leo
Thanks again.
What is  jl_init("/Users/inorton/git/jl71/usr/lib/")?

On Saturday, September 10, 2016 at 12:44:32 AM UTC+8, Isaiah wrote:
>
> (Disregard my suggestion about `Ptr{TestType}`, `jl_call1` only takes 
> boxed arguments so that won't work)
>
> The problem is that the passed argument type does not match any available 
> method (because it isn't actually passed a julia type at all) so `jl_call1` 
> silently gives up. The `jl_call*` methods are in TRY/CATCH blocks to 
> prevent spilling errors across the API, and they do not print error 
> messages.
>
> The following example works, it's not really efficient but it does 
> demonstrate type construction from C:
>
> #include 
> #include 
> using namespace std;
>
> struct TestType {
> double a;
> double b;
> };
> int main(int argc, char *argv[])
> {
> TestType A, *ret;
> A.a=2.;
> A.b=3.;
> jl_init("/Users/inorton/git/jl71/usr/lib/");
> jl_load("TestArg.jl");
> jl_value_t * mod = (jl_value_t*)jl_eval_string("TestArg");
>
>// construct a TestType instance
>
> jl_value_t* jl_A = 
> jl_new_struct((jl_datatype_t*)jl_get_function((jl_module_t*)mod, 
> "TestType"),
>  jl_box_float64(A.a), 
> jl_box_float64(A.b));
>
> jl_function_t * func = jl_get_function((jl_module_t*)mod,"TestFunc");
> jl_call1(func, jl_A);
>
> jl_atexit_hook(0);
> return 0;
> }
>
>
> Using the embedding API requires a substantial depth of understanding of , 
> including stack vs heap and argument passing, as well as dynamic language 
> concepts such as boxing, and rooting. The embedding section of the manual 
> is designed to provide an overview, but ultimately you are going to have to 
> read and grok the Julia source to get every little detail.
>
> On Fri, Sep 9, 2016 at 9:23 AM, K leo <cnbi...@gmail.com > 
> wrote:
>
>> Isaiah,
>>
>> Thanks for the reply.
>>
>> I tried your advice A, i.e. "change to an immutable on julia side, and 
>> change function signature to  'Ptr{TestType}'", and the code behaves the 
>> same as before, i.e. it compiles OK and runs OK but does not show the 
>> output of the println in the function.
>>
>> I guess at the moment what puzzles me is not whether the data get passed 
>> correctly (because I am not trying to access the data yet), but why the one 
>> single statement in the Julia function is not executed.  That function 
>> appears to be taken correctly because if I change the function name in 
>> Julia then there is a core dump.  Any thoughts?
>>
>> I have not yet tried your advice B as I am not too clear about it.
>>
>>
>> On Friday, September 9, 2016 at 8:52:30 PM UTC+8, Isaiah wrote:
>>>
>>> In c, 'struct TestType' is plain old data, not a Julia type 
>>> (jl_value_t). Either change to an immutable on julia side, and change 
>>> function signature to  'Ptr{TestType}'; or allocate a 'jl_value_t*' with 
>>> the correct type tag, and set the fields.
>>>
>>> On Friday, September 9, 2016, K leo <cnbi...@gmail.com> wrote:
>>>
>>>> I tried the following, it compiles OK and runs OK, but it appears the 
>>>> julia function is not called (because there is no output from the println 
>>>> statement).  What is wrong?
>>>>
>>>> #include 
>>>>> #include 
>>>>> using namespace std;
>>>>> struct TestType {
>>>>> double a;
>>>>> double b;
>>>>> };
>>>>> int main(int argc, char *argv[])
>>>>> {
>>>>> TestType A, *ret;
>>>>> A.a=2.;
>>>>> A.b=3.;
>>>>> jl_init(NULL);
>>>>> jl_load("TestArg.jl");
>>>>> jl_value_t * mod = (jl_value_t*)jl_eval_string("TestArg");
>>>>> jl_function_t * func = 
>>>>> jl_get_function((jl_module_t*)mod,"TestFunc");
>>>>> jl_call1(func, (jl_value_t *));
>>>>> jl_atexit_hook(0);
>>>>> return 0;
>>>>> }
>>>>> # TestArg.jl
>>>>> module TestArg
>>>>> type TestType
>>>>> a::Float64
>>>>> b::Float64
>>>>> end
>>>>> function TestFunc(data::TestType)
>>>>> println("in TestArg.TestFunc ")
>>>>> end
>>>>> end
>>>>
>>>>
>>>>
>

[julia-users] Re: basic question on structuring modules

2016-09-09 Thread K leo
The module name needs to be the same as the file, so in this case you need 
to change the function name.

On Friday, September 9, 2016 at 9:29:48 PM UTC+8, Neal Becker wrote:
>
> Let's say I have a simple module which contains 1 function called "foo" 
>
> I might create foo.jl that contains 
>
> foo.jl 
> module foo 
>
> function foo ... 
> end 
>
> end 
>
> This doesn't work, it seems the module name collides with the function 
> name. 
>
> foo.jl 
> module foo_mod 
>
> function foo ... 
> end 
>
> end 
>
> This might be OK, but provokes a warning (here foo -> coef_from_func) 
> julia> using coef_from_func 
> WARNING: requiring "coef_from_func" in module "Main" did not define a 
> corresponding module. 
>
> So as a newb, what is the basic way to package up a function like this? 
>
>

Re: [julia-users] How to use jl_call1 with a struct argument?

2016-09-09 Thread K leo
Isaiah,

Thanks for the reply.

I tried your advice A, i.e. "change to an immutable on julia side, and 
change function signature to  'Ptr{TestType}'", and the code behaves the 
same as before, i.e. it compiles OK and runs OK but does not show the 
output of the println in the function.

I guess at the moment what puzzles me is not whether the data get passed 
correctly (because I am not trying to access the data yet), but why the one 
single statement in the Julia function is not executed.  That function 
appears to be taken correctly because if I change the function name in 
Julia then there is a core dump.  Any thoughts?

I have not yet tried your advice B as I am not too clear about it.


On Friday, September 9, 2016 at 8:52:30 PM UTC+8, Isaiah wrote:
>
> In c, 'struct TestType' is plain old data, not a Julia type (jl_value_t). 
> Either change to an immutable on julia side, and change function signature 
> to  'Ptr{TestType}'; or allocate a 'jl_value_t*' with the correct type tag, 
> and 
> set the fields.
>
> On Friday, September 9, 2016, K leo <cnbi...@gmail.com > 
> wrote:
>
>> I tried the following, it compiles OK and runs OK, but it appears the 
>> julia function is not called (because there is no output from the println 
>> statement).  What is wrong?
>>
>> #include 
>>> #include 
>>> using namespace std;
>>> struct TestType {
>>> double a;
>>> double b;
>>> };
>>> int main(int argc, char *argv[])
>>> {
>>> TestType A, *ret;
>>> A.a=2.;
>>> A.b=3.;
>>> jl_init(NULL);
>>> jl_load("TestArg.jl");
>>> jl_value_t * mod = (jl_value_t*)jl_eval_string("TestArg");
>>> jl_function_t * func = jl_get_function((jl_module_t*)mod,"TestFunc");
>>> jl_call1(func, (jl_value_t *));
>>> jl_atexit_hook(0);
>>> return 0;
>>> }
>>> # TestArg.jl
>>> module TestArg
>>> type TestType
>>> a::Float64
>>> b::Float64
>>> end
>>> function TestFunc(data::TestType)
>>> println("in TestArg.TestFunc ")
>>> end
>>> end
>>
>>
>>

[julia-users] How to use jl_call1 with a struct argument?

2016-09-09 Thread K leo
I tried the following, it compiles OK and runs OK, but it appears the julia 
function is not called (because there is no output from the println 
statement).  What is wrong?

#include 
> #include 
> using namespace std;
> struct TestType {
> double a;
> double b;
> };
> int main(int argc, char *argv[])
> {
> TestType A, *ret;
> A.a=2.;
> A.b=3.;
> jl_init(NULL);
> jl_load("TestArg.jl");
> jl_value_t * mod = (jl_value_t*)jl_eval_string("TestArg");
> jl_function_t * func = jl_get_function((jl_module_t*)mod,"TestFunc");
> jl_call1(func, (jl_value_t *));
> jl_atexit_hook(0);
> return 0;
> }
> # TestArg.jl
> module TestArg
> type TestType
> a::Float64
> b::Float64
> end
> function TestFunc(data::TestType)
> println("in TestArg.TestFunc ")
> end
> end




[julia-users] Re: There is very little overhead calling Julia from C++

2016-09-08 Thread K leo
Stefan Karpinski's words (in 
https://groups.google.com/forum/#!searchin/julia-users/C$2B$2B$20call$20julia$20struct%7Csort:relevance/julia-users/KTMlJ15vzVA/2W3qOis7Kk8J)
 
explained the results:

There's also the issue that we can and do turn Julia functions into 
> C-callable function pointers that can be invoked from C as if they were C 
> function pointers – this currently has zero overhead and if the Julia 
> function is fast, then calling it from C will also be fast. If these 
> require interpreter state, then that would need to be a function call 
> argument to every C-callable function, which is at odds with many C APIs 
> (although good libraries do allow for a void* data argument). Maybe this 
> could be made to work, but my suspicion is that it would introduce too much 
> overhead and destroy our current ability to do zero-cost two-way interop 
> with C.


On Thursday, September 8, 2016 at 12:43:30 PM UTC+8, K leo wrote:
>
> I just did a test of calling a Julia function 100,000 times, both from 
> Julia and from C++.  The execution times are very close.  The results are 
> as follows.  This is on Xubuntu 16.04 64bits.
>
> ***Julia   **
>   | | |_| | | | (_| |  |  Version 0.5.0-rc3+0 (2016-08-22 23:43 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
> |__/   |  x86_64-unknown-linux-gnu
>
> julia> include("speedTest.jl")
> speedTest
>
> julia> speedTest.TestLoop()
> elapsed time: 3.21365718 seconds
> 3.21365718
>
>
> ***   C++***
> > g++ -o test -fPIC -I$JULIA_DIR/include/julia test3.cpp -L$JULIA_DIR/lib/ 
> -L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
> $JULIA_DIR/lib/julia/libstdc++.so.6
> > ./test
> 3.22423
>
> The codes are shown below:
> Julai:
>
>> module speedTest
>>
>>
>>> function TestFunc()
>>
>> f=0.
>>
>> for i=1:1
>>
>> f += Float64(i*fld(3,2))*sqrt(rand()+1.)
>>
>> end
>>
>> end
>>
>>
>>> function TestLoop()
>>
>> tic()
>>
>> for i=1:10
>>
>> TestFunc()
>>
>> end
>>
>> toc()
>>
>> end
>>
>>
>>> end
>>
>>
> C++:
>
>> #include 
>>
>> #include 
>>
>> #include 
>>
>> using namespace std;
>>
>> typedef unsigned long long timestamp_t;
>>
>>
>>> static timestamp_t get_timestamp ()
>>
>> {
>>
>>   struct timeval now;
>>
>>   gettimeofday (, NULL);
>>
>>   return  now.tv_usec + (timestamp_t)now.tv_sec * 100;
>>
>> }
>>
>>
>>> int main(int argc, char *argv[])
>>
>> {
>>
>> jl_init(NULL);
>>
>>
>>> jl_load("speedTest.jl");
>>
>> jl_value_t * mod = (jl_value_t*)jl_eval_string("speedTest");
>>
>> jl_function_t * func = jl_get_function((jl_module_t*)mod,"TestFunc");
>>
>>
>>> timestamp_t t0 = get_timestamp();
>>
>>
>>> for(int i=1; i<10; i++) {
>>
>> jl_call0(func);
>>
>> }
>>
>>
>>> timestamp_t t1 = get_timestamp();
>>
>>
>>> double secs = (t1 - t0) / 100.0L;
>>
>> cout<< secs << endl;
>>
>>
>>> jl_atexit_hook(0);
>>
>> return 0;
>>
>> }
>>
>>
>>
>
>
>
>

Re: [julia-users] calling julia functions in C++

2016-09-08 Thread K leo
jl_load and the following two are not in the documentation.  Specifically 
how to call function in one's own module.

jl_value_t * mod = (jl_value_t*)jl_eval_string("mymodule");
jl_function_t * func = jl_get_function((jl_module_t*)mod,"myfunction");


On Friday, September 9, 2016 at 1:26:54 AM UTC+8, Isaiah wrote:
>
> As far as I can tell, everything in this thread is covered in the 
> embedding section [http://docs.julialang.org/en/latest/manual/embedding/] 
> except for the note about `jl_load` usage. Care to make a pull-request? ;)
>
> On Thu, Sep 8, 2016 at 12:09 AM, K leo <cnbi...@gmail.com > 
> wrote:
>
>> Thank you.  This just saved my day.  Can someone please put this intro in 
>> the documentation?
>>
>> On Tuesday, June 30, 2015 at 11:58:18 PM UTC+8, Isaiah wrote:
>>>
>>> try
>>>
>>> jl_value_t * mod = (jl_value_t*)jl_eval_string("mymodule");
>>> jl_function_t * func = jl_get_function((jl_module_t*)mod,"myfunction");
>>>
>>> (jl_new_module creates a new module -- that's not what you want, because 
>>> the module containing your function is created when you eval "yourfile.jl")
>>>
>>> On Tue, Jun 30, 2015 at 11:47 AM, Kostas Tavlaridis-Gyparakis <
>>> kostas.t...@gmail.com> wrote:
>>>
>>>> Ok, so first of all thanks a lot for all the help so far.
>>>> So, now I try to follow the instructions and I write the following 
>>>> three lines of code inside C++:
>>>>
>>>>  jl_load("mymodule.jl");
>>>> jl_value_t * mod = jl_eval_string("mymodule");
>>>> jl_function_t * func = 
>>>> jl_get_function(jl_new_module(mod),"myfunction");
>>>>
>>>> (the jl file and the module itself have the same name in this case 
>>>> mymodule)
>>>> But I do receive the following 2 errors when Eclipse compiles:
>>>>
>>>> 1) error: invalid conversion from ‘void*’ to ‘jl_value_t* {aka 
>>>> _jl_value_t*}’ [-fpermissive] (this is referring to  jl_value_t * mod = 
>>>> jl_eval_string("mymodule");)
>>>>
>>>> 2) error: cannot convert ‘jl_value_t* {aka _jl_value_t*}’ to ‘jl_sym_t* 
>>>> {aka _jl_sym_t*}’ for argument ‘1’ to ‘jl_module_t* 
>>>> jl_new_module(jl_sym_t*)’ (this referring to jl_function_t * func = 
>>>> jl_get_function(jl_new_module(mod),"myfunction");)
>>>>
>>>>
>>>> >No problem, no stupid questions. However, I would suggest that you 
>>>> might want to spend some time getting really familiar with Julia by 
>>>> itself, 
>>>> before trying to use the embedding API. It might save a lot of time in the 
>>>> long run.
>>>>
>>>> You are totally right on this, I am just trying first to check if it is 
>>>> doable to do some combinations between C++ in Eclipse and Julia (such as 
>>>> using functions written in
>>>> Julia inside a C++ routine etc), because I am planning to connect a 
>>>> large-scale C++ with Julia and before starting to studying Julia in full 
>>>> detail and start writing proper
>>>> code was thinking to do some small tests in connectivity between the 
>>>> two. But it turns out that I don't know some very basic things to finish 
>>>> this task.
>>>>
>>>>
>>>> On Tuesday, June 30, 2015 at 5:32:53 PM UTC+2, Isaiah wrote:
>>>>>
>>>>> Sorry but I am not sure what you mean and how to "*evaluate your .jl 
>>>>>> file defining the module first*"?
>>>>>
>>>>>
>>>>> Ok, say you have a file:
>>>>>
>>>>> ```
>>>>> module mymod
>>>>> function foo() ... end
>>>>> end
>>>>> ```
>>>>>
>>>>> At the Julia prompt you would do:
>>>>>
>>>>> julia> include("myfile.jl")
>>>>>
>>>>> And then you have the module `mymod` available in the global 
>>>>> namespace. In C you can do the equivalent with:
>>>>>
>>>>> `jl_load("myfile.jl")`
>>>>>
>>>>> I am really new to Julia so maybe the question sounds really stupid, 
>>>>>> sorry for that
>>>>>
>>>>>
>>>>> No problem, no stupid questions. However, I would suggest that you 
>>&g

[julia-users] There is very little overhead calling Julia from C++

2016-09-07 Thread K leo
I just did a test of calling a Julia function 100,000 times, both from 
Julia and from C++.  The execution times are very close.  The results are 
as follows.  This is on Xubuntu 16.04 64bits.

***Julia   **
  | | |_| | | | (_| |  |  Version 0.5.0-rc3+0 (2016-08-22 23:43 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-unknown-linux-gnu

julia> include("speedTest.jl")
speedTest

julia> speedTest.TestLoop()
elapsed time: 3.21365718 seconds
3.21365718


***   C++***
> g++ -o test -fPIC -I$JULIA_DIR/include/julia test3.cpp -L$JULIA_DIR/lib/ 
-L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
$JULIA_DIR/lib/julia/libstdc++.so.6
> ./test
3.22423

The codes are shown below:
Julai:

> module speedTest
>
>
>> function TestFunc()
>
> f=0.
>
> for i=1:1
>
> f += Float64(i*fld(3,2))*sqrt(rand()+1.)
>
> end
>
> end
>
>
>> function TestLoop()
>
> tic()
>
> for i=1:10
>
> TestFunc()
>
> end
>
> toc()
>
> end
>
>
>> end
>
>
C++:

> #include 
>
> #include 
>
> #include 
>
> using namespace std;
>
> typedef unsigned long long timestamp_t;
>
>
>> static timestamp_t get_timestamp ()
>
> {
>
>   struct timeval now;
>
>   gettimeofday (, NULL);
>
>   return  now.tv_usec + (timestamp_t)now.tv_sec * 100;
>
> }
>
>
>> int main(int argc, char *argv[])
>
> {
>
> jl_init(NULL);
>
>
>> jl_load("speedTest.jl");
>
> jl_value_t * mod = (jl_value_t*)jl_eval_string("speedTest");
>
> jl_function_t * func = jl_get_function((jl_module_t*)mod,"TestFunc");
>
>
>> timestamp_t t0 = get_timestamp();
>
>
>> for(int i=1; i<10; i++) {
>
> jl_call0(func);
>
> }
>
>
>> timestamp_t t1 = get_timestamp();
>
>
>> double secs = (t1 - t0) / 100.0L;
>
> cout<< secs << endl;
>
>
>> jl_atexit_hook(0);
>
> return 0;
>
> }
>
>
>





Re: [julia-users] calling julia functions in C++

2016-09-07 Thread K leo
Thank you.  This just saved my day.  Can someone please put this intro in 
the documentation?

On Tuesday, June 30, 2015 at 11:58:18 PM UTC+8, Isaiah wrote:
>
> try
>
> jl_value_t * mod = (jl_value_t*)jl_eval_string("mymodule");
> jl_function_t * func = jl_get_function((jl_module_t*)mod,"myfunction");
>
> (jl_new_module creates a new module -- that's not what you want, because 
> the module containing your function is created when you eval "yourfile.jl")
>
> On Tue, Jun 30, 2015 at 11:47 AM, Kostas Tavlaridis-Gyparakis <
> kostas.t...@gmail.com > wrote:
>
>> Ok, so first of all thanks a lot for all the help so far.
>> So, now I try to follow the instructions and I write the following three 
>> lines of code inside C++:
>>
>>  jl_load("mymodule.jl");
>> jl_value_t * mod = jl_eval_string("mymodule");
>> jl_function_t * func = 
>> jl_get_function(jl_new_module(mod),"myfunction");
>>
>> (the jl file and the module itself have the same name in this case 
>> mymodule)
>> But I do receive the following 2 errors when Eclipse compiles:
>>
>> 1) error: invalid conversion from ‘void*’ to ‘jl_value_t* {aka 
>> _jl_value_t*}’ [-fpermissive] (this is referring to  jl_value_t * mod = 
>> jl_eval_string("mymodule");)
>>
>> 2) error: cannot convert ‘jl_value_t* {aka _jl_value_t*}’ to ‘jl_sym_t* 
>> {aka _jl_sym_t*}’ for argument ‘1’ to ‘jl_module_t* 
>> jl_new_module(jl_sym_t*)’ (this referring to jl_function_t * func = 
>> jl_get_function(jl_new_module(mod),"myfunction");)
>>
>>
>> >No problem, no stupid questions. However, I would suggest that you might 
>> want to spend some time getting really familiar with Julia by itself, 
>> before trying to use the embedding API. It might save a lot of time in the 
>> long run.
>>
>> You are totally right on this, I am just trying first to check if it is 
>> doable to do some combinations between C++ in Eclipse and Julia (such as 
>> using functions written in
>> Julia inside a C++ routine etc), because I am planning to connect a 
>> large-scale C++ with Julia and before starting to studying Julia in full 
>> detail and start writing proper
>> code was thinking to do some small tests in connectivity between the two. 
>> But it turns out that I don't know some very basic things to finish this 
>> task.
>>
>>
>> On Tuesday, June 30, 2015 at 5:32:53 PM UTC+2, Isaiah wrote:
>>>
>>> Sorry but I am not sure what you mean and how to "*evaluate your .jl 
 file defining the module first*"?
>>>
>>>
>>> Ok, say you have a file:
>>>
>>> ```
>>> module mymod
>>> function foo() ... end
>>> end
>>> ```
>>>
>>> At the Julia prompt you would do:
>>>
>>> julia> include("myfile.jl")
>>>
>>> And then you have the module `mymod` available in the global namespace. 
>>> In C you can do the equivalent with:
>>>
>>> `jl_load("myfile.jl")`
>>>
>>> I am really new to Julia so maybe the question sounds really stupid, 
 sorry for that
>>>
>>>
>>> No problem, no stupid questions. However, I would suggest that you might 
>>> want to spend some time getting really familiar with Julia by itself, 
>>> before trying to use the embedding API. It might save a lot of time in the 
>>> long run.
>>>
>>> On Tue, Jun 30, 2015 at 10:54 AM, Kostas Tavlaridis-Gyparakis <
>>> kostas.t...@gmail.com> wrote:
>>>
 Sorry but I am not sure what you mean and how to "*evaluate your .jl 
 file defining the module first*"?
 (I am really new to Julia so maybe the question sounds really stupid, 
 sorry for that)





 On Tuesday, June 30, 2015 at 4:28:54 PM UTC+2, Isaiah wrote:
>
> `jl_new_module` creates a new module. You must evaluate your .jl file 
> defining the module first, then to get a reference to the module do:
>
> `jl_value_t* mod = jl_eval_string("MyModName");
>
> Then you can pass "mod" as the argument to `jl_get_function`.
>
> On Tue, Jun 30, 2015 at 10:16 AM, Kostas Tavlaridis-Gyparakis <
> kostas.t...@gmail.com> wrote:
>
>> Hello,
>> I am trying to write some function in Julia which I will be able to 
>> call inside my C++ projects in Eclipse.
>> In the documentation there is this 
>> 
>>  
>> example on how to call a function of julia from an existing module.
>> So, what I have done was to create my own module where inside I 
>> included my function and then my
>> understanding is that I should be using "jl_new_module(jl_sym_t 
>> *name);" instead of jl_base_module.
>> But I am not sure (in case my assumption that this is the correct 
>> command is true) how to proper use
>> it's syntax, as what I am trying is:
>>
>> jl_function_t * func = 
>> jl_get_function(jl_new_module(mymodule),"myfunction");
>>
>> and I tried instead of mymodule also mymodule.jl and "mymodule" and 
>> "mymodule.jl" and in all the attempts I
>> recieve an error 

[julia-users] Re: ran into problem compiling C embedded with julia using mingw-w64 gcc on windows

2016-09-07 Thread K leo
I just ran that example on Ubuntu with Julia 0.5.  I found I did have to 
change a few things to make it run.

export JULIA_DIR=
export JULIA_HOME=$JULIA_DIR/bin
export PATH=$JULIA_HOME:$PATH
export LD_LIBRARY_PATH=$JULIA_DIR/lib:$LD_LIBRARY_PATH

And when I compile it, I used the following statement:
g++ -o test -fPIC -I$JULIA_DIR/include/julia test.cpp -L$JULIA_DIR/lib/ 
-L$JULIA_DIR/lib/julia -lLLVM-3.7.1 -ljulia 
$JULIA_DIR/lib/julia/libstdc++.so.6

But these are for Linux, not sure if it would help you on Windows (which I 
abandoned about 10 years ago).


[julia-users] Further on calling C++ from Julia or vice versa

2016-09-07 Thread K leo
Upon studying the C++ API that I will need to use, I found that it
specifies many virtual member functions which are callback functions that
are invoked by the API library based upon different events.  The user (I)
will need to overload these virtual functions based on needs, which appears
to be the major part of the work in using the API.  It is clear that my
Julia analytics code can be invoked in various of these virtual callback
functions.

So my question is how Cxx or CxxWrap can help me with these virtual
functions?  Can I overload them in Julia?

Furthermore, I saw simon rss asked the following question which I also
would like to know.  Can anyone answer please?  Thanks.

"Another thing I am not sure is that, when we embed code like
"jl_eval_string" into C and compile it to a exe. When running this exe,
will it call julia engine to evaluate it(this should have huge overhead) or
will all be done directly at machine code level(no overhead)?"


[julia-users] Re: Is it better to call Julia from C++ or call C++ from Julia?

2016-09-06 Thread K leo
Sorry, only the '+' before '=', no '+' at the beginning.  Correct way:
LIB_DEPENDENCY += $(LIBDIR)/lib$(LLVM_LIB_NAME).$(SHLIB_EXT)

On Tuesday, September 6, 2016 at 2:08:54 PM UTC+8, K leo wrote:
>
> in deps/BuildBootstrap.Makefile, put '+' in the line so it becomes as 
> follows:
>
> +LIB_DEPENDENCY += $(LIBDIR)/lib$(LLVM_LIB_NAME).$(SHLIB_EXT)
> Then Pkg.build("CXX")
>
> On Sunday, September 4, 2016 at 9:37:45 PM UTC+8, Uwe Fechner wrote:
>>
>> Could you explain your fix? I have the same error.
>>
>> Uwe
>>
>> On Sunday, September 4, 2016 at 6:22:36 AM UTC+2, K leo wrote:
>>>
>>> The error of adding Cxx was eliminated by changing small bits in the 
>>> makefile.  It builds successfully.  I am so surprised to find that it is 
>>> such a huge package with over 1GB in size.
>>>
>>> On Sunday, September 4, 2016 at 6:41:28 AM UTC+8, K leo wrote:
>>>>
>>>> Thanks very much for the advise.
>>>>
>>>> One question is whether Cxx is mature enough to be usable at this 
>>>> stage.  I tried to add it with Julia 0.5 and got the following errors:
>>>>
>>>> julia> Pkg.add("Cxx")
>>>> INFO: Installing Cxx v0.0.1
>>>> INFO: Building Cxx
>>>> writing path.jl file
>>>> Tuning for julia installation at: 
>>>> /home/xxx/Software/julia-e6f843b073/bin
>>>>  g++ -D_GLIBCXX_USE_CXX11_ABI=0 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 
>>>> -g -std=c++11   
>>>> -I/home/xxx/Software/julia-e6f843b073/bin/../../src/support 
>>>> -I/home/xxx/Software/julia-e6f843b073/bin/../include -Isrc/clang-3.7.1/lib 
>>>> -Ibuild/clang-3.7.1/include -Isrc/clang-3.7.1/include 
>>>> -Isrc/llvm-3.7.1/include -Ibuild/llvm-3.7.1/include  -DLLVM_NDEBUG -c 
>>>> ../src/bootstrap.cpp -o build/bootstrap.o
>>>> ../src/bootstrap.cpp:19:35: fatal error: llvm/ADT/DenseMapInfo.h: No 
>>>> such file or directory
>>>> compilation terminated.
>>>> BuildBootstrap.Makefile:131: recipe for target 'build/bootstrap.o' 
>>>> failed
>>>> make: *** [build/bootstrap.o] Error 1
>>>> =[ ERROR: Cxx 
>>>> ]=
>>>>
>>>> LoadError: failed process: Process(`make -j2 -f BuildBootstrap.Makefile 
>>>> BASE_JULIA_HOME=/home/xxx/Software/julia-e6f843b073/bin`, 
>>>> ProcessExited(2)) 
>>>> [2]
>>>> while loading /home/xxx/.julia/v0.5/Cxx/deps/build.jl, in expression 
>>>> starting on line 31
>>>>
>>>>
>>>> 
>>>>
>>>> [ BUILD ERRORS 
>>>> ]
>>>>
>>>> WARNING: Cxx had build errors.
>>>>
>>>>  - packages with build errors remain installed in /home/xxx/.julia/v0.5
>>>>  - build the package(s) and all dependencies with `Pkg.build("Cxx")`
>>>>  - build a single package by running its `deps/build.jl` script
>>>>
>>>>
>>>> 
>>>> INFO: Package database updated
>>>>
>>>> On Saturday, September 3, 2016 at 9:17:38 AM UTC+8, Steven G. Johnson 
>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Friday, September 2, 2016 at 8:51:21 PM UTC-4, K leo wrote:
>>>>>>
>>>>>> While the majority of my analytics are in Julia, I will need to use 
>>>>>> an external event handling API which is implemented in C++.  It looks 
>>>>>> that 
>>>>>> I have two options: 1) write the main code in C++ with the API and call 
>>>>>> Julia function for analytics; 2) write the main code also in Julia that 
>>>>>> work seamlessly with my analytics and call the C++ API for events.
>>>>>>
>>>>>> Which would be the better path in terms of ease of coding and 
>>>>>> performance?
>>>>>>
>>>>>
>>>>> Much easier to call C++ from Julia, particularly with the Cxx.jl 
>>>>> package <https://github.com/Keno/Cxx.jl>.   Performance-wise, it 
>>>>> shouldn't matter, but it is always easier to write glue code in a 
>>>>> higher-level language than in a lower-level language. 
>>>>>
>>>>

[julia-users] Re: Is it better to call Julia from C++ or call C++ from Julia?

2016-09-06 Thread K leo
in deps/BuildBootstrap.Makefile, put '+' in the line so it becomes as 
follows:

+LIB_DEPENDENCY += $(LIBDIR)/lib$(LLVM_LIB_NAME).$(SHLIB_EXT)
Then Pkg.build("CXX")

On Sunday, September 4, 2016 at 9:37:45 PM UTC+8, Uwe Fechner wrote:
>
> Could you explain your fix? I have the same error.
>
> Uwe
>
> On Sunday, September 4, 2016 at 6:22:36 AM UTC+2, K leo wrote:
>>
>> The error of adding Cxx was eliminated by changing small bits in the 
>> makefile.  It builds successfully.  I am so surprised to find that it is 
>> such a huge package with over 1GB in size.
>>
>> On Sunday, September 4, 2016 at 6:41:28 AM UTC+8, K leo wrote:
>>>
>>> Thanks very much for the advise.
>>>
>>> One question is whether Cxx is mature enough to be usable at this stage. 
>>>  I tried to add it with Julia 0.5 and got the following errors:
>>>
>>> julia> Pkg.add("Cxx")
>>> INFO: Installing Cxx v0.0.1
>>> INFO: Building Cxx
>>> writing path.jl file
>>> Tuning for julia installation at: /home/xxx/Software/julia-e6f843b073/bin
>>>  g++ -D_GLIBCXX_USE_CXX11_ABI=0 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g 
>>> -std=c++11   -I/home/xxx/Software/julia-e6f843b073/bin/../../src/support 
>>> -I/home/xxx/Software/julia-e6f843b073/bin/../include -Isrc/clang-3.7.1/lib 
>>> -Ibuild/clang-3.7.1/include -Isrc/clang-3.7.1/include 
>>> -Isrc/llvm-3.7.1/include -Ibuild/llvm-3.7.1/include  -DLLVM_NDEBUG -c 
>>> ../src/bootstrap.cpp -o build/bootstrap.o
>>> ../src/bootstrap.cpp:19:35: fatal error: llvm/ADT/DenseMapInfo.h: No 
>>> such file or directory
>>> compilation terminated.
>>> BuildBootstrap.Makefile:131: recipe for target 'build/bootstrap.o' failed
>>> make: *** [build/bootstrap.o] Error 1
>>> =[ ERROR: Cxx 
>>> ]=
>>>
>>> LoadError: failed process: Process(`make -j2 -f BuildBootstrap.Makefile 
>>> BASE_JULIA_HOME=/home/xxx/Software/julia-e6f843b073/bin`, ProcessExited(2)) 
>>> [2]
>>> while loading /home/xxx/.julia/v0.5/Cxx/deps/build.jl, in expression 
>>> starting on line 31
>>>
>>>
>>> 
>>>
>>> [ BUILD ERRORS 
>>> ]
>>>
>>> WARNING: Cxx had build errors.
>>>
>>>  - packages with build errors remain installed in /home/xxx/.julia/v0.5
>>>  - build the package(s) and all dependencies with `Pkg.build("Cxx")`
>>>  - build a single package by running its `deps/build.jl` script
>>>
>>>
>>> 
>>> INFO: Package database updated
>>>
>>> On Saturday, September 3, 2016 at 9:17:38 AM UTC+8, Steven G. Johnson 
>>> wrote:
>>>>
>>>>
>>>>
>>>> On Friday, September 2, 2016 at 8:51:21 PM UTC-4, K leo wrote:
>>>>>
>>>>> While the majority of my analytics are in Julia, I will need to use an 
>>>>> external event handling API which is implemented in C++.  It looks that I 
>>>>> have two options: 1) write the main code in C++ with the API and call 
>>>>> Julia 
>>>>> function for analytics; 2) write the main code also in Julia that work 
>>>>> seamlessly with my analytics and call the C++ API for events.
>>>>>
>>>>> Which would be the better path in terms of ease of coding and 
>>>>> performance?
>>>>>
>>>>
>>>> Much easier to call C++ from Julia, particularly with the Cxx.jl 
>>>> package <https://github.com/Keno/Cxx.jl>.   Performance-wise, it 
>>>> shouldn't matter, but it is always easier to write glue code in a 
>>>> higher-level language than in a lower-level language. 
>>>>
>>>

[julia-users] Re: Is it better to call Julia from C++ or call C++ from Julia?

2016-09-03 Thread K leo
The error of adding Cxx was eliminated by changing small bits in the 
makefile.  It builds successfully.  I am so surprised to find that it is 
such a huge package with over 1GB in size.

On Sunday, September 4, 2016 at 6:41:28 AM UTC+8, K leo wrote:
>
> Thanks very much for the advise.
>
> One question is whether Cxx is mature enough to be usable at this stage. 
>  I tried to add it with Julia 0.5 and got the following errors:
>
> julia> Pkg.add("Cxx")
> INFO: Installing Cxx v0.0.1
> INFO: Building Cxx
> writing path.jl file
> Tuning for julia installation at: /home/xxx/Software/julia-e6f843b073/bin
>  g++ -D_GLIBCXX_USE_CXX11_ABI=0 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g 
> -std=c++11   -I/home/xxx/Software/julia-e6f843b073/bin/../../src/support 
> -I/home/xxx/Software/julia-e6f843b073/bin/../include -Isrc/clang-3.7.1/lib 
> -Ibuild/clang-3.7.1/include -Isrc/clang-3.7.1/include 
> -Isrc/llvm-3.7.1/include -Ibuild/llvm-3.7.1/include  -DLLVM_NDEBUG -c 
> ../src/bootstrap.cpp -o build/bootstrap.o
> ../src/bootstrap.cpp:19:35: fatal error: llvm/ADT/DenseMapInfo.h: No such 
> file or directory
> compilation terminated.
> BuildBootstrap.Makefile:131: recipe for target 'build/bootstrap.o' failed
> make: *** [build/bootstrap.o] Error 1
> =[ ERROR: Cxx 
> ]=
>
> LoadError: failed process: Process(`make -j2 -f BuildBootstrap.Makefile 
> BASE_JULIA_HOME=/home/xxx/Software/julia-e6f843b073/bin`, ProcessExited(2)) 
> [2]
> while loading /home/xxx/.julia/v0.5/Cxx/deps/build.jl, in expression 
> starting on line 31
>
>
> 
>
> [ BUILD ERRORS 
> ]
>
> WARNING: Cxx had build errors.
>
>  - packages with build errors remain installed in /home/xxx/.julia/v0.5
>  - build the package(s) and all dependencies with `Pkg.build("Cxx")`
>  - build a single package by running its `deps/build.jl` script
>
>
> 
> INFO: Package database updated
>
> On Saturday, September 3, 2016 at 9:17:38 AM UTC+8, Steven G. Johnson 
> wrote:
>>
>>
>>
>> On Friday, September 2, 2016 at 8:51:21 PM UTC-4, K leo wrote:
>>>
>>> While the majority of my analytics are in Julia, I will need to use an 
>>> external event handling API which is implemented in C++.  It looks that I 
>>> have two options: 1) write the main code in C++ with the API and call Julia 
>>> function for analytics; 2) write the main code also in Julia that work 
>>> seamlessly with my analytics and call the C++ API for events.
>>>
>>> Which would be the better path in terms of ease of coding and 
>>> performance?
>>>
>>
>> Much easier to call C++ from Julia, particularly with the Cxx.jl package 
>> <https://github.com/Keno/Cxx.jl>.   Performance-wise, it shouldn't 
>> matter, but it is always easier to write glue code in a higher-level 
>> language than in a lower-level language. 
>>
>

[julia-users] Re: Is it better to call Julia from C++ or call C++ from Julia?

2016-09-03 Thread K leo
Thanks very much for the advise.

One question is whether Cxx is mature enough to be usable at this stage.  I 
tried to add it with Julia 0.5 and got the following errors:

julia> Pkg.add("Cxx")
INFO: Installing Cxx v0.0.1
INFO: Building Cxx
writing path.jl file
Tuning for julia installation at: /home/xxx/Software/julia-e6f843b073/bin
 g++ -D_GLIBCXX_USE_CXX11_ABI=0 -fno-rtti -DLIBRARY_EXPORTS -fPIC -O0 -g 
-std=c++11   -I/home/xxx/Software/julia-e6f843b073/bin/../../src/support 
-I/home/xxx/Software/julia-e6f843b073/bin/../include -Isrc/clang-3.7.1/lib 
-Ibuild/clang-3.7.1/include -Isrc/clang-3.7.1/include 
-Isrc/llvm-3.7.1/include -Ibuild/llvm-3.7.1/include  -DLLVM_NDEBUG -c 
../src/bootstrap.cpp -o build/bootstrap.o
../src/bootstrap.cpp:19:35: fatal error: llvm/ADT/DenseMapInfo.h: No such 
file or directory
compilation terminated.
BuildBootstrap.Makefile:131: recipe for target 'build/bootstrap.o' failed
make: *** [build/bootstrap.o] Error 1
=[ ERROR: Cxx 
]=

LoadError: failed process: Process(`make -j2 -f BuildBootstrap.Makefile 
BASE_JULIA_HOME=/home/xxx/Software/julia-e6f843b073/bin`, ProcessExited(2)) 
[2]
while loading /home/xxx/.julia/v0.5/Cxx/deps/build.jl, in expression 
starting on line 31



[ BUILD ERRORS 
]

WARNING: Cxx had build errors.

 - packages with build errors remain installed in /home/xxx/.julia/v0.5
 - build the package(s) and all dependencies with `Pkg.build("Cxx")`
 - build a single package by running its `deps/build.jl` script


INFO: Package database updated

On Saturday, September 3, 2016 at 9:17:38 AM UTC+8, Steven G. Johnson wrote:
>
>
>
> On Friday, September 2, 2016 at 8:51:21 PM UTC-4, K leo wrote:
>>
>> While the majority of my analytics are in Julia, I will need to use an 
>> external event handling API which is implemented in C++.  It looks that I 
>> have two options: 1) write the main code in C++ with the API and call Julia 
>> function for analytics; 2) write the main code also in Julia that work 
>> seamlessly with my analytics and call the C++ API for events.
>>
>> Which would be the better path in terms of ease of coding and performance?
>>
>
> Much easier to call C++ from Julia, particularly with the Cxx.jl package 
> <https://github.com/Keno/Cxx.jl>.   Performance-wise, it shouldn't 
> matter, but it is always easier to write glue code in a higher-level 
> language than in a lower-level language. 
>


[julia-users] Re: Can someone please update Winston?

2016-09-03 Thread K leo
I am sorry, but what does the following mean:

julia> Pkg.clone("g...@github.com:MetServiceDev/Winston.jl.git")
INFO: Cloning Winston from g...@github.com:MetServiceDev/Winston.jl.git
Private key location for 'g...@github.com':
Public key location for 'g...@github.com' [.pub]:
WARNING: Private key not found
Passphrase for :
ERROR: GitError(Code:ERROR, Class:SSH, Failed to authenticate SSH session: 
Unable to open public key file)
 in macro expansion at ./libgit2/error.jl:99 [inlined]
 in clone(::String, ::SubString{String}, ::Base.LibGit2.CloneOptions) at 
./libgit2/repository.jl:191
 in #clone#109(::String, ::Bool, ::Ptr{Void}, 
::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::String, 
::SubString{String}) at ./libgit2/libgit2.jl:327
 in clone(::String, ::SubString{String}) at ./pkg/entry.jl:195
 in clone(::String) at ./pkg/entry.jl:221
 in 
(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}})() 
at ./pkg/dir.jl:31
 in 
cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#clone,Tuple{String}}, 
::String) at ./file.jl:59
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, 
::Vararg{Any,N}) at ./pkg/dir.jl:31
 in clone(::String) at ./pkg/pkg.jl:151


On Tuesday, August 30, 2016 at 1:26:29 PM UTC+8, Devin Kilminster wrote:
>
> I agree with everyone who's saying you should look at Plots.jl, but if for 
> now you must use Winston, you might have luck with the version I forked and 
> hacked to make run on 0.5:
>
> Pkg.clone("g...@github.com:MetServiceDev/Tk.jl.git")
> Pkg.clone("g...@github.com:MetServiceDev/Winston.jl.git")
>
> I don't want to be maintaining the above for any length of time, so we're 
> transitioning to Plots.jl.
>
> Also as Chris Rackauckas has said there has been some development work, 
> so hopefully, that will work.
>
> On Friday, August 26, 2016 at 10:04:22 PM UTC, K leo wrote:
>>
>> so that it works with version 0.5. 
>
>

[julia-users] Re: Is it better to call Julia from C++ or call C++ from Julia?

2016-09-02 Thread K leo
I need to add that the target OS is Ubuntu.

On Saturday, September 3, 2016 at 8:51:21 AM UTC+8, K leo wrote:
>
> While the majority of my analytics are in Julia, I will need to use an 
> external event handling API which is implemented in C++.  It looks that I 
> have two options: 1) write the main code in C++ with the API and call Julia 
> function for analytics; 2) write the main code also in Julia that work 
> seamlessly with my analytics and call the C++ API for events.
>
> Which would be the better path in terms of ease of coding and performance?
>


[julia-users] Is it better to call Julia from C++ or call C++ from Julia?

2016-09-02 Thread K leo
While the majority of my analytics are in Julia, I will need to use an
external event handling API which is implemented in C++.  It looks that I
have two options: 1) write the main code in C++ with the API and call Julia
function for analytics; 2) write the main code also in Julia that work
seamlessly with my analytics and call the C++ API for events.

Which would be the better path in terms of ease of coding and performance?


[julia-users] Re: Can someone please update Winston?

2016-08-27 Thread K leo
Thanks for the reply.

I did try Plots.jl, and it appears all plots go to a browser window.  I 
would still prefer plots have their own private window with sizes under 
control.  Am I missing anything?

Pkg.checkout("Winston") doesn't get me anything new.


On Saturday, August 27, 2016 at 8:19:45 AM UTC+8, Chris Rackauckas wrote:
>
> You should really check out Plots.jl. It's a plotting metapackage which 
> lets you use the same plot commands to use any backend. It's nice because 
> if you're using it an one package stops getting updated, you can switch to 
> another plotting backend without changing your plot commands.
>
> But I can see that, although Winston hasn't been tagged in almost a year, 
> there has been some development work. Have you tried 
> Pkg.checkout("Winston")?
>
> On Friday, August 26, 2016 at 3:04:22 PM UTC-7, K leo wrote:
>>
>> so that it works with version 0.5. 
>
>

[julia-users] Can someone please update Winston?

2016-08-26 Thread K leo
so that it works with version 0.5.


[julia-users] Why is "collect" better than "[]"?

2016-06-06 Thread K leo
Why deprecate array concatenation with "[]" and suggest to use "collect"?
It requires more typing and makes code less elegant.  What do we really
gain with inefficiency?

Also using "[]" directly in REPL does not have problem, but including code
generates warning.  Why?


Re: [julia-users] What does "include" really do?

2016-05-02 Thread K leo
Well that is very strange.  Somethings seems to get bigger or clumsier 
after many repeated includes.  I wonder what that can be.  I don't have 
global arrays, only some global constants.  Most of the time my repeated 
includes is only after changing a line or a couple lines of codes or even a 
parameter value, etc.  How can I time the time spent on include?

On Monday, May 2, 2016 at 10:07:17 PM UTC+5:30, Yichao Yu wrote:
>
>
> On May 2, 2016 12:07 PM, "K leo" <cnbi...@gmail.com > wrote:
> >
> > Did you imply that repeating "include" at the REPL should not slow it 
> down?
> >
>
> No it shouldn't.
>
> >
> > On Monday, May 2, 2016 at 9:10:58 PM UTC+5:30, Yichao Yu wrote:
> >>
> >> include parse and eval the file in current module. 
> >>
> >> Without detail (and I mean very detail, not just a sentence or two 
> >> about what it does) about your code, it's impossible to tell what's 
> >> happening. 
>


Re: [julia-users] What does "include" really do?

2016-05-02 Thread K leo
Did you imply that repeating "include" at the REPL should not slow it down?

On Monday, May 2, 2016 at 9:10:58 PM UTC+5:30, Yichao Yu wrote:
>
> include parse and eval the file in current module. 
>
> Without detail (and I mean very detail, not just a sentence or two 
> about what it does) about your code, it's impossible to tell what's 
> happening. 
>


[julia-users] What does "include" really do?

2016-05-02 Thread K leo
When I test my programs, I often do include("myprog.jl") on the REPL after
editing the program.  What I found is that after I do this enough times,
response to the "include" becomes slow at the REPL.  What is happening?


[julia-users] Re: What are the best ways to define scenarios?

2016-04-29 Thread K leo
Thanks.  My issue of using a type is where to keep the set of constant 
values for each scenario.  I can only put 1 set of them in the constructor. 
 

On Friday, April 29, 2016 at 7:12:02 AM UTC+5:30, Lyndon White wrote:
>
> Define a type (possibly immutable) per sensation, with the constants
> Create a function that operates on that type that carries out the scenario.
>
> loop (or map (or pmap)) through an array of the aforementioned type, 
> applying the aforementioned function.
>
>
> On Friday, 29 April 2016 09:15:40 UTC+8, K leo wrote:
>>
>> Each scenario has the same set of constants but with different values.  I 
>> would like to loop through all these scenarios.  What are the best ways to 
>> handle this? 
>
>

[julia-users] What are the best ways to define scenarios?

2016-04-28 Thread K leo
Each scenario has the same set of constants but with different values.  I
would like to loop through all these scenarios.  What are the best ways to
handle this?


[julia-users] What to do with those Gadfly warning/error messages?

2016-04-25 Thread K leo
Plots work, but there are a lot of messages print out to REPL.  What can I 
do about them?  See below.


$ juliag
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.5 (2016-03-18 00:58 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-unknown-linux-gnu

julia> using Plots

julia> gadfly()
Plots.GadflyBackend()

julia> plot(x=rand(10), y=rand(10))
[Plots.jl] Initializing backend: gadfly
julia> 
(Thunar:4638): GLib-GObject-WARNING **: invalid unclassed pointer in cast 
to 'GObject'

(Thunar:4638): GLib-GObject-CRITICAL **: g_object_set_qdata: assertion 
'G_IS_OBJECT (object)' failed

(firefox:4651): Gtk-WARNING **: Theme directory  of theme oxygen has no 
size field



Re: [julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-24 Thread K leo
Looking through the linear standard functions list in the documentation, I 
think perhaps the only function used is linreg.  I don't directly use 
LAPACK.

On Sunday, April 24, 2016 at 9:18:36 PM UTC+5:30, Milan Bouchet-Valat wrote:
>
> Le dimanche 24 avril 2016 à 08:44 -0700, K leo a écrit : 
> > It is hard to know how to describe my code.  So I tried to run it 
> > with the generic version which does use 200% of CPU.  So there seems 
> > something different with the Ubuntu version of Julia. 
> OK. Could you at least make a list of linear algebra functions that you 
> are using? It could be that Ubuntu's OpenBLAS doesn't include optimized 
> LAPACK functions. 
>
>
> Regards 
>
> > I installed under my home folder.  I ran it in the following way 
> > hoping that the shared libs are not mixed with the system ones. 
> > 
> > $ ~/Software/julia-2ac304dfba/bin/julia 
> >_ 
> >_   _ _(_)_ |  A fresh approach to technical computing 
> >   (_) | (_) (_)|  Documentation: http://docs.julialang.org 
> >_ _   _| |_  __ _   |  Type "?help" for help. 
> >   | | | | | | |/ _` |  | 
> >   | | |_| | | | (_| |  |  Version 0.4.5 (2016-03-18 00:58 UTC) 
> >  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release 
> > |__/   |  x86_64-unknown-linux-gnu 
> > 
> > 
> > > Le dimanche 24 avril 2016 à 05:38 -0700, K leo a écrit :  
> > > >  
> > > > See below.  
> > > >  
> > > > > Le samedi 23 avril 2016 à 18:10 -0700, K leo a écrit :   
> > > > > > > Le samedi 23 avril 2016 à 04:52 -0700, K leo a écrit :
> > > > > > > Anyway,
> > > > > > > the Ubuntu PPA is no longer maintained. The recommended 
> > > solution is to
> > > > > > > use generic Linux binaries from the Julia website.
> > > > > > >   
> > > > > > 
> > > > > > On Ubuntu 16.04, Julia 0.4.5 is available on multiverse 
> > > repository   
> > > > > > for some reason.  Not sure who maintains it.   
> > > > > Ah, OK, I thought you were using the PPA package. Anyway, 
> > > Ubuntu 16.04   
> > > > > includes the latest OpenBLAS and the Julia package depends on 
> > > it, so it   
> > > > > should be good. That said, maybe that OpenBLAS library doesn't 
> > > use   
> > > > > threading.   
> > > > >  
> > > > > Can you confirm that running
> > > > > x=rand(1,1);   
> > > > > x*x   
> > > > > does not make Julia use more than 100% CPU?   
> > > > It actually uses close to 200% of CPU.
> > > OK, so no problem in this area.  
> > > 
> > > I think you'll have to give more details about the code you 
> > > mentioned  
> > > in your first post for us to be able to help. Also, please confirm 
> > > that  
> > > you see the same problem (i.e. code using only one core) with the  
> > > generic Linux binaries.  
> > > 
> > > 
> > > Regards  
> > > 
> > > > > If not, could you post the output of versioninfo()? Finally, 
> > > please run   
> > > > > 'ls -l /usr/lib/julia/', 'ls -l /usr/lib64/julia' from a shell 
> > > and copy   
> > > > > the result.   
> > > >  julia> versioninfo()  
> > > > Julia Version 0.4.5  
> > > > Commit 2ac304d (2016-03-18 00:58 UTC)  
> > > > Platform Info:  
> > > >   System: Linux (x86_64-linux-gnu)  
> > > >   CPU: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz  
> > > >   WORD_SIZE: 64  
> > > >   BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY 
> > > Haswell)  
> > > >   LAPACK: libopenblas  
> > > >   LIBM: libopenlibm  
> > > >   LLVM: libLLVM-3.8  
> > > >  
> > > > $ ls -l /usr/lib/julia/  
> > > > ls: cannot access '/usr/lib/julia/': No such file or directory  
> > > >  
> > > > $ ls -l /usr/lib/x86_64-linux-gnu/julia  
> > > > total 26440  
> > > > lrwxrwxrwx 1 root root   20 Apr 18 17:45 libarpack.so -> 
> > > ../../libarpack.so.2  
> > > > -rw-r--r-- 1 root root15608 Apr 18 17:45 libccalltest.so  
> > > > lrwxrwxrwx 1 root root   22 Apr 18 17:45 libcholmod.so -> 
> > > ../libcholmod.so.3.0.6  
> > > > lrwxrwxrwx 1 root root   22 

Re: [julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-24 Thread K leo
It is hard to know how to describe my code.  So I tried to run it with the 
generic version which does use 200% of CPU.  So there seems something 
different with the Ubuntu version of Julia.

I installed under my home folder.  I ran it in the following way hoping 
that the shared libs are not mixed with the system ones.

$ ~/Software/julia-2ac304dfba/bin/julia
   _
   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.5 (2016-03-18 00:58 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-unknown-linux-gnu


On Sunday, April 24, 2016 at 7:18:48 PM UTC+5:30, Milan Bouchet-Valat wrote:
>
> Le dimanche 24 avril 2016 à 05:38 -0700, K leo a écrit : 
> > 
> > See below. 
> > 
> > > Le samedi 23 avril 2016 à 18:10 -0700, K leo a écrit :  
> > > > > Le samedi 23 avril 2016 à 04:52 -0700, K leo a écrit :   
> > > > > Anyway,   
> > > > > the Ubuntu PPA is no longer maintained. The recommended solution 
> is to   
> > > > > use generic Linux binaries from the Julia website.   
> > > > >  
> > > >
> > > > On Ubuntu 16.04, Julia 0.4.5 is available on multiverse repository  
> > > > for some reason.  Not sure who maintains it.  
> > > Ah, OK, I thought you were using the PPA package. Anyway, Ubuntu 
> 16.04  
> > > includes the latest OpenBLAS and the Julia package depends on it, so 
> it  
> > > should be good. That said, maybe that OpenBLAS library doesn't use  
> > > threading.  
> > > 
> > > Can you confirm that running   
> > > x=rand(1,1);  
> > > x*x  
> > > does not make Julia use more than 100% CPU?  
> > It actually uses close to 200% of CPU.   
> OK, so no problem in this area. 
>
> I think you'll have to give more details about the code you mentioned 
> in your first post for us to be able to help. Also, please confirm that 
> you see the same problem (i.e. code using only one core) with the 
> generic Linux binaries. 
>
>
> Regards 
>
> > > If not, could you post the output of versioninfo()? Finally, please 
> run  
> > > 'ls -l /usr/lib/julia/', 'ls -l /usr/lib64/julia' from a shell and 
> copy  
> > > the result.  
> >  julia> versioninfo() 
> > Julia Version 0.4.5 
> > Commit 2ac304d (2016-03-18 00:58 UTC) 
> > Platform Info: 
> >   System: Linux (x86_64-linux-gnu) 
> >   CPU: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz 
> >   WORD_SIZE: 64 
> >   BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell) 
> >   LAPACK: libopenblas 
> >   LIBM: libopenlibm 
> >   LLVM: libLLVM-3.8 
> > 
> > $ ls -l /usr/lib/julia/ 
> > ls: cannot access '/usr/lib/julia/': No such file or directory 
> > 
> > $ ls -l /usr/lib/x86_64-linux-gnu/julia 
> > total 26440 
> > lrwxrwxrwx 1 root root   20 Apr 18 17:45 libarpack.so -> 
> ../../libarpack.so.2 
> > -rw-r--r-- 1 root root15608 Apr 18 17:45 libccalltest.so 
> > lrwxrwxrwx 1 root root   22 Apr 18 17:45 libcholmod.so -> 
> ../libcholmod.so.3.0.6 
> > lrwxrwxrwx 1 root root   22 Apr 18 17:45 libdSFMT.so -> 
> ../libdSFMT-19937.so.1 
> > lrwxrwxrwx 1 root root   25 Apr 18 17:45 libfftw3f_threads.so -> 
> ../libfftw3f_threads.so.3 
> > lrwxrwxrwx 1 root root   24 Apr 18 17:45 libfftw3_threads.so -> 
> ../libfftw3_threads.so.3 
> > lrwxrwxrwx 1 root root   15 Apr 18 17:45 libgmp.so -> 
> ../libgmp.so.10 
> > -rw-r--r-- 1 root root  1175608 Apr 18 17:45 libjulia.so 
> > lrwxrwxrwx 1 root root   15 Apr 18 17:45 libmpfr.so -> 
> ../libmpfr.so.4 
> > lrwxrwxrwx 1 root root   22 Apr 18 17:45 libopenblas.so -> 
> ../../libopenblas.so.0 
> > lrwxrwxrwx 1 root root   19 Apr 18 17:45 libopenlibm.so -> 
> ../libopenlibm.so.2 
> > lrwxrwxrwx 1 root root   22 Apr 18 17:45 libopenspecfun.so -> 
> ../libopenspecfun.so.1 
> > lrwxrwxrwx 1 root root   18 Apr 18 17:45 libpcre2-8.so -> 
> ../libpcre2-8.so.0 
> > -rw-r--r-- 1 root root   203048 Apr 18 17:45 libRmath-julia.so 
> > lrwxrwxrwx 1 root root   19 Apr 18 17:45 libspqr.so -> 
> ../libspqr.so.2.0.2 
> > lrwxrwxrwx 1 root root   32 Apr 18 17:45 libsuitesparseconfig.so -> 
> ../libsuitesparseconfig.so.4.4.6 
> > -rw-r--r-- 1 root root 6000 Apr 18 17:45 libsuitesparse_wrapper.so 
> > lrwxrwxrwx 1 root root   22 Apr 18 17:45 libumfpack.so -> 
> ../libumfpack.so.5.7.1 
> > -rw-r--r-- 1 root root 25664120 Apr 18 17:45 sys.so 
> > 
> > $ ls -l /usr/lib64/julia 
> > ls: cannot access '/usr/lib64/julia': No such file or directory 
> > 
> > > 
> > > I'm Ccing Graham Inggs, who maintains the Debian package on which the  
> > > Ubuntu package is based.  
> > > 
> > > 
> > > Regards  
>


Re: [julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-24 Thread K leo
See below.

On Sunday, April 24, 2016 at 4:01:49 PM UTC+5:30, Milan Bouchet-Valat wrote:
>
> Le samedi 23 avril 2016 à 18:10 -0700, K leo a écrit : 
> > > Le samedi 23 avril 2016 à 04:52 -0700, K leo a écrit :  
> > > Anyway,  
> > > the Ubuntu PPA is no longer maintained. The recommended solution is 
> to  
> > > use generic Linux binaries from the Julia website.  
> > > 
> >   
> > On Ubuntu 16.04, Julia 0.4.5 is available on multiverse repository 
> > for some reason.  Not sure who maintains it. 
> Ah, OK, I thought you were using the PPA package. Anyway, Ubuntu 16.04 
> includes the latest OpenBLAS and the Julia package depends on it, so it 
> should be good. That said, maybe that OpenBLAS library doesn't use 
> threading. 
>
> Can you confirm that running  
> x=rand(1,1); 
> x*x 
> does not make Julia use more than 100% CPU? 
>

It actually uses close to 200% of CPU.  
 

>
> If not, could you post the output of versioninfo()? Finally, please run 
> 'ls -l /usr/lib/julia/', 'ls -l /usr/lib64/julia' from a shell and copy 
> the result. 
>

 julia> versioninfo()
Julia Version 0.4.5
Commit 2ac304d (2016-03-18 00:58 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.8

$ ls -l /usr/lib/julia/
ls: cannot access '/usr/lib/julia/': No such file or directory

$ ls -l /usr/lib/x86_64-linux-gnu/julia
total 26440
lrwxrwxrwx 1 root root   20 Apr 18 17:45 libarpack.so -> 
../../libarpack.so.2
-rw-r--r-- 1 root root15608 Apr 18 17:45 libccalltest.so
lrwxrwxrwx 1 root root   22 Apr 18 17:45 libcholmod.so -> 
../libcholmod.so.3.0.6
lrwxrwxrwx 1 root root   22 Apr 18 17:45 libdSFMT.so -> 
../libdSFMT-19937.so.1
lrwxrwxrwx 1 root root   25 Apr 18 17:45 libfftw3f_threads.so -> 
../libfftw3f_threads.so.3
lrwxrwxrwx 1 root root   24 Apr 18 17:45 libfftw3_threads.so -> 
../libfftw3_threads.so.3
lrwxrwxrwx 1 root root   15 Apr 18 17:45 libgmp.so -> ../libgmp.so.10
-rw-r--r-- 1 root root  1175608 Apr 18 17:45 libjulia.so
lrwxrwxrwx 1 root root   15 Apr 18 17:45 libmpfr.so -> ../libmpfr.so.4
lrwxrwxrwx 1 root root   22 Apr 18 17:45 libopenblas.so -> 
../../libopenblas.so.0
lrwxrwxrwx 1 root root   19 Apr 18 17:45 libopenlibm.so -> 
../libopenlibm.so.2
lrwxrwxrwx 1 root root   22 Apr 18 17:45 libopenspecfun.so -> 
../libopenspecfun.so.1
lrwxrwxrwx 1 root root   18 Apr 18 17:45 libpcre2-8.so -> 
../libpcre2-8.so.0
-rw-r--r-- 1 root root   203048 Apr 18 17:45 libRmath-julia.so
lrwxrwxrwx 1 root root   19 Apr 18 17:45 libspqr.so -> 
../libspqr.so.2.0.2
lrwxrwxrwx 1 root root   32 Apr 18 17:45 libsuitesparseconfig.so -> 
../libsuitesparseconfig.so.4.4.6
-rw-r--r-- 1 root root 6000 Apr 18 17:45 libsuitesparse_wrapper.so
lrwxrwxrwx 1 root root   22 Apr 18 17:45 libumfpack.so -> 
../libumfpack.so.5.7.1
-rw-r--r-- 1 root root 25664120 Apr 18 17:45 sys.so

$ ls -l /usr/lib64/julia
ls: cannot access '/usr/lib64/julia': No such file or directory


> I'm Ccing Graham Inggs, who maintains the Debian package on which the 
> Ubuntu package is based. 
>
>
> Regards 
>


Re: [julia-users] Re: implications of using the precompiled "generic linux binary" vs building julia myself?

2016-04-24 Thread K leo
I tried that and it seems when I have other versions (the PPA version for 
instance) of Julia installed in the system, the shared libs were mixed up. 
 When I removed the PPA version, it complained some shared libs were not 
found.

On Sunday, April 24, 2016 at 4:06:33 PM UTC+5:30, Milan Bouchet-Valat wrote:
>
> Le samedi 23 avril 2016 à 18:23 -0700, K leo a écrit : 
> > I also would like to know about what to do with the lib folder.  Can 
> > someone explain?  There is no README with Linux generic version. 
> You just need to extract the whole contents of the archive somewhere, 
> and run bin/julia. No need to look at the other files, but they need to 
> be present. 
>
>
> Regards 
>
> > > What did you do with the generic build? 
> > > 
> > > I can take the bin/julia and run it, but I am confused as to what 
> > > to do with the rest of the folders, especially all the files under 
> > > lib/julia . Do I have to copy it somewhere? The other folders seem 
> > > easy to get, such as man being man pages, etc ... Thanks! 
> > > 
> > > 
>


[julia-users] Re: implications of using the precompiled "generic linux binary" vs building julia myself?

2016-04-23 Thread K leo
I also would like to know about what to do with the lib folder.  Can 
someone explain?  There is no README with Linux generic version.

On Thursday, July 23, 2015 at 7:52:36 AM UTC+5:30, David Kao wrote:
>
> What did you do with the generic build?
>
> I can take the bin/julia and run it, but I am confused as to what to do 
> with the rest of the folders, especially all the files under lib/julia . Do 
> I have to copy it somewhere? The other folders seem easy to get, such as 
> man being man pages, etc ... Thanks!
>
>

Re: [julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-23 Thread K leo
On Saturday, April 23, 2016 at 7:01:45 PM UTC+5:30, Milan Bouchet-Valat 
wrote:
>
> Le samedi 23 avril 2016 à 04:52 -0700, K leo a écrit : 
> Anyway, 
> the Ubuntu PPA is no longer maintained. The recommended solution is to 
> use generic Linux binaries from the Julia website. 
>
>  
On Ubuntu 16.04, Julia 0.4.5 is available on multiverse repository for some 
reason.  Not sure who maintains it.


Re: [julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-23 Thread K leo
I did some timing measures running the same code.  On Ubuntu 15.10 where 
Julia uses 200% of CPU, the code runs in 2500 seconds.  On Ubuntu 16.04 
where Julia takes 100% CPU, the code runs in 2700 seconds.  I don't know 
what causes Julia to use less CPU on 16.04, whether being the Linux version 
or the Julia version.  So given the little difference in time, perhaps the 
conclusion is Ubuntu 16.04 is more efficient using hardware resources.  Any 
comments?

On Thursday, April 21, 2016 at 8:35:31 PM UTC+5:30, K leo wrote:
>
>
>
> On Thursday, April 21, 2016 at 8:21:14 PM UTC+5:30, Yichao Yu wrote:
>>
>> On Thu, Apr 21, 2016 at 10:39 AM, K leo <cnbi...@gmail.com> wrote: 
>> > Prior to running Ubuntu 16.04, I get Julia from the PPA, and run it 
>> simply 
>> > like: 
>> > 
>> >> julia 
>> > 
>> > Then when I run julia code, "top" shows CPU usage of Julia as something 
>> like 
>> > 200% (I have two cores). 
>>
>> What code are you running. Any pre-build version should run julia code 
>> only on one thread. Any other thread are created by libraries like 
>> fftw or openblas. 
>>
>  
> I run my own code which does not directly require fftw or openblas.  The 
> same code runs on the version on Ubuntu 15.10, it uses 200% CPU, but on the 
> version on 16.04, it only uses 100%.  Note the versions of Julia on the two 
> systems are likely from different builds.
>
>
>> > 
>> > Now on 16.04, julia only runs upto 100% of CPU.  The version of julia 
>> is 
>> > said to maintained by "Ubuntu Developers 
>> > <ubuntu-dev...@lists.ubuntu.com>" 
>> > 
>> > What is happening? 
>>
>

Re: [julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-21 Thread K leo


On Thursday, April 21, 2016 at 8:21:14 PM UTC+5:30, Yichao Yu wrote:
>
> On Thu, Apr 21, 2016 at 10:39 AM, K leo <cnbi...@gmail.com > 
> wrote: 
> > Prior to running Ubuntu 16.04, I get Julia from the PPA, and run it 
> simply 
> > like: 
> > 
> >> julia 
> > 
> > Then when I run julia code, "top" shows CPU usage of Julia as something 
> like 
> > 200% (I have two cores). 
>
> What code are you running. Any pre-build version should run julia code 
> only on one thread. Any other thread are created by libraries like 
> fftw or openblas. 
>
 
I run my own code which does not directly require fftw or openblas.  The 
same code runs on the version on Ubuntu 15.10, it uses 200% CPU, but on the 
version on 16.04, it only uses 100%.  Note the versions of Julia on the two 
systems are likely from different builds.


> > 
> > Now on 16.04, julia only runs upto 100% of CPU.  The version of julia is 
> > said to maintained by "Ubuntu Developers 
> > <ubuntu-dev...@lists.ubuntu.com >" 
> > 
> > What is happening? 
>


[julia-users] Why Ubuntu 16.04 version runs only on one CPU?

2016-04-21 Thread K leo
Prior to running Ubuntu 16.04, I get Julia from the PPA, and run it simply
like:

> julia

Then when I run julia code, "top" shows CPU usage of Julia as something
like 200% (I have two cores).

Now on 16.04, julia only runs upto 100% of CPU.  The version of julia is
said to maintained by "Ubuntu Developers <
ubuntu-devel-disc...@lists.ubuntu.com>"

What is happening?


[julia-users] round(Int, typemin(Float64))

2016-04-20 Thread K leo
julia> round(Int, typemin(Float64))
ERROR: InexactError()
 in round at ./float.jl:181

Should this be handled this way?  Or is it better to make round(Int,
typemin(Float64)) to be typemin(Int)?

Also, why is typemin(Float64) -Inf but typemin(Int) -9223372036854775808?
Can typemin(Int) be made -Inf as well?


[julia-users] Re: an error with DataFrames on Ubuntu 16.04 64bits

2016-04-18 Thread K leo
The PPA version.

On Monday, April 18, 2016 at 9:51:44 AM UTC+5:30, Tony Kelman wrote:
>
> Where is your Julia build from?



[julia-users] an error with DataFrames on Ubuntu 16.04 64bits

2016-04-17 Thread K leo
Run my julia code for the first time after setting julia up on Ubuntu 
16.04, I got the following errors:

INFO: Precompiling module DataFrames...
ERROR: LoadError: LoadError: error compiling anonymous: could not load 
library "libz"
libz: cannot open shared object file: No such file or directory
while loading /home/xxx/.julia/v0.4/GZip/src/zlib_h.jl, in expression 
starting on line 8
while loading /home/xxx/.julia/v0.4/GZip/src/GZip.jl, in expression 
starting on line 75
ERROR: LoadError: Failed to precompile GZip to 
/home/xxx/.julia/lib/v0.4/GZip.ji
while loading /home/xxx/.julia/v0.4/DataFrames/src/DataFrames.jl, in 
expression starting on line 15
ERROR: LoadError: LoadError: LoadError: Failed to precompile DataFrames to 
/home/xxx/.julia/lib/v0.4/DataFrames.ji
 in compilecache at ./loading.jl:400


After some searching, I found that I had to install lib32z1 and lib32z1-dev 
on Ubuntu.  Not sure why these are missing with the new Ubuntu.


[julia-users] Atom package autocomplete-julia missing?

2016-04-17 Thread K leo
The package is no longer available.  Does anyone know why?


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

2016-04-14 Thread K leo
I did more tests and runs.  Now I put most @inbounds and @simd back and 
even added more in other places.  A few runs over 3 hours did not get any 
problem.  Someone mentioned about heat.  I am actually running these on the 
deck with outside temperature over 34C.  The MacBook Pro is hot but has no 
problem.

So I am more inclined to attributing the problem to the Linux generic 
version of Julia (since the current reliable runs have been using the 
Ubuntu PPA version).  Some library mismatch of the generic version causing 
the crashes sounds very likely, doesn't it?

On Sunday, April 10, 2016 at 4:25:52 PM UTC+5:30, K leo wrote:
>
> 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 ruled out.
>
> Trying to guess what could be the problem for the crashes, I put my 
> attention on the use of @inbounds and @simd in the code.  The documentation 
> says @inbounds can cause crash when the index gets out of bound.  @simd was 
> not said of possibly causing crashes, but it is said of being 
> experimental.  So I took those out and re-run the code.
>
> After a few hours, the code finishes without crashing.  Though this does 
> not lead to the conclusion that the two modifiers were the culprit, as the 
> code did not crash everytime in the past, this rather makes me wonder if 
> @inbounds can possibly be the cause.  Look, the code finishes without 
> having an index out of bound problem.  Is this enough to conclude that 
> @inbounds was not the problem?
>
> What can make @simd crash the system?
>
> Another possible cause might be the version of Julia I used.  For the past 
> weeks, I used the Linux generic version of Julia.  This successful run was 
> on the version I got from Ubuntu's PPA.  In the past, I also juggled 
> between the two sources for Julia.  I can't be certain in saying that the 
> generic version crashes on ubuntu, but my question is what are the real 
> differences between the two version of Julia?
>
>
>

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 both Xubuntu and OSX have 
the same problem, but that becomes a hard argument.

On Sunday, April 10, 2016 at 4:47:55 PM UTC+5:30, Milan Bouchet-Valat wrote:
>
> Le dimanche 10 avril 2016 à 16:25 +0530, K leo a écrit : 
> No program should be able to crash the whole system. So this really 
> sounds like a bug in Xubuntu. What could also happen is that you run 
> out of memory, and the system is swapping so much that it's never able 
> to recover. 
>
> In any case, this is likely not related to @inbounds, which could only 
> trigger a crash of Julia, but not of the whole system. 
>
>
> Regards 
>
>

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

2016-04-09 Thread K leo
Thanks.  I have an array for functions like funcArray=[FuncA, FuncB, 
FuncC], and as I run them through a loop, I want to be able to tell which 
function is running.  So perhaps just simply string(FuncA) would serve my 
need.

On Saturday, April 9, 2016 at 12:01:34 PM UTC+5:30, Tamas Papp wrote:
>
> julia> functionname(f)=string(f.env.name) 
> functionname (generic function with 1 method) 
>
> julia> foo(x)=1 
> foo (generic function with 1 method) 
>
> julia> functionname(foo) 
> "foo" 
>
> But be aware that this may change and is unlikely to be a good solution 
> unless you really, really know what you are doing. Perhaps if you 
> explained what you want to achieve you would get suggestions for better 
> solutions. 
>
> Best, 
>
> Tamas 
>
>
> On Sat, Apr 09 2016, K. leo wrote: 
>
> > Say a function is named FuncA.  I hope to get this name into a string 
> like 
> > "FuncA".  Is there a way to do that? 
>
>

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

2016-04-08 Thread K leo
Say a function is named FuncA.  I hope to get this name into a string like
"FuncA".  Is there a way to do that?


[julia-users] Re: how should I really define const to avoid redefining warning?

2016-04-05 Thread K leo


> I wonder in what cases the warnings show.  I try to make a simple case 
where I have just one file called "testConst.jl" in which I have the 
following 2 lines:
[code]
const A=12
println(A)
[\code]

Everytime I modify the file and include it on the REPL, I don't get warning 
of redefining constant A.  Why is this?



Re: [julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread K leo
Thanks for the tip.

Don't you have to do include everytime you change some files?
My codes have not been complicated enough to use modules, but how does that 
help with only a couple files?

On Tuesday, April 5, 2016 at 6:45:00 PM UTC+5:30, Erik Schnetter wrote:
>
> I usually put code into a module, and use `using` to load the module. 
>
> After updating a module, I use `workspace()` to remove all previous 
> definition in the REPL: 
>
> `workspace(); using FunHPC` 
>
> -erik 
>
>
> On Tue, Apr 5, 2016 at 9:13 AM, K leo <cnbi...@gmail.com > 
> wrote: 
> > I have some const defined in various files in the following way: 
> > 
> > [code]const AConst=1[/code] 
> > 
> > Everytime after I modify something in the files (constants remain 
> unchanged) 
> > and include a file on Julia's REPL, I always get a bunch warnings about 
> > redefining constants.  Repeating the process many time can get Julia to 
> have 
> > slow response. 
> > 
> > What can I do to avoid these warnings? 
>
>
>
> -- 
> Erik Schnetter <schn...@gmail.com > 
> http://www.perimeterinstitute.ca/personal/eschnetter/ 
>


[julia-users] how should I really define const to avoid redefining warning?

2016-04-05 Thread K leo
I have some const defined in various files in the following way:

[code]const AConst=1[/code]

Everytime after I modify something in the files (constants remain
unchanged) and include a file on Julia's REPL, I always get a bunch
warnings about redefining constants.  Repeating the process many time can
get Julia to have slow response.

What can I do to avoid these warnings?


[julia-users] Is Ubuntu's PPA needed for installing Julia?

2016-04-01 Thread K leo
So the PPA has not been maintained for many months.  I tried to download a
Linux generic version of Julia and it appears to work well on my Xubuntu
15.10 64bits.  So my question is do we really need the PPA to install Julia?


[julia-users] Re: how to move Julia packages from Ubuntu to OSX?

2015-06-18 Thread K leo
Fantastic Eliot - thank you.  That problem is resolved!

BTW, does anyone know what the following message is about:

*julia **using Winston*

Warning: could not import Base.Text into Tk

On Tuesday, June 16, 2015, Elliot Saba staticfl...@gmail.com wrote:

 Congratulations!  You have helped me track down a bug in Pango that I
 inadvertently introduced four days ago!  You win the very helpful and
 patient community member prize.

 The good news is, this is now fixed
 https://github.com/staticfloat/homebrew-juliadeps/commit/5259fb998b76f36b783b35230d208942f2290c0d.
 The better news is, to get the fix to propagate to your machine is very
 simple:

 julia using Homebrew

 julia Homebrew.update()

 julia Homebrew.rm(pango); Homebrew.add(pango)

 Then quit Julia, reopen and you should see text in your plots.  This was
 masked on my machine due to some files laying around in just the right
 location to be loaded properly, giving me the proper text on my machine but
 not on yours.  Thank you for your patience!
 -E



[julia-users] Re: how to move Julia packages from Ubuntu to OSX?

2015-06-14 Thread K leo
Adding Winston individually succeeded.  But I still get the font problem.
Looks the same as before.

===
julia using Winston
ploWarning: could not import Base.Text into Tkt
julia plot(1:3)

(process:73606): Pango-WARNING **:
dlopen(/usr/local/Cellar/pango/1.36.8/lib/pango/1.8.0/modules/pango-basic-coretext.so,
2): image not found

(process:73606): Pango-WARNING **: failed to choose a font, expect ugly
output. engine-type='PangoRenderCoreText', script='common'


julia BinDeps.debug(Cairo)
INFO: Reading build script...
The package declares 1 dependencies.
 - Library Group cairo (satisfied by HB, HB)
 - Library png (not applicable to this system)
 - Library pixman (not applicable to this system)
 - Library ffi (not applicable to this system)
 - Library gettext
- Satisfied by:
  - Homebrew Bottles gettext at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/opt/gettext/lib/libintl.8.dylib
  - Homebrew Bottles gettext at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libgettextpo.dylib
  - Autotools Build at
/Users/xxx/.julia/v0.3/Cairo/deps/usr/lib/libintl.dylib
  - Autotools Build at
/Users/xxx/.julia/v0.3/Cairo/deps/usr/lib/libgettextpo.dylib
- Providers:
  - Homebrew Bottles gettext
  - AptGet package gettext (can't provide)
  - Yum package gettext-libs (can't provide)
  - Autotools Build
 - Library gobject
- Satisfied by:
  - Homebrew Bottles glib at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libgobject-2.0.0.dylib
- Providers:
  - Homebrew Bottles glib
  - AptGet package libglib2.0-0 (can't provide)
  - Yum package glib2 (can't provide)
  - Autotools Build
 - Library freetype (not applicable to this system)
 - Library fontconfig (not applicable to this system)
 - Library cairo
- Satisfied by:
  - Homebrew Bottles cairo at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libcairo.2.dylib
- Providers:
  - Homebrew Bottles cairo
  - AptGet package libcairo2 (can't provide)
  - Yum package cairo (can't provide)
  - Autotools Build
 - Library pango
- Satisfied by:
  - Homebrew Bottles pango at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/Cellar/pango/1.36.8/lib/libpango-1.0.0.dylib
- Providers:
  - Homebrew Bottles pango
  - AptGet package libpango1.0-0 (can't provide)
  - Yum package pango (can't provide)
  - Autotools Build
 - Library pangocairo
- Satisfied by:
  - Homebrew Bottles pango at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libpangocairo-1.0.dylib
- Providers:
  - Homebrew Bottles pango
  - AptGet package libpango1.0-0 (can't provide)
  - Yum package pango (can't provide)
  - Autotools Build
 - Library zlib (not applicable to this system)


[julia-users] problem adding Winston on OSX 10.10.3

2015-06-14 Thread K leo
Thanks for the message.

While `brew install xz` had trouble, I found my /usr/local/include and
/usr/local/lib are owned by 'root:wheel', which means I have no write
permission.  I am not sure why it is this way and what 'wheel' is.  It
might have happened when I installed OSXFuse as there are OSXFuse related
files in there.  But I chown'ed them to 'myself:admin' anyhow (other
directories under /usr/local have this ownership and I hope this is OK to
do).  After this `brew install xz` succeeded.

Well, so far I get the sense that it is going to be quite messy for me to
use Julia on the Mac.  I am prepared to take it gradually.  I would hold on
reporting the unxz issue to Homebrew.jl, as I am a lot less confidant on
the Mac right now to say that it is actually an issue rather than my own
problem.

Aren't there many people using Julia on OSX?

On Sunday, June 14, 2015, Kevin Squire kevin.squ...@gmail.com
javascript:_e(%7B%7D,'cvml','kevin.squ...@gmail.com'); wrote:

 It looks like it's having trouble finding `unxz`.  Can you file an issue
 against Homebrew.jl, with this error?  It should probably be installed by
 Homebrew (in Julia's Homebrew cellar)... although I'm not sure how that
 works for dependencies that need to be in the search path.

 In the mean time, to get it to work, you can install xz (e.g., `brew
 install xz`, if you use homebrew outside of Julia).

 Cheers,
Kevin

 On Sat, Jun 13, 2015 at 5:19 PM, K leo cnbiz...@gmail.com wrote:

 In another message I mentioned about the troubles I have with moving
 packages from Ubuntu to the Mac.  To further understand about the problems,
 I now experiment to add packages individually in a new ~/.julia directory.
 The first package to add is Winston.  It has trouble building Cairo with
 the errors below.  I checked in the finder that file
 /Users/xxx/.julia/v0.3/Cairo/deps/downloads/glib-2.34.3.tar.xz does exist.
 I wonder what the error message is about.

 [ ERROR: Cairo
 ]

 could not spawn `unxz -c
 /Users/xxx/.julia/v0.3/Cairo/deps/downloads/glib-2.34.3.tar.xz`: no such
 file or directory (ENOENT)
 while loading /Users/xxx/.julia/v0.3/Cairo/deps/build.jl, in expression
 starting on line 144


 
 INFO: Building Tk

 [ BUILD ERRORS
 ]

 WARNING: Cairo and Homebrew had build errors.

  - packages with build errors remain installed in /Users/xxx/.julia/v0.3
  - build the package(s) and all dependencies with `Pkg.build(Cairo,
 Homebrew)`
  - build a single package by running its `deps/build.jl` script


 
 INFO: Package database updated


_   _ _(_)_ |  A fresh approach to technical computing
   (_) | (_) (_)|  Documentation: http://docs.julialang.org
_ _   _| |_  __ _   |  Type help() for help.
   | | | | | | |/ _` |  |
   | | |_| | | | (_| |  |  Version 0.3.9 (2015-05-30 11:24 UTC)
  _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
 |__/   |  x86_64-apple-darwin13.4.0








[julia-users] problem adding Winston on OSX 10.10.3

2015-06-13 Thread K leo
In another message I mentioned about the troubles I have with moving
packages from Ubuntu to the Mac.  To further understand about the problems,
I now experiment to add packages individually in a new ~/.julia directory.
The first package to add is Winston.  It has trouble building Cairo with
the errors below.  I checked in the finder that file
/Users/xxx/.julia/v0.3/Cairo/deps/downloads/glib-2.34.3.tar.xz does exist.
I wonder what the error message is about.

[ ERROR: Cairo
]

could not spawn `unxz -c
/Users/xxx/.julia/v0.3/Cairo/deps/downloads/glib-2.34.3.tar.xz`: no such
file or directory (ENOENT)
while loading /Users/xxx/.julia/v0.3/Cairo/deps/build.jl, in expression
starting on line 144


INFO: Building Tk

[ BUILD ERRORS
]

WARNING: Cairo and Homebrew had build errors.

 - packages with build errors remain installed in /Users/xxx/.julia/v0.3
 - build the package(s) and all dependencies with `Pkg.build(Cairo,
Homebrew)`
 - build a single package by running its `deps/build.jl` script


INFO: Package database updated


   _   _ _(_)_ |  A fresh approach to technical computing
  (_) | (_) (_)|  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type help() for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.9 (2015-05-30 11:24 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/   |  x86_64-apple-darwin13.4.0


[julia-users] how to move Julia packages from Ubuntu to OSX?

2015-06-13 Thread K leo
hi Elliot,

Thanks for the detailed message.

Strangely, when I did BinDeps.debug(Cairo), I got:
ERROR: BinDeps not defined.

Also strangely, when I did 'brew rm pango, I got:
Error: No such keg: /usr/local/Cellar/pango

What is wrong?


[julia-users] how to move Julia packages from Ubuntu to OSX?

2015-06-13 Thread K leo
julia BinDeps.debug(Cairo)
INFO: Reading build script...
The package declares 1 dependencies.
 - Library Group cairo (satisfied by HB, HB)
 - Library png (not applicable to this system)
 - Library pixman (not applicable to this system)
 - Library ffi (not applicable to this system)
 - Library gettext
- Satisfied by:
  - Homebrew Bottles gettext at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libintl.dylib
  - Homebrew Bottles gettext at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libgettextpo.dylib
- Providers:
  - Homebrew Bottles gettext
  - AptGet package gettext (can't provide)
  - Yum package gettext-libs (can't provide)
  - Autotools Build
 - Library gobject
- Satisfied by:
  - Homebrew Bottles glib at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libgobject-2.0.dylib
- Providers:
  - Homebrew Bottles glib
  - AptGet package libglib2.0-0 (can't provide)
  - Yum package glib2 (can't provide)
  - Autotools Build
 - Library freetype (not applicable to this system)
 - Library fontconfig (not applicable to this system)
 - Library cairo
- Satisfied by:
  - Homebrew Bottles cairo at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libcairo.dylib
- Providers:
  - Homebrew Bottles cairo
  - AptGet package libcairo2 (can't provide)
  - Yum package cairo (can't provide)
  - Autotools Build
 - Library pango
- Satisfied by:
  - Homebrew Bottles pango at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libpango-1.0.dylib
- Providers:
  - Homebrew Bottles pango
  - AptGet package libpango1.0-0 (can't provide)
  - Yum package pango (can't provide)
  - Autotools Build
 - Library pangocairo
- Satisfied by:
  - Homebrew Bottles pango at
/Users/xxx/.julia/v0.3/Homebrew/deps/usr/lib/libpangocairo-1.0.dylib
- Providers:
  - Homebrew Bottles pango
  - AptGet package libpango1.0-0 (can't provide)
  - Yum package pango (can't provide)
  - Autotools Build
 - Library zlib (not applicable to this system)


On Saturday, June 13, 2015, Elliot Saba staticfl...@gmail.com
javascript:_e(%7B%7D,'cvml','staticfl...@gmail.com'); wrote:

 You need to say using BinDeps first; that will import the package.

 That is pretty strange; let's see what BinDeps has to say.
 -E

 On Sat, Jun 13, 2015 at 4:49 AM, K leo cnbiz...@gmail.com wrote:

 hi Elliot,

 Thanks for the detailed message.

 Strangely, when I did BinDeps.debug(Cairo), I got:
 ERROR: BinDeps not defined.

 Also strangely, when I did 'brew rm pango, I got:
 Error: No such keg: /usr/local/Cellar/pango

 What is wrong?





  1   2   >