pyCUDA with Flask gives pycuda._driver.LogicError: cuModuleLoadDataEx

前端 未结 2 1264
误落风尘
误落风尘 2021-01-17 11:35

I want to run a pyCUDA code on a flask server. The file runs correctly directly using python3 but fails when the corresponding function is called u

2条回答
  •  臣服心动
    2021-01-17 12:13

    PyCUDA may not be compatible with WSGI web server contexts. You could possibly make it work if you use some kind of message queue like Celery, where the HTTP request places a job on the queue and the worker on the other side of the queue runs the CUDA program.

    Edit: A quick and easy way would be to use Python Subprocess check_output function

    In the web request:

    subprocess.check_output(['python', 'cudaFlask.py'])

提交回复
热议问题