multinest.cpp
Go to the documentation of this file.
51 // An error is thrown if any of the following entries are not present in the inifile (none absolutely required for MultiNest). 54 // Tell cmake system to search known paths for these libraries; any not found must be specified in config/scanner_locations.yaml. 65 if (LogLike->getRank() == 0) std::cout << "Loading MultiNest nested sampling plugin for ScannerBit." << std::endl; 98 int nPar = ma+2; // Total no. of parameters including free & derived; +2 == {point ID code, MPI rank} 99 int nClsPar (get_inifile_value<int>("nClsPar",std::min(ma,4))); // No. of parameters to do mode separation on; don't use more than 4 100 int updInt (get_inifile_value<int>("updInt", 1000) ); // after how many iterations feedback is required & the output files should be updated (*10 for dumper) 101 double Ztol (get_inifile_value<double>("Ztol", -1E90) ); // all the modes with logZ < Ztol are ignored 102 int maxModes (get_inifile_value<int>("maxModes", 100) ); // expected max no. of modes (used only for memory allocation) 103 int seed (get_inifile_value<int>("seed", -1) ); // random no. generator seed, if < 0 then take the seed from system clock 107 double ln0 (get_inifile_value<double>("logZero",0.9999*gl0)); // points with loglike < logZero will be ignored by MultiNest 108 int maxiter (get_inifile_value<int>("maxiter", 0) ); // Max no. of iterations, a non-positive value means infinity. 113 for(int i = 0; i < ndims; i++) pWrap[i] = 0; // (need to do more work if we actually want to allow periodic BCs) 115 // TODO: check what happens if resume mode is active but multinest native output is not written. I guess it will resume writing to the printer output, but actually start a new scan? 123 char root[1000]; // I think MultiNest will truncate this to 100. But lets use a larger array just in case. 124 Gambit::Utils::strcpy2f(root, 1000, root_str);// (copy std::string into char array for transport to Fortran) 130 scan_error().raise(LOCAL_INFO,"Error from MultiNest ScannerBit plugin! Resume mode is activated, however " 145 // Options to desynchronise print streams from the main Gambit iterations. This allows for random access writing, or writing of global scan data. 275 void LogLikeWrapper::dumper(int nSamples, int nlive, int nPar, double *physLive, double *posterior, double* /*paramConstr*/, 281 scan_err <<"Error! ScannerBit MultiNest plugin attempted to run 'dumper' function on a worker process " 283 <<"process. Most likely this means that your multinest installation is not running in MPI mode " 301 std::cerr << "Multinest dumper first ran on process "<<boundLogLike->getRank()<<" at iteration "<<boundLogLike->getPtID()<<std::endl; 309 // Reset the print streams. WARNING! This potentially deletes the old data (here we overwrite it on purpose) 322 // For now, MPIrank set to 0 and pointID set to -1, as not needed. Might change how this works later. 353 live_stream->print( true, "LastLive", myrank, pointID); // Flag which points were the last live set 354 // // Put rest of parameters into a vector for printing all together // TODO: not needed, delete? scanner_plugin(multinest, version(3, 10)) ================================================= Interface to ScannerBit Definition: multinest.cpp:49 double LogLike(double *, int, int) Main interface function from MultiNest to ScannerBit-supplied loglikelihood function. Definition: multinest.cpp:229 Printers::BasePrinterManager printer_interface typedef printer_interface_temp printer_interface; Definition: printer_interface.hpp:31 void run(bool, bool, bool, int, double, double, int, int, int, int, int, double, char[], int, int[], bool, bool, bool, bool, double, int, double(*)(double *, int, int, void *), void(*)(int, int, int, double *, double *, double *, double, double, double, void *), void *) double callback_loglike(double *, int, int, void *) Plain-vanilla C-functions to pass to Multinest for the callbacks. Definition: multinest.cpp:187 Declarations for the YAML options class. General small utility functions. EXPORT_SYMBOLS void strcpy2f(char *, int, str) Copy a str to a character array, stripping the null termination character. Definition: util_functions.cpp:186 bool dumper_runonce Variable to indicate whether the dumper function has been run at least once. Definition: multinest.hpp:67 #define reqd_inifile_entries(...) Tells ScannerBit that these tags are required. Definition: plugin_macros.hpp:55 #define scan_err Defined to macros to output errors in the form: scan_err << "error" << scan_end; scan_warn << "warnin... Definition: scanner_utils.hpp:54 #define plugin_main(...) Declaration of the main function which will be ran by the interface. Definition: plugin_macros.hpp:43 virtual void reset(bool force=false)=0 Function to signal to the printer to write buffer contents to disk. LogLikeWrapper * global_loglike_object Global pointer to loglikelihood wrapper object, for use in the MultiNest callback functions... Definition: multinest.cpp:37 void callback_dumper(int, int, int, double *, double *, double *, double, double, double, void *) Definition: multinest.cpp:195 ScannerBit interface to Multinest 3.10. EXPORT_SYMBOLS const str & ensure_path_exists(const str &) Ensure that a path exists (and then return the path, for chaining purposes) Definition: util_functions.cpp:227 printer_interface & boundPrinter Reference to a printer_interface object. Definition: multinest.hpp:64 void dumper(int, int, int, double *, double *, double *, double, double, double) Main interface to MultiNest dumper routine. Definition: multinest.cpp:275 #define reqd_libraries(...) Tells ScannerBit that these libraries are requested. Definition: plugin_macros.hpp:57 declaration for scanner module scanPtr boundLogLike Scanner pointer (points to the ScannerBit provided log-likelihood function) Definition: multinest.hpp:61 void setValue(const KEYTYPE &key, const VALTYPE &val) Basic setter, for adding extra options. Definition: yaml_options.hpp:135 Class to connect multinest log-likelihood function and ScannerBit likelihood function. Definition: multinest.hpp:57 Gambit::Scanner::like_ptr scanPtr Typedef for the ScannerBit pointer to the external loglikelihood function. Definition: multinest.hpp:50 |