I have a for-loop iterating over multiple solvers, with a module of taichi inside each solver
gen() includes randomization and Solver() is a pytorch class wrapping taichi kernels
[T 01/27/20 20:21:37.296] [logging.cpp:taichi::Logger::Logger@68] Taichi core started. The started. Thread ID = 8700
[Taichi version 0.3.20, cpu only, commit 1c85d8e1]
Traceback (most recent call last):
gen(1000,16)
…
solver = Solver(iter_step=100, grid_size=grid_size)
File “d:\Repo\poisson_net\New folder\solver.py”, line 56, in init
self.ti_p = ti.var(dt=real, shape=(iter_step, grid_size+2), needs_grad=True)
File “D:\anaconda3\lib\site-packages\taichi\lang\impl.py”, line 209, in global_var
@layout
File “D:\anaconda3\lib\site-packages\taichi\lang\impl.py”, line 235, in layout
assert not pytaichi.materialized, “All layout must be specified before the first kernel launch / data access.”
AssertionError: All layout must be specified before the first
kernel launch / data access.
Single solver like
solver = Solver(iter_step=100, grid_size=grid_size).double()
ans= solver(u, fx, a)
works smoothly
I am wondering if I should specify anything in advance. Thank you!