erizmr / SPH_Taichi

A high-performance implementation of SPH in Taichi.
MIT License
201 stars 40 forks source link

wrong when set exportObj to true #20

Closed szl-opensees closed 1 year ago

szl-opensees commented 1 year ago

hello, thank you so much for sharing. I got an error when set armadillo_bath_dynamic.json "Configuration" "exportObj" to true

[E 01/14/23 19:13:58.414 20808] [taichi/rhi/cuda/cuda_driver.h:operator()@88] CUDA Error CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered while calling stream_synchronize (cuStreamSynchronize)

Traceback (most recent call last): File "E:\Taichi\SPH_Taichi-master\run_simulation.py", line 101, in obj_data = ps.dump(obj_id=obj_id) File "E:\Taichi\SPH_Taichi-master\particle_system.py", line 461, in dump self.copy_to_numpy_nd(obj_id, np_x, self.x) File "D:\Users\m1503\AppData\Local\Programs\Python\Python39\lib\site-packages\taichi\lang\kernel_impl.py", line 1006, in call return self._primal(self._kernel_owner, *args, *kwargs) File "D:\Users\m1503\AppData\Local\Programs\Python\Python39\lib\site-packages\taichi\lang\kernel_impl.py", line 872, in call return self.runtime.compiled_functions[key](args) File "D:\Users\m1503\AppData\Local\Programs\Python\Python39\lib\site-packages\taichi\lang\kernel_impl.py", line 797, in func__ raise e from None File "D:\Users\m1503\AppData\Local\Programs\Python\Python39\lib\site-packages\taichi\lang\kernel_impl.py", line 794, in func__ t_kernel(launch_ctx) RuntimeError: [taichi/rhi/cuda/cuda_driver.h:operator()@88] CUDA Error CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered while calling stream_synchronize (cuStreamSynchronize) GLFW Error 65537: The GLFW library is not initialized [E 01/14/23 19:13:59.363 20808] [taichi/rhi/cuda/cuda_driver.h:operator()@88] CUDA Error CUDA_ERROR_ILLEGAL_ADDRESS: an illegal memory access was encountered while calling stream_synchronize (cuStreamSynchronize)

szl-opensees commented 1 year ago

i have change run_simulation.py line 103-- the problem is solve
if output_ply: if cnt % output_interval == 0: obj_id = 0

obj_data = ps.dump(obj_id=obj_id)

            # np_pos = obj_data["position"]
            np_pos = ps.x.to_numpy()
            writer = ti.tools.PLYWriter(num_vertices=len(np_pos[:,1]))
            writer.add_vertex_pos(np_pos[:, 0], np_pos[:, 1],np_pos[:, 2])
            writer.export_frame_ascii(cnt_ply, series_prefix.format(0))