Are you sure this is due to CUDArt? For me, this works as many times as I care 
to try it (note that I'm not using CURAND):

using CUDArt
result = devices(dev->capability(dev)[1]>=2; nmax = 1) do devlist
    device(devlist[1])
    h = rand(Float32, 1000)
    d_a = CudaArray(h)
    a = to_host(d_a)
end

But I can replicate the bug if I use CURAND. I'd suggest filing an issue with 
that package. Most likely it needs to (and, you need to) initialize resources 
according to these instructions:
https://github.com/JuliaGPU/CUDArt.jl#initializing-and-freeing-ptx-modules

Best,
--Tim

On Saturday, November 07, 2015 02:52:16 PM Jason Eckstein wrote:
> I've had the same errors on MacOS, Windows 10, and Linux using the
> devices() do loop with CUDArt package.  All of the programs I run I place
> inside the outer do loop including all the repetitions because as soon as
> that block ends I cannot use any other CUDA functions without some type of
> pointer or memory error.  The only solution I've found is to restart Julia,
> but I noticed that if I run a program like yours with a julia command in
> the terminal rather than a REPL session, even if I just run one loop and I
> close the session I still get the memory errors when the script ends.
>  Perhaps someone involved in developing CUDArt can give some insight as to
> why the outer do-block loop cannot be ended cleanly.
> 
> On Friday, November 6, 2015 at 12:46:54 PM UTC-7, Joaquim Masset Lacombe
> 
> Dias Garcia wrote:
> > I was playing with the GPU (in both windows and mac) libraries and I came
> > up with the following errors:
> > The first time I execute the do loop, every thing goes well.
> > But If i try a second time in a row I get this invalid pointer error.
> > 
> > I got the same error in all my do loops, any ideas?
> > 
> > best,
> > Joaquim
> > 
> > *My code running on terminal:*
> > 
> > julia> using CUDArt
> > julia> using CURAND
> > julia> result = devices(dev->capability(dev)[1]>=2) do devlist
> > 
> >            d_a = curand(Float32, 1000);
> >            a = to_host(d_a);
> >        
> >        end
> > 
> > 1000-element Array{Float64,1}:
> >  0.438451
> >  0.460365
> >  0.250215
> >  0.494744
> >  0.0530111
> >  0.337699
> >  0.396763
> >  0.874419
> >  0.482167
> >  0.0428398
> >  ?
> >  0.563937
> >  0.80706
> >  0.190015
> >  0.334969
> >  0.622164
> >  0.710596
> >  0.0125895
> >  0.990388
> >  0.467796
> >  0.24313
> > 
> > julia> result = devices(dev->capability(dev)[1]>=2) do devlist
> > 
> >            d_a = curand(Float32, 1000);
> >            a = to_host(d_a);
> >        
> >        end
> > 
> > WARNING: CUDA error triggered from:
> >  in checkerror at
> > 
> > C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\libcudart-6.5.jl
> > 
> > :15
> > :
> >  in copy! at C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\arrays.jl:152
> >  in to_host at C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\arrays.jl:87
> >  in anonymous at none:3
> >  in devices at
> > 
> > C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\device.jl:61ERROR:
> > Launch failed, perhaps due to an invalid pointer
> > 
> >  in checkdrv at C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\module.jl:6
> >  in close at C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\device.jl:136
> >  in devices at C:\Users\joaquimgarcia\.julia\v0.4\CUDArt\src\device.jl:63

Reply via email to