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

[FLINK-13450][test] Adjust tests to tolerate arithmetic differences between x86 and ARM #9681

Closed
wants to merge 1 commit into from

Conversation

wangxiyuan
Copy link
Contributor

What is the purpose of the change

math.log and math.pow can actually return slightly different results across platforms because of hardware optimizations. We should use StrictMath instead to ensure the answers are already the same.

Brief change log

  • Changed Math.log to StrictMath.log
  • Changed Math.pow to StrictMath.pow

Verifying this change

This change is already covered by existing tests

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@wangxiyuan wangxiyuan changed the title [FLINK-13448][test] Use StrictMath instead of Math [FLINK-13450][test] Use StrictMath instead of Math Sep 16, 2019
@flinkbot
Copy link
Collaborator

flinkbot commented Sep 16, 2019

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 537669f (Wed Dec 04 21:54:02 UTC 2019)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Sep 16, 2019

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @wangxiyuan! I think this pull request is far more than in test scope. Could you corresponding modify the description/title?

@wangxiyuan
Copy link
Contributor Author

@tisonkun, hi, thanks for your comment. I don't know what scope is better, since this pr changed many modules. any suggestion? Thanks.

@tisonkun
Copy link
Member

Hi @wangxiyuan I revoke my change request above. After taking a look at the corresponding issue I know the root cause of this pull request is to adjust test so sort it into test component makes sense to me. Besides, what do you think if we change the title of the pull request and the commit to "Adjust tests to tolerate arithmetic differences between x86 and ARM" as the original JIRA written? I think it is more descriptive.

@tisonkun
Copy link
Member

@flinkbot run travis

@wangxiyuan wangxiyuan changed the title [FLINK-13450][test] Use StrictMath instead of Math [FLINK-13450][test] Adjust tests to tolerate arithmetic differences between x86 and ARM Sep 16, 2019
@StephanEwen
Copy link
Contributor

Could we reduce the changes to the scope where we really need strict results?
It looks like this mainly matters for result verification (some tests) and for the SQL functions.

In other parts, like exponential backoff, strict precision doesn't actually matter.
In some parts, like samplers, the performance is more important than the precision, so we should not use StrictMath there at all.

@StephanEwen
Copy link
Contributor

To clarify how this relates to my previous comment ("have just StrictMath"):
Within a module (like SQL scalar functions) I would not try to switch back and forth between Math and StrictMath. But between different uses (sampler versus SQL function) we can differentiate where we need it and where not.

@wangxiyuan
Copy link
Contributor Author

@StephanEwen Thanks for your review. ThenI just change the place where affect the test.

@wangxiyuan
Copy link
Contributor Author

can anyone review this PR? Thanks.

@wangxiyuan
Copy link
Contributor Author

@StephanEwen may this PR be visited again?

@StephanEwen
Copy link
Contributor

Looks good to me.
Merging this...

StephanEwen pushed a commit to StephanEwen/flink that referenced this pull request Dec 4, 2019
…essions

This ensures cross architecture compatibility of results.

This closes apache#9681
@asfgit asfgit closed this in 1d034ad Dec 4, 2019
@wangxiyuan wangxiyuan deleted the fix_math branch December 9, 2019 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants