Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windtunnel_3d.py Example crashes on launch #112

Closed
omarthewizard opened this issue Feb 27, 2025 · 2 comments
Closed

windtunnel_3d.py Example crashes on launch #112

omarthewizard opened this issue Feb 27, 2025 · 2 comments

Comments

@omarthewizard
Copy link

When trying to run the windtunnel example, the solver crashes when setting up the mesh_boundary_masker class with the following stack trace:


Simulation Configuration:
Grid size: 512 x 128 x 128
Backend: ComputeBackend.WARP
Velocity set: D3Q27
Precision policy: PrecisionPolicy.FP32FP32
Prescribed velocity: 0.02
Reynolds number: 50000.0
Max iterations: 100000

==================================================

Warp 1.6.0 initialized:
   CUDA Toolkit 12.8, Driver 12.7
   Devices:
     "cpu"      : "x86_64"
     "cuda:0"   : "NVIDIA GeForce RTX 3060" (12 GiB, sm_86, mempool enabled)
   Kernel cache:
     /home/omar/.cache/warp/1.6.0
registered bc RegularizedBC_8751980669715 with id 1
registered bc FullwayBounceBackBC_8751980669718 with id 2
registered bc ExtrapolationOutflowBC_8751944695298 with id 3
registered bc HalfwayBounceBackBC_8751944709877 with id 4
Module xlb.operator.equilibrium.quadratic_equilibrium 7e68aa5 load on device 'cuda:0' took 0.50 ms  (cached)
Module xlb.operator.boundary_masker.indices_boundary_masker 590d1e3 load on device 'cuda:0' took 0.46 ms  (cached)
Module xlb.operator.boundary_masker.mesh_boundary_masker 9a9d5e8 load on device 'cuda:0' took 0.10 ms  (cached)
Traceback (most recent call last):
  File "/home/omar/Thesis/00-warp/XLB/XLB/examples/cfd/windtunnel_3d.py", line 107, in <module>
    f_0, f_1, bc_mask, missing_mask = stepper.prepare_fields()
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/stepper/nse_stepper.py", line 86, in prepare_fields
    bc_mask, missing_mask = self._process_boundary_conditions(self.boundary_conditions, bc_mask, missing_mask)
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/stepper/nse_stepper.py", line 117, in _process_boundary_conditions
    bc_mask, missing_mask = mesh_masker(bc, bc_mask, missing_mask)
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/operator.py", line 74, in __call__
    raise Exception(f"Error captured for backend with key {key} for operator {self.__class__.__name__}: {error}\n {traceback_str}")
Exception: Error captured for backend with key ('MeshBoundaryMasker', <ComputeBackend.WARP: 2>, '(self, bc, bc_mask, missing_mask)') for operator MeshBoundaryMasker: Expecting value: line 1 column 1 (char 0)
 Traceback (most recent call last):
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/operator.py", line 64, in __call__
    result = backend_method(self, *args, **kwargs)
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/boundary_masker/mesh_boundary_masker.py", line 225, in warp_implementation
    wp.launch(
  File "/home/omar/Thesis/00-warp/XLB/env/lib/python3.10/site-packages/warp/context.py", line 5408, in launch
    module_exec = kernel.module.load(device, block_dim)
  File "/home/omar/Thesis/00-warp/XLB/env/lib/python3.10/site-packages/warp/context.py", line 2246, in load
    meta = json.load(meta_file)
  File "/usr/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

(env) omar@Stallion:~/Thesis/00-warp/XLB/XLB/examples$ python3 cfd/windtunnel_3d.py > output.txt
Traceback (most recent call last):
  File "/home/omar/Thesis/00-warp/XLB/XLB/examples/cfd/windtunnel_3d.py", line 107, in <module>
    f_0, f_1, bc_mask, missing_mask = stepper.prepare_fields()
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/stepper/nse_stepper.py", line 86, in prepare_fields
    bc_mask, missing_mask = self._process_boundary_conditions(self.boundary_conditions, bc_mask, missing_mask)
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/stepper/nse_stepper.py", line 117, in _process_boundary_conditions
    bc_mask, missing_mask = mesh_masker(bc, bc_mask, missing_mask)
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/operator.py", line 74, in __call__
    raise Exception(f"Error captured for backend with key {key} for operator {self.__class__.__name__}: {error}\n {traceback_str}")
Exception: Error captured for backend with key ('MeshBoundaryMasker', <ComputeBackend.WARP: 2>, '(self, bc, bc_mask, missing_mask)') for operator MeshBoundaryMasker: Expecting value: line 1 column 1 (char 0)
 Traceback (most recent call last):
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/operator.py", line 64, in __call__
    result = backend_method(self, *args, **kwargs)
  File "/home/omar/Thesis/00-warp/XLB/XLB/xlb/operator/boundary_masker/mesh_boundary_masker.py", line 225, in warp_implementation
    wp.launch(
  File "/home/omar/Thesis/00-warp/XLB/env/lib/python3.10/site-packages/warp/context.py", line 5408, in launch
    module_exec = kernel.module.load(device, block_dim)
  File "/home/omar/Thesis/00-warp/XLB/env/lib/python3.10/site-packages/warp/context.py", line 2246, in load
    meta = json.load(meta_file)
  File "/usr/lib/python3.10/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have tried different shaped meshes, including meshes from the DrivAer set.

@hsalehipour
Copy link
Collaborator

hsalehipour commented Feb 27, 2025

@omarthewizard , can you please add this to the beginning of your main function in the example: wp.clear_kernel_cache() . Sometimes mysterious errors appear if you change the code and don't recompile. The above command forces a recompilation of all Warp kernels. Let me know if the error persists.

@omarthewizard
Copy link
Author

Error appears to be gone! Thanks for the fix.

@omarthewizard omarthewizard closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants