Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A Note on NDArray Deallocation Issue in blosc2 Module #187

Closed
omaech opened this issue Apr 9, 2024 · 2 comments
Closed

A Note on NDArray Deallocation Issue in blosc2 Module #187

omaech opened this issue Apr 9, 2024 · 2 comments
Assignees

Comments

@omaech
Copy link
Collaborator

omaech commented Apr 9, 2024

Recently, while working with the blosc2 module in Python, I encountered an error message that said: 'Exception ignored in: 'blosc2.blosc2_ext.NDArray.dealloc''.
This message indicates that there is some issue related to the deallocation of an object of the NDArray class in the blosc2 module. It is important to note this as it could be an indication of other potential issues within the code related to memory management or the use of NDArray objects in the blosc2 module.
It is interesting to note that when I execute only code involving Numba, this error does not occur. This suggests that the issue could be specifically related to the interaction between Numba and the blosc2 module.

" TypeError: 'NoneType' object is not callable
Exception ignored in: 'blosc2.blosc2_ext.NDArray.dealloc' "

https://github.com/omaech/python-blosc2/blob/lazy-expr/blosc2/my_numba.py

@martaiborra martaiborra self-assigned this Apr 11, 2024
@martaiborra
Copy link
Collaborator

For some reason, the link to the Python example that shows the problem does not work. The next code fragment is another example that also shows the problem.

#######################################################################
# Copyright (c) 2019-present, Blosc Development Team <[email protected]>
# All rights reserved.
#
# This source code is licensed under a BSD-style license (found in the
# LICENSE file in the root directory of this source tree)
#######################################################################

# This shows how to evaluate expressions with NDArray instances as operands.

import numpy as np
import blosc2
import numba as nb


shape = (50, 50)
dtype = np.float64

# Create a NDArray from a NumPy array
npa = np.linspace(0, 1, np.prod(shape)).reshape(shape)
npc = npa + 1

a = blosc2.asarray(npa)

# Get a LazyExpr instance
c = a + 1
# Evaluate!  Output is a NDArray
d = c.evaluate()
# Check
assert np.allclose(d[:], npc)


@nb.jit(nopython=True, parallel=True)
def func_numba(x):
    out = np.empty(x.shape, x.dtype)
    for i in nb.prange(x.shape[0]):
        for j in nb.prange(x.shape[1]):
            out[i, j] = x[i, j] + 1
    return out


nb_res = func_numba(npa)
 

As in the @omaech example, this program outputs the following error:

TypeError: 'NoneType' object is not callable
Exception ignored in: 'blosc2.blosc2_ext.NDArray.__dealloc__'
TypeError: 'NoneType' object is not callable
TypeError: 'NoneType' object is not callable
Exception ignored in: 'blosc2.blosc2_ext.NDArray.__dealloc__'
TypeError: 'NoneType' object is not callable

If nb_res = func_numba(npa) is commented out, the error messages disappear.

@martaiborra
Copy link
Collaborator

Doing some experiments, if the blosc2 lazy expression is commented out, but the creation of the b2array is left, it still shows the error. So the problem is not related with the python-blosc2 expressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants