PyCUDA - Ubuntu14.04安装及测试

PyCUDA - Ubuntu14.04安装及测试

安装

  • 依赖 Numpy
  • 直接安装
sudo apt install python-pycuda
  • 源码安装:

Step 1 下载并解压 PyCUDA

$ wget http://pypi.python.org/pypi/pycuda
$ tar xfz pycuda-VERSION.tar.gz

Step 2 编译PyCUDA

$ cd pycuda-VERSION # if you're not there already
$ python configure.py --cuda-root=/where/ever/you/installed/cuda
$ su -c "make install"

测试

e.g. 1

$ cd pycuda-VERSION/test
$ python test_driver.py

输出 OK 即成功.

e.g. 2

$ cd pycuda-VERSION/examples
$ python test_demo.py

e.g. 3

import pycuda.autoinit
import pycuda.driver 

free_bytes,total_bytes = pycuda.driver.mem_get_info() # 查询当前显卡的总显存,可用显存

文档

官方文档

相关文章

文章浏览阅读2.3k次,点赞4次,收藏22次。最近安装了CARLA预...
文章浏览阅读6.3k次,点赞5次,收藏15次。在清华镜像中下载U...
文章浏览阅读5k次。linux环境, python3.7.问题描述: 安装...
文章浏览阅读4.2k次,点赞4次,收藏17次。要安装这个 standa...
文章浏览阅读894次,点赞51次,收藏31次。在安卓使用vscode主...