使用tensorflow-gpu为CPU和GPU构建conda软件包

时间:2020-06-07 23:35:43

标签: python tensorflow anaconda conda tensorflow2.0

我正在构建和交付使用tensorflow的conda软件包-我的软件包必须同时在仅CPU的计算机和启用GPU的计算机上运行。

Anaconda具有完善的tensorflow(https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/),但文档并未建议应将哪个软件包放入meta.yaml

tensorflow-gpu放在meta.yaml中可以吗?还是我需要构建和运送两个软件包?

注意:在仅CPU的计算机上,以下工作正常:

conda create -y -n tf tensorflow-gpu
conda activate tf
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

给予

2020-06-07 11:48:43.115000: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-06-07 11:48:43.115062: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
2020-06-07 11:48:43.115092: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (43b17c992948): /proc/driver/nvidia/version does not exist
2020-06-07 11:48:43.115394: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2020-06-07 11:48:43.125682: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2304000000 Hz
2020-06-07 11:48:43.126886: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x564a38094a80 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-07 11:48:43.126927: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
tf.Tensor(107.471436, shape=(), dtype=float32)

0 个答案:

没有答案
相关问题