Error on warp kernel

Hello,
i have an OS level error while trying and running a little test program that uses the warp extension (activated in code). The program is this:

import warp as wp
import numpy as np

@wp.kernel
def add(a: wp.array(dtype=float)):
i=wp.tid()
a[i]+=1.0
return;

array=wp.array(1024, dtype=float, device=“cuda”)
wp.launch(kernel=add, dim=1024, inputs=[array], device=“cuda”)

and it yields this error:

2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] [py stderr]: OSError: could not get source code
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin]
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] At:
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] /home/paolo/.local/share/ov/pkg/deps/691541202ea2678c05b45f92ff5d1d8c/python/lib/python3.7/inspect.py(786): findsource
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] /home/paolo/.local/share/ov/pkg/deps/691541202ea2678c05b45f92ff5d1d8c/python/lib/python3.7/inspect.py(955): getsourcelines
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] /home/paolo/.local/share/ov/pkg/deps/691541202ea2678c05b45f92ff5d1d8c/python/lib/python3.7/inspect.py(973): getsource
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] /home/paolo/.local/share/ov/pkg/deps/7c44b65c46ba8b7ef0a7f2f8232f2685/extscache/omni.warp-0.2.2+cp37/warp/codegen.py(107): init
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] /home/paolo/.local/share/ov/pkg/deps/7c44b65c46ba8b7ef0a7f2f8232f2685/extscache/omni.warp-0.2.2+cp37/warp/context.py(252): init
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] /home/paolo/.local/share/ov/pkg/deps/7c44b65c46ba8b7ef0a7f2f8232f2685/extscache/omni.warp-0.2.2+cp37/warp/context.py(302): kernel
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin] executing: Python 0…(5):
2022-08-15 09:29:20 [Error] [omni.kit.app.plugin]

Am I making something wrong?
Thankyou

Paolo

Someone on Discord mentioned that you can’t use the += operator. You want to expand that as:

a[i] = a[i] + 1.0

Also, you forgot to include wp.init(). Let me know if that doesn’t work.

Hello Mati,
the error rises only when a decorator @wp.kernel is juxtaposed.
I tried to correct the += operator with = + but no way
I just uninstalled and reinstalled code still no way.
I downloaded an warp example from github and still no way
The returned error is the same:

2022-08-15 20:59:53 [1,062,570ms] [Error] [omni.kit.app.plugin] [py stderr]: OSError: could not get source code

At:
/home/paolo/.local/share/ov/pkg/deps/7817e2526e42b831a0b672f240c251c4/python/lib/python3.7/inspect.py(786): findsource
/home/paolo/.local/share/ov/pkg/deps/7817e2526e42b831a0b672f240c251c4/python/lib/python3.7/inspect.py(955): getsourcelines
/home/paolo/.local/share/ov/pkg/deps/7817e2526e42b831a0b672f240c251c4/python/lib/python3.7/inspect.py(973): getsource
/home/paolo/.local/share/ov/pkg/deps/efa7126ac28229139e663ee7442c7aa9/extscache/omni.warp-0.2.2+cp37/warp/codegen.py(107): init
/home/paolo/.local/share/ov/pkg/deps/efa7126ac28229139e663ee7442c7aa9/extscache/omni.warp-0.2.2+cp37/warp/context.py(252): init
/home/paolo/.local/share/ov/pkg/deps/efa7126ac28229139e663ee7442c7aa9/extscache/omni.warp-0.2.2+cp37/warp/context.py(302): kernel
executing: Python 0…(5):

while the program is now:
import warp as wp
import numpy as np

@wp.kernel
def add(a: wp.array(dtype=float)):
i=wp.tid()
a[i]=a[i] + 1.0
return;

print(“Hello”)
wp.init()
array=wp.array(1024, dtype=float, device=“cuda”)
wp.launch(kernel=add, dim=1024, inputs=[array], device=“cuda”)

Just to follow-up here. We continued the conversation on Discord. Looks like the issue is that there is a bug with reading warp source code from __main__. The dev team is looking into to and the workaround is to work from within an Extension or OmniGraph node.

Hello,
ok thankyou for you kind update
Paolo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.