# BayesOpt / doxygen / install.dox

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 /*! \page install Installing BayesOpt \tableofcontents The core of BayesOpt uses standard C/C++ code (C++98) so it can be compiled from many C++ compilers (gcc, clang, MSVC...). The library also include wrappers for Python, Matlab and Octave interfaces which requires extra dependencies or compilation steps. Note that the Python or Matlab/Octave interfaces are not included by default. \section unixinst Installing in Linux/MacOS: The compilation is very similar in any *nix system. Following these instructions, the library will be compiled using the default configuration. You can modify that easily as explained in \ref confinst \subsection getDepend Getting dependencies: The easiest way to compile this library is using the cross platform and cross compiler tool CMake. This code uses Boost libraries for matrix operations (uBlas), random number generation, math functions and smart pointers. Being only include files, Boost does not require any speciall install. Boost can be found in many Linux and MacOS repositories. It can also be downloaded from http://www.boost.org. Both Python development files (Python.h) and Numpy are needed if you want the Python interface. The library has been tested with Python 2.6 and 2.7. The interface relies on Numpy arrays. Finally, if you want the Matlab interface, just make sure your C++ compiler is compatible with your Matlab version. \subsubsection cinlinux Linux: For Ubuntu/Debian, the minimum dependencies (C/C++) can be optained by running: \verbatim >> sudo apt-get install libboost-dev cmake cmake-curses-gui g++ \endverbatim If you want the Python interface: \verbatim >> sudo apt-get install python-dev python-numpy \endverbatim If you want the Octave interface (note that the \a octave package does not include all the necessary files): \verbatim >> sudo apt-get install octave-headers \endverbatim And for all dependencies: \verbatim >> sudo apt-get install libboost-dev python-dev python-numpy cmake cmake-curses-gui g++ cython octave-headers \endverbatim \subsubsection cinmac MacOS: This section assumes \b macports is installed. Similar packages can be found in \b fink or \b homebrew. For the minimal install, run: \verbatim >> sudo port install boost gcc47 cmake \endverbatim If you want the Python interface: \verbatim >> sudo port install python27 py27-numpy \endverbatim If you want the Octave interface: \verbatim >> sudo port install octave \endverbatim Again, for all dependencies: \verbatim >> sudo port install boost python27 py27-numpy gcc47 cmake py27-cython octave \endverbatim \subsection compile Compile the library: In order to compile the source code in a *nix system, run this from a terminal. \verbatim >> cmake . >> make >> sudo make install \endverbatim \b Important: If you use \b ccmake instead of \b cmake you will access a graphical interface to select features such as the include the Python and Matlab interfaces, debug/release mode or if you want to use shared libraries or not. \b Shared libraries are required to run the Python interface. \subsubsection docbuild Building the documentation If you have doxygen installed on your computer, you can compile the documentation right after compiling the code by running. \verbatim >> make doc \endverbatim Thid documentation will appear in the "doc" subdirectory. \subsection instpython Python interface: Both Python development files (Python.h) and Numpy are needed if you want the python interface. The library has been tested with Python 2.6 and 2.7. The interface relies on Numpy arrays. If we want to select the option to compile the Python interface we can just run: \verbatim >> cmake -DBUILD_PYTHON=ON . \endverbatim or \verbatim >> ccmake . \endverbatim and select the corresponding option. \b Important: Python requires bayesopt to be a \b shared library. The option is automatically adjusted by CMake. \subsection instmatlab MATLAB/Octave interface: Make sure the library is compiled with the MATLAB_COMPATIBLE option using ccmake. Undex Mac OS they must be shared. Also, configure Matlab/Octave to compile mex files. For example, in Matlab you can run to check the supported compilers: \verbatim >> mex -setup \endverbatim Run the corresponding script compile_matlab.m or compile_octave.m, which can be found in the \em /matlab/ directory. If bayesopt or nlopt are compiled as \b shared libraries, then, at run time, MATLAB/Octave also needs to access to the libraries. For example, LD_LIBRARY_PATH must include the folder where the libraries are. If the install path is the default, you can execute the exportlocalpath.sh script before calling MATLAB.
\section confinst Configure the compilation/install As we have made to select the install path or to add python bindings, CMake allows to configure the compilation using some variables. These variables can be set in Linux/MacOS from the command line with the -D flag: \verbatim >> cmake -DVARIABLE=VALUE . \endverbatim For example \verbatim >> cmake -DCMAKE_BUILD_TYPE=Debug . \endverbatim If you use ccmake or CMake for Windows, just modify the value of the variable. \subsection instshared Compile as shared libraries We can select if we want BayesOpt and NLOPT compiled as shared libraries \verbatim BAYESOPT_BUILD_SHARED=ON NLOPT_BUILD_SHARED=ON \endverbatim In this case, we also need to force rebuild NLOPT (by default it is not compiled if it is found in the system). \subsection instpath Install the library in a different path CMake allows to select the install path before compilation compilation. You just need to change the CMAKE_INSTALL_PREFIX variable. \verbatim CMAKE_INSTALL_PREFIX=/your/desired/path \endverbatim \subsection mininst Minimal installation (fast compilation) Sobol sequences can be used to for the initial design (see \ref initpar). In many cases, the performance is similar to latin hypercube sampling, however including the Sobol components increases considerably the library size and the compilation time. Thus, it can be removed from compilation: \verbatim BAYESOPT_BUILD_SOBOL=OFF \endverbatim Similarly, we can avoid to compile the example files and demos: \verbatim BAYESOPT_BUILD_EXAMPLES=OFF \endverbatim */