You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I don't know if I'm not seeing an obvious mistake I made or if this is a bug, but I can't wrap my hand around this. I wrote this very simple kernel to get the aabb of a point cloud:
@wp.kernel
def get_aabb(points: wp.array(dtype=wp.vec3), lower: wp.vec3, upper: wp.vec3):
tid = wp.tid()
for i in range(points.shape[0]):
lower[tid] = wp.min(lower[tid], points[i][tid])
upper[tid] = wp.max(upper[tid], points[i][tid])
print(lower[tid])
points[0][tid] = 10.
It computes the axis-wise minimum of the points array. As you can see, there are two print statements in there for debugging. Also, setting the first points to [10, 10, 10] is for debugging purposes only.
So inside the kernel, aabb_lower is computed correctly. However, this doesn't "propagate" to the outside of the kernel, my variable remains unchanged. Note that this is not the case for the points, where the print outside the kernel reflects the changes, so this seems to happen only for vectors not wrapped in arrays. Is there a logical explanation for this behavior?
System Information
No response
The text was updated successfully, but these errors were encountered:
Things like vectors and scalars are passed by value, so you'll need to wrap those vectors in an array if you want to "persist" the state of those variables after running the kernel.
Bug Description
So I don't know if I'm not seeing an obvious mistake I made or if this is a bug, but I can't wrap my hand around this. I wrote this very simple kernel to get the aabb of a point cloud:
It computes the axis-wise minimum of the points array. As you can see, there are two print statements in there for debugging. Also, setting the first points to [10, 10, 10] is for debugging purposes only.
I call it like this:
I would expect
aabb_lower
andaabb_upper
to contain minimums/maximums of the points, but instead I get the following:So inside the kernel,
aabb_lower
is computed correctly. However, this doesn't "propagate" to the outside of the kernel, my variable remains unchanged. Note that this is not the case for the points, where the print outside the kernel reflects the changes, so this seems to happen only for vectors not wrapped in arrays. Is there a logical explanation for this behavior?System Information
No response
The text was updated successfully, but these errors were encountered: