in reply to Re^7: Math::GSL::SparseMatrix is broken if installed on latest 5.32.1.1 "Strawberry Perl PDL edition", whom to report this issue to?
in thread Math::GSL::SparseMatrix is broken if installed on latest 5.32.1.1 "Strawberry Perl PDL edition", whom to report this issue to?

they were meticulous in what they were doing, how can it be a "bug"?

I keep hitting behaviour that is very weird.
Having compiled the following program into an executable
#include <stdio.h> #include <stdlib.h> #include <gsl/gsl_spmatrix.h> #include <gsl/gsl_version.h> int main(int argc, char * argv[]) { long t, initial_value,left_shift, addon; initial_value = strtol(argv[1], NULL, 10); left_shift = strtol(argv[2], NULL, 10); addon = strtol(argv[3], NULL, 10); size_t v = (size_t)initial_value; v <<= (size_t)left_shift; v += (size_t)addon; printf("gsl header version : %s\n", GSL_VERSION); printf("gsl library version: %s\n", gsl_version); printf("size of _size_t is %d bytes\n", sizeof(size_t)); printf("initial value: %d\nleft shift: %d\naddon: %d\n", initial_valu +e, left_shift, addon); gsl_spmatrix *m = gsl_spmatrix_alloc(v,v); printf("size1: %lu\nsize2: %lu\nnz: %lu\n", m->size1, m->size2, m->nz +); return 0; }
I then execute it 4 times with different input arguments:
D:\C>gsl_spm.exe 1 16 28000 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 28000 size1: 93536 size2: 93536 nz: 0 D:\C>gsl_spm.exe 1 16 28001 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 28001 size1: 93537 size2: 93537 nz: 0 D:\C>gsl_spm.exe 1 16 28002 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 28002 size1: 93538 size2: 93538 nz: 0 D:\C>gsl_spm.exe 1 16 29002 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 29002 gsl: init_source.c:144: ERROR: failed to allocate space for data Default GSL error handler invoked.
The first three runs seem quite sane to me, but I don't see a good reason that the 4th run should blow up like that just because the third command line argument has been raised by 1000.
Maybe it's optimization at the expense of correctness ?
Or maybe there are some mysterious rules of usage that I am overlooking. (I don't normally use the GSL library at all.)
I get the same results with gsl-2.6.1.

Cheers,
Rob
  • Comment on Re^8: Math::GSL::SparseMatrix is broken if installed on latest 5.32.1.1 "Strawberry Perl PDL edition", whom to report this issue to?
  • Select or Download Code

Replies are listed 'Best First'.
Re^9: Math::GSL::SparseMatrix is broken if installed on latest 5.32.1.1 "Strawberry Perl PDL edition", whom to report this issue to? [OT]
by Anonymous Monk on Nov 15, 2022 at 22:34 UTC
    I don't see a good reason that the 4th run should blow up

    No more virtual memory? 10% non-zero elements are assumed by default. Auto managed PF is 3 x RAM max. I see "Commit size" close to 30 GB for process when gsl_spmatrix_alloc(80000,80000), can go no further. My 8 GB RAM (less than 6 is free) + 24 GB PF sums up OK to this "30". My guess is you have 16 GB + same auto-managed PF, and "Commit size" would be ~56 GB or so for 95K by 95K matrix.

      No more virtual memory?

      Ok - that would mean that "there are some mysterious rules of usage that I am overlooking".
      In fairness to them, perhaps that's not at all "mysterious" - but I wasn't expecting that sufficient memory would be allocated to actually store so many zeros.

      Thanks for the discussion.
      It was interesting to poke at (part of) the GSL library again.

      Cheers,
      Rob

        In fairness, it's not space for zeros which is allocated, but data, i, p (each 10% of total), and AVL tree. E.g. 40K x 40K matrix of type double would require ~12.8 GB of dense storage, but ~7.5 GB (checked "Commit size") of sparse COO storage. I agree it's unexpectedly very much. If I change density to 20%, then value goes up to ~15 GB. Already more than for dense matrix. Well, for my initial purposes of "very large 64-bit indexes" actual population would be very low. Sorry to continue after discussion seemingly was supposed to end :)