#使用豆瓣源or不使用,均安装失败
pip install pygpu -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
#报错:
Looking in indexes: http://pypi.douban.com/simple/
Collecting pygpu Could not find a version that satisfies the requirement pygpu from versions: No matching distribution found for.
#继续尝试使用conda,仍失败
conda install -c conda-forge pygpu`
#报错:
Traceback (most recent call last):
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/exceptions.py", line 640, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/cli/main.py", line 140, in _main
exit_code = args.func(args, p)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/cli/main_update.py", line 65, in execute
install(args, parser, 'update')
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/cli/install.py", line 231, in install
unknown=index_args['unknown'], prefix=prefix)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/core/index.py", line 101, in get_index
index = fetch_index(channel_priority_map, use_cache=use_cache)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/core/index.py", line 120, in fetch_index
repodatas = collect_all_repodata(use_cache, tasks)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 75, in collect_all_repodata
repodatas = _collect_repodatas_serial(use_cache, tasks)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 485, in _collect_repodatas_serial
for url, schan, pri in tasks]
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 115, in func
res = f(*args, **kwargs)
File "/data_d/public/miniconda2/lib/python2.7/site-packages/conda/core/repodata.py", line 473, in fetch_repodata
with open(cache_path, 'w') as fo:
IOError: [Errno 13] Permission denied: u'/data_d/public/miniconda2/pkgs/cache/6846611e.json'
#尝试使用制定安装版本pip install pygpu==0.7.5
#仍报错:
Collecting pygpu==0.7.5
Could not find a version that satisfies the requirement pygpu==0.7.5 (from versions: )
No matching distribution found for pygpu==0.7.5
import theano报错:
RuntimeError:
Could not import 'mkl'. If you are using conda, update the numpy
packages to the latest build otherwise, set MKL_THREADING_LAYER=GNU in
your environment for MKL 2018.
遂更新numpy
conda update numpy
#显示如下:
The following packages will be UPDATED:
mkl: 2017.0.3-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free --> 2019.3-199
numpy: 1.13.1-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free --> 1.16.3-py27h7e9f1db_0
Proceed ([y]/n)? y
尝试使用pip更新
pip install --upgrade theano
#尝试:
THEANO_FLAGS = mode = FAST_RUN, device = cuda, floatX = float32 python test_gpu.py
#输出:
/.conda/envs/my_root/lib/python2.7/site-packages/theano/gpuarray/dnn.py:184: UserWarning: Your cuDNN version is
more recent than Theano. If you encounter problems, try updating Theano or downgrading cuDNN to a version >= v5 and <= v7.
warnings.warn("Your cuDNN version is more recent than" Using cuDNN version 7201 on context
None Mapped name None to device cuda: GeForce GTX 1080 Ti (0000:03:00.0)#映射到了这个显卡
[GpuElemwise{exp,no_inplace}(GpuArrayType< None >(float32, vector)>), HostFromGpu(gpuarray)(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 0.221133 seconds
Result is [1.2317803 1.6187935 1.5227807 ... 2.2077181 2.2996776 1.623233 ]
Used the cpu
#最后居然是使用CPU
若不使用GPU:
python test_gpu.py
#输出:
[Elemwise{exp,no_inplace}( < TensorType(float64, vector) >)]
Looping 1000 times took 31.611282 seconds
Result is [1.23178032 1.61879341 1.52278065 ... 2.20771815 2.29967753 1.62323285]
Used the cpu
File/.conda/envs/my_root/lib/python2.7/site-packages/theano/configdefaults.py", line 116, in filter
'You are tring to use the old GPU back-end. '
ValueError: You are tring to use the old GPU back-end. It was removed from Theano. Use device=cuda* now.
See https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29 for more information.