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

More math functions #4768

Merged
merged 7 commits into from
Feb 21, 2022
Merged

More math functions #4768

merged 7 commits into from
Feb 21, 2022

Conversation

dalg24
Copy link
Member

@dalg24 dalg24 commented Feb 8, 2022

Fix #4765
Partially resolving #4767

Adding round, rint, logb, nextafter, copysign, and signbit
Adding round, lround*, llround**, rint, lrint*, llrint**, logb, nextafter, copysign, and signbit
Naming functions that are missing in comments
** are missing with the SYCL backend

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Looks OK to me. I checked that the respective SYCL functions are indeed not implemented.
We should add unit tests, though.

@dalg24
Copy link
Member Author

dalg24 commented Feb 8, 2022

Withdrawing the functions that are prefix with l and ll and that are not provided by SYCL. I overlooked that their return type was long and long long respectively. Will push tests shortly.

@dalg24
Copy link
Member Author

dalg24 commented Feb 8, 2022

signbit is not tested (not trying to sweep it under the carpet but would rather withdraw than write all the boilerplate code needed)

@dalg24
Copy link
Member Author

dalg24 commented Feb 9, 2022

Failure with Clang+CUDA

4: rint(int)
4: rint(long)
4: rint(long long)
4: rint(unsigned int)
4: rint(unsigned long)
4: rint(unsigned long long)
4: rint(float)
4: relative difference exceeds tolerance [5.000000e-01 > 1.192093e-07]
4: relative difference exceeds tolerance [5.000000e-01 > 1.192093e-07]
4: value at 2.500000 which is 3.000000 was expected to be 2.000000
4: value at -2.500000 which is -3.000000 was expected to be -2.000000
4: /var/jenkins/workspace/Kokkos/core/unit_test/TestMathematicalFunctions.hpp:447: Failure
4: Expected equality of these values:
4:   errors
4:     Which is: 2
4:   0
4: rint(double)
4: relative difference exceeds tolerance [5.000000e-01 > 2.220446e-16]
4: relative difference exceeds tolerance [5.000000e-01 > 2.220446e-16]
4: value at 2.500000 which is 3.000000 was expected to be 2.000000
4: value at -2.500000 which is -3.000000 was expected to be -2.000000
4: /var/jenkins/workspace/Kokkos/core/unit_test/TestMathematicalFunctions.hpp:447: Failure
4: Expected equality of these values:
4:   errors
4:     Which is: 2
4:   0
4: [  FAILED  ] cuda.mathematical_functions_nearest_interger_floating_point_operations (3 ms)
4: [ RUN      ] cuda.mathematical_functions_floating_point_manipulation_functions

@dalg24
Copy link
Member Author

dalg24 commented Feb 9, 2022

On 2nd thought withdrawing rint for now since CUDA does not honor the dynamically-set rounding mode. We can revisit later.

@dalg24
Copy link
Member Author

dalg24 commented Feb 15, 2022

Retest this please

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

Looks OK to me,

@dalg24
Copy link
Member Author

dalg24 commented Feb 21, 2022

Failure is clearly unrelated (clang crashing when compiling TestOpenMPTarget_Complex.cpp)

@crtrott crtrott merged commit 89a139e into kokkos:develop Feb 21, 2022
@dalg24 dalg24 deleted the more_math_functions branch February 21, 2022 21:50
@ajpowelsnl ajpowelsnl added the InDevelop Enhancement, fix, etc. has been merged into the develop branch; label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InDevelop Enhancement, fix, etc. has been merged into the develop branch;
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants