Patrick Maynard Patrick Maynard -4 years ago 172
C++ Question

Python vs C++ for CUDA web server?

I am planning on writing some software for a web server that uses machine learning to process large amounts of data. This will be real estate data from a MySQL server. I will be using the CUDA framework from Nvidia with python/caffe or the c++ library. I will be using a Tesla P100. Although python is more widely used for machine learning I presume it is hard to write a server app in python without sacrificing performance. Is this true? Is c++ well supported for machine learning? Will anything be sacrificed by writing a professional server app in python (ex: connecting to MySQL database)?

Answer Source

Both C++ and Python are perfectly reasonable languages for implementing web servers. Python is actually quite common, and there are many frameworks for writing web servers in Python such as flask, bottle, django, etc. Architecturally, I wonder whether you really need the machine learning (which I imagine would be a data processing pipeline) and the web server to be the same process / binary; however, even if you do them in the same server, I suspect that either language would be perfectly reasonable; moreover, if you ever came to the point where you needed to run a piece of computation in C++ for performance, using SWIG to call C++ from Python or using some form of message passing from Python to a C++ helper process (such as via gRPC) are options.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download