[petsc-users] Questions on Petsc4py with PyCUDA

Stefano Zampini stefano.zampini at gmail.com
Sat Oct 23 04:33:46 CDT 2021


Use v.setType('veccuda')? Or v.setType(PETSc.Vec.Type.VECCUDA)

Il Sab 23 Ott 2021, 11:46 Guangpu Zhu <zhugp01 at nus.edu.sg> ha scritto:

> Dear Sir/Madam,
>
>         I am using the Petsc4py with PyCUDA. According to the following
> link
>
>
> https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.Vec.Type-class.html
>
> I set the vector type as 'cuda', the simple code is as follows:
>
> import sys
> import petsc4py
> from petsc4py import PETSc
> petsc4py.init(sys.argv)
> from pycuda import autoinit
> import pycuda.driver as drv
> import pycuda.compiler as compiler
> import pycuda.gpuarray as gpuarray
>
> a = PETSc.Vec().create()
> a.setType('cuda')
> a.setSizes(8)
>
> But when I run this code, it always shows that "Unknown vector type: cuda
> ".
>
> I have tried:
>        (a) petsc4py 3.15.0 with PyCUDA 2020.1
>        (b) petsc4py 3.15.1 with PyCUDA 2021.1
>        (c) petsc4py 3.16.0 with PyCUDA 2021.1
>
> but it always shows the same message: Unknown vector type: cuda
>
> The CUDA version on my computer is CUDA 11.3.
>
> So I am writing this e-mail to ask for your help and advice. Thank you in
> advance.
>
>
> Best,
>
> Guangpu Zhu
>
>
> ---
> Guangpu Zhu
>
> Research Associate,  Department of Mechanical Engineering
>
> National University of Singapore
>
> Personal E-mail: zhugpupc at gmail.com
>
> Phone: (+65) 87581879
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211023/c30b0326/attachment.html>


More information about the petsc-users mailing list