Open marco-palmiotto opened 1 month ago
@marco-palmiotto Good idea! It was declared inline for simplicity, but indeed we can change it if it causes performance issues.
The code generating libraries is in csl
and can be modified quite easily, it is mostly files starting with the library
prefix responsible of outputing all the library and converting csl::Expr
into executable C code.
I can pin-point the exact function generating the function map: https://github.com/docbrown1955/marty-public/blob/4d5697473526149debe830648590b8de29ed59fe/src/csl/librarygroup.cpp#L334
The simplest solution is probably to add a is_header
parameter in the LibraryGroup::printFunctionStack()
method, which will make it print the declaration or definition (reusing the existing code). The method is called from here:
https://github.com/docbrown1955/marty-public/blob/4d5697473526149debe830648590b8de29ed59fe/src/csl/librarygenerator.cpp#L930
It seems straigth-forward to add a boolean parameter in the existing call of LibraryGroup::printFunctionStack()
and add another call in the source file generation a few lines below.
Don't hesitate if you have any question :)
To be just a bit more specific, in LibraryGenerator::printGroup()
:
file header(path + "/" + incDir + "/" + nameHeader);
...
g.printFunctionStack(header, 0, true);
...
file source(path + "/" + srcDir + "/" + nameSource);
...
g.printFunctionStack(source, 0, false);
...
A few details:
MARTY
should cover more than enough the libary generation such that if the pipeline is passing it means the change does not break MARTY ;)
Hi, I noticed that, on large numerical libraries (such as the one I use for the MSSM), compilation is really long and resource-intensive in every file which has
group_g.h
included. I found out that it contains the definition of a variable which maps strings to functions (or something alike). Therefore, in libraries with lots of functions, this variable, defined inline, causes the slow-down of compilation. I adapted the file by hand in my project, defining the variable as external:with the definition of
f_G
copied ingroup_g.cpp
.It would be nice to have this as the default setup, to help compilation time of each project :) I can do it myself if I know which file to edit :P