在Windows 10上使用CPU在Keras上运行tensorflow

时间:2022-09-28 19:32:24

I have installed Tensorflow and Keras with an Anaconda installation on Windows 10. I´m using an Intel i7 processor. It takes 40 minutes to train 4000 data samples of a CSV file and I´m trying to perform a LSTM RNN predictive analytics on this data.

我在Windows 10上安装了Tensorflow和Keras以及Anaconda安装。我使用的是Intel i7处理器。培训4000个CSV文件的数据样本需要40分钟,我正在尝试对此数据执行LSTM RNN预测分析。

Is this an expected compile time using CPU? Can we make it faster using cpu or switching to GPU?

这是使用CPU的预期编译时间吗?我们可以使用cpu或切换到GPU来加快速度吗?

1 个解决方案

#1


0  

Yes, this does seem like a reasonable amount of time for your code to run when you're training using only a CPU. If you used a NVIDIA GPU it would run much faster.

是的,当您仅使用CPU进行培训时,这似乎是您的代码运行的合理时间。如果您使用的是NVIDIA GPU,它的运行速度会快得多。

However, you might not be using every core on your CPU; if you are, it might run faster. You can change the number of threads that Tensorflow uses by running

但是,您可能没有使用CPU上的每个核心;如果你是,它可能运行得更快。您可以通过运行更改Tensorflow使用的线程数

sess = tf.Session(config=tf.ConfigProto(intra_op_parallelism_threads=NUM_THREADS))

If you set the number of threads equal to those provided by your CPU, it should run faster.

如果将线程数设置为等于CPU提供的线程数,则应该运行得更快。

#1


0  

Yes, this does seem like a reasonable amount of time for your code to run when you're training using only a CPU. If you used a NVIDIA GPU it would run much faster.

是的,当您仅使用CPU进行培训时,这似乎是您的代码运行的合理时间。如果您使用的是NVIDIA GPU,它的运行速度会快得多。

However, you might not be using every core on your CPU; if you are, it might run faster. You can change the number of threads that Tensorflow uses by running

但是,您可能没有使用CPU上的每个核心;如果你是,它可能运行得更快。您可以通过运行更改Tensorflow使用的线程数

sess = tf.Session(config=tf.ConfigProto(intra_op_parallelism_threads=NUM_THREADS))

If you set the number of threads equal to those provided by your CPU, it should run faster.

如果将线程数设置为等于CPU提供的线程数,则应该运行得更快。