Assertion `nbytes % 8 == 0' failed

Questions and discussions regarding the use of Qbox
Forum rules
You must be a registered user to post in this forum. Registered users may also post new topics if they consider that their subject does not correspond to any topic already present on the forum.
Post Reply
dingpan
Posts: 8
Joined: Mon Mar 23, 2015 9:48 pm

Assertion `nbytes % 8 == 0' failed

Post 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!
fgygi
Site Admin
Posts: 167
Joined: Tue Jun 17, 2008 7:03 pm

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

Post 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
dingpan
Posts: 8
Joined: Mon Mar 23, 2015 9:48 pm

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

Post by dingpan »

Thank you very much Francois!
Post Reply