I’m just now getting around to offloading some expensive operations like turn simulation to c++ for speed upgrades, and I initially didn’t wan’t to fiddle around with extensions. I was hoping to just compile a few expensive operations like pathfinding into a .exe file, call it with the Python subprocess library using string arguments and captured std::cout as I/O, and continue on my merry way using the rest of my existing Python program. However, it crashes on the server because (duh) .exe permission is denied. Has anyone else used this method to borrow the power of c++? Is it required to go through Python extensions or the fledgling community-supported c++ starter kit that’s now in the works? Just curious what the fastest way to get a few specific operations offloaded to c++ is.
I think I posted bits and pieces here and there, but here’s a few things I dug up real quick.
This tutorial was my preferred method because it was very simple and easy to use. The only trouble I had was trying to pass anything but primitives to the other functions.
https://github.com/RyanDraves/Keras2Cpp4Terminal this repo I whipped up is an example of it, if you need a reference it’s in c_wrapper.py and keras2cpp/keras_model.cc. All I did was write 3 small functions to wrap someone else’s entire repo into Python. Note that just because you passed Python the variable doesn’t mean it’ll handle the memory for you. There is a leak in that example (I don’t bother to clean up the neural net because it exists for the lifetime of the algo), but it does provide an example of cleaning up memory on a routine function call.
A post was deleted with the following text
This exact post has been posted ~3 times before, on various threads related to C++, usually a month after the threads are stale. The link linked to a page on how to fix a printer that isn’t printing black ink, which didn’t seem terribly malicious but better safe than sorry.
The best thing to do if report them when they come up