Repository: Qiskit/qiskit

Issue:
Job executing problem on RBPi with Raspbian Stretch in _parallel.py
### Informations

- **Qiskit Terra version**: 0.6.1
- **Python version**: 3.6
- **Operating system**: Raspbian Stretch

### What is the current behavior?

When trying to execute job on my Raspberry Pi B I get following error in _parallel.py:

"... _parallel.py", line 109, in parallel_map
    if platform.system() != 'Windows' and num_processes > 1 \
TypeError: '>' not supported between instances of 'NoneType' and 'int'

From what I understand initialization of num_processes (or rather it's default value - CPU_COUNT = local_hardware_info()['cpus']) is a problem on selected os. 

### Steps to reproduce the problem

Try to execute a job on Raspbian Stretch on RBPi.

### What is the expected behavior?

The job gets executed.

### Suggested solutions

Check if num_processes is an initialized int before comparison. 


Discussion:
It seems that psutil cannot determine the physical cpu count on your system. The solution is to probably fall back to num_processes=1 if it cannot be determined 
I can make this fix I think.

Checking `psutil.cpu_count` on my pi I noticed that `cpu_count(logical=False)` returns None but `cpu_count(logical=True)` returns 4. Is it worth trying value of `logical=True` when `logical=False` returns `None` or just default straight to 1?

Resolving patch:
diff --git a/qiskit/_util.py b/qiskit/_util.py
--- a/qiskit/_util.py
+++ b/qiskit/_util.py
@@ -75,7 +75,7 @@ def local_hardware_info():
     """Basic hardware information about the local machine.
 
     Gives actual number of CPU's in the machine, even when hyperthreading is
-    turned on.
+    turned on. CPU count defaults to 1 when true count can't be determined.
 
     Returns:
         dict: The hardware information.
@@ -83,7 +83,7 @@ def local_hardware_info():
     """
     results = {'os': platform.system()}
     results['memory'] = psutil.virtual_memory().total / (1024**3)
-    results['cpus'] = psutil.cpu_count(logical=False)
+    results['cpus'] = psutil.cpu_count(logical=False) or 1
     return results
 
 


Test patch:
diff --git a/test/python/test_util.py b/test/python/test_util.py
new file mode 100644
--- /dev/null
+++ b/test/python/test_util.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+# Copyright 2018, IBM.
+#
+# This source code is licensed under the Apache License, Version 2.0 found in
+# the LICENSE.txt file in the root directory of this source tree.
+
+"""Tests for qiskit/_util.py"""
+
+from unittest import mock
+
+from qiskit import _util
+from .common import QiskitTestCase
+
+
+class TestUtil(QiskitTestCase):
+    """Tests for qiskit/_util.py"""
+
+    @mock.patch('platform.system', return_value='Linux')
+    @mock.patch('psutil.virtual_memory')
+    @mock.patch('psutil.cpu_count', return_value=None)
+    def test_local_hardware_none_cpu_count(self, cpu_count_mock, vmem_mock,
+                                           platform_mock):
+        """Test cpu count fallback to 1 when true value can't be determined"""
+        # pylint: disable=unused-argument
+        result = _util.local_hardware_info()
+        self.assertEqual(1, result['cpus'])