diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,626 +1,630 @@ +2020-10-28 Andy Buckley + + * Release 2.3.3 + 2020-10-18 Andy Buckley * Fix YODA call-parentheses for v1.8 onwards. 2019-09-06 Andy Buckley * Release 2.3.2 2019-07-20 Andy Buckley * Fix prof2-tune arguments and write out a params summary file that can be used with prof2-predict. 2019-05-08 Andy Buckley * Apply patches to prof2-I, from Christine Rasmussen. 2019-06-13 Holger Schulz * Release 2.3.1 2019-02-04 Holger Schulz * added reading data from hdf5 2018-10-02 Holger Schulz * Release 2.3.0, probably the last C++ release. 2018-02-07 Andy Buckley * Add numCoeffs, numParams, and exprString methods to Ipol. 2017-10-25 Holger Schulz * Bugfix missing import statement 2017-12-29 Holger Schulz * Exposed more C++ functions to python for Pade approximation testing 2017-11-10 Holger Schulz * Release 2.2.2 --- this is the result of many months of fiddling with especially multinest requirements. * Sampling --- sobol, latin hypercube and random uniform sampler --- something like PARAM 0 1 2 3 result in sub space sampling --- biases now work e.g. PARAM 0 1 exp(x) * Ipol --- --order auto and friends automatically determine best order, this avoids oversampling. --- --logy parmeterises the logy of things, useful for large paramspace and especially likelihood --- --medianfilt can drop anchor points based on error this is experimental and meant to deal with the occasional huge NLO weight --- The output has the valid region for each object now stored at the end of the coefficients, this is also where they are read from --- this allows the usage of --medianfilt etc * Tune --- Replace the grid sampling with the already existing sampler machinery, so can use random, latin, sobol when using --scan to find good start point for minuit --- --profiles and --contours stores the minuit and minos plots --- limits are by default now set to the ipol region, this can be overridden when using -x CL arg --- tune script can read more than one ipol file A lot of stuff has been put into libraries to allow reusing individual steps. * Multinest --- this is now supported in prof2-tune-nest * GP --- gp_minimize via prof2-tune-gp * emcee --- MCMC sampling via prof2-emcee * Eigentunes --- prof2-eigentunes is back and working, deltaChi2 must be provided, however, via --target * Bootstrapping in principle working but smearing is probably more complicated than what we have now prof2-bootstrap 2017-08-22 Holger Schulz * Improvements to Ipol --- we allow different orders for each bin now, there is also --order auto which does some jackknifing to figure out the best suited polynomial order to avoid overfitting. The Ipol outputformat is now binned 3 which dumps the minparam values and maxparamvalues at the end of the coefficient string. This is necessary as we now also allow to filter the inputs by median error (necessary to tame NLO spiky histograms). The ranges are read back for each bin separately now, happens in the C++ part. * Overhaul of sampling, including things such as full support of sobol sampling. Also, param range files with more than two numbers on a line are interpreted as sub spaces for patch sampling. * Add script prof2-ipolenvelopes which for each bin finds the minimum and maximum polynomial value (using migrad) in the range of the ipols validity. This is nice especially to check envelopes once filtering in the ipol step was done 2017-05-18 Holger Schulz * Refitting of ipols using smeared ipol output. Required some modification in data io structure. 2017-05-04 Holger Schulz * Fix in prof2-tune when checking analysis names, at the same time allow for for closure test tuning, i.e. tune against input folder. 2017-05-02 Holger Schulz * Use -march=native according to eigen3 faq for better performance as well as -O3 in pyext * Replace modulus based status message by simple counter in ipol stage * Set version to 2.2.2beta for imminent release 2017-04-28 Holger Schulz * Use BDSSVD in case Eigen >=3.3.3 * Reworked prof2-ipol and ipol.py to use mk_ipolbin rather than mk_ipolhisto, some speedups plus additional benefit of being able to fiddle with inividual bins in the ipol building stage * add --minos switch to prof2-tune toi run MINOS * Write GOF and NDOF into result file 2017-02-21 Andy Buckley * Change prof2-ipol ierr mode default to 'symm' 2017-02-17 Andy Buckley * Add a --limit-errs argument for prof2-tune, to avoid annoying re-reading of large run dirs * Tweaks to default error ipol order, and release figure handles in envelope plotting. 2017-02-02 Holger Schulz * Update Copyright string * Instead of exiting when prof2-ipol encounters nan coefficients in value or error ipols, spit out a warning and ignore that histogram entirely --- this makes prof2-ipol and friends much more robust * tag as 2.2.1 and release. 2017-02-01 Holger Schulz * Use Agg as default matplotlib backend. * Bump version to 2.2.1 2016-12-19 Holger Schulz * Even more robust prof-tune, added --filter CL option to automatically get rid of zero error bins * Fixed a bug where IpolBin.n was never set which is needed for the PointMatcher (i.e. weights syntax) * Not using YODA Pointmatcher but own due to different regexes required. * Make release 2.2 2016-12-15 Holger Schulz * More robust scripts and more meaningful error messages, especially prof2-tune 2016-11-30 Holger Schulz * Replace Counter code when running mk_Structure with much faster code * Bump version to 2.2 * Bump DataFormat to binned 2 * Allow passing file names or open files (or similar streams) to ipolio functions * prof2-ipol can read yaml now * Add some of Elliot's code for choosing sub spaces in prof2-ipol and some plot routines to contrib * Add SOBOL sampling to contrib 2016-08-26 Holger Schulz * Use more readable Cython DL path in bootstrap 2016-07-18 Andy Buckley * Typo fixes -- thanks to Leif Gellersen. 2016-07-14 Andy Buckley * Release version 2.1.4 * Improve Makefile tests for ROOT and Cython versions. 2016-07-11 Andy Buckley * Add Ipol min/max param vals getters and map them into Python. * Add a built-in /REF-stripping option to data histo loading. * Improvements to the Python ipol metadata interface. 2016-07-05 Andy Buckley * Try to optimise long-vector building by not executing pow() if the exponent would be zero. * Split C++ calcValue function into two, to allow re-use of a precalculated long-vector. 2016-06-23 Andy Buckley * Split 'dot product' part of ipol value calculation into a standalone calcValue function. * Use const references when passing const vectors in C++ API. 2016-04-14 Holger Schulz * Introduce 1D sensitivity based on gradient * User needs to specify --cmap or --grad when running prof2-sens now 2016-04-01 Holger Schulz * Add a first version of the parametrisation using Machine Learning 2016-02-16 Holger Schulz * Bump to version 2.1.3 2016-02-15 Holger Schulz * prof2-sens: bugfix, add weight file usage, clean up CL * prof2-I: add weight file usage * prof2-predict: add weight file usage, fix output writing * Extended documentation 2016-02-12 Holger Schulz * Documentation including asciinema 2016-02-11 Holger Schulz * Remove min_runs function, replace with numCoeffs from C++ code * Add prof2-envelopes script * In prof-tune simplechi2 --- continue on weight==0 to allow some robustness when switching off bins 2016-02-10 Holger Schulz * First version of prof2-runcombs plus sampling functions salvaged from Prof1, modified to have no scipy dependence * Add --rc switch to prof2-ipol to optionally read runcombs Syntax is --rc runcoms.dat[colon]5 (Minimally invasive addon) * Code cull in prof2-ipol. Only support multiprocessing version, default 1 thread. Changed CL switch to '-j'. 2015-12-16 Holger Schulz * Only calculate polynomials structure once per instance -> significant speed increase * Add the brute force grid scan (--scan) to prof2-tune 2015-12-11 Holger Schulz * Minimiser tweaks --- no more need for param translation, make strategy steerable (--strategy or -s), -q suppresses iminuit output now, calculation and writing of correlation matrix into results, dump weights into results file 2015-12-10 Holger Schulz * Undo ui madness * Remove numpy dependence (except sampling.py) * Add prof-sens for sensitivity plotting exploting derivatives 2015-12-09 Holger Schulz * Can specify PREFIX when calling make 2015-12-09 Andy Buckley * Improve prof2-predict UI. * Add metadata printing in prof2-lsipol debug mode. * Add -v and -q flag shortcuts to all scripts. 2015-12-07 Holger Schulz * Use __all__ in __init__.py * Started sphinx documentation * Support only iminuit, bump version to 2.2.alpha, restructure imports * Sanity checks when calling parametrisation 2015-12-03 Andy Buckley * Provide a version() function in the C++ library, and map it into Python. Both sources use the VERSION variable defined in the Makefile at build time. * Reduce SVD fitting threshold to 1e-20. 2015-12-03 Holger Schulz * Make derivative calculation work also when scaling params * Let YODA write YODA 2015-12-02 Holger Schulz * Derivative calculation 2015-11-28 Andy Buckley * Version 2.1.2 * Revert range shift in Ipol.cc, since it produced (small) numerical errors rather than improved stability. To be understood... * Add test/mkpolydata script, for generating polynomial pseudodata used in closure tests. 2015-11-27 Andy Buckley * Fix bug in histo loading. * Adding log binning and other options to prof2-residuals. 2015-11-24 Andy Buckley * Version 2.1.1 release. * Fix prof2-predict YODA writing, and improve DataHisto.toYODA. * Change parameter rescaling from using the [0,1] range to instead use [1,2], to avoid arbitrarily scaled param numbers. BREAKS IPOL FILE COMPATIBILITY WITH 2.1.0!! * Set minimizer initial step size = prange/10. * Add automatic determination of maximum MC errors in prof-tune, and use them to regularize interpolated errs which could distort the fit. * Separate internal Minuit function names (with syntax restrictions) from the free-form external param names. 2015-11-23 Andy Buckley * Add pyext/professor2/chi2.py * Add find_maxerrs() to the Python interface, for use in error regularisation. * Use the param file name as a regex. * Use __slots__ in the internal histogram and bin types, for better memory efficiency. * Fix (re-fix?) use of inappropriate indices in calculation of mean and median MC uncertainties. * More proactive data object deletion after conversion to YODA data format. 2015-11-22 Andy Buckley * Version 2.1.0 (significant version change due to scaling, all-orders, and ROOT support) 2015-11-18 Andy Buckley * dataio.py: Add ROOT file reading ability. * Change rescaling I/O behaviour a bit, moving some hacked Python-only Ipol string constructors into explicit API improvements, and only activating rescaling if DoParamScaling is set true. 2015-11-16 Andy Buckley * Add CPPFLAGS steering in Makefile and API tidying. 2015-11-11 Holger Schulz * Add automatic raw param value -> unit range mapping to Ipol. * Add any-order long vector calculation. 2015-11-10 Andy Buckley * Add prof2-lsipol as a handy way to make a tuning weights file and for general convenience. 2015-10-06 Andy Buckley * Version 2.0.0 * Add 'make dist' target to Makefile, and tweak/reduce Cython necessity * Allow calls to IpolBin and IpolHisto methods with params passed as unpacked *args as well as a packed iterable. * Add possibility to pass params as an dict-like as well as a list or tuple of floats -- note that the dict-like must return *ordered* values consistent with the Ipol training. Also ensure the float type. * Add conversion of C++ exceptions to Python exceptions. * Add professor2.utils module, providing an opportunistic use of OrderedDict for params so the params order required by Ipol is the same as the order in which they are specified in the (first run's) params.dat file. * Change Python-mapped Ipol methods with no args to be properties. * Add nice __repr__ methods for Histo and Bin objects. * Specialise Histo as IpolHisto and DataHisto, and provide toData{Histo,Bin} on IpolHisto and IpolBin respectively. * Remove ProfMaster. 2015-10-04 Andy Buckley * Add protection of svd.setThreshold call to ensure it is supported/needed, via Eigen version number macros. * Add vmin and vmax args to Ipol and IpolBin in Python. 2015-10-02 Andy Buckley * Put histo file reading in a try..except block so read failures on non-histo files in the run dirs are not fatal. * Add protection in the histo loader, so we don't trip up on Rivet's new cross-section and counter objects. 2015-09-30 Andy Buckley * src/Ipol.h: Use Eigen/SVD include path rather than non-standard eigen3/Eigen/SVD. 2015-09-14 Holger Schulz * Use Eigen's svd.setThreshold(1e-20) to prevent the errors we saw with Eigen 3.2.2 and later when looking at 5th order polynomials in 3 dimensinos with 900+ anchors * Some clean up 2015-09-11 Andy Buckley * Adding prof2-residuals script for ipol faithfulness testing. * Rename scripts from prof-* to prof2-* to allow parallel installations of Prof1 and Prof2. * Move some non-core scripts from bin to contrib. * Make root-config dependency optional * Lots of reworking to make prof-tune work again, and to use weight file parsing. 2015-09-10 Andy Buckley * Use weight file path parsing in prof-ipol. * Add prof.weights submodule, with a copy of PointMatcher and a new read_pointmatchers function for handling weight files. * Provide __version__attribute in the Python module. * User script CLI consistency, simplification, general smoothing... 2015-08-30 Andy Buckley * Add recursive scangrid generator function, and other tweaks. 2015-08-18 Andy Buckley * Tweaks to ipol file parsing functions. * Fix a bug in IpolBin's use of interpolated errors. * Convert mean and median error parameterisation to use new 0th order ipols. 2015-08-15 Holger Schulz * A first version of catching singular matrices in the SVD * Ipol has 1 additional argument, "threshold", that determines what singular values are considered 0, fully propagated to pyext * Going 2 Pro 2 Fessional * Some startup checks of prof- scripts * remove bin/prof-sampling, rename prof-prediction -> prof-predict 2015-08-13 Holger Schulz * Reverted unintended commit of hack. * Added very basic prof-config script to bin * Update PATH when sourcing setup.sh 2015-08-12 Holger Schulz * Added prof-prediction which reads in a ifile and a point in parameter space (either a text file, a comma separated list or just the args) and writes out an ipolhisto. Tested to work. 2015-08-03 Holger Schulz * Added 0-order polynomials, i.e. constant values. Currently, the coefficent is simply the value of the first anochorpoint. 2015-07-15 Holger Schulz * Some pull plotting functionality 2015-07-08 Holger Schulz * Calculate and print G.o.f. * Write some meta info to results * Read limits, fixed params from single textfile --limits * Output files steered by --output * Remove now obsolete bin/prof-interpolate 2015-07-08 Holger Schulz * First working version of prof-tune (pyminuit, simpleGOF) * Multiprocessing to speed up prof-ipol (--multi) * prof-ipol-tabulated to write out interpolation of tabulated data * Minor bugfixes 2015-06-16 Andy Buckley * Adding mean and median strategies for assigning constant ipol bin errors. 2015-06-03 Andy Buckley * Adding a Bin base class in the Python side, and a coherent handling of multiple (interpolated) bin errors. * Various tweaks and minor fixes. 2015-05-10 Andy Buckley * Add 'Minuit' class importing to the __init__.py file. 2015-05-05 Andy Buckley * Rewrite C++ ipolstring parsing using STL string functions rather than Boost: shorter! Boost dependency GONE :-) * Replace boost::tuple with std::pair and clean up ParamPoints interface a bit. * Add a --veto option to prof-sample, for a user-specified vetoing function. * Move Sampler from prof-sample into professor2/__init__.py 2015-05-04 Andy Buckley * Adding a first version of prof-tune with ipol reading from file. * Adding options for (average) error interpolation and ipol persistency to prof-ipol and module functions. 2015-05-03 Andy Buckley * Add bin/prof-ipol simple script using the functions below -- to be merged with prof-interpolate. * professor2/__init__.py: Add Histo, DataBin, IpolBin and basic data handling functions. * Remove unnecessary dlopen fiddling from professor2/__init__.py 2015-04-23 Andy Buckley * Remove bound ParamPoints pointer from Ipol, and ditch lazy coeff evaluation in favour of simplicity and construct-time coeff calculating. * Move long vector and coeff building into unbound functions rather than Ipol methods. * Start of ChangeLog. Library has already iterated quite a bit. * FILL IN EARLY HISTORY FROM HG LOG diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,185 +1,185 @@ ## Makefile for Professor 2.x -VERSION := 2.3.1 +VERSION := 2.3.3 DISTNAME := Professor-$(VERSION) $(info Building Professor $(VERSION)) ## Default values for user-specifiable build variables SHELL := /bin/bash ifndef PREFIX PREFIX := /usr/local endif CXXSTD := c++11 ifndef CXX CXX := g++ endif ifndef CPPFLAGS CPPFLAGS := -I/usr/include/eigen3 endif ifndef CXXFLAGS CXXFLAGS := -O3 -march=native ifdef DEBUG ifneq ($(DEBUG),0) CXXFLAGS += -g endif endif endif ifndef PYTHON PYTHON := python endif ifndef CYTHON CYTHON := cython endif ifndef ROOTCONFIG ROOTCONFIG := root-config endif ## Check for compatible dependencies ROOT_VERSION := $(shell $(ROOTCONFIG) --version 2> /dev/null) ifeq "$(ROOT_VERSION)" "" ROOT_VERSION := 0 else HAVE_ROOT := $(ROOT_VERSION) endif ifdef HAVE_ROOT $(info ROOT $(ROOT_VERSION) is available... providing 'root' make target) else $(info ROOT is not available... not making any ROOT integration) endif #CYTHON_VERSION := $(shell $(CYTHON) --version 1> /dev/null) CYTHON_VERSION := $(shell $(CYTHON) --version < /dev/null 2>&1 | grep -i 'Cython version' | cut -d\ -f3) ifeq "$(CYTHON_VERSION)" "" CYTHON_VERSION := NONE CYTHON_VERSION1 := 0 CYTHON_VERSION2 := 0 else CYTHON_VERSION := $(shell echo $(CYTHON_VERSION) | sed -e 's/\([0-9\.]\+\)[ab].*/\1/') CYTHON_VERSION1 := $(shell echo $(CYTHON_VERSION) | cut -d. -f1) CYTHON_VERSION2 := $(shell echo $(CYTHON_VERSION) | cut -d. -f2) HAVE_GOOD_CYTHON := $(shell test "$(CYTHON_VERSION1)" -eq 0 -a "$(CYTHON_VERSION2)" -ge 20 && echo 1 || echo 0) endif ifdef HAVE_GOOD_CYTHON $(info Cython $(CYTHON_VERSION) found... will rebuild C++/Python interface) else $(info Incompatible Cython $(CYTHON_VERSION) found... will build C++/Python interface from bundled C file) endif ## Build-file variables LIBHEADERS := $(wildcard include/Professor/*.h) LIBSOURCES := $(wildcard src/*.cc) LIBOBJECTS := $(patsubst %,obj/%.o, ParamPoints Ipol Version) TESTSOURCES := $(wildcard test/*.cc test/testPython*) TESTPROGS := test/testParamPoints test/testIpol BINPROGS := $(wildcard bin/*) CONTRIBPROGS := $(wildcard contrib/*) JUPYTERNBS := $(wildcard jupyter/*) PYTHONSOURCES := $(wildcard pyext/professor2/*.py) CYTHONSOURCES := $(wildcard pyext/professor2/*.pxd) $(wildcard pyext/professor2/*.pyx) ## Make targets .PHONY := all lib pyext tests cxxtests pytests check icheck clean root dist all: lib pyext tests @true lib: lib/libProfessor2.so @true lib/libProfessor2.so: $(LIBOBJECTS) mkdir -p lib $(CXX) -shared -o $@ $(LIBOBJECTS) obj/%.o: src/%.cc $(LIBHEADERS) mkdir -p obj $(CXX) -std=$(CXXSTD) -DPROF_VERSION="$(VERSION)" -Iinclude $(CPPFLAGS) $(CXXFLAGS) -c -fPIC $< -o $@ pyext: pyext/professor2/core.so $(wildcard pyext/professor2/*.py) $(PYTHON) pyext/setup.py install --prefix=. ifdef HAVE_GOOD_CYTHON pyext/professor2/core.cpp: $(LIBHEADERS) $(CYTHONSOURCES) lib $(CYTHON) pyext/professor2/core.pyx --cplus else pyext/professor2/core.cpp: $(LIBHEADERS) $(CYTHONSOURCES) lib $(info "Cython >= 0.20 not available; can't build $@") endif pyext/professor2/core.so: pyext/professor2/core.cpp PROF_VERSION=$(VERSION) $(PYTHON) pyext/setup.py build_ext -i --force tests: cxxtests pytests @true cxxtests: $(TESTPROGS) @true test/%: test/%.cc $(LIBHEADERS) lib $(CXX) -std=$(CXXSTD) -Iinclude $(CPPFLAGS) $(CXXFLAGS) $< -Llib -lProfessor2 -o $@ ifdef HAVE_ROOT root: src/testRoot.cc $(LIBHEADERS) lib $(CXX) -std=$(CXXSTD) $(CPPFLAGS) $(CXXFLAGS) $< -Iinclude `root-config --cflags --libs` -Llib -lProfessor2 -o test/test$@ endif pytests: pyext @true check: tests @echo @echo "testParamPoints" && test/testParamPoints && echo "\n\n" @echo "testIpol" && test/testIpol && echo "\n\n" icheck: tests test/testPython test/testPython1D test/testPython2D install: all mkdir -p $(PREFIX)/bin && cp bin/* $(PREFIX)/bin/ mkdir -p $(PREFIX)/contrib && cp contrib/* $(PREFIX)/contrib/ mkdir -p $(PREFIX)/jupyter && cp jupyter/* $(PREFIX)/jupyter/ mkdir -p $(PREFIX)/include && cp -r include/Professor $(PREFIX)/include/ test -d lib && mkdir -p $(PREFIX)/lib && cp -r lib/* $(PREFIX)/lib/ || true test -d lib64 && mkdir -p $(PREFIX)/lib64 && cp -r lib64/* $(PREFIX)/lib64/ || true # cp setup.sh $(PREFIX) dist: all rm -rf $(DISTNAME) mkdir -p $(DISTNAME) cp --parents \ - README Makefile \ + README Makefile Makefile.mac \ $(LIBHEADERS) \ $(LIBSOURCES) \ $(BINPROGS) \ $(CONTRIBPROGS) \ $(JUPYTERNBS) \ $(TESTSOURCES) \ $(PYTHONSOURCES) pyext/setup.py pyext/professor2/misc/*py pyext/professor2/ml/*py\ $(CYTHONSOURCES) $(wildcard pyext/professor2/*.cpp) \ $(DISTNAME)/ tar czf $(DISTNAME).tar.gz $(DISTNAME) clean: rm -rf obj/*.o lib/* rm -f pyext/professor2/core.cpp pyext/professor2/core.so rm -f $(TESTPROGS) rm -rf $(DISTNAME) $(DISTNAME).tar.gz diff --git a/Makefile.mac b/Makefile.mac --- a/Makefile.mac +++ b/Makefile.mac @@ -1,185 +1,185 @@ ## Makefile for Professor 2.x -VERSION := 2.2.2beta12 +VERSION := 2.3.3 DISTNAME := Professor-$(VERSION) $(info Building Professor $(VERSION)) ## Default values for user-specifiable build variables SHELL := /bin/bash ifndef PREFIX PREFIX := /usr/local endif CXXSTD := c++11 ifndef CXX CXX := g++ endif ifndef CPPFLAGS CPPFLAGS := -I/usr/include/eigen3 endif ifndef CXXFLAGS CXXFLAGS := -O3 -march=native ifdef DEBUG ifneq ($(DEBUG),0) CXXFLAGS += -g endif endif endif ifndef PYTHON PYTHON := python endif ifndef CYTHON CYTHON := cython endif ifndef ROOTCONFIG ROOTCONFIG := root-config endif ## Check for compatible dependencies ROOT_VERSION := $(shell $(ROOTCONFIG) --version 2> /dev/null) ifeq "$(ROOT_VERSION)" "" ROOT_VERSION := 0 else HAVE_ROOT := $(ROOT_VERSION) endif ifdef HAVE_ROOT $(info ROOT $(ROOT_VERSION) is available... providing 'root' make target) else $(info ROOT is not available... not making any ROOT integration) endif #CYTHON_VERSION := $(shell $(CYTHON) --version 1> /dev/null) CYTHON_VERSION := $(shell $(CYTHON) --version < /dev/null 2>&1 | grep -i 'Cython version' | cut -d\ -f3) ifeq "$(CYTHON_VERSION)" "" CYTHON_VERSION := NONE CYTHON_VERSION1 := 0 CYTHON_VERSION2 := 0 else CYTHON_VERSION := $(shell echo $(CYTHON_VERSION) | sed -e 's/\([0-9\.]\+\)[ab].*/\1/') CYTHON_VERSION1 := $(shell echo $(CYTHON_VERSION) | cut -d. -f1) CYTHON_VERSION2 := $(shell echo $(CYTHON_VERSION) | cut -d. -f2) HAVE_GOOD_CYTHON := $(shell test "$(CYTHON_VERSION1)" -eq 0 -a "$(CYTHON_VERSION2)" -ge 20 && echo 1 || echo 0) endif ifdef HAVE_GOOD_CYTHON $(info Cython $(CYTHON_VERSION) found... will rebuild C++/Python interface) else $(info Incompatible Cython $(CYTHON_VERSION) found... will build C++/Python interface from bundled C file) endif ## Build-file variables LIBHEADERS := $(wildcard include/Professor/*.h) LIBSOURCES := $(wildcard src/*.cc) LIBOBJECTS := $(patsubst %,obj/%.o, ParamPoints Ipol Version) TESTSOURCES := $(wildcard test/*.cc test/testPython*) TESTPROGS := test/testParamPoints test/testIpol BINPROGS := $(wildcard bin/*) CONTRIBPROGS := $(wildcard contrib/*) JUPYTERNBS := $(wildcard jupyter/*) PYTHONSOURCES := $(wildcard pyext/professor2/*.py) CYTHONSOURCES := $(wildcard pyext/professor2/*.pxd) $(wildcard pyext/professor2/*.pyx) ## Make targets .PHONY := all lib pyext tests cxxtests pytests check icheck clean root dist all: lib pyext tests @true lib: lib/libProfessor2.so @true lib/libProfessor2.so: $(LIBOBJECTS) mkdir -p lib $(CXX) -shared -Wl,-soname,libProfessor2.so -o $@ $(LIBOBJECTS) obj/%.o: src/%.cc $(LIBHEADERS) mkdir -p obj $(CXX) -std=$(CXXSTD) -DPROF_VERSION="$(VERSION)" -Iinclude $(CPPFLAGS) $(CXXFLAGS) -c -fPIC $< -o $@ pyext: pyext/professor2/core.so $(wildcard pyext/professor2/*.py) $(PYTHON) pyext/setup.py install --prefix=. ifdef HAVE_GOOD_CYTHON pyext/professor2/core.cpp: $(LIBHEADERS) $(CYTHONSOURCES) lib $(CYTHON) pyext/professor2/core.pyx --cplus else pyext/professor2/core.cpp: $(LIBHEADERS) $(CYTHONSOURCES) lib $(info "Cython >= 0.20 not available; can't build $@") endif pyext/professor2/core.so: pyext/professor2/core.cpp PROF_VERSION=$(VERSION) $(PYTHON) pyext/setup.py build_ext -i --force tests: cxxtests pytests @true cxxtests: $(TESTPROGS) @true test/%: test/%.cc $(LIBHEADERS) lib $(CXX) -std=$(CXXSTD) -Iinclude $(CPPFLAGS) $(CXXFLAGS) $< -Llib -lProfessor2 -o $@ ifdef HAVE_ROOT root: src/testRoot.cc $(LIBHEADERS) lib $(CXX) -std=$(CXXSTD) $(CPPFLAGS) $(CXXFLAGS) $< -Iinclude `root-config --cflags --libs` -Llib -lProfessor2 -o test/test$@ endif pytests: pyext @true check: tests @echo @echo "testParamPoints" && test/testParamPoints && echo "\n\n" @echo "testIpol" && test/testIpol && echo "\n\n" icheck: tests test/testPython test/testPython1D test/testPython2D install: all mkdir -p $(PREFIX)/bin && cp bin/* $(PREFIX)/bin/ mkdir -p $(PREFIX)/contrib && cp contrib/* $(PREFIX)/contrib/ mkdir -p $(PREFIX)/jupyter && cp jupyter/* $(PREFIX)/jupyter/ mkdir -p $(PREFIX)/include && cp -r include/Professor $(PREFIX)/include/ test -d lib && mkdir -p $(PREFIX)/lib && cp -r lib/* $(PREFIX)/lib/ || true test -d lib64 && mkdir -p $(PREFIX)/lib64 && cp -r lib64/* $(PREFIX)/lib64/ || true # cp setup.sh $(PREFIX) dist: all rm -rf $(DISTNAME) mkdir -p $(DISTNAME) cp --parents \ README Makefile \ $(LIBHEADERS) \ $(LIBSOURCES) \ $(BINPROGS) \ $(CONTRIBPROGS) \ $(JUPYTERNBS) \ $(TESTSOURCES) \ $(PYTHONSOURCES) pyext/setup.py pyext/professor2/misc/*py pyext/professor2/ml/*py\ $(CYTHONSOURCES) $(wildcard pyext/professor2/*.cpp) \ $(DISTNAME)/ tar czf $(DISTNAME).tar.gz $(DISTNAME) clean: rm -rf obj/*.o lib/* rm -f pyext/professor2/core.cpp pyext/professor2/core.so rm -f $(TESTPROGS) rm -rf $(DISTNAME) $(DISTNAME).tar.gz