我正在尝试按照以下说明安装 CUDA8-Theano-Keras这些说明。
当我到达要点 13 ( python3 check1.py
) 时,它应该检查 Theano 是否设置了 GPU,但它却出现以下消息:
Traceback (most recent call last):
File "check1.py", line 1, in <module>
from theano import function, config, shared, sandbox
File "/home/marija/anaconda3/lib/python3.6/site-packages/theano/__init__.py", line 45, in <module>
from theano.configdefaults import config
File "/home/marija/anaconda3/lib/python3.6/site-packages/theano/configdefaults.py", line 17, in <module>
from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr,
File "/home/marija/anaconda3/lib/python3.6/site-packages/theano/configparser.py", line 86, in <module>
theano_cfg.read(config_files)
File "/home/marija/anaconda3/lib/python3.6/configparser.py", line 696, in read
self._read(fp, filename)
File "/home/marija/anaconda3/lib/python3.6/configparser.py", line 1077, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '/home/marija/.theanorc', line: 1
'“n[global]nfloatX=float32ndevice=gpun[mode]=FAST_RUNnn[nvcc]nfastmath=Truenn[cuda]nroot=/usr/local/cuda”\n'
知道这里的问题是什么吗?
答案1
在12.配置theano默认使用GPU它要求复制一些带引号的字符串。不幸的是,如果你仔细看看,该网页会显示一些奇特的引号,但终端无法识别它们。比较“something”和“something”。执行此命令后,你只需添加这些引号并更改其含义(查看 Traceback -> ' “ .... “ ' 的最后一行)。
你想要的是这一行(或者从该网站粘贴,但要正确的引用):
echo -e "\n[global]\nfloatX=float32\ndevice=gpu\n[mode]=FAST_RUN\n\n[nvcc]\nfastmath=True\n\n[cuda]\nroot=/usr/local/cuda" >> ~/.theanorc