Page 1 of 1

Assertion `nbytes % 8 == 0' failed

Posted: Fri Jul 24, 2015 12:02 am
by dingpan
Occasionally, I met the error "qb: XMLGFPreprocessor.C:1046: int XMLGFPreprocessor::process(const char *, DoubleMatrix &, std::basic_string<char, std::char_traits<char>, std::allocator<char>> &, bool): Assertion `nbytes % 8 == 0' failed.".

Sorry that I do not know how to trigger this error exactly, because it seems appearing randomly, but not often.
There can be two cases:

Case 1: I simply did the restart again using the old saved XML file, the error was gone.
Case 2: It seemed the old XML file was broken, because the debug message showed:
"0: iseg=110 dbufsize=265786
1: iseg=95 nbytes=1504628
qbox.x: XMLGFPreprocessor.C:1046: int XMLGFPreprocessor::process(const char *, DoubleMatrix &, std::basic_string<char, std::char_traits<char>, std::allocator<char>> &, bool): Assertion`nbytes % 8 == 0' failed."

I guess for both cases the error is mainly caused by computer clusters themselves. Something may be wrong during data I/O. Any comments? Thank you!

Re: Assertion `nbytes % 8 == 0' failed

Posted: Sat Jul 25, 2015 1:41 am
by fgygi
This seems to indicate that the sample file was corrupted and the wave function data does not amount to a multiple of 8 bytes (which should always be the case since the size of a double is 8 bytes). This may happen if the file system failed to complete the write operation when saving the sample, or possibly failing to read the file during the load operation.
In my experience, this error message disappeared after regenerating a new sample file, which is consistent with your observation.
Note that on clusters that do not have a parallel file system, you should make sure that the "-DPARALLEL_FS" macro declaration is NOT used during compilation. This may help reducing the load on the file system, as can be seen from this fragment of XMLGFPreprocessor.C

Code: Select all

#if PARALLEL_FS
    // parallel file system: all nodes read at once
    items_read = fread(rdbuf,sizeof(char),local_size,infile);
#else
    // On a serial (or NFS) file system: tasks read by increasing row order
    // to avoid overloading the NFS server
    // No more than ctxt.npcol() tasks are reading at any given time
    for ( int irow = 0; irow < ctxt.nprow(); irow++ )
    {
      if ( irow == ctxt.myrow() )
        items_read = fread(rdbuf,sizeof(char),local_size,infile);
    }
#endif

Re: Assertion `nbytes % 8 == 0' failed

Posted: Thu Jul 30, 2015 12:23 am
by dingpan
Thank you very much Francois!