Hi all, 

So, I have found ways to pass the numerical constants in, but cannot figure out 
how to allocate memory such that my code complies. 

blockwidth = numpy .shape(array)[1] #Want the block width to be the number of 
columns in the array. 
maxblock = cuda .Device.get_attribute( cuda .Context.get_device(), cuda 
.device_attribute.MAX_THREADS_PER_BLOCK) 
blockheight =int( maxblock / blockwidth ) 
gridx = cuda .Device.get_attribute( cuda .Context.get_device(), cuda 
.device_attribute.MAX_GRID_DIM_X) 
gridy = cuda .Device.get_attribute( cuda .Context.get_device(), cuda 
.device_attribute.MAX_GRID_DIM_Y) 
a_ gpu = cuda . mem _ alloc (array. nbytes ) 
cuda . memcpy _ htod (a_ gpu , array) 
mod = pycuda .compiler. SourceModule (""" 
__device__ int convrt _(integer *i__, doublereal * gdlat , doublereal * 
gdalt , doublereal * gclat , doublereal * rkm ) 
omitting function code. . . 
__global__ void thefunk ( doublereal *in) 
{int holder; 

int thread = threadIdx .y* blockDim .x; 
int block= blockIdx .x* blockDim .x* blockDim .y; 
int grid= blockIdx .y* gridDim .x* blockDim .x* blockDim .y; 
int idx = thread+block+grid; 
holder = (int)in[ idx ]; 
int *fix = &holder; 
convrt _(fix, &in[ idx +1], &in[ idx +2], &in[ idx +3], &in[ idx +4]); 
} 
""") 
func = mod.get_function(" thefunk ") 
func (a_ gpu , block=( blockwidth , blockheight ,1), grid=( gridx , gridy )) 

Gives the error: 
File " fortry . py ", line 128, in compute 
func (a_ gpu , block=( blockwidth , blockheight ,1), grid=( gridx , gridy )) 
File "/ usr /local/ midas 
/baseline/2010/python-2.6.2/pkg/lib/python2.6/site-packages/ pycuda 
-0.94.2-py2.6-linux-x86_64.egg/ pycuda /driver. py ", line 179, in 
function_call 
func .launch_grid(*grid) 
pycuda ._driver. LaunchError : cuLaunchGrid failed: launch out of resources 


Where have I gone astray? 

Thanks, 

-drp 


----- Original Message -----

----- Original Message -----
From: "Andreas Kloeckner " <lists@ informa . tiker .net> 
To: uteboy @comcast.net, pycuda @ tiker .net 
Sent: Wednesday, June 22, 2011 1:55:24 PM 
Subject: Re: [ PyCUDA ] issues with device_attribute class 

These are numerical constants that need to be passed to functions such 
as Device.get_attribute(). 

HTH , 
Andreas 


_______________________________________________ 
PyCUDA mailing list 
PyCUDA @ tiker .net 
http ://lists. tiker .net/ listinfo / pycuda 
_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to