endif()
### Check for Eigen library
-find_package (Eigen3 3.3 REQUIRED NO_MODULE)
-message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR}")
-include_directories(${EIGEN3_INCLUDE_DIR})
-if ("3.3.4" EQUAL EIGEN3_VERSION_STRING AND CMAKE_COMPILER_IS_GNUCC)
- message(STATUS "Avoid build error of Eigen3 v3.3.4 using -Wno-error=int-in-bool-context")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=int-in-bool-context")
+set(SIMGRID_HAVE_EIGEN3 0)
+find_package (Eigen3 3.3 CONFIG
+ HINTS ${EIGEN3_HINT})
+if (Eigen3_FOUND)
+ set(SIMGRID_HAVE_EIGEN3 1)
+ message(STATUS "Found Eigen3: ${EIGEN3_INCLUDE_DIR}")
+ include_directories(${EIGEN3_INCLUDE_DIR})
+ if ("3.3.4" EQUAL EIGEN3_VERSION_STRING AND CMAKE_COMPILER_IS_GNUCC)
+ message(STATUS "Avoid build error of Eigen3 v3.3.4 using -Wno-error=int-in-bool-context")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=int-in-bool-context")
+ endif()
+else()
+ message(STATUS "Disabling model BMF because Eigen3 was not found. If it's installed, use EIGEN3_HINT to hint cmake about the location of Eigen3Config.cmake")
endif()
set(SIMGRID_HAVE_MSG 0)
else()
message(" Compile Python bindings .....: OFF (disabled, or pybind11 not found)")
endif()
+if(Eigen3_FOUND)
+ message(" Eigen3 library ..............: ${EIGEN3_VERSION_STRING} in ${EIGEN3_INCLUDE_DIR}")
+else()
+ message(" Eigen3 library ..............: not found (EIGEN3_HINT='${EIGEN3_HINT}').")
+endif()
message(" Compile Smpi ................: ${HAVE_SMPI}")
message(" Smpi fortran ..............: ${SMPI_FORTRAN}")
message(" MPICH3 testsuite ..........: ${enable_smpi_MPICH3_testsuite}")
- On Debian / Ubuntu: ``apt install libboost-dev libboost-context-dev``
- On CentOS / Fedora: ``yum install boost-devel``
- On macOS with homebrew: ``brew install boost``
-Eigen3
+Eigen3 (optional)
- On Debian / Ubuntu: ``apt install libeigen3-dev``
- On CentOS / Fedora: ``yum install eigen3-devel``
- On macOS with homebrew: ``brew install eigen``
+ - Use EIGEN3_HINT to specify where it's installed if cmake doesn't find it automatically.
Java (optional):
- Debian / Ubuntu: ``apt install default-jdk libgcj18-dev`` (or
any version of libgcj)
NS3_HINT (empty by default)
Alternative path into which ns-3 should be searched for.
+EIGEN3_HINT (empty by default)
+ Alternative path into which Eigen3 should be searched for.
+
SIMGRID_PYTHON_LIBDIR (auto-detected)
Where to install the Python module library. By default, it is set to the cmake Python3_SITEARCH variable if installing to /usr,
and a modified version of that variable if installing to another path. Just force another value if the auto-detected default
/* Was the ns-3 support compiled in? */
#cmakedefine01 SIMGRID_HAVE_NS3
#cmakedefine NS3_MINOR_VERSION @NS3_MINOR_VERSION@
+/* Was the Eigen3 support compiled in? */
+#cmakedefine01 SIMGRID_HAVE_EIGEN3
#endif /* SIMGRID_PUBLIC_CONFIG_H */
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/lmm/bmf.hpp"
+#include "xbt/config.hpp"
+
#include <Eigen/LU>
#include <iostream>
#include <numeric>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_bmf, kernel, "Kernel BMF solver");
-int sg_bmf_max_iterations = 1000; /* Change this with --cfg=bmf/max-iterations:VALUE */
+simgrid::config::Flag<int>
+ cfg_bmf_max_iteration("bmf/max-iterations",
+ "Maximum number of steps to be performed while searching for a BMF allocation", 1000);
+
+simgrid::config::Flag<bool> cfg_bmf_selective_update{
+ "bmf/selective-update", "Update the constraint set propagating recursively to others constraints (off by default)",
+ false};
namespace simgrid {
namespace kernel {
, C_shared_(std::move(shared))
, phi_(std::move(phi))
, gen_(A_)
+ , max_iteration_(cfg_bmf_max_iteration)
+
{
xbt_assert(max_iteration_ > 0,
"Invalid number of iterations for BMF solver. Please check your \"bmf/max-iterations\" configuration.");
AllocationGenerator gen_;
std::vector<int> allocations_age_;
static constexpr int NO_RESOURCE = -1; //!< flag to indicate player has selected no resource
- int max_iteration_ = sg_bmf_max_iterations; //!< number maximum of iterations of BMF algorithm
+ int max_iteration_; //!< number maximum of iterations of BMF algorithm
};
/**
"Maximum number of concurrent variables in the maxmim system. Also limits the number of "
"processes on each host, at higher level. (default: -1 means no such limitation)");
- simgrid::config::bind_flag(sg_bmf_max_iterations, "bmf/max-iterations",
- "Maximum number of steps to be performed while searching for a BMF allocation");
-
- simgrid::config::Flag<bool> _sg_bmf_selective_update{
- "bmf/selective-update",
- "Update the constraint set propagating recursively to others constraints "
- "(off by default)",
- false};
-
/* The parameters of network models */
sg_latency_factor = 13.01; // comes from the default LV08 network model
#include <simgrid/s4u/Engine.hpp>
#include <xbt/config.hpp>
+#include "simgrid/config.h"
#include "src/kernel/EngineImpl.hpp"
+#if SIMGRID_HAVE_EIGEN3
#include "src/kernel/lmm/bmf.hpp"
+#endif
#include "src/kernel/resource/profile/Event.hpp"
#include "src/surf/ptask_L07.hpp"
void surf_host_model_init_ptask_BMF()
{
+#if SIMGRID_HAVE_EIGEN3
XBT_CINFO(xbt_cfg, "Switching to the BMF model to handle parallel tasks.");
bool select = simgrid::config::get_value<bool>("bmf/selective-update");
auto* engine = simgrid::kernel::EngineImpl::get_instance();
engine->add_model(host_model);
engine->get_netzone_root()->set_host_model(host_model);
+#else
+ xbt_die("Cannot use the BMF ptask model without installing Eigen3.");
+#endif
}
namespace simgrid {
XBT_PUBLIC_DATA double sg_maxmin_precision;
XBT_PUBLIC_DATA double sg_surf_precision;
XBT_PUBLIC_DATA int sg_concurrency_limit;
-XBT_PUBLIC_DATA int sg_bmf_max_iterations;
extern XBT_PRIVATE double sg_latency_factor;
extern XBT_PRIVATE double sg_bandwidth_factor;
-foreach(x cloud-sharing ptask_L07_usage ptask-subflows wifi_usage wifi_usage_decay cm02-set-lat-bw)
+if (Eigen3_FOUND)
+ set(optional_examples ptask-subflows)
+else()
+ foreach(x ptask-subflows)
+ set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
+ set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
+ endforeach()
+endif()
+foreach(x cloud-sharing ptask_L07_usage wifi_usage wifi_usage_decay cm02-set-lat-bw ${optional_examples})
add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
src/surf/ns3/ns3_simulator.cpp )
set(SURF_SRC
- src/kernel/lmm/bmf.hpp
- src/kernel/lmm/bmf.cpp
src/kernel/lmm/fair_bottleneck.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/lmm/maxmin.cpp
src/surf/HostImpl.cpp
src/surf/ptask_L07.cpp
)
+if (Eigen3_FOUND)
+ set(SURF_SRC
+ ${SURF_SRC}
+ src/kernel/lmm/bmf.hpp
+ src/kernel/lmm/bmf.cpp)
+else()
+ set(EXTRA_DIST
+ ${EXTRA_DIST}
+ src/kernel/lmm/bmf.hpp
+ src/kernel/lmm/bmf.cpp)
+endif()
set(PLUGINS_SRC
src/plugins/ProducerConsumer.cpp
src/xbt/config_test.cpp
src/xbt/dict_test.cpp
src/xbt/dynar_test.cpp
- src/xbt/random_test.cpp
+ src/xbt/random_test.cpp
src/xbt/xbt_str_test.cpp
- src/kernel/lmm/bmf_test.cpp
- src/kernel/lmm/maxmin_test.cpp)
+ src/kernel/lmm/maxmin_test.cpp)
if (SIMGRID_HAVE_MC)
set(UNIT_TESTS ${UNIT_TESTS} src/mc/sosp/Snapshot_test.cpp src/mc/sosp/PageStore_test.cpp)
else()
set(EXTRA_DIST ${EXTRA_DIST} src/mc/sosp/Snapshot_test.cpp src/mc/sosp/PageStore_test.cpp)
endif()
+if (SIMGRID_HAVE_EIGEN3)
+ set(UNIT_TESTS ${UNIT_TESTS} src/kernel/lmm/bmf_test.cpp)
+else()
+ set(EXTRA_DIST ${EXTRA_DIST} src/kernel/lmm/bmf_test.cpp)
+endif()
set(EXTRA_DIST ${EXTRA_DIST} src/kernel/routing/NetZone_test.hpp)
add_executable (unit-tests EXCLUDE_FROM_ALL ${UNIT_TESTS})