diff --git a/.github/workflows/build_ubuntu_debug.yml b/.github/workflows/build_ubuntu_debug.yml new file mode 100644 index 000000000..58aac6a42 --- /dev/null +++ b/.github/workflows/build_ubuntu_debug.yml @@ -0,0 +1,47 @@ +name: Build Debug (Ubuntu) +on: [push, pull_request] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [g++-10, g++-9, g++-8, g++-7, clang-6, clang-7, clang-8, clang-9, clang-10, clang-11, clang-12] + + steps: + - uses: actions/checkout@v4 + + - name: Caching objects + id: cache-objects + uses: actions/cache@v4 + with: + path: ~/.cache/ccache + key: ${{ runner.os }}-${{env.BUILD_TYPE}}-${{ matrix.compiler }}-objects + + - name: Install Dependencies + shell: bash + run: | + sudo apt-get install libeigen3-dev libboost-dev + + - name: Configure + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEDO=ON -DEDO_USE_LIB=Eigen3 -DENABLE_CMAKE_EXAMPLE=ON -DENABLE_CMAKE_TESTING=ON + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} + diff --git a/.gitignore b/.gitignore index c1a3ba42c..ef1e87e20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,21 @@ -# ignore html files +# ignore generated files *.html +*.pdf # ignore all textual files *.txt +*.swp +*.swo +.kak_history +*.log +*.csv +*.ods # ignore object and archive files *.[oa] +*.bak +*.tar* +tags # ignore auto-saved files *~ @@ -15,10 +25,20 @@ !CMakeLists.txt !README.txt !application/ -!build/ !doc/ !lib/ !src/ !test/ !eompi.html + +# ignore built files build/ +release/* +debug/* +build/* +website/EO_star.png +website/paradiseo_logo.png +Release/* +Debug/* +Build/* + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..47e9ce4b9 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,52 @@ +Current maintainers +=================== + +Johann Dreo + + +Past contributors +================= + +atantar +Alesandro Sidero +Alexandre Quemy +Alix Zheng +Amine Aziz-Alaoui +Arnaud Liefooghe +Benjamin Bouvier +Bahri +Caner Candan +Clive Canape +fatene +Gustavo Romero Lopez +jboisson +Jeroen Eggermont +Jochen Küpper +Joost +Juan Julian Merelo Guervos +Jérémie Humeau +Jxtopher +Karima Boufaras +legillono +Leo Bertheas +Louis Da Costa +Loïc Jean David Arjanen +Maarten Keijzer +Mammar Amara +Manu +Marc Schoenauer +Marie-Éleonore +Mostepha Khouadjia +Olivier König +Pierre Savéant +Pedro Angel Castillo Valdivieso +Potalas +Ronald Pinho +Steve Madere +Sébastien Cahon +Sébastien Verel +Thomas Legrand +Thibault Lasnier +Victor Manuel Rivas Santos +wcancino +xohm diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..52c1fa4a5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,153 @@ +# ParadiseO + + +###################################################################################### +### 0) Check the CMake version +###################################################################################### + +cmake_minimum_required(VERSION 3.10 FATAL_ERROR) + +###################################################################################### +### 1) Define the project +###################################################################################### + +## Name +project("ParadisEO" + VERSION 3.1.3 + DESCRIPTION "Evolutionary optimization framework" + LANGUAGES C CXX) + +## Language +set(CMAKE_CXX_STANDARD 17) + +## ccache +find_program(CCACHE_PROGRAM ccache) + +if (CCACHE_PROGRAM) + message(NOTICE "-- ccache is enabled (found here: ${CCACHE_PROGRAM})") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "\"${CCACHE_PROGRAM}\"") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "\"${CCACHE_PROGRAM}\"") +else () + message(NOTICE "-- ccache has not been found") +endif () + + +###################################################################################### +### 2) Check dependencies +###################################################################################### + +## Optional +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/module" CACHE INTERNAL "Cmake module" FORCE) +include(FindDoxygen OPTIONAL) +if(NOT DOXYGEN_FOUND) + message(WARNING "Doxygen was not found, install it if you want to generate the documentation.") +else() + message(STATUS "Doxygen found, use the target `doc` to generate the documentation.") +endif() + +###################################################################################### +### 3) Include CMake files +###################################################################################### + +## Configuration file for building type and flags +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake) + +## Macro file +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Macro.cmake) + +## Custom Targets file +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Target.cmake) + +###################################################################################### +### 4) Define and add module paths : EO, MO, MOEO +###################################################################################### + +## Paths to sources of modules +set( EO_SRC_DIR "${PROJECT_SOURCE_DIR}/eo" CACHE INTERNAL "ParadisEO-EO source directory" FORCE) +set( EDO_SRC_DIR "${PROJECT_SOURCE_DIR}/edo" CACHE INTERNAL "ParadisEO-EDO source directory" FORCE) +set( MO_SRC_DIR "${PROJECT_SOURCE_DIR}/mo" CACHE INTERNAL "ParadisEO-MO source directory" FORCE) +set(MOEO_SRC_DIR "${PROJECT_SOURCE_DIR}/moeo" CACHE INTERNAL "ParadisEO-MOEO source directory" FORCE) +set( SMP_SRC_DIR "${PROJECT_SOURCE_DIR}/smp" CACHE INTERNAL "ParadisEO-SMP source directory" FORCE) +set( MPI_SRC_DIR "${PROJECT_SOURCE_DIR}/eo/src/mpi" CACHE INTERNAL "ParadisEO-MPI source directory" FORCE) + +set(PROBLEMS_SRC_DIR "${PROJECT_SOURCE_DIR}/problems" CACHE INTERNAL "Problems dependant source directory" FORCE) + +set(CMAKE_BASE_SOURCE_DIR ${PROJECT_SOURCE_DIR}) + +# All libraries are built in /lib/ +set( EO_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-EO binary directory" FORCE) +set( EDO_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-EDO binary directory" FORCE) +set( MO_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-MO binary directory" FORCE) +set(MOEO_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-MOEO binary directory" FORCE) +set( SMP_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-SMP binary directory" FORCE) +set( MPI_BIN_DIR "${CMAKE_BINARY_DIR}" CACHE INTERNAL "ParadisEO-MPI binary directory" FORCE) + + +set(EO_ONLY "false" CACHE BOOL "Only build EO and not the other modules") +set(ENABLE_OPENMP "false" CACHE BOOL "Build EO with the OpenMP support (shared-memory parallel evaluators on multi-core)") +set(ENABLE_GNUPLOT "false" CACHE BOOL "Build EO with the GNUplot support (real-time convergence plotting)") +set(EDO "false" CACHE BOOL "Build the EDO module") +set(EDO_USE_LIB "Eigen3" CACHE STRING "Which linear algebra library to use to build EDO ('UBlas' or 'Eigen3', Eigen3 is recommended)") +set(SMP "false" CACHE BOOL "Build the SMP module") +set(MPI "false" CACHE BOOL "Build the MPI module") + +## EO Module +set(MODULE_NAME "Paradiseo") +set(DOXYGEN_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doxygen) +# set(EO_MODULE_NAME "Evolving Objects") +set(CMAKE_SOURCE_DIR ${EO_SRC_DIR}) +add_subdirectory(${EO_SRC_DIR}) + +if(NOT EO_ONLY) + ## MO Module + # set(MO_MODULE_NAME "Moving Objects") + # set(MODULE_NAME "Moving Objects") + set(CMAKE_SOURCE_DIR ${MO_SRC_DIR}) + add_subdirectory(${MO_SRC_DIR}) + + ## EDO Module + if(EDO) + # set(EDO_MODULE_NAME "Evolving Distribution Objects") + set(CMAKE_SOURCE_DIR ${EDO_SRC_DIR}) + add_subdirectory(${EDO_SRC_DIR}) + endif() + + ## MOEO Module + # set(MOEO_MODULE_NAME "Multi-Objectives EO") + set(CMAKE_SOURCE_DIR ${MOEO_SRC_DIR}) + add_subdirectory(${MOEO_SRC_DIR}) + + ## SMP Module + if(SMP) + # set(SMP_MODULE_NAME "Symmetric Multi-Processing") + set(CMAKE_SOURCE_DIR ${SMP_SRC_DIR}) + add_subdirectory(${SMP_SRC_DIR}) + endif() + + ## MPI Module + if(MPI) + find_package(MPI REQUIRED) + add_definitions(-DWITH_MPI) + set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}) + set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS}) + include_directories(${MPI_INCLUDE_PATH}) + add_subdirectory(${MPI_SRC_DIR}) + endif() +endif() + +###################################################################################### +### 5) Packaging : only in release ! +###################################################################################### + +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Package.cmake) +endif() + + +# Add all targets to the build-tree export set +export(TARGETS eo FILE "${PROJECT_BINARY_DIR}/paradiseo-config.cmake") + +# Export the package for use from the build-tree +# (this registers the build-tree with a global CMake-registry) +export(PACKAGE paradiseo) + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..6eff1e82f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,84 @@ + +Licenses +======== + +ParadisEO modules are using free software licenses, +any contribution should be licensed under the same license. + +| Module | License | Version | Copyleft | Patent-left | +|--------|---------|---------|----------|-------------| +| EO | LGPL | 2 | Lib only | No | +| EDO | LGPL | 2 | Lib only | No | +| MO | CeCILL | 2.1 | Yes | No | +| MOEO | CeCILL | 2.1 | Yes | No | +| SMP | CeCILL | 2.1 | Yes | No | + + +Contribution Workflow +===================== + +The maintainer(s) will try to answer under a couple of weeks, if not, do not hesitate to send an e-mail. + +If you're not familiar with Git and merge requests, start by cloning one of the main repository: +- `git clone https://github.com/nojhan/paradiseo.git` +- `git clone https://scm.gforge.inria.fr/anonscm/git/paradiseo/paradiseo.git` + + +Git workflow +------------ + +ParadisEO follows a classical Git workflow using merge requests. +In order to fix a bug or add a feature yourself, you would follow this process. + +```bash +cd paradiseo +git pull origin master # Always start with an up-to-date version. +git checkout -b # Always work on a dedicated branch. +# [ make some modifications… ] +git commit +mkdir build +cd build +cmake -DCMAKE_BUILD_TYPE=Debug -BUILD_TESTING=ON -DENABLE_CMAKE_TESTING=ON .. && make && ctest # Always test. +cd .. +git pull origin master # Always check that your modification still merges. +``` + +If everything went without error, you can either send the patch or submit a merge request. +To do so, you can either: +- submit a "pull request" on Github: [nojhan/paradiseo](https://github.com/nojhan/paradiseo), +- or send a patch on the [ParadisEO mailing list](https://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/paradiseo-users). + +See below for the details. + + +Github pull request +------------------- + +Once logged in Github, go to the [maintainer repository](https://github.com/nojhan/paradiseo) and click the "fork" button. +You should have your own copy of the ParadisEO project under your own name. +Then add it as an additional "remote" to your ParadisEO Git tree: `git remote add me `. +Then, checkout the branch holding the modifications you want to propose, check that it merges with the main repository +and push it on your own repository: +```bash +git checkout +git pull origin master +git push me +``` + +Then go to the maintainer's repository page, click on the "Pull request" tab, and on the "New pull request" button. +You should then select the maintainer's master branch on the left dropdown list, and your own `my_feature` on the right one. +Explain why the maintainer should merge your modifications and click the "Submit" button. + + +E-mail your patch +----------------- + +Generate a patch file from the difference between your branch and a fresh master: +```bash +git pull origin master +git diff master > my_feature.patch +``` + +Then send the `my_feature.patch` (along with your explanations about why the maintainer should merge your modifications) +to the [mailing list](https://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/paradiseo-users). + diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 000000000..465d208d6 --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "ParadisEO") +set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "cdash.inria.fr") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 000000000..a3fb4e1b7 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,217 @@ + +Summary +======= + +As Paradiseo is a development framework, you do not really need to install it on all your systems. +Just put it somewhere on your development computer, compile it from here and indicate where to find it to your favorite build system. + + +Build +----- + +Paradiseo is mainly developed for Linux, on which it is straightforward to install a C++ build chain. For example, on Ubuntu 18.04: +```bash +sudo apt install g++-8 cmake make libeigen3-dev libopenmpi-dev doxygen graphviz libgnuplot-iostream-dev +``` + +Paradiseo use the CMake build system, so building it should be as simple as: +```bash +mkdir build ; cd build ; cmake -DEDO=ON .. && make -j +``` + +The file `howto_build_paradiseo.apptainer.def` shows you how to install and build from scratch. +It is a definition file for the [Apptainer](https://apptainer.org/) container system, +which is often used on HPC clusters. + + +Develop +------- + +Download the quick start project template, edit the `CMakeLists.txt` file to indicate where to find Paradiseo and start developing your own solver. + +If you don't know CMake or a modern build system, you should still be able to build a stand-alone code from a `paradiseo/build` directory with something like: +```bash + c++ ../solver.cpp -I../eo/src -I../edo/src -DWITH_EIGEN=1 -I/usr/include/eigen3 -std=c++17 -L./lib/ -leo -leoutils -les -lga -o solver +``` + + +Install +------- + +If you want to install ParadisEO system-wide anyway: +```bash +cmake -D CMAKE_BUILD_TYPE=Release .. && sudo make install +``` + + +More details +============ + +As a templated framework, most of the ParadisEO code rely within headers and is thus compiled +by you when you build your own solver. + +However, in order to save some compilation time, +the EO and EDO modules are compiled within static libraries by the default build system. + +If you believe you have a working build chain and want to test if it works with ParadisEO, +you can try to build the tests and the examples. +Note that if some of them failed (but not all), you may still be able to build your own solver, +as you will most probably not use all ParadisEO features anyway. + + +Windows +------- + +Last time we checked, ParadisEO could only be built with MinGW. +Feel free to test with another compiler and to send us your report. + +As of today, we cannot guarantee that it will be easy to +install ParadisEO under Windows if you're a beginner. +There is still some (possibly outdated) help about oldest version on the [Website](http://paradiseo.gforge.inria.fr/). + +If you know how to install a working compiler and the dependencies, +you may follow the same steps than the Linux process below. + +If you are a beginner, we strongly suggest you install a Linux distribution +(either as an OS, as a virtual machine or using the Windows 10 compatibility layer). + + +Linux +----- + +### Dependencies + +In order to build the latest version of Paradiseo, you will need a C++ compiler supporting C++17. +So far, GCC and CLANG gave good results under Linux. You will also need the CMake and make build tools. + +Some features are only available if some dependencies are installed: +- Most of the EDO module depends on either uBlas or Eigen3. The recommended package is Eigen3, which enables the adaptive algorithms. +- Doxygen is needed to build the API documentation, and you should also install graphviz if you want the class relationship diagrams. +- GNUplot is needed to have the… GNUplot graphs at checkpoints. + +To install all those dependencies at once under Ubuntu (18.04), just type: +```bash +sudo apt install g++-8 cmake make libeigen3-dev libopenmpi-dev doxygen graphviz libgnuplot-iostream-dev. +``` + + +### Build + +The build chain uses the classical workflow of CMake. +The recommended method is to build in a specific, separated directory and call `cmake ..` from here. +CMake will prepare the compilation script for your system of choice which you can change with the `-G ` option (see your CMake doc for the list of available generators). + +Under Linux, the default is `make`, and a build command is straitghtforward: +```bash +mkdir build ; cd build ; cmake .. && make -j +``` + +There is, however, several build options which you may want to switch. +To see them, we recommend the use of a CMake gui, like ccmake or cmake-gui. +On the command line, you can see the available options with: `cmake -LH ..`. +Those options can be set with the `-D