GithubHelp home page GithubHelp logo

Comments (3)

wolfv avatar wolfv commented on August 20, 2024

This seems to be a really weird issue. Luckily, so far I could only reproduce it in the jupyter notebook.

Using this code:

template <class C>
auto countnan(const C& c)
{
    int i = 0;
    for (auto& el : c)
    {
        if (std::isnan(el))
        {
             i += 1;
        }
    }
    return i;
}

I was able to observe a very random nondeterministic number of nans in the result.

I wonder if this is somehow related to cling.

from xtensor-blas.

wolfv avatar wolfv commented on August 20, 2024

Okay, I took a second look into it.

We do import the blas libraries for cling, but we do not define HAVE_CBLAS 1 (e.g.

#define HAVE_CBLAS 1

If you define this at the top of your notebook, you should not see any nan's anymore (at least that was the case for me).

Now that hints at a problem in the generic implementation of the dot product in FLENS.

I am looking at the output from running with CXXBLAS_DEBUG 1 and I see that CXXBLAS: dotu_generic is getting called. I'll take a look if I can find something obvious.

from xtensor-blas.

wolfv avatar wolfv commented on August 20, 2024

Ok, i found the root cause of the issue in this line of FLENS

for (IndexType i=0, iY=0; i<m; ++i, iY+=incY) {
    VY y_;
    dotu_generic(n, A+i*ldA, IndexType(1), x, incX, y_);
    y[iY] += alpha * y_;
}

The problem is that it's += assigning to potentially unitialized memory ... and that produces random nan's!

Let's check what the BLAS manual says.

from xtensor-blas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.