avoid segfault when calling PPPM*::memory_usage() before grid communication is initialized

This commit is contained in:
Axel Kohlmeyer
2017-03-28 07:50:48 -04:00
parent 5feeb79c13
commit 28bdebd3c0
3 changed files with 4 additions and 4 deletions

View File

@ -3158,7 +3158,7 @@ double PPPMKokkos<DeviceType>::memory_usage()
if (peratom_allocate_flag)
bytes += 6 * nbrick * sizeof(FFT_SCALAR);
bytes += cg->memory_usage();
if (cg) bytes += cg->memory_usage();
return bytes;
}

View File

@ -3085,7 +3085,7 @@ double PPPM::memory_usage()
bytes += 2 * nfft_both * sizeof(FFT_SCALAR);;
}
bytes += cg->memory_usage();
if (cg) bytes += cg->memory_usage();
return bytes;
}

View File

@ -8240,7 +8240,7 @@ double PPPMDisp::memory_usage()
bytes += 6 * nfft_both * sizeof(double); // vg
bytes += nfft_both * sizeof(double); // greensfn
bytes += nfft_both * 3 * sizeof(FFT_SCALAR); // density_FFT, work1, work2
bytes += cg->memory_usage();
if (cg) bytes += cg->memory_usage();
}
if (function[1] + function[2] + function[3]) {
@ -8250,7 +8250,7 @@ double PPPMDisp::memory_usage()
bytes += 6 * nfft_both_6 * sizeof(double); // vg
bytes += nfft_both_6 * sizeof(double); // greensfn
bytes += nfft_both_6 * (mixing + 2) * sizeof(FFT_SCALAR); // density_FFT, work1, work2
bytes += cg_6->memory_usage();
if (cg_6) bytes += cg_6->memory_usage();
}
return bytes;
}