CEA-LIST / N2D2

N2D2 is an open source CAD framework for Deep Neural Network simulation and full DNN-based applications building.
Other
146 stars 35 forks source link

Fix: popen failure make app crash + includes missing #48

Closed GasparQ closed 4 years ago

GasparQ commented 4 years ago

Popen error

Encountered issue

When I tryied to generate a ResNet-50, the application n2d2 crashed with a segfault.

Cause

After debug, I found that this crash was made by the function N2D2::Utils::exec :

Fix

To fix this Issue, I replaced the shared_ptr by a unique_ptr which is better in that case because :

Includes missing

Encountered issue

On Centos7, I couldn't manage to build the n2d2 target because of some includes missing.

Cause

In the file include/RangeStats.hpp, some unordered_map are declared but only the map header is included.

In the file src/RangeStats.hpp, the function assert is called without the inclusion of cassert.

Fix

Just added the missing includes in the files and remove useless ones.

Popen failed ??!!??

In the function N2D2::Utils::exec and at the construction of a N2D2::Gnuplot object, the function popen is called.

At some points, this function can fail and, in my case, it was because I didn't have enough memory on my environment (cf. #47).

Then I decided to improve error messages with strerror and errno in both cases.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.0005%) to 19.586% when pulling 3b95d3ced54ca7d2c0948abe6c41498e470ec270 on GasparQ:master into d66da81cdc7c1dce6ac9d29ebf586d5a4fa16d74 on CEA-LIST:master.

olivierbichler-cea commented 4 years ago

Thank you for your feedback, your pull request is straightforward, accepting it!