You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "vfdff (via GitHub)" <gi...@apache.org> on 2025/03/03 03:39:37 UTC

[I] [Bug] how to get the active libtvm.so when we run a script [tvm]

vfdff opened a new issue, #17698:
URL: https://github.com/apache/tvm/issues/17698

   As we known, for a  PE binary, we can use ldd to show the active dynamic library we used, but we don't have similar method to get it for a script
   
   ### Expected behavior
   
   I expect I use the libtvm.so matched to my configuration  PYTHONPATH, but it seems it may use another libtvm.so
   For example, When I config the following **PYTHONPATH**, I expected we use the libtvm.so under /home/zhongyunde/tvm/python, but in fact we don't have the libtvm.so under /home/zhongyunde/tvm/python, and it still can find the tvm module when we run the python script
   ```
   export TVM_HOME=/home/zhongyunde/tvm
   export PYTHONPATH=$TVM_HOME/python
   
   (mlir_venv) (base) root@998ee80b761b:/home/zhongyunde/tvm# ls /home/zhongyunde/tvm/build/libtvm.so -lt
   -rwxr-xr-x 1 root root 183057984 Mar  3 03:05 /home/zhongyunde/tvm/build/libtvm.so
   ```
   
   ### Environment
   
   Any environment details, such as: Operating System, TVM version, etc
   ```
   Ubuntu 7.5.0-3ubuntu1~18.04 (cat /proc/version)
   Python 3.11.0
   ```
   
   
   
   ### Steps to reproduce
   1、we build the libtvm.so local with source, and we add string **dd  zyd** to mask my local building file libtvm.so
   ![Image](https://github.com/user-attachments/assets/1e398588-5bc0-483b-9223-cce6df3e899e)
   
   2、run the python matmul_ansor.py after we config the PYTHONPATH as following,but we still get **Generate Sketches without dd  zyd** after we took a look at the run log, so we can make sure we don't use the libtvm.so new modified source
   ```
   export TVM_HOME=/home/zhongyunde/tvm
   export PYTHONPATH=$TVM_HOME/python
   ```
   (/py311-tts) root@998ee80b761b:/home/zhongyunde/source/test/ansor# python matmul_ansor.py
   
   * the snip of the run log
   ![Image](https://github.com/user-attachments/assets/0744eb7e-961c-405f-a0b1-ad7ea58fb15b)
    
    refer to https://github.com/apache/tvm/issues/17692
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] how to get the active libtvm.so when we run a script [tvm]

Posted by "vfdff (via GitHub)" <gi...@apache.org>.
vfdff commented on issue #17698:
URL: https://github.com/apache/tvm/issues/17698#issuecomment-2693286466

   * When I switch to the environment **mlir_venv** ,which is used to build the above tvm source, then I see the additions string **dd  zyd**
   ![Image](https://github.com/user-attachments/assets/1b9d2d3a-243d-45e4-a739-400cb8bb948e)
   
   * but the libtvm.so are not new installed
   ```
   (mlir_venv) (base) root@998ee80b761b:/home/zhongyunde/source/test/ansor# find /home/zhongyunde/mlir_venv -name libtvm.so | xargs -i bash -c "ls {} -lt"
   -rwxr-xr-x 1 root root 177122408 Dec 19 09:09 /home/zhongyunde/mlir_venv/bin/libtvm.so
   -rwxr-xr-x 1 root root 177122408 Dec 19 09:11 /home/zhongyunde/mlir_venv/lib/libtvm.so
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] how to get the active libtvm.so when we run a script [tvm]

Posted by "vfdff (via GitHub)" <gi...@apache.org>.
vfdff closed issue #17698: [Bug] how to get the active libtvm.so when we run a script
URL: https://github.com/apache/tvm/issues/17698


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] how to get the active libtvm.so when we run a script [tvm]

Posted by "vfdff (via GitHub)" <gi...@apache.org>.
vfdff commented on issue #17698:
URL: https://github.com/apache/tvm/issues/17698#issuecomment-2696234627

   *  oh, It can use **LD_DEBUG** to get the path of libtvm.so, eg: 
      > LD_DEBUG=libs python3 -m pdb dd4.py
   
     then I see load **/home/zhongyunde/tvm/build/libtvm.so** on environment **mlir_venv**, 
               and load **/usr/local/sbin/libtvm.so** on environment **/py311-tts**
   
   
   * related file dd4.py can be simple as following: 
   ```
   import tvm
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] how to get the active libtvm.so when we run a script [tvm]

Posted by "vfdff (via GitHub)" <gi...@apache.org>.
vfdff commented on issue #17698:
URL: https://github.com/apache/tvm/issues/17698#issuecomment-2693223556

   * I try to use os.path.abspath to get the path of libtvm.so, but in fact there is no such file for the return value
   (/py311-tts) root@998ee80b761b:/home/zhongyunde/source/test/ansor# python getpath.py
   library path: /home/zhongyunde/source/test/ansor/libtvm.so
   
   (/py311-tts) @998ee80b761b:/home/zhongyunde/source/test/ansor# ls /home/zhongyunde/source/test/ansor/libtvm.so
   ls: cannot access '/home/zhongyunde/source/test/ansor/libtvm.so': No such file or directory
   
   **file getpath.py**
   ```
   import ctypes
   import os
   
   libc = ctypes.CDLL("libtvm.so")  # Linux 示例
   
   libc_path = os.path.abspath(libc._name)
   print(f"library path: {libc_path}")
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org