ENDFtk icon indicating copy to clipboard operation
ENDFtk copied to clipboard

Performance of fission yield data access

Open ojschumann opened this issue 4 months ago • 13 comments

Dear all,

while using the ENDFtk lib, I stumbled across a performance issue, when assessing fission yield data. That is about a factor of 9 slower than e.g. accessing a cross section data. Is there a better access pattern that what I did or is this an issue with ENDFtk?

What I did

I used the TENDL2017 and GEFY 6.1 Fission Yield data from the Fispact website. I accessed these ENDF files with ENDFtk through python. My IPython session looks like the following:

file = ENDFtk.tree.Tape.from_file("/opt/test/nuclear_data/GEFY61data/gefy61_nfy/Pu239") # load yields for Pu-239
mat = file.materials.front().parse() # parse  the first and only material
y = mat.file(8).section(454) # get prompt fission yields
def loadYield(y):
  Y=zeros((77, 1358, 2)) # I know already the size of the table
  for n,yd in enumerate(y.yields): # iterate over all energy dependent yields
    Y[n] = array(yd.fission_yields) # use an numpy array to collect the data from ENDFtk. Is here a better way?
  return Y
%timeit loadYield(y)
#3.92 s ± 5.84 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

This is "only" 415 kbyte/s transfer rate. On the other hand, when I load a cross section:

file = ENDFtk.tree.Tape.from_file("/opt/test/nuclear_data/TENDL2017data/tal2017-n/gxs-709/Pu229g.asc")
pu239 = file.materials.front().file(3).parse().section(18)
%timeit xs = array(pu239.cross_sections)
#1.48 ms ± 728 ns per loop (mean ± std. dev. of 7 runs, 1000 loops each)

I get about 3,8 Mbytes/s.

Any idea why yield data access is that slow? From my experience it is possible to transfer large amount of data from the C++ side to python in µs, when one can prevent a copy. And even with a copy, the nearly 4 seconds for some yield data is quite long..

ojschumann avatar Oct 17 '24 11:10 ojschumann