minerva icon indicating copy to clipboard operation
minerva copied to clipboard

none checking on owl + removal of compiled pyx files

Open lukemetz opened this issue 10 years ago • 1 comments

Ran into a number of odd errors when accidentally passing None into owl functions. Turns out cython just tries to accept them and they turn into invalid memory causing segfaults. (https://github.com/cython/cython/wiki/FAQ#why-does-a-function-with-cdef-d-parameters-accept-none) This pull request tries to fix that. In addition I removed the generated cpp file for the pyx file.

The new errors look something like:

[23:49:49] /home/luke/Repos/minerva/minerva/system/minerva_system.cpp:86: dag engine enabled
Traceback (most recent call last):
  File "tt.py", line 10, in <module>
    ele.relu(None)
  File "/home/luke/Repos/minerva/owl/owl/elewise.py", line 50, in relu
    return _owl.NArray.relu(x)
TypeError: Argument 'lhs' has incorrect type (expected owl.libowl.NArray, got NoneType)

The old error looks like:

[23:51:53] /home/luke/Repos/minerva/minerva/system/minerva_system.cpp:86: dag engine enabled
Segmentation fault (core dumped)

To my knowledge there are no tests for this pyx file. In addition I cannot run the cuda code on my current machine but to my knowledge this shouldn't break anything.

lukemetz avatar Aug 13 '15 06:08 lukemetz

Hi. Thanks for contributing. I'll merge after I test with your commits. This might take some time as we are now moving efforts to dmlc/mxnet and we are short of developers.

hotpxl avatar Aug 20 '15 07:08 hotpxl