I would split that up, save the requirement as event in some storage (redis for example or even rabbitmq) and listen to that with some daemonized script (cron would be a bad joice since its hard to make it run more often than every minute). The script will update the storage entry with the results and you can access it again in your http stack. You can implement the functionallity via ajax or utilize a usleep command in php to wait for the results. If using a while loop, dont forget to break it after 1 second or something, so the request is not running too long.
Your problem might be the configured user, that executes the php binary - it maybe not permitted to access those binaries on your system. Typically its the www-data user. By adding the www-data user to the necessary group, you might be able to solve it without splitting all up. Have a look at the binary's ownerships and permissions to figure that out.
theano
has GPU processing enabled (deeplearning.net/software/theano/tutorial/using_gpu.html)? Also, you may want to checkNumba
(A just-in-time compiler (from Continuum Analytics) specializing in NumPy) usage of GPU. See drive.google.com/drive/u/0/folders/0Bw5McUt95YdeanU5M0FFUlFsSjg. – Soberminded