Skip to content

overflow in utility term calculation #842

@jpn--

Description

@jpn--

There is a potential problem in utility calculations for non-sharrow evaluation: When an expression is an evaluation of two int8 values, the pandas.eval engine preserves the datatype in the result, even if it triggers an overflow. For example, in the error @i-am-sijia found below, the problem occurs when evaluating num_escort_tours * start. Both operands have an original dtype of np.int8, and so result of df.eval('num_escort_tours * start') also has a dtype of np.int8. But in this case, the maximum "correct" value for a few rows of the result exceeds 127, causing an overflow.

When using Sharrow, this overflow does not occur (intermediate calculations are promoted to float as sharrow knows they are about to be multiplied against a float coefficient anyhow). BUT this then triggers disagreement between sharrow and non-sharrow, which stops the run in 'test' mode.

... Sharrow is still crashing at the non_mandatory_tour_scheduling.vectorize_tour_scheduling.tour_6.interaction_sample_simulate.eval_interaction_utils, due to the difference in utilities. See attached logs.

activitysim_nonetype_error.log
activitysim.log

...

I did not get this error when running the full-scale benchmarking run with Sharrow. So this might just be happening with the small test example. Should I open a separate issue?

Originally posted by @i-am-sijia in #839 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working/bug f

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions