warp-lang 1.1.0__py3-none-macosx_10_13_universal2.whl → 1.2.0__py3-none-macosx_10_13_universal2.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 (218) hide show
  1. warp/bin/libwarp-clang.dylib +0 -0
  2. warp/bin/libwarp.dylib +0 -0
  3. warp/build.py +10 -37
  4. warp/build_dll.py +2 -2
  5. warp/builtins.py +274 -6
  6. warp/codegen.py +51 -4
  7. warp/config.py +2 -2
  8. warp/constants.py +4 -0
  9. warp/context.py +418 -203
  10. warp/examples/benchmarks/benchmark_api.py +0 -2
  11. warp/examples/benchmarks/benchmark_cloth_warp.py +0 -1
  12. warp/examples/benchmarks/benchmark_launches.py +0 -2
  13. warp/examples/core/example_dem.py +0 -2
  14. warp/examples/core/example_fluid.py +0 -2
  15. warp/examples/core/example_graph_capture.py +0 -2
  16. warp/examples/core/example_marching_cubes.py +0 -2
  17. warp/examples/core/example_mesh.py +0 -2
  18. warp/examples/core/example_mesh_intersect.py +0 -2
  19. warp/examples/core/example_nvdb.py +0 -2
  20. warp/examples/core/example_raycast.py +0 -2
  21. warp/examples/core/example_raymarch.py +0 -2
  22. warp/examples/core/example_render_opengl.py +0 -2
  23. warp/examples/core/example_sph.py +0 -2
  24. warp/examples/core/example_torch.py +0 -3
  25. warp/examples/core/example_wave.py +0 -2
  26. warp/examples/fem/example_apic_fluid.py +140 -115
  27. warp/examples/fem/example_burgers.py +262 -0
  28. warp/examples/fem/example_convection_diffusion.py +0 -2
  29. warp/examples/fem/example_convection_diffusion_dg.py +0 -2
  30. warp/examples/fem/example_deformed_geometry.py +0 -2
  31. warp/examples/fem/example_diffusion.py +0 -2
  32. warp/examples/fem/example_diffusion_3d.py +5 -4
  33. warp/examples/fem/example_diffusion_mgpu.py +0 -2
  34. warp/examples/fem/example_mixed_elasticity.py +0 -2
  35. warp/examples/fem/example_navier_stokes.py +0 -2
  36. warp/examples/fem/example_stokes.py +0 -2
  37. warp/examples/fem/example_stokes_transfer.py +0 -2
  38. warp/examples/optim/example_bounce.py +0 -2
  39. warp/examples/optim/example_cloth_throw.py +0 -2
  40. warp/examples/optim/example_diffray.py +0 -2
  41. warp/examples/optim/example_drone.py +0 -2
  42. warp/examples/optim/example_inverse_kinematics.py +0 -2
  43. warp/examples/optim/example_inverse_kinematics_torch.py +0 -2
  44. warp/examples/optim/example_spring_cage.py +0 -2
  45. warp/examples/optim/example_trajectory.py +0 -2
  46. warp/examples/optim/example_walker.py +0 -2
  47. warp/examples/sim/example_cartpole.py +0 -2
  48. warp/examples/sim/example_cloth.py +0 -2
  49. warp/examples/sim/example_granular.py +0 -2
  50. warp/examples/sim/example_granular_collision_sdf.py +0 -2
  51. warp/examples/sim/example_jacobian_ik.py +0 -2
  52. warp/examples/sim/example_particle_chain.py +0 -2
  53. warp/examples/sim/example_quadruped.py +0 -2
  54. warp/examples/sim/example_rigid_chain.py +0 -2
  55. warp/examples/sim/example_rigid_contact.py +0 -2
  56. warp/examples/sim/example_rigid_force.py +0 -2
  57. warp/examples/sim/example_rigid_gyroscopic.py +0 -2
  58. warp/examples/sim/example_rigid_soft_contact.py +0 -2
  59. warp/examples/sim/example_soft_body.py +0 -2
  60. warp/fem/__init__.py +1 -0
  61. warp/fem/cache.py +3 -1
  62. warp/fem/geometry/__init__.py +1 -0
  63. warp/fem/geometry/element.py +4 -0
  64. warp/fem/geometry/grid_3d.py +0 -4
  65. warp/fem/geometry/nanogrid.py +455 -0
  66. warp/fem/integrate.py +63 -9
  67. warp/fem/space/__init__.py +43 -158
  68. warp/fem/space/basis_space.py +34 -0
  69. warp/fem/space/collocated_function_space.py +1 -1
  70. warp/fem/space/grid_2d_function_space.py +13 -132
  71. warp/fem/space/grid_3d_function_space.py +16 -154
  72. warp/fem/space/hexmesh_function_space.py +37 -134
  73. warp/fem/space/nanogrid_function_space.py +202 -0
  74. warp/fem/space/quadmesh_2d_function_space.py +12 -119
  75. warp/fem/space/restriction.py +4 -1
  76. warp/fem/space/shape/__init__.py +77 -0
  77. warp/fem/space/shape/cube_shape_function.py +5 -15
  78. warp/fem/space/tetmesh_function_space.py +6 -76
  79. warp/fem/space/trimesh_2d_function_space.py +6 -76
  80. warp/native/array.h +12 -3
  81. warp/native/builtin.h +48 -5
  82. warp/native/bvh.cpp +14 -10
  83. warp/native/bvh.cu +23 -15
  84. warp/native/bvh.h +1 -0
  85. warp/native/clang/clang.cpp +2 -1
  86. warp/native/crt.cpp +11 -1
  87. warp/native/crt.h +18 -1
  88. warp/native/exports.h +187 -0
  89. warp/native/mat.h +47 -0
  90. warp/native/mesh.cpp +1 -1
  91. warp/native/mesh.cu +1 -2
  92. warp/native/nanovdb/GridHandle.h +366 -0
  93. warp/native/nanovdb/HostBuffer.h +590 -0
  94. warp/native/nanovdb/NanoVDB.h +3999 -2157
  95. warp/native/nanovdb/PNanoVDB.h +936 -99
  96. warp/native/quat.h +28 -1
  97. warp/native/rand.h +5 -1
  98. warp/native/vec.h +45 -1
  99. warp/native/volume.cpp +335 -103
  100. warp/native/volume.cu +39 -13
  101. warp/native/volume.h +725 -303
  102. warp/native/volume_builder.cu +381 -360
  103. warp/native/volume_builder.h +16 -1
  104. warp/native/volume_impl.h +61 -0
  105. warp/native/warp.cu +8 -2
  106. warp/native/warp.h +15 -7
  107. warp/render/render_opengl.py +191 -52
  108. warp/sim/integrator_featherstone.py +10 -3
  109. warp/sim/integrator_xpbd.py +16 -22
  110. warp/sparse.py +89 -27
  111. warp/stubs.py +83 -0
  112. warp/tests/assets/test_index_grid.nvdb +0 -0
  113. warp/tests/aux_test_dependent.py +0 -2
  114. warp/tests/aux_test_grad_customs.py +0 -2
  115. warp/tests/aux_test_reference.py +0 -2
  116. warp/tests/aux_test_reference_reference.py +0 -2
  117. warp/tests/aux_test_square.py +0 -2
  118. warp/tests/disabled_kinematics.py +0 -2
  119. warp/tests/test_adam.py +0 -2
  120. warp/tests/test_arithmetic.py +0 -36
  121. warp/tests/test_array.py +9 -11
  122. warp/tests/test_array_reduce.py +0 -2
  123. warp/tests/test_async.py +0 -2
  124. warp/tests/test_atomic.py +0 -2
  125. warp/tests/test_bool.py +58 -50
  126. warp/tests/test_builtins_resolution.py +0 -2
  127. warp/tests/test_bvh.py +0 -2
  128. warp/tests/test_closest_point_edge_edge.py +0 -1
  129. warp/tests/test_codegen.py +0 -4
  130. warp/tests/test_compile_consts.py +130 -10
  131. warp/tests/test_conditional.py +0 -2
  132. warp/tests/test_copy.py +0 -2
  133. warp/tests/test_ctypes.py +6 -8
  134. warp/tests/test_dense.py +0 -2
  135. warp/tests/test_devices.py +0 -2
  136. warp/tests/test_dlpack.py +9 -11
  137. warp/tests/test_examples.py +42 -39
  138. warp/tests/test_fabricarray.py +0 -3
  139. warp/tests/test_fast_math.py +0 -2
  140. warp/tests/test_fem.py +75 -54
  141. warp/tests/test_fp16.py +0 -2
  142. warp/tests/test_func.py +0 -2
  143. warp/tests/test_generics.py +27 -2
  144. warp/tests/test_grad.py +147 -8
  145. warp/tests/test_grad_customs.py +0 -2
  146. warp/tests/test_hash_grid.py +1 -3
  147. warp/tests/test_import.py +0 -2
  148. warp/tests/test_indexedarray.py +0 -2
  149. warp/tests/test_intersect.py +0 -2
  150. warp/tests/test_jax.py +0 -2
  151. warp/tests/test_large.py +11 -9
  152. warp/tests/test_launch.py +0 -2
  153. warp/tests/test_lerp.py +10 -54
  154. warp/tests/test_linear_solvers.py +3 -5
  155. warp/tests/test_lvalue.py +0 -2
  156. warp/tests/test_marching_cubes.py +0 -2
  157. warp/tests/test_mat.py +0 -2
  158. warp/tests/test_mat_lite.py +0 -2
  159. warp/tests/test_mat_scalar_ops.py +0 -2
  160. warp/tests/test_math.py +0 -2
  161. warp/tests/test_matmul.py +35 -37
  162. warp/tests/test_matmul_lite.py +29 -31
  163. warp/tests/test_mempool.py +0 -2
  164. warp/tests/test_mesh.py +0 -3
  165. warp/tests/test_mesh_query_aabb.py +0 -2
  166. warp/tests/test_mesh_query_point.py +0 -2
  167. warp/tests/test_mesh_query_ray.py +0 -2
  168. warp/tests/test_mlp.py +0 -2
  169. warp/tests/test_model.py +0 -2
  170. warp/tests/test_module_hashing.py +111 -0
  171. warp/tests/test_modules_lite.py +0 -3
  172. warp/tests/test_multigpu.py +0 -2
  173. warp/tests/test_noise.py +0 -4
  174. warp/tests/test_operators.py +0 -2
  175. warp/tests/test_options.py +0 -2
  176. warp/tests/test_peer.py +0 -2
  177. warp/tests/test_pinned.py +0 -2
  178. warp/tests/test_print.py +0 -2
  179. warp/tests/test_quat.py +0 -2
  180. warp/tests/test_rand.py +41 -5
  181. warp/tests/test_reload.py +0 -10
  182. warp/tests/test_rounding.py +0 -2
  183. warp/tests/test_runlength_encode.py +0 -2
  184. warp/tests/test_sim_grad.py +0 -2
  185. warp/tests/test_sim_kinematics.py +0 -2
  186. warp/tests/test_smoothstep.py +0 -2
  187. warp/tests/test_snippet.py +0 -2
  188. warp/tests/test_sparse.py +0 -2
  189. warp/tests/test_spatial.py +0 -2
  190. warp/tests/test_special_values.py +362 -0
  191. warp/tests/test_streams.py +0 -2
  192. warp/tests/test_struct.py +0 -2
  193. warp/tests/test_tape.py +0 -2
  194. warp/tests/test_torch.py +0 -2
  195. warp/tests/test_transient_module.py +0 -2
  196. warp/tests/test_types.py +0 -2
  197. warp/tests/test_utils.py +0 -2
  198. warp/tests/test_vec.py +0 -2
  199. warp/tests/test_vec_lite.py +0 -2
  200. warp/tests/test_vec_scalar_ops.py +0 -2
  201. warp/tests/test_verify_fp.py +0 -2
  202. warp/tests/test_volume.py +237 -13
  203. warp/tests/test_volume_write.py +86 -3
  204. warp/tests/unittest_serial.py +10 -9
  205. warp/tests/unittest_suites.py +6 -2
  206. warp/tests/unittest_utils.py +2 -171
  207. warp/tests/unused_test_misc.py +0 -2
  208. warp/tests/walkthrough_debug.py +1 -1
  209. warp/thirdparty/unittest_parallel.py +37 -40
  210. warp/types.py +514 -77
  211. {warp_lang-1.1.0.dist-info → warp_lang-1.2.0.dist-info}/METADATA +57 -30
  212. warp_lang-1.2.0.dist-info/RECORD +359 -0
  213. warp/examples/fem/example_convection_diffusion_dg0.py +0 -204
  214. warp/native/nanovdb/PNanoVDBWrite.h +0 -295
  215. warp_lang-1.1.0.dist-info/RECORD +0 -352
  216. {warp_lang-1.1.0.dist-info → warp_lang-1.2.0.dist-info}/LICENSE.md +0 -0
  217. {warp_lang-1.1.0.dist-info → warp_lang-1.2.0.dist-info}/WHEEL +0 -0
  218. {warp_lang-1.1.0.dist-info → warp_lang-1.2.0.dist-info}/top_level.txt +0 -0
@@ -316,70 +316,6 @@ def add_function_test_register_kernel(cls, name, func, devices=None, **kwargs):
316
316
  add_function_test(cls, name, func, devices=devices, **kwargs)
317
317
 
318
318
 
319
- class TeamCityTestResult(unittest.TextTestResult):
320
- """This class will report each test result to TeamCity"""
321
-
322
- def __init__(self, stream, descriptions, verbosity):
323
- super(TeamCityTestResult, self).__init__(stream, descriptions, verbosity)
324
-
325
- def addSuccess(self, test):
326
- super(TeamCityTestResult, self).addSuccess(test)
327
- self.reportSuccess(test)
328
-
329
- def addError(self, test, err):
330
- super(TeamCityTestResult, self).addError(test, err)
331
- self.reportFailure(test)
332
-
333
- def addFailure(self, test, err):
334
- super(TeamCityTestResult, self).addFailure(test, err)
335
- self.reportFailure(test)
336
-
337
- def addSkip(self, test, reason):
338
- super(TeamCityTestResult, self).addSkip(test, reason)
339
-
340
- def addExpectedFailure(self, test, err):
341
- super(TeamCityTestResult, self).addExpectedFailure(test, err)
342
- self.reportSuccess(test)
343
-
344
- def addUnexpectedSuccess(self, test):
345
- super(TeamCityTestResult, self).addUnexpectedSuccess(test)
346
- self.reportFailure(test)
347
-
348
- def reportSuccess(self, test):
349
- test_id = test.id()
350
- print(f"##teamcity[testStarted name='{test_id}']")
351
- print(f"##teamcity[testFinished name='{test_id}']")
352
-
353
- def reportFailure(self, test):
354
- test_id = test.id()
355
- print(f"##teamcity[testStarted name='{test_id}']")
356
- print(f"##teamcity[testFailed name='{test_id}']")
357
- print(f"##teamcity[testFinished name='{test_id}']")
358
-
359
-
360
- class TeamCityTestRunner(unittest.TextTestRunner):
361
- """Test runner that will report test results to TeamCity if running in TeamCity"""
362
-
363
- def __init__(self, **kwargs):
364
- self.running_in_teamcity = os.environ.get("TEAMCITY_VERSION") is not None
365
- if self.running_in_teamcity:
366
- kwargs["resultclass"] = TeamCityTestResult
367
- super(TeamCityTestRunner, self).__init__(**kwargs)
368
-
369
- def run(self, test, name):
370
- if self.running_in_teamcity:
371
- print(f"##teamcity[testSuiteStarted name='{name}']")
372
-
373
- result = super(TeamCityTestRunner, self).run(test)
374
-
375
- if self.running_in_teamcity:
376
- print(f"##teamcity[testSuiteFinished name='{name}']")
377
- if not result.wasSuccessful():
378
- print("##teamcity[buildStatus status='FAILURE']")
379
-
380
- return result
381
-
382
-
383
319
  def write_junit_results(
384
320
  outfile: str,
385
321
  test_records: list,
@@ -397,7 +333,7 @@ def write_junit_results(
397
333
  import xml.etree.ElementTree as ET
398
334
 
399
335
  root = ET.Element(
400
- "testsuites",
336
+ "testsuite",
401
337
  name="Warp Tests",
402
338
  failures=str(tests_failed),
403
339
  errors=str(tests_errored),
@@ -412,11 +348,7 @@ def write_junit_results(
412
348
  test_status = test_data[2]
413
349
 
414
350
  test_case = ET.SubElement(
415
- root,
416
- "testcase",
417
- classname=test.__class__.__name__,
418
- name=test._testMethodName,
419
- time=f"{test_duration:.3f}",
351
+ root, "testcase", classname=test.__class__.__name__, name=test._testMethodName, time=f"{test_duration:.3f}"
420
352
  )
421
353
 
422
354
  if test_status == "FAIL":
@@ -500,104 +432,3 @@ class ParallelJunitTestResult(unittest.TextTestResult):
500
432
 
501
433
  def printErrors(self):
502
434
  pass
503
-
504
-
505
- def _tc_escape(s):
506
- """Modifies strings so they can be used in TeamCity log messages."""
507
- s = s.replace("|", "||")
508
- s = s.replace("\n", "|n")
509
- s = s.replace("\r", "|r")
510
- s = s.replace("'", "|'")
511
- s = s.replace("[", "|[")
512
- s = s.replace("]", "|]")
513
- return s
514
-
515
-
516
- class ParallelTeamCityTestResult(unittest.TextTestResult):
517
- def __init__(self, stream, descriptions, verbosity):
518
- stream = type(stream)(sys.stderr)
519
- super().__init__(stream, descriptions, verbosity)
520
- self.test_record = []
521
-
522
- def startTest(self, test):
523
- if self.showAll:
524
- self.stream.writeln(f"{self.getDescription(test)} ...")
525
- self.stream.flush()
526
- self.start_time = time.perf_counter_ns()
527
- super(unittest.TextTestResult, self).startTest(test)
528
-
529
- def _add_helper(self, test, dots_message, show_all_message):
530
- if self.showAll:
531
- self.stream.writeln(f"{self.getDescription(test)} ... {show_all_message}")
532
- elif self.dots:
533
- self.stream.write(dots_message)
534
- self.stream.flush()
535
-
536
- def addSuccess(self, test):
537
- super(unittest.TextTestResult, self).addSuccess(test)
538
- self._add_helper(test, ".", "ok")
539
- self.reportSuccess(test)
540
-
541
- def addError(self, test, err):
542
- super(unittest.TextTestResult, self).addError(test, err)
543
- self._add_helper(test, "E", "ERROR")
544
- self.reportFailure(test, err)
545
-
546
- def addFailure(self, test, err):
547
- super(unittest.TextTestResult, self).addFailure(test, err)
548
- self._add_helper(test, "F", "FAIL")
549
- self.reportFailure(test, err)
550
-
551
- def addSkip(self, test, reason):
552
- super(unittest.TextTestResult, self).addSkip(test, reason)
553
- self._add_helper(test, "s", f"skipped {reason!r}")
554
- self.reportIgnored(test, reason)
555
-
556
- def addExpectedFailure(self, test, err):
557
- super(unittest.TextTestResult, self).addExpectedFailure(test, err)
558
- self._add_helper(test, "x", "expected failure")
559
- self.reportSuccess(test)
560
-
561
- def addUnexpectedSuccess(self, test):
562
- super(unittest.TextTestResult, self).addUnexpectedSuccess(test)
563
- self._add_helper(test, "u", "unexpected success")
564
- self.reportFailure(test, "unexpected success")
565
-
566
- def addSubTest(self, test, subtest, err):
567
- super(unittest.TextTestResult, self).addSubTest(test, subtest, err)
568
- if err is not None:
569
- self._add_helper(test, "E", "ERROR")
570
- self.reportSubTestFailure(test, err)
571
-
572
- def printErrors(self):
573
- pass
574
-
575
- def reportIgnored(self, test, reason):
576
- test_id = test.id()
577
- self.stream.writeln(f"##teamcity[testIgnored name='{test_id}' message='{_tc_escape(str(reason))}']")
578
- self.stream.flush()
579
-
580
- def reportSuccess(self, test):
581
- duration = round((time.perf_counter_ns() - self.start_time) / 1e6) # [ms]
582
- test_id = test.id()
583
- self.stream.writeln(f"##teamcity[testStarted name='{test_id}']")
584
- self.stream.writeln(f"##teamcity[testFinished name='{test_id}' duration='{duration}']")
585
- self.stream.flush()
586
-
587
- def reportFailure(self, test, err):
588
- test_id = test.id()
589
- self.stream.writeln(f"##teamcity[testStarted name='{test_id}']")
590
- self.stream.writeln(
591
- f"##teamcity[testFailed name='{test_id}' message='{_tc_escape(str(err[1]))}' details='{_tc_escape(self._exc_info_to_string(err, test))}']"
592
- )
593
- self.stream.writeln(f"##teamcity[testFinished name='{test_id}']")
594
- self.stream.flush()
595
-
596
- def reportSubTestFailure(self, test, err):
597
- test_id = test.id()
598
- self.stream.writeln(f"##teamcity[testStarted name='{test_id}']")
599
- self.stream.writeln(
600
- f"##teamcity[testFailed name='{test_id}' message='{_tc_escape(str(err[1]))}' details='{_tc_escape(self._exc_info_to_string(err, test))}']"
601
- )
602
- self.stream.writeln(f"##teamcity[testFinished name='{test_id}']")
603
- self.stream.flush()
@@ -9,8 +9,6 @@ import numpy as np
9
9
 
10
10
  import warp as wp
11
11
 
12
- wp.init()
13
-
14
12
 
15
13
  @wp.kernel
16
14
  def arange(out: wp.array(dtype=int)):
@@ -26,7 +26,7 @@
26
26
  },
27
27
  {
28
28
  "name": "Python: Current File",
29
- "type": "python",
29
+ "type": "debugpy",
30
30
  "request": "launch",
31
31
  "program": "${file}",
32
32
  "console": "integratedTerminal",
@@ -29,7 +29,6 @@ from io import StringIO
29
29
  import warp.tests.unittest_suites # NVIDIA Modification
30
30
  from warp.tests.unittest_utils import ( # NVIDIA modification
31
31
  ParallelJunitTestResult,
32
- ParallelTeamCityTestResult,
33
32
  write_junit_results,
34
33
  )
35
34
 
@@ -42,8 +41,6 @@ except ImportError:
42
41
 
43
42
 
44
43
  # The following variables are NVIDIA Modifications
45
- RUNNING_IN_TEAMCITY = os.environ.get("TEAMCITY_VERSION") is not None
46
- TEST_SUITE_NAME = "WarpTests"
47
44
  START_DIRECTORY = os.path.dirname(__file__) # The directory to start test discovery
48
45
 
49
46
 
@@ -154,6 +151,10 @@ def main(argv=None):
154
151
  group_coverage.add_argument(
155
152
  "--coverage-fail-under", metavar="MIN", type=float, help="Fail if coverage percentage under min"
156
153
  )
154
+ group_warp = parser.add_argument_group("NVIDIA Warp options") # NVIDIA Modification
155
+ group_warp.add_argument(
156
+ "--no-shared-cache", action="store_true", help="Use a separate kernel cache per test process."
157
+ )
157
158
  args = parser.parse_args(args=argv)
158
159
 
159
160
  if args.coverage_branch:
@@ -169,6 +170,12 @@ def main(argv=None):
169
170
  process_count = multiprocessing.cpu_count()
170
171
  process_count = min(process_count, args.maxjobs) # NVIDIA Modification
171
172
 
173
+ import warp as wp # NVIDIA Modification
174
+
175
+ # Clear the Warp cache (NVIDIA Modification)
176
+ wp.build.clear_kernel_cache()
177
+ print("Cleared Warp kernel cache")
178
+
172
179
  # Create the temporary directory (for coverage files)
173
180
  with tempfile.TemporaryDirectory() as temp_dir:
174
181
  # Discover tests
@@ -201,9 +208,6 @@ def main(argv=None):
201
208
  # Don't use more processes than test suites
202
209
  process_count = max(1, min(len(test_suites), process_count))
203
210
 
204
- if RUNNING_IN_TEAMCITY:
205
- print(f"##teamcity[testSuiteStarted name='{TEST_SUITE_NAME}']") # NVIDIA Modification for TC
206
-
207
211
  if not args.serial_fallback:
208
212
  # Report test suites and processes
209
213
  print(
@@ -226,7 +230,7 @@ def main(argv=None):
226
230
  with multiprocessing_context.Pool(
227
231
  process_count,
228
232
  maxtasksperchild=maxtasksperchild,
229
- initializer=set_worker_cache,
233
+ initializer=initialize_test_process,
230
234
  initargs=(manager.Lock(), shared_index, args, temp_dir),
231
235
  ) as pool:
232
236
  test_manager = ParallelTestManager(manager, args, temp_dir)
@@ -236,7 +240,7 @@ def main(argv=None):
236
240
  with concurrent.futures.ProcessPoolExecutor(
237
241
  max_workers=process_count,
238
242
  mp_context=multiprocessing.get_context(method="spawn"),
239
- initializer=set_worker_cache,
243
+ initializer=initialize_test_process,
240
244
  initargs=(manager.Lock(), shared_index, args, temp_dir),
241
245
  ) as executor:
242
246
  test_manager = ParallelTestManager(manager, args, temp_dir)
@@ -249,14 +253,6 @@ def main(argv=None):
249
253
  if args.verbose > 1:
250
254
  print(file=sys.stderr)
251
255
 
252
- import warp as wp
253
-
254
- wp.init()
255
-
256
- # force rebuild of all kernels
257
- wp.build.clear_kernel_cache()
258
- print("Cleared Warp kernel cache")
259
-
260
256
  # Run the tests in serial
261
257
  start_time = time.perf_counter()
262
258
 
@@ -267,9 +263,6 @@ def main(argv=None):
267
263
  stop_time = time.perf_counter()
268
264
  test_duration = stop_time - start_time
269
265
 
270
- if RUNNING_IN_TEAMCITY:
271
- print(f"##teamcity[testSuiteFinished name='{TEST_SUITE_NAME}']") # NVIDIA Modification for TC
272
-
273
266
  # Aggregate parallel test run results
274
267
  tests_run = 0
275
268
  errors = []
@@ -331,8 +324,6 @@ def main(argv=None):
331
324
 
332
325
  # Return an error status on failure
333
326
  if not is_success:
334
- if RUNNING_IN_TEAMCITY:
335
- print("##teamcity[buildStatus status='FAILURE']") # NVIDIA Modification for TC
336
327
  parser.exit(status=len(errors) + len(failures) + unexpected_successes)
337
328
 
338
329
  # Coverage?
@@ -435,18 +426,16 @@ class ParallelTestManager:
435
426
  def run_tests(self, test_suite):
436
427
  # Fail fast?
437
428
  if self.failfast.is_set():
438
- return [0, [], [], 0, 0, 0]
429
+ return [0, [], [], 0, 0, 0, []] # NVIDIA Modification
439
430
 
440
- # NVIDIA Modification for TeamCity and GitLab
431
+ # NVIDIA Modification for GitLab
441
432
  import warp.tests.unittest_utils
442
433
 
443
434
  warp.tests.unittest_utils.coverage_enabled = self.args.coverage
444
435
  warp.tests.unittest_utils.coverage_temp_dir = self.temp_dir
445
436
  warp.tests.unittest_utils.coverage_branch = self.args.coverage_branch
446
437
 
447
- if RUNNING_IN_TEAMCITY:
448
- resultclass = ParallelTeamCityTestResult
449
- elif self.args.junit_report_xml:
438
+ if self.args.junit_report_xml:
450
439
  resultclass = ParallelJunitTestResult
451
440
  else:
452
441
  resultclass = ParallelTextTestResult
@@ -455,7 +444,7 @@ class ParallelTestManager:
455
444
  with _coverage(self.args, self.temp_dir):
456
445
  runner = unittest.TextTestRunner(
457
446
  stream=StringIO(),
458
- resultclass=resultclass, # NVIDIA Modification for TC
447
+ resultclass=resultclass, # NVIDIA Modification
459
448
  verbosity=self.args.verbose,
460
449
  failfast=self.args.failfast,
461
450
  buffer=self.args.buffer,
@@ -536,10 +525,13 @@ class ParallelTextTestResult(unittest.TextTestResult):
536
525
  pass
537
526
 
538
527
 
539
- def set_worker_cache(lock, shared_index, args, temp_dir):
540
- """Change the Warp cache to avoid conflicts.
541
- This function is run at the start of every new process. (NVIDIA modification)
528
+ def initialize_test_process(lock, shared_index, args, temp_dir):
529
+ """Necessary operations to be executed at the start of every test process.
530
+
531
+ Currently this function can be used to set a separate Warp cache. (NVIDIA modification)
542
532
  If the environment variable `WARP_CACHE_ROOT` is detected, the cache will be placed in the provided path.
533
+
534
+ It also ensures that Warp is initialized prior to running any tests.
543
535
  """
544
536
 
545
537
  with lock:
@@ -548,18 +540,23 @@ def set_worker_cache(lock, shared_index, args, temp_dir):
548
540
 
549
541
  with _coverage(args, temp_dir):
550
542
  import warp as wp
551
- from warp.thirdparty import appdirs
552
543
 
553
- if "WARP_CACHE_ROOT" in os.environ:
554
- cache_root_dir = os.path.join(os.getenv("WARP_CACHE_ROOT"), f"{wp.config.version}-{worker_index:03d}")
555
- else:
556
- cache_root_dir = appdirs.user_cache_dir(
557
- appname="warp", appauthor="NVIDIA", version=f"{wp.config.version}-{worker_index:03d}"
558
- )
544
+ if args.no_shared_cache:
545
+ from warp.thirdparty import appdirs
546
+
547
+ if "WARP_CACHE_ROOT" in os.environ:
548
+ cache_root_dir = os.path.join(os.getenv("WARP_CACHE_ROOT"), f"{wp.config.version}-{worker_index:03d}")
549
+ else:
550
+ cache_root_dir = appdirs.user_cache_dir(
551
+ appname="warp", appauthor="NVIDIA", version=f"{wp.config.version}-{worker_index:03d}"
552
+ )
553
+
554
+ wp.config.kernel_cache_dir = cache_root_dir
559
555
 
560
- wp.config.kernel_cache_dir = cache_root_dir
561
- wp.init()
562
- wp.build.clear_kernel_cache()
556
+ wp.build.clear_kernel_cache()
557
+ else:
558
+ # Initialize Warp is if hasn't been initialized already
559
+ wp.init()
563
560
 
564
561
 
565
562
  if __name__ == "__main__": # pragma: no cover