# Modulus-Sym examples \_ ldc error

**URL:** <https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899>\
**Category:** Technical Support (PhysicsNeMo Only)\
**Created:** [May 20, 2023, 6:28am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899 "2023-05-20T06:28:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitanshtrip](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mitanshtrip](https://forums.developer.nvidia.com/u/mitanshtrip)\
**Post date:** [May 20, 2023, 6:28am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899/1 "2023-05-20T06:28:27Z")

</div>

Hi, so I have been able to get the helmholtz and chip\_2d cases to work. However I am getting an error when running the ldc and ldc\_zeroEq models. I saw some answers on this forum but it did not help my case, the error is as such:

modulus-sym/examples/ldc# python3 ldc\_2d.py  
/usr/local/lib/python3.8/dist-packages/hydra/\_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default.  
See [Changes to job's runtime working directory | Hydra](https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/) for more information.  
ret = run\_job(  
[01:56:29] - JitManager: {‘\_enabled’: False, ‘\_arch\_mode’: \<JitArchMode.ONLY\_ACTIVATION: 1\>, ‘\_use\_nvfuser’: True, ‘\_autograd\_nodes’: False}  
[01:56:29] - GraphManager: {‘\_func\_arch’: False, ‘\_debug’: False, ‘\_func\_arch\_allow\_partial\_hessian’: True}  
[01:56:34] - attempting to restore from: outputs/ldc\_2d  
[01:56:34] - optimizer checkpoint not found  
[01:56:34] - model flow\_network.0.pth not found  
Error executing job with overrides:   
Traceback (most recent call last):  
File “ldc\_2d.py”, line 136, in run  
slv.solve()  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/solver/solver.py”, line 173, in solve  
self.\_train\_loop(sigterm\_handler)  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/trainer.py”, line 535, in \_train\_loop  
loss, losses = self.\_cuda\_graph\_training\_step(step)  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/trainer.py”, line 716, in \_cuda\_graph\_training\_step  
self.loss\_static, self.losses\_static = self.compute\_gradients(  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/trainer.py”, line 68, in adam\_compute\_gradients  
losses\_minibatch = self.compute\_losses(step)  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/solver/solver.py”, line 66, in compute\_losses  
return self.domain.compute\_losses(step)  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/domain/domain.py”, line 147, in compute\_losses  
constraint.forward()  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/domain/constraint/continuous.py”, line 130, in forward  
self.\_output\_vars = self.model(self.\_input\_vars)  
File “/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py”, line 1190, in \_call\_impl  
return forward\_call(\*input, \*\*kwargs)  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/graph.py”, line 234, in forward  
outvar.update(e(outvar))  
File “/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py”, line 1190, in \_call\_impl  
return forward\_call(\*input, \*\*kwargs)  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/eq/derivatives.py”, line 99, in forward  
grad = gradient(var, grad\_var)  
RuntimeError: The following operation failed in the TorchScript interpreter.  
Traceback of TorchScript (most recent call last):  
File “/usr/local/lib/python3.8/dist-packages/modulus/sym/eq/derivatives.py”, line 38, in gradient  
“”"  
grad\_outputs: List[Optional[torch.Tensor]] = [torch.ones\_like(y, device=y.device)]  
grad = torch.autograd.grad(  
~~~~~~~~~~~~~~~~~~~ \<— HERE  
[  
y,  
RuntimeError: CUDA error: unknown error  
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.  
For debugging consider passing CUDA\_LAUNCH\_BLOCKING=1.

Set the environment variable HYDRA\_FULL\_ERROR=1 for a complete stack trace.

---

<div class="post-metadata">

**Author:** ![ngeneva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/ngeneva/32/173476_2.png) [@ngeneva](https://forums.developer.nvidia.com/u/ngeneva)\
**Post date:** [May 24, 2023, 1:52am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899/2 "2023-05-24T01:52:22Z")

</div>

Hi @mitanshtrip

Sorry you’re having problems with the LDC example, its a bit unusual for this example to have errors. Can you tell me a little more about your environment? Is this inside the Modulus docker container? Or is this with a pip / bare metal install? What is your PyTorch version? What is the hardware you are running on?

Its odd that chip\_2d works for you but this doesn’t. Can I also ask you to try the [annular ring example](https://github.com/NVIDIA/modulus-sym/tree/main/examples/annular_ring/annular_ring) (another N-S system). Thanks!

---

<div class="post-metadata">

**Author:** ![mitanshtrip](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mitanshtrip](https://forums.developer.nvidia.com/u/mitanshtrip)\
**Post date:** [May 24, 2023, 3:27am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899/3 "2023-05-24T03:27:40Z")

</div>

So I am using “WSL” on windows to run the cases. I used the pip/bare metal installation.

The PyTorch version is: 1.13.0+cu116

The annular ring example gave me the exact same error that I pasted in the query above

Thank you

---

<div class="post-metadata">

**Author:** ![ngeneva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/ngeneva/32/173476_2.png) [@ngeneva](https://forums.developer.nvidia.com/u/ngeneva)\
**Post date:** [May 24, 2023, 6:23am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899/4 "2023-05-24T06:23:19Z")

</div>

Hi @mitanshtrip

Unfortunately, we don’t formally test WSL. I would verify that you’re not running out of memory on your GPU. Another item to try is to comment out the JIT decorator [here](https://github.com/NVIDIA/modulus-sym/blob/main/modulus/sym/eq/derivatives.py#L32) on the gradient calculation and see if the CUDA error is more informative. Otherwise debugging a `RuntimeError: CUDA error: unknown error` is rather challenging.

---

<div class="post-metadata">

**Author:** ![mitanshtrip](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mitanshtrip](https://forums.developer.nvidia.com/u/mitanshtrip)\
**Post date:** [May 24, 2023, 6:36am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899/5 "2023-05-24T06:36:38Z")

</div>

Hi, so I tested these out on an hpc cluster (just a single node) and I had the same issue, helmholtz and chip\_2d working but the ldc and annular ring are not working.

Instead of running it on GPU’s can this be run on CPU’s?

---

<div class="post-metadata">

**Author:** ![ngeneva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/ngeneva/32/173476_2.png) [@ngeneva](https://forums.developer.nvidia.com/u/ngeneva)\
**Post date:** [May 26, 2023, 2:28am UTC](https://forums.developer.nvidia.com/t/modulus-sym-examples-ldc-error/253899/6 "2023-05-26T02:28:25Z")

</div>

Hi @mitanshtrip

I just tested a bare metal install of `nvidia-modulus.sym` and the LDC problem runs fine on a unix V100 GPU. If you have a CPU installation, and Pytorch runs on the CPU then most of the examples should function maybe with some modification. However, I would strongly suggest against this since training will be very slow and many features will not work.

Did you try commenting out the JIT decorator? Also what hardware are you using? Confirm you are not running out of GPU memory.
