Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
5c78b9d7
Unverified
Commit
5c78b9d7
authored
May 01, 2018
by
Taylor Robie
Committed by
GitHub
May 01, 2018
Browse files
catch cpuinfo ImportError (#4138)
* catch cpuinfo ImportError * add psutil import catch * fix typo
parent
369d1981
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
official/utils/logs/logger.py
official/utils/logs/logger.py
+19
-13
No files found.
official/utils/logs/logger.py
View file @
5c78b9d7
...
@@ -213,15 +213,18 @@ def _collect_cpu_info(run_info):
...
@@ -213,15 +213,18 @@ def _collect_cpu_info(run_info):
cpu_info
[
"num_cores"
]
=
multiprocessing
.
cpu_count
()
cpu_info
[
"num_cores"
]
=
multiprocessing
.
cpu_count
()
# Note: cpuinfo is not installed in the TensorFlow OSS tree.
try
:
# It is installable via pip.
# Note: cpuinfo is not installed in the TensorFlow OSS tree.
import
cpuinfo
# pylint: disable=g-import-not-at-top
# It is installable via pip.
import
cpuinfo
# pylint: disable=g-import-not-at-top
info
=
cpuinfo
.
get_cpu_info
()
info
=
cpuinfo
.
get_cpu_info
()
cpu_info
[
"cpu_info"
]
=
info
[
"brand"
]
cpu_info
[
"cpu_info"
]
=
info
[
"brand"
]
cpu_info
[
"mhz_per_cpu"
]
=
info
[
"hz_advertised_raw"
][
0
]
/
1.0e6
cpu_info
[
"mhz_per_cpu"
]
=
info
[
"hz_advertised_raw"
][
0
]
/
1.0e6
run_info
[
"machine_config"
][
"cpu_info"
]
=
cpu_info
run_info
[
"machine_config"
][
"cpu_info"
]
=
cpu_info
except
ImportError
:
tf
.
logging
.
warn
(
"'cpuinfo' not imported. CPU info will not be logged."
)
def
_collect_gpu_info
(
run_info
):
def
_collect_gpu_info
(
run_info
):
...
@@ -243,12 +246,15 @@ def _collect_gpu_info(run_info):
...
@@ -243,12 +246,15 @@ def _collect_gpu_info(run_info):
def
_collect_memory_info
(
run_info
):
def
_collect_memory_info
(
run_info
):
# Note: psutil is not installed in the TensorFlow OSS tree.
try
:
# It is installable via pip.
# Note: psutil is not installed in the TensorFlow OSS tree.
import
psutil
# pylint: disable=g-import-not-at-top
# It is installable via pip.
vmem
=
psutil
.
virtual_memory
()
import
psutil
# pylint: disable=g-import-not-at-top
run_info
[
"machine_config"
][
"memory_total"
]
=
vmem
.
total
vmem
=
psutil
.
virtual_memory
()
run_info
[
"machine_config"
][
"memory_available"
]
=
vmem
.
available
run_info
[
"machine_config"
][
"memory_total"
]
=
vmem
.
total
run_info
[
"machine_config"
][
"memory_available"
]
=
vmem
.
available
except
ImportError
:
tf
.
logging
.
warn
(
"'psutil' not imported. Memory info will not be logged."
)
def
_parse_gpu_model
(
physical_device_desc
):
def
_parse_gpu_model
(
physical_device_desc
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment