如何在Colaboratory中使用numba

时间:2018-02-15 15:53:55

标签: numba google-colaboratory numba-pro

有人试图在谷歌合作中使用numba吗?我只是无法弄清楚如何在这种环境中进行设置。 目前,我遇到了错误$ stack --version Version 1.6.3 $ stack new yesod-project yesod-sqlite Downloading template "yesod-sqlite" to create project "yesod-project" in yesod-project/ ... Looking for .cabal or package.yaml files to use to init the project. Using cabal packages: - yesod-project/ Selecting the best among 12 snapshots... * Matches lts-10.5 Selected resolver: lts-10.5 Initialising configuration using resolver: lts-10.5 Total number of user packages considered: 1 Writing configuration to file: yesod-project/stack.yaml All done. $ cd yesod-project/ $ stack build $ stack exec -- yesod devel Yesod devel server. Enter 'quit' or hit Ctrl-C to quit. Application can be accessed at: http://localhost:3000 https://localhost:3443 If you wish to test https capabilities, you should set the following variable: export APPROOT=https://localhost:3443 Downloading lts-10.5 build plan ... Downloaded lts-10.5 build plan. AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\"" Type help for available commands. Press enter to force a rebuild.

3 个答案:

答案 0 :(得分:7)

将此代码复制到单元格中。它对我有用。

library nvvm not found

答案 1 :(得分:0)

我不必安装@Algis建议的软件包,但是驱动程序的路径不同。因此,我必须执行以下操作。

首先确定驱动程序的正确路径

!find / -iname 'libdevice'
!find / -iname 'libnvvm.so'

# Output:
# /usr/local/cuda-9.2/nvvm/lib64/libnvvm.so
# /usr/local/cuda-9.2/nvvm/libdevice

然后将路径设置为@Algis描述

import os
os.environ['NUMBAPRO_LIBDEVICE'] = "/usr/local/cuda-9.2/nvvm/libdevice"
os.environ['NUMBAPRO_NVVM'] = "/usr/local/cuda-9.2/nvvm/lib64/libnvvm.so"

答案 2 :(得分:0)

如果您在colab笔记本的开头有此代码块,则可以一口气完成@Stan的工作(随着CUDA更新,此代码也会自动更新)

import os
dev_lib_path = !find / -iname 'libdevice'
nvvm_lib_path = !find / -iname 'libnvvm.so'
assert len(dev_lib_path)>0, "Device Lib Missing"
assert len(nvvm_lib_path)>0, "NVVM Missing"
os.environ['NUMBAPRO_LIBDEVICE'] = dev_lib_path[0]
os.environ['NUMBAPRO_NVVM'] = nvvm_lib_path[0]