diff --git a/meshroom/core/stats.py b/meshroom/core/stats.py index 4a3b9d11a5..046b1c5ca3 100644 --- a/meshroom/core/stats.py +++ b/meshroom/core/stats.py @@ -95,23 +95,34 @@ def updateGpu(self): return try: p = subprocess.Popen([self.nvidia_smi, "-q", "-x"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - xmlGpu, stdError = p.communicate(timeout=10) # 10 seconds + if sys.version_info[0] == 2: + # no timeout in python-2 + xmlGpu, stdError = p.communicate() + else: + xmlGpu, stdError = p.communicate(timeout=10) # 10 seconds smiTree = ET.fromstring(xmlGpu) gpuTree = smiTree.find('gpu') try: - self._addKV('gpuMemoryUsed', gpuTree.find('fb_memory_usage').find('used').text.split(" ")[0]) + gpuMemoryUsed = gpuTree.find('fb_memory_usage').find('used').text.split(" ")[0] + self._addKV('gpuMemoryUsed', gpuMemoryUsed) except Exception as e: logging.debug('Failed to get gpuMemoryUsed: "{}".'.format(str(e))) pass try: - self._addKV('gpuUsed', gpuTree.find('utilization').find('gpu_util').text.split(" ")[0]) + self.gpuMemoryTotal = gpuTree.find('fb_memory_usage').find('total').text.split(" ")[0] + except Exception as e: + pass + try: + gpuUsed = gpuTree.find('utilization').find('gpu_util').text.split(" ")[0] + self._addKV('gpuUsed', gpuUsed) except Exception as e: logging.debug('Failed to get gpuUsed: "{}".'.format(str(e))) pass try: - self._addKV('gpuTemperature', gpuTree.find('temperature').find('gpu_temp').text.split(" ")[0]) + gpuTemperature = gpuTree.find('temperature').find('gpu_temp').text.split(" ")[0] + self._addKV('gpuTemperature', gpuTemperature) except Exception as e: logging.debug('Failed to get gpuTemperature: "{}".'.format(str(e))) pass @@ -191,7 +202,7 @@ def update(self, proc): data = proc.as_dict(self.dynamicKeys) for k, v in data.items(): self._addKV(k, v) - + ## Note: Do not collect stats about open files for now, # as there is bug in psutil-5.7.2 on Windows which crashes the application. # https://github.com/giampaolo/psutil/issues/1763 diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index cd7a6daa2c..3915c42ada 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -360,7 +360,7 @@ def fieldOfView(self): return None focalLength = self.solvedIntrinsics["focalLength"] sensorHeight = self.solvedIntrinsics["sensorHeight"] - return 2.0 * math.atan(sensorHeight / (2.0 * float(focalLength))) * 180 / math.pi + return 2.0 * math.atan(float(sensorHeight) / (2.0 * float(focalLength))) * 180.0 / math.pi @Property(type=QUrl, notify=denseSceneParamsChanged) def undistortedImageSource(self):