Andreas,

Thanks for the quick reply.I was able to track that problem down to a syntax 
error, but I've run into a problem launching kernels on gpu arrays allocated 
from the device memory pool, as in the following code:

import numpy
import pycuda.autoinit
import pycuda.gpuarray as gpua
from pycuda.tools import DeviceMemoryPool as DMP

pool=DMP()

test=gpua.GPUArray((1,2),dtype=numpy.float32,allocator=pool.allocate)

print(test)

# [[ nan  nan]]

print( int( test.gpudata))

# 30066083328

print( test.allocator)

# <bound method DeviceMemoryPool.allocate of <pycuda._driver.DeviceMemoryPool 
object at 0x2909e68>>

# attempting to launch a kernel returns an error
test.fill(3.)


The error I get is as follows (depending on the kernel and the way it is 
launched)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File 
"/usr/local/lib/python3.2/dist-packages/pycuda-2013.1.1-py3.2-linux-x86_64.egg/pycuda/gpuarray.py",
 line 516, in fill
    value, self.gpudata, self.mem_size)
  File 
"/usr/local/lib/python3.2/dist-packages/pycuda-2013.1.1-py3.2-linux-x86_64.egg/pycuda/driver.py",
 line 475, in function_prepared_async_call
    arg_buf = pack(func.arg_format, *args)
struct.error: required argument is not an integer


Manually specifying the allocator in the same way with pycuda.driver.mem_alloc 
seems to work fine, though. Do you know what it might be?

Graham
________________________________________
From: Andreas Kloeckner [[email protected]]
Sent: Saturday, April 19, 2014 2:54 PM
To: Graham Mills; [email protected]
Subject: Re: [PyCUDA] Device memory pool

Hi Graham,

Graham Mills <[email protected]> writes:
> I am attempting to use a memory pool for some gpu array calculations,
> using PyCUDA 2013.1 with python 3.x and CUDA 5.5. The trouble is I
> can't find an appropriate integer type with which to call .allocate on
> a DeviceMemoryPool object. All numpy integers as well as the native
> python integer return the error:
>
>
> Boost.Python.ArgumentError: Python argument types in
>     DeviceMemoryPool.allocate(numpy.uint32)
> did not match C++ signature:
>     allocate(boost::shared_ptr<(anonymous 
> namespace)::context_dependent_memory_pool<(anonymous 
> namespace)::device_allocator> >, unsigned long)
>
> I'm not entirely clear yet on how the device memory pool works; am I
> doing something wrong? Does the associated boost module not work with
> the unified python 3 integer type?

I'm not sure that's it, as there are tests for DeviceMemoryPool in
PyCUDA's test suite [1], and they pass in Python 3. If you could try and
put together a minimal reproducer, I'd be happy to take a look.

Andreas

[1] https://github.com/inducer/pycuda/blob/master/test/test_driver.py#L343
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to