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

fix: kdd tree knn example segfault #2925

Conversation

Alexandr-Solovev
Copy link
Contributor

Description

Please include a summary of the change. For large or complex changes please include enough information to introduce your change and explain motivation for it.

Changes proposed in this pull request:

@Alexandr-Solovev Alexandr-Solovev marked this pull request as ready for review September 30, 2024 16:39
@Alexandr-Solovev
Copy link
Contributor Author

/intelci: run

@@ -50,18 +50,32 @@ struct Math

static fpType sPowx(fpType in, fpType in1) { return _impl<fpType, cpu>::sPowx(in, in1); }

static fpType xsPowx(fpType in, fpType in1) { return _impl<fpType, cpu>::xsPowx(in, in1); }
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please leave some comments in this header about the differences between the functions starting with 's' and the functions starting with 'xs' and when should each be called.

static void vExp(SizeType n, const double * in, double * out)
{
#pragma omp simd
for (SizeType i = 0; i < n; ++i) out[i] = exp(in[i]);
}

static void xvExp(SizeType n, const double * in, double * out)
{
for (SizeType i = 0; i < n; ++i) out[i] = exp(in[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Functions like this would run faster when using multiple threads. MKL runs then multi-threaded as far as I can tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, you are right, but I wanted to add the section about these functions usage in threader_for(multithread for), because in such case to avoid calling multithread function inside the multithread loop we must use xFunc(single thread)

// Not implemented
static double sErfInv(double in) { return std::numeric_limits<double>::quiet_NaN(); }

// Not implemented
static double xsErfInv(double in) { return std::numeric_limits<double>::quiet_NaN(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't looked at what exact compilation arguments go into the icx invocations, but isn't the default for it to have the equivalent of GCC's -ffast-math which implicitly assumes that NaNs and Infs will not be encountered?

If so, would this NaN be checked somewhere? Could it throw an exception instead?

And how about taking these functions from the cephes library from Netlib which is public domain?

@ahuber21 ahuber21 mentioned this pull request Oct 23, 2024
3 tasks
@ethanglaser
Copy link
Contributor

Was anything else merged that would impact kd tree knn seg faults? Because these are no longer showing up in CI

@Alexandr-Solovev
Copy link
Contributor Author

Was anything else merged that would impact kd tree knn seg faults? Because these are no longer showing up in CI

#2951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants