RooFit BatchMode for compiled code

Hi all,

We are currently using ROOT 6.24.02 with HisfFactory, and we just learned that BatchMode can speed up our fit in principle.

According to the README:

Now, RooFit comes with dedicated computation libraries, each compiled for a specific CPU architecture.

is that statement true for compiled programs too? Currently our fitted is compiled with the following flags:

COMPILER		:=	$(shell root-config --cxx)
CXXFLAGS		:=	$(shell root-config --cflags)
LINKFLAGS		:=	$(shell root-config --libs)
ADDCXXFLAGS		:=	-O2 -march=native -mtune=native -Iinclude
ADDLINKFLAGS	:=	-lRooFitCore -lRooFit -lRooStats -lHistFactory -llua -lyaml-cpp

$(BINPATH)/%.exe: %.cpp

We tried to enable the BatchMode with:

nllHF = (RooNLLVar*)(D0DDmodel->createNLL(*D0DDdata, Offset(kTRUE), BatchMode("cpu")))

but the fit is actually slower.

Is our usage of the BatchMode correct (the example uses pdf.fitTo, but we used it in createNLL)? Do we need to link to a specific RooFit library (e.g. RooFit_avx2) to make it work?

Hi @yipengsun thanks for your question!

In ROOT 6.24, the BatchMode was still experimental. It didn’t give the right result for most fits and was also not necessarily faster.

Have you tried ROOT 6.28? HistFactory got a major speedup there (if you also generate your workspace with that release, not only fitting), and with the BatchMode it should be again around 30 % faster. ROOT 6.28 is also the first release where the BatchMode gives the right result for all usecases known to the developers.

So please try 6.28, and if the BatchMode is not faster there it is considered a bug. Then you should open a GitHub issue and provide a reproducer to we can debug this problem.

Thank you very much!

I see. Will try with ROOT 6.28 and report back. Just want to confirm: our usage of the BatchMode is correct (e.g. there’s no need to supply separate/additional compilation flag) as long as we update to ROOT 6.28?

Yes, it’s correct! The BatchMode code is all in libraries that are already compiled, so it doesn’t matter which flags you use to compile you own code.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.