24#include <lal/LALInference.h>
25#include <lal/LALInferenceInit.h>
26#include <lal/LALInferenceReadData.h>
27#include <lal/LALInferenceCalibrationErrors.h>
28#include <lal/LALInferenceLikelihood.h>
29#include <lal/LALInferenceTemplate.h>
30#include <sys/resource.h>
33#define UNUSED __attribute__ ((unused))
39"lalinference_bench: Benchmark template and likelihood functions.\n\
41 --Niter : Number of calls to time (delfault 1000) \n\
42 --bench-template : Only benchmark template function\n\
43 --bench-likelihood : Only benchmark likelihood function\n\
44 (defaults to benchmarking both)\n\
45 Example (for 1.0-1.0 binary with seglen 8, srate 4096): \n\
46 $ ./lalinference_bench --psdlength 1000 --psdstart 1 --seglen 8 --srate 4096 --trigtime 0 --ifo H1 --H1-channel LALSimAdLIGO --H1-cache LALSimAdLIGO --dataseed 1324 --Niter 10000 --fix-chirpmass 1.218 --fix-q 1.0\n\n\n\
52 REAL8 utime = (
end.ru_utime.tv_sec -
start.ru_utime.tv_sec) + 1
e-6 * (
end.ru_utime.tv_usec -
start.ru_utime.tv_usec);
53 REAL8 stime = (
end.ru_stime.tv_sec -
start.ru_stime.tv_sec) + 1
e-6 * (
end.ru_stime.tv_usec -
start.ru_stime.tv_usec);
56 fprintf(
fp,
"USER Per iteration: %e s\n",utime / (
double) Niter);
59 fprintf(
fp,
"SYS Per iteration: %e s\n",stime / (
double) Niter);
72 struct rusage r_usage_start,r_usage_end;
80 fprintf(stdout,
"Benchmarking likelihood:\n");
81 getrusage(RUSAGE_SELF, &r_usage_start);
86 getrusage(RUSAGE_SELF, &r_usage_end);
96 struct rusage r_usage_start,r_usage_end;
97 fprintf(stdout,
"Benchmarking template:\n");
98 getrusage(RUSAGE_SELF, &r_usage_start);
103 getrusage(RUSAGE_SELF, &r_usage_end);
107int main(
int argc,
char *argv[]){
126 bench_T=1; bench_L=0;
130 bench_T=0; bench_L=1;
136 if(runState && !helpflag) {
152 printf(
"Template test will run with parameters:\n");
ProcessParamsTable * LALInferenceParseCommandLine(int argc, char *argv[])
void bench_likelihood(LALInferenceRunState *runState, UINT4 Niter)
int main(int argc, char *argv[])
void LALInferenceTemplateNoop(UNUSED LALInferenceModel *model)
void bench_template(LALInferenceRunState *runState, UINT4 Niter)
void fprintf_bench(FILE *fp, struct rusage start, struct rusage end, UINT4 Niter)
void LALInferenceApplyCalibrationErrors(LALInferenceIFOData *IFOdata, ProcessParamsTable *commandLine)
LALInferenceRunState * LALInferenceInitRunState(ProcessParamsTable *command_line)
void LALInferenceInitCBCThreads(LALInferenceRunState *run_state, INT4 nthreads)
void LALInferenceInjectInspiralSignal(LALInferenceIFOData *IFOdata, ProcessParamsTable *commandLine)
ProcessParamsTable * LALInferenceGetProcParamVal(ProcessParamsTable *procparams, const char *name)
Returns the element of the process params table with "name".
void(* LALInferenceTemplateFunction)(struct tagLALInferenceModel *model)
Type declaration for template function, which operates on a LALInferenceIFOData structure *data.
void LALInferencePrintVariables(LALInferenceVariables *var)
output contents of a 'LALInferenceVariables' structure * / / * (by now only prints names and types,...
void LALInferenceInitLikelihood(LALInferenceRunState *runState)
Initialisation function which reads runState->commaneLine and sets up the likelihood function accordi...
void LALInferenceTemplateNullFreqdomain(LALInferenceModel *model)
Returns a frequency-domain 'null' template (all zeroes, implying no signal present).
Structure to constain a model and its parameters.
LALSimInspiralWaveformCache * waveformCache
LALInferenceVariables * params
LALInferenceTemplateFunction templt
Domain of model.
Structure containing inference run state This includes pointers to the function types required to run...
ProcessParamsTable * commandLine
struct tagLALInferenceIFOData * data
Log sample, i.e.
LALInferenceThreadState * threads
LALInferenceLikelihoodFunction likelihood
MultiNest prior for the parameters.
LALInferenceModel * model
Cycle of proposals to call.
CHAR value[LIGOMETA_VALUE_MAX]