ECF installation / running the examples


Prerequisites – boost library

ECF uses some features of boost C++ library (www.boost.org). To use ECF, a minimal boost installation (only header files, no compilation) is needed. After the boost source files are extracted, the ECF projects may be compiled (on Windows, check the boost directory location!).

NOTE: in Visual Studio projects included in the ECF, boost include directory is set to "C:\Program Files\boost\boost_1_64_0". If you installed to a different location (or use a newer boost version), change the directory accordingly (in project's Additional include directories).

Obtaining boost: the latest version can be downloaded from http://sourceforge.net/projects/boost/files/latest/download?source=files. More information on boost is available at Getting Started guide.

For linux packages, be sure to search for 'libboost-dev' package (e.g. 'sudo apt-get install libboost-dev').


Installation

Visual Studio

In the main directory you can find a "VS" subdirectory which contains Visual Studio (2010) solution file ECF_lib_2010.sln. Open it and just build the solution (release and/or debug version). The solution produces library ECF.lib (in either ./release or ./debug directory) which can be used to build examples and user projects. Each example has its "VS" subdirectory with a VS solution file that can be used to build either debug or release version (having previously built the ECF_lib project). 

CMake

CMake project files ("CMakeLists.txt") are provided in the main directory for the ECF library, and in example subfolders for each example.

CLion

The ECF library and the examples can also be compiled with CLion, for which the project files are suplied in subdirectory .idea for each example.

Autotools (Linux)

Semi-automatic installation is available with this nifty little script (thanks to Jernej Makovsek), tested on Ubuntu.

Otherwise, standard installation procedure applies (you may need to chmod the 'configure' script beforehand to be able to execute it):

 $ ./configure [ --prefix=DIR ]
 $ make
 $ make install

By default, the compiled libraries are installed in folder '/usr/local/lib', while the headers are installed in '/usr/local/include'.
You can specify a different installation folder by giving the option '--prefix=<PATH>' to the 'configure' script, e.g. --prefix=/home/someuser/ecf/.

Should any errors occurr, try reconfiguring the package by running aclocal, autoconf and automake  (or just autoreconf -fi) before ./configure.

Each directory in /examples contains a Makefile used to build a specific example:

 $ cd examples/GAonemax
 $ make
 g++ -Wall OneMaxEvalOp.cpp -c -o OneMaxEvalOp.o
 g++ -Wall main.cpp -c -o main.o
 g++ -Wall OneMaxEvalOp.o main.o -lecf -o onemax

If necessary, modify the Makefile to include the ECF installation library directory as the compilation flags (if not installed to the default system location), e.g.:

CFLAGS = $(WARN) -I/home/someuser/ecf/include
LDFLAGS = $(WARN) -lecf -L/home/someuser/ecf/lib

Make sure libecf is installed and can be found by the linker (add the above installation library directory defined with ./configure to LD_LIBRARY_PATH if necessary, e.g. 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH').

Each example is started by calling its name and given parameters file (e.g. "./onemax parameters.txt"). The examples and parameters are explained in more detail in the Tutorial.


Parallel ECF

Prerequisites – MPI library

In order to run parallel ECF on one or more processors or computers, an MPI (Message Passing Interface) implementation such as MPICH2 or OpenMPI has to be installed. ECF has been tested with MPICH2 and simple installation instructions can be found with the MPI implementation.

Note: in Visual Studio projects included in the ECF, MPICH2 directory is presumed to be "C:\Program Files\MPICH2". If you installed to a different location, change the directory accordingly.

Windows: installation

The "VS" subdirectory of the main project directory contains the Visual Studio 2005 solution file ECF_lib_MPI.sln. The solution produces library ECF.lib (in ./release or ./debug directory) which can be used to build MPI programs that can be executed in parallel. Note that this library overwrites the sequential library with the same name (and vice versa). If you need to have both ECF.lib variants at the same time, copy one to a different location.

Windows: running the examples

The examples are built in the same way as for the serial version: the only difference is that MPI-capable library is now used, which allows the executable to be run as an MPI program. To use a parallel evolutionary algorithm, one only has to be stated in the configuration file.

Note that to run parallel ECF as an MPI program - in several processes on different machines - you need to start it using the currently installed MPI implementation (e.g. "mpiexec" gui or command utility with MPICH2). The number of processes and the machines to run on are also defined using the MPI program environment.

Linux: installation

To compile ECF libraries with MPI support, use --with-mpi=<MPI directory> option with the configure script, e.g.:

  $ ./configure --with-mpi=/home/user/mpi
  $ make
  $ make install

Should any errors occurr, try reconfiguring the package by running aclocal, autoconf and automake  (or just autoreconf -fi) before ./configure.

Linux: running the examples

The compiler in the project's makefile has to be set to the installed MPI compiler (e.g. set as "CXX = mpicxx"). Other than that, the example projects are built in the same manner as for the sequential ECF.

Automatic execution with MPI is available with another script (thanks to Jernej Makovsek) tested on Ubuntu.