Replies: 2 comments 2 replies
-
As a sanity check, this does work:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @cadop, Would you be able to share which version of Warp you've been using and sharing a runnable snippet showcasing the issue? I didn't manage to repro this issue on my end using the following snippet: import numpy as np
import warp as wp
POINTS = (
( 0.853553, -0.146446, 0.0 ), ( 0.146446, -0.853553, 0.0 ),
( 0.353553, 0.353553, 0.707106), (-0.353553, -0.353553, 0.707106),
(-0.353553, -0.353553, -0.707106), ( 0.353553, 0.353553, -0.707106),
(-0.853553, 0.146446, 0.0 ), (-0.146446, 0.853553, 0.0 ),
)
FACE_VERTEX_INDICES = (
0, 3, 1, 0, 2, 3, 4, 7, 5, 4, 6, 7, 6, 2, 7, 6, 3, 2,
5, 1, 4, 5, 0, 1, 5, 2, 0, 5, 7, 2, 1, 6, 4, 1, 3, 6,
)
@wp.kernel
def _matrix(
points: wp.array(dtype=wp.vec3),
faces: wp.array(dtype=wp.vec3i),
):
f = wp.tid()
face = faces[f]
wp.printf("face=(%d, %d, %d)\n", face[0], face[1], face[2])
def run():
points = wp.array(POINTS, dtype=wp.vec3)
faces = np.array(FACE_VERTEX_INDICES).reshape((-1, 3))
faces = wp.array(faces, shape=faces.shape[0], dtype=wp.vec3i)
wp.launch(_matrix, dim=faces.shape, inputs=(points, faces))
wp.synchronize()
if __name__ == "__main__":
run() Note that these 2 lines: faces = np.array(FACE_VERTEX_INDICES).reshape((-1, 3))
faces = wp.array(faces, shape=faces.shape[0], dtype=wp.vec3i) Could be replaced by single call: faces = wp.array(FACE_VERTEX_INDICES, dtype=wp.vec3i) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to convert a numpy array of integers into a warp array, where the second dim of numpy is captured by the warp dtype.
The kernel signature is:
This was seemingly working when I was in
device='cpu'
, however changing device to cuda results in:RuntimeError: Error launching kernel '_matrix', argument 'faces' expects an array with dtype=<class 'warp.types.vec3i'> but passed array has dtype=<class 'warp.types.int32'>.
Beta Was this translation helpful? Give feedback.
All reactions