Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial: deployment. An error occurred on arch x64 and cuda #8313

Closed
Routhleck opened this issue Aug 4, 2023 · 6 comments
Closed

Tutorial: deployment. An error occurred on arch x64 and cuda #8313

Routhleck opened this issue Aug 4, 2023 · 6 comments
Assignees
Labels
question Question on using Taichi

Comments

@Routhleck
Copy link
Contributor

Description

I tried the tutorial (Doc Home>>Deployment>>Tutorial: Run Taichi programs in C++ applications). And I found it can successfully run on vulkan backend, then I changed
app.py

ti.init(arch=ti.vulkan) -> ti.init(arch=ti.x64) or ti.init(arch=ti.cuda)
mod = ti.aot.Module(ti.vulkan) -> mod = ti.aot.Module(ti.x64) or mod = ti.aot.Module(ti.cuda)

app.cpp

ti::Runtime runtime(TI_ARCH_VULKAN) -> ti::Runtime runtime(TI_ARCH_X64) or ti::Runtime runtime(TI_ARCH_CUDA) 

After cmake compilation, ran ./build/TaichiAot , there was a segmentation fault on both x64 and cuda arch.

Thread 1 "TaichiAot" received signal SIGSEGV, Segmentation fault.
0x00007ffff5d31b50 in ?? () from /home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/lib/libtaichi_c_api.so
(gdb) backtrace
#0  0x00007ffff5d31b50 in ?? () from /home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/lib/libtaichi_c_api.so
#1  0x00007ffff5cc6534 in ?? () from /home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/lib/libtaichi_c_api.so
#2  0x00007ffff5caaef7 in ti_load_aot_module ()
   from /home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/lib/libtaichi_c_api.so
#3  0x0000555555557565 in ti::Runtime::load_aot_module(char const*) const ()
#4  0x000055555555686c in main ()

Then I noticed that "Before we start, it is recommended to install Taichi through taichi-nightly Python wheels using the following command. Be aware that there's no strong version compatibility enforced yet, so it's highly recommended to use the Taichi built from exactly the same commit." in tutorial. So I replaced taichi-nightly from 1.7.0.post20230804 to 1.6.0.post2023041. But I ran into a problem that I couldn't find libtaichi_c_api.so

-- Looking for Taichi components: Runtime
CMake Error at /home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake:92 (message):
  The imported target "taichi_c_api" references the file

     "/home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/lib/libtaichi_c_api.so"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/routhleck/miniconda3/envs/jax-taichi/lib/python3.8/site-packages/taichi/_lib/c_api/taichi/lib/cmake/taichi/TaichiConfig.cmake:27 (include)
  cmake/FindTaichi.cmake:101 (find_package)
  CMakeLists.txt:14 (find_package)

Development environment

hardware

  • CPU: Intel Core i5-12490F
  • GPU: Nvidia Geforce RTX 2070
  • RAM: 32G DDR4 3200MHz

software

  • OS: Ubuntu 22.04.2 LTS
  • Python: 3.8
  • taichi: 1.6.0
  • taichi-nightly: 1.7.0.post20230804 or 1.6.0.post2023041
@Routhleck Routhleck added the question Question on using Taichi label Aug 4, 2023
@bobcao3
Copy link
Collaborator

bobcao3 commented Aug 4, 2023

Can you try after installing taichi-nightly, remove the taichi package? (And regenerate the cmake files)

@Routhleck
Copy link
Contributor Author

After removing the taichi package, and I reinstalled taichi-nightly. There still occured segmentation fault in ti_load_aot_module

@chaoming0625
Copy link
Contributor

It seems that this feature in the doc is only supported in the Vulkan backend?

image

@Routhleck
Copy link
Contributor Author

But the document say:
Currently ti.vulkan, ti.opengl, ti.x86 and ti.cuda are supported. ti.metal is not yet supported.

It seems that this feature in the doc is only supported in the Vulkan backend?

image

@jim19930609
Copy link
Contributor

The Taichi AOT library shipped in the nightly-taichi does not have CUDA/x86 inside. You'll have to compile taichi from source code to enable C-API for CUDA/x86 or metal, etc.

Luckily, there's an easy way to do that. The build system for https://github.com/taichi-dev/taichi-aot-demo has options to turn on CUDA/x86 backends. Just turn on "TI_WITH_CPU" and "TI_WITH_CUDA" when you do cmake.

@Routhleck
Copy link
Contributor Author

Thanks, I can compile taichi from source code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question on using Taichi
Projects
Status: Done
Development

No branches or pull requests

4 participants