DLPack feature broken in petsc4py
The following commit breaks the DLPack feature in petsc4py.
commit b12f50eb112f916bb6f36986fae3f8302242f7a3 (HEAD)
Author: Lisandro Dalcin <dalcinl@gmail.com>
Date: Sat Jul 22 21:37:30 2023 +0300
petsc4py: Update to Cython 3
Running the following example now gives a seg fault. @dalcinl Any idea how to fix it?
import sys
import petsc4py
petsc4py.init(sys.argv)
import numpy as np
from petsc4py import PETSc
import torch
import torch.utils.dlpack as dlpack
# convert PETSc Vec to tensor
b_vec = PETSc.Vec().createWithArray([5.,6.,7.,8.])
b_tensor = dlpack.from_dlpack(b_vec)
print(b_tensor)
Edited by Hong Zhang