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
I have observed that a variable which is defined outside the kernel and not passed to it either, is accessible by name within the kernel. Please check the code below
import warp as wp
import numpy as np
wp.init()
@wp.kernel
def calculations(J : int):
i = wp.tid()
wp.printf('\n p val is %d', p)
Variable p is not being passed onto the kernel but when I run the code, the print statement gives the value of p that I have defined.
Is this an expected behavior or a bug?
The text was updated successfully, but these errors were encountered:
Hi @nithinsomu, it is expected - this is mostly to support the case where you have some numeric constants in global scope that you would like to access in the kernel. Typically these should be declared with value = wp.constant(3.141) syntax (which will ensure that kernel caching etc works correctly).
I have observed that a variable which is defined outside the kernel and not passed to it either, is accessible by name within the kernel. Please check the code below
import warp as wp
import numpy as np
wp.init()
@wp.kernel
def calculations(J : int):
i = wp.tid()
wp.printf('\n p val is %d', p)
p= 10
J = 5
wp.launch(calculations, dim=1, inputs=[J])
Variable p is not being passed onto the kernel but when I run the code, the print statement gives the value of p that I have defined.
Is this an expected behavior or a bug?
The text was updated successfully, but these errors were encountered: