Skip to content

Commit

Permalink
Updating standalone compilation to work in 10_2_X, and optionally wit…
Browse files Browse the repository at this point in the history
…h the ROOT master
  • Loading branch information
ajgilbert committed Jun 18, 2019
1 parent 728b59d commit c77e54c
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 18 deletions.
24 changes: 14 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@
#######################################################################

# Boost
BOOST = /cvmfs/cms.cern.ch/slc6_amd64_gcc491/external/boost/1.51.0-cms
VDT = /cvmfs/cms.cern.ch/slc6_amd64_gcc491/cms/vdt/v0.3.2-cms

BOOST = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/boost/1.63.0-gnimlf
VDT = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/cms/vdt/0.4.0-gnimlf
# PCRE = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/pcre/8.37-omkpbe2
GSL = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/gsl/2.2.1-omkpbe2
# LIBXML = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/libxml2/2.9.1-omkpbe2/include/libxml2
# XZ = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/xz/5.2.2-omkpbe2
# ZLIB = /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/zlib-x86_64/1.2.11-omkpbe2
# Compiler and flags -----------------------------------------------------------
CC = g++

CC = c++
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs --glibs)
ROOTINC = $(shell root-config --incdir)

CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -I$(BOOST)/include -I$(VDT)/include -g -fPIC
# CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -I$(BOOST)/include -I$(VDT)/include -I$(PCRE)/include -I$(GSL)/include -I$(LIBXML)/include/libxml2 -I$(XZ)/include -I$(ZLIB)/include -g -fPIC
CCFLAGS = -D STANDALONE $(ROOTCFLAGS) -I$(BOOST)/include -I$(VDT)/include -I$(GSL)/include -g -fPIC
# CMSSW CXXFLAGS plus -Wno-unused-local-typedefs (otherwise we get a flood of messages from BOOST) plus -Wno-unused-function
CCFLAGS += -O2 -pedantic -pthread -pipe -Wno-vla -Werror=overflow -Wstrict-overflow -std=c++0x -msse3 -ftree-vectorize -Wno-strict-overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -fipa-pta -felide-constructors -fmessage-length=0 -ftemplate-depth-300 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=maybe-uninitialized -Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=switch -fdiagnostics-show-option -DBOOST_DISABLE_ASSERTS -Wno-unused-local-typedefs -Wno-unused-function
LIBS = $(ROOTLIBS) -L$(BOOST)/lib -L$(VDT)/lib -l RooFit -lRooFitCore -l RooStats -l Minuit -l Foam -lHistFactory -lboost_filesystem -lboost_program_options -lboost_system -lvdt
CCFLAGS += -O2 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++1z -ftree-vectorize -Wstrict-overflow -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -msse3 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -DGNU_GCC -D_GNU_SOURCE -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE
LIBS = $(ROOTLIBS) -L$(BOOST)/lib -L$(VDT)/lib -L$(GSL)/lib -lgsl -l RooFit -lRooFitCore -l RooStats -l Minuit -lMathMore -l Foam -lHistFactory -lboost_filesystem -lboost_program_options -lboost_system -lvdt

# Library name -----------------------------------------------------------------
LIBNAME=HiggsAnalysisCombinedLimit
Expand All @@ -45,7 +49,7 @@ DICTNAME=$(LIBNAME)_xr
# Linker and flags -------------------------------------------------------------
LD = g++
ROOTLDFLAGS = $(shell root-config --ldflags)
LDFLAGS = $(ROOTLDFLAGS) -rdynamic -shared -Wl,-soname,$(SONAME) -fPIC
LDFLAGS = $(ROOTLDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,-E -Wl,-z,defs -fPIC

# Directory structure ----------------------------------------------------------
PARENT_DIR = $(shell pwd)/../../
Expand Down Expand Up @@ -122,7 +126,7 @@ ${LIB_DIR}/$(SONAME):$(addprefix $(OBJ_DIR)/,$(OBJS)) $(OBJ_DIR)/a/$(DICTNAME).o

exe: $(addprefix $(EXE_DIR)/,$(EXES))
# @echo "\n*** Compiling executables ..."
$(addprefix $(EXE_DIR)/,$(EXES)) : $(addprefix $(PROG_DIR)/,$(PROGS))
$(EXE_DIR)/% : $(PROG_DIR)/%.cpp lib
$(CC) $< -o $@ $(CCFLAGS) -L $(LIB_DIR) -l $(LIBNAME) -I $(INC_DIR) -I $(SRC_DIR) -I $(PARENT_DIR) $(BOOST_INC) $(LIBS)

compile_python:
Expand Down
15 changes: 7 additions & 8 deletions env_standalone.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
. /cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/gcc/5.3.0/etc/profile.d/init.sh
cd /cvmfs/cms.cern.ch/slc6_amd64_gcc530/lcg/root/6.06.00-cms/
. ./bin/thisroot.sh
cd -
. /cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/vdt/v0.3.2-giojec/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/boost/1.57.0-giojec/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/xz/5.2.1/etc/profile.d/init.sh
export LD_LIBRARY_PATH=/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/pcre/8.37/lib/:${LD_LIBRARY_PATH}
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/gcc/7.0.0-omkpbe2/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/lcg/root/6.12.07-gnimlf5/bin/thisroot.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/gsl/2.2.1-omkpbe2/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/tbb/2018_U1-omkpbe2/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/cms/vdt/0.4.0-gnimlf/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/boost/1.63.0-gnimlf/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/pcre/8.37-omkpbe2/etc/profile.d/init.sh
export PATH=${PATH}:${PWD}/exe:${PWD}/scripts
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/lib
export PYTHONPATH=${PYTHONPATH}:${PWD}/lib/python:${PWD}/lib
10 changes: 10 additions & 0 deletions env_standalone_root_master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/gcc/7.0.0-omkpbe2/etc/profile.d/init.sh
. /afs/cern.ch/work/a/agilbert/public/root_master/bin/thisroot.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/gsl/2.2.1-omkpbe2/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/tbb/2018_U1-omkpbe2/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/cms/vdt/0.4.0-gnimlf/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/boost/1.63.0-gnimlf/etc/profile.d/init.sh
. /cvmfs/cms.cern.ch/slc7_amd64_gcc700/external/pcre/8.37-omkpbe2/etc/profile.d/init.sh
export PATH=${PATH}:${PWD}/exe:${PWD}/scripts
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/lib
export PYTHONPATH=${PYTHONPATH}:${PWD}/lib/python:${PWD}/lib
4 changes: 4 additions & 0 deletions src/CachingNLL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ cacheutils::makeCachingPdf(RooAbsReal *pdf, const RooArgSet *obs) {
} else if (histNll && typeid(*pdf) == typeid(FastVerticalInterpHistPdf2)) {
return new CachingHistPdf2(pdf, obs);
} else if (gaussNll && typeid(*pdf) == typeid(RooGaussian)) {
if (runtimedef::get("DBG_GAUSS")) {
std::cout << "Creating CachingGaussPdf for " << pdf->GetName() << "\n";
pdf->Print("v");
}
return new CachingGaussPdf(pdf, obs);
} else if (cbNll && typeid(*pdf) == typeid(RooCBShape)) {
return new CachingCBPdf(pdf, obs);
Expand Down
3 changes: 3 additions & 0 deletions src/CascadeMinimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ bool CascadeMinimizer::improve(int verbose, bool cascade)
minimizer_->setEps(tol);
minimizer_->setStrategy(approxPreFitStrategy_);
improveOnce(verbose-1, true);
if (runtimedef::get("DBG_QUICKEXIT")) {
exit(0);
}
minimizer_->setEps(nominalTol);
minimizer_->setStrategy(strategy_);
} while (autoBounds_ && !autoBoundsOk(verbose-1));
Expand Down
6 changes: 6 additions & 0 deletions src/Combine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <TCanvas.h>
#include <TFile.h>
#include <TFileCacheRead.h>
#include <TGraphErrors.h>
#include <TIterator.h>
#include <TLine.h>
Expand Down Expand Up @@ -304,6 +305,11 @@ void Combine::run(TString hlfFile, const std::string &dataset, double &limit, do
garbageCollect.tfile = fIn; // request that we close this file when done

w = dynamic_cast<RooWorkspace *>(fIn->Get(workspaceName_.c_str()));

if (fIn->GetCacheRead()) {
fIn->GetCacheRead()->Close();
}

if (w == 0) {
std::cerr << "Could not find workspace '" << workspaceName_ << "' in file " << fileToLoad << std::endl; fIn->ls();
throw std::invalid_argument("Missing Workspace");
Expand Down

0 comments on commit c77e54c

Please sign in to comment.