Hello,
I ran into an issue where a script would run on a small number of processes, but would fail with an access violation segfault in the compute_bonds and compute_angles functions. The computes requested multiple values (energy and an additional xyz position which I had added to the compute), the problem will not arise when one value is requested as the compute operates in vector mode, not array mode. I tracked the access violation to this chunk of code:
if (flag) {
if (nvalues == 1) {
if (dflag >= 0) dbuf = vector;
if (eflag >= 0) ebuf = vector;
} else {
if (dflag >= 0) dbuf = &array[0][dflag];
if (eflag >= 0) ebuf = &array[0][eflag];
if (pflag >= 0) {
xbuf = &array[0][xflag];
ybuf = &array[0][yflag];
zbuf = &array[0][zflag];
}
}
}
Where pflag is pertinent to my modifications. When I exceed a certain number of processes, some processors had no bonds/angles to which the compute applied, thus array was never allocated, generating the access violation. I fixed the problem by adding:
reallocate(1);
to the end of the constructor, though I imaging something more memory efficient could be done (as this default allocates 10000 rows of data storage, generally not a big deal though). A default initial allocation would probably be most ideal. Just running an ncount==0 check before running the compute (say in the compute_local()) function) does not work as access violations can then occur in following fixes that use the compute.
Hope this is useful,
Brad Ewers