question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Failure to create sparse matrix on PPC

See original GitHub issue

This is from https://github.com/conda-forge/osqp-feedstock/pull/39, happens both with openblas & netlib backends. Scipy version 1.7.1, numpy 1.21.1.

Minimal example directly from osqp test suite:

import scipy
from scipy import sparse
scipy.random.seed(1)
sparse.random(5, 5, density=0.7)

fails with

[...]/lib/python3.8/site-packages/osqp/tests/update_matrices_test.py:23:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[...]/lib/python3.8/site-packages/scipy/sparse/construct.py:813: in random
    return coo_matrix((vals, (i, j)), shape=(m, n)).asformat(format,
[...]/lib/python3.8/site-packages/scipy/sparse/coo.py:196: in __init__
    self._check()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <5x5 sparse matrix of type '<class 'numpy.float64'>'
        with 18 stored elements in COOrdinate format>

    def _check(self):
        """ Checks data structure for consistency """

        # index arrays should have integer data types
        if self.row.dtype.kind != 'i':
            warn("row index array has non-integer dtype (%s)  "
                    % self.row.dtype.name)
        if self.col.dtype.kind != 'i':
            warn("col index array has non-integer dtype (%s) "
                    % self.col.dtype.name)

        idx_dtype = get_index_dtype(maxval=max(self.shape))
        self.row = np.asarray(self.row, dtype=idx_dtype)
        self.col = np.asarray(self.col, dtype=idx_dtype)
        self.data = to_native(self.data)

        if self.nnz > 0:
            if self.row.max() >= self.shape[0]:
>               raise ValueError('row index exceeds matrix dimensions')
E               ValueError: row index exceeds matrix dimensions

Same thing for scipy.sparse.random(100, 200, density=0.9, format='csc'),

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
h-vetinaricommented, Aug 9, 2021

Thanks for taking a look!

I’m just packaging the library, it’s not “my” code, which comes from here.

Indeed the import is done separately there; I had just tried to translate that function into a minimal example (without rerunning directly) - apologies.

0reactions
rgommerscommented, Feb 22, 2022

Probably an emulation bug, this code is too simple to actually be broken specifically on PPC I’d think. Let’s close it - if someone finds this problem on an actual PPC machine instead of on QEMU please reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in building sparse matrix Python Scipy.sparse
In my code I am currently iterating and creating three lists: data, row, col. to construct a sparse matrix (it represents a rating...
Read more >
Matrix package bug?
Hi guys,   I got a sparse matrix. All the elements of this matrix are either 0, 1, or 2. I only need...
Read more >
Bug List - Eigen
ID Product△ Comp△ Assignee Status△ Resolution△ Changed 121 Eigen Tests eigen.nobody RESO FIXE 2019‑12‑04 1543 Eigen Core ‑ e eigen.nobody RESO FIXE 2019‑12‑04 17 Eigen Geometry...
Read more >
I get an error, what's wrong? on Sparse matrix logic and answer
A sparse matrix is a large matrix with almost all elements of the same value (typically zero). The normal representation of a sparse...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug:1523 - "[IDEA] Offload work by distributing trivial ebuild maintenance to users, ... Bug:357499 - "Build failure on ppc: games-arcade/lbreakout2-2.6.2" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found