dasikuzi2 opened a new issue, #285:
URL: https://github.com/apache/tvm-ffi/issues/285

   
[test-bind.zip](https://github.com/user-attachments/files/23751221/test-bind.zip)
   
   
   
   In the above archive is my test program.
   
   - **Command used to compile the FFI wrapper:**
   
   1.  
   ```bash
   g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC 
compile/add_one_cpu.cc $(tvm-ffi-config --cxxflags) $(tvm-ffi-config --ldflags) 
$(tvm-ffi-config --libs) -o ./build/add_one_cpu.so -g0 -fPIC --shared
   ```
   
   2. **Test results:**
   ```bash
   python test_ffi.py
   ```
   Output:
   ```
   ffi  0 :  5.9604644775390625e-06
   ffi  10000000 :  4.554137229919434
   ffi  20000000 :  9.029613494873047
   ffi  30000000 :  13.255855560302734
   ffi  40000000 :  17.748437881469727
   ffi  50000000 :  22.10731530189514
   ffi  60000000 :  26.44673252105713
   ffi  70000000 :  30.857760667800903
   ffi  80000000 :  35.373382329940796
   ffi  90000000 :  39.864691734313965
   cal_wrapper.new_cal() - Time for 1,000,000 calls: 44.241560 seconds
   ```
   
   - **Command used to compile the pybind11 wrapper:**
   
   1.  
   ```bash
   python setup.py install
   ```
   The auto-generated compilation command from pybind11 during the above 
execution was:
   ```bash
   gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC 
-I/mnt/data/x2robot_v2/yangjinnan/bus_2509_ryan_feature/lib/python3.11/site-packages/pybind11/share/cmake/pybind11
 
-I/mnt/data/x2robot_v2/yangjinnan/bus_2509_ryan_feature/lib/python3.11/site-packages/pybind11/include
 -I/mnt/data/x2robot_v2/yangjinnan/bus_2509_ryan_feature/include 
-I/usr/local/include/python3.11 -c cal_wrapper.cpp -o 
build/temp.linux-x86_64-3.11/cal_wrapper.o -fvisibility=hidden -g0 -fPIC
   creating build/lib.linux-x86_64-3.11
   g++ -shared build/temp.linux-x86_64-3.11/cal_wrapper.o -L/usr/local/lib -o 
build/lib.linux-x86_64-3.11/cal_wrapper.cpython-311-x86_64-linux-gnu.so
   ```
   *Compilation flags were aligned with those used for FFI.*
   
   2. **Test results:**
   ```bash
   python test_cal_pybind.py
   ```
   Output:
   ```
   pybind  0 :  9.5367431640625e-06
   pybind  10000000 :  3.3902204036712646
   pybind  20000000 :  6.6988911628723145
   pybind  30000000 :  10.134164333343506
   pybind  40000000 :  13.443641424179077
   pybind  50000000 :  16.740714073181152
   pybind  60000000 :  19.707695960998535
   pybind  70000000 :  22.906324863433838
   pybind  80000000 :  26.006007432937622
   pybind  90000000 :  29.200982809066772
   cal_wrapper.new_cal() - Time for 1,000,000 calls: 32.471445 seconds
   ```
   
   - **Runtime environment:**
     - `pybind11`: 3.0.1  
     - `apache-tvm-ffi`: 0.1.2  
     - CPU model: `Intel(R) Xeon(R) Processor @ 2.90GHz`  
     - OS:  
       ```
       PRETTY_NAME="Ubuntu 22.04.5 LTS"
       NAME="Ubuntu"
       VERSION_ID="22.04"
       VERSION="22.04.5 LTS (Jammy Jellyfish)"
       VERSION_CODENAME=jammy
       ID=ubuntu
       ID_LIKE=debian
       HOME_URL="https://www.ubuntu.com/";
       SUPPORT_URL="https://help.ubuntu.com/";
       BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/";
       
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy";
       UBUNTU_CODENAME=jammy
       ```
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to