Skip to content

Commit

Permalink
Merge branch 'ccrouzet/init-with-tape' into 'main'
Browse files Browse the repository at this point in the history
Initialize Warp When Entering a `wp.Tape` Context

See merge request omniverse/warp!766
  • Loading branch information
mmacklin committed Sep 30, 2024
2 parents 7fc83e1 + 924fef8 commit ee08b03
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
- Fix printing Boolean and 8-bit integer values.
- Fix array interface type strings used for Boolean and 8-bit integer values.
- Fix initialization error when setting struct members.
- Fix Warp not being initialized upon entering a `wp.Tape` context.

## [1.3.3] - 2024-09-04

Expand Down
2 changes: 2 additions & 0 deletions warp/tape.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def __init__(self):
self.loss = None

def __enter__(self):
wp.context.init()

if wp.context.runtime.tape is not None:
raise RuntimeError("Warp: Error, entering a tape while one is already active")

Expand Down
21 changes: 21 additions & 0 deletions warp/tests/test_implicit_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,27 @@ class TestImplicitInitStructMemberInit(unittest.TestCase):
)


# Tape
# ------------------------------------------------------------------------------


def test_tape(test, device):
with wp.Tape():
pass


class TestImplicitInitTape(unittest.TestCase):
pass


add_function_test(
TestImplicitInitTape,
"test_tape",
test_tape,
check_output=False,
)


if __name__ == "__main__":
# Do not clear the kernel cache or call anything that would initialize Warp
# since these tests are specifically aiming to catch issues where Warp isn't
Expand Down

0 comments on commit ee08b03

Please sign in to comment.