Re: [julia-users] poor performance of threads

2016-03-03 Thread pevnak
Thanks a lot for the suggestions.
As I have mentioned, it was really a toy problem, but I am not getting a 
significant speedup on a bigger problem, where threads are nicely separated 
either and the problem is very CPU bound either. I would be very interested 
to know about tool that would point out to problems with cache and memory 
access.

Tomas



[julia-users] Re: Sessions in Escher

2016-03-03 Thread jock . lawrie
Hi Leonardo,

I'm not an Escher user, but I use SecureSessions.jl 
 when building web apps 
with plain HttpServer.jl.
If this is a little over the top then the source code should be helpful for 
implementing a simpler scheme.

Hope this helps,
Jock


On Friday, March 4, 2016 at 9:12:24 AM UTC+11, Leonardo wrote:
>
> Hello,
> user sessions are supported in Escher? (e.g. with some API to get unique 
> ID)
> and cookies are supported (or planned)?
>
> Many thanks in advance
>
> Leonardo
>
>
>

[julia-users] Re: malformed expr concerning a module

2016-03-03 Thread Julia Tylors
I think i forgot to add toplevel

esc(Expr(:toplevel, ex))

Thanks everyone

On Thursday, March 3, 2016 at 6:31:05 PM UTC-8, Julia Tylors wrote:
>
> Hi everyone;
>
> I am writing a macro which uses module:
>
> @f module X
>   x= 4
> end
>
> macro f(ex)
> isa(ex,Expr) && (ex.head == :module) || error("@f : syntax error")
> module_name = ex.args[2]
> module_blk = ex.args[3].args
> import_stmts =  quote
>   import CSS.Leech
> end
> insert!(module_blk,length(module_blk),import_stmts)
> esc(ex)
> end
>
> But it gives the error:
> ERROR: syntax: malformed expression
>
> What is wrong here?
>
> Thanks
>


[julia-users] Integer enums + some questions

2016-03-03 Thread Greg Plowman
I want to use enums as integers, especially for array indexing.
 
So I started to implement an IntEnum type, so I could do something like the 
following:
 
julia> @intenum Animal pig dog cat
 
julia> pig
pig=1
 
julia> dog
dog=2
 
julia> A = zeros(length(Animal))
3-element Array{Float64,1}:
0.0
0.0
0.0
 
julia> A[dog] = 10.5
10.5
 
julia> A
3-element Array{Float64,1}:
 0.0
10.5
 0.0
 
s = 0.0
for i in eachindex(Animal)
   s += A[i]
end
 
 
 
Then I realized my code was similar to the existing Enum type in Base with 
a few exceptions/additions:

   - abstract IntEnum is a subtype of Integer (this allows use with array 
   indexing)
   - default enumerations start at 1 rather 0 (so defaults work with array 
   indexing)
   - introduced length(), eachindex() functions
   - plus some other cosmetic changes (e.g. show() prints both label and 
   associated integer (pig=1) 

 
Q1. Are there any problems with my type inheriting from Integer? (actually, 
super(Int) 
== Signed)
 
 
Q2. I implemented my type and conversion to/from Integers as follows 
(simplified):
 
immutable $enum <: IntEnum
   i::Int
end
 
Base.convert{E<:IntEnum}(::Type{E}, x::Integer) = T(Int(x))
Base.convert{I<:Integer}(::Type{I}, x::IntEnum) = I(x.i) 
 
compared to Enum implementation (also simplified):
 
bitstype  32 $enum <: Enum
 
Base.convert(::Type{$enum}, x::Integer) = Intrinsics.box($enum, convert(
Int32, x))
Base.convert{T<:Integer}(::Type{T}, x::Enum) = convert(T, Intrinsics.box(
Int32, x))
 
a) Are bitstypes faster than immutable composite types? Are there other 
advantages/disadvantages?
 
b) What is the difference between boxing Intrinsics.Box and using 
reinterpret?
 
 
Q3. I can't help but feel this is a really stupid question, but here goes 
anyway ...
 
Compare these implementations of defining a function to return a constant / 
immutable
 
global const xxx = (a,b,c,d)
names1(::Type{Y}) = xxx

 
names2(::Type{Y}) = (a,b,c,d)

 
Is names2 as efficient as names1?, in the sense that it doesn't allocate a 
new tuple on each call?
If so, is this because a tuple is immutable?
So if it returned say an array instead, it would allocate a new array each 
call (even if that array was intended to be const)?



[julia-users] malformed expr concerning a module

2016-03-03 Thread Julia Tylors
Hi everyone;

I am writing a macro which uses module:

@f module X
  x= 4
end

macro f(ex)
isa(ex,Expr) && (ex.head == :module) || error("@f : syntax error")
module_name = ex.args[2]
module_blk = ex.args[3].args
import_stmts =  quote
  import CSS.Leech
end
insert!(module_blk,length(module_blk),import_stmts)
esc(ex)
end

But it gives the error:
ERROR: syntax: malformed expression

What is wrong here?

Thanks


Re: [julia-users] ERROR: LoadError: syntax: incomplete: premature end of input

2016-03-03 Thread Fei Ma
Many thanks for the reply. I re-checked my code. It seems like that I have 
left out a ")".



On Friday, 4 March 2016 02:37:58 UTC+11, Stefan Karpinski wrote:
>
> It means what entered in new.jl isn't a complete Julia expression. Perhaps 
> you're missing a closing `end` or something?
>
> On Thu, Mar 3, 2016 at 6:58 AM, Fei Ma > 
> wrote:
>
>> Hello. Here I have a problem. 
>>
>> I run a program, but stopped  it when it is running, and then the 
>> terminal output this :
>>
>> ERROR: LoadError: syntax: incomplete: premature end of input
>>  in include at ./boot.jl:261
>>  in include_from_node1 at ./loading.jl:304
>> while loading /home/i/Documents/Julia/new.jl, in expression starting on 
>> line 80
>>  
>> I don't know what  it means. Does anyone have such problems? 
>>
>
>

[julia-users] Re: PyPlot ArgumentError: haskey of NULL PyObject error

2016-03-03 Thread Steven G. Johnson
It sounds like "using PyPlot" probably threw an error that you ignored?

To make sure that Python and Matplotlib are properly installed, the easiest 
thing is to have PyCall install its own Miniconda Python distro:

 ENV["PYTHON"]=""
 Pkg.build("PyCall")

You only need to do this once, then re-launch Julia "using PyPlot" will 
install Matplotlib if needed.


[julia-users] Re: Plotting the Rosenbrock Function using PyPlot

2016-03-03 Thread Steven G. Johnson
This works, for example:

x, y = -1.5:0.1:1.5, -1.5:0.1:1.5
z = Float64[rosenbrock([x,y]) for x in x, y in y]

using PyPlot
pcolor(x,y,z)



[julia-users] Why does using Compose not work behind a firewall with packages in LOAD_PATH

2016-03-03 Thread Sheehan Olver

I'm trying to set up julia on lab computers, with the packages shared in a 
single directory, that is included in the default LOAD_PATH in Julia.  For 
some reason Compose tries to initialize a local METADATA.  This fails since 
git is not allowed.  Other packages work fine, including all of Compose's 
dependencies, see below.  

Any thoughts?  



*julia> **using Colors*

*INFO: Precompiling module Colors...*


*julia> **using JSON*

*INFO: Precompiling module JSON...*


*julia> **using Compat*


*julia> **using Measures*


*julia> **using DataStructures*

*INFO: Precompiling module DataStructures...*


*julia> **using Iterators*

*INFO: Precompiling module Iterators...*


*julia> **using Compose*

*INFO: Precompiling module Compose...*

*INFO: Initializing package repository /users/ugrad/m3976/.julia/v0.4*

*INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl*

fatal: unable to access 'https://github.com/JuliaLang/METADATA.jl/': 
gnutls_handshake() failed: An unexpected TLS packet was received.

*INFO: Initializing package repository /users/ugrad/m3976/.julia/v0.4*

*INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl*

fatal: unable to access 'https://github.com/JuliaLang/METADATA.jl/': 
gnutls_handshake() failed: An unexpected TLS packet was received.

*INFO: Recompiling stale cache file 
/users/ugrad/m3976/.julia/lib/v0.4/Compose.ji for module Compose.*

*INFO: Initializing package repository /users/ugrad/m3976/.julia/v0.4*

*INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl*

fatal: unable to access 'https://github.com/JuliaLang/METADATA.jl/': 
gnutls_handshake() failed: An unexpected TLS packet was received.

*INFO: Initializing package repository /users/ugrad/m3976/.julia/v0.4*

*INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl*

fatal: unable to access 'https://github.com/JuliaLang/METADATA.jl/': 
gnutls_handshake() failed: An unexpected TLS packet was received.

WARNING: Module Measures uuid did not match cache file

*ERROR: __precompile__(true) but require failed to create a precompiled 
cache file*

* in require at ./loading.jl:252*



Re: [julia-users] poor performance of threads

2016-03-03 Thread Tim Holy
Your "one" function is not type-stable (f::Int->f::Float64). From the 
allocation, two() must also be boxing something, but I'm not sure why. (This 
might be a julia bug.) In any event, because of all this allocation, it's not 
telling you anything about what the actual performance will be when it's 
working properly.

When you see that much allocation on a loop that shouldn't allocate, focus on 
eliminating it before worrying about anything else.

Best,
--Tim

On Thursday, March 03, 2016 03:39:31 PM Erik Schnetter wrote:
> Tomas
> 
> In your example, different threads access nearby elements in the array
> f. They are likely to be in the same cache line, leading to much
> unnecessary inter-CPU communication. This is also called "false
> sharing". Leaving a gap between the elements used by each thread might
> speed things up.
> 
> Your example is also memory-bound, not compute-bound. Most of the time
> will be spent accessing the elements of x, not performing a
> computation. On a two-socket machine, you can expect at most a speedup
> of two.
> 
> Finally, function one is quite simple, and there's a good chance it
> will be vectorized and/or unrolled. I'm less certain about function
> two. If so, you lose between a factor of two or sixteen.
> 
> Distributing work over threads has an overhead. It might be better to
> use an example that has a non-trivial amount of work per thread, e.g.
> sqrt(sqrt(sqrt(...(sqrt(x, with ten or hundred sqrt invokations.
> 
> -erik
> 
> On Thu, Mar 3, 2016 at 2:39 PM,   wrote:
> > Hi All,
> > I would like to ask if someone has an experience with Threads as they are
> > implemented at the moment in the master branch.
> > After the successful compilation  (put JULIA_THREADS=1 to Make.user)
> > I have played with different levels of granularity, but usually the code
> > was slower or more or less the same speed as single threaded version. I
> > have even tried a totally stupid execution like this
> > 
> > using Base.Threads;
> > function one()
> > 
> >   x=randn(100);
> >   f=0;
> >   for i in x
> >   
> > f+=i;
> >   
> >   end
> > 
> > end
> > 
> > function two()
> > 
> >   x=randn(100);
> >   f=zeros(nthreads())
> >   @inbounds @threads for i in 1:length(x)
> >   
> > f[threadid()]+=x[i];
> >   
> >   end
> >   sum(f)
> > 
> > end
> > 
> > one()
> > @time one()
> > 
> > two()
> > @time two()
> > 
> > and the times on my 2013 Macbook air were
> > 
> >   0.068617 seconds (2.00 M allocations: 38.157 MB, 9.72% gc time)
> >   0.394164 seconds (5.72 M allocations: 99.015 MB, 5.00% gc time)
> > 
> > Wov, that is quite poor. I would expect an overhead, but not big like
> > this.
> > 
> > Can anyone suggest, what is going wrong? I have been trying a profiler,
> > but
> > it does not help. It seems that it does not work with Threads at the
> > moment. Or, is it because Threads are still not really supported.
> > 
> > I would like to get speed-up showing in this video
> > https://www.youtube.com/watch?v=GvLhseZ4D8M
> > 
> > Any suggestions welcomed.
> > Tomas



[julia-users] subscribe() in Escher

2016-03-03 Thread Leonardo
Hi all,
I've some doubt about correct positioning of subscribe() in Escher.
I've slightly modified 'form' example (attached) to decouple subscribe() 
and map() call to handle events triggered.
Why my example not works as expected, printing all content of form when 
button is pressed?

Many thanks in advance

Leonardo



[julia-users] Re: subscribe() in Escher

2016-03-03 Thread Leonardo
Sorry, I've forgotten the attachment ...

Leonardo


Il giorno giovedì 3 marzo 2016 23:21:15 UTC+1, Leonardo ha scritto:
>
> Hi all,
> I've some doubt about correct positioning of subscribe() in Escher.
> I've slightly modified 'form' example (attached) to decouple subscribe() 
> and map() call to handle events triggered.
> Why my example not works as expected, printing all content of form when 
> button is pressed?
>
> Many thanks in advance
>
> Leonardo
>
>

my_form.jl
Description: Binary data


[julia-users] Sessions in Escher

2016-03-03 Thread Leonardo
Hello,
user sessions are supported in Escher? (e.g. with some API to get unique ID)
and cookies are supported (or planned)?

Many thanks in advance

Leonardo




Re: [julia-users] Replacing multiple characters in a string

2016-03-03 Thread Yunde Zhong
 Here is one solution:

str = "ACGT"
d = Dict("A"=>"T", "C"=> "G", "G"=>"C", "T"=>"A")
y = replace(str, r"[ACGT]{1}", x->d[x])  # "TGCA"

reverse() is on the top of that

On Thu, Mar 3, 2016 at 3:26 PM Carlos Guzman  wrote:

> I'm relatively new to programming. Started picking up Julia yesterday, and
> am having trouble with something I suspect is very simple to do. I've spent
> some time searching, but haven't been able to get this to work.
>
> I am essentially trying to answer this question here:
> http://rosalind.info/problems/revc/
>
> This isn't homework or related to school in anyway. I am simply trying to
> learn how to write small scripts for various tasks.
>
> I am trying to reverse my string s, and then replace the characters A C G
> T with T G C A. So every 'A' with a 'T' and so on. Here's what i've written
> so far, and after various attempts I don't know how to complete the
> function to get what I want.
>
> # creating complementary strand of DNA
> # reverse the string
> # find the complementary nucleotide
>
>
> s = readall("nt.txt")
>
>
> t = reverse((replace(s, r"[ACGT]", ))) # Not sure what goes here
>
>
> println("$t")
>
> All help is appreciated, and I apologize for the relatively simple
> question.
>


Re: [julia-users] Replacing multiple characters in a string

2016-03-03 Thread Erik Schnetter
Carlos

You are trying to use pattern matching, which is mostly used to find
patterns in strings. In your case, it seems the string consists
exclusively of these characters, and you want to replace all of them.
I would use `map` for this.

function dual(c::Char)
c=='A' && return 'T'
c=='C' && return 'G'
... etc ...
end

newstring = reverse(map(dual, string))

-erik



On Thu, Mar 3, 2016 at 11:41 AM, Carlos Guzman  wrote:
> I'm relatively new to programming. Started picking up Julia yesterday, and
> am having trouble with something I suspect is very simple to do. I've spent
> some time searching, but haven't been able to get this to work.
>
> I am essentially trying to answer this question here:
> http://rosalind.info/problems/revc/
>
> This isn't homework or related to school in anyway. I am simply trying to
> learn how to write small scripts for various tasks.
>
> I am trying to reverse my string s, and then replace the characters A C G T
> with T G C A. So every 'A' with a 'T' and so on. Here's what i've written so
> far, and after various attempts I don't know how to complete the function to
> get what I want.
>
> # creating complementary strand of DNA
> # reverse the string
> # find the complementary nucleotide
>
>
> s = readall("nt.txt")
>
>
> t = reverse((replace(s, r"[ACGT]", ))) # Not sure what goes here
>
>
> println("$t")
>
> All help is appreciated, and I apologize for the relatively simple question.



-- 
Erik Schnetter 
http://www.perimeterinstitute.ca/personal/eschnetter/


[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread Rohit Thankachan

In case you work with an IJulia notebook or Escher, you can use ThreeJS.jl 
. If you use Escher, you can 
also create UI's to control the variables and get the plots to update 
interactively. Please see the examples for more details. There isn't 
support for labels or axes currently though.

Regards,
Rohit

On Thursday, 3 March 2016 09:40:52 UTC+5:30, mauri...@gmail.com wrote:
>
> Hello Julia users, 
>
> I would like to know if anyone knows how we can have 3D scatter plots or 
> meshed surfaces color plots using Julia.  
>
> My problem is based on four variables, so I'm trying to visualize the data 
> according to these options. 
>
> Any idea or example code will be really helpful. 
>
> Thanks!
>


[julia-users] ZMQ poll

2016-03-03 Thread Leonardo
Hello,
if anyone can help me:
poll() API exists into ZeroMQ port in Julia?
If so, how to call it?

Many thanks in advance

Leonardo



[julia-users] Re: Plotting the Rosenbrock Function using PyPlot

2016-03-03 Thread Patrick Kofod Mogensen
If you're willing to use Plots, here's the syntax (might be very close to 
Pyplot, not sure). It uses the pyplot backend

using Plots

function rosenbrock(x::Vector)
  return (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
end

default(size=(600,600), fc=:heat)
x, y = -1.5:0.1:1.5, -1.5:0.1:1.5
z = Surface((x,y)->rosenbrock([x,y]), x, y)
surface(x,y,z, linealpha = 0.3)

On Thursday, March 3, 2016 at 10:13:52 PM UTC+1, Ayush Pandey wrote:
>
> Hi,
>
> I have defined Rosenbrock function as 
>
> *function rosenbrock(x::Vector)*
> *  return (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2*
> *end*
>
> *m = rand(51,2)*
>
> I want to check the unimodality of the function by plotting(surface as 
> well as contour) over the points given by rows of matrix m. Can anyone help 
> how this can be achieved using PyPlot?
>
>
>
>
>
> *Yours Sincerely,*
> *Ayush Pandey* * *
> *LinkedIn Profile *
> *GitHub *
>


[julia-users] Replacing multiple characters in a string

2016-03-03 Thread Carlos Guzman
I'm relatively new to programming. Started picking up Julia yesterday, and 
am having trouble with something I suspect is very simple to do. I've spent 
some time searching, but haven't been able to get this to work.

I am essentially trying to answer this question 
here: http://rosalind.info/problems/revc/

This isn't homework or related to school in anyway. I am simply trying to 
learn how to write small scripts for various tasks.

I am trying to reverse my string s, and then replace the characters A C G T 
with T G C A. So every 'A' with a 'T' and so on. Here's what i've written 
so far, and after various attempts I don't know how to complete the 
function to get what I want.

# creating complementary strand of DNA
# reverse the string
# find the complementary nucleotide


s = readall("nt.txt")


t = reverse((replace(s, r"[ACGT]", ))) # Not sure what goes here


println("$t")

All help is appreciated, and I apologize for the relatively simple question.


[julia-users] Plotting the Rosenbrock Function using PyPlot

2016-03-03 Thread Ayush Pandey
Hi,

I have defined Rosenbrock function as

*function rosenbrock(x::Vector)*
*  return (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2*
*end*

*m = rand(51,2)*

I want to check the unimodality of the function by plotting(surface as well
as contour) over the points given by rows of matrix m. Can anyone help how
this can be achieved using PyPlot?





*Yours Sincerely,*
*Ayush Pandey* * *
*LinkedIn Profile *
*GitHub *


[julia-users] Re: PyPlot ArgumentError: haskey of NULL PyObject error

2016-03-03 Thread cdm

this also works on JuliaBox, https://www.juliabox.org/, although with the 
0.4 and 0.5 kernels,

users will need to add the PyPlot package themselves ...



result:



In [9]:

scatter(x, y, s=area, alpha=0.5)

Out[9]:

PyObject 



Re: [julia-users] poor performance of threads

2016-03-03 Thread Erik Schnetter
Tomas

In your example, different threads access nearby elements in the array
f. They are likely to be in the same cache line, leading to much
unnecessary inter-CPU communication. This is also called "false
sharing". Leaving a gap between the elements used by each thread might
speed things up.

Your example is also memory-bound, not compute-bound. Most of the time
will be spent accessing the elements of x, not performing a
computation. On a two-socket machine, you can expect at most a speedup
of two.

Finally, function one is quite simple, and there's a good chance it
will be vectorized and/or unrolled. I'm less certain about function
two. If so, you lose between a factor of two or sixteen.

Distributing work over threads has an overhead. It might be better to
use an example that has a non-trivial amount of work per thread, e.g.
sqrt(sqrt(sqrt(...(sqrt(x, with ten or hundred sqrt invokations.

-erik


On Thu, Mar 3, 2016 at 2:39 PM,   wrote:
> Hi All,
> I would like to ask if someone has an experience with Threads as they are
> implemented at the moment in the master branch.
> After the successful compilation  (put JULIA_THREADS=1 to Make.user)
> I have played with different levels of granularity, but usually the code was
> slower or more or less the same speed as single threaded version. I have
> even tried a totally stupid execution like this
>
> using Base.Threads;
> function one()
>   x=randn(100);
>   f=0;
>   for i in x
> f+=i;
>   end
> end
>
> function two()
>   x=randn(100);
>   f=zeros(nthreads())
>   @inbounds @threads for i in 1:length(x)
> f[threadid()]+=x[i];
>   end
>   sum(f)
> end
>
> one()
> @time one()
>
> two()
> @time two()
>
> and the times on my 2013 Macbook air were
>
>   0.068617 seconds (2.00 M allocations: 38.157 MB, 9.72% gc time)
>   0.394164 seconds (5.72 M allocations: 99.015 MB, 5.00% gc time)
>
> Wov, that is quite poor. I would expect an overhead, but not big like this.
>
> Can anyone suggest, what is going wrong? I have been trying a profiler, but
> it does not help. It seems that it does not work with Threads at the moment.
> Or, is it because Threads are still not really supported.
>
> I would like to get speed-up showing in this video
> https://www.youtube.com/watch?v=GvLhseZ4D8M
>
> Any suggestions welcomed.
> Tomas



-- 
Erik Schnetter 
http://www.perimeterinstitute.ca/personal/eschnetter/


[julia-users] My module MathToolkit (PSLQ algorithm, recurrence detection, etc.)

2016-03-03 Thread Thomas Baruchel
Hi,

I changed my mind, deleted the previous repository and created a more 
general package where I want to keep the functions I generally write when 
using some mathematical software (I wrote the same recvec function in Sympy 
and Maxima; I also wrote a PSLQ version for Maxima).

Right now, I have two functions which are the two I use the most.

Do you think I could submit this package? See: 
https://github.com/baruchel/MathToolkit.jl

Regards, tb.


[julia-users] poor performance of threads

2016-03-03 Thread pevnak
Hi All,
I would like to ask if someone has an experience with Threads as they are 
implemented at the moment in the master branch.
After the successful compilation  (put JULIA_THREADS=1 to Make.user)
I have played with different levels of granularity, but usually the code 
was slower or more or less the same speed as single threaded version. I 
have even tried a totally stupid execution like this

using Base.Threads;
function one()
  x=randn(100);
  f=0;
  for i in x
f+=i;
  end
end

function two()
  x=randn(100);
  f=zeros(nthreads())
  @inbounds @threads for i in 1:length(x)
f[threadid()]+=x[i];
  end
  sum(f)
end

one()
@time one()

two()
@time two()

and the times on my 2013 Macbook air were

  0.068617 seconds (2.00 M allocations: 38.157 MB, 9.72% gc time)
  0.394164 seconds (5.72 M allocations: 99.015 MB, 5.00% gc time)

Wov, that is quite poor. I would expect an overhead, but not big like this.

Can anyone suggest, what is going wrong? I have been trying a profiler, but 
it does not help. It seems that it does not work with Threads at the 
moment. Or, is it because Threads are still not really supported.

I would like to get speed-up showing in this video
https://www.youtube.com/watch?v=GvLhseZ4D8M

Any suggestions welcomed.
Tomas


Re: [julia-users] Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Tim Holy
Thanks for the update.

On Thursday, March 03, 2016 10:52:26 AM Matthew Pearce wrote:
> To get it straight if A is a matrix in main memory, the corresponding GPU
> memory object is d_A = CudaArray(A) then:
> 
> A[i, j] = d_A[ j * nrows + i]

Yes, that should be right. Please do feel free to edit the README if it's 
unclear (it's often very hard for the code author to spot what's unclear!)

https://github.com/JuliaGPU/CUDArt.jl/blob/master/README.md, click pencil 
icon.

Best,
--Tim



Re: [julia-users] Re: Set Environment Variable to a Number?

2016-03-03 Thread Chris Rackauckas
That makes sense given what I'm seeing since OMP_NUM_THREADS and other 
environmental variables work. I guess this isn't the issue then (still 
don't know why the Phi won't read the environmental variable, instead I 
have to pass it... but that's a whole separate issue). Thanks

On Thursday, March 3, 2016 at 10:54:48 AM UTC-8, Yichao Yu wrote:
>
> On Thu, Mar 3, 2016 at 1:36 PM, Chris Rackauckas  > wrote: 
> > Oh, meant the line with the mic environment variable: 
> > 
> >   printf("%s\n",getenv("MIC_OMP_NUM_THREADS")); 
> > 
> > It's clear from context though. Sorry for the mistake. 
>
> Env's are strings and you can't store a number in it. Especially not 
> by letting `printf` interpret a char* as a number. 
>
> > 
> > 
> > On Thursday, March 3, 2016 at 10:35:42 AM UTC-8, Chris Rackauckas wrote: 
> >> 
> >> Hey, 
> >>   I found a solution for strings here, but I really need it to be a 
> >> number. If I do 
> >> 
> >> ENV["MIC_OMP_NUM_THREADS"]=240 
> >> 
> >>   Then call a C function, I get 
> >> 
> >> printf("%s\n",getenv("OMP_NUM_THREADS")); 
> >> 
> >>   as 240 whereas 
> >> 
> >> printf("%d\n",getenv("OMP_NUM_THREADS")); 
> >> 
> >>   is garbage. Anyone know how to set it as an integer? Thanks. (P.S. 
> Yes, 
> >> this is Julia interfacing with a Xeon Phi. More on this soon!) 
>


Re: [julia-users] Re: Set Environment Variable to a Number?

2016-03-03 Thread Yichao Yu
On Thu, Mar 3, 2016 at 1:36 PM, Chris Rackauckas  wrote:
> Oh, meant the line with the mic environment variable:
>
>   printf("%s\n",getenv("MIC_OMP_NUM_THREADS"));
>
> It's clear from context though. Sorry for the mistake.

Env's are strings and you can't store a number in it. Especially not
by letting `printf` interpret a char* as a number.

>
>
> On Thursday, March 3, 2016 at 10:35:42 AM UTC-8, Chris Rackauckas wrote:
>>
>> Hey,
>>   I found a solution for strings here, but I really need it to be a
>> number. If I do
>>
>> ENV["MIC_OMP_NUM_THREADS"]=240
>>
>>   Then call a C function, I get
>>
>> printf("%s\n",getenv("OMP_NUM_THREADS"));
>>
>>   as 240 whereas
>>
>> printf("%d\n",getenv("OMP_NUM_THREADS"));
>>
>>   is garbage. Anyone know how to set it as an integer? Thanks. (P.S. Yes,
>> this is Julia interfacing with a Xeon Phi. More on this soon!)


Re: [julia-users] Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Matthew Pearce
Thanks again.

Think the problem may have been with my kernel and getting confused about 
the row major and column major ordering of the layout of the array. 
I thought I'd checked it was producing the correct norms yesterday, but I 
must have changed something...

To get it straight if A is a matrix in main memory, the corresponding GPU 
memory object is d_A = CudaArray(A) then:

A[i, j] = d_A[ j * nrows + i]

Is that right? I guess I got confused by the discussion of transposition in 
the CUDArt docs.

Matthew


[julia-users] Re: Set Environment Variable to a Number?

2016-03-03 Thread Chris Rackauckas
Oh, meant the line with the mic environment variable:

  printf("%s\n",getenv("MIC_OMP_NUM_THREADS"));

It's clear from context though. Sorry for the mistake.

On Thursday, March 3, 2016 at 10:35:42 AM UTC-8, Chris Rackauckas wrote:
>
> Hey,
>   I found a solution for strings here 
> , but I 
> really need it to be a number. If I do
>
> ENV["MIC_OMP_NUM_THREADS"]=240
>
>   Then call a C function, I get
>
> printf("%s\n",getenv("OMP_NUM_THREADS"));
>
>   as 240 whereas
>
> printf("%d\n",getenv("OMP_NUM_THREADS"));
>
>   is garbage. Anyone know how to set it as an integer? Thanks. (P.S. Yes, 
> this is Julia interfacing with a Xeon Phi. More on this soon!)
>


[julia-users] Set Environment Variable to a Number?

2016-03-03 Thread Chris Rackauckas
Hey,
  I found a solution for strings here 
, but I 
really need it to be a number. If I do

ENV["MIC_OMP_NUM_THREADS"]=240

  Then call a C function, I get

printf("%s\n",getenv("OMP_NUM_THREADS"));

  as 240 whereas

printf("%d\n",getenv("OMP_NUM_THREADS"));

  is garbage. Anyone know how to set it as an integer? Thanks. (P.S. Yes, 
this is Julia interfacing with a Xeon Phi. More on this soon!)


Re: [julia-users] Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Tim Holy
Oh, drat, I misread it as if you were trying to create an n-dimensional array 
of size one in each dimension. I forgot you could move a CPU-array to the host 
with a construct like that. Sorry about that.

More efficient, however, is to use fill or fill! for such things, since there 
is 
no memory movement involved (it is _only_ created on the GPU).

Regarding the rest, I'm not sure. If you figure it out, adding a note to the 
README seems like it could be helpful. Multi-process is still a bit 
challenging sometimes, though package precompilation has made it a lot more 
pleasant than it used to be!

Best,
--Tim

On Thursday, March 03, 2016 07:27:27 AM Matthew Pearce wrote:
> Thanks Tim.
> 
> For me `elty=Float32' so if I use `CudaArray(elty, ones(10))' or `CudaArray(
> elty, ones(10)...)' I get a conversion error. [I am running Julia
> 0.5.0-dev+749]
> The result of my CudaArray creation above looks like:
> 
> julia> to_host(CudaArray(map(elty, ones(10'
> 1x10 Array{Float32,2}:
>  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
> 
> I tried putting a `device_synchronize()' call in the `p2' block above like
> so, which was probably needed anyway, but doesn't fix the error:
> 
> julia> p2 = quote
>elty = eltype(d_M)
>n1, n2 = size(d_M)
>d_dots = CudaArray(map(elty, ones(n1)))
>dev = device(d_dots)
>dotf = cudakernels.ptxdict[(dev, "sqrownorms", elty)]
>numblox = Int(ceil(n1/cudakernels.maxBlock))
>CUDArt.launch(dotf, numblox, cudakernels.maxBlock, (d_M, n1, n2,
> d_dots))
>device_synchronize()
>dots = to_host(d_dots)
>free(d_dots)
>dots
>end
> 
> julia> sow(reps[3], :d_M, :(residual_shared(Y,A_init,S_init,1,sig)))
> RemoteRef{Channel{Any}}(51,1,40341)
> 
> julia> reap(reps[3], :(string(d_M)))
> Dict{Int64,Any} with 1 entry:
>   51 => "CUDArt.CudaArray{Float32,2}(CUDArt.CudaPtr{Float32}(Ptr{Float32}
> @0x000b041e),(4000,2500),0)"
> 
> julia> reap(reps[3], p2)
> ERROR: On worker 51:
> "an illegal memory access was encountered"
>  [inlined code] from essentials.jl:111
>  in checkerror at /home/mcp50/.julia/v0.5/CUDArt/src/libcudart-6.5.jl:16
>  [inlined code] from /home/mcp50/.julia/v0.5/CUDArt/src/../gen-6.5/
> gen_libcudart.jl:16
>  in device_synchronize at /home/mcp50/.julia/v0.5/CUDArt/src/device.jl:28
>  in anonymous at multi.jl:892
>  in run_work_thunk at multi.jl:645
>  [inlined code] from multi.jl:892
>  in anonymous at task.jl:59
>  in remotecall_fetch at multi.jl:731
>  [inlined code] from multi.jl:368
>  in remotecall_fetch at multi.jl:734
>  in anonymous at task.jl:443
>  in sync_end at ./task.jl:409
>  [inlined code] from task.jl:418
>  in reap at /home/mcp50/.julia/v0.5/ClusterUtils/src/ClusterUtils.jl:203
> 
> One thing I have noted is that a remote process crashes if I ever attempt
> to move a `CudaArray' type/pointer from it to the host.
> That shouldn't be happening in the above, but I wonder if, inadevertently
> something similar is happening.
> 
> If I try calling the kernel on another process on the same machine, I don't
> get the error:
> 
> julia> sow(62, :d_M, :(residual_shared($Y_init,$A_init,$S_init,1,$sig)))
> RemoteRef{Channel{Any}}(62,1,40936)
> 
> julia> sum(reap(62, p2)[62])
> 5.149127f6
> 
> Hmm...



[julia-users] Current status of in-place ops

2016-03-03 Thread Lutfullah Tomak
Hi Marcin,

Here is an effort under Julia to conclude a final aproach based on actual user 
code.

https://groups.google.com/forum/m/#!topic/julia-users/_LduslpljpE

If you like you can contribute too.

[julia-users] Current status of in-place ops

2016-03-03 Thread Marcin Elantkowski
Hello, 
One of the biggest downsides of Julia is its lack of support for in-place 
operations.
E.g. in numpy I can write

import numpy.random as nr
A = nr.randn(1, 1)
B = nr.randn(3000, 3000)

A[0:3000, 0:3000] += B

whereas in Julia to achieve the same speed and memory usage I need to write 
cumbersome 

broadcast!(+, sub(A, 1:3000, 1:3000), B);

>From view threads on Github it is not clear whether Julia devs are 
interested in changing that. 

So, I just wanted to ask if this is likely to change in the future or maybe 
there is some way of doing in-place ops that I'm not aware of?


Re: [julia-users] Interested in GSoC idea "Random number generation"

2016-03-03 Thread Upekshe Jayasekera
Yup, Seems good :)


[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread J Luis
Ok, thanks.

Joaquim

quinta-feira, 3 de Março de 2016 às 16:45:20 UTC, Josef Heinen escreveu:
>
> The build problem is fixed (in the master branch).
> peaks() is part of GR - also in the master branch.
>
> The next GR.jl release will be released this weekend.
>
> On Thursday, March 3, 2016 at 5:28:29 PM UTC+1, J Luis wrote:
>>
>> Hmm, is 'peaks' part of GR? Because
>>
>> julia> using GR
>>
>> julia> z = peaks();
>> ERROR: UndefVarError: peaks not defined
>>
>>

[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread Josef Heinen
The build problem is fixed (in the master branch).
peaks() is part of GR - also in the master branch.

The next GR.jl release will be released this weekend.

On Thursday, March 3, 2016 at 5:28:29 PM UTC+1, J Luis wrote:
>
> Hmm, is 'peaks' part of GR? Because
>
> julia> using GR
>
> julia> z = peaks();
> ERROR: UndefVarError: peaks not defined
>
>

[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread J Luis
Hmm, is 'peaks' part of GR? Because

julia> using GR

julia> z = peaks();
ERROR: UndefVarError: peaks not defined



quinta-feira, 3 de Março de 2016 às 16:24:07 UTC, Josef Heinen escreveu:
>
> I could re-produce the problem on a fresh Windows installation.
> Removing the downloaded archive leads to a chmod error, although I don't 
> use this function in build.jl.
> Will have to use another method to delete the file.
>
> Nevertheless, the package should be installed 
>
> On Thursday, March 3, 2016 at 3:13:33 PM UTC+1, J Luis wrote:
>>
>> But unfortunately on Windows
>>
>> INFO: Downloading pre-compiled GR 0.17.3 binary
>> =[ ERROR: GR 
>> ]==
>>
>> LoadError: chmod: no such file or directory (ENOENT)
>> while loading C:\j\.julia\v0.4\GR\deps\build.jl, in expression starting 
>> on line 25
>>
>>

[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread J Luis
Oops, don't know what happened to the message asking me what version was 
it, and my reply to it (both disappeared), but here it goes again. 
It eas trying to install v0.0.17

julia> Pkg.add("GR")
INFO: Cloning cache of GR from git://github.com/jheinen/GR.jl.git
INFO: Installing GR v0.9.17
INFO: Building GR
INFO: Downloading pre-compiled GR 0.17.3 binary
=[ ERROR: GR 
]==

LoadError: chmod: no such file or directory (ENOENT)
while loading C:\j\.julia\v0.4\GR\deps\build.jl, in expression starting on 
line 25



quinta-feira, 3 de Março de 2016 às 14:13:33 UTC, J Luis escreveu:
>
> But unfortunately on Windows
>
> INFO: Downloading pre-compiled GR 0.17.3 binary
> =[ ERROR: GR 
> ]==
>
> LoadError: chmod: no such file or directory (ENOENT)
> while loading C:\j\.julia\v0.4\GR\deps\build.jl, in expression starting 
> on line 25
>
>
>
> quinta-feira, 3 de Março de 2016 às 08:26:20 UTC, Josef Heinen escreveu:
>>
>> *Pkg.add("GR")*
>>
>> *using GR*
>> *z = peaks()*
>> *surface(z)*
>>
>>
>> 
>>
>>
>>
>> On Thursday, March 3, 2016 at 5:10:52 AM UTC+1, mauri...@gmail.com wrote:
>>>
>>> Hello Julia users, 
>>>
>>> I would like to know if anyone knows how we can have 3D scatter plots or 
>>> meshed surfaces color plots using Julia.  
>>>
>>> My problem is based on four variables, so I'm trying to visualize the 
>>> data according to these options. 
>>>
>>> Any idea or example code will be really helpful. 
>>>
>>> Thanks!
>>>
>>

[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread Josef Heinen
I could re-produce the problem on a fresh Windows installation.
Removing the downloaded archive leads to a chmod error, although I don't 
use this function in build.jl.
Will have to use another method to delete the file.

Nevertheless, the package should be installed 

On Thursday, March 3, 2016 at 3:13:33 PM UTC+1, J Luis wrote:
>
> But unfortunately on Windows
>
> INFO: Downloading pre-compiled GR 0.17.3 binary
> =[ ERROR: GR 
> ]==
>
> LoadError: chmod: no such file or directory (ENOENT)
> while loading C:\j\.julia\v0.4\GR\deps\build.jl, in expression starting 
> on line 25
>
>

[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread Josef Heinen
Which version are you using?

=> *Pkg.installed("GR")*


On Thursday, March 3, 2016 at 3:13:33 PM UTC+1, J Luis wrote:
>
> But unfortunately on Windows
>
> INFO: Downloading pre-compiled GR 0.17.3 binary
> =[ ERROR: GR 
> ]==
>
> LoadError: chmod: no such file or directory (ENOENT)
> while loading C:\j\.julia\v0.4\GR\deps\build.jl, in expression starting 
> on line 25
>
>
>
> quinta-feira, 3 de Março de 2016 às 08:26:20 UTC, Josef Heinen escreveu:
>>
>> *Pkg.add("GR")*
>>
>> *using GR*
>> *z = peaks()*
>> *surface(z)*
>>
>>
>> 
>>
>>
>>
>> On Thursday, March 3, 2016 at 5:10:52 AM UTC+1, mauri...@gmail.com wrote:
>>>
>>> Hello Julia users, 
>>>
>>> I would like to know if anyone knows how we can have 3D scatter plots or 
>>> meshed surfaces color plots using Julia.  
>>>
>>> My problem is based on four variables, so I'm trying to visualize the 
>>> data according to these options. 
>>>
>>> Any idea or example code will be really helpful. 
>>>
>>> Thanks!
>>>
>>

Re: [julia-users] Acessing raw binary data

2016-03-03 Thread Stefan Karpinski
Could you use BitVectors? They store boolean vectors using one bit per
boolean.

On Thu, Mar 3, 2016 at 8:29 AM, Christina Lee 
wrote:

>
>
> I'm interested in looking at how to perform exact diagonalization of
> various quantum states in Julia.
>
> This problem is often memory limited, but the states can often be
> represented by strings of 0 and 1 (binary format).  Not only that, but
> various binary operations, and converting to other bases come in handy for
> solving the problem.
>
> I can just work with array's of Int8, but binary would give a great boost
> if possible,
>


Re: [julia-users] ERROR: LoadError: syntax: incomplete: premature end of input

2016-03-03 Thread Stefan Karpinski
It means what entered in new.jl isn't a complete Julia expression. Perhaps
you're missing a closing `end` or something?

On Thu, Mar 3, 2016 at 6:58 AM, Fei Ma  wrote:

> Hello. Here I have a problem.
>
> I run a program, but stopped  it when it is running, and then the terminal
> output this :
>
> ERROR: LoadError: syntax: incomplete: premature end of input
>  in include at ./boot.jl:261
>  in include_from_node1 at ./loading.jl:304
> while loading /home/i/Documents/Julia/new.jl, in expression starting on
> line 80
>
> I don't know what  it means. Does anyone have such problems?
>


[julia-users] Re: Creating docstrings using code generation

2016-03-03 Thread Michael Hatherly
The `eval` is going to do some really odd things there. If you're on a very 
recent 0.5 build you should probably see the following output after doing 
that

```
julia> for name in (:year, :month, :day, :hour, :minute, :second, 
:millisecond)

   func = eval(name)
   @doc """

   $name(dt::TimeType) -> Int64

   Return the $name of a `Date` or `DateTime` as an `Int64`.
   """ -> func(dt::TimeType)
   end
WARNING: replacing docs for 'func :: Tuple{Base.Dates.TimeType}'.
WARNING: replacing docs for 'func :: Tuple{Base.Dates.TimeType}'.
WARNING: replacing docs for 'func :: Tuple{Base.Dates.TimeType}'.
WARNING: replacing docs for 'func :: Tuple{Base.Dates.TimeType}'.
WARNING: replacing docs for 'func :: Tuple{Base.Dates.TimeType}'.
WARNING: replacing docs for 'func :: Tuple{Base.Dates.TimeType}'.
```

where only the last doc, `millisecond`, is stored. What's *really* being 
stored is a doc for `func`:

```julia
julia> keys(Docs.meta(Main))
Any[func]
```

since in the loop you're redefining a global named `func` on each iteration 
and then attaching a doc to that.

Best to avoid `eval` as much as possible and use the double `$` trick for 
this kind of thing.

-- Mike

On Thursday, 3 March 2016 17:17:31 UTC+2, Curtis Vogt wrote:
>
> Thanks Mike, I also managed to come up with an alternative solution:
>
> using Base.Dates
> for name in (:year, :month, :day, :hour, :minute, :second, :millisecond)
> func = eval(name)
> @doc """
> $name(dt::TimeType) -> Int64
>
> Return the $name of a `Date` or `DateTime` as an `Int64`.
> """ -> func(dt::TimeType)
> end
>
> Not sure which I like better yet.
>
> On Thursday, March 3, 2016 at 9:05:36 AM UTC-6, Michael Hatherly wrote:
>>
>> Just needs extra `$`s in the docstring, one for expression interpolation 
>> and one for string interpolation:
>>
>> julia> for name in (:year, :month, :day, :hour, :minute, :second, :
>> millisecond)
>>@eval begin
>>@doc """
>>$($name)(dt::TimeType) -> Int64
>>
>>Return the $($name) of a `Date` or `DateTime` as an 
>> `Int64`.
>>""" ->
>>$name(dt::TimeType)
>>end
>>end
>>
>> (`name` will be displayed fully qualified, i.e. `Base.Dates.year`, so you 
>> could convert `name` it to a string to avoid that.)
>>
>> -- Mike
>>
>> On Thursday, 3 March 2016 16:44:38 UTC+2, Curtis Vogt wrote:
>>>
>>> I was hoping to generate several redundant docstrings using code 
>>> generation. Unfortunately I have run into an issue where $name isn't 
>>> being replaced in the docstring:
>>>
>>> julia> using Base.Dates
>>>
>>> julia> for name in (:year, :month, :day, :hour, :minute, :second, :
>>> millisecond)
>>>@eval begin
>>>@doc """
>>>$name(dt::TimeType) -> Int64
>>>
>>>Return the $name of a `Date` or `DateTime` as an `Int64`.
>>>""" ->
>>>$name(dt::TimeType)
>>>end
>>>end
>>> ERROR: UndefVarError: name not defined
>>>  in eval(::Module, ::Any) at ./boot.jl:267
>>>  [inlined code] from ./boot.jl:266
>>>  in anonymous at ./no file:4294967295
>>>  in eval(::Module, ::Any) at ./boot.jl:267
>>>
>>>
>>>
>>> Is there a way I can get this to work?
>>>
>>

Re: [julia-users] Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Matthew Pearce
Thanks Tim. 

For me `elty=Float32' so if I use `CudaArray(elty, ones(10))' or `CudaArray(
elty, ones(10)...)' I get a conversion error. [I am running Julia 
0.5.0-dev+749]
The result of my CudaArray creation above looks like:

julia> to_host(CudaArray(map(elty, ones(10'
1x10 Array{Float32,2}:
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0

I tried putting a `device_synchronize()' call in the `p2' block above like 
so, which was probably needed anyway, but doesn't fix the error:

julia> p2 = quote 
   elty = eltype(d_M)
   n1, n2 = size(d_M)
   d_dots = CudaArray(map(elty, ones(n1)))
   dev = device(d_dots)
   dotf = cudakernels.ptxdict[(dev, "sqrownorms", elty)]
   numblox = Int(ceil(n1/cudakernels.maxBlock))
   CUDArt.launch(dotf, numblox, cudakernels.maxBlock, (d_M, n1, n2, 
d_dots))
   device_synchronize()
   dots = to_host(d_dots)
   free(d_dots)
   dots
   end

julia> sow(reps[3], :d_M, :(residual_shared(Y,A_init,S_init,1,sig)))
RemoteRef{Channel{Any}}(51,1,40341)

julia> reap(reps[3], :(string(d_M)))
Dict{Int64,Any} with 1 entry:
  51 => "CUDArt.CudaArray{Float32,2}(CUDArt.CudaPtr{Float32}(Ptr{Float32} 
@0x000b041e),(4000,2500),0)"

julia> reap(reps[3], p2)
ERROR: On worker 51:
"an illegal memory access was encountered"
 [inlined code] from essentials.jl:111
 in checkerror at /home/mcp50/.julia/v0.5/CUDArt/src/libcudart-6.5.jl:16
 [inlined code] from /home/mcp50/.julia/v0.5/CUDArt/src/../gen-6.5/
gen_libcudart.jl:16
 in device_synchronize at /home/mcp50/.julia/v0.5/CUDArt/src/device.jl:28
 in anonymous at multi.jl:892
 in run_work_thunk at multi.jl:645
 [inlined code] from multi.jl:892
 in anonymous at task.jl:59
 in remotecall_fetch at multi.jl:731
 [inlined code] from multi.jl:368
 in remotecall_fetch at multi.jl:734
 in anonymous at task.jl:443
 in sync_end at ./task.jl:409
 [inlined code] from task.jl:418
 in reap at /home/mcp50/.julia/v0.5/ClusterUtils/src/ClusterUtils.jl:203

One thing I have noted is that a remote process crashes if I ever attempt 
to move a `CudaArray' type/pointer from it to the host. 
That shouldn't be happening in the above, but I wonder if, inadevertently 
something similar is happening.

If I try calling the kernel on another process on the same machine, I don't 
get the error:

julia> sow(62, :d_M, :(residual_shared($Y_init,$A_init,$S_init,1,$sig)))
RemoteRef{Channel{Any}}(62,1,40936)

julia> sum(reap(62, p2)[62])
5.149127f6

Hmm...






[julia-users] ERROR: LoadError: syntax: incomplete: premature end of input

2016-03-03 Thread Fei Ma
Hello. Here I have a problem. 

I run a program, but stopped  it when it is running, and then the terminal 
output this :

ERROR: LoadError: syntax: incomplete: premature end of input
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
while loading /home/i/Documents/Julia/new.jl, in expression starting on 
line 80
 
I don't know what  it means. Does anyone have such problems? 


[julia-users] Acessing raw binary data

2016-03-03 Thread Christina Lee


I'm interested in looking at how to perform exact diagonalization of 
various quantum states in Julia.

This problem is often memory limited, but the states can often be 
represented by strings of 0 and 1 (binary format).  Not only that, but 
various binary operations, and converting to other bases come in handy for 
solving the problem.  

I can just work with array's of Int8, but binary would give a great boost 
if possible,


Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Chris Wade

also gcc version is
4.8.3 20140911 (red hat 4.8.3-9)

On 03/03/2016 14:07, Stefan Karpinski wrote:
What is the content of /etc/issue – i.e. what is the Linux distro and 
what is the output of `gcc --version`?


On Thu, Mar 3, 2016 at 8:52 AM, Chris Wade 
mailto:chris.w...@thecitysecret.com>> 
wrote:


the linux version is
4.1.13-19.31.amzn1.x86_64 GNU/Linux


On 03/03/2016 13:42, Stefan Karpinski wrote:

I was wondering about the Linux version, not what AMI. If it's an
older version of CentOS, for example, it may have a version of
GCC that's too old.

On Thu, Mar 3, 2016 at 4:08 AM, Chris
mailto:chris.w...@thecitysecret.com>> wrote:

Linuz VM is running: Amazon Linux AMI ElasticBeanstalk
4.1.13-19.31.amzn1.x86_64 GNU/Linux

On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan
Karpinski wrote:

What version of Linux is the VM running?

On Wed, Mar 2, 2016 at 12:06 PM, Chris
mailto:chris...@thecitysecret.com>> wrote:

Im trying to install julia on amazon linux instance.

i ran:

sudo yum -y install clang m4 patch ncurses-devel
python-devel
git clone https://github.com/JuliaLang/julia.git
cd julia
git checkout v0.4.3
make

that failed on fortran
so i ran:

sudo yum -y install gcc-gfortran

then ran 'make'
but get this error

/usr/bin/ld:
/usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o):
relocation R_X86_64_32 against `.rodata.str1.1' can
not be used when making a shared object; recompile
with -fPIC
/usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a:
could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libopenspecfun.so] Error 1
make[1]: *** [openspecfun/libopenspecfun.so] Error 2
make: *** [julia-deps] Error 2

it seems to be something to do with fortran, but i
cannot understand what i need to do?
I also tried make -fPIC, but PIC is not a target.










Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Chris Wade

all it says is
amazon linux AMI release 2015.09
kernel \r on an \m

On 03/03/2016 14:07, Stefan Karpinski wrote:
What is the content of /etc/issue – i.e. what is the Linux distro and 
what is the output of `gcc --version`?


On Thu, Mar 3, 2016 at 8:52 AM, Chris Wade 
mailto:chris.w...@thecitysecret.com>> 
wrote:


the linux version is
4.1.13-19.31.amzn1.x86_64 GNU/Linux


On 03/03/2016 13:42, Stefan Karpinski wrote:

I was wondering about the Linux version, not what AMI. If it's an
older version of CentOS, for example, it may have a version of
GCC that's too old.

On Thu, Mar 3, 2016 at 4:08 AM, Chris
mailto:chris.w...@thecitysecret.com>> wrote:

Linuz VM is running: Amazon Linux AMI ElasticBeanstalk
4.1.13-19.31.amzn1.x86_64 GNU/Linux

On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan
Karpinski wrote:

What version of Linux is the VM running?

On Wed, Mar 2, 2016 at 12:06 PM, Chris
mailto:chris...@thecitysecret.com>> wrote:

Im trying to install julia on amazon linux instance.

i ran:

sudo yum -y install clang m4 patch ncurses-devel
python-devel
git clone https://github.com/JuliaLang/julia.git
cd julia
git checkout v0.4.3
make

that failed on fortran
so i ran:

sudo yum -y install gcc-gfortran

then ran 'make'
but get this error

/usr/bin/ld:
/usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o):
relocation R_X86_64_32 against `.rodata.str1.1' can
not be used when making a shared object; recompile
with -fPIC
/usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a:
could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libopenspecfun.so] Error 1
make[1]: *** [openspecfun/libopenspecfun.so] Error 2
make: *** [julia-deps] Error 2

it seems to be something to do with fortran, but i
cannot understand what i need to do?
I also tried make -fPIC, but PIC is not a target.










[julia-users] Re: Creating docstrings using code generation

2016-03-03 Thread Curtis Vogt
Thanks Mike, I also managed to come up with an alternative solution:

using Base.Dates
for name in (:year, :month, :day, :hour, :minute, :second, :millisecond)
func = eval(name)
@doc """
$name(dt::TimeType) -> Int64

Return the $name of a `Date` or `DateTime` as an `Int64`.
""" -> func(dt::TimeType)
end

Not sure which I like better yet.

On Thursday, March 3, 2016 at 9:05:36 AM UTC-6, Michael Hatherly wrote:
>
> Just needs extra `$`s in the docstring, one for expression interpolation 
> and one for string interpolation:
>
> julia> for name in (:year, :month, :day, :hour, :minute, :second, :
> millisecond)
>@eval begin
>@doc """
>$($name)(dt::TimeType) -> Int64
>
>Return the $($name) of a `Date` or `DateTime` as an `Int64`.
>""" ->
>$name(dt::TimeType)
>end
>end
>
> (`name` will be displayed fully qualified, i.e. `Base.Dates.year`, so you 
> could convert `name` it to a string to avoid that.)
>
> -- Mike
>
> On Thursday, 3 March 2016 16:44:38 UTC+2, Curtis Vogt wrote:
>>
>> I was hoping to generate several redundant docstrings using code 
>> generation. Unfortunately I have run into an issue where $name isn't 
>> being replaced in the docstring:
>>
>> julia> using Base.Dates
>>
>> julia> for name in (:year, :month, :day, :hour, :minute, :second, :
>> millisecond)
>>@eval begin
>>@doc """
>>$name(dt::TimeType) -> Int64
>>
>>Return the $name of a `Date` or `DateTime` as an `Int64`.
>>""" ->
>>$name(dt::TimeType)
>>end
>>end
>> ERROR: UndefVarError: name not defined
>>  in eval(::Module, ::Any) at ./boot.jl:267
>>  [inlined code] from ./boot.jl:266
>>  in anonymous at ./no file:4294967295
>>  in eval(::Module, ::Any) at ./boot.jl:267
>>
>>
>>
>> Is there a way I can get this to work?
>>
>

[julia-users] Re: Creating docstrings using code generation

2016-03-03 Thread Michael Hatherly
Just needs extra `$`s in the docstring, one for expression interpolation 
and one for string interpolation:

julia> for name in (:year, :month, :day, :hour, :minute, :second, :
millisecond)
   @eval begin
   @doc """
   $($name)(dt::TimeType) -> Int64

   Return the $($name) of a `Date` or `DateTime` as an `Int64`.
   """ ->
   $name(dt::TimeType)
   end
   end

(`name` will be displayed fully qualified, i.e. `Base.Dates.year`, so you 
could convert `name` it to a string to avoid that.)

-- Mike

On Thursday, 3 March 2016 16:44:38 UTC+2, Curtis Vogt wrote:
>
> I was hoping to generate several redundant docstrings using code 
> generation. Unfortunately I have run into an issue where $name isn't 
> being replaced in the docstring:
>
> julia> using Base.Dates
>
> julia> for name in (:year, :month, :day, :hour, :minute, :second, :
> millisecond)
>@eval begin
>@doc """
>$name(dt::TimeType) -> Int64
>
>Return the $name of a `Date` or `DateTime` as an `Int64`.
>""" ->
>$name(dt::TimeType)
>end
>end
> ERROR: UndefVarError: name not defined
>  in eval(::Module, ::Any) at ./boot.jl:267
>  [inlined code] from ./boot.jl:266
>  in anonymous at ./no file:4294967295
>  in eval(::Module, ::Any) at ./boot.jl:267
>
>
>
> Is there a way I can get this to work?
>


Re: [julia-users] [Plots.jl] Sequential color of consecutive data series

2016-03-03 Thread Pablo Zubieta
Thank you, this works fine for me.

I understand the motivation of generating the palette based  on the 
background color and I don't expect this to be implemented. No worries.



[julia-users] Creating docstrings using code generation

2016-03-03 Thread Curtis Vogt
I was hoping to generate several redundant docstrings using code 
generation. Unfortunately I have run into an issue where $name isn't being 
replaced in the docstring:

julia> using Base.Dates

julia> for name in (:year, :month, :day, :hour, :minute, :second, :
millisecond)
   @eval begin
   @doc """
   $name(dt::TimeType) -> Int64

   Return the $name of a `Date` or `DateTime` as an `Int64`.
   """ ->
   $name(dt::TimeType)
   end
   end
ERROR: UndefVarError: name not defined
 in eval(::Module, ::Any) at ./boot.jl:267
 [inlined code] from ./boot.jl:266
 in anonymous at ./no file:4294967295
 in eval(::Module, ::Any) at ./boot.jl:267



Is there a way I can get this to work?


Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Yichao Yu
On Thu, Mar 3, 2016 at 9:07 AM, Stefan Karpinski  wrote:
> What is the content of /etc/issue – i.e. what is the Linux distro and what
> is the output of `gcc --version`?

>From the output,the gcc version seems to be 4.8.3

>
> On Thu, Mar 3, 2016 at 8:52 AM, Chris Wade 
> wrote:
>>
>> the linux version is
>> 4.1.13-19.31.amzn1.x86_64 GNU/Linux
>>
>>
>> On 03/03/2016 13:42, Stefan Karpinski wrote:
>>
>> I was wondering about the Linux version, not what AMI. If it's an older
>> version of CentOS, for example, it may have a version of GCC that's too old.
>>
>> On Thu, Mar 3, 2016 at 4:08 AM, Chris 
>> wrote:
>>>
>>> Linuz VM is running: Amazon Linux AMI ElasticBeanstalk
>>> 4.1.13-19.31.amzn1.x86_64 GNU/Linux
>>>
>>> On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan Karpinski wrote:

 What version of Linux is the VM running?

 On Wed, Mar 2, 2016 at 12:06 PM, Chris 
 wrote:
>
> Im trying to install julia on amazon linux instance.
>
> i ran:
>
> sudo yum -y install clang m4 patch ncurses-devel python-devel
> git clone https://github.com/JuliaLang/julia.git
> cd julia
> git checkout v0.4.3
> make
>
> that failed on fortran
> so i ran:
>
> sudo yum -y install gcc-gfortran
>
> then ran 'make'
> but get this error
>
> /usr/bin/ld:
> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o): relocation
> R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared
> object; recompile with -fPIC
> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a: could not read
> symbols: Bad value
> collect2: error: ld returned 1 exit status
> make[2]: *** [libopenspecfun.so] Error 1
> make[1]: *** [openspecfun/libopenspecfun.so] Error 2
> make: *** [julia-deps] Error 2
>
> it seems to be something to do with fortran, but i cannot understand
> what i need to do?
> I also tried make -fPIC, but PIC is not a target.
>

>>
>>
>


Re: [julia-users] Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Tim Holy
I can tell you I've gotten CUDArt-based operations working on remote machines.

I don't really know what the issue is, but I did notice a couple of concerns:

- what's up with `CudaArray(map(elty, ones(n1)))`? That doesn't look right at 
all. Don't you mean `CudaArray(elty, ones(n1)...)`?
- don't you need to make sure the kernel completes before calling to_host? 

Best,
--Tim

On Thursday, March 03, 2016 04:31:54 AM Matthew Pearce wrote:
> Hello
> 
> I've come across a baffling error. I have a custom CUDA kernel to calculate
> squared row norms of a matrix. It works fine on the host computer:
> 
> julia> d_M = residual_shared(Y_init,A_init,S_init,k,sig)
> CUDArt.CudaArray{Float32,2}(CUDArt.CudaPtr{Float32}(Ptr{Float32} @
> 0x000b037a),(4000,2500),0)
> 
> julia> sum(cudakernels.sqrownorms(d_M))
> 5.149127f6
> 
> However when I try to run the same code on a remote machine, the variable
> `d_M' gets calculated properly. The custom kernel launch code looks like:
> 
> function sqrownorms{T}(d_M::CUDArt.CudaArray{T,2})
> elty = eltype(d_M)
> n1, n2 = size(d_M)
> d_dots = CudaArray(map(elty, ones(n1)))
> dev = device(d_dots)
> dotf = ptxdict[(dev, "sqrownorms", elty)]
> numblox = Int(ceil(n1/maxBlock))
> CUDArt.launch(dotf, numblox, maxBlock, (d_M, n1, n2, d_dots))
> dots = to_host(d_dots)
> free(d_dots)
> return dots
> end
> 
> Running the inside of this on a remote causes the following crash message.
> (Running the function produces an unhelpful process exited arrgh! error).
> 
> julia> sow(reps[5], :d_M, :(residual_shared(Y,A_init,S_init,1,sig)))
> 
> julia> p2 = quote
>elty = eltype(d_M)
>n1, n2 = size(d_M)
>d_dots = CudaArray(map(elty, ones(n1)))
>dev = device(d_dots)
>dotf = cudakernels.ptxdict[(dev, "sqrownorms", elty)]
>numblox = Int(ceil(n1/cudakernels.maxBlock))
>CUDArt.launch(dotf, numblox, cudakernels.maxBlock, (d_M, n1, n2,
> d_dots))
>dots = to_host(d_dots)
>free(d_dots)
>dots
>end;
> 
> julia> reap(reps[5], p2)  #this is a remote call fetch of the eval of the
> `p2' block in global scope
> ERROR: On worker 38:
> "an illegal memory access was encountered"
>  [inlined code] from essentials.jl:111
>  in checkerror at /home/mcp50/.julia/v0.5/CUDArt/src/libcudart-6.5.jl:16
>  [inlined code] from /home/mcp50/.julia/v0.5/CUDArt/src/stream.jl:11
>  in cudaMemcpyAsync at /home/mcp50/.julia/v0.5/CUDArt/src/../gen-6.5/
> gen_libcudart.jl:396
>  in copy! at /home/mcp50/.julia/v0.5/CUDArt/src/arrays.jl:152
>  in to_host at /home/mcp50/.julia/v0.5/CUDArt/src/arrays.jl:148
>  in anonymous at multi.jl:892
>  in run_work_thunk at multi.jl:645
>  [inlined code] from multi.jl:892
>  in anonymous at task.jl:59
>  in remotecall_fetch at multi.jl:731
>  [inlined code] from multi.jl:368
>  in remotecall_fetch at multi.jl:734
>  in anonymous at task.jl:443
>  in sync_end at ./task.jl:409
>  [inlined code] from task.jl:418
>  in reap at /home/mcp50/.julia/v0.5/ClusterUtils/src/ClusterUtils.jl:203
> 
> Any thoughts much appreciated - I'm not sure where to go with this now.
> 
> Matthew



[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread J Luis
But unfortunately on Windows

INFO: Downloading pre-compiled GR 0.17.3 binary
=[ ERROR: GR 
]==

LoadError: chmod: no such file or directory (ENOENT)
while loading C:\j\.julia\v0.4\GR\deps\build.jl, in expression starting on 
line 25



quinta-feira, 3 de Março de 2016 às 08:26:20 UTC, Josef Heinen escreveu:
>
> *Pkg.add("GR")*
>
> *using GR*
> *z = peaks()*
> *surface(z)*
>
>
> 
>
>
>
> On Thursday, March 3, 2016 at 5:10:52 AM UTC+1, mauri...@gmail.com wrote:
>>
>> Hello Julia users, 
>>
>> I would like to know if anyone knows how we can have 3D scatter plots or 
>> meshed surfaces color plots using Julia.  
>>
>> My problem is based on four variables, so I'm trying to visualize the 
>> data according to these options. 
>>
>> Any idea or example code will be really helpful. 
>>
>> Thanks!
>>
>

Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Stefan Karpinski
What is the content of /etc/issue – i.e. what is the Linux distro and what
is the output of `gcc --version`?

On Thu, Mar 3, 2016 at 8:52 AM, Chris Wade 
wrote:

> the linux version is
> 4.1.13-19.31.amzn1.x86_64 GNU/Linux
>
>
> On 03/03/2016 13:42, Stefan Karpinski wrote:
>
> I was wondering about the Linux version, not what AMI. If it's an older
> version of CentOS, for example, it may have a version of GCC that's too old.
>
> On Thu, Mar 3, 2016 at 4:08 AM, Chris 
> wrote:
>
>> Linuz VM is running: Amazon Linux AMI ElasticBeanstalk
>> 4.1.13-19.31.amzn1.x86_64 GNU/Linux
>>
>> On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan Karpinski wrote:
>>>
>>> What version of Linux is the VM running?
>>>
>>> On Wed, Mar 2, 2016 at 12:06 PM, Chris 
>>> wrote:
>>>
 Im trying to install julia on amazon linux instance.

 i ran:

 sudo yum -y install clang m4 patch ncurses-devel python-devel
 git clone https://github.com/JuliaLang/julia.git
 cd julia
 git checkout v0.4.3
 make

 that failed on fortran
 so i ran:

 sudo yum -y install gcc-gfortran

 then ran 'make'
 but get this error

 /usr/bin/ld:
 /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o): relocation
 R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared
 object; recompile with -fPIC
 /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a: could not read
 symbols: Bad value
 collect2: error: ld returned 1 exit status
 make[2]: *** [libopenspecfun.so] Error 1
 make[1]: *** [openspecfun/libopenspecfun.so] Error 2
 make: *** [julia-deps] Error 2

 it seems to be something to do with fortran, but i cannot understand
 what i need to do?
 I also tried make -fPIC, but PIC is not a target.


>>>
>
>


Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Chris Wade

the linux version is
4.1.13-19.31.amzn1.x86_64 GNU/Linux

On 03/03/2016 13:42, Stefan Karpinski wrote:
I was wondering about the Linux version, not what AMI. If it's an 
older version of CentOS, for example, it may have a version of GCC 
that's too old.


On Thu, Mar 3, 2016 at 4:08 AM, Chris > wrote:


Linuz VM is running: Amazon Linux AMI ElasticBeanstalk
4.1.13-19.31.amzn1.x86_64 GNU/Linux

On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan Karpinski
wrote:

What version of Linux is the VM running?

On Wed, Mar 2, 2016 at 12:06 PM, Chris
 wrote:

Im trying to install julia on amazon linux instance.

i ran:

sudo yum -y install clang m4 patch ncurses-devel python-devel
git clone https://github.com/JuliaLang/julia.git
cd julia
git checkout v0.4.3
make

that failed on fortran
so i ran:

sudo yum -y install gcc-gfortran

then ran 'make'
but get this error

/usr/bin/ld:
/usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not be
used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a:
could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libopenspecfun.so] Error 1
make[1]: *** [openspecfun/libopenspecfun.so] Error 2
make: *** [julia-deps] Error 2

it seems to be something to do with fortran, but i cannot
understand what i need to do?
I also tried make -fPIC, but PIC is not a target.







[julia-users] Re: Abstract typed array construction JIT performance

2016-03-03 Thread FANG Colin
All right that makes sense.

On Thursday, March 3, 2016 at 1:50:09 PM UTC, Lutfullah Tomak wrote:
>
> Hi Colin,
> I think if getindex inlined in vect it is not compiled seperately for your 
> second run. Check code generated with @code_* for youreself.



[julia-users] Abstract typed array construction JIT performance

2016-03-03 Thread Lutfullah Tomak
Hi Colin,
I think if getindex inlined in vect it is not compiled seperately for your 
second run. Check code generated with @code_* for youreself.

Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Stefan Karpinski
I was wondering about the Linux version, not what AMI. If it's an older
version of CentOS, for example, it may have a version of GCC that's too old.

On Thu, Mar 3, 2016 at 4:08 AM, Chris  wrote:

> Linuz VM is running: Amazon Linux AMI ElasticBeanstalk
> 4.1.13-19.31.amzn1.x86_64 GNU/Linux
>
> On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan Karpinski wrote:
>>
>> What version of Linux is the VM running?
>>
>> On Wed, Mar 2, 2016 at 12:06 PM, Chris 
>> wrote:
>>
>>> Im trying to install julia on amazon linux instance.
>>>
>>> i ran:
>>>
>>> sudo yum -y install clang m4 patch ncurses-devel python-devel
>>> git clone https://github.com/JuliaLang/julia.git
>>> cd julia
>>> git checkout v0.4.3
>>> make
>>>
>>> that failed on fortran
>>> so i ran:
>>>
>>> sudo yum -y install gcc-gfortran
>>>
>>> then ran 'make'
>>> but get this error
>>>
>>> /usr/bin/ld:
>>> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o): relocation
>>> R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared
>>> object; recompile with -fPIC
>>> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a: could not read
>>> symbols: Bad value
>>> collect2: error: ld returned 1 exit status
>>> make[2]: *** [libopenspecfun.so] Error 1
>>> make[1]: *** [openspecfun/libopenspecfun.so] Error 2
>>> make: *** [julia-deps] Error 2
>>>
>>> it seems to be something to do with fortran, but i cannot understand
>>> what i need to do?
>>> I also tried make -fPIC, but PIC is not a target.
>>>
>>>
>>


[julia-users] Re: Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Matthew Pearce
I should add that I don't think the error lies in my `reap' function for 
remote calls. 
As I can correctly call the cudakernels.sqrownorms function on the host 
from the remote:

julia> reap(3, :(reap(1, :(sum(cudakernels.sqrownorms(d_M[1]  ))[3]
5.149127f6

(The above gets process three to call the kernel on process 1 and then 
returns the result from 3 to 1.)



[julia-users] Using CUDArt on remote machines - 'illegal memory access'

2016-03-03 Thread Matthew Pearce
Hello

I've come across a baffling error. I have a custom CUDA kernel to calculate 
squared row norms of a matrix. It works fine on the host computer:

julia> d_M = residual_shared(Y_init,A_init,S_init,k,sig)
CUDArt.CudaArray{Float32,2}(CUDArt.CudaPtr{Float32}(Ptr{Float32} @
0x000b037a),(4000,2500),0)

julia> sum(cudakernels.sqrownorms(d_M))
5.149127f6

However when I try to run the same code on a remote machine, the variable 
`d_M' gets calculated properly. The custom kernel launch code looks like:

function sqrownorms{T}(d_M::CUDArt.CudaArray{T,2})
elty = eltype(d_M)
n1, n2 = size(d_M)
d_dots = CudaArray(map(elty, ones(n1)))
dev = device(d_dots)
dotf = ptxdict[(dev, "sqrownorms", elty)]
numblox = Int(ceil(n1/maxBlock)) 
CUDArt.launch(dotf, numblox, maxBlock, (d_M, n1, n2, d_dots))
dots = to_host(d_dots)
free(d_dots)
return dots
end

Running the inside of this on a remote causes the following crash message. 
(Running the function produces an unhelpful process exited arrgh! error).

julia> sow(reps[5], :d_M, :(residual_shared(Y,A_init,S_init,1,sig)))

julia> p2 = quote 
   elty = eltype(d_M)
   n1, n2 = size(d_M)
   d_dots = CudaArray(map(elty, ones(n1)))
   dev = device(d_dots)
   dotf = cudakernels.ptxdict[(dev, "sqrownorms", elty)]
   numblox = Int(ceil(n1/cudakernels.maxBlock))
   CUDArt.launch(dotf, numblox, cudakernels.maxBlock, (d_M, n1, n2, 
d_dots))
   dots = to_host(d_dots)
   free(d_dots)
   dots
   end;

julia> reap(reps[5], p2)  #this is a remote call fetch of the eval of the 
`p2' block in global scope
ERROR: On worker 38:
"an illegal memory access was encountered"
 [inlined code] from essentials.jl:111
 in checkerror at /home/mcp50/.julia/v0.5/CUDArt/src/libcudart-6.5.jl:16
 [inlined code] from /home/mcp50/.julia/v0.5/CUDArt/src/stream.jl:11
 in cudaMemcpyAsync at /home/mcp50/.julia/v0.5/CUDArt/src/../gen-6.5/
gen_libcudart.jl:396
 in copy! at /home/mcp50/.julia/v0.5/CUDArt/src/arrays.jl:152
 in to_host at /home/mcp50/.julia/v0.5/CUDArt/src/arrays.jl:148
 in anonymous at multi.jl:892
 in run_work_thunk at multi.jl:645
 [inlined code] from multi.jl:892
 in anonymous at task.jl:59
 in remotecall_fetch at multi.jl:731
 [inlined code] from multi.jl:368
 in remotecall_fetch at multi.jl:734
 in anonymous at task.jl:443
 in sync_end at ./task.jl:409
 [inlined code] from task.jl:418
 in reap at /home/mcp50/.julia/v0.5/ClusterUtils/src/ClusterUtils.jl:203

Any thoughts much appreciated - I'm not sure where to go with this now.

Matthew




Re: [julia-users] 3D scatter / meshed surface color map

2016-03-03 Thread Tom Breloff
These are all really cool packages. Don't pick just one! ;)

https://github.com/tbreloff/Plots.jl

One of these days I'll get GLVisualize working...

On Wednesday, March 2, 2016,  wrote:

> Hello Julia users,
>
> I would like to know if anyone knows how we can have 3D scatter plots or
> meshed surfaces color plots using Julia.
>
> My problem is based on four variables, so I'm trying to visualize the data
> according to these options.
>
> Any idea or example code will be really helpful.
>
> Thanks!
>


Re: [julia-users] Re: JuliaCon 2016: Program Committee Office Hours on the 5th of March at 15:00 UTC

2016-03-03 Thread Pontus Stenetorp
On 3 March 2016 at 11:47, Bart Janssens  wrote:
>
> Should we already fill in the proposal form for JuliaCon before this
> session, to improve upon it later, or is it better to just submit after?

Either way is fine.  I imagine that it is easiest for us on the PC if
you have a link to a draft (or drafts) stored somewhere ready on
Saturday.

Pontus


[julia-users] Re: [ANN] GLVisualize

2016-03-03 Thread Job van der Zwan
On Monday, 29 February 2016 16:03:10 UTC+1, Simon Danisch wrote:
>
> > If not MatplotLib, could this become the Processing (and by extension 
> OpenFrameworks, LibCinder) of Julia?
>
> That's definitely more the direction I'd like to take (although with a 
> very different approach).
> I hope that it will enable us to create a nice platform for accelerated 
> data processing in general. With FireRender 
> 
>  as 
> a backend it might also appeal to artists more!
>

I have to say, after years of Processing API indoctrination (which almost 
every other CC framework follows), I didn't quite understand how the 
interactive examples[0 ] 
work. It took me a while to realise all the input is handled by the 
Reactive package (which I wasn't familiar with) - maybe you want to mention 
that in the documentation somehow?

(offtopic: is there a package for capturing live camera feeds? I'd like to 
mess around with slitscanning[1 
][2 
] as my "Hello World" project 
for this package; and it looks like working with volumes is relatively easy[
3 ] in Julia)


[julia-users] Re: JuliaCon 2016: Program Committee Office Hours on the 5th of March at 15:00 UTC

2016-03-03 Thread Bart Janssens
Hi,

Should we already fill in the proposal form for JuliaCon before this 
session, to improve upon it later, or is it better to just submit after?

Cheers,

Bart

On Wednesday, March 2, 2016 at 11:55:22 PM UTC+1, Pontus Stenetorp wrote:
>
> Everyone, 
>
> With the JuliaCon 2016 proposal deadline at the 18th of March only being a 
> few 
> weeks away, it is high time to consider what to submit for this years 
> JuliaCon. 
> In order to help potential speakers, we will arrange a public session on 
> the 
> 5th of March at 15:00 UTC where you can interact directly with members of 
> the 
> Program Committee to ask for feedback on your ideas and proposals. 
>
>

[julia-users] Abstract typed array construction JIT performance

2016-03-03 Thread FANG Colin
Hi all

I have got some questions about array construction JIT speed.

abstract Aimmutable B <: A endimmutable C <: A end



b = B()
c = C()
@time getindex(B, b, b)
@time Base.vect(b, b);

  0.006129 seconds (6.03 k allocations: 276.191 KB)
  0.005339 seconds (3.43 k allocations: 175.144 KB)


Restart the kernel and change the order of statments: 


b = B()
c = C()
@time Base.vect(b, b)
@time getindex(B, b, b);

 0.009543 seconds (7.02 k allocations: 328.819 KB)
 0.006245 seconds (2.44 k allocations: 128.672 KB)


According to source code, vect{T}(X::T...) = T[ X[i] for i=1:length(X) ]

So I would expect when calling vect, the JIT for vect & getindex would both get 
done.

However the test showed that Julia still need to do an extra JIT for getindex? 
Why is that?



In the source code, I see 2 methods are implemented for getindex


# T[x...] constructs Array{T,1}function getindex(T::Type, vals...)
a = Array(T,length(vals))
@inbounds for i = 1:length(vals)
a[i] = vals[i]
end
return aend
function getindex(::Type{Any}, vals::ANY...)
a = Array(Any,length(vals))
@inbounds for i = 1:length(vals)
a[i] = vals[i]
end
return aend


Why is the second one required?  I have read the performance-tips, but in this 
case type of a is stable: always T. 


In one of my application, I have to store elements of different subtypes in the 
array and I got big hit by the JIT performance.

Below is a minimal example.


Restart the kernel and run the following: 


b = B()
c = C()
@time getindex(A, b, b)
@time getindex(A, b, c)
@time getindex(A, c, c)
@time getindex(A, c, b)
@time getindex(A, b, c, b)
@time getindex(A, b, c, c);

  0.007756 seconds (6.03 k allocations: 276.426 KB)
  0.007878 seconds (5.01 k allocations: 223.087 KB)
  0.005175 seconds (2.44 k allocations: 128.773 KB)
  0.004276 seconds (2.42 k allocations: 127.546 KB)
  0.004107 seconds (2.45 k allocations: 129.983 KB)
  0.004090 seconds (2.45 k allocations: 129.983 KB)

As you see, each time I construct the array for different combination of 
elements, it has to do a JIT.


I also tried [...] instead of T[...], it appeared worse.


Restart the kernel and run the following: 


b = B()
c = C()
@time Base.vect(b, b)
@time Base.vect(b, c)
@time Base.vect(c, c)
@time Base.vect(c, b)
@time Base.vect(b, c, b)
@time Base.vect(b, c, c);

  0.008252 seconds (6.87 k allocations: 312.395 KB)
  0.149397 seconds (229.26 k allocations: 12.251 MB)
  0.006778 seconds (6.86 k allocations: 312.270 KB)
  0.113640 seconds (178.26 k allocations: 9.132 MB, 3.04% gc time)
  0.050561 seconds (99.19 k allocations: 5.194 MB)
  0.031053 seconds (72.50 k allocations: 3.661 MB)



In my application I face a lot of different subtypes: each element is of type 
NTuple{N, A} where N can change. So in the end the application was stuck in JIT.


What's the best way to get around it? The only way I can think of is to create 
a wrapper, say W, and box all my element into W before entering the array.


immutable W
value::NTupleend





[julia-users] [Plots.jl] Sequential color of consecutive data series

2016-03-03 Thread Pablo Zubieta
Hi

I was making a plot using Plots.jl and the gadfly backend to draw different 
series of data on the same plot and I found that if I declare the colour 
for just a specific data series the default palette advances to the next 
colour even though the next available colour in the palette has not been 
used.

Is there a mechanism to avoid this?

Cheers,
Pablo


Re: [julia-users] julia make error on amazon linux ec2

2016-03-03 Thread Chris
Linuz VM is running: Amazon Linux AMI ElasticBeanstalk 
4.1.13-19.31.amzn1.x86_64 GNU/Linux

On Wednesday, March 2, 2016 at 6:17:25 PM UTC, Stefan Karpinski wrote:
>
> What version of Linux is the VM running?
>
> On Wed, Mar 2, 2016 at 12:06 PM, Chris  > wrote:
>
>> Im trying to install julia on amazon linux instance.
>>
>> i ran:
>>
>> sudo yum -y install clang m4 patch ncurses-devel python-devel
>> git clone https://github.com/JuliaLang/julia.git
>> cd julia
>> git checkout v0.4.3
>> make
>>
>> that failed on fortran
>> so i ran:
>>
>> sudo yum -y install gcc-gfortran
>>
>> then ran 'make'
>> but get this error
>>
>> /usr/bin/ld: 
>> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o): relocation 
>> R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared 
>> object; recompile with -fPIC
>> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a: could not read 
>> symbols: Bad value
>> collect2: error: ld returned 1 exit status
>> make[2]: *** [libopenspecfun.so] Error 1
>> make[1]: *** [openspecfun/libopenspecfun.so] Error 2
>> make: *** [julia-deps] Error 2
>>
>> it seems to be something to do with fortran, but i cannot understand what 
>> i need to do?
>> I also tried make -fPIC, but PIC is not a target.
>>
>>
>

[julia-users] Re: julia make error on amazon linux ec2

2016-03-03 Thread Chris
Linuz VM is running: Amazon Linux AMI 
ElasticBeanstalk 4.1.13-19.31.amzn1.x86_64 GNU/Linux

On Wednesday, March 2, 2016 at 5:06:07 PM UTC, Chris wrote:
>
> Im trying to install julia on amazon linux instance.
>
> i ran:
>
> sudo yum -y install clang m4 patch ncurses-devel python-devel
> git clone https://github.com/JuliaLang/julia.git
> cd julia
> git checkout v0.4.3
> make
>
> that failed on fortran
> so i ran:
>
> sudo yum -y install gcc-gfortran
>
> then ran 'make'
> but get this error
>
> /usr/bin/ld: /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a(stop.o): 
> relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making 
> a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-amazon-linux/4.8.3/libgfortran.a: could not read 
> symbols: Bad value
> collect2: error: ld returned 1 exit status
> make[2]: *** [libopenspecfun.so] Error 1
> make[1]: *** [openspecfun/libopenspecfun.so] Error 2
> make: *** [julia-deps] Error 2
>
> it seems to be something to do with fortran, but i cannot understand what 
> i need to do?
> I also tried make -fPIC, but PIC is not a target.
>
>

[julia-users] Re: PyPlot ArgumentError: haskey of NULL PyObject error

2016-03-03 Thread Josef Heinen
Works find on my machines. Does you example work in the Python environment 
you are using within Julia?

On Thursday, March 3, 2016 at 8:18:52 AM UTC+1, Kai Xin Thia wrote:
>
> Using the sample code below, Version 0.4.3 on Mac, I keep getting the 
> error. Is there a way to fix it?:
>
>
> using PyPlot
>
> n = 50
>
> srand(1)
>
> x = rand(n)
>
> y = rand(n)
>
> area = pi .* (15 .* rand(n)).^2 # 0 to 15 point radiuses
>
> scatter(x, y, s=area, alpha=0.5)
>
>
> LoadError: ArgumentError: haskey of NULL PyObject
>
> while loading In[12], in expression starting on line 8
>
>  in haskey at /Users/admin/.julia/v0.4/PyCall/src/PyCall.jl:249
>
>  in scatter at /Users/admin/.julia/v0.4/PyPlot/src/PyPlot.jl:457
>
>
> *For reference, Pkg.status()*
>
> 4 required packages:
>
>  - IJulia1.1.8
>
>  - Plots 0.5.2
>
>  - PyCall1.4.0  master
>
>  - PyPlot2.1.1
>
> 17 additional packages:
>
>  - BinDeps   0.3.21
>
>  - ColorTypes0.2.1
>
>  - Colors0.6.3
>
>  - Compat0.7.12
>
>  - Conda 0.1.9
>
>  - Dates 0.4.4
>
>  - FixedPointNumbers 0.1.2
>
>  - Homebrew  0.2.0
>
>  - JSON  0.5.0
>
>  - LaTeXStrings  0.1.6
>
>  - MacroTools0.3.0
>
>  - Nettle0.2.2
>
>  - Reexport  0.0.3
>
>  - Requires  0.2.2
>
>  - SHA   0.1.2
>
>  - URIParser 0.1.2
>  - ZMQ   0.3.1 
>
>
>

[julia-users] Re: 3D scatter / meshed surface color map

2016-03-03 Thread Josef Heinen
*Pkg.add("GR")*

*using GR*
*z = peaks()*
*surface(z)*





On Thursday, March 3, 2016 at 5:10:52 AM UTC+1, mauri...@gmail.com wrote:
>
> Hello Julia users, 
>
> I would like to know if anyone knows how we can have 3D scatter plots or 
> meshed surfaces color plots using Julia.  
>
> My problem is based on four variables, so I'm trying to visualize the data 
> according to these options. 
>
> Any idea or example code will be really helpful. 
>
> Thanks!
>