Skip to content

Diffmpm.py crashes during the forward simulation #65

@increew

Description

@increew

Out-of-bounds Memory Access in the DiffMpm Example

In the example given in diffmpm.py, the code crashes during an iteration of my training process. I found that the there is an array-out-of-bounds access during the forward simulation.

How to reproduce

System specifications

  • OS: Ubuntu 18.04 LTS
  • Taichi version: 1.4.1
  • Python version: 3.9.16

To reproduce the bug, only the forward simulation is needed.

The necessary files are given in https://www.dropbox.com/s/obhpljd9qp8vj10/bug_report.zip?dl=0. The value of parameters weights and bias when the crash happens is given in weights.npy and bias.npy, respectively.

To get a minimal example that reproduces the crash, run the file bug_report.py, which simply loads the value of weights and bias from their corresponding numpy files and run forward simulation for 1500 steps. You would observe the output saying:

[Taichi] version 1.4.1, llvm 15.0.4, commit e67c674e, linux, python 3.9.16
[Taichi] Starting on arch=x64
n_particles 2976
n_solid 2976
Traceback (most recent call last):
  File "/home/user/bug_report.py", line 419, in <module>
    reproduce_bug()
  File "/home/user/bug_report.py", line 364, in reproduce_bug
    forward(1500)
  File "/home/user/bug_report.py", line 254, in forward
    advance(s)
  File "/home/user/miniconda3/envs/tai/lib/python3.9/site-packages/taichi/ad/_ad.py", line 311, in decorated
    func(*args, **kwargs)
  File "/home/user/bug_report.py", line 234, in advance
    p2g(s)
  File "/home/user/miniconda3/envs/tai/lib/python3.9/site-packages/taichi/lang/kernel_impl.py", line 976, in wrapped
    raise type(e)('\n' + str(e)) from None
taichi.lang.exception.TaichiAssertionError:
(kernel=p2g_c82_0) Accessing field (S25place<f32>) of size (128, 128) with indices (-5980, -8119)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions