[petsc-users] Questions on Petsc4py with PyCUDA

Jose E. Roman jroman at dsic.upv.es
Sat Oct 23 05:53:15 CDT 2021


The correct ways are
  a.setType('cuda')
or
  a.setType(PETSc.Vec.Type.CUDA)

Probably what is happening is that PETSc has not been configured --with-cuda  - that's why it complains with "Unknown vector type: cuda"

Jose


> El 23 oct 2021, a las 11:33, Stefano Zampini <stefano.zampini at gmail.com> escribió:
> 
> 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



More information about the petsc-users mailing list