- changed status to open
- removed comment
Reduce time spent in deciding not to do output.
I noticed, during some scaling tests, that for my code a significant amount of time was spent by CarpetIOASCII, even though I only had it activated and didn't actually request any output. The reason is that in order to figure out whether to do output or not, there is a loop over all grid variables and a routine (TimeToOutput) is called. In this routine there is a check if the out_dir and out_vars parameters have been steered and if so update some internal data structures. It should be sufficient to do this before entering the loop over grid variables. The same issue is present in CarpetIOScalar and CarpetIOHDF5. The attached patches for CarpetIOASCII, CarpetIOScalar and CarpetIOHDF5 moves this check outside of the loop over grid variables and in addition bypasses the loop completely if the out_vars parameter string is the empty string. Note that the code where I noticed this problem uses large vectors of 1D grid arrays, and it turns out that Cactus counts each vector element as a distinct grid variables and the length of the loop over grid variables in my case was close to 100.000, which might explain why nobody has noticed this before.
Keyword: performance
Keyword: optimization
Comments (6)
-
-
- changed status to open
- removed comment
This is okay to apply.
Please update CarpetIOHDF5.patch, which currently introduces some commented-out code. It also seems the indentation of off near there.
-
- removed comment
Is this still fine to apply?
-
- removed comment
I think so - pending the changes Erik suggested. Also, now is probably the best time to do this.
-
- changed status to resolved
- removed comment
Applied as hash 8c15ca1ed8101bb8aa9a072aa9a7ac54f8070874, 7d977402d5a81ac4941423715cde5bc383fb8b54 and 5930260426100d6a6c83aea5e80c6711e2970115 of CarpetIOASCII, CarpetIOScalar and CarpetIOHDF5. I added a piece of the commented out code in CarpetIOHDF5 (without comments) to check myGH->out_vars in OutputGH (same as done for the other methods).
Is the same code needed in CarpetIOBasic (screen output) as well?
-
- changed status to closed
- edited description
- Log in to comment