warp-lang 0.9.0__py3-none-win_amd64.whl → 0.11.0__py3-none-win_amd64.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.

Files changed (315) hide show
  1. warp/__init__.py +15 -7
  2. warp/__init__.pyi +1 -0
  3. warp/bin/warp-clang.dll +0 -0
  4. warp/bin/warp.dll +0 -0
  5. warp/build.py +22 -443
  6. warp/build_dll.py +384 -0
  7. warp/builtins.py +998 -488
  8. warp/codegen.py +1307 -739
  9. warp/config.py +5 -3
  10. warp/constants.py +6 -0
  11. warp/context.py +1291 -548
  12. warp/dlpack.py +31 -31
  13. warp/fabric.py +326 -0
  14. warp/fem/__init__.py +27 -0
  15. warp/fem/cache.py +389 -0
  16. warp/fem/dirichlet.py +181 -0
  17. warp/fem/domain.py +263 -0
  18. warp/fem/field/__init__.py +101 -0
  19. warp/fem/field/field.py +149 -0
  20. warp/fem/field/nodal_field.py +299 -0
  21. warp/fem/field/restriction.py +21 -0
  22. warp/fem/field/test.py +181 -0
  23. warp/fem/field/trial.py +183 -0
  24. warp/fem/geometry/__init__.py +19 -0
  25. warp/fem/geometry/closest_point.py +70 -0
  26. warp/fem/geometry/deformed_geometry.py +271 -0
  27. warp/fem/geometry/element.py +744 -0
  28. warp/fem/geometry/geometry.py +186 -0
  29. warp/fem/geometry/grid_2d.py +373 -0
  30. warp/fem/geometry/grid_3d.py +435 -0
  31. warp/fem/geometry/hexmesh.py +953 -0
  32. warp/fem/geometry/partition.py +376 -0
  33. warp/fem/geometry/quadmesh_2d.py +532 -0
  34. warp/fem/geometry/tetmesh.py +840 -0
  35. warp/fem/geometry/trimesh_2d.py +577 -0
  36. warp/fem/integrate.py +1616 -0
  37. warp/fem/operator.py +191 -0
  38. warp/fem/polynomial.py +213 -0
  39. warp/fem/quadrature/__init__.py +2 -0
  40. warp/fem/quadrature/pic_quadrature.py +245 -0
  41. warp/fem/quadrature/quadrature.py +294 -0
  42. warp/fem/space/__init__.py +292 -0
  43. warp/fem/space/basis_space.py +489 -0
  44. warp/fem/space/collocated_function_space.py +105 -0
  45. warp/fem/space/dof_mapper.py +236 -0
  46. warp/fem/space/function_space.py +145 -0
  47. warp/fem/space/grid_2d_function_space.py +267 -0
  48. warp/fem/space/grid_3d_function_space.py +306 -0
  49. warp/fem/space/hexmesh_function_space.py +352 -0
  50. warp/fem/space/partition.py +350 -0
  51. warp/fem/space/quadmesh_2d_function_space.py +369 -0
  52. warp/fem/space/restriction.py +160 -0
  53. warp/fem/space/shape/__init__.py +15 -0
  54. warp/fem/space/shape/cube_shape_function.py +738 -0
  55. warp/fem/space/shape/shape_function.py +103 -0
  56. warp/fem/space/shape/square_shape_function.py +611 -0
  57. warp/fem/space/shape/tet_shape_function.py +567 -0
  58. warp/fem/space/shape/triangle_shape_function.py +429 -0
  59. warp/fem/space/tetmesh_function_space.py +292 -0
  60. warp/fem/space/topology.py +295 -0
  61. warp/fem/space/trimesh_2d_function_space.py +221 -0
  62. warp/fem/types.py +77 -0
  63. warp/fem/utils.py +495 -0
  64. warp/native/array.h +164 -55
  65. warp/native/builtin.h +150 -174
  66. warp/native/bvh.cpp +75 -328
  67. warp/native/bvh.cu +406 -23
  68. warp/native/bvh.h +37 -45
  69. warp/native/clang/clang.cpp +136 -24
  70. warp/native/crt.cpp +1 -76
  71. warp/native/crt.h +111 -104
  72. warp/native/cuda_crt.h +1049 -0
  73. warp/native/cuda_util.cpp +15 -3
  74. warp/native/cuda_util.h +3 -1
  75. warp/native/cutlass/tools/library/scripts/conv2d_operation.py +463 -0
  76. warp/native/cutlass/tools/library/scripts/conv3d_operation.py +321 -0
  77. warp/native/cutlass/tools/library/scripts/gemm_operation.py +988 -0
  78. warp/native/cutlass/tools/library/scripts/generator.py +4625 -0
  79. warp/native/cutlass/tools/library/scripts/library.py +799 -0
  80. warp/native/cutlass/tools/library/scripts/manifest.py +402 -0
  81. warp/native/cutlass/tools/library/scripts/pycutlass/docs/source/conf.py +96 -0
  82. warp/native/cutlass/tools/library/scripts/pycutlass/profile/conv/conv2d_f16_sm80.py +106 -0
  83. warp/native/cutlass/tools/library/scripts/pycutlass/profile/gemm/gemm_f32_sm80.py +91 -0
  84. warp/native/cutlass/tools/library/scripts/pycutlass/setup.py +80 -0
  85. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/__init__.py +48 -0
  86. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/arguments.py +118 -0
  87. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/c_types.py +241 -0
  88. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/compiler.py +432 -0
  89. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/conv2d_operation.py +631 -0
  90. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/epilogue.py +1026 -0
  91. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/frontend.py +104 -0
  92. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/gemm_operation.py +1276 -0
  93. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/library.py +744 -0
  94. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/memory_manager.py +74 -0
  95. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/operation.py +110 -0
  96. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/parser.py +619 -0
  97. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/reduction_operation.py +398 -0
  98. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/tensor_ref.py +70 -0
  99. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/__init__.py +4 -0
  100. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/conv2d_testbed.py +646 -0
  101. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_grouped_testbed.py +235 -0
  102. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_testbed.py +557 -0
  103. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/profiler.py +70 -0
  104. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/type_hint.py +39 -0
  105. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/__init__.py +1 -0
  106. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/device.py +76 -0
  107. warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/reference_model.py +255 -0
  108. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/__init__.py +0 -0
  109. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +201 -0
  110. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +177 -0
  111. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +98 -0
  112. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_dgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +95 -0
  113. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_few_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py +163 -0
  114. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_fixed_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py +187 -0
  115. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +309 -0
  116. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +54 -0
  117. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +96 -0
  118. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_fprop_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +107 -0
  119. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_strided_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +253 -0
  120. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py +97 -0
  121. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py +242 -0
  122. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_f32nhwc_f32nhwc_f32nhwc_simt_f32_sm80.py +96 -0
  123. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/conv2d_wgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py +107 -0
  124. warp/native/cutlass/tools/library/scripts/pycutlass/test/conv/run_all_tests.py +10 -0
  125. warp/native/cutlass/tools/library/scripts/pycutlass/test/frontend/test_frontend.py +146 -0
  126. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/__init__.py +0 -0
  127. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_bf16_sm80.py +96 -0
  128. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f16_sm80.py +447 -0
  129. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f32_sm80.py +146 -0
  130. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_f64_sm80.py +102 -0
  131. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_grouped_sm80.py +203 -0
  132. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/gemm_s8_sm80.py +229 -0
  133. warp/native/cutlass/tools/library/scripts/pycutlass/test/gemm/run_all_tests.py +9 -0
  134. warp/native/cutlass/tools/library/scripts/pycutlass/test/unit/test_sm80.py +453 -0
  135. warp/native/cutlass/tools/library/scripts/rank_2k_operation.py +398 -0
  136. warp/native/cutlass/tools/library/scripts/rank_k_operation.py +387 -0
  137. warp/native/cutlass/tools/library/scripts/rt.py +796 -0
  138. warp/native/cutlass/tools/library/scripts/symm_operation.py +400 -0
  139. warp/native/cutlass/tools/library/scripts/trmm_operation.py +407 -0
  140. warp/native/cutlass_gemm.cu +5 -3
  141. warp/native/exports.h +1240 -949
  142. warp/native/fabric.h +228 -0
  143. warp/native/hashgrid.cpp +4 -4
  144. warp/native/hashgrid.h +22 -2
  145. warp/native/initializer_array.h +2 -2
  146. warp/native/intersect.h +22 -7
  147. warp/native/intersect_adj.h +8 -8
  148. warp/native/intersect_tri.h +13 -16
  149. warp/native/marching.cu +157 -161
  150. warp/native/mat.h +119 -19
  151. warp/native/matnn.h +2 -2
  152. warp/native/mesh.cpp +108 -83
  153. warp/native/mesh.cu +243 -6
  154. warp/native/mesh.h +1547 -458
  155. warp/native/nanovdb/NanoVDB.h +1 -1
  156. warp/native/noise.h +272 -329
  157. warp/native/quat.h +51 -8
  158. warp/native/rand.h +45 -35
  159. warp/native/range.h +6 -2
  160. warp/native/reduce.cpp +157 -0
  161. warp/native/reduce.cu +348 -0
  162. warp/native/runlength_encode.cpp +62 -0
  163. warp/native/runlength_encode.cu +46 -0
  164. warp/native/scan.cu +11 -13
  165. warp/native/scan.h +1 -0
  166. warp/native/solid_angle.h +442 -0
  167. warp/native/sort.cpp +13 -0
  168. warp/native/sort.cu +9 -1
  169. warp/native/sparse.cpp +338 -0
  170. warp/native/sparse.cu +545 -0
  171. warp/native/spatial.h +2 -2
  172. warp/native/temp_buffer.h +30 -0
  173. warp/native/vec.h +126 -24
  174. warp/native/volume.h +120 -0
  175. warp/native/warp.cpp +658 -53
  176. warp/native/warp.cu +660 -68
  177. warp/native/warp.h +112 -12
  178. warp/optim/__init__.py +1 -0
  179. warp/optim/linear.py +922 -0
  180. warp/optim/sgd.py +92 -0
  181. warp/render/render_opengl.py +392 -152
  182. warp/render/render_usd.py +11 -11
  183. warp/sim/__init__.py +2 -2
  184. warp/sim/articulation.py +385 -185
  185. warp/sim/collide.py +21 -8
  186. warp/sim/import_mjcf.py +297 -106
  187. warp/sim/import_urdf.py +389 -210
  188. warp/sim/import_usd.py +198 -97
  189. warp/sim/inertia.py +17 -18
  190. warp/sim/integrator_euler.py +14 -8
  191. warp/sim/integrator_xpbd.py +161 -19
  192. warp/sim/model.py +795 -291
  193. warp/sim/optimizer.py +2 -6
  194. warp/sim/render.py +65 -3
  195. warp/sim/utils.py +3 -0
  196. warp/sparse.py +1227 -0
  197. warp/stubs.py +665 -223
  198. warp/tape.py +66 -15
  199. warp/tests/__main__.py +3 -6
  200. warp/tests/assets/curlnoise_golden.npy +0 -0
  201. warp/tests/assets/pnoise_golden.npy +0 -0
  202. warp/tests/assets/torus.usda +105 -105
  203. warp/tests/{test_class_kernel.py → aux_test_class_kernel.py} +9 -1
  204. warp/tests/aux_test_conditional_unequal_types_kernels.py +21 -0
  205. warp/tests/{test_dependent.py → aux_test_dependent.py} +2 -2
  206. warp/tests/{test_reference.py → aux_test_reference.py} +1 -1
  207. warp/tests/aux_test_unresolved_func.py +14 -0
  208. warp/tests/aux_test_unresolved_symbol.py +14 -0
  209. warp/tests/disabled_kinematics.py +239 -0
  210. warp/tests/run_coverage_serial.py +31 -0
  211. warp/tests/test_adam.py +103 -106
  212. warp/tests/test_arithmetic.py +128 -74
  213. warp/tests/test_array.py +1497 -211
  214. warp/tests/test_array_reduce.py +150 -0
  215. warp/tests/test_atomic.py +64 -28
  216. warp/tests/test_bool.py +99 -0
  217. warp/tests/test_builtins_resolution.py +1292 -0
  218. warp/tests/test_bvh.py +75 -43
  219. warp/tests/test_closest_point_edge_edge.py +54 -57
  220. warp/tests/test_codegen.py +233 -128
  221. warp/tests/test_compile_consts.py +28 -20
  222. warp/tests/test_conditional.py +108 -24
  223. warp/tests/test_copy.py +10 -12
  224. warp/tests/test_ctypes.py +112 -88
  225. warp/tests/test_dense.py +21 -14
  226. warp/tests/test_devices.py +98 -0
  227. warp/tests/test_dlpack.py +136 -108
  228. warp/tests/test_examples.py +277 -0
  229. warp/tests/test_fabricarray.py +955 -0
  230. warp/tests/test_fast_math.py +15 -11
  231. warp/tests/test_fem.py +1271 -0
  232. warp/tests/test_fp16.py +53 -19
  233. warp/tests/test_func.py +187 -74
  234. warp/tests/test_generics.py +194 -49
  235. warp/tests/test_grad.py +180 -116
  236. warp/tests/test_grad_customs.py +176 -0
  237. warp/tests/test_hash_grid.py +52 -37
  238. warp/tests/test_import.py +10 -23
  239. warp/tests/test_indexedarray.py +577 -24
  240. warp/tests/test_intersect.py +18 -9
  241. warp/tests/test_large.py +141 -0
  242. warp/tests/test_launch.py +251 -15
  243. warp/tests/test_lerp.py +64 -65
  244. warp/tests/test_linear_solvers.py +154 -0
  245. warp/tests/test_lvalue.py +493 -0
  246. warp/tests/test_marching_cubes.py +12 -13
  247. warp/tests/test_mat.py +508 -2778
  248. warp/tests/test_mat_lite.py +115 -0
  249. warp/tests/test_mat_scalar_ops.py +2889 -0
  250. warp/tests/test_math.py +103 -9
  251. warp/tests/test_matmul.py +305 -69
  252. warp/tests/test_matmul_lite.py +410 -0
  253. warp/tests/test_mesh.py +71 -14
  254. warp/tests/test_mesh_query_aabb.py +41 -25
  255. warp/tests/test_mesh_query_point.py +325 -34
  256. warp/tests/test_mesh_query_ray.py +39 -22
  257. warp/tests/test_mlp.py +30 -22
  258. warp/tests/test_model.py +92 -89
  259. warp/tests/test_modules_lite.py +39 -0
  260. warp/tests/test_multigpu.py +88 -114
  261. warp/tests/test_noise.py +12 -11
  262. warp/tests/test_operators.py +16 -20
  263. warp/tests/test_options.py +11 -11
  264. warp/tests/test_pinned.py +17 -18
  265. warp/tests/test_print.py +32 -11
  266. warp/tests/test_quat.py +275 -129
  267. warp/tests/test_rand.py +18 -16
  268. warp/tests/test_reload.py +38 -34
  269. warp/tests/test_rounding.py +50 -43
  270. warp/tests/test_runlength_encode.py +190 -0
  271. warp/tests/test_smoothstep.py +9 -11
  272. warp/tests/test_snippet.py +143 -0
  273. warp/tests/test_sparse.py +460 -0
  274. warp/tests/test_spatial.py +276 -243
  275. warp/tests/test_streams.py +110 -85
  276. warp/tests/test_struct.py +331 -85
  277. warp/tests/test_tape.py +39 -21
  278. warp/tests/test_torch.py +118 -89
  279. warp/tests/test_transient_module.py +12 -13
  280. warp/tests/test_types.py +614 -0
  281. warp/tests/test_utils.py +494 -0
  282. warp/tests/test_vec.py +354 -1987
  283. warp/tests/test_vec_lite.py +73 -0
  284. warp/tests/test_vec_scalar_ops.py +2099 -0
  285. warp/tests/test_volume.py +457 -293
  286. warp/tests/test_volume_write.py +124 -134
  287. warp/tests/unittest_serial.py +35 -0
  288. warp/tests/unittest_suites.py +341 -0
  289. warp/tests/unittest_utils.py +568 -0
  290. warp/tests/unused_test_misc.py +71 -0
  291. warp/tests/{test_debug.py → walkthough_debug.py} +3 -17
  292. warp/thirdparty/appdirs.py +36 -45
  293. warp/thirdparty/unittest_parallel.py +549 -0
  294. warp/torch.py +72 -30
  295. warp/types.py +1744 -713
  296. warp/utils.py +360 -350
  297. warp_lang-0.11.0.dist-info/LICENSE.md +36 -0
  298. warp_lang-0.11.0.dist-info/METADATA +238 -0
  299. warp_lang-0.11.0.dist-info/RECORD +332 -0
  300. {warp_lang-0.9.0.dist-info → warp_lang-0.11.0.dist-info}/WHEEL +1 -1
  301. warp/bin/warp-clang.exp +0 -0
  302. warp/bin/warp-clang.lib +0 -0
  303. warp/bin/warp.exp +0 -0
  304. warp/bin/warp.lib +0 -0
  305. warp/tests/test_all.py +0 -215
  306. warp/tests/test_array_scan.py +0 -60
  307. warp/tests/test_base.py +0 -208
  308. warp/tests/test_unresolved_func.py +0 -7
  309. warp/tests/test_unresolved_symbol.py +0 -7
  310. warp_lang-0.9.0.dist-info/METADATA +0 -20
  311. warp_lang-0.9.0.dist-info/RECORD +0 -177
  312. /warp/tests/{test_compile_consts_dummy.py → aux_test_compile_consts_dummy.py} +0 -0
  313. /warp/tests/{test_reference_reference.py → aux_test_reference_reference.py} +0 -0
  314. /warp/tests/{test_square.py → aux_test_square.py} +0 -0
  315. {warp_lang-0.9.0.dist-info → warp_lang-0.11.0.dist-info}/top_level.txt +0 -0
@@ -1,8 +1,16 @@
1
+ # Copyright (c) 2023 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
+ import unittest
9
+
1
10
  import numpy as np
2
- import math
3
11
 
4
12
  import warp as wp
5
- from warp.tests.test_base import *
13
+ from warp.tests.unittest_utils import *
6
14
 
7
15
  wp.init()
8
16
 
@@ -12,10 +20,9 @@ kernel_cache = dict()
12
20
 
13
21
 
14
22
  def getkernel(func, suffix=""):
15
- module = wp.get_module(func.__module__)
16
23
  key = func.__name__ + "_" + suffix
17
24
  if key not in kernel_cache:
18
- kernel_cache[key] = wp.Kernel(func=func, key=key, module=module)
25
+ kernel_cache[key] = wp.Kernel(func=func, key=key)
19
26
  return kernel_cache[key]
20
27
 
21
28
 
@@ -34,7 +41,7 @@ def get_select_kernel(dtype):
34
41
 
35
42
 
36
43
  def test_spatial_vector_constructors(test, device, dtype, register_kernels=False):
37
- np.random.seed(123)
44
+ rng = np.random.default_rng(123)
38
45
 
39
46
  tol = {
40
47
  np.float16: 5.0e-3,
@@ -81,7 +88,7 @@ def test_spatial_vector_constructors(test, device, dtype, register_kernels=False
81
88
  if register_kernels:
82
89
  return
83
90
 
84
- input = wp.array(np.random.randn(6).astype(dtype), requires_grad=True, device=device)
91
+ input = wp.array(rng.standard_normal(size=6).astype(dtype), requires_grad=True, device=device)
85
92
  output = wp.zeros_like(input)
86
93
  wp.launch(kernel, dim=1, inputs=[input], outputs=[output], device=device)
87
94
 
@@ -99,7 +106,7 @@ def test_spatial_vector_constructors(test, device, dtype, register_kernels=False
99
106
  assert_np_equal(tape.gradients[input].numpy(), expectedgrads)
100
107
  tape.zero()
101
108
 
102
- input = wp.array(np.random.randn(6).astype(dtype), requires_grad=True, device=device)
109
+ input = wp.array(rng.standard_normal(size=6).astype(dtype), requires_grad=True, device=device)
103
110
  output = wp.zeros_like(input)
104
111
  wp.launch(vec_kernel, dim=1, inputs=[input], outputs=[output], device=device)
105
112
 
@@ -119,7 +126,7 @@ def test_spatial_vector_constructors(test, device, dtype, register_kernels=False
119
126
 
120
127
 
121
128
  def test_spatial_vector_indexing(test, device, dtype, register_kernels=False):
122
- np.random.seed(123)
129
+ rng = np.random.default_rng(123)
123
130
 
124
131
  tol = {
125
132
  np.float16: 5.0e-3,
@@ -148,7 +155,9 @@ def test_spatial_vector_indexing(test, device, dtype, register_kernels=False):
148
155
  if register_kernels:
149
156
  return
150
157
 
151
- input = wp.array(np.random.randn(1, 6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
158
+ input = wp.array(
159
+ rng.standard_normal(size=(1, 6)).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device
160
+ )
152
161
  outcmps = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
153
162
 
154
163
  wp.launch(kernel, dim=1, inputs=[input], outputs=[outcmps], device=device)
@@ -169,7 +178,7 @@ def test_spatial_vector_indexing(test, device, dtype, register_kernels=False):
169
178
 
170
179
 
171
180
  def test_spatial_vector_scalar_multiplication(test, device, dtype, register_kernels=False):
172
- np.random.seed(123)
181
+ rng = np.random.default_rng(123)
173
182
 
174
183
  tol = {
175
184
  np.float16: 5.0e-3,
@@ -200,8 +209,10 @@ def test_spatial_vector_scalar_multiplication(test, device, dtype, register_kern
200
209
  if register_kernels:
201
210
  return
202
211
 
203
- s = wp.array(np.random.randn(1).astype(dtype), requires_grad=True, device=device)
204
- q = wp.array(np.random.randn(1, 6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
212
+ s = wp.array(rng.standard_normal(size=1).astype(dtype), requires_grad=True, device=device)
213
+ q = wp.array(
214
+ rng.standard_normal(size=(1, 6)).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device
215
+ )
205
216
 
206
217
  outcmps_l = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
207
218
  outcmps_r = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
@@ -237,7 +248,7 @@ def test_spatial_vector_scalar_multiplication(test, device, dtype, register_kern
237
248
 
238
249
 
239
250
  def test_spatial_vector_add_sub(test, device, dtype, register_kernels=False):
240
- np.random.seed(123)
251
+ rng = np.random.default_rng(123)
241
252
 
242
253
  tol = {
243
254
  np.float16: 5.0e-3,
@@ -265,8 +276,8 @@ def test_spatial_vector_add_sub(test, device, dtype, register_kernels=False):
265
276
  if register_kernels:
266
277
  return
267
278
 
268
- q = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
269
- v = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
279
+ q = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
280
+ v = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
270
281
 
271
282
  outputs_add = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
272
283
  outputs_sub = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
@@ -313,7 +324,7 @@ def test_spatial_vector_add_sub(test, device, dtype, register_kernels=False):
313
324
 
314
325
 
315
326
  def test_spatial_dot(test, device, dtype, register_kernels=False):
316
- np.random.seed(123)
327
+ rng = np.random.default_rng(123)
317
328
 
318
329
  tol = {
319
330
  np.float16: 1.0e-2,
@@ -335,8 +346,8 @@ def test_spatial_dot(test, device, dtype, register_kernels=False):
335
346
  if register_kernels:
336
347
  return
337
348
 
338
- s = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
339
- v = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
349
+ s = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
350
+ v = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
340
351
  dot = wp.zeros(1, dtype=wptype, requires_grad=True, device=device)
341
352
 
342
353
  tape = wp.Tape()
@@ -365,7 +376,7 @@ def test_spatial_dot(test, device, dtype, register_kernels=False):
365
376
 
366
377
 
367
378
  def test_spatial_cross(test, device, dtype, register_kernels=False):
368
- np.random.seed(123)
379
+ rng = np.random.default_rng(123)
369
380
 
370
381
  tol = {
371
382
  np.float16: 5.0e-3,
@@ -416,8 +427,8 @@ def test_spatial_cross(test, device, dtype, register_kernels=False):
416
427
  if register_kernels:
417
428
  return
418
429
 
419
- s = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
420
- v = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
430
+ s = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
431
+ v = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
421
432
  outputs = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
422
433
  outputs_dual = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
423
434
  outputs_wcrossw = wp.zeros(3, dtype=wptype, requires_grad=True, device=device)
@@ -519,7 +530,7 @@ def test_spatial_cross(test, device, dtype, register_kernels=False):
519
530
 
520
531
 
521
532
  def test_spatial_top_bottom(test, device, dtype, register_kernels=False):
522
- np.random.seed(123)
533
+ rng = np.random.default_rng(123)
523
534
 
524
535
  tol = {
525
536
  np.float16: 1.0e-2,
@@ -551,7 +562,7 @@ def test_spatial_top_bottom(test, device, dtype, register_kernels=False):
551
562
  if register_kernels:
552
563
  return
553
564
 
554
- s = wp.array(np.random.randn(6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
565
+ s = wp.array(rng.standard_normal(size=6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
555
566
  outputs = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
556
567
 
557
568
  wp.launch(
@@ -588,7 +599,7 @@ def test_spatial_top_bottom(test, device, dtype, register_kernels=False):
588
599
 
589
600
 
590
601
  def test_transform_constructors(test, device, dtype, register_kernels=False):
591
- np.random.seed(123)
602
+ rng = np.random.default_rng(123)
592
603
 
593
604
  tol = {
594
605
  np.float16: 5.0e-3,
@@ -622,8 +633,8 @@ def test_transform_constructors(test, device, dtype, register_kernels=False):
622
633
  if register_kernels:
623
634
  return
624
635
 
625
- p = np.random.randn(3).astype(dtype)
626
- q = np.random.randn(4).astype(dtype)
636
+ p = rng.standard_normal(size=3).astype(dtype)
637
+ q = rng.standard_normal(size=4).astype(dtype)
627
638
  q /= np.linalg.norm(q)
628
639
 
629
640
  input = wp.array(np.concatenate((p, q)), requires_grad=True, device=device)
@@ -647,7 +658,7 @@ def test_transform_constructors(test, device, dtype, register_kernels=False):
647
658
 
648
659
 
649
660
  def test_transform_indexing(test, device, dtype, register_kernels=False):
650
- np.random.seed(123)
661
+ rng = np.random.default_rng(123)
651
662
 
652
663
  tol = {
653
664
  np.float16: 5.0e-3,
@@ -676,7 +687,7 @@ def test_transform_indexing(test, device, dtype, register_kernels=False):
676
687
  if register_kernels:
677
688
  return
678
689
 
679
- input = wp.array(np.random.randn(1, 7).astype(dtype), dtype=transform, requires_grad=True, device=device)
690
+ input = wp.array(rng.standard_normal(size=(1, 7)).astype(dtype), dtype=transform, requires_grad=True, device=device)
680
691
  outcmps = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
681
692
 
682
693
  wp.launch(kernel, dim=1, inputs=[input], outputs=[outcmps], device=device)
@@ -696,7 +707,7 @@ def test_transform_indexing(test, device, dtype, register_kernels=False):
696
707
 
697
708
 
698
709
  def test_transform_scalar_multiplication(test, device, dtype, register_kernels=False):
699
- np.random.seed(123)
710
+ rng = np.random.default_rng(123)
700
711
 
701
712
  tol = {
702
713
  np.float16: 5.0e-3,
@@ -727,8 +738,8 @@ def test_transform_scalar_multiplication(test, device, dtype, register_kernels=F
727
738
  if register_kernels:
728
739
  return
729
740
 
730
- s = wp.array(np.random.randn(1).astype(dtype), requires_grad=True, device=device)
731
- q = wp.array(np.random.randn(1, 7).astype(dtype), dtype=transform, requires_grad=True, device=device)
741
+ s = wp.array(rng.standard_normal(size=1).astype(dtype), requires_grad=True, device=device)
742
+ q = wp.array(rng.standard_normal(size=(1, 7)).astype(dtype), dtype=transform, requires_grad=True, device=device)
732
743
 
733
744
  outcmps_l = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
734
745
  outcmps_r = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
@@ -764,7 +775,7 @@ def test_transform_scalar_multiplication(test, device, dtype, register_kernels=F
764
775
 
765
776
 
766
777
  def test_transform_add_sub(test, device, dtype, register_kernels=False):
767
- np.random.seed(123)
778
+ rng = np.random.default_rng(123)
768
779
 
769
780
  tol = {
770
781
  np.float16: 5.0e-3,
@@ -793,8 +804,8 @@ def test_transform_add_sub(test, device, dtype, register_kernels=False):
793
804
  if register_kernels:
794
805
  return
795
806
 
796
- q = wp.array(np.random.randn(7).astype(dtype), dtype=transform, requires_grad=True, device=device)
797
- v = wp.array(np.random.randn(7).astype(dtype), dtype=transform, requires_grad=True, device=device)
807
+ q = wp.array(rng.standard_normal(size=7).astype(dtype), dtype=transform, requires_grad=True, device=device)
808
+ v = wp.array(rng.standard_normal(size=7).astype(dtype), dtype=transform, requires_grad=True, device=device)
798
809
 
799
810
  outputs_add = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
800
811
  outputs_sub = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
@@ -841,7 +852,7 @@ def test_transform_add_sub(test, device, dtype, register_kernels=False):
841
852
 
842
853
 
843
854
  def test_transform_get_trans_rot(test, device, dtype, register_kernels=False):
844
- np.random.seed(123)
855
+ rng = np.random.default_rng(123)
845
856
 
846
857
  tol = {
847
858
  np.float16: 1.0e-2,
@@ -874,7 +885,7 @@ def test_transform_get_trans_rot(test, device, dtype, register_kernels=False):
874
885
  if register_kernels:
875
886
  return
876
887
 
877
- s = wp.array(np.random.randn(7).astype(dtype), dtype=transform, requires_grad=True, device=device)
888
+ s = wp.array(rng.standard_normal(size=7).astype(dtype), dtype=transform, requires_grad=True, device=device)
878
889
  outputs = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
879
890
 
880
891
  wp.launch(
@@ -911,7 +922,7 @@ def test_transform_get_trans_rot(test, device, dtype, register_kernels=False):
911
922
 
912
923
 
913
924
  def test_transform_multiply(test, device, dtype, register_kernels=False):
914
- np.random.seed(123)
925
+ rng = np.random.default_rng(123)
915
926
 
916
927
  tol = {
917
928
  np.float16: 1.0e-2,
@@ -955,8 +966,8 @@ def test_transform_multiply(test, device, dtype, register_kernels=False):
955
966
  if register_kernels:
956
967
  return
957
968
 
958
- q = np.random.randn(7)
959
- s = np.random.randn(7)
969
+ q = rng.standard_normal(size=7)
970
+ s = rng.standard_normal(size=7)
960
971
  q[3:] /= np.linalg.norm(q[3:])
961
972
  s[3:] /= np.linalg.norm(s[3:])
962
973
 
@@ -1020,7 +1031,7 @@ def test_transform_multiply(test, device, dtype, register_kernels=False):
1020
1031
 
1021
1032
 
1022
1033
  def test_transform_inverse(test, device, dtype, register_kernels=False):
1023
- np.random.seed(123)
1034
+ rng = np.random.default_rng(123)
1024
1035
 
1025
1036
  tol = {
1026
1037
  np.float16: 1.0e-2,
@@ -1059,8 +1070,8 @@ def test_transform_inverse(test, device, dtype, register_kernels=False):
1059
1070
  if register_kernels:
1060
1071
  return
1061
1072
 
1062
- q = np.random.randn(7)
1063
- s = np.random.randn(7)
1073
+ q = rng.standard_normal(size=7)
1074
+ s = rng.standard_normal(size=7)
1064
1075
  q[3:] /= np.linalg.norm(q[3:])
1065
1076
  s[3:] /= np.linalg.norm(s[3:])
1066
1077
 
@@ -1113,7 +1124,7 @@ def test_transform_inverse(test, device, dtype, register_kernels=False):
1113
1124
 
1114
1125
 
1115
1126
  def test_transform_point_vector(test, device, dtype, register_kernels=False):
1116
- np.random.seed(123)
1127
+ rng = np.random.default_rng(123)
1117
1128
 
1118
1129
  tol = {
1119
1130
  np.float16: 1.0e-2,
@@ -1151,11 +1162,11 @@ def test_transform_point_vector(test, device, dtype, register_kernels=False):
1151
1162
  if register_kernels:
1152
1163
  return
1153
1164
 
1154
- q = np.random.randn(7)
1165
+ q = rng.standard_normal(size=7)
1155
1166
  q[3:] /= np.linalg.norm(q[3:])
1156
1167
 
1157
1168
  t = wp.array(q.astype(dtype), dtype=transform, requires_grad=True, device=device)
1158
- v = wp.array(np.random.randn(3), dtype=vec3, requires_grad=True, device=device)
1169
+ v = wp.array(rng.standard_normal(size=3), dtype=vec3, requires_grad=True, device=device)
1159
1170
  outputs_pt = wp.zeros(3, dtype=wptype, requires_grad=True, device=device)
1160
1171
  outputs_pt_manual = wp.zeros(3, dtype=wptype, requires_grad=True, device=device)
1161
1172
  outputs_vec = wp.zeros(3, dtype=wptype, requires_grad=True, device=device)
@@ -1221,7 +1232,7 @@ def test_transform_point_vector(test, device, dtype, register_kernels=False):
1221
1232
 
1222
1233
 
1223
1234
  def test_spatial_matrix_constructors(test, device, dtype, register_kernels=False):
1224
- np.random.seed(123)
1235
+ rng = np.random.default_rng(123)
1225
1236
 
1226
1237
  tol = {
1227
1238
  np.float16: 5.0e-3,
@@ -1294,7 +1305,7 @@ def test_spatial_matrix_constructors(test, device, dtype, register_kernels=False
1294
1305
  if register_kernels:
1295
1306
  return
1296
1307
 
1297
- input = wp.array(np.random.randn(6 * 6).astype(dtype), requires_grad=True, device=device)
1308
+ input = wp.array(rng.standard_normal(size=6 * 6).astype(dtype), requires_grad=True, device=device)
1298
1309
  output = wp.zeros(2 * 6 * 6, dtype=wptype, requires_grad=True, device=device)
1299
1310
 
1300
1311
  wp.launch(kernel, dim=1, inputs=[input], outputs=[output], device=device)
@@ -1317,7 +1328,7 @@ def test_spatial_matrix_constructors(test, device, dtype, register_kernels=False
1317
1328
 
1318
1329
 
1319
1330
  def test_spatial_matrix_indexing(test, device, dtype, register_kernels=False):
1320
- np.random.seed(123)
1331
+ rng = np.random.default_rng(123)
1321
1332
 
1322
1333
  tol = {
1323
1334
  np.float16: 5.0e-3,
@@ -1347,7 +1358,9 @@ def test_spatial_matrix_indexing(test, device, dtype, register_kernels=False):
1347
1358
  if register_kernels:
1348
1359
  return
1349
1360
 
1350
- input = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1361
+ input = wp.array(
1362
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1363
+ )
1351
1364
  outcmps = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1352
1365
 
1353
1366
  wp.launch(kernel, dim=1, inputs=[input], outputs=[outcmps], device=device)
@@ -1370,7 +1383,7 @@ def test_spatial_matrix_indexing(test, device, dtype, register_kernels=False):
1370
1383
 
1371
1384
 
1372
1385
  def test_spatial_matrix_scalar_multiplication(test, device, dtype, register_kernels=False):
1373
- np.random.seed(123)
1386
+ rng = np.random.default_rng(123)
1374
1387
 
1375
1388
  tol = {
1376
1389
  np.float16: 5.0e-3,
@@ -1404,8 +1417,10 @@ def test_spatial_matrix_scalar_multiplication(test, device, dtype, register_kern
1404
1417
  if register_kernels:
1405
1418
  return
1406
1419
 
1407
- s = wp.array(np.random.randn(1).astype(dtype), requires_grad=True, device=device)
1408
- q = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1420
+ s = wp.array(rng.standard_normal(size=1).astype(dtype), requires_grad=True, device=device)
1421
+ q = wp.array(
1422
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1423
+ )
1409
1424
 
1410
1425
  outcmps_l = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1411
1426
  outcmps_r = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
@@ -1444,7 +1459,7 @@ def test_spatial_matrix_scalar_multiplication(test, device, dtype, register_kern
1444
1459
 
1445
1460
 
1446
1461
  def test_spatial_matrix_add_sub(test, device, dtype, register_kernels=False):
1447
- np.random.seed(123)
1462
+ rng = np.random.default_rng(123)
1448
1463
 
1449
1464
  tol = {
1450
1465
  np.float16: 5.0e-3,
@@ -1476,8 +1491,12 @@ def test_spatial_matrix_add_sub(test, device, dtype, register_kernels=False):
1476
1491
  if register_kernels:
1477
1492
  return
1478
1493
 
1479
- q = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1480
- v = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1494
+ q = wp.array(
1495
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1496
+ )
1497
+ v = wp.array(
1498
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1499
+ )
1481
1500
 
1482
1501
  outputs_add = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1483
1502
  outputs_sub = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
@@ -1528,7 +1547,7 @@ def test_spatial_matrix_add_sub(test, device, dtype, register_kernels=False):
1528
1547
 
1529
1548
 
1530
1549
  def test_spatial_matvec_multiplication(test, device, dtype, register_kernels=False):
1531
- np.random.seed(123)
1550
+ rng = np.random.default_rng(123)
1532
1551
 
1533
1552
  tol = {
1534
1553
  np.float16: 2.0e-2,
@@ -1560,8 +1579,12 @@ def test_spatial_matvec_multiplication(test, device, dtype, register_kernels=Fal
1560
1579
  if register_kernels:
1561
1580
  return
1562
1581
 
1563
- v = wp.array(np.random.randn(1, 6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
1564
- m = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1582
+ v = wp.array(
1583
+ rng.standard_normal(size=(1, 6)).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device
1584
+ )
1585
+ m = wp.array(
1586
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1587
+ )
1565
1588
  outcomponents = wp.zeros(6, dtype=wptype, requires_grad=True, device=device)
1566
1589
 
1567
1590
  wp.launch(kernel, dim=1, inputs=[v, m], outputs=[outcomponents], device=device)
@@ -1585,7 +1608,7 @@ def test_spatial_matvec_multiplication(test, device, dtype, register_kernels=Fal
1585
1608
 
1586
1609
 
1587
1610
  def test_spatial_matmat_multiplication(test, device, dtype, register_kernels=False):
1588
- np.random.seed(123)
1611
+ rng = np.random.default_rng(123)
1589
1612
 
1590
1613
  tol = {
1591
1614
  np.float16: 2.0e-2,
@@ -1617,8 +1640,12 @@ def test_spatial_matmat_multiplication(test, device, dtype, register_kernels=Fal
1617
1640
  if register_kernels:
1618
1641
  return
1619
1642
 
1620
- v = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1621
- m = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1643
+ v = wp.array(
1644
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1645
+ )
1646
+ m = wp.array(
1647
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1648
+ )
1622
1649
  outcomponents = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1623
1650
 
1624
1651
  wp.launch(kernel, dim=1, inputs=[v, m], outputs=[outcomponents], device=device)
@@ -1648,7 +1675,7 @@ def test_spatial_matmat_multiplication(test, device, dtype, register_kernels=Fal
1648
1675
 
1649
1676
 
1650
1677
  def test_spatial_mat_transpose(test, device, dtype, register_kernels=False):
1651
- np.random.seed(123)
1678
+ rng = np.random.default_rng(123)
1652
1679
 
1653
1680
  tol = {
1654
1681
  np.float16: 1.0e-2,
@@ -1679,7 +1706,9 @@ def test_spatial_mat_transpose(test, device, dtype, register_kernels=False):
1679
1706
  if register_kernels:
1680
1707
  return
1681
1708
 
1682
- m = wp.array(np.random.randn(1, 6, 6).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device)
1709
+ m = wp.array(
1710
+ rng.standard_normal(size=(1, 6, 6)).astype(dtype), dtype=spatial_matrix, requires_grad=True, device=device
1711
+ )
1683
1712
  outcomponents = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1684
1713
 
1685
1714
  wp.launch(kernel, dim=1, inputs=[m], outputs=[outcomponents], device=device)
@@ -1703,7 +1732,7 @@ def test_spatial_mat_transpose(test, device, dtype, register_kernels=False):
1703
1732
 
1704
1733
 
1705
1734
  def test_spatial_outer_product(test, device, dtype, register_kernels=False):
1706
- np.random.seed(123)
1735
+ rng = np.random.default_rng(123)
1707
1736
 
1708
1737
  tol = {
1709
1738
  np.float16: 5.0e-3,
@@ -1735,8 +1764,12 @@ def test_spatial_outer_product(test, device, dtype, register_kernels=False):
1735
1764
  if register_kernels:
1736
1765
  return
1737
1766
 
1738
- s = wp.array(np.random.randn(1, 6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
1739
- v = wp.array(np.random.randn(1, 6).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device)
1767
+ s = wp.array(
1768
+ rng.standard_normal(size=(1, 6)).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device
1769
+ )
1770
+ v = wp.array(
1771
+ rng.standard_normal(size=(1, 6)).astype(dtype), dtype=spatial_vector, requires_grad=True, device=device
1772
+ )
1740
1773
  outcomponents = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1741
1774
 
1742
1775
  wp.launch(kernel, dim=1, inputs=[s, v], outputs=[outcomponents], device=device)
@@ -1779,7 +1812,7 @@ def test_spatial_outer_product(test, device, dtype, register_kernels=False):
1779
1812
 
1780
1813
 
1781
1814
  def test_spatial_adjoint(test, device, dtype, register_kernels=False):
1782
- np.random.seed(123)
1815
+ rng = np.random.default_rng(123)
1783
1816
 
1784
1817
  tol = {
1785
1818
  np.float16: 5.0e-3,
@@ -1811,8 +1844,8 @@ def test_spatial_adjoint(test, device, dtype, register_kernels=False):
1811
1844
  if register_kernels:
1812
1845
  return
1813
1846
 
1814
- R = wp.array(np.random.randn(1, 3, 3).astype(dtype), dtype=mat3, requires_grad=True, device=device)
1815
- S = wp.array(np.random.randn(1, 3, 3).astype(dtype), dtype=mat3, requires_grad=True, device=device)
1847
+ R = wp.array(rng.standard_normal(size=(1, 3, 3)).astype(dtype), dtype=mat3, requires_grad=True, device=device)
1848
+ S = wp.array(rng.standard_normal(size=(1, 3, 3)).astype(dtype), dtype=mat3, requires_grad=True, device=device)
1816
1849
  outcomponents = wp.zeros(6 * 6, dtype=wptype, requires_grad=True, device=device)
1817
1850
 
1818
1851
  wp.launch(kernel, dim=1, inputs=[R, S], outputs=[outcomponents], device=device)
@@ -1895,6 +1928,8 @@ def test_transform_identity(test, device, dtype, register_kernels=False):
1895
1928
 
1896
1929
 
1897
1930
  def test_transform_anon_type_instance(test, device, dtype, register_kernels=False):
1931
+ rng = np.random.default_rng(123)
1932
+
1898
1933
  wptype = wp.types.np_dtype_to_warp_type[np.dtype(dtype)]
1899
1934
 
1900
1935
  def transform_create_test(input: wp.array(dtype=wptype), output: wp.array(dtype=wptype)):
@@ -1910,7 +1945,7 @@ def test_transform_anon_type_instance(test, device, dtype, register_kernels=Fals
1910
1945
  if register_kernels:
1911
1946
  return
1912
1947
 
1913
- input = wp.array(np.random.randn(7).astype(dtype), requires_grad=True, device=device)
1948
+ input = wp.array(rng.standard_normal(size=7).astype(dtype), requires_grad=True, device=device)
1914
1949
  output = wp.zeros(7, dtype=wptype, requires_grad=True, device=device)
1915
1950
  wp.launch(transform_create_kernel, dim=1, inputs=[input], outputs=[output], device=device)
1916
1951
  assert_np_equal(output.numpy(), 2 * input.numpy())
@@ -1928,188 +1963,186 @@ def test_transform_anon_type_instance(test, device, dtype, register_kernels=Fals
1928
1963
  tape.zero()
1929
1964
 
1930
1965
 
1931
- def register(parent):
1932
- devices = get_test_devices()
1966
+ devices = get_test_devices()
1933
1967
 
1934
- class TestSpatial(parent):
1935
- pass
1936
1968
 
1937
- for dtype in np_float_types:
1938
- add_function_test_register_kernel(
1939
- TestSpatial,
1940
- f"test_spatial_vector_constructors_{dtype.__name__}",
1941
- test_spatial_vector_constructors,
1942
- devices=devices,
1943
- dtype=dtype,
1944
- )
1945
- add_function_test_register_kernel(
1946
- TestSpatial,
1947
- f"test_spatial_vector_indexing_{dtype.__name__}",
1948
- test_spatial_vector_indexing,
1949
- devices=devices,
1950
- dtype=dtype,
1951
- )
1952
- add_function_test_register_kernel(
1953
- TestSpatial,
1954
- f"test_spatial_vector_scalar_multiplication_{dtype.__name__}",
1955
- test_spatial_vector_scalar_multiplication,
1956
- devices=devices,
1957
- dtype=dtype,
1958
- )
1959
- add_function_test_register_kernel(
1960
- TestSpatial,
1961
- f"test_spatial_vector_add_sub_{dtype.__name__}",
1962
- test_spatial_vector_add_sub,
1963
- devices=devices,
1964
- dtype=dtype,
1965
- )
1966
- add_function_test_register_kernel(
1967
- TestSpatial, f"test_spatial_dot_{dtype.__name__}", test_spatial_dot, devices=devices, dtype=dtype
1968
- )
1969
- add_function_test_register_kernel(
1970
- TestSpatial, f"test_spatial_cross_{dtype.__name__}", test_spatial_cross, devices=devices, dtype=dtype
1971
- )
1972
- add_function_test_register_kernel(
1973
- TestSpatial,
1974
- f"test_spatial_top_bottom_{dtype.__name__}",
1975
- test_spatial_top_bottom,
1976
- devices=devices,
1977
- dtype=dtype,
1978
- )
1969
+ class TestSpatial(unittest.TestCase):
1970
+ pass
1979
1971
 
1980
- add_function_test_register_kernel(
1981
- TestSpatial,
1982
- f"test_transform_constructors_{dtype.__name__}",
1983
- test_transform_constructors,
1984
- devices=devices,
1985
- dtype=dtype,
1986
- )
1987
- add_function_test_register_kernel(
1988
- TestSpatial,
1989
- f"test_transform_anon_type_instance_{dtype.__name__}",
1990
- test_transform_anon_type_instance,
1991
- devices=devices,
1992
- dtype=dtype,
1993
- )
1994
- add_function_test_register_kernel(
1995
- TestSpatial,
1996
- f"test_transform_identity_{dtype.__name__}",
1997
- test_transform_identity,
1998
- devices=devices,
1999
- dtype=dtype,
2000
- )
2001
- add_function_test_register_kernel(
2002
- TestSpatial,
2003
- f"test_transform_indexing_{dtype.__name__}",
2004
- test_transform_indexing,
2005
- devices=devices,
2006
- dtype=dtype,
2007
- )
2008
- add_function_test_register_kernel(
2009
- TestSpatial,
2010
- f"test_transform_get_trans_rot_{dtype.__name__}",
2011
- test_transform_get_trans_rot,
2012
- devices=devices,
2013
- dtype=dtype,
2014
- )
2015
- add_function_test_register_kernel(
2016
- TestSpatial,
2017
- f"test_transform_multiply_{dtype.__name__}",
2018
- test_transform_multiply,
2019
- devices=devices,
2020
- dtype=dtype,
2021
- )
2022
- add_function_test_register_kernel(
2023
- TestSpatial,
2024
- f"test_transform_inverse_{dtype.__name__}",
2025
- test_transform_inverse,
2026
- devices=devices,
2027
- dtype=dtype,
2028
- )
2029
- add_function_test_register_kernel(
2030
- TestSpatial,
2031
- f"test_transform_point_vector_{dtype.__name__}",
2032
- test_transform_point_vector,
2033
- devices=devices,
2034
- dtype=dtype,
2035
- )
2036
1972
 
2037
- # are these two valid? They don't seem to be doing things you'd want to do,
2038
- # maybe they should be removed
2039
- add_function_test_register_kernel(
2040
- TestSpatial,
2041
- f"test_transform_scalar_multiplication_{dtype.__name__}",
2042
- test_transform_scalar_multiplication,
2043
- devices=devices,
2044
- dtype=dtype,
2045
- )
2046
- add_function_test_register_kernel(
2047
- TestSpatial,
2048
- f"test_transform_add_sub_{dtype.__name__}",
2049
- test_transform_add_sub,
2050
- devices=devices,
2051
- dtype=dtype,
2052
- )
1973
+ for dtype in np_float_types:
1974
+ add_function_test_register_kernel(
1975
+ TestSpatial,
1976
+ f"test_spatial_vector_constructors_{dtype.__name__}",
1977
+ test_spatial_vector_constructors,
1978
+ devices=devices,
1979
+ dtype=dtype,
1980
+ )
1981
+ add_function_test_register_kernel(
1982
+ TestSpatial,
1983
+ f"test_spatial_vector_indexing_{dtype.__name__}",
1984
+ test_spatial_vector_indexing,
1985
+ devices=devices,
1986
+ dtype=dtype,
1987
+ )
1988
+ add_function_test_register_kernel(
1989
+ TestSpatial,
1990
+ f"test_spatial_vector_scalar_multiplication_{dtype.__name__}",
1991
+ test_spatial_vector_scalar_multiplication,
1992
+ devices=devices,
1993
+ dtype=dtype,
1994
+ )
1995
+ add_function_test_register_kernel(
1996
+ TestSpatial,
1997
+ f"test_spatial_vector_add_sub_{dtype.__name__}",
1998
+ test_spatial_vector_add_sub,
1999
+ devices=devices,
2000
+ dtype=dtype,
2001
+ )
2002
+ add_function_test_register_kernel(
2003
+ TestSpatial, f"test_spatial_dot_{dtype.__name__}", test_spatial_dot, devices=devices, dtype=dtype
2004
+ )
2005
+ add_function_test_register_kernel(
2006
+ TestSpatial, f"test_spatial_cross_{dtype.__name__}", test_spatial_cross, devices=devices, dtype=dtype
2007
+ )
2008
+ add_function_test_register_kernel(
2009
+ TestSpatial,
2010
+ f"test_spatial_top_bottom_{dtype.__name__}",
2011
+ test_spatial_top_bottom,
2012
+ devices=devices,
2013
+ dtype=dtype,
2014
+ )
2053
2015
 
2054
- add_function_test_register_kernel(
2055
- TestSpatial,
2056
- f"test_spatial_matrix_constructors_{dtype.__name__}",
2057
- test_spatial_matrix_constructors,
2058
- devices=devices,
2059
- dtype=dtype,
2060
- )
2061
- add_function_test_register_kernel(
2062
- TestSpatial,
2063
- f"test_spatial_matrix_indexing_{dtype.__name__}",
2064
- test_spatial_matrix_indexing,
2065
- devices=devices,
2066
- dtype=dtype,
2067
- )
2068
- add_function_test_register_kernel(
2069
- TestSpatial,
2070
- f"test_spatial_matrix_scalar_multiplication_{dtype.__name__}",
2071
- test_spatial_matrix_scalar_multiplication,
2072
- devices=devices,
2073
- dtype=dtype,
2074
- )
2075
- add_function_test_register_kernel(
2076
- TestSpatial,
2077
- f"test_spatial_matrix_add_sub_{dtype.__name__}",
2078
- test_spatial_matrix_add_sub,
2079
- devices=devices,
2080
- dtype=dtype,
2081
- )
2082
- add_function_test_register_kernel(
2083
- TestSpatial,
2084
- f"test_spatial_matvec_multiplication_{dtype.__name__}",
2085
- test_spatial_matvec_multiplication,
2086
- devices=devices,
2087
- dtype=dtype,
2088
- )
2089
- add_function_test_register_kernel(
2090
- TestSpatial,
2091
- f"test_spatial_matmat_multiplication_{dtype.__name__}",
2092
- test_spatial_matmat_multiplication,
2093
- devices=devices,
2094
- dtype=dtype,
2095
- )
2096
- add_function_test_register_kernel(
2097
- TestSpatial,
2098
- f"test_spatial_outer_product_{dtype.__name__}",
2099
- test_spatial_outer_product,
2100
- devices=devices,
2101
- dtype=dtype,
2102
- )
2103
- add_function_test_register_kernel(
2104
- TestSpatial, f"test_spatial_adjoint_{dtype.__name__}", test_spatial_adjoint, devices=devices, dtype=dtype
2105
- )
2016
+ add_function_test_register_kernel(
2017
+ TestSpatial,
2018
+ f"test_transform_constructors_{dtype.__name__}",
2019
+ test_transform_constructors,
2020
+ devices=devices,
2021
+ dtype=dtype,
2022
+ )
2023
+ add_function_test_register_kernel(
2024
+ TestSpatial,
2025
+ f"test_transform_anon_type_instance_{dtype.__name__}",
2026
+ test_transform_anon_type_instance,
2027
+ devices=devices,
2028
+ dtype=dtype,
2029
+ )
2030
+ add_function_test_register_kernel(
2031
+ TestSpatial,
2032
+ f"test_transform_identity_{dtype.__name__}",
2033
+ test_transform_identity,
2034
+ devices=devices,
2035
+ dtype=dtype,
2036
+ )
2037
+ add_function_test_register_kernel(
2038
+ TestSpatial,
2039
+ f"test_transform_indexing_{dtype.__name__}",
2040
+ test_transform_indexing,
2041
+ devices=devices,
2042
+ dtype=dtype,
2043
+ )
2044
+ add_function_test_register_kernel(
2045
+ TestSpatial,
2046
+ f"test_transform_get_trans_rot_{dtype.__name__}",
2047
+ test_transform_get_trans_rot,
2048
+ devices=devices,
2049
+ dtype=dtype,
2050
+ )
2051
+ add_function_test_register_kernel(
2052
+ TestSpatial,
2053
+ f"test_transform_multiply_{dtype.__name__}",
2054
+ test_transform_multiply,
2055
+ devices=devices,
2056
+ dtype=dtype,
2057
+ )
2058
+ add_function_test_register_kernel(
2059
+ TestSpatial,
2060
+ f"test_transform_inverse_{dtype.__name__}",
2061
+ test_transform_inverse,
2062
+ devices=devices,
2063
+ dtype=dtype,
2064
+ )
2065
+ add_function_test_register_kernel(
2066
+ TestSpatial,
2067
+ f"test_transform_point_vector_{dtype.__name__}",
2068
+ test_transform_point_vector,
2069
+ devices=devices,
2070
+ dtype=dtype,
2071
+ )
2072
+
2073
+ # are these two valid? They don't seem to be doing things you'd want to do,
2074
+ # maybe they should be removed
2075
+ add_function_test_register_kernel(
2076
+ TestSpatial,
2077
+ f"test_transform_scalar_multiplication_{dtype.__name__}",
2078
+ test_transform_scalar_multiplication,
2079
+ devices=devices,
2080
+ dtype=dtype,
2081
+ )
2082
+ add_function_test_register_kernel(
2083
+ TestSpatial,
2084
+ f"test_transform_add_sub_{dtype.__name__}",
2085
+ test_transform_add_sub,
2086
+ devices=devices,
2087
+ dtype=dtype,
2088
+ )
2106
2089
 
2107
- # \TODO: test spatial_mass and spatial_jacobian
2090
+ add_function_test_register_kernel(
2091
+ TestSpatial,
2092
+ f"test_spatial_matrix_constructors_{dtype.__name__}",
2093
+ test_spatial_matrix_constructors,
2094
+ devices=devices,
2095
+ dtype=dtype,
2096
+ )
2097
+ add_function_test_register_kernel(
2098
+ TestSpatial,
2099
+ f"test_spatial_matrix_indexing_{dtype.__name__}",
2100
+ test_spatial_matrix_indexing,
2101
+ devices=devices,
2102
+ dtype=dtype,
2103
+ )
2104
+ add_function_test_register_kernel(
2105
+ TestSpatial,
2106
+ f"test_spatial_matrix_scalar_multiplication_{dtype.__name__}",
2107
+ test_spatial_matrix_scalar_multiplication,
2108
+ devices=devices,
2109
+ dtype=dtype,
2110
+ )
2111
+ add_function_test_register_kernel(
2112
+ TestSpatial,
2113
+ f"test_spatial_matrix_add_sub_{dtype.__name__}",
2114
+ test_spatial_matrix_add_sub,
2115
+ devices=devices,
2116
+ dtype=dtype,
2117
+ )
2118
+ add_function_test_register_kernel(
2119
+ TestSpatial,
2120
+ f"test_spatial_matvec_multiplication_{dtype.__name__}",
2121
+ test_spatial_matvec_multiplication,
2122
+ devices=devices,
2123
+ dtype=dtype,
2124
+ )
2125
+ add_function_test_register_kernel(
2126
+ TestSpatial,
2127
+ f"test_spatial_matmat_multiplication_{dtype.__name__}",
2128
+ test_spatial_matmat_multiplication,
2129
+ devices=devices,
2130
+ dtype=dtype,
2131
+ )
2132
+ add_function_test_register_kernel(
2133
+ TestSpatial,
2134
+ f"test_spatial_outer_product_{dtype.__name__}",
2135
+ test_spatial_outer_product,
2136
+ devices=devices,
2137
+ dtype=dtype,
2138
+ )
2139
+ add_function_test_register_kernel(
2140
+ TestSpatial, f"test_spatial_adjoint_{dtype.__name__}", test_spatial_adjoint, devices=devices, dtype=dtype
2141
+ )
2108
2142
 
2109
- return TestSpatial
2143
+ # \TODO: test spatial_mass and spatial_jacobian
2110
2144
 
2111
2145
 
2112
2146
  if __name__ == "__main__":
2113
2147
  wp.build.clear_kernel_cache()
2114
- c = register(unittest.TestCase)
2115
2148
  unittest.main(verbosity=2)