在Mac上远程登录后,如何在GPU上测试OpenCL? [英] How do I test OpenCL on GPU when logged in remotely on Mac?

查看:147
本文介绍了在Mac上远程登录后,如何在GPU上测试OpenCL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在控制台登录时,我的OpenCL程序可以找到GPU设备,但是当我使用ssh远程登录时,找不到.此外,如果我在ssh会话中以root身份运行该程序,则该程序可以找到GPU.

My OpenCL program can find the GPU device when I am logged in at the console, but not when I am logged in remotely with ssh. Further, if I run the program as root in the ssh session, the program can find the GPU.

该计算机是具有GeForce 9400 GPU的Snow Leopard Mac.

The computer is a Snow Leopard Mac with a GeForce 9400 GPU.

如果我从控制台或以root用户身份运行程序(请参见下文),则输出如下(请注意"GeForce 9400"行):

If I run the program (see below) from the console or as root, the output is as follows (notice the "GeForce 9400" line):

2 devices found
Device #0 name = GeForce 9400
Device #1 name = Intel(R) Core(TM)2 Duo CPU     P8700  @ 2.53GHz

但是如果只是我,则通过ssh,没有GeForce 9400条目:

but if it is just me, over ssh, there is no GeForce 9400 entry:

1 devices found
Device #0 name = Intel(R) Core(TM)2 Duo CPU     P8700  @ 2.53GHz

我想在没有root的情况下在GPU上测试我的代码.那可能吗?下面是简化的GPU查找程序:

I would like to test my code on the GPU without having to be root. Is that possible? Simplified GPU finding program below:

#include <stdio.h>
#include <OpenCL/opencl.h>

int main(int argc, char** argv) {
    char dname[500];
    size_t namesize;
    cl_device_id devices[10];
    cl_uint num_devices;
    int d;

    clGetDeviceIDs(0, CL_DEVICE_TYPE_ALL, 10, devices, &num_devices);
    printf("%d devices found\n", num_devices);
    for (d = 0; d < num_devices; ++d) {
        clGetDeviceInfo(devices[d], CL_DEVICE_NAME, 500, dname, &namesize);
        printf("Device #%d name = %s\n", d, dname);
    }
    return 0;
}

我在 nvidia的论坛.不幸的是,唯一的答案是这是错误的论坛".

I found essentially the same question being asked on nvidia's forums. Unfortunately, the only answer was of the form "this is the wrong forum".

推荐答案

我希望GPU资源归桌面会话所有(即使显示登录屏幕也始终存在),这就是为什么它不可用的原因到远程会话.通过更改权限来强制问题会破坏系统,并必然导致问题.

I expect the GPU resource is owned by the desktop session (which is always present, even if to show the login screen), which is why it is not available to remote sessions. Forcing the issue by changing permissions is subverting the system and is bound to lead to problems.

您是否尝试过运行屏幕共享来远程访问Mac,而不是ssh?这样,您可以正常在桌面上运行该应用程序,并查看结果(可能会有一些延迟,具体取决于您的网络连接).

Have you tried running Screen Sharing to remotely access the Mac rather than ssh? That way you can run the app on the desktop as normal, and see your results (potentially with some latency, depending on your network connection).

这篇关于在Mac上远程登录后,如何在GPU上测试OpenCL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆