BallisticLA / RandBLAS

A header-only C++ library for sketching in randomized linear algebra
https://randblas.readthedocs.io/en/latest/
Other
66 stars 4 forks source link

floating point exception in `RandBLAS::SJLTS::fill_colwise` #18

Closed burlen closed 1 year ago

burlen commented 1 year ago

There's a floating point exception generated by the following line because j == n_rows == 4 https://github.com/BallisticLA/RandBLAS/blob/550bbcd7962e9268012999ac6b67b221885721ee/include/RandBLAS/sjlts.hh#L89

we got here by:

(gdb) where
#0  0x00007fffbd9b0e1c in RandBLAS::sjlts::fill_colwise<double> (sjl=..., seed_key=15611466, seed_ctr=975143) at /work/rblas/RandLAPACK-install/include/RandBLAS/sjlts.hh:89
#1  0x00007fffbd989c09 in RandLAPACK::comps::preconditioners::rpc_svd_sjlt<double> (m=3, n=2, d=4, k=8, A_rm=0x555556114f50, M_wk=0x555556230ed0, mu=0, threads=1, seed_key=15611466, seed_ctr=975143)
    at /work/rblas/RandLAPACK-install/include/RandLAPACK/comps/preconditioners.hh:79
#2  0x00007fffbd96f101 in block_PCG_precond_lstsq<double> (A_cm=..., A_rm=..., ridge_coeff=0, B=..., X=..., m=3, n=2, s=1, layout=Layout::ColMajor, device=-1, strm=..., queue=0x0, cb_handle=0x0, cs_handle=0x0) at /work/rblas/gpu_linsolver/BPCG.h:247

the value of sjl at this point is:

(gdb) print sjl
$13 = (const RandBLAS::sjlts::SJLT<double> &) @0x7fffffffc890: {ori = RandBLAS::sjlts::ColumnWise, n_rows = 4, n_cols = 3, 
  vec_nnz = 8, rows = 0x5555569578c0, cols = 0x555556957980, vals = 0x555556f6d740}
burlen commented 1 year ago

@rileyjmurray Could you take a look at this?

rileyjmurray commented 1 year ago

I'll look at this right away!

On Fri, Dec 9, 2022 at 12:41 PM Burlen Loring @.***> wrote:

@rileyjmurray https://github.com/rileyjmurray Could you take a look at this?

— Reply to this email directly, view it on GitHub https://github.com/BallisticLA/RandBLAS/issues/18#issuecomment-1344761264, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRLIFHGL2PNNPFOKIKEW4DWMOKQ3ANCNFSM6AAAAAASZXJTO4 . You are receiving this because you were mentioned.Message ID: @.***>

rileyjmurray commented 1 year ago

The problem is that vec_nnz = 8 and n_rows = 4. We should raise an exception if vec_nnz > n_rows. (In practice this should never happen, since n_rows will be at least a few thousand and vec_nnz should rarely be more than 8.)

burlen commented 1 year ago

Got it thanks! May be worth mentioning this in the rpc_svd_sjlt Doxygen comments as well

burlen commented 1 year ago

user error