STEllAR-GROUP / phylanx

An Asynchronous Distributed C++ Array Processing Toolkit
Boost Software License 1.0
75 stars 76 forks source link

Debug option does not work as expcted. #1294

Closed rtohid closed 3 years ago

rtohid commented 4 years ago

Setting the debug option to true should print the PhySL code at function definition not function call.

NOT working

from phylanx import Phylanx

@Phylanx(debug=1)
def foo():
    return 1

working

from phylanx import Phylanx

@Phylanx(debug=1)
def foo():
    return 1

foo()

with output:

define(
    foo,
    lambda(1)
)
hkaiser commented 4 years ago

@rtohid this is a side effect of the delayed compilation we have put in place a while ago. However I think we could simply compile the function right away if debug=True is set.

rtohid commented 4 years ago

Thanks @hkaiser. I get similar behavior with debug=True.

hkaiser commented 4 years ago

Thanks @hkaiser. I get similar behavior with debug=True.

Sure, I didn't imply debug=1 would be different from debug=True. What I meant is that we should change https://github.com/STEllAR-GROUP/phylanx/blob/master/python/phylanx/ast/physl.py#L515 to:

    if PhylanxSession.is_initialized or self.kwargs.get('debug', False):

to force compiling a function when it is seen first if debug is enabled.

rtohid commented 4 years ago

Thanks @hkaiser. I'd misunderstood. This works, I'll create a pull request later today.