wrapped C++ code poor performance #915
Unanswered
SchroedingersLion
asked this question in
Q&A
Replies: 2 comments 6 replies
-
Dear @SchroedingersLion, I believe that passing |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @wjakob thanks for the response! I just tried it, but it did not help. Somehow, the function being launched with nanobind is slower than launching it from a main.cpp. I had the same experience with pybind11, which is why I ended up here. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Greetings, I am new to Nanobind, so apologies for the potential beginners' mistakes.
I have a performance-critical C++ simulation code that I want to wrap in a Python package such that the user simply needs to do
All the heavy lifting happens within the
run
function, and there is no explicit interface crossing within.My issue is that this approach leads to
run
becoming slower by 30% to 50% compared to running it from a compiled C++ main file.I post my module creation file that also holds the simulation wrapper class that will be exposed to Python. I also post my CMakeList.txt file below.
The code uses OpenMP multithreading under the hood, but I benchmarked by using only one thread.
Is there anything wrong with my setup?
Module creation:
CMakeList.txt
Beta Was this translation helpful? Give feedback.
All reactions