cudart_static-何时需要? [英] cudart_static - when is it necessary?

查看:370
本文介绍了cudart_static-何时需要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于CUDA运行时附带了较新的驱动程序(我可以在驱动程序下载页面中选择9.1或9.2),所以我的问题是:我的库(内部使用CUDA内核)应该与 -lcudart_static一起提供吗?

Since newer drivers ship with the CUDA runtime (I can choose 9.1 or 9.2 in the drivers download page) my question is: should my library (which uses a CUDA kernel internally) be shipped with -lcudart_static?

我在使用9.1 CUDA驱动程序的系统上启动用9.2编译的内核时遇到问题。确保我的媒体库在安装了最新CUDA驱动程序的任何地方都可以运行的最兼容方式是什么? (我已经在为虚拟体系结构进行编译)

I had issues launching kernels compiled with 9.2 on systems which used 9.1 CUDA drivers. What's the most 'compatible' way of ensuring my library will run everywhere a recent CUDA driver is installed? (I'm already compiling for a virtual architecture)

推荐答案


由于CUDA附带了新的驱动程序运行时(我可以在驱动程序下载页面中选择9.1或9.2)

Since newer drivers ship with the CUDA runtime (I can choose 9.1 or 9.2 in the drivers download page)

不,那是不正确的。驱动程序下载页面中的选择与以下事实有关:每个CUDA版本都具有与之关联的最低所需驱动程序版本。这并不意味着该驱动程序随CUDA运行时一起提供(换句话说,该驱动程序未在linux上安装libcudart.so且从未安装过-经过全新安装的仔细试验,您可以自己证明一下。)

No, that's incorrect. That choice in the drivers download page is related to the fact that each CUDA version has a minimum required driver version associated with it. It does not mean that the driver ships with the CUDA runtime (stated another way, the driver does not install libcudart.so on linux and never has - with some careful experimentation on a clean install, you can prove this to yourself.)

一些其他注释:

-lcudart_static 实际上是默认,用于 nvcc 的当前/最新版本。您可以通过阅读 nvcc手册。因此,默认情况下,使用 nvcc 编译/构建的可执行文件应已静态链接到与 nvcc <版本对应的CUDA运行时库。 / code>用于编译。您可能需要指定此名称或类似内容的原因是,例如,如果要使用gnu工具链(在Linux上)而不是 nvcc

-lcudart_static is actually the default for current/recent versions of nvcc. You can discover this by reading the nvcc manual. Therefore, by default, your executable, when compiled/built with nvcc should already be statically linked to the CUDA runtime library corresponding to the version of nvcc that you are using for compilation. The reason you might need to specify this or something like this is if you are building an application with e.g. the gnu toolchain (on linux) rather than nvcc.

静态链接到CUDA运行时库的目的是如您所料,因此可以以无需安装CUDA工具箱即可正常运行的方式构建应用程序。只需安装正确的GPU驱动程序的计算机即可。

The purpose of static linking to the CUDA runtime library is, as you surmise, so that an application can be built in such a way that it does not need an installation of the CUDA toolkit to run properly. It only needs a machine with a proper GPU driver install.

确保应用程序在安装了一系列GPU驱动程序的一系列计算机上运行的最兼容方法是使用最旧的 CUDA工具包来编译您的应用程序,以满足您打算涵盖的范围内最早的GPU驱动程序的需求。同样,您可以在此处

The most compatible way to ensure that an application will run on a range of machines with a range of GPU driver installs is to compile your application using the oldest CUDA toolkit required to meet the needs of the earliest GPU driver in the range you intend to cover. Again, you can refer to the table here.

这篇关于cudart_static-何时需要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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