gpt4 book ai didi

python - Keras 耗时太长,不知道我用的是 GPU 还是 CPU

转载 作者:太空宇宙 更新时间:2023-11-04 09:27:01 26 4
gpt4 key购买 nike

我在运行我的程序时得到这些信息:

Using TensorFlow backend.
WARNING: Logging before flag parsing goes to stderr.
W0723 16:10:32.496439 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

W0723 16:10:32.497687 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W0723 16:10:32.500930 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

W0723 16:10:32.524909 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

W0723 16:10:32.530971 139881743095616 deprecation.py:506] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
W0723 16:10:32.584314 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

2019-07-23 16:10:32.584575: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2019-07-23 16:10:32.607060: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3400080000 Hz
2019-07-23 16:10:32.607412: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x235e0b0 executing computations on platform Host. Devices:
2019-07-23 16:10:32.607427: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): <undefined>, <undefined>
OMP: Info #212: KMP_AFFINITY: decoding x2APIC ids.
OMP: Info #210: KMP_AFFINITY: Affinity capable, using global cpuid leaf 11 info
OMP: Info #154: KMP_AFFINITY: Initial OS proc set respected: 0-7
OMP: Info #156: KMP_AFFINITY: 8 available OS procs
OMP: Info #157: KMP_AFFINITY: Uniform topology
OMP: Info #179: KMP_AFFINITY: 1 packages x 4 cores/pkg x 2 threads/core (4 total cores)
OMP: Info #214: KMP_AFFINITY: OS proc to physical thread map:
OMP: Info #171: KMP_AFFINITY: OS proc 0 maps to package 0 core 0 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 4 maps to package 0 core 0 thread 1
OMP: Info #171: KMP_AFFINITY: OS proc 1 maps to package 0 core 1 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 5 maps to package 0 core 1 thread 1
OMP: Info #171: KMP_AFFINITY: OS proc 2 maps to package 0 core 2 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 6 maps to package 0 core 2 thread 1
OMP: Info #171: KMP_AFFINITY: OS proc 3 maps to package 0 core 3 thread 0
OMP: Info #171: KMP_AFFINITY: OS proc 7 maps to package 0 core 3 thread 1
OMP: Info #250: KMP_AFFINITY: pid 6324 tid 6324 thread 0 bound to OS proc set 0
2019-07-23 16:10:32.607860: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
2019-07-23 16:10:32.659852: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
W0723 16:10:32.681015 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:1834: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.

W0723 16:10:33.686542 139881743095616 deprecation_wrapper.py:119] From /home/merry/anaconda3/envs/merry_env/lib/python3.7/site-packages/keras/optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

我不知道那是什么,OMP 行,我也不知道我是否在使用 GPU。

要点是,由于我收到此消息,执行时间超出了我的承受能力,因此我试图理解它以解决它。

知道它可能是什么吗,我是否正在使用 GPU,为什么要花这么长时间或如何指定 GPU?

如果需要,我可以添加我的代码。

最佳答案

通过以下方式检查 GPU 是否可用:

  1. 在 Bash shell 中,运行 nvidia-smi。如果您有 GPU(及其驱动程序),您将看到您有多少个 GPU 以及内存等其他信息。

  2. 在tensorflow中运行

python
>>> import tensorflow as tf
>>> tf.test.is_built_with_cuda()

如果为假,您可能需要检查是否正确安装了 tensorflow-gpu 和 cuda。

关于python - Keras 耗时太长,不知道我用的是 GPU 还是 CPU,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57166429/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com