Bulk write vector values in distribute_local_to_global.
This patch lowers the total number of calls to VecSetValues in
ConstraintMatrix::distribute_local_to_global by writing new vector values to a
temporary array before sending them off to PETSc. There are no notable
performance improvements for the other vector classes (though this certainly
should not hurt).
I used step-40 to check that the performance improved. Here is the (filtered)
output with this patch:
[drwells@archway step-40]$ make run | grep assembly
| assembly | 1 | 0.00966s | 8.7% |
| assembly | 1 | 0.0122s | 6.4% |
| assembly | 1 | 0.0217s | 5.9% |
| assembly | 1 | 0.0431s | 5.6% |
| assembly | 1 | 0.0848s | 5.6% |
| assembly | 1 | 0.173s | 5.6% |
| assembly | 1 | 0.351s | 5.5% |
| assembly | 1 | 0.729s | 5.5% |
and on master:
[drwells@archway step-40]$ make run | grep assembly
| assembly | 1 | 0.00672s | 8.9% |
| assembly | 1 | 0.0133s | 7.2% |
| assembly | 1 | 0.0258s | 6.9% |
| assembly | 1 | 0.0513s | 6.8% |
| assembly | 1 | 0.101s | 6.6% |
| assembly | 1 | 0.203s | 6.5% |
| assembly | 1 | 0.414s | 6.4% |
| assembly | 1 | 0.93s | 6.9% |
so it appears that the whole assembly process takes about 10% less time.
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams