From f15e92e5de94e0d84b2084de6e1648ce64dadbed Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 30 Jan 2020 20:49:18 +0100 Subject: [PATCH] Add a cmake flag to not compile MSG at all --- CMakeLists.txt | 25 ++- ChangeLog | 8 +- MANIFEST.in | 91 +---------- NEWS | 6 +- examples/deprecated/msg/CMakeLists.txt | 118 +++++++------- examples/deprecated/msg/mc/CMakeLists.txt | 4 +- .../smpi/replay_multiple/replay_multiple.c | 18 +-- .../masterslave_mailbox_smpi.c | 145 ------------------ .../smpi/smpi_msg_masterslave/msg_smpi.tesh | 43 ------ .../CMakeLists.txt | 8 +- .../deployment_masterslave_mailbox_smpi.xml | 11 +- .../masterslave_mailbox_smpi.cpp | 132 ++++++++++++++++ .../smpi/smpi_s4u_masterslave/s4u_smpi.tesh | 43 ++++++ include/simgrid/config.h.in | 2 + src/instr/instr_interface.cpp | 26 ++-- src/instr/instr_platform.cpp | 5 + src/msg/msg_process.cpp | 6 - src/xbt/xbt_log_layout_format.cpp | 6 +- src/xbt/xbt_log_layout_simple.cpp | 6 +- teshsuite/mc/CMakeLists.txt | 15 +- teshsuite/mc/mutex-handling/mutex-handling.c | 84 ---------- .../mc/mutex-handling/mutex-handling.cpp | 89 +++++++++++ .../mc/mutex-handling/mutex-handling_d.xml | 11 -- teshsuite/msg/CMakeLists.txt | 59 ++++--- teshsuite/surf/lmm_usage/lmm_usage.cpp | 4 +- teshsuite/surf/maxmin_bench/maxmin_bench.cpp | 4 +- teshsuite/xbt/log_large/log_large.c | 6 +- teshsuite/xbt/log_usage/log_usage.c | 4 +- .../parallel_log_crashtest.cpp | 4 +- teshsuite/xbt/parmap_bench/parmap_bench.cpp | 4 +- teshsuite/xbt/parmap_test/parmap_test.cpp | 4 +- tools/cmake/DefinePackages.cmake | 9 +- tools/cmake/Option.cmake | 1 + tools/graphicator/CMakeLists.txt | 20 +-- 34 files changed, 476 insertions(+), 545 deletions(-) delete mode 100644 examples/smpi/smpi_msg_masterslave/masterslave_mailbox_smpi.c delete mode 100644 examples/smpi/smpi_msg_masterslave/msg_smpi.tesh rename examples/smpi/{smpi_msg_masterslave => smpi_s4u_masterslave}/CMakeLists.txt (55%) rename examples/smpi/{smpi_msg_masterslave => smpi_s4u_masterslave}/deployment_masterslave_mailbox_smpi.xml (80%) create mode 100644 examples/smpi/smpi_s4u_masterslave/masterslave_mailbox_smpi.cpp create mode 100644 examples/smpi/smpi_s4u_masterslave/s4u_smpi.tesh delete mode 100644 teshsuite/mc/mutex-handling/mutex-handling.c create mode 100644 teshsuite/mc/mutex-handling/mutex-handling.cpp delete mode 100644 teshsuite/mc/mutex-handling/mutex-handling_d.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index adf4eecccc..f3e237c72e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,6 +231,11 @@ if(enable_ns3) endif() endif() +set(SIMGRID_HAVE_MSG 0) +if(enable_MSG) + set(SIMGRID_HAVE_MSG 1) +endif() + if(WIN32) set(Boost_USE_STATIC_LIBS 1) endif() @@ -407,6 +412,10 @@ endif() mark_as_advanced(PATH_LIBDW_H) mark_as_advanced(PATH_LIBDW_LIB) +if(enable_java AND NOT enable_MSG) + message(FATAL_ERROR "Cannot activate the Java bindings without the MSG module. Either add -Denable_MSG=ON or -Denable_java=OFF") +endif() + if (enable_model-checking AND enable_ns3) message(FATAL_ERROR "Cannot activate both model-checking and ns-3 bindings: ns-3 pulls too much dependencies for the MC to work") endif() @@ -927,23 +936,29 @@ message(" LDFlags .....................: ${CMAKE_C_LINK_FLAGS}") message(" with LTO ....................: ${enable_lto}") message("") +if (SIMGRID_HAVE_MSG) + message(" Compile MSG .................: ON") +else() + message(" Compile MSG .................: OFF") +endif() + if (SIMGRID_HAVE_NS3) - message(" Compile ns-3 ................: yes (path: ${NS3_PATH})") + message(" Compile ns-3 ................: ON (path: ${NS3_PATH})") else() - message(" Compile ns-3 ................: NO (hint: ${NS3_HINT})") + message(" Compile ns-3 ................: OFF (hint: ${NS3_HINT})") endif() if (${Java_FOUND}) - message(" Compile Java ................: yes") + message(" Compile Java ................: ON") message(" Native lib in jar .........: ${enable_lib_in_jar}") else() - message(" Compile Java ................: NO") + message(" Compile Java ................: OFF") endif() if(pybind11_FOUND) message(" Compile Python bindings .....: ${enable_python}") message(" module ....................: ${PYTHON_MODULE_PREFIX}simgrid${PYTHON_MODULE_EXTENSION}") else() - message(" Compile Python bindings .....: NO (disabled, or pybind11 not found)") + message(" Compile Python bindings .....: OFF (disabled, or pybind11 not found)") endif() message(" Compile Lua .................: ${SIMGRID_HAVE_LUA}") message(" Compile Smpi ................: ${HAVE_SMPI}") diff --git a/ChangeLog b/ChangeLog index acd2d0ba06..57795a61fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,11 +3,13 @@ SimGrid (3.24.1) NOT RELEASED YET (v3.25 expected December 22. 2029, 04:19 UTC) Important user-visible changes: -- Great improvement of the Python binding's stability. +- Improve the Python usability (stability and documentation). - A nasty synchronization bug was ironed out, see also below. -- Reorganization of the C & Python bindings' documentation. - - Python was organized as a separate tree, C was not part of the doc + - Python's doc was organized as a separate tree, now integrated with C++. + - C bindings of S4U were not part of the doc. - The C++ doc was also improved as methods are now split by theme. +- Further deprecate MSG: you now have to pass -Denable-MSG=ON to cmake. + - The plan is to completely remove MSG by the end of 2020. - SimDAG++: Automatic dependencies on S4U activities (experimental) - Some features are already implemented but not all of them - Cannot block an activity until it's scheduled on a resource diff --git a/MANIFEST.in b/MANIFEST.in index fa9a8e1a37..1951c3d035 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -545,9 +545,9 @@ include examples/smpi/replay_multiple_manual_deploy/workload_compute_consecutive include examples/smpi/replay_multiple_manual_deploy/workload_compute_simple include examples/smpi/replay_multiple_manual_deploy/workload_mixed2_same_time include examples/smpi/replay_multiple_manual_deploy/workload_mixed2_same_time_and_resources -include examples/smpi/smpi_msg_masterslave/deployment_masterslave_mailbox_smpi.xml -include examples/smpi/smpi_msg_masterslave/masterslave_mailbox_smpi.c -include examples/smpi/smpi_msg_masterslave/msg_smpi.tesh +include examples/smpi/smpi_s4u_masterslave/deployment_masterslave_mailbox_smpi.xml +include examples/smpi/smpi_s4u_masterslave/masterslave_mailbox_smpi.c +include examples/smpi/smpi_s4u_masterslave/msg_smpi.tesh include examples/smpi/trace/trace.c include examples/smpi/trace/trace.tesh include examples/smpi/trace_call_location/adjust @@ -563,9 +563,8 @@ include teshsuite/mc/dwarf-expression/dwarf-expression.cpp include teshsuite/mc/dwarf-expression/dwarf-expression.tesh include teshsuite/mc/dwarf/dwarf.cpp include teshsuite/mc/dwarf/dwarf.tesh -include teshsuite/mc/mutex-handling/mutex-handling.c +include teshsuite/mc/mutex-handling/mutex-handling.cpp include teshsuite/mc/mutex-handling/mutex-handling.tesh -include teshsuite/mc/mutex-handling/mutex-handling_d.xml include teshsuite/mc/mutex-handling/without-mutex-handling.tesh include teshsuite/mc/random-bug/random-bug-nocrash.tesh include teshsuite/mc/random-bug/random-bug-replay.tesh @@ -1858,8 +1857,6 @@ include docs/source/tuto_smpi/img/big-picture.svg include docs/source/tuto_smpi/img/lu.S.4.png include docs/source/tuto_smpi/roundtrip.c include examples/README.rst -include examples/deprecated/java/.classpath -include examples/deprecated/java/.project include examples/deprecated/java/CMakeLists.txt include examples/deprecated/msg/CMakeLists.txt include examples/deprecated/msg/mc/CMakeLists.txt @@ -1947,11 +1944,9 @@ include examples/python/async-waitany/async-waitany_d.xml include examples/s4u/CMakeLists.txt include examples/smpi/CMakeLists.txt include examples/smpi/NAS/CMakeLists.txt -include examples/smpi/mc/non_deterministic.tesh -include examples/smpi/mc/only_send_deterministic.tesh include examples/smpi/replay_multiple/CMakeLists.txt include examples/smpi/replay_multiple_manual_deploy/CMakeLists.txt -include examples/smpi/smpi_msg_masterslave/CMakeLists.txt +include examples/smpi/smpi_s4u_masterslave/CMakeLists.txt include include/simgrid/Exception.hpp include include/simgrid/actor.h include include/simgrid/barrier.h @@ -2070,7 +2065,6 @@ include include/xbt/xbt_os_time.h include setup.py include src/bindings/java/JavaContext.cpp include src/bindings/java/JavaContext.hpp -include src/bindings/java/MANIFEST.in include src/bindings/java/jmsg.cpp include src/bindings/java/jmsg.hpp include src/bindings/java/jmsg_as.cpp @@ -2125,16 +2119,6 @@ include src/bindings/lua/lua_utils.cpp include src/bindings/lua/lua_utils.hpp include src/bindings/lua/simgrid_lua.cpp include src/bindings/lua/simgrid_lua.hpp -include src/bindings/python/simgrid_python.cpp -include src/include/catch.hpp -include src/include/mc/datatypes.h -include src/include/mc/mc.h -include src/include/simgrid/sg_config.hpp -include src/include/surf/surf.hpp -include src/include/xbt/coverage.h -include src/include/xbt/mmalloc.h -include src/include/xbt/parmap.hpp -include src/include/xxhash.hpp include src/instr/instr_config.cpp include src/instr/instr_interface.cpp include src/instr/instr_paje_containers.cpp @@ -2273,7 +2257,6 @@ include src/mc/mc_hash.cpp include src/mc/mc_hash.hpp include src/mc/mc_ignore.hpp include src/mc/mc_memory.cpp -include src/mc/mc_mmu.hpp include src/mc/mc_private.hpp include src/mc/mc_record.cpp include src/mc/mc_record.hpp @@ -2307,7 +2290,6 @@ include src/mc/sosp/Snapshot_test.cpp include src/msg/msg_comm.cpp include src/msg/msg_global.cpp include src/msg/msg_legacy.cpp -include src/msg/msg_private.hpp include src/msg/msg_process.cpp include src/msg/msg_task.cpp include src/plugins/dirty_page_tracking.cpp @@ -2339,31 +2321,20 @@ include src/s4u/s4u_Mutex.cpp include src/s4u/s4u_Netzone.cpp include src/s4u/s4u_Semaphore.cpp include src/s4u/s4u_Storage.cpp -include src/simdag/dax.dtd -include src/simdag/dax_dtd.c -include src/simdag/dax_dtd.h include src/simdag/sd_daxloader.cpp include src/simdag/sd_dotloader.cpp include src/simdag/sd_global.cpp include src/simdag/sd_task.cpp -include src/simdag/simdag_private.hpp include src/simgrid/Exception.cpp include src/simgrid/sg_config.cpp include src/simgrid/sg_version.cpp include src/simgrid/util.hpp include src/simix/libsmx.cpp include src/simix/popping.cpp -include src/simix/popping_accessors.hpp -include src/simix/popping_bodies.cpp -include src/simix/popping_enum.h include src/simix/popping_generated.cpp -include src/simix/popping_private.hpp -include src/simix/simcalls.in -include src/simix/simcalls.py include src/simix/smx_context.cpp include src/simix/smx_deployment.cpp include src/simix/smx_global.cpp -include src/simix/smx_private.hpp include src/smpi/bindings/smpi_f77.cpp include src/smpi/bindings/smpi_f77_coll.cpp include src/smpi/bindings/smpi_f77_comm.cpp @@ -2464,9 +2435,7 @@ include src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp include src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp include src/smpi/colls/bcast/bcast-scatter-rdb-allgather.cpp include src/smpi/colls/coll_tuned_topo.cpp -include src/smpi/colls/coll_tuned_topo.hpp include src/smpi/colls/colls_global.cpp -include src/smpi/colls/colls_private.hpp include src/smpi/colls/gather/gather-mvapich.cpp include src/smpi/colls/gather/gather-ompi.cpp include src/smpi/colls/reduce/reduce-NTSL.cpp @@ -2488,10 +2457,8 @@ include src/smpi/colls/smpi_default_selector.cpp include src/smpi/colls/smpi_intel_mpi_selector.cpp include src/smpi/colls/smpi_mpich_selector.cpp include src/smpi/colls/smpi_mvapich2_selector.cpp -include src/smpi/colls/smpi_mvapich2_selector_stampede.hpp include src/smpi/colls/smpi_nbc_impl.cpp include src/smpi/colls/smpi_openmpi_selector.cpp -include src/smpi/include/private.hpp include src/smpi/include/smpi_actor.hpp include src/smpi/include/smpi_coll.hpp include src/smpi/include/smpi_comm.hpp @@ -2509,7 +2476,6 @@ include src/smpi/include/smpi_op.hpp include src/smpi/include/smpi_request.hpp include src/smpi/include/smpi_status.hpp include src/smpi/include/smpi_topo.hpp -include src/smpi/include/smpi_utils.hpp include src/smpi/include/smpi_win.hpp include src/smpi/internals/instr_smpi.cpp include src/smpi/internals/smpi_actor.cpp @@ -2543,8 +2509,6 @@ include src/smpi/plugins/ampi/instr_ampi.hpp include src/smpi/plugins/load_balancer/LoadBalancer.cpp include src/smpi/plugins/load_balancer/load_balancer.hpp include src/smpi/plugins/sampi_loadbalancer.cpp -include src/smpi/smpi_main.c -include src/smpi/smpi_replay_main.cpp include src/smpi/smpicc.in include src/smpi/smpicxx.in include src/smpi/smpif90.in @@ -2552,90 +2516,48 @@ include src/smpi/smpiff.in include src/smpi/smpirun.in include src/smpi/smpitools.sh include src/surf/HostImpl.cpp -include src/surf/HostImpl.hpp include src/surf/StorageImpl.cpp -include src/surf/StorageImpl.hpp include src/surf/cpu_cas01.cpp -include src/surf/cpu_cas01.hpp include src/surf/cpu_interface.cpp -include src/surf/cpu_interface.hpp include src/surf/cpu_ti.cpp -include src/surf/cpu_ti.hpp include src/surf/disk_s19.cpp -include src/surf/disk_s19.hpp include src/surf/host_clm03.cpp -include src/surf/host_clm03.hpp include src/surf/network_cm02.cpp -include src/surf/network_cm02.hpp include src/surf/network_constant.cpp -include src/surf/network_constant.hpp include src/surf/network_ib.cpp -include src/surf/network_ib.hpp include src/surf/network_interface.cpp -include src/surf/network_interface.hpp include src/surf/network_ns3.cpp -include src/surf/network_ns3.hpp include src/surf/network_smpi.cpp -include src/surf/network_smpi.hpp include src/surf/network_wifi.cpp -include src/surf/network_wifi.hpp include src/surf/ns3/ns3_simulator.cpp -include src/surf/ns3/ns3_simulator.hpp include src/surf/ptask_L07.cpp -include src/surf/ptask_L07.hpp include src/surf/sg_platf.cpp include src/surf/storage_n11.cpp -include src/surf/storage_n11.hpp include src/surf/surf_c_bindings.cpp include src/surf/surf_interface.cpp -include src/surf/surf_interface.hpp -include src/surf/surf_private.hpp include src/surf/xml/platf.hpp include src/surf/xml/platf_private.hpp -include src/surf/xml/simgrid.dtd -include src/surf/xml/simgrid_dtd.c -include src/surf/xml/simgrid_dtd.h include src/surf/xml/surfxml_parseplatf.cpp include src/surf/xml/surfxml_sax_cb.cpp include src/xbt/OsSemaphore.hpp include src/xbt/PropertyHolder.cpp include src/xbt/automaton/automaton.c -include src/xbt/automaton/automaton_lexer.yy.c include src/xbt/automaton/automatonparse_promela.c -include src/xbt/automaton/parserPromela.lex -include src/xbt/automaton/parserPromela.tab.cacc -include src/xbt/automaton/parserPromela.tab.hacc -include src/xbt/automaton/parserPromela.yacc include src/xbt/backtrace.cpp include src/xbt/config.cpp include src/xbt/config_test.cpp include src/xbt/dict.cpp include src/xbt/dict_cursor.c include src/xbt/dict_elm.c -include src/xbt/dict_private.h include src/xbt/dict_test.cpp include src/xbt/dynar.cpp include src/xbt/dynar_test.cpp include src/xbt/exception.cpp include src/xbt/graph.c include src/xbt/log.cpp -include src/xbt/log_private.hpp include src/xbt/mallocator.c -include src/xbt/mallocator_private.h include src/xbt/memory_map.cpp include src/xbt/memory_map.hpp -include src/xbt/mmalloc/mfree.c -include src/xbt/mmalloc/mm.c -include src/xbt/mmalloc/mm_legacy.c -include src/xbt/mmalloc/mm_module.c -include src/xbt/mmalloc/mmalloc.c -include src/xbt/mmalloc/mmalloc.info -include src/xbt/mmalloc/mmalloc.texi -include src/xbt/mmalloc/mmorecore.c -include src/xbt/mmalloc/mmprivate.h -include src/xbt/mmalloc/mrealloc.c -include src/xbt/mmalloc/swag.c -include src/xbt/mmalloc/swag.h include src/xbt/parmap.cpp include src/xbt/random.cpp include src/xbt/random_test.cpp @@ -2656,7 +2578,6 @@ include src/xbt/xbt_virtu.cpp include src/xbt_modinter.h include teshsuite/java/CMakeLists.txt include teshsuite/lua/CMakeLists.txt -include teshsuite/lua/lua_platforms.tesh include teshsuite/mc/CMakeLists.txt include teshsuite/msg/CMakeLists.txt include teshsuite/python/CMakeLists.txt @@ -2735,7 +2656,6 @@ include tools/doxygen/fig2dev_postprocessor.pl include tools/doxygen/list_routing_models_examples.sh include tools/doxygen/xbt_log_extract_hierarchy.pl include tools/graphicator/CMakeLists.txt -include tools/lualib.patch include tools/smpi/generate_smpi_defines.pl include tools/stack-cleaner/README include tools/stack-cleaner/as @@ -2745,4 +2665,3 @@ include tools/stack-cleaner/clean-stack-filter include tools/stack-cleaner/compiler-wrapper include tools/stack-cleaner/fortran include tools/tesh/CMakeLists.txt -include tools/tesh/generate_tesh diff --git a/NEWS b/NEWS index 9f247840dc..b0bd060240 100644 --- a/NEWS +++ b/NEWS @@ -7,9 +7,9 @@ __ _____ _ __ ___(_) ___ _ __ |___ / |___ \| ___| The Dependstable Snake Release. - * Great improvement of the Python binding's stability. - * Reorganization of the C & Python bindings' documentation. - * SimDAG++: Automatic dependencies on S4U activities (experimental) + * Improve the Python usability (stability and documentation). + * Further deprecate MSG: you now have to pass -Denable-MSG=ON to cmake. + * SimDAG++: Automatic dependencies on S4U activities (experimental). * (+ many bug fixes and internal refactoring) _ _____ ____ _ _ __ _____ _ __ ___(_) ___ _ __ |___ / |___ \| || | diff --git a/examples/deprecated/msg/CMakeLists.txt b/examples/deprecated/msg/CMakeLists.txt index ac04e1aa3c..481d2e47ee 100644 --- a/examples/deprecated/msg/CMakeLists.txt +++ b/examples/deprecated/msg/CMakeLists.txt @@ -5,25 +5,29 @@ foreach(x app-masterworker cloud-masterworker synchro-semaphore trace-categories trace-route-user-variables trace-link-user-variables trace-masterworker trace-process-migration trace-host-user-variables) - add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) - target_link_libraries(${x} simgrid) - set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) - add_dependencies(tests ${x}) + if(enable_MSG) + add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) + target_link_libraries(${x} simgrid) + set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) + add_dependencies(tests ${x}) + endif() set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) endforeach() -if(SIMGRID_HAVE_NS3) +if(SIMGRID_HAVE_NS3 AND enable_MSG) add_executable (network-ns3 EXCLUDE_FROM_ALL network-ns3/network-ns3.c) target_link_libraries(network-ns3 simgrid) set_target_properties(network-ns3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/network-ns3) add_dependencies(tests network-ns3) endif() -add_executable (dht-kademlia EXCLUDE_FROM_ALL dht-kademlia/dht-kademlia.c dht-kademlia/node.c dht-kademlia/routing_table.c dht-kademlia/task.c dht-kademlia/answer.c) -target_link_libraries(dht-kademlia simgrid) -set_target_properties(dht-kademlia PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dht-kademlia) -add_dependencies(tests dht-kademlia) +if(enable_MSG) + add_executable (dht-kademlia EXCLUDE_FROM_ALL dht-kademlia/dht-kademlia.c dht-kademlia/node.c dht-kademlia/routing_table.c dht-kademlia/task.c dht-kademlia/answer.c) + target_link_libraries(dht-kademlia simgrid) + set_target_properties(dht-kademlia PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dht-kademlia) + add_dependencies(tests dht-kademlia) +endif() foreach (file answer dht-kademlia node routing_table task) set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.c ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.h) endforeach() @@ -51,54 +55,56 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/a ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/onelink_d.xml ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml PARENT_SCOPE) -foreach(x app-masterworker cloud-masterworker - dht-pastry dht-kademlia platform-failures - energy-vm - process-create - synchro-semaphore) - ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" - --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x} - --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh) -endforeach() +if(enable_MSG) + foreach(x app-masterworker cloud-masterworker + dht-pastry dht-kademlia platform-failures + energy-vm + process-create + synchro-semaphore) + ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" + --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x} + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh) + endforeach() -foreach (x trace-categories trace-route-user-variables trace-link-user-variables trace-masterworker trace-process-migration trace-host-user-variables) - ADD_TESH(msg-${x} --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x} - --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - --cd ${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x} - ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh) -endforeach() + foreach (x trace-categories trace-route-user-variables trace-link-user-variables trace-masterworker trace-process-migration trace-host-user-variables) + ADD_TESH(msg-${x} --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x} + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + --cd ${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x} + ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh) + endforeach() -if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8) - # Thread-local storage (TLS) is needed for parallel execution, but it doesn't - # play well with Ucontexts on 64bit SunOS (at least on x86_64). - set(parallel-factories "thread;raw;boost") -else() - set(parallel-factories "thread;ucontext;raw;boost") -endif() -ADD_TESH_FACTORIES(msg-dht-kademlia-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO} - --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/dht-kademlia - --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia/dht-kademlia.tesh) + if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8) + # Thread-local storage (TLS) is needed for parallel execution, but it doesn't + # play well with Ucontexts on 64bit SunOS (at least on x86_64). + set(parallel-factories "thread;raw;boost") + else() + set(parallel-factories "thread;ucontext;raw;boost") + endif() + ADD_TESH_FACTORIES(msg-dht-kademlia-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO} + --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/dht-kademlia + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia/dht-kademlia.tesh) -ADD_TESH_FACTORIES(app-masterworker-multicore "thread;ucontext;raw;boost" - --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker - --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/app-masterworker - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker/app-masterworker-multicore.tesh) -ADD_TESH_FACTORIES(app-masterworker-vivaldi "thread;ucontext;raw;boost" - --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker - --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/app-masterworker - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi.tesh) + ADD_TESH_FACTORIES(app-masterworker-multicore "thread;ucontext;raw;boost" + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker + --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/app-masterworker + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker/app-masterworker-multicore.tesh) + ADD_TESH_FACTORIES(app-masterworker-vivaldi "thread;ucontext;raw;boost" + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker + --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/app-masterworker + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi.tesh) -if(SIMGRID_HAVE_NS3) - ADD_TESH_FACTORIES(msg-network-ns3 "thread;ucontext;raw;boost" - --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg - --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/network-ns3/network-ns3.tesh) -endif() + if(SIMGRID_HAVE_NS3) + ADD_TESH_FACTORIES(msg-network-ns3 "thread;ucontext;raw;boost" + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg + --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/network-ns3/network-ns3.tesh) + endif() +endif(enable_MSG) \ No newline at end of file diff --git a/examples/deprecated/msg/mc/CMakeLists.txt b/examples/deprecated/msg/mc/CMakeLists.txt index 0d4d3edcb1..e22c4a0943 100644 --- a/examples/deprecated/msg/mc/CMakeLists.txt +++ b/examples/deprecated/msg/mc/CMakeLists.txt @@ -1,5 +1,5 @@ foreach (x bugged1 bugged2 bugged3 centralized_mutex electric_fence bugged1_liveness bugged2_liveness) - if(SIMGRID_HAVE_MC) + if(SIMGRID_HAVE_MC AND SIMGRID_HAVE_MSG) add_executable (${x} EXCLUDE_FROM_ALL ${x}.c) target_link_libraries(${x} simgrid) add_dependencies(tests ${x}) @@ -8,7 +8,7 @@ foreach (x bugged1 bugged2 bugged3 centralized_mutex electric_fence bugged1_live set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/deploy_${x}.xml) endforeach() -if(SIMGRID_HAVE_MC) +if(SIMGRID_HAVE_MC AND SIMGRID_HAVE_MSG) if(HAVE_C_STACK_CLEANER) add_executable (bugged1_liveness_cleaner_on EXCLUDE_FROM_ALL bugged1_liveness.c) target_link_libraries(bugged1_liveness_cleaner_on simgrid) diff --git a/examples/smpi/replay_multiple/replay_multiple.c b/examples/smpi/replay_multiple/replay_multiple.c index 469a68a7fd..6bf7d76f3a 100644 --- a/examples/smpi/replay_multiple/replay_multiple.c +++ b/examples/smpi/replay_multiple/replay_multiple.c @@ -4,8 +4,9 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "simgrid/msg.h" #include "mpi.h" +#include "simgrid/engine.h" +#include "xbt/str.h" #include #include @@ -27,16 +28,14 @@ static int smpi_replay(int argc, char *argv[]) { } int main(int argc, char *argv[]){ - msg_error_t res; - - MSG_init(&argc, argv); + simgrid_init(&argc, argv); SMPI_init(); xbt_assert(argc > 3, "Usage: %s description_file platform_file deployment_file\n" "\tExample: %s smpi_multiple_apps msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); /* Simulation setting */ - MSG_create_environment(argv[2]); + simgrid_load_platform(argv[2]); /* Application deployment: read the description file in order to identify instances to launch */ FILE* fp = fopen(argv[1], "r"); @@ -63,12 +62,11 @@ int main(int argc, char *argv[]){ fclose(fp); - MSG_launch_application(argv[3]); - - res = MSG_main(); + simgrid_load_deployment(argv[3]); + simgrid_run(); - XBT_INFO("Simulation time %g", MSG_get_clock()); + XBT_INFO("Simulation time %g", simgrid_get_clock()); SMPI_finalize(); - return res != MSG_OK; + return 0; } diff --git a/examples/smpi/smpi_msg_masterslave/masterslave_mailbox_smpi.c b/examples/smpi/smpi_msg_masterslave/masterslave_mailbox_smpi.c deleted file mode 100644 index 1947029f9e..0000000000 --- a/examples/smpi/smpi_msg_masterslave/masterslave_mailbox_smpi.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "simgrid/msg.h" -#include "mpi.h" - -#include /* snprintf */ - -XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); - -static int master(int argc, char *argv[]) -{ - xbt_assert(argc == 5); - long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s"); - double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s"); - double task_comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); - long slaves_count = xbt_str_parse_int(argv[4], "Invalid amount of slaves: %s"); - - XBT_INFO("Got %ld slaves and %ld tasks to process", slaves_count, number_of_tasks); - - for (int i = 0; i < number_of_tasks; i++) { - char mailbox[256]; - char sprintf_buffer[256]; - - snprintf(mailbox,256, "slave-%ld", i % slaves_count); - snprintf(sprintf_buffer,256, "Task_%d", i); - msg_task_t task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL); - if (number_of_tasks < 10000 || i % 10000 == 0) - XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", MSG_task_get_name(task), number_of_tasks, mailbox); - - MSG_task_send(task, mailbox); - } - - XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over."); - for (int i = 0; i < slaves_count; i++) { - char mailbox[80]; - - snprintf(mailbox,80, "slave-%ld", i % slaves_count); - msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0); - MSG_task_send(finalize, mailbox); - } - - return 0; -} - -static int master_mpi(int argc, char *argv[]) -{ - MPI_Init(&argc, &argv); - - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - XBT_INFO("here for rank %d", rank); - int test[1000]={rank}; - if(rank==0) - MPI_Send(&test, 1000, MPI_INT, 1, 1, MPI_COMM_WORLD); - else - MPI_Recv(&test, 1000, MPI_INT, 0, 1, MPI_COMM_WORLD, MPI_STATUSES_IGNORE); - - XBT_INFO("After comm %d", rank); - MPI_Finalize(); - - XBT_INFO("After finalize %d %d", rank, test[0]); - return 0; -} - -static int alltoall_mpi(int argc, char *argv[]) -{ - MPI_Init(&argc, &argv); - - int rank; - int size; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); - XBT_INFO("alltoall for rank %d", rank); - int* out=malloc(1000*size*sizeof(int)); - int* in=malloc(1000*size*sizeof(int)); - MPI_Alltoall(out, 1000, MPI_INT,in, 1000, MPI_INT, MPI_COMM_WORLD); - - XBT_INFO("after alltoall %d", rank); - free(out); - free(in); - MPI_Finalize(); - return 0; -} - -static int slave(int argc, char *argv[]) -{ - xbt_assert(argc == 2); - msg_task_t task = NULL; - XBT_ATTRIB_UNUSED int res; - int id = -1; - char mailbox[80]; - XBT_ATTRIB_UNUSED int read; - - read = sscanf(argv[1], "%d", &id); - xbt_assert(read, "Invalid argument %s\n", argv[1]); - - snprintf(mailbox,80, "slave-%d", id); - - while (1) { - res = MSG_task_receive(&(task), mailbox); - xbt_assert(res == MSG_OK, "MSG_task_get failed"); - - if (strcmp(MSG_task_get_name(task), "finalize")==0) { - MSG_task_destroy(task); - break; - } - MSG_task_execute(task); - MSG_task_destroy(task); - task = NULL; - } - XBT_INFO("I'm done. See you!"); - - return 0; -} - -int main(int argc, char *argv[]) -{ - msg_error_t res; - - MSG_init(&argc, argv); - SMPI_init(); - - xbt_assert(argc > 2,"Usage: %s platform_file deployment_file\n" - "\nexample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); - - MSG_create_environment(argv[1]); - - MSG_function_register("master", master); - MSG_function_register("slave", slave); - // launch two MPI applications as well, one using master_mpi function as main on 2 nodes - SMPI_app_instance_register("master_mpi", master_mpi,2); - // the second performing an alltoall on 4 nodes - SMPI_app_instance_register("alltoall_mpi", alltoall_mpi,4); - MSG_launch_application(argv[2]); - - res = MSG_main(); - - XBT_INFO("Simulation time %g", MSG_get_clock()); - - SMPI_finalize(); - return res != MSG_OK; -} diff --git a/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh b/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh deleted file mode 100644 index ee2b1a0ae8..0000000000 --- a/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh +++ /dev/null @@ -1,43 +0,0 @@ -p Test the use of SMPI+MSG in the same file, as well as several different SMPI instances at the same time -$ ./masterslave_mailbox_smpi ${srcdir:=.}/../../platforms/small_platform_with_routers.xml ${srcdir:=.}/deployment_masterslave_mailbox_smpi.xml --log=smpi.:info --cfg=smpi/simulate-computation:no -> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/simulate-computation' to 'no' -> [0.000000] [smpi_config/INFO] You did not set the power of the host running the simulation. The timings will certainly not be accurate. Use the option "--cfg=smpi/host-speed:" to set its value. Check https://simgrid.org/doc/latest/Configuring_SimGrid.html#automatic-benchmarking-of-smpi-code for more information. -> [Tremblay:master:(1) 0.000000] [msg_test/INFO] Got 1 slaves and 20 tasks to process -> [Tremblay:master:(1) 0.000000] [msg_test/INFO] Sending "Task_0" (of 20) to mailbox "slave-0" -> [Ginette:master_mpi:(3) 0.000000] [msg_test/INFO] here for rank 0 -> [Bourassa:master_mpi:(4) 0.000000] [msg_test/INFO] here for rank 1 -> [Ginette:alltoall_mpi:(5) 0.000000] [msg_test/INFO] alltoall for rank 0 -> [Bourassa:alltoall_mpi:(6) 0.000000] [msg_test/INFO] alltoall for rank 1 -> [Jupiter:alltoall_mpi:(7) 0.000000] [msg_test/INFO] alltoall for rank 2 -> [Fafard:alltoall_mpi:(8) 0.000000] [msg_test/INFO] alltoall for rank 3 -> [Ginette:master_mpi:(3) 0.000000] [msg_test/INFO] After comm 0 -> [Ginette:master_mpi:(3) 0.000000] [msg_test/INFO] After finalize 0 0 -> [Tremblay:master:(1) 0.002265] [msg_test/INFO] Sending "Task_1" (of 20) to mailbox "slave-0" -> [Bourassa:master_mpi:(4) 0.016868] [msg_test/INFO] After comm 1 -> [Bourassa:master_mpi:(4) 0.016868] [msg_test/INFO] After finalize 1 0 -> [Ginette:alltoall_mpi:(5) 0.098642] [msg_test/INFO] after alltoall 0 -> [Fafard:alltoall_mpi:(8) 0.099069] [msg_test/INFO] after alltoall 3 -> [Bourassa:alltoall_mpi:(6) 0.127526] [msg_test/INFO] after alltoall 1 -> [Jupiter:alltoall_mpi:(7) 0.127802] [msg_test/INFO] after alltoall 2 -> [Tremblay:master:(1) 0.514241] [msg_test/INFO] Sending "Task_2" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 1.026216] [msg_test/INFO] Sending "Task_3" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 1.538191] [msg_test/INFO] Sending "Task_4" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 2.050166] [msg_test/INFO] Sending "Task_5" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 2.562142] [msg_test/INFO] Sending "Task_6" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 3.074117] [msg_test/INFO] Sending "Task_7" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 3.586092] [msg_test/INFO] Sending "Task_8" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 4.098067] [msg_test/INFO] Sending "Task_9" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 4.610043] [msg_test/INFO] Sending "Task_10" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 5.122018] [msg_test/INFO] Sending "Task_11" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 5.633993] [msg_test/INFO] Sending "Task_12" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 6.145968] [msg_test/INFO] Sending "Task_13" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 6.657944] [msg_test/INFO] Sending "Task_14" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 7.169919] [msg_test/INFO] Sending "Task_15" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 7.681894] [msg_test/INFO] Sending "Task_16" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 8.193869] [msg_test/INFO] Sending "Task_17" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 8.705845] [msg_test/INFO] Sending "Task_18" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 9.217820] [msg_test/INFO] Sending "Task_19" (of 20) to mailbox "slave-0" -> [Tremblay:master:(1) 9.729795] [msg_test/INFO] All tasks have been dispatched. Let's tell everybody the computation is over. -> [Tremblay:slave:(2) 10.239700] [msg_test/INFO] I'm done. See you! -> [10.239700] [msg_test/INFO] Simulation time 10.2397 - diff --git a/examples/smpi/smpi_msg_masterslave/CMakeLists.txt b/examples/smpi/smpi_s4u_masterslave/CMakeLists.txt similarity index 55% rename from examples/smpi/smpi_msg_masterslave/CMakeLists.txt rename to examples/smpi/smpi_s4u_masterslave/CMakeLists.txt index 71bd37df5f..41e4dcf3a5 100644 --- a/examples/smpi/smpi_msg_masterslave/CMakeLists.txt +++ b/examples/smpi/smpi_s4u_masterslave/CMakeLists.txt @@ -1,12 +1,12 @@ if(enable_smpi) include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") - add_executable (masterslave_mailbox_smpi EXCLUDE_FROM_ALL masterslave_mailbox_smpi.c) + add_executable (masterslave_mailbox_smpi EXCLUDE_FROM_ALL masterslave_mailbox_smpi.cpp) target_link_libraries(masterslave_mailbox_smpi simgrid) - ADD_TESH_FACTORIES(smpi-msg-masterslave "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave --cd ${CMAKE_BINARY_DIR}/examples/smpi/smpi_msg_masterslave ${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_msg_masterslave/msg_smpi.tesh) + ADD_TESH_FACTORIES(smpi-s4u-masterslave "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_s4u_masterslave --cd ${CMAKE_BINARY_DIR}/examples/smpi/smpi_s4u_masterslave ${CMAKE_HOME_DIRECTORY}/examples/smpi/smpi_s4u_masterslave/s4u_smpi.tesh) add_dependencies(tests masterslave_mailbox_smpi) endif() -set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/msg_smpi.tesh PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/s4u_smpi.tesh PARENT_SCOPE) set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/deployment_masterslave_mailbox_smpi.xml PARENT_SCOPE) -set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_mailbox_smpi.c PARENT_SCOPE) +set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_mailbox_smpi.cpp PARENT_SCOPE) diff --git a/examples/smpi/smpi_msg_masterslave/deployment_masterslave_mailbox_smpi.xml b/examples/smpi/smpi_s4u_masterslave/deployment_masterslave_mailbox_smpi.xml similarity index 80% rename from examples/smpi/smpi_msg_masterslave/deployment_masterslave_mailbox_smpi.xml rename to examples/smpi/smpi_s4u_masterslave/deployment_masterslave_mailbox_smpi.xml index e9a3320fa1..6c6e9781ff 100644 --- a/examples/smpi/smpi_msg_masterslave/deployment_masterslave_mailbox_smpi.xml +++ b/examples/smpi/smpi_s4u_masterslave/deployment_masterslave_mailbox_smpi.xml @@ -6,12 +6,13 @@ - - - - - + + + + + + diff --git a/examples/smpi/smpi_s4u_masterslave/masterslave_mailbox_smpi.cpp b/examples/smpi/smpi_s4u_masterslave/masterslave_mailbox_smpi.cpp new file mode 100644 index 0000000000..1e583cee66 --- /dev/null +++ b/examples/smpi/smpi_s4u_masterslave/masterslave_mailbox_smpi.cpp @@ -0,0 +1,132 @@ +/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "mpi.h" +#include "simgrid/s4u.hpp" + +#include /* snprintf */ + +XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); + +static void master(std::vector args) +{ + xbt_assert(args.size() > 4, "The master function expects at least 3 arguments"); + + long tasks_count = std::stol(args[1]); + double compute_cost = std::stod(args[2]); + double communication_cost = std::stod(args[3]); + std::vector workers; + for (unsigned int i = 4; i < args.size(); i++) + workers.push_back(simgrid::s4u::Mailbox::by_name(args[i])); + + XBT_INFO("Got %zu workers and %ld tasks to process", workers.size(), tasks_count); + + for (int i = 0; i < tasks_count; i++) { /* For each task to be executed: */ + /* - Select a worker in a round-robin way */ + simgrid::s4u::Mailbox* mailbox = workers[i % workers.size()]; + + /* - Send the computation cost to that worker */ + XBT_INFO("Sending task %d of %ld to mailbox '%s'", i, tasks_count, mailbox->get_cname()); + mailbox->put(new double(compute_cost), communication_cost); + } + + XBT_INFO("All tasks have been dispatched. Request all workers to stop."); + for (unsigned int i = 0; i < workers.size(); i++) { + /* The workers stop when receiving a negative compute_cost */ + simgrid::s4u::Mailbox* mailbox = workers[i % workers.size()]; + + mailbox->put(new double(-1.0), 0); + } +} + +static void worker(std::vector args) +{ + xbt_assert(args.size() == 1, "The worker expects no argument"); + + const simgrid::s4u::Host* my_host = simgrid::s4u::this_actor::get_host(); + simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(my_host->get_name()); + + double compute_cost; + do { + const double* msg = static_cast(mailbox->get()); + compute_cost = *msg; + delete msg; + + if (compute_cost > 0) /* If compute_cost is valid, execute a computation of that cost */ + simgrid::s4u::this_actor::execute(compute_cost); + + } while (compute_cost > 0); /* Stop when receiving an invalid compute_cost */ + + XBT_INFO("Exiting now."); +} + +static int master_mpi(int argc, char* argv[]) +{ + MPI_Init(&argc, &argv); + + int rank; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + XBT_INFO("here for rank %d", rank); + int test[1000] = {rank}; + if (rank == 0) + MPI_Send(&test, 1000, MPI_INT, 1, 1, MPI_COMM_WORLD); + else + MPI_Recv(&test, 1000, MPI_INT, 0, 1, MPI_COMM_WORLD, MPI_STATUSES_IGNORE); + + XBT_INFO("After comm %d", rank); + MPI_Finalize(); + + XBT_INFO("After finalize %d %d", rank, test[0]); + return 0; +} + +static int alltoall_mpi(int argc, char* argv[]) +{ + MPI_Init(&argc, &argv); + + int rank; + int size; + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); + XBT_INFO("alltoall for rank %d", rank); + int* out = new int[1000 * size]; + int* in = new int[1000 * size]; + MPI_Alltoall(out, 1000, MPI_INT, in, 1000, MPI_INT, MPI_COMM_WORLD); + + XBT_INFO("after alltoall %d", rank); + delete[] out; + delete[] in; + MPI_Finalize(); + return 0; +} + +int main(int argc, char* argv[]) +{ + simgrid::s4u::Engine e(&argc, argv); + + SMPI_init(); + + xbt_assert(argc > 2, + "Usage: %s platform_file deployment_file\n" + "\nexample: %s msg_platform.xml msg_deployment.xml\n", + argv[0], argv[0]); + + e.load_platform(argv[1]); + + e.register_function("master", master); + e.register_function("worker", worker); + // launch two MPI applications as well, one using master_mpi function as main on 2 nodes + SMPI_app_instance_register("master_mpi", master_mpi, 2); + // the second performing an alltoall on 4 nodes + SMPI_app_instance_register("alltoall_mpi", alltoall_mpi, 4); + e.load_deployment(argv[2]); + + e.run(); + + XBT_INFO("Simulation time %g", e.get_clock()); + + SMPI_finalize(); + return 0; +} diff --git a/examples/smpi/smpi_s4u_masterslave/s4u_smpi.tesh b/examples/smpi/smpi_s4u_masterslave/s4u_smpi.tesh new file mode 100644 index 0000000000..252735bfb6 --- /dev/null +++ b/examples/smpi/smpi_s4u_masterslave/s4u_smpi.tesh @@ -0,0 +1,43 @@ +p Test the use of SMPI+MSG in the same file, as well as several different SMPI instances at the same time +$ ./masterslave_mailbox_smpi ${srcdir:=.}/../../platforms/small_platform_with_routers.xml ${srcdir:=.}/deployment_masterslave_mailbox_smpi.xml --log=smpi.:info --cfg=smpi/simulate-computation:no +> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/simulate-computation' to 'no' +> [0.000000] [smpi_config/INFO] You did not set the power of the host running the simulation. The timings will certainly not be accurate. Use the option "--cfg=smpi/host-speed:" to set its value. Check https://simgrid.org/doc/latest/Configuring_SimGrid.html#automatic-benchmarking-of-smpi-code for more information. +> [Tremblay:master:(1) 0.000000] [msg_test/INFO] Got 2 workers and 20 tasks to process +> [Tremblay:master:(1) 0.000000] [msg_test/INFO] Sending task 0 of 20 to mailbox 'Ginette' +> [Ginette:master_mpi:(4) 0.000000] [msg_test/INFO] here for rank 0 +> [Bourassa:master_mpi:(5) 0.000000] [msg_test/INFO] here for rank 1 +> [Ginette:alltoall_mpi:(6) 0.000000] [msg_test/INFO] alltoall for rank 0 +> [Bourassa:alltoall_mpi:(7) 0.000000] [msg_test/INFO] alltoall for rank 1 +> [Jupiter:alltoall_mpi:(8) 0.000000] [msg_test/INFO] alltoall for rank 2 +> [Fafard:alltoall_mpi:(9) 0.000000] [msg_test/INFO] alltoall for rank 3 +> [Ginette:master_mpi:(4) 0.000000] [msg_test/INFO] After comm 0 +> [Ginette:master_mpi:(4) 0.000000] [msg_test/INFO] After finalize 0 0 +> [Bourassa:master_mpi:(5) 0.016868] [msg_test/INFO] After comm 1 +> [Bourassa:master_mpi:(5) 0.016868] [msg_test/INFO] After finalize 1 0 +> [Ginette:alltoall_mpi:(6) 0.100219] [msg_test/INFO] after alltoall 0 +> [Fafard:alltoall_mpi:(9) 0.100625] [msg_test/INFO] after alltoall 3 +> [Tremblay:master:(1) 0.125464] [msg_test/INFO] Sending task 1 of 20 to mailbox 'Jupiter' +> [Bourassa:alltoall_mpi:(7) 0.129082] [msg_test/INFO] after alltoall 1 +> [Jupiter:alltoall_mpi:(8) 0.129358] [msg_test/INFO] after alltoall 2 +> [Tremblay:master:(1) 0.294619] [msg_test/INFO] Sending task 2 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 1.280294] [msg_test/INFO] Sending task 3 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 1.449449] [msg_test/INFO] Sending task 4 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 2.435124] [msg_test/INFO] Sending task 5 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 2.604279] [msg_test/INFO] Sending task 6 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 3.589954] [msg_test/INFO] Sending task 7 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 3.759109] [msg_test/INFO] Sending task 8 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 4.744784] [msg_test/INFO] Sending task 9 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 4.913938] [msg_test/INFO] Sending task 10 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 5.899614] [msg_test/INFO] Sending task 11 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 6.068768] [msg_test/INFO] Sending task 12 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 7.054444] [msg_test/INFO] Sending task 13 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 7.223598] [msg_test/INFO] Sending task 14 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 8.209273] [msg_test/INFO] Sending task 15 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 8.378428] [msg_test/INFO] Sending task 16 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 9.364103] [msg_test/INFO] Sending task 17 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 9.533258] [msg_test/INFO] Sending task 18 of 20 to mailbox 'Ginette' +> [Tremblay:master:(1) 10.518933] [msg_test/INFO] Sending task 19 of 20 to mailbox 'Jupiter' +> [Tremblay:master:(1) 10.688088] [msg_test/INFO] All tasks have been dispatched. Request all workers to stop. +> [Ginette:worker:(2) 11.566584] [msg_test/INFO] Exiting now. +> [Jupiter:worker:(3) 11.585598] [msg_test/INFO] Exiting now. +> [11.585598] [msg_test/INFO] Simulation time 11.5856 diff --git a/include/simgrid/config.h.in b/include/simgrid/config.h.in index 9d7589ac9d..b0252b0ab0 100644 --- a/include/simgrid/config.h.in +++ b/include/simgrid/config.h.in @@ -9,6 +9,8 @@ #define SIMGRID_PUBLIC_CONFIG_H #include +/* Was MSG compiled in? */ +#cmakedefine01 SIMGRID_HAVE_MSG /* Was Jedule compiled in? */ #cmakedefine01 SIMGRID_HAVE_JEDULE /* Was the Lua support compiled in? */ diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index b523d5a2b1..824af31f8b 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -239,7 +239,7 @@ void TRACE_mark(const char *mark_type, const char *mark_value) simgrid::xbt::string_printf("mark_type with name (%s) is not declared", mark_type)); } else { XBT_DEBUG("MARK %s %s", mark_type, mark_value); - new simgrid::instr::NewEvent(MSG_get_clock(), simgrid::instr::Container::get_root(), type, + new simgrid::instr::NewEvent(simgrid_get_clock(), simgrid::instr::Container::get_root(), type, type->get_entity_value(mark_value)); } } @@ -383,7 +383,7 @@ void TRACE_vm_variable_declare_with_color (const char *variable, const char *col */ void TRACE_vm_variable_set (const char *vm, const char *variable, double value) { - TRACE_vm_variable_set_with_time (MSG_get_clock(), vm, variable, value); + TRACE_vm_variable_set_with_time(simgrid_get_clock(), vm, variable, value); } /** @ingroup TRACE_user_variables @@ -397,7 +397,7 @@ void TRACE_vm_variable_set (const char *vm, const char *variable, double value) */ void TRACE_vm_variable_add (const char *vm, const char *variable, double value) { - TRACE_vm_variable_add_with_time (MSG_get_clock(), vm, variable, value); + TRACE_vm_variable_add_with_time(simgrid_get_clock(), vm, variable, value); } /** @ingroup TRACE_user_variables @@ -411,7 +411,7 @@ void TRACE_vm_variable_add (const char *vm, const char *variable, double value) */ void TRACE_vm_variable_sub (const char *vm, const char *variable, double value) { - TRACE_vm_variable_sub_with_time (MSG_get_clock(), vm, variable, value); + TRACE_vm_variable_sub_with_time(simgrid_get_clock(), vm, variable, value); } /** @ingroup TRACE_user_variables @@ -517,7 +517,7 @@ void TRACE_host_variable_declare_with_color (const char *variable, const char *c */ void TRACE_host_variable_set (const char *host, const char *variable, double value) { - TRACE_host_variable_set_with_time (MSG_get_clock(), host, variable, value); + TRACE_host_variable_set_with_time(simgrid_get_clock(), host, variable, value); } /** @ingroup TRACE_user_variables @@ -531,7 +531,7 @@ void TRACE_host_variable_set (const char *host, const char *variable, double val */ void TRACE_host_variable_add (const char *host, const char *variable, double value) { - TRACE_host_variable_add_with_time (MSG_get_clock(), host, variable, value); + TRACE_host_variable_add_with_time(simgrid_get_clock(), host, variable, value); } /** @ingroup TRACE_user_variables @@ -545,7 +545,7 @@ void TRACE_host_variable_add (const char *host, const char *variable, double val */ void TRACE_host_variable_sub (const char *host, const char *variable, double value) { - TRACE_host_variable_sub_with_time (MSG_get_clock(), host, variable, value); + TRACE_host_variable_sub_with_time(simgrid_get_clock(), host, variable, value); } /** @ingroup TRACE_user_variables @@ -664,7 +664,7 @@ void TRACE_link_variable_declare_with_color (const char *variable, const char *c */ void TRACE_link_variable_set (const char *link, const char *variable, double value) { - TRACE_link_variable_set_with_time (MSG_get_clock(), link, variable, value); + TRACE_link_variable_set_with_time(simgrid_get_clock(), link, variable, value); } /** @ingroup TRACE_user_variables @@ -678,7 +678,7 @@ void TRACE_link_variable_set (const char *link, const char *variable, double val */ void TRACE_link_variable_add (const char *link, const char *variable, double value) { - TRACE_link_variable_add_with_time (MSG_get_clock(), link, variable, value); + TRACE_link_variable_add_with_time(simgrid_get_clock(), link, variable, value); } /** @ingroup TRACE_user_variables @@ -692,7 +692,7 @@ void TRACE_link_variable_add (const char *link, const char *variable, double val */ void TRACE_link_variable_sub (const char *link, const char *variable, double value) { - TRACE_link_variable_sub_with_time (MSG_get_clock(), link, variable, value); + TRACE_link_variable_sub_with_time(simgrid_get_clock(), link, variable, value); } /** @ingroup TRACE_user_variables @@ -772,7 +772,7 @@ void TRACE_link_variable_sub_with_time (double time, const char *link, const cha */ void TRACE_link_srcdst_variable_set (const char *src, const char *dst, const char *variable, double value) { - TRACE_link_srcdst_variable_set_with_time (MSG_get_clock(), src, dst, variable, value); + TRACE_link_srcdst_variable_set_with_time(simgrid_get_clock(), src, dst, variable, value); } /** @ingroup TRACE_user_variables @@ -791,7 +791,7 @@ void TRACE_link_srcdst_variable_set (const char *src, const char *dst, const cha */ void TRACE_link_srcdst_variable_add (const char *src, const char *dst, const char *variable, double value) { - TRACE_link_srcdst_variable_add_with_time (MSG_get_clock(), src, dst, variable, value); + TRACE_link_srcdst_variable_add_with_time(simgrid_get_clock(), src, dst, variable, value); } /** @ingroup TRACE_user_variables @@ -810,7 +810,7 @@ void TRACE_link_srcdst_variable_add (const char *src, const char *dst, const cha */ void TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const char *variable, double value) { - TRACE_link_srcdst_variable_sub_with_time (MSG_get_clock(), src, dst, variable, value); + TRACE_link_srcdst_variable_sub_with_time(simgrid_get_clock(), src, dst, variable, value); } /** @ingroup TRACE_user_variables diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index 565c8cb601..fc6fde1ae2 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -24,6 +24,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_routing, instr, "Tracing platform hierarch static std::vector currentContainer; /* push and pop, used only in creation */ +std::string instr_pid(simgrid::s4u::Actor const& proc) +{ + return std::string(proc.get_name()) + "-" + std::to_string(proc.get_pid()); +} + static const char* instr_node_name(const s_xbt_node_t* node) { return static_cast(xbt_graph_node_get_data(node)); diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index 50e133df91..fc52b04fbf 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -6,14 +6,8 @@ #include "msg_private.hpp" #include "simgrid/Exception.hpp" #include "simgrid/s4u/Host.hpp" -#include "src/instr/instr_private.hpp" #include "src/simix/smx_private.hpp" -std::string instr_pid(simgrid::s4u::Actor const& proc) -{ - return std::string(proc.get_name()) + "-" + std::to_string(proc.get_pid()); -} - /******************************** Process ************************************/ /** @brief Creates and runs a new #msg_process_t. * diff --git a/src/xbt/xbt_log_layout_format.cpp b/src/xbt/xbt_log_layout_format.cpp index 670d4d5da4..6f488e4919 100644 --- a/src/xbt/xbt_log_layout_format.cpp +++ b/src/xbt/xbt_log_layout_format.cpp @@ -5,8 +5,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/engine.h" /* simgrid_get_clock */ #include "simgrid/host.h" -#include "simgrid/msg.h" /* MSG_get_clock */ #include "src/xbt/log_private.hpp" #include "xbt/sysdep.h" #include @@ -144,10 +144,10 @@ static int xbt_log_layout_format_doit(const s_xbt_log_layout_t* l, xbt_log_event show_string(ev->functionName); break; case 'd': /* date; LOG4J compliant */ - show_double(MSG_get_clock()); + show_double(simgrid_get_clock()); break; case 'r': /* application age; LOG4J compliant */ - show_double(MSG_get_clock()); + show_double(simgrid_get_clock()); break; case 'm': { /* user-provided message; LOG4J compliant */ int sz; diff --git a/src/xbt/xbt_log_layout_simple.cpp b/src/xbt/xbt_log_layout_simple.cpp index 5cc0a6531e..7d1c84bfd9 100644 --- a/src/xbt/xbt_log_layout_simple.cpp +++ b/src/xbt/xbt_log_layout_simple.cpp @@ -8,8 +8,8 @@ #include "xbt/sysdep.h" #include "src/xbt/log_private.hpp" -#include "simgrid/host.h" /* sg_host_self_get_name */ -#include "simgrid/msg.h" /* MSG_get_clock */ +#include "simgrid/engine.h" /* simgrid_get_clock */ +#include "simgrid/host.h" /* sg_host_self_get_name */ #include extern const char *xbt_log_priority_names[8]; @@ -45,7 +45,7 @@ static int xbt_log_layout_simple_doit(const s_xbt_log_layout_t*, xbt_log_event_t } /* Display the date */ - len = snprintf(p, rem_size, "%f] ", MSG_get_clock()); + len = snprintf(p, rem_size, "%f] ", simgrid_get_clock()); check_overflow(len); /* Display file position if not INFO */ diff --git a/teshsuite/mc/CMakeLists.txt b/teshsuite/mc/CMakeLists.txt index f7fdd36cea..451a0ea3d4 100644 --- a/teshsuite/mc/CMakeLists.txt +++ b/teshsuite/mc/CMakeLists.txt @@ -13,7 +13,7 @@ foreach(x dwarf dwarf-expression) endforeach() # MC-independent C++ binaries -foreach(x random-bug) +foreach(x random-bug mutex-handling) 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}) @@ -24,27 +24,16 @@ foreach(x random-bug) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp) endforeach() -add_executable (without-mutex-handling EXCLUDE_FROM_ALL mutex-handling/mutex-handling.c) +add_executable (without-mutex-handling EXCLUDE_FROM_ALL mutex-handling/mutex-handling.cpp) target_link_libraries(without-mutex-handling simgrid) set_target_properties(without-mutex-handling PROPERTIES COMPILE_FLAGS -DDISABLE_THE_MUTEX=1) set_target_properties(without-mutex-handling PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mutex-handling) add_dependencies(tests without-mutex-handling) -foreach(x mutex-handling) - add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) - target_link_libraries(${x} simgrid) - set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) - add_dependencies(tests ${x}) - - set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) - set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c) -endforeach() - set(teshsuite_src ${teshsuite_src} PARENT_SCOPE) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/random-bug/random-bug-nocrash.tesh ${CMAKE_CURRENT_SOURCE_DIR}/random-bug/random-bug-replay.tesh ${CMAKE_CURRENT_SOURCE_DIR}/mutex-handling/without-mutex-handling.tesh PARENT_SCOPE) -set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/mutex-handling/mutex-handling_d.xml PARENT_SCOPE) IF(SIMGRID_HAVE_MC) ADD_TESH(tesh-mc-dwarf --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/mc/dwarf --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf dwarf.tesh) diff --git a/teshsuite/mc/mutex-handling/mutex-handling.c b/teshsuite/mc/mutex-handling/mutex-handling.c deleted file mode 100644 index da35e9aab8..0000000000 --- a/teshsuite/mc/mutex-handling/mutex-handling.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2015-2020. The SimGrid Team. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -/* In this test, we have two senders sending one message to a common receiver. - * The receiver should be able to see any ordering between the two messages. - * If we model-check the application with assertions on a specific order of - * the messages (see the assertions in the receiver code), it should fail - * because both ordering are possible. - * - * If the senders sends the message directly, the current version of the MC - * finds that the ordering may differ and the MC find a counter-example. - * - * However, if the senders send the message in a mutex, the MC always let - * the first process take the mutex because it thinks that the effect of - * a mutex is purely local: the ordering of the messages is always the same - * and the MC does not find the counter-example. - */ - -#include "simgrid/modelchecker.h" -#include "simgrid/msg.h" -#include - -XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); - -#define BOX_NAME "box" - -#ifndef DISABLE_THE_MUTEX -static sg_mutex_t mutex = NULL; -#endif - -static int receiver(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[]) -{ - msg_task_t task = NULL; - - MSG_task_receive(&task, BOX_NAME); - MC_assert(strcmp(MSG_task_get_name(task), "X") == 0); - MSG_task_destroy(task); - - MSG_task_receive(&task, BOX_NAME); - MC_assert(strcmp(MSG_task_get_name(task), "Y") == 0); - MSG_task_destroy(task); - - return 0; -} - -static int sender(int argc, char *argv[]) -{ - xbt_assert(argc == 2); - const char* message_name = argv[1]; -#ifndef DISABLE_THE_MUTEX - sg_mutex_lock(mutex); -#endif - MSG_task_send(MSG_task_create(message_name, 0.0, 0.0, NULL), BOX_NAME); -#ifndef DISABLE_THE_MUTEX - sg_mutex_unlock(mutex); -#endif - return 0; -} - -int main(int argc, char *argv[]) -{ - MSG_init(&argc, argv); - xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" - "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); - - MSG_create_environment(argv[1]); - MSG_function_register("receiver", receiver); - MSG_function_register("sender", sender); - - MSG_launch_application(argv[2]); -#ifndef DISABLE_THE_MUTEX - mutex = sg_mutex_init(); -#endif - msg_error_t res = MSG_main(); -#ifndef DISABLE_THE_MUTEX - sg_mutex_destroy(mutex); - mutex = NULL; -#endif - XBT_INFO("Simulation time %g", MSG_get_clock()); - - return res != MSG_OK; -} diff --git a/teshsuite/mc/mutex-handling/mutex-handling.cpp b/teshsuite/mc/mutex-handling/mutex-handling.cpp new file mode 100644 index 0000000000..4a03cc7d7d --- /dev/null +++ b/teshsuite/mc/mutex-handling/mutex-handling.cpp @@ -0,0 +1,89 @@ +/* Copyright (c) 2015-2020. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +/* In this test, we have two senders sending one message to a common receiver. + * The receiver should be able to see any ordering between the two messages. + * If we model-check the application with assertions on a specific order of + * the messages (see the assertions in the receiver code), it should fail + * because both ordering are possible. + * + * If the senders sends the message directly, the current version of the MC + * finds that the ordering may differ and the MC find a counter-example. + * + * However, if the senders send the message in a mutex, the MC always let + * the first process take the mutex because it thinks that the effect of + * a mutex is purely local: the ordering of the messages is always the same + * and the MC does not find the counter-example. + */ + +#include "simgrid/modelchecker.h" +#include "simgrid/s4u/Engine.hpp" +#include "simgrid/s4u/Host.hpp" +#include "simgrid/s4u/Mailbox.hpp" +#include "simgrid/s4u/Mutex.hpp" +#include + +XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); + +static int receiver(const char* box_name) +{ + int* payload; + auto mb = simgrid::s4u::Mailbox::by_name(box_name); + + payload = static_cast(mb->get()); + MC_assert(*payload == 0); + free(payload); + + payload = static_cast(mb->get()); + MC_assert(*payload == 1); + free(payload); + + return 0; +} + +static int sender(const char* box_name, simgrid::s4u::MutexPtr mutex, int value) +{ + int* payload = new int(value); + auto mb = simgrid::s4u::Mailbox::by_name(box_name); + +#ifndef DISABLE_THE_MUTEX + mutex->lock(); +#endif + + mb->put(static_cast(payload), 8); + +#ifndef DISABLE_THE_MUTEX + mutex->unlock(); +#endif + return 0; +} + +int main(int argc, char* argv[]) +{ + XBT_ATTRIB_UNUSED simgrid::s4u::MutexPtr mutex; +#ifndef DISABLE_THE_MUTEX + mutex = simgrid::s4u::Mutex::create(); +#endif + + simgrid::s4u::Engine e(&argc, argv); + xbt_assert(argc > 2, + "Usage: %s platform_file deployment_file\n" + "\tExample: %s msg_platform.xml msg_deployment.xml\n", + argv[0], argv[0]); + + e.load_platform(argv[1]); + simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Tremblay"), sender, "box", mutex, 1); + simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("Tremblay"), sender, "box", mutex, 2); + simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("Jupiter"), receiver, "box"); + +#ifndef DISABLE_THE_MUTEX + mutex = simgrid::s4u::Mutex::create(); +#endif + + e.run(); + XBT_INFO("Simulation time %g", e.get_clock()); + + return 0; +} diff --git a/teshsuite/mc/mutex-handling/mutex-handling_d.xml b/teshsuite/mc/mutex-handling/mutex-handling_d.xml deleted file mode 100644 index aad5411cf2..0000000000 --- a/teshsuite/mc/mutex-handling/mutex-handling_d.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/teshsuite/msg/CMakeLists.txt b/teshsuite/msg/CMakeLists.txt index f3eb8efbf7..159c008f81 100644 --- a/teshsuite/msg/CMakeLists.txt +++ b/teshsuite/msg/CMakeLists.txt @@ -9,10 +9,12 @@ foreach(x app-pingpong app-token-ring task-priority plugin-hostload trace_integration) - add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) - target_link_libraries(${x} simgrid) - set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) - add_dependencies(tests ${x}) + if(enable_MSG) + add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c) + target_link_libraries(${x} simgrid) + set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) + add_dependencies(tests ${x}) + endif() set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c) @@ -20,27 +22,33 @@ endforeach() # CPP examples foreach(x task_destroy_cancel task_listen_from task_progress host_on_off_processes) - 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}) - add_dependencies(tests ${x}) + if(enable_MSG) + 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}) + add_dependencies(tests ${x}) + endif() set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp) endforeach() -add_executable (bittorrent EXCLUDE_FROM_ALL app-bittorrent/bittorrent.c app-bittorrent/bittorrent-messages.c app-bittorrent/bittorrent-peer.c app-bittorrent/tracker.c app-bittorrent/connection.c) -target_link_libraries(bittorrent simgrid) -set_target_properties(bittorrent PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-bittorrent) -add_dependencies(tests bittorrent) +if(enable_MSG) + add_executable (bittorrent EXCLUDE_FROM_ALL app-bittorrent/bittorrent.c app-bittorrent/bittorrent-messages.c app-bittorrent/bittorrent-peer.c app-bittorrent/tracker.c app-bittorrent/connection.c) + target_link_libraries(bittorrent simgrid) + set_target_properties(bittorrent PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-bittorrent) + add_dependencies(tests bittorrent) +endif() foreach (file bittorrent connection bittorrent-messages bittorrent-peer tracker) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/${file}.c ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/${file}.h) endforeach() -add_executable (chainsend EXCLUDE_FROM_ALL app-chainsend/chainsend.c app-chainsend/iterator.c app-chainsend/common.c app-chainsend/messages.c app-chainsend/broadcaster.c app-chainsend/peer.c) -target_link_libraries(chainsend simgrid) -set_target_properties(chainsend PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-chainsend) -add_dependencies(tests chainsend) +if(enable_MSG) + add_executable (chainsend EXCLUDE_FROM_ALL app-chainsend/chainsend.c app-chainsend/iterator.c app-chainsend/common.c app-chainsend/messages.c app-chainsend/broadcaster.c app-chainsend/peer.c) + target_link_libraries(chainsend simgrid) + set_target_properties(chainsend PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-chainsend) + add_dependencies(tests chainsend) +endif() foreach (file common iterator messages broadcaster peer) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/${file}.c ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/${file}.h) endforeach() @@ -81,7 +89,8 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/ap ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1-c1s1-c3s2.xml ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp2.5-hbp1.5.xml PARENT_SCOPE) -foreach(x +if(enable_MSG) + foreach(x async-wait async-waitall async-waitany app-bittorrent app-chainsend app-pingpong app-token-ring cloud-capping cloud-migration cloud-two-tasks cloud-simple @@ -96,12 +105,14 @@ foreach(x task-priority plugin-hostload trace_integration) - ADD_TESH_FACTORIES(tesh-msg-${x} "raw" - --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms - --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/${x} - --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} - ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh) -endforeach() + + ADD_TESH_FACTORIES(tesh-msg-${x} "raw" + --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms + --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/${x} + --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} + ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh) + endforeach() -ADD_TESH_FACTORIES(tesh-app-bittorrent-parallel "raw" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/app-bittorrent --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/app-bittorrent app-bittorrent.tesh) + ADD_TESH_FACTORIES(tesh-app-bittorrent-parallel "raw" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/msg/app-bittorrent --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/app-bittorrent app-bittorrent.tesh) +endif() diff --git a/teshsuite/surf/lmm_usage/lmm_usage.cpp b/teshsuite/surf/lmm_usage/lmm_usage.cpp index 9b8fe093d5..a1257d3cf5 100644 --- a/teshsuite/surf/lmm_usage/lmm_usage.cpp +++ b/teshsuite/surf/lmm_usage/lmm_usage.cpp @@ -5,7 +5,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "simgrid/msg.h" +#include "simgrid/s4u/Engine.hpp" #include "src/kernel/lmm/maxmin.hpp" #include "src/surf/surf_interface.hpp" #include "xbt/log.h" @@ -167,7 +167,7 @@ static void test3() int main(int argc, char** argv) { - MSG_init(&argc, argv); + simgrid::s4u::Engine e(&argc, argv); XBT_INFO("***** Test 1"); test1(); diff --git a/teshsuite/surf/maxmin_bench/maxmin_bench.cpp b/teshsuite/surf/maxmin_bench/maxmin_bench.cpp index 5394298625..493c17d4f9 100644 --- a/teshsuite/surf/maxmin_bench/maxmin_bench.cpp +++ b/teshsuite/surf/maxmin_bench/maxmin_bench.cpp @@ -5,8 +5,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/s4u/Engine.hpp" #include "src/kernel/lmm/maxmin.hpp" -#include "simgrid/msg.h" #include "xbt/module.h" #include "xbt/sysdep.h" /* time manipulation for benchmarking */ #include "xbt/xbt_os_time.h" @@ -120,7 +120,7 @@ unsigned int TestClasses [][4]= int main(int argc, char **argv) { - MSG_init(&argc, argv); + simgrid::s4u::Engine e(&argc, argv); float rate_no_limit=0.2; float acc_date=0; diff --git a/teshsuite/xbt/log_large/log_large.c b/teshsuite/xbt/log_large/log_large.c index a997332a27..cc9ca24799 100644 --- a/teshsuite/xbt/log_large/log_large.c +++ b/teshsuite/xbt/log_large/log_large.c @@ -6,14 +6,14 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "xbt.h" -#include +#include +#include XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logs of this example"); int main(int argc, char *argv[]) { - MSG_init(&argc, argv); + simgrid_init(&argc, argv); char *tmp = bprintf("\n%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s%d%s", 1, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n", 2, ".........1.........2.........3.........4.........5.........6.........7.........8.........9.........0\n", diff --git a/teshsuite/xbt/log_usage/log_usage.c b/teshsuite/xbt/log_usage/log_usage.c index 5a67278304..c4327d51ab 100644 --- a/teshsuite/xbt/log_usage/log_usage.c +++ b/teshsuite/xbt/log_usage/log_usage.c @@ -6,7 +6,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include +#include #include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(test, top, "Logging specific to this test"); @@ -24,7 +24,7 @@ static void dolog(const char *settings) int main(int argc, char **argv) { - MSG_init(&argc, argv); + simgrid_init(&argc, argv); dolog(""); dolog(" "); diff --git a/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp b/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp index b827a05d42..b894023e66 100644 --- a/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp +++ b/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp @@ -5,7 +5,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "simgrid/msg.h" +#include "simgrid/s4u/Engine.hpp" #include XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example"); @@ -29,7 +29,7 @@ static void crasher_thread(int id) int main(int argc, char* argv[]) { - MSG_init(&argc, argv); + simgrid::s4u::Engine e(&argc, argv); std::thread crashers[crasher_amount]; diff --git a/teshsuite/xbt/parmap_bench/parmap_bench.cpp b/teshsuite/xbt/parmap_bench/parmap_bench.cpp index e9a34f2094..1270071fde 100644 --- a/teshsuite/xbt/parmap_bench/parmap_bench.cpp +++ b/teshsuite/xbt/parmap_bench/parmap_bench.cpp @@ -5,7 +5,7 @@ #include "src/internal_config.h" // HAVE_FUTEX_H #include "xbt/parmap.hpp" -#include +#include #include #include @@ -113,7 +113,7 @@ int main(int argc, char* argv[]) unsigned modes = MODES_DEFAULT; xbt_log_control_set("parmap_bench.fmt:[%c/%p]%e%m%n"); - MSG_init(&argc, argv); + simgrid::s4u::Engine e(&argc, argv); if (argc != 3 && argc != 4) { XBT_INFO("Usage: %s nthreads timeout [modes]", argv[0]); diff --git a/teshsuite/xbt/parmap_test/parmap_test.cpp b/teshsuite/xbt/parmap_test/parmap_test.cpp index fa3e9a7131..30da8b5dd7 100644 --- a/teshsuite/xbt/parmap_test/parmap_test.cpp +++ b/teshsuite/xbt/parmap_test/parmap_test.cpp @@ -6,7 +6,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/internal_config.h" // HAVE_FUTEX_H -#include +#include #include #include @@ -88,7 +88,7 @@ int main(int argc, char** argv) { int status = 0; xbt_log_control_set("parmap_test.fmt:[%c/%p]%e%m%n"); - MSG_init(&argc, argv); + simgrid::s4u::Engine e(&argc, argv); SIMIX_context_set_nthreads(16); // dummy value > 1 XBT_INFO("Basic testing posix"); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 2511c87c98..d6fec02b59 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -815,10 +815,15 @@ set(simgrid_sources ${XBT_SRC} ${PLUGINS_SRC} ${BINDINGS_SRC} - ${MSG_SRC} ${SIMDAG_SRC} ) +if(${enable_MSG}) + set(simgrid_sources ${simgrid_sources} ${MSG_SRC}) +else() + set(EXTRA_DIST ${simgrid_sources} ${MSG_SRC}) +endif() + if(${SIMGRID_HAVE_JEDULE}) set(simgrid_sources ${simgrid_sources} ${JEDULE_SRC}) else() @@ -999,7 +1004,7 @@ set(CMAKEFILES_TXT examples/s4u/CMakeLists.txt examples/smpi/CMakeLists.txt examples/smpi/NAS/CMakeLists.txt - examples/smpi/smpi_msg_masterslave/CMakeLists.txt + examples/smpi/smpi_s4u_masterslave/CMakeLists.txt examples/smpi/replay_multiple/CMakeLists.txt examples/smpi/replay_multiple_manual_deploy/CMakeLists.txt examples/python/CMakeLists.txt diff --git a/tools/cmake/Option.cmake b/tools/cmake/Option.cmake index 36ac349232..9cf3503a90 100644 --- a/tools/cmake/Option.cmake +++ b/tools/cmake/Option.cmake @@ -24,6 +24,7 @@ option(enable_documentation "Whether to produce documentation" off) option(enable_ns3 "Whether ns-3 model is activated." off) option(enable_java "Whether the Java bindings are activated." off) +option(enable_MSG "Whether the MSG module is activated." off) option(enable_lib_in_jar "Whether the native libraries are bundled in a Java jar file" on) option(minimal-bindings "Whether to compile the bindings libraries (Java/Python) with the minimal dependency set" off) mark_as_advanced(minimal-bindings) diff --git a/tools/graphicator/CMakeLists.txt b/tools/graphicator/CMakeLists.txt index 66b8af3b0e..c66b778edb 100644 --- a/tools/graphicator/CMakeLists.txt +++ b/tools/graphicator/CMakeLists.txt @@ -1,14 +1,16 @@ -add_executable (graphicator graphicator.c) -add_dependencies (tests graphicator) -target_link_libraries(graphicator simgrid) -set_target_properties(graphicator PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -ADD_TESH(graphicator --setenv srcdir=${CMAKE_HOME_DIRECTORY} --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.tesh) +if(enable_MSG) + add_executable (graphicator graphicator.c) + add_dependencies (tests graphicator) + target_link_libraries(graphicator simgrid) + set_target_properties(graphicator PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + ADD_TESH(graphicator --setenv srcdir=${CMAKE_HOME_DIRECTORY} --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.tesh) -install(TARGETS graphicator DESTINATION bin/) + install(TARGETS graphicator DESTINATION bin/) -## Clean generated files -get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/simgrid.trace;") + ## Clean generated files + get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES) + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/simgrid.trace;") +endif() set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.tesh PARENT_SCOPE) set(tools_src ${tools_src} ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.c PARENT_SCOPE) -- 2.20.1