To differentiate through CLASS and make it compatible with Enzyme, should one perhaps look to modify it so there is a pure C function that one can ccall from Julia (like here) to return the desired output as a function of some given input parameters? Maybe something like this:
void output_from_input(double *output, double *input) {
// populate output from input
}
If so, that would require circumventing the standard interface with *.ini input configuration files and *.dat output data files.
I think it would be very interesting to try to start with something trivial, say just computing \Omega_{c0}(\omega_{c0}) = \omega_{c0}/h^2 as a function of \omega_{c0} (and some fixed h). Then, if that works, one could try to include more parameters and ramp up autodiff module-by-module (background, thermodynamics, perturbations, …) and ultimately get the C_l for the CMB as a function of some parameters or something similar.