<div dir="ltr"><div>Hello, petsc-users<br><br>I posted about this before without luck, but perhaps that was a little too specific a request:<br><br><a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2014-July/022145.html">http://lists.mcs.anl.gov/pipermail/petsc-users/2014-July/022145.html</a><br><br></div><div>In general, it would be great to be able to use PyCUDA and petsc4py together. Here is an example of how I'd like to be able to do this (based on this PyCUDA <a href="http://documen.tician.de/pycuda/tutorial.html">example</a>):<br><br>from petsc4py import PETSc as petsc<br>import pycuda.driver as cuda<br>from pycuda import autoinit<br>from pycuda.compiler import SourceModule<br><br>mod = SourceModule("""<br>  __global__ void doublify(double *a)<br>  {<br>    int idx = threadIdx.x + threadIdx.y*4;<br>    a[idx] *= 2;<br>  }<br>  """)<br><br>v = petsc.Vec()<br>v.create()<br>v.setSizes(16)<br>v.setType('cusp')<br>v.set(1)<br><br>func = mod.get_function("doublify")<br><b>func(???, block=(4,4,1))</b><br><br></div><div>`func` accepts as ??? an object that supports the Python buffer interface, see <a href="http://documen.tician.de/pycuda/driver.html#pycuda.driver.Function">here</a>, and I'm wondering if it's possible for petsc4py cusp vectors to support that?<br><br></div><div>Are there any other ways to use custom kernels with petsc4py cusp vectors? petsc4py users - if you use CUSP vectors in your petsc4py code, may I ask how?<br><br></div><div>Thanks so much,<br>Ashwin<br></div><div><br></div></div>