warp-lang 1.0.0b5__py3-none-manylinux2014_x86_64.whl → 1.0.0b6__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.
Files changed (187) hide show
  1. docs/conf.py +3 -4
  2. examples/env/env_ant.py +1 -1
  3. examples/env/env_cartpole.py +1 -1
  4. examples/env/env_humanoid.py +1 -1
  5. examples/example_dem.py +28 -26
  6. examples/example_diffray.py +37 -30
  7. examples/example_fluid.py +7 -3
  8. examples/example_jacobian_ik.py +1 -1
  9. examples/example_mesh_intersect.py +10 -7
  10. examples/example_nvdb.py +3 -3
  11. examples/example_render_opengl.py +19 -10
  12. examples/example_sim_cartpole.py +9 -5
  13. examples/example_sim_cloth.py +29 -25
  14. examples/example_sim_fk_grad.py +2 -2
  15. examples/example_sim_fk_grad_torch.py +3 -3
  16. examples/example_sim_grad_bounce.py +11 -8
  17. examples/example_sim_grad_cloth.py +12 -9
  18. examples/example_sim_granular.py +2 -2
  19. examples/example_sim_granular_collision_sdf.py +13 -13
  20. examples/example_sim_neo_hookean.py +3 -3
  21. examples/example_sim_particle_chain.py +2 -2
  22. examples/example_sim_quadruped.py +8 -5
  23. examples/example_sim_rigid_chain.py +8 -5
  24. examples/example_sim_rigid_contact.py +13 -10
  25. examples/example_sim_rigid_fem.py +2 -2
  26. examples/example_sim_rigid_gyroscopic.py +2 -2
  27. examples/example_sim_rigid_kinematics.py +1 -1
  28. examples/example_sim_trajopt.py +3 -2
  29. examples/fem/example_apic_fluid.py +5 -7
  30. examples/fem/example_diffusion_mgpu.py +18 -16
  31. warp/__init__.py +3 -2
  32. warp/bin/warp.so +0 -0
  33. warp/build_dll.py +29 -9
  34. warp/builtins.py +206 -7
  35. warp/codegen.py +58 -38
  36. warp/config.py +3 -1
  37. warp/context.py +234 -128
  38. warp/fem/__init__.py +2 -2
  39. warp/fem/cache.py +2 -1
  40. warp/fem/field/nodal_field.py +18 -17
  41. warp/fem/geometry/hexmesh.py +11 -6
  42. warp/fem/geometry/quadmesh_2d.py +16 -12
  43. warp/fem/geometry/tetmesh.py +19 -8
  44. warp/fem/geometry/trimesh_2d.py +18 -7
  45. warp/fem/integrate.py +341 -196
  46. warp/fem/quadrature/__init__.py +1 -1
  47. warp/fem/quadrature/pic_quadrature.py +138 -53
  48. warp/fem/quadrature/quadrature.py +81 -9
  49. warp/fem/space/__init__.py +1 -1
  50. warp/fem/space/basis_space.py +169 -51
  51. warp/fem/space/grid_2d_function_space.py +2 -2
  52. warp/fem/space/grid_3d_function_space.py +2 -2
  53. warp/fem/space/hexmesh_function_space.py +2 -2
  54. warp/fem/space/partition.py +9 -6
  55. warp/fem/space/quadmesh_2d_function_space.py +2 -2
  56. warp/fem/space/shape/cube_shape_function.py +27 -15
  57. warp/fem/space/shape/square_shape_function.py +29 -18
  58. warp/fem/space/tetmesh_function_space.py +2 -2
  59. warp/fem/space/topology.py +10 -0
  60. warp/fem/space/trimesh_2d_function_space.py +2 -2
  61. warp/fem/utils.py +10 -5
  62. warp/native/array.h +49 -8
  63. warp/native/builtin.h +31 -14
  64. warp/native/cuda_util.cpp +8 -3
  65. warp/native/cuda_util.h +1 -0
  66. warp/native/exports.h +1177 -1108
  67. warp/native/intersect.h +4 -4
  68. warp/native/intersect_adj.h +8 -8
  69. warp/native/mat.h +65 -6
  70. warp/native/mesh.h +126 -5
  71. warp/native/quat.h +28 -4
  72. warp/native/vec.h +76 -14
  73. warp/native/warp.cu +1 -6
  74. warp/render/render_opengl.py +261 -109
  75. warp/sim/import_mjcf.py +13 -7
  76. warp/sim/import_urdf.py +14 -14
  77. warp/sim/inertia.py +17 -18
  78. warp/sim/model.py +67 -67
  79. warp/sim/render.py +1 -1
  80. warp/sparse.py +6 -6
  81. warp/stubs.py +19 -81
  82. warp/tape.py +1 -1
  83. warp/tests/__main__.py +3 -6
  84. warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
  85. warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
  86. warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
  87. warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
  88. warp/tests/aux_test_unresolved_func.py +14 -0
  89. warp/tests/aux_test_unresolved_symbol.py +14 -0
  90. warp/tests/{test_kinematics.py → disabled_kinematics.py} +10 -12
  91. warp/tests/run_coverage_serial.py +31 -0
  92. warp/tests/test_adam.py +102 -106
  93. warp/tests/test_arithmetic.py +39 -40
  94. warp/tests/test_array.py +46 -48
  95. warp/tests/test_array_reduce.py +25 -19
  96. warp/tests/test_atomic.py +62 -26
  97. warp/tests/test_bool.py +16 -11
  98. warp/tests/test_builtins_resolution.py +1292 -0
  99. warp/tests/test_bvh.py +9 -12
  100. warp/tests/test_closest_point_edge_edge.py +53 -57
  101. warp/tests/test_codegen.py +164 -134
  102. warp/tests/test_compile_consts.py +13 -19
  103. warp/tests/test_conditional.py +30 -32
  104. warp/tests/test_copy.py +9 -12
  105. warp/tests/test_ctypes.py +90 -98
  106. warp/tests/test_dense.py +20 -14
  107. warp/tests/test_devices.py +34 -35
  108. warp/tests/test_dlpack.py +74 -75
  109. warp/tests/test_examples.py +215 -97
  110. warp/tests/test_fabricarray.py +15 -21
  111. warp/tests/test_fast_math.py +14 -11
  112. warp/tests/test_fem.py +280 -97
  113. warp/tests/test_fp16.py +19 -15
  114. warp/tests/test_func.py +177 -194
  115. warp/tests/test_generics.py +71 -77
  116. warp/tests/test_grad.py +83 -32
  117. warp/tests/test_grad_customs.py +7 -9
  118. warp/tests/test_hash_grid.py +6 -10
  119. warp/tests/test_import.py +9 -23
  120. warp/tests/test_indexedarray.py +19 -21
  121. warp/tests/test_intersect.py +15 -9
  122. warp/tests/test_large.py +17 -19
  123. warp/tests/test_launch.py +14 -17
  124. warp/tests/test_lerp.py +63 -63
  125. warp/tests/test_lvalue.py +84 -35
  126. warp/tests/test_marching_cubes.py +9 -13
  127. warp/tests/test_mat.py +388 -3004
  128. warp/tests/test_mat_lite.py +9 -12
  129. warp/tests/test_mat_scalar_ops.py +2889 -0
  130. warp/tests/test_math.py +10 -11
  131. warp/tests/test_matmul.py +104 -100
  132. warp/tests/test_matmul_lite.py +72 -98
  133. warp/tests/test_mesh.py +35 -32
  134. warp/tests/test_mesh_query_aabb.py +18 -25
  135. warp/tests/test_mesh_query_point.py +39 -23
  136. warp/tests/test_mesh_query_ray.py +9 -21
  137. warp/tests/test_mlp.py +8 -9
  138. warp/tests/test_model.py +89 -93
  139. warp/tests/test_modules_lite.py +15 -25
  140. warp/tests/test_multigpu.py +87 -114
  141. warp/tests/test_noise.py +10 -12
  142. warp/tests/test_operators.py +14 -21
  143. warp/tests/test_options.py +10 -11
  144. warp/tests/test_pinned.py +16 -18
  145. warp/tests/test_print.py +16 -20
  146. warp/tests/test_quat.py +121 -88
  147. warp/tests/test_rand.py +12 -13
  148. warp/tests/test_reload.py +27 -32
  149. warp/tests/test_rounding.py +7 -10
  150. warp/tests/test_runlength_encode.py +105 -106
  151. warp/tests/test_smoothstep.py +8 -9
  152. warp/tests/test_snippet.py +13 -22
  153. warp/tests/test_sparse.py +30 -29
  154. warp/tests/test_spatial.py +179 -174
  155. warp/tests/test_streams.py +100 -107
  156. warp/tests/test_struct.py +98 -67
  157. warp/tests/test_tape.py +11 -17
  158. warp/tests/test_torch.py +89 -86
  159. warp/tests/test_transient_module.py +9 -12
  160. warp/tests/test_types.py +328 -50
  161. warp/tests/test_utils.py +217 -218
  162. warp/tests/test_vec.py +133 -2133
  163. warp/tests/test_vec_lite.py +8 -11
  164. warp/tests/test_vec_scalar_ops.py +2099 -0
  165. warp/tests/test_volume.py +391 -382
  166. warp/tests/test_volume_write.py +122 -135
  167. warp/tests/unittest_serial.py +35 -0
  168. warp/tests/unittest_suites.py +291 -0
  169. warp/tests/{test_base.py → unittest_utils.py} +138 -25
  170. warp/tests/{test_misc.py → unused_test_misc.py} +13 -5
  171. warp/tests/{test_debug.py → walkthough_debug.py} +2 -15
  172. warp/thirdparty/unittest_parallel.py +257 -54
  173. warp/types.py +119 -98
  174. warp/utils.py +14 -0
  175. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/METADATA +2 -1
  176. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/RECORD +182 -178
  177. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/WHEEL +1 -1
  178. warp/tests/test_all.py +0 -239
  179. warp/tests/test_conditional_unequal_types_kernels.py +0 -14
  180. warp/tests/test_coverage.py +0 -38
  181. warp/tests/test_unresolved_func.py +0 -7
  182. warp/tests/test_unresolved_symbol.py +0 -7
  183. /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
  184. /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
  185. /warp/tests/{test_square.py → aux_test_square.py} +0 -0
  186. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/LICENSE.md +0 -0
  187. {warp_lang-1.0.0b5.dist-info → warp_lang-1.0.0b6.dist-info}/top_level.txt +0 -0
warp/tests/test_quat.py CHANGED
@@ -1,9 +1,16 @@
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
+
1
8
  import unittest
2
9
 
3
10
  import numpy as np
4
11
 
5
12
  import warp as wp
6
- from warp.tests.test_base import *
13
+ from warp.tests.unittest_utils import *
7
14
 
8
15
  wp.init()
9
16
 
@@ -1932,99 +1939,125 @@ def test_constructor_default():
1932
1939
  wp.expect_eq(qeye[3], 1.0)
1933
1940
 
1934
1941
 
1935
- def register(parent):
1936
- devices = get_test_devices()
1942
+ def test_py_arithmetic_ops(test, device, dtype):
1943
+ wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
1937
1944
 
1938
- class TestQuat(parent):
1939
- pass
1945
+ def make_quat(*args):
1946
+ if wptype in wp.types.int_types:
1947
+ # Cast to the correct integer type to simulate wrapping.
1948
+ return tuple(wptype._type_(x).value for x in args)
1940
1949
 
1941
- add_kernel_test(TestQuat, test_constructor_default, dim=1, devices=devices)
1950
+ return args
1942
1951
 
1943
- for dtype in np_float_types:
1944
- add_function_test_register_kernel(
1945
- TestQuat, f"test_constructors_{dtype.__name__}", test_constructors, devices=devices, dtype=dtype
1946
- )
1947
- add_function_test_register_kernel(
1948
- TestQuat,
1949
- f"test_casting_constructors_{dtype.__name__}",
1950
- test_casting_constructors,
1951
- devices=devices,
1952
- dtype=dtype,
1953
- )
1954
- add_function_test_register_kernel(
1955
- TestQuat, f"test_anon_type_instance_{dtype.__name__}", test_anon_type_instance, devices=devices, dtype=dtype
1956
- )
1957
- add_function_test_register_kernel(
1958
- TestQuat, f"test_inverse_{dtype.__name__}", test_inverse, devices=devices, dtype=dtype
1959
- )
1960
- add_function_test_register_kernel(
1961
- TestQuat, f"test_quat_identity_{dtype.__name__}", test_quat_identity, devices=devices, dtype=dtype
1962
- )
1963
- add_function_test_register_kernel(
1964
- TestQuat, f"test_dotproduct_{dtype.__name__}", test_dotproduct, devices=devices, dtype=dtype
1965
- )
1966
- add_function_test_register_kernel(
1967
- TestQuat, f"test_length_{dtype.__name__}", test_length, devices=devices, dtype=dtype
1968
- )
1969
- add_function_test_register_kernel(
1970
- TestQuat, f"test_normalize_{dtype.__name__}", test_normalize, devices=devices, dtype=dtype
1971
- )
1972
- add_function_test_register_kernel(
1973
- TestQuat, f"test_addition_{dtype.__name__}", test_addition, devices=devices, dtype=dtype
1974
- )
1975
- add_function_test_register_kernel(
1976
- TestQuat, f"test_subtraction_{dtype.__name__}", test_subtraction, devices=devices, dtype=dtype
1977
- )
1978
- add_function_test_register_kernel(
1979
- TestQuat,
1980
- f"test_scalar_multiplication_{dtype.__name__}",
1981
- test_scalar_multiplication,
1982
- devices=devices,
1983
- dtype=dtype,
1984
- )
1985
- add_function_test_register_kernel(
1986
- TestQuat, f"test_scalar_division_{dtype.__name__}", test_scalar_division, devices=devices, dtype=dtype
1987
- )
1988
- add_function_test_register_kernel(
1989
- TestQuat,
1990
- f"test_quat_multiplication_{dtype.__name__}",
1991
- test_quat_multiplication,
1992
- devices=devices,
1993
- dtype=dtype,
1994
- )
1995
- add_function_test_register_kernel(
1996
- TestQuat, f"test_indexing_{dtype.__name__}", test_indexing, devices=devices, dtype=dtype
1997
- )
1998
- add_function_test_register_kernel(
1999
- TestQuat, f"test_quat_lerp_{dtype.__name__}", test_quat_lerp, devices=devices, dtype=dtype
2000
- )
2001
- add_function_test_register_kernel(
2002
- TestQuat,
2003
- f"test_quat_to_axis_angle_grad_{dtype.__name__}",
2004
- test_quat_to_axis_angle_grad,
2005
- devices=devices,
2006
- dtype=dtype,
2007
- )
2008
- add_function_test_register_kernel(
2009
- TestQuat, f"test_slerp_grad_{dtype.__name__}", test_slerp_grad, devices=devices, dtype=dtype
2010
- )
2011
- add_function_test_register_kernel(
2012
- TestQuat, f"test_quat_rpy_grad_{dtype.__name__}", test_quat_rpy_grad, devices=devices, dtype=dtype
2013
- )
2014
- add_function_test_register_kernel(
2015
- TestQuat, f"test_quat_from_matrix_{dtype.__name__}", test_quat_from_matrix, devices=devices, dtype=dtype
2016
- )
2017
- add_function_test_register_kernel(
2018
- TestQuat, f"test_quat_rotate_{dtype.__name__}", test_quat_rotate, devices=devices, dtype=dtype
2019
- )
2020
- add_function_test_register_kernel(
2021
- TestQuat, f"test_quat_to_matrix_{dtype.__name__}", test_quat_to_matrix, devices=devices, dtype=dtype
2022
- )
1952
+ quat_cls = wp.types.quaternion(wptype)
1953
+
1954
+ v = quat_cls(1, -2, 3, -4)
1955
+ test.assertSequenceEqual(+v, make_quat(1, -2, 3, -4))
1956
+ test.assertSequenceEqual(-v, make_quat(-1, 2, -3, 4))
1957
+ test.assertSequenceEqual(v + quat_cls(5, 5, 5, 5), make_quat(6, 3, 8, 1))
1958
+ test.assertSequenceEqual(v - quat_cls(5, 5, 5, 5), make_quat(-4, -7, -2, -9))
1959
+
1960
+ v = quat_cls(2, 4, 6, 8)
1961
+ test.assertSequenceEqual(v * wptype(2), make_quat(4, 8, 12, 16))
1962
+ test.assertSequenceEqual(wptype(2) * v, make_quat(4, 8, 12, 16))
1963
+ test.assertSequenceEqual(v / wptype(2), make_quat(1, 2, 3, 4))
1964
+ test.assertSequenceEqual(wptype(24) / v, make_quat(12, 6, 4, 3))
1965
+
1966
+
1967
+ devices = get_test_devices()
2023
1968
 
2024
- return TestQuat
1969
+
1970
+ class TestQuat(unittest.TestCase):
1971
+ pass
1972
+
1973
+
1974
+ add_kernel_test(TestQuat, test_constructor_default, dim=1, devices=devices)
1975
+
1976
+ for dtype in np_float_types:
1977
+ add_function_test_register_kernel(
1978
+ TestQuat, f"test_constructors_{dtype.__name__}", test_constructors, devices=devices, dtype=dtype
1979
+ )
1980
+ add_function_test_register_kernel(
1981
+ TestQuat,
1982
+ f"test_casting_constructors_{dtype.__name__}",
1983
+ test_casting_constructors,
1984
+ devices=devices,
1985
+ dtype=dtype,
1986
+ )
1987
+ add_function_test_register_kernel(
1988
+ TestQuat, f"test_anon_type_instance_{dtype.__name__}", test_anon_type_instance, devices=devices, dtype=dtype
1989
+ )
1990
+ add_function_test_register_kernel(
1991
+ TestQuat, f"test_inverse_{dtype.__name__}", test_inverse, devices=devices, dtype=dtype
1992
+ )
1993
+ add_function_test_register_kernel(
1994
+ TestQuat, f"test_quat_identity_{dtype.__name__}", test_quat_identity, devices=devices, dtype=dtype
1995
+ )
1996
+ add_function_test_register_kernel(
1997
+ TestQuat, f"test_dotproduct_{dtype.__name__}", test_dotproduct, devices=devices, dtype=dtype
1998
+ )
1999
+ add_function_test_register_kernel(
2000
+ TestQuat, f"test_length_{dtype.__name__}", test_length, devices=devices, dtype=dtype
2001
+ )
2002
+ add_function_test_register_kernel(
2003
+ TestQuat, f"test_normalize_{dtype.__name__}", test_normalize, devices=devices, dtype=dtype
2004
+ )
2005
+ add_function_test_register_kernel(
2006
+ TestQuat, f"test_addition_{dtype.__name__}", test_addition, devices=devices, dtype=dtype
2007
+ )
2008
+ add_function_test_register_kernel(
2009
+ TestQuat, f"test_subtraction_{dtype.__name__}", test_subtraction, devices=devices, dtype=dtype
2010
+ )
2011
+ add_function_test_register_kernel(
2012
+ TestQuat,
2013
+ f"test_scalar_multiplication_{dtype.__name__}",
2014
+ test_scalar_multiplication,
2015
+ devices=devices,
2016
+ dtype=dtype,
2017
+ )
2018
+ add_function_test_register_kernel(
2019
+ TestQuat, f"test_scalar_division_{dtype.__name__}", test_scalar_division, devices=devices, dtype=dtype
2020
+ )
2021
+ add_function_test_register_kernel(
2022
+ TestQuat,
2023
+ f"test_quat_multiplication_{dtype.__name__}",
2024
+ test_quat_multiplication,
2025
+ devices=devices,
2026
+ dtype=dtype,
2027
+ )
2028
+ add_function_test_register_kernel(
2029
+ TestQuat, f"test_indexing_{dtype.__name__}", test_indexing, devices=devices, dtype=dtype
2030
+ )
2031
+ add_function_test_register_kernel(
2032
+ TestQuat, f"test_quat_lerp_{dtype.__name__}", test_quat_lerp, devices=devices, dtype=dtype
2033
+ )
2034
+ add_function_test_register_kernel(
2035
+ TestQuat,
2036
+ f"test_quat_to_axis_angle_grad_{dtype.__name__}",
2037
+ test_quat_to_axis_angle_grad,
2038
+ devices=devices,
2039
+ dtype=dtype,
2040
+ )
2041
+ add_function_test_register_kernel(
2042
+ TestQuat, f"test_slerp_grad_{dtype.__name__}", test_slerp_grad, devices=devices, dtype=dtype
2043
+ )
2044
+ add_function_test_register_kernel(
2045
+ TestQuat, f"test_quat_rpy_grad_{dtype.__name__}", test_quat_rpy_grad, devices=devices, dtype=dtype
2046
+ )
2047
+ add_function_test_register_kernel(
2048
+ TestQuat, f"test_quat_from_matrix_{dtype.__name__}", test_quat_from_matrix, devices=devices, dtype=dtype
2049
+ )
2050
+ add_function_test_register_kernel(
2051
+ TestQuat, f"test_quat_rotate_{dtype.__name__}", test_quat_rotate, devices=devices, dtype=dtype
2052
+ )
2053
+ add_function_test_register_kernel(
2054
+ TestQuat, f"test_quat_to_matrix_{dtype.__name__}", test_quat_to_matrix, devices=devices, dtype=dtype
2055
+ )
2056
+ add_function_test(
2057
+ TestQuat, f"test_py_arithmetic_ops_{dtype.__name__}", test_py_arithmetic_ops, devices=None, dtype=dtype
2058
+ )
2025
2059
 
2026
2060
 
2027
2061
  if __name__ == "__main__":
2028
2062
  wp.build.clear_kernel_cache()
2029
- _ = register(unittest.TestCase)
2030
2063
  unittest.main(verbosity=2)
warp/tests/test_rand.py CHANGED
@@ -9,10 +9,11 @@ import unittest
9
9
 
10
10
  import numpy as np
11
11
 
12
+ import warp as wp
13
+ from warp.tests.unittest_utils import *
14
+
12
15
  # import matplotlib.pyplot as plt
13
16
 
14
- import warp as wp
15
- from warp.tests.test_base import *
16
17
 
17
18
  wp.init()
18
19
 
@@ -62,7 +63,7 @@ def test_rand(test, device):
62
63
  wp.copy(int_ab_host, int_ab_device)
63
64
  wp.copy(float_01_host, float_01_device)
64
65
  wp.copy(float_ab_host, float_ab_device)
65
- wp.synchronize()
66
+ wp.synchronize_device(device)
66
67
 
67
68
  int_a = int_a_host.numpy()
68
69
  int_ab = int_ab_host.numpy()
@@ -269,21 +270,19 @@ def test_poisson(test, device):
269
270
  test.assertTrue(np.abs(poisson_high_std - np_poisson_high_std) <= 2e-1)
270
271
 
271
272
 
272
- def register(parent):
273
- devices = get_test_devices()
273
+ devices = get_test_devices()
274
+
274
275
 
275
- class TestNoise(parent):
276
- pass
276
+ class TestRand(unittest.TestCase):
277
+ pass
277
278
 
278
- add_function_test(TestNoise, "test_rand", test_rand, devices=devices)
279
- add_function_test(TestNoise, "test_sample_cdf", test_sample_cdf, devices=devices)
280
- add_function_test(TestNoise, "test_sampling_methods", test_sampling_methods, devices=devices)
281
- add_function_test(TestNoise, "test_poisson", test_poisson, devices=devices)
282
279
 
283
- return TestNoise
280
+ add_function_test(TestRand, "test_rand", test_rand, devices=devices)
281
+ add_function_test(TestRand, "test_sample_cdf", test_sample_cdf, devices=devices)
282
+ add_function_test(TestRand, "test_sampling_methods", test_sampling_methods, devices=devices)
283
+ add_function_test(TestRand, "test_poisson", test_poisson, devices=devices)
284
284
 
285
285
 
286
286
  if __name__ == "__main__":
287
287
  wp.build.clear_kernel_cache()
288
- _ = register(unittest.TestCase)
289
288
  unittest.main(verbosity=2)
warp/tests/test_reload.py CHANGED
@@ -5,25 +5,22 @@
5
5
  # distribution of this software and related documentation without an express
6
6
  # license agreement from NVIDIA CORPORATION is strictly prohibited.
7
7
 
8
- import numpy as np
9
- import warp as wp
8
+ import importlib
9
+ import os
10
+ import unittest
10
11
 
11
- import math
12
+ import numpy as np
12
13
 
13
14
  import warp as wp
14
- from warp.tests.test_base import *
15
15
 
16
- import unittest
17
- import importlib
18
- import os
16
+ # dummy modules used for testing reload with dependencies
17
+ import warp.tests.aux_test_dependent as test_dependent
18
+ import warp.tests.aux_test_reference as test_reference
19
+ import warp.tests.aux_test_reference_reference as test_reference_reference
19
20
 
20
21
  # dummy module used for testing reload
21
- import warp.tests.test_square as test_square
22
-
23
- # dummy modules used for testing reload with dependencies
24
- import warp.tests.test_dependent as test_dependent
25
- import warp.tests.test_reference as test_reference
26
- import warp.tests.test_reference_reference as test_reference_reference
22
+ import warp.tests.aux_test_square as test_square
23
+ from warp.tests.unittest_utils import *
27
24
 
28
25
  wp.init()
29
26
 
@@ -110,7 +107,7 @@ def run(expect, device):
110
107
 
111
108
  def test_reload(test, device):
112
109
  # write out the module python and import it
113
- f = open(os.path.abspath(os.path.join(os.path.dirname(__file__), "test_square.py")), "w")
110
+ f = open(os.path.abspath(os.path.join(os.path.dirname(__file__), "aux_test_square.py")), "w")
114
111
  f.writelines(square_two)
115
112
  f.flush()
116
113
  f.close()
@@ -118,7 +115,7 @@ def test_reload(test, device):
118
115
  reload_module(test_square)
119
116
  test_square.run(expect=4.0, device=device) # 2*2=4
120
117
 
121
- f = open(os.path.abspath(os.path.join(os.path.dirname(__file__), "test_square.py")), "w")
118
+ f = open(os.path.abspath(os.path.join(os.path.dirname(__file__), "aux_test_square.py")), "w")
122
119
  f.writelines(square_four)
123
120
  f.flush()
124
121
  f.close()
@@ -130,12 +127,12 @@ def test_reload(test, device):
130
127
 
131
128
  def test_reload_class(test, device):
132
129
  def test_func():
133
- import warp.tests.test_class_kernel
134
- from warp.tests.test_class_kernel import ClassKernelTest
135
-
136
130
  import importlib as imp
137
131
 
138
- imp.reload(warp.tests.test_class_kernel)
132
+ import warp.tests.aux_test_class_kernel
133
+ from warp.tests.aux_test_class_kernel import ClassKernelTest
134
+
135
+ imp.reload(warp.tests.aux_test_class_kernel)
139
136
 
140
137
  ctest = ClassKernelTest(device)
141
138
  expected = np.zeros((10, 3, 3), dtype=np.float32)
@@ -149,7 +146,7 @@ def test_reload_class(test, device):
149
146
  template_ref = """# This file is used to test reloading module references.
150
147
 
151
148
  import warp as wp
152
- import warp.tests.test_reference_reference as refref
149
+ import warp.tests.aux_test_reference_reference as refref
153
150
 
154
151
  wp.init()
155
152
 
@@ -173,8 +170,8 @@ def more_magic():
173
170
 
174
171
 
175
172
  def test_reload_references(test, device):
176
- path_ref = os.path.abspath(os.path.join(os.path.dirname(__file__), "test_reference.py"))
177
- path_refref = os.path.abspath(os.path.join(os.path.dirname(__file__), "test_reference_reference.py"))
173
+ path_ref = os.path.abspath(os.path.join(os.path.dirname(__file__), "aux_test_reference.py"))
174
+ path_refref = os.path.abspath(os.path.join(os.path.dirname(__file__), "aux_test_reference_reference.py"))
178
175
 
179
176
  # rewrite both dependency modules and reload them
180
177
  with open(path_ref, "w") as f:
@@ -202,21 +199,19 @@ def test_reload_references(test, device):
202
199
  test_dependent.run(expect=4.0, device=device) # 2 * 2 = 4
203
200
 
204
201
 
205
- def register(parent):
206
- devices = get_test_devices()
202
+ devices = get_test_devices()
203
+
207
204
 
208
- class TestReload(parent):
209
- pass
205
+ class TestReload(unittest.TestCase):
206
+ pass
210
207
 
211
- add_function_test(TestReload, "test_redefine", test_redefine, devices=devices)
212
- add_function_test(TestReload, "test_reload", test_reload, devices=devices)
213
- add_function_test(TestReload, "test_reload_class", test_reload_class, devices=devices)
214
- add_function_test(TestReload, "test_reload_references", test_reload_references, devices=devices)
215
208
 
216
- return TestReload
209
+ add_function_test(TestReload, "test_redefine", test_redefine, devices=devices)
210
+ add_function_test(TestReload, "test_reload", test_reload, devices=devices)
211
+ add_function_test(TestReload, "test_reload_class", test_reload_class, devices=devices)
212
+ add_function_test(TestReload, "test_reload_references", test_reload_references, devices=devices)
217
213
 
218
214
 
219
215
  if __name__ == "__main__":
220
216
  wp.build.clear_kernel_cache()
221
- _ = register(unittest.TestCase)
222
217
  unittest.main(verbosity=2, failfast=False)
@@ -7,11 +7,11 @@
7
7
 
8
8
  import unittest
9
9
 
10
- import warp as wp
11
- from warp.tests.test_base import *
12
-
13
10
  import numpy as np
14
11
 
12
+ import warp as wp
13
+ from warp.tests.unittest_utils import *
14
+
15
15
  compare_to_numpy = False
16
16
  print_results = False
17
17
 
@@ -165,18 +165,15 @@ def test_rounding(test, device):
165
165
  print("----------------------------------------------")
166
166
 
167
167
 
168
- def register(parent):
169
- class TestRounding(parent):
170
- pass
168
+ class TestRounding(unittest.TestCase):
169
+ pass
171
170
 
172
- devices = get_test_devices()
173
171
 
174
- add_function_test(TestRounding, "test_rounding", test_rounding, devices=devices)
172
+ devices = get_test_devices()
175
173
 
176
- return TestRounding
174
+ add_function_test(TestRounding, "test_rounding", test_rounding, devices=devices)
177
175
 
178
176
 
179
177
  if __name__ == "__main__":
180
178
  wp.build.clear_kernel_cache()
181
- _ = register(unittest.TestCase)
182
179
  unittest.main(verbosity=2)