Gridap.jl icon indicating copy to clipboard operation
Gridap.jl copied to clipboard

Gridap Warm-up file (for PackageCompiler)

Open amartinhuertas opened this issue 3 years ago • 0 comments

Hi @amartinhuertas !

I have been thinking about this and I have some comments

  1. The approach seems a bit complicated to me. In particular, with the clones of Gridap, Gridap Tutorials. It feels like we are trying to re-implement something that the package manager already provides.
  2. Wrapping calls to PackageCompiler is a bit rigid and one needs to learn the API of the wrapper. I would prefer to use PackageCompiler directly. It is a well documented package and once the user knows how to use it, it can be useful for other Julia projects, not just Gridap.
  3. This approach is vulnerable to code invalidation. When the user imports packages that were not present at this point, some code generated in the image can be invalidated.

In summary:

In Gridap, I would only provide a path to a "warm-up file", or some function returning a path in function of some arguments if we want some customization. Then, the user can use this warm-up file to call PackageCompiler in the way she/he needs for the case at hand.

Some tentative user code


using PackageCompiler
using Gridap
# load other packages that the user wants to use to avoid code invalidations
using Plots
using DrWatson
using GridapEmbedded

# Recover the warmup file for the Gridap version installed
# (package manager will handle the installation of Gridap)
warmup_gridap = Gridap.warmup_file

# Here one has the oportunity to compile more things
pkgs = [:Gridap,:OtherPackage1,...]
warmups= [warmup_gridap, other_warmup, ....]

 PackageCompiler.create_sysimage(
pkgs,
sysimage_path="whatever.so",
precompile_execution_file=warmups)

amartinhuertas avatar Jul 17 '21 02:07 amartinhuertas