SparseLinearAlgebra/spbla

Document first invocation of API is slower

bencardoen opened this issue · 2 comments

In ref to review openjournals/joss-reviews#3743
(minor issue)
The first time I execute

import pyspbla as sp
b = sp.Matrix.empty(shape=(3, 4))

there's a 1-2 sec wait before results show up (which I guess is due to first call init), it can help document this (unless I overlooked this).

@bencardoen Hi, thank you for your feedback.

Is it really necessary to document such a behavior? since:

  • module import requires library initialization
  • it is a common practice to do a warm up before the execution or measurements
  • first invocation may require kernels compilations
  • on Cuda backend, if driver already cached native kernels from ptx assembly, first invocation is not necessary slow

So, what do you think?

Hi @EgorOrachyov,
You don't need to, it's a suggestion/minor comment only. I figured adding it to the docs can be of help to e.g. algorithm designers who want to use your API but are not versed in the background implementation.

I came across it when trying to build a singularity image, adding the import to the definition file ensures the image contains the prebuilt version, rather than having to add it to code that depends on the image.