call CUDA program in PHP

Hello,

exec("fun.exe input/input.txt ");

I want to run an CUDA program in PHP, the task is:

fun.exe(CUDA program) load data from an input.txt. (argument)
calculating.
write an output.txt.
and PHP read ouput.txt to do next task.

In server1(Apache ,Windows XP), it can run perfectly, but in server2,3(Apache, Windows 7),the output is wrong.
The program doesn’t crash and there’s no any error message in the page, it seems like something wrong during the execution.
Next I try exec the All CPU-side version (same calculation),server2,3 can run correctly.
If I exec the fun.exe(CUDA version) in server2,3 directly(double click or in command line),the program also run perfectly.

Any idea on why server2,3 can’t run the program? Thanks.

I had the same problem. In my case, this occurs because Apache (installed together with XAMPP) was started as a service. If I run Apache directly, instead of as a service, CUDA works.

Is there any solution to this problem(Apache as a service and CUDA)??

What card are you using? If you have a Tesla, putting it in TCC mode should fix this problem.

The reason you can’t use CUDA from within a service in Windows is because Windows runs services in Session 0, which is not an interactive session; Windows only loads the graphics driver (and therefore, CUDA) for interactive sessions. If you have a Tesla and run it in TCC mode, it uses a special driver which is able to bypass this restriction.

Note this is also the reason that you normally (i.e., without using a Tesla in TCC mode) can’t utilize CUDA apps from within a Remote Desktop / Terminal Services session – because they’re also assigned to Session 0.

What card are you using? If you have a Tesla, putting it in TCC mode should fix this problem.

The reason you can’t use CUDA from within a service in Windows is because Windows runs services in Session 0, which is not an interactive session; Windows only loads the graphics driver (and therefore, CUDA) for interactive sessions. If you have a Tesla and run it in TCC mode, it uses a special driver which is able to bypass this restriction.

Note this is also the reason that you normally (i.e., without using a Tesla in TCC mode) can’t utilize CUDA apps from within a Remote Desktop / Terminal Services session – because they’re also assigned to Session 0.

hello,

I had the same problem!

The program doesn’t crash and there’s no any error message in the page, it seems like something wrong during the execution.

I ues PHP5.3.9 and apache2.2.21 in linux OS, GTX660 are used, CUDA program can run properly when used via command line.

Is there any solutions to this problem without replace the GPU card?

Thanks for your reply in advance!