Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Add Pickling support for Warp kernels #413

Open
eric-heiden opened this issue Jan 3, 2025 · 0 comments
Open

[REQUEST] Add Pickling support for Warp kernels #413

eric-heiden opened this issue Jan 3, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@eric-heiden
Copy link
Contributor

Description

It is currently not possible to pickle Warp kernels.

Example:

import warp as wp
import pickle

@wp.kernel
def my_kernel(xs: wp.array(dtype=float), ys: wp.array(dtype=float)):
    tid = wp.tid()
    ys[tid] = xs[tid] * 2.0

pickled_kernel = pickle.dumps(my_kernel)

yields the error:

_pickle.PicklingError: Can't pickle <function my_kernel at 0x0000020199CA9000>: it's not the same object as __main__.my_kernel

Context

Being able to pickle kernels is necessary to save PyTorch models that contain Warp kernels. torch.save() uses pickle (or a user-provided pickling module) to store the models, which fails.

@eric-heiden eric-heiden added the enhancement New feature or request label Jan 3, 2025
@eric-heiden eric-heiden self-assigned this Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant