简体   繁体   English

编译器在编译时会自动使用GPU还是必须手动使用它?

[英]Does the compiler automatically use GPU while compiling or shall I have to use it manually?

I have been compiling this program for bird image preprocessing on my pc with 8GB RAM, intel core i7-4th gen. 我一直在用8GB RAM(英特尔酷睿i7-4th gen)在我的PC上编译该程序以进行鸟类图像预处理 processor but everytime is gets stuck after running for a while showing this error: 处理器,但每次运行一段时间后都会卡住,显示此错误:

File "bird.py", line 13, in <module>
    X,Y,X_test,Y_test = pickle.load(open("full_dataset.pkl", "rb"))
MemoryError

Being a newbie to tensorflow, I am not sure whether CUDA (which I've installed successfully) is being used or is it just the CPU still performing the computations. 作为tensorflow的新手,我不确定是否正在使用CUDA(已成功安装)或只是CPU仍在执行计算。

The error you are seeing is raised before any GPU computation (or indeed any TensorFlow computation) has been issued. 在发出任何GPU计算(或者实际上是任何TensorFlow计算)之前,都会引发您所看到的错误。 The MemoryError implies that unpickling the dataset is either leading to running out of memory, or that there is some corruption in the data. MemoryError表示取消挑选数据集可能导致内存不足,或者数据中存在某些损坏。 Try loading a smaller dataset to see if the problem persists. 尝试加载较小的数据集,以查看问题是否仍然存在。

As to your original question, if you have installed the GPU version of TensorFlow, and a compatible version of CUDA (ie CUDA 8.0) and cuDNN, TensorFlow will offload much of the computation to your GPU, including the matrix multiplications and convolutions that will comprise the bulk of the time spent during training. 关于您的原始问题,如果您已经安装了TensorFlow的GPU版本以及兼容的CUDA版本(即CUDA 8.0)和cuDNN,TensorFlow会将许多计算任务转移到您的GPU上,包括将要构成的矩阵乘法和卷积培训期间花费的大部分时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM