我怎么能告诉PyCUDA哪个GPU使用? [英] How can i tell PyCUDA which GPU to use?

查看:407
本文介绍了我怎么能告诉PyCUDA哪个GPU使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器中有两个NVidia卡,两个都有CUDA功能。当我运行示例脚本以开始使用PyCUDA,如下所示: http://documen.tician.de/pycuda/ 我得到错误

I have two NVidia cards in my machine, and both are CUDA capable. When I run the example script to get started with PyCUDA seen here: http://documen.tician.de/pycuda/ i get the error

nvcc fatal   : Value 'sm_30' is not defined for option 'gpu-architecture'

我的计算GPU是计算能力3.0,所以sm_30应该是nvcc编译器的正确选项。我的图形GPU只有CC 1.2,所以我想也许这是问题。我安装了没有错误的linux的CUDA 5.0发行版,以及所有的编译器组件和python组件。

My computing GPU is compute capability 3.0, so sm_30 should be the right option for the nvcc compiler. My graphics GPU is only CC 1.2, so i thought maybe that's the problem. I've installed the CUDA 5.0 release for linux with no errors, and all the compiler components and python components.

有没有办法明确告诉PyCUDA使用哪个GPU?

Is there a way to tell PyCUDA explicitly which GPU to use?

推荐答案

nvcc 根据您安装的特定GPU不会抱怨。它会编译为你要编译的任何GPU类型。问题是你指定 sm_30 这不是 - gpu-architecture 的有效选项$ c> - gpu-code 选项。

nvcc isn't going to complain based on the specific GPUs you have installed. It will compile for whatever GPU type you tell it to compile for. The problem is you are specifying sm_30 which is not a valid option for --gpu-architecture when a --gpu-code option is also specified.

你应该传递 compute_30 - gpu-architecture sm_30 for - gpu-code

You should be passing compute_30 for --gpu-architecture and sm_30 for --gpu-code

还要确保你使用正确的 nvcc ,并且不会无意中使用

Also be sure you have the correct nvcc in use and are not inadvertently using some old version of the CUDA toolkit.

一旦你编译出问题,就会有一个环境变量 CUDA_DEVICE pycuda将观察选择一个特定的已安装的GPU。

Once you have the compile problem sorted out, there is an environment variable CUDA_DEVICE that pycuda will observe to select a particular installed GPU.

此处

CUDA_DEVICE=2 python my-script.py

顺便说一下其他人遇到了您的问题。
确定您没有PyCUDA正在使用的旧版本的CUDA工具包吗?

By the way someone else had your problem. Are you sure you don't have an old version of the CUDA toolkit laying around that PyCUDA is using?

这篇关于我怎么能告诉PyCUDA哪个GPU使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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