taichi-dev / taichi_elements

High-performance multi-material continuum physics engine in Taichi
MIT License
483 stars 69 forks source link

Decorate class MPMSolver with @data_oriented? #12

Closed r03ert0 closed 4 years ago

r03ert0 commented 4 years ago

I'm getting this error with demo_2d and demo_3d (I just updated to the latest version of taichi-nightly: 0.5.7)

$ python demo_3d.py 
[Taichi] mode=release
[Taichi] version 0.5.7, cpu only, commit 568f6651, python 3.7.5
[W 03/09/20 20:03:50.970] [program.cpp:Program@41] Taichi is not compiled with CUDA.
[W 03/09/20 20:03:50.970] [program.cpp:Program@64] Falling back to x64
Traceback (most recent call last):
  File "demo_3d.py", line 14, in <module>
    mpm.add_cube(lower_corner=[2, 4, 3], cube_size=[1, 1, 3], material=MPMSolver.material_elastic)
  File "/Users/roberto/Applications/taichi_elements/mpm_solver.py", line 186, in add_cube
    self.seed(self.n_particles, num_new_particles, material)
  File "/opt/miniconda3/envs/mypy3/lib/python3.7/site-packages/taichi/lang/kernel.py", line 463, in wrapped
    f'Please decorate class {clsobj.__name__} with @data_oriented')
taichi.lang.kernel.KernelDefError: Please decorate class MPMSolver with @data_oriented
$ python demo_2d.py 
[Taichi] mode=release
[Taichi] version 0.5.7, cpu only, commit 568f6651, python 3.7.5
[W 03/09/20 20:04:12.483] [program.cpp:Program@41] Taichi is not compiled with CUDA.
[W 03/09/20 20:04:12.483] [program.cpp:Program@64] Falling back to x64
Traceback (most recent call last):
  File "demo_2d.py", line 15, in <module>
    mpm.add_cube(lower_corner=[0.2 + i * 0.1, 0.3 + i * 0.1], cube_size=[0.1, 0.1], material=MPMSolver.material_elastic)
  File "/Users/roberto/Applications/taichi_elements/mpm_solver.py", line 186, in add_cube
    self.seed(self.n_particles, num_new_particles, material)
  File "/opt/miniconda3/envs/mypy3/lib/python3.7/site-packages/taichi/lang/kernel.py", line 463, in wrapped
    f'Please decorate class {clsobj.__name__} with @data_oriented')
taichi.lang.kernel.KernelDefError: Please decorate class MPMSolver with @data_oriented
yuanming-hu commented 4 years ago

Hi @r03ert0 I believe this is fixed now.

r03ert0 commented 4 years ago

Thank you Yuanming! It works perfectly now : )