warp-lang 1.1.0__py3-none-manylinux2014_x86_64.whl → 1.2.1__py3-none-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of warp-lang might be problematic. Click here for more details.
- warp/bin/warp-clang.so +0 -0
- warp/bin/warp.so +0 -0
- warp/build.py +10 -37
- warp/build_dll.py +2 -2
- warp/builtins.py +274 -6
- warp/codegen.py +51 -4
- warp/config.py +2 -2
- warp/constants.py +4 -0
- warp/context.py +422 -203
- warp/examples/benchmarks/benchmark_api.py +0 -2
- warp/examples/benchmarks/benchmark_cloth_warp.py +0 -1
- warp/examples/benchmarks/benchmark_launches.py +0 -2
- warp/examples/core/example_dem.py +0 -2
- warp/examples/core/example_fluid.py +0 -2
- warp/examples/core/example_graph_capture.py +0 -2
- warp/examples/core/example_marching_cubes.py +0 -2
- warp/examples/core/example_mesh.py +0 -2
- warp/examples/core/example_mesh_intersect.py +0 -2
- warp/examples/core/example_nvdb.py +0 -2
- warp/examples/core/example_raycast.py +0 -2
- warp/examples/core/example_raymarch.py +0 -2
- warp/examples/core/example_render_opengl.py +0 -2
- warp/examples/core/example_sph.py +0 -2
- warp/examples/core/example_torch.py +0 -3
- warp/examples/core/example_wave.py +0 -2
- warp/examples/fem/example_apic_fluid.py +140 -115
- warp/examples/fem/example_burgers.py +262 -0
- warp/examples/fem/example_convection_diffusion.py +0 -2
- warp/examples/fem/example_convection_diffusion_dg.py +0 -2
- warp/examples/fem/example_deformed_geometry.py +0 -2
- warp/examples/fem/example_diffusion.py +0 -2
- warp/examples/fem/example_diffusion_3d.py +5 -4
- warp/examples/fem/example_diffusion_mgpu.py +0 -2
- warp/examples/fem/example_mixed_elasticity.py +0 -2
- warp/examples/fem/example_navier_stokes.py +0 -2
- warp/examples/fem/example_stokes.py +0 -2
- warp/examples/fem/example_stokes_transfer.py +0 -2
- warp/examples/optim/example_bounce.py +0 -2
- warp/examples/optim/example_cloth_throw.py +0 -2
- warp/examples/optim/example_diffray.py +0 -2
- warp/examples/optim/example_drone.py +0 -2
- warp/examples/optim/example_inverse_kinematics.py +0 -2
- warp/examples/optim/example_inverse_kinematics_torch.py +0 -2
- warp/examples/optim/example_spring_cage.py +0 -2
- warp/examples/optim/example_trajectory.py +0 -2
- warp/examples/optim/example_walker.py +0 -2
- warp/examples/sim/example_cartpole.py +0 -2
- warp/examples/sim/example_cloth.py +0 -2
- warp/examples/sim/example_granular.py +0 -2
- warp/examples/sim/example_granular_collision_sdf.py +0 -2
- warp/examples/sim/example_jacobian_ik.py +0 -2
- warp/examples/sim/example_particle_chain.py +0 -2
- warp/examples/sim/example_quadruped.py +0 -2
- warp/examples/sim/example_rigid_chain.py +0 -2
- warp/examples/sim/example_rigid_contact.py +0 -2
- warp/examples/sim/example_rigid_force.py +0 -2
- warp/examples/sim/example_rigid_gyroscopic.py +0 -2
- warp/examples/sim/example_rigid_soft_contact.py +0 -2
- warp/examples/sim/example_soft_body.py +0 -2
- warp/fem/__init__.py +1 -0
- warp/fem/cache.py +3 -1
- warp/fem/geometry/__init__.py +1 -0
- warp/fem/geometry/element.py +4 -0
- warp/fem/geometry/grid_3d.py +0 -4
- warp/fem/geometry/nanogrid.py +455 -0
- warp/fem/integrate.py +63 -9
- warp/fem/space/__init__.py +43 -158
- warp/fem/space/basis_space.py +34 -0
- warp/fem/space/collocated_function_space.py +1 -1
- warp/fem/space/grid_2d_function_space.py +13 -132
- warp/fem/space/grid_3d_function_space.py +16 -154
- warp/fem/space/hexmesh_function_space.py +37 -134
- warp/fem/space/nanogrid_function_space.py +202 -0
- warp/fem/space/quadmesh_2d_function_space.py +12 -119
- warp/fem/space/restriction.py +4 -1
- warp/fem/space/shape/__init__.py +77 -0
- warp/fem/space/shape/cube_shape_function.py +5 -15
- warp/fem/space/tetmesh_function_space.py +6 -76
- warp/fem/space/trimesh_2d_function_space.py +6 -76
- warp/native/array.h +12 -3
- warp/native/builtin.h +48 -5
- warp/native/bvh.cpp +14 -10
- warp/native/bvh.cu +23 -15
- warp/native/bvh.h +1 -0
- warp/native/clang/clang.cpp +2 -1
- warp/native/crt.cpp +11 -1
- warp/native/crt.h +18 -1
- warp/native/exports.h +187 -0
- warp/native/mat.h +47 -0
- warp/native/mesh.cpp +1 -1
- warp/native/mesh.cu +1 -2
- warp/native/nanovdb/GridHandle.h +366 -0
- warp/native/nanovdb/HostBuffer.h +590 -0
- warp/native/nanovdb/NanoVDB.h +3999 -2157
- warp/native/nanovdb/PNanoVDB.h +936 -99
- warp/native/quat.h +28 -1
- warp/native/rand.h +5 -1
- warp/native/vec.h +45 -1
- warp/native/volume.cpp +335 -103
- warp/native/volume.cu +39 -13
- warp/native/volume.h +725 -303
- warp/native/volume_builder.cu +381 -360
- warp/native/volume_builder.h +16 -1
- warp/native/volume_impl.h +61 -0
- warp/native/warp.cu +8 -2
- warp/native/warp.h +15 -7
- warp/render/render_opengl.py +191 -52
- warp/sim/integrator_featherstone.py +10 -3
- warp/sim/integrator_xpbd.py +16 -22
- warp/sparse.py +89 -27
- warp/stubs.py +83 -0
- warp/tests/assets/test_index_grid.nvdb +0 -0
- warp/tests/aux_test_dependent.py +0 -2
- warp/tests/aux_test_grad_customs.py +0 -2
- warp/tests/aux_test_reference.py +0 -2
- warp/tests/aux_test_reference_reference.py +0 -2
- warp/tests/aux_test_square.py +0 -2
- warp/tests/disabled_kinematics.py +0 -2
- warp/tests/test_adam.py +0 -2
- warp/tests/test_arithmetic.py +0 -36
- warp/tests/test_array.py +9 -11
- warp/tests/test_array_reduce.py +0 -2
- warp/tests/test_async.py +0 -2
- warp/tests/test_atomic.py +0 -2
- warp/tests/test_bool.py +58 -50
- warp/tests/test_builtins_resolution.py +0 -2
- warp/tests/test_bvh.py +0 -2
- warp/tests/test_closest_point_edge_edge.py +0 -1
- warp/tests/test_codegen.py +0 -4
- warp/tests/test_compile_consts.py +130 -10
- warp/tests/test_conditional.py +0 -2
- warp/tests/test_copy.py +0 -2
- warp/tests/test_ctypes.py +6 -8
- warp/tests/test_dense.py +0 -2
- warp/tests/test_devices.py +0 -2
- warp/tests/test_dlpack.py +9 -11
- warp/tests/test_examples.py +42 -39
- warp/tests/test_fabricarray.py +0 -3
- warp/tests/test_fast_math.py +0 -2
- warp/tests/test_fem.py +75 -54
- warp/tests/test_fp16.py +0 -2
- warp/tests/test_func.py +0 -2
- warp/tests/test_generics.py +27 -2
- warp/tests/test_grad.py +147 -8
- warp/tests/test_grad_customs.py +0 -2
- warp/tests/test_hash_grid.py +1 -3
- warp/tests/test_import.py +0 -2
- warp/tests/test_indexedarray.py +0 -2
- warp/tests/test_intersect.py +0 -2
- warp/tests/test_jax.py +0 -2
- warp/tests/test_large.py +11 -9
- warp/tests/test_launch.py +0 -2
- warp/tests/test_lerp.py +10 -54
- warp/tests/test_linear_solvers.py +3 -5
- warp/tests/test_lvalue.py +0 -2
- warp/tests/test_marching_cubes.py +0 -2
- warp/tests/test_mat.py +0 -2
- warp/tests/test_mat_lite.py +0 -2
- warp/tests/test_mat_scalar_ops.py +0 -2
- warp/tests/test_math.py +0 -2
- warp/tests/test_matmul.py +35 -37
- warp/tests/test_matmul_lite.py +29 -31
- warp/tests/test_mempool.py +0 -2
- warp/tests/test_mesh.py +0 -3
- warp/tests/test_mesh_query_aabb.py +0 -2
- warp/tests/test_mesh_query_point.py +0 -2
- warp/tests/test_mesh_query_ray.py +0 -2
- warp/tests/test_mlp.py +0 -2
- warp/tests/test_model.py +0 -2
- warp/tests/test_module_hashing.py +111 -0
- warp/tests/test_modules_lite.py +0 -3
- warp/tests/test_multigpu.py +0 -2
- warp/tests/test_noise.py +0 -4
- warp/tests/test_operators.py +0 -2
- warp/tests/test_options.py +0 -2
- warp/tests/test_peer.py +0 -2
- warp/tests/test_pinned.py +0 -2
- warp/tests/test_print.py +0 -2
- warp/tests/test_quat.py +0 -2
- warp/tests/test_rand.py +41 -5
- warp/tests/test_reload.py +0 -10
- warp/tests/test_rounding.py +0 -2
- warp/tests/test_runlength_encode.py +0 -2
- warp/tests/test_sim_grad.py +0 -2
- warp/tests/test_sim_kinematics.py +0 -2
- warp/tests/test_smoothstep.py +0 -2
- warp/tests/test_snippet.py +0 -2
- warp/tests/test_sparse.py +0 -2
- warp/tests/test_spatial.py +0 -2
- warp/tests/test_special_values.py +362 -0
- warp/tests/test_streams.py +0 -2
- warp/tests/test_struct.py +0 -2
- warp/tests/test_tape.py +0 -2
- warp/tests/test_torch.py +0 -2
- warp/tests/test_transient_module.py +0 -2
- warp/tests/test_types.py +0 -2
- warp/tests/test_utils.py +0 -2
- warp/tests/test_vec.py +0 -2
- warp/tests/test_vec_lite.py +0 -2
- warp/tests/test_vec_scalar_ops.py +0 -2
- warp/tests/test_verify_fp.py +0 -2
- warp/tests/test_volume.py +237 -13
- warp/tests/test_volume_write.py +86 -3
- warp/tests/unittest_serial.py +10 -9
- warp/tests/unittest_suites.py +6 -2
- warp/tests/unittest_utils.py +2 -171
- warp/tests/unused_test_misc.py +0 -2
- warp/tests/walkthrough_debug.py +1 -1
- warp/thirdparty/unittest_parallel.py +37 -40
- warp/types.py +526 -85
- {warp_lang-1.1.0.dist-info → warp_lang-1.2.1.dist-info}/METADATA +61 -31
- warp_lang-1.2.1.dist-info/RECORD +359 -0
- warp/examples/fem/example_convection_diffusion_dg0.py +0 -204
- warp/native/nanovdb/PNanoVDBWrite.h +0 -295
- warp_lang-1.1.0.dist-info/RECORD +0 -352
- {warp_lang-1.1.0.dist-info → warp_lang-1.2.1.dist-info}/LICENSE.md +0 -0
- {warp_lang-1.1.0.dist-info → warp_lang-1.2.1.dist-info}/WHEEL +0 -0
- {warp_lang-1.1.0.dist-info → warp_lang-1.2.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
|
|
2
|
+
# NVIDIA CORPORATION and its licensors retain all intellectual property
|
|
3
|
+
# and proprietary rights in and to this software, related documentation
|
|
4
|
+
# and any modifications thereto. Any use, reproduction, disclosure or
|
|
5
|
+
# distribution of this software and related documentation without an express
|
|
6
|
+
# license agreement from NVIDIA CORPORATION is strictly prohibited.
|
|
7
|
+
|
|
8
|
+
# TODO: add more tests for kernels and generics
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import tempfile
|
|
12
|
+
import unittest
|
|
13
|
+
from importlib import util
|
|
14
|
+
|
|
15
|
+
import warp as wp
|
|
16
|
+
from warp.tests.unittest_utils import *
|
|
17
|
+
|
|
18
|
+
FUNC_OVERLOAD_1 = """# -*- coding: utf-8 -*-
|
|
19
|
+
import warp as wp
|
|
20
|
+
|
|
21
|
+
@wp.func
|
|
22
|
+
def fn():
|
|
23
|
+
wp.print(17)
|
|
24
|
+
|
|
25
|
+
@wp.func
|
|
26
|
+
def fn(value: int):
|
|
27
|
+
wp.print(value)
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
# should be same hash as FUNC_OVERLOAD_1
|
|
31
|
+
FUNC_OVERLOAD_2 = """# -*- coding: utf-8 -*-
|
|
32
|
+
import warp as wp
|
|
33
|
+
|
|
34
|
+
@wp.func
|
|
35
|
+
def fn():
|
|
36
|
+
wp.print(17)
|
|
37
|
+
|
|
38
|
+
@wp.func
|
|
39
|
+
def fn(value: int):
|
|
40
|
+
wp.print(value)
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
# should be different hash than FUNC_OVERLOAD_1 (first overload is different)
|
|
44
|
+
FUNC_OVERLOAD_3 = """# -*- coding: utf-8 -*-
|
|
45
|
+
import warp as wp
|
|
46
|
+
|
|
47
|
+
@wp.func
|
|
48
|
+
def fn():
|
|
49
|
+
wp.print(42)
|
|
50
|
+
|
|
51
|
+
@wp.func
|
|
52
|
+
def fn(value: int):
|
|
53
|
+
wp.print(value)
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
# should be different hash than FUNC_OVERLOAD_1 (second overload is different)
|
|
57
|
+
FUNC_OVERLOAD_4 = """# -*- coding: utf-8 -*-
|
|
58
|
+
import warp as wp
|
|
59
|
+
|
|
60
|
+
@wp.func
|
|
61
|
+
def fn():
|
|
62
|
+
wp.print(17)
|
|
63
|
+
|
|
64
|
+
@wp.func
|
|
65
|
+
def fn(value: int):
|
|
66
|
+
wp.print(value + 1)
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def load_code_as_module(code, name):
|
|
71
|
+
file, file_path = tempfile.mkstemp(suffix=".py")
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
with os.fdopen(file, "w") as f:
|
|
75
|
+
f.write(code)
|
|
76
|
+
|
|
77
|
+
spec = util.spec_from_file_location(name, file_path)
|
|
78
|
+
module = util.module_from_spec(spec)
|
|
79
|
+
spec.loader.exec_module(module)
|
|
80
|
+
finally:
|
|
81
|
+
os.remove(file_path)
|
|
82
|
+
|
|
83
|
+
return wp.get_module(module.__name__)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_function_overload_hashing(test, device):
|
|
87
|
+
m1 = load_code_as_module(FUNC_OVERLOAD_1, "func_overload_1")
|
|
88
|
+
m2 = load_code_as_module(FUNC_OVERLOAD_2, "func_overload_2")
|
|
89
|
+
m3 = load_code_as_module(FUNC_OVERLOAD_3, "func_overload_3")
|
|
90
|
+
m4 = load_code_as_module(FUNC_OVERLOAD_4, "func_overload_4")
|
|
91
|
+
|
|
92
|
+
hash1 = m1.hash_module()
|
|
93
|
+
hash2 = m2.hash_module()
|
|
94
|
+
hash3 = m3.hash_module()
|
|
95
|
+
hash4 = m4.hash_module()
|
|
96
|
+
|
|
97
|
+
test.assertEqual(hash2, hash1)
|
|
98
|
+
test.assertNotEqual(hash3, hash1)
|
|
99
|
+
test.assertNotEqual(hash4, hash1)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class TestModuleHashing(unittest.TestCase):
|
|
103
|
+
pass
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
add_function_test(TestModuleHashing, "test_function_overload_hashing", test_function_overload_hashing)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
wp.build.clear_kernel_cache()
|
|
111
|
+
unittest.main(verbosity=2)
|
warp/tests/test_modules_lite.py
CHANGED
warp/tests/test_multigpu.py
CHANGED
warp/tests/test_noise.py
CHANGED
warp/tests/test_operators.py
CHANGED
warp/tests/test_options.py
CHANGED
warp/tests/test_peer.py
CHANGED
warp/tests/test_pinned.py
CHANGED
warp/tests/test_print.py
CHANGED
warp/tests/test_quat.py
CHANGED
warp/tests/test_rand.py
CHANGED
|
@@ -12,11 +12,6 @@ import numpy as np
|
|
|
12
12
|
import warp as wp
|
|
13
13
|
from warp.tests.unittest_utils import *
|
|
14
14
|
|
|
15
|
-
# import matplotlib.pyplot as plt
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
wp.init()
|
|
19
|
-
|
|
20
15
|
|
|
21
16
|
@wp.kernel
|
|
22
17
|
def test_kernel(
|
|
@@ -113,6 +108,46 @@ def test_rand(test, device):
|
|
|
113
108
|
test.assertTrue(err < 1e-04)
|
|
114
109
|
|
|
115
110
|
|
|
111
|
+
@wp.kernel
|
|
112
|
+
def randn_kernel(
|
|
113
|
+
x: wp.array(dtype=float),
|
|
114
|
+
):
|
|
115
|
+
tid = wp.tid()
|
|
116
|
+
r = wp.rand_init(tid)
|
|
117
|
+
x[tid] = wp.randn(r)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def test_randn(test, device):
|
|
121
|
+
N = 100000000
|
|
122
|
+
|
|
123
|
+
samples = wp.zeros(N, dtype=float, device=device)
|
|
124
|
+
|
|
125
|
+
wp.launch(randn_kernel, inputs=[samples], dim=N, device=device)
|
|
126
|
+
|
|
127
|
+
randn_samples = samples.numpy()
|
|
128
|
+
|
|
129
|
+
test.assertFalse(np.any(np.isinf(randn_samples)))
|
|
130
|
+
test.assertFalse(np.any(np.isnan(randn_samples)))
|
|
131
|
+
|
|
132
|
+
randn_true = np.array(
|
|
133
|
+
[
|
|
134
|
+
-1.8213255,
|
|
135
|
+
0.27881497,
|
|
136
|
+
-1.1122388,
|
|
137
|
+
0.5936895,
|
|
138
|
+
0.04976363,
|
|
139
|
+
0.69087356,
|
|
140
|
+
0.2935363,
|
|
141
|
+
0.8405019,
|
|
142
|
+
-0.8436684,
|
|
143
|
+
0.53108305,
|
|
144
|
+
]
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
err = np.max(np.abs(randn_samples[0:10] - randn_true))
|
|
148
|
+
test.assertTrue(err < 1e-04)
|
|
149
|
+
|
|
150
|
+
|
|
116
151
|
@wp.kernel
|
|
117
152
|
def sample_cdf_kernel(kernel_seed: int, cdf: wp.array(dtype=float), samples: wp.array(dtype=int)):
|
|
118
153
|
tid = wp.tid()
|
|
@@ -278,6 +313,7 @@ class TestRand(unittest.TestCase):
|
|
|
278
313
|
|
|
279
314
|
|
|
280
315
|
add_function_test(TestRand, "test_rand", test_rand, devices=devices)
|
|
316
|
+
add_function_test(TestRand, "test_randn", test_randn, devices=devices)
|
|
281
317
|
add_function_test(TestRand, "test_sample_cdf", test_sample_cdf, devices=devices)
|
|
282
318
|
add_function_test(TestRand, "test_sampling_methods", test_sampling_methods, devices=devices)
|
|
283
319
|
add_function_test(TestRand, "test_poisson", test_poisson, devices=devices)
|
warp/tests/test_reload.py
CHANGED
|
@@ -22,8 +22,6 @@ import warp.tests.aux_test_reference_reference as test_reference_reference
|
|
|
22
22
|
import warp.tests.aux_test_square as test_square
|
|
23
23
|
from warp.tests.unittest_utils import *
|
|
24
24
|
|
|
25
|
-
wp.init()
|
|
26
|
-
|
|
27
25
|
|
|
28
26
|
def reload_module(module):
|
|
29
27
|
# Clearing the .pyc file associated with a module is a necessary workaround
|
|
@@ -68,8 +66,6 @@ def test_redefine(test, device):
|
|
|
68
66
|
|
|
69
67
|
square_two = """import warp as wp
|
|
70
68
|
|
|
71
|
-
wp.init()
|
|
72
|
-
|
|
73
69
|
|
|
74
70
|
@wp.func
|
|
75
71
|
def sqr(x: float):
|
|
@@ -87,8 +83,6 @@ def run(expect, device):
|
|
|
87
83
|
|
|
88
84
|
square_four = """import warp as wp
|
|
89
85
|
|
|
90
|
-
wp.init()
|
|
91
|
-
|
|
92
86
|
|
|
93
87
|
@wp.func
|
|
94
88
|
def multiply(x: float):
|
|
@@ -148,8 +142,6 @@ template_ref = """# This file is used to test reloading module references.
|
|
|
148
142
|
import warp as wp
|
|
149
143
|
import warp.tests.aux_test_reference_reference as refref
|
|
150
144
|
|
|
151
|
-
wp.init()
|
|
152
|
-
|
|
153
145
|
|
|
154
146
|
@wp.func
|
|
155
147
|
def magic():
|
|
@@ -160,8 +152,6 @@ template_refref = """# This file is used to test reloading module references.
|
|
|
160
152
|
|
|
161
153
|
import warp as wp
|
|
162
154
|
|
|
163
|
-
wp.init()
|
|
164
|
-
|
|
165
155
|
|
|
166
156
|
@wp.func
|
|
167
157
|
def more_magic():
|
warp/tests/test_rounding.py
CHANGED
warp/tests/test_sim_grad.py
CHANGED
warp/tests/test_smoothstep.py
CHANGED
warp/tests/test_snippet.py
CHANGED
warp/tests/test_sparse.py
CHANGED