mars icon indicating copy to clipboard operation
mars copied to clipboard

[BUG] test_numexpr_execution.py::test_unary_execution may raises NotImplementedError: couldn't find matching opcode for 'invert_dd'

Open fyrestone opened this issue 3 years ago • 0 comments

Describe the bug A clear and concise description of what the bug is.

Traceback (most recent call last):
  File "/home/vsts/miniconda/envs/test/lib/python3.9/site-packages/numexpr/necompiler.py", line 820, in evaluate
    compiled_ex = _numexpr_cache[numexpr_key]
KeyError: ('(~((abs((sin((cosh(V_0))))))))', (('optimization', 'aggressive'), ('truediv', False)), (('V_0', <class 'numpy.float64'>),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vsts/work/1/s/mars/tensor/fuse/numexpr.py", line 49, in execute
    res = ne.evaluate(expr, local_dict=local_dict, global_dict={})
  File "/home/vsts/miniconda/envs/test/lib/python3.9/site-packages/numexpr/necompiler.py", line 822, in evaluate
    compiled_ex = _numexpr_cache[numexpr_key] = NumExpr(ex, signature, **context)
  File "/home/vsts/miniconda/envs/test/lib/python3.9/site-packages/numexpr/necompiler.py", line 621, in NumExpr
    threeAddrProgram, inputsig, tempsig, constants, input_names = precompile(ex, signature, context)
  File "/home/vsts/miniconda/envs/test/lib/python3.9/site-packages/numexpr/necompiler.py", line 566, in precompile
    ast = typeCompileAst(ast)
  File "/home/vsts/miniconda/envs/test/lib/python3.9/site-packages/numexpr/necompiler.py", line 202, in typeCompileAst
    raise NotImplementedError(
NotImplementedError: couldn't find matching opcode for 'invert_dd'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/vsts/work/1/s/mars/services/subtask/worker/processor.py", line 189, in _execute_operand
    return execute(ctx, op)
  File "/home/vsts/work/1/s/mars/core/operand/core.py", line 491, in execute
    result = executor(results, op)
  File "/home/vsts/work/1/s/mars/tensor/fuse/numexpr.py", line 51, in execute
    raise RuntimeError(
RuntimeError: Failed to evaluate numexpr '(~((abs((sin((cosh(V_0))))))))' on local dict {'V_0': array([[[0.21645726, 0.16604782, 0.92275661, 0.29407666],

The problem is occurred in CI test, the ~ can not apply to a float array. Similar issue: https://github.com/pandas-dev/pandas/blob/main/pandas/tests/computation/test_eval.py#L368

To Reproduce To help us reproducing this bug, please provide information below:

  1. Your Python version
  2. The version of Mars you use
  3. Versions of crucial packages, such as numpy, scipy and pandas
  4. Full stack of the error.
  5. Minimized code to reproduce the error.

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

fyrestone avatar Aug 11 '22 10:08 fyrestone