通过WAMP执行GPGPU程序

发布于 2024-09-10 06:55:54 字数 527 浏览 2 评论 0原文

我有一个使用 GPU 执行某些计算的程序。我可以使用命令行让程序正确运行。但是当我尝试通过 PHP 执行相同的语句时,我遇到了麻烦。

我使用的是 wamp 2.0,并且我尝试了 exec 和 proc_open 函数来尝试让程序运行,但即使进程正确启动,当涉及到 GPU 部分时,程序本身会引发错误,“您的硬件不支持着色器”。该程序最初还会检测正在使用的显卡类型,但这也没有发生。

需要说明的是,我还没有编写 GPU 程序。我可以直接从命令行运行相同的语句,但不能通过 php 运行。从 php 执行命令与直接执行命令有什么区别?

我使用的是 NVIDIA GT8600 显卡。任何帮助都会很棒。

在程序中,当它使用 glGetString(GL_VENDOR) 检查显卡供应商时,它会获取 Microsoft Corporation 而不是 NVIDIA。这导致了所有问题,尽管我仍然不知道为什么只有当我从 php 运行它时才会这样做。

我还尝试从命令行独立运行 php 脚本,在这种情况下,我的显卡被正确检测到,一切正常,只有当我通过浏览器时它才不起作用。

I have a program that uses the GPU for performing certain computations. I can get the program to run correctly using the command line. But when i try to execute the same statement through PHP, i run into trouble.

I'm using wamp 2.0, and I've tried the exec and proc_open functions to try to get the program to run, but even though the process starts correctly, when it comes to the GPU part, the program itself raises the error, "Shader not supported by your hardware". The program also initially detects the kind of graphics card being used, but this is not happening either.

To be clear, I haven't written the GPU program. And I can run the same statement directly from the command line, but not through php. What is the difference in executing a command from php rather than directly?

I'm using an NVIDIA GT8600 graphics card. Any help at all would be great.

In the program when it checks for graphics card vendor using glGetString(GL_VENDOR) it gets Microsoft Corporation instead of NVIDIA. This is causing all the problems, though i still don't know why its doing so only when i run it from php.

I've also tried running the php script standalone from the command line, and in this case my graphics card gets detected correctly and everything works fine, only when i go through my browser does it not work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神经大条 2024-09-17 06:55:54

经过一番挖掘后,我发现问题是由于 Windows 7 中的会话 0 隔离引起的(我为在问题中没有提及 Windows 7 深表歉意)

其要点是,由驻留在会话 0 中的 wampapache 服务启动的任何进程都是无法访问显示设备(这需要我的服务成为会话 1 的一部分)。所以我的代码在调用GPU进程时无法检测到我的显卡。

解决这个问题的一种方法是在会话 1 中生成一个服务,然后让它执行该进程。 NVIDIA 论坛中有一个很好的帖子以及一些示例代码,展示了如何完成此操作。

http://forums.nvidia .com/index.php?showtopic=93450&pid=1047458&mode=threaded&start=#entry1047458

After some digging around I found that the problem arises due to session 0 isolation in windows 7 (I humbly apologize for not mentioning windows 7 in the question)

The gist of it being, any process initiated by the wampapache service that resides in session 0 is unable to access display devices (which requires my service to be a part of session 1). So my code when calling the GPU process is unable to detect my graphics card.

One way of getting around this is spawning a service in session 1, and then letting that execute the process. There's a good thread in the NVIDIA forums along with some example code that shows how this can be done.

http://forums.nvidia.com/index.php?showtopic=93450&pid=1047458&mode=threaded&start=#entry1047458

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文