taichi-dev / taichi

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

ti.init(arch=ti.opengl) failed with Taichi 0.8.1 #3069

Closed Y7K4 closed 3 years ago

Y7K4 commented 3 years ago

Describe the bug With Taichi 0.8.1, ti.init(arch=ti.opengl) doesn't work.

Btw, ti.opengl with v0.7.32 and ti.cpu with v0.8.1 both work.

To Reproduce A minimal Python file to reproduce:

import taichi as ti

ti.init(arch=ti.opengl)

Log/Screenshots Full error message:

(venv) kyc@kyc-T470p:~$ python3 example.py 
[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10
[Taichi] Starting on arch=opengl
[E 09/30/21 23:36:16.302 52849] [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION

***********************************
* Taichi Compiler Stack Traceback *
***********************************
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::Logger::error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::check_opengl_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLCommandList::CmdBufferFill::execute()
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit(taichi::lang::CommandList*)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit_synced(taichi::lang::CommandList*)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::OpenGlRuntime::OpenGlRuntime()
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::OpenglProgramImpl::materialize_runtime(taichi::lang::MemoryPool*, taichi::lang::KernelProfilerBase*, unsigned long**)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x45aaeb) [0x7fcac84feaeb]
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x39ad2e) [0x7fcac843ed2e]
python3(PyCFunction_Call+0x59) [0x5f2cc9]
python3(_PyObject_MakeTpCall+0x150) [0x5f3010]
python3() [0x50bf55]
python3(_PyEval_EvalFrameDefault+0x57d7) [0x56fb87]
python3(_PyEval_EvalCodeWithName+0x26a) [0x568d9a]
python3(_PyFunction_Vectorcall+0x393) [0x5f5b33]
python3(_PyEval_EvalFrameDefault+0x18eb) [0x56bc9b]
python3(_PyEval_EvalCodeWithName+0x26a) [0x568d9a]
python3(PyEval_EvalCode+0x27) [0x68cdc7]
python3() [0x67e161]
python3() [0x67e1df]
python3() [0x67e281]
python3(PyRun_SimpleFileExFlags+0x197) [0x67e627]
python3(Py_RunMain+0x212) [0x6b6e62]
python3(Py_BytesMain+0x2d) [0x6b71ed]
/lib/x86_64-linux-gnu/libc.so.6: __libc_start_main
python3(_start+0x2e) [0x5f96de]

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi.graphics/docs/lang/articles/misc/install
Traceback (most recent call last):
  File "example.py", line 3, in <module>
    ti.init(arch=ti.opengl)
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/lang/__init__.py", line 439, in init
    impl.get_runtime().prog.materialize_runtime()
RuntimeError: [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION

Additional comments Output of ti diagnose:

(venv) kyc@kyc-T470p:~$ ti diagnose
[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10

*******************************************
**      Taichi Programming Language      **
*******************************************

Docs:   https://taichi.rtfd.io/en/stable
GitHub: https://github.com/taichi-dev/taichi
Forum:  https://forum.taichi.graphics

Taichi system diagnose:

python: 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0]
system: linux
executable: /home/kyc/venv/bin/python3
platform: Linux-5.11.0-36-generic-x86_64-with-glibc2.29
architecture: 64bit ELF
uname: uname_result(system='Linux', node='kyc-T470p', release='5.11.0-36-generic', version='#40~20.04.1-Ubuntu SMP Sat Sep 18 02:14:19 UTC 2021', machine='x86_64', processor='x86_64')
locale: en_US.UTF-8
PATH: /home/kyc/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PYTHONPATH: ['/home/kyc/venv/bin', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/kyc/venv/lib/python3.8/site-packages', '/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib']

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal

import: <module 'taichi' from '/home/kyc/venv/lib/python3.8/site-packages/taichi/__init__.py'>

cc: False
cpu: True
metal: False
opengl: True
cuda: False
vulkan: True

`glewinfo` not available: [Errno 2] No such file or directory: 'glewinfo'

`nvidia-smi` not available: [Errno 2] No such file or directory: 'nvidia-smi'
[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10

[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10
[Taichi] Starting on arch=x64

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/lang/__init__.py", line 439, in init
    impl.get_runtime().prog.materialize_runtime()
RuntimeError: [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION
Taichi OpenGL test failed: Command '['/home/kyc/venv/bin/python3', '-c', 'import taichi as ti; ti.init(arch=ti.opengl)']' returned non-zero exit status 1.
[W 09/30/21 23:42:04.918 53403] [__init__.py:adaptive_arch_select@953] Arch=[<Arch.cuda: 5>] is not supported, falling back to CPU
[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10
[Taichi] Starting on arch=x64

[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10

*******************************************
**      Taichi Programming Language      **
*******************************************

Docs:   https://taichi.rtfd.io/en/stable
GitHub: https://github.com/taichi-dev/taichi
Forum:  https://forum.taichi.graphics

Running example minimal ...
[Taichi] Starting on arch=x64
>>> Running time: 0.36s
42

Consider attaching this log when maintainers ask about system information.
>>> Running time: 9.40s
bobcao3 commented 3 years ago

Hello! Which GPU do you have? Also can you try the Vulkan backend?

On Thu, Sep 30, 2021, 8:46 PM Y7K4 @.***> wrote:

Describe the bug With Taichi 0.8.1, ti.init(arch=ti.opengl) doesn't work.

Btw, ti.opengl with v0.7.32 and ti.cpu with v0.8.1 both work.

To Reproduce A minimal Python file to reproduce:

import taichi as ti ti.init(arch=ti.opengl)

Log/Screenshots Full error message:

(venv) @.:~$ python3 example.py [Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10 [Taichi] Starting on arch=opengl [E 09/30/21 23:36:16.302 52849] @. glClearBufferSubData: GL_INVALID_OPERATION


  • Taichi Compiler Stack Traceback *

    /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::Logger::error(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool) /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::check_opengl_error(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLCommandList::CmdBufferFill::execute() /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit(taichi::lang::CommandList) /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit_synced(taichi::lang::CommandList) /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::OpenGlRuntime::OpenGlRuntime() /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::OpenglProgramImpl::materialize_runtime(taichi::lang::MemoryPool, taichi::lang::KernelProfilerBase, unsigned long**) /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x45aaeb) [0x7fcac84feaeb] /home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x39ad2e) [0x7fcac843ed2e] python3(PyCFunction_Call+0x59) [0x5f2cc9] python3(_PyObject_MakeTpCall+0x150) [0x5f3010] python3() [0x50bf55] python3(_PyEval_EvalFrameDefault+0x57d7) [0x56fb87] python3(_PyEval_EvalCodeWithName+0x26a) [0x568d9a] python3(_PyFunction_Vectorcall+0x393) [0x5f5b33] python3(_PyEval_EvalFrameDefault+0x18eb) [0x56bc9b] python3(_PyEval_EvalCodeWithName+0x26a) [0x568d9a] python3(PyEval_EvalCode+0x27) [0x68cdc7] python3() [0x67e161] python3() [0x67e1df] python3() [0x67e281] python3(PyRun_SimpleFileExFlags+0x197) [0x67e627] python3(Py_RunMain+0x212) [0x6b6e62] python3(Py_BytesMain+0x2d) [0x6b71ed] /lib/x86_64-linux-gnu/libc.so.6: libc_start_main python3(_start+0x2e) [0x5f96de]

Internal error occurred. Check out this page for possible solutions:https://docs.taichi.graphics/docs/lang/articles/misc/install Traceback (most recent call last): File "example.py", line 3, in ti.init(arch=ti.opengl) File "/home/kyc/venv/lib/python3.8/site-packages/taichi/lang/init.py", line 439, in init impl.get_runtime().prog.materialize_runtime() RuntimeError: @.*** glClearBufferSubData: GL_INVALID_OPERATION

Additional comments Output of ti diagnose:

(venv) @.***:~$ ti diagnose [Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10


Taichi Programming Language


Docs: https://taichi.rtfd.io/en/stable GitHub: https://github.com/taichi-dev/taichi Forum: https://forum.taichi.graphics

Taichi system diagnose:

python: 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] system: linux executable: /home/kyc/venv/bin/python3 platform: Linux-5.11.0-36-generic-x86_64-with-glibc2.29 architecture: 64bit ELF uname: uname_result(system='Linux', node='kyc-T470p', release='5.11.0-36-generic', version='#40~20.04.1-Ubuntu SMP Sat Sep 18 02:14:19 UTC 2021', machine='x86_64', processor='x86_64') locale: en_US.UTF-8 PATH: /home/kyc/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin PYTHONPATH: ['/home/kyc/venv/bin', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/kyc/venv/lib/python3.8/site-packages', '/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib']

No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal

import: <module 'taichi' from '/home/kyc/venv/lib/python3.8/site-packages/taichi/init.py'>

cc: False cpu: True metal: False opengl: True cuda: False vulkan: True

glewinfo not available: [Errno 2] No such file or directory: 'glewinfo'

nvidia-smi not available: [Errno 2] No such file or directory: 'nvidia-smi' [Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10

[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10 [Taichi] Starting on arch=x64

Traceback (most recent call last): File "", line 1, in File "/home/kyc/venv/lib/python3.8/site-packages/taichi/lang/init.py", line 439, in init impl.get_runtime().prog.materialize_runtime() RuntimeError: @. glClearBufferSubData: GL_INVALID_OPERATION Taichi OpenGL test failed: Command '['/home/kyc/venv/bin/python3', '-c', 'import taichi as ti; ti.init(arch=ti.opengl)']' returned non-zero exit status 1. [W 09/30/21 23:42:04.918 53403] @. Arch=[<Arch.cuda: 5>] is not supported, falling back to CPU [Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10 [Taichi] Starting on arch=x64

[Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, linux, python 3.8.10


Taichi Programming Language


Docs: https://taichi.rtfd.io/en/stable GitHub: https://github.com/taichi-dev/taichi Forum: https://forum.taichi.graphics

Running example minimal ... [Taichi] Starting on arch=x64

Running time: 0.36s 42

Consider attaching this log when maintainers ask about system information.

Running time: 9.40s

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/taichi-dev/taichi/issues/3069, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACY7Q5CEBZFNIUP7BSI4I7LUEUVKNANCNFSM5FDXWXNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Y7K4 commented 3 years ago

My laptop only has an integrated GPU, Intel HD Graphics 630.

I just tried the Julia set example with the Vulkan backend, and it worked.

bobcao3 commented 3 years ago

I think I have a rough idea why this might be happening, but in the meantime maybe use the Vulkan backend, features wise Vulkan has multiple Snode root and GL has a semi working global dynamic field, but I do suggest using Vulkan backend if it works for you!

On Thu, Sep 30, 2021, 9:30 PM Y7K4 @.***> wrote:

My laptop only has an integrated GPU, Intel HD Graphics 630.

I just tried the Julia set example with the Vulkan backend, and it worked.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/taichi-dev/taichi/issues/3069#issuecomment-931888997, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACY7Q5F6GXZBWIJA2YENRWDUEU2MXANCNFSM5FDXWXNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bobcao3 commented 3 years ago

So I dug around the issue a bit, from the OpenGL specs:

https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glClearBufferSubData.xhtml

Which claims that there are only two ways this command generates error GL_INVALID_OPERATION:

  1. the glClearNamedBufferSubData (DSA) variant is used and the buffer arg is invalid
  2. if the buffer is currently mapped

However both of these are impossible according to the specs, as we did not call glClearNamedBufferSubData, and the buffer can't be mapped in this point of the code. I double checked and there's no way it is mapped. So then we are dealing with a OpenGL implementation that is non-standard, being Intel I think this is very likely.

After double checking the code, I realized I used glCreateBuffers instead of the non-DSA variant glGenBuffers. It does not seem to bother the Nvidia or AMD GPUs, but it might be the case that since it's the DSA variant and this buffer is bound, on Intel the driver might interpret that command as the named version or something similar.

Hopefully that fix will be fixing this issue, as I have no Intel device to test & check against. I'm closing this for now, if this bug still exists after that fix is pushed into the next taichi release, please reopen it for me.

rainyriver commented 3 years ago

Which commit fixes this issue? I still get this error with the following release:

[Taichi] version 0.8.3, llvm 10.0.0, commit 021af5d2, linux, python 3.9.7 I don't have GPU in my system. I just want to use a multi-core cloud instance to try out taichi.

[Taichi] Starting on arch=opengl [E 10/17/21 23:30:29.886 1142023] [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION


Internal error occurred. Check out this page for possible solutions: https://docs.taichi.graphics/lang/articles/misc/install Traceback (most recent call last): File "/usr/local/g/home/nn/git/taichi/./a.py", line 3, in ti.init(arch=ti.gpu) File "/usr/local/g/home/nn/.local/lib/python3.9/site-packages/taichi/lang/init.py", line 546, in init impl.get_runtime().prog.materialize_runtime() RuntimeError: [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION

bobcao3 commented 3 years ago

Hi, how do you get OpenGL without a GPU?

rainyriver commented 3 years ago

Sorry, I am totally new to graphics programming. I was thinking GPU is not necessary for graphics programming. Please correct me if I am wrong. :)

Maybe it would helpful to describe the hardware requirement to use Taichi?

Thanks

bobcao3 commented 3 years ago

Sorry, I am totally new to graphics programming. I was thinking GPU is not necessary for graphics programming. Please correct me if I am wrong. :)

Maybe it would helpful to describe the hardware requirement to use Taichi?

Thanks

Hi! If you don't have a GPU you can call ti.init(arch=x64) to use the CPU backend.

It's kind of interesting to see that the GL backend tried to initialize, we should probably address this. You don't need a GPU, just that some taichi examples are written to default to GPU and fallback to CPU. The fallback part failed.

bobcao3 commented 3 years ago

By the way, if you can provide some details on which cloud provider you used, what linux distro you used, and most preferably a rough idea of what is installed on the system, that would be very helpful for us to fix the fallback

Y7K4 commented 3 years ago

I just tried taichi v0.8.3 with integrated graphics (same setup as mentioned before: Ubuntu 20.04, Intel HD Graphics 630), and I still got the same issue.

(venv) kyc@kyc-T470p:~$ python3 example.py 
[Taichi] version 0.8.3, llvm 10.0.0, commit 021af5d2, linux, python 3.8.10
[Taichi] Starting on arch=opengl
[E 10/18/21 03:56:40.154 98670] [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION

***********************************
* Taichi Compiler Stack Traceback *
***********************************
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::Logger::error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::check_opengl_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLCommandList::CmdBufferFill::execute()
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit(taichi::lang::CommandList*)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit_synced(taichi::lang::CommandList*)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::OpenGlRuntime::OpenGlRuntime()
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::OpenglProgramImpl::materialize_runtime(taichi::lang::MemoryPool*, taichi::lang::KernelProfilerBase*, unsigned long**)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x46617b) [0x7f94aedf717b]
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x3a455e) [0x7f94aed3555e]
python3(PyCFunction_Call+0x59) [0x5f5db9]
python3(_PyObject_MakeTpCall+0x29e) [0x5f698e]
python3() [0x50b4c7]
python3(_PyEval_EvalFrameDefault+0x5786) [0x570e46]
python3(_PyEval_EvalCodeWithName+0x26a) [0x56a0ba]
python3(_PyFunction_Vectorcall+0x393) [0x5f6343]
python3(_PyEval_EvalFrameDefault+0x186a) [0x56cf2a]
python3(_PyEval_EvalCodeWithName+0x26a) [0x56a0ba]
python3(PyEval_EvalCode+0x27) [0x68d5b7]
python3() [0x67cd01]
python3() [0x67cd7f]
python3() [0x67ce21]
python3(PyRun_SimpleFileExFlags+0x197) [0x67ef47]
python3(Py_RunMain+0x212) [0x6b7242]
python3(Py_BytesMain+0x2d) [0x6b75cd]
/lib/x86_64-linux-gnu/libc.so.6: __libc_start_main
python3(_start+0x2e) [0x5fb18e]

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi.graphics/lang/articles/misc/install
Traceback (most recent call last):
  File "example.py", line 3, in <module>
    ti.init(arch=ti.opengl)
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/lang/__init__.py", line 546, in init
    impl.get_runtime().prog.materialize_runtime()
RuntimeError: [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION
k-ye commented 3 years ago

Describe the bug With Taichi 0.8.1, ti.init(arch=ti.opengl) doesn't work.

Btw, ti.opengl with v0.7.32 and ti.cpu with v0.8.1 both work.

@Y7K4 does v0.8.0 work?

Y7K4 commented 3 years ago

Describe the bug With Taichi 0.8.1, ti.init(arch=ti.opengl) doesn't work. Btw, ti.opengl with v0.7.32 and ti.cpu with v0.8.1 both work.

@Y7K4 does v0.8.0 work?

@k-ye For some reason when I use v0.8.0 I get a different error regardless of the backend. This looks like a different issue.

(venv) kyc@kyc-T470p:~$ python3 example.py 
Share object taichi_core import failed, check this page for possible solutions:
https://docs.taichi.graphics/docs/lang/articles/misc/install
Traceback (most recent call last):
  File "example.py", line 1, in <module>
    import taichi as ti
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/__init__.py", line 3, in <module>
    from taichi.core import *
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/core/__init__.py", line 1, in <module>
    from taichi.core.logging import *
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/core/logging.py", line 4, in <module>
    from taichi.core import util
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/core/util.py", line 133, in <module>
    import_ti_core()
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/core/util.py", line 45, in import_ti_core
    raise e from None
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/core/util.py", line 33, in import_ti_core
    import taichi_core as core
ImportError: libz3.so.4: cannot open shared object file: No such file or directory
Consider installing libtinfo5: sudo apt-get install libtinfo5

libtinfo5 is already installed on my machine.

k-ye commented 3 years ago

Ouch, that's actually libz3. Could you try

sudo apt-get update
sudo apt-get install libz3-dev
Y7K4 commented 3 years ago

OpenGL backend doesn't work with v0.8.0 either.

(venv) kyc@kyc-T470p:~$ python3 example.py 
[Taichi] version 0.8.0, llvm 10.0.0, commit 181c9039, linux, python 3.8.10
[Taichi] Starting on arch=opengl
[E 10/18/21 06:30:16.968 102038] [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION

***********************************
* Taichi Compiler Stack Traceback *
***********************************
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::Logger::error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::check_opengl_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLCommandList::CmdBufferFill::execute()
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit(taichi::lang::CommandList*)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::GLStream::submit_synced(taichi::lang::CommandList*)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::opengl::OpenGlRuntime::OpenGlRuntime()
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so: taichi::lang::OpenglProgramImpl::materialize_runtime(taichi::lang::MemoryPool*, taichi::lang::KernelProfilerBase*, unsigned long**)
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x45861b) [0x7f80388a961b]
/home/kyc/venv/lib/python3.8/site-packages/taichi/core/../lib/taichi_core.so(+0x399a9e) [0x7f80387eaa9e]
python3(PyCFunction_Call+0x59) [0x5f5db9]
python3(_PyObject_MakeTpCall+0x29e) [0x5f698e]
python3() [0x50b4c7]
python3(_PyEval_EvalFrameDefault+0x5786) [0x570e46]
python3(_PyEval_EvalCodeWithName+0x26a) [0x56a0ba]
python3(_PyFunction_Vectorcall+0x393) [0x5f6343]
python3(_PyEval_EvalFrameDefault+0x186a) [0x56cf2a]
python3(_PyEval_EvalCodeWithName+0x26a) [0x56a0ba]
python3(PyEval_EvalCode+0x27) [0x68d5b7]
python3() [0x67cd01]
python3() [0x67cd7f]
python3() [0x67ce21]
python3(PyRun_SimpleFileExFlags+0x197) [0x67ef47]
python3(Py_RunMain+0x212) [0x6b7242]
python3(Py_BytesMain+0x2d) [0x6b75cd]
/lib/x86_64-linux-gnu/libc.so.6: __libc_start_main
python3(_start+0x2e) [0x5fb18e]

Internal error occurred. Check out this page for possible solutions:
https://docs.taichi.graphics/docs/lang/articles/misc/install
Traceback (most recent call last):
  File "example.py", line 3, in <module>
    ti.init(arch=ti.opengl)
  File "/home/kyc/venv/lib/python3.8/site-packages/taichi/lang/__init__.py", line 377, in init
    impl.get_runtime().prog.materialize_runtime()
RuntimeError: [opengl_device.cpp:check_opengl_error@30] glClearBufferSubData: GL_INVALID_OPERATION
k-ye commented 3 years ago

Thanks. We don't really have your card at hand ;-( Are you able to build Taichi from source (https://docs.taichi.graphics/lang/articles/contribution/dev_install)? If so, could you compare the outcome between

This would help us identify the problem a lot faster

Y7K4 commented 3 years ago

OK, I will try to build from source later this week.

Y7K4 commented 3 years ago

Thanks. We don't really have your card at hand ;-( Are you able to build Taichi from source (https://docs.taichi.graphics/lang/articles/contribution/dev_install)? If so, could you compare the outcome between

This would help us identify the problem a lot faster

OpenGL backend works at both 4741216f and ed7fa26e, and it fails starting from b510e807 ([opengl] Move old runtime onto Device API (#2945)). I don't have any idea how to fix though.