On Fri, 20 Jan 2012 09:28:05 -0800 (PST), ggeo <[email protected]> wrote:
> Hello , i am a bit confused about measuring time,so i need a little help.
> 
> I have a code like :
> 
> ....
> Rs_gpu=gpuarray.to_gpu(np.random.rand(numPointsRs*3).astype(np.float32))
> Rp_gpu=gpuarray.to_gpu(np.random.rand(3).astype(np.float32))
> ....
> start = drv.Event()
> end = drv.Event()
> 
> mod =SourceModule("""
>     __global__ void compute(float *Rs_mat, ...., float *Rp,.) 
> """)
> 
> #call the function(kernel)
> func = mod.get_function("compute")
> 
> start.record() # start timing
> 
> func(Rs_gpu,..Rp_gpu...)
> 
> end.record() # end timing
> 
> # calculate the run length
> end.synchronize()
> secs = start.time_till(end)*1e-3
> 
> #----- get data back from GPU-----
> Rs=Rs_gpu.get()
> Rp=Rp_gpu.get()
> 
> 
> print "%s, %fsec, %s" % ('Time for Rs = ',secs,str(Rs))
> print "%s, %fsec, %s" % ('Time for Rp = ',secs,str(Rp))     //here i am
> computing the same thing!
>               
> 
> My questions are:
> 
> 1) Is this right correct for measuring the gpu time?

Yes.

> 2) How can i distinguish the results for Rs and for Rp (if it can be
> done)

Not easily, unfortunately.

HTH,
Andreas

Attachment: pgpqRvIwSVEWL.pgp
Description: PGP signature

_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to