Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: passing arguments to backends #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pablooliveira
Copy link
Member

@pablooliveira pablooliveira commented Aug 8, 2019

Verificarlo is preparing to move fully towards the interflop interface (verificarlo/verificarlo#93).

In this context we need a way to pass arguments and options to our backends. For example, the mca or random-rounding backends require options to configure the precision or rounding mode.

This is a proposal to pass arguments to the backends by adding two parameters to the interflop_init function with the following conventions,

/* interflop_init: called at initialization before using a backend.
 * It returns an interflop_backend_interface_t structure with callbacks
 * for each of the numerical instrument hooks.
 *
 * argc: number of arguments passed to the backend
 *
 * argv: arguments passed to the backend, argv[0] always contains the name of
 * the backend library. argv[] may be deallocated after the call to
 * interflop_init. To make it persistent, a backend must copy it.
 *
 * context: the backend is free to make this point to a backend-specific
 * context. The frontend will pass the context back as the last argument of the
 * above instrumentation hooks.
 * */

struct interflop_backend_interface_t interflop_init(int argc, char **argv,
                                                    void **context);

In this way, earch argument is free to parse argc, argv using well established libraries (such as argp.h). See example here in the ongoing verificarlo's interflop PR.

In this PR, I have only modified interflop.h to start the discussion. If this proposal is accepted, we should update the existing backends and the C++ interface before merging.

@pablooliveira
Copy link
Member Author

@Helios77760 please feel free to comment on this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant