Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #259 from simgrid/configfix
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 30 Mar 2018 22:13:35 +0000 (00:13 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Mar 2018 22:13:35 +0000 (00:13 +0200)
config: fix declareFlag template

456 files changed:
.gitignore
.travis.yml
CMakeLists.txt
COPYING
ChangeLog
FindSimGrid.cmake
NEWS
README.coding
doc/Doxyfile.in
doc/doxygen/inside.doc
doc/doxygen/inside_cmake.doc
doc/doxygen/inside_doxygen.doc
doc/doxygen/inside_extending.doc
doc/doxygen/inside_release.doc
doc/doxygen/inside_tests.doc
doc/doxygen/install_yours.doc
doc/doxygen/module-smpi.doc
doc/tuto-msg/masterworker-sol1.c
doc/tuto-msg/masterworker-sol2.c
doc/tuto-msg/masterworker-sol3.c
doc/tuto-msg/masterworker-sol4.c
doc/tuto-msg/masterworker.c
examples/msg/app-masterworker/app-masterworker.c
examples/msg/cloud-masterworker/cloud-masterworker.c
examples/msg/dht-kademlia/dht-kademlia.c
examples/msg/dht-kademlia/node.c
examples/msg/dht-pastry/dht-pastry.c
examples/msg/mc/bugged1_liveness.c
examples/msg/mc/bugged2_liveness.c
examples/msg/network-ns3/network-ns3.c
examples/msg/platform-failures/platform-failures.c
examples/msg/trace-host-user-variables/trace-host-user-variables.c
examples/msg/trace-host-user-variables/trace-host-user-variables.tesh
examples/msg/trace-process-migration/trace-process-migration.tesh
examples/s4u/CMakeLists.txt
examples/s4u/actor-kill-pid/s4u-actor-kill-pid.cpp [deleted file]
examples/s4u/actor-kill-pid/s4u-actor-kill-pid.tesh [deleted file]
examples/s4u/actor-kill/s4u-actor-kill.cpp
examples/s4u/actor-kill/s4u-actor-kill.tesh
examples/s4u/io-file-remote/s4u-io-file-remote.cpp
examples/s4u/io-file-system/s4u-io-file-system.cpp
examples/s4u/replay-comm/s4u-replay-comm.cpp
examples/s4u/replay-storage/s4u-replay-storage.cpp
examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp
examples/smpi/CMakeLists.txt
examples/smpi/replay/replay.cpp [moved from examples/smpi/replay/replay.c with 83% similarity]
examples/smpi/replay/replay.tesh
examples/smpi/replay_multiple/replay_multiple.tesh
examples/smpi/smpi_msg_masterslave/masterslave_mailbox_smpi.c
examples/smpi/trace_call_location/trace_call_location.tesh
include/simgrid/actor.h [new file with mode: 0644]
include/simgrid/forward.h
include/simgrid/host.h
include/simgrid/instr.h
include/simgrid/jedule/jedule.hpp
include/simgrid/jedule/jedule_events.hpp
include/simgrid/jedule/jedule_platform.hpp
include/simgrid/jedule/jedule_sd_binding.h
include/simgrid/kernel/future.hpp
include/simgrid/kernel/resource/Action.hpp [moved from src/kernel/resource/Action.hpp with 52% similarity]
include/simgrid/kernel/resource/Model.hpp [new file with mode: 0644]
include/simgrid/kernel/resource/Resource.hpp [moved from src/kernel/resource/Resource.hpp with 81% similarity]
include/simgrid/kernel/routing/ClusterZone.hpp [moved from src/kernel/routing/ClusterZone.hpp with 86% similarity]
include/simgrid/kernel/routing/DijkstraZone.hpp [moved from src/kernel/routing/DijkstraZone.hpp with 81% similarity]
include/simgrid/kernel/routing/DragonflyZone.hpp [moved from src/kernel/routing/DragonflyZone.hpp with 80% similarity]
include/simgrid/kernel/routing/EmptyZone.hpp [moved from src/kernel/routing/EmptyZone.hpp with 85% similarity]
include/simgrid/kernel/routing/FatTreeZone.hpp [moved from src/kernel/routing/FatTreeZone.hpp with 85% similarity]
include/simgrid/kernel/routing/FloydZone.hpp [moved from src/kernel/routing/FloydZone.hpp with 83% similarity]
include/simgrid/kernel/routing/FullZone.hpp [moved from src/kernel/routing/FullZone.hpp with 83% similarity]
include/simgrid/kernel/routing/NetPoint.hpp [moved from src/kernel/routing/NetPoint.hpp with 75% similarity]
include/simgrid/kernel/routing/NetZoneImpl.hpp [moved from src/kernel/routing/NetZoneImpl.hpp with 83% similarity]
include/simgrid/kernel/routing/RoutedZone.hpp [moved from src/kernel/routing/RoutedZone.hpp with 93% similarity]
include/simgrid/kernel/routing/TorusZone.hpp [moved from src/kernel/routing/TorusZone.hpp with 82% similarity]
include/simgrid/kernel/routing/VivaldiZone.hpp [moved from src/kernel/routing/VivaldiZone.hpp with 91% similarity]
include/simgrid/link.h
include/simgrid/modelchecker.h
include/simgrid/msg.h
include/simgrid/plugins/dvfs.h
include/simgrid/plugins/energy.h
include/simgrid/plugins/file_system.h
include/simgrid/plugins/live_migration.h
include/simgrid/plugins/load.h
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Comm.hpp
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/s4u/Exec.hpp
include/simgrid/s4u/Host.hpp
include/simgrid/s4u/Link.hpp
include/simgrid/s4u/Mailbox.hpp
include/simgrid/s4u/Mutex.hpp
include/simgrid/s4u/NetZone.hpp
include/simgrid/s4u/Storage.hpp
include/simgrid/s4u/VirtualMachine.hpp
include/simgrid/s4u/forward.hpp
include/simgrid/simdag.h
include/simgrid/simix.h
include/simgrid/simix.hpp
include/simgrid/simix/blocking_simcall.hpp
include/simgrid/storage.h [new file with mode: 0644]
include/simgrid/vm.h [new file with mode: 0644]
include/simgrid/zone.h [new file with mode: 0644]
include/simgrid_config.h.in
include/smpi/mpif.h.in
include/smpi/smpi.h
include/xbt/RngStream.h
include/xbt/asserts.h
include/xbt/automaton.h
include/xbt/backtrace.h
include/xbt/backtrace.hpp
include/xbt/base.h
include/xbt/config.h
include/xbt/config.hpp
include/xbt/cunit.h
include/xbt/dict.h
include/xbt/dynar.h
include/xbt/ex.h
include/xbt/ex.hpp
include/xbt/exception.hpp
include/xbt/function_types.h
include/xbt/functional.hpp
include/xbt/graph.h
include/xbt/log.h
include/xbt/log.hpp
include/xbt/mallocator.h
include/xbt/misc.h
include/xbt/module.h
include/xbt/replay.hpp
include/xbt/str.h
include/xbt/string.hpp
include/xbt/synchro.h
include/xbt/sysdep.h
include/xbt/virtu.h
include/xbt/xbt_os_thread.h
include/xbt/xbt_os_time.h
sonar-project.properties
src/bindings/java/JavaContext.cpp
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_comm.cpp
src/bindings/java/jmsg_file.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_process.h
src/bindings/java/jmsg_rngstream.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_synchro.cpp
src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jtrace.cpp
src/bindings/java/jxbt_utilities.cpp
src/bindings/java/org/simgrid/msg/Process.java
src/bindings/lua/lua_debug.cpp
src/bindings/lua/lua_host.cpp
src/bindings/lua/lua_platf.cpp
src/bindings/lua/simgrid_lua.cpp
src/include/instr/instr_interface.h
src/include/mc/mc.h
src/include/simgrid/sg_config.h [deleted file]
src/include/simgrid/sg_config.hpp [new file with mode: 0644]
src/include/surf/surf.hpp
src/include/xbt/mmalloc.h [moved from include/xbt/mmalloc.h with 63% similarity]
src/instr/instr_config.cpp
src/instr/instr_interface.cpp
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_containers.hpp
src/instr/instr_paje_events.cpp
src/instr/instr_paje_header.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_values.cpp
src/instr/instr_private.hpp
src/instr/instr_smpi.hpp
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/CommImpl.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/ExecImpl.hpp
src/kernel/activity/MailboxImpl.hpp
src/kernel/activity/MutexImpl.cpp
src/kernel/activity/MutexImpl.hpp
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/SleepImpl.hpp
src/kernel/activity/SynchroIo.cpp
src/kernel/activity/SynchroIo.hpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/activity/SynchroRaw.hpp
src/kernel/context/Context.hpp
src/kernel/lmm/fair_bottleneck.cpp
src/kernel/lmm/lagrange.cpp
src/kernel/lmm/maxmin.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/resource/Action.cpp
src/kernel/resource/Model.cpp
src/kernel/resource/Model.hpp [deleted file]
src/kernel/resource/Resource.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/EmptyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetPoint.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/mc/ModelChecker.cpp
src/mc/Session.cpp
src/mc/checker/Checker.hpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/checker/simgrid_mc.cpp
src/mc/mc_config.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_exit.hpp
src/mc/mc_ignore.h
src/mc/mc_memory.cpp
src/mc/mc_page_snapshot.cpp
src/mc/mc_replay.hpp
src/mc/mc_request.cpp
src/mc/mc_smx.cpp
src/mc/mc_snapshot.cpp
src/mc/remote/Client.cpp
src/mc/remote/Client.hpp
src/mc/remote/RemoteClient.cpp
src/mc/remote/RemoteClient.hpp
src/msg/instr_msg_process.cpp
src/msg/instr_msg_task.cpp
src/msg/msg_actions.cpp [deleted file]
src/msg/msg_deployment.cpp
src/msg/msg_environment.cpp
src/msg/msg_global.cpp
src/msg/msg_gos.cpp
src/msg/msg_host.cpp [deleted file]
src/msg/msg_legacy.cpp [new file with mode: 0644]
src/msg/msg_mailbox.cpp
src/msg/msg_private.hpp
src/msg/msg_process.cpp
src/msg/msg_task.cpp
src/plugins/file_system/FileSystem.hpp [deleted file]
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VirtualMachineImpl.hpp
src/plugins/vm/VmLiveMigration.cpp
src/plugins/vm/s4u_VirtualMachine.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_comm.cpp
src/s4u/s4u_engine.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_link.cpp
src/s4u/s4u_netzone.cpp
src/s4u/s4u_storage.cpp
src/simdag/dax_dtd.h
src/simdag/sd_daxloader.cpp
src/simdag/sd_global.cpp
src/simdag/sd_task.cpp
src/simgrid/host.cpp
src/simgrid/sg_config.cpp
src/simix/ActorImpl.cpp
src/simix/ActorImpl.hpp
src/simix/libsmx.cpp
src/simix/popping_accessors.hpp
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/popping_private.hpp
src/simix/simcalls.in
src/simix/smx_context.cpp
src/simix/smx_deployment.cpp
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/simix/smx_host_private.hpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/simix/smx_private.hpp
src/simix/smx_synchro.cpp
src/simix/smx_synchro_private.hpp
src/smpi/bindings/smpi_mpi.cpp
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/bindings/smpi_pmpi_comm.cpp
src/smpi/bindings/smpi_pmpi_group.cpp
src/smpi/bindings/smpi_pmpi_info.cpp
src/smpi/bindings/smpi_pmpi_op.cpp
src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/bindings/smpi_pmpi_topo.cpp
src/smpi/bindings/smpi_pmpi_type.cpp
src/smpi/bindings/smpi_pmpi_win.cpp
src/smpi/colls/smpi_automatic_selector.cpp
src/smpi/colls/smpi_mvapich2_selector_stampede.hpp
src/smpi/include/private.hpp
src/smpi/include/smpi_coll.hpp
src/smpi/include/smpi_datatype.hpp
src/smpi/include/smpi_utils.hpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_deployment.cpp
src/smpi/internals/smpi_dvfs.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_memory.cpp
src/smpi/internals/smpi_process.cpp
src/smpi/internals/smpi_replay.cpp
src/smpi/internals/smpi_shared.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_f2c.cpp
src/smpi/mpi/smpi_op.cpp
src/smpi/mpi/smpi_request.cpp
src/smpi/smpicc.in
src/smpi/smpicxx.in
src/smpi/smpif90.in
src/smpi/smpiff.in
src/smpi/smpirun.in
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.cpp
src/surf/StorageImpl.hpp
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/host_clm03.cpp
src/surf/host_clm03.hpp
src/surf/instr_routing.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/network_smpi.cpp
src/surf/ns3/ns3_simulator.hpp
src/surf/plugins/dirty_page_tracking.cpp
src/surf/plugins/host_dvfs.cpp
src/surf/plugins/host_energy.cpp
src/surf/plugins/host_load.cpp
src/surf/plugins/link_energy.cpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/surf/surf_private.hpp
src/surf/trace_mgr.cpp
src/surf/trace_mgr.hpp
src/surf/trace_mgr_test.cpp
src/surf/xml/platf.hpp
src/surf/xml/platf_private.hpp
src/surf/xml/simgrid_dtd.h
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/automaton/automaton.c
src/xbt/backtrace.cpp
src/xbt/config.cpp
src/xbt/dict_cursor.c
src/xbt/dynar.cpp
src/xbt/ex.cpp
src/xbt/exception.cpp
src/xbt/log.c
src/xbt/log_private.h
src/xbt/memory_map.cpp
src/xbt/mmalloc/mmprivate.h
src/xbt/snprintf.c
src/xbt/xbt_main.cpp
src/xbt/xbt_replay.cpp
teshsuite/mc/CMakeLists.txt
teshsuite/mc/mutex-handling/mutex-handling.c
teshsuite/mc/random-bug/random-bug.c
teshsuite/msg/CMakeLists.txt
teshsuite/msg/actions-comm/actions-comm.c [deleted file]
teshsuite/msg/actions-comm/actions-comm.tesh [deleted file]
teshsuite/msg/actions-comm/actions-comm.txt [deleted file]
teshsuite/msg/actions-comm/actions-comm_d.xml [deleted file]
teshsuite/msg/actions-comm/actions-comm_split_d.xml [deleted file]
teshsuite/msg/actions-comm/actions-comm_split_p0.txt [deleted file]
teshsuite/msg/actions-comm/actions-comm_split_p1.txt [deleted file]
teshsuite/msg/actions-storage/actions-storage.c [deleted file]
teshsuite/msg/actions-storage/actions-storage.tesh [deleted file]
teshsuite/msg/actions-storage/actions-storage.txt [deleted file]
teshsuite/msg/actions-storage/actions-storage_d.xml [deleted file]
teshsuite/msg/app-bittorrent/bittorrent-messages.c
teshsuite/msg/app-bittorrent/bittorrent-peer.c
teshsuite/msg/app-bittorrent/bittorrent.c
teshsuite/msg/app-pingpong/app-pingpong.c
teshsuite/msg/app-token-ring/app-token-ring.c
teshsuite/msg/async-wait/async-wait.c
teshsuite/msg/async-waitall/async-waitall.c
teshsuite/msg/async-waitany/async-waitany.c
teshsuite/msg/host_on_off_processes/host_on_off_processes.c
teshsuite/msg/io-file-remote/io-file-remote.c
teshsuite/msg/io-file/io-file.c
teshsuite/msg/process-lifetime/process-lifetime.c
teshsuite/msg/process-yield/process-yield.c
teshsuite/msg/task_progress/task_progress.cpp
teshsuite/s4u/actor/actor.cpp
teshsuite/s4u/pid/pid.cpp
teshsuite/s4u/pid/pid.tesh
teshsuite/s4u/storage_client_server/storage_client_server.cpp
teshsuite/simdag/CMakeLists.txt
teshsuite/simdag/evaluate-parse-time/evaluate-parse-time.c
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/simdag/is-router/is-router.cpp
teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/mpich3-test/coll/CMakeLists.txt
teshsuite/smpi/mpich3-test/coll/red_scat_block2.c
teshsuite/smpi/mpich3-test/coll/redscat2.c
teshsuite/smpi/mpich3-test/datatype/CMakeLists.txt
teshsuite/smpi/mpich3-test/datatype/subarray-pack.c
teshsuite/smpi/mpich3-test/datatype/testlist
teshsuite/smpi/mpich3-test/f77/datatype/CMakeLists.txt
teshsuite/smpi/mpich3-test/f77/datatype/testlist
teshsuite/smpi/mpich3-test/f90/datatype/CMakeLists.txt
teshsuite/smpi/mpich3-test/f90/datatype/indtype.f90
teshsuite/smpi/mpich3-test/f90/datatype/testlist
teshsuite/smpi/mpich3-test/info/CMakeLists.txt
teshsuite/smpi/mpich3-test/perf/CMakeLists.txt
teshsuite/smpi/mpich3-test/perf/non_zero_root.c
teshsuite/smpi/mpich3-test/pt2pt/CMakeLists.txt
teshsuite/smpi/mpich3-test/pt2pt/waitany-null.c
teshsuite/smpi/mpich3-test/rma/CMakeLists.txt
teshsuite/smpi/mpich3-test/util/mtest_datatype.c
teshsuite/smpi/mpich3-test/util/mtest_datatype_gen.c
teshsuite/smpi/mpich3-test/util/mtest_datatype_gen_manual.c
teshsuite/smpi/privatization/privatization.tesh
teshsuite/smpi/privatization/privatization_dlopen.tesh [deleted file]
teshsuite/surf/CMakeLists.txt
teshsuite/surf/lmm_usage/lmm_usage.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/surf/surf_usage/surf_usage.cpp
teshsuite/xbt/CMakeLists.txt
teshsuite/xbt/mallocator/mallocator.c
teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.c
teshsuite/xbt/parmap_bench/parmap_bench.cpp
tools/cmake/DefinePackages.cmake
tools/cmake/Distrib.cmake
tools/cmake/GCCFlags.cmake
tools/cmake/Java.cmake
tools/cmake/MaintainerMode.cmake
tools/cmake/MakeLib.cmake
tools/cmake/MakeLibWin.cmake
tools/cmake/Tests.cmake
tools/cmake/UnitTesting.cmake
tools/jenkins/Sanitizers.sh
tools/tesh/tesh.py

index 5394388..39e7b55 100644 (file)
@@ -146,7 +146,6 @@ examples/msg/*.tr
 examples/s4u/actor-create/s4u-actor-create
 examples/s4u/actor-daemon/s4u-actor-daemon
 examples/s4u/actor-join/s4u-actor-join
-examples/s4u/actor-kill-pid/s4u-actor-kill-pid
 examples/s4u/actor-kill/s4u-actor-kill
 examples/s4u/actor-lifetime/s4u-actor-lifetime
 examples/s4u/actor-migration/s4u-actor-migration
@@ -222,8 +221,6 @@ teshsuite/mc/dwarf-expression/dwarf-expression
 teshsuite/mc/mutex-handling/mutex-handling
 teshsuite/mc/mutex-handling/without-mutex-handling
 teshsuite/mc/random-bug/random-bug
-teshsuite/msg/actions-comm/actions-comm
-teshsuite/msg/actions-storage/actions-storage
 teshsuite/msg/app-bittorrent/bittorrent
 teshsuite/msg/app-chainsend/chainsend
 teshsuite/msg/app-pingpong/app-pingpong
index e1288a1..fcb08e6 100644 (file)
@@ -10,12 +10,7 @@ dist: trusty
 language: cpp
 compiler:
    - gcc
-#  - clang # boost 1.48 raises an error on clang:
-#            /usr/include/boost/signals2/detail/auto_buffer.hpp:565:57: error:
-#              reference to non-static member function must be called
-#                        std::uninitialized_fill( buffer_, buffer_ + size, init_value );
-#                                                                    ^~~~
-#
+#  - clang 
 addons:
   apt:
     packages:
@@ -52,7 +47,7 @@ script:
    - if [[ "$TRAVIS_OS_NAME" == "osx"   ]]; then cmake -Denable_model-checking=OFF -Denable_documentation=OFF -Denable_coverage=ON -Denable_java=ON -Denable_lua=OFF -Denable_compile_optimizations=ON -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=ON .; fi
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cmake -Denable_model-checking=ON  -Denable_documentation=OFF -Denable_coverage=ON -Denable_java=ON -Denable_lua=OFF -Denable_compile_optimizations=ON -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_compile_warnings=ON .; fi
    # run make and ctest in the sonar wrapper on master/linux; run it directly in PR or OSX
-   - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then ./tools/internal/travis-sonarqube.sh make VERBOSE=1; else make VERBOSE=1 && ctest --output-on-failure --timeout 100; fi
+   - if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then ./tools/internal/travis-sonarqube.sh make VERBOSE=1; else make VERBOSE=1 && ctest --output-on-failure ; fi
 notifications:
   recipients:
     - martin.quinson@ens-rennes.fr
index 51590bc..3733e2b 100644 (file)
@@ -79,9 +79,9 @@ if ((NOT DEFINED enable_smpi) OR enable_smpi)
   endif()
   
   if(CMAKE_Fortran_COMPILER)
+
     # Fortran compiler detected: save it, then replace by smpiff
     set(SMPI_Fortran_COMPILER "${CMAKE_Fortran_COMPILER}" CACHE FILEPATH "The real Fortran compiler")
-    set(CMAKE_Fortran_COMPILER smpiff)
 
        # Set flags/libs to be used in smpiff
     if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
@@ -106,10 +106,10 @@ endif()
 
 set(SIMGRID_VERSION_MAJOR "3")
 set(SIMGRID_VERSION_MINOR "19")
-set(SIMGRID_VERSION_PATCH "0")
+set(SIMGRID_VERSION_PATCH "90")
 set(SIMGRID_VERSION_EXTRA "-DEVEL") # Extra words to add to version string (e.g. -rc1)
 
-set(SIMGRID_VERSION_DATE  "2017") # Year for copyright information
+set(SIMGRID_VERSION_DATE  "2018") # Year for copyright information
 
 if(${SIMGRID_VERSION_PATCH} EQUAL "0")
   set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}")
@@ -159,20 +159,26 @@ endif()
 SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
 
 ### Compute the include paths
-set(INCLUDES
+
+# Only include public headers by default
+include_directories(
+   ${CMAKE_BINARY_DIR}/include
+   ${CMAKE_HOME_DIRECTORY}/include
+)
+
+# Compute the ones that should be added when compiling the library
+set(INTERNAL_INCLUDES
   ${CMAKE_BINARY_DIR}
-  ${CMAKE_BINARY_DIR}/include
   ${CMAKE_HOME_DIRECTORY}
-  ${CMAKE_HOME_DIRECTORY}/include
   ${CMAKE_HOME_DIRECTORY}/src/include
   )
 
 if(enable_smpi)
-  set (INCLUDES ${INCLUDES} ${CMAKE_HOME_DIRECTORY}/src/smpi/include)
+  set (INTERNAL_INCLUDES ${INTERNAL_INCLUDES} ${CMAKE_HOME_DIRECTORY}/src/smpi/include)
 endif()
 
 if(NOT CMAKE_CROSSCOMPILING AND EXISTS /usr/include/)
-  set(INCLUDES ${INCLUDES} /usr/include/)
+  set(INTERNAL_INCLUDES ${INTERNAL_INCLUDES} /usr/include/)
 endif()
 
 if(WIN32)
@@ -180,12 +186,10 @@ if(WIN32)
   set(CMAKE_LIB_WIN "${CMAKE_C_COMPILER}")
   string(REGEX REPLACE "/bin/gcc.*" "/include"  CMAKE_INCLUDE_WIN "${CMAKE_INCLUDE_WIN}")
   string(REGEX REPLACE "/bin/gcc.*" "/lib"  CMAKE_LIB_WIN "${CMAKE_LIB_WIN}")
-  set(INCLUDES ${INCLUDES} ${CMAKE_INCLUDE_WIN})
+  set(INTERNAL_INCLUDES ${INTERNAL_INCLUDES} ${CMAKE_INCLUDE_WIN})
   unset(CMAKE_INCLUDE_WIN)
 endif()
 
-include_directories(${INCLUDES})
-
 # library dependency cannot start with a space (CMP0004), so initialize it with something that is never desactivated.
 set(SIMGRID_DEP "-lm") 
 
@@ -699,6 +703,16 @@ set(CMAKE_SMPI_COMMAND "${CMAKE_SMPI_COMMAND}:\${LD_LIBRARY_PATH:+:$LD_LIBRARY_P
 set(SMPIMAIN smpimain)
 
 configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/include/smpi/mpif.h @ONLY)
+#configure mpif.f90 to build mpi.mod
+if(SMPI_FORTRAN)
+  set(MODULE_MPIF_IN "module mpi")
+  set(MODULE_MPIF_OUT "end module mpi")
+  configure_file(${CMAKE_HOME_DIRECTORY}/include/smpi/mpif.h.in ${CMAKE_BINARY_DIR}/src/smpi/mpif.f90.generated @ONLY)
+  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/src/smpi/mpif.f90.generated ${CMAKE_BINARY_DIR}/src/smpi/mpif.f90)
+  set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/include/smpi)
+  add_library(mpi SHARED ${CMAKE_BINARY_DIR}/src/smpi/mpif.f90)
+endif()
+
 foreach(script cc cxx ff f90 run)
   configure_file(${CMAKE_HOME_DIRECTORY}/src/smpi/smpi${script}.in ${CMAKE_BINARY_DIR}/bin/smpi${script} @ONLY)
 endforeach()
diff --git a/COPYING b/COPYING
index f44d682..75a4258 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -3,7 +3,7 @@ Upstream-Name: SimGrid
 Source: https://gforge.inria.fr/frs/?group_id=12
 
 Files: *
-Copyright: 2003-2016. The SimGrid Team. All rights reserved.
+Copyright: 2003-2018. The SimGrid Team. All rights reserved.
 License: LGPL-2.1
 
 Files: src/xbt/snprintf.c
@@ -11,39 +11,10 @@ Copyright: 1999, Mark Martinec <mark.martinec@ijs.si.
 License: Artistic
 Comment: Heavily adapted by the SimGrid team but remains under the original license
 
-Files: src/xbt/ex.cpp include/xbt/ex.h
-Copyright: 
-  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
-  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
-  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
-  Copyright (c) 2005-2015. The SimGrid Team.  
-License: Expat
- This file is part of OSSP ex, an exception handling library
- which can be found at http://www.ossp.org/pkg/lib/ex/.
- .
- Permission to use, copy, modify, and distribute this software for
- any purpose with or without fee is hereby granted, provided that
- the above copyright notice and this permission notice appear in all
- copies.
- .
- THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-Comment: Adapted from code from Ralf S. Engelschall and others in the OSSP project, remains under the original license.
-
 Files: src/xbt/mmalloc/* include/xbt/mmalloc.h
 Copyright: 
   Copyright (C) 1991, 1992 Free Software Foundation, Inc.
-  Copyright (C) 2003-2016. The SimGrid Team.
+  Copyright (C) 2003-2018. The SimGrid Team.
 License: LGPL-2.1
 Comment: these files used to be part of gdb, but were removed there
 
@@ -111,36 +82,36 @@ License: GPL-2+ and LGPL-2.1
 Comment: Generated with the FleXML XML processor generator (which is GPL-2+) using SimGrid configuration files (that are LGPL-2.1)
 
 Files:
- src/smpi/colls/allgather-2dmesh.c
- src/smpi/colls/allgather-3dmesh.c
- src/smpi/colls/allgather-bruck.c
- src/smpi/colls/allgather-pair.c
- src/smpi/colls/allgather-ring.c
- src/smpi/colls/allgather-spreading-simple.c
- src/smpi/colls/allgatherv-pair.c
- src/smpi/colls/allgatherv-ring.c
- src/smpi/colls/alltoall-2dmesh.c
- src/smpi/colls/alltoall-3dmesh.c
- src/smpi/colls/alltoall-pair.c
- src/smpi/colls/alltoall-pair-light-barrier.c
- src/smpi/colls/alltoall-pair-mpi-barrier.c
- src/smpi/colls/alltoall-pair-one-barrier.c
- src/smpi/colls/alltoall-rdb.c
- src/smpi/colls/alltoall-ring.c
- src/smpi/colls/alltoall-ring-light-barrier.c
- src/smpi/colls/alltoall-ring-mpi-barrier.c
- src/smpi/colls/alltoall-ring-one-barrier.c
- src/smpi/colls/alltoallv-pair.c
- src/smpi/colls/alltoallv-pair-light-barrier.c
- src/smpi/colls/alltoallv-pair-mpi-barrier.c
- src/smpi/colls/alltoallv-pair-one-barrier.c
- src/smpi/colls/alltoallv-ring.c
- src/smpi/colls/alltoallv-ring-light-barrier.c
- src/smpi/colls/alltoallv-ring-mpi-barrier.c
- src/smpi/colls/alltoallv-ring-one-barrier.c
- src/smpi/colls/bcast-binomial-tree.c
- src/smpi/colls/bcast-scatter-LR-allgather.c
- src/smpi/colls/bcast-scatter-rdb-allgather.c
+ src/smpi/colls/allgather/allgather-2dmesh.c
+ src/smpi/colls/allgather/allgather-3dmesh.c
+ src/smpi/colls/allgather/allgather-bruck.c
+ src/smpi/colls/allgather/allgather-pair.c
+ src/smpi/colls/allgather/allgather-ring.c
+ src/smpi/colls/allgather/allgather-spreading-simple.c
+ src/smpi/colls/allgatherv/allgatherv-pair.c
+ src/smpi/colls/allgatherv/allgatherv-ring.c
+ src/smpi/colls/alltoall/alltoall-2dmesh.c
+ src/smpi/colls/alltoall/alltoall-3dmesh.c
+ src/smpi/colls/alltoall/alltoall-pair.c
+ src/smpi/colls/alltoall/alltoall-pair-light-barrier.c
+ src/smpi/colls/alltoall/alltoall-pair-mpi-barrier.c
+ src/smpi/colls/alltoall/alltoall-pair-one-barrier.c
+ src/smpi/colls/alltoall/alltoall-rdb.c
+ src/smpi/colls/alltoall/alltoall-ring.c
+ src/smpi/colls/alltoall/alltoall-ring-light-barrier.c
+ src/smpi/colls/alltoall/alltoall-ring-mpi-barrier.c
+ src/smpi/colls/alltoall/alltoall-ring-one-barrier.c
+ src/smpi/colls/alltoallv/alltoallv-pair.c
+ src/smpi/colls/alltoallv/alltoallv-pair-light-barrier.c
+ src/smpi/colls/alltoallv/alltoallv-pair-mpi-barrier.c
+ src/smpi/colls/alltoallv/alltoallv-pair-one-barrier.c
+ src/smpi/colls/alltoallv/alltoallv-ring.c
+ src/smpi/colls/alltoallv/alltoallv-ring-light-barrier.c
+ src/smpi/colls/alltoallv/alltoallv-ring-mpi-barrier.c
+ src/smpi/colls/alltoallv/alltoallv-ring-one-barrier.c
+ src/smpi/colls/bcast/bcast-binomial-tree.c
+ src/smpi/colls/bcast/bcast-scatter-LR-allgather.c
+ src/smpi/colls/bcast/bcast-scatter-rdb-allgather.c
 Copyright: Copyright (c) 2006, Ahmad Faraj & Xin Yuan
 License: BSD-3-clause
  Redistribution and use in source and binary forms, with or without
@@ -171,27 +142,18 @@ License: BSD-3-clause
 Comment: Borrowed from StarMPI.
 
 Files:
- src/smpi/colls/allgather-mvapich-smp.c
- src/smpi/colls/allgatherv-ompi-bruck.c
- src/smpi/colls/allgatherv-mpich-ring.c
- src/smpi/colls/allreduce-mvapich-two-level.c
- src/smpi/colls/allreduce-ompi-ring-segmented.c
- src/smpi/colls/alltoall-mvapich-scatter-dest.c
- src/smpi/colls/allreduce-mvapich-rs.c
- src/smpi/colls/barrier-mvapich2-pair.c
- src/smpi/colls/barrier-ompi.c
- src/smpi/colls/bcast-mvapich-smp.c
- src/smpi/colls/bcast-ompi-split-bintree.c
+ src/smpi/colls/allgather/allgather-mvapich-smp.c
+ src/smpi/colls/allreduce/allreduce-mvapich-two-level.c
+ src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.c
+ src/smpi/colls/allreduce/allreduce-mvapich-rs.c
+ src/smpi/colls/barrier/barrier-mvapich2-pair.c
+ src/smpi/colls/bcast/bcast-mvapich-smp.c
  src/smpi/colls/coll_tuned_topo.c
  src/smpi/colls/coll_tuned_topo.h
- src/smpi/colls/gather-mvapich.c
- src/smpi/colls/gather-ompi.c
- src/smpi/colls/reduce-mvapich-knomial.c
- src/smpi/colls/reduce-mvapich-two-level.c
- src/smpi/colls/reduce-ompi.c
- src/smpi/colls/reduce_scatter-ompi.c
- src/smpi/colls/scatter-mvapich-two-level.c
- src/smpi/colls/scatter-ompi.c
+ src/smpi/colls/gather/gather-mvapich.c
+ src/smpi/colls/reduce/reduce-mvapich-knomial.c
+ src/smpi/colls/reduce/reduce-mvapich-two-level.c
+ src/smpi/colls/scatter/scatter-mvapich-two-level.c
 Copyright:
  Copyright (c) 2001 by Argonne National Laboratory.
  Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation.  All rights reserved.
@@ -202,7 +164,55 @@ Copyright:
 License: BSD-3-clause
 Comment: Borrowed from MVAPICH2.
 
-Files: src/smpi/colls/reduce-rab.c
+ src/smpi/colls/allgatherv/allgatherv-ompi-bruck.c
+ src/smpi/colls/allreduce/allreduce-ompi-ring-segmented.c
+ src/smpi/colls/barrier/barrier-ompi.c
+ src/smpi/colls/gather/gather-ompi.c
+ src/smpi/colls/reduce/reduce-ompi.c
+ src/smpi/colls/bcast/bcast-ompi-split-bintree.c
+ src/smpi/colls/scatter/scatter-ompi.c
+ src/smpi/colls/reduce_scatter/reduce_scatter-ompi.c
+ src/smpi/colls/reduce_scatter/reduce_scatter-ompi.c
+Copyright:
+ Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana University Research and Technology Corporation.  All rights reserved.
+ Copyright (c) 2004-2010 The University of Tennessee and The University of Tennessee Research Foundation.  All rights reserved.
+ Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, University of Stuttgart.  All rights reserved.
+ Copyright (c) 2004-2008 The Regents of the University of California. All rights reserved.
+ Copyright (c) 2006-2010 Los Alamos National Security, LLC.  All rights reserved.
+ Copyright (c) 2006-2010 Cisco Systems, Inc.  All rights reserved.
+ Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved.
+ Copyright (c) 2006-2011 Sandia National Laboratories. All rights reserved.
+ Copyright (c) 2006-2010 Sun Microsystems, Inc.  All rights reserved. Use is subject to license terms.
+ Copyright (c) 2006-2010 The University of Houston. All rights reserved.
+ Copyright (c) 2006-2009 Myricom, Inc.  All rights reserved.
+ Copyright (c) 2007-2008 UT-Battelle, LLC. All rights reserved.
+ Copyright (c) 2007-2010 IBM Corporation.  All rights reserved.
+ Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing Centre, Federal Republic of Germany
+ Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany
+ Copyright (c) 2007      Evergrid, Inc. All rights reserved.
+ Copyright (c) 2008      Chelsio, Inc.  All rights reserved.
+ Copyright (c) 2008-2009 Institut National de Recherche en Informatique.  All rights reserved.
+ Copyright (c) 2007      Lawrence Livermore National Security, LLC. All rights reserved.
+ Copyright (c) 2007-2009 Mellanox Technologies.  All rights reserved.
+ Copyright (c) 2006-2010 QLogic Corporation.  All rights reserved.
+ Copyright (c) 2008-2010 Oak Ridge National Labs.  All rights reserved.
+ Copyright (c) 2006-2010 Oracle and/or its affiliates.  All rights reserved.
+ Copyright (c) 2009      Bull SAS.  All rights reserved.
+ Copyright (c) 2010      ARM ltd.  All rights reserved.
+ Copyright (c) 2010-2011 Alex Brick <bricka@ccs.neu.edu>.  All rights reserved.
+ Copyright (c) 2012      The University of Wisconsin-La Crosse. All rights reserved.
+Comment: Borrowed from OpenMPI.
+
+Files:
+ src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp
+ src/smpi/colls/allgatherv/allgatherv-mpich-rdb.cpp
+ src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp
+ teshsuite/smpi/mpich3/*
+Copyright:
+ 2002 University of Chicago 
+Comment: Borrowed from MPICH2.
+
+Files: src/smpi/colls/reduce/reduce-rab.c
 Copyright: 1997, Rolf Rabenseifner. Computing Center University of Stuttgart
 License: other
  The usage of this software is free, but this header must not be removed.
@@ -210,7 +220,7 @@ License: other
 Files: src/xbt/automaton/parserPromela.tab.cacc
 Copyright:
  Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
- Copyright (C) 2003-2016. The SimGrid team.
+ Copyright (C) 2003-2018. The SimGrid team.
 License: GPL-3+ and LGPL-2.1
 Comment: Generated with the Bison processor generator (which is GPL-3+) using SimGrid configuration files (that are LGPL-2.1) 
 
index 827ae25..c6faf42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
-SimGrid (3.19) NOT RELEASED YET (target: March 20 2018, 16:15:27 UTC)
+SimGrid (3.20) NOT RELEASED YET (Release target: June 21. 2018 10:07 UTC)
 
- MSG
- - Fix MSG_task_get_remaining_work_ratio() to return 1.0 for tasks that have
-   not started.
+TRACE
+ - Change --cfg=tracing/msg/vm to --cfg=tracing/vm as virtual machine
+   behavior tracing is no longer limited to MSG 
+----------------------------------------------------------------------------
+
+SimGrid (3.19.1) Released March 22 2018
+
+ The Fixed ABI Release.
+
+ As you may know, we are currently refactoring SimGrid in deep.
+ Upcoming SimGrid4 will be really different from SimGrid3: modular,
+ standard and extensible vs. layered, homegrown and rigid. C++ vs. C.
+
+ Our goal is to smooth this transition, with backward compatibility
+ and automatic update paths, while still progressing toward SimGrid4.
+
+ SimGrid remains open during works: The last pure SimGrid3 release was
+ v3.12 while all subsequent versions are usable alpha versions of
+ SimGrid4: Existing interfaces remain unchanged, but the new S4U
+ interface is budding and the internals are deeply reorganized.
+
+ Since 2015, we work hard to reduce the changes to public APIs. When
+ we need to rename a public library symbol in S4U, we let your
+ compiler issue an explicative warning when you use the deprecated
+ function. These messages remain for four releases, i.e. for one full
+ year, before turning into an error. Starting with v3.15, your can
+ also adapt to API changes with the SIMGRID_VERSION macro, that is
+ defined to 31500 for v3.15, to 31901 for v3.19.1 and so on.
+
+ Starting with this v3.19.1, our commitment to reduce the changes to
+ the public interfaces is extended from the API to the ABI: a program
+ using only MSG or SimDag and compiled against a given version of
+ simgrid can probably be used with a later version of SimGrid without
+ recompilation. We will do our best... but don't expect too much of
+ it, that's a really difficult goal during such profund refactoring.
+
+ The difference between v3.19 and v3.19.1 is that the former was
+ accidentally breaking the ABI of MSG, while the later is restoring
+ the previous ABI.
+
+ S4U and kernel APIs will still evolve until SimGrid4, with one-year
+ deprecation warnings as currently. In fact, cleaning up these
+ interfaces and converting them to snake_case() is one release goal of
+ v3.20. But don't worry, we are working to smooth this upgrade path.
+
+ In summary, new projects should start with S4U to benefit of the
+ future, but old MSG projects should still be usable with no change.
+
+----------------------------------------------------------------------------
+
+SimGrid (3.19) Released March 20 2018
+
+ The Moscovitly-cold Spring release.
+
+ SMPI user-visible improvements:
+ - Support of MPI_Type_create_subarray
+ - Unimplemented MPI calls now abort (instead of issuing a warning)
+   Some harmless calls around errhandlers still only issue a warning.
+ - MPI_Sendrecv was behaving badly when MPI_PROC_NULL was sender or receiver.
+ - Starting MPI ranks (or even MSG/S4U actors) once the simulation started
+   is now possible (mmap privatization was refactored to this end).
+   Adding new SMPI instances should also be technically doable now.
+
+ SMPI internal cleanups:
+ - Removed index notion from SMPI -- no more "getPid() - 1"!
+   In tracing files, actors are called rank-<PROCESS-ID> but these are
+   NOT the real ranks (tracing several communicators is not supported yet).
+ - Deprecate smpi_process_index() (will be removed in 3.22)
+ - Better testing on classical proxy apps, through an external project:
+   https://github.com/simgrid/SMPI-proxy-apps/
 
  Documentation
  - Use a graphical TOC to make it easier to find the documentation you need
  - Revamp the MSG tutorial
 
+ MSG
+ - Fix MSG_task_get_remaining_work_ratio(): return 1.0 for unstarted tasks.
+ - Remove parameter of MSG_process_killall().
+   Resetting the PID was bogus anyway (several actors could have the same PID).
+
  S4U
- - Execution->setHost() can be called after start() to migrate it.
+ - Execution->setHost() can be called after start(), to migrate it.
  - Comm::test_any() is now implemented.
  - s4u::Actor now has onCreation() and onDestruction() signals.
-
- XBT
- - Remove XBT_LOG_CONNECT, it should be useless nowadays.
+ - Install some kernel header files for the users' plugins and more.
+   Warning, their API is really not stable yet.
+    include/simgrid/kernel/resource/{Action,Resource,Model}.hpp
+    include/simgrid/kernel/routing/*Zone.hpp
 
  SimDag
  - SD_task_dependency_add(): remove unused parameters 'name' and 'data'.
 
- SMPI
- - The privatization of global variables via mmap() is now significantly more
-   flexible and allows the use of daemons with SMPI and to add new processes
-   while the simulation is running. (Adding new SMPI instances after the
-   simulation has already started should also be technically doable now.)
- - Removed index notion from SMPI -- no more "getPid() - 1"!
-   This also means that the trace files
-   now contain actors called rank-<PROCESS-ID>. These are NOT the real
-   ranks, because tracing several communicators right now is not supported.
- - Because of this, smpi_process_index() has now been deprecated and will
-   be removed in 3.21
- Fixed bugs:
- - #245: migrating an actor does not migrate its execution
+ Build System and other cleanups:
+ - Remove unused run-time parameter "tracing/onelink-only".
+ - SimGrid now works with intel compilers (MC still buggy)
+ - Remove XBT_LOG_CONNECT, it should be useless nowadays.
+ - tesh kills subprocesses on timeout (but not on windows)
 
  PLATFORM:
  - Rename FULLDUPLEX into SPLITDUPLEX (old name still accepted)
 
- TRACING
- - Remove unused run-time parameter "tracing/onelink-only".
+ Fixed bugs:
+ - #194: Feature request: simgrid::s4u::Comm::test_any()
+ - #245: migrating an actor does not migrate its execution
+ - #254: Something seems wrong with s4u::Actor::kill(aid_t)
+ - #256: Modernize FindSimGrid.cmake
+ - #257: Fix (ab)use of CMake install
+
+----------------------------------------------------------------------------
 
 SimGrid (3.18) Released December 24 2017
 
@@ -131,6 +202,8 @@ SimGrid (3.18) Released December 24 2017
  - #221: odd LMM warning when killing an actor
  - #120: Memory leak when the processes are forcefully killed
 
+----------------------------------------------------------------------------
+
 SimGrid (3.17) Released October 8 2017
 
  The Drained Leaks release: (almost) no known leaks despite the tests.
index 8a79cdf..dd035e2 100644 (file)
-# Cmake macro to search for the SimGrid library. 
+# CMake find module to search for the SimGrid library. 
 
-# Copyright (c) 2016. The SimGrid Team (version 20161210).
+# Copyright (c) 2016-2018. The SimGrid Team.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
-# The user can hint a path using the SimGrid_PATH option.
 #
-# Once done, the following will be defined:
-#  
-#  SimGrid_INCLUDE_DIR - the SimGrid include directories
-#  SimGrid_LIBRARY - link your simulator against it to use SimGrid
+# USERS OF PROGRAMS USING SIMGRID
+# -------------------------------
 #
-# Afterward, you should probably do the following:
+# If cmake does not find this file, add its path to CMAKE_PREFIX_PATH:
+#    CMAKE_PREFIX_PATH="/path/to/FindSimGrid.cmake:$CMAKE_PREFIX_PATH"  cmake .
 #
-#  include_directories("${SimGrid_INCLUDE_DIR}" SYSTEM)
-#  target_link_libraries(your-simulator ${SimGrid_LIBRARY})
+# If this file does not find SimGrid, define SimGrid_PATH:
+#    SimGrid_PATH=/path/to/simgrid  cmake .
+
+#
+# DEVELOPERS OF PROGRAMS USING SIMGRID
+# ------------------------------------
+#
+#  1. Include this file in your own CMakeLists.txt
+#     Either by copying it in your tree, or (recommended) by using the
+#     version automatically installed by SimGrid.
+#    
+#  2. Afterward, if you have CMake >= 2.8.12, this will define a
+#     target called 'SimGrid::Simgrid'. Use it as:
+#       target_link_libraries(your-simulator SimGrid::SimGrid)
+#
+#    With older CMake (< 2.8.12), it simply defines several variables:
+#       SimGrid_INCLUDE_DIR - the SimGrid include directories
+#       SimGrid_LIBRARY - link your simulator against it to use SimGrid
+#    Use as:
+#      include_directories("${SimGrid_INCLUDE_DIR}" SYSTEM)
+#      target_link_libraries(your-simulator ${SimGrid_LIBRARY})
 #
-# This could be improved in many ways (patches welcome):
-#  - Not finding SimGrid is fatal. But who would want to 
-#    overcome such a desperate situation anyway? ;)
-#  - No way to specify a minimal version
-#  - No proper find_package() integration
+#  In both cases, it also define a SimGrid_VERSION macro, that you
+#    can use to deal with API evolutions as follows:
+#
+#    #if SimGrid_VERSION < 31800
+#      (code to use if the installed version is lower than v3.18)
+#    #elif SimGrid_VERSION < 31900
+#      (code to use if we are using SimGrid v3.18.x)
+#    #else
+#      (code to use with SimGrid v3.19+)
+#    #endif
+
+# 
+# IMPROVING THIS FILE
+# -------------------
+#  - Use automatic SimGridConfig.cmake creation via export/install(EXPORT in main CMakeLists.txt:
+#    https://cliutils.gitlab.io/modern-cmake/chapters/exporting.html
+#    https://cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
+#    https://github.com/boostcon/cppnow_presentations_2017/blob/master/05-19-2017_friday/effective_cmake__daniel_pfeifer__cppnow_05-19-2017.pdf
+
+cmake_minimum_required(VERSION 2.8)
 
-set(SimGrid_PATH ${SimGrid_PATH} CACHE PATH "Path to SimGrid library and include")
 find_path(SimGrid_INCLUDE_DIR
   NAMES simgrid_config.h
-  HINTS ${SimGrid_PATH}/include /usr/include /usr/local/include /opt/simgrid/include
+  PATHS ${SimGrid_PATH}/include /opt/simgrid/include
 )
 find_library(SimGrid_LIBRARY
   NAMES simgrid
-  HINTS ${SimGrid_PATH}/lib /usr/lib /usr/local/lib /opt/simgrid/lib
+  PATHS ${SimGrid_PATH}/lib /opt/simgrid/lib
 )
 mark_as_advanced(SimGrid_INCLUDE_DIR)
 mark_as_advanced(SimGrid_LIBRARY)
 
-if (NOT EXISTS "${SimGrid_INCLUDE_DIR}")
-  message(FATAL_ERROR "Unable to find SimGrid header file. Please point the SimGrid_PATH variable to the installation directory.")
-endif ()
-if (NOT EXISTS "${SimGrid_LIBRARY}")
-  message(FATAL_ERROR "Unable to find SimGrid library. Please point the SimGrid_PATH variable to the installation directory.")
-endif ()
-
-# Extract the actual path
-if (NOT "$SimGrid_INCLUDE_DIR" STREQUAL "${SimGrid_PATH}/include")
-      string(REGEX REPLACE "(.*)/include" "\\1" SimGrid_PATH "${SimGrid_INCLUDE_DIR}")
-endif()
+if (SimGrid_INCLUDE_DIR)
+  set(SimGrid_VERSION_REGEX "^#define SIMGRID_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)$")
+  file(STRINGS "${SimGrid_INCLUDE_DIR}/simgrid_config.h" SimGrid_VERSION_STRING REGEX ${SimGrid_VERSION_REGEX})
+  set(SimGrid_VERSION "")
 
-# Extract the actual version number
-file(READ "${SimGrid_INCLUDE_DIR}/simgrid_config.h" _SimGrid_CONFIG_H_CONTENTS)
-set(_SimGrid_VERSION_REGEX ".*#define SIMGRID_VERSION_STRING \"SimGrid version ([^\"]*)\".*")
-if ("${_SimGrid_CONFIG_H_CONTENTS}" MATCHES "${_SimGrid_VERSION_REGEX}")
-      string(REGEX REPLACE "${_SimGrid_VERSION_REGEX}" "\\1" SimGrid_VERSION "${_SimGrid_CONFIG_H_CONTENTS}")
-endif ("${_SimGrid_CONFIG_H_CONTENTS}" MATCHES "${_SimGrid_VERSION_REGEX}")
-  
+  # Concat the matches to MAJOR.MINOR.PATCH assuming they appear in this order
+  foreach(match ${SimGrid_VERSION_STRING})
+    if(SimGrid_VERSION)
+      set(SimGrid_VERSION "${SimGrid_VERSION}.")
+    endif()
+    string(REGEX REPLACE ${SimGrid_VERSION_REGEX} "${SimGrid_VERSION}\\2" SimGrid_VERSION ${match})
+    set(SimGrid_VERSION_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+  endforeach()
+  unset(SimGrid_VERSION_STRING)
+  unset(SimGrid_VERSION_REGEX)  
+endif ()
 
-message(STATUS "SimGrid found in ${SimGrid_PATH} (version ${SimGrid_VERSION})")
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SimGrid
+  FOUND_VAR SimGrid_FOUND
+  REQUIRED_VARS SimGrid_INCLUDE_DIR SimGrid_LIBRARY
+  VERSION_VAR SimGrid_VERSION
+)
 
+if (SimGrid_FOUND AND NOT CMAKE_VERSION VERSION_LESS 2.8.12)
+  add_library(SimGrid::SimGrid SHARED IMPORTED)
+  set_target_properties(SimGrid::SimGrid PROPERTIES
+    INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${SimGrid_INCLUDE_DIR}
+    INTERFACE_COMPILE_FEATURES cxx_alias_templates
+    IMPORTED_LOCATION ${SimGrid_LIBRARY}
+  )
+  # We need C++11, so check for it just in case the user removed it since compiling SimGrid
+  if (NOT CMAKE_VERSION VERSION_LESS 3.8)
+    # 3.8+ allows us to simply require C++11 (or higher)
+    set_property(TARGET SimGrid::SimGrid PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_11)
+  elseif (NOT CMAKE_VERSION VERSION_LESS 3.1)
+    # 3.1+ is similar but for certain features. We pick just one
+    set_property(TARGET SimGrid::SimGrid PROPERTY INTERFACE_COMPILE_FEATURES cxx_alias_templates)
+  else ()
+    # Old CMake can't do much. Just check the CXX_FLAGS and inform the user when a C++11 feature does not work
+    include(CheckCXXSourceCompiles)
+    set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS}")
+    check_cxx_source_compiles("using Foo = int; int main(){}" _SIMGRID_CXX11_ENABLED)
+    if (NOT _SIMGRID_CXX11_ENABLED)
+        message(WARNING "C++11 is required to use SimGrid. Enable it with e.g. -std=c++11")
+    endif ()
+    unset(_SIMGRID_CXX11_ENABLED CACHE)
+  endif ()
+endif ()
 
diff --git a/NEWS b/NEWS
index 72960dd..dc27034 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,34 @@
+                    _               _____  ____   ___
+__   _____ _ __ ___(_) ___  _ __   |___ / |___ \ / _ \
+\ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \   __) | | | |
+ \ V /  __/ |  \__ \ | (_) | | | |  ___) | / __/| |_| |
+  \_/ \___|_|  |___/_|\___/|_| |_| |____(_)_____|\___/
+               (NOT RELEASED)
+
+                    _               _____  _  ___   _
+__   _____ _ __ ___(_) ___  _ __   |___ / / |/ _ \ / |
+\ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \ | | (_) || |
+ \ V /  __/ |  \__ \ | (_) | | | |  ___) || |\__, || |
+  \_/ \___|_|  |___/_|\___/|_| |_| |____(_)_|  /_(_)_|
+               March 22 2018
+
+The Fixed ABI release.
+
+ * Reduce the changes to the binary interface of MSG,
+   accidentally introduced by v3.19.
                     _               _____  _  ___
 __   _____ _ __ ___(_) ___  _ __   |___ / / |/ _ \
 \ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \ | | (_) |
  \ V /  __/ |  \__ \ | (_) | | | |  ___) || |\__, |
   \_/ \___|_|  |___/_|\___/|_| |_| |____(_)_|  /_/
-               (not released yet)
+               March 20 2018
 
+The Moscovitly-cold Spring release.
+
+ * SMPI: Allow to start new actors and ranks after simulation start.
+ * SMPI: Support ICC, better testing on classical proxy apps.
+ * Some kernel headers are now installed, allowing external plugins.
+ * (+ the classical bug fixes and doc improvement)
                     _               _____  _  ___
 __   _____ _ __ ___(_) ___  _ __   |___ / / |( _ )
 \ \ / / _ \ '__/ __| |/ _ \| '_ \    |_ \ | |/ _ \
index 4dd9610..c0325a7 100644 (file)
@@ -3,31 +3,6 @@
 **
 ******************************************************
 
-There is at least 5 sub-projects in the tree:
-
- - XBT: eXtended Bundle of Tools (low-level toolbox: logging, datatypes).
- - SURF: a SimUlation aRtiFact. This is the simulation kernel.
- - MSG:  originally MetaSimGrid, MSG is a simple distributed application
-         simulator.
- - SMPI: Simulated MPI, to run MPI application using emulation technics;
- - MC: model-checker;
- - SIMIX: basix interface for simulated processes. This layer defines simcalls
-   (simulation calls) exposed to the simulated processes by the SIMIX "kernel".
-   This interface is used to implement the MSG, SMPI layers.
- - SIMDAG;
-
-They are all in the same tree because they are complementary tools and
-having all of them in the same package makes the installation easier
-for end-users. Moreover, it enables to share the compilation chain and
-eases the development.
-
-The tree is not split on projects, but on file finality:
- include/            -> all *public* headers
- include/xbt/*.h     -> one file per module
-
- src/include -> another location for protected headers. Used by SURF, and
-                other should be converted, since this is the Right Thing.
-
  examples/ -> Supposed to be copy/pastable by the user, so keep it clear and
                 avoid any kind of trick. In particular, do only include the
                 public headers here.
@@ -39,28 +14,33 @@ The tree is not split on projects, but on file finality:
                should leverage our tesh(1) utility.
 
 **
-** Indentation standard
+** NEW type naming standard in SimGrid4
 **
 *****************************************************
 
-Most files use the Kernighan & Ritchie coding style with 2 spaces of
-indentation. The indent program can help you to stick to it:
-
-indent -kr -l120 -nut -i2 -lps -npcs -br -brs -ce -cdw -bbo -npsl <myfile>
+SimGrid4 will follow the these rules:
 
-The script ./tools/internal/indent runs indent with the appropriate options.
+  - filenames are unique in the whole project 
+    (because of a bug in Sonar coverage computation)
+  C++
+  - fields, methods and variables are in snake_case()
+  - Classes and Enum are in CamelCase
+  - filenames: Class.cpp and Class.hpp
+  C
+  - variables and functions are in snake_case()
+  - typedefs do not hide the pointers, ie * must be explicit
+    char * sg_host_get_name(sg_host_t * host);
+  
 
-If you use Eclipse, please import the settings in ./tools/internal/eclipse-formating.xml
+This is different from the old convention (described below), that
+should not be used in S4U and its bindings, nor in the kernel.
 
 **
-** Type naming standard
+** OLD Type naming standard in SimGrid3
 **
 *****************************************************
 
-It may sound strange, but the type naming convention was source of intense
-discussion between da SimGrid posse members. The convention we came to may not
-be the best solution, but it has the merit to exist and leave everyone work.
-So please stick to it.
+SimGrid3 legacy interfaces (ie, MSG and SimDag) are following these rules:
 
   - ???_t is a valid type (built with typedef)
   - s_toto_t is a structure (access to fields with .)
@@ -83,30 +63,6 @@ is private.
 If you see any part of the code not following this convention, this is a
 bug. Please report it (or fix it yourself if you can).
 
-**
-** Random bits about coding standards and portability
-**
-*****************************************************
-
-MALLOC
- Don't use it, or you'll have to check the result (and do some dirty stuff
- on AIX). Use xbt_malloc (or even better, xbt_new) instead.
-
-SIZE_T (FIXME: obsolete?)
- If possible, avoid size_t and use unsigned long instead. If not,
- #include <sys/types.h> in all files manipulating size_t
- do cast it to unsigned long before printing (and use %lu),
- or use %zu.
-
-INTEGERS
- Please avoid to use long ints.  This is the source of many compatibility
- problems between 32 bits and 64 bits archs.  Either use plain ints (generally
- 32 bits wide) or long long ints (64 bits wide, at least).  At last resort
- consider using integer types defined in C99 by <stdint.h>.
-
-PRINTF pointer difference (FIXME: advertise %td instead?)
- printf ("diff = %ld\n", (long) (pointer2 - pointer1));
-
 **
 ** Commenting the source: doxygen
 **
@@ -129,78 +85,10 @@ The documentation of each function must be in the C file were it lives.
 
 Any public element (function, type and macro) must have a @brief part.
 
-**
-** XBT virtualization mechanism (FIXME: this section is deprecated)
-**
-****************************************************
-
-There is some functionalities that we want to virtualize in XBT. We
-want xbt_time to give the simulated clock when running on top of the
-simulator, and the host clock when running on a real system. This
-could be placed in GRAS (and was, historically), but there is some
-reason to lower it down to XBT.
-
-Here is the used naming scheme:
-
-  - xbt_<module>_<func>(): functions working both in SG and RL
-  - xbt_os_<module>_<func>(): RL functions usable even in simulator
-
-    That way, in libsimgrid, we still can use native functions if we
-    want to. It may for example be useful to get the real time when
-    implementing the simulator. Think of the SIGINT handler, which
-    wants to see if the user pressed the key twice in a 5 seconds
-    interval. This is of little use to check the simulated time here.
-
-Here is the file layout:
-
-  - xbt_rl_<module>.c: native implementation (xbt_<module>_<func>()).
-    Simply call the corresponding xbt_os_<module>_<func>.
-    Part only of libgras.so
-
-  - xbt_sg_<module>.c: SIMIX implementation xbt_<module>_<func>()).
-    Simply call the corresponding SIMIX implementation.
-    Part only of libsimgrid.so
-
-  - xbt_os_<module>.c: body of the functions implementing natively the
-    stuff (xbt_os_<module>_<func>()).
-    Part of both libgras.so and libsimgrid.so
-
-Since there is almost nothing in xbt_rl_module.c and xbt_sg_module.c,
-it'd be better to use symbol aliasing here (to declare in the object
-code that the same function have two names), but I'm still
-investigating the portability of the thing to windows.
-
 
 *
 * SimGrid Hacker Survival Guide (FIXME: should be betterly placed)
 ********************************
-
-* Before pushing any change, don't forget to check if the compilation
-  passes with compiler optimizations and warnings turned on:
-      cmake -Denable_compile_optimizations=ON \
-            -Denable_compile_warnings=ON
-
-* Your commit message should follow the git habits, explained eg here:
-  http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
-
 * When you add/remove files, and/or make changes in the lists of files to build,
   please check that "make distcheck" still succeeds.  This is needed to ensure
   that the generated archive is consistent.
-
-* If you want to debug memory allocation problems, here are a few hints:
-  - disable compiler optimizations, to have better backtraces;
-  - disable the mallocators, or it will be hard to match malloc's with
-    free's;
-  - disable model checking, unless your problem lies in the model
-    checker part of SimGrid (MC brings its own malloc implementation,
-    which valgrind doesn't understand).
-  All this is configured with:
-      cmake -Denable_model-checking=OFF \
-            -Denable_mallocators=OFF \
-            -Denable_compile_optimizations=OFF
-
-* If you break the logs (for example while hacking in the dynars), you
-  want to define XBT_LOG_MAYDAY at the beginning of log.h. It will
-  deactivate the whole logging mechanism, switching to printfs
-  instead. SimGrid becomes incredibly verbose when doing so, but it
-  you let you fixing the dynars.
index c40b913..9a93fc7 100644 (file)
@@ -1453,11 +1453,10 @@ INCLUDE_FILE_PATTERNS  =
 # undefined via #undef or recursively expanded use the := operator
 # instead of the = operator.
 
-PREDEFINED             = XBT_PUBLIC(type)="extern type" \
-                         XBT_EXPORT_NO_IMPORT(type)=type \
-                         XBT_IMPORT_NO_EXPORT(type)=type \
-                         XBT_PUBLIC_DATA(type)="extern type" \
-                         XBT_PUBLIC_CLASS=class \
+PREDEFINED             = XBT_PUBLIC= \
+                         XBT_EXPORT_NO_IMPORT= \
+                         XBT_IMPORT_NO_EXPORT= \
+                         XBT_PUBLIC_DATA=extern \
                          XBT_INLINE= \
                         XBT_PRIVATE=
 
index 0ef01a8..a5c2591 100644 (file)
@@ -1,25 +1,21 @@
 /*! @page uhood_tech Coding Standard and Technical Considerations
 
+This page describes the software infrastructure behind the SimGrid
+project. This is not the components' organisation (described in @ref
+uhood_arch) but informations on how to extend the framework, how the
+automatic tests are run, and so on. These informations are split on
+several pages, as follows:
 
-There is two main things you want to know about the internals of
-SimGrid. First, you need to understand the component organization, as
-SimGrid is heavily layered, with each level being rather highly
-specialized and optimized toward a task. For that, please head to 
-@ref uhood_arch. 
-
-Then, if you work actively on the SimGrid project, the second point
-you need to understand is about the infrastructure of the SimGrid
-project, ie how to extend the framework in any way, how the automatic
-tests are run, and so on. These informations are split on several
-pages, as follows:
-
+ - @ref uhood_tech_inside
  - @subpage inside_tests
  - @subpage inside_doxygen
  - @subpage inside_extending
  - @subpage inside_cmake
  - @subpage inside_release
 
-@section uhood_tech_config Insider's Configuration
+@section uhood_tech_inside Insiders Considerations
+
+@subsection uhood_tech_inside_config Extra configuration
 
 The default build configuration of SimGrid fits the user needs, but
 they are not adapted to the ones actually working on SimGrid. See @ref
@@ -37,7 +33,28 @@ we don't want to bother them with compiler warnings (that abort the
 build in SimGrid), but any insider must turn this option on, or your
 code will be refused from the main repository.
 
-@section uhood_tech_codstand Automatically Enforcing our Coding Standards
+@verbatim
+    cmake -Denable_compile_optimizations=OFF \
+          -Denable_compile_warnings=ON .
+@endverbatim
+
+@subsection uhood_tech_inside_commit Interacting with git
+
+During the Gran Refactoring to SimGrid4, things are evolving rather
+quickly, and some changes impact a large amount of files. You should
+thus not have long-standing branches, because they will rot very
+quickly and you will suffer to merge them back. Instead, you should
+work as much as possible with incremental changes that do not break
+things, and get them directly in master.
+
+Your commit message should follow the git habits, explained in this
+<a href="http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html">blog
+post</a>, or in the 
+<a href="https://github.com/atom/atom/blob/master/CONTRIBUTING.md#git-commit-messages">
+git styleguide of Atom</a>.
+
+  
+@subsection uhood_tech_inside_codstand Automatically Enforcing our Coding Standards
  
 If you plan to commit code to the SimGrid project, you definitely need
 to install the relevant tool to ensure that your changes follow our
@@ -45,7 +62,7 @@ coding standards:
 
 @verbatim
 # install clang-format
-sudo apt-get install clang-format-3.8 # debian
+sudo apt-get install clang-format-3.9 # debian
 
 # tell git to call the script on each commit
 ln -s $(realpath tools/git-hooks/clang-format.pre-commit) .git/hooks/pre-commit
@@ -60,7 +77,7 @@ to find the exact command with git-apply to fix your formating.
 If you find that for a specific commit, the formatter does a very bad
 job, then add --no-verify to your git commit command line.
 
-@section uhood_tech_tricks Insider tricks
+@subsection uhood_tech_tricks Random Tricks
 
 Over the years, we accumulated a few tricks that make it easier to
 work with SimGrid. Here is a somewhat unsorted list of such tricks.
@@ -81,9 +98,9 @@ each build/ subdir to test each of them separately.
 
 It is easy to break one build configuration or another. That's
 perfectly OK and we will not point fingers if it happens. But it is
-somewhat forbidden to leave the tree broken for a long while. Monitor
-the build daemons after you push something, and strive to fix any
-breakage ASAP.
+somewhat forbidden to leave the tree broken for more than one working
+day. Monitor the build daemons after you push something, and strive to
+fix any breakage ASAP.
 
 To easily switch between the configs without rebuilding everything,
 create a set of out of tree builds (as explained in @ref
@@ -107,4 +124,25 @@ after all).
 
 Note that the links sometimes broken by git or others. Relaunching
 `make hardlinks` may help if you're getting incoherent build results.
+
+### Unsorted hints
+
+* If you want to debug memory allocation problems, here are a few hints:
+  - disable compiler optimizations, to have better backtraces;
+  - disable the mallocators, or it will be hard to match malloc's with free's;
+  - disable model checking, unless your problem lies in the model
+    checker part of SimGrid (MC brings its own malloc implementation,
+    which valgrind does not really love).
+    All this is configured with:
+
+    cmake -Denable_model-checking=OFF 
+          -Denable_mallocators=OFF 
+         -Denable_compile_optimizations=OFF .
+
+* If you break the logs, you want to define XBT_LOG_MAYDAY at the
+  beginning of log.h. It deactivates the whole logging mechanism,
+  switching to printfs instead. SimGrid becomes incredibly verbose
+  when doing so, but it you let you fixing things.
+
+
 */
index 3124c78..f1e570f 100644 (file)
@@ -77,7 +77,7 @@ instance, examples/msg/CMakeLists.txt starts with a loop over all the (currently
  - add the source and tesh files to the distribution.
 
 \verbatim
-foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app-token-ring async-wait async-waitall 
+foreach(x app-masterworker app-pingpong app-pmm app-token-ring async-wait async-waitall 
           async-waitany cloud-capping cloud-masterworker cloud-migration cloud-multicore cloud-simple 
           cloud-two-tasks dht-chord dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm
           platform-failures io-file io-remote io-storage task-priority process-create process-kill process-migration 
@@ -108,7 +108,7 @@ If your example require a deployment file (see @ref deployment for details), nam
 Then add the name of your example to this foreach loop.
 
 \verbatim
-foreach (file actions-comm actions-storage app-bittorrent app-chainsend app-masterworker app-pingpong async-wait
+foreach (file app-bittorrent app-chainsend app-masterworker app-pingpong async-wait
          async-waitall async-waitany dht-chord dht-kademlia dht-pastry io-remote platform-properties maestro-set 
          task-priority)
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
@@ -119,7 +119,7 @@ If your example includes extra source, text, XML, or tesh files, add them to the
 example to the testing infrastructure. See \ref inside_tests_add_integration for more details.
 
 \verbatim
-foreach(x actions-comm actions-storage app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring
+foreach(x app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring
           async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple 
           cloud-two-tasks dht-chord dht-kademlia platform-failures io-file io-remote io-storage task-priority 
           process-kill process-migration process-suspend platform-properties synchro-semaphore process-startkilltime)
index 0aadd25..4758cfa 100644 (file)
@@ -3,11 +3,9 @@
 
 \tableofcontents
 
-We use doxygen for our documentation. This tool is sometimes annoying
-but that's the best we've found so far. Remember, we all bitch about
-doxygen, but at the end of the day, it kinda delivers what we need. So
-stop bitching about the doc or the tools, and start improving the
-documentation text itself.
+We use doxygen for our documentation. It's annoying but that's the
+best we've found so far. Stop bitching about the doc or the tools, and
+start improving the documentation text itself.
 
 Good documentation is rare and there is not much project of which we
 can get inspiration. The best exception I know is TikZ and
@@ -216,8 +214,8 @@ make pdf # the result is in doc/latex/simgrid_documentation.pdf
 Once you're satisfyied with the result, refreshing the documentation
 on the web pages is very easy, as shown below. A few permission errors
 are ok, unfortunately. We should improve things here, but I'm not sure
-of how. A funny thing is that this make target is also provided in the
-archives we distribute to the users, but I guess that it's harmless :)
+of how. This @c make target is also provided in the archives we
+distribute to the users, but I guess that it's harmless :)
 
 @verbatim
 make sync-gforge-doc
index 9593489..e13c61c 100644 (file)
@@ -108,7 +108,7 @@ initialization function.
 s_surf_model_description_t surf_plugin_description[] = {
                   {"Energy",
                    "Cpu energy consumption.",
-                   sg_energy_plugin_init},
+                   sg_host_energy_plugin_init},
                   {"MyNetworkPlugin",
                    "My network plugin.",
                    sg_my_network_plugin_init},
index d96ea36..7422e9e 100644 (file)
@@ -9,14 +9,15 @@ Please apply the following checklist before releasing.
 
 - Sources
   - The external patches (Debian, etc) are integrated.
-    The COPYING file is aligned with Debian's copyright file.
-  - The version number is correctly marked in CMakeLists.txt, in macros
-    SIMGRID_VERSION_MAJOR and friends. 
+    The COPYING file is aligned with Debian's copyright file, and the
+    dates of SimGrid chunks are accurate.
+  - The version number is correctly marked in CMakeLists.txt (in macros
+    SIMGRID_VERSION_*), and also in sonar-project.properties
   - The "make distcheck" target works (testing that every files needed
     to build and install are included in the archive)
 - Tests
   - All tests pass on a reasonable amount of platforms (typically,
-    everything on ci)
+    everything on ci + travis/Mac + AppVeyor)
   - You also tested to build and install the content of the source
     archive on a reasonable amount of platforms (typically, 2 or 3).
 - ChangeLog file
@@ -42,8 +43,8 @@ cmake . && make dist
 
 If you prefer, you can clean your repository the hard way:
 \verbatim
-git reset --hard master # warning, it will kill your uncommited changes
-git clean -dfx          # warning, it will kill your uncommited changes
+git reset --hard master # remove all uncommited changes to the files tracked by git
+git clean -dfx          # delete all files and directories that are not tracked by git
 cmake . && make dist
 \endverbatim
 
@@ -52,9 +53,25 @@ cmake . && make dist
 Get the jarfiles for several OSes on the CI slaves. Use Save under to
 give a separate name to each of them.
 
-- On Jenkins: Mac OSX, Linux 64 and Linux 32 (without boost-context), FreeBSD, NetBSD
+- On Jenkins: Mac OSX, Linux 64 and Linux 32 (without boost-context), FreeBSD
 - On AppVeyor: Windows 
 
+For Linux, it is safer to rebuild them in a chroot (to avoid
+boost-context and all other optional dependencies):
+\verbatim
+mkdir /tmp/build-amd64
+cp SimGrid-3.*.tar.gz /tmp/build-amd64
+sudo debootstrap --arch amd64 --variant=buildd testing /tmp/build-amd64 http://deb.debian.org/debian/
+sudo chroot /tmp/build-amd64
+echo "proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0" >> /tmp/fstab
+mount proc /proc -t proc
+apt-get install -y cmake default-jdk libboost-dev python3 
+cd tmp
+tar xfz ../SimGrid*tar.gz && cd SimGrid-*
+cmake . -Denable_documentation=off -Denable_java=ON
+make -j4 && ctest -R java
+\endverbatim
+
 Once all jarfiles are in a separate directory, run the following to
 merge them:
 \verbatim
@@ -112,7 +129,7 @@ the settings icon of the release you want to change.
     - libsimgrid3.XY conflicts with libsimgrid3.XX because of smpimain
 - Update the simgrid/package.py for spack: https://gitlab.inria.fr/solverstack/spack-repo
 - Create the template for the next release in ChangeLog and NEWS files
-- Change the release number in CMakeLists.txt and sonar-project.properties
+- Change the release number to 3.X.90 in CMakeLists.txt and sonar-project.properties
 - Deal with deprecations:
   - Introduce the XBT_ATTRIB_DEPRECATED_v??? macro for the next release.
   - Kill the one for the current release and remove all code that were
index 21d187f..7845eb2 100644 (file)
@@ -326,13 +326,14 @@ manager there, and it works like a charm.
 AppVeyor aims at becoming the Travis of Windows. It is maybe less
 mature than Travis, or maybe it is just that I'm less trained in
 Windows. Our configuration is in the file appveyor.yml as it should
-be, and the result is here: https://ci.appveyor.com/project/simgrid/simgrid
+be, and the result is here: https://ci.appveyor.com/project/mquinson/simgrid
 
 We use \c Choco as a package manager on AppVeyor, and it is sufficient
 for us. In the future, we will probably move to the ubuntu subsystem
-of Windows 10: SimGrid performs very well under these settings, but
-unfortunately we have no continuous integration service providing it
-yet, so we cannot drop AppVeyor yet.
+of Windows 10: SimGrid performs very well under these settings, as
+tested on Inria's CI servers. For the time being having a native
+library is still useful for the Java users that don't want to install
+anything beyond Java on their windows.
 
 \subsection inside_tests_debian Debian builders
 
index 09bacff..1046f52 100644 (file)
@@ -22,9 +22,6 @@ documentation.
 Here is a `CMakeLists.txt` that you can use as a starting point for
 your project. It builds two simulators from a given set of source files.
 
-You first need to copy the `FindSimGrid.cmake` (at the root of the
-SimGrid tree) into the `cmake/Modules` directory of your project.
-
 @verbatim
 project(MyFirstScheduler)
 
@@ -43,6 +40,15 @@ add_executable(other_xp ${OTHER_SOURCES})
 target_link_libraries(other_xp ${SimGrid_LIBRARY})
 @endverbatim
 
+For that, you need <a href="https://github.com/simgrid/simgrid/blob/master/FindSimGrid.cmake">FindSimGrid.cmake</a>,
+that is located at the root of the SimGrid tree. You can either copy
+this file into the `cmake/Modules` directory of your project, or use
+the version installed on the disk. Both solutions present advantages
+and drawback: if you copy the file, you have to keep it in sync
+manually but your project will produce relevant error messages when
+trying to compile on a machine where SimGrid is not installed. Please
+also refer to the file header for more information.
+
 @section install_yours_makefile Building your project with Makefile
 
 Here is a Makefile that will work if your project is composed of three
index 1354486..bbeaed2 100644 (file)
@@ -641,10 +641,11 @@ make
 @endverbatim
 
 Indeed, the programs compiled with <tt>smpicc</tt> cannot be executed
-without <tt>smpirun</tt>, while configure wants to test them directly.
-With <tt>SMPI_PRETEND_CC</tt>, any program compiled with smpicc stops
-and returns 0 before doing anything that would fail without
-<tt>smpirun</tt>.
+without <tt>smpirun</tt> (they are shared libraries, and they do weird
+things on startup), while configure wants to test them directly.
+With <tt>SMPI_PRETEND_CC</tt> smpicc does not compile as shared,
+and the SMPI initialization stops and returns 0 before doing anything
+that would fail without <tt>smpirun</tt>.
 
 \warning 
 
index c0ceffc..7441cab 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* sprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
index 317335f..2b71a0b 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* sprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
index 29d10fa..8cb7f19 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* sprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
index 4aaade0..890cdc4 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* sprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
index 64cccb6..4ff16b0 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* sprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
index ff45776..55aaf69 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2010-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_masterworker, "Messages specific for this msg example");
 
 /* Main function of the master process */
index 07c7556..93b2ef3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -6,6 +6,8 @@
 #include "simgrid/msg.h"
 #include "simgrid/plugins/live_migration.h"
 
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define MAXMBOXLEN 64
index d40ca6c..f932373 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012, 2014-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2018. 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. */
@@ -9,6 +8,9 @@
 #include "task.h"
 
 #include "simgrid/msg.h"
+
+#include <stdio.h> /* snprintf */
+
 /** @addtogroup MSG_examples
   * <b>kademlia/kademlia.c: Kademlia protocol</b>
   * Implements the Kademlia protocol, using 32 bits identifiers.
index 2d8c22f..20b9fbe 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010, 2012-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -8,6 +7,8 @@
 #include "routing_table.h"
 #include "simgrid/msg.h"
 
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_kademlia_node, "Messages specific for this msg example");
 
 /** @brief Initialization of a node
index c19cd35..191ae07 100644 (file)
@@ -6,8 +6,9 @@
 
 #include "simgrid/msg.h"
 #include "xbt/dynar.h"
-#include <math.h>
 
+#include <math.h>
+#include <stdio.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry, "Messages specific for this msg example");
 
index cfd16e1..d334f66 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -15,8 +15,8 @@
 #include <unistd.h>
 #endif
 
-#include "simgrid/msg.h"
-#include "mc/mc.h"
+#include <simgrid/modelchecker.h>
+#include <simgrid/msg.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(bugged1_liveness, "my log messages");
 
index b363faf..5a6d2d2 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2018. 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. */
@@ -10,8 +9,8 @@
 /* LTL property checked : !(GFcs)                                             */
 /******************************************************************************/
 
-#include "simgrid/msg.h"
-#include "mc/mc.h"
+#include <simgrid/modelchecker.h>
+#include <simgrid/msg.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(bugged3, "my log messages");
 
index 390ca97..f133b16 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 int timer_start; //set as 1 in the master process
index 6875eb0..7771e50 100644 (file)
@@ -1,11 +1,12 @@
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 #define FINALIZE ((void*)221297)        /* a magic number to tell people to stop working */
index 4917717..9abbad2 100644 (file)
@@ -88,7 +88,7 @@ int main(int argc, char *argv[])
   }
   xbt_dynar_t edges_type = TRACE_get_edge_types ();
   if (edges_type){
-    XBT_INFO ("Node types in the trace:");
+    XBT_INFO("Edge types in the trace:");
     char *edge_type;
     xbt_dynar_foreach (edges_type, cursor, edge_type){
       XBT_INFO ("%s", edge_type);
index be7db02..370a3dc 100644 (file)
@@ -11,7 +11,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/trace-host-user-variables$EXEEXT --cfg=tracing:yes
 > [0.004078] [msg_test/INFO] Node types in the trace:
 > [0.004078] [msg_test/INFO] HOST
 > [0.004078] [msg_test/INFO] LINK
-> [0.004078] [msg_test/INFO] Node types in the trace:
+> [0.004078] [msg_test/INFO] Edge types in the trace:
 > [0.004078] [msg_test/INFO] 0-HOST1-LINK3
 > [0.004078] [msg_test/INFO] 0-LINK3-HOST1
 > [0.004078] [msg_test/INFO] 0-LINK3-LINK3
index 2326be5..c75ba60 100644 (file)
@@ -118,15 +118,15 @@ $ tail -n +3 procmig.trace
 > %EndEventDef
 > 0 1 0 HOST
 > 6 0 1 1 0 "Tremblay"
-> 0 2 1 MSG_PROCESS
-> 2 3 2 MSG_PROCESS_STATE
+> 0 2 1 ACTOR
+> 2 3 2 ACTOR_STATE
 > 5 4 3 suspend "1 0 1"
 > 5 5 3 sleep "1 1 0"
 > 5 6 3 receive "1 0 0"
 > 5 7 3 send "0 0 1"
 > 5 8 3 task_execute "0 1 1"
-> 4 9 0 2 2 MSG_PROCESS_LINK
-> 4 10 0 2 2 MSG_PROCESS_TASK_LINK
+> 4 9 0 2 2 ACTOR_LINK
+> 4 10 0 2 2 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
@@ -514,15 +514,15 @@ $ tail -n +3 procmig.trace
 > 6 0 1 1 0 "Tremblay"
 > 1 2 1 power "1 1 1"
 > 1 3 1 power_used "0.5 0.5 0.5"
-> 0 4 1 MSG_PROCESS
-> 2 5 4 MSG_PROCESS_STATE
+> 0 4 1 ACTOR
+> 2 5 4 ACTOR_STATE
 > 5 6 5 suspend "1 0 1"
 > 5 7 5 sleep "1 1 0"
 > 5 8 5 receive "1 0 0"
 > 5 9 5 send "0 0 1"
 > 5 10 5 task_execute "0 1 1"
-> 4 11 0 4 4 MSG_PROCESS_LINK
-> 4 12 0 4 4 MSG_PROCESS_TASK_LINK
+> 4 11 0 4 4 ACTOR_LINK
+> 4 12 0 4 4 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
@@ -1116,15 +1116,15 @@ $ tail -n +3 procmig.trace
 > 6 0 1 1 0 "Tremblay"
 > 1 2 1 power "1 1 1"
 > 1 3 1 power_used "0.5 0.5 0.5"
-> 0 4 1 MSG_PROCESS
-> 2 5 4 MSG_PROCESS_STATE
+> 0 4 1 ACTOR
+> 2 5 4 ACTOR_STATE
 > 5 6 5 suspend "1 0 1"
 > 5 7 5 sleep "1 1 0"
 > 5 8 5 receive "1 0 0"
 > 5 9 5 send "0 0 1"
 > 5 10 5 task_execute "0 1 1"
-> 4 11 0 4 4 MSG_PROCESS_LINK
-> 4 12 0 4 4 MSG_PROCESS_TASK_LINK
+> 4 11 0 4 4 ACTOR_LINK
+> 4 12 0 4 4 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
@@ -2529,15 +2529,15 @@ $ tail -n +3 simgrid.trace
 > %EndEventDef
 > 0 1 0 HOST
 > 6 0 1 1 0 "Tremblay"
-> 0 2 1 MSG_PROCESS
-> 2 3 2 MSG_PROCESS_STATE
+> 0 2 1 ACTOR
+> 2 3 2 ACTOR_STATE
 > 5 4 3 suspend "1 0 1"
 > 5 5 3 sleep "1 1 0"
 > 5 6 3 receive "1 0 0"
 > 5 7 3 send "0 0 1"
 > 5 8 3 task_execute "0 1 1"
-> 4 9 0 2 2 MSG_PROCESS_LINK
-> 4 10 0 2 2 MSG_PROCESS_TASK_LINK
+> 4 9 0 2 2 ACTOR_LINK
+> 4 10 0 2 2 ACTOR_TASK_LINK
 > 6 0 2 1 0 "Jupiter"
 > 6 0 3 1 0 "Fafard"
 > 6 0 4 1 0 "Ginette"
index 8782111..64eb278 100644 (file)
@@ -1,4 +1,4 @@
-foreach (example actor-create actor-daemon actor-join actor-kill actor-kill-pid
+foreach (example actor-create actor-daemon actor-join actor-kill
                  actor-lifetime actor-migration actor-suspend actor-yield
                  app-chainsend app-masterworker app-pingpong app-token-ring
                  async-wait async-waitany async-waitall
@@ -85,7 +85,7 @@ set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-re
                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-storage/s4u-replay-storage.txt
                                   ${CMAKE_CURRENT_SOURCE_DIR}/README.doc                                   PARENT_SCOPE)
 
-foreach(example actor-create actor-daemon actor-join actor-kill actor-kill-pid
+foreach(example actor-create actor-daemon actor-join actor-kill
                 actor-lifetime actor-migration actor-suspend actor-yield
                 app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring 
                 async-wait async-waitall async-waitany
diff --git a/examples/s4u/actor-kill-pid/s4u-actor-kill-pid.cpp b/examples/s4u/actor-kill-pid/s4u-actor-kill-pid.cpp
deleted file mode 100644 (file)
index 3f1c42d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (c) 2017-2018 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/s4u.hpp>
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_kill_pid, "Messages specific for this s4u example");
-
-static int on_exit(void*, void*)
-{
-  XBT_INFO("I have been killed!");
-  return 0;
-}
-
-static void victimA_fun()
-{
-  simgrid::s4u::this_actor::onExit(on_exit, nullptr);
-  XBT_INFO("Hello!");
-  XBT_INFO("Suspending myself");
-  simgrid::s4u::this_actor::suspend(); /* - Start by suspending itself */
-  XBT_INFO("OK, OK. Let's work");      /* - Then is resumed and start to execute a task */
-  simgrid::s4u::this_actor::execute(1e9);
-  XBT_INFO("Bye!"); /* - But will never reach the end of it */
-}
-
-static void victimB_fun()
-{
-  XBT_INFO("Terminate before being killed");
-}
-
-static void killer()
-{
-  XBT_INFO("Hello!"); /* - First start a victim process */
-  simgrid::s4u::ActorPtr victimA =
-      simgrid::s4u::Actor::createActor("victim A", simgrid::s4u::Host::by_name("Fafard"), victimA_fun);
-  simgrid::s4u::ActorPtr victimB =
-      simgrid::s4u::Actor::createActor("victim B", simgrid::s4u::Host::by_name("Jupiter"), victimB_fun);
-  simgrid::s4u::this_actor::sleep_for(10); /* - Wait for 10 seconds */
-
-  XBT_INFO("Resume the victim A"); /* - Resume it from its suspended state */
-  victimA->resume();
-  simgrid::s4u::this_actor::sleep_for(2);
-
-  aid_t pidA = victimA->getPid();
-  XBT_INFO("Kill the victim A (pid=%lu)", pidA); /* - and then kill it */
-  simgrid::s4u::Actor::kill(pidA);
-
-  aid_t pidB = victimB->getPid();
-  XBT_INFO("Kill victimB (pid=%lu), even if it's already dead", pidB); /* that's a no-op, there is no zombies in SimGrid */
-  try
-  {
-    simgrid::s4u::Actor::kill(pidB);
-  } catch (const std::runtime_error& e) {
-    XBT_DEBUG("Caught exception: %s", e.what());
-  }
-  simgrid::s4u::this_actor::sleep_for(1);
-
-  XBT_INFO("Killing everybody but myself");
-  simgrid::s4u::Actor::killAll();
-
-  aid_t pidMe = simgrid::s4u::this_actor::getPid();
-  XBT_INFO("OK, goodbye now. I commit a suicide (pid=%lu).", pidMe);
-  simgrid::s4u::Actor::kill(pidMe);
-
-  XBT_INFO("This line will never get displayed: I'm already dead since the previous line.");
-}
-
-int main(int argc, char* argv[])
-{
-  simgrid::s4u::Engine e(&argc, argv);
-  xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
-
-  e.loadPlatform(argv[1]); /* - Load the platform description */
-  /* - Create and deploy killer process, that will create the victim actors  */
-  simgrid::s4u::Actor::createActor("killer", simgrid::s4u::Host::by_name("Tremblay"), killer);
-
-  e.run(); /* - Run the simulation */
-
-  XBT_INFO("Simulation time %g", e.getClock());
-
-  return 0;
-}
diff --git a/examples/s4u/actor-kill-pid/s4u-actor-kill-pid.tesh b/examples/s4u/actor-kill-pid/s4u-actor-kill-pid.tesh
deleted file mode 100644 (file)
index e6171fc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env tesh
-
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-kill-pid ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
->[  0.000000] (killer@Tremblay) Hello!
->[  0.000000] (victim A@Fafard) Hello!
->[  0.000000] (victim A@Fafard) Suspending myself
->[  0.000000] (victim B@Jupiter) Terminate before being killed
->[ 10.000000] (killer@Tremblay) Resume the victim A
->[ 10.000000] (victim A@Fafard) OK, OK. Let's work
->[ 12.000000] (killer@Tremblay) Kill the victim A (pid=2)
->[ 12.000000] (killer@Tremblay) Kill victimB (pid=3), even if it's already dead
->[ 13.000000] (killer@Tremblay) Killing everybody but myself
->[ 13.000000] (victim A@Fafard) I have been killed!
->[ 13.000000] (killer@Tremblay) OK, goodbye now. I commit a suicide (pid=1).
->[ 13.000000] (maestro@) Simulation time 13
index 78658b9..3663640 100644 (file)
@@ -43,10 +43,13 @@ static void killer()
   simgrid::s4u::this_actor::sleep_for(2);
 
   XBT_INFO("Kill the victim A"); /* - and then kill it */
-  victimA->kill();
+  simgrid::s4u::Actor::kill(victimA->getPid()); // Kill by PID is legit
+
+  simgrid::s4u::this_actor::sleep_for(1);
 
   XBT_INFO("Kill victimB, even if it's already dead"); /* that's a no-op, there is no zombies in SimGrid */
-  victimB->kill();
+  victimB->kill(); // the actor is automatically garbage-collected after this last reference
+
   simgrid::s4u::this_actor::sleep_for(1);
 
   XBT_INFO("Killing everybody but myself");
index 2e31458..eca4cd3 100644 (file)
@@ -9,7 +9,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/s4u-actor-kill ${platfdir}/small_platform.xml "--l
 > [ 10.000000] (victim A@Fafard) OK, OK. Let's work
 > [ 12.000000] (killer@Tremblay) Kill the victim A
 > [ 12.000000] (victim A@Fafard) I have been killed!
-> [ 12.000000] (killer@Tremblay) Kill victimB, even if it's already dead
-> [ 13.000000] (killer@Tremblay) Killing everybody but myself
-> [ 13.000000] (killer@Tremblay) OK, goodbye now. I commit a suicide.
-> [ 13.000000] (maestro@) Simulation time 13
+> [ 13.000000] (killer@Tremblay) Kill victimB, even if it's already dead
+> [ 14.000000] (killer@Tremblay) Killing everybody but myself
+> [ 14.000000] (killer@Tremblay) OK, goodbye now. I commit a suicide.
+> [ 14.000000] (maestro@) Simulation time 14
index f93c062..2a23590 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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/plugins/file_system.h>
 #include <simgrid/s4u.hpp>
-#include <src/plugins/file_system/FileSystem.hpp>
 #include <string>
 
 #define INMEGA (1024 * 1024)
@@ -54,19 +54,18 @@ int main(int argc, char** argv)
   e.loadPlatform(argv[1]);
   e.registerFunction("host", host);
   e.loadDeployment(argv[2]);
-  std::map<std::string, simgrid::s4u::Storage*> allStorages;
-  simgrid::s4u::getStorageList(&allStorages);
+  std::vector<simgrid::s4u::Storage*> allStorages = e.getAllStorages();
 
   for (auto const& s : allStorages) {
-    XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA,
-             sg_storage_get_size_free(s.second) / INMEGA, s.second->getCname());
+    XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA,
+             sg_storage_get_size_free(s) / INMEGA, s->getCname());
   }
 
   e.run();
 
   for (auto const& s : allStorages) {
-    XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA,
-             sg_storage_get_size_free(s.second) / INMEGA, s.second->getCname());
+    XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA,
+             sg_storage_get_size_free(s) / INMEGA, s->getCname());
   }
 
   XBT_INFO("Simulation time %g", simgrid::s4u::Engine::getClock());
index c676b07..832d267 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -6,8 +6,8 @@
 #include <string>
 #include <unordered_map>
 
+#include "simgrid/plugins/file_system.h"
 #include "simgrid/s4u.hpp"
-#include "src/plugins/file_system/FileSystem.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
 
index 4c5db1e..42c9481 100644 (file)
@@ -6,24 +6,23 @@
 #include "simgrid/s4u.hpp"
 #include "xbt/replay.hpp"
 #include "xbt/str.h"
+#include <boost/algorithm/string/join.hpp>
 #include <string>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(replay_comm, "Messages specific for this msg example");
 
 #define ACT_DEBUG(...)                                                                                                 \
-  if (XBT_LOG_ISENABLED(replay_comm, xbt_log_priority_verbose)) {                                                      \
-    char* NAME = xbt_str_join_array(action, " ");                                                                      \
+  if (XBT_LOG_ISENABLED(replay_comm, xbt_log_priority_verbose)) {                                                   \
+    std::string NAME = boost::algorithm::join(action, " ");                                                            \
     XBT_DEBUG(__VA_ARGS__);                                                                                            \
-    xbt_free(NAME);                                                                                                    \
   } else                                                                                                               \
   ((void)0)
 
-static void log_action(const char* const* action, double date)
+static void log_action(simgrid::xbt::ReplayAction& action, double date)
 {
   if (XBT_LOG_ISENABLED(replay_comm, xbt_log_priority_verbose)) {
-    char* name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, date);
-    xbt_free(name);
+    std::string s = boost::algorithm::join(action, " ");
+    XBT_VERB("%s %f", s.c_str(), date);
   }
 }
 
@@ -49,36 +48,37 @@ public:
   }
 
   /* My actions */
-  static void compute(const char* const* action)
+  static void compute(simgrid::xbt::ReplayAction& action)
   {
     double amount = std::stod(action[2]);
     double clock  = simgrid::s4u::Engine::getClock();
-    ACT_DEBUG("Entering %s", NAME);
+    ACT_DEBUG("Entering %s", NAME.c_str());
     simgrid::s4u::this_actor::execute(amount);
     log_action(action, simgrid::s4u::Engine::getClock() - clock);
   }
 
-  static void send(const char* const* action)
+  static void send(simgrid::xbt::ReplayAction& action)
   {
     double size                 = std::stod(action[3]);
     std::string* payload        = new std::string(action[3]);
     double clock                = simgrid::s4u::Engine::getClock();
     simgrid::s4u::MailboxPtr to = simgrid::s4u::Mailbox::byName(simgrid::s4u::this_actor::getName() + "_" + action[2]);
-    ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME, size,
-              simgrid::s4u::this_actor::getCname(), to->getCname());
+    ACT_DEBUG("Entering Send: %s (size: %g) -- Actor %s on mailbox %s", NAME.c_str(), size,
+    simgrid::s4u::this_actor::getCname(), to->getCname());
     to->put(payload, size);
     delete payload;
 
     log_action(action, simgrid::s4u::Engine::getClock() - clock);
   }
 
-  static void recv(const char* const* action)
+  static void recv(simgrid::xbt::ReplayAction& action)
   {
     double clock = simgrid::s4u::Engine::getClock();
     simgrid::s4u::MailboxPtr from =
         simgrid::s4u::Mailbox::byName(std::string(action[2]) + "_" + simgrid::s4u::this_actor::getName());
 
-    ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME, simgrid::s4u::this_actor::getCname(), from->getCname());
+    ACT_DEBUG("Receiving: %s -- Actor %s on mailbox %s", NAME.c_str(), simgrid::s4u::this_actor::getCname(),
+    from->getCname());
     from->get();
     log_action(action, simgrid::s4u::Engine::getClock() - clock);
   }
index 543b21e..3d69a72 100644 (file)
@@ -1,33 +1,31 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2017-2018. 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/s4u.hpp"
-#include "src/plugins/file_system/FileSystem.hpp"
-#include <boost/algorithm/string/join.hpp>
 #include <simgrid/plugins/file_system.h>
+#include <simgrid/s4u.hpp>
 #include <xbt/replay.hpp>
 #include <xbt/str.h>
 
+#include <boost/algorithm/string/join.hpp>
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(replay_storage, "Messages specific for this example");
 
 static std::unordered_map<std::string, simgrid::s4u::File*> opened_files;
 
 #define ACT_DEBUG(...)                                                                                                 \
   if (XBT_LOG_ISENABLED(replay_storage, xbt_log_priority_verbose)) {                                                   \
-    char* NAME = xbt_str_join_array(action, " ");                                                                      \
+    std::string NAME = boost::algorithm::join(action, " ");                                                            \
     XBT_DEBUG(__VA_ARGS__);                                                                                            \
-    xbt_free(NAME);                                                                                                    \
   } else                                                                                                               \
   ((void)0)
 
-static void log_action(const char* const* action, double date)
+static void log_action(simgrid::xbt::ReplayAction& action, double date)
 {
   if (XBT_LOG_ISENABLED(replay_storage, xbt_log_priority_verbose)) {
-    char* name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, date);
-    xbt_free(name);
+    std::string s = boost::algorithm::join(action, " ");
+    XBT_VERB("%s %f", s.c_str(), date);
   }
 }
 
@@ -60,13 +58,13 @@ public:
   }
 
   /* My actions */
-  static void open(const char* const* action)
+  static void open(simgrid::xbt::ReplayAction& action)
   {
     std::string file_name = action[2];
     double clock          = simgrid::s4u::Engine::getClock();
     std::string full_name = simgrid::s4u::this_actor::getName() + ":" + file_name;
 
-    ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name.c_str());
+    ACT_DEBUG("Entering Open: %s (filename: %s)", NAME.c_str(), file_name.c_str());
     simgrid::s4u::File* file = new simgrid::s4u::File(file_name, NULL);
 
     opened_files.insert({full_name, file});
@@ -74,7 +72,7 @@ public:
     log_action(action, simgrid::s4u::Engine::getClock() - clock);
   }
 
-  static void read(const char* const* action)
+  static void read(simgrid::xbt::ReplayAction& action)
   {
     std::string file_name = action[2];
     sg_size_t size        = std::stoul(action[3]);
@@ -82,20 +80,20 @@ public:
 
     simgrid::s4u::File* file = get_file_descriptor(file_name);
 
-    ACT_DEBUG("Entering Read: %s (size: %llu)", NAME, size);
+    ACT_DEBUG("Entering Read: %s (size: %llu)", NAME.c_str(), size);
     file->read(size);
 
     log_action(action, simgrid::s4u::Engine::getClock() - clock);
   }
 
-  static void close(const char* const* action)
+  static void close(simgrid::xbt::ReplayAction& action)
   {
     std::string file_name = action[2];
     double clock          = simgrid::s4u::Engine::getClock();
 
     simgrid::s4u::File* file = get_file_descriptor(file_name);
 
-    ACT_DEBUG("Entering Close: %s (filename: %s)", NAME, file_name.c_str());
+    ACT_DEBUG("Entering Close: %s (filename: %s)", NAME.c_str(), file_name.c_str());
     delete file;
 
     log_action(action, simgrid::s4u::Engine::getClock() - clock);
index bc36f0f..f4a0b0b 100644 (file)
@@ -3,9 +3,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/kernel/routing/ClusterZone.hpp"
+#include "simgrid/kernel/routing/DragonflyZone.hpp"
 #include "simgrid/s4u.hpp"
-#include "src/kernel/routing/ClusterZone.hpp"
-#include "src/kernel/routing/DragonflyZone.hpp"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
 
index 2d08813..07861d3 100644 (file)
@@ -1,10 +1,18 @@
 if(enable_smpi)
   set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
+  set(CMAKE_CXX_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicxx")
   include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
 
   file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mc/")
 
-  foreach(x replay trace trace_simple trace_call_location energy)
+  foreach(x replay)
+    add_executable       (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
+    target_link_libraries(smpi_${x} simgrid)
+    set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+    set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
+  endforeach()
+
+  foreach(x trace trace_simple trace_call_location energy)
     add_executable       (smpi_${x} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
     target_link_libraries(smpi_${x} simgrid)
     set_target_properties(smpi_${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
similarity index 83%
rename from examples/smpi/replay/replay.c
rename to examples/smpi/replay/replay.cpp
index fb0e9f9..e101ddd 100644 (file)
@@ -8,19 +8,20 @@
 
 /* This shows how to extend the trace format by adding a new kind of events.
    This function is registered through xbt_replay_action_register() below. */
-static void action_blah(const char* const* args)
+static void action_blah(simgrid::xbt::ReplayAction& args)
 {
   /* Add your answer to the blah event here.
      args is a strings array containing the blank-separated parameters found in the trace for this event instance. */
 }
 
 action_fun previous_send;
-static void overriding_send(const char* const* args)
+static void overriding_send(simgrid::xbt::ReplayAction& args)
 {
-  (*previous_send)(args); // Just call the overriden symbol. That's a toy example.
+  previous_send(args); // Just call the overriden symbol. That's a toy example.
 }
 
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[])
+{
   /* Setup things and register default actions */
   smpi_replay_init(&argc, &argv);
 
index e2ca245..4b70705 100644 (file)
@@ -263,6 +263,7 @@ $ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --
 > [Fafard:2:(3) 29.490406] [smpi_replay/VERBOSE] 2 compute 2.5e8 3.276712
 > [Fafard:2:(3) 29.490606] [smpi_replay/VERBOSE] 2 test 0.000200
 > [Fafard:2:(3) 32.767318] [smpi_replay/VERBOSE] 2 compute 2.5e8 3.276712
+> [Fafard:2:(3) 32.767318] [smpi_replay/VERBOSE] 2 wait 0.000000
 > [Fafard:2:(3) 32.767318] [smpi_replay/VERBOSE] 2 Isend 0 1e6 0.000000
 > [Tremblay:0:(1) 32.923014] [smpi_replay/VERBOSE] 0 recv 2 1e6 12.367458
 > [Fafard:2:(3) 39.320741] [smpi_replay/VERBOSE] 2 compute 5e8 6.553424
@@ -270,7 +271,7 @@ $ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --
 
 $ rm -f replay/one_trace
 
-p Test of Isend replay with SMPI (one trace for all processes)
+p Test of AllReduce replay with SMPI (one trace for all processes)
 
 < replay/actions_allReduce.txt
 $ mkfile replay/one_trace
@@ -319,11 +320,12 @@ p Test of AllGatherv replay with SMPI (one trace for all processes)
 < replay/actions_allgatherv.txt
 $ mkfile replay/one_trace
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 3 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
-> [Tremblay:0:(1) 0.909909] [smpi_replay/VERBOSE] 0 allGatherV 275427 275427 275427 275427 204020 0 0 0.909909
-> [Fafard:2:(3) 1.340304] [smpi_replay/VERBOSE] 2 allGatherV 275427 275427 275427 275427 204020 0 0 1.340304
-> [Jupiter:1:(2) 1.340304] [smpi_replay/VERBOSE] 1 allGatherV 275427 275427 275427 275427 204020 0 0 1.340304
-> [Jupiter:1:(2) 1.340304] [smpi_replay/INFO] Simulation time 1.340304
+$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 4 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay replay/one_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+> [Tremblay:0:(1) 1.397261] [smpi_replay/VERBOSE] 0 allGatherV 275427 275427 275427 275427 204020 0 0 1.397261
+> [Ginette:3:(4) 1.760421] [smpi_replay/VERBOSE] 3 allGatherV 204020 275427 275427 275427 204020 0 0 1.760421
+> [Fafard:2:(3) 1.941986] [smpi_replay/VERBOSE] 2 allGatherV 275427 275427 275427 275427 204020 0 0 1.941986
+> [Jupiter:1:(2) 1.941986] [smpi_replay/VERBOSE] 1 allGatherV 275427 275427 275427 275427 204020 0 0 1.941986
+> [Jupiter:1:(2) 1.941986] [smpi_replay/INFO] Simulation time 1.941986
 
 $ rm -f replay/one_trace
 
index b838228..06c1cff 100644 (file)
@@ -10,5 +10,5 @@ $ ./replay_multiple description_file ${srcdir:=.}/../../platforms/small_platform
 > [0.000000] [smpi_kernel/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:<flops>" to set its value.Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information.
 > [0.000000] [msg_test/INFO] Initializing instance 1 of size 32
 > [0.000000] [msg_test/INFO] Initializing instance 2 of size 32
-> [Jupiter:2:(62) 1140698.106357] [smpi_replay/INFO] Simulation time 1124380.753685
-> [1140698.106357] [msg_test/INFO] Simulation time 1.1407e+06
+> [Jupiter:2:(62) 1149120.441959] [smpi_replay/INFO] Simulation time 1132803.089288
+> [1149120.441959] [msg_test/INFO] Simulation time 1.14912e+06
index 2ea6b1b..b3ccbfb 100644 (file)
@@ -1,10 +1,13 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 static int master(int argc, char *argv[])
index fd5ff1a..b8cf961 100644 (file)
@@ -4,7 +4,7 @@
 
 p Test SMPI with call-location tracing. This means that the binary must have
 p already been compiled with the -trace-call-location switch.
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace -trace-file ${bindir:=.}/smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${platfdir}/small_platform.xml --cfg=smpi/trace-call-location:1 -np 3 ${bindir:=.}/smpi_trace_call_location --cfg=smpi/host-speed:-1 --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace -trace-file ${bindir:=.}/smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${platfdir}/small_platform.xml --cfg=smpi/trace-call-location:1 -np 3 ${bindir:=.}/smpi_trace_call_location --cfg=smpi/host-speed:1 --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
 
 $ grep --quiet "12 0.* 2 1 5 .*trace_call_location\.c\" 14$" ${bindir:=.}/smpi_trace.trace 
 
diff --git a/include/simgrid/actor.h b/include/simgrid/actor.h
new file mode 100644 (file)
index 0000000..0cdb36f
--- /dev/null
@@ -0,0 +1,43 @@
+/* Public interface to the Link datatype                                    */
+
+/* Copyright (c) 2018. 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. */
+
+#ifndef INCLUDE_SIMGRID_ACTOR_H_
+#define INCLUDE_SIMGRID_ACTOR_H_
+
+#include <simgrid/forward.h>
+#include <xbt/base.h>
+#include <xbt/dict.h>
+
+/* C interface */
+SG_BEGIN_DECL()
+/** @brief Actor datatype.
+    @ingroup m_actor_management
+
+    An actor may be defined as a <em>code</em>, with some <em>private data</em>, executing in a <em>location</em>.
+
+    You should not access directly to the fields of the pointed structure, but always use the provided API to interact
+    with actors.
+ */
+
+XBT_PUBLIC int sg_actor_get_PID(sg_actor_t actor);
+XBT_PUBLIC int sg_actor_get_PPID(sg_actor_t actor);
+XBT_PUBLIC const char* sg_actor_get_name(sg_actor_t actor);
+XBT_PUBLIC sg_host_t sg_actor_get_host(sg_actor_t actor);
+XBT_PUBLIC const char* sg_actor_get_property_value(sg_actor_t actor, const char* name);
+XBT_PUBLIC xbt_dict_t sg_actor_get_properties(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_suspend(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_resume(sg_actor_t actor);
+XBT_PUBLIC int sg_actor_is_suspended(sg_actor_t actor);
+XBT_PUBLIC sg_actor_t sg_actor_restart(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_daemonize(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_migrate(sg_actor_t process, sg_host_t host);
+XBT_PUBLIC void sg_actor_join(sg_actor_t actor, double timeout);
+XBT_PUBLIC void sg_actor_kill(sg_actor_t actor);
+XBT_PUBLIC void sg_actor_set_kill_time(sg_actor_t actor, double kill_time);
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_ACTOR_H_ */
index 772a50a..4ab1b7f 100644 (file)
@@ -8,8 +8,9 @@
 
 #ifdef __cplusplus
 
-#include "s4u/forward.hpp"
-#include "xbt/base.h"
+#include <simgrid/s4u/forward.hpp>
+#include <xbt/base.h>
+
 #include <boost/intrusive_ptr.hpp>
 
 namespace simgrid {
@@ -19,11 +20,15 @@ namespace context {
 class Context;
 class ContextFactory;
 }
+namespace actor {
+class ActorImpl;
+using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
+} // namespace actor
 namespace activity {
   class ActivityImpl;
   using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
-  XBT_PUBLIC(void) intrusive_ptr_add_ref(ActivityImpl* activity);
-  XBT_PUBLIC(void) intrusive_ptr_release(ActivityImpl* activity);
+  XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
+  XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
 
   class CommImpl;
   using CommImplPtr = boost::intrusive_ptr<CommImpl>;
@@ -51,15 +56,17 @@ namespace resource {
 class Action;
 class Model;
 class Resource;
+class TraceEvent;
 }
 namespace routing {
-  class NetPoint;
-  class NetZoneImpl;
+class ClusterCreationArgs;
+class LinkCreationArgs;
+class NetPoint;
+class NetZoneImpl;
+class RouteCreationArgs;
 }
 }
 namespace simix {
-  class ActorImpl;
-  using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
   class Host;
 }
 
@@ -89,15 +96,13 @@ typedef simgrid::kernel::resource::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
 typedef simgrid::kernel::context::Context* smx_context_t;
-typedef simgrid::simix::ActorImpl* smx_actor_t;
+typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
 typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t;
 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
 typedef simgrid::surf::StorageImpl* surf_storage_t;
 
-typedef simgrid::kernel::lmm::Element* lmm_element_t;
 typedef const simgrid::kernel::lmm::Element* const_lmm_element_t;
 typedef simgrid::kernel::lmm::ConstraintLight* lmm_constraint_light_t;
-typedef simgrid::kernel::lmm::System* lmm_system_t;
 
 #else
 
@@ -127,6 +132,7 @@ typedef s4u_Link* sg_link_t;
 typedef s4u_Storage* sg_storage_t;
 typedef s4u_File* sg_file_t;
 typedef s4u_VM* sg_vm_t;
+typedef s4u_Actor* sg_actor_t;
 
 typedef routing_NetPoint* sg_netpoint_t;
 typedef surf_Resource *sg_resource_t;
@@ -152,6 +158,6 @@ typedef unsigned long long sg_size_t;
  */
 typedef long long sg_offset_t;
 
-typedef unsigned long aid_t;
+typedef long aid_t;
 
 #endif /* SIMGRID_TYPES_H */
index 60696b6..75aceb8 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2016. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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/forward.h>
 
 SG_BEGIN_DECL()
+/** @brief Host datatype.
+    @ingroup m_host_management
 
-XBT_PUBLIC(sg_host_t *) sg_host_list();
+    A <em>location</em> (or <em>host</em>) is any possible place where an actor may run. Thus it is represented as a
+    <em>physical resource with computing capabilities</em>, some <em>mailboxes</em> to enable running actors to
+    communicate with remote ones, and some <em>private data</em> that can be only accessed by local actors.
+ */
+
+XBT_PUBLIC sg_host_t* sg_host_list();
 
 /** \ingroup m_host_management
- * \brief Return the current number MSG hosts.
+ * \brief Return the current number of hosts.
  */
-XBT_PUBLIC(size_t) sg_host_count();
-#define MSG_get_host_number() sg_host_count()
+XBT_PUBLIC size_t sg_host_count();
 
 /** \ingroup m_host_management
  * \brief Return a dynar containing all the hosts declared at a given point of time (including VMs)
  * \remark The host order in the returned array is generally different from the host creation/declaration order in the
  *         XML platform (we use a hash table internally)
  */
-XBT_PUBLIC(xbt_dynar_t) sg_hosts_as_dynar();
-#define MSG_hosts_as_dynar() sg_hosts_as_dynar()
+XBT_PUBLIC xbt_dynar_t sg_hosts_as_dynar();
 
-XBT_PUBLIC(size_t) sg_host_extension_create(void(*deleter)(void*));
-XBT_PUBLIC(void*) sg_host_extension_get(sg_host_t host, size_t rank);
+XBT_PUBLIC size_t sg_host_extension_create(void (*deleter)(void*));
+XBT_PUBLIC void* sg_host_extension_get(sg_host_t host, size_t rank);
 
 /** \ingroup m_host_management
- * \brief Finds a msg_host_t using its name.
+ * \brief Finds a sg_host_t using its name.
  *
  * This is a name directory service
  * \param name the name of an host.
  * \return the corresponding host
  */
-XBT_PUBLIC(sg_host_t) sg_host_by_name(const char *name);
-#define MSG_host_by_name(name) sg_host_by_name(name)
-#define MSG_get_host_by_name(n) sg_host_by_name(n) /* Rewrite the old name into the new one transparently */
+XBT_PUBLIC sg_host_t sg_host_by_name(const char* name);
 
 /** \ingroup m_host_management
  *
- * \brief Return the name of the #msg_host_t. */
-XBT_PUBLIC(const char*) sg_host_get_name(sg_host_t host);
-#define MSG_host_get_name(host) sg_host_get_name(host)
+ * \brief Return the name of the #sg_host_t. */
+XBT_PUBLIC const char* sg_host_get_name(sg_host_t host);
 
 // ========== User Data ==============
 /** \ingroup m_host_management
  *
- * \brief Return the user data of a #msg_host_t.
+ * \brief Return the user data of a #sg_host_t.
  *
  * This functions returns the user data associated to \a host if it is possible.
  */
-XBT_PUBLIC(void*) sg_host_user(sg_host_t host);
-#define MSG_host_get_data(host) sg_host_user(host)
+XBT_PUBLIC void* sg_host_user(sg_host_t host);
 /** \ingroup m_host_management
  *
- * \brief Set the user data of a #msg_host_t.
+ * \brief Set the user data of a #sg_host_t.
  *
  * This functions attach \a data to \a host if it is possible.
  */
-XBT_PUBLIC(void) sg_host_user_set(sg_host_t host, void* userdata);
-#define MSG_host_set_data(host, data) sg_host_user_set(host, data)
-XBT_PUBLIC(void) sg_host_user_destroy(sg_host_t host);
+XBT_PUBLIC void sg_host_user_set(sg_host_t host, void* userdata);
+XBT_PUBLIC void sg_host_user_destroy(sg_host_t host);
 
 // ========= storage related functions ============
 /** \ingroup m_host_management
  * \brief Return the list of mount point names on an host.
  * \param host a host
- * \return a dict containing all mount point on the host (mount_name => msg_storage_t)
+ * \return a dict containing all mount point on the host (mount_name => sg_storage_t)
  */
-XBT_PUBLIC(xbt_dict_t) sg_host_get_mounted_storage_list(sg_host_t host);
-#define MSG_host_get_mounted_storage_list(host) sg_host_get_mounted_storage_list(host)
+XBT_PUBLIC xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host);
 
 /** \ingroup m_host_management
  * \brief Return the list of storages attached to an host.
  * \param host a host
  * \return a dynar containing all storages (name) attached to the host
  */
-XBT_PUBLIC(xbt_dynar_t) sg_host_get_attached_storage_list(sg_host_t host);
-#define MSG_host_get_attached_storage_list(host) host_get_attached_storage_list(host)
+XBT_PUBLIC xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host);
 
 // =========== user-level functions ===============
 /** \ingroup m_host_management
  * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
  */
-XBT_PUBLIC(double) sg_host_speed(sg_host_t host);
-#define MSG_host_get_speed(host) sg_host_speed(host)
-XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
+XBT_PUBLIC double sg_host_speed(sg_host_t host);
+XBT_PUBLIC double sg_host_get_pstate_speed(sg_host_t host, int pstate_index);
+
+XBT_PUBLIC double sg_host_get_available_speed(sg_host_t host);
 
-XBT_PUBLIC(int) sg_host_core_count(sg_host_t host);
-#define MSG_host_get_core_number(host) sg_host_core_count(host)
+XBT_PUBLIC int sg_host_core_count(sg_host_t host);
 
 /** \ingroup m_process_management
  * \brief Return the location on which a process is running.
  * \param process a process (nullptr means the current one)
- * \return the msg_host_t corresponding to the location on which \a process is running.
+ * \return the sg_host_t corresponding to the location on which \a process is running.
  */
-XBT_PUBLIC(sg_host_t) sg_host_self();
-#define MSG_host_self() sg_host_self()
+XBT_PUBLIC sg_host_t sg_host_self();
 
-XBT_PUBLIC(const char*) sg_host_self_get_name();
+XBT_PUBLIC const char* sg_host_self_get_name();
 
 /** \ingroup m_host_management
  * \brief Return the total count of pstates defined for a host. See also @ref plugin_energy.
  *
  * \param  host host to test
  */
-XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
-#define MSG_host_get_nb_pstates(host) sg_host_get_nb_pstates(host)
-
-XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
-#define MSG_host_get_pstate(h) sg_host_get_pstate(h) /* users don't know that MSG is the C version of SimGrid */
-XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate);
-#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* (same here) */
-
-XBT_PUBLIC(void) sg_host_turn_on(sg_host_t host);
-#define MSG_host_on(h) sg_host_turn_on(h)
-XBT_PUBLIC(void) sg_host_turn_off(sg_host_t host);
-#define MSG_host_off(h) sg_host_turn_off(h)
-XBT_PUBLIC(int) sg_host_is_on(sg_host_t host);
-#define MSG_host_is_on(h) sg_host_is_on(h)
-XBT_PUBLIC(int) sg_host_is_off(sg_host_t host);
-#define MSG_host_is_off(h) sg_host_is_off(h)
+XBT_PUBLIC int sg_host_get_nb_pstates(sg_host_t host);
+
+XBT_PUBLIC int sg_host_get_pstate(sg_host_t host);
+XBT_PUBLIC void sg_host_set_pstate(sg_host_t host, int pstate);
+
+XBT_PUBLIC void sg_host_turn_on(sg_host_t host);
+XBT_PUBLIC void sg_host_turn_off(sg_host_t host);
+XBT_PUBLIC int sg_host_is_on(sg_host_t host);
+XBT_PUBLIC int sg_host_is_off(sg_host_t host);
 
 /** \ingroup m_host_management
  * \brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
@@ -137,8 +126,7 @@ XBT_PUBLIC(int) sg_host_is_off(sg_host_t host);
  * \param host a host
  * \return a dict containing the properties
  */
-XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host);
-#define MSG_host_get_properties(host) sg_host_get_properties(host)
+XBT_PUBLIC xbt_dict_t sg_host_get_properties(sg_host_t host);
 
 /** \ingroup m_host_management
  * \brief Returns the value of a given host property
@@ -147,8 +135,7 @@ XBT_PUBLIC(xbt_dict_t) sg_host_get_properties(sg_host_t host);
  * \param name a property name
  * \return value of a property (or nullptr if property not set)
  */
-XBT_PUBLIC(const char*) sg_host_get_property_value(sg_host_t host, const char* name);
-#define MSG_host_get_property_value(host, name) sg_host_get_property_value(host, name)
+XBT_PUBLIC const char* sg_host_get_property_value(sg_host_t host, const char* name);
 
 /** \ingroup m_host_management
  * \brief Change the value of a given host property
@@ -157,13 +144,14 @@ XBT_PUBLIC(const char*) sg_host_get_property_value(sg_host_t host, const char* n
  * \param name a property name
  * \param value what to change the property to
  */
-XBT_PUBLIC(void) sg_host_set_property_value(sg_host_t host, const char* name, const char* value);
-#define MSG_host_set_property_value(host, name, value) sg_host_set_property_value(host, name, value)
+XBT_PUBLIC void sg_host_set_property_value(sg_host_t host, const char* name, const char* value);
+
+XBT_PUBLIC void sg_host_route(sg_host_t from, sg_host_t to, xbt_dynar_t links);
+XBT_PUBLIC double sg_host_route_latency(sg_host_t from, sg_host_t to);
+XBT_PUBLIC double sg_host_route_bandwidth(sg_host_t from, sg_host_t to);
+XBT_PUBLIC void sg_host_dump(sg_host_t ws);
 
-XBT_PUBLIC(void) sg_host_route(sg_host_t from, sg_host_t to, xbt_dynar_t links);
-XBT_PUBLIC(double) sg_host_route_latency(sg_host_t from, sg_host_t to);
-XBT_PUBLIC(double) sg_host_route_bandwidth(sg_host_t from, sg_host_t to);
-XBT_PUBLIC(void) sg_host_dump(sg_host_t ws);
+XBT_PUBLIC void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto);
 SG_END_DECL()
 
 #endif /* SIMGRID_HOST_H_ */
index 80cb735..dcf444e 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -7,76 +6,80 @@
 #ifndef INSTR_H_
 #define INSTR_H_
 
-#include "xbt.h"
-#include "simgrid/msg.h"
+#include <simgrid/msg.h>
+#include <xbt.h>
 
 SG_BEGIN_DECL()
 
 /* Functions to manage tracing categories */
-XBT_PUBLIC(void) TRACE_category(const char *category);
-XBT_PUBLIC(void) TRACE_category_with_color (const char *category, const char *color);
-XBT_PUBLIC(xbt_dynar_t) TRACE_get_categories ();
-XBT_PUBLIC(void) TRACE_smpi_set_category(const char *category);
+XBT_PUBLIC void TRACE_category(const char* category);
+XBT_PUBLIC void TRACE_category_with_color(const char* category, const char* color);
+XBT_PUBLIC xbt_dynar_t TRACE_get_categories();
+XBT_PUBLIC void TRACE_smpi_set_category(const char* category);
 
 /*  Functions to manage tracing marks (used for trace comparison experiments) */
-XBT_PUBLIC(void) TRACE_declare_mark(const char *mark_type);
-XBT_PUBLIC(void) TRACE_declare_mark_value_with_color (const char *mark_type, const char *mark_value, const char *mark_color);
-XBT_PUBLIC(void) TRACE_declare_mark_value (const char *mark_type, const char *mark_value);
-XBT_PUBLIC(void) TRACE_mark(const char *mark_type, const char *mark_value);
-XBT_PUBLIC(xbt_dynar_t) TRACE_get_marks ();
+XBT_PUBLIC void TRACE_declare_mark(const char* mark_type);
+XBT_PUBLIC void TRACE_declare_mark_value_with_color(const char* mark_type, const char* mark_value,
+                                                    const char* mark_color);
+XBT_PUBLIC void TRACE_declare_mark_value(const char* mark_type, const char* mark_value);
+XBT_PUBLIC void TRACE_mark(const char* mark_type, const char* mark_value);
+XBT_PUBLIC xbt_dynar_t TRACE_get_marks();
 
 /* Function used by graphicator (transform a SimGrid platform file in a graphviz dot file with the network topology) */
-XBT_PUBLIC(int) TRACE_platform_graph_export_graphviz (const char *filename);
+XBT_PUBLIC int TRACE_platform_graph_export_graphviz(const char* filename);
 
 /* User-variables related functions*/
 /* for VM variables */
-XBT_PUBLIC(void) TRACE_vm_variable_declare (const char *variable);
-XBT_PUBLIC(void) TRACE_vm_variable_declare_with_color (const char *variable, const char *color);
-XBT_PUBLIC(void) TRACE_vm_variable_set (const char *vm, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_vm_variable_add (const char *vm, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_vm_variable_sub (const char *vm, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_vm_variable_set_with_time (double time, const char *vm, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_vm_variable_add_with_time (double time, const char *vm, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *variable, double value);
+XBT_PUBLIC void TRACE_vm_variable_declare(const char* variable);
+XBT_PUBLIC void TRACE_vm_variable_declare_with_color(const char* variable, const char* color);
+XBT_PUBLIC void TRACE_vm_variable_set(const char* vm, const char* variable, double value);
+XBT_PUBLIC void TRACE_vm_variable_add(const char* vm, const char* variable, double value);
+XBT_PUBLIC void TRACE_vm_variable_sub(const char* vm, const char* variable, double value);
+XBT_PUBLIC void TRACE_vm_variable_set_with_time(double time, const char* vm, const char* variable, double value);
+XBT_PUBLIC void TRACE_vm_variable_add_with_time(double time, const char* vm, const char* variable, double value);
+XBT_PUBLIC void TRACE_vm_variable_sub_with_time(double time, const char* vm, const char* variable, double value);
 
 /* for host variables */
-XBT_PUBLIC(void) TRACE_host_variable_declare (const char *variable);
-XBT_PUBLIC(void) TRACE_host_variable_declare_with_color (const char *variable, const char *color);
-XBT_PUBLIC(void) TRACE_host_variable_set (const char *host, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_host_variable_add (const char *host, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_host_variable_sub (const char *host, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value);
-XBT_PUBLIC(xbt_dynar_t) TRACE_get_host_variables ();
+XBT_PUBLIC void TRACE_host_variable_declare(const char* variable);
+XBT_PUBLIC void TRACE_host_variable_declare_with_color(const char* variable, const char* color);
+XBT_PUBLIC void TRACE_host_variable_set(const char* host, const char* variable, double value);
+XBT_PUBLIC void TRACE_host_variable_add(const char* host, const char* variable, double value);
+XBT_PUBLIC void TRACE_host_variable_sub(const char* host, const char* variable, double value);
+XBT_PUBLIC void TRACE_host_variable_set_with_time(double time, const char* host, const char* variable, double value);
+XBT_PUBLIC void TRACE_host_variable_add_with_time(double time, const char* host, const char* variable, double value);
+XBT_PUBLIC void TRACE_host_variable_sub_with_time(double time, const char* host, const char* variable, double value);
+XBT_PUBLIC xbt_dynar_t TRACE_get_host_variables();
 
 /* for link variables */
-XBT_PUBLIC(void) TRACE_link_variable_declare (const char *var);
-XBT_PUBLIC(void) TRACE_link_variable_declare_with_color (const char *var, const char *color);
-XBT_PUBLIC(void) TRACE_link_variable_set (const char *link, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_variable_add (const char *link, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_variable_sub (const char *link, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value);
+XBT_PUBLIC void TRACE_link_variable_declare(const char* var);
+XBT_PUBLIC void TRACE_link_variable_declare_with_color(const char* var, const char* color);
+XBT_PUBLIC void TRACE_link_variable_set(const char* link, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_variable_add(const char* link, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_variable_sub(const char* link, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_variable_set_with_time(double time, const char* link, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_variable_add_with_time(double time, const char* link, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_variable_sub_with_time(double time, const char* link, const char* variable, double value);
 
 /* for link variables, but with src and dst used for get_route */
-XBT_PUBLIC(void) TRACE_link_srcdst_variable_set (const char *src, const char *dst, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_srcdst_variable_add (const char *src, const char *dst, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_srcdst_variable_set_with_time (double time, const char *src, const char *dst, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_srcdst_variable_add_with_time (double time, const char *src, const char *dst, const char *variable, double value);
-XBT_PUBLIC(void) TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, const char *dst, const char *variable, double value);
-XBT_PUBLIC(xbt_dynar_t) TRACE_get_link_variables ();
-XBT_PUBLIC(void) TRACE_host_state_declare (const char *state);
-XBT_PUBLIC(void) TRACE_host_state_declare_value (const char *state, const char *value, const char *color);
-XBT_PUBLIC(void) TRACE_host_set_state (const char *host, const char *state, const char *value);
-XBT_PUBLIC(void) TRACE_host_push_state (const char *host, const char *state, const char *value);
-XBT_PUBLIC(void) TRACE_host_pop_state (const char *host, const char *state);
+XBT_PUBLIC void TRACE_link_srcdst_variable_set(const char* src, const char* dst, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_srcdst_variable_add(const char* src, const char* dst, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_srcdst_variable_sub(const char* src, const char* dst, const char* variable, double value);
+XBT_PUBLIC void TRACE_link_srcdst_variable_set_with_time(double time, const char* src, const char* dst,
+                                                         const char* variable, double value);
+XBT_PUBLIC void TRACE_link_srcdst_variable_add_with_time(double time, const char* src, const char* dst,
+                                                         const char* variable, double value);
+XBT_PUBLIC void TRACE_link_srcdst_variable_sub_with_time(double time, const char* src, const char* dst,
+                                                         const char* variable, double value);
+XBT_PUBLIC xbt_dynar_t TRACE_get_link_variables();
+XBT_PUBLIC void TRACE_host_state_declare(const char* state);
+XBT_PUBLIC void TRACE_host_state_declare_value(const char* state, const char* value, const char* color);
+XBT_PUBLIC void TRACE_host_set_state(const char* host, const char* state, const char* value);
+XBT_PUBLIC void TRACE_host_push_state(const char* host, const char* state, const char* value);
+XBT_PUBLIC void TRACE_host_pop_state(const char* host, const char* state);
 
 /* for creating graph configuration files for Viva by hand */
-XBT_PUBLIC(xbt_dynar_t) TRACE_get_node_types ();
-XBT_PUBLIC(xbt_dynar_t) TRACE_get_edge_types ();
+XBT_PUBLIC xbt_dynar_t TRACE_get_node_types();
+XBT_PUBLIC xbt_dynar_t TRACE_get_edge_types();
 
 SG_END_DECL()
 
index eb25b52..dcc32d4 100644 (file)
@@ -1,24 +1,23 @@
-/* Copyright (c) 2010-2012, 2014-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
 
 #ifndef JEDULE_HPP_
 #define JEDULE_HPP_
-#include "simgrid_config.h"
-#include <cstdio>
 
-#include "jedule_events.hpp"
-#include "jedule_platform.hpp"
+#include <simgrid/jedule/jedule_events.hpp>
+#include <simgrid/jedule/jedule_platform.hpp>
+#include <simgrid_config.h>
+
+#include <cstdio>
 
 #if SIMGRID_HAVE_JEDULE
 
 namespace simgrid {
 namespace jedule{
 
-
-XBT_PUBLIC_CLASS Jedule {
+class XBT_PUBLIC Jedule {
 public:
   Jedule()=default;
   ~Jedule();
index 704d4f6..4362ffe 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2012, 2014-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -7,41 +6,42 @@
 #ifndef JEDULE_EVENTS_H_
 #define JEDULE_EVENTS_H_
 
-#include "simgrid_config.h"
-#include "simgrid/forward.h"
+#include <simgrid/jedule/jedule_platform.hpp>
+
+#include <simgrid/forward.h>
+#include <simgrid_config.h>
+
 #include <vector>
 #include <string>
 #include <unordered_map>
 
-#include "jedule_platform.hpp"
-
 #if SIMGRID_HAVE_JEDULE
 namespace simgrid {
 namespace jedule{
 
-XBT_PUBLIC_CLASS Event{
-  public:
-    Event(std::string name, double start_time, double end_time, std::string type);
-    ~Event();
-    void addCharacteristic(char *characteristic);
-    void addResources(std::vector<sg_host_t> *host_selection);
-    void addInfo(char *key, char *value);
-    void print(FILE *file);
-
-  private:
-    std::string name;
-    double start_time;
-    double end_time;
-    std::string type;
-    std::vector<jed_subset_t> *resource_subsets;
-    std::vector<char*> characteristics_list; /* just a list of names (strings) */
-    std::unordered_map<char*, char*> info_map;     /* key/value pairs */
+class XBT_PUBLIC Event {
+public:
+  Event(std::string name, double start_time, double end_time, std::string type);
+  ~Event();
+  void addCharacteristic(char* characteristic);
+  void addResources(std::vector<sg_host_t>* host_selection);
+  void addInfo(char* key, char* value);
+  void print(FILE* file);
+
+private:
+  std::string name;
+  double start_time;
+  double end_time;
+  std::string type;
+  std::vector<jed_subset_t>* resource_subsets;
+  std::vector<char*> characteristics_list;   /* just a list of names (strings) */
+  std::unordered_map<char*, char*> info_map; /* key/value pairs */
 };
 }
 }
 
 extern "C" {
-typedef simgrid::jedule::Event * jed_event_t;
+typedef simgrid::jedule::Event* jed_event_t;
 }
 
 #endif
index 9510ad0..9d02ade 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2012, 2014-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -7,19 +6,21 @@
 #ifndef JED_SIMGRID_PLATFORM_H_
 #define JED_SIMGRID_PLATFORM_H_
 
-#include "simgrid_config.h"
-#include "simgrid/forward.h"
-#include "xbt/dynar.h"
+#include <simgrid/forward.h>
+#include <simgrid_config.h>
+#include <xbt/dynar.h>
+
 #include <unordered_map>
 #include <vector>
 #include <string>
+
 #if SIMGRID_HAVE_JEDULE
 
 namespace simgrid {
 namespace jedule{
-XBT_PUBLIC_CLASS Container {
+class XBT_PUBLIC Container {
 public:
-  Container(std::string name);
+  explicit Container(std::string name);
   virtual ~Container();
 private:
   int last_id;
@@ -39,7 +40,7 @@ public:
   void printResources(FILE *file);
 };
 
-XBT_PUBLIC_CLASS Subset {
+class XBT_PUBLIC Subset {
 public:
   Subset(int s, int n, Container* p);
   virtual ~Subset()=default;
index 909ad6c..5f5ab68 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2011, 2013-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -7,16 +6,16 @@
 #ifndef JEDULE_SD_BINDING_H_
 #define JEDULE_SD_BINDING_H_
 
-#include "simgrid_config.h"
-#include "simgrid/simdag.h"
+#include <simgrid/simdag.h>
+#include <simgrid_config.h>
 
 #if SIMGRID_HAVE_JEDULE
 SG_BEGIN_DECL()
-XBT_PUBLIC(void) jedule_log_sd_event(SD_task_t task);
-XBT_PUBLIC(void) jedule_sd_init(void);
-XBT_PUBLIC(void) jedule_sd_exit(void);
-XBT_PUBLIC(void) jedule_sd_dump(const char* filename);
+XBT_PUBLIC void jedule_log_sd_event(SD_task_t task);
+XBT_PUBLIC void jedule_sd_init(void);
+XBT_PUBLIC void jedule_sd_exit(void);
+XBT_PUBLIC void jedule_sd_dump(const char* filename);
 SG_END_DECL()
-#endif /* JEDULE_SD_BINDING_H_ */
-
 #endif
+
+#endif /* JEDULE_SD_BINDING_H_ */
index 7ecfaca..f0c8cac 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team.
+/* Copyright (c) 2016-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@ public:
   FutureStateBase(FutureStateBase const&) = delete;
   FutureStateBase& operator=(FutureStateBase const&) = delete;
 
-  XBT_PUBLIC(void) schedule(simgrid::xbt::Task<void()>&& job);
+  XBT_PUBLIC void schedule(simgrid::xbt::Task<void()>&& job);
 
   void set_exception(std::exception_ptr exception)
   {
similarity index 52%
rename from src/kernel/resource/Action.hpp
rename to include/simgrid/kernel/resource/Action.hpp
index 827fccf..c0c0aec 100644 (file)
@@ -6,7 +6,14 @@
 #ifndef SIMGRID_KERNEL_RESOURCE_ACTION_HPP
 #define SIMGRID_KERNEL_RESOURCE_ACTION_HPP
 
-#include "src/surf/surf_interface.hpp"
+#include <simgrid/forward.h>
+#include <xbt/signal.hpp>
+#include <xbt/utility.hpp>
+
+#include <boost/heap/pairing_heap.hpp>
+#include <boost/optional.hpp>
+
+static constexpr int NO_MAX_DURATION = -1.0;
 
 namespace simgrid {
 namespace kernel {
@@ -17,24 +24,20 @@ typedef boost::heap::pairing_heap<heap_element_type, boost::heap::constant_time_
                                   boost::heap::compare<simgrid::xbt::HeapComparator<heap_element_type>>>
     heap_type;
 
-/** @ingroup SURF_interface
- * @brief SURF action interface class
- * @details An action is an event generated by a resource (e.g.: a communication for the network)
- */
-XBT_PUBLIC_CLASS Action
-{
+/** @details An action is a consumption on a resource (e.g.: a communication for the network) */
+class XBT_PUBLIC Action {
 public:
-  boost::intrusive::list_member_hook<> modifiedSetHook_; /* Used by the lazy update to list the actions to track */
-  bool isLinkedModifiedSet() const { return modifiedSetHook_.is_linked(); }
-
-  typedef boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modifiedSetHook_>
-      ActionLmmOptions;
-  typedef boost::intrusive::list<Action, ActionLmmOptions> ActionLmmList;
-
-  boost::intrusive::list_member_hook<> stateSetHook_;
-  typedef boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::stateSetHook_>
-      ActionOptions;
-  typedef boost::intrusive::list<Action, ActionOptions> ActionList;
+  /* Lazy update needs this Set hook to maintain a list of the tracked actions */
+  boost::intrusive::list_member_hook<> modified_set_hook_;
+  bool is_within_modified_set() const { return modified_set_hook_.is_linked(); }
+  typedef boost::intrusive::list<
+      Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_>>
+      ModifiedSet;
+
+  boost::intrusive::list_member_hook<> state_set_hook_;
+  typedef boost::intrusive::list<
+      Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::state_set_hook_>>
+      StateSet;
 
   enum class State {
     ready = 0,        /**< Ready        */
@@ -60,7 +63,7 @@ public:
    * @param cost The cost of the Action
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    */
-  Action(simgrid::kernel::resource::Model * model, double cost, bool failed);
+  Action(Model* model, double cost, bool failed);
 
   /**
    * @brief Action constructor
@@ -70,7 +73,7 @@ public:
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    * @param var The lmm variable associated to this Action if it is part of a LMM component
    */
-  Action(simgrid::kernel::resource::Model * model, double cost, bool failed, kernel::lmm::Variable* var);
+  Action(Model* model, double cost, bool failed, lmm::Variable* var);
 
   virtual ~Action();
 
@@ -82,54 +85,56 @@ public:
   void finish(Action::State state);
 
   /** @brief Get the [state](\ref simgrid::kernel::resource::Action::State) of the current Action */
-  Action::State getState() const; /**< get the state*/
+  Action::State get_state() const; /**< get the state*/
   /** @brief Set the [state](\ref simgrid::kernel::resource::Action::State) of the current Action */
-  virtual void setState(Action::State state);
+  virtual void set_state(Action::State state);
 
   /** @brief Get the bound of the current Action */
-  double getBound() const;
+  double get_bound() const;
   /** @brief Set the bound of the current Action */
-  void setBound(double bound);
+  void set_bound(double bound);
 
   /** @brief Get the start time of the current action */
-  double getStartTime() const { return start_; }
+  double get_start_time() const { return start_time_; }
   /** @brief Get the finish time of the current action */
-  double getFinishTime() const { return finishTime_; }
+  double get_finish_time() const { return finish_time_; }
 
   /** @brief Get the user data associated to the current action */
-  void* getData() const { return data_; }
+  void* get_data() const { return data_; }
   /** @brief Set the user data associated to the current action */
-  void setData(void* data) { data_ = data; }
+  void set_data(void* data) { data_ = data; }
 
   /** @brief Get the cost of the current action */
-  double getCost() const { return cost_; }
+  double get_cost() const { return cost_; }
   /** @brief Set the cost of the current action */
-  void setCost(double cost) { cost_ = cost; }
+  void set_cost(double cost) { cost_ = cost; }
 
   /** @brief Update the maximum duration of the current action
    *  @param delta Amount to remove from the MaxDuration */
-  void updateMaxDuration(double delta) { double_update(&maxDuration_, delta, sg_surf_precision); }
+  void update_max_duration(double delta);
 
   /** @brief Update the remaining time of the current action
    *  @param delta Amount to remove from the remaining time */
-  void updateRemains(double delta) { double_update(&remains_, delta, sg_maxmin_precision * sg_surf_precision); }
+  void update_remains(double delta);
+
+  virtual void update_remains_lazy(double now) = 0;
 
   /** @brief Set the remaining time of the current action */
-  void setRemains(double value) { remains_ = value; }
+  void set_remains(double value) { remains_ = value; }
+
   /** @brief Get the remaining time of the current action after updating the resource */
-  virtual double getRemains();
+  virtual double get_remains();
   /** @brief Get the remaining time of the current action without updating the resource */
-  double getRemainsNoUpdate() const { return remains_; }
+  double get_remains_no_update() const { return remains_; }
 
   /** @brief Set the finish time of the current action */
-  void setFinishTime(double value) { finishTime_ = value; }
+  void set_finish_time(double value) { finish_time_ = value; }
 
   /**@brief Add a reference to the current action (refcounting) */
   void ref();
   /** @brief Unref that action (and destroy it if refcount reaches 0)
-   *  @return true if the action was destroyed and false if someone still has references on it
-   */
-  virtual int unref();
+   *  @return true if the action was destroyed and false if someone still has references on it */
+  int unref();
 
   /** @brief Cancel the current Action if running */
   virtual void cancel();
@@ -141,75 +146,74 @@ public:
   virtual void resume();
 
   /** @brief Returns true if the current action is running */
-  virtual bool isSuspended();
+  bool is_suspended();
 
   /** @brief Get the maximum duration of the current action */
-  double getMaxDuration() const { return maxDuration_; }
+  double get_max_duration() const { return max_duration_; }
   /** @brief Set the maximum duration of the current Action */
-  virtual void setMaxDuration(double duration);
+  virtual void set_max_duration(double duration);
 
   /** @brief Get the tracing category associated to the current action */
-  char* getCategory() const { return category_; }
+  char* get_category() const { return category_; }
   /** @brief Set the tracing category of the current Action */
-  void setCategory(const char* category);
+  void set_category(const char* category);
 
   /** @brief Get the priority of the current Action */
-  double getPriority() const { return sharingWeight_; };
+  double get_priority() const { return sharing_priority_; };
   /** @brief Set the priority of the current Action */
-  virtual void setSharingWeight(double priority);
-  void setSharingWeightNoUpdate(double weight) { sharingWeight_ = weight; }
+  virtual void set_priority(double priority);
+  void set_priority_no_update(double priority) { sharing_priority_ = priority; }
 
   /** @brief Get the state set in which the action is */
-  ActionList* getStateSet() const { return stateSet_; };
+  StateSet* get_state_set() const { return state_set_; };
 
-  simgrid::kernel::resource::Model* getModel() const { return model_; }
+  simgrid::kernel::resource::Model* get_model() const { return model_; }
 
 protected:
-  ActionList* stateSet_;
-  int refcount_ = 1;
+  StateSet* state_set_;
 
 private:
-  double sharingWeight_ = 1.0;             /**< priority (1.0 by default) */
-  double maxDuration_   = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
+  int refcount_            = 1;
+  double sharing_priority_ = 1.0;             /**< priority (1.0 by default) */
+  double max_duration_   = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
   double remains_;           /**< How much of that cost remains to be done in the currently running task */
-  double start_;             /**< start time  */
-  char* category_ = nullptr; /**< tracing category for categorized resource utilization monitoring */
-  double finishTime_ =
-      -1; /**< finish time : this is modified during the run and fluctuates until the task is completed */
+  double start_time_;        /**< start time  */
+  double finish_time_ = -1;  /**< finish time (may fluctuate until the task is completed) */
+  char* category_     = nullptr; /**< tracing category for categorized resource utilization monitoring */
 
   double cost_;
   simgrid::kernel::resource::Model* model_;
   void* data_ = nullptr; /**< for your convenience */
 
   /* LMM */
-  double lastUpdate_                                  = 0;
-  double lastValue_                                   = 0;
-  kernel::lmm::Variable* variable_                    = nullptr;
-  Action::Type type_                                  = Action::Type::NOTSET;
-  boost::optional<heap_type::handle_type> heapHandle_ = boost::none;
+  double last_update_                                = 0;
+  double last_value_                                 = 0;
+  kernel::lmm::Variable* variable_                   = nullptr;
+  Action::Type type_                                 = Action::Type::NOTSET;
+  boost::optional<heap_type::handle_type> heap_hook_ = boost::none;
 
 public:
-  virtual void updateRemainingLazy(double now) { THROW_IMPOSSIBLE; };
-  void heapInsert(heap_type & heap, double key, Action::Type hat);
-  void heapRemove(heap_type & heap);
-  void heapUpdate(heap_type & heap, double key, Action::Type hat);
-  void clearHeapHandle() { heapHandle_ = boost::none; }
-  kernel::lmm::Variable* getVariable() const { return variable_; }
-  void setVariable(kernel::lmm::Variable * var) { variable_ = var; }
-  double getLastUpdate() const { return lastUpdate_; }
-  void refreshLastUpdate() { lastUpdate_ = surf_get_clock(); }
-  double getLastValue() const { return lastValue_; }
-  void setLastValue(double val) { lastValue_ = val; }
-  Action::Type getType() const { return type_; }
+  void heapInsert(double key, Action::Type hat);
+  void heapRemove();
+  void heapUpdate(double key, Action::Type hat);
+  void clearHeapHandle() { heap_hook_ = boost::none; }
+
+  lmm::Variable* get_variable() const { return variable_; }
+  void set_variable(lmm::Variable* var) { variable_ = var; }
+
+  double get_last_update() const { return last_update_; }
+  void set_last_update();
+
+  double get_last_value() const { return last_value_; }
+  void set_last_value(double val) { last_value_ = val; }
+
+  Action::Type get_type() const { return type_; }
 
 protected:
   Action::SuspendStates suspended_ = Action::SuspendStates::not_suspended;
 };
 
-typedef Action::ActionList ActionList;
-typedef Action::ActionLmmList ActionLmmList;
-typedef Action::ActionLmmList* ActionLmmListPtr;
-} // namespace surf
-} // namespace simgrid
+} // namespace resource
+} // namespace kernel
 } // namespace simgrid
 #endif
diff --git a/include/simgrid/kernel/resource/Model.hpp b/include/simgrid/kernel/resource/Model.hpp
new file mode 100644 (file)
index 0000000..7703923
--- /dev/null
@@ -0,0 +1,109 @@
+/* Copyright (c) 2004-2018. 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. */
+
+#ifndef SIMGRID_KERNEL_RESOURCE_MODEL_HPP
+#define SIMGRID_KERNEL_RESOURCE_MODEL_HPP
+
+#include <simgrid/kernel/resource/Action.hpp>
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+/** @ingroup SURF_interface
+ * @brief SURF model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
+class XBT_PUBLIC Model {
+public:
+  /** @brief Possible update mechanisms */
+  enum class UpdateAlgo {
+    Full,     /**< Full update mechanism: the remaining time of every action is recomputed at each step */
+    Lazy,     /**< Lazy update mechanism: only the modified actions get recomputed.
+                      It may be slower than full if your system is tightly coupled to the point where every action
+                      gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for
+                      a simple full update.  */
+    Undefined /**< Mechanism not defined */
+  };
+
+  Model();
+  virtual ~Model();
+
+  /** @brief Get the set of [actions](@ref Action) in *ready* state */
+  Action::StateSet* get_ready_action_set() const { return ready_action_set_; }
+
+  /** @brief Get the set of [actions](@ref Action) in *running* state */
+  Action::StateSet* get_running_action_set() const { return running_action_set_; }
+
+  /** @brief Get the set of [actions](@ref Action) in *failed* state */
+  Action::StateSet* get_failed_action_set() const { return failed_action_set_; }
+
+  /** @brief Get the set of [actions](@ref Action) in *done* state */
+  Action::StateSet* get_done_action_set() const { return done_action_set_; }
+
+  /** @brief Get the set of modified [actions](@ref Action) */
+  Action::ModifiedSet* get_modified_set() const;
+
+  /** @brief Get the maxmin system of the current Model */
+  lmm::System* get_maxmin_system() const { return maxmin_system_; }
+
+  /** @brief Set the maxmin system of the current Model */
+  void set_maxmin_system(lmm::System* system) { maxmin_system_ = system; }
+
+  /**
+   * @brief Get the update mechanism of the current Model
+   * @see e_UM_t
+   */
+  UpdateAlgo getUpdateMechanism() const { return update_mechanism_; }
+  void setUpdateMechanism(UpdateAlgo mechanism) { update_mechanism_ = mechanism; }
+
+  /** @brief Get Action heap */
+  heap_type& getActionHeap() { return action_heap_; }
+
+  double actionHeapTopDate() const { return action_heap_.top().first; }
+  Action* actionHeapPop();
+  bool actionHeapIsEmpty() const { return action_heap_.empty(); }
+
+  /**
+   * @brief Share the resources between the actions
+   *
+   * @param now The current time of the simulation
+   * @return The delta of time till the next action will finish
+   */
+  virtual double next_occuring_event(double now);
+  virtual double next_occuring_event_lazy(double now);
+  virtual double next_occuring_event_full(double now);
+
+  /**
+   * @brief Update action to the current time
+   *
+   * @param now The current time of the simulation
+   * @param delta The delta of time since the last update
+   */
+  virtual void update_actions_state(double now, double delta);
+  virtual void update_actions_state_lazy(double now, double delta);
+  virtual void update_actions_state_full(double now, double delta);
+
+  /** @brief Returns whether this model have an idempotent shareResource()
+   *
+   * The only model that is not is NS3: computing the next timestamp moves the model up to that point,
+   * so we need to call it only when the next timestamp of other sources is computed.
+   */
+  virtual bool nextOccuringEventIsIdempotent() { return true; }
+
+private:
+  lmm::System* maxmin_system_           = nullptr;
+  UpdateAlgo update_mechanism_          = UpdateAlgo::Undefined;
+  Action::StateSet* ready_action_set_   = new Action::StateSet(); /**< Actions in state SURF_ACTION_READY */
+  Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_RUNNING */
+  Action::StateSet* failed_action_set_  = new Action::StateSet(); /**< Actions in state SURF_ACTION_FAILED */
+  Action::StateSet* done_action_set_    = new Action::StateSet(); /**< Actions in state SURF_ACTION_DONE */
+  heap_type action_heap_;
+};
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
+#endif
similarity index 81%
rename from src/kernel/resource/Resource.hpp
rename to include/simgrid/kernel/resource/Resource.hpp
index 8bf9885..551ff4c 100644 (file)
@@ -6,7 +6,12 @@
 #ifndef SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP
 #define SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP
 
-#include "src/surf/surf_interface.hpp"
+#include <simgrid/forward.h>
+#include <xbt/signal.hpp>
+#include <xbt/str.h>
+#include <xbt/utility.hpp>
+
+#include <string>
 
 namespace simgrid {
 namespace kernel {
@@ -16,8 +21,7 @@ namespace resource {
  * @brief SURF resource interface class
  * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or storage
  */
-XBT_PUBLIC_CLASS Resource
-{
+class XBT_PUBLIC Resource {
 public:
   /**
    * @brief Constructor of LMM Resources
@@ -26,7 +30,7 @@ public:
    * @param name The name of the Resource
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
-  Resource(Model * model, const std::string& name, lmm::Constraint* constraint);
+  Resource(Model* model, const std::string& name, lmm::Constraint* constraint);
 
   virtual ~Resource();
 
@@ -46,7 +50,7 @@ public:
    * @param event What happened
    * @param value [TODO]
    */
-  virtual void apply_event(tmgr_trace_event_t event, double value) = 0;
+  virtual void apply_event(TraceEvent* event, double value) = 0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
   virtual bool isUsed() = 0;
@@ -66,7 +70,7 @@ public:
 private:
   std::string name_;
   Model* model_;
-  bool isOn_ = true;
+  bool is_on_ = true;
 
 public: /* LMM */
   /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
@@ -77,9 +81,9 @@ private:
 
 protected:
   struct Metric {
-    double peak;              /**< The peak of the metric, ie its max value */
-    double scale;             /**< Current availability of the metric according to the traces, in [0,1] */
-    tmgr_trace_event_t event; /**< The associated trace event associated to the metric */
+    double peak;       /**< The peak of the metric, ie its max value */
+    double scale;      /**< Current availability of the metric according to the traces, in [0,1] */
+    TraceEvent* event; /**< The associated trace event associated to the metric */
   };
 };
 } // namespace resource
similarity index 86%
rename from src/kernel/routing/ClusterZone.hpp
rename to include/simgrid/kernel/routing/ClusterZone.hpp
index a9a7866..f44aba3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,9 +6,9 @@
 #ifndef SIMGRID_ROUTING_CLUSTER_HPP_
 #define SIMGRID_ROUTING_CLUSTER_HPP_
 
-#include <unordered_map>
+#include <simgrid/kernel/routing/NetZoneImpl.hpp>
 
-#include "src/kernel/routing/NetZoneImpl.hpp"
+#include <unordered_map>
 
 namespace simgrid {
 namespace kernel {
@@ -81,21 +81,21 @@ public:
 
   /* We use a map instead of a std::vector here because that's a sparse vector. Some values may not exist */
   /* The pair is {linkUp, linkDown} */
-  std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> privateLinks_;
+  std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> private_links_;
 
-  unsigned int nodePosition(int id) { return id * linkCountPerNode_; }
-  unsigned int nodePositionWithLoopback(int id) { return nodePosition(id) + (hasLoopback_ ? 1 : 0); }
-  unsigned int nodePositionWithLimiter(int id) { return nodePositionWithLoopback(id) + (hasLimiter_ ? 1 : 0); }
+  unsigned int nodePosition(int id) { return id * num_links_per_node_; }
+  unsigned int nodePositionWithLoopback(int id) { return nodePosition(id) + (has_loopback_ ? 1 : 0); }
+  unsigned int nodePositionWithLimiter(int id) { return nodePositionWithLoopback(id) + (has_limiter_ ? 1 : 0); }
 
   surf::LinkImpl* backbone_      = nullptr;
   void* loopback_                = nullptr;
   NetPoint* router_              = nullptr;
-  bool hasLimiter_               = false;
-  bool hasLoopback_              = false;
-  unsigned int linkCountPerNode_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */
+  bool has_limiter_                = false;
+  bool has_loopback_               = false;
+  unsigned int num_links_per_node_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */
 };
-}
-}
-} // namespace
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SIMGRID_ROUTING_CLUSTER_HPP_ */
similarity index 81%
rename from src/kernel/routing/DijkstraZone.hpp
rename to include/simgrid/kernel/routing/DijkstraZone.hpp
index 001eb42..2a638bd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,7 @@
 #ifndef SURF_ROUTING_DIJKSTRA_HPP_
 #define SURF_ROUTING_DIJKSTRA_HPP_
 
-#include "src/kernel/routing/RoutedZone.hpp"
+#include <simgrid/kernel/routing/RoutedZone.hpp>
 
 struct s_graph_node_data_t {
   int id;
@@ -28,7 +28,8 @@ namespace routing {
  *  The path between components is computed each time you request it,
  *  using the Dijkstra algorithm. A cache can be used to reduce the computation.
  *
- *  This result in rather small platform file, very fast initialization, and very low memory requirements, but somehow long path resolution times.
+ *  This result in rather small platform file, very fast initialization, and very low memory requirements, but somehow
+ * long path resolution times.
  */
 class XBT_PRIVATE DijkstraZone : public RoutedZone {
 public:
@@ -54,13 +55,13 @@ public:
   void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
                 std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
 
-  xbt_graph_t routeGraph_  = nullptr; /* xbt_graph */
-  std::map<int, xbt_node_t> graphNodeMap_;     /* map */
+  xbt_graph_t route_graph_ = nullptr;          /* xbt_graph */
+  std::map<int, xbt_node_t> graph_node_map_;   /* map */
   bool cached_;                                /* cache mode */
-  std::map<int, std::vector<int>> routeCache_; /* use in cache mode */
+  std::map<int, std::vector<int>> route_cache_; /* use in cache mode */
 };
-}
-}
-} // namespaces
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SURF_ROUTING_DIJKSTRA_HPP_ */
similarity index 80%
rename from src/kernel/routing/DragonflyZone.hpp
rename to include/simgrid/kernel/routing/DragonflyZone.hpp
index f676e41..f5063d9 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
 #define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
 
-#include "src/kernel/routing/ClusterZone.hpp"
+#include <simgrid/kernel/routing/ClusterZone.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -17,10 +17,10 @@ public:
   unsigned int group_;
   unsigned int chassis_;
   unsigned int blade_;
-  surf::LinkImpl** blueLinks_  = nullptr;
-  surf::LinkImpl** blackLinks_ = nullptr;
-  surf::LinkImpl** greenLinks_ = nullptr;
-  surf::LinkImpl** myNodes_    = nullptr;
+  surf::LinkImpl** blue_links_  = nullptr;
+  surf::LinkImpl** black_links_ = nullptr;
+  surf::LinkImpl** green_links_ = nullptr;
+  surf::LinkImpl** my_nodes_    = nullptr;
   DragonflyRouter(int i, int j, int k);
   ~DragonflyRouter();
 };
@@ -58,7 +58,7 @@ public:
  *    is also not realistic, as blue level can use more links than a single
  *    Aries can handle, thus it should use several routers.
  */
-XBT_PUBLIC_CLASS DragonflyZone : public ClusterZone {
+class XBT_PUBLIC DragonflyZone : public ClusterZone {
 public:
   explicit DragonflyZone(NetZone* father, std::string name);
   ~DragonflyZone() override;
@@ -74,17 +74,17 @@ public:
 
 private:
   ClusterCreationArgs* cluster_     = nullptr;
-  unsigned int numNodesPerBlade_    = 0;
-  unsigned int numBladesPerChassis_ = 0;
-  unsigned int numChassisPerGroup_  = 0;
-  unsigned int numGroups_           = 0;
-  unsigned int numLinksGreen_       = 0;
-  unsigned int numLinksBlack_       = 0;
-  unsigned int numLinksBlue_        = 0;
-  unsigned int numLinksperLink_     = 1; // splitduplex -> 2, only for local link
+  unsigned int num_nodes_per_blade_    = 0;
+  unsigned int num_blades_per_chassis_ = 0;
+  unsigned int num_chassis_per_group_  = 0;
+  unsigned int num_groups_             = 0;
+  unsigned int num_links_green_        = 0;
+  unsigned int num_links_black_        = 0;
+  unsigned int num_links_blue_         = 0;
+  unsigned int num_links_per_link_     = 1; // splitduplex -> 2, only for local link
   DragonflyRouter** routers_        = nullptr;
 };
-}
-}
-}
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 #endif
similarity index 85%
rename from src/kernel/routing/EmptyZone.hpp
rename to include/simgrid/kernel/routing/EmptyZone.hpp
index 2ec0d85..cb64ff5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,7 @@
 #ifndef SURF_ROUTING_NONE_HPP_
 #define SURF_ROUTING_NONE_HPP_
 
-#include "src/kernel/routing/NetZoneImpl.hpp"
+#include <simgrid/kernel/routing/NetZoneImpl.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -32,8 +32,8 @@ public:
   void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* /*nodes*/,
                 std::map<std::string, xbt_edge_t>* /*edges*/) override;
 };
-}
-}
-} // namespace
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SURF_ROUTING_NONE_HPP_ */
similarity index 85%
rename from src/kernel/routing/FatTreeZone.hpp
rename to include/simgrid/kernel/routing/FatTreeZone.hpp
index 73e313a..251cb3d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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. */
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_ROUTING_CLUSTER_FAT_TREE_HPP_
 #define SIMGRID_ROUTING_CLUSTER_FAT_TREE_HPP_
 
-#include "src/kernel/routing/ClusterZone.hpp"
+#include <simgrid/kernel/routing/ClusterZone.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -46,7 +46,7 @@ public:
 
   /** Virtual link standing for the node global capacity.
    */
-  surf::LinkImpl* limiterLink;
+  surf::LinkImpl* limiter_link_;
   /** If present, communications from this node to this node will pass through it
    * instead of passing by an upper level switch.
    */
@@ -63,13 +63,13 @@ class FatTreeLink {
 public:
   FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* source, FatTreeNode* destination);
   /** Link going up in the tree */
-  surf::LinkImpl* upLink;
+  surf::LinkImpl* up_link_;
   /** Link going down in the tree */
-  surf::LinkImpl* downLink;
+  surf::LinkImpl* down_link_;
   /** Upper end of the link */
-  FatTreeNode* upNode;
+  FatTreeNode* up_node_;
   /** Lower end of the link */
-  FatTreeNode* downNode;
+  FatTreeNode* down_node_;
 };
 
 /** @ingroup ROUTING_API
@@ -114,24 +114,24 @@ public:
    * It will also store the cluster for future use.
    */
   void parse_specific_arguments(ClusterCreationArgs* cluster) override;
-  void addProcessingNode(int id);
-  void generateDotFile(const std::string& filename = "fatTree.dot") const;
+  void add_processing_node(int id);
+  void generate_dot_file(const std::string& filename = "fatTree.dot") const;
 
 private:
   // description of a PGFT (TODO : better doc)
   unsigned long levels_ = 0;
-  std::vector<unsigned int> lowerLevelNodesNumber_; // number of children by node
-  std::vector<unsigned int> upperLevelNodesNumber_; // number of parents by node
-  std::vector<unsigned int> lowerLevelPortsNumber_; // ports between each level l and l-1
+  std::vector<unsigned int> num_children_per_node_; // number of children by node
+  std::vector<unsigned int> num_parents_per_node_;  // number of parents by node
+  std::vector<unsigned int> num_port_lower_level_;  // ports between each level l and l-1
 
-  std::map<int, FatTreeNode*> computeNodes_;
+  std::map<int, FatTreeNode*> compute_nodes_;
   std::vector<FatTreeNode*> nodes_;
   std::vector<FatTreeLink*> links_;
-  std::vector<unsigned int> nodesByLevel_;
+  std::vector<unsigned int> nodes_by_level_;
 
   ClusterCreationArgs* cluster_ = nullptr;
 
-  void addLink(FatTreeNode* parent, unsigned int parentPort, FatTreeNode* child, unsigned int childPort);
+  void addLink(FatTreeNode* parent, unsigned int parent_port, FatTreeNode* child, unsigned int child_port);
   int getLevelPosition(const unsigned int level);
   void generateLabels();
   void generateSwitches();
@@ -139,8 +139,8 @@ private:
   bool areRelated(FatTreeNode* parent, FatTreeNode* child);
   bool isInSubTree(FatTreeNode* root, FatTreeNode* node);
 };
-}
-}
-} // namespaces
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif
similarity index 83%
rename from src/kernel/routing/FloydZone.hpp
rename to include/simgrid/kernel/routing/FloydZone.hpp
index c7479c2..7046ec9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,7 @@
 #ifndef SURF_ROUTING_FLOYD_HPP_
 #define SURF_ROUTING_FLOYD_HPP_
 
-#include "src/kernel/routing/RoutedZone.hpp"
+#include <simgrid/kernel/routing/RoutedZone.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -34,12 +34,12 @@ public:
 
 private:
   /* vars to compute the Floyd algorithm. */
-  int* predecessorTable_;
-  double* costTable_;
-  RouteCreationArgs** linkTable_;
+  int* predecessor_table_;
+  double* cost_table_;
+  RouteCreationArgs** link_table_;
 };
-}
-}
-} // namespaces
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SURF_ROUTING_FLOYD_HPP_ */
similarity index 83%
rename from src/kernel/routing/FullZone.hpp
rename to include/simgrid/kernel/routing/FullZone.hpp
index d92e444..4890a24 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_ROUTING_FULL_HPP_
 #define SIMGRID_ROUTING_FULL_HPP_
 
-#include "src/kernel/routing/RoutedZone.hpp"
+#include <simgrid/kernel/routing/RoutedZone.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -29,10 +29,11 @@ public:
                 kernel::routing::NetPoint* gw_dst, std::vector<simgrid::surf::LinkImpl*>& link_list,
                 bool symmetrical) override;
 
-  RouteCreationArgs** routingTable_ = nullptr;
+private:
+  RouteCreationArgs** routing_table_ = nullptr;
 };
-}
-}
-} // namespaces
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SIMGRID_ROUTING_FULL_HPP_ */
similarity index 75%
rename from src/kernel/routing/NetPoint.hpp
rename to include/simgrid/kernel/routing/NetPoint.hpp
index 0a48274..fd26947 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -10,7 +10,7 @@
 #include <xbt/base.h>
 #include <xbt/signal.hpp>
 
-#include "src/kernel/routing/NetZoneImpl.hpp"
+#include <simgrid/kernel/routing/NetZoneImpl.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -36,9 +36,9 @@ public:
   /** @brief the NetZone in which this NetPoint is included */
   NetZoneImpl* netzone() { return netzone_; }
 
-  bool isNetZone() { return componentType_ == Type::NetZone; }
-  bool isHost() { return componentType_ == Type::Host; }
-  bool isRouter() { return componentType_ == Type::Router; }
+  bool isNetZone() { return component_type_ == Type::NetZone; }
+  bool isHost() { return component_type_ == Type::Host; }
+  bool isRouter() { return component_type_ == Type::Router; }
 
   static simgrid::xbt::signal<void(NetPoint*)> onCreation;
 
@@ -47,13 +47,13 @@ public:
 private:
   unsigned int id_;
   std::string name_;
-  NetPoint::Type componentType_;
+  NetPoint::Type component_type_;
   NetZoneImpl* netzone_;
 };
-}
-}
-}
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
-XBT_PUBLIC(sg_netpoint_t) sg_netpoint_by_name_or_null(const char* name);
+XBT_PUBLIC sg_netpoint_t sg_netpoint_by_name_or_null(const char* name);
 
 #endif /* KERNEL_ROUTING_NETPOINT_HPP_ */
similarity index 83%
rename from src/kernel/routing/NetZoneImpl.hpp
rename to include/simgrid/kernel/routing/NetZoneImpl.hpp
index 9e0b013..dbcde25 100644 (file)
@@ -6,13 +6,11 @@
 #ifndef SIMGRID_ROUTING_NETZONEIMPL_HPP
 #define SIMGRID_ROUTING_NETZONEIMPL_HPP
 
-#include <map>
-
-#include "xbt/graph.h"
+#include <simgrid/forward.h>
+#include <simgrid/s4u/NetZone.hpp>
+#include <xbt/graph.h>
 
-#include "simgrid/forward.h"
-#include "simgrid/s4u/NetZone.hpp"
-#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
+#include <map>
 
 namespace simgrid {
 namespace kernel {
@@ -48,12 +46,11 @@ class BypassRoute;
  * called Autonomous Systems in this article).
  *
  */
-XBT_PUBLIC_CLASS NetZoneImpl : public s4u::NetZone
-{
+class XBT_PUBLIC NetZoneImpl : public s4u::NetZone {
   friend simgrid::kernel::EngineImpl; // it destroys netRoot_
 
 protected:
-  explicit NetZoneImpl(NetZone * father, std::string name);
+  explicit NetZoneImpl(NetZone* father, std::string name);
   virtual ~NetZoneImpl();
 
 public:
@@ -61,8 +58,8 @@ public:
   simgrid::s4u::Host* createHost(const char* name, std::vector<double>* speedPerPstate, int coreAmount,
                                  std::map<std::string, std::string>* props);
   /** @brief Creates a new route in this NetZone */
-  void addBypassRoute(NetPoint * src, NetPoint * dst, NetPoint * gw_src, NetPoint * gw_dst,
-                      std::vector<simgrid::surf::LinkImpl*> & link_list, bool symmetrical) override;
+  void addBypassRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
+                      std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
 
 protected:
   /**
@@ -73,10 +70,10 @@ protected:
    * @param into Container into which the traversed links and gateway informations should be pushed
    * @param latency Accumulator in which the latencies should be added (caller must set it to 0)
    */
-  virtual void getLocalRoute(NetPoint * src, NetPoint * dst, RouteCreationArgs * into, double* latency) = 0;
+  virtual void getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) = 0;
   /** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */
   /* returns whether we found a bypass path */
-  bool getBypassRoute(routing::NetPoint * src, routing::NetPoint * dst,
+  bool getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
                       /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency);
 
 public:
@@ -87,11 +84,11 @@ public:
    * @param links Accumulator in which all traversed links should be pushed (caller must empty it)
    * @param latency Accumulator in which the latencies should be added (caller must set it to 0)
    */
-  static void getGlobalRoute(routing::NetPoint * src, routing::NetPoint * dst,
+  static void getGlobalRoute(routing::NetPoint* src, routing::NetPoint* dst,
                              /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency);
 
-  virtual void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t> * nodes,
-                        std::map<std::string, xbt_edge_t> * edges) = 0;
+  virtual void getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+                        std::map<std::string, xbt_edge_t>* edges) = 0;
   enum class RoutingMode {
     unset = 0, /**< Undefined type                                   */
     base,      /**< Base case: use simple link lists for routing     */
@@ -101,11 +98,11 @@ public:
   RoutingMode hierarchy_ = RoutingMode::unset;
 
 private:
-  std::map<std::pair<NetPoint*, NetPoint*>, BypassRoute*> bypassRoutes_; // src x dst -> route
+  std::map<std::pair<NetPoint*, NetPoint*>, BypassRoute*> bypass_routes_; // src x dst -> route
   routing::NetPoint* netpoint_ = nullptr;                                // Our representative in the father NetZone
 };
-}
-}
-}; // Namespace simgrid::kernel::routing
+} // namespace routing
+} // namespace kernel
+}; // namespace simgrid
 
 #endif /* SIMGRID_ROUTING_NETZONEIMPL_HPP */
similarity index 93%
rename from src/kernel/routing/RoutedZone.hpp
rename to include/simgrid/kernel/routing/RoutedZone.hpp
index 1a874b0..efe3729 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_ROUTING_GENERIC_HPP_
 #define SIMGRID_ROUTING_GENERIC_HPP_
 
-#include "src/kernel/routing/NetZoneImpl.hpp"
+#include <simgrid/kernel/routing/NetZoneImpl.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -64,9 +64,9 @@ protected:
                            kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst,
                            std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical);
 };
-}
-}
-} // namespace
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 extern "C" {
 XBT_PRIVATE xbt_node_t new_xbt_graph_node(xbt_graph_t graph, const char* name,
similarity index 82%
rename from src/kernel/routing/TorusZone.hpp
rename to include/simgrid/kernel/routing/TorusZone.hpp
index ac04e68..463f654 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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. */
@@ -6,7 +6,8 @@
 #ifndef SURF_ROUTING_CLUSTER_TORUS_HPP_
 #define SURF_ROUTING_CLUSTER_TORUS_HPP_
 
-#include "src/kernel/routing/ClusterZone.hpp"
+#include <simgrid/kernel/routing/ClusterZone.hpp>
+
 #include <vector>
 
 namespace simgrid {
@@ -28,7 +29,7 @@ public:
 private:
   std::vector<unsigned int> dimensions_;
 };
-}
-}
-}
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 #endif
similarity index 91%
rename from src/kernel/routing/VivaldiZone.hpp
rename to include/simgrid/kernel/routing/VivaldiZone.hpp
index 794fe7a..ccec349 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,8 @@
 #ifndef SURF_ROUTING_VIVALDI_HPP_
 #define SURF_ROUTING_VIVALDI_HPP_
 
-#include "src/kernel/routing/ClusterZone.hpp"
+#include <simgrid/kernel/routing/ClusterZone.hpp>
+#include <xbt/Extendable.hpp>
 
 namespace simgrid {
 namespace kernel {
@@ -60,9 +61,9 @@ public:
 
   std::vector<double> coords;
 };
-}
-}
-}
-} // namespace
+} // namespace vivaldi
+} // namespace routing
+} // namespace kernel
+} // namespace simgrid
 
 #endif /* SURF_ROUTING_VIVALDI_HPP_ */
index 9dea554..07aecc9 100644 (file)
@@ -1,7 +1,6 @@
 /* Public interface to the Link datatype                                    */
 
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2015-2018. 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. */
@@ -9,21 +8,21 @@
 #ifndef INCLUDE_SIMGRID_LINK_H_
 #define INCLUDE_SIMGRID_LINK_H_
 
-#include "simgrid/forward.h"
-#include "xbt/base.h"
+#include <simgrid/forward.h>
+#include <xbt/base.h>
 
 /* C interface */
 SG_BEGIN_DECL()
-XBT_PUBLIC(const char*) sg_link_name(sg_link_t link);
-XBT_PUBLIC(sg_link_t) sg_link_by_name(const char* name);
-XBT_PUBLIC(int) sg_link_is_shared(sg_link_t link);
-XBT_PUBLIC(double) sg_link_bandwidth(sg_link_t link);
-XBT_PUBLIC(double) sg_link_latency(sg_link_t link);
-XBT_PUBLIC(void*) sg_link_data(sg_link_t link);
-XBT_PUBLIC(void) sg_link_data_set(sg_link_t link, void* data);
-XBT_PUBLIC(int) sg_link_count();
-XBT_PUBLIC(sg_link_t*) sg_link_list();
-XBT_PUBLIC(void) sg_link_exit();
+XBT_PUBLIC const char* sg_link_name(sg_link_t link);
+XBT_PUBLIC sg_link_t sg_link_by_name(const char* name);
+XBT_PUBLIC int sg_link_is_shared(sg_link_t link);
+XBT_PUBLIC double sg_link_bandwidth(sg_link_t link);
+XBT_PUBLIC double sg_link_latency(sg_link_t link);
+XBT_PUBLIC void* sg_link_data(sg_link_t link);
+XBT_PUBLIC void sg_link_data_set(sg_link_t link, void* data);
+XBT_PUBLIC int sg_link_count();
+XBT_PUBLIC sg_link_t* sg_link_list();
+XBT_PUBLIC void sg_link_exit();
 SG_END_DECL()
 
 #endif /* INCLUDE_SIMGRID_LINK_H_ */
index 5ccaed2..547f9fd 100644 (file)
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(int) MC_random(int min, int max);
+XBT_PUBLIC int MC_random(int min, int max);
 
 #if SIMGRID_HAVE_MC
 
 /* Internal variable used to check if we're running under the MC
  *
  * Please don't use directly: you should use MC_is_active. */
-extern XBT_PUBLIC(int) _sg_do_model_check;
-extern XBT_PUBLIC(int) _sg_mc_max_visited_states;
+extern XBT_PUBLIC int _sg_do_model_check;
+extern XBT_PUBLIC int _sg_mc_max_visited_states;
 
 #define MC_is_active()                  _sg_do_model_check
 #define MC_visited_reduction() _sg_mc_max_visited_states
@@ -39,17 +39,17 @@ extern XBT_PUBLIC(int) _sg_mc_max_visited_states;
  *
  *  This function is used to define safety properties to verify.
  */
-XBT_PUBLIC(void) MC_assert(int);
+XBT_PUBLIC void MC_assert(int);
 
-XBT_PUBLIC(void) MC_automaton_new_propositional_symbol(const char* id, int(*fct)(void));
-XBT_PUBLIC(void) MC_automaton_new_propositional_symbol_pointer(const char *id, int* value);
+XBT_PUBLIC void MC_automaton_new_propositional_symbol(const char* id, int (*fct)(void));
+XBT_PUBLIC void MC_automaton_new_propositional_symbol_pointer(const char* id, int* value);
 
-XBT_PUBLIC(void) MC_cut(void);
-XBT_PUBLIC(void) MC_ignore(void *addr, size_t size);
+XBT_PUBLIC void MC_cut(void);
+XBT_PUBLIC void MC_ignore(void* addr, size_t size);
 
-XBT_PUBLIC(void) MC_ignore_heap(void* address, size_t size);
-XBT_PUBLIC(void) MC_unignore_heap(void* address, size_t size);
-XBT_PUBLIC(void) MC_ignore_global_variable(const char* var_name);
+XBT_PUBLIC void MC_ignore_heap(void* address, size_t size);
+XBT_PUBLIC void MC_unignore_heap(void* address, size_t size);
+XBT_PUBLIC void MC_ignore_global_variable(const char* var_name);
 
 #else
 
index b885231..796e26b 100644 (file)
@@ -3,20 +3,24 @@
 /* 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. */
 
-#ifndef MSG_H
-#define MSG_H
-
-#include "simgrid/forward.h"
-#include "simgrid/host.h"
-#include "simgrid/plugins/live_migration.h"
-
-#include "xbt/base.h"
-#include "xbt/dict.h"
-#include "xbt/dynar.h"
+#ifndef SIMGRID_MSG_H
+#define SIMGRID_MSG_H
+
+#include <simgrid/actor.h>
+#include <simgrid/forward.h>
+#include <simgrid/host.h>
+#include <simgrid/instr.h>
+#include <simgrid/plugins/live_migration.h>
+#include <simgrid/storage.h>
+#include <simgrid/vm.h>
+#include <simgrid/zone.h>
+#include <xbt/base.h>
+#include <xbt/dict.h>
+#include <xbt/dynar.h>
 
 #ifdef __cplusplus
-#include "simgrid/simix.h"
 #include <map>
+#include <simgrid/simix.h>
 namespace simgrid {
 namespace msg {
 class Comm;
@@ -31,59 +35,113 @@ SG_BEGIN_DECL()
 
 /* *************************** Network Zones ******************************** */
 #define msg_as_t msg_netzone_t /* portability macro */
-typedef s4u_NetZone* msg_netzone_t;
+typedef sg_netzone_t msg_netzone_t;
 
-/* ******************************** Host ************************************ */
+XBT_PUBLIC msg_netzone_t MSG_zone_get_root();
+XBT_PUBLIC const char* MSG_zone_get_name(msg_netzone_t zone);
+XBT_PUBLIC msg_netzone_t MSG_zone_get_by_name(const char* name);
+XBT_PUBLIC void MSG_zone_get_sons(msg_netzone_t zone, xbt_dict_t whereto);
+XBT_PUBLIC const char* MSG_zone_get_property_value(msg_netzone_t zone, const char* name);
+XBT_PUBLIC void MSG_zone_set_property_value(msg_netzone_t zone, const char* name, char* value);
+XBT_PUBLIC void MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
 
-/** @brief Host datatype.
-    @ingroup m_host_management
-
-    A <em>location</em> (or <em>host</em>) is any possible place where
-    a process may run. Thus it is represented as a <em>physical
-    resource with computing capabilities</em>, some <em>mailboxes</em>
-    to enable running process to communicate with remote ones, and
-    some <em>private data</em> that can be only accessed by local
-    process.
- */
+/* ******************************** Hosts ************************************ */
 typedef sg_host_t msg_host_t;
 
+XBT_PUBLIC size_t MSG_get_host_number();
+XBT_PUBLIC sg_host_t MSG_get_host_by_name(const char* name);
+XBT_PUBLIC sg_host_t MSG_host_by_name(const char* name);
+
+XBT_PUBLIC xbt_dynar_t MSG_hosts_as_dynar();
+
+XBT_PUBLIC const char* MSG_host_get_name(sg_host_t host);
+XBT_PUBLIC void* MSG_host_get_data(sg_host_t host);
+XBT_PUBLIC void MSG_host_set_data(sg_host_t host, void* data);
+XBT_PUBLIC xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host);
+XBT_PUBLIC xbt_dynar_t MSG_host_get_attached_storage_lists(sg_host_t host);
+XBT_PUBLIC double MSG_host_get_speed(sg_host_t host);
+XBT_PUBLIC double MSG_host_get_power_peak_at(sg_host_t host, int pstate_index);
+XBT_PUBLIC int MSG_host_get_core_number(sg_host_t host);
+XBT_PUBLIC int MSG_host_get_nb_pstates(sg_host_t host);
+XBT_PUBLIC int MSG_host_get_pstate(sg_host_t host);
+XBT_PUBLIC void MSG_host_set_pstate(sg_host_t host, int pstate);
+XBT_PUBLIC void MSG_host_on(sg_host_t h);
+XBT_PUBLIC void MSG_host_off(sg_host_t h);
+XBT_PUBLIC int MSG_host_is_on(sg_host_t h);
+XBT_PUBLIC int MSG_host_is_off(sg_host_t h);
+XBT_PUBLIC xbt_dict_t MSG_host_get_properties(sg_host_t host);
+XBT_PUBLIC const char* MSG_host_get_property_value(sg_host_t host, const char* name);
+XBT_PUBLIC void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value);
+XBT_PUBLIC void MSG_host_get_process_list(sg_host_t host, xbt_dynar_t whereto);
+
+XBT_PUBLIC sg_host_t MSG_host_self();
+
+/* ******************************** VMs ************************************* */
+typedef sg_vm_t msg_vm_t;
 
-XBT_PUBLIC_DATA(int) sg_storage_max_file_descriptors;
-/* ******************************** Task ************************************ */
+XBT_ATTRIB_DEPRECATED_v322("Use sg_vm_create_migratable() from the live migration plugin: "
+                           "v3.22 will drop MSG_vm_create() completely.") XBT_PUBLIC sg_vm_t
+    MSG_vm_create(sg_host_t ind_pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity);
 
-typedef struct s_simdata_task_t* simdata_task_t;
+XBT_PUBLIC msg_vm_t MSG_vm_create_core(msg_host_t pm, const char* name);
+XBT_PUBLIC msg_vm_t MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount);
 
-typedef struct msg_task {
-  char *name;                   /**< @brief task name if any */
-  simdata_task_t simdata;       /**< @brief simulator data */
-  void *data;                   /**< @brief user data */
-  long long int counter;        /* task unique identifier for instrumentation */
-  char *category;               /* task category for instrumentation */
-} s_msg_task_t;
+XBT_PUBLIC int MSG_vm_is_created(msg_vm_t vm);
+XBT_PUBLIC int MSG_vm_is_running(msg_vm_t vm);
+XBT_PUBLIC int MSG_vm_is_suspended(msg_vm_t vm);
 
-/** @brief Task datatype.
-    @ingroup m_task_management
+XBT_PUBLIC const char* MSG_vm_get_name(msg_vm_t vm);
+XBT_PUBLIC void MSG_vm_set_ramsize(msg_vm_t vm, size_t size);
+XBT_PUBLIC size_t MSG_vm_get_ramsize(msg_vm_t vm);
+XBT_PUBLIC msg_host_t MSG_vm_get_pm(msg_vm_t vm);
+XBT_PUBLIC void MSG_vm_set_bound(msg_vm_t vm, double bound);
 
-    A <em>task</em> may then be defined by a <em>computing
-    amount</em>, a <em>message size</em> and some <em>private
-    data</em>.
- */
-typedef struct msg_task *msg_task_t;
+XBT_PUBLIC void MSG_vm_start(msg_vm_t vm);
+XBT_PUBLIC void MSG_vm_suspend(msg_vm_t vm);
+XBT_PUBLIC void MSG_vm_resume(msg_vm_t vm);
+XBT_PUBLIC void MSG_vm_shutdown(msg_vm_t vm);
+XBT_PUBLIC void MSG_vm_destroy(msg_vm_t vm);
 
-/* ******************************** VM ************************************* */
-typedef sg_vm_t msg_vm_t;
+/* ******************************** Storage ********************************* */
+typedef sg_storage_t msg_storage_t;
 
-/* ******************************** File ************************************ */
-typedef sg_file_t msg_file_t;
+XBT_PUBLIC const char* MSG_storage_get_name(msg_storage_t storage);
+XBT_PUBLIC msg_storage_t MSG_storage_get_by_name(const char* name);
+XBT_PUBLIC xbt_dict_t MSG_storage_get_properties(msg_storage_t storage);
+XBT_PUBLIC void MSG_storage_set_property_value(msg_storage_t storage, const char* name, const char* value);
+XBT_PUBLIC const char* MSG_storage_get_property_value(msg_storage_t storage, const char* name);
+XBT_PUBLIC xbt_dynar_t MSG_storages_as_dynar();
+XBT_PUBLIC void MSG_storage_set_data(msg_storage_t storage, void* data);
+XBT_PUBLIC void* MSG_storage_get_data(msg_storage_t storage);
+XBT_PUBLIC const char* MSG_storage_get_host(msg_storage_t storage);
+XBT_PUBLIC sg_size_t MSG_storage_read(msg_storage_t storage, sg_size_t size);
+XBT_PUBLIC sg_size_t MSG_storage_write(msg_storage_t storage, sg_size_t size);
+
+/* ******************************** Actor/process *************************** */
+typedef sg_actor_t msg_process_t;
+
+XBT_PUBLIC int MSG_process_get_PID(msg_process_t process);
+XBT_PUBLIC int MSG_process_get_PPID(msg_process_t process);
+XBT_PUBLIC const char* MSG_process_get_name(msg_process_t process);
+XBT_PUBLIC sg_host_t MSG_process_get_host(msg_process_t process);
 
-/* ******************************** Storage ************************************ */
+/*property handlers*/
+XBT_PUBLIC xbt_dict_t MSG_process_get_properties(msg_process_t process);
+XBT_PUBLIC const char* MSG_process_get_property_value(msg_process_t process, const char* name);
+
+XBT_PUBLIC void MSG_process_suspend(msg_process_t process);
+XBT_PUBLIC void MSG_process_resume(msg_process_t process);
+XBT_PUBLIC int MSG_process_is_suspended(msg_process_t process);
+XBT_PUBLIC void MSG_process_restart(msg_process_t process);
+XBT_PUBLIC void MSG_process_daemonize(msg_process_t process);
+XBT_PUBLIC void MSG_process_migrate(msg_process_t process, msg_host_t host);
+XBT_PUBLIC void MSG_process_join(msg_process_t process, double timeout);
+XBT_PUBLIC void MSG_process_kill(msg_process_t process);
+XBT_PUBLIC void MSG_process_set_kill_time(msg_process_t process, double kill_time);
 
-/** @brief Storage datatype.
- *  @ingroup msg_storage_management
- *
- *  You should consider this as an opaque object.
- */
-typedef sg_storage_t msg_storage_t;
+/* ******************************** File ************************************ */
+typedef sg_file_t msg_file_t;
+XBT_PUBLIC_DATA int sg_storage_max_file_descriptors;
 
 /**
  * \brief @brief Communication action.
@@ -93,24 +151,32 @@ typedef sg_storage_t msg_storage_t;
  */
 typedef sg_msg_Comm* msg_comm_t;
 
-/** \brief Default value for an uninitialized #msg_task_t.
-    \ingroup m_task_management
-*/
-#define MSG_TASK_UNINITIALIZED NULL
+/* ******************************** Task ************************************ */
 
-/* ****************************** Process *********************************** */
+typedef struct s_simdata_task_t* simdata_task_t;
 
-/** @brief Process datatype.
-    @ingroup m_process_management
+typedef struct msg_task {
+  char* name;             /**< @brief task name if any */
+  simdata_task_t simdata; /**< @brief simulator data */
+  void* data;             /**< @brief user data */
+  long long int counter;  /* task unique identifier for instrumentation */
+  char* category;         /* task category for instrumentation */
+} s_msg_task_t;
 
-    A process may be defined as a <em>code</em>, with some
-    <em>private data</em>, executing in a <em>location</em>.
+/** @brief Task datatype.
+    @ingroup m_task_management
 
-    You should not access directly to the fields of the pointed
-    structure, but always use the provided API to interact with
-    processes.
+    A <em>task</em> may then be defined by a <em>computing
+    amount</em>, a <em>message size</em> and some <em>private
+    data</em>.
  */
-typedef s4u_Actor* msg_process_t;
+
+typedef struct msg_task* msg_task_t;
+
+/** \brief Default value for an uninitialized #msg_task_t.
+    \ingroup m_task_management
+*/
+#define MSG_TASK_UNINITIALIZED NULL
 
 /** @brief Return code of most MSG functions
     @ingroup msg_simulation
@@ -130,7 +196,7 @@ typedef enum {
 /** @} */
 
 /************************** Global ******************************************/
-XBT_PUBLIC(void) MSG_config(const char *key, const char *value);
+XBT_PUBLIC void MSG_config(const char* key, const char* value);
 /** \ingroup msg_simulation
  *  \brief Initialize the MSG internal data.
  *  \hideinitializer
@@ -146,198 +212,120 @@ XBT_PUBLIC(void) MSG_config(const char *key, const char *value);
     MSG_init_nocheck(argc,argv);                                                        \
   } while (0)
 
-XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
-XBT_PUBLIC(msg_error_t) MSG_main();;
-XBT_PUBLIC(void) MSG_function_register(const char *name,
-                                       xbt_main_func_t code);
-XBT_PUBLIC(void) MSG_function_register_default(xbt_main_func_t code);
-XBT_PUBLIC(void) MSG_launch_application(const char *file);
+XBT_PUBLIC void MSG_init_nocheck(int* argc, char** argv);
+XBT_PUBLIC msg_error_t MSG_main();
+XBT_PUBLIC void MSG_function_register(const char* name, xbt_main_func_t code);
+XBT_PUBLIC void MSG_function_register_default(xbt_main_func_t code);
+XBT_PUBLIC void MSG_create_environment(const char* file);
+XBT_PUBLIC void MSG_launch_application(const char* file);
 /*Bypass the parser */
-XBT_PUBLIC(void) MSG_set_function(const char *host_id,
-                                  const char *function_name,
-                                  xbt_dynar_t arguments);
-
-XBT_PUBLIC(double) MSG_get_clock();
-XBT_PUBLIC(unsigned long int) MSG_get_sent_msg();
-
-/************************** Net Zones ***********************************/
-XBT_PUBLIC(msg_netzone_t) MSG_zone_get_root();
-XBT_PUBLIC(const char*) MSG_zone_get_name(msg_netzone_t zone);
-XBT_PUBLIC(msg_netzone_t) MSG_zone_get_by_name(const char* name);
-XBT_PUBLIC(void) MSG_zone_get_sons(msg_netzone_t zone, xbt_dict_t whereto);
-XBT_PUBLIC(const char*) MSG_zone_get_property_value(msg_netzone_t as, const char* name);
-XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
-XBT_PUBLIC(void) MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
-
-/************************** Storage handling ***********************************/
-XBT_PUBLIC(const char*) sg_storage_get_name(sg_storage_t storage);
-#define MSG_storage_get_name(storage) sg_storage_get_name(storage)
-XBT_PUBLIC(sg_storage_t) sg_storage_get_by_name(const char* name);
-#define MSG_storage_get_by_name(name) sg_storage_get_by_name(name)
-XBT_PUBLIC(xbt_dict_t) sg_storage_get_properties(sg_storage_t storage);
-#define MSG_storage_get_properties(storage) sg_storage_get_properties(storage)
-XBT_PUBLIC(void) sg_storage_set_property_value(sg_storage_t storage, const char* name, char* value);
-#define MSG_storage_set_property_value(storage, name, value) sg_storage_set_property_value(storage, name, value)
-XBT_PUBLIC(const char*) sg_storage_get_property_value(sg_storage_t storage, const char* name);
-#define MSG_storage_get_property_value(storage, name) sg_storage_get_property_value(storage, name)
-XBT_PUBLIC(xbt_dynar_t) sg_storages_as_dynar();
-#define MSG_storages_as_dynar() sg_storages_as_dynar()
-XBT_PUBLIC(void) sg_storage_set_data(sg_storage_t host, void* data);
-#define MSG_storage_set_data(storage, data) sg_storage_set_data(storage, data)
-XBT_PUBLIC(void*) sg_storage_get_data(sg_storage_t storage);
-#define MSG_storage_get_data(storage) sg_storage_get_data(storage)
-XBT_PUBLIC(const char*) sg_storage_get_host(sg_storage_t storage);
-#define MSG_storage_get_host(storage) sg_storage_get_host(storage)
-XBT_PUBLIC(sg_size_t) sg_storage_read(sg_storage_t storage, sg_size_t size);
-#define MSG_storage_read(storage, size) sg_storage_read(storage, size)
-XBT_PUBLIC(sg_size_t) sg_storage_write(sg_storage_t storage, sg_size_t size);
-#define MSG_storage_write(storage, size) sg_storage_write(storage, size)
-
-/************************** Host handling ***********************************/
-XBT_PUBLIC(void) MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto);
-
-XBT_ATTRIB_DEPRECATED_v320("Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() "
-                           "completely.") static inline double MSG_host_get_current_power_peak(msg_host_t host)
-{
-  return MSG_host_get_speed(host);
-}
+XBT_PUBLIC void MSG_set_function(const char* host_id, const char* function_name, xbt_dynar_t arguments);
 
-XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
-
-XBT_PUBLIC(void) MSG_create_environment(const char *file);
+XBT_PUBLIC double MSG_get_clock();
+XBT_PUBLIC unsigned long int MSG_get_sent_msg();
 
 /************************** Process handling *********************************/
-XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
-                                           xbt_main_func_t code,
-                                           void *data, msg_host_t host);
-XBT_PUBLIC(msg_process_t)
-MSG_process_create_with_arguments(const char* name, xbt_main_func_t code, void* data, msg_host_t host, int argc,
-                                  char** argv);
-XBT_PUBLIC(msg_process_t)
-MSG_process_create_with_environment(const char* name, xbt_main_func_t code, void* data, msg_host_t host, int argc,
-                                    char** argv, xbt_dict_t properties);
-
-XBT_PUBLIC(msg_process_t) MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties);
-XBT_PUBLIC(void) MSG_process_detach();
-
-XBT_PUBLIC(void) MSG_process_kill(msg_process_t process);
-XBT_PUBLIC(int) MSG_process_killall(int reset_PIDs);
-XBT_PUBLIC(msg_error_t) MSG_process_migrate(msg_process_t process, msg_host_t host);
-XBT_PUBLIC(void) MSG_process_yield();
-
-XBT_PUBLIC(void *) MSG_process_get_data(msg_process_t process);
-XBT_PUBLIC(msg_error_t) MSG_process_set_data(msg_process_t process,
-                                             void *data);
-XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
-XBT_PUBLIC(msg_host_t) MSG_process_get_host(msg_process_t process);
-XBT_PUBLIC(msg_process_t) MSG_process_from_PID(int PID);
-XBT_PUBLIC(int) MSG_process_get_PID(msg_process_t process);
-XBT_PUBLIC(int) MSG_process_get_PPID(msg_process_t process);
-XBT_PUBLIC(const char *) MSG_process_get_name(msg_process_t process);
-XBT_PUBLIC(int) MSG_process_self_PID();
-XBT_PUBLIC(int) MSG_process_self_PPID();
-XBT_PUBLIC(const char*) MSG_process_self_name();
-XBT_PUBLIC(msg_process_t) MSG_process_self();
-XBT_PUBLIC(xbt_dynar_t) MSG_processes_as_dynar();
-XBT_PUBLIC(int) MSG_process_get_number();
-
-XBT_PUBLIC(msg_error_t) MSG_process_set_kill_time(msg_process_t process, double kill_time);
+XBT_PUBLIC msg_process_t MSG_process_create(const char* name, xbt_main_func_t code, void* data, msg_host_t host);
+XBT_PUBLIC msg_process_t MSG_process_create_with_arguments(const char* name, xbt_main_func_t code, void* data,
+                                                           msg_host_t host, int argc, char** argv);
+XBT_PUBLIC msg_process_t MSG_process_create_with_environment(const char* name, xbt_main_func_t code, void* data,
+                                                             msg_host_t host, int argc, char** argv,
+                                                             xbt_dict_t properties);
 
-/*property handlers*/
-XBT_PUBLIC(xbt_dict_t) MSG_process_get_properties(msg_process_t process);
-XBT_PUBLIC(const char*) MSG_process_get_property_value(msg_process_t process, const char* name);
+XBT_PUBLIC msg_process_t MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties);
+XBT_PUBLIC void MSG_process_detach();
+
+XBT_PUBLIC int MSG_process_killall();
+XBT_PUBLIC void MSG_process_yield();
+
+XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
+XBT_PUBLIC msg_process_t MSG_process_from_PID(int PID);
+XBT_PUBLIC int MSG_process_self_PID();
+XBT_PUBLIC int MSG_process_self_PPID();
+XBT_PUBLIC const char* MSG_process_self_name();
+XBT_PUBLIC msg_process_t MSG_process_self();
+XBT_PUBLIC xbt_dynar_t MSG_processes_as_dynar();
+XBT_PUBLIC int MSG_process_get_number();
+
+XBT_PUBLIC void* MSG_process_get_data(msg_process_t process);
+XBT_PUBLIC msg_error_t MSG_process_set_data(msg_process_t process, void* data);
 
-XBT_PUBLIC(msg_error_t) MSG_process_suspend(msg_process_t process);
-XBT_PUBLIC(msg_error_t) MSG_process_resume(msg_process_t process);
-XBT_PUBLIC(int) MSG_process_is_suspended(msg_process_t process);
-XBT_PUBLIC(void) MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data);
-XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
+XBT_PUBLIC void MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void* data);
+XBT_PUBLIC void MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
 
-XBT_PUBLIC(void) MSG_process_daemonize(msg_process_t process);
-XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process);
-XBT_PUBLIC(void) MSG_process_ref(msg_process_t process);
-XBT_PUBLIC(void) MSG_process_unref(msg_process_t process);
+XBT_PUBLIC void MSG_process_ref(msg_process_t process);
+XBT_PUBLIC void MSG_process_unref(msg_process_t process);
 
 /************************** Task handling ************************************/
-XBT_PUBLIC(msg_task_t) MSG_task_create(const char* name, double flops_amount, double bytes_amount, void* data);
-XBT_PUBLIC(msg_task_t) MSG_parallel_task_create(const char *name,
-                                              int host_nb,
-                                              const msg_host_t * host_list,
-                                              double *flops_amount,
-                                              double *bytes_amount,
-                                              void *data);
-XBT_PUBLIC(void *) MSG_task_get_data(msg_task_t task);
-XBT_PUBLIC(void) MSG_task_set_data(msg_task_t task, void *data);
-XBT_PUBLIC(void) MSG_task_set_copy_callback(void (*callback) (
-    msg_task_t task, msg_process_t src, msg_process_t dst));
-XBT_PUBLIC(msg_process_t) MSG_task_get_sender(msg_task_t task);
-XBT_PUBLIC(msg_host_t) MSG_task_get_source(msg_task_t task);
-XBT_PUBLIC(const char *) MSG_task_get_name(msg_task_t task);
-XBT_PUBLIC(void) MSG_task_set_name(msg_task_t task, const char *name);
-XBT_PUBLIC(msg_error_t) MSG_task_cancel(msg_task_t task);
-XBT_PUBLIC(msg_error_t) MSG_task_destroy(msg_task_t task);
-
-XBT_PUBLIC(msg_error_t) MSG_task_execute(msg_task_t task);
-XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute(msg_task_t task);
-XBT_PUBLIC(msg_error_t) MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeout);
-XBT_PUBLIC(void) MSG_task_set_priority(msg_task_t task, double priority);
-XBT_PUBLIC(void) MSG_task_set_bound(msg_task_t task, double bound);
-
-XBT_PUBLIC(msg_error_t) MSG_process_join(msg_process_t process, double timeout);
-XBT_PUBLIC(msg_error_t) MSG_process_sleep(double nb_sec);
-
-XBT_PUBLIC(void) MSG_task_set_flops_amount(msg_task_t task, double flops_amount);
-XBT_PUBLIC(double) MSG_task_get_flops_amount(msg_task_t task);
-XBT_PUBLIC(double) MSG_task_get_remaining_work_ratio(msg_task_t task);
-XBT_PUBLIC(void) MSG_task_set_bytes_amount(msg_task_t task, double bytes_amount);
-
-
-XBT_PUBLIC(double) MSG_task_get_remaining_communication(msg_task_t task);
-XBT_PUBLIC(double) MSG_task_get_bytes_amount(msg_task_t task);
-
-XBT_PUBLIC(msg_error_t) MSG_task_receive_ext(msg_task_t* task, const char* alias, double timeout, msg_host_t host);
-
-XBT_PUBLIC(msg_error_t) MSG_task_receive_with_timeout(msg_task_t* task, const char* alias, double timeout);
-
-XBT_PUBLIC(msg_error_t) MSG_task_receive(msg_task_t* task, const char* alias);
+XBT_PUBLIC msg_task_t MSG_task_create(const char* name, double flops_amount, double bytes_amount, void* data);
+XBT_PUBLIC msg_task_t MSG_parallel_task_create(const char* name, int host_nb, const msg_host_t* host_list,
+                                               double* flops_amount, double* bytes_amount, void* data);
+XBT_PUBLIC void* MSG_task_get_data(msg_task_t task);
+XBT_PUBLIC void MSG_task_set_data(msg_task_t task, void* data);
+XBT_PUBLIC void MSG_task_set_copy_callback(void (*callback)(msg_task_t task, msg_process_t src, msg_process_t dst));
+XBT_PUBLIC msg_process_t MSG_task_get_sender(msg_task_t task);
+XBT_PUBLIC msg_host_t MSG_task_get_source(msg_task_t task);
+XBT_PUBLIC const char* MSG_task_get_name(msg_task_t task);
+XBT_PUBLIC void MSG_task_set_name(msg_task_t task, const char* name);
+XBT_PUBLIC msg_error_t MSG_task_cancel(msg_task_t task);
+XBT_PUBLIC msg_error_t MSG_task_destroy(msg_task_t task);
+
+XBT_PUBLIC msg_error_t MSG_task_execute(msg_task_t task);
+XBT_PUBLIC msg_error_t MSG_parallel_task_execute(msg_task_t task);
+XBT_PUBLIC msg_error_t MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeout);
+XBT_PUBLIC void MSG_task_set_priority(msg_task_t task, double priority);
+XBT_PUBLIC void MSG_task_set_bound(msg_task_t task, double bound);
+
+XBT_PUBLIC msg_error_t MSG_process_sleep(double nb_sec);
+
+XBT_PUBLIC void MSG_task_set_flops_amount(msg_task_t task, double flops_amount);
+XBT_PUBLIC double MSG_task_get_flops_amount(msg_task_t task);
+XBT_PUBLIC double MSG_task_get_remaining_work_ratio(msg_task_t task);
+XBT_PUBLIC void MSG_task_set_bytes_amount(msg_task_t task, double bytes_amount);
+
+XBT_PUBLIC double MSG_task_get_remaining_communication(msg_task_t task);
+XBT_PUBLIC double MSG_task_get_bytes_amount(msg_task_t task);
+
+XBT_PUBLIC msg_error_t MSG_task_receive_ext(msg_task_t* task, const char* alias, double timeout, msg_host_t host);
+
+XBT_PUBLIC msg_error_t MSG_task_receive_with_timeout(msg_task_t* task, const char* alias, double timeout);
+
+XBT_PUBLIC msg_error_t MSG_task_receive(msg_task_t* task, const char* alias);
 #define MSG_task_recv(t,a) MSG_task_receive(t,a)
 
-XBT_PUBLIC(msg_error_t)
-MSG_task_receive_ext_bounded(msg_task_t* task, const char* alias, double timeout, msg_host_t host, double rate);
+XBT_PUBLIC msg_error_t MSG_task_receive_ext_bounded(msg_task_t* task, const char* alias, double timeout,
+                                                    msg_host_t host, double rate);
 
-XBT_PUBLIC(msg_error_t)
-MSG_task_receive_with_timeout_bounded(msg_task_t* task, const char* alias, double timeout, double rate);
-XBT_PUBLIC(msg_error_t) MSG_task_receive_bounded(msg_task_t * task, const char *alias,double rate);
+XBT_PUBLIC msg_error_t MSG_task_receive_with_timeout_bounded(msg_task_t* task, const char* alias, double timeout,
+                                                             double rate);
+XBT_PUBLIC msg_error_t MSG_task_receive_bounded(msg_task_t* task, const char* alias, double rate);
 #define MSG_task_recv_bounded(t,a,r) MSG_task_receive_bounded(t,a,r)
 
-XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias);
-XBT_PUBLIC(msg_comm_t) MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate);
-XBT_ATTRIB_DEPRECATED_v320(
-    "This function will be removed from SimGrid v3.20. If you really need this function, please speak up quickly.")
-    XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task, const char* alias,
-                                                        int (*match_fun)(void*, void*, void*), void* match_data);
-
-XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup);
-XBT_PUBLIC(void) MSG_task_dsend_bounded(msg_task_t task, const char *alias, void_f_pvoid_t cleanup, double maxrate);
-XBT_PUBLIC(msg_comm_t) MSG_task_irecv(msg_task_t * task, const char *alias);
-XBT_PUBLIC(msg_comm_t) MSG_task_irecv_bounded(msg_task_t * task, const char *alias, double rate);
-XBT_PUBLIC(int) MSG_comm_test(msg_comm_t comm);
-XBT_PUBLIC(int) MSG_comm_testany(xbt_dynar_t comms);
-XBT_PUBLIC(void) MSG_comm_destroy(msg_comm_t comm);
-XBT_PUBLIC(msg_error_t) MSG_comm_wait(msg_comm_t comm, double timeout);
-XBT_PUBLIC(void) MSG_comm_waitall(msg_comm_t * comm, int nb_elem, double timeout);
-XBT_PUBLIC(int) MSG_comm_waitany(xbt_dynar_t comms);
-XBT_PUBLIC(msg_task_t) MSG_comm_get_task(msg_comm_t comm);
-XBT_PUBLIC(msg_error_t) MSG_comm_get_status(msg_comm_t comm);
-
-XBT_PUBLIC(int) MSG_task_listen(const char *alias);
-XBT_PUBLIC(msg_error_t) MSG_task_send_with_timeout(msg_task_t task, const char *alias, double timeout);
-XBT_PUBLIC(msg_error_t) MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alias, double timeout, double maxrate);
-XBT_PUBLIC(msg_error_t) MSG_task_send(msg_task_t task, const char *alias);
-XBT_PUBLIC(msg_error_t) MSG_task_send_bounded(msg_task_t task, const char *alias, double rate);
-XBT_PUBLIC(int) MSG_task_listen_from(const char *alias);
-XBT_PUBLIC(void) MSG_task_set_category (msg_task_t task, const char *category);
-XBT_PUBLIC(const char *) MSG_task_get_category (msg_task_t task);
+XBT_PUBLIC msg_comm_t MSG_task_isend(msg_task_t task, const char* alias);
+XBT_PUBLIC msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char* alias, double maxrate);
+
+XBT_PUBLIC void MSG_task_dsend(msg_task_t task, const char* alias, void_f_pvoid_t cleanup);
+XBT_PUBLIC void MSG_task_dsend_bounded(msg_task_t task, const char* alias, void_f_pvoid_t cleanup, double maxrate);
+XBT_PUBLIC msg_comm_t MSG_task_irecv(msg_task_t* task, const char* alias);
+XBT_PUBLIC msg_comm_t MSG_task_irecv_bounded(msg_task_t* task, const char* alias, double rate);
+XBT_PUBLIC int MSG_comm_test(msg_comm_t comm);
+XBT_PUBLIC int MSG_comm_testany(xbt_dynar_t comms);
+XBT_PUBLIC void MSG_comm_destroy(msg_comm_t comm);
+XBT_PUBLIC msg_error_t MSG_comm_wait(msg_comm_t comm, double timeout);
+XBT_PUBLIC void MSG_comm_waitall(msg_comm_t* comm, int nb_elem, double timeout);
+XBT_PUBLIC int MSG_comm_waitany(xbt_dynar_t comms);
+XBT_PUBLIC msg_task_t MSG_comm_get_task(msg_comm_t comm);
+XBT_PUBLIC msg_error_t MSG_comm_get_status(msg_comm_t comm);
+
+XBT_PUBLIC int MSG_task_listen(const char* alias);
+XBT_PUBLIC msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char* alias, double timeout);
+XBT_PUBLIC msg_error_t MSG_task_send_with_timeout_bounded(msg_task_t task, const char* alias, double timeout,
+                                                          double maxrate);
+XBT_PUBLIC msg_error_t MSG_task_send(msg_task_t task, const char* alias);
+XBT_PUBLIC msg_error_t MSG_task_send_bounded(msg_task_t task, const char* alias, double rate);
+XBT_PUBLIC int MSG_task_listen_from(const char* alias);
+XBT_PUBLIC void MSG_task_set_category(msg_task_t task, const char* category);
+XBT_PUBLIC const char* MSG_task_get_category(msg_task_t task);
 
 /************************** Mailbox handling ************************************/
 
@@ -347,12 +335,12 @@ XBT_PUBLIC(const char *) MSG_task_get_category (msg_task_t task);
  * This call should be done before issuing any receive, and on the receiver's side only
  * @param alias    The alias of the mailbox to modify.
  */
-XBT_PUBLIC(void) MSG_mailbox_set_async(const char *alias);
+XBT_PUBLIC void MSG_mailbox_set_async(const char* alias);
 
 /************************** Action handling **********************************/
-XBT_PUBLIC(msg_error_t) MSG_action_trace_run(char *path);
-XBT_PUBLIC(void) MSG_action_init();
-XBT_PUBLIC(void) MSG_action_exit();
+XBT_PUBLIC msg_error_t MSG_action_trace_run(char* path);
+XBT_PUBLIC void MSG_action_init();
+XBT_PUBLIC void MSG_action_exit();
 
 /** @brief Opaque type representing a semaphore
  *  @ingroup msg_synchro
@@ -360,13 +348,13 @@ XBT_PUBLIC(void) MSG_action_exit();
  */
 typedef struct s_smx_sem_t* msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be
                                        // declared here
-XBT_PUBLIC(msg_sem_t) MSG_sem_init(int initial_value);
-XBT_PUBLIC(void) MSG_sem_acquire(msg_sem_t sem);
-XBT_PUBLIC(msg_error_t) MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
-XBT_PUBLIC(void) MSG_sem_release(msg_sem_t sem);
-XBT_PUBLIC(int) MSG_sem_get_capacity(msg_sem_t sem);
-XBT_PUBLIC(void) MSG_sem_destroy(msg_sem_t sem);
-XBT_PUBLIC(int) MSG_sem_would_block(msg_sem_t sem);
+XBT_PUBLIC msg_sem_t MSG_sem_init(int initial_value);
+XBT_PUBLIC void MSG_sem_acquire(msg_sem_t sem);
+XBT_PUBLIC msg_error_t MSG_sem_acquire_timeout(msg_sem_t sem, double timeout);
+XBT_PUBLIC void MSG_sem_release(msg_sem_t sem);
+XBT_PUBLIC int MSG_sem_get_capacity(msg_sem_t sem);
+XBT_PUBLIC void MSG_sem_destroy(msg_sem_t sem);
+XBT_PUBLIC int MSG_sem_would_block(msg_sem_t sem);
 
 /** @brief Opaque type representing a barrier identifier
  *  @ingroup msg_synchro
@@ -375,69 +363,22 @@ XBT_PUBLIC(int) MSG_sem_would_block(msg_sem_t sem);
 
 #define MSG_BARRIER_SERIAL_PROCESS -1
 typedef struct s_msg_bar_t* msg_bar_t;
-XBT_PUBLIC(msg_bar_t) MSG_barrier_init( unsigned int count);
-XBT_PUBLIC(void) MSG_barrier_destroy(msg_bar_t bar);
-XBT_PUBLIC(int) MSG_barrier_wait(msg_bar_t bar);
-
-/** @brief Opaque type describing a Virtual Machine.
- *  @ingroup msg_VMs
- *
- * All this is highly experimental and the interface will probably change in the future.
- * Please don't depend on this yet (although testing is welcomed if you feel so).
- * Usual lack of guaranty of any kind applies here, and is even increased.
- *
- */
-
-XBT_PUBLIC(int) sg_vm_is_created(sg_vm_t vm);
-#define MSG_vm_is_created(vm) sg_vm_is_created(vm)
-XBT_PUBLIC(int) sg_vm_is_running(sg_vm_t vm);
-#define MSG_vm_is_running(vm) sg_vm_is_running(vm)
-XBT_PUBLIC(int) sg_vm_is_suspended(sg_vm_t vm);
-#define MSG_vm_is_suspended(vm) sg_vm_is_suspended(vm)
-
-XBT_PUBLIC(const char*) sg_vm_get_name(sg_vm_t vm);
-#define MSG_vm_get_name(vm) sg_vm_get_name(vm)
-XBT_PUBLIC(void) sg_vm_set_ramsize(sg_vm_t vm, size_t size);
-#define MSG_vm_set_ramsize(vm, size) sg_vm_set_ramsize(vm, size)
-XBT_PUBLIC(size_t) sg_vm_get_ramsize(sg_vm_t vm);
-#define MSG_vm_get_ramsize(vm) sg_vm_get_ramsize(vm)
-
-XBT_PUBLIC(sg_vm_t) sg_vm_create_core(sg_host_t pm, const char* name);
-#define MSG_vm_create_core(vm, name) sg_vm_create_core(vm, name)
-XBT_PUBLIC(sg_vm_t) sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount);
-#define MSG_vm_create_multicore(vm, name, coreAmount) sg_vm_create_multicore(vm, name, coreAmount)
-
-XBT_ATTRIB_DEPRECATED_v322("Use sg_vm_create_migratable() from the live migration plugin: "
-                           "v3.22 will drop MSG_vm_create() completely.") XBT_PUBLIC(msg_vm_t)
-    MSG_vm_create(msg_host_t ind_pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity);
-
-XBT_PUBLIC(void) sg_vm_start(msg_vm_t vm);
-#define MSG_vm_start(vm) sg_vm_start(vm)
-XBT_PUBLIC(void) sg_vm_suspend(msg_vm_t vm);
-#define MSG_vm_suspend(vm) sg_vm_suspend(vm)
-XBT_PUBLIC(void) sg_vm_resume(msg_vm_t vm);
-#define MSG_vm_resume(vm) sg_vm_resume(vm)
-XBT_PUBLIC(void) sg_vm_shutdown(msg_vm_t vm);
-#define MSG_vm_shutdown(vm) sg_vm_shutdown(vm)
-XBT_PUBLIC(void) sg_vm_destroy(msg_vm_t vm);
-#define MSG_vm_destroy(vm) sg_vm_destroy(vm)
-XBT_PUBLIC(sg_host_t) sg_vm_get_pm(sg_vm_t vm);
-#define MSG_vm_get_pm(vm) sg_vm_get_pm(vm)
-XBT_PUBLIC(void) sg_vm_set_bound(sg_vm_t vm, double bound);
-#define MSG_vm_set_bound(vm, bound) sg_vm_set_bound(vm, bound)
-
-#include "simgrid/instr.h"
+XBT_PUBLIC msg_bar_t MSG_barrier_init(unsigned int count);
+XBT_PUBLIC void MSG_barrier_destroy(msg_bar_t bar);
+XBT_PUBLIC int MSG_barrier_wait(msg_bar_t bar);
 
 /* ****************************************************************************************** */
-/* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
-XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process);
+/* DO NOT USE this nasty pimple (unless if you're writing a binding) */
+XBT_PUBLIC smx_context_t
+XBT_ATTRIB_DEPRECATED_v323("MSG_process_get_smx_ctx is deprecated. Please contact us if you need it.")
+MSG_process_get_smx_ctx(msg_process_t process);
 
 SG_END_DECL()
 
 #ifdef __cplusplus
-XBT_PUBLIC(msg_process_t)
-MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
-                                std::map<std::string, std::string>* properties);
+XBT_PUBLIC msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data,
+                                                         msg_host_t host,
+                                                         std::map<std::string, std::string>* properties);
 #endif
 
 #endif
index 57726ed..bd856b9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team.
+/* Copyright (c) 2017-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -12,7 +12,7 @@
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(void) sg_host_dvfs_plugin_init();
+XBT_PUBLIC void sg_host_dvfs_plugin_init();
 
 #define MSG_host_dvfs_plugin_init() sg_host_dvfs_plugin_init()
 
index 285345b..3cfe6e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2018. 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. */
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(void) sg_host_energy_plugin_init();
-XBT_PUBLIC(void) sg_host_energy_update_all();
-XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host);
-XBT_PUBLIC(double) sg_host_get_wattmin_at(sg_host_t host, int pstate);
-XBT_PUBLIC(double) sg_host_get_wattmax_at(sg_host_t host, int pstate);
-XBT_PUBLIC(double) sg_host_get_current_consumption(sg_host_t host);
+XBT_PUBLIC void sg_host_energy_plugin_init();
+XBT_PUBLIC void sg_host_energy_update_all();
+XBT_PUBLIC double sg_host_get_consumed_energy(sg_host_t host);
+XBT_PUBLIC double sg_host_get_wattmin_at(sg_host_t host, int pstate);
+XBT_PUBLIC double sg_host_get_wattmax_at(sg_host_t host, int pstate);
+XBT_PUBLIC double sg_host_get_current_consumption(sg_host_t host);
 
-XBT_PUBLIC(void) sg_link_energy_plugin_init();
-XBT_PUBLIC(double) sg_link_get_consumed_energy(sg_link_t link);
+XBT_PUBLIC void sg_link_energy_plugin_init();
+XBT_PUBLIC double sg_link_get_consumed_energy(sg_link_t link);
 
-XBT_PUBLIC(int) sg_link_energy_is_inited();
+XBT_PUBLIC int sg_link_energy_is_inited();
 
 #define MSG_host_energy_plugin_init() sg_host_energy_plugin_init()
 #define MSG_host_get_consumed_energy(host) sg_host_get_consumed_energy(host)
index 41363fd..3b0de47 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2017-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2017-2018. 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. */
@@ -9,33 +8,36 @@
 
 #include <simgrid/forward.h>
 #include <xbt/base.h>
+#include <xbt/dict.h>
+
+// C interface
+////////////////
 
 SG_BEGIN_DECL()
+XBT_PUBLIC void sg_storage_file_system_init();
+XBT_PUBLIC sg_file_t sg_file_open(const char* fullpath, void* data);
+XBT_PUBLIC sg_size_t sg_file_read(sg_file_t fd, sg_size_t size);
+XBT_PUBLIC sg_size_t sg_file_write(sg_file_t fd, sg_size_t size);
+XBT_PUBLIC void sg_file_close(sg_file_t fd);
+
+XBT_PUBLIC const char* sg_file_get_name(sg_file_t fd);
+XBT_PUBLIC sg_size_t sg_file_get_size(sg_file_t fd);
+XBT_PUBLIC void sg_file_dump(sg_file_t fd);
+XBT_PUBLIC void* sg_file_get_data(sg_file_t fd);
+XBT_PUBLIC void sg_file_set_data(sg_file_t fd, void* data);
+XBT_PUBLIC void sg_file_seek(sg_file_t fd, sg_offset_t offset, int origin);
+XBT_PUBLIC sg_size_t sg_file_tell(sg_file_t fd);
+XBT_PUBLIC void sg_file_move(sg_file_t fd, const char* fullpath);
+XBT_PUBLIC void sg_file_unlink(sg_file_t fd);
+XBT_PUBLIC int sg_file_rcopy(sg_file_t file, sg_host_t host, const char* fullpath);
+XBT_PUBLIC int sg_file_rmove(sg_file_t file, sg_host_t host, const char* fullpath);
+
+XBT_PUBLIC sg_size_t sg_storage_get_size_free(sg_storage_t st);
+XBT_PUBLIC sg_size_t sg_storage_get_size_used(sg_storage_t st);
+XBT_PUBLIC sg_size_t sg_storage_get_size(sg_storage_t st);
+XBT_PUBLIC xbt_dict_t sg_storage_get_content(sg_storage_t storage);
 
-XBT_PUBLIC(void) sg_storage_file_system_init();
-XBT_PUBLIC(sg_file_t) sg_file_open(const char* fullpath, void* data);
-XBT_PUBLIC(sg_size_t) sg_file_read(sg_file_t fd, sg_size_t size);
-XBT_PUBLIC(sg_size_t) sg_file_write(sg_file_t fd, sg_size_t size);
-XBT_PUBLIC(void) sg_file_close(sg_file_t fd);
-
-XBT_PUBLIC(const char*) sg_file_get_name(sg_file_t fd);
-XBT_PUBLIC(sg_size_t) sg_file_get_size(sg_file_t fd);
-XBT_PUBLIC(void) sg_file_dump(sg_file_t fd);
-XBT_PUBLIC(void*) sg_file_get_data(sg_file_t fd);
-XBT_PUBLIC(void) sg_file_set_data(sg_file_t fd, void* data);
-XBT_PUBLIC(void) sg_file_seek(sg_file_t fd, sg_offset_t offset, int origin);
-XBT_PUBLIC(sg_size_t) sg_file_tell(sg_file_t fd);
-XBT_PUBLIC(void) sg_file_move(sg_file_t fd, const char* fullpath);
-XBT_PUBLIC(void) sg_file_unlink(sg_file_t fd);
-XBT_PUBLIC(int) sg_file_rcopy(sg_file_t file, sg_host_t host, const char* fullpath);
-XBT_PUBLIC(int) sg_file_rmove(sg_file_t file, sg_host_t host, const char* fullpath);
-
-XBT_PUBLIC(sg_size_t) sg_storage_get_size_free(sg_storage_t st);
-XBT_PUBLIC(sg_size_t) sg_storage_get_size_used(sg_storage_t st);
-XBT_PUBLIC(sg_size_t) sg_storage_get_size(sg_storage_t st);
-XBT_PUBLIC(xbt_dict_t) sg_storage_get_content(sg_storage_t storage);
-
-XBT_PUBLIC(xbt_dict_t) sg_host_get_storage_content(sg_host_t host);
+XBT_PUBLIC xbt_dict_t sg_host_get_storage_content(sg_host_t host);
 
 #define MSG_file_open(fullpath, data) sg_file_open(fullpath, data)
 #define MSG_file_read(fd, size) sg_file_read(fd, size)
@@ -63,4 +65,97 @@ XBT_PUBLIC(xbt_dict_t) sg_host_get_storage_content(sg_host_t host);
 
 SG_END_DECL()
 
+// C++ interface
+//////////////////
+
+#ifdef __cplusplus
+#include <xbt/Extendable.hpp>
+
+#include <map>
+#include <string>
+
+namespace simgrid {
+namespace s4u {
+
+/** @brief A simulated file
+ *
+ * Used to simulate the time it takes to access to a file, but does not really store any information.
+ *
+ * They are located on @ref simgrid::s4u::Storage that are accessed from a given @ref simgrid::s4u::Host through
+ * mountpoints.
+ * For now, you cannot change the mountpoints programatically, and must declare them from your platform file.
+ */
+class XBT_PUBLIC File {
+public:
+  File(std::string fullpath, void* userdata);
+  File(std::string fullpath, sg_host_t host, void* userdata);
+  ~File();
+
+  /** Retrieves the path to the file */
+  const char* getPath() { return fullpath_.c_str(); }
+
+  /** Simulates a local read action. Returns the size of data actually read */
+  sg_size_t read(sg_size_t size);
+
+  /** Simulates a write action. Returns the size of data actually written. */
+  sg_size_t write(sg_size_t size);
+
+  /** Allows to store user data on that host */
+  void setUserdata(void* data) { userdata_ = data; }
+  /** Retrieves the previously stored data */
+  void* getUserdata() { return userdata_; }
+
+  sg_size_t size();
+  void seek(sg_offset_t pos);             /** Sets the file head to the given position. */
+  void seek(sg_offset_t pos, int origin); /** Sets the file head to the given position from a given origin. */
+  sg_size_t tell();                       /** Retrieves the current file position */
+
+  /** Rename a file. WARNING: It is forbidden to move the file to another mount point */
+  void move(std::string fullpath);
+  int remoteCopy(sg_host_t host, const char* fullpath);
+  int remoteMove(sg_host_t host, const char* fullpath);
+
+  int unlink(); /** Remove a file from the contents of a disk */
+  void dump();
+
+  int desc_id = 0;
+  Storage* localStorage;
+  std::string mount_point_;
+
+private:
+  sg_size_t size_;
+  std::string path_;
+  std::string fullpath_;
+  sg_size_t current_position_ = SEEK_SET;
+  void* userdata_             = nullptr;
+};
+
+class XBT_PUBLIC FileSystemStorageExt {
+public:
+  static simgrid::xbt::Extension<Storage, FileSystemStorageExt> EXTENSION_ID;
+  explicit FileSystemStorageExt(Storage* ptr);
+  ~FileSystemStorageExt();
+  std::map<std::string, sg_size_t>* parseContent(std::string filename);
+  std::map<std::string, sg_size_t>* getContent() { return content_; }
+  sg_size_t getSize() { return size_; }
+  sg_size_t getUsedSize() { return usedSize_; }
+  void decrUsedSize(sg_size_t size) { usedSize_ -= size; }
+  void incrUsedSize(sg_size_t size) { usedSize_ += size; }
+
+private:
+  std::map<std::string, sg_size_t>* content_;
+  sg_size_t usedSize_ = 0;
+  sg_size_t size_     = 0;
+};
+
+class XBT_PUBLIC FileDescriptorHostExt {
+public:
+  static simgrid::xbt::Extension<Host, FileDescriptorHostExt> EXTENSION_ID;
+  FileDescriptorHostExt() = default;
+  ~FileDescriptorHostExt() { delete file_descriptor_table; }
+  std::vector<int>* file_descriptor_table = nullptr; // Created lazily on need
+};
+} // namespace s4u
+} // namespace simgrid
+#endif
 #endif
index 3a5107a..bfdf1f8 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2017-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2017-2018. 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. */
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(void) sg_vm_live_migration_plugin_init();
+XBT_PUBLIC void sg_vm_live_migration_plugin_init();
 XBT_PRIVATE void sg_vm_dirty_page_tracking_init();
-XBT_PUBLIC(void) sg_vm_start_dirty_page_tracking(sg_vm_t vm);
-XBT_PUBLIC(void) sg_vm_stop_dirty_page_tracking(sg_vm_t vm);
-XBT_PUBLIC(double) sg_vm_lookup_computed_flops(sg_vm_t vm);
-XBT_PUBLIC(void) sg_vm_migrate(sg_vm_t vm, sg_host_t dst_pm);
-XBT_PUBLIC(void) sg_vm_set_dirty_page_intensity(sg_vm_t vm, double intensity);
-XBT_PUBLIC(double) sg_vm_get_dirty_page_intensity(sg_vm_t vm);
-XBT_PUBLIC(void) sg_vm_set_working_set_memory(sg_vm_t vm, sg_size_t size);
-XBT_PUBLIC(sg_size_t) sg_vm_get_working_set_memory(sg_vm_t vm);
-XBT_PUBLIC(void) sg_vm_set_migration_speed(sg_vm_t vm, double speed);
-XBT_PUBLIC(double) sg_vm_get_migration_speed(sg_vm_t vm);
-XBT_PUBLIC(double) sg_vm_get_max_downtime(sg_vm_t vm);
-XBT_PUBLIC(int) sg_vm_is_migrating(sg_vm_t vm);
-XBT_PUBLIC(sg_vm_t)
-sg_vm_create_migratable(sg_host_t pm, const char* name, int coreAmount, int ramsize, int mig_netspeed,
-                        int dp_intensity);
+XBT_PUBLIC void sg_vm_start_dirty_page_tracking(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_stop_dirty_page_tracking(sg_vm_t vm);
+XBT_PUBLIC double sg_vm_lookup_computed_flops(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_migrate(sg_vm_t vm, sg_host_t dst_pm);
+XBT_PUBLIC void sg_vm_set_dirty_page_intensity(sg_vm_t vm, double intensity);
+XBT_PUBLIC double sg_vm_get_dirty_page_intensity(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_working_set_memory(sg_vm_t vm, sg_size_t size);
+XBT_PUBLIC sg_size_t sg_vm_get_working_set_memory(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_migration_speed(sg_vm_t vm, double speed);
+XBT_PUBLIC double sg_vm_get_migration_speed(sg_vm_t vm);
+XBT_PUBLIC double sg_vm_get_max_downtime(sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_migrating(sg_vm_t vm);
+XBT_PUBLIC sg_vm_t sg_vm_create_migratable(sg_host_t pm, const char* name, int coreAmount, int ramsize,
+                                           int mig_netspeed, int dp_intensity);
 
 #define MSG_vm_live_migration_plugin_init() sg_vm_live_migration_plugin_init()
 
index 5b7f903..734752a 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2017-2018. 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. */
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(void) sg_host_load_plugin_init();
-XBT_PUBLIC(double) sg_host_get_current_load(sg_host_t host);
-XBT_PUBLIC(double) sg_host_get_avg_load(sg_host_t host);
-XBT_PUBLIC(double) sg_host_get_idle_time(sg_host_t host);
-XBT_PUBLIC(double) sg_host_get_computed_flops(sg_host_t host);
-XBT_PUBLIC(void) sg_host_load_reset(sg_host_t host);
+XBT_PUBLIC void sg_host_load_plugin_init();
+XBT_PUBLIC double sg_host_get_current_load(sg_host_t host);
+XBT_PUBLIC double sg_host_get_avg_load(sg_host_t host);
+XBT_PUBLIC double sg_host_get_idle_time(sg_host_t host);
+XBT_PUBLIC double sg_host_get_computed_flops(sg_host_t host);
+XBT_PUBLIC void sg_host_load_reset(sg_host_t host);
 
 #define MSG_host_load_plugin_init() sg_host_load_plugin_init()
 #define MSG_host_get_current_load(host) sg_host_get_current_load(host)
index 5e801f4..c508d9d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -18,13 +18,13 @@ namespace s4u {
  *
  * This class is the ancestor of every activities that an actor can undertake, that is, of the actions that do take time in the simulated world.
  */
-XBT_PUBLIC_CLASS Activity {
+class XBT_PUBLIC Activity {
   friend Comm;
-  friend XBT_PUBLIC(void) intrusive_ptr_release(Comm * c);
-  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(Comm * c);
+  friend XBT_PUBLIC void intrusive_ptr_release(Comm * c);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm * c);
   friend Exec;
-  friend XBT_PUBLIC(void) intrusive_ptr_release(Exec * e);
-  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(Exec * e);
+  friend XBT_PUBLIC void intrusive_ptr_release(Exec * e);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(Exec * e);
 
 protected:
   Activity()  = default;
@@ -61,17 +61,17 @@ public:
   /** Put some user data onto the Activity */
   Activity* setUserData(void* data)
   {
-    userData_ = data;
+    user_data_ = data;
     return this;
   }
   /** Retrieve the user data of the Activity */
-  void *getUserData() { return userData_; }
+  void* getUserData() { return user_data_; }
 
 private:
   simgrid::kernel::activity::ActivityImplPtr pimpl_ = nullptr;
   e_s4u_activity_state_t state_ = inited;
   double remains_ = 0;
-  void *userData_ = nullptr;
+  void* user_data_                                  = nullptr;
 }; // class
 
 }}; // Namespace simgrid::s4u
index 2a77e8e..e1b47f3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -51,7 +51,7 @@ namespace s4u {
  * pure function or as an object. It is very simple with functions:
  *
  * @code{.cpp}
- * #include "s4u/actor.hpp"
+ * #include <simgrid/s4u/actor.hpp>
  *
  * // Declare the code of your worker
  * void worker() {
@@ -69,7 +69,7 @@ namespace s4u {
  * The syntax is slightly more complicated, but not much.
  *
  * @code{.cpp}
- * #include "s4u/actor.hpp"
+ * #include <simgrid/s4u/actor.hpp>
  *
  * // Declare the class representing your actors
  * class Worker {
@@ -129,13 +129,12 @@ namespace s4u {
  */
 
 /** @brief Simulation Agent */
-XBT_PUBLIC_CLASS Actor : public simgrid::xbt::Extendable<Actor>
-{
+class XBT_PUBLIC Actor : public simgrid::xbt::Extendable<Actor> {
   friend Exec;
   friend Mailbox;
-  friend simgrid::simix::ActorImpl;
+  friend simgrid::kernel::actor::ActorImpl;
   friend simgrid::kernel::activity::MailboxImpl;
-  simix::ActorImpl* pimpl_ = nullptr;
+  kernel::actor::ActorImpl* pimpl_ = nullptr;
 
   /** Wrap a (possibly non-copyable) single-use task into a `std::function` */
   template<class F, class... Args>
@@ -156,8 +155,8 @@ public:
   Actor& operator=(Actor const&) = delete;
 
   // ***** Reference count *****
-  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(Actor * actor);
-  friend XBT_PUBLIC(void) intrusive_ptr_release(Actor * actor);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(Actor * actor);
+  friend XBT_PUBLIC void intrusive_ptr_release(Actor * actor);
 
   // ***** Actor creation *****
   /** Retrieve a reference to myself */
@@ -215,11 +214,11 @@ public:
   s4u::Host* getHost();
   /** Retrieves the PID of that actor
    *
-   * actor_id_t is an alias for unsigned long */
+   * aid_t is an alias for long */
   aid_t getPid();
   /** Retrieves the PPID of that actor
    *
-   * actor_id_t is an alias for unsigned long */
+   * aid_t is an alias for long */
   aid_t getPpid();
 
   /** Suspend an actor by suspending the task on which it was waiting for the completion. */
@@ -277,7 +276,7 @@ public:
   static void killAll(int resetPid);
 
   /** Returns the internal implementation of this actor */
-  simix::ActorImpl* getImpl();
+  kernel::actor::ActorImpl* getImpl();
 
   /** Retrieve the property value (or nullptr if not set) */
   std::map<std::string, std::string>* getProperties();
@@ -290,11 +289,11 @@ public:
  *  @brief Static methods working on the current actor (see @ref s4u::Actor) */
 namespace this_actor {
 
-XBT_PUBLIC(bool) isMaestro();
+XBT_PUBLIC bool isMaestro();
 
 /** Block the actor sleeping for that amount of seconds (may throws hostFailure) */
-XBT_PUBLIC(void) sleep_for(double duration);
-XBT_PUBLIC(void) sleep_until(double timeout);
+XBT_PUBLIC void sleep_for(double duration);
+XBT_PUBLIC void sleep_until(double timeout);
 
 template <class Rep, class Period> inline void sleep_for(std::chrono::duration<Rep, Period> duration)
 {
@@ -308,83 +307,54 @@ template <class Duration> inline void sleep_until(const SimulationTimePoint<Dura
   this_actor::sleep_until(timeout_native.time_since_epoch().count());
 }
 
-XBT_ATTRIB_DEPRECATED_v320("Use sleep_for(): v3.20 will turn this warning into an error.") inline void sleep(
-    double duration)
-{
-  return sleep_for(duration);
-}
-
 /** Block the actor, computing the given amount of flops */
-XBT_PUBLIC(void) execute(double flop);
+XBT_PUBLIC void execute(double flop);
 
 /** Block the actor, computing the given amount of flops at the given priority.
  *  An execution of priority 2 computes twice as fast as an execution at priority 1. */
-XBT_PUBLIC(void) execute(double flop, double priority);
-
-XBT_PUBLIC(void) parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount);
-XBT_PUBLIC(void)
-parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double timeout);
+XBT_PUBLIC void execute(double flop, double priority);
 
-XBT_PUBLIC(ExecPtr) exec_init(double flops_amounts);
-XBT_PUBLIC(ExecPtr) exec_async(double flops_amounts);
-
-/** Block the actor until it gets a message from the given mailbox.
- *
- * See \ref Comm for the full communication API (including non blocking communications).
- */
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will turn this warning into an error.") XBT_PUBLIC(void*)
-    recv(MailboxPtr chan);
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will turn this warning into an error.") XBT_PUBLIC(void*)
-    recv(MailboxPtr chan, double timeout);
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::recv_async(): v3.20 will turn this warning into an error.") XBT_PUBLIC(CommPtr)
-    irecv(MailboxPtr chan, void** data);
-
-/** Block the actor until it delivers a message of the given simulated size to the given mailbox
- *
- * See \ref Comm for the full communication API (including non blocking communications).
-*/
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will turn this warning into an error.") XBT_PUBLIC(void)
-    send(MailboxPtr chan, void* payload, double simulatedSize);
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will turn this warning into an error.") XBT_PUBLIC(void)
-    send(MailboxPtr chan, void* payload, double simulatedSize, double timeout);
+XBT_PUBLIC void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount);
+XBT_PUBLIC void parallel_execute(int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount,
+                                 double timeout);
 
-XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will turn this warning into an error.") XBT_PUBLIC(CommPtr)
-    isend(MailboxPtr chan, void* payload, double simulatedSize);
+XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
+XBT_PUBLIC ExecPtr exec_async(double flops_amounts);
 
 /** @brief Returns the actor ID of the current actor). */
-XBT_PUBLIC(aid_t) getPid();
+XBT_PUBLIC aid_t getPid();
 
 /** @brief Returns the ancestor's actor ID of the current actor. */
-XBT_PUBLIC(aid_t) getPpid();
+XBT_PUBLIC aid_t getPpid();
 
 /** @brief Returns the name of the current actor. */
-XBT_PUBLIC(std::string) getName();
+XBT_PUBLIC std::string getName();
 
 /** @brief Returns the name of the current actor as a C string. */
-XBT_PUBLIC(const char*) getCname();
+XBT_PUBLIC const char* getCname();
 
 /** @brief Returns the name of the host on which the actor is running. */
-XBT_PUBLIC(Host*) getHost();
+XBT_PUBLIC Host* getHost();
 
 /** @brief Suspend the actor. */
-XBT_PUBLIC(void) suspend();
+XBT_PUBLIC void suspend();
 
 /** @brief yield the actor. */
-XBT_PUBLIC(void) yield();
+XBT_PUBLIC void yield();
 
 /** @brief Resume the actor. */
-XBT_PUBLIC(void) resume();
+XBT_PUBLIC void resume();
 
-XBT_PUBLIC(bool) isSuspended();
+XBT_PUBLIC bool isSuspended();
 
 /** @brief kill the actor. */
-XBT_PUBLIC(void) kill();
+XBT_PUBLIC void kill();
 
 /** @brief Add a function to the list of "on_exit" functions. */
-XBT_PUBLIC(void) onExit(int_f_pvoid_pvoid_t fun, void* data);
+XBT_PUBLIC void onExit(int_f_pvoid_pvoid_t fun, void* data);
 
 /** @brief Migrate the actor to a new host. */
-XBT_PUBLIC(void) migrate(Host* new_host);
+XBT_PUBLIC void migrate(Host* new_host);
 }
 
 /** @} */
index 7c615fe..077718b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -6,13 +6,16 @@
 #ifndef SIMGRID_S4U_COMM_HPP
 #define SIMGRID_S4U_COMM_HPP
 
+#include <xbt/asserts.h>
 #include <xbt/base.h>
+#include <xbt/dynar.h>
 
 #include <simgrid/forward.h>
 #include <simgrid/s4u/Activity.hpp>
-#include <simgrid/s4u/Mailbox.hpp> // DEPRECATED 3.20
 #include <simgrid/s4u/forward.hpp>
+#include <simgrid/simix.h>
 
+#include <atomic>
 #include <vector>
 
 namespace simgrid {
@@ -21,12 +24,11 @@ namespace s4u {
  *
  * Represents all asynchronous communications, that you can test or wait onto.
  */
-XBT_PUBLIC_CLASS Comm : public Activity
-{
+class XBT_PUBLIC Comm : public Activity {
   Comm() : Activity() {}
 public:
-  friend XBT_PUBLIC(void) intrusive_ptr_release(simgrid::s4u::Comm* c);
-  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(simgrid::s4u::Comm* c);
+  friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Comm * c);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Comm * c);
   friend Mailbox; // Factory of comms
 
   virtual ~Comm();
@@ -67,37 +69,6 @@ public:
   /*! take a vector s4u::CommPtr and return the rank of the first finished one (or -1 if none is done). */
   static int test_any(std::vector<CommPtr> * comms);
 
-  /** Creates (but don't start) an async send to the mailbox @p dest */
-  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will turn this warning into an error.") static CommPtr
-  send_init(MailboxPtr dest)
-  {
-    return dest->put_init();
-  }
-  /** Creates (but don't start) an async send to the mailbox @p dest */
-  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will turn this warning into an error.") static CommPtr
-  send_init(MailboxPtr dest, void* data, int simulatedByteAmount)
-  {
-    return dest->put_init(data, simulatedByteAmount);
-  }
-  /** Creates and start an async send to the mailbox @p dest */
-  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will turn this warning into an error.") static CommPtr
-  send_async(MailboxPtr dest, void* data, int simulatedByteAmount)
-  {
-    return dest->put_async(data, simulatedByteAmount);
-  }
-  /** Creates (but don't start) an async recv onto the mailbox @p from */
-  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get_init(): v3.20 will turn this warning into an error.") static CommPtr
-  recv_init(MailboxPtr from)
-  {
-    return from->get_init();
-  }
-  /** Creates and start an async recv to the mailbox @p from */
-  XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get_async(): v3.20 will turn this warning into an error.") static CommPtr
-  recv_async(MailboxPtr from, void** data)
-  {
-    return from->get_async(data);
-  }
-
   Activity* start() override;
   Activity* wait() override;
   Activity* wait(double timeout) override;
index 85f4c47..1bd6e11 100644 (file)
@@ -30,8 +30,7 @@ namespace s4u {
  *  semantic. But we currently use (only) double for both durations and
  *  timestamp timeouts.
  */
-XBT_PUBLIC_CLASS ConditionVariable
-{
+class XBT_PUBLIC ConditionVariable {
 private:
   friend s_smx_cond_t;
   smx_cond_t cond_;
@@ -40,8 +39,8 @@ public:
   ConditionVariable(ConditionVariable const&) = delete;
   ConditionVariable& operator=(ConditionVariable const&) = delete;
 
-  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(ConditionVariable * cond);
-  friend XBT_PUBLIC(void) intrusive_ptr_release(ConditionVariable * cond);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(ConditionVariable * cond);
+  friend XBT_PUBLIC void intrusive_ptr_release(ConditionVariable * cond);
   using Ptr = boost::intrusive_ptr<ConditionVariable>;
 
   static Ptr createConditionVariable();
index cd42aec..636f678 100644 (file)
@@ -24,8 +24,7 @@ namespace s4u {
  *
  * This class is an interface to the simulation engine.
  */
-XBT_PUBLIC_CLASS Engine
-{
+class XBT_PUBLIC Engine {
 public:
   /** Constructor, taking the command line parameters of your main function */
   Engine(int* argc, char** argv);
@@ -47,7 +46,7 @@ public:
   /** Registers a function as the default main function of actors
    *
    * It will be used as fallback when the function requested from the deployment file was not registered.
-   * It is used for trace-based simulations (see examples/msg/actions).
+   * It is used for trace-based simulations (see examples/s4u/replay-comms and similar).
    */
   void registerDefault(int (*code)(int, char**));
 
@@ -56,12 +55,17 @@ public:
 
 protected:
   friend s4u::Host;
+  friend s4u::Storage;
   void addHost(std::string name, simgrid::s4u::Host * host);
   void delHost(std::string name);
+  void addStorage(std::string name, simgrid::s4u::Storage * storage);
+  void delStorage(std::string name);
 
 public:
   simgrid::s4u::Host* hostByName(std::string name);
   simgrid::s4u::Host* hostByNameOrNull(std::string name);
+  simgrid::s4u::Storage* storageByName(std::string name);
+  simgrid::s4u::Storage* storageByNameOrNull(std::string name);
 
   size_t getHostCount();
   void getHostList(std::vector<Host*> * whereTo);
@@ -71,6 +75,8 @@ public:
   void getLinkList(std::vector<Link*> * list);
   std::vector<Link*> getAllLinks();
 
+  std::vector<Storage*> getAllStorages();
+
   /** @brief Run the simulation */
   void run();
 
@@ -131,16 +137,16 @@ private:
 
 /** Callback fired when the platform is created (ie, the xml file parsed),
  * right before the actual simulation starts. */
-extern XBT_PUBLIC(xbt::signal<void()>) onPlatformCreated;
+extern XBT_PUBLIC xbt::signal<void()> onPlatformCreated;
 
-/** Callback fired when the main simulation loop ends, just before MSG_run (or similar) ends */
-extern XBT_PUBLIC(xbt::signal<void()>) onSimulationEnd;
+/** Callback fired when the main simulation loop ends, just before the end of Engine::run() */
+extern XBT_PUBLIC xbt::signal<void()> onSimulationEnd;
 
 /** Callback fired when the time jumps into the future */
-extern XBT_PUBLIC(xbt::signal<void(double)>) onTimeAdvance;
+extern XBT_PUBLIC xbt::signal<void(double)> onTimeAdvance;
 
 /** Callback fired when the time cannot jump because of inter-actors deadlock */
-extern XBT_PUBLIC(xbt::signal<void(void)>) onDeadlock;
+extern XBT_PUBLIC xbt::signal<void(void)> onDeadlock;
 
 template <class T> XBT_PRIVATE void netzoneByTypeRecursive(s4u::NetZone* current, std::vector<T*>* whereto)
 {
index 650ea7f..43a0031 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017-2018. 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. */
 namespace simgrid {
 namespace s4u {
 
-XBT_PUBLIC_CLASS Exec : public Activity
-{
+class XBT_PUBLIC Exec : public Activity {
   Exec() : Activity() {}
 public:
-  friend XBT_PUBLIC(void) intrusive_ptr_release(simgrid::s4u::Exec* e);
-  friend XBT_PUBLIC(void) intrusive_ptr_add_ref(simgrid::s4u::Exec* e);
-  friend XBT_PUBLIC(ExecPtr) this_actor::exec_init(double flops_amount);
+  friend XBT_PUBLIC void intrusive_ptr_release(simgrid::s4u::Exec * e);
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(simgrid::s4u::Exec * e);
+  friend XBT_PUBLIC ExecPtr this_actor::exec_init(double flops_amount);
 
   ~Exec() = default;
 
index 986744b..c5d4e09 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -6,21 +6,20 @@
 #ifndef SIMGRID_S4U_HOST_HPP
 #define SIMGRID_S4U_HOST_HPP
 
+#include <simgrid/forward.h>
+#include <simgrid/s4u/forward.hpp>
+#include <xbt/Extendable.hpp>
+#include <xbt/signal.hpp>
+#include <xbt/string.hpp>
+
 #include <map>
 #include <string>
 #include <unordered_map>
 
-#include "xbt/Extendable.hpp"
-#include "xbt/signal.hpp"
-#include "xbt/string.hpp"
-
-#include "simgrid/forward.h"
-#include "simgrid/s4u/forward.hpp"
-
 namespace simgrid {
 
 namespace xbt {
-extern template class XBT_PUBLIC() Extendable<simgrid::s4u::Host>;
+extern template class XBT_PUBLIC Extendable<simgrid::s4u::Host>;
 }
 namespace s4u {
 
@@ -37,8 +36,7 @@ namespace s4u {
  * You can retrieve a particular host using simgrid::s4u::Host::byName()
  * and actors can retrieve the host on which they run using simgrid::s4u::Host::current().
  */
-XBT_PUBLIC_CLASS Host : public simgrid::xbt::Extendable<Host>
-{
+class XBT_PUBLIC Host : public simgrid::xbt::Extendable<Host> {
 
 public:
   explicit Host(const char* name);
index 13619bc..8376304 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -23,8 +23,7 @@ class NetworkAction;
 };
 namespace s4u {
 /** @brief A Link represents the network facilities between [hosts](\ref simgrid::s4u::Host) */
-XBT_PUBLIC_CLASS Link : public simgrid::xbt::Extendable<Link>
-{
+class XBT_PUBLIC Link : public simgrid::xbt::Extendable<Link> {
   friend simgrid::surf::LinkImpl;
 
   // Links are created from the NetZone, and destroyed by their private implementation when the simulation ends
index 4b6a905..642ce4a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -104,7 +104,7 @@ namespace s4u {
  *
  * @section s4u_mb_api The API
  */
-XBT_PUBLIC_CLASS Mailbox {
+class XBT_PUBLIC Mailbox {
   friend Comm;
   friend simgrid::kernel::activity::MailboxImpl;
 
index 81263d9..ce19858 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2015. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -11,8 +11,8 @@
 
 #include <boost/intrusive_ptr.hpp>
 
+#include <simgrid/simix.h>
 #include <xbt/base.h>
-#include "simgrid/simix.h"
 
 namespace simgrid {
 namespace s4u {
@@ -33,7 +33,7 @@ class ConditionVariable;
  * Use createMutex() to get a ::MutexPtr to a newly created mutex and only manipulate ::MutexPtr.
  *
  */
-XBT_PUBLIC_CLASS Mutex {
+class XBT_PUBLIC Mutex {
   friend ConditionVariable;
   friend simgrid::kernel::activity::MutexImpl;
   simgrid::kernel::activity::MutexImpl* mutex_;
index 778d179..a1935b7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2016-2018. 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. */
@@ -28,8 +28,7 @@ namespace s4u {
  * netzones. In SimGrid, there is a hierarchy of netzones, with a unique root zone (that you can retrieve from the
  * s4u::Engine).
  */
-XBT_PUBLIC_CLASS NetZone
-{
+class XBT_PUBLIC NetZone {
 protected:
   friend simgrid::kernel::routing::NetZoneImpl;
 
index 571c3b1..dc93710 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2006-2015, 2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2018. 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. */
@@ -7,29 +6,29 @@
 #ifndef INCLUDE_SIMGRID_S4U_STORAGE_HPP_
 #define INCLUDE_SIMGRID_S4U_STORAGE_HPP_
 
-#include "xbt/Extendable.hpp"
-#include <map>
 #include <simgrid/s4u/forward.hpp>
 #include <simgrid/simix.h>
+#include <xbt/Extendable.hpp>
+#include <xbt/base.h>
+
+#include <map>
 #include <string>
 #include <unordered_map>
-#include <xbt/base.h>
 
 namespace simgrid {
 namespace xbt {
-extern template class XBT_PUBLIC() Extendable<simgrid::s4u::Storage>;
+extern template class XBT_PUBLIC Extendable<simgrid::s4u::Storage>;
 }
 namespace s4u {
 
-XBT_ATTRIB_PUBLIC void getStorageList(std::map<std::string, Storage*>* whereTo);
+XBT_PUBLIC void getStorageList(std::map<std::string, Storage*>* whereTo);
 
-XBT_PUBLIC_CLASS Storage : public simgrid::xbt::Extendable<Storage>
-{
+class XBT_PUBLIC Storage : public simgrid::xbt::Extendable<Storage> {
   friend s4u::Engine;
   friend simgrid::surf::StorageImpl;
 
 public:
-  explicit Storage(surf::StorageImpl * pimpl) : pimpl_(pimpl) {}
+  explicit Storage(std::string name, surf::StorageImpl * pimpl);
   virtual ~Storage() = default;
   /** Retrieve a Storage by its name. It must exist in the platform file */
   static Storage* byName(std::string name);
index 2ec81c7..89063d5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -6,8 +6,8 @@
 #ifndef SIMGRID_S4U_VM_HPP
 #define SIMGRID_S4U_VM_HPP
 
-#include "simgrid/s4u/Host.hpp"
-#include "simgrid/s4u/forward.hpp"
+#include <simgrid/s4u/Host.hpp>
+#include <simgrid/s4u/forward.hpp>
 
 enum e_surf_vm_state_t {
   SURF_VM_STATE_CREATED, /**< created, but not yet started */
@@ -31,8 +31,7 @@ namespace s4u {
  * The total computing power that the contained actors can get is constrained to the virtual machine size.
  *
  */
-XBT_PUBLIC_CLASS VirtualMachine : public s4u::Host
-{
+class XBT_PUBLIC VirtualMachine : public s4u::Host {
   simgrid::vm::VirtualMachineImpl* pimpl_vm_ = nullptr;
   virtual ~VirtualMachine();
 
index e55df1f..09e6af5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2018. 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. */
@@ -15,24 +15,26 @@ namespace s4u {
 class Activity;
 class Actor;
 using ActorPtr = boost::intrusive_ptr<Actor>;
-XBT_PUBLIC(void) intrusive_ptr_release(Actor* actor);
-XBT_PUBLIC(void) intrusive_ptr_add_ref(Actor* actor);
+XBT_PUBLIC void intrusive_ptr_release(Actor* actor);
+XBT_PUBLIC void intrusive_ptr_add_ref(Actor* actor);
 
 class Comm;
 using CommPtr = boost::intrusive_ptr<Comm>;
-XBT_PUBLIC(void) intrusive_ptr_release(Comm* c);
-XBT_PUBLIC(void) intrusive_ptr_add_ref(Comm* c);
+XBT_PUBLIC void intrusive_ptr_release(Comm* c);
+XBT_PUBLIC void intrusive_ptr_add_ref(Comm* c);
 
 class Engine;
 class Exec;
 using ExecPtr = boost::intrusive_ptr<Exec>;
-XBT_PUBLIC(void) intrusive_ptr_release(Exec* e);
-XBT_PUBLIC(void) intrusive_ptr_add_ref(Exec* e);
+XBT_PUBLIC void intrusive_ptr_release(Exec* e);
+XBT_PUBLIC void intrusive_ptr_add_ref(Exec* e);
 
 class Host;
 class Link;
 class Mailbox;
 using MailboxPtr = boost::intrusive_ptr<Mailbox>;
+XBT_PUBLIC void intrusive_ptr_release(Mailbox* m);
+XBT_PUBLIC void intrusive_ptr_add_ref(Mailbox* m);
 class Mutex;
 class NetZone;
 class VirtualMachine;
index 4c044a5..cb54bd9 100644 (file)
@@ -1,19 +1,20 @@
-/* Copyright (c) 2006-2010, 2012-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2018. 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. */
 
-#ifndef SIMDAG_SIMDAG_H
-#define SIMDAG_SIMDAG_H
+#ifndef SIMGRID_SIMDAG_H
+#define SIMGRID_SIMDAG_H
+
+#include <simgrid/host.h>
+#include <simgrid/link.h>
+#include <xbt/log.h>
+#include <xbt/sysdep.h>
 
-#include "simgrid/host.h"
-#include "simgrid/link.h"
-#include "xbt/log.h"
-#include "xbt/sysdep.h"
 #ifdef __cplusplus
 #include <set>
 #endif
+
 SG_BEGIN_DECL()
 
 /** @brief Link opaque datatype
@@ -70,46 +71,45 @@ typedef enum {
  *  @see SD_task_t, @see SD_task_dependency_api
  *  @{
  */
-XBT_PUBLIC(SD_task_t) SD_task_create(const char *name, void *data, double amount);
-XBT_PUBLIC(void *) SD_task_get_data(SD_task_t task);
-XBT_PUBLIC(void) SD_task_set_data(SD_task_t task, void *data);
-XBT_PUBLIC(e_SD_task_state_t) SD_task_get_state(SD_task_t task);
-XBT_PUBLIC(const char *) SD_task_get_name(SD_task_t task);
-XBT_PUBLIC(void) SD_task_set_name(SD_task_t task, const char *name);
-XBT_PUBLIC(void) SD_task_set_rate(SD_task_t task, double rate);
-
-XBT_PUBLIC(void) SD_task_watch(SD_task_t task, e_SD_task_state_t state);
-XBT_PUBLIC(void) SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
-XBT_PUBLIC(double) SD_task_get_amount(SD_task_t task);
-XBT_PUBLIC(void) SD_task_set_amount(SD_task_t task, double amount);
-XBT_PUBLIC(double) SD_task_get_alpha(SD_task_t task);
-XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task);
-XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task, int host_count, const sg_host_t *host_list,
-                                              const double *flops_amount, const double *bytes_amount);
-XBT_PUBLIC(e_SD_task_kind_t) SD_task_get_kind(SD_task_t task);
-XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int host_count, const sg_host_t *host_list,
-                                  const double *flops_amount, const double *bytes_amount, double rate);
-XBT_PUBLIC(void) SD_task_unschedule(SD_task_t task);
-XBT_PUBLIC(double) SD_task_get_start_time(SD_task_t task);
-XBT_PUBLIC(double) SD_task_get_finish_time(SD_task_t task);
-XBT_PUBLIC(xbt_dynar_t) SD_task_get_parents(SD_task_t task);
-XBT_PUBLIC(xbt_dynar_t) SD_task_get_children(SD_task_t task);
-XBT_PUBLIC(int) SD_task_get_workstation_count(SD_task_t task);
-XBT_PUBLIC(sg_host_t *) SD_task_get_workstation_list(SD_task_t task);
-XBT_PUBLIC(void) SD_task_destroy(SD_task_t task);
-XBT_PUBLIC(void) SD_task_dump(SD_task_t task);
-XBT_PUBLIC(void) SD_task_dotty(SD_task_t task, void *out_FILE);
-
-XBT_PUBLIC(SD_task_t) SD_task_create_comp_seq(const char *name, void *data, double amount);
-XBT_PUBLIC(SD_task_t) SD_task_create_comp_par_amdahl(const char *name, void *data, double amount, double alpha);
-XBT_PUBLIC(SD_task_t) SD_task_create_comm_e2e(const char *name, void *data, double amount);
-XBT_PUBLIC(SD_task_t) SD_task_create_comm_par_mxn_1d_block(const char *name, void *data, double amount);
-
-XBT_PUBLIC(void) SD_task_distribute_comp_amdahl(SD_task_t task, int ws_count);
-XBT_PUBLIC(void) SD_task_build_MxN_1D_block_matrix(SD_task_t task, int src_nb, int dst_nb);
-XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count, const sg_host_t * list);
-XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
-
+XBT_PUBLIC SD_task_t SD_task_create(const char* name, void* data, double amount);
+XBT_PUBLIC void* SD_task_get_data(SD_task_t task);
+XBT_PUBLIC void SD_task_set_data(SD_task_t task, void* data);
+XBT_PUBLIC e_SD_task_state_t SD_task_get_state(SD_task_t task);
+XBT_PUBLIC const char* SD_task_get_name(SD_task_t task);
+XBT_PUBLIC void SD_task_set_name(SD_task_t task, const char* name);
+XBT_PUBLIC void SD_task_set_rate(SD_task_t task, double rate);
+
+XBT_PUBLIC void SD_task_watch(SD_task_t task, e_SD_task_state_t state);
+XBT_PUBLIC void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
+XBT_PUBLIC double SD_task_get_amount(SD_task_t task);
+XBT_PUBLIC void SD_task_set_amount(SD_task_t task, double amount);
+XBT_PUBLIC double SD_task_get_alpha(SD_task_t task);
+XBT_PUBLIC double SD_task_get_remaining_amount(SD_task_t task);
+XBT_PUBLIC double SD_task_get_execution_time(SD_task_t task, int host_count, const sg_host_t* host_list,
+                                             const double* flops_amount, const double* bytes_amount);
+XBT_PUBLIC e_SD_task_kind_t SD_task_get_kind(SD_task_t task);
+XBT_PUBLIC void SD_task_schedule(SD_task_t task, int host_count, const sg_host_t* host_list, const double* flops_amount,
+                                 const double* bytes_amount, double rate);
+XBT_PUBLIC void SD_task_unschedule(SD_task_t task);
+XBT_PUBLIC double SD_task_get_start_time(SD_task_t task);
+XBT_PUBLIC double SD_task_get_finish_time(SD_task_t task);
+XBT_PUBLIC xbt_dynar_t SD_task_get_parents(SD_task_t task);
+XBT_PUBLIC xbt_dynar_t SD_task_get_children(SD_task_t task);
+XBT_PUBLIC int SD_task_get_workstation_count(SD_task_t task);
+XBT_PUBLIC sg_host_t* SD_task_get_workstation_list(SD_task_t task);
+XBT_PUBLIC void SD_task_destroy(SD_task_t task);
+XBT_PUBLIC void SD_task_dump(SD_task_t task);
+XBT_PUBLIC void SD_task_dotty(SD_task_t task, void* out_FILE);
+
+XBT_PUBLIC SD_task_t SD_task_create_comp_seq(const char* name, void* data, double amount);
+XBT_PUBLIC SD_task_t SD_task_create_comp_par_amdahl(const char* name, void* data, double amount, double alpha);
+XBT_PUBLIC SD_task_t SD_task_create_comm_e2e(const char* name, void* data, double amount);
+XBT_PUBLIC SD_task_t SD_task_create_comm_par_mxn_1d_block(const char* name, void* data, double amount);
+
+XBT_PUBLIC void SD_task_distribute_comp_amdahl(SD_task_t task, int ws_count);
+XBT_PUBLIC void SD_task_build_MxN_1D_block_matrix(SD_task_t task, int src_nb, int dst_nb);
+XBT_PUBLIC void SD_task_schedulev(SD_task_t task, int count, const sg_host_t* list);
+XBT_PUBLIC void SD_task_schedulel(SD_task_t task, int count, ...);
 
 /** @brief A constant to use in SD_task_schedule to mean that there is no cost.
  *
@@ -128,9 +128,9 @@ XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
  *  @see SD_task_api
  *  @{
  */
-XBT_PUBLIC(void) SD_task_dependency_add(SD_task_t src, SD_task_t dst);
-XBT_PUBLIC(void) SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
-XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
+XBT_PUBLIC void SD_task_dependency_add(SD_task_t src, SD_task_t dst);
+XBT_PUBLIC void SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
+XBT_PUBLIC int SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
 /** @} */
 
 /************************** Global *******************************************/
@@ -147,17 +147,17 @@ XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
     SD_init_nocheck(argc, argv);                                                                                       \
   } while (0)
 
-XBT_PUBLIC(void) SD_init_nocheck(int *argc, char **argv);
-XBT_PUBLIC(void) SD_config(const char *key, const char *value);
-XBT_PUBLIC(void) SD_create_environment(const char *platform_file);
-XBT_PUBLIC(void) SD_simulate(double how_long);
-XBT_PUBLIC(void) SD_simulate_with_update(double how_long, xbt_dynar_t changed_tasks_dynar);
-XBT_PUBLIC(double) SD_get_clock();
-XBT_PUBLIC(void) SD_exit();
-XBT_PUBLIC(xbt_dynar_t) SD_daxload(const char *filename);
-XBT_PUBLIC(xbt_dynar_t) SD_dotload(const char *filename);
-XBT_PUBLIC(xbt_dynar_t) SD_dotload_with_sched(const char *filename);
-XBT_PUBLIC(xbt_dynar_t) SD_PTG_dotload(const char *filename);
+XBT_PUBLIC void SD_init_nocheck(int* argc, char** argv);
+XBT_PUBLIC void SD_config(const char* key, const char* value);
+XBT_PUBLIC void SD_create_environment(const char* platform_file);
+XBT_PUBLIC void SD_simulate(double how_long);
+XBT_PUBLIC void SD_simulate_with_update(double how_long, xbt_dynar_t changed_tasks_dynar);
+XBT_PUBLIC double SD_get_clock();
+XBT_PUBLIC void SD_exit();
+XBT_PUBLIC xbt_dynar_t SD_daxload(const char* filename);
+XBT_PUBLIC xbt_dynar_t SD_dotload(const char* filename);
+XBT_PUBLIC xbt_dynar_t SD_dotload_with_sched(const char* filename);
+XBT_PUBLIC xbt_dynar_t SD_PTG_dotload(const char* filename);
 /** @} */
 
 /* Support some backward compatibility */
@@ -200,7 +200,7 @@ SG_END_DECL()
 #ifdef __cplusplus
 namespace simgrid {
 namespace sd {
-XBT_PUBLIC(std::set<SD_task_t>*) simulate(double how_long);
+XBT_PUBLIC std::set<SD_task_t>* simulate(double how_long);
 }
 }
 #endif
index 56c2f33..51196db 100644 (file)
@@ -3,13 +3,13 @@
 /* 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. */
 
-#ifndef _SIMIX_SIMIX_H
-#define _SIMIX_SIMIX_H
+#ifndef SIMGRID_SIMIX_H
+#define SIMGRID_SIMIX_H
 
-#include "simgrid/forward.h"
-#include "simgrid/host.h"
-#include "xbt/ex.h"
-#include "xbt/parmap.h"
+#include <simgrid/forward.h>
+#include <simgrid/host.h>
+#include <xbt/ex.h>
+#include <xbt/parmap.h>
 #ifdef __cplusplus
 #include <map>
 #endif
@@ -74,61 +74,57 @@ extern int smx_context_guard_size_was_set;
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(smx_actor_t) SIMIX_process_from_PID(aid_t PID);
+XBT_PUBLIC smx_actor_t SIMIX_process_from_PID(aid_t PID);
 
 /* parallelism */
-XBT_PUBLIC(int) SIMIX_context_is_parallel();
-XBT_PUBLIC(int) SIMIX_context_get_nthreads();
-XBT_PUBLIC(void) SIMIX_context_set_nthreads(int nb_threads);
-XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold();
-XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
-XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode();
-XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
-XBT_PUBLIC(int) SIMIX_is_maestro();
-
+XBT_PUBLIC int SIMIX_context_is_parallel();
+XBT_PUBLIC int SIMIX_context_get_nthreads();
+XBT_PUBLIC void SIMIX_context_set_nthreads(int nb_threads);
+XBT_PUBLIC int SIMIX_context_get_parallel_threshold();
+XBT_PUBLIC void SIMIX_context_set_parallel_threshold(int threshold);
+XBT_PUBLIC e_xbt_parmap_mode_t SIMIX_context_get_parallel_mode();
+XBT_PUBLIC void SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
+XBT_PUBLIC int SIMIX_is_maestro();
 
 /********************************** Global ************************************/
 /* Initialization and exit */
-XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
+XBT_PUBLIC void SIMIX_global_init(int* argc, char** argv);
 
 /* Set to execute in the maestro
  *
  * If no maestro code is registered (the default), the main thread
  * is assumed to be the maestro. */
-XBT_PUBLIC(void) SIMIX_set_maestro(void (*code)(void*), void* data);
+XBT_PUBLIC void SIMIX_set_maestro(void (*code)(void*), void* data);
 
-XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
-XBT_PUBLIC(void) SIMIX_function_register_process_kill(void_pfn_smxprocess_t function);
+XBT_PUBLIC void SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
+XBT_PUBLIC void SIMIX_function_register_process_kill(void_pfn_smxprocess_t function);
 
 /* Simulation execution */
-XBT_PUBLIC(void) SIMIX_run();
-XBT_PUBLIC(double) SIMIX_get_clock();
+XBT_PUBLIC void SIMIX_run();
+XBT_PUBLIC double SIMIX_get_clock();
 
 /* Timer functions FIXME: should these be public? */
 typedef struct s_smx_timer_t* smx_timer_t;
 
-XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, void (*function)(void*), void *arg);
-XBT_PUBLIC(void) SIMIX_timer_remove(smx_timer_t timer);
-XBT_PUBLIC(double) SIMIX_timer_next();
-XBT_PUBLIC(double) SIMIX_timer_get_date(smx_timer_t timer);
+XBT_PUBLIC smx_timer_t SIMIX_timer_set(double date, void (*function)(void*), void* arg);
+XBT_PUBLIC void SIMIX_timer_remove(smx_timer_t timer);
+XBT_PUBLIC double SIMIX_timer_next();
+XBT_PUBLIC double SIMIX_timer_get_date(smx_timer_t timer);
 
-XBT_PUBLIC(void) SIMIX_display_process_status();
+XBT_PUBLIC void SIMIX_display_process_status();
 
 /******************************* Environment **********************************/
-XBT_PUBLIC(void) SIMIX_create_environment(const char *file);
+XBT_PUBLIC void SIMIX_create_environment(const char* file);
 
 /******************************** Deployment **********************************/
 
-XBT_PUBLIC(void) SIMIX_function_register(const char *name, xbt_main_func_t code);
-XBT_PUBLIC(void) SIMIX_function_register_default(xbt_main_func_t code);
-XBT_PUBLIC(void) SIMIX_init_application();
-XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
+XBT_PUBLIC void SIMIX_function_register(const char* name, xbt_main_func_t code);
+XBT_PUBLIC void SIMIX_function_register_default(xbt_main_func_t code);
+XBT_PUBLIC void SIMIX_init_application();
+XBT_PUBLIC void SIMIX_launch_application(const char* file);
 
-XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
-                                            const char *process_function,
-                                            xbt_dynar_t arguments,
-                                            double process_start_time,
-                                            double process_kill_time);
+XBT_PUBLIC void SIMIX_process_set_function(const char* process_host, const char* process_function,
+                                           xbt_dynar_t arguments, double process_start_time, double process_kill_time);
 
 /*********************************** Host *************************************/
 /* Functions for running a process in main()
@@ -139,35 +135,34 @@ XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
  *  4. detach (this waits for the simulation to terminate)
  */
 
-XBT_PUBLIC(void) SIMIX_maestro_create(void (*code)(void*), void* data);
+XBT_PUBLIC void SIMIX_maestro_create(void (*code)(void*), void* data);
 #ifdef __cplusplus
-XBT_PUBLIC(smx_actor_t)
-SIMIX_process_attach(const char* name, void* data, const char* hostname, std::map<std::string, std::string>* properties,
-                     smx_actor_t parent_process);
+XBT_PUBLIC smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostname,
+                                            std::map<std::string, std::string>* properties, smx_actor_t parent_process);
 #endif
-XBT_PUBLIC(void) SIMIX_process_detach();
+XBT_PUBLIC void SIMIX_process_detach();
 
 /*********************************** Host *************************************/
-XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_actor_t issuer);
+XBT_PUBLIC void SIMIX_host_off(sg_host_t host, smx_actor_t issuer);
 
 /********************************* Process ************************************/
-XBT_PUBLIC(int) SIMIX_process_count();
-XBT_PUBLIC(smx_actor_t) SIMIX_process_self();
-XBT_PUBLIC(const char*) SIMIX_process_self_get_name();
-XBT_PUBLIC(void) SIMIX_process_self_set_data(void *data);
-XBT_PUBLIC(void*) SIMIX_process_self_get_data();
-XBT_PUBLIC(int) SIMIX_process_has_pending_comms(smx_actor_t process);
-XBT_PUBLIC(void) SIMIX_process_on_exit_runall(smx_actor_t process);
-XBT_PUBLIC(void) SIMIX_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data);
+XBT_PUBLIC int SIMIX_process_count();
+XBT_PUBLIC smx_actor_t SIMIX_process_self();
+XBT_PUBLIC const char* SIMIX_process_self_get_name();
+XBT_PUBLIC void SIMIX_process_self_set_data(void* data);
+XBT_PUBLIC void* SIMIX_process_self_get_data();
+XBT_PUBLIC int SIMIX_process_has_pending_comms(smx_actor_t process);
+XBT_PUBLIC void SIMIX_process_on_exit_runall(smx_actor_t process);
+XBT_PUBLIC void SIMIX_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data);
 
 SG_END_DECL()
 
 /****************************** Communication *********************************/
-XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, size_t));
-XBT_PUBLIC(void) SIMIX_comm_copy_pointer_callback(smx_activity_t comm, void* buff, size_t buff_size);
-XBT_PUBLIC(void) SIMIX_comm_copy_buffer_callback(smx_activity_t comm, void* buff, size_t buff_size);
+XBT_PUBLIC void SIMIX_comm_set_copy_data_callback(void (*callback)(smx_activity_t, void*, size_t));
+XBT_PUBLIC void SIMIX_comm_copy_pointer_callback(smx_activity_t comm, void* buff, size_t buff_size);
+XBT_PUBLIC void SIMIX_comm_copy_buffer_callback(smx_activity_t comm, void* buff, size_t buff_size);
 
-XBT_PUBLIC(void) SIMIX_comm_finish(smx_activity_t synchro);
+XBT_PUBLIC void SIMIX_comm_finish(smx_activity_t synchro);
 
 /******************************************************************************/
 /*                            SIMIX simcalls                                  */
@@ -176,113 +171,113 @@ XBT_PUBLIC(void) SIMIX_comm_finish(smx_activity_t synchro);
 /* They can also be called from maestro's context, and they are thread safe.  */
 /******************************************************************************/
 
-XBT_PUBLIC(void) simcall_call(smx_actor_t process);
+XBT_PUBLIC void simcall_call(smx_actor_t process);
 
 /******************************* Host simcalls ********************************/
-XBT_PUBLIC(smx_activity_t)
-simcall_execution_start(const char* name, double flops_amount, double priority, double bound, sg_host_t host);
-XBT_PUBLIC(smx_activity_t)
-simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
-                                 double* bytes_amount, double rate, double timeout);
-XBT_PUBLIC(void) simcall_execution_cancel(smx_activity_t execution);
-XBT_PUBLIC(void) simcall_execution_set_priority(smx_activity_t execution, double priority);
-XBT_PUBLIC(void) simcall_execution_set_bound(smx_activity_t execution, double bound);
-XBT_PUBLIC(e_smx_state_t) simcall_execution_wait(smx_activity_t execution);
-XBT_PUBLIC(e_smx_state_t) simcall_execution_test(smx_activity_t execution);
+XBT_PUBLIC smx_activity_t simcall_execution_start(const char* name, double flops_amount, double priority, double bound,
+                                                  sg_host_t host);
+XBT_PUBLIC smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list,
+                                                           double* flops_amount, double* bytes_amount, double rate,
+                                                           double timeout);
+XBT_PUBLIC void simcall_execution_cancel(smx_activity_t execution);
+XBT_PUBLIC void simcall_execution_set_priority(smx_activity_t execution, double priority);
+XBT_PUBLIC void simcall_execution_set_bound(smx_activity_t execution, double bound);
+XBT_PUBLIC e_smx_state_t simcall_execution_wait(smx_activity_t execution);
+XBT_PUBLIC e_smx_state_t simcall_execution_test(smx_activity_t execution);
 
 /**************************** Process simcalls ********************************/
 SG_BEGIN_DECL()
 /* Constructor and Destructor */
 #ifdef __cplusplus
-XBT_PUBLIC(smx_actor_t)
-simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc, char** argv,
-                       std::map<std::string, std::string>* properties);
+XBT_PUBLIC smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host,
+                                              int argc, char** argv, std::map<std::string, std::string>* properties);
 #endif
 
-XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
-XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg);
-
+XBT_PUBLIC void simcall_process_killall();
+XBT_PUBLIC void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char* mesg);
 
 /* Process handling */
-XBT_PUBLIC(void) simcall_process_cleanup(smx_actor_t process);
-XBT_PUBLIC(void) simcall_process_suspend(smx_actor_t process);
+XBT_PUBLIC void simcall_process_cleanup(smx_actor_t process);
+XBT_PUBLIC void simcall_process_suspend(smx_actor_t process);
 
 /* Getters and Setters */
-XBT_PUBLIC(int) simcall_process_count();
-XBT_PUBLIC(void) simcall_process_set_data(smx_actor_t process, void *data);
-XBT_PUBLIC(void) simcall_process_set_kill_time(smx_actor_t process, double kill_time);
-XBT_PUBLIC(void) simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data);
-XBT_PUBLIC(void) simcall_process_join(smx_actor_t process, double timeout);
+XBT_PUBLIC int simcall_process_count();
+XBT_PUBLIC void simcall_process_set_data(smx_actor_t process, void* data);
+XBT_PUBLIC void simcall_process_set_kill_time(smx_actor_t process, double kill_time);
+XBT_PUBLIC void simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data);
+XBT_PUBLIC void simcall_process_join(smx_actor_t process, double timeout);
 /* Sleep control */
-XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
+XBT_PUBLIC e_smx_state_t simcall_process_sleep(double duration);
 SG_END_DECL()
 
 /************************** Comunication simcalls *****************************/
 
 #ifdef __cplusplus
-XBT_PUBLIC(void)
-simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
-                  size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout);
-
-XBT_PUBLIC(smx_activity_t)
-simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
-                   size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                   void (*clean_fun)(void*), void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
-                   int detached);
-
-XBT_PUBLIC(void)
-simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
-                  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout, double rate);
-
-XBT_PUBLIC(smx_activity_t)
-simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
-                   int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                   void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double rate);
-
-XBT_PUBLIC(smx_activity_t)
-simcall_comm_iprobe(smx_mailbox_t mbox, int type, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                    void* data);
+XBT_PUBLIC void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
+                                  size_t src_buff_size,
+                                  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout);
+
+XBT_PUBLIC smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
+                                             void* src_buff, size_t src_buff_size,
+                                             int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                             void (*clean_fun)(void*),
+                                             void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                                             int detached);
+
+XBT_PUBLIC void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+                                  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout,
+                                  double rate);
+
+XBT_PUBLIC smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff,
+                                             size_t* dst_buff_size,
+                                             int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                             void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                                             double rate);
+
+XBT_PUBLIC smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type,
+                                              int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                              void* data);
 #endif
-XBT_PUBLIC(void) simcall_comm_cancel(smx_activity_t comm);
+XBT_PUBLIC void simcall_comm_cancel(smx_activity_t comm);
 
 /* FIXME: waitany is going to be a vararg function, and should take a timeout */
-XBT_PUBLIC(unsigned int) simcall_comm_waitany(xbt_dynar_t comms, double timeout);
-XBT_PUBLIC(void) simcall_comm_wait(smx_activity_t comm, double timeout);
-XBT_PUBLIC(int) simcall_comm_test(smx_activity_t comm);
-XBT_PUBLIC(int) simcall_comm_testany(smx_activity_t* comms, size_t count);
+XBT_PUBLIC unsigned int simcall_comm_waitany(xbt_dynar_t comms, double timeout);
+XBT_PUBLIC void simcall_comm_wait(smx_activity_t comm, double timeout);
+XBT_PUBLIC int simcall_comm_test(smx_activity_t comm);
+XBT_PUBLIC int simcall_comm_testany(smx_activity_t* comms, size_t count);
 
 /************************** Tracing handling **********************************/
-XBT_PUBLIC(void) simcall_set_category(smx_activity_t synchro, const char *category);
+XBT_PUBLIC void simcall_set_category(smx_activity_t synchro, const char* category);
 
 /************************** Synchro simcalls **********************************/
 SG_BEGIN_DECL()
-XBT_PUBLIC(smx_mutex_t) simcall_mutex_init();
-XBT_PUBLIC(smx_mutex_t) SIMIX_mutex_ref(smx_mutex_t mutex);
-XBT_PUBLIC(void) SIMIX_mutex_unref(smx_mutex_t mutex);
-XBT_PUBLIC(void) simcall_mutex_lock(smx_mutex_t mutex);
-XBT_PUBLIC(int) simcall_mutex_trylock(smx_mutex_t mutex);
-XBT_PUBLIC(void) simcall_mutex_unlock(smx_mutex_t mutex);
-
-XBT_PUBLIC(smx_cond_t) simcall_cond_init();
-XBT_PUBLIC(void) SIMIX_cond_unref(smx_cond_t cond);
-XBT_PUBLIC(smx_cond_t) SIMIX_cond_ref(smx_cond_t cond);
-XBT_PUBLIC(void) simcall_cond_signal(smx_cond_t cond);
-XBT_PUBLIC(void) simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
-XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double max_duration);
-XBT_PUBLIC(void) simcall_cond_broadcast(smx_cond_t cond);
-
-XBT_PUBLIC(void) SIMIX_sem_destroy(smx_sem_t sem);
-XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem);
-XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
+XBT_PUBLIC smx_mutex_t simcall_mutex_init();
+XBT_PUBLIC smx_mutex_t SIMIX_mutex_ref(smx_mutex_t mutex);
+XBT_PUBLIC void SIMIX_mutex_unref(smx_mutex_t mutex);
+XBT_PUBLIC void simcall_mutex_lock(smx_mutex_t mutex);
+XBT_PUBLIC int simcall_mutex_trylock(smx_mutex_t mutex);
+XBT_PUBLIC void simcall_mutex_unlock(smx_mutex_t mutex);
+
+XBT_PUBLIC smx_cond_t simcall_cond_init();
+XBT_PUBLIC void SIMIX_cond_unref(smx_cond_t cond);
+XBT_PUBLIC smx_cond_t SIMIX_cond_ref(smx_cond_t cond);
+XBT_PUBLIC void simcall_cond_signal(smx_cond_t cond);
+XBT_PUBLIC void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
+XBT_PUBLIC void simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double max_duration);
+XBT_PUBLIC void simcall_cond_broadcast(smx_cond_t cond);
+
+XBT_PUBLIC void SIMIX_sem_destroy(smx_sem_t sem);
+XBT_PUBLIC void simcall_sem_acquire(smx_sem_t sem);
+XBT_PUBLIC void simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
 
 /*****************************   Storage   **********************************/
-XBT_PUBLIC(sg_size_t) simcall_storage_read(surf_storage_t st, sg_size_t size);
-XBT_PUBLIC(sg_size_t) simcall_storage_write(surf_storage_t fd, sg_size_t size);
+XBT_PUBLIC sg_size_t simcall_storage_read(surf_storage_t st, sg_size_t size);
+XBT_PUBLIC sg_size_t simcall_storage_write(surf_storage_t fd, sg_size_t size);
 /************************** MC simcalls   **********************************/
-XBT_PUBLIC(int) simcall_mc_random(int min, int max);
+XBT_PUBLIC int simcall_mc_random(int min, int max);
 
 SG_END_DECL()
 
-#endif                          /* _SIMIX_SIMIX_H */
+#endif
index f21fa3d..0e952a5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2010, 2012-2017. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2012-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -15,7 +15,7 @@
 #include <map>
 #include <string>
 
-XBT_PUBLIC(void) simcall_run_kernel(std::function<void()> const& code);
+XBT_PUBLIC void simcall_run_kernel(std::function<void()> const& code);
 
 /** Execute some code in the kernel and block
  *
@@ -26,7 +26,7 @@ XBT_PUBLIC(void) simcall_run_kernel(std::function<void()> const& code);
  *
  * @ref simix::kernelSync() is a higher level wrapper for this.
  */
-XBT_PUBLIC(void) simcall_run_blocking(std::function<void()> const& code);
+XBT_PUBLIC void simcall_run_blocking(std::function<void()> const& code);
 
 template<class F> inline
 void simcall_run_kernel(F& f)
@@ -69,10 +69,7 @@ typename std::result_of<F()>::type kernelImmediate(F&& code)
   return result.get();
 }
 
-XBT_PUBLIC(const std::vector<smx_actor_t>&) process_get_runnable();
-
-XBT_PUBLIC(void) set_maestro(std::function<void()> code);
-XBT_PUBLIC(void) create_maestro(std::function<void()> code);
+XBT_PUBLIC const std::vector<smx_actor_t>& process_get_runnable();
 
 // What's executed as SIMIX actor code:
 typedef std::function<void()> ActorCode;
@@ -80,7 +77,7 @@ typedef std::function<void()> ActorCode;
 // Create ActorCode based on argv:
 typedef std::function<ActorCode(std::vector<std::string> args)> ActorCodeFactory;
 
-XBT_PUBLIC(void) registerFunction(const char* name, ActorCodeFactory factory);
+XBT_PUBLIC void registerFunction(const char* name, ActorCodeFactory factory);
 
 /** These functions will be called when we detect a deadlock: any remaining process is locked on an action
  *
@@ -108,14 +105,12 @@ typedef smx_actor_t (*smx_creation_func_t)(
     /* props */ std::map<std::string, std::string>*,
     /* parent_process */ smx_actor_t);
 
-extern "C"
-XBT_PUBLIC(void) SIMIX_function_register_process_create(smx_creation_func_t function);
+extern "C" XBT_PUBLIC void SIMIX_function_register_process_create(smx_creation_func_t function);
 
-XBT_PUBLIC(smx_actor_t)
-simcall_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
-                       std::map<std::string, std::string>* properties);
+XBT_PUBLIC smx_actor_t simcall_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
+                                              std::map<std::string, std::string>* properties);
 
-XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback);
+XBT_PUBLIC smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback);
 
 template<class F> inline
 smx_timer_t SIMIX_timer_set(double date, F callback)
index 8cd2eee..ccfc8a1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team.
+/* Copyright (c) 2016-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 #include <simgrid/simix.h>
 #include <simgrid/simix.hpp>
 
-XBT_PUBLIC(void) simcall_run_blocking(std::function<void()> const& code);
+XBT_PUBLIC void simcall_run_blocking(std::function<void()> const& code);
 
 namespace simgrid {
 namespace simix {
 
-XBT_PUBLIC(void) unblock(smx_actor_t process);
+XBT_PUBLIC void unblock(smx_actor_t process);
 
 /** Execute some code in kernel mode and wakes up the actor when
  *  the result is available.
diff --git a/include/simgrid/storage.h b/include/simgrid/storage.h
new file mode 100644 (file)
index 0000000..01a58ee
--- /dev/null
@@ -0,0 +1,31 @@
+/* Public interface to the Link datatype                                    */
+
+/* Copyright (c) 2018. 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. */
+
+#ifndef INCLUDE_SIMGRID_STORAGE_H_
+#define INCLUDE_SIMGRID_STORAGE_H_
+
+#include <simgrid/forward.h>
+#include <xbt/base.h>
+
+/* C interface */
+SG_BEGIN_DECL()
+
+XBT_PUBLIC const char* sg_storage_get_name(sg_storage_t storage);
+XBT_PUBLIC sg_storage_t sg_storage_get_by_name(const char* name);
+XBT_PUBLIC xbt_dict_t sg_storage_get_properties(sg_storage_t storage);
+XBT_PUBLIC void sg_storage_set_property_value(sg_storage_t storage, const char* name, const char* value);
+XBT_PUBLIC const char* sg_storage_get_property_value(sg_storage_t storage, const char* name);
+XBT_PUBLIC xbt_dynar_t sg_storages_as_dynar();
+XBT_PUBLIC void sg_storage_set_data(sg_storage_t host, void* data);
+XBT_PUBLIC void* sg_storage_get_data(sg_storage_t storage);
+XBT_PUBLIC const char* sg_storage_get_host(sg_storage_t storage);
+XBT_PUBLIC sg_size_t sg_storage_read(sg_storage_t storage, sg_size_t size);
+XBT_PUBLIC sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size);
+
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_STORAGE_H_ */
diff --git a/include/simgrid/vm.h b/include/simgrid/vm.h
new file mode 100644 (file)
index 0000000..98628d3
--- /dev/null
@@ -0,0 +1,46 @@
+/* Public interface to the Link datatype                                    */
+
+/* Copyright (c) 2018. 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. */
+
+#ifndef INCLUDE_SIMGRID_VM_H_
+#define INCLUDE_SIMGRID_VM_H_
+
+#include <simgrid/forward.h>
+#include <xbt/base.h>
+
+/* C interface */
+SG_BEGIN_DECL()
+
+/** @brief Opaque type describing a Virtual Machine.
+ *  @ingroup msg_VMs
+ *
+ * All this is highly experimental and the interface will probably change in the future.
+ * Please don't depend on this yet (although testing is welcomed if you feel so).
+ * Usual lack of guaranty of any kind applies here, and is even increased.
+ *
+ */
+XBT_PUBLIC sg_vm_t sg_vm_create_core(sg_host_t pm, const char* name);
+XBT_PUBLIC sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount);
+
+XBT_PUBLIC int sg_vm_is_created(sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_running(sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_suspended(sg_vm_t vm);
+
+XBT_PUBLIC const char* sg_vm_get_name(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_ramsize(sg_vm_t vm, size_t size);
+XBT_PUBLIC size_t sg_vm_get_ramsize(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_set_bound(sg_vm_t vm, double bound);
+XBT_PUBLIC sg_host_t sg_vm_get_pm(sg_vm_t vm);
+
+XBT_PUBLIC void sg_vm_start(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_suspend(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_resume(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_shutdown(sg_vm_t vm);
+XBT_PUBLIC void sg_vm_destroy(sg_vm_t vm);
+
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_VM_H_ */
diff --git a/include/simgrid/zone.h b/include/simgrid/zone.h
new file mode 100644 (file)
index 0000000..4dac581
--- /dev/null
@@ -0,0 +1,28 @@
+/* Public interface to the Link datatype                                    */
+
+/* Copyright (c) 2018. 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. */
+
+#ifndef INCLUDE_SIMGRID_ZONE_H_
+#define INCLUDE_SIMGRID_ZONE_H_
+
+#include <simgrid/forward.h>
+#include <xbt/base.h>
+#include <xbt/dict.h>
+
+/* C interface */
+SG_BEGIN_DECL()
+
+XBT_PUBLIC sg_netzone_t sg_zone_get_root();
+XBT_PUBLIC const char* sg_zone_get_name(sg_netzone_t zone);
+XBT_PUBLIC sg_netzone_t sg_zone_get_by_name(const char* name);
+XBT_PUBLIC void sg_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto);
+XBT_PUBLIC const char* sg_zone_get_property_value(sg_netzone_t as, const char* name);
+XBT_PUBLIC void sg_zone_set_property_value(sg_netzone_t netzone, const char* name, char* value);
+XBT_PUBLIC void sg_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto);
+
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_ZONE_H_ */
index f2517b4..3ee9f3f 100644 (file)
@@ -1,6 +1,6 @@
 /* simgrid_config.h - Results of the configure made visible to user code.   */
 
-/* Copyright (c) 2009-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
 SG_BEGIN_DECL()
 /** Retrieves the version numbers of the used dynamic library (so, DLL or dynlib), while
     SIMGRID_VERSION_MAJOR and friends give the version numbers of the used header files */
-XBT_PUBLIC(void) sg_version_get(int *major,int *minor,int *patch);
+XBT_PUBLIC void sg_version_get(int* major, int* minor, int* patch);
 
 /** Display the version information and some additional blurb. */
-XBT_PUBLIC(void) sg_version();
+XBT_PUBLIC void sg_version();
 SG_END_DECL()
 
 
 /* Version as a single integer. v3.4 is 30400, v3.16.2 is 31602, v42 will be 420000, and so on. */
-#define SIMGRID_VERSION (100UL * (100UL * (@SIMGRID_VERSION_MAJOR@) + (@SIMGRID_VERSION_MINOR@)) + (@SIMGRID_VERSION_PATCH@))
+#define SIMGRID_VERSION (100UL * (100UL * (SIMGRID_VERSION_MAJOR) + (SIMGRID_VERSION_MINOR)) + (SIMGRID_VERSION_PATCH))
 
 #define SIMGRID_VERSION_STRING "@SIMGRID_VERSION_STRING@"
 
index 8af2cdf..580f2b3 100644 (file)
@@ -6,7 +6,7 @@
 ! under the terms of the license (GNU LGPL) which comes with this package.
 
 ! SMPI's Fortran 77 include file
-
+@MODULE_MPIF_IN@
       integer MPI_THREAD_SINGLE, MPI_THREAD_FUNNELED
       integer MPI_THREAD_SERIALIZED, MPI_THREAD_MULTIPLE
       parameter(MPI_THREAD_SINGLE=0)
       double precision smpi_get_host_current_power_peak
       integer smpi_get_host_nb_pstates
       double precision smpi_get_host_consumed_energy
+@MODULE_MPIF_OUT@
index 490a9e7..34b5e54 100644 (file)
@@ -226,63 +226,63 @@ typedef SMPI_Info* MPI_Info;
 #define MPI_STATUSES_IGNORE ((MPI_Status*)NULL)
 
 #define MPI_DATATYPE_NULL ((const MPI_Datatype)NULL)
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_CHAR;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_SHORT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_LONG;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_LONG_LONG;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_CHAR;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_SHORT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_LONG;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_LONG_LONG;
 #define MPI_LONG_LONG_INT MPI_LONG_LONG
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_SIGNED_CHAR;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UNSIGNED_CHAR;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UNSIGNED_SHORT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UNSIGNED;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UNSIGNED_LONG;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UNSIGNED_LONG_LONG;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_FLOAT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_DOUBLE;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_LONG_DOUBLE;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_WCHAR;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_C_BOOL;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INT8_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INT16_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INT32_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INT64_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UINT8_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_BYTE;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UINT16_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UINT32_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UINT64_T;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_C_FLOAT_COMPLEX;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_SIGNED_CHAR;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UNSIGNED_CHAR;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UNSIGNED_SHORT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UNSIGNED;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UNSIGNED_LONG;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UNSIGNED_LONG_LONG;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_FLOAT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_DOUBLE;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_LONG_DOUBLE;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_WCHAR;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_C_BOOL;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INT8_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INT16_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INT32_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INT64_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UINT8_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_BYTE;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UINT16_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UINT32_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UINT64_T;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_C_FLOAT_COMPLEX;
 #define MPI_C_COMPLEX MPI_C_FLOAT_COMPLEX
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_C_DOUBLE_COMPLEX;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_C_LONG_DOUBLE_COMPLEX;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_AINT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_OFFSET;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_LB;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_UB;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_C_DOUBLE_COMPLEX;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_C_LONG_DOUBLE_COMPLEX;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_AINT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_OFFSET;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_LB;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_UB;
 //The following are datatypes for the MPI functions MPI_MAXLOC  and MPI_MINLOC.
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_FLOAT_INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_LONG_INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_DOUBLE_INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_SHORT_INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_2INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_LONG_DOUBLE_INT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_2FLOAT;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_2DOUBLE;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_2LONG;//only for compatibility with Fortran
-
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_REAL;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_REAL4;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_REAL8;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_REAL16;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_COMPLEX8;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_COMPLEX16;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_COMPLEX32;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INTEGER1;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INTEGER2;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INTEGER4;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INTEGER8;
-XBT_PUBLIC_DATA( const MPI_Datatype ) MPI_INTEGER16;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_FLOAT_INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_LONG_INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_DOUBLE_INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_SHORT_INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_2INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_LONG_DOUBLE_INT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_2FLOAT;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_2DOUBLE;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_2LONG; // only for compatibility with Fortran
+
+XBT_PUBLIC_DATA const MPI_Datatype MPI_REAL;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_REAL4;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_REAL8;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_REAL16;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_COMPLEX8;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_COMPLEX16;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_COMPLEX32;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER1;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER2;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER4;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER8;
+XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER16;
 
 //for now we only send int values at max
 #define MPI_Count int
@@ -316,32 +316,32 @@ typedef void MPI_User_function(void *invec, void *inoutvec, int *len, MPI_Dataty
 typedef SMPI_Op *MPI_Op;
 
 #define MPI_OP_NULL ((MPI_Op)NULL)
-XBT_PUBLIC_DATA( MPI_Op ) MPI_MAX;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_MIN;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_MAXLOC;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_MINLOC;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_SUM;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_PROD;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_LAND;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_LOR;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_LXOR;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_BAND;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_BOR;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_BXOR;
+XBT_PUBLIC_DATA MPI_Op MPI_MAX;
+XBT_PUBLIC_DATA MPI_Op MPI_MIN;
+XBT_PUBLIC_DATA MPI_Op MPI_MAXLOC;
+XBT_PUBLIC_DATA MPI_Op MPI_MINLOC;
+XBT_PUBLIC_DATA MPI_Op MPI_SUM;
+XBT_PUBLIC_DATA MPI_Op MPI_PROD;
+XBT_PUBLIC_DATA MPI_Op MPI_LAND;
+XBT_PUBLIC_DATA MPI_Op MPI_LOR;
+XBT_PUBLIC_DATA MPI_Op MPI_LXOR;
+XBT_PUBLIC_DATA MPI_Op MPI_BAND;
+XBT_PUBLIC_DATA MPI_Op MPI_BOR;
+XBT_PUBLIC_DATA MPI_Op MPI_BXOR;
 //For accumulate
-XBT_PUBLIC_DATA( MPI_Op ) MPI_REPLACE;
-XBT_PUBLIC_DATA( MPI_Op ) MPI_NO_OP;
+XBT_PUBLIC_DATA MPI_Op MPI_REPLACE;
+XBT_PUBLIC_DATA MPI_Op MPI_NO_OP;
 
 typedef SMPI_Group* MPI_Group;
 
 #define MPI_GROUP_NULL ((MPI_Group)NULL)
 
-XBT_PUBLIC_DATA( MPI_Group ) MPI_GROUP_EMPTY;
+XBT_PUBLIC_DATA MPI_Group MPI_GROUP_EMPTY;
 
 typedef SMPI_Comm* MPI_Comm;
 
 #define MPI_COMM_NULL ((MPI_Comm)NULL)
-XBT_PUBLIC_DATA( MPI_Comm ) MPI_COMM_WORLD;
+XBT_PUBLIC_DATA MPI_Comm MPI_COMM_WORLD;
 #define MPI_COMM_SELF smpi_process_comm_self()
 
 typedef SMPI_Request* MPI_Request;
@@ -378,283 +378,291 @@ typedef int MPI_Win_delete_attr_function(MPI_Win win, int keyval, void* attribut
 typedef int (MPI_Datarep_extent_function)(MPI_Datatype, MPI_Aint *, void *);
 typedef int (MPI_Datarep_conversion_function)(void *, MPI_Datatype, int, void *, MPI_Offset, void *);
 
-MPI_CALL(XBT_PUBLIC(int), MPI_Init, (int *argc, char ***argv));
-MPI_CALL(XBT_PUBLIC(int), MPI_Finalize, (void));
-MPI_CALL(XBT_PUBLIC(int), MPI_Finalized, (int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Init_thread, (int *argc, char ***argv, int required, int *provided));
-MPI_CALL(XBT_PUBLIC(int), MPI_Initialized, (int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Query_thread, (int *provided));
-MPI_CALL(XBT_PUBLIC(int), MPI_Is_thread_main, (int *flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_version, (int *version,int *subversion));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_library_version, (char *version,int *len));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_processor_name, (char *name, int *resultlen));
-MPI_CALL(XBT_PUBLIC(int), MPI_Abort, (MPI_Comm comm, int errorcode));
-MPI_CALL(XBT_PUBLIC(int), MPI_Alloc_mem, (MPI_Aint size, MPI_Info info, void *baseptr));
-MPI_CALL(XBT_PUBLIC(int), MPI_Free_mem, (void *base));
-MPI_CALL(XBT_PUBLIC(double), MPI_Wtime, (void));
-MPI_CALL(XBT_PUBLIC(double), MPI_Wtick,(void));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Address, (void *location, MPI_Aint * address));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_address, (void *location, MPI_Aint * address));
-MPI_CALL(XBT_PUBLIC(int), MPI_Error_class, (int errorcode, int* errorclass));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Attr_delete, (MPI_Comm comm, int keyval));
-MPI_CALL(XBT_PUBLIC(int), MPI_Attr_get, (MPI_Comm comm, int keyval, void* attr_value, int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Attr_put, (MPI_Comm comm, int keyval, void* attr_value));
-MPI_CALL(XBT_PUBLIC(int), MPI_Keyval_create, (MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval,
-                              void* extra_state));
-MPI_CALL(XBT_PUBLIC(int), MPI_Keyval_free, (int* keyval));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_free, (MPI_Datatype * datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_size, (MPI_Datatype datatype, int *size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_size_x, (MPI_Datatype datatype, MPI_Count *size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_extent, (MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_true_extent, (MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_extent, (MPI_Datatype datatype, MPI_Aint * extent));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_lb, (MPI_Datatype datatype, MPI_Aint * disp));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_ub, (MPI_Datatype datatype, MPI_Aint * disp));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_commit, (MPI_Datatype* datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_hindexed,(int count, int* blocklens, MPI_Aint* indices,
-                            MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_hindexed, (int count, int* blocklens, MPI_Aint* indices,
-                            MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_hindexed_block, (int count, int blocklength, MPI_Aint* indices,
-                            MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_hvector, (int count, int blocklen, MPI_Aint stride,
-                             MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_hvector, (int count, int blocklen, MPI_Aint stride,
-                             MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_indexed, (int count, int* blocklens, int* indices,
-                             MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_indexed, (int count, int* blocklens, int* indices,
-                             MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_indexed_block, (int count, int blocklength, int* indices,
-                             MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_struct, (int count, int* blocklens, MPI_Aint* indices,
-                             MPI_Datatype* old_types, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_struct, (int count, int* blocklens, MPI_Aint* indices,
-                             MPI_Datatype* old_types, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_vector, (int count, int blocklen, int stride,
-                             MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_contiguous, (int count, MPI_Datatype old_type, MPI_Datatype* newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_resized ,(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent,
-                                                    MPI_Datatype *newtype));
-MPI_CALL(XBT_PUBLIC(MPI_Datatype), MPI_Type_f2c,(MPI_Fint datatype));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Type_c2f,(MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_count, (MPI_Status * status, MPI_Datatype datatype, int *count));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_attr, (MPI_Datatype type, int type_keyval, void *attribute_val, int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_set_attr, (MPI_Datatype type, int type_keyval, void *att));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_delete_attr, (MPI_Datatype type, int comm_keyval));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_keyval,(MPI_Type_copy_attr_function* copy_fn,
-                              MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_free_keyval,(int* keyval));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_dup,(MPI_Datatype datatype,MPI_Datatype *newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_set_name,(MPI_Datatype  datatype, char * name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_name,(MPI_Datatype  datatype, char * name, int* len));
-
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Pack, (void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount,
-                              int* position, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Pack_size, (int incount, MPI_Datatype datatype, MPI_Comm comm, int* size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Unpack, (void* inbuf, int insize, int* position, void* outbuf, int outcount,
-                              MPI_Datatype type, MPI_Comm comm));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Op_create, (MPI_User_function * function, int commute, MPI_Op * op));
-MPI_CALL(XBT_PUBLIC(int), MPI_Op_free, (MPI_Op * op));
-MPI_CALL(XBT_PUBLIC(int), MPI_Op_commutative, (MPI_Op op, int *commute));
-MPI_CALL(XBT_PUBLIC(MPI_Op), MPI_Op_f2c,(MPI_Fint op));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Op_c2f,(MPI_Op op));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_free, (MPI_Group * group));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_size, (MPI_Group group, int *size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_rank, (MPI_Group group, int *rank));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_translate_ranks, (MPI_Group group1, int n, int *ranks1, MPI_Group group2,
-                             int *ranks2));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_compare, (MPI_Group group1, MPI_Group group2, int *result));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_union, (MPI_Group group1, MPI_Group group2, MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_intersection, (MPI_Group group1, MPI_Group group2, MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_difference, (MPI_Group group1, MPI_Group group2, MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_incl, (MPI_Group group, int n, int *ranks, MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_excl, (MPI_Group group, int n, int *ranks, MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_range_incl, (MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(int), MPI_Group_range_excl, (MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup));
-MPI_CALL(XBT_PUBLIC(MPI_Group), MPI_Group_f2c,(MPI_Fint group));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Group_c2f,(MPI_Group group));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_rank, (MPI_Comm comm, int *rank));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_size, (MPI_Comm comm, int *size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_name, (MPI_Comm comm, char* name, int* len));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_set_name, (MPI_Comm comm, char* name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_dup, (MPI_Comm comm, MPI_Comm * newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_attr, (MPI_Comm comm, int comm_keyval, void *attribute_val, int *flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_set_attr, (MPI_Comm comm, int comm_keyval, void *attribute_val));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_delete_attr, (MPI_Comm comm, int comm_keyval));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create_keyval,(MPI_Comm_copy_attr_function* copy_fn,
-                              MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_free_keyval,(int* keyval));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_group, (MPI_Comm comm, MPI_Group * group));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_compare, (MPI_Comm comm1, MPI_Comm comm2, int *result));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create, (MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create_group, (MPI_Comm comm, MPI_Group group, int tag, MPI_Comm * newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_free, (MPI_Comm * comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_disconnect, (MPI_Comm * comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_split, (MPI_Comm comm, int color, int key, MPI_Comm* comm_out));
-MPI_CALL(XBT_PUBLIC(MPI_Comm), MPI_Comm_f2c,(MPI_Fint comm));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Comm_c2f,(MPI_Comm comm));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Send_init, (void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm,
-                             MPI_Request * request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Recv_init, (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm,
-                             MPI_Request * request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Start, (MPI_Request * request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Startall, (int count, MPI_Request * requests));
-MPI_CALL(XBT_PUBLIC(int), MPI_Request_free, (MPI_Request * request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Irecv, (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm,
-                             MPI_Request * request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Isend, (void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm,
-                             MPI_Request * request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Recv, (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm,
-                             MPI_Status * status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Send, (void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Ssend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Ssend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag,
-                              MPI_Comm comm, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Issend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
-                              MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Sendrecv, (void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag,
-                             void *recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag,
-                             MPI_Comm comm, MPI_Status * status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Sendrecv_replace, (void *buf, int count, MPI_Datatype datatype, int dst,
-                             int sendtag, int src, int recvtag, MPI_Comm comm, MPI_Status * status));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Test, (MPI_Request * request, int *flag, MPI_Status* status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Testany, (int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Testall, (int count, MPI_Request* requests, int* flag, MPI_Status* statuses));
-MPI_CALL(XBT_PUBLIC(int), MPI_Testsome, (int incount, MPI_Request requests[], int *outcount, int *indices,
-                             MPI_Status status[]));
-MPI_CALL(XBT_PUBLIC(int), MPI_Wait, (MPI_Request * request, MPI_Status * status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Waitany, (int count, MPI_Request requests[], int *index, MPI_Status * status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Waitall, (int count, MPI_Request requests[], MPI_Status status[]));
-MPI_CALL(XBT_PUBLIC(int), MPI_Waitsome, (int incount, MPI_Request requests[], int *outcount, int *indices,
-                             MPI_Status status[]));
-MPI_CALL(XBT_PUBLIC(int), MPI_Iprobe, (int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Probe, (int source, int tag, MPI_Comm comm, MPI_Status* status));
-MPI_CALL(XBT_PUBLIC(MPI_Request), MPI_Request_f2c,(MPI_Fint request));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Request_c2f,(MPI_Request request));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Bcast, (void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Barrier, (MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Gather, (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                             int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Gatherv, (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                             int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Allgather, (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                             int recvcount, MPI_Datatype recvtype, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Allgatherv, (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                             int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Scatter, (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                             int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Scatterv, (void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype,
-                             void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Reduce, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
-                             int root, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Allreduce, (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
-                             MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Scan, (void *sendbuf, void *recvbuf, int count,MPI_Datatype datatype, MPI_Op op,
-                             MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Exscan,(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
-                                      MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Reduce_scatter, (void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype,
-                             MPI_Op op, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Reduce_scatter_block, (void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype,
-                             MPI_Op op, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Alltoall, (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                             int recvcount, MPI_Datatype recvtype, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Alltoallv, (void *sendbuf, int *sendcounts, int *senddisps, MPI_Datatype sendtype,
-                             void *recvbuf, int *recvcounts, int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Reduce_local,(void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_create,( MPI_Info *info));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_set,( MPI_Info info, char *key, char *value));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_get,(MPI_Info info,char *key,int valuelen, char *value, int *flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_free,( MPI_Info *info));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_delete,( MPI_Info info,  char *key));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_dup,(MPI_Info info, MPI_Info *newinfo));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_get_nkeys,( MPI_Info info, int *nkeys));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_get_nthkey,( MPI_Info info, int n, char *key));
-MPI_CALL(XBT_PUBLIC(int), MPI_Info_get_valuelen,( MPI_Info info, char *key, int *valuelen, int *flag));
-MPI_CALL(XBT_PUBLIC(MPI_Info), MPI_Info_f2c,(MPI_Fint info));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Info_c2f,(MPI_Info info));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_free,( MPI_Win* win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_create,( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm,
-                              MPI_Win *win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_allocate,( MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void *base,
-                              MPI_Win *win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_create_dynamic,( MPI_Info info, MPI_Comm comm,
-                              MPI_Win *win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_attach,(MPI_Win win, void *base, MPI_Aint size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_detach,(MPI_Win win, void *base));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_set_name,(MPI_Win  win, char * name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_name,(MPI_Win  win, char * name, int* len));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_set_info,(MPI_Win  win, MPI_Info info));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_info,(MPI_Win  win, MPI_Info* info));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_group,(MPI_Win  win, MPI_Group * group));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_fence,( int assert,  MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_get_attr, (MPI_Win type, int type_keyval, void *attribute_val, int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_set_attr, (MPI_Win type, int type_keyval, void *att));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_delete_attr, (MPI_Win type, int comm_keyval));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_create_keyval,(MPI_Win_copy_attr_function* copy_fn,
-                              MPI_Win_delete_attr_function* delete_fn, int* keyval, void* extra_state));
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_free_keyval,(int* keyval));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_complete,(MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_post,(MPI_Group group, int assert, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_start,(MPI_Group group, int assert, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_wait,(MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_lock,(int lock_type, int rank, int assert, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_lock_all,(int assert, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_unlock,(int rank, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_unlock_all,(MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_flush,(int rank, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_flush_local,(int rank, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_flush_all,(MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_flush_local_all,(MPI_Win win));
-MPI_CALL(XBT_PUBLIC(MPI_Win), MPI_Win_f2c,(MPI_Fint win));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Win_c2f,(MPI_Win win));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Get,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
-    MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Put,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
-    MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Accumulate,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
-    int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_accumulate,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
-    void* result_addr, int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
-    int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Rget,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
-    MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Rput,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
-    MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Raccumulate,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
-    int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Rget_accumulate,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
-    void* result_addr, int result_count, MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
-    int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Fetch_and_op,( void *origin_addr, void* result_addr, MPI_Datatype datatype,
-    int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win));
-MPI_CALL(XBT_PUBLIC(int), MPI_Compare_and_swap, (void *origin_addr, void *compare_addr,
-        void *result_addr, MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, MPI_Win win));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_coords, (MPI_Comm comm, int rank, int maxdims, int* coords));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_create, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder,
-                                            MPI_Comm* comm_cart));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_get, (MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_rank, (MPI_Comm comm, int* coords, int* rank));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_shift, (MPI_Comm comm, int direction, int displ, int* source, int* dest));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_sub, (MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cartdim_get, (MPI_Comm comm, int* ndims));
-MPI_CALL(XBT_PUBLIC(int), MPI_Dims_create, (int nnodes, int ndims, int* dims));
-
+MPI_CALL(XBT_PUBLIC int, MPI_Init, (int* argc, char*** argv));
+MPI_CALL(XBT_PUBLIC int, MPI_Finalize, (void));
+MPI_CALL(XBT_PUBLIC int, MPI_Finalized, (int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Init_thread, (int* argc, char*** argv, int required, int* provided));
+MPI_CALL(XBT_PUBLIC int, MPI_Initialized, (int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Query_thread, (int* provided));
+MPI_CALL(XBT_PUBLIC int, MPI_Is_thread_main, (int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_version, (int* version, int* subversion));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_library_version, (char* version, int* len));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_processor_name, (char* name, int* resultlen));
+MPI_CALL(XBT_PUBLIC int, MPI_Abort, (MPI_Comm comm, int errorcode));
+MPI_CALL(XBT_PUBLIC int, MPI_Alloc_mem, (MPI_Aint size, MPI_Info info, void* baseptr));
+MPI_CALL(XBT_PUBLIC int, MPI_Free_mem, (void* base));
+MPI_CALL(XBT_PUBLIC double, MPI_Wtime, (void));
+MPI_CALL(XBT_PUBLIC double, MPI_Wtick, (void));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Address, (void* location, MPI_Aint* address));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_address, (void* location, MPI_Aint* address));
+MPI_CALL(XBT_PUBLIC int, MPI_Error_class, (int errorcode, int* errorclass));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Attr_delete, (MPI_Comm comm, int keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Attr_get, (MPI_Comm comm, int keyval, void* attr_value, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Attr_put, (MPI_Comm comm, int keyval, void* attr_value));
+MPI_CALL(XBT_PUBLIC int, MPI_Keyval_create,
+         (MPI_Copy_function * copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state));
+MPI_CALL(XBT_PUBLIC int, MPI_Keyval_free, (int* keyval));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Type_free, (MPI_Datatype * datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_size, (MPI_Datatype datatype, int* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_size_x, (MPI_Datatype datatype, MPI_Count* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_get_extent, (MPI_Datatype datatype, MPI_Aint* lb, MPI_Aint* extent));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_get_true_extent, (MPI_Datatype datatype, MPI_Aint* lb, MPI_Aint* extent));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_extent, (MPI_Datatype datatype, MPI_Aint* extent));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_lb, (MPI_Datatype datatype, MPI_Aint* disp));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_ub, (MPI_Datatype datatype, MPI_Aint* disp));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_commit, (MPI_Datatype * datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_hindexed,
+         (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hindexed,
+         (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hindexed_block,
+         (int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_hvector,
+         (int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hvector,
+         (int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_indexed,
+         (int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_indexed,
+         (int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_indexed_block,
+         (int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_struct,
+         (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_struct,
+         (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_vector,
+         (int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_contiguous, (int count, MPI_Datatype old_type, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_resized,
+         (MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC MPI_Datatype, MPI_Type_f2c, (MPI_Fint datatype));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Type_c2f, (MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_count, (MPI_Status * status, MPI_Datatype datatype, int* count));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_get_attr, (MPI_Datatype type, int type_keyval, void* attribute_val, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_set_attr, (MPI_Datatype type, int type_keyval, void* att));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_delete_attr, (MPI_Datatype type, int comm_keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_keyval,
+         (MPI_Type_copy_attr_function * copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+          void* extra_state));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_free_keyval, (int* keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_dup, (MPI_Datatype datatype, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_set_name, (MPI_Datatype datatype, char* name));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_get_name, (MPI_Datatype datatype, char* name, int* len));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Pack,
+         (void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Pack_size, (int incount, MPI_Datatype datatype, MPI_Comm comm, int* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Unpack,
+         (void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Op_create, (MPI_User_function * function, int commute, MPI_Op* op));
+MPI_CALL(XBT_PUBLIC int, MPI_Op_free, (MPI_Op * op));
+MPI_CALL(XBT_PUBLIC int, MPI_Op_commutative, (MPI_Op op, int* commute));
+MPI_CALL(XBT_PUBLIC MPI_Op, MPI_Op_f2c, (MPI_Fint op));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Op_c2f, (MPI_Op op));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Group_free, (MPI_Group * group));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_size, (MPI_Group group, int* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_rank, (MPI_Group group, int* rank));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_translate_ranks,
+         (MPI_Group group1, int n, int* ranks1, MPI_Group group2, int* ranks2));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_compare, (MPI_Group group1, MPI_Group group2, int* result));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_union, (MPI_Group group1, MPI_Group group2, MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_intersection, (MPI_Group group1, MPI_Group group2, MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_difference, (MPI_Group group1, MPI_Group group2, MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_incl, (MPI_Group group, int n, int* ranks, MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_excl, (MPI_Group group, int n, int* ranks, MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_range_incl, (MPI_Group group, int n, int ranges[][3], MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC int, MPI_Group_range_excl, (MPI_Group group, int n, int ranges[][3], MPI_Group* newgroup));
+MPI_CALL(XBT_PUBLIC MPI_Group, MPI_Group_f2c, (MPI_Fint group));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Group_c2f, (MPI_Group group));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_rank, (MPI_Comm comm, int* rank));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_size, (MPI_Comm comm, int* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_name, (MPI_Comm comm, char* name, int* len));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_name, (MPI_Comm comm, char* name));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_dup, (MPI_Comm comm, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_attr, (MPI_Comm comm, int comm_keyval, void* attribute_val, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_attr, (MPI_Comm comm, int comm_keyval, void* attribute_val));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_delete_attr, (MPI_Comm comm, int comm_keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_create_keyval,
+         (MPI_Comm_copy_attr_function * copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+          void* extra_state));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_free_keyval, (int* keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_group, (MPI_Comm comm, MPI_Group* group));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_compare, (MPI_Comm comm1, MPI_Comm comm2, int* result));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_create, (MPI_Comm comm, MPI_Group group, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_create_group, (MPI_Comm comm, MPI_Group group, int tag, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_free, (MPI_Comm * comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_disconnect, (MPI_Comm * comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_split, (MPI_Comm comm, int color, int key, MPI_Comm* comm_out));
+MPI_CALL(XBT_PUBLIC MPI_Comm, MPI_Comm_f2c, (MPI_Fint comm));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Comm_c2f, (MPI_Comm comm));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Send_init,
+         (void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Recv_init,
+         (void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Start, (MPI_Request * request));
+MPI_CALL(XBT_PUBLIC int, MPI_Startall, (int count, MPI_Request* requests));
+MPI_CALL(XBT_PUBLIC int, MPI_Request_free, (MPI_Request * request));
+MPI_CALL(XBT_PUBLIC int, MPI_Irecv,
+         (void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Isend,
+         (void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Recv,
+         (void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Send, (void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Ssend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Ssend_init,
+         (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Issend,
+         (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Sendrecv,
+         (void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf, int recvcount,
+          MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Sendrecv_replace, (void* buf, int count, MPI_Datatype datatype, int dst, int sendtag,
+                                                int src, int recvtag, MPI_Comm comm, MPI_Status* status));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Test, (MPI_Request * request, int* flag, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Testany, (int count, MPI_Request requests[], int* index, int* flag, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Testall, (int count, MPI_Request* requests, int* flag, MPI_Status* statuses));
+MPI_CALL(XBT_PUBLIC int, MPI_Testsome,
+         (int incount, MPI_Request requests[], int* outcount, int* indices, MPI_Status status[]));
+MPI_CALL(XBT_PUBLIC int, MPI_Wait, (MPI_Request * request, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Waitany, (int count, MPI_Request requests[], int* index, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Waitall, (int count, MPI_Request requests[], MPI_Status status[]));
+MPI_CALL(XBT_PUBLIC int, MPI_Waitsome,
+         (int incount, MPI_Request requests[], int* outcount, int* indices, MPI_Status status[]));
+MPI_CALL(XBT_PUBLIC int, MPI_Iprobe, (int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Probe, (int source, int tag, MPI_Comm comm, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC MPI_Request, MPI_Request_f2c, (MPI_Fint request));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Request_c2f, (MPI_Request request));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Bcast, (void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Barrier, (MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Gather, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
+                                      MPI_Datatype recvtype, int root, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Gatherv, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
+                                       int* recvcounts, int* displs, MPI_Datatype recvtype, int root, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Allgather, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
+                                         int recvcount, MPI_Datatype recvtype, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Allgatherv, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
+                                          int* recvcounts, int* displs, MPI_Datatype recvtype, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Scatter, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
+                                       int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Scatterv, (void* sendbuf, int* sendcounts, int* displs, MPI_Datatype sendtype,
+                                        void* recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Reduce,
+         (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Allreduce,
+         (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Scan,
+         (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Exscan,
+         (void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Reduce_scatter,
+         (void* sendbuf, void* recvbuf, int* recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Reduce_scatter_block,
+         (void* sendbuf, void* recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Alltoall, (void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
+                                        int recvcount, MPI_Datatype recvtype, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Alltoallv,
+         (void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype sendtype, void* recvbuf, int* recvcounts,
+          int* recvdisps, MPI_Datatype recvtype, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Reduce_local, (void* inbuf, void* inoutbuf, int count, MPI_Datatype datatype, MPI_Op op));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Info_create, (MPI_Info * info));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_set, (MPI_Info info, char* key, char* value));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_get, (MPI_Info info, char* key, int valuelen, char* value, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_free, (MPI_Info * info));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_delete, (MPI_Info info, char* key));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_dup, (MPI_Info info, MPI_Info* newinfo));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_get_nkeys, (MPI_Info info, int* nkeys));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_get_nthkey, (MPI_Info info, int n, char* key));
+MPI_CALL(XBT_PUBLIC int, MPI_Info_get_valuelen, (MPI_Info info, char* key, int* valuelen, int* flag));
+MPI_CALL(XBT_PUBLIC MPI_Info, MPI_Info_f2c, (MPI_Fint info));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Info_c2f, (MPI_Info info));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Win_free, (MPI_Win * win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_create,
+         (void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win* win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_allocate,
+         (MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void* base, MPI_Win* win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_create_dynamic, (MPI_Info info, MPI_Comm comm, MPI_Win* win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_attach, (MPI_Win win, void* base, MPI_Aint size));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_detach, (MPI_Win win, void* base));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_set_name, (MPI_Win win, char* name));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_get_name, (MPI_Win win, char* name, int* len));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_set_info, (MPI_Win win, MPI_Info info));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_get_info, (MPI_Win win, MPI_Info* info));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_get_group, (MPI_Win win, MPI_Group* group));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_fence, (int assert, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_get_attr, (MPI_Win type, int type_keyval, void* attribute_val, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_set_attr, (MPI_Win type, int type_keyval, void* att));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_delete_attr, (MPI_Win type, int comm_keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_create_keyval,
+         (MPI_Win_copy_attr_function * copy_fn, MPI_Win_delete_attr_function* delete_fn, int* keyval,
+          void* extra_state));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_free_keyval, (int* keyval));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_complete, (MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_post, (MPI_Group group, int assert, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_start, (MPI_Group group, int assert, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_wait, (MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_lock, (int lock_type, int rank, int assert, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_lock_all, (int assert, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_unlock, (int rank, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_unlock_all, (MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_flush, (int rank, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_flush_local, (int rank, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_flush_all, (MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_flush_local_all, (MPI_Win win));
+MPI_CALL(XBT_PUBLIC MPI_Win, MPI_Win_f2c, (MPI_Fint win));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Win_c2f, (MPI_Win win));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Get, (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
+                                   MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Put, (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
+                                   MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Accumulate,
+         (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp,
+          int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_accumulate,
+         (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, void* result_addr, int result_count,
+          MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
+          MPI_Datatype target_datatype, MPI_Op op, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Rget,
+         (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp,
+          int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Rput,
+         (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp,
+          int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Raccumulate,
+         (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp,
+          int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Rget_accumulate,
+         (void* origin_addr, int origin_count, MPI_Datatype origin_datatype, void* result_addr, int result_count,
+          MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp, int target_count,
+          MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Fetch_and_op, (void* origin_addr, void* result_addr, MPI_Datatype datatype,
+                                            int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win));
+MPI_CALL(XBT_PUBLIC int, MPI_Compare_and_swap,
+         (void* origin_addr, void* compare_addr, void* result_addr, MPI_Datatype datatype, int target_rank,
+          MPI_Aint target_disp, MPI_Win win));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_coords, (MPI_Comm comm, int rank, int maxdims, int* coords));
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_create,
+         (MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart));
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_get, (MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords));
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_rank, (MPI_Comm comm, int* coords, int* rank));
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_shift, (MPI_Comm comm, int direction, int displ, int* source, int* dest));
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_sub, (MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new));
+MPI_CALL(XBT_PUBLIC int, MPI_Cartdim_get, (MPI_Comm comm, int* ndims));
+MPI_CALL(XBT_PUBLIC int, MPI_Dims_create, (int nnodes, int ndims, int* dims));
 
 //FIXME: these are not yet implemented
 
@@ -699,220 +707,247 @@ typedef MPI_Comm_errhandler_function MPI_Comm_errhandler_fn;
 typedef MPI_File_errhandler_function MPI_File_errhandler_fn;
 typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn;
 #define MPI_INFO_ENV 1
-XBT_PUBLIC_DATA( const MPI_Datatype )  MPI_PACKED;
-XBT_PUBLIC_DATA(MPI_Errhandler*)  MPI_ERRORS_RETURN;
-XBT_PUBLIC_DATA(MPI_Errhandler*)  MPI_ERRORS_ARE_FATAL;
-XBT_PUBLIC_DATA(MPI_Errhandler*)  MPI_ERRHANDLER_NULL;
-
-MPI_CALL(XBT_PUBLIC(MPI_Errhandler), MPI_Errhandler_f2c,(MPI_Fint errhandler));
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_Errhandler_c2f,(MPI_Errhandler errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cart_map, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank));
-MPI_CALL(XBT_PUBLIC(int), MPI_Graph_create, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder,
-                                             MPI_Comm* comm_graph));
-MPI_CALL(XBT_PUBLIC(int), MPI_Graph_get, (MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges));
-MPI_CALL(XBT_PUBLIC(int), MPI_Graph_map, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank));
-MPI_CALL(XBT_PUBLIC(int), MPI_Graph_neighbors, (MPI_Comm comm, int rank, int maxneighbors, int* neighbors));
-MPI_CALL(XBT_PUBLIC(int), MPI_Graph_neighbors_count, (MPI_Comm comm, int rank, int* nneighbors));
-MPI_CALL(XBT_PUBLIC(int), MPI_Graphdims_get, (MPI_Comm comm, int* nnodes, int* nedges));
-MPI_CALL(XBT_PUBLIC(int), MPI_Topo_test, (MPI_Comm comm, int* top_type));
-MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_create, (MPI_Handler_function* function, MPI_Errhandler* errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_free, (MPI_Errhandler* errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_get, (MPI_Comm comm, MPI_Errhandler* errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Error_string, (int errorcode, char* string, int* resultlen));
-MPI_CALL(XBT_PUBLIC(int), MPI_Errhandler_set, (MPI_Comm comm, MPI_Errhandler errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_set_errhandler, (MPI_Comm comm, MPI_Errhandler errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_errhandler, (MPI_Comm comm, MPI_Errhandler *errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create_errhandler,( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_call_errhandler,(MPI_Comm comm,int errorcode));
-MPI_CALL(XBT_PUBLIC(int), MPI_Add_error_class,( int *errorclass));
-MPI_CALL(XBT_PUBLIC(int), MPI_Add_error_code,(  int errorclass, int *errorcode));
-MPI_CALL(XBT_PUBLIC(int), MPI_Add_error_string,( int errorcode, char *string));
-MPI_CALL(XBT_PUBLIC(int), MPI_Cancel, (MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Buffer_attach, (void* buffer, int size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Buffer_detach, (void* buffer, int* size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_test_inter, (MPI_Comm comm, int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Intercomm_create, (MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm,
-                              int remote_leader, int tag, MPI_Comm* comm_out));
-MPI_CALL(XBT_PUBLIC(int), MPI_Intercomm_merge, (MPI_Comm comm, int high, MPI_Comm* comm_out));
-MPI_CALL(XBT_PUBLIC(int), MPI_Bsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Bsend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag,
-                              MPI_Comm comm, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Ibsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
-                              MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_remote_group, (MPI_Comm comm, MPI_Group* group));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_remote_size, (MPI_Comm comm, int* size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Rsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Rsend_init, (void* buf, int count, MPI_Datatype datatype, int dest, int tag,
-                              MPI_Comm comm, MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Irsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
-                              MPI_Request* request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Test_cancelled, (MPI_Status* status, int* flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Get_elements, (MPI_Status* status, MPI_Datatype datatype, int* elements));
-MPI_CALL(XBT_PUBLIC(int), MPI_Pcontrol, (const int level, ... ));
-
-MPI_CALL(XBT_PUBLIC(int), MPI_Win_set_errhandler, (MPI_Win win, MPI_Errhandler errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_envelope,(MPI_Datatype datatype,int *num_integers,int *num_addresses,
-                            int *num_datatypes, int *combiner));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_get_contents,(MPI_Datatype datatype, int max_integers, int max_addresses,
-                            int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
-                            MPI_Datatype *array_of_datatypes));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_darray,(int size, int rank, int ndims, int* array_of_gsizes,
-                            int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
-                            int order, MPI_Datatype oldtype, MPI_Datatype *newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Pack_external_size, (char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size));
-MPI_CALL(XBT_PUBLIC(int), MPI_Pack_external, (char *datarep, void *inbuf, int incount, MPI_Datatype datatype,
-                                              void *outbuf, MPI_Aint outcount, MPI_Aint *position));
-MPI_CALL(XBT_PUBLIC(int), MPI_Unpack_external, (char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position,
-                                                void *outbuf, int outcount, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_create_subarray,(int ndims,int *array_of_sizes, int *array_of_subsizes,
-                              int *array_of_starts, int order, MPI_Datatype oldtype, MPI_Datatype *newtype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Type_match_size,(int typeclass,int size,MPI_Datatype *datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_Alltoallw, ( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
-                              void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes, MPI_Comm comm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_set_info, (MPI_Comm comm, MPI_Info info));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_info, (MPI_Comm comm, MPI_Info* info));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_dup_with_info,(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_split_type,(MPI_Comm comm, int split_type, int key, MPI_Info info,
-                                               MPI_Comm *newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_connect,(char *port_name, MPI_Info info, int root, MPI_Comm comm,
-                                            MPI_Comm *newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Request_get_status,( MPI_Request request, int *flag, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_Grequest_start,(MPI_Grequest_query_function *query_fn,
-                                              MPI_Grequest_free_function *free_fn,
-                                              MPI_Grequest_cancel_function *cancel_fn,
-                                              void *extra_state, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Grequest_complete,( MPI_Request request));
-MPI_CALL(XBT_PUBLIC(int), MPI_Status_set_cancelled,(MPI_Status *status,int flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_Status_set_elements,( MPI_Status *status, MPI_Datatype datatype, int count));
-MPI_CALL(XBT_PUBLIC(int), MPI_Unpublish_name,( char *service_name, MPI_Info info, char *port_name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Publish_name,( char *service_name, MPI_Info info, char *port_name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Lookup_name,( char *service_name, MPI_Info info, char *port_name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_join,( int fd, MPI_Comm *intercomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Open_port,( MPI_Info info, char *port_name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Close_port,( char *port_name));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_accept,(char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_spawn,(char *command, char **argv, int maxprocs, MPI_Info info, int root,
-                                          MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_spawn_multiple,(int count, char **array_of_commands, char*** array_of_argv,
-                                                   int* array_of_maxprocs, MPI_Info* array_of_info, int root,
-                                                   MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes));
-MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_parent,( MPI_Comm *parent));
-MPI_CALL(XBT_PUBLIC(int),  MPI_Win_test,(MPI_Win win, int *flag));
-
-MPI_CALL(XBT_PUBLIC(MPI_Fint), MPI_File_c2f,(MPI_File file));
-MPI_CALL(XBT_PUBLIC(MPI_File), MPI_File_f2c,(MPI_Fint file));
-MPI_CALL(XBT_PUBLIC(int), MPI_Register_datarep,(char *datarep, MPI_Datarep_conversion_function *read_conversion_fn, MPI_Datarep_conversion_function *write_conversion_fn, MPI_Datarep_extent_function *dtype_file_extent_fn, void *extra_state));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_call_errhandler,(MPI_File fh, int errorcode));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_create_errhandler,(MPI_File_errhandler_function *function, MPI_Errhandler *errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_set_errhandler,( MPI_File file, MPI_Errhandler errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_errhandler,( MPI_File file, MPI_Errhandler *errhandler));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_open,(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_close,(MPI_File *fh));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_delete,(char *filename, MPI_Info info));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_set_size,(MPI_File fh, MPI_Offset size));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_preallocate,(MPI_File fh, MPI_Offset size));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_size,(MPI_File fh, MPI_Offset *size));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_group,(MPI_File fh, MPI_Group *group));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_amode,(MPI_File fh, int *amode));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_set_info,(MPI_File fh, MPI_Info info));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_info,(MPI_File fh, MPI_Info *info_used));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_set_view,(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, char *datarep, MPI_Info info));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_view,(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype, MPI_Datatype *filetype, char *datarep));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at_all,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at,(MPI_File fh, MPI_Offset offset, void *buf,int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at_all,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iread_at,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iwrite_at,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iread_at_all,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iwrite_at_all,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_all,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_all,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iread,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iwrite,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iread_all,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iwrite_all,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_seek,(MPI_File fh, MPI_Offset offset, int whenace));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_position,(MPI_File fh, MPI_Offset *offset));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_byte_offset,(MPI_File fh, MPI_Offset offset, MPI_Offset *disp));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_shared,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_shared,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iread_shared,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_iwrite_shared,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Request *request));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_ordered,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_ordered,(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_seek_shared,(MPI_File fh, MPI_Offset offset, int whence));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_position_shared,(MPI_File fh, MPI_Offset *offset));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at_all_begin,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_at_all_end,(MPI_File fh, void *buf, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at_all_begin,(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_at_all_end,(MPI_File fh, void *buf, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_all_begin,(MPI_File fh, void *buf, int count, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_all_end,(MPI_File fh, void *buf, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_all_begin,(MPI_File fh, void *buf, int count, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_all_end,(MPI_File fh, void *buf, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_ordered_begin,(MPI_File fh, void *buf, int count, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_read_ordered_end,(MPI_File fh, void *buf, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_ordered_begin,(MPI_File fh, void *buf, int count, MPI_Datatype datatype));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_write_ordered_end,(MPI_File fh, void *buf, MPI_Status *status));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_type_extent,(MPI_File fh, MPI_Datatype datatype, MPI_Aint *extent));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_set_atomicity,(MPI_File fh, int flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_get_atomicity,(MPI_File fh, int *flag));
-MPI_CALL(XBT_PUBLIC(int), MPI_File_sync,(MPI_File fh));
-
+XBT_PUBLIC_DATA const MPI_Datatype MPI_PACKED;
+XBT_PUBLIC_DATA MPI_Errhandler* MPI_ERRORS_RETURN;
+XBT_PUBLIC_DATA MPI_Errhandler* MPI_ERRORS_ARE_FATAL;
+XBT_PUBLIC_DATA MPI_Errhandler* MPI_ERRHANDLER_NULL;
+
+MPI_CALL(XBT_PUBLIC MPI_Errhandler, MPI_Errhandler_f2c, (MPI_Fint errhandler));
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_Errhandler_c2f, (MPI_Errhandler errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Cart_map, (MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank));
+MPI_CALL(XBT_PUBLIC int, MPI_Graph_create,
+         (MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph));
+MPI_CALL(XBT_PUBLIC int, MPI_Graph_get, (MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges));
+MPI_CALL(XBT_PUBLIC int, MPI_Graph_map, (MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank));
+MPI_CALL(XBT_PUBLIC int, MPI_Graph_neighbors, (MPI_Comm comm, int rank, int maxneighbors, int* neighbors));
+MPI_CALL(XBT_PUBLIC int, MPI_Graph_neighbors_count, (MPI_Comm comm, int rank, int* nneighbors));
+MPI_CALL(XBT_PUBLIC int, MPI_Graphdims_get, (MPI_Comm comm, int* nnodes, int* nedges));
+MPI_CALL(XBT_PUBLIC int, MPI_Topo_test, (MPI_Comm comm, int* top_type));
+MPI_CALL(XBT_PUBLIC int, MPI_Errhandler_create, (MPI_Handler_function * function, MPI_Errhandler* errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Errhandler_free, (MPI_Errhandler * errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Errhandler_get, (MPI_Comm comm, MPI_Errhandler* errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Error_string, (int errorcode, char* string, int* resultlen));
+MPI_CALL(XBT_PUBLIC int, MPI_Errhandler_set, (MPI_Comm comm, MPI_Errhandler errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_errhandler, (MPI_Comm comm, MPI_Errhandler errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_errhandler, (MPI_Comm comm, MPI_Errhandler* errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_create_errhandler, (MPI_Comm_errhandler_fn * function, MPI_Errhandler* errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_call_errhandler, (MPI_Comm comm, int errorcode));
+MPI_CALL(XBT_PUBLIC int, MPI_Add_error_class, (int* errorclass));
+MPI_CALL(XBT_PUBLIC int, MPI_Add_error_code, (int errorclass, int* errorcode));
+MPI_CALL(XBT_PUBLIC int, MPI_Add_error_string, (int errorcode, char* string));
+MPI_CALL(XBT_PUBLIC int, MPI_Cancel, (MPI_Request * request));
+MPI_CALL(XBT_PUBLIC int, MPI_Buffer_attach, (void* buffer, int size));
+MPI_CALL(XBT_PUBLIC int, MPI_Buffer_detach, (void* buffer, int* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_test_inter, (MPI_Comm comm, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Intercomm_create,
+         (MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out));
+MPI_CALL(XBT_PUBLIC int, MPI_Intercomm_merge, (MPI_Comm comm, int high, MPI_Comm* comm_out));
+MPI_CALL(XBT_PUBLIC int, MPI_Bsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Bsend_init,
+         (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Ibsend,
+         (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_remote_group, (MPI_Comm comm, MPI_Group* group));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_remote_size, (MPI_Comm comm, int* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Rsend, (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Rsend_init,
+         (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Irsend,
+         (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Test_cancelled, (MPI_Status * status, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Get_elements, (MPI_Status * status, MPI_Datatype datatype, int* elements));
+MPI_CALL(XBT_PUBLIC int, MPI_Pcontrol, (const int level, ...));
+
+MPI_CALL(XBT_PUBLIC int, MPI_Win_set_errhandler, (MPI_Win win, MPI_Errhandler errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_get_envelope,
+         (MPI_Datatype datatype, int* num_integers, int* num_addresses, int* num_datatypes, int* combiner));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_get_contents,
+         (MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes, int* array_of_integers,
+          MPI_Aint* array_of_addresses, MPI_Datatype* array_of_datatypes));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_darray,
+         (int size, int rank, int ndims, int* array_of_gsizes, int* array_of_distribs, int* array_of_dargs,
+          int* array_of_psizes, int order, MPI_Datatype oldtype, MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Pack_external_size, (char* datarep, int incount, MPI_Datatype datatype, MPI_Aint* size));
+MPI_CALL(XBT_PUBLIC int, MPI_Pack_external, (char* datarep, void* inbuf, int incount, MPI_Datatype datatype,
+                                             void* outbuf, MPI_Aint outcount, MPI_Aint* position));
+MPI_CALL(XBT_PUBLIC int, MPI_Unpack_external, (char* datarep, void* inbuf, MPI_Aint insize, MPI_Aint* position,
+                                               void* outbuf, int outcount, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_create_subarray,
+         (int ndims, int* array_of_sizes, int* array_of_subsizes, int* array_of_starts, int order, MPI_Datatype oldtype,
+          MPI_Datatype* newtype));
+MPI_CALL(XBT_PUBLIC int, MPI_Type_match_size, (int typeclass, int size, MPI_Datatype* datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_Alltoallw,
+         (void* sendbuf, int* sendcnts, int* sdispls, MPI_Datatype* sendtypes, void* recvbuf, int* recvcnts,
+          int* rdispls, MPI_Datatype* recvtypes, MPI_Comm comm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_info, (MPI_Comm comm, MPI_Info info));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_info, (MPI_Comm comm, MPI_Info* info));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_dup_with_info, (MPI_Comm comm, MPI_Info info, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_split_type,
+         (MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_connect,
+         (char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Request_get_status, (MPI_Request request, int* flag, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_Grequest_start,
+         (MPI_Grequest_query_function * query_fn, MPI_Grequest_free_function* free_fn,
+          MPI_Grequest_cancel_function* cancel_fn, void* extra_state, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_Grequest_complete, (MPI_Request request));
+MPI_CALL(XBT_PUBLIC int, MPI_Status_set_cancelled, (MPI_Status * status, int flag));
+MPI_CALL(XBT_PUBLIC int, MPI_Status_set_elements, (MPI_Status * status, MPI_Datatype datatype, int count));
+MPI_CALL(XBT_PUBLIC int, MPI_Unpublish_name, (char* service_name, MPI_Info info, char* port_name));
+MPI_CALL(XBT_PUBLIC int, MPI_Publish_name, (char* service_name, MPI_Info info, char* port_name));
+MPI_CALL(XBT_PUBLIC int, MPI_Lookup_name, (char* service_name, MPI_Info info, char* port_name));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_join, (int fd, MPI_Comm* intercomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Open_port, (MPI_Info info, char* port_name));
+MPI_CALL(XBT_PUBLIC int, MPI_Close_port, (char* port_name));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_accept, (char* port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm* newcomm));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_spawn, (char* command, char** argv, int maxprocs, MPI_Info info, int root,
+                                          MPI_Comm comm, MPI_Comm* intercomm, int* array_of_errcodes));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_spawn_multiple,
+         (int count, char** array_of_commands, char*** array_of_argv, int* array_of_maxprocs, MPI_Info* array_of_info,
+          int root, MPI_Comm comm, MPI_Comm* intercomm, int* array_of_errcodes));
+MPI_CALL(XBT_PUBLIC int, MPI_Comm_get_parent, (MPI_Comm * parent));
+MPI_CALL(XBT_PUBLIC int, MPI_Win_test, (MPI_Win win, int* flag));
+
+MPI_CALL(XBT_PUBLIC MPI_Fint, MPI_File_c2f, (MPI_File file));
+MPI_CALL(XBT_PUBLIC MPI_File, MPI_File_f2c, (MPI_Fint file));
+MPI_CALL(XBT_PUBLIC int, MPI_Register_datarep, (char* datarep, MPI_Datarep_conversion_function* read_conversion_fn,
+                                                MPI_Datarep_conversion_function* write_conversion_fn,
+                                                MPI_Datarep_extent_function* dtype_file_extent_fn, void* extra_state));
+MPI_CALL(XBT_PUBLIC int, MPI_File_call_errhandler, (MPI_File fh, int errorcode));
+MPI_CALL(XBT_PUBLIC int, MPI_File_create_errhandler,
+         (MPI_File_errhandler_function * function, MPI_Errhandler* errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_File_set_errhandler, (MPI_File file, MPI_Errhandler errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_errhandler, (MPI_File file, MPI_Errhandler* errhandler));
+MPI_CALL(XBT_PUBLIC int, MPI_File_open, (MPI_Comm comm, char* filename, int amode, MPI_Info info, MPI_File* fh));
+MPI_CALL(XBT_PUBLIC int, MPI_File_close, (MPI_File * fh));
+MPI_CALL(XBT_PUBLIC int, MPI_File_delete, (char* filename, MPI_Info info));
+MPI_CALL(XBT_PUBLIC int, MPI_File_set_size, (MPI_File fh, MPI_Offset size));
+MPI_CALL(XBT_PUBLIC int, MPI_File_preallocate, (MPI_File fh, MPI_Offset size));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_size, (MPI_File fh, MPI_Offset* size));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_group, (MPI_File fh, MPI_Group* group));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_amode, (MPI_File fh, int* amode));
+MPI_CALL(XBT_PUBLIC int, MPI_File_set_info, (MPI_File fh, MPI_Info info));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_info, (MPI_File fh, MPI_Info* info_used));
+MPI_CALL(XBT_PUBLIC int, MPI_File_set_view,
+         (MPI_File fh, MPI_Offset disp, MPI_Datatype etype, MPI_Datatype filetype, char* datarep, MPI_Info info));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_view,
+         (MPI_File fh, MPI_Offset* disp, MPI_Datatype* etype, MPI_Datatype* filetype, char* datarep));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_at,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_at_all,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_at,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_at_all,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iread_at,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iwrite_at,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iread_at_all,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iwrite_at_all,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read, (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_all,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_all,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iread,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iwrite,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iread_all,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iwrite_all,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_seek, (MPI_File fh, MPI_Offset offset, int whenace));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_position, (MPI_File fh, MPI_Offset* offset));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_byte_offset, (MPI_File fh, MPI_Offset offset, MPI_Offset* disp));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_shared,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_shared,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iread_shared,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_iwrite_shared,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Request* request));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_ordered,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_ordered,
+         (MPI_File fh, void* buf, int count, MPI_Datatype datatype, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_seek_shared, (MPI_File fh, MPI_Offset offset, int whence));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_position_shared, (MPI_File fh, MPI_Offset* offset));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_at_all_begin,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_at_all_end, (MPI_File fh, void* buf, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_at_all_begin,
+         (MPI_File fh, MPI_Offset offset, void* buf, int count, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_at_all_end, (MPI_File fh, void* buf, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_all_begin, (MPI_File fh, void* buf, int count, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_all_end, (MPI_File fh, void* buf, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_all_begin, (MPI_File fh, void* buf, int count, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_all_end, (MPI_File fh, void* buf, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_ordered_begin, (MPI_File fh, void* buf, int count, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_File_read_ordered_end, (MPI_File fh, void* buf, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_ordered_begin, (MPI_File fh, void* buf, int count, MPI_Datatype datatype));
+MPI_CALL(XBT_PUBLIC int, MPI_File_write_ordered_end, (MPI_File fh, void* buf, MPI_Status* status));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_type_extent, (MPI_File fh, MPI_Datatype datatype, MPI_Aint* extent));
+MPI_CALL(XBT_PUBLIC int, MPI_File_set_atomicity, (MPI_File fh, int flag));
+MPI_CALL(XBT_PUBLIC int, MPI_File_get_atomicity, (MPI_File fh, int* flag));
+MPI_CALL(XBT_PUBLIC int, MPI_File_sync, (MPI_File fh));
 
 //FIXME: End of all the not yet implemented stuff
 
 // smpi functions
-XBT_PUBLIC(int) smpi_global_size();
-XBT_PUBLIC(MPI_Comm) smpi_process_comm_self();
-XBT_PUBLIC(void*) smpi_process_get_user_data();
-XBT_PUBLIC(void) smpi_process_set_user_data(void *);
+XBT_PUBLIC int smpi_global_size();
+XBT_PUBLIC MPI_Comm smpi_process_comm_self();
+XBT_PUBLIC void* smpi_process_get_user_data();
+XBT_PUBLIC void smpi_process_set_user_data(void*);
 
-XBT_PUBLIC(void) smpi_execute_flops(double flops);
-XBT_PUBLIC(void) smpi_execute(double duration);
-XBT_PUBLIC(void) smpi_execute_benched(double duration);
+XBT_PUBLIC void smpi_execute_flops(double flops);
+XBT_PUBLIC void smpi_execute(double duration);
+XBT_PUBLIC void smpi_execute_benched(double duration);
 
-XBT_PUBLIC(double) smpi_get_host_power_peak_at(int pstate_index);
-XBT_PUBLIC(double) smpi_get_host_current_power_peak();
-XBT_PUBLIC(int) smpi_get_host_nb_pstates();
-XBT_PUBLIC(void) smpi_set_host_pstate(int pstate_index);
-XBT_PUBLIC(int)  smpi_get_host_pstate();
+XBT_PUBLIC double smpi_get_host_power_peak_at(int pstate_index);
+XBT_PUBLIC double smpi_get_host_current_power_peak();
+XBT_PUBLIC int smpi_get_host_nb_pstates();
+XBT_PUBLIC void smpi_set_host_pstate(int pstate_index);
+XBT_PUBLIC int smpi_get_host_pstate();
 
-XBT_PUBLIC(double) smpi_get_host_consumed_energy();
+XBT_PUBLIC double smpi_get_host_consumed_energy();
 
-XBT_PUBLIC(int) smpi_usleep(useconds_t usecs);
+XBT_PUBLIC int smpi_usleep(useconds_t usecs);
 #if _POSIX_TIMERS > 0
-XBT_PUBLIC(int) smpi_nanosleep(const struct timespec *tp, struct timespec * t);
-XBT_PUBLIC(int) smpi_clock_gettime(clockid_t clk_id, struct timespec *tp);
+XBT_PUBLIC int smpi_nanosleep(const struct timespec* tp, struct timespec* t);
+XBT_PUBLIC int smpi_clock_gettime(clockid_t clk_id, struct timespec* tp);
 #endif
-XBT_PUBLIC(unsigned int) smpi_sleep(unsigned int secs);
-XBT_PUBLIC(int) smpi_gettimeofday(struct timeval *tv, void* tz);
-XBT_PUBLIC(unsigned long long) smpi_rastro_resolution ();
-XBT_PUBLIC(unsigned long long) smpi_rastro_timestamp ();
-XBT_PUBLIC(void) smpi_sample_1(int global, const char *file, int line, int iters, double threshold);
-XBT_PUBLIC(int) smpi_sample_2(int global, const char *file, int line);
-XBT_PUBLIC(void) smpi_sample_3(int global, const char *file, int line);
+XBT_PUBLIC unsigned int smpi_sleep(unsigned int secs);
+XBT_PUBLIC int smpi_gettimeofday(struct timeval* tv, void* tz);
+XBT_PUBLIC unsigned long long smpi_rastro_resolution();
+XBT_PUBLIC unsigned long long smpi_rastro_timestamp();
+XBT_PUBLIC void smpi_sample_1(int global, const char* file, int line, int iters, double threshold);
+XBT_PUBLIC int smpi_sample_2(int global, const char* file, int line);
+XBT_PUBLIC void smpi_sample_3(int global, const char* file, int line);
 
 /**
  * Need a public setter for SMPI copy_callback function, so users can define
- * their own while still using default SIMIX_copy_callback for MSG copies.
+ * their own while still using default SIMIX_copy_callback for S4U copies.
  */
-XBT_PUBLIC(void) smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, size_t));
-
+XBT_PUBLIC void smpi_comm_set_copy_data_callback(void (*callback)(smx_activity_t, void*, size_t));
 
 /**
  * Functions for call location tracing. These functions will be
  * called from the user's application! (With the __FILE__ and __LINE__ values
  * passed as parameters.)
  */
-XBT_PUBLIC(void) smpi_trace_set_call_location(const char *file, int line);
+XBT_PUBLIC void smpi_trace_set_call_location(const char* file, int line);
 /** Fortran binding **/
-XBT_PUBLIC(void) smpi_trace_set_call_location_(const char *file, int* line);
+XBT_PUBLIC void smpi_trace_set_call_location_(const char* file, int* line);
 /** Fortran binding + -fsecond-underscore **/
-XBT_PUBLIC(void) smpi_trace_set_call_location__(const char *file, int* line);
+XBT_PUBLIC void smpi_trace_set_call_location__(const char* file, int* line);
 
 #define SMPI_SAMPLE_LOOP(global, iters, thres)                                                                         \
   for (smpi_sample_1(global, __FILE__, __LINE__, iters, thres); smpi_sample_2(global, __FILE__, __LINE__);             \
@@ -923,40 +958,41 @@ XBT_PUBLIC(void) smpi_trace_set_call_location__(const char *file, int* line);
 #define SMPI_SAMPLE_DELAY(duration) for(smpi_execute(duration); 0; )
 #define SMPI_SAMPLE_FLOPS(flops) for(smpi_execute_flops(flops); 0; )
 
-XBT_PUBLIC(void *) smpi_shared_malloc(size_t size, const char *file, int line);
+XBT_PUBLIC void* smpi_shared_malloc(size_t size, const char* file, int line);
 #define SMPI_SHARED_MALLOC(size) smpi_shared_malloc(size, __FILE__, __LINE__)
-XBT_PUBLIC(void*) smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int nb_shared_blocks);
+XBT_PUBLIC void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int nb_shared_blocks);
 #define SMPI_PARTIAL_SHARED_MALLOC(size, shared_block_offsets, nb_shared_blocks)                                       \
   smpi_shared_malloc_partial(size, shared_block_offsets, nb_shared_blocks)
 
-XBT_PUBLIC(void) smpi_shared_free(void *data);
+XBT_PUBLIC void smpi_shared_free(void* data);
 #define SMPI_SHARED_FREE(data) smpi_shared_free(data)
 
-XBT_PUBLIC(int) smpi_shared_known_call(const char* func, const char* input);
-XBT_PUBLIC(void*) smpi_shared_get_call(const char* func, const char* input);
-XBT_PUBLIC(void*) smpi_shared_set_call(const char* func, const char* input, void* data);
+XBT_PUBLIC int smpi_shared_known_call(const char* func, const char* input);
+XBT_PUBLIC void* smpi_shared_get_call(const char* func, const char* input);
+XBT_PUBLIC void* smpi_shared_set_call(const char* func, const char* input, void* data);
 #define SMPI_SHARED_CALL(func, input, ...) \
    (smpi_shared_known_call(#func, input) ? smpi_shared_get_call(#func, input) \
                                          : smpi_shared_set_call(#func, input, (func(__VA_ARGS__))))
 
 /* Fortran specific stuff */
 
-XBT_PUBLIC(int) smpi_main(const char* program, int argc, char *argv[]);
-XBT_ATTRIB_DEPRECATED_v322("Use Actor::self()->getPid(): v3.22 will turn this warning into an error.") XBT_PUBLIC(int) smpi_process_index();
-XBT_PUBLIC(void) smpi_process_init(int *argc, char ***argv);
+XBT_PUBLIC int smpi_main(const char* program, int argc, char* argv[]);
+XBT_ATTRIB_DEPRECATED_v322("Use s4u::this_actor::getPid(): v3.22 will turn this warning into an error.") XBT_PUBLIC
+    int smpi_process_index();
+XBT_PUBLIC void smpi_process_init(int* argc, char*** argv);
 
 /* Trace replay specific stuff */
-XBT_PUBLIC(void) smpi_replay_init(int* argc, char*** argv); // Only initialization
-XBT_PUBLIC(void) smpi_replay_main(int* argc, char*** argv); // Launch the replay once init is done
-XBT_PUBLIC(void) smpi_replay_run(int* argc, char*** argv);  // Both init and start
+XBT_PUBLIC void smpi_replay_init(int* argc, char*** argv); // Only initialization
+XBT_PUBLIC void smpi_replay_main(int* argc, char*** argv); // Launch the replay once init is done
+XBT_PUBLIC void smpi_replay_run(int* argc, char*** argv);  // Both init and start
 
-XBT_PUBLIC(void) SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes);
-XBT_PUBLIC(void) SMPI_init();
-XBT_PUBLIC(void) SMPI_finalize();
+XBT_PUBLIC void SMPI_app_instance_register(const char* name, xbt_main_func_t code, int num_processes);
+XBT_PUBLIC void SMPI_init();
+XBT_PUBLIC void SMPI_finalize();
 
 /* Manual global privatization fallback */
-XBT_PUBLIC(void) smpi_register_static(void* arg, void_f_pvoid_t free_fn);
-XBT_PUBLIC(void) smpi_free_static();
+XBT_PUBLIC void smpi_register_static(void* arg, void_f_pvoid_t free_fn);
+XBT_PUBLIC void smpi_free_static();
 
 #define SMPI_VARINIT_GLOBAL(name,type)                          \
 type *name = NULL;                                              \
@@ -1022,7 +1058,7 @@ SG_END_DECL()
 #ifdef __cplusplus
 #include <vector>
 
-XBT_PUBLIC(int) smpi_is_shared(void* ptr, std::vector<std::pair<size_t, size_t>>& private_blocks, size_t* offset);
+XBT_PUBLIC int smpi_is_shared(void* ptr, std::vector<std::pair<size_t, size_t>>& private_blocks, size_t* offset);
 
 std::vector<std::pair<size_t, size_t>> shift_and_frame_private_blocks(const std::vector<std::pair<size_t, size_t>> vec,
                                                                       size_t offset, size_t buff_size);
index 06ade63..ad3336d 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012, 2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2018. 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. */
@@ -8,7 +7,7 @@
 #ifndef RNGSTREAM_H
 #define RNGSTREAM_H
 
-#include "misc.h"
+#include <xbt/misc.h>
 
 typedef struct RngStream_InfoState * RngStream;
 
@@ -23,22 +22,22 @@ struct RngStream_InfoState {
 
 SG_BEGIN_DECL();
 
-XBT_PUBLIC(int) RngStream_SetPackageSeed (unsigned long seed[6]);
-XBT_PUBLIC(RngStream) RngStream_CreateStream (const char name[]);
-XBT_PUBLIC(void) RngStream_DeleteStream (RngStream *pg);
-XBT_PUBLIC(RngStream) RngStream_CopyStream (const RngStream src);
-XBT_PUBLIC(void) RngStream_ResetStartStream (RngStream g);
-XBT_PUBLIC(void) RngStream_ResetStartSubstream (RngStream g);
-XBT_PUBLIC(void) RngStream_ResetNextSubstream (RngStream g);
-XBT_PUBLIC(void) RngStream_SetAntithetic (RngStream g, int a);
-XBT_PUBLIC(void) RngStream_IncreasedPrecis (RngStream g, int incp);
-XBT_PUBLIC(int) RngStream_SetSeed (RngStream g, unsigned long seed[6]);
-XBT_PUBLIC(void) RngStream_AdvanceState (RngStream g, long e, long c);
-XBT_PUBLIC(void) RngStream_GetState (RngStream g, unsigned long seed[6]);
-XBT_PUBLIC(void) RngStream_WriteState (RngStream g);
-XBT_PUBLIC(void) RngStream_WriteStateFull (RngStream g);
-XBT_PUBLIC(double) RngStream_RandU01 (RngStream g);
-XBT_PUBLIC(int) RngStream_RandInt (RngStream g, int i, int j);
+XBT_PUBLIC int RngStream_SetPackageSeed(unsigned long seed[6]);
+XBT_PUBLIC RngStream RngStream_CreateStream(const char name[]);
+XBT_PUBLIC void RngStream_DeleteStream(RngStream* pg);
+XBT_PUBLIC RngStream RngStream_CopyStream(const RngStream src);
+XBT_PUBLIC void RngStream_ResetStartStream(RngStream g);
+XBT_PUBLIC void RngStream_ResetStartSubstream(RngStream g);
+XBT_PUBLIC void RngStream_ResetNextSubstream(RngStream g);
+XBT_PUBLIC void RngStream_SetAntithetic(RngStream g, int a);
+XBT_PUBLIC void RngStream_IncreasedPrecis(RngStream g, int incp);
+XBT_PUBLIC int RngStream_SetSeed(RngStream g, unsigned long seed[6]);
+XBT_PUBLIC void RngStream_AdvanceState(RngStream g, long e, long c);
+XBT_PUBLIC void RngStream_GetState(RngStream g, unsigned long seed[6]);
+XBT_PUBLIC void RngStream_WriteState(RngStream g);
+XBT_PUBLIC void RngStream_WriteStateFull(RngStream g);
+XBT_PUBLIC double RngStream_RandU01(RngStream g);
+XBT_PUBLIC int RngStream_RandInt(RngStream g, int i, int j);
 
 SG_END_DECL();
 
index b3494cf..5e78a3b 100644 (file)
@@ -1,7 +1,6 @@
 /*  xbt/asserts.h -- assertion mechanism                                    */
 
-/* Copyright (c) 2005-2007, 2009-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2005-2018. 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. */
@@ -9,12 +8,12 @@
 #ifndef XBT_ASSERTS_H
 #define XBT_ASSERTS_H
 
-#include "xbt/misc.h"
-#include "xbt/log.h"
-#include "xbt/ex.h"
+#include <xbt/ex.h>
+#include <xbt/log.h>
+#include <xbt/misc.h>
 
 SG_BEGIN_DECL()
-XBT_PUBLIC_DATA(int) xbt_log_no_loc; /* Do not show the backtrace on failed backtrace when doing our tests */
+XBT_PUBLIC_DATA int xbt_log_no_loc; /* Do not show the backtrace on failed backtrace when doing our tests */
 
 /**
  * @addtogroup XBT_error
index a0f9013..f76712c 100644 (file)
@@ -60,57 +60,58 @@ typedef struct xbt_automaton_propositional_symbol* xbt_automaton_propositional_s
 typedef int (*xbt_automaton_propositional_symbol_callback_type)(void*);
 typedef void (*xbt_automaton_propositional_symbol_free_function_type)(void*);
 
-XBT_PUBLIC(xbt_automaton_t) xbt_automaton_new(void);
-XBT_PUBLIC(void) xbt_automaton_load(xbt_automaton_t automaton, const char *file);
-XBT_PUBLIC(xbt_automaton_state_t) xbt_automaton_state_new(xbt_automaton_t a, int type, char* id);
-XBT_PUBLIC(xbt_automaton_transition_t)
-    xbt_automaton_transition_new(xbt_automaton_t a, xbt_automaton_state_t src, xbt_automaton_state_t dst,
-                                 xbt_automaton_exp_label_t label);
-XBT_PUBLIC(xbt_automaton_exp_label_t) xbt_automaton_exp_label_new(int type, ...);
-XBT_PUBLIC(xbt_dynar_t) xbt_automaton_get_states(xbt_automaton_t a);
-XBT_PUBLIC(xbt_dynar_t) xbt_automaton_get_transitions(xbt_automaton_t a);
-XBT_PUBLIC(xbt_automaton_transition_t) xbt_automaton_get_transition(xbt_automaton_t a, xbt_automaton_state_t src,
-                                                                    xbt_automaton_state_t dst);
-XBT_PUBLIC(xbt_automaton_state_t) xbt_automaton_transition_get_source(xbt_automaton_transition_t t);
-XBT_PUBLIC(xbt_automaton_state_t) xbt_automaton_transition_get_destination(xbt_automaton_transition_t t);
-XBT_PUBLIC(void) xbt_automaton_transition_set_source(xbt_automaton_transition_t t, xbt_automaton_state_t src);
-XBT_PUBLIC(void) xbt_automaton_transition_set_destination(xbt_automaton_transition_t t, xbt_automaton_state_t dst);
-XBT_PUBLIC(xbt_dynar_t) xbt_automaton_state_get_out_transitions(xbt_automaton_state_t s);
-XBT_PUBLIC(xbt_dynar_t) xbt_automaton_state_get_in_transitions(xbt_automaton_state_t s);
-XBT_PUBLIC(xbt_automaton_state_t) xbt_automaton_state_exists(xbt_automaton_t a, char *id);
-XBT_PUBLIC(void) xbt_automaton_display(xbt_automaton_t a);
-XBT_PUBLIC(void) xbt_automaton_exp_label_display(xbt_automaton_exp_label_t l);
+XBT_PUBLIC xbt_automaton_t xbt_automaton_new(void);
+XBT_PUBLIC void xbt_automaton_load(xbt_automaton_t automaton, const char* file);
+XBT_PUBLIC xbt_automaton_state_t xbt_automaton_state_new(xbt_automaton_t a, int type, char* id);
+XBT_PUBLIC xbt_automaton_transition_t xbt_automaton_transition_new(xbt_automaton_t a, xbt_automaton_state_t src,
+                                                                   xbt_automaton_state_t dst,
+                                                                   xbt_automaton_exp_label_t label);
+XBT_PUBLIC xbt_automaton_exp_label_t xbt_automaton_exp_label_new(int type, ...);
+XBT_PUBLIC xbt_dynar_t xbt_automaton_get_states(xbt_automaton_t a);
+XBT_PUBLIC xbt_dynar_t xbt_automaton_get_transitions(xbt_automaton_t a);
+XBT_PUBLIC xbt_automaton_transition_t xbt_automaton_get_transition(xbt_automaton_t a, xbt_automaton_state_t src,
+                                                                   xbt_automaton_state_t dst);
+XBT_PUBLIC xbt_automaton_state_t xbt_automaton_transition_get_source(xbt_automaton_transition_t t);
+XBT_PUBLIC xbt_automaton_state_t xbt_automaton_transition_get_destination(xbt_automaton_transition_t t);
+XBT_PUBLIC void xbt_automaton_transition_set_source(xbt_automaton_transition_t t, xbt_automaton_state_t src);
+XBT_PUBLIC void xbt_automaton_transition_set_destination(xbt_automaton_transition_t t, xbt_automaton_state_t dst);
+XBT_PUBLIC xbt_dynar_t xbt_automaton_state_get_out_transitions(xbt_automaton_state_t s);
+XBT_PUBLIC xbt_dynar_t xbt_automaton_state_get_in_transitions(xbt_automaton_state_t s);
+XBT_PUBLIC xbt_automaton_state_t xbt_automaton_state_exists(xbt_automaton_t a, char* id);
+XBT_PUBLIC void xbt_automaton_display(xbt_automaton_t a);
+XBT_PUBLIC void xbt_automaton_exp_label_display(xbt_automaton_exp_label_t l);
 
 // xbt_automaton_propositional_symbol constructors:
-XBT_PUBLIC(xbt_automaton_propositional_symbol_t)
-   xbt_automaton_propositional_symbol_new(xbt_automaton_t a, const char* id, int(*fct)(void));
-XBT_PUBLIC(xbt_automaton_propositional_symbol_t)
-   xbt_automaton_propositional_symbol_new_pointer(xbt_automaton_t a, const char* id, int* value);
-XBT_PUBLIC(xbt_automaton_propositional_symbol_t)
-   xbt_automaton_propositional_symbol_new_callback(xbt_automaton_t a, const char* id,
-  xbt_automaton_propositional_symbol_callback_type callback,
-  void* data, xbt_automaton_propositional_symbol_free_function_type free_function);
+XBT_PUBLIC xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new(xbt_automaton_t a,
+                                                                                       const char* id,
+                                                                                       int (*fct)(void));
+XBT_PUBLIC xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new_pointer(xbt_automaton_t a,
+                                                                                               const char* id,
+                                                                                               int* value);
+XBT_PUBLIC xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new_callback(
+    xbt_automaton_t a, const char* id, xbt_automaton_propositional_symbol_callback_type callback, void* data,
+    xbt_automaton_propositional_symbol_free_function_type free_function);
 
 // xbt_automaton_propositional_symbol accessors:
-XBT_PUBLIC(xbt_automaton_propositional_symbol_callback_type)
-   xbt_automaton_propositional_symbol_get_callback(xbt_automaton_propositional_symbol_t symbol);
-XBT_PUBLIC(void*) xbt_automaton_propositional_symbol_get_data(xbt_automaton_propositional_symbol_t symbol);
-XBT_PUBLIC(const char*) xbt_automaton_propositional_symbol_get_name(xbt_automaton_propositional_symbol_t symbol);
+XBT_PUBLIC xbt_automaton_propositional_symbol_callback_type
+xbt_automaton_propositional_symbol_get_callback(xbt_automaton_propositional_symbol_t symbol);
+XBT_PUBLIC void* xbt_automaton_propositional_symbol_get_data(xbt_automaton_propositional_symbol_t symbol);
+XBT_PUBLIC const char* xbt_automaton_propositional_symbol_get_name(xbt_automaton_propositional_symbol_t symbol);
 
 // xbt_automaton_propositional_symbol methods!
-XBT_PUBLIC(int) xbt_automaton_propositional_symbol_evaluate(xbt_automaton_propositional_symbol_t symbol);
-
-XBT_PUBLIC(xbt_automaton_state_t) xbt_automaton_get_current_state(xbt_automaton_t a);
-XBT_PUBLIC(int) xbt_automaton_state_compare(xbt_automaton_state_t s1, xbt_automaton_state_t s2);
-XBT_PUBLIC(int) xbt_automaton_propositional_symbols_compare_value(xbt_dynar_t s1, xbt_dynar_t s2);
-XBT_PUBLIC(int) xbt_automaton_transition_compare(const void *t1, const void *t2);
-XBT_PUBLIC(int) xbt_automaton_exp_label_compare(xbt_automaton_exp_label_t l1, xbt_automaton_exp_label_t l2);
-XBT_PUBLIC(void) xbt_automaton_state_free_voidp(void *s);
-XBT_PUBLIC(void) xbt_automaton_state_free(xbt_automaton_state_t s);
-XBT_PUBLIC(void) xbt_automaton_transition_free_voidp(void *t);
-XBT_PUBLIC(void) xbt_automaton_exp_label_free_voidp(void *e);
-XBT_PUBLIC(void) xbt_automaton_propositional_symbol_free_voidp(void *ps);
-XBT_PUBLIC(void) xbt_automaton_free(xbt_automaton_t a);
+XBT_PUBLIC int xbt_automaton_propositional_symbol_evaluate(xbt_automaton_propositional_symbol_t symbol);
+
+XBT_PUBLIC xbt_automaton_state_t xbt_automaton_get_current_state(xbt_automaton_t a);
+XBT_PUBLIC int xbt_automaton_state_compare(xbt_automaton_state_t s1, xbt_automaton_state_t s2);
+XBT_PUBLIC int xbt_automaton_propositional_symbols_compare_value(xbt_dynar_t s1, xbt_dynar_t s2);
+XBT_PUBLIC int xbt_automaton_transition_compare(const void* t1, const void* t2);
+XBT_PUBLIC int xbt_automaton_exp_label_compare(xbt_automaton_exp_label_t l1, xbt_automaton_exp_label_t l2);
+XBT_PUBLIC void xbt_automaton_state_free_voidp(void* s);
+XBT_PUBLIC void xbt_automaton_state_free(xbt_automaton_state_t s);
+XBT_PUBLIC void xbt_automaton_transition_free_voidp(void* t);
+XBT_PUBLIC void xbt_automaton_exp_label_free_voidp(void* e);
+XBT_PUBLIC void xbt_automaton_propositional_symbol_free_voidp(void* ps);
+XBT_PUBLIC void xbt_automaton_free(xbt_automaton_t a);
 
 SG_END_DECL()
 
index dd4fb3d..6367997 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2005-2018. The SimGrid Team. All rights reserved.          */
 
 #ifndef XBT_BACKTRACE_H
 #define XBT_BACKTRACE_H
@@ -14,19 +14,19 @@ SG_BEGIN_DECL()
 typedef void* xbt_backtrace_location_t;
 
 /** @brief Shows a backtrace of the current location */
-XBT_PUBLIC(void) xbt_backtrace_display_current();
+XBT_PUBLIC void xbt_backtrace_display_current();
 
 /** @brief reimplementation of glibc backtrace based directly on gcc library, without implicit malloc  */
-XBT_PUBLIC(int) xbt_backtrace_no_malloc(void**bt, int size);
+XBT_PUBLIC int xbt_backtrace_no_malloc(void** bt, int size);
 
 /** @brief Captures a backtrace for further use */
-XBT_PUBLIC(size_t) xbt_backtrace_current(xbt_backtrace_location_t* loc, size_t count);
+XBT_PUBLIC size_t xbt_backtrace_current(xbt_backtrace_location_t* loc, size_t count);
 
 /** @brief Display a previously captured backtrace */
-XBT_PUBLIC(void) xbt_backtrace_display(xbt_backtrace_location_t* loc, size_t count);
+XBT_PUBLIC void xbt_backtrace_display(xbt_backtrace_location_t* loc, size_t count);
 
 /** @brief Get current backtrace with libunwind */
-XBT_PUBLIC(int) xbt_libunwind_backtrace(void** bt, int size);
+XBT_PUBLIC int xbt_libunwind_backtrace(void** bt, int size);
 
 SG_END_DECL()
 
index ca3f282..754bd5f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2019. The SimGrid Team.
+/* Copyright (c) 2005-2018. The SimGrid Team.
  * All rights reserved. */
 
 #ifndef SIMGRIX_XBT_BACKTRACE_HPP
@@ -20,18 +20,16 @@ namespace xbt {
  *
  *  Return the origin string if this fails.
  */
-XBT_PUBLIC() std::unique_ptr<char, void(*)(void*)> demangle(const char* name);
+XBT_PUBLIC std::unique_ptr<char, void (*)(void*)> demangle(const char* name);
 
 /** Get the current backtrace */
-XBT_PUBLIC(std::vector<xbt_backtrace_location_t>) backtrace();
+XBT_PUBLIC std::vector<xbt_backtrace_location_t> backtrace();
 
 /* Translate the backtrace in a human friendly form
  *
  *  Try ro resolve symbols and source code location.
  */
-XBT_PUBLIC(std::vector<std::string>) resolveBacktrace(
-  xbt_backtrace_location_t const* loc, std::size_t count);
-
+XBT_PUBLIC std::vector<std::string> resolveBacktrace(xbt_backtrace_location_t const* loc, std::size_t count);
 }
 }
 
index 6486466..7cb057e 100644 (file)
@@ -53,7 +53,7 @@
 #define XBT_ATTRIB_UNUSED [[maybe_unused]]
 #endif
 #if __cplusplus >= 201402L
-#define XBT_ATTRIB_DEPRECATED(msg) [[deprecated(msg)]]
+#define XBT_ATTRIB_DEPRECATED(mesg) [[deprecated(mesg)]]
 #endif
 #elif defined(__STDC_VERSION__)
 #if __STDC_VERSION__ >= 201112L
 #define XBT_ATTRIB_UNUSED  __attribute__((unused))
 #endif
 #ifndef XBT_ATTRIB_DEPRECATED
-#define XBT_ATTRIB_DEPRECATED(msg) __attribute__((deprecated(msg)))
+#define XBT_ATTRIB_DEPRECATED(mesg) __attribute__((deprecated(mesg)))
 #endif
 
-#define XBT_ATTRIB_DEPRECATED_v320(msg) XBT_ATTRIB_DEPRECATED(msg) /* Will be dropped in v3.20 */
-#define XBT_ATTRIB_DEPRECATED_v321(msg) XBT_ATTRIB_DEPRECATED(msg) /* Will be dropped in v3.21 */
-#define XBT_ATTRIB_DEPRECATED_v322(msg) XBT_ATTRIB_DEPRECATED(msg) /* Will be dropped in v3.22 */
+#define XBT_ATTRIB_DEPRECATED_v321(mesg) XBT_ATTRIB_DEPRECATED(mesg) /* Will be dropped in v3.21 */
+#define XBT_ATTRIB_DEPRECATED_v322(mesg) XBT_ATTRIB_DEPRECATED(mesg) /* Will be dropped in v3.22 */
+#define XBT_ATTRIB_DEPRECATED_v323(mesg) XBT_ATTRIB_DEPRECATED(mesg) /* Will be dropped in v3.23 */
 
 #define XBT_ATTRIB_CONSTRUCTOR(prio) __attribute__((__constructor__(prio)))
 #define XBT_ATTRIB_DESTRUCTOR(prio) __attribute__((__destructor__(prio)))
 
 /* Build the DLL */
 #if defined(DLL_EXPORT)
-#  define XBT_ATTRIB_PUBLIC           __declspec(dllexport)
-#  define XBT_PUBLIC(type)            __declspec(dllexport) type
-#  define XBT_EXPORT_NO_IMPORT(type)  __declspec(dllexport) type
-#  define XBT_IMPORT_NO_EXPORT(type)  type
-#  define XBT_PUBLIC_DATA(type)       extern __declspec(dllexport) type
-#  define XBT_PUBLIC_CLASS            class __declspec(dllexport)
+#  define XBT_PUBLIC            __declspec(dllexport)
+#  define XBT_EXPORT_NO_IMPORT  __declspec(dllexport)
+#  define XBT_IMPORT_NO_EXPORT
+#  define XBT_PUBLIC_DATA       extern __declspec(dllexport)
 #  define XBT_PRIVATE
 
 /* Link against the DLL */
 #elif (defined(_WIN32) && !defined(DLL_EXPORT))
-#  define XBT_ATTRIB_PUBLIC           __declspec(dllimport)
-#  define XBT_PUBLIC(type)            __declspec(dllimport) type
-#  define XBT_EXPORT_NO_IMPORT(type)  type
-#  define XBT_IMPORT_NO_EXPORT(type)  __declspec(dllimport) type
-#  define XBT_PUBLIC_DATA(type)       extern __declspec(dllimport) type
-#  define XBT_PUBLIC_CLASS            class __declspec(dllimport)
+#  define XBT_PUBLIC            __declspec(dllimport)
+#  define XBT_EXPORT_NO_IMPORT
+#  define XBT_IMPORT_NO_EXPORT  __declspec(dllimport)
+#  define XBT_PUBLIC_DATA       extern __declspec(dllimport)
 #  define XBT_PRIVATE
 
 #elif defined(__ELF__)
-#  define XBT_ATTRIB_PUBLIC           __attribute__((visibility("default")))
-#  define XBT_PUBLIC(type)            __attribute__((visibility("default"))) type
-#  define XBT_EXPORT_NO_IMPORT(type)  __attribute__((visibility("default"))) type
-#  define XBT_IMPORT_NO_EXPORT(type)  __attribute__((visibility("default"))) type
-#  define XBT_PUBLIC_DATA(type)       extern __attribute__((visibility("default"))) type
-#  define XBT_PUBLIC_CLASS            class __attribute__((visibility("default")))
-#  define XBT_PRIVATE                 __attribute__((visibility("hidden")))
+#  define XBT_PUBLIC            __attribute__((visibility("default")))
+#  define XBT_EXPORT_NO_IMPORT  __attribute__((visibility("default")))
+#  define XBT_IMPORT_NO_EXPORT  __attribute__((visibility("default")))
+#  define XBT_PUBLIC_DATA       extern __attribute__((visibility("default")))
+#  define XBT_PRIVATE           __attribute__((visibility("hidden")))
 
 #else
-#  define XBT_ATTRIB_PUBLIC           /* public */
-#  define XBT_PUBLIC(type)            type
-#  define XBT_EXPORT_NO_IMPORT(type)  type
-#  define XBT_IMPORT_NO_EXPORT(type)  type
-#  define XBT_PUBLIC_DATA(type)       extern type
-#  define XBT_PUBLIC_CLASS            class
-#  define XBT_PRIVATE                 /** @private */
+#  define XBT_PUBLIC            /* public */
+#  define XBT_EXPORT_NO_IMPORT
+#  define XBT_IMPORT_NO_EXPORT
+#  define XBT_PUBLIC_DATA       extern
+#  define XBT_PRIVATE           /** @private */
 
 #endif
 
-#define TRUE  1
-#define FALSE 0
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
 
 /* C++ users need love */
 #ifndef SG_BEGIN_DECL
index 4ad8e1f..c5f9480 100644 (file)
@@ -1,7 +1,7 @@
 /* config - Dictionary where the type of each cell is provided.             */
 /* This is useful to build named structs, like option or property sets.     */
 
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -67,26 +67,26 @@ typedef void* xbt_cfg_t;
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(void) xbt_cfg_set_parse(const char *options);
+XBT_PUBLIC void xbt_cfg_set_parse(const char* options);
 
 /* Set the value of the cell \a name in \a cfg with the provided value.*/
-XBT_PUBLIC(void) xbt_cfg_set_int       (const char *name, int val);
-XBT_PUBLIC(void) xbt_cfg_set_double    (const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_set_boolean   (const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_set_string(const char* name, const char* val);
-XBT_PUBLIC(void) xbt_cfg_set_as_string(const char *name, const char *val);
+XBT_PUBLIC void xbt_cfg_set_int(const char* name, int val);
+XBT_PUBLIC void xbt_cfg_set_double(const char* name, double val);
+XBT_PUBLIC void xbt_cfg_set_boolean(const char* name, const char* val);
+XBT_PUBLIC void xbt_cfg_set_string(const char* name, const char* val);
+XBT_PUBLIC void xbt_cfg_set_as_string(const char* name, const char* val);
 
 /*
   Set the default value of the cell \a name in \a cfg with the provided value.
   If it was already set to something (possibly from the command line), do nothing.
  */
-XBT_PUBLIC(void) xbt_cfg_setdefault_int    (const char *name, int val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_double (const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_string (const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_boolean(const char *name, const char *val);
+XBT_PUBLIC void xbt_cfg_setdefault_int(const char* name, int val);
+XBT_PUBLIC void xbt_cfg_setdefault_double(const char* name, double val);
+XBT_PUBLIC void xbt_cfg_setdefault_string(const char* name, const char* val);
+XBT_PUBLIC void xbt_cfg_setdefault_boolean(const char* name, const char* val);
 
 /** @brief Return if configuration is set by default*/
-XBT_PUBLIC(int) xbt_cfg_is_default_value(const char *name);
+XBT_PUBLIC int xbt_cfg_is_default_value(const char* name);
 
 /* @} */
 
@@ -97,13 +97,13 @@ XBT_PUBLIC(int) xbt_cfg_is_default_value(const char *name);
  */
 
 /** \brief Callback types. They get the name of the modified entry, and the position of the changed value */
-typedef void (*xbt_cfg_cb_t) (const char * name);
+typedef void (*xbt_cfg_cb_t)(const char* name);
 
-XBT_PUBLIC(xbt_cfg_t) xbt_cfg_new();
-XBT_PUBLIC(void) xbt_cfg_free(xbt_cfg_t * cfg);
-XBT_PUBLIC(void) xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cfg);
+XBT_PUBLIC xbt_cfg_t xbt_cfg_new();
+XBT_PUBLIC void xbt_cfg_free(xbt_cfg_t* cfg);
+XBT_PUBLIC void xbt_cfg_dump(const char* name, const char* indent, xbt_cfg_t cfg);
 
- /** @} */
+/** @} */
 
 /** @defgroup XBT_cfg_register  Registering stuff
  *  @ingroup XBT_config
@@ -112,14 +112,16 @@ XBT_PUBLIC(void) xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cf
  *
  *  @{
  */
-XBT_PUBLIC(void) xbt_cfg_register_double (const char *name, double default_val,    xbt_cfg_cb_t cb_set, const char *desc);
-XBT_PUBLIC(void) xbt_cfg_register_int    (const char *name, int default_val,       xbt_cfg_cb_t cb_set, const char *desc);
-XBT_PUBLIC(void) xbt_cfg_register_string (const char *name, const char*default_val,xbt_cfg_cb_t cb_set, const char *desc);
-XBT_PUBLIC(void) xbt_cfg_register_boolean(const char *name, const char*default_val,xbt_cfg_cb_t cb_set, const char *desc);
-XBT_PUBLIC(void) xbt_cfg_register_alias(const char *newname, const char *oldname);
+XBT_PUBLIC void xbt_cfg_register_double(const char* name, double default_val, xbt_cfg_cb_t cb_set, const char* desc);
+XBT_PUBLIC void xbt_cfg_register_int(const char* name, int default_val, xbt_cfg_cb_t cb_set, const char* desc);
+XBT_PUBLIC void xbt_cfg_register_string(const char* name, const char* default_val, xbt_cfg_cb_t cb_set,
+                                        const char* desc);
+XBT_PUBLIC void xbt_cfg_register_boolean(const char* name, const char* default_val, xbt_cfg_cb_t cb_set,
+                                         const char* desc);
+XBT_PUBLIC void xbt_cfg_register_alias(const char* newname, const char* oldname);
 
-XBT_PUBLIC(void) xbt_cfg_aliases();
-XBT_PUBLIC(void) xbt_cfg_help();
+XBT_PUBLIC void xbt_cfg_aliases();
+XBT_PUBLIC void xbt_cfg_help();
 
 /*  @} */
 /** @defgroup XBT_cfg_get Getting the stored values
@@ -135,9 +137,9 @@ XBT_PUBLIC(void) xbt_cfg_help();
  *  @{
  */
 
-XBT_PUBLIC(int)    xbt_cfg_get_int(const char *name);
-XBT_PUBLIC(double) xbt_cfg_get_double(const char *name);
-XBT_PUBLIC(int)    xbt_cfg_get_boolean(const char *name);
+XBT_PUBLIC int xbt_cfg_get_int(const char* name);
+XBT_PUBLIC double xbt_cfg_get_double(const char* name);
+XBT_PUBLIC int xbt_cfg_get_boolean(const char* name);
 
 /** @} */
 
index 6c61a46..1ce01c3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2018. 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. */
@@ -23,7 +23,7 @@
 namespace simgrid {
 namespace config {
 
-XBT_PUBLIC_CLASS missing_key_error : public std::runtime_error {
+class XBT_PUBLIC missing_key_error : public std::runtime_error {
 public:
   explicit missing_key_error(const std::string& what)
     : std::runtime_error(what) {}
@@ -52,13 +52,12 @@ inline std::string to_string(std::string&& value)
 
 // Get config
 
-template<class T>
-XBT_PUBLIC(T const&) getConfig(const char* name);
+template <class T> XBT_PUBLIC T const& getConfig(const char* name);
 
-extern template XBT_PUBLIC(int const&) getConfig<int>(const char* name);
-extern template XBT_PUBLIC(double const&) getConfig<double>(const char* name);
-extern template XBT_PUBLIC(bool const&) getConfig<bool>(const char* name);
-extern template XBT_PUBLIC(std::string const&) getConfig<std::string>(const char* name);
+extern template XBT_PUBLIC int const& getConfig<int>(const char* name);
+extern template XBT_PUBLIC double const& getConfig<double>(const char* name);
+extern template XBT_PUBLIC bool const& getConfig<bool>(const char* name);
+extern template XBT_PUBLIC std::string const& getConfig<std::string>(const char* name);
 
 // Register:
 
@@ -69,22 +68,22 @@ extern template XBT_PUBLIC(std::string const&) getConfig<std::string>(const char
  *  @param value       Initial/default value
  *  @param callback    called with the option value
  */
-template<class T>
-XBT_PUBLIC(void) declareFlag(const char* name, const char* description,
-  T value, std::function<void(const T&)> callback = std::function<void(const T&)>());
-
-extern template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, int value, std::function<void(int const &)> callback);
-extern template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, double value, std::function<void(double const &)> callback);
-extern template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, bool value, std::function<void(bool const &)> callback);
-extern template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, std::string value, std::function<void(std::string const &)> callback);
+template <class T>
+XBT_PUBLIC void declareFlag(const char* name, const char* description, T value,
+                            std::function<void(const T&)> callback = std::function<void(const T&)>());
+
+extern template XBT_PUBLIC void declareFlag(const char* name, const char* description, int value,
+                                            std::function<void(int const&)> callback);
+extern template XBT_PUBLIC void declareFlag(const char* name, const char* description, double value,
+                                            std::function<void(double const&)> callback);
+extern template XBT_PUBLIC void declareFlag(const char* name, const char* description, bool value,
+                                            std::function<void(bool const&)> callback);
+extern template XBT_PUBLIC void declareFlag(const char* name, const char* description, std::string value,
+                                            std::function<void(std::string const&)> callback);
 
 // ***** alias *****
 
-XBT_PUBLIC(void) alias(const char* realname, const char* aliasname);
+XBT_PUBLIC void alias(const char* realname, const char* aliasname);
 
 inline
 void alias(std::initializer_list<const char*> names)
@@ -242,6 +241,6 @@ public:
 
 }
 }
-XBT_PUBLIC(std::string) xbt_cfg_get_string(const char* name);
+XBT_PUBLIC std::string xbt_cfg_get_string(const char* name);
 
 #endif
index 24b4449..296b582 100644 (file)
@@ -1,6 +1,6 @@
 /* cunit - A little C Unit facility                                         */
 
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2005-2018. 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. */
@@ -10,8 +10,8 @@
 #ifndef XBT_CUNIT_H_
 #define XBT_CUNIT_H_
 
-#include "xbt/sysdep.h"         /* XBT_GNU_PRINTF */
-#include "xbt/ex.h"
+#include <xbt/ex.h>
+#include <xbt/sysdep.h> /* XBT_GNU_PRINTF */
 
 SG_BEGIN_DECL()
 
@@ -27,8 +27,8 @@ typedef struct s_xbt_test_unit *xbt_test_unit_t;
 typedef void (*ts_test_cb_t) ();
 
 /* test suite operations */
-XBT_PUBLIC(xbt_test_suite_t) xbt_test_suite_by_name(const char *name, const char *fmt, ...);
-XBT_PUBLIC(void) xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t func, const char *fmt, ...);
+XBT_PUBLIC xbt_test_suite_t xbt_test_suite_by_name(const char* name, const char* fmt, ...);
+XBT_PUBLIC void xbt_test_suite_push(xbt_test_suite_t suite, const char* name, ts_test_cb_t func, const char* fmt, ...);
 
 /* Run all the specified tests. what_to_do allows to disable some tests.
  * It is a coma (,) separated list of directives. They are applied from left to right.
@@ -46,11 +46,11 @@ XBT_PUBLIC(void) xbt_test_suite_push(xbt_test_suite_t suite, const char *name, t
  * * testname: if given, the test on which the directive acts. If not, acts on any tests.
  */
 
-XBT_PUBLIC(int) xbt_test_run(char *selection, int verbosity);
+XBT_PUBLIC int xbt_test_run(char* selection, int verbosity);
 /* Show information about the selection of tests */
-XBT_PUBLIC(void) xbt_test_dump(char *selection);
+XBT_PUBLIC void xbt_test_dump(char* selection);
 /* Cleanup the mess */
-XBT_PUBLIC(void) xbt_test_exit();
+XBT_PUBLIC void xbt_test_exit();
 
 /**
  * @addtogroup XBT_cunit
@@ -96,9 +96,9 @@ XBT_PUBLIC(void) xbt_test_exit();
 #endif
 
 /* test operations */
-XBT_PUBLIC(void) _xbt_test_add(const char *file, int line, const char *fmt, ...) XBT_ATTRIB_PRINTF(3, 4);
-XBT_PUBLIC(void) _xbt_test_fail(const char *file, int line, const char *fmt, ...) XBT_ATTRIB_PRINTF(3, 4);
-XBT_PUBLIC(void) _xbt_test_log(const char *file, int line, const char *fmt, ...) XBT_ATTRIB_PRINTF(3, 4);
+XBT_PUBLIC void _xbt_test_add(const char* file, int line, const char* fmt, ...) XBT_ATTRIB_PRINTF(3, 4);
+XBT_PUBLIC void _xbt_test_fail(const char* file, int line, const char* fmt, ...) XBT_ATTRIB_PRINTF(3, 4);
+XBT_PUBLIC void _xbt_test_log(const char* file, int line, const char* fmt, ...) XBT_ATTRIB_PRINTF(3, 4);
 /** @brief Declare that a new test begins (printf-like parameters, describing the test)
  *  @hideinitializer */
 #define xbt_test_add(...)       _xbt_test_add(__FILE__, __LINE__, __VA_ARGS__)
@@ -124,12 +124,12 @@ XBT_PUBLIC(void) _xbt_test_log(const char *file, int line, const char *fmt, ...)
 #define xbt_test_log(...)       _xbt_test_log(__FILE__, __LINE__, __VA_ARGS__)
 
 /** @brief Declare that the lastly started test failed because of the provided exception */
-XBT_PUBLIC(void) xbt_test_exception(xbt_ex_t e);
+XBT_PUBLIC void xbt_test_exception(xbt_ex_t e);
 
 /** @brief Declare that the lastly started test was expected to fail (and actually failed) */
-XBT_PUBLIC(void) xbt_test_expect_failure();
+XBT_PUBLIC void xbt_test_expect_failure();
 /** @brief Declare that the lastly started test should be skipped today */
-XBT_PUBLIC(void) xbt_test_skip();
+XBT_PUBLIC void xbt_test_skip();
 
 /** @} */
 
index 30f9ec3..a4623bf 100644 (file)
@@ -8,8 +8,9 @@
 #ifndef XBT_DICT_H
 #define XBT_DICT_H
 
-#include "xbt/misc.h"           /* SG_BEGIN_DECL */
-#include "xbt/dynar.h"          /* void_f_pvoid_t */
+#include <xbt/dynar.h> /* void_f_pvoid_t */
+#include <xbt/misc.h>  /* SG_BEGIN_DECL */
+
 #include <stdint.h>             /* uintptr_t */
 
 SG_BEGIN_DECL()
@@ -55,9 +56,9 @@ typedef struct s_xbt_dictelm {
   xbt_dictelm_t next;
 } s_xbt_dictelm_t;
 
-XBT_PUBLIC(xbt_dict_t) xbt_dict_new_homogeneous(void_f_pvoid_t free_ctn);
-XBT_PUBLIC(void) xbt_dict_free(xbt_dict_t * dict);
-XBT_PUBLIC(unsigned int) xbt_dict_size(xbt_dict_t dict);
+XBT_PUBLIC xbt_dict_t xbt_dict_new_homogeneous(void_f_pvoid_t free_ctn);
+XBT_PUBLIC void xbt_dict_free(xbt_dict_t* dict);
+XBT_PUBLIC unsigned int xbt_dict_size(xbt_dict_t dict);
 
 /** @} */
 /** @defgroup XBT_dict_basic Dictionaries basic usage
@@ -68,24 +69,24 @@ XBT_PUBLIC(unsigned int) xbt_dict_size(xbt_dict_t dict);
  *  @{
  */
 
-XBT_PUBLIC(void) xbt_dict_set(xbt_dict_t dict, const char *key, void *data, void_f_pvoid_t free_ctn);
-XBT_PUBLIC(void *) xbt_dict_get(xbt_dict_t dict, const char *key);
-XBT_PUBLIC(void *) xbt_dict_get_or_null(xbt_dict_t dict, const char *key);
-XBT_PUBLIC(char*) xbt_dict_get_key(xbt_dict_t dict, const void* data);
-XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC(char*)
-    xbt_dict_get_elm_key(xbt_dictelm_t elem);
-XBT_PUBLIC(xbt_dictelm_t) xbt_dict_get_elm(xbt_dict_t dict, const char *key);
-XBT_PUBLIC(xbt_dictelm_t) xbt_dict_get_elm_or_null(xbt_dict_t dict, const char *key);
-
-XBT_PUBLIC(void) xbt_dict_remove(xbt_dict_t dict, const char *key);
-XBT_PUBLIC(void) xbt_dict_reset(xbt_dict_t dict);
-XBT_PUBLIC(int) xbt_dict_length(xbt_dict_t dict);
-XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC(void)
-    xbt_dict_dump_output_string(void* s);
-XBT_PUBLIC(void) xbt_dict_dump(xbt_dict_t dict, void (*output) (void *));
-XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC(void)
-    xbt_dict_dump_sizes(xbt_dict_t dict);
-XBT_PUBLIC(int) xbt_dict_is_empty(xbt_dict_t dict);
+XBT_PUBLIC void xbt_dict_set(xbt_dict_t dict, const char* key, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC void* xbt_dict_get(xbt_dict_t dict, const char* key);
+XBT_PUBLIC void* xbt_dict_get_or_null(xbt_dict_t dict, const char* key);
+XBT_PUBLIC char* xbt_dict_get_key(xbt_dict_t dict, const void* data);
+XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC
+    char* xbt_dict_get_elm_key(xbt_dictelm_t elem);
+XBT_PUBLIC xbt_dictelm_t xbt_dict_get_elm(xbt_dict_t dict, const char* key);
+XBT_PUBLIC xbt_dictelm_t xbt_dict_get_elm_or_null(xbt_dict_t dict, const char* key);
+
+XBT_PUBLIC void xbt_dict_remove(xbt_dict_t dict, const char* key);
+XBT_PUBLIC void xbt_dict_reset(xbt_dict_t dict);
+XBT_PUBLIC int xbt_dict_length(xbt_dict_t dict);
+XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC
+    void xbt_dict_dump_output_string(void* s);
+XBT_PUBLIC void xbt_dict_dump(xbt_dict_t dict, void (*output)(void*));
+XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC
+    void xbt_dict_dump_sizes(xbt_dict_t dict);
+XBT_PUBLIC int xbt_dict_is_empty(xbt_dict_t dict);
 
 /** @} */
 /** @defgroup XBT_dict_nnul Dictionaries with non-nul terminated keys
@@ -95,10 +96,10 @@ XBT_PUBLIC(int) xbt_dict_is_empty(xbt_dict_t dict);
  *
  *  @{
  */
-XBT_PUBLIC(void) xbt_dict_set_ext(xbt_dict_t dict, const char *key, int key_len, void *data, void_f_pvoid_t free_ctn);
-XBT_PUBLIC(void*) xbt_dict_get_ext(xbt_dict_t dict, const char* key, int key_len);
-XBT_PUBLIC(void*) xbt_dict_get_or_null_ext(xbt_dict_t dict, const char* key, int key_len);
-XBT_PUBLIC(void) xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len);
+XBT_PUBLIC void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC void* xbt_dict_get_ext(xbt_dict_t dict, const char* key, int key_len);
+XBT_PUBLIC void* xbt_dict_get_or_null_ext(xbt_dict_t dict, const char* key, int key_len);
+XBT_PUBLIC void xbt_dict_remove_ext(xbt_dict_t dict, const char* key, int key_len);
 
 struct s_xbt_dict_cursor {
   xbt_dictelm_t current;
@@ -135,19 +136,19 @@ static inline xbt_dictelm_t xbt_dict_cursor_get_elm(xbt_dict_cursor_t cursor) {
   return cursor->current;
 }
 
-XBT_PUBLIC(xbt_dict_cursor_t) xbt_dict_cursor_new(const xbt_dict_t dict);
-XBT_PUBLIC(void) xbt_dict_cursor_free(xbt_dict_cursor_t * cursor);
+XBT_PUBLIC xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict);
+XBT_PUBLIC void xbt_dict_cursor_free(xbt_dict_cursor_t* cursor);
 
-XBT_PUBLIC(void) xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
+XBT_PUBLIC void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor);
 
-XBT_PUBLIC(char *) xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor);
-XBT_PUBLIC(void *) xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor);
-XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC(void)
-    xbt_dict_cursor_set_data(xbt_dict_cursor_t cursor, void* data, void_f_pvoid_t free_ctn);
+XBT_PUBLIC char* xbt_dict_cursor_get_key(xbt_dict_cursor_t cursor);
+XBT_PUBLIC void* xbt_dict_cursor_get_data(xbt_dict_cursor_t cursor);
+XBT_ATTRIB_DEPRECATED_v321("xbt_dict is dying. v3.21 will turn this warning into an error.") XBT_PUBLIC
+    void xbt_dict_cursor_set_data(xbt_dict_cursor_t cursor, void* data, void_f_pvoid_t free_ctn);
 
-XBT_PUBLIC(void) xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t * cursor);
-XBT_PUBLIC(void) xbt_dict_cursor_step(xbt_dict_cursor_t cursor);
-XBT_PUBLIC(int) xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, char **key, void **data);
+XBT_PUBLIC void xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t* cursor);
+XBT_PUBLIC void xbt_dict_cursor_step(xbt_dict_cursor_t cursor);
+XBT_PUBLIC int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t* cursor, char** key, void** data);
 /** @def xbt_dict_foreach
  *  @param dict a \ref xbt_dict_t iterator
  *  @param cursor an \ref xbt_dict_cursor_t used as cursor
index 5484ccd..fee93eb 100644 (file)
@@ -1,6 +1,6 @@
 /* dynar - a generic dynamic array                                          */
 
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -64,14 +64,14 @@ SG_BEGIN_DECL()
    /** \brief Dynar data type (opaque type) */
 typedef struct xbt_dynar_s *xbt_dynar_t;
 
-XBT_PUBLIC(xbt_dynar_t) xbt_dynar_new(const unsigned long elm_size, void_f_pvoid_t const free_f);
-XBT_PUBLIC(void) xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f);
-XBT_PUBLIC(void) xbt_dynar_free(xbt_dynar_t * dynar);
-XBT_PUBLIC(void) xbt_dynar_free_voidp(void *dynar);
-XBT_PUBLIC(void) xbt_dynar_free_container(xbt_dynar_t * dynar);
-XBT_PUBLIC(void) xbt_dynar_free_data(xbt_dynar_t dynar);
-XBT_PUBLIC(void) xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots);
-XBT_PUBLIC(void) xbt_dynar_dump(xbt_dynar_t dynar);
+XBT_PUBLIC xbt_dynar_t xbt_dynar_new(const unsigned long elm_size, void_f_pvoid_t const free_f);
+XBT_PUBLIC void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f);
+XBT_PUBLIC void xbt_dynar_free(xbt_dynar_t* dynar);
+XBT_PUBLIC void xbt_dynar_free_voidp(void* dynar);
+XBT_PUBLIC void xbt_dynar_free_container(xbt_dynar_t* dynar);
+XBT_PUBLIC void xbt_dynar_free_data(xbt_dynar_t dynar);
+XBT_PUBLIC void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots);
+XBT_PUBLIC void xbt_dynar_dump(xbt_dynar_t dynar);
 
 /** @} */
 /** @defgroup XBT_dynar_array Dynar as a regular array
@@ -80,21 +80,21 @@ XBT_PUBLIC(void) xbt_dynar_dump(xbt_dynar_t dynar);
  *  @{
  */
 
-XBT_PUBLIC(void) xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void *const dst);
-XBT_PUBLIC(void) xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void *src);
-XBT_PUBLIC(void) xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void *object);
+XBT_PUBLIC void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst);
+XBT_PUBLIC void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* src);
+XBT_PUBLIC void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* object);
 
-XBT_PUBLIC(void) xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void *src);
-XBT_PUBLIC(void) xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void *const dst);
-XBT_PUBLIC(void) xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx);
+XBT_PUBLIC void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* src);
+XBT_PUBLIC void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const dst);
+XBT_PUBLIC void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx);
 
-XBT_PUBLIC(unsigned int) xbt_dynar_search(xbt_dynar_t const dynar, void *elem);
-XBT_PUBLIC(signed int) xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void *const elem);
-XBT_PUBLIC(int) xbt_dynar_member(xbt_dynar_t const dynar, void *elem);
-XBT_PUBLIC(void) xbt_dynar_sort(xbt_dynar_t const dynar, int_f_cpvoid_cpvoid_t compar_fn);
-XBT_PUBLIC(xbt_dynar_t) xbt_dynar_sort_strings(xbt_dynar_t dynar);
-XBT_PUBLIC(int) xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int(*compar)(const void *, const void *));
-XBT_PUBLIC(void *) xbt_dynar_to_array (xbt_dynar_t dynar);
+XBT_PUBLIC unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* elem);
+XBT_PUBLIC signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem);
+XBT_PUBLIC int xbt_dynar_member(xbt_dynar_t const dynar, void* elem);
+XBT_PUBLIC void xbt_dynar_sort(xbt_dynar_t const dynar, int_f_cpvoid_cpvoid_t compar_fn);
+XBT_PUBLIC xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar);
+XBT_PUBLIC int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*));
+XBT_PUBLIC void* xbt_dynar_to_array(xbt_dynar_t dynar);
 
 /** @} */
 /** @defgroup XBT_dynar_misc Dynar miscellaneous functions
@@ -103,10 +103,10 @@ XBT_PUBLIC(void *) xbt_dynar_to_array (xbt_dynar_t dynar);
  *  @{
  */
 
-XBT_PUBLIC(unsigned long) xbt_dynar_length(const xbt_dynar_t dynar);
-XBT_PUBLIC(int) xbt_dynar_is_empty(const xbt_dynar_t dynar);
-XBT_PUBLIC(void) xbt_dynar_reset(xbt_dynar_t const dynar);
-XBT_PUBLIC(void) xbt_dynar_merge(xbt_dynar_t *d1, xbt_dynar_t *d2);
+XBT_PUBLIC unsigned long xbt_dynar_length(const xbt_dynar_t dynar);
+XBT_PUBLIC int xbt_dynar_is_empty(const xbt_dynar_t dynar);
+XBT_PUBLIC void xbt_dynar_reset(xbt_dynar_t const dynar);
+XBT_PUBLIC void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2);
 
 /** @} */
 /** @defgroup XBT_dynar_perl Perl-like use of dynars
@@ -115,11 +115,11 @@ XBT_PUBLIC(void) xbt_dynar_merge(xbt_dynar_t *d1, xbt_dynar_t *d2);
  *  @{
  */
 
-XBT_PUBLIC(void) xbt_dynar_push(xbt_dynar_t const dynar, const void *src);
-XBT_PUBLIC(void) xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst);
-XBT_PUBLIC(void) xbt_dynar_unshift(xbt_dynar_t const dynar, const void *src);
-XBT_PUBLIC(void) xbt_dynar_shift(xbt_dynar_t const dynar, void *const dst);
-XBT_PUBLIC(void) xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op);
+XBT_PUBLIC void xbt_dynar_push(xbt_dynar_t const dynar, const void* src);
+XBT_PUBLIC void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst);
+XBT_PUBLIC void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* src);
+XBT_PUBLIC void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst);
+XBT_PUBLIC void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op);
 
 /** @} */
 /** @defgroup XBT_dynar_ctn Direct manipulation to the dynars content
@@ -130,11 +130,11 @@ XBT_PUBLIC(void) xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
  *  @{
  */
 
-XBT_PUBLIC(void *) xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx);
-XBT_PUBLIC(void *) xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx);
-XBT_PUBLIC(void *) xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx);
-XBT_PUBLIC(void *) xbt_dynar_push_ptr(xbt_dynar_t const dynar);
-XBT_PUBLIC(void *) xbt_dynar_pop_ptr(xbt_dynar_t const dynar);
+XBT_PUBLIC void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx);
+XBT_PUBLIC void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx);
+XBT_PUBLIC void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx);
+XBT_PUBLIC void* xbt_dynar_push_ptr(xbt_dynar_t const dynar);
+XBT_PUBLIC void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar);
 
 /** @} */
 /** @defgroup XBT_dynar_speed Speed optimized access to dynars of scalars
@@ -187,7 +187,7 @@ XBT_PUBLIC(void *) xbt_dynar_pop_ptr(xbt_dynar_t const dynar);
  *  @{
  */
 
-XBT_PUBLIC(void) xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int *const cursor);
+XBT_PUBLIC void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor);
 
 /*
  * \warning DO NOT USE THIS STRUCTURE DIRECTLY! Instead, use the public interface:
@@ -205,20 +205,20 @@ typedef struct xbt_dynar_s {
   void_f_pvoid_t free_f;
 } s_xbt_dynar_t;
 
-static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, void *const dst)
+static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int idx, voidconst dst)
 {
   if (!dynar) /* iterating over a NULL dynar is a no-op */
-    return FALSE;
+    return false;
 
   if (idx >= dynar->used) {
     //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
-    return FALSE;
+    return false;
   }
   //  XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
 
   memcpy(dst, ((char *) dynar->data) + idx * dynar->elmsize, dynar->elmsize);
 
-  return TRUE;
+  return true;
 }
 
 /** @brief Iterates over the whole dynar.
index 78ade07..dc6596c 100644 (file)
@@ -1,54 +1,17 @@
-/* Copyright (c) 2005-2017. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/*  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>       */
-/*  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>         */
-/*  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>           */
-/*  All rights reserved.                                                    */
-
-/* This code is inspirated from the OSSP version (as retrieved back in 2004)*/
-/* It was heavily modified to fit the SimGrid framework.                    */
-
-/* The OSSP version has the following copyright notice:
-**  OSSP ex - Exception Handling
-**  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
-**  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
-**
-**  This file is part of OSSP ex, an exception handling library
-**  which can be found at http://www.ossp.org/pkg/lib/ex/.
-**
-**  Permission to use, copy, modify, and distribute this software for
-**  any purpose with or without fee is hereby granted, provided that
-**  the above copyright notice and this permission notice appear in all
-**  copies.
-**
-**  THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESSED OR IMPLIED
-**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
-**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-**  SUCH DAMAGE.
- */
+/* Copyright (c) 2005-2018. The SimGrid Team. All rights reserved.          */
 
-/* The extensions made for the SimGrid project can either be distributed    */
-/* under the same license, or under the LGPL v2.1                           */
+/* 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. */
 
 #ifndef XBT_EX_H
 #define XBT_EX_H
 
 #include <stdlib.h>
 
-#include "xbt/base.h"
-#include "xbt/sysdep.h"
-#include "xbt/misc.h"
-#include "xbt/virtu.h"
+#include <xbt/base.h>
+#include <xbt/misc.h>
+#include <xbt/sysdep.h>
+#include <xbt/virtu.h>
 
 /** @addtogroup XBT_ex_c
  *  @brief Exceptions support (C)
@@ -87,13 +50,13 @@ SG_BEGIN_DECL()
 /** Get the name of a category
  *  @ingroup XBT_ex_c
  */
-XBT_PUBLIC(const char *) xbt_ex_catname(xbt_errcat_t cat);
+XBT_PUBLIC const char* xbt_ex_catname(xbt_errcat_t cat);
 
 typedef struct xbt_ex xbt_ex_t;
 
 /** Helper function used to throw exceptions in C */
-XBT_ATTRIB_NORETURN XBT_PUBLIC(void)
-    _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file, int line, const char* func);
+XBT_ATTRIB_NORETURN XBT_PUBLIC void _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file,
+                                               int line, const char* func);
 
 /** Builds and throws an exception
  *  @ingroup XBT_ex_c
@@ -131,7 +94,7 @@ XBT_ATTRIB_NORETURN XBT_PUBLIC(void)
 #define DIE_IMPOSSIBLE xbt_die("The Impossible Did Happen (yet again)")
 
 /** Display an exception */
-XBT_PUBLIC(void) xbt_ex_display(xbt_ex_t * e);
+XBT_PUBLIC void xbt_ex_display(xbt_ex_t* e);
 
 SG_END_DECL()
 
index 7e64973..9b6ff5f 100644 (file)
@@ -1,44 +1,8 @@
-/* Copyright (c) 2005-2017. The SimGrid Team.
+/* Copyright (c) 2005-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
-/*  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>       */
-/*  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>         */
-/*  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>           */
-/*  All rights reserved.                                                    */
-
-/* This code is inspirated from the OSSP version (as retrieved back in 2004)*/
-/* It was heavily modified to fit the SimGrid framework.                    */
-
-/* The OSSP version has the following copyright notice:
-**  OSSP ex - Exception Handling
-**  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
-**  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
-**
-**  This file is part of OSSP ex, an exception handling library
-**  which can be found at http://www.ossp.org/pkg/lib/ex/.
-**
-**  Permission to use, copy, modify, and distribute this software for
-**  any purpose with or without fee is hereby granted, provided that
-**  the above copyright notice and this permission notice appear in all
-**  copies.
-**
-**  THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESSED OR IMPLIED
-**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
-**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-**  SUCH DAMAGE.
- */
-
-/* The extensions made for the SimGrid project can either be distributed    */
-/* under the same license, or under the LGPL v2.1                           */
+/* 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. */
 
 #ifndef SIMGRID_XBT_EX_HPP
 #define SIMGRID_XBT_EX_HPP
  *
  *  @ingroup XBT_ex_c
  */
-struct XBT_PUBLIC() xbt_ex :
-  std::runtime_error,
-  simgrid::xbt::WithContextException {
-
+class XBT_PUBLIC xbt_ex : public std::runtime_error, public simgrid::xbt::WithContextException {
+public:
   xbt_ex() :
     std::runtime_error("")
   {}
@@ -79,7 +41,7 @@ struct XBT_PUBLIC() xbt_ex :
     simgrid::xbt::WithContextException(throwpoint, simgrid::xbt::backtrace())
   {}
 
-  ~xbt_ex();
+  ~xbt_ex(); // DO NOT define it here -- see ex.cpp for a rationale
 
   /** Category (what went wrong) */
   xbt_errcat_t category = unknown_error;
index 3d648a1..8fa032d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2017. The SimGrid Team.All rights reserved. */
+/* Copyright (c) 2005-2018. 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. */
@@ -65,7 +65,7 @@ class ThrowPoint {
  *  However, you can try `dynamic_cast` an exception to this type in order to
  *  get contextual information about the exception.
  */
-XBT_PUBLIC_CLASS WithContextException {
+class XBT_PUBLIC WithContextException {
 public:
   WithContextException() :
     backtrace_(simgrid::xbt::backtrace()),
index f9883a5..a08d990 100644 (file)
@@ -1,6 +1,6 @@
 /* function_type.h - classical types for pointer to function                */
 
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -8,7 +8,7 @@
 #ifndef XBT_FUNCTION_TYPE_H
 #define XBT_FUNCTION_TYPE_H
 
-#include "xbt/base.h"
+#include <xbt/base.h>
 
 SG_BEGIN_DECL()
 
index 8b73dab..1c6983a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -6,6 +6,9 @@
 #ifndef XBT_FUNCTIONAL_HPP
 #define XBT_FUNCTIONAL_HPP
 
+#include <xbt/sysdep.h>
+#include <xbt/utility.hpp>
+
 #include <cstddef>
 #include <cstdlib>
 #include <cstring>
@@ -20,9 +23,6 @@
 #include <utility>
 #include <vector>
 
-#include "xbt/sysdep.h"
-#include "xbt/utility.hpp"
-
 namespace simgrid {
 namespace xbt {
 
index 91ad42f..e4cd6ef 100644 (file)
@@ -1,12 +1,14 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
 
 #ifndef XBT_GRAPH_H
 #define XBT_GRAPH_H
-#include "xbt/misc.h"           /* SG_BEGIN_DECL */
-#include "xbt/dynar.h"
+
+#include <xbt/dynar.h>
+#include <xbt/misc.h> /* SG_BEGIN_DECL */
+
 SG_BEGIN_DECL()
 
   /** @addtogroup XBT_graph
@@ -50,24 +52,24 @@ typedef struct xbt_graph {
 } s_xbt_graph_t;
 
 /* API */
-XBT_PUBLIC(xbt_graph_t) xbt_graph_new_graph(unsigned short int directed, void *data);
-XBT_PUBLIC(xbt_node_t) xbt_graph_new_node(xbt_graph_t g, void *data);
-XBT_PUBLIC(xbt_edge_t) xbt_graph_new_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst, void *data);
-XBT_PUBLIC(void *) xbt_graph_node_get_data(xbt_node_t node);
-XBT_PUBLIC(void) xbt_graph_node_set_data(xbt_node_t node, void *data);
-XBT_PUBLIC(void *) xbt_graph_edge_get_data(xbt_edge_t edge);
-XBT_PUBLIC(void) xbt_graph_edge_set_data(xbt_edge_t edge, void *data);
+XBT_PUBLIC xbt_graph_t xbt_graph_new_graph(unsigned short int directed, void* data);
+XBT_PUBLIC xbt_node_t xbt_graph_new_node(xbt_graph_t g, void* data);
+XBT_PUBLIC xbt_edge_t xbt_graph_new_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst, void* data);
+XBT_PUBLIC void* xbt_graph_node_get_data(xbt_node_t node);
+XBT_PUBLIC void xbt_graph_node_set_data(xbt_node_t node, void* data);
+XBT_PUBLIC void* xbt_graph_edge_get_data(xbt_edge_t edge);
+XBT_PUBLIC void xbt_graph_edge_set_data(xbt_edge_t edge, void* data);
 
-XBT_PUBLIC(xbt_edge_t) xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst);
+XBT_PUBLIC xbt_edge_t xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src, xbt_node_t dst);
 
-XBT_PUBLIC(void) xbt_graph_free_graph(xbt_graph_t g,
-    void_f_pvoid_t node_free_function, void_f_pvoid_t edge_free_function, void_f_pvoid_t graph_free_function);
+XBT_PUBLIC void xbt_graph_free_graph(xbt_graph_t g, void_f_pvoid_t node_free_function,
+                                     void_f_pvoid_t edge_free_function, void_f_pvoid_t graph_free_function);
 
-XBT_PUBLIC(xbt_dynar_t) xbt_graph_get_nodes(xbt_graph_t g);
-XBT_PUBLIC(xbt_dynar_t) xbt_graph_get_edges(xbt_graph_t g);
-XBT_PUBLIC(xbt_dynar_t) xbt_graph_node_get_outedges(xbt_node_t n);
-XBT_PUBLIC(xbt_node_t) xbt_graph_edge_get_source(xbt_edge_t e);
-XBT_PUBLIC(xbt_node_t) xbt_graph_edge_get_target(xbt_edge_t e);
+XBT_PUBLIC xbt_dynar_t xbt_graph_get_nodes(xbt_graph_t g);
+XBT_PUBLIC xbt_dynar_t xbt_graph_get_edges(xbt_graph_t g);
+XBT_PUBLIC xbt_dynar_t xbt_graph_node_get_outedges(xbt_node_t n);
+XBT_PUBLIC xbt_node_t xbt_graph_edge_get_source(xbt_edge_t e);
+XBT_PUBLIC xbt_node_t xbt_graph_edge_get_target(xbt_edge_t e);
 
 SG_END_DECL()
 #endif /* XBT_GRAPH_H */
index 7819e7e..34bc142 100644 (file)
@@ -28,9 +28,9 @@
 #ifndef XBT_LOG_H
 #define XBT_LOG_H
 
-#include "xbt/misc.h"
 #include <stdarg.h>
-#include <stddef.h>             /* NULL */
+#include <stddef.h> /* NULL */
+#include <xbt/misc.h>
 SG_BEGIN_DECL()
 /**\brief Log priorities
  * \ingroup XBT_log
@@ -112,8 +112,7 @@ typedef enum {
     }                                                                                                                  \
   }                                                                                                                    \
   SG_END_DECL()                                                                                                        \
-  XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t)                                                                           \
-  _XBT_LOGV(catName) = {                                                                                               \
+  XBT_EXPORT_NO_IMPORT s_xbt_log_category_t _XBT_LOGV(catName) = {                                                     \
       &_XBT_LOGV(parent),                                                                                              \
       NULL /* firstChild */,                                                                                           \
       NULL /* nextSibling */,                                                                                          \
@@ -218,7 +217,7 @@ typedef enum {
 
 /* Functions you may call */
 
-XBT_PUBLIC(void) xbt_log_control_set(const char *cs);
+XBT_PUBLIC void xbt_log_control_set(const char* cs);
 
 /* Forward declarations */
 typedef struct xbt_log_appender_s  s_xbt_log_appender_t;
@@ -264,7 +263,7 @@ struct xbt_log_event_s {
  *
  * Programatically alters a category's threshold priority (don't use).
  */
-XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat, e_xbt_log_priority_t thresholdPriority);
+XBT_PUBLIC void xbt_log_threshold_set(xbt_log_category_t cat, e_xbt_log_priority_t thresholdPriority);
 
 /**
  * \ingroup XBT_log_implem
@@ -273,7 +272,7 @@ XBT_PUBLIC(void) xbt_log_threshold_set(xbt_log_category_t cat, e_xbt_log_priorit
  *
  * Programatically sets the category's appender. (the preferred interface is through xbt_log_control_set())
  */
-XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app);
+XBT_PUBLIC void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app);
 /**
  * \ingroup XBT_log_implem
  * \param cat the category (not only its name, but the variable)
@@ -281,7 +280,7 @@ XBT_PUBLIC(void) xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t
  *
  * Programatically sets the category's layout. (the preferred interface is through xbt_log_control_set())
  */
-XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay);
+XBT_PUBLIC void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay);
 
 /**
  * \ingroup XBT_log_implem
@@ -291,26 +290,26 @@ XBT_PUBLIC(void) xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay
  * Programatically sets whether the logging actions must be passed to the parent category.
  * (the preferred interface is through xbt_log_control_set())
  */
-XBT_PUBLIC(void) xbt_log_additivity_set(xbt_log_category_t cat, int additivity);
+XBT_PUBLIC void xbt_log_additivity_set(xbt_log_category_t cat, int additivity);
 
 /** @brief create a new simple layout
  *
  * This layout is not as flexible as the pattern one
  */
-XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char *arg);
-XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char *arg);
-XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char *arg);
-XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender2_file_new(char *arg,int roll);
+XBT_PUBLIC xbt_log_layout_t xbt_log_layout_simple_new(char* arg);
+XBT_PUBLIC xbt_log_layout_t xbt_log_layout_format_new(char* arg);
+XBT_PUBLIC xbt_log_appender_t xbt_log_appender_file_new(char* arg);
+XBT_PUBLIC xbt_log_appender_t xbt_log_appender2_file_new(char* arg, int roll);
 
 /* ********************************** */
 /* Functions that you shouldn't call  */
 /* ********************************** */
-XBT_PUBLIC(void) xbt_log_init(int *argc, char **argv);
-XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...) XBT_ATTRIB_PRINTF(2, 3);
-XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority);
+XBT_PUBLIC void xbt_log_init(int* argc, char** argv);
+XBT_PUBLIC void _xbt_log_event_log(xbt_log_event_t ev, const char* fmt, ...) XBT_ATTRIB_PRINTF(2, 3);
+XBT_PUBLIC int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority);
 
 #ifdef DLL_EXPORT
-XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
+XBT_PUBLIC_DATA s_xbt_log_category_t _XBT_LOGV(XBT_LOG_ROOT_CAT);
 #else
 // If we `dllexport` the root log category, MinGW does not want us to take its address with the error:
 // > initializer element is not constant
index 6dbf711..4b4826c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016. The SimGrid Team. All rights reserved.*/
+/* Copyright (c) 2016, 2018. 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. */
@@ -16,11 +16,8 @@ namespace xbt {
  *
  *  @ingroup XBT_ex
  */
-XBT_PUBLIC(void) logException(
-  e_xbt_log_priority_t priority,
-  const char* context, std::exception const& exception);
-
-XBT_PUBLIC(void) installExceptionHandler();
+XBT_PUBLIC void logException(e_xbt_log_priority_t priority, const char* context, std::exception const& exception);
 
+XBT_PUBLIC void installExceptionHandler();
 }
 }
index d0b0f36..7b76ed8 100644 (file)
@@ -1,7 +1,6 @@
 /* xbt/mallocator.h -- api to recycle allocated objects                     */
 
-/* Copyright (c) 2006-2007, 2009-2010, 2012-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2018. 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. */
@@ -9,8 +8,9 @@
 #ifndef XBT_MALLOCATOR_H
 #define XBT_MALLOCATOR_H
 
-#include "xbt/function_types.h"
-#include "xbt/misc.h"
+#include <xbt/function_types.h>
+#include <xbt/misc.h>
+
 SG_BEGIN_DECL()
 
 /** @addtogroup XBT_mallocator
@@ -33,9 +33,9 @@ SG_BEGIN_DECL()
  */
 /** \brief Mallocator data type (opaque structure) */
 typedef struct s_xbt_mallocator *xbt_mallocator_t;
-XBT_PUBLIC(xbt_mallocator_t) xbt_mallocator_new(int size, pvoid_f_void_t new_f, void_f_pvoid_t free_f,
-                                                void_f_pvoid_t reset_f);
-XBT_PUBLIC(void) xbt_mallocator_free(xbt_mallocator_t mallocator);
+XBT_PUBLIC xbt_mallocator_t xbt_mallocator_new(int size, pvoid_f_void_t new_f, void_f_pvoid_t free_f,
+                                               void_f_pvoid_t reset_f);
+XBT_PUBLIC void xbt_mallocator_free(xbt_mallocator_t mallocator);
 /** @} */
 
 /* object handling */
@@ -44,10 +44,10 @@ XBT_PUBLIC(void) xbt_mallocator_free(xbt_mallocator_t mallocator);
  *
  *  @{
  */
-XBT_PUBLIC(void *) xbt_mallocator_get(xbt_mallocator_t mallocator);
-XBT_PUBLIC(void) xbt_mallocator_release(xbt_mallocator_t mallocator, void *object);
+XBT_PUBLIC void* xbt_mallocator_get(xbt_mallocator_t mallocator);
+XBT_PUBLIC void xbt_mallocator_release(xbt_mallocator_t mallocator, void* object);
 
-XBT_PUBLIC(void) xbt_mallocator_initialization_is_done(int protect);
+XBT_PUBLIC void xbt_mallocator_initialization_is_done(int protect);
 /** @} */
 
 SG_END_DECL()
index dc19d77..c04f208 100644 (file)
@@ -1,7 +1,6 @@
-/* xbt.h - Public interface to the xbt (simgrid's toolbox)                     */
+/* xbt.h - Public interface to the xbt (simgrid's toolbox)                  */
 
-/* Copyright (c) 2004-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2018. 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. */
@@ -9,25 +8,25 @@
 #ifndef XBT_MISC_H
 #define XBT_MISC_H
 
-#include "simgrid_config.h"
-#include "base.h"
-#include "dynar.h"
+#include <simgrid_config.h>
+#include <xbt/base.h>
+#include <xbt/dynar.h>
 
 #include <stdarg.h>
 
 SG_BEGIN_DECL()
 
 /** Cache the size of a memory page for the current system. */
-XBT_PUBLIC_DATA(int) xbt_pagesize;
+XBT_PUBLIC_DATA int xbt_pagesize;
 
 /** Cache the number of bits of addresses inside a given page, log2(xbt_pagesize). */
-XBT_PUBLIC_DATA(int) xbt_pagebits;
+XBT_PUBLIC_DATA int xbt_pagebits;
 
 /** Helps ensuring that header version (SIMGRID_VERSION_MAJOR and friends) and dynamic library version do match. */
-XBT_PUBLIC(void) sg_version_check(int lib_version_major,int lib_version_minor,int lib_version_patch);
+XBT_PUBLIC void sg_version_check(int lib_version_major, int lib_version_minor, int lib_version_patch);
 
 /** Contains all the parameters we got from the command line */
-XBT_PUBLIC_DATA(xbt_dynar_t) sg_cmdline;
+XBT_PUBLIC_DATA xbt_dynar_t sg_cmdline;
 
 /* snprintf related functions */
 /** @addtogroup XBT_str
@@ -37,12 +36,12 @@ XBT_PUBLIC_DATA(xbt_dynar_t) sg_cmdline;
  *
  * Similar to vasprintf(), but returns a pointer to the newly created string (or aborts on error).
  */
-XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
+XBT_PUBLIC char* bvprintf(const char* fmt, va_list ap);
 /** @brief print to allocated string
  *
  * Similar to asprintf(), but returns a pointer to the newly created string (or aborts on error).
  */
-XBT_PUBLIC(char *) bprintf(const char *fmt, ...) XBT_ATTRIB_PRINTF(1, 2);
+XBT_PUBLIC char* bprintf(const char* fmt, ...) XBT_ATTRIB_PRINTF(1, 2);
 /** @} */
 
 SG_END_DECL()
index ba5b03f..353baad 100644 (file)
@@ -1,6 +1,6 @@
 /* module - modularize the code                                             */
 
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -12,7 +12,7 @@
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(void) xbt_init(int *argc, char **argv);
+XBT_PUBLIC void xbt_init(int* argc, char** argv);
 
 SG_END_DECL()
 
index a969fbc..0658148 100644 (file)
@@ -1,7 +1,6 @@
 /* xbt/replay_reader.h -- Tools to parse a replay file                */
 
-/* Copyright (c) 2010, 2012-2015, 2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -9,9 +8,10 @@
 #ifndef XBT_REPLAY_HPP
 #define XBT_REPLAY_HPP
 
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
-#ifdef __cplusplus
+#include <xbt/misc.h> /* SG_BEGIN_DECL */
+
 #include <fstream>
+#include <functional>
 #include <queue>
 #include <unordered_map>
 
@@ -19,20 +19,14 @@ namespace simgrid {
 namespace xbt {
 /* To split the file if a unique one is given (specific variable for the other case live in runner()) */
 typedef std::vector<std::string> ReplayAction;
-static std::unordered_map<std::string, std::queue<ReplayAction*>*> action_queues;
 
-XBT_PUBLIC_DATA(std::ifstream*) action_fs;
-XBT_PUBLIC(int) replay_runner(int argc, char* argv[]);
+XBT_PUBLIC_DATA std::ifstream* action_fs;
+XBT_PUBLIC int replay_runner(int argc, char* argv[]);
 }
 }
-#endif
-
-SG_BEGIN_DECL()
-
-typedef void (*action_fun)(const char* const* args);
-XBT_PUBLIC(void) xbt_replay_action_register(const char* action_name, action_fun function);
-XBT_PUBLIC(action_fun) xbt_replay_action_get(const char* action_name);
 
-SG_END_DECL()
+typedef std::function<void(simgrid::xbt::ReplayAction&)> action_fun;
+XBT_PUBLIC void xbt_replay_action_register(const char* action_name, action_fun function);
+XBT_PUBLIC action_fun xbt_replay_action_get(const char* action_name);
 
 #endif
index 8068459..7880b4b 100644 (file)
@@ -1,7 +1,6 @@
 /* str.h - XBT string related functions.                                    */
 
-/* Copyright (c) 2007-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2018. 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. */
@@ -9,12 +8,11 @@
 #ifndef XBT_STR_H
 #define XBT_STR_H
 
-#include "xbt/dict.h"
-#include "xbt/dynar.h"
-#include "xbt/misc.h"
+#include <xbt/dict.h>
+#include <xbt/dynar.h>
+#include <xbt/misc.h>
 
-#include <stdarg.h>             /* va_* */
-#include <stdio.h>  /* FILE */
+#include <stdarg.h> /* va_* */
 
 SG_BEGIN_DECL()
 
@@ -26,14 +24,14 @@ SG_BEGIN_DECL()
  * @{
  */
 
-XBT_PUBLIC(xbt_dynar_t) xbt_str_split(const char *s, const char *sep);
-XBT_PUBLIC(xbt_dynar_t) xbt_str_split_quoted(const char *s);
-XBT_PUBLIC(xbt_dynar_t) xbt_str_split_quoted_in_place(char *s);
+XBT_PUBLIC xbt_dynar_t xbt_str_split(const char* s, const char* sep);
+XBT_PUBLIC xbt_dynar_t xbt_str_split_quoted(const char* s);
+XBT_PUBLIC xbt_dynar_t xbt_str_split_quoted_in_place(char* s);
 
-XBT_PUBLIC(char *) xbt_str_join_array(const char *const *strs, const char *sep);
+XBT_PUBLIC char* xbt_str_join_array(const char* const* strs, const char* sep);
 
-XBT_PUBLIC(long int) xbt_str_parse_int(const char* str, const char* error_msg);
-XBT_PUBLIC(double) xbt_str_parse_double(const char* str, const char* error_msg);
+XBT_PUBLIC long int xbt_str_parse_int(const char* str, const char* error_mesg);
+XBT_PUBLIC double xbt_str_parse_double(const char* str, const char* error_mesg);
 
 #define XBT_DJB2_HASH_FUNCTION
 //#define XBT_FNV_HASH_FUNCTION
@@ -41,7 +39,7 @@ XBT_PUBLIC(double) xbt_str_parse_double(const char* str, const char* error_msg);
 /**
  * @brief Returns the hash code of a string.
  */
-static inline unsigned int xbt_str_hash_ext(const char *str, int str_len)
+static inline unsigned int xbt_str_hash_ext(const charstr, int str_len)
 {
 #ifdef XBT_DJB2_HASH_FUNCTION
   /* fast implementation of djb2 algorithm */
index 0cc1c48..bb237f0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -54,7 +54,7 @@ struct string_data {
  *  * the [C++11-conforming implementation](https://gcc.gnu.org/gcc-5/changes.html)
  *    does not use refcouting/COW but has a small string optimization.
  */
-XBT_PUBLIC_CLASS string : private string_data {
+class XBT_PUBLIC string : private string_data {
   static char NUL;
 
 public:
@@ -300,13 +300,13 @@ typedef std::string string;
  *
  * @ingroup XBT_str
 */
-XBT_PUBLIC(std::string) string_printf(const char* fmt, ...);
+XBT_PUBLIC std::string string_printf(const char* fmt, ...);
 
 /** Create a C++ string from a C-style format
  *
  * @ingroup XBT_str
 */
-XBT_PUBLIC(std::string) string_vprintf(const char* fmt, va_list ap);
+XBT_PUBLIC std::string string_vprintf(const char* fmt, va_list ap);
 }
 }
 
index e5f7d06..a03505a 100644 (file)
@@ -1,6 +1,6 @@
 /* xbt/synchro.h -- Simulated synchronization                               */
 
-/* Copyright (c) 2009-2016. The SimGrid Team.                               */
+/* Copyright (c) 2009-2018. The SimGrid Team.                               */
 
 /* 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. */
@@ -8,8 +8,8 @@
 #ifndef XBT_THREAD_H
 #define XBT_THREAD_H
 
-#include "xbt/function_types.h"
-#include "xbt/misc.h" /* SG_BEGIN_DECL */
+#include <xbt/function_types.h>
+#include <xbt/misc.h> /* SG_BEGIN_DECL */
 
 SG_BEGIN_DECL()
 
@@ -29,10 +29,10 @@ SG_BEGIN_DECL()
 typedef struct s_smx_mutex_* xbt_mutex_t;
 
 /** @brief Creates a new mutex variable */
-XBT_PUBLIC(xbt_mutex_t) xbt_mutex_init(void);
+XBT_PUBLIC xbt_mutex_t xbt_mutex_init(void);
 
 /** @brief Blocks onto the given mutex variable */
-XBT_PUBLIC(void) xbt_mutex_acquire(xbt_mutex_t mutex);
+XBT_PUBLIC void xbt_mutex_acquire(xbt_mutex_t mutex);
 
 /** @brief Tries to block onto the given mutex variable
  * Tries to lock a mutex, return 1 if the mutex is unlocked, else 0.
@@ -40,13 +40,13 @@ XBT_PUBLIC(void) xbt_mutex_acquire(xbt_mutex_t mutex);
  * \param mutex The mutex
  * \return 1 - mutex free, 0 - mutex used
  */
-XBT_PUBLIC(int) xbt_mutex_try_acquire(xbt_mutex_t mutex);
+XBT_PUBLIC int xbt_mutex_try_acquire(xbt_mutex_t mutex);
 
 /** @brief Releases the given mutex variable */
-XBT_PUBLIC(void) xbt_mutex_release(xbt_mutex_t mutex);
+XBT_PUBLIC void xbt_mutex_release(xbt_mutex_t mutex);
 
 /** @brief Destroyes the given mutex variable */
-XBT_PUBLIC(void) xbt_mutex_destroy(xbt_mutex_t mutex);
+XBT_PUBLIC void xbt_mutex_destroy(xbt_mutex_t mutex);
 
 /** @brief Thread condition data type (opaque object)
  *  @hideinitializer
@@ -54,19 +54,19 @@ XBT_PUBLIC(void) xbt_mutex_destroy(xbt_mutex_t mutex);
 typedef struct s_smx_cond_* xbt_cond_t;
 
 /** @brief Creates a condition variable */
-XBT_PUBLIC(xbt_cond_t) xbt_cond_init(void);
+XBT_PUBLIC xbt_cond_t xbt_cond_init(void);
 
 /** @brief Blocks onto the given condition variable */
-XBT_PUBLIC(void) xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex);
+XBT_PUBLIC void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex);
 /** @brief Blocks onto the given condition variable, but only for the given amount of time.
  *  @return 0 on success, 1 on timeout */
-XBT_PUBLIC(int) xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay);
+XBT_PUBLIC int xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay);
 /** @brief Signals the given mutex variable */
-XBT_PUBLIC(void) xbt_cond_signal(xbt_cond_t cond);
+XBT_PUBLIC void xbt_cond_signal(xbt_cond_t cond);
 /** @brief Broadcasts the given mutex variable */
-XBT_PUBLIC(void) xbt_cond_broadcast(xbt_cond_t cond);
+XBT_PUBLIC void xbt_cond_broadcast(xbt_cond_t cond);
 /** @brief Destroys the given mutex variable */
-XBT_PUBLIC(void) xbt_cond_destroy(xbt_cond_t cond);
+XBT_PUBLIC void xbt_cond_destroy(xbt_cond_t cond);
 
 /** @} */
 
index 3cbeb65..44ef89a 100644 (file)
@@ -2,8 +2,7 @@
 /*  no system header should be loaded out of this file so that we have only */
 /*  one file to check when porting to another OS                            */
 
-/* Copyright (c) 2004-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2018. 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. */
 #ifndef XBT_SYSDEP_H
 #define XBT_SYSDEP_H
 
-#include "xbt/log.h"
-#include "xbt/misc.h"
-#include "xbt/asserts.h"
+#include <xbt/asserts.h>
+#include <xbt/log.h>
+#include <xbt/misc.h>
 
-#include "simgrid_config.h"
+#include <simgrid_config.h>
 
 #include <string.h>
 #include <stdlib.h>
@@ -31,7 +30,7 @@ SG_BEGIN_DECL()
  * @{
  */
 /** @brief Kill the program in silence */
-XBT_ATTRIB_NORETURN XBT_PUBLIC(void) xbt_abort(void);
+XBT_ATTRIB_NORETURN XBT_PUBLIC void xbt_abort(void);
 
 /**
  * @brief Kill the program with an error message
@@ -71,7 +70,7 @@ static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) {
   return res;
 }
 
-XBT_PUBLIC(void) xbt_backtrace_display_current();
+XBT_PUBLIC void xbt_backtrace_display_current();
 
 /** @brief Like malloc, but xbt_die() on error
     @hideinitializer */
@@ -114,9 +113,9 @@ static XBT_ALWAYS_INLINE void *xbt_realloc(void *p, size_t s) {
 #define xbt_free(p) free(p) /*nothing specific to do here. A poor valgrind replacement? */
 
 /** @brief like free, but you can be sure that it is a function  */
-XBT_PUBLIC(void) xbt_free_f(void *p);
+XBT_PUBLIC void xbt_free_f(void* p);
 /** @brief should be given a pointer to pointer, and frees the second one */
-XBT_PUBLIC(void) xbt_free_ref(void *d);
+XBT_PUBLIC void xbt_free_ref(void* d);
 
 SG_END_DECL()
 
index bb4bad2..834d39f 100644 (file)
@@ -1,6 +1,6 @@
 /* virtu - virtualization layer for the logging to know about the actors    */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -8,22 +8,22 @@
 #ifndef XBT_VIRTU_H
 #define XBT_VIRTU_H
 
-#include "xbt/misc.h"
-#include "xbt/base.h"
-#include "xbt/function_types.h"
-#include "xbt/dynar.h"
+#include <xbt/base.h>
+#include <xbt/dynar.h>
+#include <xbt/function_types.h>
+#include <xbt/misc.h>
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(const char*) xbt_procname(void);
+XBT_PUBLIC const char* xbt_procname(void);
 
-XBT_PUBLIC(int) xbt_getpid(void);
+XBT_PUBLIC int xbt_getpid(void);
 
 /* Get the name of the UNIX process englobing the world */
-XBT_PUBLIC_DATA(char*) xbt_binary_name;
+XBT_PUBLIC_DATA char* xbt_binary_name;
 
 /** Contains all the parameters we got from the command line (including argv[0]) */
-XBT_PUBLIC_DATA(xbt_dynar_t) xbt_cmdline;
+XBT_PUBLIC_DATA xbt_dynar_t xbt_cmdline;
 
 SG_END_DECL()
 #endif /* XBT_VIRTU_H */
index 23b8fc8..9c8c05e 100644 (file)
@@ -1,6 +1,6 @@
 /* xbt/xbt_os_thread.h -- Thread portability layer                          */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -8,11 +8,12 @@
 #ifndef XBT_OS_THREAD_H
 #define XBT_OS_THREAD_H
 
-#include "xbt/base.h"
-
 SG_BEGIN_DECL()
 
+#include <xbt/base.h>
+
 #include <pthread.h>
+
 typedef pthread_key_t xbt_os_thread_key_t;
 
 /** @addtogroup XBT_thread
@@ -24,50 +25,51 @@ typedef pthread_key_t xbt_os_thread_key_t;
  *  @{
  */
 
-XBT_PUBLIC(int) xbt_os_get_numcores(void);
+XBT_PUBLIC int xbt_os_get_numcores(void);
 
-  /** \brief Thread data type (opaque structure) */
+/** \brief Thread data type (opaque structure) */
 typedef struct xbt_os_thread_ *xbt_os_thread_t;
-XBT_PUBLIC(xbt_os_thread_t) xbt_os_thread_create(const char *name, pvoid_f_pvoid_t start_routine, void *param, void *data);
-XBT_PUBLIC(void) xbt_os_thread_exit(int *retcode);
-
-XBT_PUBLIC(xbt_os_thread_t) xbt_os_thread_self(void);
-XBT_PUBLIC(const char *) xbt_os_thread_self_name(void);
-XBT_PUBLIC(void) xbt_os_thread_set_extra_data(void *data);
-XBT_PUBLIC(void *) xbt_os_thread_get_extra_data(void);
-XBT_PUBLIC(void) xbt_os_thread_key_create(xbt_os_thread_key_t* key);
-XBT_PUBLIC(void) xbt_os_thread_key_destroy(xbt_os_thread_key_t key);
-XBT_PUBLIC(void) xbt_os_thread_set_specific(xbt_os_thread_key_t key, void* value);
-XBT_PUBLIC(void*) xbt_os_thread_get_specific(xbt_os_thread_key_t key);
-  /* xbt_os_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
-XBT_PUBLIC(void) xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return);
-XBT_PUBLIC(void) xbt_os_thread_yield(void);
-XBT_PUBLIC(void) xbt_os_thread_setstacksize(int stack_size);
-XBT_PUBLIC(void) xbt_os_thread_setguardsize(int guard_size);
-XBT_PUBLIC(int) xbt_os_thread_bind(xbt_os_thread_t thread, int core);
-XBT_PUBLIC(int) xbt_os_thread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
-
-  /** \brief Thread mutex data type (opaque structure) */
+XBT_PUBLIC xbt_os_thread_t xbt_os_thread_create(const char* name, pvoid_f_pvoid_t start_routine, void* param,
+                                                void* data);
+XBT_PUBLIC void xbt_os_thread_exit(int* retcode);
+
+XBT_PUBLIC xbt_os_thread_t xbt_os_thread_self(void);
+XBT_PUBLIC const char* xbt_os_thread_self_name(void);
+XBT_PUBLIC void xbt_os_thread_set_extra_data(void* data);
+XBT_PUBLIC void* xbt_os_thread_get_extra_data(void);
+XBT_PUBLIC void xbt_os_thread_key_create(xbt_os_thread_key_t* key);
+XBT_PUBLIC void xbt_os_thread_key_destroy(xbt_os_thread_key_t key);
+XBT_PUBLIC void xbt_os_thread_set_specific(xbt_os_thread_key_t key, void* value);
+XBT_PUBLIC void* xbt_os_thread_get_specific(xbt_os_thread_key_t key);
+/* xbt_os_thread_join frees the joined thread (ie the XBT wrapper around it, the OS frees the rest) */
+XBT_PUBLIC void xbt_os_thread_join(xbt_os_thread_t thread, void** thread_return);
+XBT_PUBLIC void xbt_os_thread_yield(void);
+XBT_PUBLIC void xbt_os_thread_setstacksize(int stack_size);
+XBT_PUBLIC void xbt_os_thread_setguardsize(int guard_size);
+XBT_PUBLIC int xbt_os_thread_bind(xbt_os_thread_t thread, int core);
+XBT_PUBLIC int xbt_os_thread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
+
+/** \brief Thread mutex data type (opaque structure) */
 typedef struct xbt_os_mutex_ *xbt_os_mutex_t;
-XBT_PUBLIC(xbt_os_mutex_t) xbt_os_mutex_init(void);
-XBT_PUBLIC(void) xbt_os_mutex_acquire(xbt_os_mutex_t mutex);
-XBT_PUBLIC(void) xbt_os_mutex_release(xbt_os_mutex_t mutex);
-XBT_PUBLIC(void) xbt_os_mutex_destroy(xbt_os_mutex_t mutex);
+XBT_PUBLIC xbt_os_mutex_t xbt_os_mutex_init(void);
+XBT_PUBLIC void xbt_os_mutex_acquire(xbt_os_mutex_t mutex);
+XBT_PUBLIC void xbt_os_mutex_release(xbt_os_mutex_t mutex);
+XBT_PUBLIC void xbt_os_mutex_destroy(xbt_os_mutex_t mutex);
 
 /** \brief Thread condition data type (opaque structure) */
 typedef struct xbt_os_cond_ *xbt_os_cond_t;
-XBT_PUBLIC(xbt_os_cond_t) xbt_os_cond_init(void);
-XBT_PUBLIC(void) xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex);
-XBT_PUBLIC(void) xbt_os_cond_signal(xbt_os_cond_t cond);
-XBT_PUBLIC(void) xbt_os_cond_broadcast(xbt_os_cond_t cond);
-XBT_PUBLIC(void) xbt_os_cond_destroy(xbt_os_cond_t cond);
+XBT_PUBLIC xbt_os_cond_t xbt_os_cond_init(void);
+XBT_PUBLIC void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex);
+XBT_PUBLIC void xbt_os_cond_signal(xbt_os_cond_t cond);
+XBT_PUBLIC void xbt_os_cond_broadcast(xbt_os_cond_t cond);
+XBT_PUBLIC void xbt_os_cond_destroy(xbt_os_cond_t cond);
 
 /** \brief Semaphore data type (opaque structure) */
 typedef struct xbt_os_sem_ *xbt_os_sem_t;
-XBT_PUBLIC(xbt_os_sem_t) xbt_os_sem_init(unsigned int value);
-XBT_PUBLIC(void) xbt_os_sem_acquire(xbt_os_sem_t sem);
-XBT_PUBLIC(void) xbt_os_sem_release(xbt_os_sem_t sem);
-XBT_PUBLIC(void) xbt_os_sem_destroy(xbt_os_sem_t sem);
+XBT_PUBLIC xbt_os_sem_t xbt_os_sem_init(unsigned int value);
+XBT_PUBLIC void xbt_os_sem_acquire(xbt_os_sem_t sem);
+XBT_PUBLIC void xbt_os_sem_release(xbt_os_sem_t sem);
+XBT_PUBLIC void xbt_os_sem_destroy(xbt_os_sem_t sem);
 
 /** @} */
 
index e7b2c24..074218b 100644 (file)
@@ -1,6 +1,6 @@
 /*  xbt/xbt_os_timer.h -- system dependency on time functions               */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -17,27 +17,27 @@ SG_BEGIN_DECL()
  *
  * gives  the  number  of  seconds since the Epoch (00:00:00 UTC, January 1, 1970).
  */
-XBT_PUBLIC(double) xbt_os_time(void);
-XBT_PUBLIC(void) xbt_os_sleep(double sec);
+XBT_PUBLIC double xbt_os_time(void);
+XBT_PUBLIC void xbt_os_sleep(double sec);
 
 typedef struct s_xbt_os_timer *xbt_os_timer_t;
 
-XBT_PUBLIC(xbt_os_timer_t) xbt_os_timer_new(void);
-XBT_PUBLIC(void) xbt_os_timer_free(xbt_os_timer_t timer);
-XBT_PUBLIC(double) xbt_os_timer_elapsed(xbt_os_timer_t timer);
-XBT_PUBLIC(size_t) xbt_os_timer_size(void);
+XBT_PUBLIC xbt_os_timer_t xbt_os_timer_new(void);
+XBT_PUBLIC void xbt_os_timer_free(xbt_os_timer_t timer);
+XBT_PUBLIC double xbt_os_timer_elapsed(xbt_os_timer_t timer);
+XBT_PUBLIC size_t xbt_os_timer_size(void);
 
-XBT_PUBLIC(void) xbt_os_walltimer_start(xbt_os_timer_t timer);
-XBT_PUBLIC(void) xbt_os_walltimer_resume(xbt_os_timer_t timer);
-XBT_PUBLIC(void) xbt_os_walltimer_stop(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_walltimer_start(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_walltimer_resume(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_walltimer_stop(xbt_os_timer_t timer);
 
-XBT_PUBLIC(void) xbt_os_cputimer_start(xbt_os_timer_t timer);
-XBT_PUBLIC(void) xbt_os_cputimer_resume(xbt_os_timer_t timer);
-XBT_PUBLIC(void) xbt_os_cputimer_stop(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_cputimer_start(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_cputimer_resume(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_cputimer_stop(xbt_os_timer_t timer);
 
-XBT_PUBLIC(void) xbt_os_threadtimer_start(xbt_os_timer_t timer);
-XBT_PUBLIC(void) xbt_os_threadtimer_resume(xbt_os_timer_t timer);
-XBT_PUBLIC(void) xbt_os_threadtimer_stop(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_threadtimer_start(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_threadtimer_resume(xbt_os_timer_t timer);
+XBT_PUBLIC void xbt_os_threadtimer_stop(xbt_os_timer_t timer);
 
 SG_END_DECL()
 
index 9e03b33..39e7274 100644 (file)
@@ -3,7 +3,7 @@
 
 sonar.projectKey=simgrid
 sonar.projectName=SimGrid
-sonar.projectVersion=3.19
+sonar.projectVersion=3.19.90
 
 sonar.links.homepage=http://simgrid.org
 sonar.links.issue=https://github.com/simgrid/simgrid/issues
index 695023d..439c30b 100644 (file)
@@ -1,6 +1,6 @@
 /* Context switching within the JVM.                                        */
 
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -13,7 +13,7 @@
 #include <functional>
 #include <utility>
 
-extern "C" JavaVM* __java_vm;
+extern JavaVM* __java_vm;
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(java, "MSG for Java(TM)");
 
index 0a9bc6d..6ba8f43 100644 (file)
@@ -40,8 +40,6 @@
 #endif
 /* end of eclipse-mandated pimple */
 
-extern "C" {
-
 int JAVA_HOST_LEVEL = -1;
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
@@ -239,7 +237,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_fileSystemInit()
 {
   sg_storage_file_system_init();
 }
-} // extern "C"
 
 /** Run a Java org.simgrid.msg.Process
  *
index d06d1d4..d921d3e 100644 (file)
@@ -1,13 +1,13 @@
 /* Java bindings of the NetZones.                                           */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/NetZone.hpp"
-#include "src/kernel/routing/NetZoneImpl.hpp"
 
 #include "jmsg.hpp"
 #include "jmsg_as.hpp"
@@ -16,8 +16,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 static jmethodID jas_method_As_constructor;
 static jfieldID jas_field_As_bind;
 
@@ -155,4 +153,3 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   }
   return jtable;
 }
-}
index da8c34d..513384c 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings to the Comm API                                            */
 
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -14,8 +14,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 static jfieldID jcomm_field_Comm_bind;
 static jfieldID jcomm_field_Comm_finished;
 static jfieldID jcomm_field_Comm_receiving;
@@ -166,4 +164,3 @@ JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls,
   xbt_dynar_free(&dyn);
   return rank;
 }
-}
index ff8dcba..def75aa 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings of the file API.                                           */
 
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -8,8 +8,6 @@
 #include "jmsg_file.h"
 #include "jxbt_utilities.hpp"
 
-extern "C" {
-
 void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t fd) {
   env->SetLongField(jfile, jfile_field_bind, reinterpret_cast<std::intptr_t>(fd));
 }
@@ -53,4 +51,3 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfil
   MSG_file_close(file);
   jfile_bind(env, jfile, nullptr);
 }
-}
index 22c54da..6dc5b56 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions related to the java host instances.                            */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -16,8 +16,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 static jmethodID jhost_method_Host_constructor;
 static jfieldID jhost_field_Host_bind;
 static jfieldID jhost_field_Host_name;
@@ -374,4 +372,3 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getPowerPeakAt(JNIEnv* env,
   msg_host_t host = jhost_get_native(env, jhost);
   return MSG_host_get_power_peak_at(host, pstate);
 }
-}
index 10645cf..a25eb46 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions related to the java process instances.                         */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -16,8 +16,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 jfieldID jprocess_field_Process_bind;
 jfieldID jprocess_field_Process_host;
 jfieldID jprocess_field_Process_killTime;
@@ -27,7 +25,7 @@ jfieldID jprocess_field_Process_ppid;
 
 jobject jprocess_from_native(msg_process_t process)
 {
-  simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) MSG_process_get_smx_ctx(process);
+  simgrid::kernel::context::JavaContext* context = (simgrid::kernel::context::JavaContext*) process->getImpl()->context;
   return context->jprocess;
 }
 
@@ -100,12 +98,12 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_daemonize(JNIEnv* env, jobje
     return;
   }
 
-  MSG_process_daemonize(process);
+  process->daemonize();
 }
 
-JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv * env, jclass cls, jint jresetPID)
+JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls)
 {
-  return (jint) MSG_process_killall((int) jresetPID);
+  return (jint)MSG_process_killall();
 }
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv * env, jclass cls, jint pid)
@@ -171,10 +169,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv * env, jobjec
     return;
   }
 
-  /* try to suspend the process */
-  msg_error_t rv = MSG_process_suspend(process);
-
-  jxbt_check_res("MSG_process_suspend()", rv, MSG_OK, "unexpected error , please report this bug");
+  /* suspend the process */
+  process->suspend();
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv * env, jobject jprocess)
@@ -186,9 +182,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv * env, jobject
     return;
   }
 
-  /* try to resume the process */
-  msg_error_t res = MSG_process_resume(process);
-  jxbt_check_res("MSG_process_resume()", res, MSG_OK, "unexpected error , please report this bug");
+  /* resume the process */
+  process->resume();
 }
 
 JNIEXPORT void
@@ -211,7 +206,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart (JNIEnv *env, jobjec
     return;
   }
 
-  MSG_process_restart(process);
+  process->restart();
 }
 
 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env, jobject jprocess)
@@ -224,7 +219,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env
   }
 
   /* true is the process is suspended, false otherwise */
-  return (jboolean) MSG_process_is_suspended(process);
+  return (jboolean)process->isSuspended();
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cls, jlong jmillis, jint jnanos)
@@ -284,12 +279,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobjec
     return;
   }
 
-  /* try to change the host of the process */
-  msg_error_t rv = MSG_process_migrate(process, host);
-  if (rv != MSG_OK) {
-    jmsg_throw_status(env,rv);
-    return;
-  }
+  /* change the host of the process */
+  process->migrate(host);
+
   /* change the host java side */
   env->SetObjectField(jprocess, jprocess_field_Process_host, jhost);
 }
@@ -307,4 +299,3 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime (JNIEnv *env , j
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls) {
   return (jint) MSG_process_get_number();
 }
-}
index 0d5cc44..55b78b7 100644 (file)
@@ -48,7 +48,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_nativeInit(JNIEnv *env, jcla
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject jprocess_arg, jobject jhostname);
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_daemonize(JNIEnv* env, jobject jprocess);
-JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls, jint jresetPID);
+JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_killAll(JNIEnv* env, jclass cls);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv* env, jclass cls, jint pid);
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_nativeGetPID(JNIEnv* env, jobject jprocess);
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv* env, jobject jprocess, jobject jname);
index cf069b3..2bbc9bb 100644 (file)
@@ -1,6 +1,6 @@
 /* Java binding of the RngStream library                                    */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -10,8 +10,6 @@
 #include "jmsg_rngstream.h"
 #include "jxbt_utilities.hpp"
 
-extern "C" {
-
 jfieldID jrngstream_bind;
 
 RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream) {
@@ -145,4 +143,3 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_RngStream_randInt(JNIEnv *env, jobje
 
   return (jint)RngStream_RandInt(rngstream, (int)i, (int)j);
 }
-}
index 548780c..15fedd9 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings of the Storage API.                                        */
 
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -16,8 +16,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 static jmethodID jstorage_method_Storage_constructor;
 static jfieldID jstorage_field_Storage_bind;
 static jfieldID jstorage_field_Storage_name;
@@ -229,4 +227,3 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv * env, jc
   xbt_dynar_free(&table);
   return jtable;
 }
-}
index a831b3f..259def3 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings of the Synchronization API.                                */
 
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -14,8 +14,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 static jfieldID jsynchro_field_Mutex_bind;
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_nativeInit(JNIEnv *env, jclass cls) {
@@ -94,4 +92,3 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_nativeFinalize(JNIEnv * en
   sem = (msg_sem_t)(uintptr_t)env->GetLongField(obj, jsynchro_field_Semaphore_bind);
   MSG_sem_destroy(sem);
 }
-}
index 91f2557..953ec60 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions related to the java task instances.                            */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -15,8 +15,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 static jmethodID jtask_method_Comm_constructor;
 
 static jfieldID jtask_field_Task_bind;
@@ -528,4 +526,3 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv * env, jclass
 
   return (jint) rv;
 }
-}
index 9055739..f855359 100644 (file)
@@ -14,8 +14,6 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
 
-extern "C" {
-
 extern int JAVA_HOST_LEVEL;
 static jfieldID jvm_field_bind;
 
@@ -194,4 +192,3 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_VM_getVMByName(JNIEnv* env, jclas
 
   return static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
 }
-}
index 02f22f1..fe16a28 100644 (file)
@@ -1,6 +1,6 @@
 /* Java bindings of the Trace API.                                          */
 
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -20,8 +20,6 @@
 // Define a new category
 XBT_LOG_NEW_DEFAULT_CATEGORY (jtrace, "TRACE for Java(TM)");
 
-extern "C" {
-
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclare(JNIEnv * env, jclass cls, jstring js)
 {
   const char *s = env->GetStringUTFChars(js, 0);
@@ -198,4 +196,3 @@ JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSet
    JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_linkSrcDstVariableSubWithTime(JNIEnv *env, jclass cls, jdouble,
                                                                                      jstring, jstring, jstring, jdouble)
 */
-}
index 1853d1b..f26d24c 100644 (file)
@@ -1,6 +1,6 @@
 /* Various JNI helper functions                                             */
 
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -10,8 +10,6 @@
 
 #include <cstdlib> /* abort */
 
-extern "C" {
-
 jclass jxbt_get_class(JNIEnv * env, const char *name)
 {
   jclass cls = env->FindClass(name);
@@ -211,4 +209,3 @@ void jxbt_throw_task_cancelled(JNIEnv* env, std::string details)
 {
   jxbt_throw_by_name(env, "org/simgrid/msg/TaskCancelledException", details);
 }
-}
index 6c06550..4c27475 100644 (file)
@@ -148,14 +148,10 @@ public abstract class Process implements Runnable {
        /**
         * This method kills all running process of the simulation.
         *
-        * @param resetPID              Should we reset the PID numbers. A negative number means no reset
-        *                                              and a positive number will be used to set the PID of the next newly
-        *                                              created process.
-        *
         * @return                              The function returns the PID of the next created process.
         *                      
         */ 
-       public static native int killAll(int resetPID);
+       public static native int killAll();
 
        /** Simply kills the receiving process.
         *
index ddf1fb4..120e460 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team.
+/* Copyright (c) 2010-2018. The SimGrid Team.
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -11,9 +11,7 @@
  *
  */
  /* SimGrid Lua debug functions                                             */
-extern "C" {
 #include <lauxlib.h>
-}
 #include "lua_utils.hpp"
 #include "xbt.h"
 
@@ -214,13 +212,12 @@ void* sglua_checkudata_debug(lua_State* L, int ud, const char* tname)
  * @param size     number of bytes of data
  * @param userdata the memory buffer to write
  */
-int sglua_memory_writer(lua_State* L, const void* source, size_t size,
-    void* userdata) {
-
-  sglua_buffer_t buffer = (sglua_buffer_t) userdata;
+int sglua_memory_writer(lua_State* L, const void* source, size_t size, void* userdata)
+{
+  sglua_buffer_t buffer = static_cast<sglua_buffer_t>(userdata);
   while (buffer->capacity < buffer->size + size) {
     buffer->capacity *= 2;
-    buffer->data = (char*)xbt_realloc(buffer->data, buffer->capacity);
+    buffer->data = static_cast<char*>(xbt_realloc(buffer->data, buffer->capacity));
   }
   memcpy(buffer->data + buffer->size, source, size);
   buffer->size += size;
index f511ec3..7f35793 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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. */
@@ -7,9 +7,7 @@
 
 #include "lua_private.hpp"
 #include "simgrid/s4u/Host.hpp"
-extern "C" {
 #include <lauxlib.h>
-}
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(lua_host, "Lua Host module");
 
index 37ec994..90a2afa 100644 (file)
@@ -6,15 +6,13 @@
 /* SimGrid Lua bindings                                                     */
 
 #include "lua_private.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf_private.hpp"
 #include <cctype>
 #include <cstring>
 
-extern "C" {
 #include <lauxlib.h>
-}
 
 #include "src/surf/surf_private.hpp"
 #include <boost/algorithm/string/classification.hpp>
@@ -63,7 +61,7 @@ int console_close(lua_State *L) {
 }
 
 int console_add_backbone(lua_State *L) {
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   link.properties = nullptr;
 
@@ -111,7 +109,7 @@ int console_add_backbone(lua_State *L) {
 }
 
 int console_add_host___link(lua_State *L) {
-  HostLinkCreationArgs hostlink;
+  simgrid::kernel::routing::HostLinkCreationArgs hostlink;
   int type;
 
   lua_ensure(lua_istable(L, -1), "Bad Arguments to create host_link in Lua. Should be a table with named arguments.");
@@ -143,7 +141,7 @@ int console_add_host___link(lua_State *L) {
 }
 
 int console_add_host(lua_State *L) {
-  s_sg_platf_host_cbarg_t host;
+  simgrid::kernel::routing::HostCreationArgs host;
   int type;
 
   // we get values from the table passed as argument
@@ -202,7 +200,7 @@ int console_add_host(lua_State *L) {
 }
 
 int  console_add_link(lua_State *L) {
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   const char* policy;
 
@@ -308,7 +306,7 @@ int console_add_router(lua_State* L) {
 
 int console_add_route(lua_State *L) {
   XBT_DEBUG("Adding route");
-  RouteCreationArgs route;
+  simgrid::kernel::routing::RouteCreationArgs route;
   int type;
 
   lua_ensure(lua_istable(L, -1), "Bad Arguments to add a route. Should be a table with named arguments");
@@ -379,7 +377,7 @@ int console_add_route(lua_State *L) {
 }
 
 int console_add_ASroute(lua_State *L) {
-  RouteCreationArgs ASroute;
+  simgrid::kernel::routing::RouteCreationArgs ASroute;
 
   lua_pushstring(L, "src");
   lua_gettable(L, -2);
@@ -480,7 +478,7 @@ int console_AS_open(lua_State *L) {
    mode_int = A_surfxml_AS_routing_None;
  else xbt_die("Don't have the model name '%s'",mode);
 
- ZoneCreationArgs AS;
simgrid::kernel::routing::ZoneCreationArgs AS;
  AS.id = id;
  AS.routing = mode_int;
  simgrid::s4u::NetZone* new_as = sg_platf_new_Zone_begin(&AS);
index 1bca949..b6ca7a4 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(lua, "Lua Bindings");
 
-extern "C" {
 #include <lauxlib.h>
 
-int luaopen_simgrid(lua_State *L);
-}
+extern "C" int luaopen_simgrid(lua_State* L);
 
 /* ********************************************************************************* */
 /*                                  simgrid API                                      */
index a3262e0..e31aea6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(int) TRACE_start ();
-XBT_PUBLIC(int) TRACE_end ();
-XBT_PUBLIC(void) TRACE_global_init();
-XBT_PUBLIC(void) TRACE_help(int detailed);
+XBT_PUBLIC int TRACE_start();
+XBT_PUBLIC int TRACE_end();
+XBT_PUBLIC void TRACE_global_init();
+XBT_PUBLIC void TRACE_help(int detailed);
 
 SG_END_DECL()
 
index 49e0f09..3119413 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
 SG_BEGIN_DECL()
 
 /********************************** Configuration of MC **************************************/
-extern XBT_PUBLIC(int) _sg_do_model_check;
+extern XBT_PUBLIC int _sg_do_model_check;
 extern XBT_PRIVATE int _sg_do_model_check_record;
 extern XBT_PRIVATE int _sg_mc_checkpoint;
-extern XBT_PUBLIC(int) _sg_mc_sparse_checkpoint;
-extern XBT_PUBLIC(int) _sg_mc_ksm;
+extern XBT_PUBLIC int _sg_mc_sparse_checkpoint;
+extern XBT_PUBLIC int _sg_mc_ksm;
 extern XBT_PRIVATE int _sg_mc_timeout;
 extern XBT_PRIVATE int _sg_mc_hash;
 extern XBT_PRIVATE int _sg_mc_max_depth;
-extern XBT_PUBLIC(int) _sg_mc_max_visited_states;
-extern XBT_PUBLIC(int) _sg_mc_comms_determinism;
-extern XBT_PUBLIC(int) _sg_mc_send_determinism;
+extern XBT_PUBLIC int _sg_mc_max_visited_states;
+extern XBT_PUBLIC int _sg_mc_comms_determinism;
+extern XBT_PUBLIC int _sg_mc_send_determinism;
 extern XBT_PRIVATE int _sg_mc_snapshot_fds;
 extern XBT_PRIVATE int _sg_mc_termination;
 
@@ -55,13 +55,13 @@ XBT_PRIVATE void _mc_cfg_cb_comms_determinism(const char *name);
 XBT_PRIVATE void _mc_cfg_cb_send_determinism(const char *name);
 XBT_PRIVATE void _mc_cfg_cb_termination(const char *name);
 
-XBT_PUBLIC(void) MC_run();
-XBT_PUBLIC(void) MC_process_clock_add(smx_actor_t, double);
-XBT_PUBLIC(double) MC_process_clock_get(smx_actor_t);
+XBT_PUBLIC void MC_run();
+XBT_PUBLIC void MC_process_clock_add(smx_actor_t, double);
+XBT_PUBLIC double MC_process_clock_get(smx_actor_t);
 XBT_PRIVATE void MC_automaton_load(const char *file);
 
 /********************************* Memory *************************************/
-XBT_PUBLIC(void) MC_memory_init();  /* Initialize the memory subsystem */
+XBT_PUBLIC void MC_memory_init(); /* Initialize the memory subsystem */
 
 SG_END_DECL()
 
diff --git a/src/include/simgrid/sg_config.h b/src/include/simgrid/sg_config.h
deleted file mode 100644 (file)
index 304b7b6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2012-2017. 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. */
-
-#ifndef SIMGRID_CONFIG_H
-#define SIMGRID_CONFIG_H
-
-#include "xbt/config.h"
-#include "xbt/config.hpp"
-
-/** Config Globals */
-SG_BEGIN_DECL()
-
-XBT_PUBLIC_DATA(xbt_cfg_t) simgrid_config;
-XBT_PUBLIC_DATA(int) _sg_cfg_init_status;
-XBT_PUBLIC_DATA(int) _sg_cfg_exit_asap;
-
-XBT_PUBLIC(void) sg_config_init(int *argc, char **argv);
-XBT_PUBLIC(void) sg_config_finalize();
-
-SG_END_DECL()
-
-#endif
diff --git a/src/include/simgrid/sg_config.hpp b/src/include/simgrid/sg_config.hpp
new file mode 100644 (file)
index 0000000..a11602f
--- /dev/null
@@ -0,0 +1,21 @@
+/* Copyright (c) 2012-2018. 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. */
+
+#ifndef SIMGRID_CONFIG_HPP
+#define SIMGRID_CONFIG_HPP
+
+#include "xbt/config.h"
+#include "xbt/config.hpp"
+
+/** Config Globals */
+
+XBT_PUBLIC_DATA xbt_cfg_t simgrid_config;
+XBT_PUBLIC_DATA int _sg_cfg_init_status;
+XBT_PUBLIC_DATA int _sg_cfg_exit_asap;
+
+XBT_PUBLIC void sg_config_init(int* argc, char** argv);
+XBT_PUBLIC void sg_config_finalize();
+
+#endif
index 84b8c16..9252170 100644 (file)
 #include "xbt/graph.h"
 #include "xbt/misc.h"
 
-#ifndef __cplusplus
-#error This is a C++ only file, now
-#endif
-
 namespace simgrid {
 namespace surf {
 class CpuModel;
@@ -39,16 +35,8 @@ typedef simgrid::surf::HostModel* surf_host_model_t;
 typedef simgrid::surf::NetworkModel* surf_network_model_t;
 typedef simgrid::surf::StorageModel* surf_storage_model_t;
 
-SG_BEGIN_DECL()
 /* Actions and models are highly connected structures... */
 
-/* user-visible parameters */
-extern XBT_PRIVATE double sg_tcp_gamma;
-extern XBT_PRIVATE double sg_latency_factor;
-extern XBT_PRIVATE double sg_bandwidth_factor;
-extern XBT_PRIVATE double sg_weight_S_parameter;
-extern XBT_PRIVATE int sg_network_crosstraffic;
-
 /** \brief Resource model description
  */
 struct surf_model_description {
@@ -58,8 +46,8 @@ struct surf_model_description {
 };
 typedef struct surf_model_description s_surf_model_description_t;
 
-XBT_PUBLIC(int) find_model_description(s_surf_model_description_t* table, std::string name);
-XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t* table);
+XBT_PUBLIC int find_model_description(s_surf_model_description_t* table, std::string name);
+XBT_PUBLIC void model_help(const char* category, s_surf_model_description_t* table);
 
 /***************************/
 /* Generic model object */
@@ -73,7 +61,7 @@ XBT_PUBLIC(void) model_help(const char* category, s_surf_model_description_t* ta
  * @param model The model from which the action is extracted
  * @return An action in done state
  */
-XBT_PUBLIC(simgrid::kernel::resource::Action*)
+XBT_PUBLIC simgrid::kernel::resource::Action*
 surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model);
 
 /**
@@ -82,7 +70,7 @@ surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model);
  * @param model The model from which the action is extracted
  * @return An action in failed state
  */
-XBT_PUBLIC(simgrid::kernel::resource::Action*)
+XBT_PUBLIC simgrid::kernel::resource::Action*
 surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model);
 
 /**
@@ -91,7 +79,7 @@ surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model);
  * @param model The model
  * @return The size of the running action set
  */
-XBT_PUBLIC(int) surf_model_running_action_set_size(simgrid::kernel::resource::Model* model);
+XBT_PUBLIC int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model);
 
 /**
  * @brief [brief description]
@@ -100,7 +88,7 @@ XBT_PUBLIC(int) surf_model_running_action_set_size(simgrid::kernel::resource::Mo
  * @param action The surf cpu action
  * @param bound [description]
  */
-XBT_PUBLIC(void) surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound);
+XBT_PUBLIC void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound);
 
 /** @} */
 
@@ -111,12 +99,12 @@ XBT_PUBLIC(void) surf_cpu_action_set_bound(simgrid::kernel::resource::Action* ac
 /** \ingroup SURF_models
  *  \brief The CPU model object for the physical machine layer
  */
-XBT_PUBLIC_DATA(surf_cpu_model_t) surf_cpu_model_pm;
+XBT_PUBLIC_DATA surf_cpu_model_t surf_cpu_model_pm;
 
 /** \ingroup SURF_models
  *  \brief The CPU model object for the virtual machine layer
  */
-XBT_PUBLIC_DATA(surf_cpu_model_t) surf_cpu_model_vm;
+XBT_PUBLIC_DATA surf_cpu_model_t surf_cpu_model_vm;
 
 /** \ingroup SURF_models
  *  \brief Initializes the CPU model with the model Cas01
@@ -127,30 +115,30 @@ XBT_PUBLIC_DATA(surf_cpu_model_t) surf_cpu_model_vm;
  *
  *  You shouldn't have to call it by yourself.
  */
-XBT_PUBLIC(void) surf_cpu_model_init_Cas01();
+XBT_PUBLIC void surf_cpu_model_init_Cas01();
 
 /** \ingroup SURF_models
  *  \brief Initializes the CPU model with trace integration [Deprecated]
  *
  *  You shouldn't have to call it by yourself.
  */
-XBT_PUBLIC(void) surf_cpu_model_init_ti();
+XBT_PUBLIC void surf_cpu_model_init_ti();
 
 /** \ingroup SURF_models
  *  \brief The list of all available optimization modes (both for cpu and networks).
  *  These optimization modes can be set using --cfg=cpu/optim:... and --cfg=network/optim:...
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_optimization_mode_description[];
+XBT_PUBLIC_DATA s_surf_model_description_t surf_optimization_mode_description[];
 
 /** \ingroup SURF_plugins
  *  \brief The list of all available surf plugins
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_plugin_description[];
+XBT_PUBLIC_DATA s_surf_model_description_t surf_plugin_description[];
 
 /** \ingroup SURF_models
  *  \brief The list of all available cpu model models
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
+XBT_PUBLIC_DATA s_surf_model_description_t surf_cpu_model_description[];
 
 /** \ingroup SURF_models
  *  \brief The network model
@@ -158,7 +146,7 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_cpu_model_description[];
  *  When creating a new API on top on SURF, you shouldn't use the network model unless you know what you are doing.
  *  Only the host model should be accessed because depending on the platform model, the network model can be NULL.
  */
-XBT_PUBLIC_DATA(surf_network_model_t) surf_network_model;
+XBT_PUBLIC_DATA surf_network_model_t surf_network_model;
 
 /** \ingroup SURF_models
  *  \brief Same as network model 'LagrangeVelho', only with different correction factors.
@@ -169,7 +157,7 @@ XBT_PUBLIC_DATA(surf_network_model_t) surf_network_model;
  *
  *  \see surf_host_model_init_SMPI()
  */
-XBT_PUBLIC(void) surf_network_model_init_SMPI();
+XBT_PUBLIC void surf_network_model_init_SMPI();
 
 /** \ingroup SURF_models
  *  \brief Same as network model 'LagrangeVelho', only with different correction factors.
@@ -179,7 +167,7 @@ XBT_PUBLIC(void) surf_network_model_init_SMPI();
  *
  *  \see surf_host_model_init_IB()
  */
-XBT_PUBLIC(void) surf_network_model_init_IB();
+XBT_PUBLIC void surf_network_model_init_IB();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model 'LegrandVelho'
@@ -189,7 +177,7 @@ XBT_PUBLIC(void) surf_network_model_init_IB();
  *
  *  \see surf_host_model_init_LegrandVelho()
  */
-XBT_PUBLIC(void) surf_network_model_init_LegrandVelho();
+XBT_PUBLIC void surf_network_model_init_LegrandVelho();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model 'Constant'
@@ -200,7 +188,7 @@ XBT_PUBLIC(void) surf_network_model_init_LegrandVelho();
  *
  *  \see surf_host_model_init_compound()
  */
-XBT_PUBLIC(void) surf_network_model_init_Constant();
+XBT_PUBLIC void surf_network_model_init_Constant();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model CM02
@@ -208,7 +196,7 @@ XBT_PUBLIC(void) surf_network_model_init_Constant();
  *  You sould call this function by yourself only if you plan using surf_host_model_init_compound.
  *  See comments in the code for more information.
  */
-XBT_PUBLIC(void) surf_network_model_init_CM02();
+XBT_PUBLIC void surf_network_model_init_CM02();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model NS3
@@ -218,7 +206,7 @@ XBT_PUBLIC(void) surf_network_model_init_CM02();
  *
  *  \see surf_host_model_init_NS3()
  */
-XBT_PUBLIC(void) surf_network_model_init_NS3();
+XBT_PUBLIC void surf_network_model_init_NS3();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model Reno
@@ -231,7 +219,7 @@ XBT_PUBLIC(void) surf_network_model_init_NS3();
  *
  *  Call this function only if you plan using surf_host_model_init_compound.
  */
-XBT_PUBLIC(void) surf_network_model_init_Reno();
+XBT_PUBLIC void surf_network_model_init_Reno();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model Reno2
@@ -244,7 +232,7 @@ XBT_PUBLIC(void) surf_network_model_init_Reno();
  *
  *  Call this function only if you plan using surf_host_model_init_compound.
  */
-XBT_PUBLIC(void) surf_network_model_init_Reno2();
+XBT_PUBLIC void surf_network_model_init_Reno2();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model Vegas
@@ -257,25 +245,25 @@ XBT_PUBLIC(void) surf_network_model_init_Reno2();
  *
  *  Call this function only if you plan using surf_host_model_init_compound.
  */
-XBT_PUBLIC(void) surf_network_model_init_Vegas();
+XBT_PUBLIC void surf_network_model_init_Vegas();
 
 /** \ingroup SURF_models
  *  \brief The list of all available network model models
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_network_model_description[];
+XBT_PUBLIC_DATA s_surf_model_description_t surf_network_model_description[];
 
 /** \ingroup SURF_models
  *  \brief The storage model
  */
-XBT_PUBLIC(void) surf_storage_model_init_default();
+XBT_PUBLIC void surf_storage_model_init_default();
 
 /** \ingroup SURF_models
  *  \brief The list of all available storage modes.
  *  This storage mode can be set using --cfg=storage/model:...
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[];
+XBT_PUBLIC_DATA s_surf_model_description_t surf_storage_model_description[];
 
-XBT_PUBLIC_DATA(surf_storage_model_t) surf_storage_model;
+XBT_PUBLIC_DATA surf_storage_model_t surf_storage_model;
 
 /** \ingroup SURF_models
  *  \brief The host model
@@ -283,14 +271,14 @@ XBT_PUBLIC_DATA(surf_storage_model_t) surf_storage_model;
  *  Note that when you create an API on top of SURF, the host model should be the only one you use
  *  because depending on the platform model, the network model and the CPU model may not exist.
  */
-XBT_PUBLIC_DATA(surf_host_model_t) surf_host_model;
+XBT_PUBLIC_DATA surf_host_model_t surf_host_model;
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with a compound host model
  *
  *  This function should be called after a cpu_model and a network_model have been set up.
  */
-XBT_PUBLIC(void) surf_host_model_init_compound();
+XBT_PUBLIC void surf_host_model_init_compound();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the current best network and cpu models at hand
@@ -300,7 +288,7 @@ XBT_PUBLIC(void) surf_host_model_init_compound();
  *  traffic support) and the CPU model with the model Cas01.
  *  Such model is subject to modification with warning in the ChangeLog so monitor it!
  */
-XBT_PUBLIC(void) surf_host_model_init_current_default();
+XBT_PUBLIC void surf_host_model_init_current_default();
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the model L07
@@ -308,12 +296,12 @@ XBT_PUBLIC(void) surf_host_model_init_current_default();
  *  With this model, only parallel tasks can be used. Resource sharing is done by identifying bottlenecks and giving an
  *  equal share of the model to each action.
  */
-XBT_PUBLIC(void) surf_host_model_init_ptask_L07();
+XBT_PUBLIC void surf_host_model_init_ptask_L07();
 
 /** \ingroup SURF_models
  *  \brief The list of all available host model models
  */
-XBT_PUBLIC_DATA(s_surf_model_description_t) surf_host_model_description[];
+XBT_PUBLIC_DATA s_surf_model_description_t surf_host_model_description[];
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the current best network and cpu models at hand
@@ -323,7 +311,7 @@ XBT_PUBLIC_DATA(s_surf_model_description_t) surf_host_model_description[];
  *  traffic support) and the CPU model with the model Cas01.
  *  Such model is subject to modification with warning in the ChangeLog so monitor it!
  */
-XBT_PUBLIC(void) surf_vm_model_init_HL13();
+XBT_PUBLIC void surf_vm_model_init_HL13();
 
 /*** SURF Globals **************************/
 
@@ -337,14 +325,14 @@ XBT_PUBLIC(void) surf_vm_model_init_HL13();
  *
  *  \see surf_host_model_init_CM02(), surf_host_model_init_compound(), surf_exit()
  */
-XBT_PUBLIC(void) surf_init(int* argc, char** argv); /* initialize common structures */
+XBT_PUBLIC void surf_init(int* argc, char** argv); /* initialize common structures */
 
 /** \ingroup SURF_simulation
  *  \brief Finish simulation initialization
  *
  *  This function must be called before the first call to surf_solve()
  */
-XBT_PUBLIC(void) surf_presolve();
+XBT_PUBLIC void surf_presolve();
 
 /** \ingroup SURF_simulation
  *  \brief Performs a part of the simulation
@@ -356,14 +344,14 @@ XBT_PUBLIC(void) surf_presolve();
  *  when you call surf_solve.
  *  Note that the returned elapsed time can be zero.
  */
-XBT_PUBLIC(double) surf_solve(double max_date);
+XBT_PUBLIC double surf_solve(double max_date);
 
 /** \ingroup SURF_simulation
  *  \brief Return the current time
  *
  *  Return the current time in millisecond.
  */
-XBT_PUBLIC(double) surf_get_clock();
+XBT_PUBLIC double surf_get_clock();
 
 /** \ingroup SURF_simulation
  *  \brief Exit SURF
@@ -372,10 +360,10 @@ XBT_PUBLIC(double) surf_get_clock();
  *
  *  \see surf_init()
  */
-XBT_PUBLIC(void) surf_exit();
+XBT_PUBLIC void surf_exit();
 
 /* surf parse file related (public because called from a test suite) */
-XBT_PUBLIC(void) parse_platform_file(const char* file);
+XBT_PUBLIC void parse_platform_file(const char* file);
 
 /********** Tracing **********/
 
@@ -384,6 +372,4 @@ void instr_routing_define_callbacks();
 xbt_graph_t instr_routing_platform_graph();
 void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename);
 
-SG_END_DECL()
-
 #endif
similarity index 63%
rename from include/xbt/mmalloc.h
rename to src/include/xbt/mmalloc.h
index a8b49c4..ab6ca00 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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 "src/internal_config.h"
 #if HAVE_MMALLOC
 
-# include <sys/types.h>        /* for size_t */
-# include <stdio.h>            /* for NULL */
+#include <stdio.h>     /* for NULL */
+#include <sys/types.h> /* for size_t */
 
-#include "xbt/dynar.h"
 #include "xbt/dict.h"
+#include "xbt/dynar.h"
 
 SG_BEGIN_DECL()
 
@@ -28,43 +27,43 @@ SG_BEGIN_DECL()
  * The heap structure itself is an opaque object that shouldnt be messed with.
  */
 typedef struct mdesc s_xbt_mheap_t;
-typedef struct mdesc *xbt_mheap_t;
+typedef struct mdescxbt_mheap_t;
 
 /* Allocate SIZE bytes of memory (and memset it to 0).  */
-XBT_PUBLIC( void ) *mmalloc(xbt_mheap_t md, size_t size);
+XBT_PUBLIC void* mmalloc(xbt_mheap_t md, size_t size);
 
 /* Allocate SIZE bytes of memory (and don't mess with it) */
-void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size);
+voidmmalloc_no_memset(xbt_mheap_t mdp, size_t size);
 
 /* Re-allocate the previously allocated block in void*, making the new block SIZE bytes long.  */
-XBT_PUBLIC( void ) *mrealloc(xbt_mheap_t md, void *ptr, size_t size);
+XBT_PUBLIC void* mrealloc(xbt_mheap_t md, void* ptr, size_t size);
 
 /* Free a block allocated by `mmalloc', `mrealloc' or `mcalloc'.  */
-XBT_PUBLIC( void ) mfree(xbt_mheap_t md, void *ptr);
+XBT_PUBLIC void mfree(xbt_mheap_t md, void* ptr);
 
-XBT_PUBLIC( xbt_mheap_t ) xbt_mheap_new(int fd, void *baseaddr);
+XBT_PUBLIC xbt_mheap_t xbt_mheap_new(int fd, void* baseaddr);
 
 #define XBT_MHEAP_OPTION_MEMSET 1
 
-XBT_PUBLIC( xbt_mheap_t ) xbt_mheap_new_options(int fd, void *baseaddr, int options);
+XBT_PUBLIC xbt_mheap_t xbt_mheap_new_options(int fd, void* baseaddr, int options);
 
-XBT_PUBLIC( void ) xbt_mheap_destroy_no_free(xbt_mheap_t md);
+XBT_PUBLIC void xbt_mheap_destroy_no_free(xbt_mheap_t md);
 
-XBT_PUBLIC( void ) *xbt_mheap_destroy(xbt_mheap_t md);
+XBT_PUBLIC void* xbt_mheap_destroy(xbt_mheap_t md);
 
 /* return the heap used when NULL is passed as first argument to any mm* function */
-XBT_PUBLIC( xbt_mheap_t ) mmalloc_get_default_md(void);
+XBT_PUBLIC xbt_mheap_t mmalloc_get_default_md(void);
 
 /* To change the heap used when using the legacy version malloc/free/realloc and such */
 xbt_mheap_t mmalloc_set_current_heap(xbt_mheap_t new_heap);
 xbt_mheap_t mmalloc_get_current_heap(void);
 
 size_t mmalloc_get_bytes_used(xbt_mheap_t);
-ssize_t mmalloc_get_busy_size(xbt_mheap_t, void *ptr);
+ssize_t mmalloc_get_busy_size(xbt_mheap_t, voidptr);
 
 void* malloc_no_memset(size_t n);
 
 SG_END_DECL()
 
 #endif
-#endif                          /* SIMGRID_MMALLOC_H */
+#endif /* SIMGRID_MMALLOC_H */
index bcccadc..fb4d44d 100644 (file)
@@ -24,8 +24,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_config, instr, "Configuration");
 #define OPT_TRACING_FILENAME             "tracing/filename"
 #define OPT_TRACING_FORMAT_TI_ONEFILE    "tracing/smpi/format/ti-one-file"
 #define OPT_TRACING_FORMAT               "tracing/smpi/format"
-#define OPT_TRACING_MSG_PROCESS          "tracing/msg/process"
-#define OPT_TRACING_MSG_VM               "tracing/msg/vm"
+#define OPT_TRACING_ACTOR "tracing/msg/process"
+#define OPT_TRACING_VM "tracing/vm"
 #define OPT_TRACING_PLATFORM             "tracing/platform"
 #define OPT_TRACING_PRECISION            "tracing/precision"
 #define OPT_TRACING_SMPI_COMPUTING       "tracing/smpi/computing"
@@ -48,14 +48,13 @@ static bool trace_view_internals;
 static bool trace_categorized;
 static bool trace_uncategorized;
 static bool trace_actor_enabled;
-static bool trace_msg_vm_enabled;
+static bool trace_vm_enabled;
 static bool trace_buffer;
 static bool trace_disable_destroy;
 static bool trace_basic;
 static bool trace_display_sizes = false;
 static bool trace_disable_link;
 static bool trace_disable_power;
-static int trace_precision;
 
 static bool trace_configured = false;
 static bool trace_active     = false;
@@ -74,15 +73,14 @@ static void TRACE_getopts()
   trace_view_internals      = xbt_cfg_get_boolean(OPT_TRACING_SMPI_INTERNALS);
   trace_categorized         = xbt_cfg_get_boolean(OPT_TRACING_CATEGORIZED);
   trace_uncategorized       = xbt_cfg_get_boolean(OPT_TRACING_UNCATEGORIZED);
-  trace_actor_enabled       = trace_enabled && xbt_cfg_get_boolean(OPT_TRACING_MSG_PROCESS);
-  trace_msg_vm_enabled      = xbt_cfg_get_boolean(OPT_TRACING_MSG_VM);
+  trace_actor_enabled       = trace_enabled && xbt_cfg_get_boolean(OPT_TRACING_ACTOR);
+  trace_vm_enabled          = xbt_cfg_get_boolean(OPT_TRACING_VM);
   trace_buffer              = xbt_cfg_get_boolean(OPT_TRACING_BUFFER);
   trace_disable_destroy     = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_DESTROY);
   trace_basic               = xbt_cfg_get_boolean(OPT_TRACING_BASIC);
   trace_display_sizes       = xbt_cfg_get_boolean(OPT_TRACING_DISPLAY_SIZES);
   trace_disable_link        = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_LINK);
   trace_disable_power       = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_POWER);
-  trace_precision           = xbt_cfg_get_int(OPT_TRACING_PRECISION);
 }
 
 int TRACE_start()
@@ -158,7 +156,7 @@ int TRACE_end()
 
 bool TRACE_needs_platform ()
 {
-  return TRACE_actor_is_enabled() || TRACE_msg_vm_is_enabled() || TRACE_categorized() || TRACE_uncategorized() ||
+  return TRACE_actor_is_enabled() || TRACE_vm_is_enabled() || TRACE_categorized() || TRACE_uncategorized() ||
          TRACE_platform() || (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped());
 }
 
@@ -222,9 +220,9 @@ bool TRACE_actor_is_enabled()
   return trace_actor_enabled;
 }
 
-bool TRACE_msg_vm_is_enabled()
+bool TRACE_vm_is_enabled()
 {
-  return trace_msg_vm_enabled && TRACE_is_enabled();
+  return trace_vm_enabled && TRACE_is_enabled();
 }
 
 bool TRACE_disable_link()
@@ -297,8 +295,8 @@ void TRACE_global_init()
   xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED, "no", nullptr, "Tracing categorized resource utilization of hosts and links.");
   xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED, "no", nullptr, "Tracing uncategorized resource utilization of hosts and links.");
 
-  xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS, "no", nullptr, "Tracing of MSG process behavior.");
-  xbt_cfg_register_boolean(OPT_TRACING_MSG_VM, "no", nullptr, "Tracing of MSG process behavior.");
+  xbt_cfg_register_boolean(OPT_TRACING_ACTOR, "no", nullptr, "Tracing of actor behavior.");
+  xbt_cfg_register_boolean(OPT_TRACING_VM, "no", nullptr, "Tracing of virtual machine behavior.");
   xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK, "no", nullptr, "Do not trace link bandwidth and latency.");
   xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "no", nullptr, "Do not trace host power.");
   xbt_cfg_register_boolean(OPT_TRACING_BUFFER, "yes", nullptr, "Buffer trace events to put them in temporal order.");
@@ -372,10 +370,11 @@ void TRACE_help (int detailed)
       "  to allow further study of simulated or real sleep time", detailed);
   print_line (OPT_TRACING_SMPI_INTERNALS, "Generates tracing events corresponding",
       "  to point-to-point messages sent by collective communications", detailed);
-  print_line (OPT_TRACING_MSG_PROCESS, "Trace processes behavior (MSG)",
-      "  This option only has effect if this simulator is MSG-based. It traces the\n"
-      "  behavior of all categorized MSG processes, grouping them by hosts. This option\n"
-      "  can be used to track process location if this simulator has process migration.", detailed);
+  print_line(OPT_TRACING_ACTOR, "Trace actor behavior",
+             "  This option traces the behavior of all categorized actors, grouping them\n"
+             "  by hosts. This option can be used to track actor location if the simulator\n"
+             "  does actor migration.",
+             detailed);
   print_line (OPT_TRACING_BUFFER, "Buffer events to put them in temporal order",
       "  This option put some events in a time-ordered buffer using the insertion\n"
       "  sort algorithm. The process of acquiring and releasing locks to access this\n"
@@ -412,19 +411,3 @@ void TRACE_help (int detailed)
         "  time consuming, since it must get the route from each host to other hosts\n"
         "  within the same Autonomous System (AS).", detailed);
 }
-
-static void output_types (const char *name, xbt_dynar_t types, FILE *file)
-{
-  unsigned int i;
-  fprintf (file, "  %s = (", name);
-  for (i = xbt_dynar_length(types); i > 0; i--) {
-    char *type = *(static_cast<char**>(xbt_dynar_get_ptr(types, i - 1)));
-    fprintf (file, "\"%s\"", type);
-    if (i - 1 > 0){
-      fprintf (file, ",");
-    }else{
-      fprintf (file, ");\n");
-    }
-  }
-  xbt_dynar_free (&types);
-}
index 455dffe..b1ff48d 100644 (file)
@@ -1,18 +1,17 @@
-/* Copyright (c) 2010-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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/kernel/routing/NetPoint.hpp"
 #include "simgrid_config.h"
 #include "src/instr/instr_private.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/surf_private.hpp"
 #include "surf/surf.hpp"
 #include <algorithm>
 
-enum InstrUserVariable { INSTR_US_DECLARE, INSTR_US_SET, INSTR_US_ADD, INSTR_US_SUB };
+enum class InstrUserVariable { DECLARE, SET, ADD, SUB };
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API");
 
@@ -269,7 +268,7 @@ static void instr_user_variable(double time, const char* resource, const char* v
 
   //check if variable is already declared
   auto created = filter->find(variable_name);
-  if (what == INSTR_US_DECLARE){
+  if (what == InstrUserVariable::DECLARE) {
     if (created == filter->end()) { // not declared yet
       filter->insert(variable_name);
       instr_new_user_variable_type(father_type, variable_name, color == nullptr ? "" : color);
@@ -278,18 +277,18 @@ static void instr_user_variable(double time, const char* resource, const char* v
     if (created != filter->end()) { // declared, let's work
       simgrid::instr::VariableType* variable = simgrid::instr::Container::byName(resource)->getVariable(variable_name);
       switch (what){
-      case INSTR_US_SET:
-        variable->setEvent(time, value);
-        break;
-      case INSTR_US_ADD:
-        variable->addEvent(time, value);
-        break;
-      case INSTR_US_SUB:
-        variable->subEvent(time, value);
-        break;
-      default:
-        THROW_IMPOSSIBLE;
-        break;
+        case InstrUserVariable::SET:
+          variable->setEvent(time, value);
+          break;
+        case InstrUserVariable::ADD:
+          variable->addEvent(time, value);
+          break;
+        case InstrUserVariable::SUB:
+          variable->subEvent(time, value);
+          break;
+        default:
+          THROW_IMPOSSIBLE;
+          break;
       }
     }
   }
@@ -355,7 +354,7 @@ int TRACE_platform_graph_export_graphviz (const char *filename)
  */
 void TRACE_vm_variable_declare (const char *variable)
 {
-  instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, nullptr, &user_vm_variables);
+  instr_user_variable(0, nullptr, variable, "MSG_VM", 0, InstrUserVariable::DECLARE, nullptr, &user_vm_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -370,7 +369,7 @@ void TRACE_vm_variable_declare (const char *variable)
  */
 void TRACE_vm_variable_declare_with_color (const char *variable, const char *color)
 {
-  instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, &user_vm_variables);
+  instr_user_variable(0, nullptr, variable, "MSG_VM", 0, InstrUserVariable::DECLARE, color, &user_vm_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -432,7 +431,7 @@ void TRACE_vm_variable_sub (const char *vm, const char *variable, double value)
  */
 void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *variable, double value)
 {
-  instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, nullptr, &user_vm_variables);
+  instr_user_variable(time, vm, variable, "MSG_VM", value, InstrUserVariable::SET, nullptr, &user_vm_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -452,7 +451,7 @@ void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *v
  */
 void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *variable, double value)
 {
-  instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, nullptr, &user_vm_variables);
+  instr_user_variable(time, vm, variable, "MSG_VM", value, InstrUserVariable::ADD, nullptr, &user_vm_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -472,7 +471,7 @@ void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *v
  */
 void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *variable, double value)
 {
-  instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, nullptr, &user_vm_variables);
+  instr_user_variable(time, vm, variable, "MSG_VM", value, InstrUserVariable::SUB, nullptr, &user_vm_variables);
 }
 
 /* for host variables */
@@ -489,7 +488,7 @@ void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *v
  */
 void TRACE_host_variable_declare (const char *variable)
 {
-  instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, nullptr, &user_host_variables);
+  instr_user_variable(0, nullptr, variable, "HOST", 0, InstrUserVariable::DECLARE, nullptr, &user_host_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -504,7 +503,7 @@ void TRACE_host_variable_declare (const char *variable)
  */
 void TRACE_host_variable_declare_with_color (const char *variable, const char *color)
 {
-  instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, color, &user_host_variables);
+  instr_user_variable(0, nullptr, variable, "HOST", 0, InstrUserVariable::DECLARE, color, &user_host_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -566,7 +565,7 @@ void TRACE_host_variable_sub (const char *host, const char *variable, double val
  */
 void TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value)
 {
-  instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, nullptr, &user_host_variables);
+  instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SET, nullptr, &user_host_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -586,7 +585,7 @@ void TRACE_host_variable_set_with_time (double time, const char *host, const cha
  */
 void TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value)
 {
-  instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, nullptr, &user_host_variables);
+  instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::ADD, nullptr, &user_host_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -606,7 +605,7 @@ void TRACE_host_variable_add_with_time (double time, const char *host, const cha
  */
 void TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value)
 {
-  instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, nullptr, &user_host_variables);
+  instr_user_variable(time, host, variable, "HOST", value, InstrUserVariable::SUB, nullptr, &user_host_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -636,7 +635,7 @@ xbt_dynar_t TRACE_get_host_variables ()
  */
 void TRACE_link_variable_declare (const char *variable)
 {
-  instr_user_variable(0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, nullptr, &user_link_variables);
+  instr_user_variable(0, nullptr, variable, "LINK", 0, InstrUserVariable::DECLARE, nullptr, &user_link_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -651,7 +650,7 @@ void TRACE_link_variable_declare (const char *variable)
  */
 void TRACE_link_variable_declare_with_color (const char *variable, const char *color)
 {
-  instr_user_variable(0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, color, &user_link_variables);
+  instr_user_variable(0, nullptr, variable, "LINK", 0, InstrUserVariable::DECLARE, color, &user_link_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -713,7 +712,7 @@ void TRACE_link_variable_sub (const char *link, const char *variable, double val
  */
 void TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value)
 {
-  instr_user_variable(time, link, variable, "LINK", value, INSTR_US_SET, nullptr, &user_link_variables);
+  instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SET, nullptr, &user_link_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -733,7 +732,7 @@ void TRACE_link_variable_set_with_time (double time, const char *link, const cha
  */
 void TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value)
 {
-  instr_user_variable(time, link, variable, "LINK", value, INSTR_US_ADD, nullptr, &user_link_variables);
+  instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::ADD, nullptr, &user_link_variables);
 }
 
 /** \ingroup TRACE_user_variables
@@ -753,7 +752,7 @@ void TRACE_link_variable_add_with_time (double time, const char *link, const cha
  */
 void TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value)
 {
-  instr_user_variable(time, link, variable, "LINK", value, INSTR_US_SUB, nullptr, &user_link_variables);
+  instr_user_variable(time, link, variable, "LINK", value, InstrUserVariable::SUB, nullptr, &user_link_variables);
 }
 
 /* for link variables, but with src and dst used for get_route */
@@ -833,7 +832,7 @@ void TRACE_link_srcdst_variable_sub (const char *src, const char *dst, const cha
 void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, const char *dst, const char *variable,
                                                double value)
 {
-  instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SET);
+  instr_user_srcdst_variable(time, src, dst, variable, "LINK", value, InstrUserVariable::SET);
 }
 
 /** \ingroup TRACE_user_variables
@@ -855,7 +854,7 @@ void TRACE_link_srcdst_variable_set_with_time (double time, const char *src, con
 void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, const char *dst, const char *variable,
                                                double value)
 {
-  instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_ADD);
+  instr_user_srcdst_variable(time, src, dst, variable, "LINK", value, InstrUserVariable::ADD);
 }
 
 /** \ingroup TRACE_user_variables
@@ -877,7 +876,7 @@ void TRACE_link_srcdst_variable_add_with_time (double time, const char *src, con
 void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, const char *dst, const char *variable,
                                                double value)
 {
-  instr_user_srcdst_variable (time, src, dst, variable, "LINK", value, INSTR_US_SUB);
+  instr_user_srcdst_variable(time, src, dst, variable, "LINK", value, InstrUserVariable::SUB);
 }
 
 /** \ingroup TRACE_user_variables
index ce66709..2f7a00f 100644 (file)
@@ -114,6 +114,11 @@ Container::~Container()
   allContainers.erase(name_);
 }
 
+void Container::createChild(std::string name, std::string type_name)
+{
+  new Container(name, type_name, this);
+}
+
 Container* Container::byNameOrNull(std::string name)
 {
   auto cont = allContainers.find(name);
@@ -135,6 +140,7 @@ void Container::removeFromParent()
     XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", getCname(), father_->getCname());
     father_->children_.erase(name_);
   }
+  delete this;
 }
 
 void Container::logCreation()
@@ -142,7 +148,7 @@ void Container::logCreation()
   double timestamp = SIMIX_get_clock();
   std::stringstream stream;
 
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, PAJE_CreateContainer, timestamp);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, timestamp);
 
   if (instr_fmt_type == instr_fmt_paje) {
     stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_CreateContainer << " ";
@@ -186,7 +192,7 @@ void Container::logDestruction()
   std::stringstream stream;
   double timestamp = SIMIX_get_clock();
 
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_DestroyContainer, timestamp);
 
   if (instr_fmt_type == instr_fmt_paje) {
     stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DestroyContainer << " ";
index fe1bd00..828024a 100644 (file)
@@ -40,7 +40,7 @@ public:
   StateType* getState(std::string name);
   LinkType* getLink(std::string name);
   VariableType* getVariable(std::string name);
-
+  void createChild(std::string name, std::string type_name);
   static Container* getRoot();
 };
 
index 9719ce5..c44aa81 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2018. 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. */
@@ -18,7 +17,7 @@ namespace instr {
 NewEvent::NewEvent(double timestamp, container_t container, Type* type, EntityValue* val)
     : simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), val(val)
 {
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, eventType_, timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, eventType_, timestamp_);
   insertIntoBuffer();
 }
 
@@ -36,14 +35,14 @@ LinkEvent::LinkEvent(container_t container, Type* type, e_event_type event_type,
     , key_(key)
     , size_(size)
 {
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f, value:%s", __FUNCTION__, eventType_, timestamp_, value_.c_str());
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f, value:%s", __func__, eventType_, timestamp_, value_.c_str());
   insertIntoBuffer();
 }
 
 VariableEvent::VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
     : PajeEvent::PajeEvent(container, type, timestamp, event_type), value(value)
 {
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, eventType_, timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, eventType_, timestamp_);
   insertIntoBuffer();
 }
 
@@ -61,9 +60,12 @@ StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type
     filename                        = loc->filename;
     linenumber                      = loc->linenumber;
   }
+#else
+  filename   = "(null)";
+  linenumber = -1;
 #endif
 
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __FUNCTION__, eventType_, timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, eventType_, timestamp_);
   insertIntoBuffer();
 };
 
@@ -71,7 +73,7 @@ void NewEvent::print()
 {
   std::stringstream stream;
   stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
   if (instr_fmt_type != instr_fmt_paje)
     return;
 
@@ -88,7 +90,7 @@ void LinkEvent::print()
 {
   std::stringstream stream;
   stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
   if (instr_fmt_type != instr_fmt_paje)
     return;
   if (timestamp_ < 1e-12)
@@ -109,7 +111,7 @@ void VariableEvent::print()
 {
   std::stringstream stream;
   stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
   if (instr_fmt_type != instr_fmt_paje)
     return;
 
@@ -126,7 +128,7 @@ void StateEvent::print()
 {
   std::stringstream stream;
   stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, eventType_, TRACE_precision(), timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
   if (instr_fmt_type == instr_fmt_paje) {
     if (timestamp_ < 1e-12)
       stream << eventType_ << " " << 0 << " " << getType()->getId() << " " << getContainer()->getId();
index 8e293ad..26dca6a 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2010, 2012-2017. The SimGrid Team.
+/* Copyright (c) 2010, 2012-2018. 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/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/instr/instr_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_header, instr, "Paje tracing event system (header)");
index e4aea24..a811e79 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2010-2017. The SimGrid Team.
+/* Copyright (c) 2010-2018. 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/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/instr/instr_private.hpp"
 #include "src/instr/instr_smpi.hpp"
 #include "src/smpi/include/private.hpp"
@@ -52,7 +52,7 @@ void TRACE_paje_dump_buffer(bool force)
 {
   if (not TRACE_is_enabled())
     return;
-  XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
+  XBT_DEBUG("%s: dump until %f. starts", __func__, TRACE_last_timestamp_to_dump);
   if (force){
     for (auto const& event : buffer) {
       event->print();
@@ -71,7 +71,7 @@ void TRACE_paje_dump_buffer(bool force)
     }
     buffer.erase(buffer.begin(), i);
   }
-  XBT_DEBUG("%s: ends", __FUNCTION__);
+  XBT_DEBUG("%s: ends", __func__);
 }
 
 void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf)
@@ -98,8 +98,7 @@ void simgrid::instr::PajeEvent::insertIntoBuffer()
   }
   buffer_debug(&buffer);
 
-  XBT_DEBUG("%s: insert event_type=%u, timestamp=%f, buffersize=%zu)", __FUNCTION__, eventType_, timestamp_,
-            buffer.size());
+  XBT_DEBUG("%s: insert event_type=%u, timestamp=%f, buffersize=%zu)", __func__, eventType_, timestamp_, buffer.size());
   std::vector<simgrid::instr::PajeEvent*>::reverse_iterator i;
   for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
     simgrid::instr::PajeEvent* e1 = *i;
@@ -108,11 +107,11 @@ void simgrid::instr::PajeEvent::insertIntoBuffer()
       break;
   }
   if (i == buffer.rend())
-    XBT_DEBUG("%s: inserted at beginning", __FUNCTION__);
+    XBT_DEBUG("%s: inserted at beginning", __func__);
   else if (i == buffer.rbegin())
-    XBT_DEBUG("%s: inserted at end", __FUNCTION__);
+    XBT_DEBUG("%s: inserted at end", __func__);
   else
-    XBT_DEBUG("%s: inserted at pos= %zd from its end", __FUNCTION__, std::distance(buffer.rbegin(), i));
+    XBT_DEBUG("%s: inserted at pos= %zd from its end", __func__, std::distance(buffer.rbegin(), i));
   buffer.insert(i.base(), this);
 
   buffer_debug(&buffer);
index 3f87707..c0fa372 100644 (file)
@@ -129,7 +129,7 @@ void Type::logDefinition(e_event_type event_type)
   if (instr_fmt_type != instr_fmt_paje)
     return;
   std::stringstream stream;
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, event_type, TRACE_precision(), 0.);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event_type, TRACE_precision(), 0.);
   stream << std::fixed << std::setprecision(TRACE_precision()) << event_type << " " << getId();
   stream << " " << father_->getId() << " " << getName();
   if (isColored())
@@ -144,7 +144,7 @@ void Type::logDefinition(simgrid::instr::Type* source, simgrid::instr::Type* des
   if (instr_fmt_type != instr_fmt_paje)
     return;
   std::stringstream stream;
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __FUNCTION__, PAJE_DefineLinkType, TRACE_precision(), 0.);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, TRACE_precision(), 0.);
   stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DefineLinkType << " " << getId();
   stream << " " << father_->getId() << " " << source->getId() << " " << dest->getId() << " " << getName();
   XBT_DEBUG("Dump %s", stream.str().c_str());
index d0bdb9d..2a06dc2 100644 (file)
@@ -20,7 +20,7 @@ void EntityValue::print()
   if (instr_fmt_type != instr_fmt_paje)
     return;
   std::stringstream stream;
-  XBT_DEBUG("%s: event_type=%u", __FUNCTION__, PAJE_DefineEntityValue);
+  XBT_DEBUG("%s: event_type=%u", __func__, PAJE_DefineEntityValue);
   stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DefineEntityValue;
   stream << " " << id_ << " " << father_->getId() << " " << name_;
   if (not color_.empty())
index 7569078..0004fa9 100644 (file)
@@ -19,6 +19,7 @@
 #include "xbt/graph.h"
 #include <iomanip> /** std::setprecision **/
 #include <map>
+#include <memory>
 #include <set>
 #include <sstream>
 #include <string>
@@ -42,9 +43,9 @@ class TIData {
 public:
   int endpoint                 = 0;
   int send_size                = 0;
-  std::vector<int>* sendcounts = nullptr;
+  std::shared_ptr<std::vector<int>> sendcounts = nullptr;
   int recv_size                = 0;
-  std::vector<int>* recvcounts = nullptr;
+  std::shared_ptr<std::vector<int>> recvcounts = nullptr;
   std::string send_type        = "";
   std::string recv_type        = "";
 
@@ -68,6 +69,12 @@ public:
   // VarCollTI: gatherV, scatterV, allGatherV, allToAllV (+ reduceScatter out of laziness)
   explicit TIData(std::string name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
                   std::vector<int>* recvcounts, std::string send_type, std::string recv_type)
+      : TIData(name, root, send_size, std::shared_ptr<std::vector<int>>(sendcounts), recv_size,
+               std::shared_ptr<std::vector<int>>(recvcounts), send_type, recv_type){};
+
+  explicit TIData(std::string name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
+                  int recv_size, std::shared_ptr<std::vector<int>> recvcounts, std::string send_type,
+                  std::string recv_type)
       : name_(name)
       , endpoint(root)
       , send_size(send_size)
@@ -77,11 +84,7 @@ public:
       , send_type(send_type)
       , recv_type(recv_type){};
 
-  virtual ~TIData()
-  {
-    delete sendcounts;
-    delete recvcounts;
-  }
+  virtual ~TIData() {}
 
   std::string getName() { return name_; }
   double getAmount() { return amount_; }
@@ -151,6 +154,12 @@ public:
   explicit VarCollTIData(std::string name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
                          std::vector<int>* recvcounts, std::string send_type, std::string recv_type)
       : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+
+  explicit VarCollTIData(std::string name, int root, int send_size, std::shared_ptr<std::vector<int>> sendcounts,
+                         int recv_size, std::shared_ptr<std::vector<int>> recvcounts, std::string send_type,
+                         std::string recv_type)
+      : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+
   std::string print() override
   {
     std::stringstream stream;
@@ -203,7 +212,7 @@ XBT_PRIVATE bool TRACE_is_configured();
 XBT_PRIVATE bool TRACE_categorized();
 XBT_PRIVATE bool TRACE_uncategorized();
 XBT_PRIVATE bool TRACE_actor_is_enabled();
-XBT_PRIVATE bool TRACE_msg_vm_is_enabled();
+XBT_PRIVATE bool TRACE_vm_is_enabled();
 XBT_PRIVATE bool TRACE_buffer();
 XBT_PRIVATE bool TRACE_disable_link();
 XBT_PRIVATE bool TRACE_disable_speed();
@@ -213,11 +222,11 @@ XBT_PRIVATE bool TRACE_display_sizes();
 XBT_PRIVATE int TRACE_precision();
 
 /* Public functions used in SMPI */
-XBT_PUBLIC(bool) TRACE_smpi_is_enabled();
-XBT_PUBLIC(bool) TRACE_smpi_is_grouped();
-XBT_PUBLIC(bool) TRACE_smpi_is_computing();
-XBT_PUBLIC(bool) TRACE_smpi_is_sleeping();
-XBT_PUBLIC(bool) TRACE_smpi_view_internals();
+XBT_PUBLIC bool TRACE_smpi_is_enabled();
+XBT_PUBLIC bool TRACE_smpi_is_grouped();
+XBT_PUBLIC bool TRACE_smpi_is_computing();
+XBT_PUBLIC bool TRACE_smpi_is_sleeping();
+XBT_PUBLIC bool TRACE_smpi_view_internals();
 
 /* from resource_utilization.c */
 XBT_PRIVATE void TRACE_surf_host_set_utilization(const char* resource, const char* category, double value, double now,
index def907b..8346160 100644 (file)
@@ -19,7 +19,6 @@ XBT_PRIVATE const char* TRACE_internal_smpi_get_category();
 XBT_PRIVATE void TRACE_smpi_computing_init(int rank);
 XBT_PRIVATE void TRACE_smpi_computing_out(int rank);
 XBT_PRIVATE void TRACE_smpi_computing_in(int rank, double amount);
-XBT_PRIVATE void TRACE_smpi_sleeping_init(int rank);
 XBT_PRIVATE void TRACE_smpi_sleeping_out(int rank);
 XBT_PRIVATE void TRACE_smpi_sleeping_in(int rank, double duration);
 XBT_PRIVATE void TRACE_smpi_testing_out(int rank);
@@ -33,8 +32,6 @@ XBT_PRIVATE void TRACE_smpi_recv(int src, int dst, int tag);
 XBT_PRIVATE void TRACE_smpi_init(int rank);
 XBT_PRIVATE void TRACE_smpi_finalize(int rank);
 
-XBT_PRIVATE const char* encode_datatype(MPI_Datatype datatype);
-
 class smpi_trace_call_location_t {
 public:
   std::string filename;
index df3b893..abda1e2 100644 (file)
@@ -1,12 +1,13 @@
-/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2018. 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 "src/kernel/EngineImpl.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/NetZoneImpl.hpp"
+#include "src/surf/StorageImpl.hpp"
 
 #include <algorithm>
 
@@ -36,6 +37,10 @@ EngineImpl::~EngineImpl()
   delete netRoot_;
   for (auto const& kv : netpoints_)
     delete kv.second;
+
+  for (auto const& kv : storages_)
+    if (kv.second)
+      delete kv.second->getImpl();
 }
 }
 }
index 4e2ef24..cba6843 100644 (file)
@@ -20,6 +20,7 @@ public:
 
 private:
   std::map<std::string, simgrid::s4u::Host*> hosts_;
+  std::map<std::string, simgrid::s4u::Storage*> storages_;
   std::unordered_map<std::string, simgrid::kernel::routing::NetPoint*> netpoints_;
   friend simgrid::s4u::Engine;
 };
index 24f6e48..dba9a7a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -19,25 +19,25 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-  XBT_PUBLIC_CLASS ActivityImpl {
-  public:
-    ActivityImpl();
-    virtual ~ActivityImpl();
-    e_smx_state_t state = SIMIX_WAITING; /* State of the activity */
-    std::string name;                    /* Activity name if any */
-    std::list<smx_simcall_t> simcalls;   /* List of simcalls waiting for this activity */
-
-    virtual void suspend()=0;
-    virtual void resume()=0;
-    virtual void post() =0; // What to do when a simcall terminates
-
-    // boost::intrusive_ptr<ActivityImpl> support:
-    friend XBT_PUBLIC(void) intrusive_ptr_add_ref(ActivityImpl * activity);
-    friend XBT_PUBLIC(void) intrusive_ptr_release(ActivityImpl * activity);
-
-  private:
-    std::atomic_int_fast32_t refcount_{0};
-  };
+class XBT_PUBLIC ActivityImpl {
+public:
+  ActivityImpl();
+  virtual ~ActivityImpl();
+  e_smx_state_t state = SIMIX_WAITING; /* State of the activity */
+  std::string name;                    /* Activity name if any */
+  std::list<smx_simcall_t> simcalls;   /* List of simcalls waiting for this activity */
+
+  virtual void suspend() = 0;
+  virtual void resume()  = 0;
+  virtual void post()    = 0; // What to do when a simcall terminates
+
+  // boost::intrusive_ptr<ActivityImpl> support:
+  friend XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
+  friend XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
+
+private:
+  std::atomic_int_fast32_t refcount_{0};
+};
 }}} // namespace simgrid::kernel::activity
 
 #endif /* SIMGRID_KERNEL_ACTIVITY_ACTIVITYIMPL_HPP */
index e811dd1..129aeaf 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 "src/kernel/activity/CommImpl.hpp"
-#include "src/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Action.hpp"
 
 #include "simgrid/modelchecker.h"
 #include "src/mc/mc_replay.hpp"
@@ -72,7 +72,7 @@ void simgrid::kernel::activity::CommImpl::cancel()
 /**  @brief get the amount remaining from the communication */
 double simgrid::kernel::activity::CommImpl::remains()
 {
-  return surfAction_->getRemains();
+  return surfAction_->get_remains();
 }
 
 /** @brief This is part of the cleanup process, probably an internal command */
@@ -97,15 +97,15 @@ void simgrid::kernel::activity::CommImpl::cleanupSurf()
 void simgrid::kernel::activity::CommImpl::post()
 {
   /* Update synchro state */
-  if (src_timeout && src_timeout->getState() == simgrid::kernel::resource::Action::State::done)
+  if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::done)
     state = SIMIX_SRC_TIMEOUT;
-  else if (dst_timeout && dst_timeout->getState() == simgrid::kernel::resource::Action::State::done)
+  else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::done)
     state = SIMIX_DST_TIMEOUT;
-  else if (src_timeout && src_timeout->getState() == simgrid::kernel::resource::Action::State::failed)
+  else if (src_timeout && src_timeout->get_state() == simgrid::kernel::resource::Action::State::failed)
     state = SIMIX_SRC_HOST_FAILURE;
-  else if (dst_timeout && dst_timeout->getState() == simgrid::kernel::resource::Action::State::failed)
+  else if (dst_timeout && dst_timeout->get_state() == simgrid::kernel::resource::Action::State::failed)
     state = SIMIX_DST_HOST_FAILURE;
-  else if (surfAction_ && surfAction_->getState() == simgrid::kernel::resource::Action::State::failed) {
+  else if (surfAction_ && surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) {
     state = SIMIX_LINK_FAILURE;
   } else
     state = SIMIX_DONE;
index 86e44d1..849f605 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -15,8 +15,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-XBT_PUBLIC_CLASS CommImpl : public ActivityImpl
-{
+class XBT_PUBLIC CommImpl : public ActivityImpl {
   ~CommImpl() override;
 
 public:
index 9f2c205..521785d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -34,14 +34,14 @@ simgrid::kernel::activity::ExecImpl::~ExecImpl()
 
 void simgrid::kernel::activity::ExecImpl::suspend()
 {
-  XBT_VERB("This exec is suspended (remain: %f)", surfAction_->getRemains());
+  XBT_VERB("This exec is suspended (remain: %f)", surfAction_->get_remains());
   if (surfAction_)
     surfAction_->suspend();
 }
 
 void simgrid::kernel::activity::ExecImpl::resume()
 {
-  XBT_VERB("This exec is resumed (remain: %f)", surfAction_->getRemains());
+  XBT_VERB("This exec is resumed (remain: %f)", surfAction_->get_remains());
   if (surfAction_)
     surfAction_->resume();
 }
@@ -52,21 +52,21 @@ double simgrid::kernel::activity::ExecImpl::remains()
                                "We would need to return a vector instead of a scalar. "
                                "Did you mean remainingRatio() instead?");
 
-  return surfAction_ ? surfAction_->getRemains() : 0;
+  return surfAction_ ? surfAction_->get_remains() : 0;
 }
 
 double simgrid::kernel::activity::ExecImpl::remainingRatio()
 {
   if (host_ == nullptr) // parallel task: their remain is already between 0 and 1 (see comment in ExecImpl::remains())
-    return surfAction_->getRemains();
+    return surfAction_->get_remains();
   else // Actually compute the ratio for sequential tasks
-    return surfAction_->getRemains() / surfAction_->getCost();
+    return surfAction_->get_remains() / surfAction_->get_cost();
 }
 
 void simgrid::kernel::activity::ExecImpl::setBound(double bound)
 {
   if (surfAction_)
-    surfAction_->setBound(bound);
+    surfAction_->set_bound(bound);
 }
 
 void simgrid::kernel::activity::ExecImpl::post()
@@ -75,10 +75,10 @@ void simgrid::kernel::activity::ExecImpl::post()
                                  /* If the host running the synchro failed, notice it. This way, the asking
                                   * process can be killed if it runs on that host itself */
     state = SIMIX_FAILED;
-  } else if (surfAction_->getState() == simgrid::kernel::resource::Action::State::failed) {
+  } else if (surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) {
     /* If the host running the synchro didn't fail, then the synchro was canceled */
     state = SIMIX_CANCELED;
-  } else if (timeoutDetector && timeoutDetector->getState() == simgrid::kernel::resource::Action::State::done) {
+  } else if (timeoutDetector && timeoutDetector->get_state() == simgrid::kernel::resource::Action::State::done) {
     state = SIMIX_TIMEOUT;
   } else {
     state = SIMIX_DONE;
@@ -105,15 +105,15 @@ simgrid::kernel::activity::ExecImpl::migrate(simgrid::s4u::Host* to)
 
   if (not MC_is_active() && not MC_record_replay_is_active()) {
     simgrid::kernel::resource::Action* oldAction = this->surfAction_;
-    simgrid::kernel::resource::Action* newAction = to->pimpl_cpu->execution_start(oldAction->getCost());
-    newAction->setRemains(oldAction->getRemains());
-    newAction->setData(this);
-    newAction->setSharingWeight(oldAction->getPriority());
+    simgrid::kernel::resource::Action* newAction = to->pimpl_cpu->execution_start(oldAction->get_cost());
+    newAction->set_remains(oldAction->get_remains());
+    newAction->set_data(this);
+    newAction->set_priority(oldAction->get_priority());
 
     // FIXME: the user-defined bound seem to not be kept by LMM, that seem to overwrite it for the multi-core modeling.
     // I hope that the user did not provide any.
 
-    oldAction->setData(nullptr);
+    oldAction->set_data(nullptr);
     oldAction->cancel();
     oldAction->unref();
     this->surfAction_ = newAction;
index 4b11447..17f82ae 100644 (file)
@@ -13,8 +13,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-XBT_PUBLIC_CLASS ExecImpl : public ActivityImpl
-{
+class XBT_PUBLIC ExecImpl : public ActivityImpl {
   ~ExecImpl() override;
 
 public:
index 2039f25..4bfffe8 100644 (file)
@@ -37,7 +37,7 @@ public:
   simgrid::s4u::Mailbox piface_; // Our interface
   simgrid::xbt::string name_;
 
-  simgrid::simix::ActorImplPtr permanent_receiver; // process to which the mailbox is attached
+  simgrid::kernel::actor::ActorImplPtr permanent_receiver; // actor to which the mailbox is attached
   boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
   boost::circular_buffer_space_optimized<smx_activity_t> done_comm_queue; // messages already received in the permanent receive mode
 };
index 6b94db7..7d90c8a 100644 (file)
@@ -81,7 +81,7 @@ void MutexImpl::unlock(smx_actor_t issuer)
 
   /* If the mutex is not owned by the issuer, that's not good */
   if (issuer != this->owner)
-    THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%lu), not by you.",
+    THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%ld), not by you.",
            this->owner->getCname(), this->owner->pid);
 
   if (not this->sleeping.empty()) {
index 1274e79..53543b6 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -14,7 +14,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-class XBT_PUBLIC() MutexImpl {
+class XBT_PUBLIC MutexImpl {
 public:
   MutexImpl();
   ~MutexImpl();
@@ -28,7 +28,7 @@ public:
   bool locked       = false;
   smx_actor_t owner = nullptr;
   // List of sleeping processes:
-  simgrid::simix::SynchroList sleeping;
+  simgrid::kernel::actor::SynchroList sleeping;
 
   // boost::intrusive_ptr<Mutex> support:
   friend void intrusive_ptr_add_ref(MutexImpl* mutex)
index c8f76b3..054d467 100644 (file)
@@ -5,9 +5,9 @@
 
 #include "simgrid/s4u/Host.hpp"
 
+#include "simgrid/kernel/resource/Action.hpp"
 #include "src/kernel/activity/SleepImpl.hpp"
 #include "src/kernel/context/Context.hpp"
-#include "src/kernel/resource/Action.hpp"
 
 #include "src/simix/ActorImpl.hpp"
 #include "src/simix/popping_private.hpp"
@@ -32,7 +32,7 @@ void simgrid::kernel::activity::SleepImpl::post()
     simcalls.pop_front();
 
     e_smx_state_t result;
-    switch (surf_sleep->getState()) {
+    switch (surf_sleep->get_state()) {
       case simgrid::kernel::resource::Action::State::failed:
         simcall->issuer->context->iwannadie = 1;
         result                              = SIMIX_SRC_HOST_FAILURE;
index 38c781f..2713736 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -13,8 +13,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-XBT_PUBLIC_CLASS SleepImpl : public ActivityImpl
-{
+class XBT_PUBLIC SleepImpl : public ActivityImpl {
 public:
   void suspend() override;
   void resume() override;
index 5d7c25d..e0158cf 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 "src/kernel/activity/SynchroIo.hpp"
-#include "src/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Action.hpp"
 #include "src/simix/smx_private.hpp"
 #include "src/surf/surf_interface.hpp"
 
@@ -25,17 +25,17 @@ void simgrid::kernel::activity::IoImpl::post()
   for (smx_simcall_t const& simcall : simcalls) {
     switch (simcall->call) {
       case SIMCALL_STORAGE_WRITE:
-        simcall_storage_write__set__result(simcall, surf_io->getCost());
+        simcall_storage_write__set__result(simcall, surf_io->get_cost());
         break;
       case SIMCALL_STORAGE_READ:
-        simcall_storage_read__set__result(simcall, surf_io->getCost());
+        simcall_storage_read__set__result(simcall, surf_io->get_cost());
         break;
       default:
         break;
     }
   }
 
-  switch (surf_io->getState()) {
+  switch (surf_io->get_state()) {
     case simgrid::kernel::resource::Action::State::failed:
       state = SIMIX_FAILED;
       break;
index b7f7e1b..03efd48 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -13,8 +13,7 @@ namespace simgrid {
 namespace kernel {
 namespace activity {
 
-XBT_PUBLIC_CLASS IoImpl : public ActivityImpl
-{
+class XBT_PUBLIC IoImpl : public ActivityImpl {
 public:
   void suspend() override;
   void resume() override;
index 3d60634..b9e089e 100644 (file)
@@ -4,7 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/activity/SynchroRaw.hpp"
-#include "src/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Action.hpp"
 #include "src/simix/smx_synchro_private.hpp"
 #include "src/surf/surf_interface.hpp"
 
@@ -27,9 +27,9 @@ void simgrid::kernel::activity::RawImpl::resume()
 void simgrid::kernel::activity::RawImpl::post()
 {
   XBT_IN("(%p)",this);
-  if (sleep->getState() == simgrid::kernel::resource::Action::State::failed)
+  if (sleep->get_state() == simgrid::kernel::resource::Action::State::failed)
     state = SIMIX_FAILED;
-  else if (sleep->getState() == simgrid::kernel::resource::Action::State::done)
+  else if (sleep->get_state() == simgrid::kernel::resource::Action::State::done)
     state = SIMIX_SRC_TIMEOUT;
 
   SIMIX_synchro_finish(this);
index eaa8e9c..40b3887 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -14,8 +14,7 @@ namespace kernel {
 namespace activity {
 
   /** Used to implement mutexes, semaphores and conditions */
-XBT_PUBLIC_CLASS RawImpl : public ActivityImpl
-{
+class XBT_PUBLIC RawImpl : public ActivityImpl {
 public:
   ~RawImpl() override;
   void suspend() override;
index 7b53ca9..373df85 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -37,107 +37,88 @@ namespace simgrid {
 namespace kernel {
 namespace context {
 
-  XBT_PUBLIC_CLASS ContextFactory {
-  private:
-    std::string name_;
-  public:
-
-    explicit ContextFactory(std::string name) : name_(std::move(name)) {}
-    virtual ~ContextFactory();
-    virtual Context* create_context(std::function<void()> code,
-      void_pfn_smxprocess_t cleanup, smx_actor_t process) = 0;
-
-    // Optional methods for attaching main() as a context:
-
-    /** Creates a context from the current context of execution
+class XBT_PUBLIC ContextFactory {
+private:
+  std::string name_;
+
+public:
+  explicit ContextFactory(std::string name) : name_(std::move(name)) {}
+  virtual ~ContextFactory();
+  virtual Context* create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t process) = 0;
+
+  // Optional methods for attaching main() as a context:
+
+  /** Creates a context from the current context of execution
+   *
+   *  This will not work on all implementation of `ContextFactory`.
+   */
+  virtual Context* attach(void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
+  virtual Context* create_maestro(std::function<void()> code, smx_actor_t process);
+
+  virtual void run_all() = 0;
+  virtual Context* self();
+  std::string const& name() const { return name_; }
+private:
+  void declare_context(void* T, std::size_t size);
+
+protected:
+  template <class T, class... Args> T* new_context(Args&&... args)
+  {
+    T* context = new T(std::forward<Args>(args)...);
+    this->declare_context(context, sizeof(T));
+    return context;
+  }
+};
+
+class XBT_PUBLIC Context {
+private:
+  std::function<void()> code_;
+  void_pfn_smxprocess_t cleanup_func_ = nullptr;
+  smx_actor_t process_                = nullptr;
+
+public:
+  class StopRequest {
+    /** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff
      *
-     *  This will not work on all implementation of `ContextFactory`.
+     * Nope, Sonar, this should not inherit of std::exception.
+     * Otherwise, users may accidentally catch it with a try {} catch (std::exception)
      */
-    virtual Context* attach(void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
-    virtual Context* create_maestro(std::function<void()> code, smx_actor_t process);
-
-    virtual void run_all() = 0;
-    virtual Context* self();
-    std::string const& name() const
-    {
-      return name_;
-    }
-  private:
-    void declare_context(void* T, std::size_t size);
-  protected:
-    template<class T, class... Args>
-    T* new_context(Args&&... args)
-    {
-      T* context = new T(std::forward<Args>(args)...);
-      this->declare_context(context, sizeof(T));
-      return context;
-    }
-  };
-
-  XBT_PUBLIC_CLASS Context {
-  private:
-    std::function<void()> code_;
-    void_pfn_smxprocess_t cleanup_func_ = nullptr;
-    smx_actor_t process_ = nullptr;
-  public:
-    class StopRequest {
-      /** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff
-       *
-       * Nope, Sonar, this should not inherit of std::exception.
-       * Otherwise, users may accidentally catch it with a try {} catch (std::exception)
-       */
-    };
-    bool iwannadie;
-
-    Context(std::function<void()> code,
-            void_pfn_smxprocess_t cleanup_func,
-            smx_actor_t process);
-    void operator()()
-    {
-      code_();
-    }
-    bool has_code() const
-    {
-      return static_cast<bool>(code_);
-    }
-    smx_actor_t process()
-    {
-      return this->process_;
-    }
-    void set_cleanup(void_pfn_smxprocess_t cleanup)
-    {
-      cleanup_func_ = cleanup;
-    }
-
-    // Virtual methods
-    virtual ~Context();
-    virtual void stop();
-    virtual void suspend() = 0;
   };
-
-  XBT_PUBLIC_CLASS AttachContext : public Context {
-  public:
-
-    AttachContext(std::function<void()> code,
-            void_pfn_smxprocess_t cleanup_func,
-            smx_actor_t process)
+  bool iwannadie;
+
+  Context(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
+  void operator()() { code_(); }
+  bool has_code() const { return static_cast<bool>(code_); }
+  smx_actor_t process() { return this->process_; }
+  void set_cleanup(void_pfn_smxprocess_t cleanup) { cleanup_func_ = cleanup; }
+
+  // Virtual methods
+  virtual ~Context();
+  virtual void stop();
+  virtual void suspend() = 0;
+};
+
+class XBT_PUBLIC AttachContext : public Context {
+public:
+  AttachContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
       : Context(std::move(code), cleanup_func, process)
-    {}
+  {
+  }
 
-    ~AttachContext() override;
+  ~AttachContext() override;
 
-    /** Called by the context when it is ready to give control
-     *  to the maestro.
-     */
-    virtual void attach_start() = 0;
+  /** Called by the context when it is ready to give control
+   *  to the maestro.
+   */
+  virtual void attach_start() = 0;
 
-    /** Called by the context when it has finished its job */
-    virtual void attach_stop() = 0;
-  };
+  /** Called by the context when it has finished its job */
+  virtual void attach_stop() = 0;
+};
 
 /* This allows Java to hijack the context factory (Java induces factories of factory :) */
 typedef ContextFactory* (*ContextFactoryInitializer)();
-XBT_PUBLIC_DATA(ContextFactoryInitializer) factory_initializer;
+XBT_PUBLIC_DATA ContextFactoryInitializer factory_initializer;
 
 XBT_PRIVATE ContextFactory* thread_factory();
 XBT_PRIVATE ContextFactory* sysv_factory();
@@ -153,11 +134,11 @@ extern "C" {
 XBT_PRIVATE void SIMIX_context_mod_init();
 XBT_PRIVATE void SIMIX_context_mod_exit();
 
-XBT_PUBLIC(smx_context_t)
-SIMIX_context_new(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t simix_process);
+XBT_PUBLIC smx_context_t SIMIX_context_new(std::function<void()> code, void_pfn_smxprocess_t cleanup_func,
+                                           smx_actor_t simix_process);
 
 #ifndef WIN32
-XBT_PUBLIC_DATA(char sigsegv_stack[SIGSTKSZ]);
+XBT_PUBLIC_DATA char sigsegv_stack[SIGSTKSZ];
 #endif
 
 /* We are using the bottom of the stack to save some information, like the
@@ -173,15 +154,15 @@ XBT_PUBLIC_DATA(char sigsegv_stack[SIGSTKSZ]);
 /** @brief Executes all the processes to run (in parallel if possible). */
 XBT_PRIVATE void SIMIX_context_runall();
 /** @brief returns the current running context */
-XBT_PUBLIC(smx_context_t) SIMIX_context_self(); // public because it's used in simgrid-java
+XBT_PUBLIC smx_context_t SIMIX_context_self(); // public because it's used in simgrid-java
 
 XBT_PRIVATE void *SIMIX_context_stack_new();
 XBT_PRIVATE void SIMIX_context_stack_delete(void *stack);
 
-XBT_PUBLIC(void) SIMIX_context_set_current(smx_context_t context);
+XBT_PUBLIC void SIMIX_context_set_current(smx_context_t context);
 XBT_PRIVATE smx_context_t SIMIX_context_get_current();
 
-XBT_PUBLIC(int) SIMIX_process_get_maxpid();
+XBT_PUBLIC int SIMIX_process_get_maxpid();
 
 XBT_PRIVATE void SIMIX_post_create_environment();
 }
index 83bd007..94cb183 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007-2011, 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2018. 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 <xbt/utility.hpp>
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_maxmin);
-#define SHOW_EXPR_G(expr) XBT_DEBUG(#expr " = %g", expr);
-#define SHOW_EXPR_D(expr) XBT_DEBUG(#expr " = %d", expr);
-#define SHOW_EXPR_P(expr) XBT_DEBUG(#expr " = %p", expr);
 
-void simgrid::kernel::lmm::bottleneck_solve(lmm_system_t sys)
+simgrid::kernel::lmm::System* simgrid::kernel::lmm::make_new_fair_bottleneck_system(bool selective_update)
 {
-  if (not sys->modified)
+  return new simgrid::kernel::lmm::FairBottleneck(selective_update);
+}
+
+void simgrid::kernel::lmm::FairBottleneck::bottleneck_solve()
+{
+  if (not modified)
     return;
 
-  XBT_DEBUG("Variable set : %zu", sys->variable_set.size());
-  for (Variable& var : sys->variable_set) {
+  XBT_DEBUG("Variable set : %zu", variable_set.size());
+  for (Variable& var : variable_set) {
     var.value = 0.0;
     XBT_DEBUG("Handling variable %p", &var);
     if (var.sharing_weight > 0.0 && std::find_if(begin(var.cnsts), end(var.cnsts), [](Element const& x) {
                                       return x.consumption_weight != 0.0;
                                     }) != end(var.cnsts)) {
-      sys->saturated_variable_set.push_back(var);
+      saturated_variable_set.push_back(var);
     } else {
       XBT_DEBUG("Err, finally, there is no need to take care of variable %p", &var);
       if (var.sharing_weight > 0.0)
@@ -38,11 +39,11 @@ void simgrid::kernel::lmm::bottleneck_solve(lmm_system_t sys)
     }
   }
 
-  XBT_DEBUG("Active constraints : %zu", sys->active_constraint_set.size());
-  for (Constraint& cnst : sys->active_constraint_set) {
-    sys->saturated_constraint_set.push_back(cnst);
+  XBT_DEBUG("Active constraints : %zu", active_constraint_set.size());
+  for (Constraint& cnst : active_constraint_set) {
+    saturated_constraint_set.push_back(cnst);
   }
-  for (Constraint& cnst : sys->saturated_constraint_set) {
+  for (Constraint& cnst : saturated_constraint_set) {
     cnst.remaining = cnst.bound;
     cnst.usage     = 0.0;
   }
@@ -52,12 +53,12 @@ void simgrid::kernel::lmm::bottleneck_solve(lmm_system_t sys)
   /*
    * Compute Usage and store the variables that reach the maximum.
    */
-  auto& var_list  = sys->saturated_variable_set;
-  auto& cnst_list = sys->saturated_constraint_set;
+  auto& var_list  = saturated_variable_set;
+  auto& cnst_list = saturated_constraint_set;
   do {
     if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
       XBT_DEBUG("Fair bottleneck done");
-      sys->print();
+      print();
     }
     XBT_DEBUG("******* Constraints to process: %zu *******", cnst_list.size());
     for (auto iter = std::begin(cnst_list); iter != std::end(cnst_list);) {
@@ -143,9 +144,9 @@ void simgrid::kernel::lmm::bottleneck_solve(lmm_system_t sys)
   } while (not var_list.empty());
 
   cnst_list.clear();
-  sys->modified = true;
+  modified = true;
   if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
     XBT_DEBUG("Fair bottleneck done");
-    sys->print();
+    print();
   }
 }
index d08d85c..f8afafd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 "xbt/sysdep.h"
 
 #include <algorithm>
-#include <cstdlib>
-#ifndef MATH
 #include <cmath>
-#endif
+#include <cstdlib>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_lagrange, surf, "Logging specific to SURF (lagrange)");
 XBT_LOG_NEW_SUBCATEGORY(surf_lagrange_dichotomy, surf_lagrange, "Logging specific to SURF (lagrange dichotomy)");
 
-#define SHOW_EXPR(expr) XBT_CDEBUG(surf_lagrange, #expr " = %g", expr);
-#define VEGAS_SCALING 1000.0
-#define RENO_SCALING 1.0
-#define RENO2_SCALING 1.0
+static constexpr double VEGAS_SCALING = 1000.0;
+static constexpr double RENO_SCALING  = 1.0;
+static constexpr double RENO2_SCALING = 1.0;
 
 namespace simgrid {
 namespace kernel {
 namespace lmm {
 
-double (*func_f_def)(const Variable&, double);
-double (*func_fp_def)(const Variable&, double);
-double (*func_fpi_def)(const Variable&, double);
+System* make_new_lagrange_system(bool selective_update)
+{
+  return new Lagrange(selective_update);
+}
 
-/*
- * Local prototypes to implement the Lagrangian optimization with optimal step, also called dichotomy.
- */
-// solves the proportional fairness using a Lagrangian optimization with dichotomy step
-void lagrange_solve(lmm_system_t sys);
-// computes the value of the dichotomy using a initial values, init, with a specific variable or constraint
-static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, double min_error);
-// computes the value of the differential of constraint cnst applied to lambda
-static double partial_diff_lambda(double lambda, const Constraint& cnst);
-
-template <class CnstList, class VarList>
-static int __check_feasible(const CnstList& cnst_list, const VarList& var_list, int warn)
+bool Lagrange::check_feasible(bool warn)
 {
-  for (Constraint const& cnst : cnst_list) {
+  for (Constraint const& cnst : active_constraint_set) {
     double tmp = 0;
     for (Element const& elem : cnst.enabled_element_set) {
       Variable* var = elem.variable;
@@ -57,12 +44,12 @@ static int __check_feasible(const CnstList& cnst_list, const VarList& var_list,
     if (double_positive(tmp - cnst.bound, sg_maxmin_precision)) {
       if (warn)
         XBT_WARN("The link (%p) is over-used. Expected less than %f and got %f", &cnst, cnst.bound, tmp);
-      return 0;
+      return false;
     }
     XBT_DEBUG("Checking feasability for constraint (%p): sat = %f, lambda = %f ", &cnst, tmp - cnst.bound, cnst.lambda);
   }
 
-  for (Variable const& var : var_list) {
+  for (Variable const& var : variable_set) {
     if (not var.sharing_weight)
       break;
     if (var.bound < 0)
@@ -72,13 +59,13 @@ static int __check_feasible(const CnstList& cnst_list, const VarList& var_list,
     if (double_positive(var.value - var.bound, sg_maxmin_precision)) {
       if (warn)
         XBT_WARN("The variable (%p) is too large. Expected less than %f and got %f", &var, var.bound, var.value);
-      return 0;
+      return false;
     }
   }
-  return 1;
+  return true;
 }
 
-static double new_value(const Variable& var)
+double Lagrange::new_value(const Variable& var)
 {
   double tmp = 0;
 
@@ -89,10 +76,10 @@ static double new_value(const Variable& var)
     tmp += var.mu;
   XBT_DEBUG("\t Working on var (%p). cost = %e; Weight = %e", &var, tmp, var.sharing_weight);
   // uses the partial differential inverse function
-  return var.func_fpi(var, tmp);
+  return func_fpi(var, tmp);
 }
 
-static double new_mu(const Variable& var)
+double Lagrange::new_mu(const Variable& var)
 {
   double mu_i    = 0.0;
   double sigma_i = 0.0;
@@ -100,18 +87,17 @@ static double new_mu(const Variable& var)
   for (Element const& elem : var.cnsts) {
     sigma_i += elem.constraint->lambda;
   }
-  mu_i = var.func_fp(var, var.bound) - sigma_i;
+  mu_i = func_fp(var, var.bound) - sigma_i;
   if (mu_i < 0.0)
     return 0.0;
   return mu_i;
 }
 
-template <class VarList, class CnstList>
-static double dual_objective(const VarList& var_list, const CnstList& cnst_list)
+double Lagrange::dual_objective()
 {
   double obj = 0.0;
 
-  for (Variable const& var : var_list) {
+  for (Variable const& var : variable_set) {
     double sigma_i = 0.0;
 
     if (not var.sharing_weight)
@@ -125,19 +111,20 @@ static double dual_objective(const VarList& var_list, const CnstList& cnst_list)
 
     XBT_DEBUG("var %p : sigma_i = %1.20f", &var, sigma_i);
 
-    obj += var.func_f(var, var.func_fpi(var, sigma_i)) - sigma_i * var.func_fpi(var, sigma_i);
+    obj += func_f(var, func_fpi(var, sigma_i)) - sigma_i * func_fpi(var, sigma_i);
 
     if (var.bound > 0)
       obj += var.mu * var.bound;
   }
 
-  for (Constraint const& cnst : cnst_list)
+  for (Constraint const& cnst : active_constraint_set)
     obj += cnst.lambda * cnst.bound;
 
   return obj;
 }
 
-void lagrange_solve(lmm_system_t sys)
+// solves the proportional fairness using a Lagrangian optimization with dichotomy step
+void Lagrange::lagrange_solve()
 {
   /* Lagrange Variables. */
   int max_iterations       = 100;
@@ -152,25 +139,23 @@ void lagrange_solve(lmm_system_t sys)
   XBT_DEBUG("#### Minimum error tolerated (dichotomy) : %e", dichotomy_min_error);
 
   if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
-    sys->print();
+    print();
   }
 
-  if (not sys->modified)
+  if (not modified)
     return;
 
   /* Initialize lambda. */
-  auto& cnst_list = sys->active_constraint_set;
-  for (Constraint& cnst : cnst_list) {
+  for (Constraint& cnst : active_constraint_set) {
     cnst.lambda     = 1.0;
     cnst.new_lambda = 2.0;
     XBT_DEBUG("#### cnst(%p)->lambda :  %e", &cnst, cnst.lambda);
   }
 
   /*
-   * Initialize the var_list variable with only the active variables. Initialize mu.
+   * Initialize the active variables. Initialize mu.
    */
-  auto& var_list = sys->variable_set;
-  for (Variable& var : var_list) {
+  for (Variable& var : variable_set) {
     if (not var.sharing_weight)
       var.value = 0.0;
     else {
@@ -194,7 +179,7 @@ void lagrange_solve(lmm_system_t sys)
   }
 
   /*  Compute dual objective. */
-  double obj = dual_objective(var_list, cnst_list);
+  double obj = dual_objective();
 
   /* While doesn't reach a minimum error or a number maximum of iterations. */
   int iteration = 0;
@@ -204,14 +189,14 @@ void lagrange_solve(lmm_system_t sys)
     XBT_DEBUG("-------------- Gradient Descent ----------");
 
     /* Improve the value of mu_i */
-    for (Variable& var : var_list) {
+    for (Variable& var : variable_set) {
       if (var.sharing_weight && var.bound >= 0) {
         XBT_DEBUG("Working on var (%p)", &var);
         var.new_mu = new_mu(var);
         XBT_DEBUG("Updating mu : var->mu (%p) : %1.20f -> %1.20f", &var, var.mu, var.new_mu);
         var.mu = var.new_mu;
 
-        double new_obj = dual_objective(var_list, cnst_list);
+        double new_obj = dual_objective();
         XBT_DEBUG("Improvement for Objective (%g -> %g) : %g", obj, new_obj, obj - new_obj);
         xbt_assert(obj - new_obj >= -epsilon_min_error, "Our gradient sucks! (%1.20f)", obj - new_obj);
         obj = new_obj;
@@ -219,13 +204,13 @@ void lagrange_solve(lmm_system_t sys)
     }
 
     /* Improve the value of lambda_i */
-    for (Constraint& cnst : cnst_list) {
+    for (Constraint& cnst : active_constraint_set) {
       XBT_DEBUG("Working on cnst (%p)", &cnst);
       cnst.new_lambda = dichotomy(cnst.lambda, partial_diff_lambda, cnst, dichotomy_min_error);
       XBT_DEBUG("Updating lambda : cnst->lambda (%p) : %1.20f -> %1.20f", &cnst, cnst.lambda, cnst.new_lambda);
       cnst.lambda = cnst.new_lambda;
 
-      double new_obj = dual_objective(var_list, cnst_list);
+      double new_obj = dual_objective();
       XBT_DEBUG("Improvement for Objective (%g -> %g) : %g", obj, new_obj, obj - new_obj);
       xbt_assert(obj - new_obj >= -epsilon_min_error, "Our gradient sucks! (%1.20f)", obj - new_obj);
       obj = new_obj;
@@ -234,7 +219,7 @@ void lagrange_solve(lmm_system_t sys)
     /* Now computes the values of each variable (\rho) based on the values of \lambda and \mu. */
     XBT_DEBUG("-------------- Check convergence ----------");
     overall_modification = 0;
-    for (Variable& var : var_list) {
+    for (Variable& var : variable_set) {
       if (var.sharing_weight <= 0)
         var.value = 0.0;
       else {
@@ -248,12 +233,12 @@ void lagrange_solve(lmm_system_t sys)
     }
 
     XBT_DEBUG("-------------- Check feasability ----------");
-    if (not __check_feasible(cnst_list, var_list, 0))
+    if (not check_feasible(false))
       overall_modification = 1.0;
     XBT_DEBUG("Iteration %d: overall_modification : %f", iteration, overall_modification);
   }
 
-  __check_feasible(cnst_list, var_list, 1);
+  check_feasible(true);
 
   if (overall_modification <= epsilon_min_error) {
     XBT_DEBUG("The method converges in %d iterations.", iteration);
@@ -263,7 +248,7 @@ void lagrange_solve(lmm_system_t sys)
   }
 
   if (XBT_LOG_ISENABLED(surf_lagrange, xbt_log_priority_debug)) {
-    sys->print();
+    print();
   }
 }
 
@@ -278,7 +263,8 @@ void lagrange_solve(lmm_system_t sys)
  *
  * @return a double corresponding to the result of the dichotomy process
  */
-static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst, double min_error)
+double Lagrange::dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst,
+                           double min_error)
 {
   double min = init;
   double max = init;
@@ -378,7 +364,7 @@ static double dichotomy(double init, double diff(double, const Constraint&), con
   return ((min + max) / 2.0);
 }
 
-static double partial_diff_lambda(double lambda, const Constraint& cnst)
+double Lagrange::partial_diff_lambda(double lambda, const Constraint& cnst)
 {
   double diff           = 0.0;
 
@@ -404,7 +390,7 @@ static double partial_diff_lambda(double lambda, const Constraint& cnst)
     // replace value of cnst.lambda by the value of parameter lambda
     sigma_i = (sigma_i - cnst.lambda) + lambda;
 
-    diff += -var.func_fpi(var, sigma_i);
+    diff += -func_fpi(var, sigma_i);
   }
 
   diff += cnst.bound;
@@ -418,19 +404,21 @@ static double partial_diff_lambda(double lambda, const Constraint& cnst)
  *
  *  \param func_fpi  inverse of the partial differential of f (f prime inverse, (f')^{-1})
  *
- *  Set default functions to the ones passed as parameters. This is a polymorphism in C pure, enjoy the roots of
- *  programming.
- *
+ *  Set default functions to the ones passed as parameters.
  */
-void set_default_protocol_function(double (*func_f)(const Variable& var, double x),
-                                   double (*func_fp)(const Variable& var, double x),
-                                   double (*func_fpi)(const Variable& var, double x))
+void Lagrange::set_default_protocol_function(double (*func_f)(const Variable& var, double x),
+                                             double (*func_fp)(const Variable& var, double x),
+                                             double (*func_fpi)(const Variable& var, double x))
 {
-  func_f_def   = func_f;
-  func_fp_def  = func_fp;
-  func_fpi_def = func_fpi;
+  Lagrange::func_f   = func_f;
+  Lagrange::func_fp  = func_fp;
+  Lagrange::func_fpi = func_fpi;
 }
 
+double (*Lagrange::func_f)(const Variable&, double);
+double (*Lagrange::func_fp)(const Variable&, double);
+double (*Lagrange::func_fpi)(const Variable&, double);
+
 /**************** Vegas and Reno functions *************************/
 /* NOTE for Reno: all functions consider the network coefficient (alpha) equal to 1. */
 
index b9c5b41..0b27a67 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -33,6 +33,11 @@ typedef std::vector<int> dyn_light_t;
 int Variable::Global_debug_id   = 1;
 int Constraint::Global_debug_id = 1;
 
+System* make_new_maxmin_system(bool selective_update)
+{
+  return new System(selective_update);
+}
+
 int Element::get_concurrency() const
 {
   // Ignore element with weight less than one (e.g. cross-traffic)
@@ -150,10 +155,8 @@ System::System(bool selective_update) : selective_update_active(selective_update
 
   XBT_DEBUG("Setting selective_update_active flag to %d", selective_update_active);
 
-  keep_track          = nullptr;
   variable_mallocator =
       xbt_mallocator_new(65536, System::variable_mallocator_new_f, System::variable_mallocator_free_f, nullptr);
-  solve_fun = &lmm_solve;
 }
 
 System::~System()
@@ -171,6 +174,7 @@ System::~System()
     cnst_free(cnst);
 
   xbt_mallocator_free(variable_mallocator);
+  delete modified_set_;
 }
 
 void System::cnst_free(Constraint* cnst)
@@ -412,7 +416,7 @@ static inline void saturated_constraints_update(double usage, int cnst_light_num
 }
 
 static inline void saturated_variable_set_update(ConstraintLight* cnst_light_tab,
-                                                 const dyn_light_t& saturated_constraints, lmm_system_t sys)
+                                                 const dyn_light_t& saturated_constraints, System* sys)
 {
   /* Add active variables (i.e. variables that need to be set) from the set of constraints to saturate
    * (cnst_light_tab)*/
@@ -486,7 +490,7 @@ void System::print() const
   }
 }
 
-void System::solve()
+void System::lmm_solve()
 {
   if (modified) {
     XBT_IN("(sys=%p)", this);
@@ -494,14 +498,14 @@ void System::solve()
      * constraints that changed are considered. Otherwise all constraints with active actions are considered.
      */
     if (selective_update_active)
-      solve(modified_constraint_set);
+      lmm_solve(modified_constraint_set);
     else
-      solve(active_constraint_set);
+      lmm_solve(active_constraint_set);
     XBT_OUT();
   }
 }
 
-template <class CnstList> void System::solve(CnstList& cnst_list)
+template <class CnstList> void System::lmm_solve(CnstList& cnst_list)
 {
   double min_usage = -1;
   double min_bound = -1;
@@ -536,8 +540,8 @@ template <class CnstList> void System::solve(CnstList& cnst_list)
 
         elem.make_active();
         simgrid::kernel::resource::Action* action = static_cast<simgrid::kernel::resource::Action*>(elem.variable->id);
-        if (keep_track && not action->isLinkedModifiedSet())
-          keep_track->push_back(*action);
+        if (modified_set_ && not action->is_within_modified_set())
+          modified_set_->push_back(*action);
       }
     }
     XBT_DEBUG("Constraint '%d' usage: %f remaining: %f concurrency: %i<=%i<=%i", cnst.id_int, cnst.usage,
@@ -690,11 +694,6 @@ template <class CnstList> void System::solve(CnstList& cnst_list)
   delete[] cnst_light_tab;
 }
 
-void lmm_solve(lmm_system_t sys)
-{
-  sys->solve();
-}
-
 /** \brief Attribute the value bound to var->bound.
  *
  *  \param var the Variable*
@@ -726,9 +725,6 @@ void Variable::initialize(simgrid::kernel::resource::Action* id_value, double sh
   visited           = visited_value;
   mu                = 0.0;
   new_mu            = 0.0;
-  func_f            = func_f_def;
-  func_fp           = func_fp_def;
-  func_fpi          = func_fpi_def;
 
   xbt_assert(not variable_set_hook.is_linked());
   xbt_assert(not saturated_variable_set_hook.is_linked());
@@ -817,12 +813,12 @@ void System::on_disabled_var(Constraint* cnstr)
   if (not numelem)
     return;
 
-  lmm_element_t elem = &cnstr->disabled_element_set.front();
+  Element* elem = &cnstr->disabled_element_set.front();
 
   // Cannot use foreach loop, because System::enable_var() will modify disabled_element_set.. within the loop
   while (numelem-- && elem) {
 
-    lmm_element_t nextelem;
+    Element* nextelem;
     if (elem->disabled_element_set_hook.is_linked()) {
       auto iter = std::next(cnstr->disabled_element_set.iterator_to(*elem));
       nextelem  = iter != std::end(cnstr->disabled_element_set) ? &*iter : nullptr;
index d0930c0..8c006f5 100644 (file)
@@ -6,14 +6,15 @@
 #ifndef SURF_MAXMIN_HPP
 #define SURF_MAXMIN_HPP
 
+#include "simgrid/kernel/resource/Action.hpp"
 #include "src/internal_config.h"
-#include "src/kernel/resource/Action.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "surf/surf.hpp"
 #include "xbt/asserts.h"
 #include "xbt/mallocator.h"
 #include "xbt/misc.h"
 #include "xbt/utility.hpp"
+
 #include <boost/intrusive/list.hpp>
 #include <cmath>
 #include <limits>
@@ -134,33 +135,19 @@ namespace lmm {
 
 /** @{ @ingroup SURF_lmm */
 
-/**
- * @brief Solve the lmm system
- * @param sys The lmm system to solve
- */
-XBT_PUBLIC(void) lmm_solve(lmm_system_t sys);
-
-XBT_PUBLIC(void) lagrange_solve(lmm_system_t sys);
-XBT_PUBLIC(void) bottleneck_solve(lmm_system_t sys);
-
 /** Default functions associated to the chosen protocol. When using the lagrangian approach. */
 
-XBT_PUBLIC(void)
-set_default_protocol_function(double (*func_f)(const Variable& var, double x),
-                              double (*func_fp)(const Variable& var, double x),
-                              double (*func_fpi)(const Variable& var, double x));
-
-XBT_PUBLIC(double) func_reno_f(const Variable& var, double x);
-XBT_PUBLIC(double) func_reno_fp(const Variable& var, double x);
-XBT_PUBLIC(double) func_reno_fpi(const Variable& var, double x);
+XBT_PUBLIC double func_reno_f(const Variable& var, double x);
+XBT_PUBLIC double func_reno_fp(const Variable& var, double x);
+XBT_PUBLIC double func_reno_fpi(const Variable& var, double x);
 
-XBT_PUBLIC(double) func_reno2_f(const Variable& var, double x);
-XBT_PUBLIC(double) func_reno2_fp(const Variable& var, double x);
-XBT_PUBLIC(double) func_reno2_fpi(const Variable& var, double x);
+XBT_PUBLIC double func_reno2_f(const Variable& var, double x);
+XBT_PUBLIC double func_reno2_fp(const Variable& var, double x);
+XBT_PUBLIC double func_reno2_fpi(const Variable& var, double x);
 
-XBT_PUBLIC(double) func_vegas_f(const Variable& var, double x);
-XBT_PUBLIC(double) func_vegas_fp(const Variable& var, double x);
-XBT_PUBLIC(double) func_vegas_fpi(const Variable& var, double x);
+XBT_PUBLIC double func_vegas_f(const Variable& var, double x);
+XBT_PUBLIC double func_vegas_fp(const Variable& var, double x);
+XBT_PUBLIC double func_vegas_fpi(const Variable& var, double x);
 
 /**
  * @brief LMM element
@@ -169,8 +156,7 @@ XBT_PUBLIC(double) func_vegas_fpi(const Variable& var, double x);
  * Then, it is used to list all variables involved in constraint through constraint's xxx_element_set lists, or
  * vice-versa list all constraints for a given variable.
  */
-XBT_PUBLIC_CLASS Element
-{
+class XBT_PUBLIC Element {
 public:
   int get_concurrency() const;
   void decrease_concurrency();
@@ -207,8 +193,7 @@ struct ConstraintLight {
  * \li Active elements which variable's weight is non-zero (i.e. it is enabled) AND its element value is non-zero.
  *     LMM_solve iterates over active elements during resolution, dynamically making them active or unactive.
  */
-XBT_PUBLIC_CLASS Constraint
-{
+class XBT_PUBLIC Constraint {
 public:
   Constraint() = delete;
   Constraint(void* id_value, double bound_value);
@@ -334,8 +319,7 @@ private:
  * When something prevents us from enabling a variable, we "stage" the weight that we would have like to set, so that as
  * soon as possible we enable the variable with desired weight
  */
-XBT_PUBLIC_CLASS Variable
-{
+class XBT_PUBLIC Variable {
 public:
   void initialize(simgrid::kernel::resource::Action * id_value, double sharing_weight_value, double bound_value,
                   int number_of_constraints, unsigned visited_value);
@@ -421,9 +405,6 @@ public:
   /* \begin{For Lagrange only} */
   double mu;
   double new_mu;
-  double (*func_f)(const Variable& var, double x);   /* (f)    */
-  double (*func_fp)(const Variable& var, double x);  /* (f')    */
-  double (*func_fpi)(const Variable& var, double x); /* (f')^{-1}    */
   /* \end{For Lagrange only} */
 
 private:
@@ -443,8 +424,7 @@ inline void Element::make_inactive()
 /**
  * @brief LMM system
  */
-XBT_PUBLIC_CLASS System
-{
+class XBT_PUBLIC System {
 public:
   /**
    * @brief Create a new Linear MaxMim system
@@ -452,7 +432,7 @@ public:
    */
   explicit System(bool selective_update);
   /** @brief Free an existing Linear MaxMin system */
-  ~System();
+  virtual ~System();
 
   /**
    * @brief Create a new Linear MaxMin constraint
@@ -525,7 +505,10 @@ public:
   void print() const;
 
   /** @brief Solve the lmm system */
-  void solve();
+  void lmm_solve();
+
+  /** @brief Solve the lmm system. May be specialized in subclasses. */
+  virtual void solve() { lmm_solve(); }
 
 private:
   static void* variable_mallocator_new_f();
@@ -589,7 +572,8 @@ private:
   void remove_all_modified_set();
   void check_concurrency() const;
 
-  template <class CnstList> void solve(CnstList& cnst_list);
+  template <class CnstList> void lmm_solve(CnstList& cnst_list);
+
 public:
   bool modified;
   boost::intrusive::list<Variable, boost::intrusive::member_hook<Variable, boost::intrusive::list_member_hook<>,
@@ -605,9 +589,7 @@ public:
                                                                    &Constraint::saturated_constraint_set_hook>>
       saturated_constraint_set;
 
-  simgrid::kernel::resource::ActionLmmListPtr keep_track;
-
-  void (*solve_fun)(lmm_system_t self);
+  simgrid::kernel::resource::Action::ModifiedSet* modified_set_ = nullptr;
 
 private:
   bool selective_update_active; /* flag to update partially the system only selecting changed portions */
@@ -622,9 +604,50 @@ private:
   xbt_mallocator_t variable_mallocator;
 };
 
-extern XBT_PRIVATE double (*func_f_def)(const Variable&, double);
-extern XBT_PRIVATE double (*func_fp_def)(const Variable&, double);
-extern XBT_PRIVATE double (*func_fpi_def)(const Variable&, double);
+class XBT_PUBLIC FairBottleneck : public System {
+public:
+  explicit FairBottleneck(bool selective_update) : System(selective_update) {}
+  void solve() final { bottleneck_solve(); }
+
+private:
+  void bottleneck_solve();
+};
+
+class XBT_PUBLIC Lagrange : public System {
+public:
+  explicit Lagrange(bool selective_update) : System(selective_update) {}
+  void solve() final { lagrange_solve(); }
+
+  static void set_default_protocol_function(double (*func_f)(const Variable& var, double x),
+                                            double (*func_fp)(const Variable& var, double x),
+                                            double (*func_fpi)(const Variable& var, double x));
+
+private:
+  void lagrange_solve();
+
+  bool check_feasible(bool warn);
+  double dual_objective();
+
+  static double (*func_f)(const Variable& var, double x);   /* (f)    */
+  static double (*func_fp)(const Variable& var, double x);  /* (f')    */
+  static double (*func_fpi)(const Variable& var, double x); /* (f')^{-1}    */
+
+  /*
+   * Local prototypes to implement the Lagrangian optimization with optimal step, also called dichotomy.
+   */
+  // computes the value of the dichotomy using a initial values, init, with a specific variable or constraint
+  static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst,
+                          double min_error);
+  // computes the value of the differential of constraint cnst applied to lambda
+  static double partial_diff_lambda(double lambda, const Constraint& cnst);
+
+  static double new_value(const Variable& var);
+  static double new_mu(const Variable& var);
+};
+
+XBT_PUBLIC System* make_new_maxmin_system(bool selective_update);
+XBT_PUBLIC System* make_new_fair_bottleneck_system(bool selective_update);
+XBT_PUBLIC System* make_new_lagrange_system(bool selective_update);
 
 /** @} */
 }
index fac7b4a..9e64d25 100644 (file)
@@ -3,9 +3,10 @@
 /* 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 "src/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Model.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/resource/Model.hpp"
+#include "src/surf/surf_interface.hpp"
 
 XBT_LOG_NEW_CATEGORY(kernel, "Logging specific to the internals of SimGrid");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(resource, kernel, "Logging specific to the resources");
@@ -19,81 +20,93 @@ Action::Action(simgrid::kernel::resource::Model* model, double cost, bool failed
 }
 
 Action::Action(simgrid::kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
-    : remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
+    : remains_(cost), start_time_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
 {
   if (failed)
-    stateSet_ = getModel()->getFailedActionSet();
+    state_set_ = get_model()->get_failed_action_set();
   else
-    stateSet_ = getModel()->getRunningActionSet();
+    state_set_ = get_model()->get_running_action_set();
 
-  stateSet_->push_back(*this);
+  state_set_->push_back(*this);
 }
 
 Action::~Action()
 {
+  if (state_set_hook_.is_linked())
+    simgrid::xbt::intrusive_erase(*state_set_, *this);
+  if (get_variable())
+    get_model()->get_maxmin_system()->variable_free(get_variable());
+  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy) {
+    /* remove from heap */
+    heapRemove();
+    if (modified_set_hook_.is_linked())
+      simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
+  }
+
   xbt_free(category_);
 }
 
 void Action::finish(Action::State state)
 {
-  finishTime_ = surf_get_clock();
-  setState(state);
+  finish_time_ = surf_get_clock();
+  set_state(state);
+  set_remains(0);
 }
 
-Action::State Action::getState() const
+Action::State Action::get_state() const
 {
-  if (stateSet_ == model_->getReadyActionSet())
+  if (state_set_ == model_->get_ready_action_set())
     return Action::State::ready;
-  if (stateSet_ == model_->getRunningActionSet())
+  if (state_set_ == model_->get_running_action_set())
     return Action::State::running;
-  if (stateSet_ == model_->getFailedActionSet())
+  if (state_set_ == model_->get_failed_action_set())
     return Action::State::failed;
-  if (stateSet_ == model_->getDoneActionSet())
+  if (state_set_ == model_->get_done_action_set())
     return Action::State::done;
   return Action::State::not_in_the_system;
 }
 
-void Action::setState(Action::State state)
+void Action::set_state(Action::State state)
 {
-  simgrid::xbt::intrusive_erase(*stateSet_, *this);
+  simgrid::xbt::intrusive_erase(*state_set_, *this);
   switch (state) {
     case Action::State::ready:
-      stateSet_ = model_->getReadyActionSet();
+      state_set_ = model_->get_ready_action_set();
       break;
     case Action::State::running:
-      stateSet_ = model_->getRunningActionSet();
+      state_set_ = model_->get_running_action_set();
       break;
     case Action::State::failed:
-      stateSet_ = model_->getFailedActionSet();
+      state_set_ = model_->get_failed_action_set();
       break;
     case Action::State::done:
-      stateSet_ = model_->getDoneActionSet();
+      state_set_ = model_->get_done_action_set();
       break;
     default:
-      stateSet_ = nullptr;
+      state_set_ = nullptr;
       break;
   }
-  if (stateSet_)
-    stateSet_->push_back(*this);
+  if (state_set_)
+    state_set_->push_back(*this);
 }
 
-double Action::getBound() const
+double Action::get_bound() const
 {
   return variable_ ? variable_->get_bound() : 0;
 }
 
-void Action::setBound(double bound)
+void Action::set_bound(double bound)
 {
   XBT_IN("(%p,%g)", this, bound);
   if (variable_)
-    getModel()->getMaxminSystem()->update_variable_bound(variable_, bound);
+    get_model()->get_maxmin_system()->update_variable_bound(variable_, bound);
 
-  if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate() != surf_get_clock())
-    heapRemove(getModel()->getActionHeap());
+  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy && get_last_update() != surf_get_clock())
+    heapRemove();
   XBT_OUT();
 }
 
-void Action::setCategory(const char* category)
+void Action::set_category(const char* category)
 {
   category_ = xbt_strdup(category);
 }
@@ -103,31 +116,31 @@ void Action::ref()
   refcount_++;
 }
 
-void Action::setMaxDuration(double duration)
+void Action::set_max_duration(double duration)
 {
-  maxDuration_ = duration;
-  if (getModel()->getUpdateMechanism() == UM_LAZY) // remove action from the heap
-    heapRemove(getModel()->getActionHeap());
+  max_duration_ = duration;
+  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy) // remove action from the heap
+    heapRemove();
 }
 
-void Action::setSharingWeight(double weight)
+void Action::set_priority(double weight)
 {
   XBT_IN("(%p,%g)", this, weight);
-  sharingWeight_ = weight;
-  getModel()->getMaxminSystem()->update_variable_weight(getVariable(), weight);
+  sharing_priority_ = weight;
+  get_model()->get_maxmin_system()->update_variable_weight(get_variable(), weight);
 
-  if (getModel()->getUpdateMechanism() == UM_LAZY)
-    heapRemove(getModel()->getActionHeap());
+  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy)
+    heapRemove();
   XBT_OUT();
 }
 
 void Action::cancel()
 {
-  setState(Action::State::failed);
-  if (getModel()->getUpdateMechanism() == UM_LAZY) {
-    if (modifiedSetHook_.is_linked())
-      simgrid::xbt::intrusive_erase(*getModel()->getModifiedSet(), *this);
-    heapRemove(getModel()->getActionHeap());
+  set_state(Action::State::failed);
+  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy) {
+    if (modified_set_hook_.is_linked())
+      simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
+    heapRemove();
   }
 }
 
@@ -135,16 +148,6 @@ int Action::unref()
 {
   refcount_--;
   if (not refcount_) {
-    if (stateSetHook_.is_linked())
-      simgrid::xbt::intrusive_erase(*stateSet_, *this);
-    if (getVariable())
-      getModel()->getMaxminSystem()->variable_free(getVariable());
-    if (getModel()->getUpdateMechanism() == UM_LAZY) {
-      /* remove from heap */
-      heapRemove(getModel()->getActionHeap());
-      if (modifiedSetHook_.is_linked())
-        simgrid::xbt::intrusive_erase(*getModel()->getModifiedSet(), *this);
-    }
     delete this;
     return 1;
   }
@@ -155,13 +158,12 @@ void Action::suspend()
 {
   XBT_IN("(%p)", this);
   if (suspended_ != SuspendStates::sleeping) {
-    getModel()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
-    if (getModel()->getUpdateMechanism() == UM_LAZY) {
-      heapRemove(getModel()->getActionHeap());
-      if (getModel()->getUpdateMechanism() == UM_LAZY && stateSet_ == getModel()->getRunningActionSet() &&
-          sharingWeight_ > 0) {
+    get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
+    if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy) {
+      heapRemove();
+      if (state_set_ == get_model()->get_running_action_set() && sharing_priority_ > 0) {
         // If we have a lazy model, we need to update the remaining value accordingly
-        updateRemainingLazy(surf_get_clock());
+        update_remains_lazy(surf_get_clock());
       }
     }
     suspended_ = SuspendStates::suspended;
@@ -173,15 +175,15 @@ void Action::resume()
 {
   XBT_IN("(%p)", this);
   if (suspended_ != SuspendStates::sleeping) {
-    getModel()->getMaxminSystem()->update_variable_weight(getVariable(), getPriority());
+    get_model()->get_maxmin_system()->update_variable_weight(get_variable(), get_priority());
     suspended_ = SuspendStates::not_suspended;
-    if (getModel()->getUpdateMechanism() == UM_LAZY)
-      heapRemove(getModel()->getActionHeap());
+    if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy)
+      heapRemove();
   }
   XBT_OUT();
 }
 
-bool Action::isSuspended()
+bool Action::is_suspended()
 {
   return suspended_ == SuspendStates::suspended;
 }
@@ -192,41 +194,55 @@ bool Action::isSuspended()
  * LATENCY = this is a heap entry to warn us when the latency is payed
  * MAX_DURATION =this is a heap entry to warn us when the max_duration limit is reached
  */
-void Action::heapInsert(heap_type& heap, double key, Action::Type hat)
+void Action::heapInsert(double key, Action::Type hat)
 {
   type_       = hat;
-  heapHandle_ = heap.emplace(std::make_pair(key, this));
+  heap_hook_  = get_model()->getActionHeap().emplace(std::make_pair(key, this));
 }
 
-void Action::heapRemove(heap_type& heap)
+void Action::heapRemove()
 {
   type_ = Action::Type::NOTSET;
-  if (heapHandle_) {
-    heap.erase(*heapHandle_);
+  if (heap_hook_) {
+    get_model()->getActionHeap().erase(*heap_hook_);
     clearHeapHandle();
   }
 }
 
-void Action::heapUpdate(heap_type& heap, double key, Action::Type hat)
+void Action::heapUpdate(double key, Action::Type hat)
 {
   type_ = hat;
-  if (heapHandle_) {
-    heap.update(*heapHandle_, std::make_pair(key, this));
+  if (heap_hook_) {
+    get_model()->getActionHeap().update(*heap_hook_, std::make_pair(key, this));
   } else {
-    heapHandle_ = heap.emplace(std::make_pair(key, this));
+    heap_hook_ = get_model()->getActionHeap().emplace(std::make_pair(key, this));
   }
 }
 
-double Action::getRemains()
+double Action::get_remains()
 {
   XBT_IN("(%p)", this);
   /* update remains before return it */
-  if (getModel()->getUpdateMechanism() == UM_LAZY) /* update remains before return it */
-    updateRemainingLazy(surf_get_clock());
+  if (get_model()->getUpdateMechanism() == Model::UpdateAlgo::Lazy) /* update remains before return it */
+    update_remains_lazy(surf_get_clock());
   XBT_OUT();
   return remains_;
 }
 
+void Action::update_max_duration(double delta)
+{
+  double_update(&max_duration_, delta, sg_surf_precision);
+}
+void Action::update_remains(double delta)
+{
+  double_update(&remains_, delta, sg_maxmin_precision * sg_surf_precision);
+}
+
+void Action::set_last_update()
+{
+  last_update_ = surf_get_clock();
+}
+
 } // namespace surf
 } // namespace simgrid
 } // namespace simgrid
index 5d518ef..5e73044 100644 (file)
@@ -3,7 +3,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 "src/kernel/resource/Model.hpp"
+#include "simgrid/kernel/resource/Model.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(resource);
@@ -12,94 +12,88 @@ namespace simgrid {
 namespace kernel {
 namespace resource {
 
-Model::Model() : maxminSystem_(nullptr)
-{
-  readyActionSet_   = new ActionList();
-  runningActionSet_ = new ActionList();
-  failedActionSet_  = new ActionList();
-  doneActionSet_    = new ActionList();
-
-  modifiedSet_     = nullptr;
-  updateMechanism_ = UM_UNDEFINED;
-  selectiveUpdate_ = 0;
-}
+Model::Model() = default;
 
 Model::~Model()
 {
-  delete readyActionSet_;
-  delete runningActionSet_;
-  delete failedActionSet_;
-  delete doneActionSet_;
-  delete modifiedSet_;
-  delete maxminSystem_;
+  delete ready_action_set_;
+  delete running_action_set_;
+  delete failed_action_set_;
+  delete done_action_set_;
+  delete maxmin_system_;
 }
 
 Action* Model::actionHeapPop()
 {
-  Action* action = actionHeap_.top().second;
-  actionHeap_.pop();
+  Action* action = action_heap_.top().second;
+  action_heap_.pop();
   action->clearHeapHandle();
   return action;
 }
 
-double Model::nextOccuringEvent(double now)
+Action::ModifiedSet* Model::get_modified_set() const
+{
+  return maxmin_system_->modified_set_;
+}
+
+double Model::next_occuring_event(double now)
 {
   // FIXME: set the good function once and for all
-  if (updateMechanism_ == UM_LAZY)
-    return nextOccuringEventLazy(now);
-  else if (updateMechanism_ == UM_FULL)
-    return nextOccuringEventFull(now);
+  if (update_mechanism_ == Model::UpdateAlgo::Lazy)
+    return next_occuring_event_lazy(now);
+  else if (update_mechanism_ == Model::UpdateAlgo::Full)
+    return next_occuring_event_full(now);
   else
     xbt_die("Invalid cpu update mechanism!");
 }
 
-double Model::nextOccuringEventLazy(double now)
+double Model::next_occuring_event_lazy(double now)
 {
-  XBT_DEBUG("Before share resources, the size of modified actions set is %zu", modifiedSet_->size());
-  lmm_solve(maxminSystem_);
-  XBT_DEBUG("After share resources, The size of modified actions set is %zu", modifiedSet_->size());
+  XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxmin_system_->modified_set_->size());
+  maxmin_system_->lmm_solve();
+  XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxmin_system_->modified_set_->size());
 
-  while (not modifiedSet_->empty()) {
-    Action* action = &(modifiedSet_->front());
-    modifiedSet_->pop_front();
-    bool max_dur_flag = false;
+  while (not maxmin_system_->modified_set_->empty()) {
+    Action* action = &(maxmin_system_->modified_set_->front());
+    maxmin_system_->modified_set_->pop_front();
+    bool max_duration_flag = false;
 
-    if (action->getStateSet() != runningActionSet_)
+    if (action->get_state_set() != running_action_set_)
       continue;
 
     /* bogus priority, skip it */
-    if (action->getPriority() <= 0 || action->getType() == Action::Type::LATENCY)
+    if (action->get_priority() <= 0 || action->get_type() == Action::Type::LATENCY)
       continue;
 
-    action->updateRemainingLazy(now);
+    action->update_remains_lazy(now);
 
     double min   = -1;
-    double share = action->getVariable()->get_value();
+    double share = action->get_variable()->get_value();
 
     if (share > 0) {
       double time_to_completion;
-      if (action->getRemains() > 0) {
-        time_to_completion = action->getRemainsNoUpdate() / share;
+      if (action->get_remains() > 0) {
+        time_to_completion = action->get_remains_no_update() / share;
       } else {
         time_to_completion = 0.0;
       }
       min = now + time_to_completion; // when the task will complete if nothing changes
     }
 
-    if ((action->getMaxDuration() > NO_MAX_DURATION) &&
-        (min <= -1 || action->getStartTime() + action->getMaxDuration() < min)) {
+    if ((action->get_max_duration() > NO_MAX_DURATION) &&
+        (min <= -1 || action->get_start_time() + action->get_max_duration() < min)) {
       // when the task will complete anyway because of the deadline if any
-      min          = action->getStartTime() + action->getMaxDuration();
-      max_dur_flag = true;
+      min          = action->get_start_time() + action->get_max_duration();
+      max_duration_flag = true;
     }
 
-    XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->getVariable()->id_int);
+    XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->get_variable()->id_int);
 
     XBT_DEBUG("Action(%p) Start %f. May finish at %f (got a share of %f). Max_duration %f", action,
-              action->getStartTime(), min, share, action->getMaxDuration());
+              action->get_start_time(), min, share, action->get_max_duration());
 
     if (min > -1) {
-      action->heapUpdate(actionHeap_, min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
+      action->heapUpdate(min, max_duration_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
       XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min, now);
     } else
       DIE_IMPOSSIBLE;
@@ -116,17 +110,17 @@ double Model::nextOccuringEventLazy(double now)
   }
 }
 
-double Model::nextOccuringEventFull(double /*now*/)
+double Model::next_occuring_event_full(double /*now*/)
 {
-  maxminSystem_->solve_fun(maxminSystem_);
+  maxmin_system_->solve();
 
   double min = -1;
 
-  for (Action& action : *getRunningActionSet()) {
-    double value = action.getVariable()->get_value();
+  for (Action& action : *get_running_action_set()) {
+    double value = action.get_variable()->get_value();
     if (value > 0) {
-      if (action.getRemains() > 0)
-        value = action.getRemainsNoUpdate() / value;
+      if (action.get_remains() > 0)
+        value = action.get_remains_no_update() / value;
       else
         value = 0.0;
       if (min < 0 || value < min) {
@@ -134,8 +128,8 @@ double Model::nextOccuringEventFull(double /*now*/)
         XBT_DEBUG("Updating min (value) with %p: %f", &action, min);
       }
     }
-    if ((action.getMaxDuration() >= 0) && (min < 0 || action.getMaxDuration() < min)) {
-      min = action.getMaxDuration();
+    if ((action.get_max_duration() >= 0) && (min < 0 || action.get_max_duration() < min)) {
+      min = action.get_max_duration();
       XBT_DEBUG("Updating min (duration) with %p: %f", &action, min);
     }
   }
@@ -144,22 +138,22 @@ double Model::nextOccuringEventFull(double /*now*/)
   return min;
 }
 
-void Model::updateActionsState(double now, double delta)
+void Model::update_actions_state(double now, double delta)
 {
-  if (updateMechanism_ == UM_FULL)
-    updateActionsStateFull(now, delta);
-  else if (updateMechanism_ == UM_LAZY)
-    updateActionsStateLazy(now, delta);
+  if (update_mechanism_ == Model::UpdateAlgo::Full)
+    update_actions_state_full(now, delta);
+  else if (update_mechanism_ == Model::UpdateAlgo::Lazy)
+    update_actions_state_lazy(now, delta);
   else
     xbt_die("Invalid cpu update mechanism!");
 }
 
-void Model::updateActionsStateLazy(double /*now*/, double /*delta*/)
+void Model::update_actions_state_lazy(double /*now*/, double /*delta*/)
 {
   THROW_UNIMPLEMENTED;
 }
 
-void Model::updateActionsStateFull(double /*now*/, double /*delta*/)
+void Model::update_actions_state_full(double /*now*/, double /*delta*/)
 {
   THROW_UNIMPLEMENTED;
 }
diff --git a/src/kernel/resource/Model.hpp b/src/kernel/resource/Model.hpp
deleted file mode 100644 (file)
index e947ad3..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2004-2018. 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. */
-
-#ifndef SIMGRID_KERNEL_RESOURCE_MODEL_HPP
-#define SIMGRID_KERNEL_RESOURCE_MODEL_HPP
-
-#include "src/kernel/resource/Action.hpp"
-
-namespace simgrid {
-namespace kernel {
-namespace resource {
-
-/** @ingroup SURF_interface
- * @brief SURF model interface class
- * @details A model is an object which handle the interactions between its Resources and its Actions
- */
-XBT_PUBLIC_CLASS Model
-{
-public:
-  Model();
-  virtual ~Model();
-
-  /** @brief Get the set of [actions](@ref Action) in *ready* state */
-  virtual ActionList* getReadyActionSet() const { return readyActionSet_; }
-
-  /** @brief Get the set of [actions](@ref Action) in *running* state */
-  virtual ActionList* getRunningActionSet() const { return runningActionSet_; }
-
-  /** @brief Get the set of [actions](@ref Action) in *failed* state */
-  virtual ActionList* getFailedActionSet() const { return failedActionSet_; }
-
-  /** @brief Get the set of [actions](@ref Action) in *done* state */
-  virtual ActionList* getDoneActionSet() const { return doneActionSet_; }
-
-  /** @brief Get the set of modified [actions](@ref Action) */
-  virtual ActionLmmListPtr getModifiedSet() const { return modifiedSet_; }
-
-  /** @brief Get the maxmin system of the current Model */
-  lmm_system_t getMaxminSystem() const { return maxminSystem_; }
-
-  /**
-   * @brief Get the update mechanism of the current Model
-   * @see e_UM_t
-   */
-  e_UM_t getUpdateMechanism() const { return updateMechanism_; }
-  void setUpdateMechanism(e_UM_t mechanism) { updateMechanism_ = mechanism; }
-
-  /** @brief Get Action heap */
-  heap_type& getActionHeap() { return actionHeap_; }
-
-  double actionHeapTopDate() const { return actionHeap_.top().first; }
-  Action* actionHeapPop();
-  bool actionHeapIsEmpty() const { return actionHeap_.empty(); }
-
-  /**
-   * @brief Share the resources between the actions
-   *
-   * @param now The current time of the simulation
-   * @return The delta of time till the next action will finish
-   */
-  virtual double nextOccuringEvent(double now);
-  virtual double nextOccuringEventLazy(double now);
-  virtual double nextOccuringEventFull(double now);
-
-  /**
-   * @brief Update action to the current time
-   *
-   * @param now The current time of the simulation
-   * @param delta The delta of time since the last update
-   */
-  virtual void updateActionsState(double now, double delta);
-  virtual void updateActionsStateLazy(double now, double delta);
-  virtual void updateActionsStateFull(double now, double delta);
-
-  /** @brief Returns whether this model have an idempotent shareResource()
-   *
-   * The only model that is not is NS3: computing the next timestamp moves the model up to that point,
-   * so we need to call it only when the next timestamp of other sources is computed.
-   */
-  virtual bool nextOccuringEventIsIdempotent() { return true; }
-
-protected:
-  ActionLmmListPtr modifiedSet_;
-  lmm_system_t maxminSystem_ = nullptr;
-  bool selectiveUpdate_;
-
-private:
-  e_UM_t updateMechanism_ = UM_UNDEFINED;
-  ActionList* readyActionSet_;   /**< Actions in state SURF_ACTION_READY */
-  ActionList* runningActionSet_; /**< Actions in state SURF_ACTION_RUNNING */
-  ActionList* failedActionSet_;  /**< Actions in state SURF_ACTION_FAILED */
-  ActionList* doneActionSet_;    /**< Actions in state SURF_ACTION_DONE */
-  heap_type actionHeap_;
-};
-
-} // namespace surf
-} // namespace simgrid
-} // namespace simgrid
-#endif
index ff87ae8..427a6b1 100644 (file)
@@ -3,7 +3,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 "src/kernel/resource/Resource.hpp"
+#include "simgrid/kernel/resource/Resource.hpp"
 #include "src/kernel/lmm/maxmin.hpp" // Constraint
 #include "src/surf/surf_interface.hpp"
 
@@ -20,21 +20,21 @@ Resource::~Resource() = default;
 
 bool Resource::isOn() const
 {
-  return isOn_;
+  return is_on_;
 }
 bool Resource::isOff() const
 {
-  return not isOn_;
+  return not is_on_;
 }
 
 void Resource::turnOn()
 {
-  isOn_ = true;
+  is_on_ = true;
 }
 
 void Resource::turnOff()
 {
-  isOn_ = false;
+  is_on_ = false;
 }
 
 double Resource::getLoad()
index 33e0863..d5da906 100644 (file)
@@ -1,12 +1,13 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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 "src/kernel/routing/ClusterZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/RoutedZone.hpp"
+#include "simgrid/kernel/routing/ClusterZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp" // FIXME: RouteCreationArgs and friends
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
 
@@ -23,13 +24,13 @@ ClusterZone::ClusterZone(NetZone* father, std::string name) : NetZoneImpl(father
 void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
 {
   XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
-  xbt_assert(not privateLinks_.empty(),
+  xbt_assert(not private_links_.empty(),
              "Cluster routing: no links attached to the source node - did you use host_link tag?");
 
-  if ((src->id() == dst->id()) && hasLoopback_) {
+  if ((src->id() == dst->id()) && has_loopback_) {
     xbt_assert(not src->isRouter(), "Routing from a cluster private router to itself is meaningless");
 
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePosition(src->id()));
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
     route->link_list.push_back(info.first);
     if (lat)
       *lat += info.first->latency();
@@ -37,12 +38,12 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   }
 
   if (not src->isRouter()) { // No private link for the private router
-    if (hasLimiter_) { // limiter for sender
-      std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLoopback(src->id()));
+    if (has_limiter_) {      // limiter for sender
+      std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
       route->link_list.push_back(info.first);
     }
 
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLimiter(src->id()));
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(src->id()));
     if (info.first) { // link up
       route->link_list.push_back(info.first);
       if (lat)
@@ -58,14 +59,14 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
 
   if (not dst->isRouter()) { // No specific link for router
 
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLimiter(dst->id()));
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(dst->id()));
     if (info.second) { // link down
       route->link_list.push_back(info.second);
       if (lat)
         *lat += info.second->latency();
     }
-    if (hasLimiter_) { // limiter for receiver
-      info = privateLinks_.at(nodePositionWithLoopback(dst->id()));
+    if (has_limiter_) { // limiter for receiver
+      info = private_links_.at(nodePositionWithLoopback(dst->id()));
       route->link_list.push_back(info.first);
     }
   }
@@ -90,7 +91,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, std::map<std::string, xbt_node_t>*
     if (not src->isRouter()) {
       xbt_node_t previous = new_xbt_graph_node(graph, src->getCname(), nodes);
 
-      std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
+      std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id());
 
       if (info.first) { // link up
         xbt_node_t current = new_xbt_graph_node(graph, info.first->getCname(), nodes);
@@ -137,7 +138,7 @@ void ClusterZone::create_links_for_node(ClusterCreationArgs* cluster, int id, in
     linkUp   = surf::LinkImpl::byName(link_id);
     linkDown = linkUp;
   }
-  privateLinks_.insert({position, {linkUp, linkDown}});
+  private_links_.insert({position, {linkUp, linkDown}});
 }
 }
 }
index 214a02f..b29e678 100644 (file)
@@ -1,11 +1,12 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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 "src/kernel/routing/DijkstraZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/DijkstraZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
 #include <cfloat>
 #include <queue>
@@ -22,7 +23,7 @@ static void graph_node_data_free(void* n)
 
 static void graph_edge_data_free(void* e)
 {
-  delete static_cast<RouteCreationArgs*>(e);
+  delete static_cast<simgrid::kernel::routing::RouteCreationArgs*>(e);
 }
 
 /* Utility functions */
@@ -36,12 +37,12 @@ void DijkstraZone::seal()
   xbt_node_t node = nullptr;
 
   /* Create the topology graph */
-  if (not routeGraph_)
-    routeGraph_ = xbt_graph_new_graph(1, nullptr);
+  if (not route_graph_)
+    route_graph_ = xbt_graph_new_graph(1, nullptr);
 
   /* Add the loopback if needed */
   if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
-    xbt_dynar_foreach (xbt_graph_get_nodes(routeGraph_), cursor, node) {
+    xbt_dynar_foreach (xbt_graph_get_nodes(route_graph_), cursor, node) {
 
       bool found = false;
       xbt_edge_t edge = nullptr;
@@ -54,15 +55,15 @@ void DijkstraZone::seal()
       }
 
       if (not found) {
-        RouteCreationArgs* e_route = new RouteCreationArgs();
+        RouteCreationArgs* e_route = new simgrid::kernel::routing::RouteCreationArgs();
         e_route->link_list.push_back(surf_network_model->loopback_);
-        xbt_graph_new_edge(routeGraph_, node, node, e_route);
+        xbt_graph_new_edge(route_graph_, node, node, e_route);
       }
     }
   }
 
   /* initialize graph indexes in nodes after graph has been built */
-  xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
+  xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
 
   xbt_dynar_foreach (nodes, cursor, node) {
     graph_node_data_t data = static_cast<graph_node_data_t>(xbt_graph_node_get_data(node));
@@ -76,21 +77,21 @@ xbt_node_t DijkstraZone::routeGraphNewNode(int id, int graph_id)
   data->id       = id;
   data->graph_id = graph_id;
 
-  xbt_node_t node                = xbt_graph_new_node(routeGraph_, data);
-  graphNodeMap_.emplace(id, node);
+  xbt_node_t node = xbt_graph_new_node(route_graph_, data);
+  graph_node_map_.emplace(id, node);
 
   return node;
 }
 
 xbt_node_t DijkstraZone::nodeMapSearch(int id)
 {
-  auto ret = graphNodeMap_.find(id);
-  return ret == graphNodeMap_.end() ? nullptr : ret->second;
+  auto ret = graph_node_map_.find(id);
+  return ret == graph_node_map_.end() ? nullptr : ret->second;
 }
 
 /* Parsing */
 
-void DijkstraZone::newRoute(int src_id, int dst_id, RouteCreationArgs* e_route)
+void DijkstraZone::newRoute(int src_id, int dst_id, simgrid::kernel::routing::RouteCreationArgs* e_route)
 {
   XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
   xbt_node_t src = nullptr;
@@ -119,7 +120,7 @@ void DijkstraZone::newRoute(int src_id, int dst_id, RouteCreationArgs* e_route)
   }
 
   /* add link as edge to graph */
-  xbt_graph_new_edge(routeGraph_, src, dst, e_route);
+  xbt_graph_new_edge(route_graph_, src, dst, e_route);
 }
 
 void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
@@ -128,7 +129,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs
   int src_id = src->id();
   int dst_id = dst->id();
 
-  xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
+  xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
 
   /* Use the graph_node id mapping set to quickly find the nodes */
   xbt_node_t src_elm = nodeMapSearch(src_id);
@@ -142,7 +143,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs
 
     xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
     xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_node_id, xbt_node_t);
-    xbt_edge_t edge     = xbt_graph_get_edge(routeGraph_, node_s_v, node_e_v);
+    xbt_edge_t edge     = xbt_graph_get_edge(route_graph_, node_s_v, node_e_v);
 
     if (edge == nullptr)
       THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
@@ -156,7 +157,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs
     }
   }
 
-  auto elm                   = routeCache_.emplace(src_id, std::vector<int>());
+  auto elm                   = route_cache_.emplace(src_id, std::vector<int>());
   std::vector<int>& pred_arr = elm.first->second;
 
   if (elm.second) { /* new element was inserted (not cached mode, or cache miss) */
@@ -212,7 +213,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs
   for (int v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
     xbt_node_t node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
     xbt_node_t node_v      = xbt_dynar_get_as(nodes, v, xbt_node_t);
-    xbt_edge_t edge        = xbt_graph_get_edge(routeGraph_, node_pred_v, node_v);
+    xbt_edge_t edge        = xbt_graph_get_edge(route_graph_, node_pred_v, node_v);
 
     if (edge == nullptr)
       THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
@@ -254,12 +255,12 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs
   }
 
   if (not cached_)
-    routeCache_.clear();
+    route_cache_.clear();
 }
 
 DijkstraZone::~DijkstraZone()
 {
-  xbt_graph_free_graph(routeGraph_, &graph_node_data_free, &graph_edge_data_free, nullptr);
+  xbt_graph_free_graph(route_graph_, &graph_node_data_free, &graph_edge_data_free, nullptr);
 }
 
 /* Creation routing model functions */
@@ -278,8 +279,8 @@ void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::Net
   addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
   /* Create the topology graph */
-  if (not routeGraph_)
-    routeGraph_ = xbt_graph_new_graph(1, nullptr);
+  if (not route_graph_)
+    route_graph_ = xbt_graph_new_graph(1, nullptr);
 
   /* we don't check whether the route already exist, because the algorithm may find another path through some other
    * nodes */
@@ -291,10 +292,10 @@ void DijkstraZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::Net
   // Symmetrical YES
   if (symmetrical == true) {
 
-    xbt_dynar_t nodes   = xbt_graph_get_nodes(routeGraph_);
+    xbt_dynar_t nodes   = xbt_graph_get_nodes(route_graph_);
     xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src->id(), xbt_node_t);
     xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst->id(), xbt_node_t);
-    xbt_edge_t edge     = xbt_graph_get_edge(routeGraph_, node_e_v, node_s_v);
+    xbt_edge_t edge     = xbt_graph_get_edge(route_graph_, node_e_v, node_s_v);
 
     if (not gw_dst || not gw_src) {
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
index 6b6f2c7..3ad8df8 100644 (file)
@@ -1,11 +1,12 @@
-/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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 "src/kernel/routing/DragonflyZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/DragonflyZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
@@ -24,7 +25,7 @@ DragonflyZone::DragonflyZone(NetZone* father, std::string name) : ClusterZone(fa
 DragonflyZone::~DragonflyZone()
 {
   if (this->routers_ != nullptr) {
-    for (unsigned int i = 0; i < this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_; i++)
+    for (unsigned int i = 0; i < this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_; i++)
       delete routers_[i];
     delete[] routers_;
   }
@@ -33,12 +34,12 @@ DragonflyZone::~DragonflyZone()
 void DragonflyZone::rankId_to_coords(int rankId, unsigned int (*coords)[4])
 {
   // coords : group, chassis, blade, node
-  (*coords)[0]         = rankId / (numChassisPerGroup_ * numBladesPerChassis_ * numNodesPerBlade_);
-  rankId               = rankId % (numChassisPerGroup_ * numBladesPerChassis_ * numNodesPerBlade_);
-  (*coords)[1]         = rankId / (numBladesPerChassis_ * numNodesPerBlade_);
-  rankId               = rankId % (numBladesPerChassis_ * numNodesPerBlade_);
-  (*coords)[2]         = rankId / numNodesPerBlade_;
-  (*coords)[3]         = rankId % numNodesPerBlade_;
+  (*coords)[0] = rankId / (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
+  rankId       = rankId % (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
+  (*coords)[1] = rankId / (num_blades_per_chassis_ * num_nodes_per_blade_);
+  rankId       = rankId % (num_blades_per_chassis_ * num_nodes_per_blade_);
+  (*coords)[2] = rankId / num_nodes_per_blade_;
+  (*coords)[3] = rankId % num_nodes_per_blade_;
 }
 
 void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
@@ -59,13 +60,13 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
 
   try {
-    this->numGroups_ = std::stoi(tmp[0]);
+    this->num_groups_ = std::stoi(tmp[0]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
   }
 
   try {
-    this->numLinksBlue_ = std::stoi(tmp[1]);
+    this->num_links_blue_ = std::stoi(tmp[1]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid number of links for the blue level:") + tmp[1]);
   }
@@ -76,13 +77,13 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
 
   try {
-    this->numChassisPerGroup_ = std::stoi(tmp[0]);
+    this->num_chassis_per_group_ = std::stoi(tmp[0]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
   }
 
   try {
-    this->numLinksBlack_ = std::stoi(tmp[1]);
+    this->num_links_black_ = std::stoi(tmp[1]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid number of links for the black level:") + tmp[1]);
   }
@@ -94,26 +95,26 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
 
   try {
-    this->numBladesPerChassis_ = std::stoi(tmp[0]);
+    this->num_blades_per_chassis_ = std::stoi(tmp[0]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
   }
 
   try {
-    this->numLinksGreen_ = std::stoi(tmp[1]);
+    this->num_links_green_ = std::stoi(tmp[1]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Invalid number of links for the green level:") + tmp[1]);
   }
 
   // The last part of topo_parameters should be the number of nodes per blade
   try {
-    this->numNodesPerBlade_ = std::stoi(parameters[3]);
+    this->num_nodes_per_blade_ = std::stoi(parameters[3]);
   } catch (std::invalid_argument& ia) {
     throw std::invalid_argument(std::string("Last parameter is not the amount of nodes per blade:") + parameters[3]);
   }
 
   if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX)
-    this->numLinksperLink_ = 2;
+    this->num_links_per_link_ = 2;
 
   this->cluster_ = cluster;
 }
@@ -121,7 +122,7 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
 /* Generate the cluster once every node is created */
 void DragonflyZone::seal()
 {
-  if (this->numNodesPerBlade_ == 0) {
+  if (this->num_nodes_per_blade_ == 0) {
     return;
   }
 
@@ -135,22 +136,23 @@ DragonflyRouter::DragonflyRouter(int group, int chassis, int blade) : group_(gro
 
 DragonflyRouter::~DragonflyRouter()
 {
-  delete[] myNodes_;
-  delete[] greenLinks_;
-  delete[] blackLinks_;
-  delete blueLinks_;
+  delete[] my_nodes_;
+  delete[] green_links_;
+  delete[] black_links_;
+  delete blue_links_;
 }
 
 void DragonflyZone::generateRouters()
 {
-  this->routers_ = new DragonflyRouter*[this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_];
+  this->routers_ =
+      new DragonflyRouter*[this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_];
 
-  for (unsigned int i = 0; i < this->numGroups_; i++) {
-    for (unsigned int j = 0; j < this->numChassisPerGroup_; j++) {
-      for (unsigned int k = 0; k < this->numBladesPerChassis_; k++) {
+  for (unsigned int i = 0; i < this->num_groups_; i++) {
+    for (unsigned int j = 0; j < this->num_chassis_per_group_; j++) {
+      for (unsigned int k = 0; k < this->num_blades_per_chassis_; k++) {
         DragonflyRouter* router = new DragonflyRouter(i, j, k);
-        this->routers_[i * this->numChassisPerGroup_ * this->numBladesPerChassis_ + j * this->numBladesPerChassis_ +
-                       k] = router;
+        this->routers_[i * this->num_chassis_per_group_ * this->num_blades_per_chassis_ +
+                       j * this->num_blades_per_chassis_ + k] = router;
       }
     }
   }
@@ -184,56 +186,56 @@ void DragonflyZone::generateLinks()
   surf::LinkImpl* linkup;
   surf::LinkImpl* linkdown;
 
-  unsigned int numRouters = this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_;
+  unsigned int numRouters = this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_;
 
   // Links from routers to their local nodes.
   for (unsigned int i = 0; i < numRouters; i++) {
     // allocate structures
-    this->routers_[i]->myNodes_    = new surf::LinkImpl*[numLinksperLink_ * this->numNodesPerBlade_];
-    this->routers_[i]->greenLinks_ = new surf::LinkImpl*[this->numBladesPerChassis_];
-    this->routers_[i]->blackLinks_ = new surf::LinkImpl*[this->numChassisPerGroup_];
+    this->routers_[i]->my_nodes_    = new surf::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
+    this->routers_[i]->green_links_ = new surf::LinkImpl*[this->num_blades_per_chassis_];
+    this->routers_[i]->black_links_ = new surf::LinkImpl*[this->num_chassis_per_group_];
 
-    for (unsigned int j = 0; j < numLinksperLink_ * this->numNodesPerBlade_; j += numLinksperLink_) {
-      std::string id = "local_link_from_router_"+ std::to_string(i) + "_to_node_" +
-          std::to_string(j / numLinksperLink_) + "_" + std::to_string(uniqueId);
+    for (unsigned int j = 0; j < num_links_per_link_ * this->num_nodes_per_blade_; j += num_links_per_link_) {
+      std::string id = "local_link_from_router_" + std::to_string(i) + "_to_node_" +
+                       std::to_string(j / num_links_per_link_) + "_" + std::to_string(uniqueId);
       this->createLink(id, 1, &linkup, &linkdown);
 
-      this->routers_[i]->myNodes_[j] = linkup;
+      this->routers_[i]->my_nodes_[j] = linkup;
       if (this->cluster_->sharing_policy == SURF_LINK_SPLITDUPLEX)
-        this->routers_[i]->myNodes_[j + 1] = linkdown;
+        this->routers_[i]->my_nodes_[j + 1] = linkdown;
 
       uniqueId++;
     }
   }
 
   // Green links from routers to same chassis routers - alltoall
-  for (unsigned int i = 0; i < this->numGroups_ * this->numChassisPerGroup_; i++) {
-    for (unsigned int j = 0; j < this->numBladesPerChassis_; j++) {
-      for (unsigned int k = j + 1; k < this->numBladesPerChassis_; k++) {
-        std::string id = "green_link_in_chassis_" + std::to_string(i % numChassisPerGroup_) +"_between_routers_" +
-            std::to_string(j) + "_and_" + std::to_string(k) + "_" + std::to_string(uniqueId);
-        this->createLink(id, this->numLinksGreen_, &linkup, &linkdown);
-
-        this->routers_[i * numBladesPerChassis_ + j]->greenLinks_[k] = linkup;
-        this->routers_[i * numBladesPerChassis_ + k]->greenLinks_[j] = linkdown;
+  for (unsigned int i = 0; i < this->num_groups_ * this->num_chassis_per_group_; i++) {
+    for (unsigned int j = 0; j < this->num_blades_per_chassis_; j++) {
+      for (unsigned int k = j + 1; k < this->num_blades_per_chassis_; k++) {
+        std::string id = "green_link_in_chassis_" + std::to_string(i % num_chassis_per_group_) + "_between_routers_" +
+                         std::to_string(j) + "_and_" + std::to_string(k) + "_" + std::to_string(uniqueId);
+        this->createLink(id, this->num_links_green_, &linkup, &linkdown);
+
+        this->routers_[i * num_blades_per_chassis_ + j]->green_links_[k] = linkup;
+        this->routers_[i * num_blades_per_chassis_ + k]->green_links_[j] = linkdown;
         uniqueId++;
       }
     }
   }
 
   // Black links from routers to same group routers - alltoall
-  for (unsigned int i = 0; i < this->numGroups_; i++) {
-    for (unsigned int j = 0; j < this->numChassisPerGroup_; j++) {
-      for (unsigned int k = j + 1; k < this->numChassisPerGroup_; k++) {
-        for (unsigned int l = 0; l < this->numBladesPerChassis_; l++) {
+  for (unsigned int i = 0; i < this->num_groups_; i++) {
+    for (unsigned int j = 0; j < this->num_chassis_per_group_; j++) {
+      for (unsigned int k = j + 1; k < this->num_chassis_per_group_; k++) {
+        for (unsigned int l = 0; l < this->num_blades_per_chassis_; l++) {
           std::string id = "black_link_in_group_" + std::to_string(i) + "_between_chassis_" + std::to_string(j) +
               "_and_" + std::to_string(k) +"_blade_" + std::to_string(l) + "_" + std::to_string(uniqueId);
-          this->createLink(id, this->numLinksBlack_, &linkup, &linkdown);
+          this->createLink(id, this->num_links_black_, &linkup, &linkdown);
 
-          this->routers_[i * numBladesPerChassis_ * numChassisPerGroup_ + j * numBladesPerChassis_ + l]
-              ->blackLinks_[k] = linkup;
-          this->routers_[i * numBladesPerChassis_ * numChassisPerGroup_ + k * numBladesPerChassis_ + l]
-              ->blackLinks_[j] = linkdown;
+          this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + j * num_blades_per_chassis_ + l]
+              ->black_links_[k] = linkup;
+          this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + k * num_blades_per_chassis_ + l]
+              ->black_links_[j] = linkdown;
           uniqueId++;
         }
       }
@@ -243,18 +245,18 @@ void DragonflyZone::generateLinks()
   // Blue links between groups - Not all routers involved, only one per group is linked to others. Let's say router n of
   // each group is linked to group n.
   // FIXME: in reality blue links may be attached to several different routers
-  for (unsigned int i = 0; i < this->numGroups_; i++) {
-    for (unsigned int j = i + 1; j < this->numGroups_; j++) {
-      unsigned int routernumi                = i * numBladesPerChassis_ * numChassisPerGroup_ + j;
-      unsigned int routernumj                = j * numBladesPerChassis_ * numChassisPerGroup_ + i;
-      this->routers_[routernumi]->blueLinks_ = new surf::LinkImpl*;
-      this->routers_[routernumj]->blueLinks_ = new surf::LinkImpl*;
+  for (unsigned int i = 0; i < this->num_groups_; i++) {
+    for (unsigned int j = i + 1; j < this->num_groups_; j++) {
+      unsigned int routernumi                 = i * num_blades_per_chassis_ * num_chassis_per_group_ + j;
+      unsigned int routernumj                 = j * num_blades_per_chassis_ * num_chassis_per_group_ + i;
+      this->routers_[routernumi]->blue_links_ = new surf::LinkImpl*;
+      this->routers_[routernumj]->blue_links_ = new surf::LinkImpl*;
       std::string id = "blue_link_between_group_"+ std::to_string(i) +"_and_" + std::to_string(j) +"_routers_" +
           std::to_string(routernumi) + "_and_" + std::to_string(routernumj) + "_" + std::to_string(uniqueId);
-      this->createLink(id, this->numLinksBlue_, &linkup, &linkdown);
+      this->createLink(id, this->num_links_blue_, &linkup, &linkdown);
 
-      this->routers_[routernumi]->blueLinks_[0] = linkup;
-      this->routers_[routernumj]->blueLinks_[0] = linkdown;
+      this->routers_[routernumi]->blue_links_[0] = linkup;
+      this->routers_[routernumj]->blue_links_[0] = linkdown;
       uniqueId++;
     }
   }
@@ -270,8 +272,8 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArg
 
   XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
 
-  if ((src->id() == dst->id()) && hasLoopback_) {
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePosition(src->id()));
+  if ((src->id() == dst->id()) && has_loopback_) {
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
 
     route->link_list.push_back(info.first);
     if (latency)
@@ -287,19 +289,19 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArg
   XBT_DEBUG("dst : %u group, %u chassis, %u blade, %u node", targetCoords[0], targetCoords[1], targetCoords[2],
             targetCoords[3]);
 
-  DragonflyRouter* myRouter = routers_[myCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
-                                       myCoords[1] * numBladesPerChassis_ + myCoords[2]];
-  DragonflyRouter* targetRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
-                                           targetCoords[1] * numBladesPerChassis_ + targetCoords[2]];
+  DragonflyRouter* myRouter      = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+                                       myCoords[1] * num_blades_per_chassis_ + myCoords[2]];
+  DragonflyRouter* targetRouter  = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+                                           targetCoords[1] * num_blades_per_chassis_ + targetCoords[2]];
   DragonflyRouter* currentRouter = myRouter;
 
   // node->router local link
-  route->link_list.push_back(myRouter->myNodes_[myCoords[3] * numLinksperLink_]);
+  route->link_list.push_back(myRouter->my_nodes_[myCoords[3] * num_links_per_link_]);
   if (latency)
-    *latency += myRouter->myNodes_[myCoords[3] * numLinksperLink_]->latency();
+    *latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->latency();
 
-  if (hasLimiter_) { // limiter for sender
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLoopback(src->id()));
+  if (has_limiter_) { // limiter for sender
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
     route->link_list.push_back(info.first);
   }
 
@@ -310,53 +312,53 @@ void DragonflyZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArg
       // go to the router of our group connected to this one.
       if (currentRouter->blade_ != targetCoords[0]) {
         // go to the nth router in our chassis
-        route->link_list.push_back(currentRouter->greenLinks_[targetCoords[0]]);
+        route->link_list.push_back(currentRouter->green_links_[targetCoords[0]]);
         if (latency)
-          *latency += currentRouter->greenLinks_[targetCoords[0]]->latency();
-        currentRouter = routers_[myCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
-                                 myCoords[1] * numBladesPerChassis_ + targetCoords[0]];
+          *latency += currentRouter->green_links_[targetCoords[0]]->latency();
+        currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+                                 myCoords[1] * num_blades_per_chassis_ + targetCoords[0]];
       }
 
       if (currentRouter->chassis_ != 0) {
         // go to the first chassis of our group
-        route->link_list.push_back(currentRouter->blackLinks_[0]);
+        route->link_list.push_back(currentRouter->black_links_[0]);
         if (latency)
-          *latency += currentRouter->blackLinks_[0]->latency();
-        currentRouter = routers_[myCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) + targetCoords[0]];
+          *latency += currentRouter->black_links_[0]->latency();
+        currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[0]];
       }
 
       // go to destination group - the only optical hop
-      route->link_list.push_back(currentRouter->blueLinks_[0]);
+      route->link_list.push_back(currentRouter->blue_links_[0]);
       if (latency)
-        *latency += currentRouter->blueLinks_[0]->latency();
-      currentRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) + myCoords[0]];
+        *latency += currentRouter->blue_links_[0]->latency();
+      currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + myCoords[0]];
     }
 
     // same group, but same blade ?
     if (targetRouter->blade_ != currentRouter->blade_) {
-      route->link_list.push_back(currentRouter->greenLinks_[targetCoords[2]]);
+      route->link_list.push_back(currentRouter->green_links_[targetCoords[2]]);
       if (latency)
-        *latency += currentRouter->greenLinks_[targetCoords[2]]->latency();
-      currentRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) + targetCoords[2]];
+        *latency += currentRouter->green_links_[targetCoords[2]]->latency();
+      currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[2]];
     }
 
     // same blade, but same chassis ?
     if (targetRouter->chassis_ != currentRouter->chassis_) {
-      route->link_list.push_back(currentRouter->blackLinks_[targetCoords[1]]);
+      route->link_list.push_back(currentRouter->black_links_[targetCoords[1]]);
       if (latency)
-        *latency += currentRouter->blackLinks_[targetCoords[1]]->latency();
+        *latency += currentRouter->black_links_[targetCoords[1]]->latency();
     }
   }
 
-  if (hasLimiter_) { // limiter for receiver
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLoopback(dst->id()));
+  if (has_limiter_) { // limiter for receiver
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(dst->id()));
     route->link_list.push_back(info.first);
   }
 
   // router->node local link
-  route->link_list.push_back(targetRouter->myNodes_[targetCoords[3] * numLinksperLink_ + numLinksperLink_ - 1]);
+  route->link_list.push_back(targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]);
   if (latency)
-    *latency += targetRouter->myNodes_[targetCoords[3] * numLinksperLink_ + numLinksperLink_ - 1]->latency();
+    *latency += targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]->latency();
 }
 }
 }
index f4b386a..8615cfd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -7,7 +7,7 @@
 #include <xbt/graph.h>
 #include <xbt/log.h>
 
-#include "src/kernel/routing/EmptyZone.hpp"
+#include "simgrid/kernel/routing/EmptyZone.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
 
index e8732f1..2c59ed9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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. */
@@ -7,9 +7,11 @@
 #include <sstream>
 #include <string>
 
-#include "src/kernel/routing/FatTreeZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/FatTreeZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
+
 
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
@@ -63,13 +65,13 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
     return;
 
   /* Let's find the source and the destination in our internal structure */
-  auto searchedNode = this->computeNodes_.find(src->id());
-  xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the source %s [%u] in the fat tree",
+  auto searchedNode = this->compute_nodes_.find(src->id());
+  xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the source %s [%u] in the fat tree",
              src->getCname(), src->id());
   FatTreeNode* source = searchedNode->second;
 
-  searchedNode = this->computeNodes_.find(dst->id());
-  xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the destination %s [%u] in the fat tree",
+  searchedNode = this->compute_nodes_.find(dst->id());
+  xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the destination %s [%u] in the fat tree",
              dst->getCname(), dst->id());
   FatTreeNode* destination = searchedNode->second;
 
@@ -77,7 +79,7 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
            dst->getCname(), dst->id());
 
   /* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */
-  if (source->id == destination->id && this->hasLoopback_) {
+  if (source->id == destination->id && this->has_loopback_) {
     into->link_list.push_back(source->loopback);
     if (latency)
       *latency += source->loopback->latency();
@@ -91,18 +93,18 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
     int d = destination->position; // as in d-mod-k
 
     for (unsigned int i = 0; i < currentNode->level; i++)
-      d /= this->upperLevelNodesNumber_[i];
+      d /= this->num_parents_per_node_[i];
 
-    int k = this->upperLevelNodesNumber_[currentNode->level];
+    int k = this->num_parents_per_node_[currentNode->level];
     d     = d % k;
-    into->link_list.push_back(currentNode->parents[d]->upLink);
+    into->link_list.push_back(currentNode->parents[d]->up_link_);
 
     if (latency)
-      *latency += currentNode->parents[d]->upLink->latency();
+      *latency += currentNode->parents[d]->up_link_->latency();
 
-    if (this->hasLimiter_)
-      into->link_list.push_back(currentNode->limiterLink);
-    currentNode = currentNode->parents[d]->upNode;
+    if (this->has_limiter_)
+      into->link_list.push_back(currentNode->limiter_link_);
+    currentNode = currentNode->parents[d]->up_node_;
   }
 
   XBT_DEBUG("%d(%u,%u) is in the sub tree of %d(%u,%u).", destination->id, destination->level, destination->position,
@@ -111,13 +113,13 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   // Down part
   while (currentNode != destination) {
     for (unsigned int i = 0; i < currentNode->children.size(); i++) {
-      if (i % this->lowerLevelNodesNumber_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
-        into->link_list.push_back(currentNode->children[i]->downLink);
+      if (i % this->num_children_per_node_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
+        into->link_list.push_back(currentNode->children[i]->down_link_);
         if (latency)
-          *latency += currentNode->children[i]->downLink->latency();
-        currentNode = currentNode->children[i]->downNode;
-        if (this->hasLimiter_)
-          into->link_list.push_back(currentNode->limiterLink);
+          *latency += currentNode->children[i]->down_link_->latency();
+        currentNode = currentNode->children[i]->down_node_;
+        if (this->has_limiter_)
+          into->link_list.push_back(currentNode->limiter_link_);
         XBT_DEBUG("%d(%u,%u) is accessible through %d(%u,%u)", destination->id, destination->level,
                   destination->position, currentNode->id, currentNode->level, currentNode->position);
       }
@@ -139,9 +141,9 @@ void FatTreeZone::seal()
     std::stringstream msgBuffer;
 
     msgBuffer << "We are creating a fat tree of " << this->levels_ << " levels "
-              << "with " << this->nodesByLevel_[0] << " processing nodes";
+              << "with " << this->nodes_by_level_[0] << " processing nodes";
     for (unsigned int i = 1; i <= this->levels_; i++) {
-      msgBuffer << ", " << this->nodesByLevel_[i] << " switches at level " << i;
+      msgBuffer << ", " << this->nodes_by_level_[i] << " switches at level " << i;
     }
     XBT_DEBUG("%s", msgBuffer.str().c_str());
     msgBuffer.str("");
@@ -158,7 +160,7 @@ void FatTreeZone::seal()
   unsigned int k = 0;
   // Nodes are totally ordered, by level and then by position, in this->nodes
   for (unsigned int i = 0; i < this->levels_; i++) {
-    for (unsigned int j = 0; j < this->nodesByLevel_[i]; j++) {
+    for (unsigned int j = 0; j < this->nodes_by_level_[i]; j++) {
       this->connectNodeToParents(this->nodes_[k]);
       k++;
     }
@@ -168,7 +170,7 @@ void FatTreeZone::seal()
     std::stringstream msgBuffer;
     msgBuffer << "Links are : ";
     for (unsigned int i = 0; i < this->links_.size(); i++) {
-      msgBuffer << "(" << this->links_[i]->upNode->id << "," << this->links_[i]->downNode->id << ") ";
+      msgBuffer << "(" << this->links_[i]->up_node_->id << "," << this->links_[i]->down_node_->id << ") ";
     }
     XBT_DEBUG("%s", msgBuffer.str().c_str());
   }
@@ -181,15 +183,15 @@ int FatTreeZone::connectNodeToParents(FatTreeNode* node)
   const int level                                       = node->level;
   XBT_DEBUG("We are connecting node %d(%u,%u) to his parents.", node->id, node->level, node->position);
   currentParentNode += this->getLevelPosition(level + 1);
-  for (unsigned int i = 0; i < this->nodesByLevel_[level + 1]; i++) {
+  for (unsigned int i = 0; i < this->nodes_by_level_[level + 1]; i++) {
     if (this->areRelated(*currentParentNode, node)) {
       XBT_DEBUG("%d(%u,%u) and %d(%u,%u) are related,"
                 " with %u links between them.",
                 node->id, node->level, node->position, (*currentParentNode)->id, (*currentParentNode)->level,
-                (*currentParentNode)->position, this->lowerLevelPortsNumber_[level]);
-      for (unsigned int j = 0; j < this->lowerLevelPortsNumber_[level]; j++) {
-        this->addLink(*currentParentNode, node->label[level] + j * this->lowerLevelNodesNumber_[level], node,
-                      (*currentParentNode)->label[level] + j * this->upperLevelNodesNumber_[level]);
+                (*currentParentNode)->position, this->num_port_lower_level_[level]);
+      for (unsigned int j = 0; j < this->num_port_lower_level_[level]; j++) {
+        this->addLink(*currentParentNode, node->label[level] + j * this->num_children_per_node_[level], node,
+                      (*currentParentNode)->label[level] + j * this->num_parents_per_node_[level]);
       }
       connectionsNumber++;
     }
@@ -233,16 +235,16 @@ bool FatTreeZone::areRelated(FatTreeNode* parent, FatTreeNode* child)
 void FatTreeZone::generateSwitches()
 {
   XBT_DEBUG("Generating switches.");
-  this->nodesByLevel_.resize(this->levels_ + 1, 0);
+  this->nodes_by_level_.resize(this->levels_ + 1, 0);
 
   // Take care of the number of nodes by level
-  this->nodesByLevel_[0] = 1;
+  this->nodes_by_level_[0] = 1;
   for (unsigned int i = 0; i < this->levels_; i++)
-    this->nodesByLevel_[0] *= this->lowerLevelNodesNumber_[i];
+    this->nodes_by_level_[0] *= this->num_children_per_node_[i];
 
-  if (this->nodesByLevel_[0] != this->nodes_.size()) {
+  if (this->nodes_by_level_[0] != this->nodes_.size()) {
     surf_parse_error(std::string("The number of provided nodes does not fit with the wanted topology.") +
-                     " Please check your platform description (We need " + std::to_string(this->nodesByLevel_[0]) +
+                     " Please check your platform description (We need " + std::to_string(this->nodes_by_level_[0]) +
                      "nodes, we got " + std::to_string(this->nodes_.size()));
     return;
   }
@@ -251,23 +253,23 @@ void FatTreeZone::generateSwitches()
     int nodesInThisLevel = 1;
 
     for (unsigned int j = 0; j <= i; j++)
-      nodesInThisLevel *= this->upperLevelNodesNumber_[j];
+      nodesInThisLevel *= this->num_parents_per_node_[j];
 
     for (unsigned int j = i + 1; j < this->levels_; j++)
-      nodesInThisLevel *= this->lowerLevelNodesNumber_[j];
+      nodesInThisLevel *= this->num_children_per_node_[j];
 
-    this->nodesByLevel_[i + 1] = nodesInThisLevel;
+    this->nodes_by_level_[i + 1] = nodesInThisLevel;
   }
 
   // Create the switches
   int k = 0;
   for (unsigned int i = 0; i < this->levels_; i++) {
-    for (unsigned int j = 0; j < this->nodesByLevel_[i + 1]; j++) {
+    for (unsigned int j = 0; j < this->nodes_by_level_[i + 1]; j++) {
       FatTreeNode* newNode = new FatTreeNode(this->cluster_, --k, i + 1, j);
       XBT_DEBUG("We create the switch %d(%u,%u)", newNode->id, newNode->level, newNode->position);
-      newNode->children.resize(this->lowerLevelNodesNumber_[i] * this->lowerLevelPortsNumber_[i]);
+      newNode->children.resize(this->num_children_per_node_[i] * this->num_port_lower_level_[i]);
       if (i != this->levels_ - 1) {
-        newNode->parents.resize(this->upperLevelNodesNumber_[i + 1] * this->lowerLevelPortsNumber_[i + 1]);
+        newNode->parents.resize(this->num_parents_per_node_[i + 1] * this->num_port_lower_level_[i + 1]);
       }
       newNode->label.resize(this->levels_);
       this->nodes_.push_back(newNode);
@@ -285,10 +287,10 @@ void FatTreeZone::generateLabels()
   for (unsigned int i = 0; i <= this->levels_; i++) {
     currentLabel.assign(this->levels_, 0);
     for (unsigned int j = 0; j < this->levels_; j++) {
-      maxLabel[j] = j + 1 > i ? this->lowerLevelNodesNumber_[j] : this->upperLevelNodesNumber_[j];
+      maxLabel[j] = j + 1 > i ? this->num_children_per_node_[j] : this->num_parents_per_node_[j];
     }
 
-    for (unsigned int j = 0; j < this->nodesByLevel_[i]; j++) {
+    for (unsigned int j = 0; j < this->nodes_by_level_[i]; j++) {
 
       if (XBT_LOG_ISENABLED(surf_route_fat_tree, xbt_log_priority_debug)) {
         std::stringstream msgBuffer;
@@ -327,20 +329,20 @@ int FatTreeZone::getLevelPosition(const unsigned int level)
   int tempPosition = 0;
 
   for (unsigned int i = 0; i < level; i++)
-    tempPosition += this->nodesByLevel_[i];
+    tempPosition += this->nodes_by_level_[i];
 
   return tempPosition;
 }
 
-void FatTreeZone::addProcessingNode(int id)
+void FatTreeZone::add_processing_node(int id)
 {
   using std::make_pair;
   static int position = 0;
   FatTreeNode* newNode;
   newNode = new FatTreeNode(this->cluster_, id, 0, position++);
-  newNode->parents.resize(this->upperLevelNodesNumber_[0] * this->lowerLevelPortsNumber_[0]);
+  newNode->parents.resize(this->num_parents_per_node_[0] * this->num_port_lower_level_[0]);
   newNode->label.resize(this->levels_);
-  this->computeNodes_.insert(make_pair(id, newNode));
+  this->compute_nodes_.insert(make_pair(id, newNode));
   this->nodes_.push_back(newNode);
 }
 
@@ -382,7 +384,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
-      this->lowerLevelNodesNumber_.push_back(std::stoi(tmp[i]));
+      this->num_children_per_node_.push_back(std::stoi(tmp[i]));
     } catch (std::invalid_argument& ia) {
       throw std::invalid_argument(std::string("Invalid lower level node number:") + tmp[i]);
     }
@@ -395,7 +397,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
-      this->upperLevelNodesNumber_.push_back(std::stoi(tmp[i]));
+      this->num_parents_per_node_.push_back(std::stoi(tmp[i]));
     } catch (std::invalid_argument& ia) {
       throw std::invalid_argument(std::string("Invalid upper level node number:") + tmp[i]);
     }
@@ -408,7 +410,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
-      this->lowerLevelPortsNumber_.push_back(std::stoi(tmp[i]));
+      this->num_port_lower_level_.push_back(std::stoi(tmp[i]));
     } catch (std::invalid_argument& ia) {
       throw std::invalid_argument(std::string("Invalid lower level port number:") + tmp[i]);
     }
@@ -416,7 +418,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   this->cluster_ = cluster;
 }
 
-void FatTreeZone::generateDotFile(const std::string& filename) const
+void FatTreeZone::generate_dot_file(const std::string& filename) const
 {
   std::ofstream file;
   file.open(filename, std::ios::out | std::ios::trunc);
@@ -432,7 +434,7 @@ void FatTreeZone::generateDotFile(const std::string& filename) const
   }
 
   for (unsigned int i = 0; i < this->links_.size(); i++) {
-    file << this->links_[i]->downNode->id << " -- " << this->links_[i]->upNode->id << ";\n";
+    file << this->links_[i]->down_node_->id << " -- " << this->links_[i]->up_node_->id << ";\n";
   }
   file << "}";
   file.close();
@@ -448,7 +450,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po
     linkTemplate.policy    = SURF_LINK_SHARED;
     linkTemplate.id        = "limiter_"+std::to_string(id);
     sg_platf_new_link(&linkTemplate);
-    this->limiterLink = surf::LinkImpl::byName(linkTemplate.id);
+    this->limiter_link_ = surf::LinkImpl::byName(linkTemplate.id);
   }
   if (cluster->loopback_bw || cluster->loopback_lat) {
     linkTemplate.bandwidth = cluster->loopback_bw;
@@ -461,7 +463,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po
 }
 
 FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, FatTreeNode* upNode)
-    : upNode(upNode), downNode(downNode)
+    : up_node_(upNode), down_node_(downNode)
 {
   static int uniqueId = 0;
   LinkCreationArgs linkTemplate;
@@ -474,12 +476,12 @@ FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, Fa
 
   if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX) {
     std::string tmpID = std::string(linkTemplate.id) + "_UP";
-    this->upLink      = surf::LinkImpl::byName(tmpID); // check link?
+    this->up_link_    = surf::LinkImpl::byName(tmpID); // check link?
     tmpID          = std::string(linkTemplate.id) + "_DOWN";
-    this->downLink    = surf::LinkImpl::byName(tmpID); // check link ?
+    this->down_link_  = surf::LinkImpl::byName(tmpID); // check link ?
   } else {
-    this->upLink   = surf::LinkImpl::byName(linkTemplate.id);
-    this->downLink = this->upLink;
+    this->up_link_   = surf::LinkImpl::byName(linkTemplate.id);
+    this->down_link_ = this->up_link_;
   }
   uniqueId++;
 }
index 3095394..20c340d 100644 (file)
@@ -1,21 +1,22 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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 "src/kernel/routing/FloydZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/FloydZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 #include "xbt/log.h"
+#include "src/surf/xml/platf_private.hpp"
 
 #include <cfloat>
 #include <limits>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_floyd, surf, "Routing part of surf");
 
-#define TO_FLOYD_COST(i, j) (costTable_)[(i) + (j)*table_size]
-#define TO_FLOYD_PRED(i, j) (predecessorTable_)[(i) + (j)*table_size]
-#define TO_FLOYD_LINK(i, j) (linkTable_)[(i) + (j)*table_size]
+#define TO_FLOYD_COST(i, j) (cost_table_)[(i) + (j)*table_size]
+#define TO_FLOYD_PRED(i, j) (predecessor_table_)[(i) + (j)*table_size]
+#define TO_FLOYD_LINK(i, j) (link_table_)[(i) + (j)*table_size]
 
 namespace simgrid {
 namespace kernel {
@@ -23,24 +24,24 @@ namespace routing {
 
 FloydZone::FloydZone(NetZone* father, std::string name) : RoutedZone(father, name)
 {
-  predecessorTable_ = nullptr;
-  costTable_        = nullptr;
-  linkTable_        = nullptr;
+  predecessor_table_ = nullptr;
+  cost_table_        = nullptr;
+  link_table_        = nullptr;
 }
 
 FloydZone::~FloydZone()
 {
-  if (linkTable_ == nullptr) // Dealing with a parse error in the file?
+  if (link_table_ == nullptr) // Dealing with a parse error in the file?
     return;
   unsigned int table_size = getTableSize();
   /* Delete link_table */
   for (unsigned int i = 0; i < table_size; i++)
     for (unsigned int j = 0; j < table_size; j++)
       delete TO_FLOYD_LINK(i, j);
-  delete[] linkTable_;
+  delete[] link_table_;
 
-  delete[] predecessorTable_;
-  delete[] costTable_;
+  delete[] predecessor_table_;
+  delete[] cost_table_;
 }
 
 void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
@@ -93,11 +94,11 @@ void FloydZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoi
 
   addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
-  if (not linkTable_) {
+  if (not link_table_) {
     /* Create Cost, Predecessor and Link tables */
-    costTable_        = new double[table_size * table_size];                 /* link cost from host to host */
-    predecessorTable_ = new int[table_size * table_size];                    /* predecessor host numbers */
-    linkTable_        = new RouteCreationArgs*[table_size * table_size];     /* actual link between src and dst */
+    cost_table_        = new double[table_size * table_size];             /* link cost from host to host */
+    predecessor_table_ = new int[table_size * table_size];                /* predecessor host numbers */
+    link_table_        = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */
 
     /* Initialize costs and predecessors */
     for (unsigned int i = 0; i < table_size; i++)
@@ -159,11 +160,11 @@ void FloydZone::seal()
   /* set the size of table routing */
   unsigned int table_size = getTableSize();
 
-  if (not linkTable_) {
+  if (not link_table_) {
     /* Create Cost, Predecessor and Link tables */
-    costTable_        = new double[table_size * table_size];                 /* link cost from host to host */
-    predecessorTable_ = new int[table_size * table_size];                    /* predecessor host numbers */
-    linkTable_        = new RouteCreationArgs*[table_size * table_size];     /* actual link between src and dst */
+    cost_table_        = new double[table_size * table_size];             /* link cost from host to host */
+    predecessor_table_ = new int[table_size * table_size];                /* predecessor host numbers */
+    link_table_        = new RouteCreationArgs*[table_size * table_size]; /* actual link between src and dst */
 
     /* Initialize costs and predecessors */
     for (unsigned int i = 0; i < table_size; i++)
index ddcaf3d..5f4b90c 100644 (file)
@@ -1,15 +1,16 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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 "src/kernel/routing/FullZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/FullZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
-#define TO_ROUTE_FULL(i, j) routingTable_[(i) + (j)*table_size]
+#define TO_ROUTE_FULL(i, j) routing_table_[(i) + (j)*table_size]
 
 namespace simgrid {
 namespace kernel {
@@ -23,8 +24,8 @@ void FullZone::seal()
   unsigned int table_size = getTableSize();
 
   /* Create table if needed */
-  if (not routingTable_)
-    routingTable_ = new RouteCreationArgs*[table_size * table_size]();
+  if (not routing_table_)
+    routing_table_ = new RouteCreationArgs*[table_size * table_size]();
 
   /* Add the loopback if needed */
   if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
@@ -41,13 +42,13 @@ void FullZone::seal()
 
 FullZone::~FullZone()
 {
-  if (routingTable_) {
+  if (routing_table_) {
     unsigned int table_size = getTableSize();
     /* Delete routing table */
     for (unsigned int i = 0; i < table_size; i++)
       for (unsigned int j = 0; j < table_size; j++)
         delete TO_ROUTE_FULL(i, j);
-    delete[] routingTable_;
+    delete[] routing_table_;
   }
 }
 
@@ -77,8 +78,8 @@ void FullZone::addRoute(kernel::routing::NetPoint* src, kernel::routing::NetPoin
 
   unsigned int table_size = getTableSize();
 
-  if (not routingTable_)
-    routingTable_ = new RouteCreationArgs*[table_size * table_size]();
+  if (not routing_table_)
+    routing_table_ = new RouteCreationArgs*[table_size * table_size]();
 
   /* Check that the route does not already exist */
   if (gw_dst) // inter-zone route (to adapt the error message, if any)
index 3670c70..c15f13a 100644 (file)
@@ -1,10 +1,9 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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 "src/kernel/routing/NetPoint.hpp"
-
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 
@@ -17,10 +16,12 @@ namespace routing {
 simgrid::xbt::signal<void(NetPoint*)> NetPoint::onCreation;
 
 NetPoint::NetPoint(std::string name, NetPoint::Type componentType, NetZoneImpl* netzone_p)
-    : name_(name), componentType_(componentType), netzone_(netzone_p)
+    : name_(name), component_type_(componentType), netzone_(netzone_p)
 {
   if (netzone_p != nullptr)
     id_ = netzone_p->addComponent(this);
+  else
+    id_ = static_cast<decltype(id_)>(-1);
   simgrid::s4u::Engine::getInstance()->netpointRegister(this);
   simgrid::kernel::routing::NetPoint::onCreation(this);
 }
index 775bff4..f980bba 100644 (file)
@@ -1,15 +1,15 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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 "src/kernel/routing/NetZoneImpl.hpp"
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
-
+#include "src/surf/xml/platf_private.hpp"
 #include "xbt/log.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
@@ -37,7 +37,7 @@ NetZoneImpl::NetZoneImpl(NetZone* father, std::string name) : NetZone(father, na
 
 NetZoneImpl::~NetZoneImpl()
 {
-  for (auto const& kv : bypassRoutes_)
+  for (auto const& kv : bypass_routes_)
     delete kv.second;
 
   simgrid::s4u::Engine::getInstance()->netpointUnregister(netpoint_);
@@ -73,14 +73,14 @@ void NetZoneImpl::addBypassRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src,
               gw_dst->getCname());
     xbt_assert(not link_list.empty(), "Bypass route between %s@%s and %s@%s cannot be empty.", src->getCname(),
                gw_src->getCname(), dst->getCname(), gw_dst->getCname());
-    xbt_assert(bypassRoutes_.find({src, dst}) == bypassRoutes_.end(),
+    xbt_assert(bypass_routes_.find({src, dst}) == bypass_routes_.end(),
                "The bypass route between %s@%s and %s@%s already exists.", src->getCname(), gw_src->getCname(),
                dst->getCname(), gw_dst->getCname());
   } else {
     XBT_DEBUG("Load bypassRoute from %s to %s", src->getCname(), dst->getCname());
     xbt_assert(not link_list.empty(), "Bypass route between %s and %s cannot be empty.", src->getCname(),
                dst->getCname());
-    xbt_assert(bypassRoutes_.find({src, dst}) == bypassRoutes_.end(),
+    xbt_assert(bypass_routes_.find({src, dst}) == bypass_routes_.end(),
                "The bypass route between %s and %s already exists.", src->getCname(), dst->getCname());
   }
 
@@ -90,7 +90,7 @@ void NetZoneImpl::addBypassRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src,
     newRoute->links.push_back(link);
 
   /* Store it */
-  bypassRoutes_.insert({{src, dst}, newRoute});
+  bypass_routes_.insert({{src, dst}, newRoute});
 }
 
 /** @brief Get the common ancestor and its first children in each line leading to src and dst
@@ -207,13 +207,13 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
                                  /* OUT */ std::vector<surf::LinkImpl*>& links, double* latency)
 {
   // If never set a bypass route return nullptr without any further computations
-  if (bypassRoutes_.empty())
+  if (bypass_routes_.empty())
     return false;
 
   /* Base case, no recursion is needed */
   if (dst->netzone() == this && src->netzone() == this) {
-    if (bypassRoutes_.find({src, dst}) != bypassRoutes_.end()) {
-      BypassRoute* bypassedRoute = bypassRoutes_.at({src, dst});
+    if (bypass_routes_.find({src, dst}) != bypass_routes_.end()) {
+      BypassRoute* bypassedRoute = bypass_routes_.at({src, dst});
       for (surf::LinkImpl* const& link : bypassedRoute->links) {
         links.push_back(link);
         if (latency)
@@ -262,16 +262,16 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
     for (int i = 0; i < max; i++) {
       if (i <= max_index_src && max <= max_index_dst) {
         key = {path_src.at(i)->netpoint_, path_dst.at(max)->netpoint_};
-        auto bpr = bypassRoutes_.find(key);
-        if (bpr != bypassRoutes_.end()) {
+        auto bpr = bypass_routes_.find(key);
+        if (bpr != bypass_routes_.end()) {
           bypassedRoute = bpr->second;
           break;
         }
       }
       if (max <= max_index_src && i <= max_index_dst) {
         key = {path_src.at(max)->netpoint_, path_dst.at(i)->netpoint_};
-        auto bpr = bypassRoutes_.find(key);
-        if (bpr != bypassRoutes_.end()) {
+        auto bpr = bypass_routes_.find(key);
+        if (bpr != bypass_routes_.end()) {
           bypassedRoute = bpr->second;
           break;
         }
@@ -283,8 +283,8 @@ bool NetZoneImpl::getBypassRoute(routing::NetPoint* src, routing::NetPoint* dst,
 
     if (max <= max_index_src && max <= max_index_dst) {
       key = {path_src.at(max)->netpoint_, path_dst.at(max)->netpoint_};
-      auto bpr = bypassRoutes_.find(key);
-      if (bpr != bypassRoutes_.end()) {
+      auto bpr = bypass_routes_.find(key);
+      if (bpr != bypass_routes_.end()) {
         bypassedRoute = bpr->second;
         break;
       }
index 5c573be..73df03a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -7,10 +7,10 @@
 #include "xbt/graph.h"
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
-
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/RoutedZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/RoutedZone.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_routing_generic, surf_route, "Generic implementation of the surf routing");
 
index 1d01cc9..4446fdb 100644 (file)
@@ -1,11 +1,13 @@
-/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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 "src/kernel/routing/TorusZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/TorusZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
+
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
 #include <string>
@@ -68,7 +70,7 @@ void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int
      * Note that position rankId*(xbt_dynar_length(dimensions)+has_loopback?+has_limiter?)
      * holds the link "rankId->rankId"
      */
-    privateLinks_.insert({position + j, {linkUp, linkDown}});
+    private_links_.insert({position + j, {linkUp, linkDown}});
     dim_product *= current_dimension;
   }
   rank++;
@@ -87,7 +89,7 @@ void TorusZone::parse_specific_arguments(ClusterCreationArgs* cluster)
     for (auto const& group : dimensions)
       dimensions_.push_back(surf_parse_get_int(group));
 
-    linkCountPerNode_ = dimensions_.size();
+    num_links_per_node_ = dimensions_.size();
   }
 }
 
@@ -99,8 +101,8 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* r
   if (dst->isRouter() || src->isRouter())
     return;
 
-  if (src->id() == dst->id() && hasLoopback_) {
-    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
+  if (src->id() == dst->id() && has_loopback_) {
+    std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id() * num_links_per_node_);
 
     route->link_list.push_back(info.first);
     if (lat)
@@ -149,8 +151,8 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* r
             next_node = (current_node + dim_product);
 
           // HERE: We use *CURRENT* node for calculation (as opposed to next_node)
-          nodeOffset = current_node * (linkCountPerNode_);
-          linkOffset = nodeOffset + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0) + j;
+          nodeOffset = current_node * (num_links_per_node_);
+          linkOffset = nodeOffset + (has_loopback_ ? 1 : 0) + (has_limiter_ ? 1 : 0) + j;
           use_lnk_up = true;
           assert(linkOffset >= 0);
         } else { // Route to the left
@@ -160,8 +162,8 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* r
             next_node = (current_node - dim_product);
 
           // HERE: We use *next* node for calculation (as opposed to current_node!)
-          nodeOffset = next_node * (linkCountPerNode_);
-          linkOffset = nodeOffset + j + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0);
+          nodeOffset = next_node * (num_links_per_node_);
+          linkOffset = nodeOffset + j + (has_loopback_ ? 1 : 0) + (has_limiter_ ? 1 : 0);
           use_lnk_up = false;
 
           assert(linkOffset >= 0);
@@ -177,12 +179,12 @@ void TorusZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* r
 
     std::pair<surf::LinkImpl*, surf::LinkImpl*> info;
 
-    if (hasLimiter_) { // limiter for sender
-      info = privateLinks_.at(nodeOffset + (hasLoopback_ ? 1 : 0));
+    if (has_limiter_) { // limiter for sender
+      info = private_links_.at(nodeOffset + (has_loopback_ ? 1 : 0));
       route->link_list.push_back(info.first);
     }
 
-    info = privateLinks_.at(linkOffset);
+    info = private_links_.at(linkOffset);
 
     if (use_lnk_up == false) {
       route->link_list.push_back(info.second);
index 5a0cfd4..4c9a331 100644 (file)
@@ -1,16 +1,16 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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 <boost/algorithm/string.hpp>
-
+#include "simgrid/kernel/routing/VivaldiZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/VivaldiZone.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
+
+#include <boost/algorithm/string.hpp>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf");
 
@@ -72,7 +72,7 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s
   std::string link_down    = "link_" + netpoint->getName() + "_DOWN";
   surf::LinkImpl* linkUp   = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
   surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
-  privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
+  private_links_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
 void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
@@ -87,8 +87,8 @@ void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
   }
 
   /* Retrieve the private links */
-  auto src_link = privateLinks_.find(src->id());
-  if (src_link != privateLinks_.end()) {
+  auto src_link = private_links_.find(src->id());
+  if (src_link != private_links_.end()) {
     std::pair<surf::LinkImpl*, surf::LinkImpl*> info = src_link->second;
     if (info.first) {
       route->link_list.push_back(info.first);
@@ -99,8 +99,8 @@ void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs*
     XBT_DEBUG("Source of private link (%u) doesn't exist", src->id());
   }
 
-  auto dst_link = privateLinks_.find(dst->id());
-  if (dst_link != privateLinks_.end()) {
+  auto dst_link = private_links_.find(dst->id());
+  if (dst_link != private_links_.end()) {
     std::pair<surf::LinkImpl*, surf::LinkImpl*> info = dst_link->second;
     if (info.second) {
       route->link_list.push_back(info.second);
index 53ebd7e..adb52a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team.
+/* Copyright (c) 2008-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -19,7 +19,7 @@
 #include "xbt/log.h"
 #include "xbt/system_error.hpp"
 
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 
 #include "src/mc/ModelChecker.hpp"
 #include "src/mc/ModelChecker.hpp"
index a01cf12..97834f1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team.
+/* Copyright (c) 2015-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -13,7 +13,7 @@
 #include "xbt/system_error.hpp"
 #include <mc/mc.h>
 #include <simgrid/modelchecker.h>
-#include <simgrid/sg_config.h>
+#include <simgrid/sg_config.hpp>
 
 #include "src/mc/Session.hpp"
 #include "src/mc/checker/Checker.hpp"
index d69ba24..c0ea47c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017. The SimGrid Team.
+/* Copyright (c) 2016-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -64,10 +64,9 @@ protected:
   Session& getSession() { return *session_; }
 };
 
-XBT_PUBLIC() Checker* createLivenessChecker(Session& session);
-XBT_PUBLIC() Checker* createSafetyChecker(Session& session);
-XBT_PUBLIC() Checker* createCommunicationDeterminismChecker(Session& session);
-
+XBT_PUBLIC Checker* createLivenessChecker(Session& session);
+XBT_PUBLIC Checker* createSafetyChecker(Session& session);
+XBT_PUBLIC Checker* createCommunicationDeterminismChecker(Session& session);
 }
 }
 
index 4fedf30..ac155f2 100644 (file)
@@ -245,7 +245,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim
   } else
     xbt_die("Unexpected call_type %i", (int) call_type);
 
-  XBT_DEBUG("Insert incomplete comm pattern %p for process %lu", pattern.get(), issuer->pid);
+  XBT_DEBUG("Insert incomplete comm pattern %p for process %ld", pattern.get(), issuer->pid);
   xbt_dynar_t dynar = xbt_dynar_get_as(incomplete_communications_pattern, issuer->pid, xbt_dynar_t);
   simgrid::mc::PatternCommunication* pattern2 = pattern.release();
   xbt_dynar_push(dynar, &pattern2);
index 8bad4a5..391a1aa 100644 (file)
@@ -245,7 +245,7 @@ void SafetyChecker::backtrack()
         } else {
 
           const smx_actor_t previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req);
-          XBT_DEBUG("Simcall %d, process %lu (state %d) and simcall %d, process %lu (state %d) are independent",
+          XBT_DEBUG("Simcall %d, process %ld (state %d) and simcall %d, process %ld (state %d) are independent",
                     req->call, issuer->pid, state->num,
                     prev_state->internal_req.call,
                     previous_issuer->pid,
index af02035..7f3d39a 100644 (file)
@@ -16,7 +16,7 @@
 
 #include <xbt/log.h>
 
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/xbt_modinter.h"
 
 #include "src/mc/Session.hpp"
index bfee449..260bfe8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
@@ -10,7 +10,7 @@
 #include "src/mc/mc_replay.hpp"
 #include <mc/mc.h>
 
-#include <simgrid/sg_config.h>
+#include <simgrid/sg_config.hpp>
 
 #if SIMGRID_HAVE_MC
 #include "src/mc/mc_private.hpp"
index ae32b74..580b8f5 100644 (file)
@@ -403,12 +403,11 @@ static uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die,
     // This is not really 0, but the code expects this (we do not know):
     return 0;
 
-  uint64_t upper_bound =
-      MC_dwarf_attr_integrate_uint(die, DW_AT_upper_bound, -1);
+  uint64_t upper_bound = MC_dwarf_attr_integrate_uint(die, DW_AT_upper_bound, static_cast<uint64_t>(-1));
 
   uint64_t lower_bound = 0;
   if (dwarf_hasattr_integrate(die, DW_AT_lower_bound))
-    lower_bound = MC_dwarf_attr_integrate_uint(die, DW_AT_lower_bound, -1);
+    lower_bound = MC_dwarf_attr_integrate_uint(die, DW_AT_lower_bound, static_cast<uint64_t>(-1));
   else
     lower_bound = MC_dwarf_default_lower_bound(dwarf_srclang(unit));
   return upper_bound - lower_bound + 1;
index cede412..23d2626 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
 
 namespace simgrid {
 namespace mc {
-XBT_PUBLIC_CLASS DeadlockError{};
-XBT_PUBLIC_CLASS TerminationError{};
-XBT_PUBLIC_CLASS LivenessError{};
+class XBT_PUBLIC DeadlockError {
+};
+class XBT_PUBLIC TerminationError {
+};
+class XBT_PUBLIC LivenessError {
+};
 }
 }
 
index 58f1795..f146f50 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -12,7 +12,7 @@
 #include <ucontext.h>           /* context relative declarations */
 
 SG_BEGIN_DECL();
-XBT_PUBLIC(void) MC_register_stack_area(void *stack, smx_actor_t process, ucontext_t* context, size_t size);
+XBT_PUBLIC void MC_register_stack_area(void* stack, smx_actor_t process, ucontext_t* context, size_t size);
 SG_END_DECL();
 
 #endif
index 2864b9d..b0a39d9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team.
+/* Copyright (c) 2008-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -16,8 +16,6 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc,
                                 "Logging specific to MC (memory)");
 
-extern "C" {
-
 /* Initialize the model-checker memory subsystem */
 /* It creates the two heap regions: std_heap and mc_heap */
 void MC_memory_init()
@@ -25,5 +23,3 @@ void MC_memory_init()
   if (not malloc_use_mmalloc())
     xbt_die("Model-checking support is not enabled: run with simgrid-mc.");
 }
-
-}
index dacbbb6..a7f21c2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017. The SimGrid Team.
+/* Copyright (c) 2014-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -19,8 +19,6 @@
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 /** @brief Restore a snapshot of a region
  *
  *  If possible, the restoration will be incremental
@@ -51,5 +49,3 @@ void mc_region_restore_sparse(simgrid::mc::RemoteClient* process, mc_mem_region_
   mc_restore_page_snapshot_region(process,
     (void*) reg->permanent_address().address(), reg->page_data());
 }
-
-}
index c4c2dd8..813d138 100644 (file)
@@ -13,7 +13,7 @@
  *
  *  This is using the format generated by traceToString().
  */
-XBT_PUBLIC_DATA(std::string) MC_record_path;
+XBT_PUBLIC_DATA std::string MC_record_path;
 
 /** Whether the replay mode is enabled */
 static inline int MC_record_replay_is_active()
index de861f4..09f9c88 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
@@ -97,7 +97,7 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
 #if 0
   if((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
      &&  r2->call == SIMCALL_COMM_TEST)
-     return FALSE;
+     return false;
 #endif
 
   if (r1->call == SIMCALL_COMM_WAIT
@@ -139,7 +139,7 @@ bool request_depend(smx_simcall_t r1, smx_simcall_t r2)
   if ((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0)
       || (r2->call == SIMCALL_COMM_WAIT
           && simcall_comm_wait__get__timeout(r2) > 0))
-    return TRUE;
+    return true;
 
   if (r1->call != r2->call)
     return request_depend_asymmetric(r1, r2)
@@ -222,10 +222,10 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     char* p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
     char* bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
     if (issuer->host)
-      args = bprintf("src=(%lu)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
+      args = bprintf("src=(%ld)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
                      MC_smx_actor_get_name(issuer), p, bs);
     else
-      args = bprintf("src=(%lu)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
+      args = bprintf("src=(%ld)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
     xbt_free(bs);
     xbt_free(p);
     break;
@@ -242,10 +242,10 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     char* p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
     char* bs = buff_size_to_string(size);
     if (issuer->host)
-      args = bprintf("dst=(%lu)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
+      args = bprintf("dst=(%ld)%s (%s), buff=%s, size=%s", issuer->pid, MC_smx_actor_get_host_name(issuer),
                      MC_smx_actor_get_name(issuer), p, bs);
     else
-      args = bprintf("dst=(%lu)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
+      args = bprintf("dst=(%ld)%s, buff=%s, size=%s", issuer->pid, MC_smx_actor_get_name(issuer), p, bs);
     xbt_free(bs);
     xbt_free(p);
     break;
@@ -275,7 +275,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
       smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc));
       smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc));
       args =
-          bprintf("comm=%s [(%lu)%s (%s)-> (%lu)%s (%s)]", p, src_proc ? src_proc->pid : 0,
+          bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->pid : 0,
                   src_proc ? MC_smx_actor_get_host_name(src_proc) : "", src_proc ? MC_smx_actor_get_name(src_proc) : "",
                   dst_proc ? dst_proc->pid : 0, dst_proc ? MC_smx_actor_get_host_name(dst_proc) : "",
                   dst_proc ? MC_smx_actor_get_name(dst_proc) : "");
@@ -307,7 +307,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
 
       smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->src_proc));
       smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(act->dst_proc));
-      args = bprintf("comm=%s [(%lu)%s (%s) -> (%lu)%s (%s)]", p, src_proc->pid, MC_smx_actor_get_name(src_proc),
+      args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->pid, MC_smx_actor_get_name(src_proc),
                      MC_smx_actor_get_host_name(src_proc), dst_proc->pid, MC_smx_actor_get_name(dst_proc),
                      MC_smx_actor_get_host_name(dst_proc));
     }
@@ -381,10 +381,10 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
 
   std::string str;
   if (args != nullptr)
-    str = simgrid::xbt::string_printf("[(%lu)%s (%s)] %s(%s)", issuer->pid, MC_smx_actor_get_host_name(issuer),
+    str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s(%s)", issuer->pid, MC_smx_actor_get_host_name(issuer),
                                       MC_smx_actor_get_name(issuer), type, args);
   else
-    str = simgrid::xbt::string_printf("[(%lu)%s (%s)] %s ", issuer->pid, MC_smx_actor_get_host_name(issuer),
+    str = simgrid::xbt::string_printf("[(%ld)%s (%s)] %s ", issuer->pid, MC_smx_actor_get_host_name(issuer),
                                       MC_smx_actor_get_name(issuer), type);
   xbt_free(args);
   return str;
@@ -453,24 +453,24 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
   switch (req->call) {
   case SIMCALL_COMM_ISEND:
     if (issuer->host)
-      label = simgrid::xbt::string_printf("[(%lu)%s] iSend", issuer->pid, MC_smx_actor_get_host_name(issuer));
+      label = simgrid::xbt::string_printf("[(%ld)%s] iSend", issuer->pid, MC_smx_actor_get_host_name(issuer));
     else
-      label = bprintf("[(%lu)] iSend", issuer->pid);
+      label = bprintf("[(%ld)] iSend", issuer->pid);
     break;
 
   case SIMCALL_COMM_IRECV:
     if (issuer->host)
-      label = simgrid::xbt::string_printf("[(%lu)%s] iRecv", issuer->pid, MC_smx_actor_get_host_name(issuer));
+      label = simgrid::xbt::string_printf("[(%ld)%s] iRecv", issuer->pid, MC_smx_actor_get_host_name(issuer));
     else
-      label = simgrid::xbt::string_printf("[(%lu)] iRecv", issuer->pid);
+      label = simgrid::xbt::string_printf("[(%ld)] iRecv", issuer->pid);
     break;
 
   case SIMCALL_COMM_WAIT:
     if (value == -1) {
       if (issuer->host)
-        label = simgrid::xbt::string_printf("[(%lu)%s] WaitTimeout", issuer->pid, MC_smx_actor_get_host_name(issuer));
+        label = simgrid::xbt::string_printf("[(%ld)%s] WaitTimeout", issuer->pid, MC_smx_actor_get_host_name(issuer));
       else
-        label = simgrid::xbt::string_printf("[(%lu)] WaitTimeout", issuer->pid);
+        label = simgrid::xbt::string_printf("[(%ld)] WaitTimeout", issuer->pid);
     } else {
       simgrid::kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
       simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
@@ -481,11 +481,11 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
       smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc));
       smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc));
       if (issuer->host)
-        label = simgrid::xbt::string_printf("[(%lu)%s] Wait [(%lu)->(%lu)]", issuer->pid,
+        label = simgrid::xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->pid,
                                             MC_smx_actor_get_host_name(issuer), src_proc ? src_proc->pid : 0,
                                             dst_proc ? dst_proc->pid : 0);
       else
-        label = simgrid::xbt::string_printf("[(%lu)] Wait [(%lu)->(%lu)]",
+        label = simgrid::xbt::string_printf("[(%ld)] Wait [(%ld)->(%ld)]",
                     issuer->pid,
                     src_proc ? src_proc->pid : 0,
                     dst_proc ? dst_proc->pid : 0);
@@ -499,14 +499,14 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
     simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
     if (comm->src_proc == nullptr || comm->dst_proc == nullptr) {
       if (issuer->host)
-        label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
+        label = simgrid::xbt::string_printf("[(%ld)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
       else
-        label = bprintf("[(%lu)] Test FALSE", issuer->pid);
+        label = bprintf("[(%ld)] Test FALSE", issuer->pid);
     } else {
       if (issuer->host)
-        label = simgrid::xbt::string_printf("[(%lu)%s] Test TRUE", issuer->pid, MC_smx_actor_get_host_name(issuer));
+        label = simgrid::xbt::string_printf("[(%ld)%s] Test TRUE", issuer->pid, MC_smx_actor_get_host_name(issuer));
       else
-        label = simgrid::xbt::string_printf("[(%lu)] Test TRUE", issuer->pid);
+        label = simgrid::xbt::string_printf("[(%ld)] Test TRUE", issuer->pid);
     }
     break;
   }
@@ -515,10 +515,10 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
     unsigned long comms_size = read_length(
       mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(req)));
     if (issuer->host)
-      label = simgrid::xbt::string_printf("[(%lu)%s] WaitAny [%d of %lu]", issuer->pid,
+      label = simgrid::xbt::string_printf("[(%ld)%s] WaitAny [%d of %lu]", issuer->pid,
                                           MC_smx_actor_get_host_name(issuer), value + 1, comms_size);
     else
-      label = simgrid::xbt::string_printf("[(%lu)] WaitAny [%d of %lu]",
+      label = simgrid::xbt::string_printf("[(%ld)] WaitAny [%d of %lu]",
                   issuer->pid, value + 1, comms_size);
     break;
   }
@@ -526,16 +526,16 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
   case SIMCALL_COMM_TESTANY:
     if (value == -1) {
       if (issuer->host)
-        label = simgrid::xbt::string_printf("[(%lu)%s] TestAny FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
+        label = simgrid::xbt::string_printf("[(%ld)%s] TestAny FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
       else
-        label = simgrid::xbt::string_printf("[(%lu)] TestAny FALSE", issuer->pid);
+        label = simgrid::xbt::string_printf("[(%ld)] TestAny FALSE", issuer->pid);
     } else {
       if (issuer->host)
-        label = simgrid::xbt::string_printf("[(%lu)%s] TestAny TRUE [%d of %lu]", issuer->pid,
+        label = simgrid::xbt::string_printf("[(%ld)%s] TestAny TRUE [%d of %lu]", issuer->pid,
                                             MC_smx_actor_get_host_name(issuer), value + 1,
                                             simcall_comm_testany__get__count(req));
       else
-        label = simgrid::xbt::string_printf("[(%lu)] TestAny TRUE [%d of %lu]",
+        label = simgrid::xbt::string_printf("[(%ld)] TestAny TRUE [%d of %lu]",
                     issuer->pid,
                     value + 1,
                     simcall_comm_testany__get__count(req));
@@ -543,19 +543,19 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
     break;
 
   case SIMCALL_MUTEX_TRYLOCK:
-    label = simgrid::xbt::string_printf("[(%lu)] Mutex TRYLOCK", issuer->pid);
+    label = simgrid::xbt::string_printf("[(%ld)] Mutex TRYLOCK", issuer->pid);
     break;
 
   case SIMCALL_MUTEX_LOCK:
-    label = simgrid::xbt::string_printf("[(%lu)] Mutex LOCK", issuer->pid);
+    label = simgrid::xbt::string_printf("[(%ld)] Mutex LOCK", issuer->pid);
     break;
 
   case SIMCALL_MC_RANDOM:
     if (issuer->host)
-      label = simgrid::xbt::string_printf("[(%lu)%s] MC_RANDOM (%d)", issuer->pid, MC_smx_actor_get_host_name(issuer),
+      label = simgrid::xbt::string_printf("[(%ld)%s] MC_RANDOM (%d)", issuer->pid, MC_smx_actor_get_host_name(issuer),
                                           value);
     else
-      label = simgrid::xbt::string_printf("[(%lu)] MC_RANDOM (%d)", issuer->pid, value);
+      label = simgrid::xbt::string_printf("[(%ld)] MC_RANDOM (%d)", issuer->pid, value);
     break;
 
   default:
index 9cc4241..f725c87 100644 (file)
@@ -47,7 +47,7 @@ static void MC_process_refresh_simix_actor_dynar(simgrid::mc::RemoteClient* proc
   for (unsigned int i = 0; i < dynar.used; ++i) {
 
     simgrid::mc::ActorInformation info;
-    info.address  = simgrid::mc::RemotePtr<simgrid::simix::ActorImpl>(data[i]);
+    info.address  = simgrid::mc::RemotePtr<simgrid::kernel::actor::ActorImpl>(data[i]);
     info.hostname = nullptr;
     process->read_bytes(&info.copy, sizeof(info.copy), remote(data[i]));
     target.push_back(std::move(info));
index 09e9e17..391fef8 100644 (file)
@@ -20,8 +20,6 @@
 #include "src/mc/mc_private.hpp"
 #include "src/mc/mc_snapshot.hpp"
 
-extern "C" {
-
 /** @brief Find the snapshoted region from a pointer
  *
  *  @param addr     Pointer
@@ -141,8 +139,6 @@ int MC_snapshot_region_memcmp(
   return res;
 }
 
-} // extern "C"
-
 namespace simgrid {
 namespace mc {
 
index 6521d94..f515ae4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -114,7 +114,7 @@ void Client::handleSimcall(s_mc_message_simcall_handle_t* message)
 void Client::handleRestore(s_mc_message_restore_t* message)
 {
 #if HAVE_SMPI
-  smpi_really_switch_data_segment(message->index);
+  smpi_really_switch_data_segment(simgrid::s4u::Actor::byPid(message->index));
 #endif
 }
 void Client::handleActorEnabled(s_mc_message_actor_enabled_t* msg)
index dc10fd8..1d4cd21 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team.
+/* Copyright (c) 2015-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@ namespace mc {
  *
  *  Send messages to the model-checker and handles message from it.
  */
-class XBT_PUBLIC() Client {
+class XBT_PUBLIC Client {
 private:
   Channel channel_;
   static std::unique_ptr<Client> instance_;
index 7f8877f..521c794 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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. */
@@ -85,6 +85,9 @@ static const std::vector<std::string> filtered_libraries = {
     "libelf",
     "libevent",
     "libgcc_s",
+    "libimf",
+    "libintlc",
+    "libirng",
     "liblua5.1",
     "liblua5.3",
     "liblzma",
@@ -92,6 +95,7 @@ static const std::vector<std::string> filtered_libraries = {
     "libpthread",
     "librt",
     "libstdc++",
+    "libsvml",
     "libunwind",
     "libunwind-x86_64",
     "libunwind-x86",
index b681e59..cce199a 100644 (file)
@@ -44,8 +44,8 @@ namespace mc {
 class ActorInformation {
 public:
   /** MCed address of the process */
-  RemotePtr<simgrid::simix::ActorImpl> address{nullptr};
-  Remote<simgrid::simix::ActorImpl> copy;
+  RemotePtr<simgrid::kernel::actor::ActorImpl> address{nullptr};
+  Remote<simgrid::kernel::actor::ActorImpl> copy;
 
   /** Hostname (owned by `mc_modelchecker->hostnames`) */
   const char* hostname = nullptr;
@@ -190,7 +190,7 @@ public:
   std::vector<simgrid::mc::ActorInformation>& dead_actors();
 
   /** Get a local description of a remote SIMIX actor */
-  simgrid::mc::ActorInformation* resolveActorInfo(simgrid::mc::RemotePtr<simgrid::simix::ActorImpl> actor)
+  simgrid::mc::ActorInformation* resolveActorInfo(simgrid::mc::RemotePtr<simgrid::kernel::actor::ActorImpl> actor)
   {
     xbt_assert(mc_model_checker != nullptr);
     if (not actor)
@@ -206,7 +206,7 @@ public:
   }
 
   /** Get a local copy of the SIMIX actor structure */
-  simgrid::simix::ActorImpl* resolveActor(simgrid::mc::RemotePtr<simgrid::simix::ActorImpl> process)
+  simgrid::kernel::actor::ActorImpl* resolveActor(simgrid::mc::RemotePtr<simgrid::kernel::actor::ActorImpl> process)
   {
     simgrid::mc::ActorInformation* actor_info = this->resolveActorInfo(process);
     if (actor_info)
index 61bba1d..d9eceb3 100644 (file)
@@ -3,10 +3,10 @@
 /* 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/Host.hpp"
 #include "src/instr/instr_private.hpp"
 #include "src/msg/msg_private.hpp"
 #include "src/simix/ActorImpl.hpp"
+#include <simgrid/actor.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process");
 
@@ -15,54 +15,10 @@ std::string instr_pid(msg_process_t proc)
   return std::string(proc->getCname()) + "-" + std::to_string(proc->getPid());
 }
 
-void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host)
-{
-  if (TRACE_actor_is_enabled()) {
-    static long long int counter = 0;
-
-    std::string key = std::to_string(counter);
-    counter++;
-
-    //start link
-    container_t msg                = simgrid::instr::Container::byName(instr_pid(process));
-    simgrid::instr::LinkType* link = simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_LINK");
-    link->startEvent(msg, "M", key);
-
-    //destroy existing container of this process
-    TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process));
-
-    //create new container on the new_host location
-    TRACE_msg_process_create (MSG_process_get_name (process), MSG_process_get_PID (process), new_host);
-
-    //end link
-    msg = simgrid::instr::Container::byName(instr_pid(process));
-    link->endEvent(msg, "M", key);
-  }
-}
-
-void TRACE_msg_process_create(std::string process_name, int process_pid, msg_host_t host)
-{
-  if (TRACE_actor_is_enabled()) {
-    container_t host_container = simgrid::instr::Container::byName(host->getName());
-    new simgrid::instr::Container(process_name + "-" + std::to_string(process_pid), "MSG_PROCESS", host_container);
-  }
-}
-
-void TRACE_msg_process_destroy(std::string process_name, int process_pid)
-{
-  if (TRACE_actor_is_enabled()) {
-    container_t process = simgrid::instr::Container::byNameOrNull(process_name + "-" + std::to_string(process_pid));
-    if (process) {
-      process->removeFromParent();
-      delete process;
-    }
-  }
-}
-
 void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t process)
 {
   if (TRACE_actor_is_enabled() && status == SMX_EXIT_FAILURE) {
     //kill means that this process no longer exists, let's destroy it
-    TRACE_msg_process_destroy(process->getCname(), process->getPid());
+    simgrid::instr::Container::byName(instr_pid(process))->removeFromParent();
   }
 }
index 6c0d673..c7d77c1 100644 (file)
@@ -50,7 +50,7 @@ void TRACE_msg_task_execute_start(msg_task_t task)
 
   if (TRACE_actor_is_enabled())
     simgrid::instr::Container::byName(instr_pid(MSG_process_self()))
-        ->getState("MSG_PROCESS_STATE")
+        ->getState("ACTOR_STATE")
         ->pushEvent("task_execute");
 }
 
@@ -59,7 +59,7 @@ void TRACE_msg_task_execute_end(msg_task_t task)
   XBT_DEBUG("EXEC,out %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->popEvent();
 }
 
 /* MSG_task_destroy related functions */
@@ -78,9 +78,7 @@ void TRACE_msg_task_get_start()
   XBT_DEBUG("GET,in");
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))
-        ->getState("MSG_PROCESS_STATE")
-        ->pushEvent("receive");
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->pushEvent("receive");
 }
 
 void TRACE_msg_task_get_end(msg_task_t task)
@@ -89,27 +87,25 @@ void TRACE_msg_task_get_end(msg_task_t task)
 
   if (TRACE_actor_is_enabled()) {
     container_t process_container = simgrid::instr::Container::byName(instr_pid(MSG_process_self()));
-    process_container->getState("MSG_PROCESS_STATE")->popEvent();
+    process_container->getState("ACTOR_STATE")->popEvent();
 
     std::string key = std::string("p") + std::to_string(task->counter);
-    simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_TASK_LINK")->endEvent(process_container, "SR", key);
+    simgrid::instr::Container::getRoot()->getLink("ACTOR_TASK_LINK")->endEvent(process_container, "SR", key);
   }
 }
 
 /* MSG_task_put related functions */
-int TRACE_msg_task_put_start(msg_task_t task)
+void TRACE_msg_task_put_start(msg_task_t task)
 {
   XBT_DEBUG("PUT,in %p, %lld, %s", task, task->counter, task->category);
 
   if (TRACE_actor_is_enabled()) {
     container_t process_container = simgrid::instr::Container::byName(instr_pid(MSG_process_self()));
-    process_container->getState("MSG_PROCESS_STATE")->pushEvent("send");
+    process_container->getState("ACTOR_STATE")->pushEvent("send");
 
     std::string key = std::string("p") + std::to_string(task->counter);
-    simgrid::instr::Container::getRoot()->getLink("MSG_PROCESS_TASK_LINK")->startEvent(process_container, "SR", key);
+    simgrid::instr::Container::getRoot()->getLink("ACTOR_TASK_LINK")->startEvent(process_container, "SR", key);
   }
-
-  return 1;
 }
 
 void TRACE_msg_task_put_end()
@@ -117,5 +113,5 @@ void TRACE_msg_task_put_end()
   XBT_DEBUG("PUT,out");
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->popEvent();
 }
diff --git a/src/msg/msg_actions.cpp b/src/msg/msg_actions.cpp
deleted file mode 100644 (file)
index 82619ee..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (c) 2009-2017. 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 "src/msg/msg_private.hpp"
-#include "xbt/replay.hpp"
-
-#include <cerrno>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg, "MSG actions for trace driven simulation");
-
-extern "C" {
-
-void MSG_action_init()
-{
-  MSG_function_register_default(simgrid::xbt::replay_runner);
-}
-
-void MSG_action_exit()
-{
-  // Nothing to do anymore here
-}
-
-/** \ingroup msg_trace_driven
- * \brief A trace loader
- *
- *  If path!=nullptr, load a trace file containing actions, and execute them.
- *  Else, assume that each process gets the path in its deployment file
- */
-msg_error_t MSG_action_trace_run(char *path)
-{
-  if (path) {
-    simgrid::xbt::action_fs = new std::ifstream(path, std::ifstream::in);
-  }
-
-  msg_error_t res = MSG_main();
-
-  if (not simgrid::xbt::action_queues.empty()) {
-    XBT_WARN("Not all actions got consumed. If the simulation ended successfully (without deadlock),"
-             " you may want to add new processes to your deployment file.");
-
-    for (auto const& actions_of : simgrid::xbt::action_queues) {
-      XBT_WARN("Still %zu actions for %s", actions_of.second->size(), actions_of.first.c_str());
-    }
-  }
-
-  if (path) {
-    delete simgrid::xbt::action_fs;
-    simgrid::xbt::action_fs = nullptr;
-  }
-
-  return res;
-}
-}
index ae3d87a..8382a62 100644 (file)
@@ -1,12 +1,10 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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 "src/msg/msg_private.hpp"
 
-extern "C" {
-
 /** \ingroup msg_simulation
  * \brief An application deployer.
  *
@@ -59,4 +57,3 @@ void MSG_set_function(const char *host_id, const char *function_name, xbt_dynar_
 {
   SIMIX_process_set_function(host_id, function_name, arguments, -1, -1);
 }
-}
index 92d67e9..5bdf7ae 100644 (file)
@@ -1,11 +1,9 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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/s4u/Engine.hpp"
-#include "simgrid/s4u/NetZone.hpp"
-#include "src/msg/msg_private.hpp"
+#include "simgrid/msg.h"
 
 #if SIMGRID_HAVE_LUA
 #include <lua.h>
@@ -13,8 +11,6 @@
 #include <lualib.h>
 #endif
 
-extern "C" {
-
 /********************************* MSG **************************************/
 
 /** \ingroup msg_simulation
@@ -35,45 +31,3 @@ void MSG_create_environment(const char *file)
 {
   SIMIX_create_environment(file);
 }
-
-msg_netzone_t MSG_zone_get_root()
-{
-  return simgrid::s4u::Engine::getInstance()->getNetRoot();
-}
-
-const char* MSG_zone_get_name(msg_netzone_t netzone)
-{
-  return netzone->getCname();
-}
-
-msg_netzone_t MSG_zone_get_by_name(const char* name)
-{
-  return simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(name);
-}
-
-void MSG_zone_get_sons(msg_netzone_t netzone, xbt_dict_t whereto)
-{
-  for (auto const& elem : *netzone->getChildren()) {
-    xbt_dict_set(whereto, elem->getCname(), static_cast<void*>(elem), nullptr);
-  }
-}
-
-const char* MSG_zone_get_property_value(msg_netzone_t netzone, const char* name)
-{
-  return netzone->getProperty(name);
-}
-
-void MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value)
-{
-  netzone->setProperty(name, value);
-}
-
-void MSG_zone_get_hosts(msg_netzone_t netzone, xbt_dynar_t whereto)
-{
-  /* converts vector to dynar */
-  std::vector<simgrid::s4u::Host*> hosts;
-  netzone->getHosts(&hosts);
-  for (auto const& host : hosts)
-    xbt_dynar_push(whereto, &host);
-}
-}
index aad5620..719640c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -13,8 +13,6 @@
 XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
 
-extern "C" {
-
 MSG_Global_t msg_global = nullptr;
 static void MSG_exit();
 
@@ -93,13 +91,10 @@ void MSG_config(const char *key, const char *value){
 /** \ingroup msg_simulation
  * \brief Kill all running process
 
- * \param reset_PIDs should we reset the PID numbers. A negative
- *   number means no reset and a positive number will be used to set the PID
- *   of the next newly created process.
  */
-int MSG_process_killall(int reset_PIDs)
+int MSG_process_killall()
 {
-  simcall_process_killall(reset_PIDs);
+  simcall_process_killall();
 
   return 0;
 }
@@ -125,4 +120,3 @@ unsigned long int MSG_get_sent_msg()
 {
   return msg_global->sent_msg;
 }
-}
index b378e62..1b9e132 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -11,8 +11,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_gos, msg, "Logging specific to MSG (gos)");
 
-extern "C" {
-
 /** \ingroup msg_task_usage
  * \brief Executes a task and waits for its termination.
  *
@@ -114,7 +112,7 @@ msg_error_t MSG_process_sleep(double nb_sec)
   msg_error_t status = MSG_OK;
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->pushEvent("sleep");
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->pushEvent("sleep");
 
   try {
     simcall_process_sleep(nb_sec);
@@ -134,7 +132,7 @@ msg_error_t MSG_process_sleep(double nb_sec)
   }
 
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(MSG_process_self()))->getState("ACTOR_STATE")->popEvent();
 
   return status;
 }
@@ -307,15 +305,14 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d
   return ret;
 }
 
-/* Internal function used to factorize code between MSG_task_isend_with_matching() and MSG_task_dsend(). */
+/* Internal function used to factorize code between MSG_task_isend(), MSG_task_isend_bounded(), and MSG_task_dsend(). */
 static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* alias,
-                                                 int (*match_fun)(void*, void*, void*), void* match_data,
                                                  void_f_pvoid_t cleanup, int detached)
 {
   simdata_task_t t_simdata = nullptr;
   msg_process_t myself = MSG_process_self();
   simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
-  int call_end = TRACE_msg_task_put_start(task);
+  TRACE_msg_task_put_start(task);
 
   /* Prepare the task to send */
   t_simdata = task->simdata;
@@ -328,7 +325,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* al
   /* Send it by calling SIMIX network layer */
   smx_activity_t act =
       simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task,
-                         sizeof(void*), (simix_match_func_t)match_fun, cleanup, nullptr, match_data, detached);
+                         sizeof(void*), nullptr, cleanup, nullptr, nullptr, detached);
   t_simdata->comm = boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(act);
 
   msg_comm_t comm = nullptr;
@@ -338,8 +335,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* al
 
   if (TRACE_is_enabled())
     simcall_set_category(act, task->category);
-  if (call_end)
-    TRACE_msg_task_put_end();
+  TRACE_msg_task_put_end();
 
   return comm;
 }
@@ -355,7 +351,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char* al
  */
 msg_comm_t MSG_task_isend(msg_task_t task, const char *alias)
 {
-  return MSG_task_isend_internal(task, alias, nullptr, nullptr, nullptr, 0);
+  return MSG_task_isend_internal(task, alias, nullptr, 0);
 }
 
 /** \ingroup msg_task_usage
@@ -372,27 +368,7 @@ msg_comm_t MSG_task_isend(msg_task_t task, const char *alias)
 msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate)
 {
   task->simdata->rate = maxrate;
-  return MSG_task_isend_internal(task, alias, nullptr, nullptr, nullptr, 0);
-}
-
-/** \ingroup msg_task_usage
- * \brief Sends a task on a mailbox, with support for matching requests
- *
- * This is a non blocking function: use MSG_comm_wait() or MSG_comm_test() to end the communication.
- *
- * \param task a #msg_task_t to send on another location.
- * \param alias name of the mailbox to sent the task to
- * \param match_fun boolean function which parameters are:
- *        - match_data_provided_here
- *        - match_data_provided_by_other_side_if_any
- *        - the_smx_synchro_describing_the_other_side
- * \param match_data user provided data passed to match_fun
- * \return the msg_comm_t communication created
- */
-msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char* alias, int (*match_fun)(void*, void*, void*),
-                                        void* match_data)
-{
-  return MSG_task_isend_internal(task, alias, match_fun, match_data, nullptr, 0);
+  return MSG_task_isend_internal(task, alias, nullptr, 0);
 }
 
 /** \ingroup msg_task_usage
@@ -412,7 +388,7 @@ msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char* alias, int
  */
 void MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup)
 {
-  MSG_task_isend_internal(task, alias, nullptr, nullptr, cleanup, 1);
+  MSG_task_isend_internal(task, alias, cleanup, 1);
 }
 
 /** \ingroup msg_task_usage
@@ -493,14 +469,14 @@ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rat
 /** \ingroup msg_task_usage
  * \brief Checks whether a communication is done, and if yes, finalizes it.
  * \param comm the communication to test
- * \return TRUE if the communication is finished
+ * \return 'true' if the communication is finished
  * (but it may have failed, use MSG_comm_get_status() to know its status)
- * or FALSE if the communication is not finished yet
- * If the status is FALSE, don't forget to use MSG_process_sleep() after the test.
+ * or 'false' if the communication is not finished yet
+ * If the status is 'false', don't forget to use MSG_process_sleep() after the test.
  */
 int MSG_comm_test(msg_comm_t comm)
 {
-  int finished = 0;
+  bool finished = false;
 
   try {
     finished = simcall_comm_test(comm->s_comm);
@@ -513,11 +489,11 @@ int MSG_comm_test(msg_comm_t comm)
     switch (e.category) {
       case network_error:
         comm->status = MSG_TRANSFER_FAILURE;
-        finished = 1;
+        finished     = true;
         break;
       case timeout_error:
         comm->status = MSG_TIMEOUT;
-        finished = 1;
+        finished     = true;
         break;
       default:
         throw;
@@ -801,7 +777,7 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl
   msg_process_t process = MSG_process_self();
   simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias);
 
-  int call_end = TRACE_msg_task_put_start(task);
+  TRACE_msg_task_put_start(task);
 
   /* Prepare the task to send */
   t_simdata = task->simdata;
@@ -816,8 +792,8 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl
   /* Try to send it by calling SIMIX network layer */
   try {
     smx_activity_t comm = nullptr; /* MC needs the comm to be set to nullptr during the simix call  */
-    comm = simcall_comm_isend(SIMIX_process_self(), mailbox->getImpl(),t_simdata->bytes_amount,
-                              t_simdata->rate, task, sizeof(void *), nullptr, nullptr, nullptr, task, 0);
+    comm = simcall_comm_isend(SIMIX_process_self(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task,
+                              sizeof(void*), nullptr, nullptr, nullptr, nullptr, 0);
     if (TRACE_is_enabled())
       simcall_set_category(comm, task->category);
     t_simdata->comm = boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(comm);
@@ -842,8 +818,7 @@ msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char *alias, doubl
     t_simdata->setNotUsed();
   }
 
-  if (call_end)
-    TRACE_msg_task_put_end();
+  TRACE_msg_task_put_end();
   return ret;
 }
 
@@ -938,4 +913,3 @@ const char *MSG_task_get_category (msg_task_t task)
 {
   return task->category;
 }
-}
diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp
deleted file mode 100644 (file)
index 784265c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (c) 2004-2017. 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/s4u/Host.hpp"
-#include "simgrid/s4u/Storage.hpp"
-#include "src/msg/msg_private.hpp"
-#include "src/simix/ActorImpl.hpp"
-#include "src/simix/smx_host_private.hpp"
-
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
-
-extern "C" {
-
-/** @addtogroup m_host_management
- * (#msg_host_t) and the functions for managing it.
- *
- *  A <em>location</em> (or <em>host</em>) is any possible place where  a process may run. Thus it may be represented
- *  as a <em>physical resource with computing capabilities</em>, some <em>mailboxes</em> to enable running process to
- *  communicate with remote ones, and some <em>private data</em> that can be only accessed by local process.
- *  \see msg_host_t
- */
-
-/********************************* Host **************************************/
-
-/** \ingroup m_host_management
- * \brief Return the list of processes attached to an host.
- *
- * \param host a host
- * \param whereto a dynar in which we should push processes living on that host
- */
-void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto)
-{
-  xbt_assert((host != nullptr), "Invalid parameters");
-  for (auto& actor : host->extension<simgrid::simix::Host>()->process_list) {
-    msg_process_t p = actor.ciface();
-    xbt_dynar_push(whereto, &p);
-  }
-}
-
-/** \ingroup m_host_management
- * \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
- *
- * \param  host host to test
- * \param pstate_index pstate to test
- * \return Returns the processor speed associated with pstate_index
- */
-double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
-  xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
-  return host->getPstateSpeed(pstate_index);
-}
-
-}
diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp
new file mode 100644 (file)
index 0000000..7f65062
--- /dev/null
@@ -0,0 +1,306 @@
+/* Copyright (c) 2004-2018. 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 "src/msg/msg_private.hpp"
+
+#define MSG_CALL(type, oldname, args)
+
+/* ************************** Actors *************************** */
+int MSG_process_get_PID(sg_actor_t actor)
+{
+  return sg_actor_get_PID(actor);
+}
+int MSG_process_get_PPID(sg_actor_t actor)
+{
+  return sg_actor_get_PPID(actor);
+}
+const char* MSG_process_get_name(sg_actor_t actor)
+{
+  return sg_actor_get_name(actor);
+}
+sg_host_t MSG_process_get_host(sg_actor_t actor)
+{
+  return sg_actor_get_host(actor);
+}
+xbt_dict_t MSG_process_get_properties(sg_actor_t actor)
+{
+  return sg_actor_get_properties(actor);
+}
+const char* MSG_process_get_property_value(sg_actor_t actor, const char* name)
+{
+  return sg_actor_get_property_value(actor, name);
+}
+void MSG_process_suspend(sg_actor_t actor)
+{
+  sg_actor_suspend(actor);
+}
+void MSG_process_resume(sg_actor_t actor)
+{
+  sg_actor_resume(actor);
+}
+int MSG_process_is_suspended(sg_actor_t actor)
+{
+  return sg_actor_is_suspended(actor);
+}
+void MSG_process_restart(sg_actor_t actor)
+{
+  sg_actor_restart(actor);
+}
+void MSG_process_daemonize(sg_actor_t actor)
+{
+  sg_actor_daemonize(actor);
+}
+void MSG_process_migrate(sg_actor_t actor, sg_host_t host)
+{
+  sg_actor_migrate(actor, host);
+}
+void MSG_process_join(sg_actor_t actor, double timeout)
+{
+  sg_actor_join(actor, timeout);
+}
+void MSG_process_kill(sg_actor_t actor)
+{
+  sg_actor_kill(actor);
+}
+
+void MSG_process_set_kill_time(sg_actor_t actor, double kill_time)
+{
+  sg_actor_set_kill_time(actor, kill_time);
+}
+
+/* ************************** NetZones *************************** */
+sg_netzone_t MSG_zone_get_root()
+{
+  return sg_zone_get_root();
+}
+const char* MSG_zone_get_name(sg_netzone_t zone)
+{
+  return sg_zone_get_name(zone);
+}
+sg_netzone_t MSG_zone_get_by_name(const char* name)
+{
+  return sg_zone_get_by_name(name);
+}
+void MSG_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto)
+{
+  return sg_zone_get_sons(zone, whereto);
+}
+const char* MSG_zone_get_property_value(sg_netzone_t zone, const char* name)
+{
+  return sg_zone_get_property_value(zone, name);
+}
+void MSG_zone_set_property_value(sg_netzone_t zone, const char* name, char* value)
+{
+  sg_zone_set_property_value(zone, name, value);
+}
+void MSG_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto)
+{
+  sg_zone_get_hosts(zone, whereto);
+}
+
+/* ************************** Storages *************************** */
+const char* MSG_storage_get_name(sg_storage_t storage)
+{
+  return sg_storage_get_name(storage);
+}
+sg_storage_t MSG_storage_get_by_name(const char* name)
+{
+  return sg_storage_get_by_name(name);
+}
+xbt_dict_t MSG_storage_get_properties(sg_storage_t storage)
+{
+  return sg_storage_get_properties(storage);
+}
+void MSG_storage_set_property_value(sg_storage_t storage, const char* name, const char* value)
+{
+  sg_storage_set_property_value(storage, name, value);
+}
+const char* MSG_storage_get_property_value(sg_storage_t storage, const char* name)
+{
+  return sg_storage_get_property_value(storage, name);
+}
+xbt_dynar_t MSG_storages_as_dynar()
+{
+  return sg_storages_as_dynar();
+}
+void MSG_storage_set_data(sg_storage_t storage, void* data)
+{
+  sg_storage_set_data(storage, data);
+}
+void* MSG_storage_get_data(sg_storage_t storage)
+{
+  return sg_storage_get_data(storage);
+}
+const char* MSG_storage_get_host(sg_storage_t storage)
+{
+  return sg_storage_get_host(storage);
+}
+sg_size_t MSG_storage_read(sg_storage_t storage, sg_size_t size)
+{
+  return sg_storage_read(storage, size);
+}
+sg_size_t MSG_storage_write(sg_storage_t storage, sg_size_t size)
+{
+  return sg_storage_write(storage, size);
+}
+
+/* ************************** hosts *************************** */
+xbt_dynar_t MSG_hosts_as_dynar()
+{
+  return sg_hosts_as_dynar();
+}
+size_t MSG_get_host_number()
+{
+  return sg_host_count();
+}
+sg_host_t MSG_get_host_by_name(const char* name)
+{
+  return sg_host_by_name(name);
+}
+sg_host_t MSG_host_by_name(const char* name)
+{
+  return sg_host_by_name(name);
+}
+const char* MSG_host_get_name(sg_host_t host)
+{
+  return sg_host_get_name(host);
+}
+void* MSG_host_get_data(sg_host_t host)
+{
+  return sg_host_user(host);
+}
+void MSG_host_set_data(sg_host_t host, void* data)
+{
+  return sg_host_user_set(host, data);
+}
+xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host)
+{
+  return sg_host_get_mounted_storage_list(host);
+}
+xbt_dynar_t MSG_host_get_attached_storage_lists(sg_host_t host)
+{
+  return sg_host_get_attached_storage_list(host);
+}
+double MSG_host_get_speed(sg_host_t host)
+{
+  return sg_host_speed(host);
+}
+double MSG_host_get_power_peak_at(sg_host_t host, int pstate_index)
+{
+  return sg_host_get_pstate_speed(host, pstate_index);
+}
+int MSG_host_get_core_number(sg_host_t host)
+{
+  return sg_host_core_count(host);
+}
+int MSG_host_get_nb_pstates(sg_host_t host)
+{
+  return sg_host_get_nb_pstates(host);
+}
+int MSG_host_get_pstate(sg_host_t host)
+{
+  return sg_host_get_pstate(host);
+}
+void MSG_host_set_pstate(sg_host_t host, int pstate)
+{
+  sg_host_set_pstate(host, pstate);
+}
+void MSG_host_on(sg_host_t h)
+{
+  sg_host_turn_on(h);
+}
+void MSG_host_off(sg_host_t h)
+{
+  sg_host_turn_off(h);
+}
+int MSG_host_is_on(sg_host_t h)
+{
+  return sg_host_is_on(h);
+}
+int MSG_host_is_off(sg_host_t h)
+{
+  return sg_host_is_off(h);
+}
+xbt_dict_t MSG_host_get_properties(sg_host_t host)
+{
+  return sg_host_get_properties(host);
+}
+const char* MSG_host_get_property_value(sg_host_t host, const char* name)
+{
+  return sg_host_get_property_value(host, name);
+}
+void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value)
+{
+  sg_host_set_property_value(host, name, value);
+}
+void MSG_host_get_process_list(sg_host_t host, xbt_dynar_t whereto)
+{
+  sg_host_get_actor_list(host, whereto);
+}
+sg_host_t MSG_host_self()
+{
+  return sg_host_self();
+}
+/* ************************** Virtual Machines *************************** */
+sg_vm_t MSG_vm_create_core(sg_host_t pm, const char* name)
+{
+  return sg_vm_create_core(pm, name);
+}
+sg_vm_t MSG_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
+{
+  return sg_vm_create_multicore(pm, name, coreAmount);
+}
+int MSG_vm_is_created(sg_vm_t vm)
+{
+  return sg_vm_is_created(vm);
+}
+int MSG_vm_is_running(sg_vm_t vm)
+{
+  return sg_vm_is_running(vm);
+}
+int MSG_vm_is_suspended(sg_vm_t vm)
+{
+  return sg_vm_is_suspended(vm);
+}
+const char* MSG_vm_get_name(sg_vm_t vm)
+{
+  return sg_vm_get_name(vm);
+}
+void MSG_vm_set_ramsize(sg_vm_t vm, size_t size)
+{
+  sg_vm_set_ramsize(vm, size);
+}
+size_t MSG_vm_get_ramsize(sg_vm_t vm)
+{
+  return sg_vm_get_ramsize(vm);
+}
+sg_host_t MSG_vm_get_pm(sg_vm_t vm)
+{
+  return sg_vm_get_pm(vm);
+}
+void MSG_vm_set_bound(sg_vm_t vm, double bound)
+{
+  sg_vm_set_bound(vm, bound);
+}
+void MSG_vm_start(sg_vm_t vm)
+{
+  sg_vm_start(vm);
+}
+void MSG_vm_suspend(sg_vm_t vm)
+{
+  sg_vm_suspend(vm);
+}
+void MSG_vm_resume(sg_vm_t vm)
+{
+  sg_vm_resume(vm);
+}
+void MSG_vm_shutdown(sg_vm_t vm)
+{
+  sg_vm_shutdown(vm);
+}
+void MSG_vm_destroy(sg_vm_t vm)
+{
+  sg_vm_destroy(vm);
+}
index b99055d..0446eb9 100644 (file)
@@ -1,6 +1,6 @@
 /* Mailboxes in MSG */
 
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
@@ -10,8 +10,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
 
-extern "C" {
-
 /** \ingroup msg_mailbox_management
  * \brief Set the mailbox to receive in asynchronous mode
  *
@@ -25,4 +23,3 @@ void MSG_mailbox_set_async(const char *alias){
   simgrid::s4u::Mailbox::byName(alias)->setReceiver(simgrid::s4u::Actor::self());
   XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
 }
-}
index cf12610..c549ed1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -84,12 +84,7 @@ struct s_MSG_Global_t {
 };
 typedef s_MSG_Global_t* MSG_Global_t;
 
-XBT_PRIVATE void TRACE_msg_process_create(std::string process_name, int process_pid, msg_host_t host);
-XBT_PRIVATE void TRACE_msg_process_destroy(std::string process_name, int process_pid);
-
-extern "C" {
-
-XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
+XBT_PUBLIC_DATA MSG_Global_t msg_global;
 
 /*************************************************************/
 XBT_PRIVATE void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_proc);
@@ -107,13 +102,11 @@ XBT_PRIVATE void TRACE_msg_task_execute_end(msg_task_t task);
 XBT_PRIVATE void TRACE_msg_task_destroy(msg_task_t task);
 XBT_PRIVATE void TRACE_msg_task_get_end(msg_task_t task);
 XBT_PRIVATE void TRACE_msg_task_get_start();
-XBT_PRIVATE int TRACE_msg_task_put_start(msg_task_t task); // returns TRUE if the task_put_end must be called
+XBT_PRIVATE void TRACE_msg_task_put_start(msg_task_t task);
 XBT_PRIVATE void TRACE_msg_task_put_end();
 
 /* declaration of instrumentation functions from msg_process_instr.c */
-XBT_PRIVATE void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host);
 XBT_PRIVATE void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t process);
-}
 
 inline void s_simdata_task_t::setUsed()
 {
index 78ea89d..a9e2a3c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -10,8 +10,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
 
-extern "C" {
-
 /** @addtogroup m_process_management
  *
  *  Processes (#msg_process_t) are independent agents that can do stuff on their own. They are in charge of executing
@@ -40,7 +38,9 @@ void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_actor)
     simcall_process_set_data(smx_actor, nullptr);
   }
 
-  TRACE_msg_process_destroy(smx_actor->name, smx_actor->pid);
+  if (TRACE_actor_is_enabled())
+    simgrid::instr::Container::byName(instr_pid(smx_actor->ciface()))->removeFromParent();
+
   // free the data if a function was provided
   if (msg_actor && msg_actor->data && msg_global->process_data_cleanup) {
     msg_global->process_data_cleanup(msg_actor->data);
@@ -139,7 +139,6 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun
   xbt_free(argv);
   return res;
 }
-}
 
 msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data, msg_host_t host,
                                               std::map<std::string, std::string>* properties)
@@ -158,8 +157,6 @@ msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<vo
   return process->ciface();
 }
 
-extern "C" {
-
 /* Become a process in the simulation
  *
  * Currently this can only be called by the main thread (once) and only work with some thread factories
@@ -197,40 +194,6 @@ void MSG_process_detach()
   SIMIX_process_detach();
 }
 
-/** \ingroup m_process_management
- * \param process poor victim
- *
- * This function simply kills a \a process... scary isn't it ? :)
- */
-void MSG_process_kill(msg_process_t process)
-{
-  process->kill();
-}
-
-/**
-* \brief Wait for the completion of a #msg_process_t.
-*
-* \param process the process to wait for
-* \param timeout wait until the process is over, or the timeout occurs
-*/
-msg_error_t MSG_process_join(msg_process_t process, double timeout){
-  process->join(timeout);
-  return MSG_OK;
-}
-
-/** \ingroup m_process_management
- * \brief Migrates a process to another location.
- *
- * This function checks whether \a process and \a host are valid pointers and change the value of the #msg_host_t on
- * which \a process is running.
- */
-msg_error_t MSG_process_migrate(msg_process_t process, msg_host_t host)
-{
-  TRACE_msg_process_change_host(process, host);
-  process->migrate(host);
-  return MSG_OK;
-}
-
 /** Yield the current actor; let the other actors execute first */
 void MSG_process_yield()
 {
@@ -272,17 +235,9 @@ msg_error_t MSG_process_set_data(msg_process_t process, void *data)
  * \brief Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
  * \param data_cleanup a cleanup function for the userdata of a process, or nullptr to call no function
  */
-XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup) {
-  msg_global->process_data_cleanup = data_cleanup;
-}
-
-msg_host_t MSG_process_get_host(msg_process_t process)
+XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup)
 {
-  if (process == nullptr) {
-    return SIMIX_process_self()->host;
-  } else {
-    return process->getHost();
-  }
+  msg_global->process_data_cleanup = data_cleanup;
 }
 
 /** \ingroup m_process_management
@@ -314,83 +269,6 @@ int MSG_process_get_number()
   return SIMIX_process_count();
 }
 
-/** \ingroup m_process_management
- * \brief Set the kill time of a process.
- *
- * \param process a process
- * \param kill_time the time when the process is killed.
- */
-msg_error_t MSG_process_set_kill_time(msg_process_t process, double kill_time)
-{
-  process->setKillTime(kill_time);
-  return MSG_OK;
-}
-
-/** \ingroup m_process_management
- * \brief Returns the process ID of \a process.
- *
- * This function checks whether \a process is a valid pointer and return its PID (or 0 in case of problem).
- */
-int MSG_process_get_PID(msg_process_t process)
-{
-  /* Do not raise an exception here: this function is called by the logs
-   * and the exceptions, so it would be called back again and again */
-  if (process == nullptr || process->getImpl() == nullptr)
-    return 0;
-  return process->getPid();
-}
-
-/** \ingroup m_process_management
- * \brief Returns the process ID of the parent of \a process.
- *
- * This function checks whether \a process is a valid pointer and return its PID.
- * Returns -1 if the process has not been created by any other process.
- */
-int MSG_process_get_PPID(msg_process_t process)
-{
-  return process->getPpid();
-}
-
-/** \ingroup m_process_management
- * \brief Return the name of a process.
- *
- * This function checks whether \a process is a valid pointer and return its name.
- */
-const char *MSG_process_get_name(msg_process_t process)
-{
-  return process->getCname();
-}
-
-/** \ingroup m_process_management
- * \brief Returns the value of a given process property
- *
- * \param process a process
- * \param name a property name
- * \return value of a property (or nullptr if the property is not set)
- */
-const char *MSG_process_get_property_value(msg_process_t process, const char *name)
-{
-  return process->getProperty(name);
-}
-
-/** \ingroup m_process_management
- * \brief Return the list of properties
- *
- * This function returns all the parameters associated with a process
- */
-xbt_dict_t MSG_process_get_properties(msg_process_t process)
-{
-  xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
-  xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
-  std::map<std::string, std::string>* props = process->getProperties();
-  if (props == nullptr)
-    return nullptr;
-  for (auto const& elm : *props) {
-    xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
-  }
-  return as_dict;
-}
-
 /** \ingroup m_process_management
  * \brief Return the PID of the current process.
  *
@@ -430,41 +308,7 @@ msg_process_t MSG_process_self()
   return SIMIX_process_self()->ciface();
 }
 
-/** \ingroup m_process_management
- * \brief Suspend the process.
- *
- * This function suspends the process by suspending the task on which it was waiting for the completion.
- */
-msg_error_t MSG_process_suspend(msg_process_t process)
-{
-  xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
-  process->suspend();
-  return MSG_OK;
-}
-
-/** \ingroup m_process_management
- * \brief Resume a suspended process.
- *
- * This function resumes a suspended process by resuming the task on which it was waiting for the completion.
- */
-msg_error_t MSG_process_resume(msg_process_t process)
-{
-  xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr");
-  process->resume();
-  return MSG_OK;
-}
-
-/** \ingroup m_process_management
- * \brief Returns true if the process is suspended .
- *
- * This checks whether a process is suspended or not by inspecting the task on which it was waiting for the completion.
- */
-int MSG_process_is_suspended(msg_process_t process)
-{
-  return process->isSuspended();
-}
-
-smx_context_t MSG_process_get_smx_ctx(msg_process_t process) {
+smx_context_t MSG_process_get_smx_ctx(msg_process_t process) { // deprecated -- smx_context_t should die afterward
   return process->getImpl()->context;
 }
 /**
@@ -481,37 +325,22 @@ void MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data) {
  * \brief Sets the "auto-restart" flag of the process.
  * If the flag is set to 1, the process will be automatically restarted when its host comes back up.
  */
-XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart) {
-  process->setAutoRestart(auto_restart);
-}
-/**
- * \ingroup m_process_management
- * \brief Restarts a process from the beginning.
- */
-XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) {
-  return process->restart();
-}
-
-/** @ingroup m_process_management
- * @brief This process will be terminated automatically when the last non-daemon process finishes
- */
-XBT_PUBLIC(void) MSG_process_daemonize(msg_process_t process)
+XBT_PUBLIC void MSG_process_auto_restart_set(msg_process_t process, int auto_restart)
 {
-  process->daemonize();
+  process->setAutoRestart(auto_restart);
 }
 
 /** @ingroup m_process_management
  * @brief Take an extra reference on that process to prevent it to be garbage-collected
  */
-XBT_PUBLIC(void) MSG_process_ref(msg_process_t process)
+XBT_PUBLIC void MSG_process_ref(msg_process_t process)
 {
   intrusive_ptr_add_ref(process);
 }
 /** @ingroup m_process_management
  * @brief Release a reference on that process so that it can get be garbage-collected
  */
-XBT_PUBLIC(void) MSG_process_unref(msg_process_t process)
+XBT_PUBLIC void MSG_process_unref(msg_process_t process)
 {
   intrusive_ptr_release(process);
 }
-}
index 3e1d68b..679cb34 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -7,8 +7,6 @@
 #include "src/simix/smx_private.hpp"
 #include <algorithm>
 
-extern "C" {
-
 /** @addtogroup m_task_management
  *
  *  Since most scheduling algorithms rely on a concept of task  that can be either <em>computed</em> locally or
@@ -333,4 +331,3 @@ void MSG_task_set_bound(msg_task_t task, double bound)
   if (task->simdata->compute)
     simcall_execution_set_bound(task->simdata->compute, task->simdata->bound);
 }
-}
diff --git a/src/plugins/file_system/FileSystem.hpp b/src/plugins/file_system/FileSystem.hpp
deleted file mode 100644 (file)
index 6535c3d..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (c) 2006-2015. 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. */
-
-#ifndef SIMGRID_S4U_FILE_HPP
-#define SIMGRID_S4U_FILE_HPP
-
-#include "simgrid/plugins/file_system.h"
-#include <xbt/Extendable.hpp>
-#include <xbt/base.h>
-
-#include <simgrid/simix.h>
-#include <string>
-
-namespace simgrid {
-namespace s4u {
-
-/** @brief A simulated file
- *
- * Used to simulate the time it takes to access to a file, but does not really store any information.
- *
- * They are located on @ref simgrid::s4u::Storage that are accessed from a given @ref simgrid::s4u::Host through
- * mountpoints.
- * For now, you cannot change the mountpoints programatically, and must declare them from your platform file.
- */
-XBT_PUBLIC_CLASS File
-{
-public:
-  File(std::string fullpath, void* userdata);
-  File(std::string fullpath, sg_host_t host, void* userdata);
-  ~File();
-
-  /** Retrieves the path to the file */
-  const char* getPath() { return fullpath_.c_str(); }
-
-  /** Simulates a local read action. Returns the size of data actually read */
-  sg_size_t read(sg_size_t size);
-
-  /** Simulates a write action. Returns the size of data actually written. */
-  sg_size_t write(sg_size_t size);
-
-  /** Allows to store user data on that host */
-  void setUserdata(void* data) { userdata_ = data; }
-  /** Retrieves the previously stored data */
-  void* getUserdata() { return userdata_; }
-
-  sg_size_t size();
-  void seek(sg_offset_t pos);             /** Sets the file head to the given position. */
-  void seek(sg_offset_t pos, int origin); /** Sets the file head to the given position from a given origin. */
-  sg_size_t tell();                       /** Retrieves the current file position */
-
-  /** Rename a file. WARNING: It is forbidden to move the file to another mount point */
-  void move(std::string fullpath);
-  int remoteCopy(sg_host_t host, const char* fullpath);
-  int remoteMove(sg_host_t host, const char* fullpath);
-
-  int unlink(); /** Remove a file from the contents of a disk */
-  void dump();
-
-  int desc_id = 0;
-  Storage* localStorage;
-  std::string mount_point_;
-
-private:
-  sg_size_t size_;
-  std::string path_;
-  std::string fullpath_;
-  sg_size_t current_position_ = SEEK_SET;
-  void* userdata_             = nullptr;
-};
-
-XBT_PUBLIC_CLASS FileSystemStorageExt {
-public:
-  static simgrid::xbt::Extension<Storage, FileSystemStorageExt> EXTENSION_ID;
-  explicit FileSystemStorageExt(Storage* ptr);
-  ~FileSystemStorageExt();
-  std::map<std::string, sg_size_t>* parseContent(std::string filename);
-  std::map<std::string, sg_size_t>* getContent() { return content_; }
-  sg_size_t getSize() { return size_; }
-  sg_size_t getUsedSize() { return usedSize_; }
-  void decrUsedSize(sg_size_t size) { usedSize_ -= size; }
-  void incrUsedSize(sg_size_t size) { usedSize_ += size; }
-private:
-  std::map<std::string, sg_size_t>* content_;
-  sg_size_t usedSize_ = 0;
-  sg_size_t size_     = 0;
-};
-
-XBT_PUBLIC_CLASS FileDescriptorHostExt
-{
-public:
-  static simgrid::xbt::Extension<Host, FileDescriptorHostExt> EXTENSION_ID;
-  FileDescriptorHostExt() = default;
-  ~FileDescriptorHostExt() { delete file_descriptor_table; }
-  std::vector<int>* file_descriptor_table = nullptr; // Created lazily on need
-};
-}
-} // namespace simgrid::s4u
-
-#endif /* SIMGRID_S4U_HOST_HPP */
index bcb6879..947ea06 100644 (file)
@@ -1,15 +1,15 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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 "xbt/log.h"
 
+#include "simgrid/plugins/file_system.h"
 #include "simgrid/s4u/Actor.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.hpp"
-#include "src/plugins/file_system/FileSystem.hpp"
 #include "src/surf/HostImpl.hpp"
 
 #include <algorithm>
@@ -350,8 +350,6 @@ static void onHostCreation(simgrid::s4u::Host& host)
 }
 
 /* **************************** Public interface *************************** */
-SG_BEGIN_DECL()
-
 void sg_storage_file_system_init()
 {
   if (not FileSystemStorageExt::EXTENSION_ID.valid()) {
@@ -505,5 +503,3 @@ xbt_dict_t sg_host_get_storage_content(sg_host_t host)
 
   return contents;
 }
-
-SG_END_DECL()
index f4c0dd6..6eeac3d 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2018. 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. */
@@ -62,7 +61,7 @@ VMModel::VMModel()
   s4u::Host::onStateChange.connect(hostStateChange);
 }
 
-double VMModel::nextOccuringEvent(double now)
+double VMModel::next_occuring_event(double now)
 {
   /* TODO: update action's cost with the total cost of processes on the VM. */
 
@@ -93,12 +92,13 @@ double VMModel::nextOccuringEvent(double now)
     surf::Cpu* cpu = ws_vm->pimpl_cpu;
     xbt_assert(cpu, "cpu-less host");
 
-    double solved_value = ws_vm->getImpl()->action_->getVariable()->get_value(); // this is X1 in comment above, what
-                                                                                 // this VM got in the sharing on the PM
+    double solved_value =
+        ws_vm->getImpl()->action_->get_variable()->get_value(); // this is X1 in comment above, what
+                                                                // this VM got in the sharing on the PM
     XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getCname(), ws_vm->getPm()->getCname());
 
     xbt_assert(cpu->model() == surf_cpu_model_vm);
-    lmm_system_t vcpu_system = cpu->model()->getMaxminSystem();
+    kernel::lmm::System* vcpu_system = cpu->model()->get_maxmin_system();
     vcpu_system->update_constraint_bound(cpu->constraint(), virt_overhead * solved_value);
   }
 
@@ -106,7 +106,7 @@ double VMModel::nextOccuringEvent(double now)
   ignoreEmptyVmInPmLMM();
 
   /* 3. Ready. Get the next occurring event */
-  return surf_cpu_model_vm->nextOccuringEvent(now);
+  return surf_cpu_model_vm->next_occuring_event(now);
 }
 
 /************
@@ -260,14 +260,14 @@ void VirtualMachineImpl::setPm(s4u::Host* destination)
   surf::CpuAction* new_cpu_action =
       static_cast<surf::CpuAction*>(destination->pimpl_cpu->execution_start(0, this->coreAmount_));
 
-  if (action_->getRemainsNoUpdate() > 0)
-    XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->getRemainsNoUpdate());
+  if (action_->get_remains_no_update() > 0)
+    XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->get_remains_no_update());
 
   /* keep the bound value of the cpu action of the VM. */
-  double old_bound = action_->getBound();
+  double old_bound = action_->get_bound();
   if (old_bound > 0) {
     XBT_DEBUG("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst);
-    new_cpu_action->setBound(old_bound);
+    new_cpu_action->set_bound(old_bound);
   }
 
   XBT_ATTRIB_UNUSED int ret = action_->unref();
@@ -280,7 +280,7 @@ void VirtualMachineImpl::setPm(s4u::Host* destination)
 
 void VirtualMachineImpl::setBound(double bound)
 {
-  action_->setBound(bound);
+  action_->set_bound(bound);
 }
 
 }
index 3ffbfde..575103b 100644 (file)
@@ -27,8 +27,7 @@ namespace vm {
  * @brief SURF VM interface class
  * @details A VM represent a virtual machine
  */
-XBT_PUBLIC_CLASS VirtualMachineImpl : public surf::HostImpl, public simgrid::xbt::Extendable<VirtualMachineImpl>
-{
+class XBT_PUBLIC VirtualMachineImpl : public surf::HostImpl, public simgrid::xbt::Extendable<VirtualMachineImpl> {
   friend simgrid::s4u::VirtualMachine;
 
 public:
@@ -36,13 +35,13 @@ public:
   ~VirtualMachineImpl();
 
   /** @brief Suspend the VM */
-  virtual void suspend(simgrid::simix::ActorImpl* issuer);
+  virtual void suspend(simgrid::kernel::actor::ActorImpl* issuer);
 
   /** @brief Resume the VM */
   virtual void resume();
 
   /** @brief Shutdown the VM */
-  virtual void shutdown(simgrid::simix::ActorImpl* issuer);
+  virtual void shutdown(simgrid::kernel::actor::ActorImpl* issuer);
 
   /** @brief Change the physical host on which the given VM is running */
   virtual void setPm(s4u::Host* dest);
@@ -101,12 +100,12 @@ public:
   VMModel();
   void ignoreEmptyVmInPmLMM() override{};
 
-  double nextOccuringEvent(double now) override;
-  void updateActionsState(double /*now*/, double /*delta*/) override{};
+  double next_occuring_event(double now) override;
+  void update_actions_state(double /*now*/, double /*delta*/) override{};
 };
 }
 }
 
-XBT_PUBLIC_DATA(simgrid::vm::VMModel*) surf_vm_model;
+XBT_PUBLIC_DATA simgrid::vm::VMModel* surf_vm_model;
 
 #endif /* VM_INTERFACE_HPP_ */
index e890dd4..b584d69 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,6 +6,7 @@
 #include <simgrid/plugins/live_migration.h>
 #include <simgrid/s4u.hpp>
 #include <simgrid/s4u/VirtualMachine.hpp>
+#include <simgrid/vm.h>
 #include <src/instr/instr_private.hpp>
 #include <src/plugins/vm/VirtualMachineImpl.hpp>
 #include <src/plugins/vm/VmHostExt.hpp>
@@ -56,7 +57,7 @@ void MigrationRx::operator()()
   vm_->getImpl()->isMigrating = false;
   XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm_->getCname(), src_pm_->getCname(), dst_pm_->getCname());
 
-  if (TRACE_msg_vm_is_enabled()) {
+  if (TRACE_vm_is_enabled()) {
     static long long int counter = 0;
     std::string key              = std::to_string(counter);
     counter++;
@@ -66,9 +67,7 @@ void MigrationRx::operator()()
     simgrid::instr::Container::getRoot()->getLink("MSG_VM_LINK")->startEvent(msg, "M", key);
 
     // destroy existing container of this vm
-    container_t existing_container = simgrid::instr::Container::byName(vm_->getName());
-    existing_container->removeFromParent();
-    delete existing_container;
+    simgrid::instr::Container::byName(vm_->getName())->removeFromParent();
 
     // create new container on the new_host location
     new simgrid::instr::Container(vm_->getCname(), "MSG_VM", simgrid::instr::Container::byName(dst_pm_->getName()));
@@ -288,8 +287,6 @@ void MigrationTx::operator()()
 }
 }
 
-SG_BEGIN_DECL()
-
 static void onVirtualMachineShutdown(simgrid::s4u::VirtualMachine* vm)
 {
   if (vm->getImpl()->isMigrating) {
@@ -321,7 +318,7 @@ simgrid::s4u::VirtualMachine* sg_vm_create_migratable(simgrid::s4u::Host* pm, co
 
   /* For the moment, intensity_rate is the percentage against the migration bandwidth */
 
-  msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast<sg_size_t>(ramsize) * 1024 * 1024);
+  sg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast<sg_size_t>(ramsize) * 1024 * 1024);
   sg_vm_set_dirty_page_intensity(vm, dp_intensity / 100.0);
   sg_vm_set_working_set_memory(vm, vm->getRamsize() * 0.9); // assume working set memory is 90% of ramsize
   sg_vm_set_migration_speed(vm, mig_netspeed * 1024 * 1024.0);
@@ -373,5 +370,3 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm)
 
   vm->getImpl()->isMigrating = false;
 }
-
-SG_END_DECL()
index ef0d95c..c283575 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -9,6 +9,7 @@
 #include "src/plugins/vm/VmHostExt.hpp"
 #include "src/simix/smx_host_private.hpp"
 #include "src/surf/cpu_cas01.hpp"
+#include <simgrid/vm.h>
 #include <src/plugins/vm/VmLiveMigration.hpp>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_vm, "S4U virtual machines");
@@ -40,7 +41,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount,
   /* Make a process container */
   extension_set<simgrid::simix::Host>(new simgrid::simix::Host());
 
-  if (TRACE_msg_vm_is_enabled()) {
+  if (TRACE_vm_is_enabled()) {
     container_t host_container = instr::Container::byName(pm->getName());
     new instr::Container(name, "MSG_VM", host_container);
     instr::Container::byName(getName())->getState("MSG_VM_STATE")->addEntityValue("start", "0 0 1");   // start is blue
@@ -65,16 +66,13 @@ VirtualMachine::~VirtualMachine()
   /* Don't free these things twice: they are the ones of my physical host */
   pimpl_netpoint = nullptr;
 
-  if (TRACE_msg_vm_is_enabled()) {
-    container_t container = simgrid::instr::Container::byName(getName());
-    container->removeFromParent();
-    delete container;
-  }
+  if (TRACE_vm_is_enabled())
+    simgrid::instr::Container::byName(getName())->removeFromParent();
 }
 
 void VirtualMachine::start()
 {
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->pushEvent("start");
 
   simgrid::simix::kernelImmediate([this]() {
@@ -106,7 +104,7 @@ void VirtualMachine::start()
     this->pimpl_vm_->setState(SURF_VM_STATE_RUNNING);
   });
 
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->popEvent();
 }
 
@@ -114,7 +112,7 @@ void VirtualMachine::suspend()
 {
   smx_actor_t issuer = SIMIX_process_self();
   simgrid::simix::kernelImmediate([this, issuer]() { pimpl_vm_->suspend(issuer); });
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->pushEvent("suspend");
   XBT_DEBUG("vm_suspend done");
 }
@@ -122,7 +120,7 @@ void VirtualMachine::suspend()
 void VirtualMachine::resume()
 {
   pimpl_vm_->resume();
-  if (TRACE_msg_vm_is_enabled())
+  if (TRACE_vm_is_enabled())
     simgrid::instr::Container::byName(getName())->getState("MSG_VM_STATE")->popEvent();
 }
 
@@ -202,18 +200,17 @@ void VirtualMachine::setBound(double bound)
 
 /* **************************** Public C interface *************************** */
 
-SG_BEGIN_DECL()
 /** @brief Create a new VM object with the default parameters
  * A VM is treated as a host. The name of the VM must be unique among all hosts.
  */
-msg_vm_t sg_vm_create_core(sg_host_t pm, const char* name)
+sg_vm_t sg_vm_create_core(sg_host_t pm, const char* name)
 {
   return sg_vm_create_multicore(pm, name, 1);
 }
 /** @brief Create a new VM object with the default parameters, but with a specified amount of cores
  * A VM is treated as a host. The name of the VM must be unique among all hosts.
  */
-msg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
+sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
 {
   xbt_assert(sg_host_by_name(name) == nullptr,
              "Cannot create a VM named %s: this name is already used by an host or a VM", name);
@@ -308,4 +305,3 @@ void sg_vm_destroy(sg_vm_t vm)
 {
   vm->destroy();
 }
-SG_END_DECL()
index 57a78fe..6a9fd4d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
@@ -36,7 +36,7 @@ ActorPtr Actor::self()
 
 ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function<void()> code)
 {
-  simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
@@ -44,7 +44,7 @@ ActorPtr Actor::createActor(const char* name, s4u::Host* host, const char* funct
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
   simgrid::simix::ActorCode code = factory(std::move(args));
-  simgrid::simix::ActorImpl* actor          = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::kernel::actor::ActorImpl* actor  = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
@@ -88,6 +88,23 @@ void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data)
  */
 void Actor::migrate(Host* new_host)
 {
+  std::string key;
+  simgrid::instr::LinkType* link = nullptr;
+  if (TRACE_actor_is_enabled()) {
+    static long long int counter = 0;
+
+    key = std::to_string(counter);
+    counter++;
+
+    // start link
+    container_t actor_container = simgrid::instr::Container::byName(instr_pid(this));
+    link                        = simgrid::instr::Container::getRoot()->getLink("ACTOR_LINK");
+    link->startEvent(actor_container, "M", key);
+
+    // destroy existing container of this process
+    actor_container->removeFromParent();
+  }
+
   simgrid::simix::kernelImmediate([this, new_host]() {
     if (pimpl_->waiting_synchro != nullptr) {
       // The actor is blocked on an activity. If it's an exec, migrate it too.
@@ -99,6 +116,13 @@ void Actor::migrate(Host* new_host)
     }
     SIMIX_process_change_host(this->pimpl_, new_host);
   });
+
+  if (TRACE_actor_is_enabled()) {
+    // create new container on the new_host location
+    simgrid::instr::Container::byName(new_host->getName())->createChild(instr_pid(this), "ACTOR");
+    // end link
+    link->endEvent(simgrid::instr::Container::byName(instr_pid(this)), "M", key);
+  }
 }
 
 s4u::Host* Actor::getHost()
@@ -139,7 +163,7 @@ aid_t Actor::getPpid()
 void Actor::suspend()
 {
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(this))->getState("MSG_PROCESS_STATE")->pushEvent("suspend");
+    simgrid::instr::Container::byName(instr_pid(this))->getState("ACTOR_STATE")->pushEvent("suspend");
 
   simcall_process_suspend(pimpl_);
 }
@@ -148,7 +172,7 @@ void Actor::resume()
 {
   simgrid::simix::kernelImmediate([this] { pimpl_->resume(); });
   if (TRACE_actor_is_enabled())
-    simgrid::instr::Container::byName(instr_pid(this))->getState("MSG_PROCESS_STATE")->popEvent();
+    simgrid::instr::Container::byName(instr_pid(this))->getState("ACTOR_STATE")->popEvent();
 }
 
 int Actor::isSuspended()
@@ -168,26 +192,28 @@ double Actor::getKillTime()
 
 void Actor::kill(aid_t pid)
 {
+  smx_actor_t killer  = SIMIX_process_self();
   smx_actor_t process = SIMIX_process_from_PID(pid);
   if(process != nullptr) {
-    simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
+    simgrid::simix::kernelImmediate([killer, process] { SIMIX_process_kill(process, killer); });
   } else {
     std::ostringstream oss;
-    oss << "kill: ("<< pid <<") - No such process" << std::endl;
+    oss << "kill: (" << pid << ") - No such actor" << std::endl;
     throw std::runtime_error(oss.str());
   }
 }
 
-smx_actor_t Actor::getImpl() {
-  return pimpl_;
-}
-
 void Actor::kill() {
   smx_actor_t process = SIMIX_process_self();
   simgrid::simix::kernelImmediate(
       [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); });
 }
 
+smx_actor_t Actor::getImpl()
+{
+  return pimpl_;
+}
+
 // ***** Static functions *****
 
 ActorPtr Actor::byPid(aid_t pid)
@@ -201,12 +227,7 @@ ActorPtr Actor::byPid(aid_t pid)
 
 void Actor::killAll()
 {
-  simcall_process_killall(1);
-}
-
-void Actor::killAll(int resetPid)
-{
-  simcall_process_killall(resetPid);
+  simcall_process_killall();
 }
 
 std::map<std::string, std::string>* Actor::getProperties()
@@ -260,7 +281,7 @@ void yield()
   simgrid::simix::kernelImmediate([] { /* do nothing*/ });
 }
 
-XBT_PUBLIC(void) sleep_until(double timeout)
+XBT_PUBLIC void sleep_until(double timeout)
 {
   double now = SIMIX_get_clock();
   if (timeout > now)
@@ -308,36 +329,6 @@ ExecPtr exec_async(double flops)
   return res;
 }
 
-void* recv(MailboxPtr chan) // deprecated
-{
-  return chan->get();
-}
-
-void* recv(MailboxPtr chan, double timeout) // deprecated
-{
-  return chan->get(timeout);
-}
-
-void send(MailboxPtr chan, void* payload, double simulatedSize) // deprecated
-{
-  chan->put(payload, simulatedSize);
-}
-
-void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout) // deprecated
-{
-  chan->put(payload, simulatedSize, timeout);
-}
-
-CommPtr isend(MailboxPtr chan, void* payload, double simulatedSize) // deprecated
-{
-  return chan->put_async(payload, simulatedSize);
-}
-
-CommPtr irecv(MailboxPtr chan, void** data) // deprecated
-{
-  return chan->get_async(data);
-}
-
 aid_t getPid()
 {
   return SIMIX_process_self()->pid;
@@ -366,9 +357,7 @@ Host* getHost()
 void suspend()
 {
   if (TRACE_actor_is_enabled())
-    instr::Container::byName(getName() + "-" + std::to_string(getPid()))
-        ->getState("MSG_PROCESS_STATE")
-        ->pushEvent("suspend");
+    instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->pushEvent("suspend");
   simcall_process_suspend(SIMIX_process_self());
 }
 
@@ -378,7 +367,7 @@ void resume()
   simgrid::simix::kernelImmediate([process] { process->resume(); });
 
   if (TRACE_actor_is_enabled())
-    instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("MSG_PROCESS_STATE")->popEvent();
+    instr::Container::byName(getName() + "-" + std::to_string(getPid()))->getState("ACTOR_STATE")->popEvent();
 }
 
 bool isSuspended()
@@ -406,6 +395,163 @@ void migrate(Host* new_host)
 {
   SIMIX_process_self()->iface()->migrate(new_host);
 }
+
+} // namespace this_actor
+} // namespace s4u
+} // namespace simgrid
+
+/* **************************** Public C interface *************************** */
+
+/** \ingroup m_actor_management
+ * \brief Returns the process ID of \a actor.
+ *
+ * This function checks whether \a actor is a valid pointer and return its PID (or 0 in case of problem).
+ */
+int sg_actor_get_PID(sg_actor_t actor)
+{
+  /* Do not raise an exception here: this function is called by the logs
+   * and the exceptions, so it would be called back again and again */
+  if (actor == nullptr || actor->getImpl() == nullptr)
+    return 0;
+  return actor->getPid();
+}
+
+/** \ingroup m_actor_management
+ * \brief Returns the process ID of the parent of \a actor.
+ *
+ * This function checks whether \a actor is a valid pointer and return its parent's PID.
+ * Returns -1 if the actor has not been created by any other actor.
+ */
+int sg_actor_get_PPID(sg_actor_t actor)
+{
+  return actor->getPpid();
+}
+
+/** \ingroup m_actor_management
+ * \brief Return the name of an actor.
+ */
+const char* sg_actor_get_name(sg_actor_t actor)
+{
+  return actor->getCname();
+}
+
+sg_host_t sg_actor_get_host(sg_actor_t actor)
+{
+  return actor->getHost();
+}
+
+/** \ingroup m_actor_management
+ * \brief Returns the value of a given actor property
+ *
+ * \param actor an actor
+ * \param name a property name
+ * \return value of a property (or nullptr if the property is not set)
+ */
+const char* sg_actor_get_property_value(sg_actor_t actor, const char* name)
+{
+  return actor->getProperty(name);
+}
+
+/** \ingroup m_actor_management
+ * \brief Return the list of properties
+ *
+ * This function returns all the parameters associated with an actor
+ */
+xbt_dict_t sg_actor_get_properties(sg_actor_t actor)
+{
+  xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
+  xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
+  std::map<std::string, std::string>* props = actor->getProperties();
+  if (props == nullptr)
+    return nullptr;
+  for (auto const& elm : *props) {
+    xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()), nullptr);
+  }
+  return as_dict;
+}
+
+/** \ingroup m_actor_management
+ * \brief Suspend the actor.
+ *
+ * This function suspends the actor by suspending the task on which it was waiting for the completion.
+ */
+void sg_actor_suspend(sg_actor_t actor)
+{
+  xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
+  actor->suspend();
+}
+
+/** \ingroup m_actor_management
+ * \brief Resume a suspended actor.
+ *
+ * This function resumes a suspended actor by resuming the task on which it was waiting for the completion.
+ */
+void sg_actor_resume(sg_actor_t actor)
+{
+  xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
+  actor->resume();
+}
+
+/** \ingroup m_actor_management
+ * \brief Returns true if the actor is suspended .
+ *
+ * This checks whether an actor is suspended or not by inspecting the task on which it was waiting for the completion.
+ */
+int sg_actor_is_suspended(sg_actor_t actor)
+{
+  return actor->isSuspended();
+}
+
+/**
+ * \ingroup m_actor_management
+ * \brief Restarts an actor from the beginning.
+ */
+sg_actor_t sg_actor_restart(sg_actor_t actor)
+{
+  return actor->restart();
 }
+
+/** @ingroup m_actor_management
+ * @brief This actor will be terminated automatically when the last non-daemon actor finishes
+ */
+void sg_actor_daemonize(sg_actor_t actor)
+{
+  actor->daemonize();
 }
+
+/** \ingroup m_actor_management
+ * \brief Migrates an actor to another location.
+ *
+ * This function changes the value of the #sg_host_t on  which \a actor is running.
+ */
+void sg_actor_migrate(sg_actor_t process, sg_host_t host)
+{
+  process->migrate(host);
+}
+
+/** \ingroup m_actor_management
+* \brief Wait for the completion of a #sg_actor_t.
+*
+* \param actor the actor to wait for
+* \param timeout wait until the actor is over, or the timeout expires
+*/
+void sg_actor_join(sg_actor_t actor, double timeout)
+{
+  actor->join(timeout);
+}
+
+void sg_actor_kill(sg_actor_t actor)
+{
+  actor->kill();
+}
+
+/** \ingroup m_actor_management
+ * \brief Set the kill time of an actor.
+ *
+ * \param actor an actor
+ * \param kill_time the time when the actor is killed.
+ */
+void sg_actor_set_kill_time(sg_actor_t actor, double kill_time)
+{
+  actor->setKillTime(kill_time);
 }
index be0db14..f2ab1fd 100644 (file)
@@ -80,15 +80,12 @@ Activity* Comm::start()
   xbt_assert(state_ == inited);
 
   if (srcBuff_ != nullptr) { // Sender side
-    pimpl_ = simcall_comm_isend(sender_, mailbox_->getImpl(), remains_, rate_,
-        srcBuff_, srcBuffSize_,
-        matchFunction_, cleanFunction_, copyDataFunction_,
-        userData_, detached_);
+    pimpl_ = simcall_comm_isend(sender_, mailbox_->getImpl(), remains_, rate_, srcBuff_, srcBuffSize_, matchFunction_,
+                                cleanFunction_, copyDataFunction_, user_data_, detached_);
   } else if (dstBuff_ != nullptr) { // Receiver side
     xbt_assert(not detached_, "Receive cannot be detached");
-    pimpl_ = simcall_comm_irecv(receiver_, mailbox_->getImpl(), dstBuff_, &dstBuffSize_,
-        matchFunction_, copyDataFunction_,
-        userData_, rate_);
+    pimpl_ = simcall_comm_irecv(receiver_, mailbox_->getImpl(), dstBuff_, &dstBuffSize_, matchFunction_,
+                                copyDataFunction_, user_data_, rate_);
 
   } else {
     xbt_die("Cannot start a communication before specifying whether we are the sender or the receiver");
@@ -118,10 +115,10 @@ Activity* Comm::wait(double timeout)
     case inited: // It's not started yet. Do it in one simcall
       if (srcBuff_ != nullptr) {
         simcall_comm_send(sender_, mailbox_->getImpl(), remains_, rate_, srcBuff_, srcBuffSize_, matchFunction_,
-                          copyDataFunction_, userData_, timeout);
+                          copyDataFunction_, user_data_, timeout);
       } else { // Receiver
         simcall_comm_recv(receiver_, mailbox_->getImpl(), dstBuff_, &dstBuffSize_, matchFunction_, copyDataFunction_,
-                          userData_, timeout, rate_);
+                          user_data_, timeout, rate_);
       }
       state_ = finished;
       return this;
index e49b59d..221feb0 100644 (file)
@@ -1,12 +1,14 @@
 /* s4u::Engine Simulation Engine and global functions. */
 
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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 "instr/instr_interface.h"
 #include "mc/mc.h"
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Mailbox.hpp"
@@ -14,8 +16,6 @@
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.h"
 #include "src/kernel/EngineImpl.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/NetZoneImpl.hpp"
 #include "src/surf/network_interface.hpp"
 #include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
 
@@ -94,6 +94,7 @@ Engine::getHostList(std::vector<Host*>* list)
   for (auto const& kv : pimpl->hosts_)
     list->push_back(kv.second);
 }
+
 /** @brief Returns the list of all hosts found in the platform */
 std::vector<Host*> Engine::getAllHosts()
 {
@@ -102,29 +103,64 @@ std::vector<Host*> Engine::getAllHosts()
     res.push_back(kv.second);
   return res;
 }
+
 void Engine::addHost(std::string name, simgrid::s4u::Host* host)
 {
   pimpl->hosts_[name] = host;
 }
+
 void Engine::delHost(std::string name)
 {
   pimpl->hosts_.erase(name);
 }
+
 simgrid::s4u::Host* Engine::hostByName(std::string name)
 {
   return pimpl->hosts_.at(name); // Will raise a std::out_of_range if the host does not exist
 }
+
 simgrid::s4u::Host* Engine::hostByNameOrNull(std::string name)
 {
   auto host = pimpl->hosts_.find(name);
   return host == pimpl->hosts_.end() ? nullptr : host->second;
 }
 
+/** @brief Returns the list of all storages found in the platform */
+std::vector<Storage*> Engine::getAllStorages()
+{
+  std::vector<Storage*> res;
+  for (auto const& kv : pimpl->storages_)
+    res.push_back(kv.second);
+  return res;
+}
+
+simgrid::s4u::Storage* Engine::storageByName(std::string name)
+{
+  return pimpl->storages_.at(name); // Will raise a std::out_of_range if the host does not exist
+}
+
+simgrid::s4u::Storage* Engine::storageByNameOrNull(std::string name)
+{
+  auto storage = pimpl->storages_.find(name);
+  return storage == pimpl->storages_.end() ? nullptr : storage->second;
+}
+
+void Engine::addStorage(std::string name, simgrid::s4u::Storage* storage)
+{
+  pimpl->storages_[name] = storage;
+}
+
+void Engine::delStorage(std::string name)
+{
+  pimpl->storages_.erase(name);
+}
+
 /** @brief Returns the amount of links in the platform */
 size_t Engine::getLinkCount()
 {
   return simgrid::surf::LinkImpl::linksCount();
 }
+
 /** @brief Fills the passed list with all links found in the platform
  *
  *  @deprecated. Prefer Engine::getAllLinks() */
@@ -133,6 +169,7 @@ Engine::getLinkList(std::vector<Link*>* list)
 {
   simgrid::surf::LinkImpl::linksList(list);
 }
+
 /** @brief Returns the list of all links found in the platform */
 std::vector<Link*> Engine::getAllLinks()
 {
index 2e25a3d..38b14b2 100644 (file)
@@ -9,11 +9,11 @@
 
 #include <map>
 
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
 #include "src/msg/msg_private.hpp"
 #include "src/simix/ActorImpl.hpp"
 #include "src/simix/smx_private.hpp"
index b0de6a6..02e0102 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -6,7 +6,7 @@
 #include <algorithm>
 
 #include "simgrid/s4u/Link.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "simgrid/simix.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "src/surf/network_interface.hpp"
@@ -18,8 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U link
  * C API *
  *********/
 
-extern "C" {
-
 const char* sg_link_name(sg_link_t link)
 {
   return link->getCname();
@@ -68,7 +66,6 @@ void sg_link_exit()
 {
   simgrid::surf::LinkImpl::linksExit();
 }
-}
 
 /***********
  * C++ API *
index e4f6989..930acfe 100644 (file)
@@ -1,15 +1,16 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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 "xbt/log.h"
-
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/NetZone.hpp"
 #include "simgrid/simix.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
+#include "xbt/log.h"
+#include <simgrid/zone.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_netzone, "S4U Networking Zones");
 
@@ -108,5 +109,49 @@ void NetZone::addRoute(sg_netpoint_t /*src*/, sg_netpoint_t /*dst*/, sg_netpoint
 {
   xbt_die("NetZone '%s' does not accept new routes (wrong class).", name_.c_str());
 }
+
+} // namespace s4u
+} // namespace simgrid
+
+/* **************************** Public C interface *************************** */
+
+sg_netzone_t sg_zone_get_root()
+{
+  return simgrid::s4u::Engine::getInstance()->getNetRoot();
+}
+
+const char* sg_zone_get_name(sg_netzone_t netzone)
+{
+  return netzone->getCname();
+}
+
+sg_netzone_t sg_zone_get_by_name(const char* name)
+{
+  return simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(name);
+}
+
+void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
+{
+  for (auto const& elem : *netzone->getChildren()) {
+    xbt_dict_set(whereto, elem->getCname(), static_cast<void*>(elem), nullptr);
+  }
+}
+
+const char* sg_zone_get_property_value(sg_netzone_t netzone, const char* name)
+{
+  return netzone->getProperty(name);
+}
+
+void sg_zone_set_property_value(sg_netzone_t netzone, const char* name, char* value)
+{
+  netzone->setProperty(name, value);
+}
+
+void sg_zone_get_hosts(sg_netzone_t netzone, xbt_dynar_t whereto)
+{
+  /* converts vector to dynar */
+  std::vector<simgrid::s4u::Host*> hosts;
+  netzone->getHosts(&hosts);
+  for (auto const& host : hosts)
+    xbt_dynar_push(whereto, &host);
 }
-}; // namespace simgrid::s4u
index a351ae4..78b3013 100644 (file)
@@ -3,13 +3,16 @@
 /* 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/kernel/resource/Resource.hpp"
+#include "simgrid/plugins/file_system.h"
+#include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.hpp"
-#include "src/kernel/resource/Resource.hpp"
-#include "src/plugins/file_system/FileSystem.hpp"
+#include "simgrid/storage.h"
 #include "src/surf/StorageImpl.hpp"
+
+#include <string>
 #include <unordered_map>
 
 namespace simgrid {
@@ -19,28 +22,32 @@ template class Extendable<simgrid::s4u::Storage>;
 
 namespace s4u {
 
-void getStorageList(std::map<std::string, Storage*>* whereTo)
+void XBT_ATTRIB_DEPRECATED_v322(
+    "simgrid::s4u::getStorageList() is deprecated in favor of Engine::getAllStorages(). Please switch before v3.22")
+    getStorageList(std::map<std::string, Storage*>* whereTo)
+{
+  for (auto const& s : simgrid::s4u::Engine::getInstance()->getAllStorages())
+    whereTo->insert({s->getName(), s});
+}
+
+Storage::Storage(std::string name, surf::StorageImpl* pimpl) : pimpl_(pimpl), name_(name)
 {
-  for (auto const& s : *surf::StorageImpl::storagesMap())
-    whereTo->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface
+  simgrid::s4u::Engine::getInstance()->addStorage(name, this);
 }
 
 Storage* Storage::byName(std::string name)
 {
-  surf::StorageImpl* res = surf::StorageImpl::byName(name);
-  if (res == nullptr)
-    return nullptr;
-  return &res->piface_;
+  return Engine::getInstance()->storageByNameOrNull(name);
 }
 
 const std::string& Storage::getName() const
 {
-  return pimpl_->getName();
+  return name_;
 }
 
 const char* Storage::getCname() const
 {
-  return pimpl_->getCname();
+  return name_.c_str();
 }
 
 const char* Storage::getType()
@@ -88,7 +95,7 @@ simgrid::xbt::signal<void(s4u::Storage&)> Storage::onDestruction;
 } /* namespace simgrid */
 
 /* **************************** Public C interface *************************** */
-SG_BEGIN_DECL()
+
 /** @addtogroup sg_storage_management
  * (#sg_storage_t) and the functions for managing it.
  */
@@ -136,7 +143,7 @@ xbt_dict_t sg_storage_get_properties(sg_storage_t storage)
  * \param name a property name
  * \param value what to change the property to
  */
-void sg_storage_set_property_value(sg_storage_t storage, const char* name, char* value)
+void sg_storage_set_property_value(sg_storage_t storage, const char* name, const char* value)
 {
   storage->setProperty(name, value);
 }
@@ -168,12 +175,10 @@ sg_storage_t sg_storage_get_by_name(const char* name)
  */
 xbt_dynar_t sg_storages_as_dynar()
 {
-  std::map<std::string, simgrid::s4u::Storage*>* storage_list = new std::map<std::string, simgrid::s4u::Storage*>;
-  simgrid::s4u::getStorageList(storage_list);
+  std::vector<simgrid::s4u::Storage*> storage_list = simgrid::s4u::Engine::getInstance()->getAllStorages();
   xbt_dynar_t res = xbt_dynar_new(sizeof(sg_storage_t), nullptr);
-  for (auto const& s : *storage_list)
-    xbt_dynar_push(res, &(s.second));
-  delete storage_list;
+  for (auto const& s : storage_list)
+    xbt_dynar_push(res, &s);
   return res;
 }
 
@@ -197,4 +202,3 @@ sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size)
 {
   return storage->write(size);
 }
-SG_END_DECL()
index 5552c33..1d218f1 100644 (file)
 #define _FLEXML_dax_H
 
 /* XML application entry points. */
-XBT_PUBLIC(void) STag_dax__adag(void);
-XBT_PUBLIC(void) ETag_dax__adag(void);
-XBT_PUBLIC(void) STag_dax__child(void);
-XBT_PUBLIC(void) ETag_dax__child(void);
-XBT_PUBLIC(void) STag_dax__job(void);
-XBT_PUBLIC(void) ETag_dax__job(void);
-XBT_PUBLIC(void) STag_dax__parent(void);
-XBT_PUBLIC(void) ETag_dax__parent(void);
-XBT_PUBLIC(void) STag_dax__uses(void);
-XBT_PUBLIC(void) ETag_dax__uses(void);
+XBT_PUBLIC void STag_dax__adag(void);
+XBT_PUBLIC void ETag_dax__adag(void);
+XBT_PUBLIC void STag_dax__child(void);
+XBT_PUBLIC void ETag_dax__child(void);
+XBT_PUBLIC void STag_dax__job(void);
+XBT_PUBLIC void ETag_dax__job(void);
+XBT_PUBLIC void STag_dax__parent(void);
+XBT_PUBLIC void ETag_dax__parent(void);
+XBT_PUBLIC void STag_dax__uses(void);
+XBT_PUBLIC void ETag_dax__uses(void);
 
 /* XML application data. */
 typedef int AT_dax__adag_childCount;
@@ -108,90 +108,90 @@ typedef int AT_dax__uses_type;
 #define AU_dax__uses_type NULL
 
 /* FleXML-provided data. */
-XBT_PUBLIC_DATA(int) dax__pcdata_ix;
-XBT_PUBLIC_DATA(char *) dax__bufferstack;
+XBT_PUBLIC_DATA int dax__pcdata_ix;
+XBT_PUBLIC_DATA char *dax__bufferstack;
 #define dax__pcdata (dax__bufferstack + dax__pcdata_ix)
-XBT_PUBLIC_DATA(AT_dax__adag_childCount) AX_dax__adag_childCount;
+XBT_PUBLIC_DATA AT_dax__adag_childCount AX_dax__adag_childCount;
 #define A_dax__adag_childCount (dax__bufferstack + AX_dax__adag_childCount)
-XBT_PUBLIC_DATA(short int) dax__adag_childCount_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_count) AX_dax__adag_count;
+XBT_PUBLIC_DATA short int dax__adag_childCount_isset;
+XBT_PUBLIC_DATA AT_dax__adag_count AX_dax__adag_count;
 #define A_dax__adag_count (dax__bufferstack + AX_dax__adag_count)
-XBT_PUBLIC_DATA(short int) dax__adag_count_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_fileCount) AX_dax__adag_fileCount;
+XBT_PUBLIC_DATA short int dax__adag_count_isset;
+XBT_PUBLIC_DATA AT_dax__adag_fileCount AX_dax__adag_fileCount;
 #define A_dax__adag_fileCount (dax__bufferstack + AX_dax__adag_fileCount)
-XBT_PUBLIC_DATA(short int) dax__adag_fileCount_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_index) AX_dax__adag_index;
+XBT_PUBLIC_DATA short int dax__adag_fileCount_isset;
+XBT_PUBLIC_DATA AT_dax__adag_index AX_dax__adag_index;
 #define A_dax__adag_index (dax__bufferstack + AX_dax__adag_index)
-XBT_PUBLIC_DATA(short int) dax__adag_index_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_jobCount) AX_dax__adag_jobCount;
+XBT_PUBLIC_DATA short int dax__adag_index_isset;
+XBT_PUBLIC_DATA AT_dax__adag_jobCount AX_dax__adag_jobCount;
 #define A_dax__adag_jobCount (dax__bufferstack + AX_dax__adag_jobCount)
-XBT_PUBLIC_DATA(short int) dax__adag_jobCount_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_name) AX_dax__adag_name;
+XBT_PUBLIC_DATA short int dax__adag_jobCount_isset;
+XBT_PUBLIC_DATA AT_dax__adag_name AX_dax__adag_name;
 #define A_dax__adag_name (dax__bufferstack + AX_dax__adag_name)
-XBT_PUBLIC_DATA(short int) dax__adag_name_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_version) AX_dax__adag_version;
+XBT_PUBLIC_DATA short int dax__adag_name_isset;
+XBT_PUBLIC_DATA AT_dax__adag_version AX_dax__adag_version;
 #define A_dax__adag_version (dax__bufferstack + AX_dax__adag_version)
-XBT_PUBLIC_DATA(short int) dax__adag_version_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_xmlns) AX_dax__adag_xmlns;
+XBT_PUBLIC_DATA short int dax__adag_version_isset;
+XBT_PUBLIC_DATA AT_dax__adag_xmlns AX_dax__adag_xmlns;
 #define A_dax__adag_xmlns (dax__bufferstack + AX_dax__adag_xmlns)
-XBT_PUBLIC_DATA(short int) dax__adag_xmlns_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_xmlns_c_xsi) AX_dax__adag_xmlns_c_xsi;
+XBT_PUBLIC_DATA short int dax__adag_xmlns_isset;
+XBT_PUBLIC_DATA AT_dax__adag_xmlns_c_xsi AX_dax__adag_xmlns_c_xsi;
 #define A_dax__adag_xmlns_c_xsi (dax__bufferstack + AX_dax__adag_xmlns_c_xsi)
-XBT_PUBLIC_DATA(short int) dax__adag_xmlns_c_xsi_isset;
-XBT_PUBLIC_DATA(AT_dax__adag_xsi_c_schemaLocation) AX_dax__adag_xsi_c_schemaLocation;
+XBT_PUBLIC_DATA short int dax__adag_xmlns_c_xsi_isset;
+XBT_PUBLIC_DATA AT_dax__adag_xsi_c_schemaLocation AX_dax__adag_xsi_c_schemaLocation;
 #define A_dax__adag_xsi_c_schemaLocation (dax__bufferstack + AX_dax__adag_xsi_c_schemaLocation)
-XBT_PUBLIC_DATA(short int) dax__adag_xsi_c_schemaLocation_isset;
-XBT_PUBLIC_DATA(AT_dax__child_ref) AX_dax__child_ref;
+XBT_PUBLIC_DATA short int dax__adag_xsi_c_schemaLocation_isset;
+XBT_PUBLIC_DATA AT_dax__child_ref AX_dax__child_ref;
 #define A_dax__child_ref (dax__bufferstack + AX_dax__child_ref)
-XBT_PUBLIC_DATA(short int) dax__child_ref_isset;
-XBT_PUBLIC_DATA(AT_dax__job_id) AX_dax__job_id;
+XBT_PUBLIC_DATA short int dax__child_ref_isset;
+XBT_PUBLIC_DATA AT_dax__job_id AX_dax__job_id;
 #define A_dax__job_id (dax__bufferstack + AX_dax__job_id)
-XBT_PUBLIC_DATA(short int) dax__job_id_isset;
-XBT_PUBLIC_DATA(AT_dax__job_level) AX_dax__job_level;
+XBT_PUBLIC_DATA short int dax__job_id_isset;
+XBT_PUBLIC_DATA AT_dax__job_level AX_dax__job_level;
 #define A_dax__job_level (dax__bufferstack + AX_dax__job_level)
-XBT_PUBLIC_DATA(short int) dax__job_level_isset;
-XBT_PUBLIC_DATA(AT_dax__job_name) AX_dax__job_name;
+XBT_PUBLIC_DATA short int dax__job_level_isset;
+XBT_PUBLIC_DATA AT_dax__job_name AX_dax__job_name;
 #define A_dax__job_name (dax__bufferstack + AX_dax__job_name)
-XBT_PUBLIC_DATA(short int) dax__job_name_isset;
-XBT_PUBLIC_DATA(AT_dax__job_namespace) AX_dax__job_namespace;
+XBT_PUBLIC_DATA short int dax__job_name_isset;
+XBT_PUBLIC_DATA AT_dax__job_namespace AX_dax__job_namespace;
 #define A_dax__job_namespace (dax__bufferstack + AX_dax__job_namespace)
-XBT_PUBLIC_DATA(short int) dax__job_namespace_isset;
-XBT_PUBLIC_DATA(AT_dax__job_runtime) AX_dax__job_runtime;
+XBT_PUBLIC_DATA short int dax__job_namespace_isset;
+XBT_PUBLIC_DATA AT_dax__job_runtime AX_dax__job_runtime;
 #define A_dax__job_runtime (dax__bufferstack + AX_dax__job_runtime)
-XBT_PUBLIC_DATA(short int) dax__job_runtime_isset;
-XBT_PUBLIC_DATA(AT_dax__job_version) AX_dax__job_version;
+XBT_PUBLIC_DATA short int dax__job_runtime_isset;
+XBT_PUBLIC_DATA AT_dax__job_version AX_dax__job_version;
 #define A_dax__job_version (dax__bufferstack + AX_dax__job_version)
-XBT_PUBLIC_DATA(short int) dax__job_version_isset;
-XBT_PUBLIC_DATA(AT_dax__parent_ref) AX_dax__parent_ref;
+XBT_PUBLIC_DATA short int dax__job_version_isset;
+XBT_PUBLIC_DATA AT_dax__parent_ref AX_dax__parent_ref;
 #define A_dax__parent_ref (dax__bufferstack + AX_dax__parent_ref)
-XBT_PUBLIC_DATA(short int) dax__parent_ref_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_file) AX_dax__uses_file;
+XBT_PUBLIC_DATA short int dax__parent_ref_isset;
+XBT_PUBLIC_DATA AT_dax__uses_file AX_dax__uses_file;
 #define A_dax__uses_file (dax__bufferstack + AX_dax__uses_file)
-XBT_PUBLIC_DATA(short int) dax__uses_file_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_link) AX_dax__uses_link;
+XBT_PUBLIC_DATA short int dax__uses_file_isset;
+XBT_PUBLIC_DATA AT_dax__uses_link AX_dax__uses_link;
 #define A_dax__uses_link AX_dax__uses_link
-XBT_PUBLIC_DATA(short int) dax__uses_link_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_optional) AX_dax__uses_optional;
+XBT_PUBLIC_DATA short int dax__uses_link_isset;
+XBT_PUBLIC_DATA AT_dax__uses_optional AX_dax__uses_optional;
 #define A_dax__uses_optional AX_dax__uses_optional
-XBT_PUBLIC_DATA(short int) dax__uses_optional_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_register) AX_dax__uses_register;
+XBT_PUBLIC_DATA short int dax__uses_optional_isset;
+XBT_PUBLIC_DATA AT_dax__uses_register AX_dax__uses_register;
 #define A_dax__uses_register AX_dax__uses_register
-XBT_PUBLIC_DATA(short int) dax__uses_register_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_size) AX_dax__uses_size;
+XBT_PUBLIC_DATA short int dax__uses_register_isset;
+XBT_PUBLIC_DATA AT_dax__uses_size AX_dax__uses_size;
 #define A_dax__uses_size (dax__bufferstack + AX_dax__uses_size)
-XBT_PUBLIC_DATA(short int) dax__uses_size_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_transfer) AX_dax__uses_transfer;
+XBT_PUBLIC_DATA short int dax__uses_size_isset;
+XBT_PUBLIC_DATA AT_dax__uses_transfer AX_dax__uses_transfer;
 #define A_dax__uses_transfer AX_dax__uses_transfer
-XBT_PUBLIC_DATA(short int) dax__uses_transfer_isset;
-XBT_PUBLIC_DATA(AT_dax__uses_type) AX_dax__uses_type;
+XBT_PUBLIC_DATA short int dax__uses_transfer_isset;
+XBT_PUBLIC_DATA AT_dax__uses_type AX_dax__uses_type;
 #define A_dax__uses_type (dax__bufferstack + AX_dax__uses_type)
-XBT_PUBLIC_DATA(short int) dax__uses_type_isset;
+XBT_PUBLIC_DATA short int dax__uses_type_isset;
 
 /* XML application utilities. */
-XBT_PUBLIC(int) dax__element_context(int);
+XBT_PUBLIC int dax__element_context(int);
 
 /* XML processor entry point. */
-XBT_PUBLIC(int) yylex(void);
+XBT_PUBLIC int yylex(void);
 
 /* Flexml error handling function (useful only when -q flag passed to flexml) */
 const char * dax__parse_err_msg(void);
index 185966b..9503873 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
 
-extern "C" {
 #include "dax_dtd.h"
 #include "dax_dtd.c"
-}
 
 /* Ensure that transfer tasks have unique names even though a file is used several times */
 void uniq_transfer_task_name(SD_task_t task)
index da60d2d..aafbc55 100644 (file)
@@ -4,10 +4,10 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simdag_private.hpp"
+#include "simgrid/kernel/resource/Action.hpp"
 #include "simgrid/s4u/Engine.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/include/instr/instr_interface.h"
-#include "src/kernel/resource/Action.hpp"
 #include "src/surf/surf_interface.hpp"
 
 XBT_LOG_NEW_CATEGORY(sd, "Logging specific to SimDag");
@@ -58,8 +58,8 @@ std::set<SD_task_t>* simulate(double how_long){
     /* let's see which tasks are done */
     for (auto const& model : *all_existing_models) {
       simgrid::kernel::resource::Action* action = surf_model_extract_done_action_set(model);
-      while (action != nullptr && action->getData() != nullptr) {
-        SD_task_t task = static_cast<SD_task_t>(action->getData());
+      while (action != nullptr && action->get_data() != nullptr) {
+        SD_task_t task = static_cast<SD_task_t>(action->get_data());
         XBT_VERB("Task '%s' done", SD_task_get_name(task));
         SD_task_set_state(task, SD_DONE);
 
@@ -109,7 +109,7 @@ std::set<SD_task_t>* simulate(double how_long){
       /* let's see which tasks have just failed */
       action = surf_model_extract_failed_action_set(model);
       while (action != nullptr) {
-        SD_task_t task = static_cast<SD_task_t>(action->getData());
+        SD_task_t task = static_cast<SD_task_t>(action->get_data());
         XBT_VERB("Task '%s' failed", SD_task_get_name(task));
         SD_task_set_state(task, SD_FAILED);
         sd_global->return_set->insert(task);
index 8bbfa7f..a6c81da 100644 (file)
@@ -287,9 +287,9 @@ void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state)
 
   if (new_state == SD_DONE || new_state == SD_FAILED){
     sd_global->completed_tasks->insert(task);
-    task->start_time = task->surf_action->getStartTime();
+    task->start_time = task->surf_action->get_start_time();
     if (new_state == SD_DONE){
-      task->finish_time = task->surf_action->getFinishTime();
+      task->finish_time = task->surf_action->get_finish_time();
 #if SIMGRID_HAVE_JEDULE
       jedule_log_sd_event(task);
 #endif
@@ -435,7 +435,7 @@ double SD_task_get_alpha(SD_task_t task)
 double SD_task_get_remaining_amount(SD_task_t task)
 {
   if (task->surf_action)
-    return task->surf_action->getRemains();
+    return task->surf_action->get_remains();
   else
     return (task->state == SD_DONE) ? 0 : task->amount;
 }
@@ -810,7 +810,7 @@ void SD_task_run(SD_task_t task)
 
   task->surf_action = surf_host_model->executeParallelTask(host_nb, hosts, flops_amount, bytes_amount, task->rate);
 
-  task->surf_action->setData(task);
+  task->surf_action->set_data(task);
 
   XBT_DEBUG("surf_action = %p", task->surf_action);
 
@@ -830,7 +830,7 @@ void SD_task_run(SD_task_t task)
 double SD_task_get_start_time(SD_task_t task)
 {
   if (task->surf_action)
-    return task->surf_action->getStartTime();
+    return task->surf_action->get_start_time();
   else
     return task->start_time;
 }
@@ -848,7 +848,7 @@ double SD_task_get_start_time(SD_task_t task)
 double SD_task_get_finish_time(SD_task_t task)
 {
   if (task->surf_action)        /* should never happen as actions are destroyed right after their completion */
-    return task->surf_action->getFinishTime();
+    return task->surf_action->get_finish_time();
   else
     return task->finish_time;
 }
index e8ea892..346a1c4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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 "xbt/Extendable.hpp"
 #include "xbt/dict.h"
 
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "src/simix/smx_host_private.hpp"
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sg_host, sd, "Logging specific to sg_hosts");
 
-extern "C" {
-
 size_t sg_host_count()
 {
   return simgrid::s4u::Engine::getInstance()->getHostCount();
@@ -129,6 +127,17 @@ double sg_host_speed(sg_host_t host)
   return host->getSpeed();
 }
 
+/** \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
+ *
+ * \param  host host to test
+ * \param pstate_index pstate to test
+ * \return Returns the processor speed associated with pstate_index
+ */
+double sg_host_get_pstate_speed(sg_host_t host, int pstate_index)
+{
+  return host->getPstateSpeed(pstate_index);
+}
+
 /** \ingroup m_host_management
  * \brief Return the number of cores.
  *
@@ -309,4 +318,21 @@ void sg_host_dump(sg_host_t host)
   }
 }
 
-} // extern "C"
+/** \brief Return the list of actors attached to an host.
+ *
+ * \param host a host
+ * \param whereto a dynar in which we should push actors living on that host
+ */
+void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto)
+{
+  for (auto& actor : host->extension<simgrid::simix::Host>()->process_list) {
+    s4u_Actor* p = actor.ciface();
+    xbt_dynar_push(whereto, &p);
+  }
+}
+
+sg_host_t sg_host_self()
+{
+  smx_actor_t process = SIMIX_process_self();
+  return (process == nullptr) ? nullptr : process->host;
+}
index 19e7b14..6c6dfec 100644 (file)
@@ -1,11 +1,11 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
 
 /* sg_config: configuration infrastructure for the simulation world         */
 
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "instr/instr_interface.h"
 #include "mc/mc.h"
 #include "simgrid/instr.h"
@@ -360,11 +360,11 @@ void sg_config_init(int *argc, char **argv)
 
   xbt_cfg_register_boolean("cpu/maxmin-selective-update", "no", nullptr, "Update the constraint set propagating "
                                                                          "recursively to others constraints (off by "
-                                                                         "default when optim is set to lazy)");
+                                                                         "default unless optim is set to lazy)");
   xbt_cfg_register_alias("cpu/maxmin-selective-update", "cpu/maxmin_selective_update");
   xbt_cfg_register_boolean("network/maxmin-selective-update", "no", nullptr, "Update the constraint set propagating "
                                                                              "recursively to others constraints (off "
-                                                                             "by default when optim is set to lazy)");
+                                                                             "by default unless optim is set to lazy)");
   xbt_cfg_register_alias("network/maxmin-selective-update", "network/maxmin_selective_update");
   /* Replay (this part is enabled even if MC it disabled) */
   xbt_cfg_register_string("model-check/replay", nullptr, _sg_cfg_cb_model_check_replay,
index d81ec61..7047bb2 100644 (file)
@@ -146,7 +146,8 @@ void SIMIX_process_empty_trash()
 
 namespace simgrid {
 
-namespace simix {
+namespace kernel {
+namespace actor {
 
 ActorImpl::~ActorImpl()
 {
@@ -182,7 +183,7 @@ simgrid::s4u::Actor* ActorImpl::restart()
 
   // retrieve the arguments of the old process
   // FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
-  simgrid::simix::ProcessArg arg;
+  simgrid::kernel::actor::ProcessArg arg;
   arg.name         = name;
   arg.code         = code;
   arg.host         = host;
@@ -254,7 +255,7 @@ smx_activity_t ActorImpl::sleep(double duration)
   simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
   synchro->host                                 = host;
   synchro->surf_sleep                           = host->pimpl_cpu->sleep(duration);
-  synchro->surf_sleep->setData(synchro);
+  synchro->surf_sleep->set_data(synchro);
   XBT_DEBUG("Create sleep synchronization %p", synchro);
 
   return synchro;
@@ -264,7 +265,7 @@ void create_maestro(std::function<void()> code)
 {
   smx_actor_t maestro = nullptr;
   /* Create maestro process and initialize it */
-  maestro = new simgrid::simix::ActorImpl();
+  maestro           = new simgrid::kernel::actor::ActorImpl();
   maestro->pid = simix_process_maxpid++;
   maestro->name = "";
   maestro->userdata = nullptr;
@@ -281,13 +282,14 @@ void create_maestro(std::function<void()> code)
   simix_global->maestro_process = maestro;
 }
 
+} // namespace actor
 }
 }
 
 /** @brief Creates and runs the maestro process */
 void SIMIX_maestro_create(void (*code)(void*), void* data)
 {
-  simgrid::simix::create_maestro(std::bind(code, data));
+  simgrid::kernel::actor::create_maestro(std::bind(code, data));
 }
 
 /**
@@ -310,7 +312,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
     return nullptr;
   }
 
-  smx_actor_t process = new simgrid::simix::ActorImpl();
+  smx_actor_t process = new simgrid::kernel::actor::ActorImpl();
 
   xbt_assert(code && host != nullptr, "Invalid parameters");
   /* Process data */
@@ -349,8 +351,8 @@ smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, v
   simix_global->process_to_run.push_back(process);
   intrusive_ptr_add_ref(process);
   /* Tracing the process creation */
-  TRACE_msg_process_create(process->getName(), process->pid, process->host);
-
+  if (TRACE_actor_is_enabled())
+    simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR");
   /* The onCreation() signal must be delayed until there, where the pid and everything is set */
   simgrid::s4u::ActorPtr tmp = process->iface(); // Passing this directly to onCreation will lead to crashes
   simgrid::s4u::Actor::onCreation(tmp);
@@ -372,7 +374,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
     return nullptr;
   }
 
-  smx_actor_t process = new simgrid::simix::ActorImpl();
+  smx_actor_t process = new simgrid::kernel::actor::ActorImpl();
   /* Process data */
   process->pid = simix_process_maxpid++;
   process->name = std::string(name);
@@ -407,7 +409,8 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
   intrusive_ptr_add_ref(process);
 
   /* Tracing the process creation */
-  TRACE_msg_process_create(process->getName(), process->pid, process->host);
+  if (TRACE_actor_is_enabled())
+    simgrid::instr::Container::byName(process->host->getName())->createChild(instr_pid(process->ciface()), "ACTOR");
 
   auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
   if (not context)
@@ -462,7 +465,8 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
     return;
   }
 
-  XBT_DEBUG("Killing process %s@%s", process->getCname(), process->host->getCname());
+  XBT_DEBUG("Actor '%s'@%s is killing actor '%s'@%s", issuer->getCname(), issuer->host->getCname(), process->getCname(),
+            process->host->getCname());
 
   process->context->iwannadie = 1;
   process->blocked = 0;
@@ -574,21 +578,19 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const
 
 }
 
-void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) {
-  SIMIX_process_killall(simcall->issuer, reset_pid);
+void simcall_HANDLER_process_killall(smx_simcall_t simcall)
+{
+  SIMIX_process_killall(simcall->issuer);
 }
 /**
  * \brief Kills all running processes.
  * \param issuer this one will not be killed
  */
-void SIMIX_process_killall(smx_actor_t issuer, int reset_pid)
+void SIMIX_process_killall(smx_actor_t issuer)
 {
   for (auto const& kv : simix_global->process_list)
     if (kv.second != issuer)
       SIMIX_process_kill(kv.second, issuer);
-
-  if (reset_pid > 0)
-    simix_process_maxpid = reset_pid;
 }
 
 void SIMIX_process_change_host(smx_actor_t actor, sg_host_t dest)
@@ -749,8 +751,8 @@ void SIMIX_process_yield(smx_actor_t self)
     std::rethrow_exception(std::move(exception));
   }
 
-  if(SMPI_switch_data_segment){
-    SMPI_switch_data_segment(self->pid);
+  if (SMPI_switch_data_segment && not self->finished) {
+    SMPI_switch_data_segment(self->iface());
   }
 }
 
@@ -812,8 +814,8 @@ void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart) {
  * \param properties the properties of the process
  * \param auto_restart either it is autorestarting or not.
  */
-extern "C" smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host,
-                                              int argc, char** argv, std::map<std::string, std::string>* properties)
+smx_actor_t simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc,
+                                   char** argv, std::map<std::string, std::string>* properties)
 {
   if (name == nullptr)
     name = "";
index fab1cea..c2449fb 100644 (file)
@@ -19,7 +19,8 @@ struct s_smx_process_exit_fun_t {
 };
 
 namespace simgrid {
-namespace simix {
+namespace kernel {
+namespace actor {
 
 class ProcessArg {
 public:
@@ -127,10 +128,13 @@ public:
 typedef boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
                                                                         &ActorImpl::smx_synchro_hook>>
     SynchroList;
+
+XBT_PUBLIC void create_maestro(std::function<void()> code);
 }
-}
+} // namespace kernel
+} // namespace simgrid
 
-typedef simgrid::simix::ActorImpl* smx_actor_t;
+typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
 
 extern "C" {
 
@@ -140,7 +144,7 @@ XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, std::function<voi
 
 XBT_PRIVATE void SIMIX_process_runall();
 XBT_PRIVATE void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer);
-XBT_PRIVATE void SIMIX_process_killall(smx_actor_t issuer, int reset_pid);
+XBT_PRIVATE void SIMIX_process_killall(smx_actor_t issuer);
 XBT_PRIVATE void SIMIX_process_cleanup(smx_actor_t arg);
 XBT_PRIVATE void SIMIX_process_empty_trash();
 XBT_PRIVATE void SIMIX_process_yield(smx_actor_t self);
@@ -148,7 +152,7 @@ XBT_PRIVATE void SIMIX_process_change_host(smx_actor_t process, sg_host_t dest);
 
 XBT_PRIVATE void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart);
 
-extern void (*SMPI_switch_data_segment)(int dest);
+extern void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr actor);
 }
 
 XBT_PRIVATE void SIMIX_process_sleep_destroy(smx_activity_t synchro);
index 61d57bc..14f60e6 100644 (file)
@@ -5,7 +5,7 @@
 /*                                                                            */
 /* This is somehow the "libc" of SimGrid                                      */
 
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.            */
+/* Copyright (c) 2010-2018. 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. */
@@ -138,7 +138,7 @@ void simcall_execution_set_priority(smx_activity_t execution, double priority)
     simgrid::kernel::activity::ExecImplPtr exec =
         boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
     if (exec->surfAction_)
-      exec->surfAction_->setSharingWeight(priority);
+      exec->surfAction_->set_priority(priority);
   });
 }
 
@@ -156,7 +156,7 @@ void simcall_execution_set_bound(smx_activity_t execution, double bound)
     simgrid::kernel::activity::ExecImplPtr exec =
         boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(execution);
     if (exec->surfAction_)
-      exec->surfAction_->setBound(bound);
+      exec->surfAction_->set_bound(bound);
   });
 }
 
@@ -180,9 +180,9 @@ e_smx_state_t simcall_execution_test(smx_activity_t execution)
  * \ingroup simix_process_management
  * \brief Kills all SIMIX processes.
  */
-void simcall_process_killall(int reset_pid)
+void simcall_process_killall()
 {
-  simcall_BODY_process_killall(reset_pid);
+  simcall_BODY_process_killall();
 }
 
 /**
@@ -259,7 +259,7 @@ void simcall_process_set_kill_time(smx_actor_t process, double kill_time)
  * \brief Add an on_exit function
  * Add an on_exit function which will be executed when the process exits/is killed.
  */
-XBT_PUBLIC(void) simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data)
+XBT_PUBLIC void simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data)
 {
   simcall_BODY_process_on_exit(process, fun, data);
 }
index 106e960..21f3be7 100644 (file)
  */
 
 #include "src/simix/popping_private.hpp"
-static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<int>(simcall->args[0]);
-}
-static inline int simcall_process_killall__getraw__reset_pid(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<int>(simcall->args[0]);
-}
-static inline void simcall_process_killall__set__reset_pid(smx_simcall_t simcall, int arg)
-{
-  simgrid::simix::marshal<int>(simcall->args[0], arg);
-}
-
 static inline smx_actor_t simcall_process_cleanup__get__process(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
@@ -1399,7 +1386,7 @@ static inline void simcall_run_blocking__set__code(smx_simcall_t simcall, std::f
 
 /* The prototype of all simcall handlers, automatically generated for you */
 
-XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid);
+XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall);
 XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
 XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout);
 XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
index 8bae553..f4638de 100644 (file)
@@ -36,11 +36,11 @@ inline static R simcall(e_smx_simcall_t call, T const&... t)
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
 
-inline static void simcall_BODY_process_killall(int reset_pid)
+inline static void simcall_BODY_process_killall()
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
-    simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid);
-  return simcall<void, int>(SIMCALL_PROCESS_KILLALL, reset_pid);
+    simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall);
+  return simcall<void>(SIMCALL_PROCESS_KILLALL);
 }
 
 inline static void simcall_BODY_process_cleanup(smx_actor_t process)
index f24a394..568241c 100644 (file)
@@ -74,7 +74,7 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
     return;
   switch (simcall->call) {
 case SIMCALL_PROCESS_KILLALL:
-  simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
+  simcall_HANDLER_process_killall(simcall);
   SIMIX_simcall_answer(simcall);
   break;
 
index b7d4b5f..52ca2e7 100644 (file)
@@ -18,7 +18,7 @@
 extern "C" {
 
 /********************************* Simcalls *********************************/
-XBT_PUBLIC_DATA(const char*) simcall_names[]; /* Name of each simcall */
+XBT_PUBLIC_DATA const char* simcall_names[]; /* Name of each simcall */
 
 #include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */
 
index 82fd939..00bcbac 100644 (file)
@@ -35,7 +35,7 @@
 # Last but not the least, you should declare the new simix call in
 # ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
 
-void process_killall(int reset_pid);
+void process_killall();
 void process_cleanup(smx_actor_t process) [[nohandler]];
 void process_suspend(smx_actor_t process) [[block]];
 int  process_join(smx_actor_t process, double timeout) [[block]];
index 85c6c0a..6944ddf 100644 (file)
@@ -1,6 +1,6 @@
 /* a fast and simple context switching library                              */
 
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -17,7 +17,7 @@
 #include <xbt/sysdep.h>
 
 #include "simgrid/modelchecker.h"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "smx_private.hpp"
 #include "src/internal_config.h"
 #include "xbt/log.h"
@@ -103,7 +103,7 @@ void SIMIX_context_mod_init()
   xbt_os_thread_key_create(&smx_current_context_key);
 #endif
 
-#if defined(__APPLE__) || defined(__NetBSD__)
+#if HAVE_SMPI && (defined(__APPLE__) || defined(__NetBSD__))
   std::string priv = xbt_cfg_get_string("smpi/privatization");
   if (context_factory_name == "thread" && (priv == "dlopen" || priv == "yes" || priv == "default" || priv == "1")) {
     XBT_WARN("dlopen+thread broken on Apple and BSD. Switching to raw contexts.");
@@ -111,7 +111,7 @@ void SIMIX_context_mod_init()
   }
 #endif
 
-#if defined(__FreeBSD__)
+#if HAVE_SMPI && defined(__FreeBSD__)
   if (context_factory_name == "thread" && xbt_cfg_get_string("smpi/privatization") != "no"){
     XBT_WARN("mmap broken on FreeBSD, but dlopen+thread broken too. Switching to dlopen+raw contexts.");
     context_factory_name = "raw";
@@ -165,18 +165,14 @@ void *SIMIX_context_stack_new()
 {
   void *stack;
 
-  /* FIXME: current code for stack overflow protection assumes that stacks are
-   * growing downward (PTH_STACKGROWTH == -1).  Protected pages need to be put
-   * after the stack when PTH_STACKGROWTH == 1. */
-
   if (smx_context_guard_size > 0 && not MC_is_active()) {
 
 #if !defined(PTH_STACKGROWTH) || (PTH_STACKGROWTH != -1)
-    static int warned_once = 0;
-    if (not warned_once) {
-      XBT_WARN("Stack overflow protection is known to be broken on your system.  Either stack grows upwards, or it was not even tested properly.");
-      warned_once = 1;
-    }
+    xbt_die("Stack overflow protection is known to be broken on your system: you stacks grow upwards (or detection is "
+            "broken). "
+            "Please disable stack guards with --cfg=contexts:guard-size:0");
+    /* Current code for stack overflow protection assumes that stacks are growing downward (PTH_STACKGROWTH == -1).
+     * Protected pages need to be put after the stack when PTH_STACKGROWTH == 1. */
 #endif
 
     size_t size = smx_context_stack_size + smx_context_guard_size;
index c9ce06a..e767079 100644 (file)
@@ -117,7 +117,7 @@ simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const char *name)
 void SIMIX_process_set_function(const char* process_host, const char* process_function, xbt_dynar_t arguments,
                                 double process_start_time, double process_kill_time)
 {
-  ActorCreationArgs actor;
+  simgrid::kernel::routing::ActorCreationArgs actor;
 
   sg_host_t host = sg_host_by_name(process_host);
   if (not host)
@@ -139,7 +139,7 @@ void SIMIX_process_set_function(const char* process_host, const char* process_fu
   actor.host       = process_host;
   actor.kill_time  = process_kill_time;
   actor.start_time = process_start_time;
-  actor.on_failure = ActorOnFailure::DIE;
+  actor.on_failure = simgrid::kernel::routing::ActorOnFailure::DIE;
   sg_platf_new_actor(&actor);
 }
 
index adbd7e9..be1826f 100644 (file)
@@ -23,7 +23,7 @@
 #include "xbt/ex.h" /* ex_backtrace_display */
 
 #include "mc/mc.h"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/mc/mc_replay.hpp"
 #include "src/surf/StorageImpl.hpp"
 
@@ -68,7 +68,7 @@ public:
   s_smx_timer_t(double date, simgrid::xbt::Task<void()> callback) : date(date), callback(std::move(callback)) {}
 };
 
-void (*SMPI_switch_data_segment)(int) = nullptr;
+void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr) = nullptr;
 
 int _sg_do_verbose_exit = 1;
 static void inthandler(int)
@@ -169,21 +169,16 @@ static void kill_process(smx_actor_t process)
   SIMIX_process_kill(process, nullptr);
 }
 
-static std::function<void()> maestro_code;
 
 namespace simgrid {
 namespace simix {
 
 simgrid::xbt::signal<void()> onDeadlock;
 
-XBT_PUBLIC(void) set_maestro(std::function<void()> code)
-{
-  maestro_code = std::move(code);
-}
-
 }
 }
 
+static std::function<void()> maestro_code;
 void SIMIX_set_maestro(void (*code)(void*), void* data)
 {
 #ifdef _WIN32
@@ -195,9 +190,6 @@ void SIMIX_set_maestro(void (*code)(void*), void* data)
 /**
  * \ingroup SIMIX_API
  * \brief Initialize SIMIX internal data.
- *
- * \param argc Argc
- * \param argv Argv
  */
 void SIMIX_global_init(int *argc, char **argv)
 {
@@ -220,7 +212,7 @@ void SIMIX_global_init(int *argc, char **argv)
 
     // Either create a new context with maestro or create
     // a context object with the current context mestro):
-    simgrid::simix::create_maestro(maestro_code);
+    simgrid::kernel::actor::create_maestro(maestro_code);
 
     /* Prepare to display some more info when dying on Ctrl-C pressing */
     signal(SIGINT, inthandler);
@@ -282,7 +274,7 @@ void SIMIX_clean()
 #endif
 
   /* Kill all processes (but maestro) */
-  SIMIX_process_killall(simix_global->maestro_process, 1);
+  SIMIX_process_killall(simix_global->maestro_process);
   SIMIX_context_runall();
   SIMIX_process_empty_trash();
 
@@ -339,21 +331,21 @@ double SIMIX_get_clock()
 /** Wake up all processes waiting for a Surf action to finish */
 static void SIMIX_wake_processes()
 {
-  simgrid::kernel::resource::Action* action;
-
   for (auto const& model : *all_existing_models) {
+    simgrid::kernel::resource::Action* action;
+
     XBT_DEBUG("Handling the processes whose action failed (if any)");
     while ((action = surf_model_extract_failed_action_set(model))) {
       XBT_DEBUG("   Handling Action %p",action);
-      SIMIX_simcall_exit(static_cast<simgrid::kernel::activity::ActivityImpl*>(action->getData()));
+      SIMIX_simcall_exit(static_cast<simgrid::kernel::activity::ActivityImpl*>(action->get_data()));
     }
     XBT_DEBUG("Handling the processes whose action terminated normally (if any)");
     while ((action = surf_model_extract_done_action_set(model))) {
       XBT_DEBUG("   Handling Action %p",action);
-      if (action->getData() == nullptr)
+      if (action->get_data() == nullptr)
         XBT_DEBUG("probably vcpu's action %p, skip", action);
       else
-        SIMIX_simcall_exit(static_cast<simgrid::kernel::activity::ActivityImpl*>(action->getData()));
+        SIMIX_simcall_exit(static_cast<simgrid::kernel::activity::ActivityImpl*>(action->get_data()));
     }
   }
 }
@@ -661,12 +653,12 @@ void SIMIX_display_process_status()
       if (boost::dynamic_pointer_cast<simgrid::kernel::activity::IoImpl>(process->waiting_synchro) != nullptr)
         synchro_description = "I/O";
 
-      XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid,
+      XBT_INFO("Process %ld (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid,
                process->getCname(), process->host->getCname(), synchro_description, process->waiting_synchro.get(),
                process->waiting_synchro->name.c_str(), (int)process->waiting_synchro->state);
     }
     else {
-      XBT_INFO("Process %lu (%s@%s)", process->pid, process->getCname(), process->host->getCname());
+      XBT_INFO("Process %ld (%s@%s)", process->pid, process->getCname(), process->host->getCname());
     }
   }
 }
index 1dea2c9..b6f81fd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -85,12 +85,6 @@ void SIMIX_host_off(sg_host_t h, smx_actor_t issuer)
   }
 }
 
-sg_host_t sg_host_self()
-{
-  smx_actor_t process = SIMIX_process_self();
-  return (process == nullptr) ? nullptr : process->host;
-}
-
 /* needs to be public and without simcall for exceptions and logging events */
 const char* sg_host_self_get_name()
 {
@@ -112,8 +106,8 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::
                                          double kill_time, std::map<std::string, std::string>* properties,
                                          int auto_restart)
 {
-  simgrid::simix::ProcessArg* arg =
-      new simgrid::simix::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart);
+  simgrid::kernel::actor::ProcessArg* arg =
+      new simgrid::kernel::actor::ProcessArg(name, code, data, host, kill_time, nullptr, auto_restart);
   arg->properties.reset(properties, [](decltype(properties)) {});
 
   if (host->isOff() && watched_hosts.find(host->getCname()) == watched_hosts.end()) {
@@ -127,7 +121,7 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::
 /** @brief Restart the list of processes that have been registered to the host */
 void SIMIX_host_autorestart(sg_host_t host)
 {
-  std::vector<simgrid::simix::ProcessArg*> process_list =
+  std::vector<simgrid::kernel::actor::ProcessArg*> process_list =
       host->extension<simgrid::simix::Host>()->auto_restart_processes;
 
   for (auto const& arg : process_list) {
@@ -153,11 +147,11 @@ SIMIX_execution_start(const char* name, double flops_amount, double priority, do
   if (not MC_is_active() && not MC_record_replay_is_active()) {
 
     exec->surfAction_ = host->pimpl_cpu->execution_start(flops_amount);
-    exec->surfAction_->setData(exec.get());
-    exec->surfAction_->setSharingWeight(priority);
+    exec->surfAction_->set_data(exec.get());
+    exec->surfAction_->set_priority(priority);
 
     if (bound > 0)
-      static_cast<simgrid::surf::CpuAction*>(exec->surfAction_)->setBound(bound);
+      static_cast<simgrid::surf::CpuAction*>(exec->surfAction_)->set_bound(bound);
   }
 
   XBT_DEBUG("Create execute synchro %p: %s", exec.get(), exec->name.c_str());
@@ -188,10 +182,10 @@ SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_li
     sg_host_t* host_list_cpy = new sg_host_t[host_nb];
     std::copy_n(host_list, host_nb, host_list_cpy);
     exec->surfAction_ = surf_host_model->executeParallelTask(host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
-    exec->surfAction_->setData(exec.get());
+    exec->surfAction_->set_data(exec.get());
     if (timeout > 0) {
       exec->timeoutDetector = host_list[0]->pimpl_cpu->sleep(timeout);
-      exec->timeoutDetector->setData(exec.get());
+      exec->timeoutDetector->set_data(exec.get());
     }
   }
   XBT_DEBUG("Create parallel execute synchro %p", exec.get());
@@ -286,13 +280,13 @@ void SIMIX_set_category(smx_activity_t synchro, const char *category)
   simgrid::kernel::activity::ExecImplPtr exec =
       boost::dynamic_pointer_cast<simgrid::kernel::activity::ExecImpl>(synchro);
   if (exec != nullptr) {
-    exec->surfAction_->setCategory(category);
+    exec->surfAction_->set_category(category);
     return;
   }
 
   simgrid::kernel::activity::CommImplPtr comm =
       boost::dynamic_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
   if (comm != nullptr) {
-    comm->surfAction_->setCategory(category);
+    comm->surfAction_->set_category(category);
   }
 }
index 899fab3..00f681a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -31,11 +31,12 @@ public:
   explicit Host();
   virtual ~Host();
 
-  boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
-                                                                  &ActorImpl::host_process_list_hook>>
+  boost::intrusive::list<kernel::actor::ActorImpl,
+                         boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
+                                                       &kernel::actor::ActorImpl::host_process_list_hook>>
       process_list;
-  std::vector<ProcessArg*> auto_restart_processes;
-  std::vector<ProcessArg*> boot_processes;
+  std::vector<kernel::actor::ProcessArg*> auto_restart_processes;
+  std::vector<kernel::actor::ProcessArg*> boot_processes;
 
   void turnOn();
 };
index 39c13a1..b0363e9 100644 (file)
@@ -32,7 +32,7 @@ smx_activity_t SIMIX_storage_read(surf_storage_t st, sg_size_t size)
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = st->read(size);
 
-  synchro->surf_io->setData(synchro);
+  synchro->surf_io->set_data(synchro);
   XBT_DEBUG("Create io synchro %p", synchro);
 
   return synchro;
@@ -49,7 +49,7 @@ smx_activity_t SIMIX_storage_write(surf_storage_t st, sg_size_t size)
 {
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
   synchro->surf_io                           = st->write(size);
-  synchro->surf_io->setData(synchro);
+  synchro->surf_io->set_data(synchro);
   XBT_DEBUG("Create io synchro %p", synchro);
 
   return synchro;
index 45ce0ca..3852732 100644 (file)
@@ -323,7 +323,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_activity_t synchro, do
   } else { /* we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host
               fails */
     simgrid::kernel::resource::Action* sleep = simcall->issuer->host->pimpl_cpu->sleep(timeout);
-    sleep->setData(synchro.get());
+    sleep->set_data(synchro.get());
 
     simgrid::kernel::activity::CommImplPtr comm =
         boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
@@ -461,14 +461,14 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm)
     simgrid::s4u::Host* receiver = comm->dst_proc->host;
 
     comm->surfAction_ = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
-    comm->surfAction_->setData(comm.get());
+    comm->surfAction_->set_data(comm.get());
     comm->state = SIMIX_RUNNING;
 
     XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", comm.get(), sender->getCname(),
               receiver->getCname(), comm->surfAction_);
 
     /* If a link is failed, detect it immediately */
-    if (comm->surfAction_->getState() == simgrid::kernel::resource::Action::State::failed) {
+    if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) {
       XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->getCname(),
                 receiver->getCname());
       comm->state = SIMIX_LINK_FAILURE;
index 8bbb7ec..e6cc998 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -20,15 +20,16 @@ namespace simgrid {
 namespace simix {
 
 class Global {
-  friend XBT_PUBLIC(bool) simgrid::s4u::this_actor::isMaestro();
+  friend XBT_PUBLIC bool simgrid::s4u::this_actor::isMaestro();
 
 public:
   smx_context_factory_t context_factory = nullptr;
   std::vector<smx_actor_t> process_to_run;
   std::vector<smx_actor_t> process_that_ran;
   std::map<aid_t, smx_actor_t> process_list;
-  boost::intrusive::list<ActorImpl, boost::intrusive::member_hook<ActorImpl, boost::intrusive::list_member_hook<>,
-                                                                  &ActorImpl::smx_destroy_list_hook>>
+  boost::intrusive::list<kernel::actor::ActorImpl,
+                         boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
+                                                       &kernel::actor::ActorImpl::smx_destroy_list_hook>>
       process_to_destroy;
 #if SIMGRID_HAVE_MC
   /* MCer cannot read members process_list and process_to_destroy above in the remote process, so we copy the info it
@@ -59,28 +60,28 @@ public:
   std::vector<simgrid::xbt::Task<void()>> tasks;
   std::vector<simgrid::xbt::Task<void()>> tasksTemp;
 
-  std::vector<simgrid::simix::ActorImpl*> daemons;
+  std::vector<simgrid::kernel::actor::ActorImpl*> daemons;
 };
 }
 }
 
 extern "C" {
 
-XBT_PUBLIC_DATA(std::unique_ptr<simgrid::simix::Global>) simix_global;
+XBT_PUBLIC_DATA std::unique_ptr<simgrid::simix::Global> simix_global;
 
-XBT_PUBLIC(void) SIMIX_clean();
+XBT_PUBLIC void SIMIX_clean();
 
 /******************************** Exceptions *********************************/
 /** @brief Ask to the provided ActorImpl to raise the provided exception */
 #define SMX_EXCEPTION(issuer, cat, val, msg)                                                                           \
   if (1) {                                                                                                             \
-    simgrid::simix::ActorImpl* _smx_throw_issuer = (issuer); /* evaluate only once */                                  \
+    simgrid::kernel::actor::ActorImpl* _smx_throw_issuer = (issuer); /* evaluate only once */                          \
     xbt_ex e(XBT_THROW_POINT, msg);                                                                                    \
     e.category                   = cat;                                                                                \
     e.value                      = val;                                                                                \
     _smx_throw_issuer->exception = std::make_exception_ptr(e);                                                         \
   } else                                                                                                               \
-  ((void)0)
+    ((void)0)
 }
 
 #endif
index 2fca155..76574a1 100644 (file)
@@ -30,7 +30,7 @@ smx_activity_t SIMIX_synchro_wait(sg_host_t smx_host, double timeout)
   simgrid::kernel::activity::RawImplPtr sync =
       simgrid::kernel::activity::RawImplPtr(new simgrid::kernel::activity::RawImpl());
   sync->sleep                          = smx_host->pimpl_cpu->sleep(timeout);
-  sync->sleep->setData(sync.get());
+  sync->sleep->set_data(sync.get());
   XBT_OUT();
   return sync;
 }
index ed15fd1..76f8a9c 100644 (file)
@@ -17,13 +17,13 @@ struct s_smx_cond_t {
 
   std::atomic_int_fast32_t refcount_{1};
   smx_mutex_t mutex   = nullptr;
-  simgrid::simix::SynchroList sleeping; /* list of sleeping processes */
+  simgrid::kernel::actor::SynchroList sleeping; /* list of sleeping processes */
   simgrid::s4u::ConditionVariable cond_;
 };
 
 struct s_smx_sem_t {
   unsigned int value;
-  simgrid::simix::SynchroList sleeping; /* list of sleeping processes */
+  simgrid::kernel::actor::SynchroList sleeping; /* list of sleeping processes */
 };
 
 XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_actor_t process, smx_simcall_t simcall);
index 3e331dd..ddf92bd 100644 (file)
@@ -1,26 +1,39 @@
-/* Copyright ,(c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 "private.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI ,(mpi)");
 
 #define NOT_YET_IMPLEMENTED                                                                                            \
   {                                                                                                                    \
-    XBT_WARN("Not yet implemented : %s. Please contact the SimGrid team if support is needed", __FUNCTION__);          \
+    xbt_die("Not yet implemented: %s. Please contact the SimGrid team if support is needed", __func__);                \
     return MPI_SUCCESS;                                                                                                \
   }
 
-#define WRAPPED_PMPI_CALL(type,name,args,args2) \
-type name args { \
-  XBT_VERB("SMPI - Entering %s", __FUNCTION__);\
-  type ret = P##name args2 ; \
-  XBT_VERB("SMPI - Leaving %s", __FUNCTION__);\
-  return ret;\
-}\
+#define NOT_YET_IMPLEMENTED_NOFAIL                                                                                     \
+  {                                                                                                                    \
+    static bool warning_todo = true;                                                                                   \
+    if (warning_todo)                                                                                                  \
+      XBT_WARN("Not yet implemented: %s. "                                                                             \
+               "Please contact the SimGrid team if support is needed. "                                                \
+               "Run with --log=smpi_mpi.thresh:error to hide",                                                         \
+               __func__);                                                                                              \
+    warning_todo = false;                                                                                              \
+    return MPI_SUCCESS;                                                                                                \
+  }
+
+#define WRAPPED_PMPI_CALL(type, name, args, args2)                                                                     \
+  type name args                                                                                                       \
+  {                                                                                                                    \
+    XBT_VERB("SMPI - Entering %s", __func__);                                                                          \
+    type ret = P##name args2;                                                                                          \
+    XBT_VERB("SMPI - Leaving %s", __func__);                                                                           \
+    return ret;                                                                                                        \
+  }
 
 #define UNIMPLEMENTED_WRAPPED_PMPI_CALL(type,name,args,args2) \
 type P##name args { \
@@ -30,9 +43,16 @@ type name args { \
 return P##name args2 ; \
 }\
 
+#define UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(type,name,args,args2) \
+type P##name args { \
+NOT_YET_IMPLEMENTED_NOFAIL \
+}\
+type name args { \
+return P##name args2 ; \
+}\
+
 
 /* MPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 WRAPPED_PMPI_CALL(double, MPI_Wtick,(void),())
 WRAPPED_PMPI_CALL(double, MPI_Wtime,(void),())
@@ -166,6 +186,7 @@ WRAPPED_PMPI_CALL(int,MPI_Type_create_indexed,(int count, int* blocklens, int* i
 WRAPPED_PMPI_CALL(int,MPI_Type_create_keyval,(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,void* extra_state),(copy_fn,delete_fn,keyval,extra_state))
 WRAPPED_PMPI_CALL(int,MPI_Type_create_resized,(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype),(oldtype,lb, extent, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Type_create_struct,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_subarray,(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order,MPI_Datatype oldtype, MPI_Datatype *newtype),(ndims,array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype))
 WRAPPED_PMPI_CALL(int,MPI_Type_delete_attr ,(MPI_Datatype type, int type_keyval),(type,type_keyval))
 WRAPPED_PMPI_CALL(int,MPI_Type_dup,(MPI_Datatype datatype, MPI_Datatype * newdatatype),(datatype, newdatatype))
 WRAPPED_PMPI_CALL(int,MPI_Type_extent,(MPI_Datatype datatype, MPI_Aint * extent),(datatype, extent))
@@ -256,35 +277,35 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Cancel,(MPI_Request* request) ,(request)
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Cart_map,(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) ,(comm_old, ndims, dims, periods, newrank))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Close_port,( char *port_name),( port_name))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_accept,( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_call_errhandler,(MPI_Comm comm,int errorcode),(comm, errorcode))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_call_errhandler,(MPI_Comm comm,int errorcode),(comm, errorcode))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_connect,( char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm),( port_name, info, root, comm, newcomm))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_create_errhandler,( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler),( function, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_create_errhandler,( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler),( function, errhandler))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_dup_with_info,(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm),(comm,info,newcomm))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_get_errhandler,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_get_errhandler,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_get_info ,(MPI_Comm comm, MPI_Info* info),(comm, info))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_get_parent,( MPI_Comm *parent),( parent))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_join,( int fd, MPI_Comm *intercomm),( fd, intercomm))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_group,(MPI_Comm comm, MPI_Group* group) ,(comm, group))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_remote_size,(MPI_Comm comm, int* size) ,(comm, size))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_set_errhandler,(MPI_Comm comm, MPI_Errhandler errhandler) ,(comm, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_set_info ,(MPI_Comm comm, MPI_Info info),(comm, info))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_set_name ,(MPI_Comm comm, char* name),(comm, name))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_set_errhandler,(MPI_Comm comm, MPI_Errhandler errhandler) ,(comm, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_set_info ,(MPI_Comm comm, MPI_Info info),(comm, info))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Comm_set_name ,(MPI_Comm comm, char* name),(comm, name))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn,( char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes),( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_spawn_multiple,(int count, char **array_of_commands, char*** array_of_argv, int* array_of_maxprocs, MPI_Info* array_of_info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes), (count, array_of_commands, array_of_argv, array_of_maxprocs, array_of_info, root, comm, intercomm, array_of_errcodes))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_split_type,(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm),(comm, split_type, key, info, newcomm))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Comm_test_inter,(MPI_Comm comm, int* flag) ,(comm, flag))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Errhandler_create,(MPI_Handler_function* function, MPI_Errhandler* errhandler) ,(function, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Errhandler_free,(MPI_Errhandler* errhandler) ,(errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Errhandler_get,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Errhandler_set,(MPI_Comm comm, MPI_Errhandler errhandler) ,(comm, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Error_string,(int errorcode, char* string, int* resultlen) ,(errorcode, string, resultlen))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Errhandler_create,(MPI_Handler_function* function, MPI_Errhandler* errhandler) ,(function, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Errhandler_free,(MPI_Errhandler* errhandler) ,(errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Errhandler_get,(MPI_Comm comm, MPI_Errhandler* errhandler) ,(comm, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Errhandler_set,(MPI_Comm comm, MPI_Errhandler errhandler) ,(comm, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Error_string,(int errorcode, char* string, int* resultlen) ,(errorcode, string, resultlen))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Register_datarep, (char *datarep, MPI_Datarep_conversion_function *read_conversion_fn, MPI_Datarep_conversion_function *write_conversion_fn, MPI_Datarep_extent_function *dtype_file_extent_fn, void *extra_state) ,(datarep, read_conversion_fn, write_conversion_fn, dtype_file_extent_fn, extra_state))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(MPI_Fint, MPI_File_c2f,(MPI_File file), (file))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(MPI_File, MPI_File_f2c,(MPI_Fint file), (file))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_call_errhandler,(MPI_File fh, int errorcode), (fh, errorcode))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_create_errhandler,(MPI_File_errhandler_function *function, MPI_Errhandler *errhandler),(function, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_set_errhandler,( MPI_File file, MPI_Errhandler errhandler), (file, errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_get_errhandler,( MPI_File file, MPI_Errhandler *errhandler), (file, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int, MPI_File_set_errhandler,( MPI_File file, MPI_Errhandler errhandler), (file, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int, MPI_File_get_errhandler,( MPI_File file, MPI_Errhandler *errhandler), (file, errhandler))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_open,(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_File *fh),(comm, filename, amode, info, fh))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_close,(MPI_File *fh), (fh))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_File_delete,(char *filename, MPI_Info info), (filename, info))
@@ -367,15 +388,12 @@ UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Status_set_elements,( MPI_Status *status
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int, MPI_Test_cancelled,(MPI_Status* status, int* flag) ,(status, flag))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Topo_test,(MPI_Comm comm, int* top_type) ,(comm, top_type))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Type_create_darray,(int size, int rank, int ndims, int* array_of_gsizes, int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,int order, MPI_Datatype oldtype, MPI_Datatype *newtype) ,(size, rank, ndims, array_of_gsizes,array_of_distribs, array_of_dargs, array_of_psizes,order,oldtype, newtype))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Type_create_subarray,(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order,MPI_Datatype oldtype, MPI_Datatype *newtype),(ndims,array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Type_get_contents,(MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses, MPI_Datatype *array_of_datatypes),(datatype, max_integers, max_addresses,max_datatypes, array_of_integers, array_of_addresses, array_of_datatypes))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Type_get_envelope,( MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner),(datatype, num_integers, num_addresses, num_datatypes, combiner))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Type_match_size,(int typeclass,int size,MPI_Datatype *datatype),(typeclass,size,datatype))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Unpack_external,(char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype),( datarep, inbuf, insize, position, outbuf, outcount, datatype))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Unpublish_name,( char *service_name, MPI_Info info, char *port_name),( service_name, info, port_name))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Win_set_errhandler,(MPI_Win win, MPI_Errhandler errhandler) ,(win, errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(int,MPI_Win_set_errhandler,(MPI_Win win, MPI_Errhandler errhandler) ,(win, errhandler))
 UNIMPLEMENTED_WRAPPED_PMPI_CALL(int,MPI_Win_test,(MPI_Win win, int *flag),(win, flag))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(MPI_Errhandler, MPI_Errhandler_f2c,(MPI_Fint errhandler),(errhandler))
-UNIMPLEMENTED_WRAPPED_PMPI_CALL(MPI_Fint, MPI_Errhandler_c2f,(MPI_Errhandler errhandler),(errhandler))
-
-} // extern "C"
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(MPI_Errhandler, MPI_Errhandler_f2c,(MPI_Fint errhandler),(errhandler))
+UNIMPLEMENTED_WRAPPED_PMPI_CALL_NOFAIL(MPI_Fint, MPI_Errhandler_c2f,(MPI_Errhandler errhandler),(errhandler))
index 6e635fa..aa14f3b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -25,7 +25,6 @@ void TRACE_smpi_set_category(const char *category)
 }
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Init(int *argc, char ***argv)
 {
@@ -37,9 +36,9 @@ int PMPI_Init(int *argc, char ***argv)
   if(already_init == 0){
     simgrid::smpi::Process::init(argc, argv);
     smpi_process()->mark_as_initialized();
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
     TRACE_smpi_init(rank);
-    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("init"));
+    TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("init"));
     TRACE_smpi_comm_out(rank);
     TRACE_smpi_computing_init(rank);
     smpi_bench_begin();
@@ -53,8 +52,8 @@ int PMPI_Init(int *argc, char ***argv)
 int PMPI_Finalize()
 {
   smpi_bench_end();
-  int rank = simgrid::s4u::Actor::self()->getPid();
-  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("finalize"));
+  int rank = simgrid::s4u::this_actor::getPid();
+  TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("finalize"));
 
   smpi_process()->finalize();
 
@@ -109,8 +108,9 @@ int PMPI_Is_thread_main(int *flag)
   if (flag == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *flag = simgrid::s4u::Actor::self()->getPid() == 1; // FIXME: I don't think this is correct: This just returns true if the process ID is 1,
-                                          // regardless of whether this process called MPI_Thread_Init() or not.
+    *flag = simgrid::s4u::this_actor::getPid() ==
+            1; // FIXME: I don't think this is correct: This just returns true if the process ID is 1,
+               // regardless of whether this process called MPI_Thread_Init() or not.
     return MPI_SUCCESS;
   }
 }
@@ -216,5 +216,3 @@ int PMPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_f
 int PMPI_Keyval_free(int* keyval) {
   return simgrid::smpi::Keyval::keyval_free<simgrid::smpi::Comm>(keyval);
 }
-
-} // extern "C"
index 8904505..9b9fa96 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -13,7 +13,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
 {
@@ -26,11 +25,11 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
   } else if (not datatype->is_valid()) {
     retval = MPI_ERR_ARG;
   } else {
-    int rank = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
+    int rank = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(rank, __func__,
                        new simgrid::instr::CollTIData("bcast", root, -1.0,
                                                       datatype->is_replayable() ? count : count * datatype->size(), -1,
-                                                      encode_datatype(datatype), ""));
+                                                      simgrid::smpi::Datatype::encode(datatype), ""));
     if (comm->size() > 1)
       simgrid::smpi::Colls::bcast(buf, count, datatype, root, comm);
     retval = MPI_SUCCESS;
@@ -50,8 +49,8 @@ int PMPI_Barrier(MPI_Comm comm)
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else {
-    int rank = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("barrier"));
+    int rank = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("barrier"));
 
     simgrid::smpi::Colls::barrier(comm);
 
@@ -90,14 +89,14 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbu
       sendtmpcount=0;
       sendtmptype=recvtype;
     }
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
-                       new simgrid::instr::CollTIData(
-                           "gather", root, -1.0,
-                           sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
-                           (comm->rank() != root || recvtype->is_replayable()) ? recvcount : recvcount * recvtype->size(),
-                           encode_datatype(sendtmptype), encode_datatype(recvtype)));
+    TRACE_smpi_comm_in(
+        rank, __func__,
+        new simgrid::instr::CollTIData(
+            "gather", root, -1.0, sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
+            (comm->rank() != root || recvtype->is_replayable()) ? recvcount : recvcount * recvtype->size(),
+            simgrid::smpi::Datatype::encode(sendtmptype), simgrid::smpi::Datatype::encode(recvtype)));
 
     simgrid::smpi::Colls::gather(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, root, comm);
 
@@ -134,7 +133,7 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv
       sendtmptype=recvtype;
     }
 
-    int rank         = simgrid::s4u::Actor::self()->getPid();
+    int rank         = simgrid::s4u::this_actor::getPid();
     int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
     std::vector<int>* trace_recvcounts = new std::vector<int>;
@@ -143,11 +142,12 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv
         trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
+    TRACE_smpi_comm_in(rank, __func__,
                        new simgrid::instr::VarCollTIData(
                            "gatherV", root,
                            sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(), nullptr,
-                           dt_size_recv, trace_recvcounts, encode_datatype(sendtmptype), encode_datatype(recvtype)));
+                           dt_size_recv, trace_recvcounts, simgrid::smpi::Datatype::encode(sendtmptype),
+                           simgrid::smpi::Datatype::encode(recvtype)));
 
     retval = simgrid::smpi::Colls::gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, displs, recvtype, root, comm);
     TRACE_smpi_comm_out(rank);
@@ -178,13 +178,13 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       sendcount=recvcount;
       sendtype=recvtype;
     }
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
-                       new simgrid::instr::CollTIData("allGather", -1, -1.0,
-                                                      sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
-                                                      recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
-                                                      encode_datatype(sendtype), encode_datatype(recvtype)));
+    TRACE_smpi_comm_in(rank, __func__,
+                       new simgrid::instr::CollTIData(
+                           "allGather", -1, -1.0, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
+                           recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
+                           simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
 
     simgrid::smpi::Colls::allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
     TRACE_smpi_comm_out(rank);
@@ -215,17 +215,18 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       sendcount=recvcounts[comm->rank()];
       sendtype=recvtype;
     }
-    int rank               = simgrid::s4u::Actor::self()->getPid();
+    int rank               = simgrid::s4u::this_actor::getPid();
     int dt_size_recv       = recvtype->is_replayable() ? 1 : recvtype->size();
 
     std::vector<int>* trace_recvcounts = new std::vector<int>;
     for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
       trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
+    TRACE_smpi_comm_in(rank, __func__,
                        new simgrid::instr::VarCollTIData(
-                           "allGatherV", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(), nullptr,
-                           dt_size_recv, trace_recvcounts, encode_datatype(sendtype), encode_datatype(recvtype)));
+                           "allGatherV", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
+                           nullptr, dt_size_recv, trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype),
+                           simgrid::smpi::Datatype::encode(recvtype)));
 
     simgrid::smpi::Colls::allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
     retval = MPI_SUCCESS;
@@ -257,14 +258,15 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       recvtype  = sendtype;
       recvcount = sendcount;
     }
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
-                       new simgrid::instr::CollTIData(
-                           "scatter", root, -1.0,
-                           (comm->rank() != root || sendtype->is_replayable()) ? sendcount : sendcount * sendtype->size(),
-                           recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), encode_datatype(sendtype),
-                           encode_datatype(recvtype)));
+    TRACE_smpi_comm_in(
+        rank, __func__,
+        new simgrid::instr::CollTIData(
+            "scatter", root, -1.0,
+            (comm->rank() != root || sendtype->is_replayable()) ? sendcount : sendcount * sendtype->size(),
+            recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
+            simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
 
     simgrid::smpi::Colls::scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
     retval = MPI_SUCCESS;
@@ -294,7 +296,7 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
       recvtype  = sendtype;
       recvcount = sendcounts[comm->rank()];
     }
-    int rank               = simgrid::s4u::Actor::self()->getPid();
+    int rank               = simgrid::s4u::this_actor::getPid();
     int dt_size_send       = sendtype->is_replayable() ? 1 : sendtype->size();
 
     std::vector<int>* trace_sendcounts = new std::vector<int>;
@@ -303,10 +305,11 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
         trace_sendcounts->push_back(sendcounts[i] * dt_size_send);
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
-                                               "scatterV", root, dt_size_send, trace_sendcounts,
-                                               recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), nullptr,
-                                               encode_datatype(sendtype), encode_datatype(recvtype)));
+    TRACE_smpi_comm_in(rank, __func__,
+                       new simgrid::instr::VarCollTIData(
+                           "scatterV", root, dt_size_send, trace_sendcounts,
+                           recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), nullptr,
+                           simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
 
     retval = simgrid::smpi::Colls::scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
 
@@ -328,12 +331,12 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
   } else if (not datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
+    TRACE_smpi_comm_in(rank, __func__,
                        new simgrid::instr::CollTIData("reduce", root, 0,
                                                       datatype->is_replayable() ? count : count * datatype->size(), -1,
-                                                      encode_datatype(datatype), ""));
+                                                      simgrid::smpi::Datatype::encode(datatype), ""));
 
     simgrid::smpi::Colls::reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
 
@@ -378,12 +381,12 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
       sendtmpbuf = static_cast<char*>(xbt_malloc(count*datatype->get_extent()));
       simgrid::smpi::Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
     }
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
+    TRACE_smpi_comm_in(rank, __func__,
                        new simgrid::instr::CollTIData("allReduce", -1, 0,
                                                       datatype->is_replayable() ? count : count * datatype->size(), -1,
-                                                      encode_datatype(datatype), ""));
+                                                      simgrid::smpi::Datatype::encode(datatype), ""));
 
     simgrid::smpi::Colls::allreduce(sendtmpbuf, recvbuf, count, datatype, op, comm);
 
@@ -411,11 +414,11 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
   } else {
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData(
-                                               "scan", -1, datatype->is_replayable() ? count : count * datatype->size(),
-                                               encode_datatype(datatype)));
+    TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::Pt2PtTIData(
+                                           "scan", -1, datatype->is_replayable() ? count : count * datatype->size(),
+                                           simgrid::smpi::Datatype::encode(datatype)));
 
     retval = simgrid::smpi::Colls::scan(sendbuf, recvbuf, count, datatype, op, comm);
 
@@ -438,16 +441,16 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
   } else {
-    int rank         = simgrid::s4u::Actor::self()->getPid();
+    int rank         = simgrid::s4u::this_actor::getPid();
     void* sendtmpbuf = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
       sendtmpbuf = static_cast<void*>(xbt_malloc(count * datatype->size()));
       memcpy(sendtmpbuf, recvbuf, count * datatype->size());
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData(
-                                               "exscan", -1, datatype->is_replayable() ? count : count * datatype->size(),
-                                               encode_datatype(datatype)));
+    TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::Pt2PtTIData(
+                                           "exscan", -1, datatype->is_replayable() ? count : count * datatype->size(),
+                                           simgrid::smpi::Datatype::encode(datatype)));
 
     retval = simgrid::smpi::Colls::exscan(sendtmpbuf, recvbuf, count, datatype, op, comm);
 
@@ -474,7 +477,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
   } else if (recvcounts == nullptr) {
     retval = MPI_ERR_ARG;
   } else {
-    int rank                           = simgrid::s4u::Actor::self()->getPid();
+    int rank                           = simgrid::s4u::this_actor::getPid();
     std::vector<int>* trace_recvcounts = new std::vector<int>;
     int dt_send_size                   = datatype->is_replayable() ? 1 : datatype->size();
     int totalcount    = 0;
@@ -490,9 +493,9 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
       memcpy(sendtmpbuf, recvbuf, totalcount * datatype->size());
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
-                       new simgrid::instr::VarCollTIData("reduceScatter", -1, dt_send_size, nullptr, -1,
-                                                         trace_recvcounts, encode_datatype(datatype), ""));
+    TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::VarCollTIData(
+                                           "reduceScatter", -1, dt_send_size, nullptr, -1, trace_recvcounts,
+                                           simgrid::smpi::Datatype::encode(datatype), ""));
 
     simgrid::smpi::Colls::reduce_scatter(sendtmpbuf, recvbuf, recvcounts, datatype, op, comm);
     retval = MPI_SUCCESS;
@@ -523,7 +526,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
   } else {
     int count = comm->size();
 
-    int rank                           = simgrid::s4u::Actor::self()->getPid();
+    int rank                           = simgrid::s4u::this_actor::getPid();
     int dt_send_size                   = datatype->is_replayable() ? 1 : datatype->size();
     std::vector<int>* trace_recvcounts = new std::vector<int>(recvcount * dt_send_size); // copy data to avoid bad free
 
@@ -533,9 +536,9 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
       memcpy(sendtmpbuf, recvbuf, recvcount * count * datatype->size());
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__,
+    TRACE_smpi_comm_in(rank, __func__,
                        new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
-                                                         encode_datatype(datatype), ""));
+                                                         simgrid::smpi::Datatype::encode(datatype), ""));
 
     int* recvcounts = new int[count];
     for (int i      = 0; i < count; i++)
@@ -565,7 +568,7 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec
   } else if ((sendbuf != MPI_IN_PLACE && sendtype == MPI_DATATYPE_NULL) || recvtype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else {
-    int rank                 = simgrid::s4u::Actor::self()->getPid();
+    int rank                 = simgrid::s4u::this_actor::getPid();
     void* sendtmpbuf         = static_cast<char*>(sendbuf);
     int sendtmpcount         = sendcount;
     MPI_Datatype sendtmptype = sendtype;
@@ -576,12 +579,12 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec
       sendtmptype  = recvtype;
     }
 
-    TRACE_smpi_comm_in(
-        rank, __FUNCTION__,
-        new simgrid::instr::CollTIData("allToAll", -1, -1.0,
-                                       sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
-                                       recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
-                                       encode_datatype(sendtmptype), encode_datatype(recvtype)));
+    TRACE_smpi_comm_in(rank, __func__,
+                       new simgrid::instr::CollTIData(
+                           "allToAll", -1, -1.0,
+                           sendtmptype->is_replayable() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
+                           recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(),
+                           simgrid::smpi::Datatype::encode(sendtmptype), simgrid::smpi::Datatype::encode(recvtype)));
 
     retval = simgrid::smpi::Colls::alltoall(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, comm);
 
@@ -610,7 +613,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
              recvdisps == nullptr) {
     retval = MPI_ERR_ARG;
   } else {
-    int rank                           = simgrid::s4u::Actor::self()->getPid();
+    int rank                           = simgrid::s4u::this_actor::getPid();
     int size               = comm->size();
     int send_size                      = 0;
     int recv_size                      = 0;
@@ -647,9 +650,10 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
       trace_sendcounts->push_back(sendtmpcounts[i] * dt_size_send);
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
-                                               "allToAllV", -1, send_size, trace_sendcounts, recv_size,
-                                               trace_recvcounts, encode_datatype(sendtype), encode_datatype(recvtype)));
+    TRACE_smpi_comm_in(rank, __func__,
+                       new simgrid::instr::VarCollTIData("allToAllV", -1, send_size, trace_sendcounts, recv_size,
+                                                         trace_recvcounts, simgrid::smpi::Datatype::encode(sendtype),
+                                                         simgrid::smpi::Datatype::encode(recvtype)));
 
     retval = simgrid::smpi::Colls::alltoallv(sendtmpbuf, sendtmpcounts, sendtmpdisps, sendtmptype, recvbuf, recvcounts,
                                     recvdisps, recvtype, comm);
@@ -665,5 +669,3 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
   smpi_bench_begin();
   return retval;
 }
-
-}
index f886909..85d57ca 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -12,7 +12,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Comm_rank(MPI_Comm comm, int *rank)
 {
@@ -102,7 +101,7 @@ int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
     return MPI_ERR_GROUP;
   } else if (newcomm == nullptr) {
     return MPI_ERR_ARG;
-  } else if(group->rank(simgrid::s4u::Actor::self()->getPid())==MPI_UNDEFINED){
+  } else if (group->rank(simgrid::s4u::this_actor::getPid()) == MPI_UNDEFINED) {
     *newcomm= MPI_COMM_NULL;
     return MPI_SUCCESS;
   }else{
@@ -265,5 +264,3 @@ int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
   else
   return comm->attr_put<simgrid::smpi::Comm>(keyval, attr_value);
 }
-
-}
index 93f0cc6..6ada956 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -14,7 +14,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Group_free(MPI_Group * group)
 {
@@ -47,7 +46,7 @@ int PMPI_Group_rank(MPI_Group group, int *rank)
   } else if (rank == nullptr) {
     return MPI_ERR_ARG;
   } else {
-    *rank = group->rank(simgrid::s4u::Actor::self()->getPid());
+    *rank = group->rank(simgrid::s4u::this_actor::getPid());
     return MPI_SUCCESS;
   }
 }
@@ -190,6 +189,3 @@ MPI_Group PMPI_Group_f2c(MPI_Fint group){
 MPI_Fint PMPI_Group_c2f(MPI_Group group){
   return group->c2f();
 }
-
-
-}
index ed0c2b3..8986068 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -9,7 +9,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Info_create( MPI_Info *info){
   if (info == nullptr)
@@ -81,5 +80,3 @@ MPI_Info PMPI_Info_f2c(MPI_Fint info){
 MPI_Fint PMPI_Info_c2f(MPI_Info info){
   return info->c2f();
 }
-
-}
index 4ca50de..9b4a2e8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -9,7 +9,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Op_create(MPI_User_function * function, int commute, MPI_Op * op)
 {
@@ -52,5 +51,3 @@ MPI_Op PMPI_Op_f2c(MPI_Fint op){
 MPI_Fint PMPI_Op_c2f(MPI_Op op){
   return op->c2f();
 }
-
-}
index 6690dfc..ec183c4 100644 (file)
@@ -19,7 +19,6 @@ static int getPid(MPI_Comm comm, int id)
 }
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
 {
@@ -164,12 +163,12 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
     retval = MPI_ERR_TAG;
   } else {
 
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
 
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("Irecv", src,
                                                        datatype->is_replayable() ? count : count * datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
 
     *request = simgrid::smpi::Request::irecv(buf, count, datatype, src, tag, comm);
     retval = MPI_SUCCESS;
@@ -205,12 +204,12 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     int trace_dst = getPid(comm, dst);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("Isend", dst,
                                                        datatype->is_replayable() ? count : count * datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
 
     TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
 
@@ -247,12 +246,12 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     int trace_dst = getPid(comm, dst);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("ISsend", dst,
                                                        datatype->is_replayable() ? count : count * datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
     TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
 
     *request = simgrid::smpi::Request::issend(buf, count, datatype, dst, tag, comm);
@@ -287,11 +286,11 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int my_proc_id         = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("recv", src,
                                                        datatype->is_replayable() ? count : count * datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
 
     simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status);
     retval = MPI_SUCCESS;
@@ -329,12 +328,12 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
   } else if(tag < 0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int my_proc_id         = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id         = simgrid::s4u::this_actor::getPid();
     int dst_traced         = getPid(comm, dst);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("send", dst,
                                                        datatype->is_replayable() ? count : count * datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
     if (not TRACE_smpi_view_internals()) {
       TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
     }
@@ -367,12 +366,12 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int my_proc_id         = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id         = simgrid::s4u::this_actor::getPid();
     int dst_traced         = getPid(comm, dst);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("Ssend", dst,
                                                        datatype->is_replayable() ? count : count * datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
     TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
 
     simgrid::smpi::Request::ssend(buf, count, datatype, dst, tag, comm);
@@ -396,10 +395,17 @@ int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
     retval = MPI_ERR_COMM;
   } else if (not sendtype->is_valid() || not recvtype->is_valid()) {
     retval = MPI_ERR_TYPE;
-  } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
-    simgrid::smpi::Status::empty(status);
-    status->MPI_SOURCE = MPI_PROC_NULL;
-    retval             = MPI_SUCCESS;
+  } else if (src == MPI_PROC_NULL) {
+    if(status!=MPI_STATUS_IGNORE){
+      simgrid::smpi::Status::empty(status);
+      status->MPI_SOURCE = MPI_PROC_NULL;
+    }
+    if(dst != MPI_PROC_NULL)
+      simgrid::smpi::Request::send(sendbuf, sendcount, sendtype, dst, sendtag, comm);
+    retval = MPI_SUCCESS;
+  }else if (dst == MPI_PROC_NULL){
+    simgrid::smpi::Request::recv(recvbuf, recvcount, recvtype, src, recvtag, comm, status);
+    retval = MPI_SUCCESS;
   }else if (dst >= comm->group()->size() || dst <0 ||
       (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0))){
     retval = MPI_ERR_RANK;
@@ -409,7 +415,7 @@ int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
   } else if((sendtag<0 && sendtag !=  MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
     retval = MPI_ERR_TAG;
   } else {
-    int my_proc_id         = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id         = simgrid::s4u::this_actor::getPid();
     int dst_traced         = getPid(comm, dst);
     int src_traced         = getPid(comm, src);
 
@@ -418,11 +424,11 @@ int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
     std::vector<int>* src_hack = new std::vector<int>;
     dst_hack->push_back(dst_traced);
     src_hack->push_back(src_traced);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::VarCollTIData(
                            "sendRecv", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
                            dst_hack, recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), src_hack,
-                           encode_datatype(sendtype), encode_datatype(recvtype)));
+                           simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
 
     TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, sendtag, sendcount * sendtype->size());
 
@@ -470,7 +476,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
     simgrid::smpi::Status::empty(status);
     retval = MPI_SUCCESS;
   } else {
-    int my_proc_id = ((*request)->comm() != MPI_COMM_NULL) ? simgrid::s4u::Actor::self()->getPid() : -1;
+    int my_proc_id = ((*request)->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::getPid() : -1;
 
     TRACE_smpi_testing_in(my_proc_id);
 
@@ -585,10 +591,10 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status)
     retval = MPI_SUCCESS;
   } else {
     int my_proc_id = (*request)->comm() != MPI_COMM_NULL
-                         ? simgrid::s4u::Actor::self()->getPid()
+                         ? simgrid::s4u::this_actor::getPid()
                          : -1; // TODO: cheinrich: Check if this correct or if it should be MPI_UNDEFINED
 
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("wait"));
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("wait"));
 
     simgrid::smpi::Request::wait(request, status);
     retval = MPI_SUCCESS;
@@ -612,8 +618,8 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
 
   smpi_bench_end();
 
-  int rank_traced = simgrid::s4u::Actor::self()->getPid(); // FIXME: In PMPI_Wait, we check if the comm is null?
-  TRACE_smpi_comm_in(rank_traced, __FUNCTION__, new simgrid::instr::CpuTIData("waitAny", static_cast<double>(count)));
+  int rank_traced = simgrid::s4u::this_actor::getPid(); // FIXME: In PMPI_Wait, we check if the comm is null?
+  TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("waitAny", static_cast<double>(count)));
 
   *index = simgrid::smpi::Request::waitany(count, requests, status);
 
@@ -630,8 +636,8 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
 {
   smpi_bench_end();
 
-  int rank_traced = simgrid::s4u::Actor::self()->getPid(); // FIXME: In PMPI_Wait, we check if the comm is null?
-  TRACE_smpi_comm_in(rank_traced, __FUNCTION__, new simgrid::instr::CpuTIData("waitAll", static_cast<double>(count)));
+  int rank_traced = simgrid::s4u::this_actor::getPid(); // FIXME: In PMPI_Wait, we check if the comm is null?
+  TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("waitAll", static_cast<double>(count)));
 
   int retval = simgrid::smpi::Request::waitall(count, requests, status);
 
@@ -681,5 +687,3 @@ MPI_Request PMPI_Request_f2c(MPI_Fint request){
 MPI_Fint PMPI_Request_c2f(MPI_Request request) {
   return request->c2f();
 }
-
-}
index 0be7e5f..c428a8c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -9,7 +9,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 /* The topo part of MPI_COMM_WORLD should always be nullptr. When other topologies will be implemented, not only should we
  * check if the topology is nullptr, but we should check if it is the good topology type (so we have to add a
@@ -132,5 +131,3 @@ int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
     return  MPI_ERR_ARG;
   return MPI_SUCCESS;
 }
-
-}
index 69b7eaa..ada61b8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -9,7 +9,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Type_free(MPI_Datatype * datatype)
 {
@@ -238,18 +237,32 @@ int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Da
   return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
 }
 
+
+int PMPI_Type_create_subarray(int ndims, int* array_of_sizes,
+                             int* array_of_subsizes, int* array_of_starts,
+                             int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
+  if (ndims<0){
+    return MPI_ERR_COUNT;
+  } else if (ndims==0){
+    *newtype = MPI_DATATYPE_NULL;
+    return MPI_SUCCESS;
+  } else if (ndims==1){
+    simgrid::smpi::Datatype::create_contiguous( array_of_subsizes[0], oldtype, array_of_starts[0]*oldtype->get_extent(), newtype);
+    return MPI_SUCCESS;
+  } else if (oldtype == MPI_DATATYPE_NULL || not oldtype->is_valid() ) {
+    return MPI_ERR_TYPE;
+  } else if (order != MPI_ORDER_FORTRAN && order != MPI_ORDER_C){
+    return MPI_ERR_ARG;
+  } else {
+    return simgrid::smpi::Datatype::create_subarray(ndims, array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype);
+  }
+}
+
 int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){
   if (oldtype == MPI_DATATYPE_NULL) {
     return MPI_ERR_TYPE;
   }
-  int blocks[3]         = {1, 1, 1};
-  MPI_Aint disps[3]     = {lb, 0, lb + extent};
-  MPI_Datatype types[3] = {MPI_LB, oldtype, MPI_UB};
-
-  *newtype = new simgrid::smpi::Type_Struct(oldtype->size(), lb, lb + extent, DT_FLAG_DERIVED, 3, blocks, disps, types);
-
-  (*newtype)->addflag(~DT_FLAG_COMMITED);
-  return MPI_SUCCESS;
+  return simgrid::smpi::Datatype::create_resized(oldtype, lb, extent, newtype);
 }
 
 
@@ -353,5 +366,3 @@ int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size)
 
   return MPI_SUCCESS;
 }
-
-}
index 4bb1553..0447347 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -14,7 +14,6 @@
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
 /* PMPI User level calls */
-extern "C" { // Obviously, the C MPI interface should use the C linkage
 
 int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
   int retval = 0;
@@ -166,8 +165,8 @@ int PMPI_Win_fence( int assert,  MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_fence"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_fence"));
     retval = win->fence(assert);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -195,14 +194,14 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
             ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
     retval = MPI_ERR_TYPE;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("Get", target_rank, origin_datatype->is_replayable()
                                                                                ? origin_count
                                                                                : origin_count * origin_datatype->size(),
-                                                       encode_datatype(origin_datatype)));
+                                                       simgrid::smpi::Datatype::encode(origin_datatype)));
 
     retval = win->get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
                            target_datatype);
@@ -236,14 +235,14 @@ int PMPI_Rget( void *origin_addr, int origin_count, MPI_Datatype origin_datatype
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData(
                            "Rget", target_rank,
                            origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
-                           encode_datatype(origin_datatype)));
+                           simgrid::smpi::Datatype::encode(origin_datatype)));
 
     retval = win->get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
                            target_datatype, request);
@@ -274,15 +273,15 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
             ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
     retval = MPI_ERR_TYPE;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
     int dst_traced = group->actor(target_rank)->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("Put", target_rank, origin_datatype->is_replayable()
                                                                                ? origin_count
                                                                                : origin_count * origin_datatype->size(),
-                                                       encode_datatype(origin_datatype)));
+                                                       simgrid::smpi::Datatype::encode(origin_datatype)));
     TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, SMPI_RMA_TAG, origin_count * origin_datatype->size());
 
     retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
@@ -317,15 +316,15 @@ int PMPI_Rput( void *origin_addr, int origin_count, MPI_Datatype origin_datatype
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
     int dst_traced = group->actor(target_rank)->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData(
                            "Rput", target_rank,
                            origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
-                           encode_datatype(origin_datatype)));
+                           simgrid::smpi::Datatype::encode(origin_datatype)));
     TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, SMPI_RMA_TAG, origin_count * origin_datatype->size());
 
     retval = win->put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
@@ -359,14 +358,14 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData(
                            "Accumulate", target_rank,
                            origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
-                           encode_datatype(origin_datatype)));
+                           simgrid::smpi::Datatype::encode(origin_datatype)));
     retval = win->accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
                                   target_datatype, op);
 
@@ -401,14 +400,14 @@ int PMPI_Raccumulate( void *origin_addr, int origin_count, MPI_Datatype origin_d
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData(
                            "Raccumulate", target_rank,
                            origin_datatype->is_replayable() ? origin_count : origin_count * origin_datatype->size(),
-                           encode_datatype(origin_datatype)));
+                           simgrid::smpi::Datatype::encode(origin_datatype)));
 
     retval = win->accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
                                   target_datatype, op, request);
@@ -443,14 +442,14 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData(
                            "Get_accumulate", target_rank,
                            target_datatype->is_replayable() ? target_count : target_count * target_datatype->size(),
-                           encode_datatype(target_datatype)));
+                           simgrid::smpi::Datatype::encode(target_datatype)));
 
     retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
                                   result_count, result_datatype, target_rank, target_disp,
@@ -490,14 +489,14 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData(
                            "Rget_accumulate", target_rank,
                            target_datatype->is_replayable() ? target_count : target_count * target_datatype->size(),
-                           encode_datatype(target_datatype)));
+                           simgrid::smpi::Datatype::encode(target_datatype)));
 
     retval = win->get_accumulate( origin_addr, origin_count, origin_datatype, result_addr,
                                   result_count, result_datatype, target_rank, target_disp,
@@ -532,13 +531,13 @@ int PMPI_Compare_and_swap(void* origin_addr, void* compare_addr, void* result_ad
   } else if ((datatype == MPI_DATATYPE_NULL) || (not datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     MPI_Group group;
     win->get_group(&group);
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
+    TRACE_smpi_comm_in(my_proc_id, __func__,
                        new simgrid::instr::Pt2PtTIData("Compare_and_swap", target_rank,
                                                        datatype->is_replayable() ? 1 : datatype->size(),
-                                                       encode_datatype(datatype)));
+                                                       simgrid::smpi::Datatype::encode(datatype)));
 
     retval = win->compare_and_swap(origin_addr, compare_addr, result_addr, datatype, target_rank, target_disp);
 
@@ -556,8 +555,8 @@ int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
   } else if (group==MPI_GROUP_NULL){
     retval = MPI_ERR_GROUP;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_post"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_post"));
     retval = win->post(group,assert);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -573,8 +572,8 @@ int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){
   } else if (group==MPI_GROUP_NULL){
     retval = MPI_ERR_GROUP;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_start"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_start"));
     retval = win->start(group,assert);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -588,8 +587,8 @@ int PMPI_Win_complete(MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_complete"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_complete"));
 
     retval = win->complete();
 
@@ -605,8 +604,8 @@ int PMPI_Win_wait(MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_wait"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_wait"));
 
     retval = win->wait();
 
@@ -627,7 +626,7 @@ int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win){
   } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
     TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_lock"));
     retval = win->lock(lock_type,rank,assert);
     TRACE_smpi_comm_out(my_proc_id);
@@ -644,8 +643,8 @@ int PMPI_Win_unlock(int rank, MPI_Win win){
   } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_unlock"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock"));
     retval = win->unlock(rank);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -659,8 +658,8 @@ int PMPI_Win_lock_all(int assert, MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_lock_all"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_lock_all"));
     retval = win->lock_all(assert);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -674,8 +673,8 @@ int PMPI_Win_unlock_all(MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_unlock_all"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_unlock_all"));
     retval = win->unlock_all();
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -691,8 +690,8 @@ int PMPI_Win_flush(int rank, MPI_Win win){
   } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush"));
     retval = win->flush(rank);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -708,8 +707,8 @@ int PMPI_Win_flush_local(int rank, MPI_Win win){
   } else if (rank == MPI_PROC_NULL){
     retval = MPI_SUCCESS;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush_local"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local"));
     retval = win->flush_local(rank);
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -723,8 +722,8 @@ int PMPI_Win_flush_all(MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush_all"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_all"));
     retval = win->flush_all();
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -738,8 +737,8 @@ int PMPI_Win_flush_local_all(MPI_Win win){
   if (win == MPI_WIN_NULL) {
     retval = MPI_ERR_WIN;
   } else {
-    int my_proc_id = simgrid::s4u::Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("Win_flush_local_all"));
+    int my_proc_id = simgrid::s4u::this_actor::getPid();
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Win_flush_local_all"));
     retval = win->flush_local_all();
     TRACE_smpi_comm_out(my_proc_id);
   }
@@ -812,5 +811,3 @@ MPI_Win PMPI_Win_f2c(MPI_Fint win){
 MPI_Fint PMPI_Win_c2f(MPI_Win win){
   return win->c2f();
 }
-
-}
index 23b2a93..95ead04 100644 (file)
@@ -15,7 +15,7 @@
   if (TRACE_is_enabled()) {                                                                                            \
     simgrid::instr::EventType* type = simgrid::instr::Container::getRoot()->type_->getOrCreateEventType(#cat);         \
                                                                                                                        \
-    std::string cont_name = std::string("rank-" + std::to_string(simgrid::s4u::Actor::self()->getPid()));                            \
+    std::string cont_name = std::string("rank-" + std::to_string(simgrid::s4u::this_actor::getPid()));                 \
     type->addEntityValue(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0");                                  \
     new simgrid::instr::NewEvent(SIMIX_get_clock(), simgrid::instr::Container::byName(cont_name), type,                \
                                  type->getEntityValue(Colls::mpi_coll_##cat##_description[i].name));                   \
index 24cdf97..60f251c 100644 (file)
@@ -2,7 +2,7 @@
 /* This is the tuning used by MVAPICH for Stampede platform based on (MV2_ARCH_INTEL_XEON_E5_2680_16,
  * MV2_HCA_MLX_CX_FDR) */
 
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -16,7 +16,7 @@
 
 #define MV2_MAX_NB_THRESHOLDS 32
 
-XBT_PUBLIC(void) smpi_coll_cleanup_mvapich2(void);
+XBT_PUBLIC void smpi_coll_cleanup_mvapich2(void);
 
 struct mv2_alltoall_tuning_element {
   int min;
index 09594c2..7eebf7a 100644 (file)
@@ -65,9 +65,10 @@ XBT_PRIVATE SMPI_Process* smpi_process();
 XBT_PRIVATE SMPI_Process* smpi_process_remote(simgrid::s4u::ActorPtr actor);
 XBT_PRIVATE int smpi_process_count();
 
-XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, simgrid::s4u::ActorPtr actor);
-XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const char* instance_id);
-XBT_PRIVATE msg_bar_t smpi_deployment_finalization_barrier(const char* instance_id);
+XBT_PRIVATE void smpi_deployment_register_process(const std::string instance_id, int rank,
+                                                  simgrid::s4u::ActorPtr actor);
+XBT_PRIVATE MPI_Comm* smpi_deployment_comm_world(const std::string instance_id);
+XBT_PRIVATE msg_bar_t smpi_deployment_finalization_barrier(const std::string instance_id);
 XBT_PRIVATE void smpi_deployment_cleanup_instances();
 
 XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_activity_t comm, void* buff, size_t buff_size);
@@ -89,8 +90,8 @@ extern XBT_PRIVATE int smpi_data_exe_size;    // size of the data+bss segment of
 enum shared_malloc_type { shmalloc_none, shmalloc_local, shmalloc_global };
 extern XBT_PRIVATE shared_malloc_type smpi_cfg_shared_malloc; // Whether to activate shared malloc
 
-XBT_PRIVATE void smpi_switch_data_segment(int dest);
-XBT_PRIVATE void smpi_really_switch_data_segment(int dest);
+XBT_PRIVATE void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor);
+XBT_PRIVATE void smpi_really_switch_data_segment(simgrid::s4u::ActorPtr actor);
 XBT_PRIVATE int smpi_is_privatization_file(char* file);
 
 XBT_PRIVATE void smpi_get_executable_global_size();
@@ -104,6 +105,7 @@ XBT_PRIVATE void smpi_shared_destroy();
 XBT_PRIVATE void* smpi_get_tmp_sendbuffer(int size);
 XBT_PRIVATE void* smpi_get_tmp_recvbuffer(int size);
 XBT_PRIVATE void smpi_free_tmp_buffer(void* buf);
+XBT_PRIVATE void smpi_free_replay_tmp_buffers();
 
 // f77 wrappers
 void mpi_init_(int* ierr);
@@ -432,7 +434,7 @@ extern std::unordered_map<std::string, double> location2speedup;
 
 /** @brief Returns the last call location (filename, linenumber). Process-specific. */
 extern "C" {
-XBT_PUBLIC(smpi_trace_call_location_t*) smpi_trace_get_call_location();
+XBT_PUBLIC smpi_trace_call_location_t* smpi_trace_get_call_location();
 }
 
 enum smpi_priv_strategies {
index 99a7377..9dfb2e3 100644 (file)
@@ -1,5 +1,5 @@
 /*High level handling of collective algorithms*/
-/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team.
+/* Copyright (c) 2009-2010, 2012-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -90,8 +90,8 @@ struct s_mpi_coll_description_t {
 
 class Colls{
   public:
-    static XBT_PUBLIC(void) coll_help(const char *category, s_mpi_coll_description_t * table);
-    static XBT_PUBLIC(int) find_coll_description(s_mpi_coll_description_t* table, std::string name, const char* desc);
+    static XBT_PUBLIC void coll_help(const char* category, s_mpi_coll_description_t* table);
+    static XBT_PUBLIC int find_coll_description(s_mpi_coll_description_t* table, std::string name, const char* desc);
     static void set_collectives();
 
     // for each collective type, create the set_* prototype, the description array and the function pointer
index e96134e..5832334 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -8,6 +8,7 @@
 
 #include "smpi_f2c.hpp"
 #include "smpi_keyvals.hpp"
+#include <string>
 
 #define DT_FLAG_DESTROYED     0x0001  /**< user destroyed but some other layers still have a reference */
 #define DT_FLAG_COMMITED      0x0002  /**< ready to be used for a send/recv operation */
@@ -76,6 +77,11 @@ namespace smpi{
 
 class Datatype : public F2C, public Keyval{
   char* name_;
+  /* The id here is the (unique) datatype id used for this datastructure.
+   * It's default value is set to -1 since some code expects this return value
+   * when no other id has been assigned
+   */
+  std::string id = "-1";
   size_t size_;
   MPI_Aint lb_;
   MPI_Aint ub_;
@@ -86,6 +92,8 @@ public:
   static std::unordered_map<int, smpi_key_elem> keyvals_;
   static int keyval_id_;
 
+  Datatype(int id, int size, MPI_Aint lb, MPI_Aint ub, int flags);
+  Datatype(char* name, int id, int size, MPI_Aint lb, MPI_Aint ub, int flags);
   Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags);
   Datatype(char* name, int size, MPI_Aint lb, MPI_Aint ub, int flags);
   Datatype(Datatype* datatype, int* ret);
@@ -103,6 +111,8 @@ public:
   void commit();
   bool is_valid();
   bool is_basic();
+  static const char* encode(MPI_Datatype dt);
+  static MPI_Datatype decode(std::string datatype_id);
   bool is_replayable();
   void addflag(int flag);
   int extent(MPI_Aint* lb, MPI_Aint* extent);
@@ -127,7 +137,11 @@ public:
                              MPI_Datatype* new_type);
   static int create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
                            MPI_Datatype* new_type);
-
+  static int create_subarray(int ndims, int* array_of_sizes,
+                             int* array_of_subsizes, int* array_of_starts,
+                             int order, MPI_Datatype oldtype, MPI_Datatype *newtype);
+  static int create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent,
+                             MPI_Datatype *newtype);
   static Datatype* f2c(int id);
 };
 
index 038a40b..dca417d 100644 (file)
@@ -19,6 +19,6 @@ struct s_smpi_factor_t {
 };
 }
 
-XBT_PUBLIC(std::vector<s_smpi_factor_t>) parse_factor(std::string smpi_coef_string);
+XBT_PUBLIC std::vector<s_smpi_factor_t> parse_factor(std::string smpi_coef_string);
 
 #endif
index d13557d..2e3876e 100644 (file)
@@ -10,7 +10,7 @@
 #include <cstdarg>
 #include <cwchar>
 #include <deque>
-#include <simgrid/sg_config.h>
+#include <simgrid/sg_config.hpp>
 #include <string>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_smpi, instr, "Tracing SMPI");
@@ -155,12 +155,10 @@ void TRACE_smpi_init(int rank)
   }else{
     father = simgrid::instr::Container::getRoot();
   }
-  xbt_assert(father != nullptr, "Could not find a parent for mpi rank %s at function %s", str.c_str(), __FUNCTION__);
-#if HAVE_PAPI
-  container_t container =
-#endif
-      new simgrid::instr::Container(str, "MPI", father);
+  xbt_assert(father != nullptr, "Could not find a parent for mpi rank %s at function %s", str.c_str(), __func__);
+  father->createChild(str, "MPI");
 #if HAVE_PAPI
+  container_t container   = simgrid::instr::Container::byName(str);
   papi_counter_t counters = smpi_process()->papi_counters();
 
   for (auto const& it : counters) {
@@ -180,9 +178,7 @@ void TRACE_smpi_finalize(int rank)
   if (not TRACE_smpi_is_enabled())
     return;
 
-  container_t container = smpi_container(rank);
-  container->removeFromParent();
-  delete container;
+  smpi_container(rank)->removeFromParent();
 }
 
 void TRACE_smpi_computing_init(int rank)
@@ -206,13 +202,6 @@ void TRACE_smpi_computing_out(int rank)
     smpi_container(rank)->getState("MPI_STATE")->popEvent();
 }
 
-void TRACE_smpi_sleeping_init(int rank) // FIXME: this function is never called
-{
-  //first use, initialize the color in the trace
-  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
-    smpi_container(rank)->getState("MPI_STATE")->addEntityValue("sleeping", instr_find_color("sleeping"));
-}
-
 void TRACE_smpi_sleeping_in(int rank, double duration)
 {
   if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
index 96b3818..5f8f451 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2009-2017. The SimGrid Team. All rights reserved.    */
+/* Copyright (c) 2007, 2009-2018. 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. */
@@ -30,24 +30,25 @@ double smpi_host_speed;
 shared_malloc_type smpi_cfg_shared_malloc = shmalloc_global;
 double smpi_total_benched_time = 0;
 
-extern "C" XBT_PUBLIC(void) smpi_execute_flops_(double *flops);
+extern "C" XBT_PUBLIC void smpi_execute_flops_(double* flops);
 void smpi_execute_flops_(double *flops)
 {
   smpi_execute_flops(*flops);
 }
 
-extern "C" XBT_PUBLIC(void) smpi_execute_(double *duration);
+extern "C" XBT_PUBLIC void smpi_execute_(double* duration);
 void smpi_execute_(double *duration)
 {
   smpi_execute(*duration);
 }
 
 void smpi_execute_flops(double flops) {
+  xbt_assert(flops >= 0, "You're trying to execute a negative amount of flops (%f)!", flops);
   XBT_DEBUG("Handle real computation time: %f flops", flops);
   smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->getHost());
   simcall_set_category (action, TRACE_internal_smpi_get_category());
   simcall_execution_wait(action);
-  smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+  smpi_switch_data_segment(simgrid::s4u::Actor::self());
 }
 
 void smpi_execute(double duration)
@@ -55,7 +56,7 @@ void smpi_execute(double duration)
   if (duration >= smpi_cpu_threshold) {
     XBT_DEBUG("Sleep for %g to handle real computation time", duration);
     double flops = duration * smpi_host_speed;
-    int rank = simgrid::s4u::Actor::self()->getPid();
+    int rank     = simgrid::s4u::this_actor::getPid();
     TRACE_smpi_computing_in(rank, flops);
 
     smpi_execute_flops(flops);
@@ -79,7 +80,7 @@ void smpi_execute_benched(double duration)
 void smpi_bench_begin()
 {
   if (smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) {
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
 
   if (MC_is_active() || MC_record_replay_is_active())
@@ -157,7 +158,7 @@ void smpi_bench_end()
 #if HAVE_PAPI
   if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) {
     container_t container =
-        new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::Actor::self()->getPid()));
+        new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::this_actor::getPid));
     papi_counter_t& counter_data = smpi_process()->papi_counters();
 
     for (auto const& pair : counter_data) {
@@ -262,7 +263,7 @@ public:
   SampleLocation(bool global, const char* file, int line) : std::string(std::string(file) + ":" + std::to_string(line))
   {
     if (not global)
-      this->append(":" + std::to_string(simgrid::s4u::Actor::self()->getPid()));
+      this->append(":" + std::to_string(simgrid::s4u::this_actor::getPid()));
   }
 };
 
@@ -396,7 +397,6 @@ void smpi_sample_3(int global, const char *file, int line)
   data.benching = false;
 }
 
-extern "C" { /** These functions will be called from the user code **/
 smpi_trace_call_location_t* smpi_trace_get_call_location()
 {
   return smpi_process()->call_location();
@@ -423,7 +423,6 @@ void smpi_trace_set_call_location__(const char* file, int* line)
 {
   smpi_trace_set_call_location(file, *line);
 }
-}
 
 void smpi_bench_destroy()
 {
index ad05eae..34bdf94 100644 (file)
@@ -17,7 +17,8 @@ namespace app {
 
 class Instance {
 public:
-  Instance(const char* name, int max_no_processes, int process_count, MPI_Comm comm, msg_bar_t finalization_barrier)
+  Instance(const std::string name, int max_no_processes, int process_count, MPI_Comm comm,
+           msg_bar_t finalization_barrier)
       : name(name)
       , size(max_no_processes)
       , present_processes(0)
@@ -25,7 +26,7 @@ public:
       , finalization_barrier(finalization_barrier)
   { }
 
-  const char* name;
+  const std::string name;
   int size;
   int present_processes;
   MPI_Comm comm_world;
@@ -63,7 +64,7 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
     }
   }
 
-  Instance instance(name, num_processes, process_count, MPI_COMM_NULL, MSG_barrier_init(num_processes));
+  Instance instance(std::string(name), num_processes, process_count, MPI_COMM_NULL, MSG_barrier_init(num_processes));
   MPI_Group group     = new simgrid::smpi::Group(instance.size);
   instance.comm_world = new simgrid::smpi::Comm(group, nullptr);
   MPI_Attr_put(instance.comm_world, MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(instance.size));
@@ -73,7 +74,7 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
   smpi_instances.insert(std::pair<std::string, Instance>(name, instance));
 }
 
-void smpi_deployment_register_process(const char* instance_id, int rank, simgrid::s4u::ActorPtr actor)
+void smpi_deployment_register_process(const std::string instance_id, int rank, simgrid::s4u::ActorPtr actor)
 {
   if (smpi_instances.empty()) // no instance registered, we probably used smpirun.
     return;
@@ -84,7 +85,7 @@ void smpi_deployment_register_process(const char* instance_id, int rank, simgrid
   instance.comm_world->group()->set_mapping(actor, rank);
 }
 
-MPI_Comm* smpi_deployment_comm_world(const char* instance_id)
+MPI_Comm* smpi_deployment_comm_world(const std::string instance_id)
 {
   if (smpi_instances.empty()) { // no instance registered, we probably used smpirun.
     return nullptr;
@@ -93,7 +94,7 @@ MPI_Comm* smpi_deployment_comm_world(const char* instance_id)
   return &instance.comm_world;
 }
 
-msg_bar_t smpi_deployment_finalization_barrier(const char* instance_id)
+msg_bar_t smpi_deployment_finalization_barrier(const std::string instance_id)
 {
   if (smpi_instances.empty()) { // no instance registered, we probably used smpirun.
     return nullptr;
index 2d0ffd2..8fe3b4e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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. */
@@ -87,31 +87,31 @@ struct doublecomplex {
   doublereal i;
 };
 
-extern "C" XBT_PUBLIC(doublereal) smpi_get_host_power_peak_at_(integer *pstate_index);
+extern "C" XBT_PUBLIC doublereal smpi_get_host_power_peak_at_(integer* pstate_index);
 doublereal smpi_get_host_power_peak_at_(integer *pstate_index)
 {
   return static_cast<doublereal>(smpi_get_host_power_peak_at((int)*pstate_index));
 }
 
-extern "C" XBT_PUBLIC(doublereal) smpi_get_host_current_power_peak_();
+extern "C" XBT_PUBLIC doublereal smpi_get_host_current_power_peak_();
 doublereal smpi_get_host_current_power_peak_()
 {
   return smpi_get_host_current_power_peak();
 }
 
-extern "C" XBT_PUBLIC(integer) smpi_get_host_nb_pstates_();
+extern "C" XBT_PUBLIC integer smpi_get_host_nb_pstates_();
 integer smpi_get_host_nb_pstates_()
 {
   return static_cast<integer>(smpi_get_host_nb_pstates());
 }
 
-extern "C" XBT_PUBLIC(void) smpi_set_host_pstate_(integer *pstate_index);
+extern "C" XBT_PUBLIC void smpi_set_host_pstate_(integer* pstate_index);
 void smpi_set_host_pstate_(integer *pstate_index)
 {
   smpi_set_host_pstate(static_cast<int>(*pstate_index));
 }
 
-extern "C" XBT_PUBLIC(doublereal) smpi_get_host_consumed_energy_();
+extern "C" XBT_PUBLIC doublereal smpi_get_host_consumed_energy_();
 doublereal smpi_get_host_consumed_energy_()
 {
   return static_cast<doublereal>(smpi_get_host_consumed_energy());
index 769c009..b52f69a 100644 (file)
@@ -78,7 +78,7 @@ MPI_Errhandler *MPI_ERRORS_ARE_FATAL = nullptr;
 MPI_Errhandler *MPI_ERRHANDLER_NULL = nullptr;
 // No instance gets manually created; check also the smpirun.in script as
 // this default name is used there as well (when the <actor> tag is generated).
-static const char* smpi_default_instance_name = "smpirun";
+static const std::string smpi_default_instance_name("smpirun");
 static simgrid::config::Flag<double> smpi_wtime_sleep(
   "smpi/wtime", "Minimum time to inject inside a call to MPI_Wtime", 0.0);
 static simgrid::config::Flag<double> smpi_init_sleep(
@@ -114,7 +114,7 @@ void smpi_process_init(int *argc, char ***argv){
 }
 
 int smpi_process_index(){
-  return simgrid::s4u::Actor::self()->getPid();
+  return simgrid::s4u::this_actor::getPid();
 }
 
 void * smpi_process_get_user_data(){
@@ -192,8 +192,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
   if ((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && (static_cast<char*>(buff) >= smpi_data_exe_start) &&
       (static_cast<char*>(buff) < smpi_data_exe_start + smpi_data_exe_size)) {
     XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
-
-    smpi_switch_data_segment(Actor::self()->getPid());
+    smpi_switch_data_segment(comm->src_proc->iface());
     tmpbuff = static_cast<void*>(xbt_malloc(buff_size));
     memcpy_private(tmpbuff, buff, private_blocks);
   }
@@ -201,7 +200,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b
   if ((smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP) && ((char*)comm->dst_buff >= smpi_data_exe_start) &&
       ((char*)comm->dst_buff < smpi_data_exe_start + smpi_data_exe_size)) {
     XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
-    smpi_switch_data_segment(Actor::self()->getPid());
+    smpi_switch_data_segment(comm->dst_proc->iface());
   }
   XBT_DEBUG("Copying %zu bytes from %p to %p", buff_size, tmpbuff,comm->dst_buff);
   memcpy_private(comm->dst_buff, tmpbuff, private_blocks);
@@ -369,6 +368,7 @@ static void smpi_init_options(){
   simgrid::smpi::Colls::smpi_coll_cleanup_callback = nullptr;
   smpi_cpu_threshold                               = xbt_cfg_get_double("smpi/cpu-threshold");
   smpi_host_speed                                  = xbt_cfg_get_double("smpi/host-speed");
+  xbt_assert(smpi_host_speed >= 0, "You're trying to set the host_speed to a negative value (%f)", smpi_host_speed);
   std::string smpi_privatize_option                = xbt_cfg_get_string("smpi/privatization");
   if (smpi_privatize_option == "no" || smpi_privatize_option == "0")
     smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
@@ -542,10 +542,8 @@ int smpi_main(const char* executable, int argc, char *argv[])
         smpi_run_entry_point(entry_point, args);
       });
     };
-
   }
   else {
-
     // Load the dynamic library and resolve the entry point:
     void* handle = dlopen(executable, RTLD_LAZY | RTLD_LOCAL);
     if (handle == nullptr)
@@ -561,12 +559,11 @@ int smpi_main(const char* executable, int argc, char *argv[])
         smpi_run_entry_point(entry_point, args);
       });
     };
-
   }
 
   SMPI_init();
   SIMIX_launch_application(argv[2]);
-  SMPI_app_instance_register(smpi_default_instance_name, nullptr,
+  SMPI_app_instance_register(smpi_default_instance_name.c_str(), nullptr,
                              process_data.size()); // This call has a side effect on process_count...
   MPI_COMM_WORLD = *smpi_deployment_comm_world(smpi_default_instance_name);
   smpi_universe_size = process_count;
index 3556def..e704823 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2018. 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. */
@@ -97,12 +97,13 @@ static void* asan_safe_memcpy(void* dest, void* src, size_t n)
 #endif
 
 /** Map a given SMPI privatization segment (make a SMPI process active) */
-void smpi_switch_data_segment(int dest) {
-  if (smpi_loaded_page == dest)//no need to switch, we've already loaded the one we want
+void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor)
+{
+  if (smpi_loaded_page == actor->getPid()) // no need to switch, we've already loaded the one we want
     return;
 
   // So the job:
-  smpi_really_switch_data_segment(dest);
+  smpi_really_switch_data_segment(actor);
 }
 
 /** Map a given SMPI privatization segment (make a SMPI process active)  even if SMPI thinks it is already active
@@ -110,21 +111,21 @@ void smpi_switch_data_segment(int dest) {
  *  When doing a state restoration, the state of the restored variables  might not be consistent with the state of the
  *  virtual memory. In this case, we to change the data segment.
  */
-void smpi_really_switch_data_segment(int dest)
+void smpi_really_switch_data_segment(simgrid::s4u::ActorPtr actor)
 {
   if (smpi_data_exe_size == 0) // no need to switch
     return;
 
 #if HAVE_PRIVATIZATION
   // FIXME, cross-process support (mmap across process when necessary)
-  simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::byPid(dest+1));
+  XBT_DEBUG("Switching data frame to the one of process %ld", actor->getPid());
+  simgrid::smpi::Process* process = smpi_process_remote(actor);
   int current                     = process->privatized_region()->file_descriptor;
-  XBT_DEBUG("Switching data frame to the one of process %d", dest);
   void* tmp =
       mmap(TOPAGE(smpi_data_exe_start), smpi_data_exe_size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0);
   if (tmp != TOPAGE(smpi_data_exe_start))
     xbt_die("Couldn't map the new region (errno %d): %s", errno, strerror(errno));
-  smpi_loaded_page = dest;
+  smpi_loaded_page = actor->getPid();
 #endif
 }
 
@@ -229,3 +230,40 @@ void smpi_destroy_global_memory_segments(){
 #endif
 }
 
+static int sendbuffer_size = 0;
+static char* sendbuffer    = nullptr;
+static int recvbuffer_size = 0;
+static char* recvbuffer    = nullptr;
+
+//allocate a single buffer for all sends, growing it if needed
+void* smpi_get_tmp_sendbuffer(int size)
+{
+  if (not smpi_process()->replaying())
+    return xbt_malloc(size);
+  if (sendbuffer_size<size){
+    sendbuffer=static_cast<char*>(xbt_realloc(sendbuffer,size));
+    sendbuffer_size=size;
+  }
+  return sendbuffer;
+}
+
+//allocate a single buffer for all recv
+void* smpi_get_tmp_recvbuffer(int size){
+  if (not smpi_process()->replaying())
+    return xbt_malloc(size);
+  if (recvbuffer_size<size){
+    recvbuffer=static_cast<char*>(xbt_realloc(recvbuffer,size));
+    recvbuffer_size=size;
+  }
+  return recvbuffer;
+}
+
+void smpi_free_tmp_buffer(void* buf){
+  if (not smpi_process()->replaying())
+    xbt_free(buf);
+}
+
+void smpi_free_replay_tmp_buffers(){
+  xbt_free(sendbuffer);
+  xbt_free(recvbuffer);
+}
index 1d677e5..dc1c516 100644 (file)
@@ -63,8 +63,8 @@ Process::~Process()
 void Process::set_data(int* argc, char*** argv)
 {
   instance_id_      = std::string((*argv)[1]);
-  comm_world_       = smpi_deployment_comm_world(instance_id_.c_str());
-  msg_bar_t barrier = smpi_deployment_finalization_barrier(instance_id_.c_str());
+  comm_world_       = smpi_deployment_comm_world(instance_id_);
+  msg_bar_t barrier = smpi_deployment_finalization_barrier(instance_id_);
   if (barrier != nullptr) // don't overwrite the current one if the instance has none
     finalization_barrier_ = barrier;
 
@@ -81,14 +81,14 @@ void Process::set_data(int* argc, char*** argv)
   argv_ = argv;
   // set the process attached to the mailbox
   mailbox_small_->setReceiver(process_);
-  XBT_DEBUG("<%lu> SMPI process has been initialized: %p", process_->getPid(), process_.get());
+  XBT_DEBUG("<%ld> SMPI process has been initialized: %p", process_->getPid(), process_.get());
 }
 
 /** @brief Prepares the current process for termination. */
 void Process::finalize()
 {
   state_ = SMPI_FINALIZED;
-  XBT_DEBUG("<%lu> Process left the game", process_->getPid());
+  XBT_DEBUG("<%ld> Process left the game", process_->getPid());
 
   // This leads to an explosion of the search graph which cannot be reduced:
   if(MC_is_active() || MC_record_replay_is_active())
@@ -262,12 +262,11 @@ void Process::init(int *argc, char ***argv){
     // cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
     // this up here so that I can set the privatized region before the switch.
     Process* process = smpi_process_remote(proc);
-    int my_proc_id   = proc->getPid();
     if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
       /* Now using the segment index of this process  */
       process->set_privatized_region(smpi_init_global_memory_segment_process());
       /* Done at the process's creation */
-      SMPI_switch_data_segment(my_proc_id);
+      SMPI_switch_data_segment(proc);
     }
 
     process->set_data(argc, argv);
index 8591b82..278f0a5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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 "smpi_request.hpp"
 #include "xbt/replay.hpp"
 
+#include <boost/algorithm/string/join.hpp>
+#include <memory>
+#include <numeric>
 #include <unordered_map>
 #include <vector>
 
-#define KEY_SIZE (sizeof(int) * 2 + 1)
-
 using simgrid::s4u::Actor;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
 
-int communicator_size = 0;
-static int active_processes = 0;
-std::unordered_map<int,std::vector<MPI_Request>*> reqq;
+static int active_processes  = 0;
+static std::unordered_map<int, std::vector<MPI_Request>*> reqq;
 
-MPI_Datatype MPI_DEFAULT_TYPE;
-MPI_Datatype MPI_CURRENT_TYPE;
+static MPI_Datatype MPI_DEFAULT_TYPE;
 
-static int sendbuffer_size=0;
-char* sendbuffer=nullptr;
-static int recvbuffer_size=0;
-char* recvbuffer=nullptr;
+#define CHECK_ACTION_PARAMS(action, mandatory, optional)                                                               \
+  {                                                                                                                    \
+    if (action.size() < static_cast<unsigned long>(mandatory + 2))                                                     \
+      THROWF(arg_error, 0, "%s replay failed.\n"                                                                       \
+                           "%zu items were given on the line. First two should be process_id and action.  "            \
+                           "This action needs after them %lu mandatory arguments, and accepts %lu optional ones. \n"   \
+                           "Please contact the Simgrid team if support is needed",                                     \
+             __func__, action.size(), static_cast<unsigned long>(mandatory), static_cast<unsigned long>(optional));    \
+  }
 
-static void log_timed_action (const char *const *action, double clock){
+static void log_timed_action(simgrid::xbt::ReplayAction& action, double clock)
+{
   if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
-    char *name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, smpi_process()->simulated_elapsed()-clock);
-    xbt_free(name);
+    std::string s = boost::algorithm::join(action, " ");
+    XBT_VERB("%s %f", s.c_str(), smpi_process()->simulated_elapsed() - clock);
   }
 }
 
 static std::vector<MPI_Request>* get_reqq_self()
 {
-  return reqq.at(Actor::self()->getPid());
+  return reqq.at(simgrid::s4u::this_actor::getPid());
 }
 
 static void set_reqq_self(std::vector<MPI_Request> *mpi_request)
 {
-   reqq.insert({Actor::self()->getPid(), mpi_request});
-}
-
-//allocate a single buffer for all sends, growing it if needed
-void* smpi_get_tmp_sendbuffer(int size)
-{
-  if (not smpi_process()->replaying())
-    return xbt_malloc(size);
-  if (sendbuffer_size<size){
-    sendbuffer=static_cast<char*>(xbt_realloc(sendbuffer,size));
-    sendbuffer_size=size;
-  }
-  return sendbuffer;
-}
-
-//allocate a single buffer for all recv
-void* smpi_get_tmp_recvbuffer(int size){
-  if (not smpi_process()->replaying())
-    return xbt_malloc(size);
-  if (recvbuffer_size<size){
-    recvbuffer=static_cast<char*>(xbt_realloc(recvbuffer,size));
-    recvbuffer_size=size;
-  }
-  return recvbuffer;
-}
-
-void smpi_free_tmp_buffer(void* buf){
-  if (not smpi_process()->replaying())
-    xbt_free(buf);
+  reqq.insert({simgrid::s4u::this_actor::getPid(), mpi_request});
 }
 
 /* Helper function */
-static double parse_double(const char *string)
-{
-  char *endptr;
-  double value = strtod(string, &endptr);
-  if (*endptr != '\0')
-    THROWF(unknown_error, 0, "%s is not a double", string);
-  return value;
-}
-
-
-//TODO: this logic should be moved inside the datatype class, to support all predefined types and get rid of is_replayable.
-static MPI_Datatype decode_datatype(const char *const action)
+static double parse_double(std::string string)
 {
-  switch(atoi(action)) {
-    case 0:
-      MPI_CURRENT_TYPE=MPI_DOUBLE;
-      break;
-    case 1:
-      MPI_CURRENT_TYPE=MPI_INT;
-      break;
-    case 2:
-      MPI_CURRENT_TYPE=MPI_CHAR;
-      break;
-    case 3:
-      MPI_CURRENT_TYPE=MPI_SHORT;
-      break;
-    case 4:
-      MPI_CURRENT_TYPE=MPI_LONG;
-      break;
-    case 5:
-      MPI_CURRENT_TYPE=MPI_FLOAT;
-      break;
-    case 6:
-      MPI_CURRENT_TYPE=MPI_BYTE;
-      break;
-    default:
-      MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
-      break;
-  }
-   return MPI_CURRENT_TYPE;
+  return xbt_str_parse_double(string.c_str(), "%s is not a double");
 }
 
-const char* encode_datatype(MPI_Datatype datatype)
-{
-  if (datatype==MPI_BYTE)
-      return "";
-  if(datatype==MPI_DOUBLE)
-      return "0";
-  if(datatype==MPI_INT)
-      return "1";
-  if(datatype==MPI_CHAR)
-      return "2";
-  if(datatype==MPI_SHORT)
-      return "3";
-  if(datatype==MPI_LONG)
-    return "4";
-  if(datatype==MPI_FLOAT)
-      return "5";
-  // default - not implemented.
-  // do not warn here as we pass in this function even for other trace formats
-  return "-1";
-}
-
-#define CHECK_ACTION_PARAMS(action, mandatory, optional) {\
-    int i=0;\
-    while(action[i]!=nullptr)\
-     i++;\
-    if(i<mandatory+2)                                           \
-    THROWF(arg_error, 0, "%s replay failed.\n" \
-          "%d items were given on the line. First two should be process_id and action.  " \
-          "This action needs after them %d mandatory arguments, and accepts %d optional ones. \n" \
-          "Please contact the Simgrid team if support is needed", __FUNCTION__, i, mandatory, optional);\
-  }
-
 namespace simgrid {
 namespace smpi {
 
-static void action_init(const char *const *action)
-{
-  XBT_DEBUG("Initialize the counters");
-  CHECK_ACTION_PARAMS(action, 0, 1)
-  if(action[2])
-    MPI_DEFAULT_TYPE = MPI_DOUBLE; // default MPE datatype
-  else
-    MPI_DEFAULT_TYPE = MPI_BYTE; // default TAU datatype
-
-  /* start a simulated timer */
-  smpi_process()->simulated_start();
-  /*initialize the number of active processes */
-  active_processes = smpi_process_count();
-
-  set_reqq_self(new std::vector<MPI_Request>);
-}
-
-static void action_finalize(const char *const *action)
-{
-  /* Nothing to do */
-}
-
-static void action_comm_size(const char *const *action)
-{
-  communicator_size = parse_double(action[2]);
-  log_timed_action (action, smpi_process()->simulated_elapsed());
-}
-
-static void action_comm_split(const char *const *action)
-{
-  log_timed_action (action, smpi_process()->simulated_elapsed());
-}
-
-static void action_comm_dup(const char *const *action)
-{
-  log_timed_action (action, smpi_process()->simulated_elapsed());
-}
-
-static void action_compute(const char *const *action)
-{
-  CHECK_ACTION_PARAMS(action, 1, 0)
-  double clock = smpi_process()->simulated_elapsed();
-  double flops= parse_double(action[2]);
-  int my_proc_id = Actor::self()->getPid();
-
-  TRACE_smpi_computing_in(my_proc_id, flops);
-  smpi_execute_flops(flops);
-  TRACE_smpi_computing_out(my_proc_id);
-
-  log_timed_action (action, clock);
-}
-
-static void action_send(const char *const *action)
-{
-  CHECK_ACTION_PARAMS(action, 2, 1)
-  int to = atoi(action[2]);
-  double size=parse_double(action[3]);
-  double clock = smpi_process()->simulated_elapsed();
-
-  if(action[4])
-    MPI_CURRENT_TYPE=decode_datatype(action[4]);
-  else
-    MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  int my_proc_id = Actor::self()->getPid();
-  int dst_traced = MPI_COMM_WORLD->group()->actor(to)->getPid();
-
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::Pt2PtTIData("send", to, size, encode_datatype(MPI_CURRENT_TYPE)));
-  if (not TRACE_smpi_view_internals())
-    TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, 0, size * MPI_CURRENT_TYPE->size());
-
-  Request::send(nullptr, size, MPI_CURRENT_TYPE, to , 0, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(my_proc_id);
-
-  log_timed_action(action, clock);
-}
-
-static void action_Isend(const char *const *action)
-{
-  CHECK_ACTION_PARAMS(action, 2, 1)
-  int to = atoi(action[2]);
-  double size=parse_double(action[3]);
-  double clock = smpi_process()->simulated_elapsed();
-
-  if(action[4])
-    MPI_CURRENT_TYPE=decode_datatype(action[4]);
-  else
-    MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  int my_proc_id = Actor::self()->getPid();
-  int dst_traced = MPI_COMM_WORLD->group()->actor(to)->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::Pt2PtTIData("Isend", to, size, encode_datatype(MPI_CURRENT_TYPE)));
-  if (not TRACE_smpi_view_internals())
-    TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, 0, size * MPI_CURRENT_TYPE->size());
-
-  MPI_Request request = Request::isend(nullptr, size, MPI_CURRENT_TYPE, to, 0, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(my_proc_id);
-
-  get_reqq_self()->push_back(request);
-
-  log_timed_action (action, clock);
-}
-
-static void action_recv(const char *const *action) {
-  CHECK_ACTION_PARAMS(action, 2, 1)
-  int from = atoi(action[2]);
-  double size=parse_double(action[3]);
-  double clock = smpi_process()->simulated_elapsed();
-  MPI_Status status;
-
-  if(action[4])
-    MPI_CURRENT_TYPE=decode_datatype(action[4]);
-  else
-    MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  int my_proc_id = Actor::self()->getPid();
-  int src_traced = MPI_COMM_WORLD->group()->actor(from)->getPid();
-
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::Pt2PtTIData("recv", from, size, encode_datatype(MPI_CURRENT_TYPE)));
-
-  //unknown size from the receiver point of view
-  if (size <= 0.0) {
-    Request::probe(from, 0, MPI_COMM_WORLD, &status);
-    size=status.count;
+namespace replay {
+class ActionArgParser {
+public:
+  virtual ~ActionArgParser() = default;
+  virtual void parse(simgrid::xbt::ReplayAction& action, std::string name) { CHECK_ACTION_PARAMS(action, 0, 0) }
+};
+
+class SendRecvParser : public ActionArgParser {
+public:
+  /* communication partner; if we send, this is the receiver and vice versa */
+  int partner;
+  double size;
+  MPI_Datatype datatype1 = MPI_DEFAULT_TYPE;
+
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    CHECK_ACTION_PARAMS(action, 2, 1)
+    partner = std::stoi(action[2]);
+    size    = parse_double(action[3]);
+    if (action.size() > 4)
+      datatype1 = simgrid::smpi::Datatype::decode(action[4]);
   }
+};
 
-  Request::recv(nullptr, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD, &status);
+class ComputeParser : public ActionArgParser {
+public:
+  /* communication partner; if we send, this is the receiver and vice versa */
+  double flops;
 
-  TRACE_smpi_comm_out(my_proc_id);
-  if (not TRACE_smpi_view_internals()) {
-    TRACE_smpi_recv(src_traced, my_proc_id, 0);
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    CHECK_ACTION_PARAMS(action, 1, 0)
+    flops = parse_double(action[2]);
   }
-
-  log_timed_action (action, clock);
-}
-
-static void action_Irecv(const char *const *action)
-{
-  CHECK_ACTION_PARAMS(action, 2, 1)
-  int from = atoi(action[2]);
-  double size=parse_double(action[3]);
-  double clock = smpi_process()->simulated_elapsed();
-
-  if(action[4])
-    MPI_CURRENT_TYPE=decode_datatype(action[4]);
-  else
-    MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  int my_proc_id = Actor::self()->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::Pt2PtTIData("Irecv", from, size, encode_datatype(MPI_CURRENT_TYPE)));
-  MPI_Status status;
-  //unknow size from the receiver pov
-  if (size <= 0.0) {
-    Request::probe(from, 0, MPI_COMM_WORLD, &status);
-    size = status.count;
+};
+
+class CollCommParser : public ActionArgParser {
+public:
+  double size;
+  double comm_size;
+  double comp_size;
+  int send_size;
+  int recv_size;
+  int root = 0;
+  MPI_Datatype datatype1 = MPI_DEFAULT_TYPE;
+  MPI_Datatype datatype2 = MPI_DEFAULT_TYPE;
+};
+
+class BcastArgParser : public CollCommParser {
+public:
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    CHECK_ACTION_PARAMS(action, 1, 2)
+    size = parse_double(action[2]);
+    root = (action.size() > 3) ? std::stoi(action[3]) : 0;
+    if (action.size() > 4)
+      datatype1 = simgrid::smpi::Datatype::decode(action[4]);
   }
-
-  MPI_Request request = Request::irecv(nullptr, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(my_proc_id);
-  get_reqq_self()->push_back(request);
-
-  log_timed_action (action, clock);
-}
-
-static void action_test(const char* const* action)
-{
-  CHECK_ACTION_PARAMS(action, 0, 0)
-  double clock = smpi_process()->simulated_elapsed();
-  MPI_Status status;
-
-  MPI_Request request = get_reqq_self()->back();
-  get_reqq_self()->pop_back();
-  //if request is null here, this may mean that a previous test has succeeded
-  //Different times in traced application and replayed version may lead to this
-  //In this case, ignore the extra calls.
-  if(request!=nullptr){
-    int my_proc_id = Actor::self()->getPid();
-    TRACE_smpi_testing_in(my_proc_id);
-
-    int flag = Request::test(&request, &status);
-
-    XBT_DEBUG("MPI_Test result: %d", flag);
-    /* push back request in vector to be caught by a subsequent wait. if the test did succeed, the request is now nullptr.*/
-    get_reqq_self()->push_back(request);
-
-    TRACE_smpi_testing_out(my_proc_id);
+};
+
+class ReduceArgParser : public CollCommParser {
+public:
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    CHECK_ACTION_PARAMS(action, 2, 2)
+    comm_size = parse_double(action[2]);
+    comp_size = parse_double(action[3]);
+    root      = (action.size() > 4) ? std::stoi(action[4]) : 0;
+    if (action.size() > 5)
+      datatype1 = simgrid::smpi::Datatype::decode(action[5]);
   }
-  log_timed_action (action, clock);
-}
-
-static void action_wait(const char *const *action){
-  CHECK_ACTION_PARAMS(action, 0, 0)
-  double clock = smpi_process()->simulated_elapsed();
-  MPI_Status status;
-
-  xbt_assert(get_reqq_self()->size(), "action wait not preceded by any irecv or isend: %s",
-      xbt_str_join_array(action," "));
-  MPI_Request request = get_reqq_self()->back();
-  get_reqq_self()->pop_back();
-
-  if (request==nullptr){
-    /* Assume that the trace is well formed, meaning the comm might have been caught by a MPI_test. Then just return.*/
-    return;
+};
+
+class AllReduceArgParser : public CollCommParser {
+public:
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    CHECK_ACTION_PARAMS(action, 2, 1)
+    comm_size = parse_double(action[2]);
+    comp_size = parse_double(action[3]);
+    if (action.size() > 4)
+      datatype1 = simgrid::smpi::Datatype::decode(action[4]);
   }
-
-  int rank = request->comm() != MPI_COMM_NULL ? request->comm()->rank() : -1;
-
-  MPI_Group group = request->comm()->group();
-  int src_traced = group->rank(request->src());
-  int dst_traced = group->rank(request->dst());
-  int is_wait_for_receive = (request->flags() & RECV);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("wait"));
-
-  Request::wait(&request, &status);
-
-  TRACE_smpi_comm_out(rank);
-  if (is_wait_for_receive)
-    TRACE_smpi_recv(src_traced, dst_traced, 0);
-  log_timed_action (action, clock);
-}
-
-static void action_waitall(const char *const *action){
-  CHECK_ACTION_PARAMS(action, 0, 0)
-  double clock = smpi_process()->simulated_elapsed();
-  const unsigned int count_requests = get_reqq_self()->size();
-
-  if (count_requests>0) {
-    MPI_Status status[count_requests];
-
-    int my_proc_id_traced = Actor::self()->getPid();
-    TRACE_smpi_comm_in(my_proc_id_traced, __FUNCTION__,
-                       new simgrid::instr::Pt2PtTIData("waitAll", -1, count_requests, ""));
-    int recvs_snd[count_requests];
-    int recvs_rcv[count_requests];
-    for (unsigned int i = 0; i < count_requests; i++) {
-      const auto& req = (*get_reqq_self())[i];
-      if (req && (req->flags() & RECV)) {
-        recvs_snd[i] = req->src();
-        recvs_rcv[i] = req->dst();
-      } else
-        recvs_snd[i] = -100;
-   }
-   Request::waitall(count_requests, &(*get_reqq_self())[0], status);
-
-   for (unsigned i = 0; i < count_requests; i++) {
-     if (recvs_snd[i]!=-100)
-       TRACE_smpi_recv(recvs_snd[i], recvs_rcv[i],0);
-   }
-   TRACE_smpi_comm_out(my_proc_id_traced);
-  }
-  log_timed_action (action, clock);
-}
-
-static void action_barrier(const char *const *action){
-  double clock = smpi_process()->simulated_elapsed();
-  int my_proc_id = Actor::self()->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::NoOpTIData("barrier"));
-
-  Colls::barrier(MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
-
-static void action_bcast(const char *const *action)
-{
-  CHECK_ACTION_PARAMS(action, 1, 2)
-  double size = parse_double(action[2]);
-  double clock = smpi_process()->simulated_elapsed();
-  int root=0;
-  /* Initialize MPI_CURRENT_TYPE in order to decrease the number of the checks */
-  MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  if(action[3]) {
-    root= atoi(action[3]);
-    if(action[4])
-      MPI_CURRENT_TYPE=decode_datatype(action[4]);
+};
+
+class AllToAllArgParser : public CollCommParser {
+public:
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    CHECK_ACTION_PARAMS(action, 2, 1)
+    comm_size = MPI_COMM_WORLD->size();
+    send_size = parse_double(action[2]);
+    recv_size = parse_double(action[3]);
+
+    if (action.size() > 4)
+      datatype1 = simgrid::smpi::Datatype::decode(action[4]);
+    if (action.size() > 5)
+      datatype2 = simgrid::smpi::Datatype::decode(action[5]);
   }
-
-  int my_proc_id = Actor::self()->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(root)->getPid(), -1.0, size,
-                                                    -1, encode_datatype(MPI_CURRENT_TYPE), ""));
-
-  void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
-
-  Colls::bcast(sendbuf, size, MPI_CURRENT_TYPE, root, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
-
-static void action_reduce(const char *const *action)
-{
-  CHECK_ACTION_PARAMS(action, 2, 2)
-  double comm_size = parse_double(action[2]);
-  double comp_size = parse_double(action[3]);
-  double clock = smpi_process()->simulated_elapsed();
-  int root=0;
-  MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  if(action[4]) {
-    root= atoi(action[4]);
-    if(action[5])
-      MPI_CURRENT_TYPE=decode_datatype(action[5]);
+};
+
+class GatherArgParser : public CollCommParser {
+public:
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    /* The structure of the gather action for the rank 0 (total 4 processes) is the following:
+          0 gather 68 68 0 0 0
+        where:
+          1) 68 is the sendcounts
+          2) 68 is the recvcounts
+          3) 0 is the root node
+          4) 0 is the send datatype id, see simgrid::smpi::Datatype::decode()
+          5) 0 is the recv datatype id, see simgrid::smpi::Datatype::decode()
+    */
+    CHECK_ACTION_PARAMS(action, 2, 3)
+    comm_size = MPI_COMM_WORLD->size();
+    send_size = parse_double(action[2]);
+    recv_size = parse_double(action[3]);
+
+    if (name == "gather") {
+      root      = (action.size() > 4) ? std::stoi(action[4]) : 0;
+      if (action.size() > 5)
+        datatype1 = simgrid::smpi::Datatype::decode(action[5]);
+      if (action.size() > 6)
+        datatype2 = simgrid::smpi::Datatype::decode(action[6]);
+    }
+    else {
+      if (action.size() > 4)
+        datatype1 = simgrid::smpi::Datatype::decode(action[4]);
+      if (action.size() > 5)
+        datatype2 = simgrid::smpi::Datatype::decode(action[5]);
+    }
   }
+};
+
+class GatherVArgParser : public CollCommParser {
+public:
+  int recv_size_sum;
+  std::shared_ptr<std::vector<int>> recvcounts;
+  std::vector<int> disps;
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    /* The structure of the gatherv action for the rank 0 (total 4 processes) is the following:
+         0 gather 68 68 10 10 10 0 0 0
+       where:
+         1) 68 is the sendcount
+         2) 68 10 10 10 is the recvcounts
+         3) 0 is the root node
+         4) 0 is the send datatype id, see simgrid::smpi::Datatype::decode()
+         5) 0 is the recv datatype id, see simgrid::smpi::Datatype::decode()
+    */
+    comm_size = MPI_COMM_WORLD->size();
+    CHECK_ACTION_PARAMS(action, comm_size+1, 2)
+    send_size = parse_double(action[2]);
+    disps     = std::vector<int>(comm_size, 0);
+    recvcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+
+    if (name == "gatherV") {
+      root = (action.size() > 3 + comm_size) ? std::stoi(action[3 + comm_size]) : 0;
+      if (action.size() > 4 + comm_size)
+        datatype1 = simgrid::smpi::Datatype::decode(action[4 + comm_size]);
+      if (action.size() > 5 + comm_size)
+        datatype2 = simgrid::smpi::Datatype::decode(action[5 + comm_size]);
+    }
+    else {
+      int datatype_index = 0;
+      int disp_index     = 0;
+      /* The 3 comes from "0 gather <sendcount>", which must always be present.
+       * The + comm_size is the recvcounts array, which must also be present
+       */
+      if (action.size() > 3 + comm_size + comm_size) { /* datatype + disp are specified */
+        datatype_index = 3 + comm_size;
+        disp_index     = datatype_index + 1;
+        datatype1      = simgrid::smpi::Datatype::decode(action[datatype_index]);
+        datatype2      = simgrid::smpi::Datatype::decode(action[datatype_index]);
+      } else if (action.size() > 3 + comm_size + 2) { /* disps specified; datatype is not specified; use the default one */
+        disp_index     = 3 + comm_size;
+      } else if (action.size() > 3 + comm_size)  { /* only datatype, no disp specified */
+        datatype_index = 3 + comm_size;
+        datatype1      = simgrid::smpi::Datatype::decode(action[datatype_index]);
+        datatype2      = simgrid::smpi::Datatype::decode(action[datatype_index]);
+      }
+
+      if (disp_index != 0) {
+        for (unsigned int i = 0; i < comm_size; i++)
+          disps[i]          = std::stoi(action[disp_index + i]);
+      }
+    }
 
-  int my_proc_id = Actor::self()->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(root)->getPid(), comp_size,
-                                                    comm_size, -1, encode_datatype(MPI_CURRENT_TYPE), ""));
-
-  void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
-  void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
-  Colls::reduce(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, root, MPI_COMM_WORLD);
-  smpi_execute_flops(comp_size);
-
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
-
-static void action_allReduce(const char *const *action) {
-  CHECK_ACTION_PARAMS(action, 2, 1)
-  double comm_size = parse_double(action[2]);
-  double comp_size = parse_double(action[3]);
-
-  if(action[4])
-    MPI_CURRENT_TYPE=decode_datatype(action[4]);
-  else
-    MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  double clock = smpi_process()->simulated_elapsed();
-  int my_proc_id = Actor::self()->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__, new simgrid::instr::CollTIData("allReduce", -1, comp_size, comm_size, -1,
-                                                                              encode_datatype(MPI_CURRENT_TYPE), ""));
-
-  void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
-  void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
-  Colls::allreduce(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
-  smpi_execute_flops(comp_size);
-
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
-
-static void action_allToAll(const char *const *action) {
-  CHECK_ACTION_PARAMS(action, 2, 2) //two mandatory (send and recv volumes) and two optional (corresponding datatypes)
-  double clock = smpi_process()->simulated_elapsed();
-  int comm_size = MPI_COMM_WORLD->size();
-  int send_size = parse_double(action[2]);
-  int recv_size = parse_double(action[3]);
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-
-  if(action[4] && action[5]) {
-    MPI_CURRENT_TYPE=decode_datatype(action[4]);
-    MPI_CURRENT_TYPE2=decode_datatype(action[5]);
+    for (unsigned int i = 0; i < comm_size; i++) {
+      (*recvcounts)[i] = std::stoi(action[i + 3]);
+    }
+    recv_size_sum = std::accumulate(recvcounts->begin(), recvcounts->end(), 0);
   }
-  else
-    MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
-
-  void *send = smpi_get_tmp_sendbuffer(send_size*comm_size* MPI_CURRENT_TYPE->size());
-  void *recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* MPI_CURRENT_TYPE2->size());
-
-  int my_proc_id = Actor::self()->getPid();
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::CollTIData("allToAll", -1, -1.0, send_size, recv_size,
-                                                    encode_datatype(MPI_CURRENT_TYPE),
-                                                    encode_datatype(MPI_CURRENT_TYPE2)));
-
-  Colls::alltoall(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
-
-static void action_gather(const char *const *action) {
-  /* The structure of the gather action for the rank 0 (total 4 processes) is the following:
-        0 gather 68 68 0 0 0
-      where:
-        1) 68 is the sendcounts
-        2) 68 is the recvcounts
-        3) 0 is the root node
-        4) 0 is the send datatype id, see decode_datatype()
-        5) 0 is the recv datatype id, see decode_datatype()
-  */
-  CHECK_ACTION_PARAMS(action, 2, 3)
-  double clock = smpi_process()->simulated_elapsed();
-  int comm_size = MPI_COMM_WORLD->size();
-  int send_size = parse_double(action[2]);
-  int recv_size = parse_double(action[3]);
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-  if(action[4] && action[5]) {
-    MPI_CURRENT_TYPE=decode_datatype(action[5]);
-    MPI_CURRENT_TYPE2=decode_datatype(action[6]);
-  } else {
-    MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
+};
+
+class ScatterArgParser : public CollCommParser {
+public:
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    /* The structure of the scatter action for the rank 0 (total 4 processes) is the following:
+          0 gather 68 68 0 0 0
+        where:
+          1) 68 is the sendcounts
+          2) 68 is the recvcounts
+          3) 0 is the root node
+          4) 0 is the send datatype id, see simgrid::smpi::Datatype::decode()
+          5) 0 is the recv datatype id, see simgrid::smpi::Datatype::decode()
+    */
+    CHECK_ACTION_PARAMS(action, 2, 3)
+    comm_size   = MPI_COMM_WORLD->size();
+    send_size   = parse_double(action[2]);
+    recv_size   = parse_double(action[3]);
+    root   = (action.size() > 4) ? std::stoi(action[4]) : 0;
+    if (action.size() > 5)
+      datatype1 = simgrid::smpi::Datatype::decode(action[5]);
+    if (action.size() > 6)
+      datatype2 = simgrid::smpi::Datatype::decode(action[6]);
   }
-  void *send = smpi_get_tmp_sendbuffer(send_size* MPI_CURRENT_TYPE->size());
-  void *recv = nullptr;
-  int root=0;
-  if(action[4])
-    root=atoi(action[4]);
-  int rank = MPI_COMM_WORLD->rank();
-
-  if(rank==root)
-    recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* MPI_CURRENT_TYPE2->size());
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("gather", root, -1.0, send_size, recv_size,
-                                                                        encode_datatype(MPI_CURRENT_TYPE),
-                                                                        encode_datatype(MPI_CURRENT_TYPE2)));
-
-  Colls::gather(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(Actor::self()->getPid());
-  log_timed_action (action, clock);
-}
-
-static void action_scatter(const char* const* action)
-{
-  /* The structure of the scatter action for the rank 0 (total 4 processes) is the following:
-        0 gather 68 68 0 0 0
-      where:
-        1) 68 is the sendcounts
-        2) 68 is the recvcounts
+};
+
+class ScatterVArgParser : public CollCommParser {
+public:
+  int recv_size_sum;
+  int send_size_sum;
+  std::shared_ptr<std::vector<int>> sendcounts;
+  std::vector<int> disps;
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    /* The structure of the scatterv action for the rank 0 (total 4 processes) is the following:
+       0 gather 68 10 10 10 68 0 0 0
+        where:
+        1) 68 10 10 10 is the sendcounts
+        2) 68 is the recvcount
         3) 0 is the root node
-        4) 0 is the send datatype id, see decode_datatype()
-        5) 0 is the recv datatype id, see decode_datatype()
-  */
-  CHECK_ACTION_PARAMS(action, 2, 3)
-  double clock                   = smpi_process()->simulated_elapsed();
-  int comm_size                  = MPI_COMM_WORLD->size();
-  int send_size                  = parse_double(action[2]);
-  int recv_size                  = parse_double(action[3]);
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-  if (action[4] && action[5]) {
-    MPI_CURRENT_TYPE  = decode_datatype(action[5]);
-    MPI_CURRENT_TYPE2 = decode_datatype(action[6]);
-  } else {
-    MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
+        4) 0 is the send datatype id, see simgrid::smpi::Datatype::decode()
+        5) 0 is the recv datatype id, see simgrid::smpi::Datatype::decode()
+    */
+    CHECK_ACTION_PARAMS(action, comm_size + 1, 2)
+    recv_size  = parse_double(action[2 + comm_size]);
+    disps      = std::vector<int>(comm_size, 0);
+    sendcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+
+    if (action.size() > 5 + comm_size)
+      datatype1 = simgrid::smpi::Datatype::decode(action[4 + comm_size]);
+    if (action.size() > 5 + comm_size)
+      datatype2 = simgrid::smpi::Datatype::decode(action[5]);
+
+    for (unsigned int i = 0; i < comm_size; i++) {
+      (*sendcounts)[i] = std::stoi(action[i + 2]);
+    }
+    send_size_sum = std::accumulate(sendcounts->begin(), sendcounts->end(), 0);
+    root = (action.size() > 3 + comm_size) ? std::stoi(action[3 + comm_size]) : 0;
+  }
+};
+
+class ReduceScatterArgParser : public CollCommParser {
+public:
+  int recv_size_sum;
+  std::shared_ptr<std::vector<int>> recvcounts;
+  std::vector<int> disps;
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    /* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
+         0 reduceScatter 275427 275427 275427 204020 11346849 0
+       where:
+         1) The first four values after the name of the action declare the recvcounts array
+         2) The value 11346849 is the amount of instructions
+         3) The last value corresponds to the datatype, see simgrid::smpi::Datatype::decode().
+    */
+    comm_size = MPI_COMM_WORLD->size();
+    CHECK_ACTION_PARAMS(action, comm_size+1, 1)
+    comp_size = parse_double(action[2+comm_size]);
+    recvcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+    if (action.size() > 3 + comm_size)
+      datatype1 = simgrid::smpi::Datatype::decode(action[3 + comm_size]);
+
+    for (unsigned int i = 0; i < comm_size; i++) {
+      recvcounts->push_back(std::stoi(action[i + 2]));
+    }
+    recv_size_sum = std::accumulate(recvcounts->begin(), recvcounts->end(), 0);
+  }
+};
+
+class AllToAllVArgParser : public CollCommParser {
+public:
+  int recv_size_sum;
+  int send_size_sum;
+  std::shared_ptr<std::vector<int>> recvcounts;
+  std::shared_ptr<std::vector<int>> sendcounts;
+  std::vector<int> senddisps;
+  std::vector<int> recvdisps;
+  int send_buf_size;
+  int recv_buf_size;
+  void parse(simgrid::xbt::ReplayAction& action, std::string name) override
+  {
+    /* The structure of the allToAllV action for the rank 0 (total 4 processes) is the following:
+          0 allToAllV 100 1 7 10 12 100 1 70 10 5
+       where:
+        1) 100 is the size of the send buffer *sizeof(int),
+        2) 1 7 10 12 is the sendcounts array
+        3) 100*sizeof(int) is the size of the receiver buffer
+        4)  1 70 10 5 is the recvcounts array
+    */
+    comm_size = MPI_COMM_WORLD->size();
+    CHECK_ACTION_PARAMS(action, 2*comm_size+2, 2)
+    sendcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+    recvcounts = std::shared_ptr<std::vector<int>>(new std::vector<int>(comm_size));
+    senddisps  = std::vector<int>(comm_size, 0);
+    recvdisps  = std::vector<int>(comm_size, 0);
+
+    if (action.size() > 5 + 2 * comm_size)
+      datatype1 = simgrid::smpi::Datatype::decode(action[4 + 2 * comm_size]);
+    if (action.size() > 5 + 2 * comm_size)
+      datatype2 = simgrid::smpi::Datatype::decode(action[5 + 2 * comm_size]);
+
+    send_buf_size=parse_double(action[2]);
+    recv_buf_size=parse_double(action[3+comm_size]);
+    for (unsigned int i = 0; i < comm_size; i++) {
+      (*sendcounts)[i] = std::stoi(action[3 + i]);
+      (*recvcounts)[i] = std::stoi(action[4 + comm_size + i]);
+    }
+    send_size_sum = std::accumulate(sendcounts->begin(), sendcounts->end(), 0);
+    recv_size_sum = std::accumulate(recvcounts->begin(), recvcounts->end(), 0);
+  }
+};
+
+template <class T> class ReplayAction {
+protected:
+  const std::string name;
+  T args;
+
+  int my_proc_id;
+
+public:
+  explicit ReplayAction(std::string name) : name(name), my_proc_id(simgrid::s4u::this_actor::getPid()) {}
+  virtual ~ReplayAction() = default;
+
+  virtual void execute(simgrid::xbt::ReplayAction& action)
+  {
+    // Needs to be re-initialized for every action, hence here
+    double start_time = smpi_process()->simulated_elapsed();
+    args.parse(action, name);
+    kernel(action);
+    if (name != "Init")
+      log_timed_action(action, start_time);
   }
-  void* send = smpi_get_tmp_sendbuffer(send_size * MPI_CURRENT_TYPE->size());
-  void* recv = nullptr;
-  int root   = 0;
-  if (action[4])
-    root   = atoi(action[4]);
-  int rank = MPI_COMM_WORLD->rank();
 
-  if (rank == root)
-    recv = smpi_get_tmp_recvbuffer(recv_size * comm_size * MPI_CURRENT_TYPE2->size());
+  virtual void kernel(simgrid::xbt::ReplayAction& action) = 0;
 
-  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("gather", root, -1.0, send_size, recv_size,
-                                                                        encode_datatype(MPI_CURRENT_TYPE),
-                                                                        encode_datatype(MPI_CURRENT_TYPE2)));
+  void* send_buffer(int size)
+  {
+    return smpi_get_tmp_sendbuffer(size);
+  }
 
-  Colls::scatter(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
+  void* recv_buffer(int size)
+  {
+    return smpi_get_tmp_recvbuffer(size);
+  }
+};
+
+class WaitAction : public ReplayAction<ActionArgParser> {
+public:
+  WaitAction() : ReplayAction("Wait") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    std::string s = boost::algorithm::join(action, " ");
+    xbt_assert(get_reqq_self()->size(), "action wait not preceded by any irecv or isend: %s", s.c_str());
+    MPI_Request request = get_reqq_self()->back();
+    get_reqq_self()->pop_back();
+
+    if (request == nullptr) {
+      /* Assume that the trace is well formed, meaning the comm might have been caught by a MPI_test. Then just
+       * return.*/
+      return;
+    }
 
-  TRACE_smpi_comm_out(Actor::self()->getPid());
-  log_timed_action(action, clock);
-}
+    int rank = request->comm() != MPI_COMM_NULL ? request->comm()->rank() : -1;
 
-static void action_gatherv(const char *const *action) {
-  /* The structure of the gatherv action for the rank 0 (total 4 processes) is the following:
-       0 gather 68 68 10 10 10 0 0 0
-     where:
-       1) 68 is the sendcount
-       2) 68 10 10 10 is the recvcounts
-       3) 0 is the root node
-       4) 0 is the send datatype id, see decode_datatype()
-       5) 0 is the recv datatype id, see decode_datatype()
-  */
-  double clock = smpi_process()->simulated_elapsed();
-  int comm_size = MPI_COMM_WORLD->size();
-  CHECK_ACTION_PARAMS(action, comm_size+1, 2)
-  int send_size = parse_double(action[2]);
-  int disps[comm_size];
-  int recvcounts[comm_size];
-  int recv_sum=0;
-
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-  if(action[4+comm_size] && action[5+comm_size]) {
-    MPI_CURRENT_TYPE=decode_datatype(action[4+comm_size]);
-    MPI_CURRENT_TYPE2=decode_datatype(action[5+comm_size]);
-  } else
-    MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
-
-  void *send = smpi_get_tmp_sendbuffer(send_size* MPI_CURRENT_TYPE->size());
-  void *recv = nullptr;
-  for(int i=0;i<comm_size;i++) {
-    recvcounts[i] = atoi(action[i+3]);
-    recv_sum=recv_sum+recvcounts[i];
-    disps[i]=0;
-  }
-
-  int root=atoi(action[3+comm_size]);
-  int rank = MPI_COMM_WORLD->rank();
-
-  if(rank==root)
-    recv = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
-
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
-  for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
-    trace_recvcounts->push_back(recvcounts[i]);
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
-                                             "gatherV", root, send_size, nullptr, -1, trace_recvcounts,
-                                             encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
-
-  Colls::gatherv(send, send_size, MPI_CURRENT_TYPE, recv, recvcounts, disps, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(Actor::self()->getPid());
-  log_timed_action (action, clock);
-}
+    // Must be taken before Request::wait() since the request may be set to
+    // MPI_REQUEST_NULL by Request::wait!
+    int src                  = request->comm()->group()->rank(request->src());
+    int dst                  = request->comm()->group()->rank(request->dst());
+    bool is_wait_for_receive = (request->flags() & RECV);
+    // TODO: Here we take the rank while we normally take the process id (look for my_proc_id)
+    TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::NoOpTIData("wait"));
 
-static void action_scatterv(const char* const* action)
-{
-  /* The structure of the scatterv action for the rank 0 (total 4 processes) is the following:
-       0 gather 68 10 10 10 68 0 0 0
-     where:
-       1) 68 10 10 10 is the sendcounts
-       2) 68 is the recvcount
-       3) 0 is the root node
-       4) 0 is the send datatype id, see decode_datatype()
-       5) 0 is the recv datatype id, see decode_datatype()
-  */
-  double clock  = smpi_process()->simulated_elapsed();
-  int comm_size = MPI_COMM_WORLD->size();
-  CHECK_ACTION_PARAMS(action, comm_size + 1, 2)
-  int recv_size = parse_double(action[2 + comm_size]);
-  int disps[comm_size];
-  int sendcounts[comm_size];
-  int send_sum = 0;
-
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-  if (action[4 + comm_size] && action[5 + comm_size]) {
-    MPI_CURRENT_TYPE  = decode_datatype(action[4 + comm_size]);
-    MPI_CURRENT_TYPE2 = decode_datatype(action[5 + comm_size]);
-  } else
-    MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
-
-  void* send = nullptr;
-  void* recv = smpi_get_tmp_recvbuffer(recv_size * MPI_CURRENT_TYPE->size());
-  for (int i = 0; i < comm_size; i++) {
-    sendcounts[i] = atoi(action[i + 2]);
-    send_sum += sendcounts[i];
-    disps[i] = 0;
-  }
-
-  int root = atoi(action[3 + comm_size]);
-  int rank = MPI_COMM_WORLD->rank();
-
-  if (rank == root)
-    send = smpi_get_tmp_sendbuffer(send_sum * MPI_CURRENT_TYPE2->size());
-
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
-  for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
-    trace_sendcounts->push_back(sendcounts[i]);
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
-                                             "gatherV", root, -1, trace_sendcounts, recv_size, nullptr,
-                                             encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
-
-  Colls::scatterv(send, sendcounts, disps, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
-
-  TRACE_smpi_comm_out(Actor::self()->getPid());
-  log_timed_action(action, clock);
-}
+    MPI_Status status;
+    Request::wait(&request, &status);
 
-static void action_reducescatter(const char *const *action) {
- /* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
-      0 reduceScatter 275427 275427 275427 204020 11346849 0
-    where:
-      1) The first four values after the name of the action declare the recvcounts array
-      2) The value 11346849 is the amount of instructions
-      3) The last value corresponds to the datatype, see decode_datatype().
-*/
-  double clock = smpi_process()->simulated_elapsed();
-  int comm_size = MPI_COMM_WORLD->size();
-  CHECK_ACTION_PARAMS(action, comm_size+1, 1)
-  int comp_size = parse_double(action[2+comm_size]);
-  int recvcounts[comm_size];
-  int my_proc_id                     = Actor::self()->getPid();
-  int size = 0;
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
-  if(action[3+comm_size])
-    MPI_CURRENT_TYPE=decode_datatype(action[3+comm_size]);
-  else
-    MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
-  for(int i=0;i<comm_size;i++) {
-    recvcounts[i] = atoi(action[i+2]);
-    trace_recvcounts->push_back(recvcounts[i]);
-    size+=recvcounts[i];
-  }
-
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
-                                                       std::to_string(comp_size), /* ugly hack to print comp_size */
-                                                       encode_datatype(MPI_CURRENT_TYPE)));
-
-  void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
-  void *recvbuf = smpi_get_tmp_recvbuffer(size* MPI_CURRENT_TYPE->size());
-
-  Colls::reduce_scatter(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
-  smpi_execute_flops(comp_size);
+    TRACE_smpi_comm_out(rank);
+    if (is_wait_for_receive)
+      TRACE_smpi_recv(src, dst, 0);
+  }
+};
+
+class SendAction : public ReplayAction<SendRecvParser> {
+public:
+  SendAction() = delete;
+  explicit SendAction(std::string name) : ReplayAction(name) {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->getPid();
+
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData(name, args.partner, args.size,
+                                                                             Datatype::encode(args.datatype1)));
+    if (not TRACE_smpi_view_internals())
+      TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, 0, args.size * args.datatype1->size());
+
+    if (name == "send") {
+      Request::send(nullptr, args.size, args.datatype1, args.partner, 0, MPI_COMM_WORLD);
+    } else if (name == "Isend") {
+      MPI_Request request = Request::isend(nullptr, args.size, args.datatype1, args.partner, 0, MPI_COMM_WORLD);
+      get_reqq_self()->push_back(request);
+    } else {
+      xbt_die("Don't know this action, %s", name.c_str());
+    }
 
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class RecvAction : public ReplayAction<SendRecvParser> {
+public:
+  RecvAction() = delete;
+  explicit RecvAction(std::string name) : ReplayAction(name) {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    int src_traced = MPI_COMM_WORLD->group()->actor(args.partner)->getPid();
+
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData(name, args.partner, args.size,
+                                                                             Datatype::encode(args.datatype1)));
+
+    MPI_Status status;
+    // unknown size from the receiver point of view
+    if (args.size <= 0.0) {
+      Request::probe(args.partner, 0, MPI_COMM_WORLD, &status);
+      args.size = status.count;
+    }
 
-static void action_allgather(const char *const *action) {
-  /* The structure of the allgather action for the rank 0 (total 4 processes) is the following:
-        0 allGather 275427 275427
-    where:
-        1) 275427 is the sendcount
-        2) 275427 is the recvcount
-        3) No more values mean that the datatype for sent and receive buffer is the default one, see decode_datatype().
-  */
-  double clock = smpi_process()->simulated_elapsed();
+    if (name == "recv") {
+      Request::recv(nullptr, args.size, args.datatype1, args.partner, 0, MPI_COMM_WORLD, &status);
+    } else if (name == "Irecv") {
+      MPI_Request request = Request::irecv(nullptr, args.size, args.datatype1, args.partner, 0, MPI_COMM_WORLD);
+      get_reqq_self()->push_back(request);
+    }
 
-  CHECK_ACTION_PARAMS(action, 2, 2)
-  int sendcount=atoi(action[2]);
-  int recvcount=atoi(action[3]);
+    TRACE_smpi_comm_out(my_proc_id);
+    // TODO: Check why this was only activated in the "recv" case and not in the "Irecv" case
+    if (name == "recv" && not TRACE_smpi_view_internals()) {
+      TRACE_smpi_recv(src_traced, my_proc_id, 0);
+    }
+  }
+};
+
+class ComputeAction : public ReplayAction<ComputeParser> {
+public:
+  ComputeAction() : ReplayAction("compute") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_computing_in(my_proc_id, args.flops);
+    smpi_execute_flops(args.flops);
+    TRACE_smpi_computing_out(my_proc_id);
+  }
+};
+
+class TestAction : public ReplayAction<ActionArgParser> {
+public:
+  TestAction() : ReplayAction("Test") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    MPI_Request request = get_reqq_self()->back();
+    get_reqq_self()->pop_back();
+    // if request is null here, this may mean that a previous test has succeeded
+    // Different times in traced application and replayed version may lead to this
+    // In this case, ignore the extra calls.
+    if (request != nullptr) {
+      TRACE_smpi_testing_in(my_proc_id);
+
+      MPI_Status status;
+      int flag = Request::test(&request, &status);
+
+      XBT_DEBUG("MPI_Test result: %d", flag);
+      /* push back request in vector to be caught by a subsequent wait. if the test did succeed, the request is now
+       * nullptr.*/
+      get_reqq_self()->push_back(request);
+
+      TRACE_smpi_testing_out(my_proc_id);
+    }
+  }
+};
+
+class InitAction : public ReplayAction<ActionArgParser> {
+public:
+  InitAction() : ReplayAction("Init") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    CHECK_ACTION_PARAMS(action, 0, 1)
+    MPI_DEFAULT_TYPE = (action.size() > 2) ? MPI_DOUBLE // default MPE datatype
+                                           : MPI_BYTE;  // default TAU datatype
+
+    /* start a simulated timer */
+    smpi_process()->simulated_start();
+    /*initialize the number of active processes */
+    active_processes = smpi_process_count();
+
+    set_reqq_self(new std::vector<MPI_Request>);
+  }
+};
+
+class CommunicatorAction : public ReplayAction<ActionArgParser> {
+public:
+  CommunicatorAction() : ReplayAction("Comm") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override { /* nothing to do */}
+};
+
+class WaitAllAction : public ReplayAction<ActionArgParser> {
+public:
+  WaitAllAction() : ReplayAction("waitAll") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    const unsigned int count_requests = get_reqq_self()->size();
+
+    if (count_requests > 0) {
+      TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData("waitAll", -1, count_requests, ""));
+      std::vector<std::pair</*sender*/int,/*recv*/int>> sender_receiver;
+      for (const auto& req : (*get_reqq_self())) {
+        if (req && (req->flags() & RECV)) {
+          sender_receiver.push_back({req->src(), req->dst()});
+        }
+      }
+      MPI_Status status[count_requests];
+      Request::waitall(count_requests, &(*get_reqq_self())[0], status);
+
+      for (auto& pair : sender_receiver) {
+        TRACE_smpi_recv(pair.first, pair.second, 0);
+      }
+      TRACE_smpi_comm_out(my_proc_id);
+    }
+  }
+};
+
+class BarrierAction : public ReplayAction<ActionArgParser> {
+public:
+  BarrierAction() : ReplayAction("barrier") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("barrier"));
+    Colls::barrier(MPI_COMM_WORLD);
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
 
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
+class BcastAction : public ReplayAction<BcastArgParser> {
+public:
+  BcastAction() : ReplayAction("bcast") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, "action_bcast",
+                       new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root)->getPid(),
+                                                      -1.0, args.size, -1, Datatype::encode(args.datatype1), ""));
 
-  if(action[4] && action[5]) {
-    MPI_CURRENT_TYPE = decode_datatype(action[4]);
-    MPI_CURRENT_TYPE2 = decode_datatype(action[5]);
-  } else
-    MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
+    Colls::bcast(send_buffer(args.size * args.datatype1->size()), args.size, args.datatype1, args.root, MPI_COMM_WORLD);
 
-  void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* MPI_CURRENT_TYPE->size());
-  void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* MPI_CURRENT_TYPE2->size());
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class ReduceAction : public ReplayAction<ReduceArgParser> {
+public:
+  ReduceAction() : ReplayAction("reduce") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, "action_reduce",
+                       new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root)->getPid(), args.comp_size,
+                                                      args.comm_size, -1, Datatype::encode(args.datatype1), ""));
+
+    Colls::reduce(send_buffer(args.comm_size * args.datatype1->size()),
+        recv_buffer(args.comm_size * args.datatype1->size()), args.comm_size, args.datatype1, MPI_OP_NULL, args.root, MPI_COMM_WORLD);
+    smpi_execute_flops(args.comp_size);
+
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
 
-  int my_proc_id = Actor::self()->getPid();
+class AllReduceAction : public ReplayAction<AllReduceArgParser> {
+public:
+  AllReduceAction() : ReplayAction("allReduce") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, "action_allReduce", new simgrid::instr::CollTIData("allReduce", -1, args.comp_size, args.comm_size, -1,
+                                                                                Datatype::encode(args.datatype1), ""));
 
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::CollTIData("allGather", -1, -1.0, sendcount, recvcount,
-                                                    encode_datatype(MPI_CURRENT_TYPE),
-                                                    encode_datatype(MPI_CURRENT_TYPE2)));
+    Colls::allreduce(send_buffer(args.comm_size * args.datatype1->size()),
+        recv_buffer(args.comm_size * args.datatype1->size()), args.comm_size, args.datatype1, MPI_OP_NULL, MPI_COMM_WORLD);
+    smpi_execute_flops(args.comp_size);
 
-  Colls::allgather(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcount, MPI_CURRENT_TYPE2, MPI_COMM_WORLD);
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class AllToAllAction : public ReplayAction<AllToAllArgParser> {
+public:
+  AllToAllAction() : ReplayAction("allToAll") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, "action_allToAll",
+                     new simgrid::instr::CollTIData("allToAll", -1, -1.0, args.send_size, args.recv_size,
+                                                    Datatype::encode(args.datatype1),
+                                                    Datatype::encode(args.datatype2)));
+
+    Colls::alltoall(send_buffer(args.send_size*args.comm_size* args.datatype1->size()), 
+      args.send_size, args.datatype1, recv_buffer(args.recv_size * args.comm_size * args.datatype2->size()),
+      args.recv_size, args.datatype2, MPI_COMM_WORLD);
+
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class GatherAction : public ReplayAction<GatherArgParser> {
+public:
+  explicit GatherAction(std::string name) : ReplayAction(name) {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, name.c_str(), new simgrid::instr::CollTIData(name, (name == "gather") ? args.root : -1, -1.0, args.send_size, args.recv_size,
+                                                                          Datatype::encode(args.datatype1), Datatype::encode(args.datatype2)));
+
+    if (name == "gather") {
+      int rank = MPI_COMM_WORLD->rank();
+      Colls::gather(send_buffer(args.send_size * args.datatype1->size()), args.send_size, args.datatype1,
+                 (rank == args.root) ? recv_buffer(args.recv_size * args.comm_size * args.datatype2->size()) : nullptr, args.recv_size, args.datatype2, args.root, MPI_COMM_WORLD);
+    }
+    else
+      Colls::allgather(send_buffer(args.send_size * args.datatype1->size()), args.send_size, args.datatype1,
+                       recv_buffer(args.recv_size * args.datatype2->size()), args.recv_size, args.datatype2, MPI_COMM_WORLD);
 
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class GatherVAction : public ReplayAction<GatherVArgParser> {
+public:
+  explicit GatherVAction(std::string name) : ReplayAction(name) {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    int rank = MPI_COMM_WORLD->rank();
+
+    TRACE_smpi_comm_in(my_proc_id, name.c_str(), new simgrid::instr::VarCollTIData(
+                                               name, (name == "gatherV") ? args.root : -1, args.send_size, nullptr, -1, args.recvcounts,
+                                               Datatype::encode(args.datatype1), Datatype::encode(args.datatype2)));
+
+    if (name == "gatherV") {
+      Colls::gatherv(send_buffer(args.send_size * args.datatype1->size()), args.send_size, args.datatype1, 
+                     (rank == args.root) ? recv_buffer(args.recv_size_sum  * args.datatype2->size()) : nullptr, args.recvcounts->data(), args.disps.data(), args.datatype2, args.root,
+                     MPI_COMM_WORLD);
+    }
+    else {
+      Colls::allgatherv(send_buffer(args.send_size * args.datatype1->size()), args.send_size, args.datatype1, 
+                        recv_buffer(args.recv_size_sum * args.datatype2->size()), args.recvcounts->data(), args.disps.data(), args.datatype2,
+                    MPI_COMM_WORLD);
+    }
 
-static void action_allgatherv(const char *const *action) {
-  /* The structure of the allgatherv action for the rank 0 (total 4 processes) is the following:
-        0 allGatherV 275427 275427 275427 275427 204020
-     where:
-        1) 275427 is the sendcount
-        2) The next four elements declare the recvcounts array
-        3) No more values mean that the datatype for sent and receive buffer is the default one, see decode_datatype().
-  */
-  double clock = smpi_process()->simulated_elapsed();
-
-  int comm_size = MPI_COMM_WORLD->size();
-  CHECK_ACTION_PARAMS(action, comm_size+1, 2)
-  int sendcount=atoi(action[2]);
-  int recvcounts[comm_size];
-  int disps[comm_size];
-  int recv_sum=0;
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-
-  if(action[3+comm_size] && action[4+comm_size]) {
-    MPI_CURRENT_TYPE = decode_datatype(action[3+comm_size]);
-    MPI_CURRENT_TYPE2 = decode_datatype(action[4+comm_size]);
-  } else
-    MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
-
-  void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* MPI_CURRENT_TYPE->size());
-
-  for(int i=0;i<comm_size;i++) {
-    recvcounts[i] = atoi(action[i+3]);
-    recv_sum=recv_sum+recvcounts[i];
-    disps[i] = 0;
-  }
-  void *recvbuf = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
-
-  int my_proc_id = Actor::self()->getPid();
-
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
-  for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
-    trace_recvcounts->push_back(recvcounts[i]);
-
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::VarCollTIData("allGatherV", -1, sendcount, nullptr, -1, trace_recvcounts,
-                                                       encode_datatype(MPI_CURRENT_TYPE),
-                                                       encode_datatype(MPI_CURRENT_TYPE2)));
-
-  Colls::allgatherv(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcounts, disps, MPI_CURRENT_TYPE2,
-                          MPI_COMM_WORLD);
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class ScatterAction : public ReplayAction<ScatterArgParser> {
+public:
+  ScatterAction() : ReplayAction("scatter") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    int rank = MPI_COMM_WORLD->rank();
+    TRACE_smpi_comm_in(my_proc_id, "action_scatter", new simgrid::instr::CollTIData(name, args.root, -1.0, args.send_size, args.recv_size,
+                                                                          Datatype::encode(args.datatype1),
+                                                                          Datatype::encode(args.datatype2)));
+
+    Colls::scatter(send_buffer(args.send_size * args.datatype1->size()), args.send_size, args.datatype1,
+                  (rank == args.root) ? recv_buffer(args.recv_size * args.datatype2->size()) : nullptr, args.recv_size, args.datatype2, args.root, MPI_COMM_WORLD);
+
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
 
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
 
-static void action_allToAllv(const char *const *action) {
-  /* The structure of the allToAllV action for the rank 0 (total 4 processes) is the following:
-        0 allToAllV 100 1 7 10 12 100 1 70 10 5
-     where:
-        1) 100 is the size of the send buffer *sizeof(int),
-        2) 1 7 10 12 is the sendcounts array
-        3) 100*sizeof(int) is the size of the receiver buffer
-        4)  1 70 10 5 is the recvcounts array
-  */
-  double clock = smpi_process()->simulated_elapsed();
-
-  int comm_size = MPI_COMM_WORLD->size();
-  CHECK_ACTION_PARAMS(action, 2*comm_size+2, 2)
-  int send_size = 0;
-  int recv_size = 0;
-  int sendcounts[comm_size];
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
-  int recvcounts[comm_size];
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
-  int senddisps[comm_size];
-  int recvdisps[comm_size];
-
-  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
-
-  int send_buf_size=parse_double(action[2]);
-  int recv_buf_size=parse_double(action[3+comm_size]);
-  if(action[4+2*comm_size] && action[5+2*comm_size]) {
-    MPI_CURRENT_TYPE=decode_datatype(action[4+2*comm_size]);
-    MPI_CURRENT_TYPE2=decode_datatype(action[5+2*comm_size]);
-  }
-  else
-    MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
-
-  int my_proc_id = Actor::self()->getPid();
-  void *sendbuf = smpi_get_tmp_sendbuffer(send_buf_size* MPI_CURRENT_TYPE->size());
-  void *recvbuf  = smpi_get_tmp_recvbuffer(recv_buf_size* MPI_CURRENT_TYPE2->size());
-
-  for(int i=0;i<comm_size;i++) {
-    sendcounts[i] = atoi(action[i+3]);
-    trace_sendcounts->push_back(sendcounts[i]);
-    send_size += sendcounts[i];
-    recvcounts[i] = atoi(action[i+4+comm_size]);
-    trace_recvcounts->push_back(recvcounts[i]);
-    recv_size += recvcounts[i];
-    senddisps[i] = 0;
-    recvdisps[i] = 0;
-  }
-
-  TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
-                     new simgrid::instr::VarCollTIData("allToAllV", -1, send_size, trace_sendcounts, recv_size,
-                                                       trace_recvcounts, encode_datatype(MPI_CURRENT_TYPE),
-                                                       encode_datatype(MPI_CURRENT_TYPE2)));
-
-  Colls::alltoallv(sendbuf, sendcounts, senddisps, MPI_CURRENT_TYPE,recvbuf, recvcounts, recvdisps,
-                         MPI_CURRENT_TYPE, MPI_COMM_WORLD);
+class ScatterVAction : public ReplayAction<ScatterVArgParser> {
+public:
+  ScatterVAction() : ReplayAction("scatterV") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    int rank = MPI_COMM_WORLD->rank();
+    TRACE_smpi_comm_in(my_proc_id, "action_scatterv", new simgrid::instr::VarCollTIData(name, args.root, -1, args.sendcounts, args.recv_size,
+          nullptr, Datatype::encode(args.datatype1),
+          Datatype::encode(args.datatype2)));
 
-  TRACE_smpi_comm_out(my_proc_id);
-  log_timed_action (action, clock);
-}
+    Colls::scatterv((rank == args.root) ? send_buffer(args.send_size_sum * args.datatype1->size()) : nullptr, args.sendcounts->data(), args.disps.data(), 
+        args.datatype1, recv_buffer(args.recv_size * args.datatype2->size()), args.recv_size, args.datatype2, args.root,
+        MPI_COMM_WORLD);
 
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class ReduceScatterAction : public ReplayAction<ReduceScatterArgParser> {
+public:
+  ReduceScatterAction() : ReplayAction("reduceScatter") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, "action_reducescatter",
+                       new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, args.recvcounts,
+                                                         std::to_string(args.comp_size), /* ugly hack to print comp_size */
+                                                         Datatype::encode(args.datatype1)));
+
+    Colls::reduce_scatter(send_buffer(args.recv_size_sum * args.datatype1->size()), recv_buffer(args.recv_size_sum * args.datatype1->size()), 
+                          args.recvcounts->data(), args.datatype1, MPI_OP_NULL, MPI_COMM_WORLD);
+
+    smpi_execute_flops(args.comp_size);
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+
+class AllToAllVAction : public ReplayAction<AllToAllVArgParser> {
+public:
+  AllToAllVAction() : ReplayAction("allToAllV") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    TRACE_smpi_comm_in(my_proc_id, __func__,
+                       new simgrid::instr::VarCollTIData(
+                           "allToAllV", -1, args.send_size_sum, args.sendcounts, args.recv_size_sum, args.recvcounts,
+                           Datatype::encode(args.datatype1), Datatype::encode(args.datatype2)));
+
+    Colls::alltoallv(send_buffer(args.send_buf_size * args.datatype1->size()), args.sendcounts->data(), args.senddisps.data(), args.datatype1,
+                     recv_buffer(args.recv_buf_size * args.datatype2->size()), args.recvcounts->data(), args.recvdisps.data(), args.datatype2, MPI_COMM_WORLD);
+
+    TRACE_smpi_comm_out(my_proc_id);
+  }
+};
+} // Replay Namespace
 }} // namespace simgrid::smpi
 
 /** @brief Only initialize the replay, don't do it for real */
@@ -931,37 +810,38 @@ void smpi_replay_init(int* argc, char*** argv)
   smpi_process()->mark_as_initialized();
   smpi_process()->set_replaying(true);
 
-  int my_proc_id = Actor::self()->getPid();
+  int my_proc_id = simgrid::s4u::this_actor::getPid();
   TRACE_smpi_init(my_proc_id);
   TRACE_smpi_computing_init(my_proc_id);
   TRACE_smpi_comm_in(my_proc_id, "smpi_replay_run_init", new simgrid::instr::NoOpTIData("init"));
   TRACE_smpi_comm_out(my_proc_id);
-  xbt_replay_action_register("init",       simgrid::smpi::action_init);
-  xbt_replay_action_register("finalize",   simgrid::smpi::action_finalize);
-  xbt_replay_action_register("comm_size",  simgrid::smpi::action_comm_size);
-  xbt_replay_action_register("comm_split", simgrid::smpi::action_comm_split);
-  xbt_replay_action_register("comm_dup",   simgrid::smpi::action_comm_dup);
-  xbt_replay_action_register("send",       simgrid::smpi::action_send);
-  xbt_replay_action_register("Isend",      simgrid::smpi::action_Isend);
-  xbt_replay_action_register("recv",       simgrid::smpi::action_recv);
-  xbt_replay_action_register("Irecv",      simgrid::smpi::action_Irecv);
-  xbt_replay_action_register("test",       simgrid::smpi::action_test);
-  xbt_replay_action_register("wait",       simgrid::smpi::action_wait);
-  xbt_replay_action_register("waitAll",    simgrid::smpi::action_waitall);
-  xbt_replay_action_register("barrier",    simgrid::smpi::action_barrier);
-  xbt_replay_action_register("bcast",      simgrid::smpi::action_bcast);
-  xbt_replay_action_register("reduce",     simgrid::smpi::action_reduce);
-  xbt_replay_action_register("allReduce",  simgrid::smpi::action_allReduce);
-  xbt_replay_action_register("allToAll",   simgrid::smpi::action_allToAll);
-  xbt_replay_action_register("allToAllV",  simgrid::smpi::action_allToAllv);
-  xbt_replay_action_register("gather",     simgrid::smpi::action_gather);
-  xbt_replay_action_register("scatter", simgrid::smpi::action_scatter);
-  xbt_replay_action_register("gatherV",    simgrid::smpi::action_gatherv);
-  xbt_replay_action_register("scatterV", simgrid::smpi::action_scatterv);
-  xbt_replay_action_register("allGather",  simgrid::smpi::action_allgather);
-  xbt_replay_action_register("allGatherV", simgrid::smpi::action_allgatherv);
-  xbt_replay_action_register("reduceScatter",  simgrid::smpi::action_reducescatter);
-  xbt_replay_action_register("compute",    simgrid::smpi::action_compute);
+  xbt_replay_action_register("init", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::InitAction().execute(action); });
+  xbt_replay_action_register("finalize", [](simgrid::xbt::ReplayAction& action) { /* nothing to do */ });
+  xbt_replay_action_register("comm_size", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
+  xbt_replay_action_register("comm_split",[](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
+  xbt_replay_action_register("comm_dup",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::CommunicatorAction().execute(action); });
+
+  xbt_replay_action_register("send",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::SendAction("send").execute(action); });
+  xbt_replay_action_register("Isend", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::SendAction("Isend").execute(action); });
+  xbt_replay_action_register("recv",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::RecvAction("recv").execute(action); });
+  xbt_replay_action_register("Irecv", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::RecvAction("Irecv").execute(action); });
+  xbt_replay_action_register("test",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::TestAction().execute(action); });
+  xbt_replay_action_register("wait",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::WaitAction().execute(action); });
+  xbt_replay_action_register("waitAll", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::WaitAllAction().execute(action); });
+  xbt_replay_action_register("barrier", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::BarrierAction().execute(action); });
+  xbt_replay_action_register("bcast",   [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::BcastAction().execute(action); });
+  xbt_replay_action_register("reduce",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ReduceAction().execute(action); });
+  xbt_replay_action_register("allReduce", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::AllReduceAction().execute(action); });
+  xbt_replay_action_register("allToAll", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::AllToAllAction().execute(action); });
+  xbt_replay_action_register("allToAllV", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::AllToAllVAction().execute(action); });
+  xbt_replay_action_register("gather",   [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::GatherAction("gather").execute(action); });
+  xbt_replay_action_register("scatter",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ScatterAction().execute(action); });
+  xbt_replay_action_register("gatherV",  [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::GatherVAction("gatherV").execute(action); });
+  xbt_replay_action_register("scatterV", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ScatterVAction().execute(action); });
+  xbt_replay_action_register("allGather", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::GatherAction("allGather").execute(action); });
+  xbt_replay_action_register("allGatherV", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::GatherVAction("allGatherV").execute(action); });
+  xbt_replay_action_register("reduceScatter", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ReduceScatterAction().execute(action); });
+  xbt_replay_action_register("compute", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ComputeAction().execute(action); });
 
   //if we have a delayed start, sleep here.
   if(*argc>2){
@@ -1001,16 +881,16 @@ void smpi_replay_main(int* argc, char*** argv)
   if(active_processes==0){
     /* Last process alive speaking: end the simulated timer */
     XBT_INFO("Simulation time %f", smpi_process()->simulated_elapsed());
-    xbt_free(sendbuffer);
-    xbt_free(recvbuffer);
+    smpi_free_replay_tmp_buffers();
   }
 
-  TRACE_smpi_comm_in(Actor::self()->getPid(), "smpi_replay_run_finalize", new simgrid::instr::NoOpTIData("finalize"));
+  TRACE_smpi_comm_in(simgrid::s4u::this_actor::getPid(), "smpi_replay_run_finalize",
+                     new simgrid::instr::NoOpTIData("finalize"));
 
   smpi_process()->finalize();
 
-  TRACE_smpi_comm_out(Actor::self()->getPid());
-  TRACE_smpi_finalize(Actor::self()->getPid());
+  TRACE_smpi_comm_out(simgrid::s4u::this_actor::getPid());
+  TRACE_smpi_finalize(simgrid::s4u::this_actor::getPid());
 }
 
 /** @brief chain a replay initialization and a replay start */
index 9bf2045..b4f18eb 100644 (file)
@@ -218,7 +218,7 @@ void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int
                                 "to allow big allocations.\n",
              size >> 20);
   if(use_huge_page)
-    mem = (void*)ALIGN_UP((uint64_t)allocated_ptr, HUGE_PAGE_SIZE);
+    mem = (void*)ALIGN_UP((int64_t)allocated_ptr, HUGE_PAGE_SIZE);
   else
     mem = allocated_ptr;
 
@@ -269,8 +269,8 @@ void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int
     if(i_block < nb_shared_blocks-1)
       xbt_assert(stop_offset < shared_block_offsets[2*i_block+2],
               "stop_offset (%zu) should be lower than its successor start offset (%zu)", stop_offset, shared_block_offsets[2*i_block+2]);
-    size_t start_block_offset = ALIGN_UP(start_offset, smpi_shared_malloc_blocksize);
-    size_t stop_block_offset = ALIGN_DOWN(stop_offset, smpi_shared_malloc_blocksize);
+    size_t start_block_offset = ALIGN_UP((int64_t)start_offset, smpi_shared_malloc_blocksize);
+    size_t stop_block_offset = ALIGN_DOWN((int64_t)stop_offset, smpi_shared_malloc_blocksize);
     for (size_t offset = start_block_offset; offset < stop_block_offset; offset += smpi_shared_malloc_blocksize) {
       XBT_DEBUG("\t\tglobal shared allocation, mmap block offset %zx", offset);
       void* pos = (void*)((unsigned long)mem + offset);
@@ -283,8 +283,8 @@ void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int
                              "and that the directory you are passing is mounted correctly (mount /path/to/huge -t hugetlbfs -o rw,mode=0777).",
                  strerror(errno));
     }
-    size_t low_page_start_offset = ALIGN_UP(start_offset, PAGE_SIZE);
-    size_t low_page_stop_offset = start_block_offset < ALIGN_DOWN(stop_offset, PAGE_SIZE) ? start_block_offset : ALIGN_DOWN(stop_offset, PAGE_SIZE);
+    size_t low_page_start_offset = ALIGN_UP((int64_t)start_offset, PAGE_SIZE);
+    size_t low_page_stop_offset = (int64_t)start_block_offset < ALIGN_DOWN((int64_t)stop_offset, PAGE_SIZE) ? start_block_offset : ALIGN_DOWN((int64_t)stop_offset, (int64_t)PAGE_SIZE);
     if(low_page_start_offset < low_page_stop_offset) {
       XBT_DEBUG("\t\tglobal shared allocation, mmap block start");
       void* pos = (void*)((unsigned long)mem + low_page_start_offset);
@@ -297,7 +297,7 @@ void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int
     }
     if(low_page_stop_offset <= stop_block_offset) {
       XBT_DEBUG("\t\tglobal shared allocation, mmap block stop");
-      size_t high_page_stop_offset = stop_offset == size ? size : ALIGN_DOWN(stop_offset, PAGE_SIZE);
+      size_t high_page_stop_offset = stop_offset == size ? size : ALIGN_DOWN((int64_t)stop_offset, PAGE_SIZE);
       if(high_page_stop_offset > stop_block_offset) {
         void* pos = (void*)((unsigned long)mem + stop_block_offset);
         void* res = mmap(pos, high_page_stop_offset-stop_block_offset, PROT_READ | PROT_WRITE, mmap_base_flag, // not a full huge page
index 4652d05..c256f12 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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. */
@@ -57,7 +57,7 @@ void Comm::destroy(Comm* comm)
 
 int Comm::dup(MPI_Comm* newcomm){
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   MPI_Group cp = new  Group(this->group());
   (*newcomm)   = new  Comm(cp, this->topo());
@@ -300,7 +300,7 @@ void Comm::init_smp(){
   }
 
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   //identify neighbours in comm
   //get the indices of all processes sharing the same simix host
@@ -336,7 +336,7 @@ void Comm::init_smp(){
   Coll_allgather_mpich::allgather(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
 
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
 
   if(leaders_map_==nullptr){
@@ -408,7 +408,7 @@ void Comm::init_smp(){
   Coll_bcast_mpich::bcast(&(is_uniform_),1, MPI_INT, 0, comm_intra );
 
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   // Are the ranks blocked ? = allocated contiguously on the SMP nodes
   int is_blocked=1;
index d60ea40..de11260 100644 (file)
@@ -1,5 +1,5 @@
 /* smpi_datatype.cpp -- MPI primitives to handle datatypes                  */
-/* Copyright (c) 2009-2017. The SimGrid Team.  All rights reserved.         */
+/* Copyright (c) 2009-2018. 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. */
@@ -9,97 +9,99 @@
 #include "smpi_datatype_derived.hpp"
 #include "smpi_op.hpp"
 #include "smpi_process.hpp"
+#include <string>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_datatype, smpi, "Logging specific to SMPI (datatype)");
 
-#define CREATE_MPI_DATATYPE(name, type)               \
-  static simgrid::smpi::Datatype mpi_##name (         \
-    (char*) # name,                                   \
-    sizeof(type),   /* size */                        \
-    0,              /* lb */                          \
-    sizeof(type),   /* ub = lb + size */              \
-    DT_FLAG_BASIC  /* flags */                        \
-  );                                                  \
-const MPI_Datatype name = &mpi_##name;
-
-#define CREATE_MPI_DATATYPE_NULL(name)                \
-  static simgrid::smpi::Datatype mpi_##name (         \
-    (char*) # name,                                   \
-    0,              /* size */                        \
-    0,              /* lb */                          \
-    0,              /* ub = lb + size */              \
-    DT_FLAG_BASIC  /* flags */                       \
-  );                                                  \
-const MPI_Datatype name = &mpi_##name;
+static std::unordered_map<std::string, simgrid::smpi::Datatype*> id2type_lookup;
+
+#define CREATE_MPI_DATATYPE(name, id, type)                                                                            \
+  static simgrid::smpi::Datatype mpi_##name((char*)#name, id, sizeof(type), /* size */                                 \
+                                            0,                              /* lb */                                   \
+                                            sizeof(type),                   /* ub = lb + size */                       \
+                                            DT_FLAG_BASIC                   /* flags */                                \
+                                            );                                                                         \
+  const MPI_Datatype name = &mpi_##name;
+
+#define CREATE_MPI_DATATYPE_NULL(name, id)                                                                             \
+  static simgrid::smpi::Datatype mpi_##name((char*)#name, id, 0, /* size */                                            \
+                                            0,                   /* lb */                                              \
+                                            0,                   /* ub = lb + size */                                  \
+                                            DT_FLAG_BASIC        /* flags */                                           \
+                                            );                                                                         \
+  const MPI_Datatype name = &mpi_##name;
 
 // Predefined data types
-CREATE_MPI_DATATYPE(MPI_CHAR, char);
-CREATE_MPI_DATATYPE(MPI_SHORT, short);
-CREATE_MPI_DATATYPE(MPI_INT, int);
-CREATE_MPI_DATATYPE(MPI_LONG, long);
-CREATE_MPI_DATATYPE(MPI_LONG_LONG, long long);
-CREATE_MPI_DATATYPE(MPI_SIGNED_CHAR, signed char);
-CREATE_MPI_DATATYPE(MPI_UNSIGNED_CHAR, unsigned char);
-CREATE_MPI_DATATYPE(MPI_UNSIGNED_SHORT, unsigned short);
-CREATE_MPI_DATATYPE(MPI_UNSIGNED, unsigned int);
-CREATE_MPI_DATATYPE(MPI_UNSIGNED_LONG, unsigned long);
-CREATE_MPI_DATATYPE(MPI_UNSIGNED_LONG_LONG, unsigned long long);
-CREATE_MPI_DATATYPE(MPI_FLOAT, float);
-CREATE_MPI_DATATYPE(MPI_DOUBLE, double);
-CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE, long double);
-CREATE_MPI_DATATYPE(MPI_WCHAR, wchar_t);
-CREATE_MPI_DATATYPE(MPI_C_BOOL, bool);
-CREATE_MPI_DATATYPE(MPI_BYTE, int8_t);
-CREATE_MPI_DATATYPE(MPI_INT8_T, int8_t);
-CREATE_MPI_DATATYPE(MPI_INT16_T, int16_t);
-CREATE_MPI_DATATYPE(MPI_INT32_T, int32_t);
-CREATE_MPI_DATATYPE(MPI_INT64_T, int64_t);
-CREATE_MPI_DATATYPE(MPI_UINT8_T, uint8_t);
-CREATE_MPI_DATATYPE(MPI_UINT16_T, uint16_t);
-CREATE_MPI_DATATYPE(MPI_UINT32_T, uint32_t);
-CREATE_MPI_DATATYPE(MPI_UINT64_T, uint64_t);
-CREATE_MPI_DATATYPE(MPI_C_FLOAT_COMPLEX, float _Complex);
-CREATE_MPI_DATATYPE(MPI_C_DOUBLE_COMPLEX, double _Complex);
-CREATE_MPI_DATATYPE(MPI_C_LONG_DOUBLE_COMPLEX, long double _Complex);
-CREATE_MPI_DATATYPE(MPI_AINT, MPI_Aint);
-CREATE_MPI_DATATYPE(MPI_OFFSET, MPI_Offset);
-
-CREATE_MPI_DATATYPE(MPI_FLOAT_INT, float_int);
-CREATE_MPI_DATATYPE(MPI_LONG_INT, long_int);
-CREATE_MPI_DATATYPE(MPI_DOUBLE_INT, double_int);
-CREATE_MPI_DATATYPE(MPI_SHORT_INT, short_int);
-CREATE_MPI_DATATYPE(MPI_2INT, int_int);
-CREATE_MPI_DATATYPE(MPI_2FLOAT, float_float);
-CREATE_MPI_DATATYPE(MPI_2DOUBLE, double_double);
-CREATE_MPI_DATATYPE(MPI_2LONG, long_long);
-
-CREATE_MPI_DATATYPE(MPI_REAL, float);
-CREATE_MPI_DATATYPE(MPI_REAL4, float);
-CREATE_MPI_DATATYPE(MPI_REAL8, float);
-CREATE_MPI_DATATYPE(MPI_REAL16, double);
-CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX8);
-CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX16);
-CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX32);
-CREATE_MPI_DATATYPE(MPI_INTEGER1, int);
-CREATE_MPI_DATATYPE(MPI_INTEGER2, int16_t);
-CREATE_MPI_DATATYPE(MPI_INTEGER4, int32_t);
-CREATE_MPI_DATATYPE(MPI_INTEGER8, int64_t);
-CREATE_MPI_DATATYPE(MPI_INTEGER16, integer128_t);
-
-CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE_INT, long_double_int);
-
-CREATE_MPI_DATATYPE_NULL(MPI_UB);
-CREATE_MPI_DATATYPE_NULL(MPI_LB);
-CREATE_MPI_DATATYPE(MPI_PACKED, char);
+CREATE_MPI_DATATYPE(MPI_CHAR, 2, char);
+CREATE_MPI_DATATYPE(MPI_SHORT, 3, short);
+CREATE_MPI_DATATYPE(MPI_INT, 1, int);
+CREATE_MPI_DATATYPE(MPI_LONG, 4, long);
+CREATE_MPI_DATATYPE(MPI_LONG_LONG, 7, long long);
+CREATE_MPI_DATATYPE(MPI_SIGNED_CHAR, 8, signed char);
+CREATE_MPI_DATATYPE(MPI_UNSIGNED_CHAR, 9, unsigned char);
+CREATE_MPI_DATATYPE(MPI_UNSIGNED_SHORT, 10, unsigned short);
+CREATE_MPI_DATATYPE(MPI_UNSIGNED, 11, unsigned int);
+CREATE_MPI_DATATYPE(MPI_UNSIGNED_LONG, 12, unsigned long);
+CREATE_MPI_DATATYPE(MPI_UNSIGNED_LONG_LONG, 13, unsigned long long);
+CREATE_MPI_DATATYPE(MPI_FLOAT, 5, float);
+CREATE_MPI_DATATYPE(MPI_DOUBLE, 0, double);
+CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE, 14, long double);
+CREATE_MPI_DATATYPE(MPI_WCHAR, 15, wchar_t);
+CREATE_MPI_DATATYPE(MPI_C_BOOL, 16, bool);
+CREATE_MPI_DATATYPE(MPI_BYTE, 6, int8_t);
+CREATE_MPI_DATATYPE(MPI_INT8_T, 17, int8_t);
+CREATE_MPI_DATATYPE(MPI_INT16_T, 18, int16_t);
+CREATE_MPI_DATATYPE(MPI_INT32_T, 19, int32_t);
+CREATE_MPI_DATATYPE(MPI_INT64_T, 20, int64_t);
+CREATE_MPI_DATATYPE(MPI_UINT8_T, 21, uint8_t);
+CREATE_MPI_DATATYPE(MPI_UINT16_T, 22, uint16_t);
+CREATE_MPI_DATATYPE(MPI_UINT32_T, 23, uint32_t);
+CREATE_MPI_DATATYPE(MPI_UINT64_T, 24, uint64_t);
+CREATE_MPI_DATATYPE(MPI_C_FLOAT_COMPLEX, 25, float _Complex);
+CREATE_MPI_DATATYPE(MPI_C_DOUBLE_COMPLEX, 26, double _Complex);
+CREATE_MPI_DATATYPE(MPI_C_LONG_DOUBLE_COMPLEX, 27, long double _Complex);
+CREATE_MPI_DATATYPE(MPI_AINT, 28, MPI_Aint);
+CREATE_MPI_DATATYPE(MPI_OFFSET, 29, MPI_Offset);
+
+CREATE_MPI_DATATYPE(MPI_FLOAT_INT, 30, float_int);
+CREATE_MPI_DATATYPE(MPI_LONG_INT, 31, long_int);
+CREATE_MPI_DATATYPE(MPI_DOUBLE_INT, 32, double_int);
+CREATE_MPI_DATATYPE(MPI_SHORT_INT, 33, short_int);
+CREATE_MPI_DATATYPE(MPI_2INT, 34, int_int);
+CREATE_MPI_DATATYPE(MPI_2FLOAT, 35, float_float);
+CREATE_MPI_DATATYPE(MPI_2DOUBLE, 36, double_double);
+CREATE_MPI_DATATYPE(MPI_2LONG, 37, long_long);
+
+CREATE_MPI_DATATYPE(MPI_REAL, 38, float);
+CREATE_MPI_DATATYPE(MPI_REAL4, 39, float);
+CREATE_MPI_DATATYPE(MPI_REAL8, 40, float);
+CREATE_MPI_DATATYPE(MPI_REAL16, 41, double);
+CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX8, 42);
+CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX16, 43);
+CREATE_MPI_DATATYPE_NULL(MPI_COMPLEX32, 44);
+CREATE_MPI_DATATYPE(MPI_INTEGER1, 45, int);
+CREATE_MPI_DATATYPE(MPI_INTEGER2, 46, int16_t);
+CREATE_MPI_DATATYPE(MPI_INTEGER4, 47, int32_t);
+CREATE_MPI_DATATYPE(MPI_INTEGER8, 48, int64_t);
+CREATE_MPI_DATATYPE(MPI_INTEGER16, 49, integer128_t);
+
+CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE_INT, 50, long_double_int);
+
+CREATE_MPI_DATATYPE_NULL(MPI_UB, 51);
+CREATE_MPI_DATATYPE_NULL(MPI_LB, 52);
+CREATE_MPI_DATATYPE(MPI_PACKED, 53, char);
 // Internal use only
-CREATE_MPI_DATATYPE(MPI_PTR, void*);
+CREATE_MPI_DATATYPE(MPI_PTR, 54, void*);
 
 namespace simgrid{
 namespace smpi{
 
-std::unordered_map<int, smpi_key_elem> Datatype::keyvals_;
-int Datatype::keyval_id_=0;
-
+std::unordered_map<int, smpi_key_elem> Datatype::keyvals_; // required by the Keyval class implementation
+int Datatype::keyval_id_=0; // required by the Keyval class implementation
+Datatype::Datatype(int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags) : Datatype(size, lb, ub, flags)
+{
+  id = std::to_string(ident);
+}
 Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(1){
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
@@ -108,7 +110,10 @@ Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr
 }
 
 //for predefined types, so in_use = 0.
-Datatype::Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(name), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(0){
+Datatype::Datatype(char* name, int ident, int size, MPI_Aint lb, MPI_Aint ub, int flags)
+    : name_(name), id(std::to_string(ident)), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(0)
+{
+  id2type_lookup.insert({id, this});
 #if SIMGRID_HAVE_MC
   if(MC_is_active())
     MC_ignore(&(refcount_), sizeof(refcount_));
@@ -198,6 +203,19 @@ bool Datatype::is_basic()
   return (flags_ & DT_FLAG_BASIC);
 }
 
+const char* Datatype::encode(MPI_Datatype dt)
+{
+  if (dt == MPI_DATATYPE_NULL)
+    return "-1";
+
+  return dt->id.c_str();
+}
+
+MPI_Datatype Datatype::decode(std::string datatype_id)
+{
+  return id2type_lookup.find(datatype_id)->second;
+}
+
 bool Datatype::is_replayable()
 {
   return ((this==MPI_BYTE)||(this==MPI_DOUBLE)||(this==MPI_INT)||
@@ -277,7 +295,7 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 // FIXME Handle the case of a partial shared malloc.
 
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
   /* First check if we really have something to do */
   if (recvcount > 0 && recvbuf != sendbuf) {
@@ -497,6 +515,78 @@ int Datatype::create_struct(int count, int* block_lengths, MPI_Aint* indices, MP
   return MPI_SUCCESS;
 }
 
+int Datatype::create_subarray(int ndims, int* array_of_sizes,
+                             int* array_of_subsizes, int* array_of_starts,
+                             int order, MPI_Datatype oldtype, MPI_Datatype *newtype){
+  MPI_Datatype tmp;
+
+  for (int i = 0; i < ndims; i++) {
+    if (array_of_subsizes[i] > array_of_sizes[i]){
+      XBT_WARN("subarray : array_of_subsizes > array_of_sizes for dim %d",i);
+      return MPI_ERR_ARG;
+    }
+    if (array_of_starts[i] + array_of_subsizes[i] > array_of_sizes[i]){
+      XBT_WARN("subarray : array_of_starts + array_of_subsizes > array_of_sizes for dim %d",i);
+      return MPI_ERR_ARG;
+    }
+  }
+  
+  MPI_Aint extent = oldtype->get_extent();
+
+  int i;
+  int step;
+  int end;
+  if( order==MPI_ORDER_C ) {
+      i = ndims - 1;
+      step = -1;
+      end = -1;
+  } else {
+      i = 0;
+      step = 1;
+      end = ndims;
+  }
+  
+  MPI_Aint size = (MPI_Aint)array_of_sizes[i] * (MPI_Aint)array_of_sizes[i+step];
+  MPI_Aint lb = (MPI_Aint)array_of_starts[i] + (MPI_Aint)array_of_starts[i+step] *(MPI_Aint)array_of_sizes[i];
+
+  create_vector( array_of_subsizes[i+step], array_of_subsizes[i], array_of_sizes[i],
+                               oldtype, newtype );
+
+  tmp = *newtype;
+
+  for( i += 2 * step; i != end; i += step ) {
+      create_hvector( array_of_subsizes[i], 1, size * extent,
+                                    tmp, newtype );
+      unref(tmp);
+      lb += size * array_of_starts[i];
+      size *= array_of_sizes[i];
+      tmp = *newtype;
+  }
+
+  MPI_Aint lbs[1] = {lb * extent};
+  int sizes [1]={1};
+  //handle LB and UB with a resized call
+  create_hindexed( 1, sizes, lbs, tmp, newtype);
+  unref(tmp);
+  
+  tmp = *newtype;
+  create_resized(tmp, 0, extent, newtype);
+
+  unref(tmp);
+  return MPI_SUCCESS;
+}
+
+int Datatype::create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){
+  int blocks[3]         = {1, 1, 1};
+  MPI_Aint disps[3]     = {lb, 0, lb + extent};
+  MPI_Datatype types[3] = {MPI_LB, oldtype, MPI_UB};
+
+  *newtype = new simgrid::smpi::Type_Struct(oldtype->size(), lb, lb + extent, DT_FLAG_DERIVED, 3, blocks, disps, types);
+
+  (*newtype)->addflag(~DT_FLAG_COMMITED);
+  return MPI_SUCCESS;
+}
+
 Datatype* Datatype::f2c(int id){
   return static_cast<Datatype*>(F2C::f2c(id));
 }
index e363973..920650f 100644 (file)
@@ -39,7 +39,7 @@ char* F2C::get_key(char* key, int id) {
 }
 
 char* F2C::get_key_id(char* key, int id) {
-  std::snprintf(key, KEY_SIZE, "%x_%lu", static_cast<unsigned>(id), simgrid::s4u::Actor::self()->getPid());
+  std::snprintf(key, KEY_SIZE, "%x_%ld", static_cast<unsigned>(id), simgrid::s4u::this_actor::getPid());
   return key;
 }
 
index 53fa2cb..521f9b0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2018. 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. */
@@ -242,7 +242,7 @@ void Op::apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype)
 {
   if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){//we need to switch as the called function may silently touch global variables
     XBT_DEBUG("Applying operation, switch to the right data frame ");
-    smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+    smpi_switch_data_segment(simgrid::s4u::Actor::self());
   }
 
   if (not smpi_process()->replaying() && *len > 0) {
index aba390c..cff18d4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -178,19 +178,19 @@ void Request::print_request(const char *message)
 MPI_Request Request::send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
 
-  return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                      comm->group()->actor(dst)->getPid(), tag, comm, PERSISTENT | SEND | PREPARED);
 }
 
 MPI_Request Request::ssend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
-  return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                      comm->group()->actor(dst)->getPid(), tag, comm, PERSISTENT | SSEND | SEND | PREPARED);
 }
 
 MPI_Request Request::isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
-  return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                      comm->group()->actor(dst)->getPid(), tag, comm, PERSISTENT | ISEND | SEND | PREPARED);
 }
 
@@ -216,7 +216,7 @@ MPI_Request Request::recv_init(void *buf, int count, MPI_Datatype datatype, int
 {
   return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype,
                      src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->getPid(),
-                     simgrid::s4u::Actor::self()->getPid(), tag, comm, PERSISTENT | RECV | PREPARED);
+                     simgrid::s4u::this_actor::getPid(), tag, comm, PERSISTENT | RECV | PREPARED);
 }
 
 MPI_Request Request::rma_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
@@ -238,13 +238,13 @@ MPI_Request Request::irecv_init(void *buf, int count, MPI_Datatype datatype, int
 {
   return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype,
                      src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->getPid(),
-                     simgrid::s4u::Actor::self()->getPid(), tag, comm, PERSISTENT | RECV | PREPARED);
+                     simgrid::s4u::this_actor::getPid(), tag, comm, PERSISTENT | RECV | PREPARED);
 }
 
 MPI_Request Request::isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
-  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                         comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | ISEND | SEND);
   request->start();
   return request;
@@ -253,7 +253,7 @@ MPI_Request Request::isend(void *buf, int count, MPI_Datatype datatype, int dst,
 MPI_Request Request::issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
-  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                         comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | ISEND | SSEND | SEND);
   request->start();
   return request;
@@ -265,7 +265,7 @@ MPI_Request Request::irecv(void *buf, int count, MPI_Datatype datatype, int src,
   MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
   request             = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype,
                         src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->getPid(),
-                        simgrid::s4u::Actor::self()->getPid(), tag, comm, NON_PERSISTENT | RECV);
+                        simgrid::s4u::this_actor::getPid(), tag, comm, NON_PERSISTENT | RECV);
   request->start();
   return request;
 }
@@ -281,7 +281,7 @@ void Request::recv(void *buf, int count, MPI_Datatype datatype, int src, int tag
 void Request::send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
-  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                         comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | SEND);
 
   request->start();
@@ -292,7 +292,7 @@ void Request::send(void *buf, int count, MPI_Datatype datatype, int dst, int tag
 void Request::ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
 {
   MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
-  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::Actor::self()->getPid(),
+  request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(),
                         comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | SSEND | SEND);
 
   request->start();
@@ -306,7 +306,7 @@ void Request::sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int d
 {
   MPI_Request requests[2];
   MPI_Status stats[2];
-  unsigned int myid = simgrid::s4u::Actor::self()->getPid();
+  int myid = simgrid::s4u::this_actor::getPid();
   if ((comm->group()->actor(dst)->getPid() == myid) && (comm->group()->actor(src)->getPid() == myid)){
       Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
       if(status !=MPI_STATUS_IGNORE){
@@ -413,7 +413,7 @@ void Request::start()
           if ((smpi_privatize_global_variables != 0) && (static_cast<char*>(buf_) >= smpi_data_exe_start) &&
               (static_cast<char*>(buf_) < smpi_data_exe_start + smpi_data_exe_size)) {
             XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment ");
-            smpi_switch_data_segment(src_);
+            smpi_switch_data_segment(simgrid::s4u::Actor::byPid(src_));
           }
           buf = xbt_malloc(size_);
           memcpy(buf,oldbuf,size_);
@@ -635,9 +635,9 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   static int nsleeps = 1;
   double speed        = simgrid::s4u::Actor::self()->getHost()->getSpeed();
   double maxrate = xbt_cfg_get_double("smpi/iprobe-cpu-usage");
-  MPI_Request request = new Request(
-      nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->getPid(),
-      simgrid::s4u::Actor::self()->getPid(), tag, comm, PERSISTENT | RECV);
+  MPI_Request request = new Request(nullptr, 0, MPI_CHAR,
+                                    source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->getPid(),
+                                    simgrid::s4u::this_actor::getPid(), tag, comm, PERSISTENT | RECV);
   if (smpi_iprobe_sleep > 0) {
     smx_activity_t iprobe_sleep = simcall_execution_start(
         "iprobe", /* flops to executek*/ nsleeps * smpi_iprobe_sleep * speed * maxrate, /* priority */ 1.0,
@@ -708,7 +708,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
           static_cast<char*>(req->old_buf_) >= smpi_data_exe_start &&
           static_cast<char*>(req->old_buf_) < smpi_data_exe_start + smpi_data_exe_size) {
         XBT_VERB("Privatization : We are unserializing to a zone in global memory  Switch data segment ");
-        smpi_switch_data_segment(simgrid::s4u::Actor::self()->getPid());
+        smpi_switch_data_segment(simgrid::s4u::Actor::self());
       }
 
       if(datatype->flags() & DT_FLAG_DERIVED){
@@ -727,7 +727,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
   }
 
   if (TRACE_smpi_view_internals() && ((req->flags_ & RECV) != 0)){
-    int rank       = simgrid::s4u::Actor::self()->getPid();
+    int rank       = simgrid::s4u::this_actor::getPid();
     int src_traced = (req->src_ == MPI_ANY_SOURCE ? req->real_src_ : req->src_);
     TRACE_smpi_recv(src_traced, rank,req->tag_);
   }
index 85fd1ea..fcafe88 100755 (executable)
@@ -23,10 +23,20 @@ if [ "x@WIN32@" = "x1" ]; then
     list_add LINKARGS "@libdir@\libsimgrid.dll"
 elif [ "x@APPLE@" = "x1" ]; then
     list_add CFLAGS "-fpic"
-    list_add LINKARGS "-shared" "-lsimgrid" "-Wl,-undefined,error"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    else
+       echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+    fi
+    list_add LINKARGS "-lsimgrid" "-Wl,-undefined,error"
 else
     list_add CFLAGS "-fpic"
-    list_add LINKARGS "-shared" "-lsimgrid" "-Wl,-z,defs"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    else
+       echo "Warning: smpicc pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+    fi
+    list_add LINKARGS "-lsimgrid" "-Wl,-z,defs"
 fi
 
 
index eb8dbe1..c5abb46 100755 (executable)
@@ -20,11 +20,16 @@ list_set CXXFLAGS
 list_set LINKARGS
 if [ "@WIN32@" != "1" ]; then
     # list_add CXXFLAGS "-Dmain=smpi_simulated_main_"
-    list_add CXXFLAGS "-fpic"
-    list_add LINKARGS "-shared" "-lsimgrid"
+    list_add CXXFLAGS "-fpic" "-std=gnu++11"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    else
+       echo "Warning: smpicxx pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+    fi
+    list_add LINKARGS "-lsimgrid" "-std=gnu++11"
 else
-    list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h"
-    list_add LINKARGS "@libdir@\libsimgrid.dll"
+    list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h" "-std=gnu++11"
+    list_add LINKARGS "@libdir@\libsimgrid.dll" "-std=gnu++11"
 fi
 
 list_set CMDARGS
index 56b3ac6..a269cd8 100644 (file)
@@ -1,7 +1,6 @@
 #!/usr/bin/env sh
 
-# Copyright (c) 2012-2017. The SimGrid Team.
-# All rights reserved.
+# Copyright (c) 2012-2018. 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.
@@ -9,7 +8,7 @@
 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
 
-F90=@SMPI_Fortran_COMPILER@
+REAL_FORTRAN_COMPILER=@SMPI_Fortran_COMPILER@
 
 INCLUDEARGS="@includeflag@"
 CMAKE_LINKARGS="-L@libdir@"
@@ -17,7 +16,12 @@ CMAKE_LINKARGS="-L@libdir@"
 @SMPITOOLS_SH@
 
 list_set FFLAGS @SMPI_Fortran_FLAGS@
-list_set LINKARGS "-shared" "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
+list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
+if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+   list_add LINKARGS "-shared"
+else
+   echo "Warning: smpif90 pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+fi
 list_set TMPFILES
 main_name=main
 
@@ -29,13 +33,15 @@ trap 'cleanup' EXIT
 
 filter_and_compile() {
     list_add TMPFILES "${TMPFILE}"
-#replace "program main_name by subroutine user\_main (and the end clause as well)"
-    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g;s/[[:space:]]*[uU][sS][eE][[:space:]]*[mM][pP][iI]/\include \"mpif\.h\" /g' "${ARG}" > "${TMPFILE}"
+    #replace "program main_name by subroutine user\_main (and the end clause as well)"
+    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g' "${ARG}" > "${TMPFILE}"
     SRCFILE="${TMPFILE}"
     list_add CMDLINE "${SRCFILE}"
 }
 
-list_set CMDLINE "${F90}"
+NEEDS_OUTPUT=1
+
+list_set CMDLINE "${REAL_FORTRAN_COMPILER}"
 list_add_not_empty CMDLINE "${FFLAGS}"
 while [ $# -gt 0 ]; do
     ARG="$1"
@@ -47,11 +53,15 @@ while [ $# -gt 0 ]; do
             list_add CMDLINE "-c"
             ;;
         *.f90)
+            FILENAME=`basename ${ARG}`
             TMPFILE=$(mymktemp "${ARG}" ".f90")
+            ORIGFILE="${FILENAME%.f90}"
             filter_and_compile
             ;;
         *.F90)
+            FILENAME=`basename ${ARG}`
             TMPFILE=$(mymktemp "${ARG}" ".F90")
+            ORIGFILE="${FILENAME%.F90}"
             filter_and_compile
             ;;
         '-version' | '--version')
@@ -63,10 +73,11 @@ while [ $# -gt 0 ]; do
             exit 0
             ;;
         '-compiler-version' | '--compiler-version')
-            ${F90} --version
+            ${REAL_FORTRAN_COMPILER} --version
             ;;
         -o)
             list_add CMDLINE "-o$1"
+            NEEDS_OUTPUT=0
             shift
             ;;
         *)
@@ -75,6 +86,10 @@ while [ $# -gt 0 ]; do
     esac
 done
 
+if [ $NEEDS_OUTPUT -ne 0 ]; then
+   list_add CMDLINE "-o${ORIGFILE}.o"
+fi
+
 list_add_not_empty CMDLINE ${INCLUDEARGS}
 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
 list_add_not_empty CMDLINE "${LINKARGS}"
index 42120a7..5fafa51 100644 (file)
@@ -1,7 +1,6 @@
 #!/usr/bin/env sh
 
-# Copyright (c) 2012-2017. The SimGrid Team.
-# All rights reserved.
+# Copyright (c) 2012-2018. 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.
@@ -9,7 +8,7 @@
 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
 
-F77=@SMPI_Fortran_COMPILER@
+REAL_FORTRAN_COMPILER=@SMPI_Fortran_COMPILER@
 
 INCLUDEARGS="@includeflag@"
 CMAKE_LINKARGS="-L@libdir@"
@@ -17,7 +16,12 @@ CMAKE_LINKARGS="-L@libdir@"
 @SMPITOOLS_SH@
 
 list_set FFLAGS @SMPI_Fortran_FLAGS@
-list_set LINKARGS "-shared" "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
+list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
+if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+   list_add LINKARGS "-shared"
+else
+   echo "Warning: smpiff pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
+fi
 list_set TMPFILES
 main_name=main
 
@@ -27,21 +31,32 @@ cleanup () {
 }
 trap 'cleanup' EXIT
 
-filter_and_compile() {
+filter_and_compile_f77() {
+    list_add TMPFILES "${TMPFILE}"
+    #replace "program main_name by subroutine user\_main (and the end clause as well)"
+    if [ $TRACE_CALL_LOCATION -gt 0 ]; then
+      echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
+      echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
+    fi
+    sed 's/[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9\-\_]*\)/      \1subroutine user_main /g' "${ARG}" >> "${TMPFILE}"
+    SRCFILE="${TMPFILE}"
+    list_add CMDLINE "${SRCFILE}"
+}
+filter_and_compile_f90() {
     list_add TMPFILES "${TMPFILE}"
     #replace "program main_name by subroutine user\_main (and the end clause as well)"
     if [ $TRACE_CALL_LOCATION -gt 0 ]; then
       echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
-    echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
+      echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
     fi
-    sed 's/[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][[:space:]]*\([a-zA-Z0-9\-\_]*\)/      \1subroutine user_main /g;s/[[:space:]]*[uU][sS][eE][[:space:]]*[mM][pP][iI]/\include \"mpif\.h\" /g' "${ARG}" >> "${TMPFILE}"
+    sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g' "${ARG}" > "${TMPFILE}"
     SRCFILE="${TMPFILE}"
     list_add CMDLINE "${SRCFILE}"
 }
 TRACE_CALL_LOCATION=0
 NEEDS_OUTPUT=1
 
-list_set CMDLINE "${F77}"
+list_set CMDLINE "${REAL_FORTRAN_COMPILER}"
 list_add_not_empty CMDLINE "${FFLAGS}"
 while [ $# -gt 0 ]; do
     ARG="$1"
@@ -53,14 +68,28 @@ while [ $# -gt 0 ]; do
             list_add CMDLINE "-c"
             ;;
         *.f)
+            FILENAME=`basename ${ARG}`
             TMPFILE=$(mymktemp "${ARG}" ".f")
-            ORIGFILE="${ARG%.f}"
-            filter_and_compile
+            ORIGFILE="${FILENAME%.f}"
+            filter_and_compile_f77
             ;;
-        *.F)
+        *.F)$
+            FILENAME=`basename ${ARG}`
             TMPFILE=$(mymktemp "${ARG}" ".F")
-            ORIGFILE="${ARG%.F}"
-            filter_and_compile
+            ORIGFILE="${FILENAME%.F}"
+            filter_and_compile_f77
+            ;;
+        *.f90)
+            FILENAME=`basename ${ARG}`
+            TMPFILE=$(mymktemp "${ARG}" ".f90")
+            ORIGFILE="${FILENAME%.f90}"
+            filter_and_compile_f90
+            ;;
+        *.F90)$
+            FILENAME=`basename ${ARG}`
+            TMPFILE=$(mymktemp "${ARG}" ".F90")
+            ORIGFILE="${FILENAME%.F90}"
+            filter_and_compile_f90
             ;;
         '-version' | '--version')
             printf '%b\n' "$SIMGRID_VERSION"
@@ -71,7 +100,7 @@ while [ $# -gt 0 ]; do
             exit 0
             ;;
         '-compiler-version' | '--compiler-version')
-            ${F77} --version
+            ${REAL_FORTRAN_COMPILER} --version
             ;;
         '-trace-call-location')
             TRACE_CALL_LOCATION=1
@@ -80,10 +109,10 @@ while [ $# -gt 0 ]; do
             list_add_not_empty CMDLINE "-ffixed-line-length-none" "-cpp"
             ;;
         -o)
-            NEEDS_OUTPUT=0
             list_add CMDLINE "-o$1"
+            NEEDS_OUTPUT=0
             shift
-            ;;        
+            ;;
         *)
             list_add CMDLINE "${ARG}"
             ;;
@@ -91,7 +120,7 @@ while [ $# -gt 0 ]; do
 done
 
 if [ $NEEDS_OUTPUT -ne 0 ]; then
-   list_add CMDLINE "-o${ORIGFILE}.o"     
+   list_add CMDLINE "-o${ORIGFILE}.o"
 fi
 
 list_add_not_empty CMDLINE ${INCLUDEARGS}
index 966c456..a3ce858 100755 (executable)
@@ -23,7 +23,7 @@ NETWORK_BANDWIDTH="${DEFAULT_NETWORK_BANDWIDTH}"
 NETWORK_LATENCY="${DEFAULT_NETWORK_LATENCY}"
 SPEED="${DEFAULT_SPEED}"
 
-PRIVATIZE="--cfg=smpi/privatization:@HAVE_PRIVATIZATION@"
+PRIVATIZE="--cfg=smpi/privatization:${SMPI_PRIVATIZATION:-@HAVE_PRIVATIZATION@}"
 
 SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI"
 
index 6edf250..889b934 100644 (file)
@@ -36,9 +36,9 @@ void HostModel::ignoreEmptyVmInPmLMM()
 
     XBT_DEBUG("set the weight of the dummy CPU action of VM%p on PM to %d (#tasks: %d)", ws_vm, impact, active_tasks);
     if (impact > 0)
-      ws_vm->getImpl()->action_->setSharingWeight(1. / impact);
+      ws_vm->getImpl()->action_->set_priority(1. / impact);
     else
-      ws_vm->getImpl()->action_->setSharingWeight(0.);
+      ws_vm->getImpl()->action_->set_priority(0.);
   }
 }
 
index 632ec37..3325fd3 100644 (file)
@@ -18,7 +18,7 @@
  * Tools *
  *********/
 
-XBT_PUBLIC_DATA(simgrid::surf::HostModel*) surf_host_model;
+XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
 
 /*********
  * Model *
index fcfa534..d15f285 100644 (file)
@@ -4,6 +4,8 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "StorageImpl.hpp"
+#include "simgrid/s4u/Engine.hpp"
+#include "src/kernel/EngineImpl.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "surf_private.hpp"
 
@@ -24,24 +26,13 @@ simgrid::xbt::signal<void(StorageImpl*, int, int)> storageStateChangedCallbacks;
 simgrid::xbt::signal<void(StorageAction*, kernel::resource::Action::State, kernel::resource::Action::State)>
     storageActionStateChangedCallbacks;
 
-/* List of storages */
-std::unordered_map<std::string, StorageImpl*>* StorageImpl::storages =
-    new std::unordered_map<std::string, StorageImpl*>();
-
-StorageImpl* StorageImpl::byName(std::string name)
-{
-  if (storages->find(name) == storages->end())
-    return nullptr;
-  return storages->at(name);
-}
-
 /*********
  * Model *
  *********/
 
 StorageModel::StorageModel() : Model()
 {
-  maxminSystem_ = new simgrid::kernel::lmm::System(true /* lazy update */);
+  set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */));
 }
 
 StorageModel::~StorageModel()
@@ -53,11 +44,11 @@ StorageModel::~StorageModel()
  * Resource *
  ************/
 
-StorageImpl::StorageImpl(kernel::resource::Model* model, std::string name, lmm_system_t maxminSystem, double bread,
-                         double bwrite, std::string type_id, std::string content_name, sg_size_t size,
+StorageImpl::StorageImpl(kernel::resource::Model* model, std::string name, kernel::lmm::System* maxminSystem,
+                         double bread, double bwrite, std::string type_id, std::string content_name, sg_size_t size,
                          std::string attach)
     : Resource(model, name.c_str(), maxminSystem->constraint_new(this, std::max(bread, bwrite)))
-    , piface_(this)
+    , piface_(name, this)
     , typeId_(type_id)
     , content_name(content_name)
     , size_(size)
@@ -67,7 +58,6 @@ StorageImpl::StorageImpl(kernel::resource::Model* model, std::string name, lmm_s
   XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
   constraintRead_  = maxminSystem->constraint_new(this, bread);
   constraintWrite_ = maxminSystem->constraint_new(this, bwrite);
-  storages->insert({name, this});
 }
 
 StorageImpl::~StorageImpl()
@@ -75,7 +65,6 @@ StorageImpl::~StorageImpl()
   storageDestructedCallbacks(this);
 }
 
-
 bool StorageImpl::isUsed()
 {
   THROW_UNIMPLEMENTED;
@@ -105,10 +94,10 @@ void StorageImpl::turnOff()
 /**********
  * Action *
  **********/
-void StorageAction::setState(Action::State state)
+void StorageAction::set_state(Action::State state)
 {
-  Action::State old = getState();
-  Action::setState(state);
+  Action::State old = get_state();
+  Action::set_state(state);
   storageActionStateChangedCallbacks(this, old, state);
 }
 }
index ff0704a..9b3610f 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2004-2018. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2018. 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. */
@@ -7,12 +6,13 @@
 #include <xbt/base.h>
 #include <xbt/signal.hpp>
 
+#include "simgrid/kernel/resource/Action.hpp"
+#include "simgrid/kernel/resource/Model.hpp"
+#include "simgrid/kernel/resource/Resource.hpp"
 #include "simgrid/s4u/Storage.hpp"
-#include "src/kernel/resource/Action.hpp"
-#include "src/kernel/resource/Model.hpp"
-#include "src/kernel/resource/Resource.hpp"
 #include "src/surf/PropertyHolder.hpp"
 #include "surf_interface.hpp"
+
 #include <map>
 
 #ifndef STORAGE_INTERFACE_HPP_
@@ -35,29 +35,29 @@ class StorageAction;
  * @brief Callbacks handler which emit the callbacks after Storage creation *
  * @details Callback functions have the following signature: `void(Storage*)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(StorageImpl*)>) storageCreatedCallbacks;
+XBT_PUBLIC_DATA simgrid::xbt::signal<void(StorageImpl*)> storageCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage destruction *
  * @details Callback functions have the following signature: `void(StoragePtr)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(StorageImpl*)>) storageDestructedCallbacks;
+XBT_PUBLIC_DATA simgrid::xbt::signal<void(StorageImpl*)> storageDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage State changed *
  * @details Callback functions have the following signature: `void(StorageAction *action, int previouslyOn, int
  * currentlyOn)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(StorageImpl*, int, int)>) storageStateChangedCallbacks;
+XBT_PUBLIC_DATA simgrid::xbt::signal<void(StorageImpl*, int, int)> storageStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after StorageAction State changed *
  * @details Callback functions have the following signature: `void(StorageAction *action,
  * simgrid::kernel::resource::Action::State old, simgrid::kernel::resource::Action::State current)`
  */
-XBT_PUBLIC_DATA(
-    simgrid::xbt::signal<void(StorageAction*, kernel::resource::Action::State, kernel::resource::Action::State)>)
-storageActionStateChangedCallbacks;
+XBT_PUBLIC_DATA
+simgrid::xbt::signal<void(StorageAction*, kernel::resource::Action::State, kernel::resource::Action::State)>
+    storageActionStateChangedCallbacks;
 
 /*********
  * Model *
@@ -73,8 +73,6 @@ public:
 
   virtual StorageImpl* createStorage(std::string id, std::string type_id, std::string content_name,
                                      std::string attach) = 0;
-
-  std::vector<StorageImpl*> p_storageList;
 };
 
 /************
@@ -87,14 +85,13 @@ public:
 class StorageImpl : public kernel::resource::Resource, public PropertyHolder {
 public:
   /** @brief Storage constructor */
-  StorageImpl(kernel::resource::Model* model, std::string name, lmm_system_t maxminSystem, double bread, double bwrite,
-              std::string type_id, std::string content_name, sg_size_t size, std::string attach);
+  StorageImpl(kernel::resource::Model* model, std::string name, kernel::lmm::System* maxminSystem, double bread,
+              double bwrite, std::string type_id, std::string content_name, sg_size_t size, std::string attach);
 
   ~StorageImpl() override;
 
   /** @brief Public interface */
   s4u::Storage piface_;
-  static StorageImpl* byName(std::string name);
 
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool isUsed() override;
@@ -121,8 +118,6 @@ public:
   virtual StorageAction* write(sg_size_t size) = 0;
   virtual std::string getHost() { return attach_; }
 
-  static std::unordered_map<std::string, StorageImpl*>* storagesMap() { return StorageImpl::storages; }
-
   kernel::lmm::Constraint* constraintWrite_; /* Constraint for maximum write bandwidth*/
   kernel::lmm::Constraint* constraintRead_;  /* Constraint for maximum write bandwidth*/
 
@@ -131,7 +126,6 @@ public:
   sg_size_t size_;          // Only used at parsing time then goes to the FileSystemExtension
 
 private:
-  static std::unordered_map<std::string, StorageImpl*>* storages;
   // Name of the host to which this storage is attached. Only used at platform parsing time, then the interface stores
   // the Host directly.
   std::string attach_;
@@ -181,7 +175,7 @@ public:
                 StorageImpl* storage, e_surf_action_storage_type_t type)
       : Action(model, cost, failed, var), type_(type), storage_(storage){};
 
-  void setState(simgrid::kernel::resource::Action::State state) override;
+  void set_state(simgrid::kernel::resource::Action::State state) override;
 
   e_surf_action_storage_type_t type_;
   StorageImpl* storage_;
index 5c6f2dc..808b78a 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "cpu_cas01.hpp"
 #include "cpu_ti.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "xbt/utility.hpp"
 #include <algorithm>
@@ -41,23 +41,20 @@ CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
   bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
 
   if (optim == "Full") {
-    setUpdateMechanism(UM_FULL);
-    selectiveUpdate_ = select;
+    setUpdateMechanism(Model::UpdateAlgo::Full);
   } else if (optim == "Lazy") {
-    setUpdateMechanism(UM_LAZY);
-    selectiveUpdate_ = true;
-    xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
-               "Disabling selective update while using the lazy update mechanism is dumb!");
+    xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"),
+               "You cannot disable cpu selective update when using the lazy update mechanism");
+    setUpdateMechanism(Model::UpdateAlgo::Lazy);
+    select = true;
   } else {
     xbt_die("Unsupported optimization (%s) for this model", optim.c_str());
   }
 
-  maxminSystem_ = new simgrid::kernel::lmm::System(selectiveUpdate_);
+  set_maxmin_system(new simgrid::kernel::lmm::System(select));
 
-  if (getUpdateMechanism() == UM_LAZY) {
-    modifiedSet_              = new kernel::resource::ActionLmmList();
-    maxminSystem_->keep_track = modifiedSet_;
-  }
+  if (getUpdateMechanism() == Model::UpdateAlgo::Lazy)
+    get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 CpuCas01Model::~CpuCas01Model()
@@ -74,7 +71,7 @@ Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, std::vector<double> *spe
  * Resource *
  ************/
 CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
-    : Cpu(model, host, model->getMaxminSystem()->constraint_new(this, core * speedPerPstate->front()), speedPerPstate,
+    : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, core * speedPerPstate->front()), speedPerPstate,
           core)
 {
 }
@@ -91,7 +88,7 @@ std::vector<double> * CpuCas01::getSpeedPeakList(){
 
 bool CpuCas01::isUsed()
 {
-  return model()->getMaxminSystem()->constraint_used(constraint());
+  return model()->get_maxmin_system()->constraint_used(constraint());
 }
 
 /** @brief take into account changes of speed (either load or max) */
@@ -99,12 +96,12 @@ void CpuCas01::onSpeedChange() {
   kernel::lmm::Variable* var = nullptr;
   const_lmm_element_t elem = nullptr;
 
-  model()->getMaxminSystem()->update_constraint_bound(constraint(), coresAmount_ * speed_.scale * speed_.peak);
+  model()->get_maxmin_system()->update_constraint_bound(constraint(), coresAmount_ * speed_.scale * speed_.peak);
   while ((var = constraint()->get_variable(&elem))) {
     CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
 
-    model()->getMaxminSystem()->update_variable_bound(action->getVariable(),
-                                                      action->requestedCore() * speed_.scale * speed_.peak);
+    model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
+                                                        action->requestedCore() * speed_.scale * speed_.peak);
   }
 
   Cpu::onSpeedChange();
@@ -139,11 +136,11 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value)
       while ((var = cnst->get_variable(&elem))) {
         kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
-        if (action->getState() == kernel::resource::Action::State::running ||
-            action->getState() == kernel::resource::Action::State::ready ||
-            action->getState() == kernel::resource::Action::State::not_in_the_system) {
-          action->setFinishTime(date);
-          action->setState(kernel::resource::Action::State::failed);
+        if (action->get_state() == kernel::resource::Action::State::running ||
+            action->get_state() == kernel::resource::Action::State::ready ||
+            action->get_state() == kernel::resource::Action::State::not_in_the_system) {
+          action->set_finish_time(date);
+          action->set_state(kernel::resource::Action::State::failed);
         }
       }
     }
@@ -174,21 +171,21 @@ CpuAction *CpuCas01::sleep(double duration)
   CpuCas01Action* action = new CpuCas01Action(model(), 1.0, isOff(), speed_.scale * speed_.peak, constraint());
 
   // FIXME: sleep variables should not consume 1.0 in System::expand()
-  action->setMaxDuration(duration);
+  action->set_max_duration(duration);
   action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
   if (duration < 0) { // NO_MAX_DURATION
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
-    simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
-    action->stateSet_ = &static_cast<CpuCas01Model*>(model())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
-    action->getStateSet()->push_back(*action);
+    simgrid::xbt::intrusive_erase(*action->get_state_set(), *action);
+    action->state_set_ = &static_cast<CpuCas01Model*>(model())->cpuRunningActionSetThatDoesNotNeedBeingChecked_;
+    action->get_state_set()->push_back(*action);
   }
 
-  model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0);
-  if (model()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap
-    action->heapRemove(model()->getActionHeap());
+  model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
+  if (model()->getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) { // remove action from the heap
+    action->heapRemove();
     // this is necessary for a variable with weight 0 since such variables are ignored in lmm and we need to set its
     // max_duration correctly at the next call to share_resources
-    model()->getModifiedSet()->push_front(*action);
+    model()->get_modified_set()->push_front(*action);
   }
 
   XBT_OUT();
@@ -201,14 +198,14 @@ CpuAction *CpuCas01::sleep(double duration)
 CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
                                kernel::lmm::Constraint* constraint, int requestedCore)
     : CpuAction(model, cost, failed,
-                model->getMaxminSystem()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
+                model->get_maxmin_system()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
     , requestedCore_(requestedCore)
 {
-  if (model->getUpdateMechanism() == UM_LAZY) {
-    refreshLastUpdate();
-    setLastValue(0.0);
+  if (model->getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) {
+    set_last_update();
+    set_last_value(0.0);
   }
-  model->getMaxminSystem()->expand(constraint, getVariable(), 1.0);
+  model->get_maxmin_system()->expand(constraint, get_variable(), 1.0);
 }
 
 CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
index cefa230..7ed577b 100644 (file)
@@ -28,7 +28,7 @@ public:
   ~CpuCas01Model() override;
 
   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
-  kernel::resource::ActionList p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+  kernel::resource::Action::StateSet cpuRunningActionSetThatDoesNotNeedBeingChecked_;
 };
 
 /************
index a223b68..bbac0ef 100644 (file)
@@ -20,31 +20,28 @@ namespace surf {
  * Model *
  *********/
 
-void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
+void CpuModel::update_actions_state_lazy(double now, double /*delta*/)
 {
   while (not actionHeapIsEmpty() && double_equals(actionHeapTopDate(), now, sg_surf_precision)) {
 
     CpuAction* action = static_cast<CpuAction*>(actionHeapPop());
     XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
     if (TRACE_is_enabled()) {
-      Cpu* cpu = static_cast<Cpu*>(action->getVariable()->get_constraint(0)->get_id());
-      TRACE_surf_host_set_utilization(cpu->getCname(), action->getCategory(), action->getVariable()->get_value(),
-                                      action->getLastUpdate(), now - action->getLastUpdate());
+      Cpu* cpu = static_cast<Cpu*>(action->get_variable()->get_constraint(0)->get_id());
+      TRACE_surf_host_set_utilization(cpu->getCname(), action->get_category(), action->get_variable()->get_value(),
+                                      action->get_last_update(), now - action->get_last_update());
     }
 
     action->finish(kernel::resource::Action::State::done);
     XBT_CDEBUG(surf_kernel, "Action %p finished", action);
-
-    /* set the remains to 0 due to precision problems when updating the remaining amount */
-    action->setRemains(0);
   }
   if (TRACE_is_enabled()) {
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
-    for (kernel::resource::Action const& action : *getRunningActionSet()) {
-      if (smaller < 0 || action.getLastUpdate() < smaller)
-        smaller = action.getLastUpdate();
+    for (kernel::resource::Action const& action : *get_running_action_set()) {
+      if (smaller < 0 || action.get_last_update() < smaller)
+        smaller = action.get_last_update();
     }
     if (smaller > 0) {
       TRACE_last_timestamp_to_dump = smaller;
@@ -52,25 +49,25 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
   }
 }
 
-void CpuModel::updateActionsStateFull(double now, double delta)
+void CpuModel::update_actions_state_full(double now, double delta)
 {
-  for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
     CpuAction& action = static_cast<CpuAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     if (TRACE_is_enabled()) {
-      Cpu* cpu = static_cast<Cpu*>(action.getVariable()->get_constraint(0)->get_id());
-      TRACE_surf_host_set_utilization(cpu->getCname(), action.getCategory(), action.getVariable()->get_value(),
+      Cpu* cpu = static_cast<Cpu*>(action.get_variable()->get_constraint(0)->get_id());
+      TRACE_surf_host_set_utilization(cpu->getCname(), action.get_category(), action.get_variable()->get_value(),
                                       now - delta, delta);
       TRACE_last_timestamp_to_dump = now - delta;
     }
 
-    action.updateRemains(action.getVariable()->get_value() * delta);
+    action.update_remains(action.get_variable()->get_value() * delta);
 
-    if (action.getMaxDuration() != NO_MAX_DURATION)
-      action.updateMaxDuration(delta);
+    if (action.get_max_duration() != NO_MAX_DURATION)
+      action.update_max_duration(delta);
 
-    if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
-        ((action.getMaxDuration() != NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
+    if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) ||
+        ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
       action.finish(kernel::resource::Action::State::done);
     }
   }
@@ -173,59 +170,61 @@ void Cpu::setSpeedTrace(tmgr_trace_t trace)
  * Action *
  **********/
 
-void CpuAction::updateRemainingLazy(double now)
+void CpuAction::update_remains_lazy(double now)
 {
-  xbt_assert(getStateSet() == getModel()->getRunningActionSet(), "You're updating an action that is not running.");
-  xbt_assert(getPriority() > 0, "You're updating an action that seems suspended.");
+  xbt_assert(get_state_set() == get_model()->get_running_action_set(),
+             "You're updating an action that is not running.");
+  xbt_assert(get_priority() > 0, "You're updating an action that seems suspended.");
 
-  double delta = now - getLastUpdate();
+  double delta = now - get_last_update();
 
-  if (getRemainsNoUpdate() > 0) {
-    XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, getRemainsNoUpdate(),
-               getLastUpdate());
-    updateRemains(getLastValue() * delta);
+  if (get_remains_no_update() > 0) {
+    XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(),
+               get_last_update());
+    update_remains(get_last_value() * delta);
 
     if (TRACE_is_enabled()) {
-      Cpu* cpu = static_cast<Cpu*>(getVariable()->get_constraint(0)->get_id());
-      TRACE_surf_host_set_utilization(cpu->getCname(), getCategory(), getLastValue(), getLastUpdate(),
-                                      now - getLastUpdate());
+      Cpu* cpu = static_cast<Cpu*>(get_variable()->get_constraint(0)->get_id());
+      TRACE_surf_host_set_utilization(cpu->getCname(), get_category(), get_last_value(), get_last_update(),
+                                      now - get_last_update());
     }
-    XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, getRemainsNoUpdate());
+    XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, get_remains_no_update());
   }
 
-  refreshLastUpdate();
-  setLastValue(getVariable()->get_value());
+  set_last_update();
+  set_last_value(get_variable()->get_value());
 }
 
 simgrid::xbt::signal<void(simgrid::surf::CpuAction*, kernel::resource::Action::State)> CpuAction::onStateChange;
 
 void CpuAction::suspend(){
-  Action::State previous = getState();
+  Action::State previous = get_state();
   onStateChange(this, previous);
   Action::suspend();
 }
 
 void CpuAction::resume(){
-  Action::State previous = getState();
+  Action::State previous = get_state();
   onStateChange(this, previous);
   Action::resume();
 }
 
-void CpuAction::setState(Action::State state){
-  Action::State previous = getState();
-  Action::setState(state);
+void CpuAction::set_state(Action::State state)
+{
+  Action::State previous = get_state();
+  Action::set_state(state);
   onStateChange(this, previous);
 }
 /** @brief returns a list of all CPUs that this action is using */
 std::list<Cpu*> CpuAction::cpus() {
   std::list<Cpu*> retlist;
-  int llen = getVariable()->get_number_of_constraint();
+  int llen = get_variable()->get_number_of_constraint();
 
   for (int i = 0; i < llen; i++) {
     /* Beware of composite actions: ptasks put links and cpus together */
     // extra pb: we cannot dynamic_cast from void*...
     kernel::resource::Resource* resource =
-        static_cast<kernel::resource::Resource*>(getVariable()->get_constraint(i)->get_id());
+        static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
     Cpu* cpu           = dynamic_cast<Cpu*>(resource);
     if (cpu != nullptr)
       retlist.push_back(cpu);
index bc04a19..375c1d7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -6,10 +6,10 @@
 #ifndef SURF_CPU_INTERFACE_HPP_
 #define SURF_CPU_INTERFACE_HPP_
 
+#include "simgrid/kernel/resource/Model.hpp"
+#include "simgrid/kernel/resource/Resource.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/resource/Model.hpp"
-#include "src/kernel/resource/Resource.hpp"
 
 #include <list>
 
@@ -24,8 +24,7 @@ namespace surf {
  * @brief SURF cpu model interface class
  * @details A model is an object which handle the interactions between its Resources and its Actions
  */
-XBT_PUBLIC_CLASS CpuModel : public kernel::resource::Model
-{
+class XBT_PUBLIC CpuModel : public kernel::resource::Model {
 public:
   /**
    * @brief Create a Cpu
@@ -36,8 +35,8 @@ public:
    */
   virtual Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)=0;
 
-  void updateActionsStateLazy(double now, double delta) override;
-  void updateActionsStateFull(double now, double delta) override;
+  void update_actions_state_lazy(double now, double delta) override;
+  void update_actions_state_full(double now, double delta) override;
 };
 
 /************
@@ -48,8 +47,7 @@ public:
 * @brief SURF cpu resource interface class
 * @details A Cpu represent a cpu associated to a host
 */
-XBT_PUBLIC_CLASS Cpu : public simgrid::kernel::resource::Resource
-{
+class XBT_PUBLIC Cpu : public simgrid::kernel::resource::Resource {
 public:
   /**
    * @brief Cpu constructor
@@ -91,11 +89,7 @@ public:
    * @param requestedCores The desired amount of cores. Must be >= 1
    * @return The CpuAction corresponding to the processing
    */
-  virtual simgrid::kernel::resource::Action* execution_start(double size, int requestedCores)
-  {
-    THROW_UNIMPLEMENTED;
-    return nullptr;
-  }
+  virtual simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) = 0;
 
   /**
    * @brief Make a process sleep for duration (in seconds)
@@ -148,9 +142,8 @@ public:
  /** @ingroup SURF_cpu_interface
  * @brief A CpuAction represents the execution of code on one or several Cpus
  */
-XBT_PUBLIC_CLASS CpuAction : public simgrid::kernel::resource::Action
-{
-  friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction* action);
+class XBT_PUBLIC CpuAction : public simgrid::kernel::resource::Action {
+  friend XBT_PUBLIC Cpu* getActionCpu(CpuAction * action);
 
 public:
   /** @brief Signal emitted when the action state changes (ready/running/done, etc)
@@ -168,9 +161,9 @@ public:
   {
   }
 
-  void setState(simgrid::kernel::resource::Action::State state) override;
+  void set_state(simgrid::kernel::resource::Action::State state) override;
 
-  void updateRemainingLazy(double now) override;
+  void update_remains_lazy(double now) override;
   std::list<Cpu*> cpus();
   
   void suspend() override;
index 10e8039..4fc9b6c 100644 (file)
@@ -336,7 +336,7 @@ Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, std::vector<double>* speedP
   return new CpuTi(this, host, speedPerPstate, core);
 }
 
-double CpuTiModel::nextOccuringEvent(double now)
+double CpuTiModel::next_occuring_event(double now)
 {
   double min_action_duration = -1;
 
@@ -356,14 +356,12 @@ double CpuTiModel::nextOccuringEvent(double now)
   return min_action_duration;
 }
 
-void CpuTiModel::updateActionsState(double now, double /*delta*/)
+void CpuTiModel::update_actions_state(double now, double /*delta*/)
 {
   while (not actionHeapIsEmpty() && actionHeapTopDate() <= now) {
     CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
     XBT_DEBUG("Action %p: finish", action);
     action->finish(kernel::resource::Action::State::done);
-    /* set the remains to 0 due to precision problems when updating the remaining amount */
-    action->setRemains(0);
     /* update remaining amount of all actions */
     action->cpu_->updateRemainingAmount(surf_get_clock());
   }
@@ -439,12 +437,12 @@ void CpuTi::apply_event(tmgr_trace_event_t event, double value)
 
       /* put all action running on cpu to failed */
       for (CpuTiAction& action : actionSet_) {
-        if (action.getState() == kernel::resource::Action::State::running ||
-            action.getState() == kernel::resource::Action::State::ready ||
-            action.getState() == kernel::resource::Action::State::not_in_the_system) {
-          action.setFinishTime(date);
-          action.setState(kernel::resource::Action::State::failed);
-          action.heapRemove(model()->getActionHeap());
+        if (action.get_state() == kernel::resource::Action::State::running ||
+            action.get_state() == kernel::resource::Action::State::ready ||
+            action.get_state() == kernel::resource::Action::State::not_in_the_system) {
+          action.set_finish_time(date);
+          action.set_state(kernel::resource::Action::State::failed);
+          action.heapRemove();
         }
       }
     }
@@ -465,54 +463,54 @@ void CpuTi::updateActionsFinishTime(double now)
 
   for (CpuTiAction const& action : actionSet_) {
     /* action not running, skip it */
-    if (action.getStateSet() != surf_cpu_model_pm->getRunningActionSet())
+    if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
       continue;
 
     /* bogus priority, skip it */
-    if (action.getPriority() <= 0)
+    if (action.get_priority() <= 0)
       continue;
 
     /* action suspended, skip it */
     if (action.suspended_ != kernel::resource::Action::SuspendStates::not_suspended)
       continue;
 
-    sum_priority += 1.0 / action.getPriority();
+    sum_priority += 1.0 / action.get_priority();
   }
   sumPriority_ = sum_priority;
 
   for (CpuTiAction& action : actionSet_) {
     double min_finish = -1;
     /* action not running, skip it */
-    if (action.getStateSet() != surf_cpu_model_pm->getRunningActionSet())
+    if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
       continue;
 
     /* verify if the action is really running on cpu */
-    if (action.suspended_ == kernel::resource::Action::SuspendStates::not_suspended && action.getPriority() > 0) {
+    if (action.suspended_ == kernel::resource::Action::SuspendStates::not_suspended && action.get_priority() > 0) {
       /* total area needed to finish the action. Used in trace integration */
-      total_area = (action.getRemains()) * sum_priority * action.getPriority();
+      total_area = (action.get_remains()) * sum_priority * action.get_priority();
 
       total_area /= speed_.peak;
 
-      action.setFinishTime(speedIntegratedTrace_->solve(now, total_area));
+      action.set_finish_time(speedIntegratedTrace_->solve(now, total_area));
       /* verify which event will happen before (max_duration or finish time) */
-      if (action.getMaxDuration() > NO_MAX_DURATION &&
-          action.getStartTime() + action.getMaxDuration() < action.getFinishTime())
-        min_finish = action.getStartTime() + action.getMaxDuration();
+      if (action.get_max_duration() > NO_MAX_DURATION &&
+          action.get_start_time() + action.get_max_duration() < action.get_finish_time())
+        min_finish = action.get_start_time() + action.get_max_duration();
       else
-        min_finish = action.getFinishTime();
+        min_finish = action.get_finish_time();
     } else {
       /* put the max duration time on heap */
-      if (action.getMaxDuration() > NO_MAX_DURATION)
-        min_finish = action.getStartTime() + action.getMaxDuration();
+      if (action.get_max_duration() > NO_MAX_DURATION)
+        min_finish = action.get_start_time() + action.get_max_duration();
     }
     /* add in action heap */
     if (min_finish > NO_MAX_DURATION)
-      action.heapUpdate(model()->getActionHeap(), min_finish, kernel::resource::Action::Type::NOTSET);
+      action.heapUpdate(min_finish, kernel::resource::Action::Type::NOTSET);
     else
-      action.heapRemove(model()->getActionHeap());
+      action.heapRemove();
 
     XBT_DEBUG("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f", getCname(),
-              &action, action.getStartTime(), action.getFinishTime(), action.getMaxDuration());
+              &action, action.get_start_time(), action.get_finish_time(), action.get_max_duration());
   }
   /* remove from modified cpu */
   modified(false);
@@ -542,11 +540,11 @@ void CpuTi::updateRemainingAmount(double now)
   XBT_DEBUG("Flops total: %f, Last update %f", area_total, lastUpdate_);
   for (CpuTiAction& action : actionSet_) {
     /* action not running, skip it */
-    if (action.getStateSet() != model()->getRunningActionSet())
+    if (action.get_state_set() != model()->get_running_action_set())
       continue;
 
     /* bogus priority, skip it */
-    if (action.getPriority() <= 0)
+    if (action.get_priority() <= 0)
       continue;
 
     /* action suspended, skip it */
@@ -554,16 +552,16 @@ void CpuTi::updateRemainingAmount(double now)
       continue;
 
     /* action don't need update */
-    if (action.getStartTime() >= now)
+    if (action.get_start_time() >= now)
       continue;
 
     /* skip action that are finishing now */
-    if (action.getFinishTime() >= 0 && action.getFinishTime() <= now)
+    if (action.get_finish_time() >= 0 && action.get_finish_time() <= now)
       continue;
 
     /* update remaining */
-    action.updateRemains(area_total / (sumPriority_ * action.getPriority()));
-    XBT_DEBUG("Update remaining action(%p) remaining %f", &action, action.getRemainsNoUpdate());
+    action.update_remains(area_total / (sumPriority_ * action.get_priority()));
+    XBT_DEBUG("Update remaining action(%p) remaining %f", &action, action.get_remains_no_update());
   }
   lastUpdate_ = now;
 }
@@ -588,13 +586,13 @@ CpuAction *CpuTi::sleep(double duration)
   XBT_IN("(%s,%g)", getCname(), duration);
   CpuTiAction* action = new CpuTiAction(static_cast<CpuTiModel*>(model()), 1.0, isOff(), this);
 
-  action->setMaxDuration(duration);
+  action->set_max_duration(duration);
   action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
   if (duration == NO_MAX_DURATION) {
     /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
-    simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
-    action->stateSet_ = &static_cast<CpuTiModel*>(model())->runningActionSetThatDoesNotNeedBeingChecked_;
-    action->getStateSet()->push_back(*action);
+    simgrid::xbt::intrusive_erase(*action->get_state_set(), *action);
+    action->state_set_ = &static_cast<CpuTiModel*>(model())->runningActionSetThatDoesNotNeedBeingChecked_;
+    action->get_state_set()->push_back(*action);
   }
 
   actionSet_.push_back(*action);
@@ -625,35 +623,26 @@ CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed, CpuTi *cp
 {
   cpu_->modified(true);
 }
-
-void CpuTiAction::setState(Action::State state)
+CpuTiAction::~CpuTiAction()
 {
-  CpuAction::setState(state);
+  /* remove from action_set */
+  if (action_ti_hook.is_linked())
+    simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this);
+  /* remove from heap */
+  heapRemove();
   cpu_->modified(true);
 }
 
-int CpuTiAction::unref()
+void CpuTiAction::set_state(Action::State state)
 {
-  refcount_--;
-  if (not refcount_) {
-    if (stateSetHook_.is_linked())
-      simgrid::xbt::intrusive_erase(*getStateSet(), *this);
-    /* remove from action_set */
-    if (action_ti_hook.is_linked())
-      simgrid::xbt::intrusive_erase(cpu_->actionSet_, *this);
-    /* remove from heap */
-    heapRemove(getModel()->getActionHeap());
-    cpu_->modified(true);
-    delete this;
-    return 1;
-  }
-  return 0;
+  CpuAction::set_state(state);
+  cpu_->modified(true);
 }
 
 void CpuTiAction::cancel()
 {
-  this->setState(Action::State::failed);
-  heapRemove(getModel()->getActionHeap());
+  this->set_state(Action::State::failed);
+  heapRemove();
   cpu_->modified(true);
 }
 
@@ -662,7 +651,7 @@ void CpuTiAction::suspend()
   XBT_IN("(%p)", this);
   if (suspended_ != Action::SuspendStates::sleeping) {
     suspended_ = Action::SuspendStates::suspended;
-    heapRemove(getModel()->getActionHeap());
+    heapRemove();
     cpu_->modified(true);
   }
   XBT_OUT();
@@ -678,40 +667,40 @@ void CpuTiAction::resume()
   XBT_OUT();
 }
 
-void CpuTiAction::setMaxDuration(double duration)
+void CpuTiAction::set_max_duration(double duration)
 {
   double min_finish;
 
   XBT_IN("(%p,%g)", this, duration);
 
-  Action::setMaxDuration(duration);
+  Action::set_max_duration(duration);
 
   if (duration >= 0)
-    min_finish = (getStartTime() + getMaxDuration()) < getFinishTime() ?
-                 (getStartTime() + getMaxDuration()) : getFinishTime();
+    min_finish = (get_start_time() + get_max_duration()) < get_finish_time() ? (get_start_time() + get_max_duration())
+                                                                             : get_finish_time();
   else
-    min_finish = getFinishTime();
+    min_finish = get_finish_time();
 
   /* add in action heap */
-  heapUpdate(getModel()->getActionHeap(), min_finish, Action::Type::NOTSET);
+  heapUpdate(min_finish, Action::Type::NOTSET);
 
   XBT_OUT();
 }
 
-void CpuTiAction::setSharingWeight(double priority)
+void CpuTiAction::set_priority(double priority)
 {
   XBT_IN("(%p,%g)", this, priority);
-  setSharingWeightNoUpdate(priority);
+  set_priority_no_update(priority);
   cpu_->modified(true);
   XBT_OUT();
 }
 
-double CpuTiAction::getRemains()
+double CpuTiAction::get_remains()
 {
   XBT_IN("(%p)", this);
   cpu_->updateRemainingAmount(surf_get_clock());
   XBT_OUT();
-  return getRemainsNoUpdate();
+  return get_remains_no_update();
 }
 
 }
index 2f29bda..ec9d0a0 100644 (file)
@@ -83,15 +83,15 @@ class CpuTiAction: public CpuAction {
   friend class CpuTi;
 public:
   CpuTiAction(CpuTiModel *model, double cost, bool failed, CpuTi *cpu);
+  ~CpuTiAction();
 
-  void setState(simgrid::kernel::resource::Action::State state) override;
-  int unref() override;
+  void set_state(simgrid::kernel::resource::Action::State state) override;
   void cancel() override;
   void suspend() override;
   void resume() override;
-  void setMaxDuration(double duration) override;
-  void setSharingWeight(double priority) override;
-  double getRemains() override;
+  void set_max_duration(double duration) override;
+  void set_priority(double priority) override;
+  double get_remains() override;
 
   CpuTi *cpu_;
 
@@ -117,6 +117,11 @@ public:
 
   bool isUsed() override;
   CpuAction *execution_start(double size) override;
+  simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override
+  {
+    THROW_UNIMPLEMENTED;
+    return nullptr;
+  }
   CpuAction *sleep(double duration) override;
   double getAvailableSpeed() override;
 
@@ -143,10 +148,10 @@ public:
   CpuTiModel() = default;
   ~CpuTiModel() override;
   Cpu *createCpu(simgrid::s4u::Host *host,  std::vector<double>* speedPerPstate, int core) override;
-  double nextOccuringEvent(double now) override;
-  void updateActionsState(double now, double delta) override;
+  double next_occuring_event(double now) override;
+  void update_actions_state(double now, double delta) override;
 
-  kernel::resource::ActionList runningActionSetThatDoesNotNeedBeingChecked_;
+  kernel::resource::Action::StateSet runningActionSetThatDoesNotNeedBeingChecked_;
   CpuTiList modifiedCpu_;
 };
 
index e11489f..3cbf508 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015. The SimGrid Team.
+/* Copyright (c) 2013-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -11,7 +11,7 @@
 #include "host_clm03.hpp"
 
 #include "cpu_cas01.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
 
@@ -45,12 +45,14 @@ void surf_host_model_init_compound()
 namespace simgrid {
 namespace surf {
 
-double HostCLM03Model::nextOccuringEvent(double now){
+double HostCLM03Model::next_occuring_event(double now)
+{
   ignoreEmptyVmInPmLMM();
 
-  double min_by_cpu = surf_cpu_model_pm->nextOccuringEvent(now);
-  double min_by_net = surf_network_model->nextOccuringEventIsIdempotent() ? surf_network_model->nextOccuringEvent(now) : -1;
-  double min_by_sto = surf_storage_model->nextOccuringEvent(now);
+  double min_by_cpu = surf_cpu_model_pm->next_occuring_event(now);
+  double min_by_net =
+      surf_network_model->nextOccuringEventIsIdempotent() ? surf_network_model->next_occuring_event(now) : -1;
+  double min_by_sto = surf_storage_model->next_occuring_event(now);
 
   XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
       this, typeid(surf_cpu_model_pm).name(), min_by_cpu,
@@ -67,7 +69,8 @@ double HostCLM03Model::nextOccuringEvent(double now){
   return res;
 }
 
-void HostCLM03Model::updateActionsState(double /*now*/, double /*delta*/){
+void HostCLM03Model::update_actions_state(double /*now*/, double /*delta*/)
+{
   /* I won't do what you tell me */
 }
 
index b9da9f5..cec2349 100644 (file)
@@ -29,8 +29,8 @@ class XBT_PRIVATE HostCLM03Model;
 
 class HostCLM03Model : public HostModel {
 public:
-  double nextOccuringEvent(double now) override;
-  void updateActionsState(double now, double delta) override;
+  double next_occuring_event(double now) override;
+  void update_actions_state(double now, double delta) override;
 };
 }
 }
index 05c22a1..fcb53ce 100644 (file)
@@ -5,10 +5,10 @@
 
 #include "src/instr/instr_private.hpp"
 
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/NetZoneImpl.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf_private.hpp"
 #include "surf/surf.hpp"
@@ -223,18 +223,18 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     container->type_->getOrCreateContainerType("MPI")->getOrCreateStateType("MPI_STATE");
 
   if (TRACE_actor_is_enabled()) {
-    simgrid::instr::ContainerType* msg_process = container->type_->getOrCreateContainerType("MSG_PROCESS");
-    simgrid::instr::StateType* state           = msg_process->getOrCreateStateType("MSG_PROCESS_STATE");
+    simgrid::instr::ContainerType* actor = container->type_->getOrCreateContainerType("ACTOR");
+    simgrid::instr::StateType* state     = actor->getOrCreateStateType("ACTOR_STATE");
     state->addEntityValue("suspend", "1 0 1");
     state->addEntityValue("sleep", "1 1 0");
     state->addEntityValue("receive", "1 0 0");
     state->addEntityValue("send", "0 0 1");
     state->addEntityValue("task_execute", "0 1 1");
-    root->type_->getOrCreateLinkType("MSG_PROCESS_LINK", msg_process, msg_process);
-    root->type_->getOrCreateLinkType("MSG_PROCESS_TASK_LINK", msg_process, msg_process);
+    root->type_->getOrCreateLinkType("ACTOR_LINK", actor, actor);
+    root->type_->getOrCreateLinkType("ACTOR_TASK_LINK", actor, actor);
   }
 
-  if (TRACE_msg_vm_is_enabled()) {
+  if (TRACE_vm_is_enabled()) {
     simgrid::instr::ContainerType* msg_vm = container->type_->getOrCreateContainerType("MSG_VM");
     simgrid::instr::StateType* state      = msg_vm->getOrCreateStateType("MSG_VM_STATE");
     state->addEntityValue("suspend", "1 0 1");
@@ -243,7 +243,7 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
     state->addEntityValue("send", "0 0 1");
     state->addEntityValue("task_execute", "0 1 1");
     root->type_->getOrCreateLinkType("MSG_VM_LINK", msg_vm, msg_vm);
-    root->type_->getOrCreateLinkType("MSG_VM_PROCESS_LINK", msg_vm, msg_vm);
+    root->type_->getOrCreateLinkType("MSG_VM_ACTOR_LINK", msg_vm, msg_vm);
   }
 }
 
index 68051c7..f300d63 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "network_cm02.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 #include "src/kernel/lmm/maxmin.hpp"
 
@@ -87,14 +87,14 @@ void surf_network_model_init_Reno()
   if (surf_network_model)
     return;
 
-  set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fp,
-                                simgrid::kernel::lmm::func_reno_fpi);
+  using namespace simgrid::kernel;
+  lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
   xbt_cfg_setdefault_double("network/latency-factor", 13.01);
   xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
   xbt_cfg_setdefault_double("network/weight-S", 20537);
 
-  surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::lagrange_solve);
+  surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
   all_existing_models->push_back(surf_network_model);
 }
 
@@ -104,14 +104,14 @@ void surf_network_model_init_Reno2()
   if (surf_network_model)
     return;
 
-  set_default_protocol_function(simgrid::kernel::lmm::func_reno2_f, simgrid::kernel::lmm::func_reno2_fp,
-                                simgrid::kernel::lmm::func_reno2_fpi);
+  using namespace simgrid::kernel;
+  lmm::Lagrange::set_default_protocol_function(lmm::func_reno2_f, lmm::func_reno2_fp, lmm::func_reno2_fpi);
 
   xbt_cfg_setdefault_double("network/latency-factor", 13.01);
   xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
   xbt_cfg_setdefault_double("network/weight-S", 20537);
 
-  surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::lagrange_solve);
+  surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
   all_existing_models->push_back(surf_network_model);
 }
 
@@ -120,100 +120,89 @@ void surf_network_model_init_Vegas()
   if (surf_network_model)
     return;
 
-  set_default_protocol_function(simgrid::kernel::lmm::func_vegas_f, simgrid::kernel::lmm::func_vegas_fp,
-                                simgrid::kernel::lmm::func_vegas_fpi);
+  using namespace simgrid::kernel;
+  lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
 
   xbt_cfg_setdefault_double("network/latency-factor", 13.01);
   xbt_cfg_setdefault_double("network/bandwidth-factor", 0.97);
   xbt_cfg_setdefault_double("network/weight-S", 20537);
 
-  surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::lagrange_solve);
+  surf_network_model = new simgrid::surf::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
   all_existing_models->push_back(surf_network_model);
 }
 
 namespace simgrid {
 namespace surf {
 
-NetworkCm02Model::NetworkCm02Model()
-  :NetworkModel()
+NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool)) : NetworkModel()
 {
   std::string optim = xbt_cfg_get_string("network/optim");
   bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
 
   if (optim == "Full") {
-    setUpdateMechanism(UM_FULL);
-    selectiveUpdate_ = select;
+    setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Full);
   } else if (optim == "Lazy") {
-    setUpdateMechanism(UM_LAZY);
-    selectiveUpdate_ = true;
-    xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
-               "You cannot disable selective update when using the lazy update mechanism");
+    xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"),
+               "You cannot disable network selective update when using the lazy update mechanism");
+    select = true;
+    setUpdateMechanism(kernel::resource::Model::UpdateAlgo::Lazy);
   } else {
     xbt_die("Unsupported optimization (%s) for this model. Accepted: Full, Lazy.", optim.c_str());
   }
 
-  maxminSystem_ = new simgrid::kernel::lmm::System(selectiveUpdate_);
+  set_maxmin_system(make_new_lmm_system(select));
   loopback_     = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
 
-  if (getUpdateMechanism() == UM_LAZY) {
-    modifiedSet_              = new kernel::resource::ActionLmmList();
-    maxminSystem_->keep_track = modifiedSet_;
-  }
-}
-
-NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self)) : NetworkCm02Model()
-{
-  maxminSystem_->solve_fun = specificSolveFun;
+  if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy)
+    get_maxmin_system()->modified_set_ = new kernel::resource::Action::ModifiedSet();
 }
 
 LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
                                        e_surf_link_sharing_policy_t policy)
 {
-  return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
+  return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system());
 }
 
-void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
+void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
 {
   while (not actionHeapIsEmpty() && double_equals(actionHeapTopDate(), now, sg_surf_precision)) {
 
     NetworkCm02Action* action = static_cast<NetworkCm02Action*>(actionHeapPop());
     XBT_DEBUG("Something happened to action %p", action);
     if (TRACE_is_enabled()) {
-      int n = action->getVariable()->get_number_of_constraint();
+      int n = action->get_variable()->get_number_of_constraint();
 
       for (int i = 0; i < n; i++){
-        kernel::lmm::Constraint* constraint = action->getVariable()->get_constraint(i);
+        kernel::lmm::Constraint* constraint = action->get_variable()->get_constraint(i);
         NetworkCm02Link* link       = static_cast<NetworkCm02Link*>(constraint->get_id());
-        double value = action->getVariable()->get_value() * action->getVariable()->get_constraint_weight(i);
-        TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), value, action->getLastUpdate(),
-                                        now - action->getLastUpdate());
+        double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i);
+        TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), value, action->get_last_update(),
+                                        now - action->get_last_update());
       }
     }
 
     // if I am wearing a latency hat
-    if (action->getType() == kernel::resource::Action::Type::LATENCY) {
+    if (action->get_type() == kernel::resource::Action::Type::LATENCY) {
       XBT_DEBUG("Latency paid for action %p. Activating", action);
-      maxminSystem_->update_variable_weight(action->getVariable(), action->weight_);
-      action->heapRemove(getActionHeap());
-      action->refreshLastUpdate();
+      get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
+      action->heapRemove();
+      action->set_last_update();
 
-        // if I am wearing a max_duration or normal hat
-    } else if (action->getType() == kernel::resource::Action::Type::MAX_DURATION ||
-               action->getType() == kernel::resource::Action::Type::NORMAL) {
+      // if I am wearing a max_duration or normal hat
+    } else if (action->get_type() == kernel::resource::Action::Type::MAX_DURATION ||
+               action->get_type() == kernel::resource::Action::Type::NORMAL) {
       // no need to communicate anymore
       // assume that flows that reached max_duration have remaining of 0
       XBT_DEBUG("Action %p finished", action);
-      action->setRemains(0);
       action->finish(kernel::resource::Action::State::done);
-      action->heapRemove(getActionHeap());
+      action->heapRemove();
     }
   }
 }
 
-
-void NetworkCm02Model::updateActionsStateFull(double now, double delta)
+void NetworkCm02Model::update_actions_state_full(double now, double delta)
 {
-  for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
     NetworkCm02Action& action = static_cast<NetworkCm02Action&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     XBT_DEBUG("Something happened to action %p", &action);
@@ -226,33 +215,33 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
         double_update(&deltap, action.latency_, sg_surf_precision);
         action.latency_ = 0.0;
       }
-      if (action.latency_ <= 0.0 && not action.isSuspended())
-        maxminSystem_->update_variable_weight(action.getVariable(), action.weight_);
+      if (action.latency_ <= 0.0 && not action.is_suspended())
+        get_maxmin_system()->update_variable_weight(action.get_variable(), action.weight_);
     }
     if (TRACE_is_enabled()) {
-      int n = action.getVariable()->get_number_of_constraint();
+      int n = action.get_variable()->get_number_of_constraint();
       for (int i = 0; i < n; i++) {
-        kernel::lmm::Constraint* constraint = action.getVariable()->get_constraint(i);
+        kernel::lmm::Constraint* constraint = action.get_variable()->get_constraint(i);
         NetworkCm02Link* link = static_cast<NetworkCm02Link*>(constraint->get_id());
         TRACE_surf_link_set_utilization(
-            link->getCname(), action.getCategory(),
-            (action.getVariable()->get_value() * action.getVariable()->get_constraint_weight(i)),
-            action.getLastUpdate(), now - action.getLastUpdate());
+            link->getCname(), action.get_category(),
+            (action.get_variable()->get_value() * action.get_variable()->get_constraint_weight(i)),
+            action.get_last_update(), now - action.get_last_update());
       }
     }
-    if (not action.getVariable()->get_number_of_constraint()) {
+    if (not action.get_variable()->get_number_of_constraint()) {
       /* There is actually no link used, hence an infinite bandwidth. This happens often when using models like
        * vivaldi. In such case, just make sure that the action completes immediately.
        */
-      action.updateRemains(action.getRemains());
+      action.update_remains(action.get_remains());
     }
-    action.updateRemains(action.getVariable()->get_value() * delta);
+    action.update_remains(action.get_variable()->get_value() * delta);
 
-    if (action.getMaxDuration() > NO_MAX_DURATION)
-      action.updateMaxDuration(delta);
+    if (action.get_max_duration() > NO_MAX_DURATION)
+      action.update_max_duration(delta);
 
-    if (((action.getRemains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
-        ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
+    if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
+        ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
       action.finish(kernel::resource::Action::State::done);
     }
   }
@@ -287,8 +276,8 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
   action->weight_ = latency;
   action->latency_ = latency;
   action->rate_ = rate;
-  if (getUpdateMechanism() == UM_LAZY) {
-    action->refreshLastUpdate();
+  if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) {
+    action->set_last_update();
   }
 
   double bandwidth_bound = -1.0;
@@ -309,34 +298,34 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
   constraints_per_variable += back_route.size();
 
   if (action->latency_ > 0) {
-    action->setVariable(maxminSystem_->variable_new(action, 0.0, -1.0, constraints_per_variable));
-    if (getUpdateMechanism() == UM_LAZY) {
+    action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable));
+    if (getUpdateMechanism() == kernel::resource::Model::UpdateAlgo::Lazy) {
       // add to the heap the event when the latency is payed
-      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate());
-      action->heapInsert(getActionHeap(), action->latency_ + action->getLastUpdate(),
-                         route.empty() ? kernel::resource::Action::Type::NORMAL
-                                       : kernel::resource::Action::Type::LATENCY);
+      XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->get_last_update());
+      action->heapInsert(action->latency_ + action->get_last_update(), route.empty()
+                                                                           ? kernel::resource::Action::Type::NORMAL
+                                                                           : kernel::resource::Action::Type::LATENCY);
     }
   } else
-    action->setVariable(maxminSystem_->variable_new(action, 1.0, -1.0, constraints_per_variable));
+    action->set_variable(get_maxmin_system()->variable_new(action, 1.0, -1.0, constraints_per_variable));
 
   if (action->rate_ < 0) {
-    maxminSystem_->update_variable_bound(action->getVariable(),
-                                         (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
+    get_maxmin_system()->update_variable_bound(
+        action->get_variable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
   } else {
-    maxminSystem_->update_variable_bound(action->getVariable(),
-                                         (action->latCurrent_ > 0)
-                                             ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
-                                             : action->rate_);
+    get_maxmin_system()->update_variable_bound(action->get_variable(),
+                                               (action->latCurrent_ > 0)
+                                                   ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
+                                                   : action->rate_);
   }
 
   for (auto const& link : route)
-    maxminSystem_->expand(link->constraint(), action->getVariable(), 1.0);
+    get_maxmin_system()->expand(link->constraint(), action->get_variable(), 1.0);
 
   if (not back_route.empty()) { //  sg_network_crosstraffic was activated
     XBT_DEBUG("Crosstraffic active adding backward flow using 5%%");
     for (auto const& link : back_route)
-      maxminSystem_->expand(link->constraint(), action->getVariable(), .05);
+      get_maxmin_system()->expand(link->constraint(), action->get_variable(), .05);
 
     // Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
     // (You would also have to change simgrid::kernel::lmm::Element::get_concurrency())
@@ -352,7 +341,7 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos
  * Resource *
  ************/
 NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
-                                 e_surf_link_sharing_policy_t policy, lmm_system_t system)
+                                 e_surf_link_sharing_policy_t policy, kernel::lmm::System* system)
     : LinkImpl(model, name, system->constraint_new(this, sg_bandwidth_factor * bandwidth))
 {
   bandwidth_.scale = 1.0;
@@ -390,10 +379,10 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
       while ((var = constraint()->get_variable(&elem))) {
         kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
-        if (action->getState() == kernel::resource::Action::State::running ||
-            action->getState() == kernel::resource::Action::State::ready) {
-          action->setFinishTime(now);
-          action->setState(kernel::resource::Action::State::failed);
+        if (action->get_state() == kernel::resource::Action::State::running ||
+            action->get_state() == kernel::resource::Action::State::ready) {
+          action->set_finish_time(now);
+          action->set_state(kernel::resource::Action::State::failed);
         }
       }
     }
@@ -409,8 +398,8 @@ void NetworkCm02Link::setBandwidth(double value)
 {
   bandwidth_.peak = value;
 
-  model()->getMaxminSystem()->update_constraint_bound(constraint(),
-                                                      sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
+  model()->get_maxmin_system()->update_constraint_bound(constraint(),
+                                                        sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
   TRACE_surf_link_set_bandwidth(surf_get_clock(), getCname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
 
   if (sg_weight_S_parameter > 0) {
@@ -423,8 +412,8 @@ void NetworkCm02Link::setBandwidth(double value)
     while ((var = constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
       NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
       action->weight_ += delta;
-      if (not action->isSuspended())
-        model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
+      if (not action->is_suspended())
+        model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
     }
   }
 }
@@ -444,11 +433,11 @@ void NetworkCm02Link::setLatency(double value)
     action->latCurrent_ += delta;
     action->weight_ += delta;
     if (action->rate_ < 0)
-      model()->getMaxminSystem()->update_variable_bound(action->getVariable(),
-                                                        sg_tcp_gamma / (2.0 * action->latCurrent_));
+      model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
+                                                          sg_tcp_gamma / (2.0 * action->latCurrent_));
     else {
-      model()->getMaxminSystem()->update_variable_bound(
-          action->getVariable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
+      model()->get_maxmin_system()->update_variable_bound(
+          action->get_variable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
 
       if (action->rate_ < sg_tcp_gamma / (2.0 * action->latCurrent_)) {
         XBT_INFO("Flow is limited BYBANDWIDTH");
@@ -456,8 +445,8 @@ void NetworkCm02Link::setLatency(double value)
         XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
       }
     }
-    if (not action->isSuspended())
-      model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_);
+    if (not action->is_suspended())
+      model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
   }
 }
 
@@ -465,34 +454,35 @@ void NetworkCm02Link::setLatency(double value)
  * Action *
  **********/
 
-void NetworkCm02Action::updateRemainingLazy(double now)
+void NetworkCm02Action::update_remains_lazy(double now)
 {
   if (suspended_ != Action::SuspendStates::not_suspended)
     return;
 
-  double delta        = now - getLastUpdate();
-  double max_duration = getMaxDuration();
+  double delta        = now - get_last_update();
+  double max_duration = get_max_duration();
 
-  if (getRemainsNoUpdate() > 0) {
-    XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, getRemainsNoUpdate(), getLastUpdate());
-    updateRemains(getLastValue() * delta);
+  if (get_remains_no_update() > 0) {
+    XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(),
+              get_last_update());
+    update_remains(get_last_value() * delta);
 
-    XBT_DEBUG("Updating action(%p): remains is now %f", this, getRemainsNoUpdate());
+    XBT_DEBUG("Updating action(%p): remains is now %f", this, get_remains_no_update());
   }
 
   if (max_duration > NO_MAX_DURATION) {
     double_update(&max_duration, delta, sg_surf_precision);
-    setMaxDuration(max_duration);
+    set_max_duration(max_duration);
   }
 
-  if ((getRemainsNoUpdate() <= 0 && (getVariable()->get_weight() > 0)) ||
+  if ((get_remains_no_update() <= 0 && (get_variable()->get_weight() > 0)) ||
       ((max_duration > NO_MAX_DURATION) && (max_duration <= 0))) {
     finish(Action::State::done);
-    heapRemove(getModel()->getActionHeap());
+    heapRemove();
   }
 
-  refreshLastUpdate();
-  setLastValue(getVariable()->get_value());
+  set_last_update();
+  set_last_value(get_variable()->get_value());
 }
 
 }
index 07486aa..689ba92 100644 (file)
@@ -35,13 +35,12 @@ namespace surf {
 
 class NetworkCm02Model : public NetworkModel {
 public:
-  NetworkCm02Model();
-  explicit NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
+  explicit NetworkCm02Model(kernel::lmm::System* (*make_new_sys)(bool) = &simgrid::kernel::lmm::make_new_maxmin_system);
   virtual ~NetworkCm02Model() = default;
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
-  void updateActionsStateLazy(double now, double delta) override;
-  void updateActionsStateFull(double now, double delta) override;
+  void update_actions_state_lazy(double now, double delta) override;
+  void update_actions_state_full(double now, double delta) override;
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
 };
 
@@ -52,7 +51,7 @@ public:
 class NetworkCm02Link : public LinkImpl {
 public:
   NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
-                  e_surf_link_sharing_policy_t policy, lmm_system_t system);
+                  e_surf_link_sharing_policy_t policy, kernel::lmm::System* system);
   virtual ~NetworkCm02Link() = default;
   void apply_event(tmgr_trace_event_t event, double value) override;
   void setBandwidth(double value) override;
@@ -69,7 +68,7 @@ class NetworkCm02Action : public NetworkAction {
 public:
   NetworkCm02Action(kernel::resource::Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
   virtual ~NetworkCm02Action() = default;
-  void updateRemainingLazy(double now) override;
+  void update_remains_lazy(double now) override;
 };
 }
 }
index a2d9074..7dd7d45 100644 (file)
@@ -29,10 +29,10 @@ LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, d
   return nullptr;
 }
 
-double NetworkConstantModel::nextOccuringEvent(double /*now*/)
+double NetworkConstantModel::next_occuring_event(double /*now*/)
 {
   double min = -1.0;
-  for (kernel::resource::Action const& action : *getRunningActionSet()) {
+  for (kernel::resource::Action const& action : *get_running_action_set()) {
     const NetworkConstantAction& net_action = static_cast<const NetworkConstantAction&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
       min = net_action.latency_;
@@ -40,9 +40,9 @@ double NetworkConstantModel::nextOccuringEvent(double /*now*/)
   return min;
 }
 
-void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
+void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
 {
-  for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
     NetworkConstantAction& action = static_cast<NetworkConstantAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     if (action.latency_ > 0) {
@@ -52,12 +52,12 @@ void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
         action.latency_ = 0.0;
       }
     }
-    action.updateRemains(action.getCost() * delta / action.initialLatency_);
-    if (action.getMaxDuration() != NO_MAX_DURATION)
-      action.updateMaxDuration(delta);
+    action.update_remains(action.get_cost() * delta / action.initialLatency_);
+    if (action.get_max_duration() != NO_MAX_DURATION)
+      action.update_max_duration(delta);
 
-    if ((action.getRemainsNoUpdate() <= 0) ||
-        ((action.getMaxDuration() != NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
+    if ((action.get_remains_no_update() <= 0) ||
+        ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
       action.finish(kernel::resource::Action::State::done);
     }
   }
@@ -78,12 +78,15 @@ NetworkConstantAction::NetworkConstantAction(NetworkConstantModel* model_, doubl
     : NetworkAction(model_, size, false), initialLatency_(latency)
 {
   latency_ = latency;
-  if (latency_ <= 0.0) {
-    stateSet_ = model_->getDoneActionSet();
-    stateSet_->push_back(*this);
-  }
+  if (latency_ <= 0.0)
+    NetworkConstantAction::set_state(Action::State::done);
 };
 
 NetworkConstantAction::~NetworkConstantAction() = default;
+
+void NetworkConstantAction::update_remains_lazy(double /*now*/)
+{
+  THROW_IMPOSSIBLE;
+}
 }
 }
index f12715b..23c37ac 100644 (file)
@@ -27,8 +27,8 @@ namespace simgrid {
     public:
       kernel::resource::Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size,
                                             double rate) override;
-      double nextOccuringEvent(double now) override;
-      void updateActionsState(double now, double delta) override;
+      double next_occuring_event(double now) override;
+      void update_actions_state(double now, double delta) override;
 
       LinkImpl* createLink(const std::string& name, double bw, double lat,
                            e_surf_link_sharing_policy_t policy) override;
@@ -42,6 +42,7 @@ namespace simgrid {
       NetworkConstantAction(NetworkConstantModel *model_, double size, double latency);
       ~NetworkConstantAction();
       double initialLatency_;
+      void update_remains_lazy(double now) override;
     };
 
   }
index edc4323..7d2ecbf 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017. The SimGrid Team.
+/* Copyright (c) 2014-2018. The SimGrid Team.
 *All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -6,7 +6,7 @@
 
 #include <utility>
 
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/network_ib.hpp"
@@ -34,7 +34,7 @@ static void IB_action_state_changed_callback(simgrid::surf::NetworkAction* actio
   using simgrid::surf::NetworkIBModel;
   using simgrid::surf::IBNode;
 
-  if (action->getState() != simgrid::kernel::resource::Action::State::done)
+  if (action->get_state() != simgrid::kernel::resource::Action::State::done)
     return;
   std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
   XBT_DEBUG("IB callback - action %p finished", action);
@@ -164,7 +164,7 @@ void NetworkIBModel::computeIBfactors(IBNode* root)
 
     double penalty = std::max(my_penalty_in, max_penalty_out);
 
-    double rate_before_update = (*it)->action->getBound();
+    double rate_before_update = (*it)->action->get_bound();
     // save initial rate of the action
     if ((*it)->init_rate == -1)
       (*it)->init_rate = rate_before_update;
@@ -173,8 +173,8 @@ void NetworkIBModel::computeIBfactors(IBNode* root)
 
     if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
       XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,
-                (*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->getBound(), (*it)->init_rate);
-      maxminSystem_->update_variable_bound((*it)->action->getVariable(), penalized_bw);
+                (*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->get_bound(), (*it)->init_rate);
+      get_maxmin_system()->update_variable_bound((*it)->action->get_variable(), penalized_bw);
     } else {
       XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, (*it)->destination->id,
                 (*it)->action, penalized_bw, (*it)->init_rate);
index 0549d1d..950e535 100644 (file)
@@ -6,7 +6,7 @@
 #include <algorithm>
 
 #include "network_interface.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 
 #ifndef NETWORK_INTERFACE_CPP_
 #define NETWORK_INTERFACE_CPP_
@@ -80,11 +80,11 @@ namespace simgrid {
       return rate;
     }
 
-    double NetworkModel::nextOccuringEventFull(double now)
+    double NetworkModel::next_occuring_event_full(double now)
     {
-      double minRes = Model::nextOccuringEventFull(now);
+      double minRes = Model::next_occuring_event_full(now);
 
-      for (kernel::resource::Action const& action : *getRunningActionSet()) {
+      for (kernel::resource::Action const& action : *get_running_action_set()) {
         const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
         if (net_action.latency_ > 0)
           minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_);
@@ -133,7 +133,7 @@ namespace simgrid {
 
     bool LinkImpl::isUsed()
     {
-      return model()->getMaxminSystem()->constraint_used(constraint());
+      return model()->get_maxmin_system()->constraint_used(constraint());
     }
 
     double LinkImpl::latency()
@@ -186,9 +186,9 @@ namespace simgrid {
      * Action *
      **********/
 
-    void NetworkAction::setState(Action::State state)
+    void NetworkAction::set_state(Action::State state)
     {
-      Action::setState(state);
+      Action::set_state(state);
       s4u::Link::onCommunicationStateChange(this);
     }
 
@@ -196,13 +196,13 @@ namespace simgrid {
     std::list<LinkImpl*> NetworkAction::links()
     {
       std::list<LinkImpl*> retlist;
-      int llen = getVariable()->get_number_of_constraint();
+      int llen = get_variable()->get_number_of_constraint();
 
       for (int i = 0; i < llen; i++) {
         /* Beware of composite actions: ptasks put links and cpus together */
         // extra pb: we cannot dynamic_cast from void*...
         kernel::resource::Resource* resource =
-            static_cast<kernel::resource::Resource*>(getVariable()->get_constraint(i)->get_id());
+            static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
         LinkImpl* link     = dynamic_cast<LinkImpl*>(resource);
         if (link != nullptr)
           retlist.push_back(link);
index 8863627..2565a14 100644 (file)
@@ -6,13 +6,14 @@
 #ifndef SURF_NETWORK_INTERFACE_HPP_
 #define SURF_NETWORK_INTERFACE_HPP_
 
+#include "simgrid/kernel/resource/Model.hpp"
+#include "simgrid/kernel/resource/Resource.hpp"
 #include "simgrid/s4u/Link.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/resource/Model.hpp"
-#include "src/kernel/resource/Resource.hpp"
 #include "src/surf/PropertyHolder.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "xbt/base.h"
+
 #include <list>
 #include <unordered_map>
 
@@ -63,12 +64,6 @@ public:
    */
   virtual kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0;
 
-  /** @brief Function pointer to the function to use to solve the lmm_system_t
-   *
-   * @param system The lmm_system_t to solve
-   */
-  void (*f_networkSolve)(lmm_system_t) = simgrid::kernel::lmm::lmm_solve;
-
   /**
    * @brief Get the right multiplicative factor for the latency.
    * @details Depending on the model, the effective latency when sending
@@ -103,7 +98,7 @@ public:
    * @return The new bandwidth.
    */
   virtual double bandwidthConstraint(double rate, double bound, double size);
-  double nextOccuringEventFull(double now) override;
+  double next_occuring_event_full(double now) override;
 
   LinkImpl* loopback_ = nullptr;
 };
@@ -212,7 +207,7 @@ public:
   NetworkAction(simgrid::kernel::resource::Model* model, double cost, bool failed, kernel::lmm::Variable* var)
       : simgrid::kernel::resource::Action(model, cost, failed, var){};
 
-  void setState(simgrid::kernel::resource::Action::State state) override;
+  void set_state(simgrid::kernel::resource::Action::State state) override;
   virtual std::list<LinkImpl*> links();
 
   double latency_    = {};
index 05f1e9c..f1ddedf 100644 (file)
 #include "network_ns3.hpp"
 #include "ns3/ns3_simulator.hpp"
 
-#include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
-#include "src/kernel/routing/NetPoint.hpp"
-
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/plugins/energy.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/NetZone.hpp"
+#include "src/surf/xml/platf_private.hpp"
+#include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network NS3 module");
 
@@ -62,7 +62,7 @@ NetPointNs3::NetPointNs3()
  * Callbacks *
  *************/
 
-static void clusterCreation_cb(ClusterCreationArgs* cluster)
+static void clusterCreation_cb(simgrid::kernel::routing::ClusterCreationArgs* cluster)
 {
   for (int const& i : *cluster->radicals) {
     // Routers don't create a router on the other end of the private link by themselves.
@@ -180,13 +180,13 @@ kernel::resource::Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host
   return new NetworkNS3Action(this, size, src, dst);
 }
 
-double NetworkNS3Model::nextOccuringEvent(double now)
+double NetworkNS3Model::next_occuring_event(double now)
 {
   double time_to_next_flow_completion;
   XBT_DEBUG("ns3_next_occuring_event");
 
   //get the first relevant value from the running_actions list
-  if (not getRunningActionSet()->size() || now == 0.0)
+  if (not get_running_action_set()->size() || now == 0.0)
     return -1.0;
   else
     do {
@@ -202,12 +202,12 @@ double NetworkNS3Model::nextOccuringEvent(double now)
   return time_to_next_flow_completion;
 }
 
-void NetworkNS3Model::updateActionsState(double now, double delta)
+void NetworkNS3Model::update_actions_state(double now, double delta)
 {
   static std::vector<std::string> socket_to_destroy;
 
   /* If there are no running flows, advance the NS3 simulator and return */
-  if (getRunningActionSet()->empty()) {
+  if (get_running_action_set()->empty()) {
 
     while(double_positive(now - ns3::Simulator::Now().GetSeconds(), sg_surf_precision))
       ns3_simulator(now-ns3::Simulator::Now().GetSeconds());
@@ -221,17 +221,17 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     SgFlow* sgFlow            = elm.second;
     NetworkNS3Action * action = sgFlow->action_;
     XBT_DEBUG("Processing socket %p (action %p)",sgFlow,action);
-    action->setRemains(action->getCost() - sgFlow->sentBytes_);
+    action->set_remains(action->get_cost() - sgFlow->sentBytes_);
 
-    if (TRACE_is_enabled() && action->getState() == kernel::resource::Action::State::running) {
+    if (TRACE_is_enabled() && action->get_state() == kernel::resource::Action::State::running) {
       double data_delta_sent = sgFlow->sentBytes_ - action->lastSent_;
 
       std::vector<LinkImpl*> route = std::vector<LinkImpl*>();
 
       action->src_->routeTo(action->dst_, route, nullptr);
       for (auto const& link : route)
-        TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), (data_delta_sent) / delta, now - delta,
-                                        delta);
+        TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), (data_delta_sent) / delta,
+                                        now - delta, delta);
 
       action->lastSent_ = sgFlow->sentBytes_;
     }
@@ -339,24 +339,9 @@ std::list<LinkImpl*> NetworkNS3Action::links()
 {
   THROW_UNIMPLEMENTED;
 }
-
-/* Test whether a flow is suspended */
-bool NetworkNS3Action::isSuspended()
-{
-  return false;
-}
-
-int NetworkNS3Action::unref()
+void NetworkNS3Action::update_remains_lazy(double /*now*/)
 {
-  refcount_--;
-  if (not refcount_) {
-    if (stateSetHook_.is_linked())
-      simgrid::xbt::intrusive_erase(*stateSet_, *this);
-    XBT_DEBUG ("Removing action %p", this);
-    delete this;
-    return 1;
-  }
-  return 0;
+  THROW_IMPOSSIBLE;
 }
 
 }
index 7ed353a..542558e 100644 (file)
@@ -20,9 +20,9 @@ public:
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
-  double nextOccuringEvent(double now) override;
+  double next_occuring_event(double now) override;
   bool nextOccuringEventIsIdempotent() override { return false; }
-  void updateActionsState(double now, double delta) override;
+  void update_actions_state(double now, double delta) override;
 };
 
 /************
@@ -47,11 +47,10 @@ class XBT_PRIVATE NetworkNS3Action : public NetworkAction {
 public:
   NetworkNS3Action(kernel::resource::Model* model, double cost, s4u::Host* src, s4u::Host* dst);
 
-  bool isSuspended() override;
-  int unref() override;
   void suspend() override;
   void resume() override;
   std::list<LinkImpl*> links() override;
+  void update_remains_lazy(double now) override;
 
   // private:
   double lastSent_ = 0;
index 47b0d16..c5b2210 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017. The SimGrid Team.
+/* Copyright (c) 2013-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -10,7 +10,7 @@
 #include <xbt/log.h>
 
 #include "network_smpi.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "smpi_utils.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
index 602f0b9..edb6fc7 100644 (file)
@@ -28,11 +28,11 @@ public:
   ns3::Ptr<ns3::Node> ns3Node_;
 };
 
-XBT_PUBLIC(void) ns3_initialize(std::string TcpProtocol);
+XBT_PUBLIC void ns3_initialize(std::string TcpProtocol);
 extern "C" {
-XBT_PUBLIC(void) ns3_simulator(double maxSeconds);
-XBT_PUBLIC(void) ns3_add_link(NetPointNs3* src, NetPointNs3* dst, double bw, double lat);
-XBT_PUBLIC(void) ns3_add_cluster(const char* id, double bw, double lat);
+XBT_PUBLIC void ns3_simulator(double maxSeconds);
+XBT_PUBLIC void ns3_add_link(NetPointNs3* src, NetPointNs3* dst, double bw, double lat);
+XBT_PUBLIC void ns3_add_cluster(const char* id, double bw, double lat);
 }
 
 class XBT_PRIVATE SgFlow {
index e5232cc..78ec09b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017, 2018. 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. */
@@ -102,8 +102,6 @@ static void onExecCompletion(simgrid::kernel::activity::ExecImplPtr exec)
   vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->untrack(exec);
 }
 
-SG_BEGIN_DECL()
-
 void sg_vm_dirty_page_tracking_init()
 {
   if (not simgrid::vm::VmDirtyPageTrackingExt::EXTENSION_ID.valid()) {
@@ -164,5 +162,3 @@ double sg_vm_get_max_downtime(sg_vm_t vm)
 {
   return vm->getImpl()->extension<simgrid::vm::VmDirtyPageTrackingExt>()->getMaxDowntime();
 }
-
-SG_END_DECL()
index fd3a238..1f11563 100644 (file)
@@ -12,7 +12,6 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
-#include <simgrid/msg.h>
 #include <simgrid/s4u/Engine.hpp>
 #include <string>
 #include <utility>
@@ -295,7 +294,6 @@ static void on_host_added(simgrid::s4u::Host& host)
 }
 
 /* **************************** Public interface *************************** */
-extern "C" {
 
 /** \ingroup SURF_plugin_load
  * \brief Initializes the HostDvfs plugin
@@ -316,4 +314,3 @@ void sg_host_dvfs_plugin_init()
   xbt_cfg_register_string(property_governor, "performance", nullptr,
                           "Which Governor should be used that adapts the CPU frequency?");
 }
-}
index 81b4c9b..2e16379 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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. */
@@ -451,7 +451,6 @@ static void onSimulationEnd()
 }
 
 /* **************************** Public interface *************************** */
-extern "C" {
 
 /** \ingroup plugin_energy
  * \brief Enable host energy plugin
@@ -500,7 +499,7 @@ void sg_host_energy_update_all()
 double sg_host_get_consumed_energy(sg_host_t host)
 {
   xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
   return host->extension<HostEnergy>()->getConsumedEnergy();
 }
 
@@ -510,7 +509,7 @@ double sg_host_get_consumed_energy(sg_host_t host)
 double sg_host_get_wattmin_at(sg_host_t host, int pstate)
 {
   xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
   return host->extension<HostEnergy>()->getWattMinAt(pstate);
 }
 /** @ingroup plugin_energy
@@ -519,7 +518,7 @@ double sg_host_get_wattmin_at(sg_host_t host, int pstate)
 double sg_host_get_wattmax_at(sg_host_t host, int pstate)
 {
   xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
   return host->extension<HostEnergy>()->getWattMaxAt(pstate);
 }
 
@@ -529,7 +528,6 @@ double sg_host_get_wattmax_at(sg_host_t host, int pstate)
 double sg_host_get_current_consumption(sg_host_t host)
 {
   xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
   return host->extension<HostEnergy>()->getCurrentWattsValue();
 }
-}
index f30692e..9fc9f07 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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. */
@@ -173,7 +173,6 @@ static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kerne
 }
 
 /* **************************** Public interface *************************** */
-extern "C" {
 
 /** \ingroup plugin_load
  * \brief Initializes the HostLoad plugin
@@ -250,4 +249,3 @@ void sg_host_load_reset(sg_host_t host)
 
   host->extension<HostLoad>()->reset();
 }
-}
index d4a9f37..966da21 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2017, 2018. 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. */
@@ -175,7 +175,7 @@ static void onSimulationEnd()
   XBT_INFO("Total energy over all links: %f", total_energy);
 }
 /* **************************** Public interface *************************** */
-SG_BEGIN_DECL()
+
 int sg_link_energy_is_inited()
 {
   return LinkEnergy::EXTENSION_ID.valid();
@@ -230,4 +230,3 @@ double sg_link_get_consumed_energy(sg_link_t link)
 {
   return link->extension<LinkEnergy>()->getConsumedEnergy();
 }
-SG_END_DECL()
index 3707a56..94a69e3 100644 (file)
@@ -34,10 +34,10 @@ namespace simgrid {
 namespace surf {
 
 HostL07Model::HostL07Model() : HostModel() {
-  maxminSystem_            = new simgrid::kernel::lmm::System(true /* lazy */);
-  maxminSystem_->solve_fun = &simgrid::kernel::lmm::bottleneck_solve;
-  surf_network_model = new NetworkL07Model(this,maxminSystem_);
-  surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
+  auto* maxmin_system = new simgrid::kernel::lmm::FairBottleneck(true /* selective update */);
+  set_maxmin_system(maxmin_system);
+  surf_network_model = new NetworkL07Model(this, maxmin_system);
+  surf_cpu_model_pm  = new CpuL07Model(this, maxmin_system);
 }
 
 HostL07Model::~HostL07Model()
@@ -46,35 +46,35 @@ HostL07Model::~HostL07Model()
   delete surf_cpu_model_pm;
 }
 
-CpuL07Model::CpuL07Model(HostL07Model* hmodel, lmm_system_t sys) : CpuModel(), hostModel_(hmodel)
+CpuL07Model::CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : CpuModel(), hostModel_(hmodel)
 {
-  maxminSystem_ = sys;
+  set_maxmin_system(sys);
 }
 
 CpuL07Model::~CpuL07Model()
 {
-  maxminSystem_ = nullptr;
+  set_maxmin_system(nullptr);
 }
 
-NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, lmm_system_t sys) : NetworkModel(), hostModel_(hmodel)
+NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : NetworkModel(), hostModel_(hmodel)
 {
-  maxminSystem_ = sys;
+  set_maxmin_system(sys);
   loopback_     = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
 }
 
 NetworkL07Model::~NetworkL07Model()
 {
-  maxminSystem_ = nullptr;
+  set_maxmin_system(nullptr);
 }
 
-double HostL07Model::nextOccuringEvent(double now)
+double HostL07Model::next_occuring_event(double now)
 {
-  double min = HostModel::nextOccuringEventFull(now);
-  for (kernel::resource::Action const& action : *getRunningActionSet()) {
+  double min = HostModel::next_occuring_event_full(now);
+  for (kernel::resource::Action const& action : *get_running_action_set()) {
     const L07Action& net_action = static_cast<const L07Action&>(action);
     if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min)) {
       min = net_action.latency_;
-      XBT_DEBUG("Updating min with %p (start %f): %f", &net_action, net_action.getStartTime(), min);
+      XBT_DEBUG("Updating min with %p (start %f): %f", &net_action, net_action.get_start_time(), min);
     }
   }
   XBT_DEBUG("min value: %f", min);
@@ -82,9 +82,9 @@ double HostL07Model::nextOccuringEvent(double now)
   return min;
 }
 
-void HostL07Model::updateActionsState(double /*now*/, double delta)
+void HostL07Model::update_actions_state(double /*now*/, double delta)
 {
-  for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
     L07Action& action = static_cast<L07Action&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
     if (action.latency_ > 0) {
@@ -93,19 +93,19 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
       } else {
         action.latency_ = 0.0;
       }
-      if ((action.latency_ <= 0.0) && (action.isSuspended() == 0)) {
+      if ((action.latency_ <= 0.0) && (action.is_suspended() == 0)) {
         action.updateBound();
-        maxminSystem_->update_variable_weight(action.getVariable(), 1.0);
+        get_maxmin_system()->update_variable_weight(action.get_variable(), 1.0);
       }
     }
-    XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.getRemains(),
-              action.getVariable()->get_value() * delta);
-    action.updateRemains(action.getVariable()->get_value() * delta);
+    XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.get_remains(),
+              action.get_variable()->get_value() * delta);
+    action.update_remains(action.get_variable()->get_value() * delta);
 
-    if (action.getMaxDuration() > NO_MAX_DURATION)
-      action.updateMaxDuration(delta);
+    if (action.get_max_duration() > NO_MAX_DURATION)
+      action.update_max_duration(delta);
 
-    XBT_DEBUG("Action (%p) : remains (%g).", &action, action.getRemains());
+    XBT_DEBUG("Action (%p) : remains (%g).", &action, action.get_remains());
 
     /* In the next if cascade, the action can be finished either because:
      *  - The amount of remaining work reached 0
@@ -113,13 +113,13 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
      * If it's not done, it may have failed.
      */
 
-    if (((action.getRemains() <= 0) && (action.getVariable()->get_weight() > 0)) ||
-        ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
+    if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
+        ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
       action.finish(kernel::resource::Action::State::done);
     } else {
       /* Need to check that none of the model has failed */
       int i = 0;
-      kernel::lmm::Constraint* cnst = action.getVariable()->get_constraint(i);
+      kernel::lmm::Constraint* cnst = action.get_variable()->get_constraint(i);
       while (cnst != nullptr) {
         i++;
         void* constraint_id = cnst->get_id();
@@ -128,7 +128,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
           action.finish(kernel::resource::Action::State::failed);
           break;
         }
-        cnst = action.getVariable()->get_constraint(i);
+        cnst = action.get_variable()->get_constraint(i);
       }
     }
   }
@@ -181,13 +181,13 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos
   XBT_DEBUG("Creating a parallel task (%p) with %d hosts and %d unique links.", this, host_nb, nb_link);
   latency_ = latency;
 
-  setVariable(model->getMaxminSystem()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link));
+  set_variable(model->get_maxmin_system()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link));
 
   if (latency_ > 0)
-    model->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
+    model->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
 
   for (int i = 0; i < host_nb; i++)
-    model->getMaxminSystem()->expand(host_list[i]->pimpl_cpu->constraint(), getVariable(), flops_amount[i]);
+    model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->constraint(), get_variable(), flops_amount[i]);
 
   if(bytes_amount != nullptr) {
     for (int i = 0; i < host_nb; i++) {
@@ -197,16 +197,16 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos
           hostList_->at(i)->routeTo(hostList_->at(j), route, nullptr);
 
           for (auto const& link : route)
-            model->getMaxminSystem()->expand_add(link->constraint(), this->getVariable(),
-                                                 bytes_amount[i * host_nb + j]);
+            model->get_maxmin_system()->expand_add(link->constraint(), this->get_variable(),
+                                                   bytes_amount[i * host_nb + j]);
         }
       }
     }
   }
 
   if (nb_link + nb_used_host == 0) {
-    this->setCost(1.0);
-    this->setRemains(0.0);
+    this->set_cost(1.0);
+    this->set_remains(0.0);
   }
   delete[] host_list;
 }
@@ -240,7 +240,7 @@ LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth,
  ************/
 
 CpuL07::CpuL07(CpuL07Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
-    : Cpu(model, host, model->getMaxminSystem()->constraint_new(this, speedPerPstate->front()), speedPerPstate, core)
+    : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, speedPerPstate->front()), speedPerPstate, core)
 {
 }
 
@@ -248,7 +248,7 @@ CpuL07::~CpuL07()=default;
 
 LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
                  e_surf_link_sharing_policy_t policy)
-    : LinkImpl(model, name, model->getMaxminSystem()->constraint_new(this, bandwidth))
+    : LinkImpl(model, name, model->get_maxmin_system()->constraint_new(this, bandwidth))
 {
   bandwidth_.peak = bandwidth;
   latency_.peak   = latency;
@@ -273,15 +273,15 @@ kernel::resource::Action* CpuL07::execution_start(double size)
 kernel::resource::Action* CpuL07::sleep(double duration)
 {
   L07Action *action = static_cast<L07Action*>(execution_start(1.0));
-  action->setMaxDuration(duration);
+  action->set_max_duration(duration);
   action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
-  model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0);
+  model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
 
   return action;
 }
 
 bool CpuL07::isUsed(){
-  return model()->getMaxminSystem()->constraint_used(constraint());
+  return model()->get_maxmin_system()->constraint_used(constraint());
 }
 
 /** @brief take into account changes of speed (either load or max) */
@@ -289,11 +289,11 @@ void CpuL07::onSpeedChange() {
   kernel::lmm::Variable* var = nullptr;
   const_lmm_element_t elem = nullptr;
 
-  model()->getMaxminSystem()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
+  model()->get_maxmin_system()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
   while ((var = constraint()->get_variable(&elem))) {
     kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
 
-    model()->getMaxminSystem()->update_variable_bound(action->getVariable(), speed_.scale * speed_.peak);
+    model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
   }
 
   Cpu::onSpeedChange();
@@ -301,7 +301,7 @@ void CpuL07::onSpeedChange() {
 
 
 bool LinkL07::isUsed(){
-  return model()->getMaxminSystem()->constraint_used(constraint());
+  return model()->get_maxmin_system()->constraint_used(constraint());
 }
 
 void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
@@ -350,7 +350,7 @@ void LinkL07::apply_event(tmgr_trace_event_t triggered, double value)
 void LinkL07::setBandwidth(double value)
 {
   bandwidth_.peak = value;
-  model()->getMaxminSystem()->update_constraint_bound(constraint(), bandwidth_.peak * bandwidth_.scale);
+  model()->get_maxmin_system()->update_constraint_bound(constraint(), bandwidth_.peak * bandwidth_.scale);
 }
 
 void LinkL07::setLatency(double value)
@@ -401,25 +401,11 @@ void L07Action::updateBound()
   XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
   if ((latency_ <= 0.0) && (suspended_ == Action::SuspendStates::not_suspended)) {
     if (rate_ < 0)
-      getModel()->getMaxminSystem()->update_variable_bound(getVariable(), lat_bound);
+      get_model()->get_maxmin_system()->update_variable_bound(get_variable(), lat_bound);
     else
-      getModel()->getMaxminSystem()->update_variable_bound(getVariable(), std::min(rate_, lat_bound));
+      get_model()->get_maxmin_system()->update_variable_bound(get_variable(), std::min(rate_, lat_bound));
   }
 }
 
-int L07Action::unref()
-{
-  refcount_--;
-  if (not refcount_) {
-    if (stateSetHook_.is_linked())
-      simgrid::xbt::intrusive_erase(*stateSet_, *this);
-    if (getVariable())
-      getModel()->getMaxminSystem()->variable_free(getVariable());
-    delete this;
-    return 1;
-  }
-  return 0;
-}
-
 }
 }
index aff7964..40f54e6 100644 (file)
@@ -38,15 +38,15 @@ public:
   HostL07Model();
   ~HostL07Model();
 
-  double nextOccuringEvent(double now) override;
-  void updateActionsState(double now, double delta) override;
+  double next_occuring_event(double now) override;
+  void update_actions_state(double now, double delta) override;
   kernel::resource::Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
                                                 double* bytes_amount, double rate) override;
 };
 
 class CpuL07Model : public CpuModel {
 public:
-  CpuL07Model(HostL07Model* hmodel, lmm_system_t sys);
+  CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   ~CpuL07Model();
 
   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
@@ -55,7 +55,7 @@ public:
 
 class NetworkL07Model : public NetworkModel {
 public:
-  NetworkL07Model(HostL07Model* hmodel, lmm_system_t sys);
+  NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   ~NetworkL07Model();
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
                        e_surf_link_sharing_policy_t policy) override;
@@ -76,6 +76,11 @@ public:
   bool isUsed() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
   kernel::resource::Action* execution_start(double size) override;
+  simgrid::kernel::resource::Action* execution_start(double size, int requestedCores) override
+  {
+    THROW_UNIMPLEMENTED;
+    return nullptr;
+  }
   kernel::resource::Action* sleep(double duration) override;
 
 protected:
@@ -108,8 +113,6 @@ public:
 
   void updateBound();
 
-  int unref() override;
-
   std::vector<s4u::Host*>* hostList_ = new std::vector<s4u::Host*>();
   double *computationAmount_;
   double *communicationAmount_;
index c542476..6718257 100644 (file)
@@ -3,30 +3,29 @@
 /* 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/kernel/routing/ClusterZone.hpp"
+#include "simgrid/kernel/routing/DijkstraZone.hpp"
+#include "simgrid/kernel/routing/DragonflyZone.hpp"
+#include "simgrid/kernel/routing/EmptyZone.hpp"
+#include "simgrid/kernel/routing/FatTreeZone.hpp"
+#include "simgrid/kernel/routing/FloydZone.hpp"
+#include "simgrid/kernel/routing/FullZone.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
+#include "simgrid/kernel/routing/TorusZone.hpp"
+#include "simgrid/kernel/routing/VivaldiZone.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Storage.hpp"
-
+#include "src/include/simgrid/sg_config.hpp"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/simix/smx_private.hpp"
-
-#include "src/include/simgrid/sg_config.h"
-
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp"
 
-#include "src/kernel/routing/ClusterZone.hpp"
-#include "src/kernel/routing/DijkstraZone.hpp"
-#include "src/kernel/routing/DragonflyZone.hpp"
-#include "src/kernel/routing/EmptyZone.hpp"
-#include "src/kernel/routing/FatTreeZone.hpp"
-#include "src/kernel/routing/FloydZone.hpp"
-#include "src/kernel/routing/FullZone.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
-#include "src/kernel/routing/NetZoneImpl.hpp"
-#include "src/kernel/routing/TorusZone.hpp"
-#include "src/kernel/routing/VivaldiZone.hpp"
 #include <string>
+
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
 
 XBT_PRIVATE std::map<std::string, simgrid::surf::StorageImpl*> mount_list;
@@ -35,7 +34,7 @@ XBT_PRIVATE std::vector<std::string> known_storages;
 namespace simgrid {
 namespace surf {
 
-simgrid::xbt::signal<void(ClusterCreationArgs*)> on_cluster;
+simgrid::xbt::signal<void(kernel::routing::ClusterCreationArgs*)> on_cluster;
 }
 }
 
@@ -65,7 +64,7 @@ void sg_platf_exit() {
 }
 
 /** @brief Add an host to the current AS */
-void sg_platf_new_host(sg_platf_host_cbarg_t args)
+void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
 {
   std::map<std::string, std::string> props;
   if (args->properties) {
@@ -112,7 +111,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const
   return netpoint;
 }
 
-void sg_platf_new_link(LinkCreationArgs* link)
+void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link)
 {
   std::vector<std::string> names;
 
@@ -141,7 +140,7 @@ void sg_platf_new_link(LinkCreationArgs* link)
   delete link->properties;
 }
 
-void sg_platf_new_cluster(ClusterCreationArgs* cluster)
+void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster)
 {
   using simgrid::kernel::routing::ClusterZone;
   using simgrid::kernel::routing::DragonflyZone;
@@ -151,16 +150,16 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   int rankId=0;
 
   // What an inventive way of initializing the AS that I have as ancestor :-(
-  ZoneCreationArgs zone;
+  simgrid::kernel::routing::ZoneCreationArgs zone;
   zone.id = cluster->id;
   switch (cluster->topology) {
-    case ClusterTopology::TORUS:
+    case simgrid::kernel::routing::ClusterTopology::TORUS:
       zone.routing = A_surfxml_AS_routing_ClusterTorus;
       break;
-    case ClusterTopology::DRAGONFLY:
+    case simgrid::kernel::routing::ClusterTopology::DRAGONFLY:
       zone.routing = A_surfxml_AS_routing_ClusterDragonfly;
       break;
-    case ClusterTopology::FAT_TREE:
+    case simgrid::kernel::routing::ClusterTopology::FAT_TREE:
       zone.routing = A_surfxml_AS_routing_ClusterFatTree;
       break;
     default:
@@ -172,13 +171,13 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   current_as->parse_specific_arguments(cluster);
 
   if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){
-    current_as->linkCountPerNode_++;
-    current_as->hasLoopback_ = true;
+    current_as->num_links_per_node_++;
+    current_as->has_loopback_ = true;
   }
 
   if(cluster->limiter_link > 0){
-    current_as->linkCountPerNode_++;
-    current_as->hasLimiter_ = true;
+    current_as->num_links_per_node_++;
+    current_as->has_limiter_ = true;
   }
 
   for (int const& i : *cluster->radicals) {
@@ -187,7 +186,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
 
     XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id.c_str(), cluster->speeds.front());
 
-    s_sg_platf_host_cbarg_t host;
+    simgrid::kernel::routing::HostCreationArgs host;
     host.id = host_id.c_str();
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
       host.properties = new std::map<std::string, std::string>;
@@ -218,7 +217,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       std::string tmp_link = link_id + "_loopback";
       XBT_DEBUG("<loopback\tid=\"%s\"\tbw=\"%f\"/>", tmp_link.c_str(), cluster->loopback_bw);
 
-      LinkCreationArgs link;
+      simgrid::kernel::routing::LinkCreationArgs link;
       link.id        = tmp_link;
       link.bandwidth = cluster->loopback_bw;
       link.latency   = cluster->loopback_lat;
@@ -228,7 +227,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
 
       auto* as_cluster = static_cast<ClusterZone*>(current_as);
-      as_cluster->privateLinks_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
+      as_cluster->private_links_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
     }
 
     //add a limiter link (shared link to account for maximal bandwidth of the node)
@@ -238,7 +237,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       std::string tmp_link = std::string(link_id) + "_limiter";
       XBT_DEBUG("<limiter\tid=\"%s\"\tbw=\"%f\"/>", tmp_link.c_str(), cluster->limiter_link);
 
-      LinkCreationArgs link;
+      simgrid::kernel::routing::LinkCreationArgs link;
       link.id        = tmp_link;
       link.bandwidth = cluster->limiter_link;
       link.latency = 0;
@@ -246,12 +245,12 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       sg_platf_new_link(&link);
       linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
       linkUp   = linkDown;
-      current_as->privateLinks_.insert({current_as->nodePositionWithLoopback(rankId), {linkUp, linkDown}});
+      current_as->private_links_.insert({current_as->nodePositionWithLoopback(rankId), {linkUp, linkDown}});
     }
 
     //call the cluster function that adds the others links
-    if (cluster->topology == ClusterTopology::FAT_TREE) {
-      static_cast<FatTreeZone*>(current_as)->addProcessingNode(i);
+    if (cluster->topology == simgrid::kernel::routing::ClusterTopology::FAT_TREE) {
+      static_cast<FatTreeZone*>(current_as)->add_processing_node(i);
     } else {
       current_as->create_links_for_node(cluster, i, rankId, current_as->nodePositionWithLimiter(rankId));
     }
@@ -272,7 +271,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   //Make the backbone
   if ((cluster->bb_bw > 0) || (cluster->bb_lat > 0)) {
 
-    LinkCreationArgs link;
+    simgrid::kernel::routing::LinkCreationArgs link;
     link.id        = std::string(cluster->id)+ "_backbone";
     link.bandwidth = cluster->bb_bw;
     link.latency   = cluster->bb_lat;
@@ -303,25 +302,25 @@ void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb)
   XBT_DEBUG("Add a backbone to AS '%s'", current_routing->getCname());
 }
 
-void sg_platf_new_cabinet(CabinetCreationArgs* cabinet)
+void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet)
 {
   for (int const& radical : *cabinet->radicals) {
     std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
-    s_sg_platf_host_cbarg_t host;
+    simgrid::kernel::routing::HostCreationArgs host;
     host.pstate           = 0;
     host.core_amount      = 1;
     host.id               = hostname.c_str();
     host.speed_per_pstate.push_back(cabinet->speed);
     sg_platf_new_host(&host);
 
-    LinkCreationArgs link;
+    simgrid::kernel::routing::LinkCreationArgs link;
     link.policy    = SURF_LINK_SPLITDUPLEX;
     link.latency   = cabinet->lat;
     link.bandwidth = cabinet->bw;
     link.id        = "link_" + hostname;
     sg_platf_new_link(&link);
 
-    HostLinkCreationArgs host_link;
+    simgrid::kernel::routing::HostLinkCreationArgs host_link;
     host_link.id        = hostname;
     host_link.link_up   = std::string("link_") + hostname + "_UP";
     host_link.link_down = std::string("link_") + hostname + "_DOWN";
@@ -330,7 +329,7 @@ void sg_platf_new_cabinet(CabinetCreationArgs* cabinet)
   delete cabinet->radicals;
 }
 
-void sg_platf_new_storage(StorageCreationArgs* storage)
+void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage)
 {
   xbt_assert(std::find(known_storages.begin(), known_storages.end(), storage->id) == known_storages.end(),
              "Refusing to add a second storage named \"%s\"", storage->id.c_str());
@@ -370,7 +369,7 @@ void sg_platf_new_storage(StorageCreationArgs* storage)
   }
 }
 
-void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type)
+void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type)
 {
   xbt_assert(storage_types.find(storage_type->id) == storage_types.end(),
              "Reading a storage type, processing unit \"%s\" already exists", storage_type->id.c_str());
@@ -385,7 +384,7 @@ void sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type)
   storage_types[storage_type->id] = stype;
 }
 
-void sg_platf_new_mount(MountCreationArgs* mount)
+void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount)
 {
   xbt_assert(std::find(known_storages.begin(), known_storages.end(), mount->storageId) != known_storages.end(),
              "Cannot mount non-existent disk \"%s\"", mount->storageId.c_str());
@@ -394,22 +393,22 @@ void sg_platf_new_mount(MountCreationArgs* mount)
 
   if (mount_list.empty())
     XBT_DEBUG("Create a Mount list for %s", A_surfxml_host_id);
-  mount_list.insert({mount->name, simgrid::surf::StorageImpl::byName(mount->storageId.c_str())});
+  mount_list.insert({mount->name, simgrid::s4u::Engine::getInstance()->storageByName(mount->storageId)->getImpl()});
 }
 
-void sg_platf_new_route(RouteCreationArgs* route)
+void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route)
 {
   routing_get_current()->addRoute(route->src, route->dst, route->gw_src, route->gw_dst, route->link_list,
                                   route->symmetrical);
 }
 
-void sg_platf_new_bypassRoute(RouteCreationArgs* bypassRoute)
+void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassRoute)
 {
   routing_get_current()->addBypassRoute(bypassRoute->src, bypassRoute->dst, bypassRoute->gw_src, bypassRoute->gw_dst,
                                         bypassRoute->link_list, bypassRoute->symmetrical);
 }
 
-void sg_platf_new_actor(ActorCreationArgs* actor)
+void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
 {
   sg_host_t host = sg_host_by_name(actor->host);
   if (not host) {
@@ -435,20 +434,20 @@ void sg_platf_new_actor(ActorCreationArgs* actor)
 
   double start_time = actor->start_time;
   double kill_time  = actor->kill_time;
-  bool auto_restart = actor->on_failure != ActorOnFailure::DIE;
+  bool auto_restart = actor->on_failure != simgrid::kernel::routing::ActorOnFailure::DIE;
 
   std::string actor_name     = actor->args[0];
   std::function<void()> code = factory(std::move(actor->args));
   std::shared_ptr<std::map<std::string, std::string>> properties(actor->properties);
 
-  simgrid::simix::ProcessArg* arg =
-      new simgrid::simix::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
+  simgrid::kernel::actor::ProcessArg* arg =
+      new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
   host->extension<simgrid::simix::Host>()->boot_processes.push_back(arg);
 
   if (start_time > SIMIX_get_clock()) {
 
-    arg = new simgrid::simix::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
+    arg = new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
     XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->getCname(), start_time);
     SIMIX_timer_set(start_time, [arg, auto_restart]() {
@@ -476,7 +475,7 @@ void sg_platf_new_actor(ActorCreationArgs* actor)
   }
 }
 
-void sg_platf_new_peer(PeerCreationArgs* peer)
+void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer)
 {
   simgrid::kernel::routing::VivaldiZone* as = dynamic_cast<simgrid::kernel::routing::VivaldiZone*>(current_routing);
   xbt_assert(as, "<peer> tag can only be used in Vivaldi netzones.");
@@ -549,7 +548,7 @@ static void surf_config_models_setup()
  *
  * @param zone the parameters defining the Zone to build.
  */
-simgrid::s4u::NetZone* sg_platf_new_Zone_begin(ZoneCreationArgs* zone)
+simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone)
 {
   if (not surf_parse_models_setup_already_called) {
     /* Initialize the surf models. That must be done after we got all config, and before we need the models.
@@ -640,7 +639,7 @@ void sg_platf_new_Zone_seal()
 }
 
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
-void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink)
+void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostlink)
 {
   simgrid::kernel::routing::NetPoint* netpoint = sg_host_by_name(hostlink->id.c_str())->pimpl_netpoint;
   xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
@@ -655,14 +654,14 @@ void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink)
 
   auto* as_cluster = static_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
 
-  if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end())
+  if (as_cluster->private_links_.find(netpoint->id()) != as_cluster->private_links_.end())
     surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!");
 
   XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->getCname(), netpoint->id());
-  as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
+  as_cluster->private_links_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
-void sg_platf_new_trace(TraceCreationArgs* trace)
+void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace)
 {
   tmgr_trace_t tmgr_trace;
   if (not trace->file.empty()) {
index 62e7d21..03b1cff 100644 (file)
@@ -4,9 +4,11 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "storage_n11.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
+#include "simgrid/s4u/Host.hpp"
+#include "src/surf/xml/platf.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
-#include "src/kernel/routing/NetPoint.hpp"
 #include "xbt/utility.hpp"
 #include <cmath> /*ceil*/
 
@@ -19,13 +21,13 @@ extern std::map<std::string, simgrid::surf::StorageType*> storage_types;
 
 static void check_disk_attachment()
 {
-  for (auto const& s : *simgrid::surf::StorageImpl::storagesMap()) {
-    simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s.second->getHost().c_str());
+  for (auto const& s : simgrid::s4u::Engine::getInstance()->getAllStorages()) {
+    simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s->getImpl()->getHost().c_str());
     if (not host_elm)
-      surf_parse_error(std::string("Unable to attach storage ") + s.second->getCname() + ": host " +
-                       s.second->getHost() + " does not exist.");
+      surf_parse_error(std::string("Unable to attach storage ") + s->getCname() + ": host " +
+                       s->getImpl()->getHost().c_str() + " does not exist.");
     else
-      s.second->piface_.attached_to_ = sg_host_by_name(s.second->getHost().c_str());
+      s->attached_to_ = sg_host_by_name(s->getImpl()->getHost().c_str());
   }
 }
 
@@ -59,34 +61,32 @@ StorageImpl* StorageN11Model::createStorage(std::string id, std::string type_id,
                                            "property Bwrite, storage", type_id.c_str());
 
   StorageImpl* storage =
-      new StorageN11(this, id, maxminSystem_, Bread, Bwrite, type_id, content_name, storage_type->size, attach);
+      new StorageN11(this, id, get_maxmin_system(), Bread, Bwrite, type_id, content_name, storage_type->size, attach);
   storageCreatedCallbacks(storage);
 
   XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id.c_str(), type_id.c_str(),
             Bread);
 
-  p_storageList.push_back(storage);
-
   return storage;
 }
 
-double StorageN11Model::nextOccuringEvent(double now)
+double StorageN11Model::next_occuring_event(double now)
 {
-  return StorageModel::nextOccuringEventFull(now);
+  return StorageModel::next_occuring_event_full(now);
 }
 
-void StorageN11Model::updateActionsState(double /*now*/, double delta)
+void StorageN11Model::update_actions_state(double /*now*/, double delta)
 {
-  for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+  for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
     StorageAction& action = static_cast<StorageAction&>(*it);
     ++it; // increment iterator here since the following calls to action.finish() may invalidate it
-    action.updateRemains(lrint(action.getVariable()->get_value() * delta));
+    action.update_remains(lrint(action.get_variable()->get_value() * delta));
 
-    if (action.getMaxDuration() > NO_MAX_DURATION)
-      action.updateMaxDuration(delta);
+    if (action.get_max_duration() > NO_MAX_DURATION)
+      action.update_max_duration(delta);
 
-    if (((action.getRemainsNoUpdate() <= 0) && (action.getVariable()->get_weight() > 0)) ||
-        ((action.getMaxDuration() > NO_MAX_DURATION) && (action.getMaxDuration() <= 0))) {
+    if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) ||
+        ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
       action.finish(kernel::resource::Action::State::done);
     }
   }
@@ -96,8 +96,8 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
  * Resource *
  ************/
 
-StorageN11::StorageN11(StorageModel* model, std::string name, lmm_system_t maxminSystem, double bread, double bwrite,
-                       std::string type_id, std::string content_name, sg_size_t size, std::string attach)
+StorageN11::StorageN11(StorageModel* model, std::string name, kernel::lmm::System* maxminSystem, double bread,
+                       double bwrite, std::string type_id, std::string content_name, sg_size_t size, std::string attach)
     : StorageImpl(model, name, maxminSystem, bread, bwrite, type_id, content_name, size, attach)
 {
   XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
@@ -120,18 +120,18 @@ StorageAction* StorageN11::write(sg_size_t size)
 
 StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost, bool failed, StorageImpl* storage,
                                    e_surf_action_storage_type_t type)
-    : StorageAction(model, cost, failed, model->getMaxminSystem()->variable_new(this, 1.0, -1.0, 3), storage, type)
+    : StorageAction(model, cost, failed, model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 3), storage, type)
 {
   XBT_IN("(%s,%g", storage->getCname(), cost);
 
   // Must be less than the max bandwidth for all actions
-  model->getMaxminSystem()->expand(storage->constraint(), getVariable(), 1.0);
+  model->get_maxmin_system()->expand(storage->constraint(), get_variable(), 1.0);
   switch(type) {
   case READ:
-    model->getMaxminSystem()->expand(storage->constraintRead_, getVariable(), 1.0);
+    model->get_maxmin_system()->expand(storage->constraintRead_, get_variable(), 1.0);
     break;
   case WRITE:
-    model->getMaxminSystem()->expand(storage->constraintWrite_, getVariable(), 1.0);
+    model->get_maxmin_system()->expand(storage->constraintWrite_, get_variable(), 1.0);
     break;
   default:
     THROW_UNIMPLEMENTED;
@@ -139,31 +139,16 @@ StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost,
   XBT_OUT();
 }
 
-int StorageN11Action::unref()
-{
-  refcount_--;
-  if (not refcount_) {
-    if (stateSetHook_.is_linked())
-      simgrid::xbt::intrusive_erase(*stateSet_, *this);
-    if (getVariable())
-      getModel()->getMaxminSystem()->variable_free(getVariable());
-    xbt_free(getCategory());
-    delete this;
-    return 1;
-  }
-  return 0;
-}
-
 void StorageN11Action::cancel()
 {
-  setState(Action::State::failed);
+  set_state(Action::State::failed);
 }
 
 void StorageN11Action::suspend()
 {
   XBT_IN("(%p)", this);
   if (suspended_ != Action::SuspendStates::sleeping) {
-    getModel()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
+    get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
     suspended_ = Action::SuspendStates::suspended;
   }
   XBT_OUT();
@@ -174,20 +159,18 @@ void StorageN11Action::resume()
   THROW_UNIMPLEMENTED;
 }
 
-bool StorageN11Action::isSuspended()
+void StorageN11Action::set_max_duration(double /*duration*/)
 {
-  return suspended_ == Action::SuspendStates::suspended;
+  THROW_UNIMPLEMENTED;
 }
 
-void StorageN11Action::setMaxDuration(double /*duration*/)
+void StorageN11Action::set_priority(double /*priority*/)
 {
   THROW_UNIMPLEMENTED;
 }
-
-void StorageN11Action::setSharingWeight(double /*priority*/)
+void StorageN11Action::update_remains_lazy(double /*now*/)
 {
-  THROW_UNIMPLEMENTED;
+  THROW_IMPOSSIBLE;
 }
-
 }
 }
index 9414ac6..617b285 100644 (file)
@@ -29,8 +29,8 @@ class StorageN11Model : public StorageModel {
 public:
   StorageImpl* createStorage(std::string id, std::string type_id, std::string content_name,
                              std::string attach) override;
-  double nextOccuringEvent(double now) override;
-  void updateActionsState(double now, double delta) override;
+  double next_occuring_event(double now) override;
+  void update_actions_state(double now, double delta) override;
 };
 
 /************
@@ -39,7 +39,7 @@ public:
 
 class StorageN11 : public StorageImpl {
 public:
-  StorageN11(StorageModel* model, std::string name, lmm_system_t maxminSystem, double bread, double bwrite,
+  StorageN11(StorageModel* model, std::string name, kernel::lmm::System* maxminSystem, double bread, double bwrite,
              std::string type_id, std::string content_name, sg_size_t size, std::string attach);
   virtual ~StorageN11() = default;
   StorageAction* read(sg_size_t size);
@@ -54,13 +54,12 @@ class StorageN11Action : public StorageAction {
 public:
   StorageN11Action(kernel::resource::Model* model, double cost, bool failed, StorageImpl* storage,
                    e_surf_action_storage_type_t type);
-  void suspend();
-  int unref();
-  void cancel();
-  void resume();
-  bool isSuspended();
-  void setMaxDuration(double duration);
-  void setSharingWeight(double priority);
+  void suspend() override;
+  void cancel() override;
+  void resume() override;
+  void set_max_duration(double duration) override;
+  void set_priority(double priority) override;
+  void update_remains_lazy(double now) override;
 };
 
 }
index 659be87..968e024 100644 (file)
@@ -36,7 +36,7 @@ void surf_presolve()
 
   XBT_DEBUG ("Set every models in the right state by updating them to 0.");
   for (auto const& model : *all_existing_models)
-    model->updateActionsState(NOW, 0.0);
+    model->update_actions_state(NOW, 0.0);
 }
 
 double surf_solve(double max_date)
@@ -55,13 +55,13 @@ double surf_solve(double max_date)
 
   /* Physical models MUST be resolved first */
   XBT_DEBUG("Looking for next event in physical models");
-  double next_event_phy = surf_host_model->nextOccuringEvent(NOW);
+  double next_event_phy = surf_host_model->next_occuring_event(NOW);
   if ((time_delta < 0.0 || next_event_phy < time_delta) && next_event_phy >= 0.0) {
     time_delta = next_event_phy;
   }
   if (surf_vm_model != nullptr) {
     XBT_DEBUG("Looking for next event in virtual models");
-    double next_event_virt = surf_vm_model->nextOccuringEvent(NOW);
+    double next_event_virt = surf_vm_model->next_occuring_event(NOW);
     if ((time_delta < 0.0 || next_event_virt < time_delta) && next_event_virt >= 0.0)
       time_delta = next_event_virt;
   }
@@ -69,7 +69,7 @@ double surf_solve(double max_date)
   for (auto const& model : *all_existing_models) {
     if (model != surf_host_model && model != surf_vm_model && model != surf_network_model &&
         model != surf_storage_model) {
-      double next_event_model = model->nextOccuringEvent(NOW);
+      double next_event_model = model->next_occuring_event(NOW);
       if ((time_delta < 0.0 || next_event_model < time_delta) && next_event_model >= 0.0)
         time_delta = next_event_model;
     }
@@ -92,7 +92,7 @@ double surf_solve(double max_date)
 
       XBT_DEBUG("Run the NS3 network at most %fs", time_delta);
       // run until min or next flow
-      model_next_action_end = surf_network_model->nextOccuringEvent(time_delta);
+      model_next_action_end = surf_network_model->next_occuring_event(time_delta);
 
       XBT_DEBUG("Min for network : %f", model_next_action_end);
       if (model_next_action_end >= 0.0)
@@ -138,7 +138,7 @@ double surf_solve(double max_date)
 
   // Inform the models of the date change
   for (auto const& model : *all_existing_models)
-    model->updateActionsState(NOW, time_delta);
+    model->update_actions_state(NOW, time_delta);
 
   simgrid::s4u::onTimeAdvance(time_delta);
 
@@ -150,7 +150,7 @@ double surf_solve(double max_date)
 /*********
  * MODEL *
  *********/
-static simgrid::kernel::resource::Action* ActionListExtract(simgrid::kernel::resource::ActionList* list)
+static simgrid::kernel::resource::Action* ActionListExtract(simgrid::kernel::resource::Action::StateSet* list)
 {
   if (list->empty())
     return nullptr;
@@ -161,20 +161,20 @@ static simgrid::kernel::resource::Action* ActionListExtract(simgrid::kernel::res
 
 simgrid::kernel::resource::Action* surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model)
 {
-  return ActionListExtract(model->getDoneActionSet());
+  return ActionListExtract(model->get_done_action_set());
 }
 
 simgrid::kernel::resource::Action* surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model)
 {
-  return ActionListExtract(model->getFailedActionSet());
+  return ActionListExtract(model->get_failed_action_set());
 }
 
 int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model)
 {
-  return model->getRunningActionSet()->size();
+  return model->get_running_action_set()->size();
 }
 
 void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound)
 {
-  static_cast<simgrid::surf::CpuAction*>(action)->setBound(bound);
+  static_cast<simgrid::surf::CpuAction*>(action)->set_bound(bound);
 }
index f45907e..c172990 100644 (file)
@@ -5,12 +5,13 @@
 
 #include "surf_interface.hpp"
 #include "mc/mc.h"
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 #include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 #include "src/kernel/lmm/maxmin.hpp"   // Constraint
-#include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/HostImpl.hpp"
+#include "src/surf/xml/platf.hpp"
 #include "xbt/utility.hpp"
 
 #include <fstream>
@@ -128,12 +129,6 @@ double surf_get_clock()
   return NOW;
 }
 
-#ifdef _WIN32
-# define FILE_DELIM "\\"
-#else
-# define FILE_DELIM "/"         /* FIXME: move to better location */
-#endif
-
 std::ifstream* surf_ifsopen(std::string name)
 {
   std::ifstream* fs = new std::ifstream();
@@ -144,7 +139,7 @@ std::ifstream* surf_ifsopen(std::string name)
 
   /* search relative files in the path */
   for (auto const& path_elm : surf_path) {
-    std::string buff = path_elm + FILE_DELIM + name;
+    std::string buff = path_elm + "/" + name;
     fs->open(buff.c_str(), std::ifstream::in);
 
     if (not fs->fail()) {
@@ -167,7 +162,7 @@ FILE *surf_fopen(const char *name, const char *mode)
 
   /* search relative files in the path */
   for (auto const& path_elm : surf_path) {
-    std::string buff = path_elm + FILE_DELIM + name;
+    std::string buff = path_elm + "/" + name;
     file             = fopen(buff.c_str(), mode);
 
     if (file)
@@ -329,9 +324,6 @@ void surf_exit()
     delete stype->model_properties;
     delete stype;
   }
-  for (auto const& s : *simgrid::surf::StorageImpl::storagesMap())
-    delete s.second;
-  delete simgrid::surf::StorageImpl::storagesMap();
 
   for (auto const& model : *all_existing_models)
     delete model;
index 385a234..eaff399 100644 (file)
 #include <string>
 #include <unordered_map>
 
-#define NO_MAX_DURATION -1.0
-
 /*********
  * Utils *
  *********/
 
 /* user-visible parameters */
-XBT_PUBLIC_DATA(double) sg_maxmin_precision;
-XBT_PUBLIC_DATA(double) sg_surf_precision;
-XBT_PUBLIC_DATA(int) sg_concurrency_limit;
+XBT_PUBLIC_DATA double sg_maxmin_precision;
+XBT_PUBLIC_DATA double sg_surf_precision;
+XBT_PUBLIC_DATA int sg_concurrency_limit;
 
 extern XBT_PRIVATE double sg_tcp_gamma;
 extern XBT_PRIVATE double sg_latency_factor;
@@ -63,13 +61,10 @@ static inline int double_equals(double value1, double value2, double precision)
   return (fabs(value1 - value2) < precision);
 }
 
-extern "C" {
-XBT_PUBLIC(double) surf_get_clock();
-}
 /** \ingroup SURF_simulation
  *  \brief List of hosts that have just restarted and whose autorestart process should be restarted.
  */
-XBT_PUBLIC_DATA(std::vector<sg_host_t>) host_that_restart;
+XBT_PUBLIC_DATA std::vector<sg_host_t> host_that_restart;
 
 int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path);
 
@@ -80,6 +75,6 @@ int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path);
 /** \ingroup SURF_models
  *  \brief List of initialized models
  */
-XBT_PUBLIC_DATA(std::vector<simgrid::kernel::resource::Model*>*) all_existing_models;
+XBT_PUBLIC_DATA std::vector<simgrid::kernel::resource::Model*>* all_existing_models;
 
 #endif /* SURF_MODEL_H_ */
index 1d460ff..aa48911 100644 (file)
@@ -9,22 +9,8 @@
 #include "src/surf/trace_mgr.hpp"
 #include "surf/surf.hpp"
 
-#define NO_MAX_DURATION -1.0
-
 extern "C" {
 
-/** @ingroup SURF_interface
- * @brief Possible update mechanisms
- */
-enum e_UM_t {
-  UM_FULL,     /**< Full update mechanism: the remaining time of every action is recomputed at each step */
-  UM_LAZY,     /**< Lazy update mechanism: only the modified actions get recomputed.
-                    It may be slower than full if your system is tightly coupled to the point where every action
-                    gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for
-                    a simple full update.  */
-  UM_UNDEFINED /**< Mechanism not defined */
-};
-
 /* Generic functions common to all models */
 
 XBT_PRIVATE FILE* surf_fopen(const char* name, const char* mode);
@@ -38,7 +24,7 @@ XBT_PRIVATE int __surf_is_absolute_file_path(const char* file_path);
 
 extern XBT_PRIVATE simgrid::trace_mgr::future_evt_set* future_evt_set;
 
-XBT_PUBLIC(void) storage_register_callbacks();
+XBT_PUBLIC void storage_register_callbacks();
 
 XBT_PRIVATE void parse_after_config();
 
index 07c5ba6..9fd4620 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2004-2005, 2007, 2009-2014, 2016-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2018. 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. */
@@ -126,7 +125,7 @@ tmgr_trace_event_t simgrid::trace_mgr::future_evt_set::add_trace(tmgr_trace_t tr
 {
   tmgr_trace_event_t trace_iterator = nullptr;
 
-  trace_iterator           = new s_tmgr_trace_event_t;
+  trace_iterator           = new simgrid::kernel::resource::TraceEvent();
   trace_iterator->trace    = trace;
   trace_iterator->idx      = 0;
   trace_iterator->resource = resource;
index 36ce190..bcd2151 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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 <queue>
 #include <vector>
 
-extern "C" {
 
 /* Iterator within a trace */
-struct s_tmgr_trace_event_t {
+namespace simgrid {
+namespace kernel {
+namespace resource {
+class TraceEvent {
+public:
   tmgr_trace_t trace;
   unsigned int idx;
   sg_resource_t resource;
   bool free_me;
 };
-typedef s_tmgr_trace_event_t* tmgr_trace_event_t;
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
+typedef simgrid::kernel::resource::TraceEvent* tmgr_trace_event_t;
+extern "C" {
 
 /**
  * \brief Free a trace event structure
@@ -29,12 +37,12 @@ typedef s_tmgr_trace_event_t* tmgr_trace_event_t;
  * This flag indicates whether the structure is still used somewhere or not.
  * When the structure is freed, the argument is set to nullptr
 */
-XBT_PUBLIC(void) tmgr_trace_event_unref(tmgr_trace_event_t* trace_event);
+XBT_PUBLIC void tmgr_trace_event_unref(tmgr_trace_event_t* trace_event);
 
-XBT_PUBLIC(void) tmgr_finalize();
+XBT_PUBLIC void tmgr_finalize();
 
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(std::string filename);
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(std::string id, std::string input, double periodicity);
+XBT_PUBLIC tmgr_trace_t tmgr_trace_new_from_file(std::string filename);
+XBT_PUBLIC tmgr_trace_t tmgr_trace_new_from_string(std::string id, std::string input, double periodicity);
 }
 
 namespace simgrid {
@@ -49,8 +57,7 @@ namespace simgrid {
  * - #future_evt_set: makes it easy to find the next occuring event of all traces
  */
 namespace trace_mgr {
-XBT_PUBLIC_CLASS DatedValue
-{
+class XBT_PUBLIC DatedValue {
 public:
   double date_          = 0;
   double value_         = 0;
@@ -62,8 +69,7 @@ public:
 std::ostream& operator<<(std::ostream& out, const DatedValue& e);
 
 /** @brief A trace_iterator links a trace to a resource */
-XBT_PUBLIC_CLASS trace_event{
-
+class XBT_PUBLIC trace_event {
 };
 
 /** @brief A trace is a set of timed values, encoding the value that a variable takes at what time *
@@ -71,7 +77,7 @@ XBT_PUBLIC_CLASS trace_event{
  * It is useful to model dynamic platforms, where an external load that makes the resource availability change over time.
  * To model that, you have to set several traces per resource: one for the on/off state and one for each numerical value (computational speed, bandwidth and latency).
  */
-XBT_PUBLIC_CLASS trace {
+class XBT_PUBLIC trace {
 public:
   /**  Creates an empty trace */
   explicit trace();
@@ -82,7 +88,7 @@ public:
 
 /** @brief Future Event Set (collection of iterators over the traces)
  * That's useful to quickly know which is the next occurring event in a set of traces. */
-XBT_PUBLIC_CLASS future_evt_set {
+class XBT_PUBLIC future_evt_set {
 public:
   future_evt_set();
   virtual ~future_evt_set();
index 22eb441..fc8601a 100644 (file)
@@ -9,7 +9,7 @@ bool init_unit_test(); // boost forget to give this prototype on NetBSD, which d
 #define BOOST_TEST_NO_MAIN
 #include <boost/test/unit_test.hpp>
 
-#include "src/kernel/resource/Resource.hpp"
+#include "simgrid/kernel/resource/Resource.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "src/surf/trace_mgr.hpp"
 
index 7b1c5b4..c30139c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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. */
 extern "C" {
 
 /* Module management functions */
-XBT_PUBLIC(void) sg_platf_init();;
-XBT_PUBLIC(void) sg_platf_exit();
-
-XBT_PUBLIC(void) surf_parse_open(const char *file);
-XBT_PUBLIC(void) surf_parse_close();
-XBT_PUBLIC(void) surf_parse_assert(bool cond, std::string msg);
-XBT_ATTRIB_NORETURN XBT_PUBLIC(void) surf_parse_error(std::string msg);
-XBT_PUBLIC(void) surf_parse_assert_netpoint(std::string hostname, std::string pre, std::string post);
-
-XBT_PUBLIC(double) surf_parse_get_double(std::string s);
-XBT_PUBLIC(int) surf_parse_get_int(std::string s);
-XBT_PUBLIC(double) surf_parse_get_time(const char* string, const char* entity_kind, std::string name);
-XBT_PUBLIC(double) surf_parse_get_size(const char* string, const char* entity_kind, std::string name);
-XBT_PUBLIC(double) surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name);
-XBT_PUBLIC(double) surf_parse_get_speed(const char* string, const char* entity_kind, std::string name);
-
-XBT_PUBLIC(int) surf_parse(); /* Entry-point to the parser */
+XBT_PUBLIC void sg_platf_init();
+XBT_PUBLIC void sg_platf_exit();
+
+XBT_PUBLIC void surf_parse_open(const char* file);
+XBT_PUBLIC void surf_parse_close();
+XBT_PUBLIC void surf_parse_assert(bool cond, std::string msg);
+XBT_ATTRIB_NORETURN XBT_PUBLIC void surf_parse_error(std::string msg);
+XBT_PUBLIC void surf_parse_assert_netpoint(std::string hostname, std::string pre, std::string post);
+
+XBT_PUBLIC double surf_parse_get_double(std::string s);
+XBT_PUBLIC int surf_parse_get_int(std::string s);
+XBT_PUBLIC double surf_parse_get_time(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC double surf_parse_get_size(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC double surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name);
+XBT_PUBLIC double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name);
+
+XBT_PUBLIC int surf_parse(); /* Entry-point to the parser */
 }
 
 #endif
index 2a62c6d..39b93d2 100644 (file)
@@ -1,6 +1,6 @@
 /* platf_private.h - Interface to the SimGrid platforms which visibility should be limited to this directory */
 
-/* Copyright (c) 2004-2017. The SimGrid Team.
+/* Copyright (c) 2004-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 
 #include "simgrid/host.h"
 #include "src/surf/xml/platf.hpp"
+#include "src/surf/xml/simgrid_dtd.h"
 #include <map>
 #include <string>
 #include <vector>
 
-extern "C" {
-#include "src/surf/xml/simgrid_dtd.h"
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
+namespace simgrid {
+namespace kernel {
+namespace routing {
 /* ***************************************** */
 /*
  * Platform creation functions. Instead of passing 123 arguments to the creation functions
@@ -34,7 +30,7 @@ typedef size_t yy_size_t;
  * used, instead of malloced structures.
  */
 
-struct s_sg_platf_host_cbarg_t {
+struct HostCreationArgs {
   const char* id = nullptr;
   std::vector<double> speed_per_pstate;
   int pstate               = 0;
@@ -44,7 +40,6 @@ struct s_sg_platf_host_cbarg_t {
   const char* coord        = nullptr;
   std::map<std::string, std::string>* properties = nullptr;
 };
-typedef s_sg_platf_host_cbarg_t* sg_platf_host_cbarg_t;
 
 class HostLinkCreationArgs {
 public:
@@ -164,7 +159,7 @@ public:
   std::string element;
 };
 
-enum class ActorOnFailure { DIE, RESTART };
+enum class ActorOnFailure { DIE, RESTART }; // FIXME: move to a better namespace
 
 class ActorCreationArgs {
 public:
@@ -182,57 +177,60 @@ public:
   std::string id;
   int routing;
 };
+}}}
+
+extern "C" {
 
 /********** Routing **********/
 void routing_cluster_add_backbone(simgrid::surf::LinkImpl* bb);
 /*** END of the parsing cruft ***/
 
-XBT_PUBLIC(void) sg_platf_begin();  // Start a new platform
-XBT_PUBLIC(void) sg_platf_end(); // Finish the creation of the platform
+XBT_PUBLIC void sg_platf_begin(); // Start a new platform
+XBT_PUBLIC void sg_platf_end();   // Finish the creation of the platform
 
-XBT_PUBLIC(simgrid::s4u::NetZone*) sg_platf_new_Zone_begin(ZoneCreationArgs* zone); // Begin description of new Zone
-XBT_PUBLIC(void) sg_platf_new_Zone_seal();                                          // That Zone is fully described
+XBT_PUBLIC simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone); // Begin description of new Zone
+XBT_PUBLIC void sg_platf_new_Zone_seal();                                          // That Zone is fully described
 
-XBT_PUBLIC(void) sg_platf_new_host(sg_platf_host_cbarg_t host);        // Add a host      to the current Zone
-XBT_PUBLIC(void) sg_platf_new_hostlink(HostLinkCreationArgs* h);       // Add a host_link to the current Zone
-XBT_PUBLIC(void) sg_platf_new_link(LinkCreationArgs* link);            // Add a link      to the current Zone
-XBT_PUBLIC(void) sg_platf_new_peer(PeerCreationArgs* peer);            // Add a peer      to the current Zone
-XBT_PUBLIC(void) sg_platf_new_cluster(ClusterCreationArgs* clust);     // Add a cluster   to the current Zone
-XBT_PUBLIC(void) sg_platf_new_cabinet(CabinetCreationArgs* cabinet);   // Add a cabinet   to the current Zone
-XBT_PUBLIC(simgrid::kernel::routing::NetPoint*)                        // Add a router    to the current Zone
-sg_platf_new_router(std::string, const char* coords);
+XBT_PUBLIC void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* host);      // Add a host      to the current Zone
+XBT_PUBLIC void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* h);     // Add a host_link to the current Zone
+XBT_PUBLIC void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link);          // Add a link      to the current Zone
+XBT_PUBLIC void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer);          // Add a peer      to the current Zone
+XBT_PUBLIC void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* clust);   // Add a cluster   to the current Zone
+XBT_PUBLIC void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet); // Add a cabinet   to the current Zone
+XBT_PUBLIC simgrid::kernel::routing::NetPoint*                      // Add a router    to the current Zone
+    sg_platf_new_router(std::string, const char* coords);
 
-XBT_PUBLIC(void) sg_platf_new_route(RouteCreationArgs* route);             // Add a route
-XBT_PUBLIC(void) sg_platf_new_bypassRoute(RouteCreationArgs* bypassroute); // Add a bypassRoute
+XBT_PUBLIC void sg_platf_new_route(simgrid::kernel::routing::RouteCreationArgs* route);             // Add a route
+XBT_PUBLIC void sg_platf_new_bypassRoute(simgrid::kernel::routing::RouteCreationArgs* bypassroute); // Add a bypassRoute
 
-XBT_PUBLIC(void) sg_platf_new_trace(TraceCreationArgs* trace);
+XBT_PUBLIC void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace);
 
-XBT_PUBLIC(void) sg_platf_new_storage(StorageCreationArgs* storage); // Add a storage to the current Zone
-XBT_PUBLIC(void) sg_platf_new_storage_type(StorageTypeCreationArgs* storage_type);
-XBT_PUBLIC(void) sg_platf_new_mount(MountCreationArgs* mount);
+XBT_PUBLIC void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage); // Add a storage to the current Zone
+XBT_PUBLIC void sg_platf_new_storage_type(simgrid::kernel::routing::StorageTypeCreationArgs* storage_type);
+XBT_PUBLIC void sg_platf_new_mount(simgrid::kernel::routing::MountCreationArgs* mount);
 
-XBT_PUBLIC(void) sg_platf_new_actor(ActorCreationArgs* actor);
-XBT_PRIVATE void sg_platf_trace_connect(TraceConnectCreationArgs* trace_connect);
+XBT_PUBLIC void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor);
+XBT_PRIVATE void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect);
 
 /* Prototypes of the functions offered by flex */
-XBT_PUBLIC(int) surf_parse_lex();
-XBT_PUBLIC(int) surf_parse_get_lineno();
-XBT_PUBLIC(FILE *) surf_parse_get_in();
-XBT_PUBLIC(FILE *) surf_parse_get_out();
-XBT_PUBLIC(int) surf_parse_get_leng();
-XBT_PUBLIC(char *) surf_parse_get_text();
-XBT_PUBLIC(void) surf_parse_set_lineno(int line_number);
-XBT_PUBLIC(void) surf_parse_set_in(FILE * in_str);
-XBT_PUBLIC(void) surf_parse_set_out(FILE * out_str);
-XBT_PUBLIC(int) surf_parse_get_debug();
-XBT_PUBLIC(void) surf_parse_set_debug(int bdebug);
-XBT_PUBLIC(int) surf_parse_lex_destroy();
+XBT_PUBLIC int surf_parse_lex();
+XBT_PUBLIC int surf_parse_get_lineno();
+XBT_PUBLIC FILE* surf_parse_get_in();
+XBT_PUBLIC FILE* surf_parse_get_out();
+XBT_PUBLIC int surf_parse_get_leng();
+XBT_PUBLIC char* surf_parse_get_text();
+XBT_PUBLIC void surf_parse_set_lineno(int line_number);
+XBT_PUBLIC void surf_parse_set_in(FILE* in_str);
+XBT_PUBLIC void surf_parse_set_out(FILE* out_str);
+XBT_PUBLIC int surf_parse_get_debug();
+XBT_PUBLIC void surf_parse_set_debug(int bdebug);
+XBT_PUBLIC int surf_parse_lex_destroy();
 }
 
 namespace simgrid {
 namespace surf {
 
-extern XBT_PRIVATE simgrid::xbt::signal<void(ClusterCreationArgs*)> on_cluster;
+extern XBT_PRIVATE simgrid::xbt::signal<void(kernel::routing::ClusterCreationArgs*)> on_cluster;
 }
 }
 
index 3883f56..5db30d4 100644 (file)
 #define _FLEXML_simgrid_H
 
 /* XML application entry points. */
-XBT_PUBLIC(void) STag_surfxml_AS(void);
-XBT_PUBLIC(void) ETag_surfxml_AS(void);
-XBT_PUBLIC(void) STag_surfxml_ASroute(void);
-XBT_PUBLIC(void) ETag_surfxml_ASroute(void);
-XBT_PUBLIC(void) STag_surfxml_actor(void);
-XBT_PUBLIC(void) ETag_surfxml_actor(void);
-XBT_PUBLIC(void) STag_surfxml_argument(void);
-XBT_PUBLIC(void) ETag_surfxml_argument(void);
-XBT_PUBLIC(void) STag_surfxml_backbone(void);
-XBT_PUBLIC(void) ETag_surfxml_backbone(void);
-XBT_PUBLIC(void) STag_surfxml_bypassASroute(void);
-XBT_PUBLIC(void) ETag_surfxml_bypassASroute(void);
-XBT_PUBLIC(void) STag_surfxml_bypassRoute(void);
-XBT_PUBLIC(void) ETag_surfxml_bypassRoute(void);
-XBT_PUBLIC(void) STag_surfxml_bypassZoneRoute(void);
-XBT_PUBLIC(void) ETag_surfxml_bypassZoneRoute(void);
-XBT_PUBLIC(void) STag_surfxml_cabinet(void);
-XBT_PUBLIC(void) ETag_surfxml_cabinet(void);
-XBT_PUBLIC(void) STag_surfxml_cluster(void);
-XBT_PUBLIC(void) ETag_surfxml_cluster(void);
-XBT_PUBLIC(void) STag_surfxml_config(void);
-XBT_PUBLIC(void) ETag_surfxml_config(void);
-XBT_PUBLIC(void) STag_surfxml_host(void);
-XBT_PUBLIC(void) ETag_surfxml_host(void);
-XBT_PUBLIC(void) STag_surfxml_host___link(void);
-XBT_PUBLIC(void) ETag_surfxml_host___link(void);
-XBT_PUBLIC(void) STag_surfxml_include(void);
-XBT_PUBLIC(void) ETag_surfxml_include(void);
-XBT_PUBLIC(void) STag_surfxml_link(void);
-XBT_PUBLIC(void) ETag_surfxml_link(void);
-XBT_PUBLIC(void) STag_surfxml_link___ctn(void);
-XBT_PUBLIC(void) ETag_surfxml_link___ctn(void);
-XBT_PUBLIC(void) STag_surfxml_model___prop(void);
-XBT_PUBLIC(void) ETag_surfxml_model___prop(void);
-XBT_PUBLIC(void) STag_surfxml_mount(void);
-XBT_PUBLIC(void) ETag_surfxml_mount(void);
-XBT_PUBLIC(void) STag_surfxml_peer(void);
-XBT_PUBLIC(void) ETag_surfxml_peer(void);
-XBT_PUBLIC(void) STag_surfxml_platform(void);
-XBT_PUBLIC(void) ETag_surfxml_platform(void);
-XBT_PUBLIC(void) STag_surfxml_process(void);
-XBT_PUBLIC(void) ETag_surfxml_process(void);
-XBT_PUBLIC(void) STag_surfxml_prop(void);
-XBT_PUBLIC(void) ETag_surfxml_prop(void);
-XBT_PUBLIC(void) STag_surfxml_random(void);
-XBT_PUBLIC(void) ETag_surfxml_random(void);
-XBT_PUBLIC(void) STag_surfxml_route(void);
-XBT_PUBLIC(void) ETag_surfxml_route(void);
-XBT_PUBLIC(void) STag_surfxml_router(void);
-XBT_PUBLIC(void) ETag_surfxml_router(void);
-XBT_PUBLIC(void) STag_surfxml_storage(void);
-XBT_PUBLIC(void) ETag_surfxml_storage(void);
-XBT_PUBLIC(void) STag_surfxml_storage___type(void);
-XBT_PUBLIC(void) ETag_surfxml_storage___type(void);
-XBT_PUBLIC(void) STag_surfxml_trace(void);
-XBT_PUBLIC(void) ETag_surfxml_trace(void);
-XBT_PUBLIC(void) STag_surfxml_trace___connect(void);
-XBT_PUBLIC(void) ETag_surfxml_trace___connect(void);
-XBT_PUBLIC(void) STag_surfxml_zone(void);
-XBT_PUBLIC(void) ETag_surfxml_zone(void);
-XBT_PUBLIC(void) STag_surfxml_zoneRoute(void);
-XBT_PUBLIC(void) ETag_surfxml_zoneRoute(void);
+XBT_PUBLIC void STag_surfxml_AS(void);
+XBT_PUBLIC void ETag_surfxml_AS(void);
+XBT_PUBLIC void STag_surfxml_ASroute(void);
+XBT_PUBLIC void ETag_surfxml_ASroute(void);
+XBT_PUBLIC void STag_surfxml_actor(void);
+XBT_PUBLIC void ETag_surfxml_actor(void);
+XBT_PUBLIC void STag_surfxml_argument(void);
+XBT_PUBLIC void ETag_surfxml_argument(void);
+XBT_PUBLIC void STag_surfxml_backbone(void);
+XBT_PUBLIC void ETag_surfxml_backbone(void);
+XBT_PUBLIC void STag_surfxml_bypassASroute(void);
+XBT_PUBLIC void ETag_surfxml_bypassASroute(void);
+XBT_PUBLIC void STag_surfxml_bypassRoute(void);
+XBT_PUBLIC void ETag_surfxml_bypassRoute(void);
+XBT_PUBLIC void STag_surfxml_bypassZoneRoute(void);
+XBT_PUBLIC void ETag_surfxml_bypassZoneRoute(void);
+XBT_PUBLIC void STag_surfxml_cabinet(void);
+XBT_PUBLIC void ETag_surfxml_cabinet(void);
+XBT_PUBLIC void STag_surfxml_cluster(void);
+XBT_PUBLIC void ETag_surfxml_cluster(void);
+XBT_PUBLIC void STag_surfxml_config(void);
+XBT_PUBLIC void ETag_surfxml_config(void);
+XBT_PUBLIC void STag_surfxml_host(void);
+XBT_PUBLIC void ETag_surfxml_host(void);
+XBT_PUBLIC void STag_surfxml_host___link(void);
+XBT_PUBLIC void ETag_surfxml_host___link(void);
+XBT_PUBLIC void STag_surfxml_include(void);
+XBT_PUBLIC void ETag_surfxml_include(void);
+XBT_PUBLIC void STag_surfxml_link(void);
+XBT_PUBLIC void ETag_surfxml_link(void);
+XBT_PUBLIC void STag_surfxml_link___ctn(void);
+XBT_PUBLIC void ETag_surfxml_link___ctn(void);
+XBT_PUBLIC void STag_surfxml_model___prop(void);
+XBT_PUBLIC void ETag_surfxml_model___prop(void);
+XBT_PUBLIC void STag_surfxml_mount(void);
+XBT_PUBLIC void ETag_surfxml_mount(void);
+XBT_PUBLIC void STag_surfxml_peer(void);
+XBT_PUBLIC void ETag_surfxml_peer(void);
+XBT_PUBLIC void STag_surfxml_platform(void);
+XBT_PUBLIC void ETag_surfxml_platform(void);
+XBT_PUBLIC void STag_surfxml_process(void);
+XBT_PUBLIC void ETag_surfxml_process(void);
+XBT_PUBLIC void STag_surfxml_prop(void);
+XBT_PUBLIC void ETag_surfxml_prop(void);
+XBT_PUBLIC void STag_surfxml_random(void);
+XBT_PUBLIC void ETag_surfxml_random(void);
+XBT_PUBLIC void STag_surfxml_route(void);
+XBT_PUBLIC void ETag_surfxml_route(void);
+XBT_PUBLIC void STag_surfxml_router(void);
+XBT_PUBLIC void ETag_surfxml_router(void);
+XBT_PUBLIC void STag_surfxml_storage(void);
+XBT_PUBLIC void ETag_surfxml_storage(void);
+XBT_PUBLIC void STag_surfxml_storage___type(void);
+XBT_PUBLIC void ETag_surfxml_storage___type(void);
+XBT_PUBLIC void STag_surfxml_trace(void);
+XBT_PUBLIC void ETag_surfxml_trace(void);
+XBT_PUBLIC void STag_surfxml_trace___connect(void);
+XBT_PUBLIC void ETag_surfxml_trace___connect(void);
+XBT_PUBLIC void STag_surfxml_zone(void);
+XBT_PUBLIC void ETag_surfxml_zone(void);
+XBT_PUBLIC void STag_surfxml_zoneRoute(void);
+XBT_PUBLIC void ETag_surfxml_zoneRoute(void);
 
 /* XML application data. */
 typedef int AT_surfxml_AS_id;
@@ -352,393 +352,393 @@ typedef int AT_surfxml_zoneRoute_src;
 typedef enum { AU_surfxml_zoneRoute_symmetrical, A_surfxml_zoneRoute_symmetrical_YES,A_surfxml_zoneRoute_symmetrical_NO } AT_surfxml_zoneRoute_symmetrical;
 
 /* FleXML-provided data. */
-XBT_PUBLIC_DATA(int) surfxml_pcdata_ix;
-XBT_PUBLIC_DATA(char *) surfxml_bufferstack;
+XBT_PUBLIC_DATA int surfxml_pcdata_ix;
+XBT_PUBLIC_DATA char *surfxml_bufferstack;
 #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix)
-XBT_PUBLIC_DATA(AT_surfxml_AS_id) AX_surfxml_AS_id;
+XBT_PUBLIC_DATA AT_surfxml_AS_id AX_surfxml_AS_id;
 #define A_surfxml_AS_id (surfxml_bufferstack + AX_surfxml_AS_id)
-XBT_PUBLIC_DATA(short int) surfxml_AS_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_AS_routing) AX_surfxml_AS_routing;
+XBT_PUBLIC_DATA short int surfxml_AS_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_AS_routing AX_surfxml_AS_routing;
 #define A_surfxml_AS_routing AX_surfxml_AS_routing
-XBT_PUBLIC_DATA(short int) surfxml_AS_routing_isset;
-XBT_PUBLIC_DATA(AT_surfxml_ASroute_dst) AX_surfxml_ASroute_dst;
+XBT_PUBLIC_DATA short int surfxml_AS_routing_isset;
+XBT_PUBLIC_DATA AT_surfxml_ASroute_dst AX_surfxml_ASroute_dst;
 #define A_surfxml_ASroute_dst (surfxml_bufferstack + AX_surfxml_ASroute_dst)
-XBT_PUBLIC_DATA(short int) surfxml_ASroute_dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_ASroute_gw___dst) AX_surfxml_ASroute_gw___dst;
+XBT_PUBLIC_DATA short int surfxml_ASroute_dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_ASroute_gw___dst AX_surfxml_ASroute_gw___dst;
 #define A_surfxml_ASroute_gw___dst (surfxml_bufferstack + AX_surfxml_ASroute_gw___dst)
-XBT_PUBLIC_DATA(short int) surfxml_ASroute_gw___dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_ASroute_gw___src) AX_surfxml_ASroute_gw___src;
+XBT_PUBLIC_DATA short int surfxml_ASroute_gw___dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_ASroute_gw___src AX_surfxml_ASroute_gw___src;
 #define A_surfxml_ASroute_gw___src (surfxml_bufferstack + AX_surfxml_ASroute_gw___src)
-XBT_PUBLIC_DATA(short int) surfxml_ASroute_gw___src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_ASroute_src) AX_surfxml_ASroute_src;
+XBT_PUBLIC_DATA short int surfxml_ASroute_gw___src_isset;
+XBT_PUBLIC_DATA AT_surfxml_ASroute_src AX_surfxml_ASroute_src;
 #define A_surfxml_ASroute_src (surfxml_bufferstack + AX_surfxml_ASroute_src)
-XBT_PUBLIC_DATA(short int) surfxml_ASroute_src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_ASroute_symmetrical) AX_surfxml_ASroute_symmetrical;
+XBT_PUBLIC_DATA short int surfxml_ASroute_src_isset;
+XBT_PUBLIC_DATA AT_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical;
 #define A_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical
-XBT_PUBLIC_DATA(short int) surfxml_ASroute_symmetrical_isset;
-XBT_PUBLIC_DATA(AT_surfxml_actor_function) AX_surfxml_actor_function;
+XBT_PUBLIC_DATA short int surfxml_ASroute_symmetrical_isset;
+XBT_PUBLIC_DATA AT_surfxml_actor_function AX_surfxml_actor_function;
 #define A_surfxml_actor_function (surfxml_bufferstack + AX_surfxml_actor_function)
-XBT_PUBLIC_DATA(short int) surfxml_actor_function_isset;
-XBT_PUBLIC_DATA(AT_surfxml_actor_host) AX_surfxml_actor_host;
+XBT_PUBLIC_DATA short int surfxml_actor_function_isset;
+XBT_PUBLIC_DATA AT_surfxml_actor_host AX_surfxml_actor_host;
 #define A_surfxml_actor_host (surfxml_bufferstack + AX_surfxml_actor_host)
-XBT_PUBLIC_DATA(short int) surfxml_actor_host_isset;
-XBT_PUBLIC_DATA(AT_surfxml_actor_kill___time) AX_surfxml_actor_kill___time;
+XBT_PUBLIC_DATA short int surfxml_actor_host_isset;
+XBT_PUBLIC_DATA AT_surfxml_actor_kill___time AX_surfxml_actor_kill___time;
 #define A_surfxml_actor_kill___time (surfxml_bufferstack + AX_surfxml_actor_kill___time)
-XBT_PUBLIC_DATA(short int) surfxml_actor_kill___time_isset;
-XBT_PUBLIC_DATA(AT_surfxml_actor_on___failure) AX_surfxml_actor_on___failure;
+XBT_PUBLIC_DATA short int surfxml_actor_kill___time_isset;
+XBT_PUBLIC_DATA AT_surfxml_actor_on___failure AX_surfxml_actor_on___failure;
 #define A_surfxml_actor_on___failure AX_surfxml_actor_on___failure
-XBT_PUBLIC_DATA(short int) surfxml_actor_on___failure_isset;
-XBT_PUBLIC_DATA(AT_surfxml_actor_start___time) AX_surfxml_actor_start___time;
+XBT_PUBLIC_DATA short int surfxml_actor_on___failure_isset;
+XBT_PUBLIC_DATA AT_surfxml_actor_start___time AX_surfxml_actor_start___time;
 #define A_surfxml_actor_start___time (surfxml_bufferstack + AX_surfxml_actor_start___time)
-XBT_PUBLIC_DATA(short int) surfxml_actor_start___time_isset;
-XBT_PUBLIC_DATA(AT_surfxml_argument_value) AX_surfxml_argument_value;
+XBT_PUBLIC_DATA short int surfxml_actor_start___time_isset;
+XBT_PUBLIC_DATA AT_surfxml_argument_value AX_surfxml_argument_value;
 #define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value)
-XBT_PUBLIC_DATA(short int) surfxml_argument_value_isset;
-XBT_PUBLIC_DATA(AT_surfxml_backbone_bandwidth) AX_surfxml_backbone_bandwidth;
+XBT_PUBLIC_DATA short int surfxml_argument_value_isset;
+XBT_PUBLIC_DATA AT_surfxml_backbone_bandwidth AX_surfxml_backbone_bandwidth;
 #define A_surfxml_backbone_bandwidth (surfxml_bufferstack + AX_surfxml_backbone_bandwidth)
-XBT_PUBLIC_DATA(short int) surfxml_backbone_bandwidth_isset;
-XBT_PUBLIC_DATA(AT_surfxml_backbone_id) AX_surfxml_backbone_id;
+XBT_PUBLIC_DATA short int surfxml_backbone_bandwidth_isset;
+XBT_PUBLIC_DATA AT_surfxml_backbone_id AX_surfxml_backbone_id;
 #define A_surfxml_backbone_id (surfxml_bufferstack + AX_surfxml_backbone_id)
-XBT_PUBLIC_DATA(short int) surfxml_backbone_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_backbone_latency) AX_surfxml_backbone_latency;
+XBT_PUBLIC_DATA short int surfxml_backbone_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_backbone_latency AX_surfxml_backbone_latency;
 #define A_surfxml_backbone_latency (surfxml_bufferstack + AX_surfxml_backbone_latency)
-XBT_PUBLIC_DATA(short int) surfxml_backbone_latency_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_dst) AX_surfxml_bypassASroute_dst;
+XBT_PUBLIC_DATA short int surfxml_backbone_latency_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassASroute_dst AX_surfxml_bypassASroute_dst;
 #define A_surfxml_bypassASroute_dst (surfxml_bufferstack + AX_surfxml_bypassASroute_dst)
-XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_gw___dst) AX_surfxml_bypassASroute_gw___dst;
+XBT_PUBLIC_DATA short int surfxml_bypassASroute_dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassASroute_gw___dst AX_surfxml_bypassASroute_gw___dst;
 #define A_surfxml_bypassASroute_gw___dst (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___dst)
-XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_gw___dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_gw___src) AX_surfxml_bypassASroute_gw___src;
+XBT_PUBLIC_DATA short int surfxml_bypassASroute_gw___dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassASroute_gw___src AX_surfxml_bypassASroute_gw___src;
 #define A_surfxml_bypassASroute_gw___src (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___src)
-XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_gw___src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_src) AX_surfxml_bypassASroute_src;
+XBT_PUBLIC_DATA short int surfxml_bypassASroute_gw___src_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassASroute_src AX_surfxml_bypassASroute_src;
 #define A_surfxml_bypassASroute_src (surfxml_bufferstack + AX_surfxml_bypassASroute_src)
-XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassRoute_dst) AX_surfxml_bypassRoute_dst;
+XBT_PUBLIC_DATA short int surfxml_bypassASroute_src_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassRoute_dst AX_surfxml_bypassRoute_dst;
 #define A_surfxml_bypassRoute_dst (surfxml_bufferstack + AX_surfxml_bypassRoute_dst)
-XBT_PUBLIC_DATA(short int) surfxml_bypassRoute_dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassRoute_src) AX_surfxml_bypassRoute_src;
+XBT_PUBLIC_DATA short int surfxml_bypassRoute_dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassRoute_src AX_surfxml_bypassRoute_src;
 #define A_surfxml_bypassRoute_src (surfxml_bufferstack + AX_surfxml_bypassRoute_src)
-XBT_PUBLIC_DATA(short int) surfxml_bypassRoute_src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassZoneRoute_dst) AX_surfxml_bypassZoneRoute_dst;
+XBT_PUBLIC_DATA short int surfxml_bypassRoute_src_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassZoneRoute_dst AX_surfxml_bypassZoneRoute_dst;
 #define A_surfxml_bypassZoneRoute_dst (surfxml_bufferstack + AX_surfxml_bypassZoneRoute_dst)
-XBT_PUBLIC_DATA(short int) surfxml_bypassZoneRoute_dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassZoneRoute_gw___dst) AX_surfxml_bypassZoneRoute_gw___dst;
+XBT_PUBLIC_DATA short int surfxml_bypassZoneRoute_dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassZoneRoute_gw___dst AX_surfxml_bypassZoneRoute_gw___dst;
 #define A_surfxml_bypassZoneRoute_gw___dst (surfxml_bufferstack + AX_surfxml_bypassZoneRoute_gw___dst)
-XBT_PUBLIC_DATA(short int) surfxml_bypassZoneRoute_gw___dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassZoneRoute_gw___src) AX_surfxml_bypassZoneRoute_gw___src;
+XBT_PUBLIC_DATA short int surfxml_bypassZoneRoute_gw___dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassZoneRoute_gw___src AX_surfxml_bypassZoneRoute_gw___src;
 #define A_surfxml_bypassZoneRoute_gw___src (surfxml_bufferstack + AX_surfxml_bypassZoneRoute_gw___src)
-XBT_PUBLIC_DATA(short int) surfxml_bypassZoneRoute_gw___src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_bypassZoneRoute_src) AX_surfxml_bypassZoneRoute_src;
+XBT_PUBLIC_DATA short int surfxml_bypassZoneRoute_gw___src_isset;
+XBT_PUBLIC_DATA AT_surfxml_bypassZoneRoute_src AX_surfxml_bypassZoneRoute_src;
 #define A_surfxml_bypassZoneRoute_src (surfxml_bufferstack + AX_surfxml_bypassZoneRoute_src)
-XBT_PUBLIC_DATA(short int) surfxml_bypassZoneRoute_src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_bw) AX_surfxml_cabinet_bw;
+XBT_PUBLIC_DATA short int surfxml_bypassZoneRoute_src_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_bw AX_surfxml_cabinet_bw;
 #define A_surfxml_cabinet_bw (surfxml_bufferstack + AX_surfxml_cabinet_bw)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_bw_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_id) AX_surfxml_cabinet_id;
+XBT_PUBLIC_DATA short int surfxml_cabinet_bw_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_id AX_surfxml_cabinet_id;
 #define A_surfxml_cabinet_id (surfxml_bufferstack + AX_surfxml_cabinet_id)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_lat) AX_surfxml_cabinet_lat;
+XBT_PUBLIC_DATA short int surfxml_cabinet_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_lat AX_surfxml_cabinet_lat;
 #define A_surfxml_cabinet_lat (surfxml_bufferstack + AX_surfxml_cabinet_lat)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_lat_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_prefix) AX_surfxml_cabinet_prefix;
+XBT_PUBLIC_DATA short int surfxml_cabinet_lat_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_prefix AX_surfxml_cabinet_prefix;
 #define A_surfxml_cabinet_prefix (surfxml_bufferstack + AX_surfxml_cabinet_prefix)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_prefix_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_radical) AX_surfxml_cabinet_radical;
+XBT_PUBLIC_DATA short int surfxml_cabinet_prefix_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_radical AX_surfxml_cabinet_radical;
 #define A_surfxml_cabinet_radical (surfxml_bufferstack + AX_surfxml_cabinet_radical)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_radical_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_speed) AX_surfxml_cabinet_speed;
+XBT_PUBLIC_DATA short int surfxml_cabinet_radical_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_speed AX_surfxml_cabinet_speed;
 #define A_surfxml_cabinet_speed (surfxml_bufferstack + AX_surfxml_cabinet_speed)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_speed_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cabinet_suffix) AX_surfxml_cabinet_suffix;
+XBT_PUBLIC_DATA short int surfxml_cabinet_speed_isset;
+XBT_PUBLIC_DATA AT_surfxml_cabinet_suffix AX_surfxml_cabinet_suffix;
 #define A_surfxml_cabinet_suffix (surfxml_bufferstack + AX_surfxml_cabinet_suffix)
-XBT_PUBLIC_DATA(short int) surfxml_cabinet_suffix_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___bw) AX_surfxml_cluster_bb___bw;
+XBT_PUBLIC_DATA short int surfxml_cabinet_suffix_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_bb___bw AX_surfxml_cluster_bb___bw;
 #define A_surfxml_cluster_bb___bw (surfxml_bufferstack + AX_surfxml_cluster_bb___bw)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___bw_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___lat) AX_surfxml_cluster_bb___lat;
+XBT_PUBLIC_DATA short int surfxml_cluster_bb___bw_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_bb___lat AX_surfxml_cluster_bb___lat;
 #define A_surfxml_cluster_bb___lat (surfxml_bufferstack + AX_surfxml_cluster_bb___lat)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___lat_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___sharing___policy) AX_surfxml_cluster_bb___sharing___policy;
+XBT_PUBLIC_DATA short int surfxml_cluster_bb___lat_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy;
 #define A_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy
-XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___sharing___policy_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_bw) AX_surfxml_cluster_bw;
+XBT_PUBLIC_DATA short int surfxml_cluster_bb___sharing___policy_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_bw AX_surfxml_cluster_bw;
 #define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_bw_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_core) AX_surfxml_cluster_core;
+XBT_PUBLIC_DATA short int surfxml_cluster_bw_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_core AX_surfxml_cluster_core;
 #define A_surfxml_cluster_core (surfxml_bufferstack + AX_surfxml_cluster_core)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_core_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_id) AX_surfxml_cluster_id;
+XBT_PUBLIC_DATA short int surfxml_cluster_core_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_id AX_surfxml_cluster_id;
 #define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_lat) AX_surfxml_cluster_lat;
+XBT_PUBLIC_DATA short int surfxml_cluster_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_lat AX_surfxml_cluster_lat;
 #define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_lat_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_limiter___link) AX_surfxml_cluster_limiter___link;
+XBT_PUBLIC_DATA short int surfxml_cluster_lat_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_limiter___link AX_surfxml_cluster_limiter___link;
 #define A_surfxml_cluster_limiter___link (surfxml_bufferstack + AX_surfxml_cluster_limiter___link)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_limiter___link_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___bw) AX_surfxml_cluster_loopback___bw;
+XBT_PUBLIC_DATA short int surfxml_cluster_limiter___link_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_loopback___bw AX_surfxml_cluster_loopback___bw;
 #define A_surfxml_cluster_loopback___bw (surfxml_bufferstack + AX_surfxml_cluster_loopback___bw)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___bw_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___lat) AX_surfxml_cluster_loopback___lat;
+XBT_PUBLIC_DATA short int surfxml_cluster_loopback___bw_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_loopback___lat AX_surfxml_cluster_loopback___lat;
 #define A_surfxml_cluster_loopback___lat (surfxml_bufferstack + AX_surfxml_cluster_loopback___lat)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___lat_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_prefix) AX_surfxml_cluster_prefix;
+XBT_PUBLIC_DATA short int surfxml_cluster_loopback___lat_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_prefix AX_surfxml_cluster_prefix;
 #define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_prefix_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_radical) AX_surfxml_cluster_radical;
+XBT_PUBLIC_DATA short int surfxml_cluster_prefix_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_radical AX_surfxml_cluster_radical;
 #define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_radical_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_router___id) AX_surfxml_cluster_router___id;
+XBT_PUBLIC_DATA short int surfxml_cluster_radical_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_router___id AX_surfxml_cluster_router___id;
 #define A_surfxml_cluster_router___id (surfxml_bufferstack + AX_surfxml_cluster_router___id)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_router___id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_sharing___policy) AX_surfxml_cluster_sharing___policy;
+XBT_PUBLIC_DATA short int surfxml_cluster_router___id_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_sharing___policy AX_surfxml_cluster_sharing___policy;
 #define A_surfxml_cluster_sharing___policy AX_surfxml_cluster_sharing___policy
-XBT_PUBLIC_DATA(short int) surfxml_cluster_sharing___policy_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_speed) AX_surfxml_cluster_speed;
+XBT_PUBLIC_DATA short int surfxml_cluster_sharing___policy_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_speed AX_surfxml_cluster_speed;
 #define A_surfxml_cluster_speed (surfxml_bufferstack + AX_surfxml_cluster_speed)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_speed_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix) AX_surfxml_cluster_suffix;
+XBT_PUBLIC_DATA short int surfxml_cluster_speed_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_suffix AX_surfxml_cluster_suffix;
 #define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_suffix_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_topo___parameters) AX_surfxml_cluster_topo___parameters;
+XBT_PUBLIC_DATA short int surfxml_cluster_suffix_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_topo___parameters AX_surfxml_cluster_topo___parameters;
 #define A_surfxml_cluster_topo___parameters (surfxml_bufferstack + AX_surfxml_cluster_topo___parameters)
-XBT_PUBLIC_DATA(short int) surfxml_cluster_topo___parameters_isset;
-XBT_PUBLIC_DATA(AT_surfxml_cluster_topology) AX_surfxml_cluster_topology;
+XBT_PUBLIC_DATA short int surfxml_cluster_topo___parameters_isset;
+XBT_PUBLIC_DATA AT_surfxml_cluster_topology AX_surfxml_cluster_topology;
 #define A_surfxml_cluster_topology AX_surfxml_cluster_topology
-XBT_PUBLIC_DATA(short int) surfxml_cluster_topology_isset;
-XBT_PUBLIC_DATA(AT_surfxml_config_id) AX_surfxml_config_id;
+XBT_PUBLIC_DATA short int surfxml_cluster_topology_isset;
+XBT_PUBLIC_DATA AT_surfxml_config_id AX_surfxml_config_id;
 #define A_surfxml_config_id (surfxml_bufferstack + AX_surfxml_config_id)
-XBT_PUBLIC_DATA(short int) surfxml_config_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_availability___file) AX_surfxml_host_availability___file;
+XBT_PUBLIC_DATA short int surfxml_config_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_availability___file AX_surfxml_host_availability___file;
 #define A_surfxml_host_availability___file (surfxml_bufferstack + AX_surfxml_host_availability___file)
-XBT_PUBLIC_DATA(short int) surfxml_host_availability___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_coordinates) AX_surfxml_host_coordinates;
+XBT_PUBLIC_DATA short int surfxml_host_availability___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_coordinates AX_surfxml_host_coordinates;
 #define A_surfxml_host_coordinates (surfxml_bufferstack + AX_surfxml_host_coordinates)
-XBT_PUBLIC_DATA(short int) surfxml_host_coordinates_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_core) AX_surfxml_host_core;
+XBT_PUBLIC_DATA short int surfxml_host_coordinates_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_core AX_surfxml_host_core;
 #define A_surfxml_host_core (surfxml_bufferstack + AX_surfxml_host_core)
-XBT_PUBLIC_DATA(short int) surfxml_host_core_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_id) AX_surfxml_host_id;
+XBT_PUBLIC_DATA short int surfxml_host_core_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_id AX_surfxml_host_id;
 #define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id)
-XBT_PUBLIC_DATA(short int) surfxml_host_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_pstate) AX_surfxml_host_pstate;
+XBT_PUBLIC_DATA short int surfxml_host_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_pstate AX_surfxml_host_pstate;
 #define A_surfxml_host_pstate (surfxml_bufferstack + AX_surfxml_host_pstate)
-XBT_PUBLIC_DATA(short int) surfxml_host_pstate_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_speed) AX_surfxml_host_speed;
+XBT_PUBLIC_DATA short int surfxml_host_pstate_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_speed AX_surfxml_host_speed;
 #define A_surfxml_host_speed (surfxml_bufferstack + AX_surfxml_host_speed)
-XBT_PUBLIC_DATA(short int) surfxml_host_speed_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host_state___file) AX_surfxml_host_state___file;
+XBT_PUBLIC_DATA short int surfxml_host_speed_isset;
+XBT_PUBLIC_DATA AT_surfxml_host_state___file AX_surfxml_host_state___file;
 #define A_surfxml_host_state___file (surfxml_bufferstack + AX_surfxml_host_state___file)
-XBT_PUBLIC_DATA(short int) surfxml_host_state___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host___link_down) AX_surfxml_host___link_down;
+XBT_PUBLIC_DATA short int surfxml_host_state___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_host___link_down AX_surfxml_host___link_down;
 #define A_surfxml_host___link_down (surfxml_bufferstack + AX_surfxml_host___link_down)
-XBT_PUBLIC_DATA(short int) surfxml_host___link_down_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host___link_id) AX_surfxml_host___link_id;
+XBT_PUBLIC_DATA short int surfxml_host___link_down_isset;
+XBT_PUBLIC_DATA AT_surfxml_host___link_id AX_surfxml_host___link_id;
 #define A_surfxml_host___link_id (surfxml_bufferstack + AX_surfxml_host___link_id)
-XBT_PUBLIC_DATA(short int) surfxml_host___link_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_host___link_up) AX_surfxml_host___link_up;
+XBT_PUBLIC_DATA short int surfxml_host___link_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_host___link_up AX_surfxml_host___link_up;
 #define A_surfxml_host___link_up (surfxml_bufferstack + AX_surfxml_host___link_up)
-XBT_PUBLIC_DATA(short int) surfxml_host___link_up_isset;
-XBT_PUBLIC_DATA(AT_surfxml_include_file) AX_surfxml_include_file;
+XBT_PUBLIC_DATA short int surfxml_host___link_up_isset;
+XBT_PUBLIC_DATA AT_surfxml_include_file AX_surfxml_include_file;
 #define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file)
-XBT_PUBLIC_DATA(short int) surfxml_include_file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth) AX_surfxml_link_bandwidth;
+XBT_PUBLIC_DATA short int surfxml_include_file_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_bandwidth AX_surfxml_link_bandwidth;
 #define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth)
-XBT_PUBLIC_DATA(short int) surfxml_link_bandwidth_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth___file) AX_surfxml_link_bandwidth___file;
+XBT_PUBLIC_DATA short int surfxml_link_bandwidth_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_bandwidth___file AX_surfxml_link_bandwidth___file;
 #define A_surfxml_link_bandwidth___file (surfxml_bufferstack + AX_surfxml_link_bandwidth___file)
-XBT_PUBLIC_DATA(short int) surfxml_link_bandwidth___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_id) AX_surfxml_link_id;
+XBT_PUBLIC_DATA short int surfxml_link_bandwidth___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_id AX_surfxml_link_id;
 #define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id)
-XBT_PUBLIC_DATA(short int) surfxml_link_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_latency) AX_surfxml_link_latency;
+XBT_PUBLIC_DATA short int surfxml_link_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_latency AX_surfxml_link_latency;
 #define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency)
-XBT_PUBLIC_DATA(short int) surfxml_link_latency_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_latency___file) AX_surfxml_link_latency___file;
+XBT_PUBLIC_DATA short int surfxml_link_latency_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_latency___file AX_surfxml_link_latency___file;
 #define A_surfxml_link_latency___file (surfxml_bufferstack + AX_surfxml_link_latency___file)
-XBT_PUBLIC_DATA(short int) surfxml_link_latency___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_sharing___policy) AX_surfxml_link_sharing___policy;
+XBT_PUBLIC_DATA short int surfxml_link_latency___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy;
 #define A_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy
-XBT_PUBLIC_DATA(short int) surfxml_link_sharing___policy_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link_state___file) AX_surfxml_link_state___file;
+XBT_PUBLIC_DATA short int surfxml_link_sharing___policy_isset;
+XBT_PUBLIC_DATA AT_surfxml_link_state___file AX_surfxml_link_state___file;
 #define A_surfxml_link_state___file (surfxml_bufferstack + AX_surfxml_link_state___file)
-XBT_PUBLIC_DATA(short int) surfxml_link_state___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link___ctn_direction) AX_surfxml_link___ctn_direction;
+XBT_PUBLIC_DATA short int surfxml_link_state___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_link___ctn_direction AX_surfxml_link___ctn_direction;
 #define A_surfxml_link___ctn_direction AX_surfxml_link___ctn_direction
-XBT_PUBLIC_DATA(short int) surfxml_link___ctn_direction_isset;
-XBT_PUBLIC_DATA(AT_surfxml_link___ctn_id) AX_surfxml_link___ctn_id;
+XBT_PUBLIC_DATA short int surfxml_link___ctn_direction_isset;
+XBT_PUBLIC_DATA AT_surfxml_link___ctn_id AX_surfxml_link___ctn_id;
 #define A_surfxml_link___ctn_id (surfxml_bufferstack + AX_surfxml_link___ctn_id)
-XBT_PUBLIC_DATA(short int) surfxml_link___ctn_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_model___prop_id) AX_surfxml_model___prop_id;
+XBT_PUBLIC_DATA short int surfxml_link___ctn_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_model___prop_id AX_surfxml_model___prop_id;
 #define A_surfxml_model___prop_id (surfxml_bufferstack + AX_surfxml_model___prop_id)
-XBT_PUBLIC_DATA(short int) surfxml_model___prop_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_model___prop_value) AX_surfxml_model___prop_value;
+XBT_PUBLIC_DATA short int surfxml_model___prop_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_model___prop_value AX_surfxml_model___prop_value;
 #define A_surfxml_model___prop_value (surfxml_bufferstack + AX_surfxml_model___prop_value)
-XBT_PUBLIC_DATA(short int) surfxml_model___prop_value_isset;
-XBT_PUBLIC_DATA(AT_surfxml_mount_name) AX_surfxml_mount_name;
+XBT_PUBLIC_DATA short int surfxml_model___prop_value_isset;
+XBT_PUBLIC_DATA AT_surfxml_mount_name AX_surfxml_mount_name;
 #define A_surfxml_mount_name (surfxml_bufferstack + AX_surfxml_mount_name)
-XBT_PUBLIC_DATA(short int) surfxml_mount_name_isset;
-XBT_PUBLIC_DATA(AT_surfxml_mount_storageId) AX_surfxml_mount_storageId;
+XBT_PUBLIC_DATA short int surfxml_mount_name_isset;
+XBT_PUBLIC_DATA AT_surfxml_mount_storageId AX_surfxml_mount_storageId;
 #define A_surfxml_mount_storageId (surfxml_bufferstack + AX_surfxml_mount_storageId)
-XBT_PUBLIC_DATA(short int) surfxml_mount_storageId_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_availability___file) AX_surfxml_peer_availability___file;
+XBT_PUBLIC_DATA short int surfxml_mount_storageId_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_availability___file AX_surfxml_peer_availability___file;
 #define A_surfxml_peer_availability___file (surfxml_bufferstack + AX_surfxml_peer_availability___file)
-XBT_PUBLIC_DATA(short int) surfxml_peer_availability___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_bw___in) AX_surfxml_peer_bw___in;
+XBT_PUBLIC_DATA short int surfxml_peer_availability___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_bw___in AX_surfxml_peer_bw___in;
 #define A_surfxml_peer_bw___in (surfxml_bufferstack + AX_surfxml_peer_bw___in)
-XBT_PUBLIC_DATA(short int) surfxml_peer_bw___in_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_bw___out) AX_surfxml_peer_bw___out;
+XBT_PUBLIC_DATA short int surfxml_peer_bw___in_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_bw___out AX_surfxml_peer_bw___out;
 #define A_surfxml_peer_bw___out (surfxml_bufferstack + AX_surfxml_peer_bw___out)
-XBT_PUBLIC_DATA(short int) surfxml_peer_bw___out_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_coordinates) AX_surfxml_peer_coordinates;
+XBT_PUBLIC_DATA short int surfxml_peer_bw___out_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_coordinates AX_surfxml_peer_coordinates;
 #define A_surfxml_peer_coordinates (surfxml_bufferstack + AX_surfxml_peer_coordinates)
-XBT_PUBLIC_DATA(short int) surfxml_peer_coordinates_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_id) AX_surfxml_peer_id;
+XBT_PUBLIC_DATA short int surfxml_peer_coordinates_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_id AX_surfxml_peer_id;
 #define A_surfxml_peer_id (surfxml_bufferstack + AX_surfxml_peer_id)
-XBT_PUBLIC_DATA(short int) surfxml_peer_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_lat) AX_surfxml_peer_lat;
+XBT_PUBLIC_DATA short int surfxml_peer_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_lat AX_surfxml_peer_lat;
 #define A_surfxml_peer_lat (surfxml_bufferstack + AX_surfxml_peer_lat)
-XBT_PUBLIC_DATA(short int) surfxml_peer_lat_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_speed) AX_surfxml_peer_speed;
+XBT_PUBLIC_DATA short int surfxml_peer_lat_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_speed AX_surfxml_peer_speed;
 #define A_surfxml_peer_speed (surfxml_bufferstack + AX_surfxml_peer_speed)
-XBT_PUBLIC_DATA(short int) surfxml_peer_speed_isset;
-XBT_PUBLIC_DATA(AT_surfxml_peer_state___file) AX_surfxml_peer_state___file;
+XBT_PUBLIC_DATA short int surfxml_peer_speed_isset;
+XBT_PUBLIC_DATA AT_surfxml_peer_state___file AX_surfxml_peer_state___file;
 #define A_surfxml_peer_state___file (surfxml_bufferstack + AX_surfxml_peer_state___file)
-XBT_PUBLIC_DATA(short int) surfxml_peer_state___file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_platform_version) AX_surfxml_platform_version;
+XBT_PUBLIC_DATA short int surfxml_peer_state___file_isset;
+XBT_PUBLIC_DATA AT_surfxml_platform_version AX_surfxml_platform_version;
 #define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version)
-XBT_PUBLIC_DATA(short int) surfxml_platform_version_isset;
-XBT_PUBLIC_DATA(AT_surfxml_process_function) AX_surfxml_process_function;
+XBT_PUBLIC_DATA short int surfxml_platform_version_isset;
+XBT_PUBLIC_DATA AT_surfxml_process_function AX_surfxml_process_function;
 #define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function)
-XBT_PUBLIC_DATA(short int) surfxml_process_function_isset;
-XBT_PUBLIC_DATA(AT_surfxml_process_host) AX_surfxml_process_host;
+XBT_PUBLIC_DATA short int surfxml_process_function_isset;
+XBT_PUBLIC_DATA AT_surfxml_process_host AX_surfxml_process_host;
 #define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host)
-XBT_PUBLIC_DATA(short int) surfxml_process_host_isset;
-XBT_PUBLIC_DATA(AT_surfxml_process_kill___time) AX_surfxml_process_kill___time;
+XBT_PUBLIC_DATA short int surfxml_process_host_isset;
+XBT_PUBLIC_DATA AT_surfxml_process_kill___time AX_surfxml_process_kill___time;
 #define A_surfxml_process_kill___time (surfxml_bufferstack + AX_surfxml_process_kill___time)
-XBT_PUBLIC_DATA(short int) surfxml_process_kill___time_isset;
-XBT_PUBLIC_DATA(AT_surfxml_process_on___failure) AX_surfxml_process_on___failure;
+XBT_PUBLIC_DATA short int surfxml_process_kill___time_isset;
+XBT_PUBLIC_DATA AT_surfxml_process_on___failure AX_surfxml_process_on___failure;
 #define A_surfxml_process_on___failure AX_surfxml_process_on___failure
-XBT_PUBLIC_DATA(short int) surfxml_process_on___failure_isset;
-XBT_PUBLIC_DATA(AT_surfxml_process_start___time) AX_surfxml_process_start___time;
+XBT_PUBLIC_DATA short int surfxml_process_on___failure_isset;
+XBT_PUBLIC_DATA AT_surfxml_process_start___time AX_surfxml_process_start___time;
 #define A_surfxml_process_start___time (surfxml_bufferstack + AX_surfxml_process_start___time)
-XBT_PUBLIC_DATA(short int) surfxml_process_start___time_isset;
-XBT_PUBLIC_DATA(AT_surfxml_prop_id) AX_surfxml_prop_id;
+XBT_PUBLIC_DATA short int surfxml_process_start___time_isset;
+XBT_PUBLIC_DATA AT_surfxml_prop_id AX_surfxml_prop_id;
 #define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id)
-XBT_PUBLIC_DATA(short int) surfxml_prop_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_prop_value) AX_surfxml_prop_value;
+XBT_PUBLIC_DATA short int surfxml_prop_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_prop_value AX_surfxml_prop_value;
 #define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value)
-XBT_PUBLIC_DATA(short int) surfxml_prop_value_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_generator) AX_surfxml_random_generator;
+XBT_PUBLIC_DATA short int surfxml_prop_value_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_generator AX_surfxml_random_generator;
 #define A_surfxml_random_generator AX_surfxml_random_generator
-XBT_PUBLIC_DATA(short int) surfxml_random_generator_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_id) AX_surfxml_random_id;
+XBT_PUBLIC_DATA short int surfxml_random_generator_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_id AX_surfxml_random_id;
 #define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id)
-XBT_PUBLIC_DATA(short int) surfxml_random_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_max) AX_surfxml_random_max;
+XBT_PUBLIC_DATA short int surfxml_random_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_max AX_surfxml_random_max;
 #define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max)
-XBT_PUBLIC_DATA(short int) surfxml_random_max_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_mean) AX_surfxml_random_mean;
+XBT_PUBLIC_DATA short int surfxml_random_max_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_mean AX_surfxml_random_mean;
 #define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean)
-XBT_PUBLIC_DATA(short int) surfxml_random_mean_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_min) AX_surfxml_random_min;
+XBT_PUBLIC_DATA short int surfxml_random_mean_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_min AX_surfxml_random_min;
 #define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min)
-XBT_PUBLIC_DATA(short int) surfxml_random_min_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_radical) AX_surfxml_random_radical;
+XBT_PUBLIC_DATA short int surfxml_random_min_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_radical AX_surfxml_random_radical;
 #define A_surfxml_random_radical (surfxml_bufferstack + AX_surfxml_random_radical)
-XBT_PUBLIC_DATA(short int) surfxml_random_radical_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_seed) AX_surfxml_random_seed;
+XBT_PUBLIC_DATA short int surfxml_random_radical_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_seed AX_surfxml_random_seed;
 #define A_surfxml_random_seed (surfxml_bufferstack + AX_surfxml_random_seed)
-XBT_PUBLIC_DATA(short int) surfxml_random_seed_isset;
-XBT_PUBLIC_DATA(AT_surfxml_random_std___deviation) AX_surfxml_random_std___deviation;
+XBT_PUBLIC_DATA short int surfxml_random_seed_isset;
+XBT_PUBLIC_DATA AT_surfxml_random_std___deviation AX_surfxml_random_std___deviation;
 #define A_surfxml_random_std___deviation (surfxml_bufferstack + AX_surfxml_random_std___deviation)
-XBT_PUBLIC_DATA(short int) surfxml_random_std___deviation_isset;
-XBT_PUBLIC_DATA(AT_surfxml_route_dst) AX_surfxml_route_dst;
+XBT_PUBLIC_DATA short int surfxml_random_std___deviation_isset;
+XBT_PUBLIC_DATA AT_surfxml_route_dst AX_surfxml_route_dst;
 #define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst)
-XBT_PUBLIC_DATA(short int) surfxml_route_dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_route_src) AX_surfxml_route_src;
+XBT_PUBLIC_DATA short int surfxml_route_dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_route_src AX_surfxml_route_src;
 #define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src)
-XBT_PUBLIC_DATA(short int) surfxml_route_src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_route_symmetrical) AX_surfxml_route_symmetrical;
+XBT_PUBLIC_DATA short int surfxml_route_src_isset;
+XBT_PUBLIC_DATA AT_surfxml_route_symmetrical AX_surfxml_route_symmetrical;
 #define A_surfxml_route_symmetrical AX_surfxml_route_symmetrical
-XBT_PUBLIC_DATA(short int) surfxml_route_symmetrical_isset;
-XBT_PUBLIC_DATA(AT_surfxml_router_coordinates) AX_surfxml_router_coordinates;
+XBT_PUBLIC_DATA short int surfxml_route_symmetrical_isset;
+XBT_PUBLIC_DATA AT_surfxml_router_coordinates AX_surfxml_router_coordinates;
 #define A_surfxml_router_coordinates (surfxml_bufferstack + AX_surfxml_router_coordinates)
-XBT_PUBLIC_DATA(short int) surfxml_router_coordinates_isset;
-XBT_PUBLIC_DATA(AT_surfxml_router_id) AX_surfxml_router_id;
+XBT_PUBLIC_DATA short int surfxml_router_coordinates_isset;
+XBT_PUBLIC_DATA AT_surfxml_router_id AX_surfxml_router_id;
 #define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id)
-XBT_PUBLIC_DATA(short int) surfxml_router_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage_attach) AX_surfxml_storage_attach;
+XBT_PUBLIC_DATA short int surfxml_router_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage_attach AX_surfxml_storage_attach;
 #define A_surfxml_storage_attach (surfxml_bufferstack + AX_surfxml_storage_attach)
-XBT_PUBLIC_DATA(short int) surfxml_storage_attach_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage_content) AX_surfxml_storage_content;
+XBT_PUBLIC_DATA short int surfxml_storage_attach_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage_content AX_surfxml_storage_content;
 #define A_surfxml_storage_content (surfxml_bufferstack + AX_surfxml_storage_content)
-XBT_PUBLIC_DATA(short int) surfxml_storage_content_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage_id) AX_surfxml_storage_id;
+XBT_PUBLIC_DATA short int surfxml_storage_content_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage_id AX_surfxml_storage_id;
 #define A_surfxml_storage_id (surfxml_bufferstack + AX_surfxml_storage_id)
-XBT_PUBLIC_DATA(short int) surfxml_storage_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage_typeId) AX_surfxml_storage_typeId;
+XBT_PUBLIC_DATA short int surfxml_storage_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage_typeId AX_surfxml_storage_typeId;
 #define A_surfxml_storage_typeId (surfxml_bufferstack + AX_surfxml_storage_typeId)
-XBT_PUBLIC_DATA(short int) surfxml_storage_typeId_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage___type_content) AX_surfxml_storage___type_content;
+XBT_PUBLIC_DATA short int surfxml_storage_typeId_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage___type_content AX_surfxml_storage___type_content;
 #define A_surfxml_storage___type_content (surfxml_bufferstack + AX_surfxml_storage___type_content)
-XBT_PUBLIC_DATA(short int) surfxml_storage___type_content_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage___type_id) AX_surfxml_storage___type_id;
+XBT_PUBLIC_DATA short int surfxml_storage___type_content_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage___type_id AX_surfxml_storage___type_id;
 #define A_surfxml_storage___type_id (surfxml_bufferstack + AX_surfxml_storage___type_id)
-XBT_PUBLIC_DATA(short int) surfxml_storage___type_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage___type_model) AX_surfxml_storage___type_model;
+XBT_PUBLIC_DATA short int surfxml_storage___type_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage___type_model AX_surfxml_storage___type_model;
 #define A_surfxml_storage___type_model (surfxml_bufferstack + AX_surfxml_storage___type_model)
-XBT_PUBLIC_DATA(short int) surfxml_storage___type_model_isset;
-XBT_PUBLIC_DATA(AT_surfxml_storage___type_size) AX_surfxml_storage___type_size;
+XBT_PUBLIC_DATA short int surfxml_storage___type_model_isset;
+XBT_PUBLIC_DATA AT_surfxml_storage___type_size AX_surfxml_storage___type_size;
 #define A_surfxml_storage___type_size (surfxml_bufferstack + AX_surfxml_storage___type_size)
-XBT_PUBLIC_DATA(short int) surfxml_storage___type_size_isset;
-XBT_PUBLIC_DATA(AT_surfxml_trace_file) AX_surfxml_trace_file;
+XBT_PUBLIC_DATA short int surfxml_storage___type_size_isset;
+XBT_PUBLIC_DATA AT_surfxml_trace_file AX_surfxml_trace_file;
 #define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file)
-XBT_PUBLIC_DATA(short int) surfxml_trace_file_isset;
-XBT_PUBLIC_DATA(AT_surfxml_trace_id) AX_surfxml_trace_id;
+XBT_PUBLIC_DATA short int surfxml_trace_file_isset;
+XBT_PUBLIC_DATA AT_surfxml_trace_id AX_surfxml_trace_id;
 #define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id)
-XBT_PUBLIC_DATA(short int) surfxml_trace_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity) AX_surfxml_trace_periodicity;
+XBT_PUBLIC_DATA short int surfxml_trace_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_trace_periodicity AX_surfxml_trace_periodicity;
 #define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity)
-XBT_PUBLIC_DATA(short int) surfxml_trace_periodicity_isset;
-XBT_PUBLIC_DATA(AT_surfxml_trace___connect_element) AX_surfxml_trace___connect_element;
+XBT_PUBLIC_DATA short int surfxml_trace_periodicity_isset;
+XBT_PUBLIC_DATA AT_surfxml_trace___connect_element AX_surfxml_trace___connect_element;
 #define A_surfxml_trace___connect_element (surfxml_bufferstack + AX_surfxml_trace___connect_element)
-XBT_PUBLIC_DATA(short int) surfxml_trace___connect_element_isset;
-XBT_PUBLIC_DATA(AT_surfxml_trace___connect_kind) AX_surfxml_trace___connect_kind;
+XBT_PUBLIC_DATA short int surfxml_trace___connect_element_isset;
+XBT_PUBLIC_DATA AT_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind;
 #define A_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind
-XBT_PUBLIC_DATA(short int) surfxml_trace___connect_kind_isset;
-XBT_PUBLIC_DATA(AT_surfxml_trace___connect_trace) AX_surfxml_trace___connect_trace;
+XBT_PUBLIC_DATA short int surfxml_trace___connect_kind_isset;
+XBT_PUBLIC_DATA AT_surfxml_trace___connect_trace AX_surfxml_trace___connect_trace;
 #define A_surfxml_trace___connect_trace (surfxml_bufferstack + AX_surfxml_trace___connect_trace)
-XBT_PUBLIC_DATA(short int) surfxml_trace___connect_trace_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zone_id) AX_surfxml_zone_id;
+XBT_PUBLIC_DATA short int surfxml_trace___connect_trace_isset;
+XBT_PUBLIC_DATA AT_surfxml_zone_id AX_surfxml_zone_id;
 #define A_surfxml_zone_id (surfxml_bufferstack + AX_surfxml_zone_id)
-XBT_PUBLIC_DATA(short int) surfxml_zone_id_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zone_routing) AX_surfxml_zone_routing;
+XBT_PUBLIC_DATA short int surfxml_zone_id_isset;
+XBT_PUBLIC_DATA AT_surfxml_zone_routing AX_surfxml_zone_routing;
 #define A_surfxml_zone_routing AX_surfxml_zone_routing
-XBT_PUBLIC_DATA(short int) surfxml_zone_routing_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zoneRoute_dst) AX_surfxml_zoneRoute_dst;
+XBT_PUBLIC_DATA short int surfxml_zone_routing_isset;
+XBT_PUBLIC_DATA AT_surfxml_zoneRoute_dst AX_surfxml_zoneRoute_dst;
 #define A_surfxml_zoneRoute_dst (surfxml_bufferstack + AX_surfxml_zoneRoute_dst)
-XBT_PUBLIC_DATA(short int) surfxml_zoneRoute_dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zoneRoute_gw___dst) AX_surfxml_zoneRoute_gw___dst;
+XBT_PUBLIC_DATA short int surfxml_zoneRoute_dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_zoneRoute_gw___dst AX_surfxml_zoneRoute_gw___dst;
 #define A_surfxml_zoneRoute_gw___dst (surfxml_bufferstack + AX_surfxml_zoneRoute_gw___dst)
-XBT_PUBLIC_DATA(short int) surfxml_zoneRoute_gw___dst_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zoneRoute_gw___src) AX_surfxml_zoneRoute_gw___src;
+XBT_PUBLIC_DATA short int surfxml_zoneRoute_gw___dst_isset;
+XBT_PUBLIC_DATA AT_surfxml_zoneRoute_gw___src AX_surfxml_zoneRoute_gw___src;
 #define A_surfxml_zoneRoute_gw___src (surfxml_bufferstack + AX_surfxml_zoneRoute_gw___src)
-XBT_PUBLIC_DATA(short int) surfxml_zoneRoute_gw___src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zoneRoute_src) AX_surfxml_zoneRoute_src;
+XBT_PUBLIC_DATA short int surfxml_zoneRoute_gw___src_isset;
+XBT_PUBLIC_DATA AT_surfxml_zoneRoute_src AX_surfxml_zoneRoute_src;
 #define A_surfxml_zoneRoute_src (surfxml_bufferstack + AX_surfxml_zoneRoute_src)
-XBT_PUBLIC_DATA(short int) surfxml_zoneRoute_src_isset;
-XBT_PUBLIC_DATA(AT_surfxml_zoneRoute_symmetrical) AX_surfxml_zoneRoute_symmetrical;
+XBT_PUBLIC_DATA short int surfxml_zoneRoute_src_isset;
+XBT_PUBLIC_DATA AT_surfxml_zoneRoute_symmetrical AX_surfxml_zoneRoute_symmetrical;
 #define A_surfxml_zoneRoute_symmetrical AX_surfxml_zoneRoute_symmetrical
-XBT_PUBLIC_DATA(short int) surfxml_zoneRoute_symmetrical_isset;
+XBT_PUBLIC_DATA short int surfxml_zoneRoute_symmetrical_isset;
 
 /* XML application utilities. */
-XBT_PUBLIC(int) surfxml_element_context(int);
+XBT_PUBLIC int surfxml_element_context(int);
 
 /* XML processor entry point. */
-XBT_PUBLIC(int) yylex(void);
+XBT_PUBLIC int yylex(void);
 
 /* Flexml error handling function (useful only when -q flag passed to flexml) */
 const char * surfxml_parse_err_msg(void);
index ddcc677..d287f06 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2006-2018. 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 "src/surf/xml/platf_private.hpp"
 
 #if SIMGRID_HAVE_LUA
-extern "C" {
 #include "src/bindings/lua/simgrid_lua.hpp"
 
 #include <lua.h>                /* Always include this when calling Lua */
 #include <lauxlib.h>            /* Always include this when calling Lua */
 #include <lualib.h>             /* Prototype for luaL_openlibs(), */
-}
 #endif
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
@@ -33,27 +30,26 @@ XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link
 XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_bw;
 XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_lat;
 
-extern "C" {
-void sg_platf_trace_connect(TraceConnectCreationArgs* trace_connect)
+void sg_platf_trace_connect(simgrid::kernel::routing::TraceConnectCreationArgs* trace_connect)
 {
   xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
              "Cannot connect trace %s to %s: trace unknown", trace_connect->trace.c_str(),
              trace_connect->element.c_str());
 
   switch (trace_connect->kind) {
-    case TraceConnectKind::HOST_AVAIL:
+    case simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL:
       trace_connect_list_host_avail.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::SPEED:
+    case simgrid::kernel::routing::TraceConnectKind::SPEED:
       trace_connect_list_host_speed.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::LINK_AVAIL:
+    case simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL:
       trace_connect_list_link_avail.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::BANDWIDTH:
+    case simgrid::kernel::routing::TraceConnectKind::BANDWIDTH:
       trace_connect_list_link_bw.insert({trace_connect->trace, trace_connect->element});
       break;
-    case TraceConnectKind::LATENCY:
+    case simgrid::kernel::routing::TraceConnectKind::LATENCY:
       trace_connect_list_link_lat.insert({trace_connect->trace, trace_connect->element});
       break;
     default:
@@ -170,4 +166,3 @@ void parse_platform_file(const char *file)
   if (parse_status)
     surf_parse_error(std::string("Parse error in ") + file);
 }
-}
index d3a1168..73d9c14 100644 (file)
@@ -1,11 +1,11 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. 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/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
-#include "simgrid/sg_config.h"
-#include "src/kernel/routing/NetPoint.hpp"
+#include "simgrid/sg_config.hpp"
 #include "src/surf/network_interface.hpp"
 #include "xbt/file.hpp"
 
@@ -21,8 +21,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
 
-extern "C" {
-
 #include "simgrid_dtd.c"
 
 static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
@@ -100,7 +98,6 @@ int surf_parse_get_int(std::string s)
     return -1;
   }
 }
-}
 
 namespace {
 
@@ -199,8 +196,6 @@ double surf_parse_get_value_with_unit(const char* string, const unit_scale& unit
 }
 }
 
-extern "C" {
-
 double surf_parse_get_time(const char* string, const char* entity_kind, std::string name)
 {
   static const unit_scale units{std::make_pair("w", 7 * 24 * 60 * 60),
@@ -284,7 +279,7 @@ void STag_surfxml_storage()
 
 void ETag_surfxml_storage()
 {
-  StorageCreationArgs storage;
+  simgrid::kernel::routing::StorageCreationArgs storage;
 
   storage.properties   = current_property_set;
   current_property_set = nullptr;
@@ -305,7 +300,7 @@ void STag_surfxml_storage___type()
 }
 void ETag_surfxml_storage___type()
 {
-  StorageTypeCreationArgs storage_type;
+  simgrid::kernel::routing::StorageTypeCreationArgs storage_type;
 
   storage_type.properties = current_property_set;
   current_property_set    = nullptr;
@@ -328,7 +323,7 @@ void STag_surfxml_mount()
 
 void ETag_surfxml_mount()
 {
-  MountCreationArgs mount;
+  simgrid::kernel::routing::MountCreationArgs mount;
 
   mount.name      = A_surfxml_mount_name;
   mount.storageId = A_surfxml_mount_storageId;
@@ -383,7 +378,7 @@ void STag_surfxml_platform() {
   if (version < 4.1) {
     XBT_INFO("You're using a v%.1f XML file (%s) while the current standard is v4.1 "
              "That's fine, the new version is backward compatible. \n\n"
-             "Use simgrid_update_xml to update your file automatically to get ride of this warning. "
+             "Use simgrid_update_xml to update your file automatically to get rid of this warning. "
              "This program is installed automatically with SimGrid, or "
              "available in the tools/ directory of the source archive.",
              version, surf_parsed_filename);
@@ -421,7 +416,7 @@ void STag_surfxml_prop()
 }
 
 void ETag_surfxml_host()    {
-  s_sg_platf_host_cbarg_t host;
+  simgrid::kernel::routing::HostCreationArgs host;
 
   host.properties = current_property_set;
   current_property_set = nullptr;
@@ -442,7 +437,7 @@ void ETag_surfxml_host()    {
 
 void STag_surfxml_host___link(){
   XBT_DEBUG("Create a Host_link for %s",A_surfxml_host___link_id);
-  HostLinkCreationArgs host_link;
+  simgrid::kernel::routing::HostLinkCreationArgs host_link;
 
   host_link.id        = A_surfxml_host___link_id;
   host_link.link_up   = A_surfxml_host___link_up;
@@ -455,7 +450,7 @@ void STag_surfxml_router(){
 }
 
 void ETag_surfxml_cluster(){
-  ClusterCreationArgs cluster;
+  simgrid::kernel::routing::ClusterCreationArgs cluster;
   cluster.properties   = current_property_set;
   current_property_set = nullptr;
 
@@ -480,16 +475,16 @@ void ETag_surfxml_cluster(){
 
   switch(AX_surfxml_cluster_topology){
   case A_surfxml_cluster_topology_FLAT:
-    cluster.topology = ClusterTopology::FLAT;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::FLAT;
     break;
   case A_surfxml_cluster_topology_TORUS:
-    cluster.topology = ClusterTopology::TORUS;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::TORUS;
     break;
   case A_surfxml_cluster_topology_FAT___TREE:
-    cluster.topology = ClusterTopology::FAT_TREE;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::FAT_TREE;
     break;
   case A_surfxml_cluster_topology_DRAGONFLY:
-    cluster.topology = ClusterTopology::DRAGONFLY;
+    cluster.topology = simgrid::kernel::routing::ClusterTopology::DRAGONFLY;
     break;
   default:
     surf_parse_error(std::string("Invalid cluster topology for cluster ") + cluster.id);
@@ -539,7 +534,7 @@ void STag_surfxml_cluster(){
 
 void STag_surfxml_cabinet(){
   parse_after_config();
-  CabinetCreationArgs cabinet;
+  simgrid::kernel::routing::CabinetCreationArgs cabinet;
   cabinet.id      = A_surfxml_cabinet_id;
   cabinet.prefix  = A_surfxml_cabinet_prefix;
   cabinet.suffix  = A_surfxml_cabinet_suffix;
@@ -553,7 +548,7 @@ void STag_surfxml_cabinet(){
 
 void STag_surfxml_peer(){
   parse_after_config();
-  PeerCreationArgs peer;
+  simgrid::kernel::routing::PeerCreationArgs peer;
 
   peer.id          = std::string(A_surfxml_peer_id);
   peer.speed       = surf_parse_get_speed(A_surfxml_peer_speed, "speed of peer", peer.id.c_str());
@@ -576,7 +571,7 @@ void STag_surfxml_link(){
 }
 
 void ETag_surfxml_link(){
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   link.properties          = current_property_set;
   current_property_set     = nullptr;
@@ -645,7 +640,7 @@ void STag_surfxml_link___ctn()
 }
 
 void ETag_surfxml_backbone(){
-  LinkCreationArgs link;
+  simgrid::kernel::routing::LinkCreationArgs link;
 
   link.properties = nullptr;
   link.id = std::string(A_surfxml_backbone_id);
@@ -695,7 +690,7 @@ void STag_surfxml_bypassZoneRoute(){
 }
 
 void ETag_surfxml_route(){
-  RouteCreationArgs route;
+  simgrid::kernel::routing::RouteCreationArgs route;
 
   route.src         = sg_netpoint_by_name_or_null(A_surfxml_route_src); // tested to not be nullptr in start tag
   route.dst         = sg_netpoint_by_name_or_null(A_surfxml_route_dst); // tested to not be nullptr in start tag
@@ -719,7 +714,7 @@ void ETag_surfxml_ASroute()
 }
 void ETag_surfxml_zoneRoute()
 {
-  RouteCreationArgs ASroute;
+  simgrid::kernel::routing::RouteCreationArgs ASroute;
 
   ASroute.src = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_src); // tested to not be nullptr in start tag
   ASroute.dst = sg_netpoint_by_name_or_null(A_surfxml_zoneRoute_dst); // tested to not be nullptr in start tag
@@ -745,7 +740,7 @@ void ETag_surfxml_zoneRoute()
 }
 
 void ETag_surfxml_bypassRoute(){
-  RouteCreationArgs route;
+  simgrid::kernel::routing::RouteCreationArgs route;
 
   route.src         = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_src); // tested to not be nullptr in start tag
   route.dst         = sg_netpoint_by_name_or_null(A_surfxml_bypassRoute_dst); // tested to not be nullptr in start tag
@@ -768,7 +763,7 @@ void ETag_surfxml_bypassASroute()
 }
 void ETag_surfxml_bypassZoneRoute()
 {
-  RouteCreationArgs ASroute;
+  simgrid::kernel::routing::RouteCreationArgs ASroute;
 
   ASroute.src         = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_src);
   ASroute.dst         = sg_netpoint_by_name_or_null(A_surfxml_bypassZoneRoute_dst);
@@ -783,7 +778,7 @@ void ETag_surfxml_bypassZoneRoute()
 }
 
 void ETag_surfxml_trace(){
-  TraceCreationArgs trace;
+  simgrid::kernel::routing::TraceCreationArgs trace;
 
   trace.id = A_surfxml_trace_id;
   trace.file = A_surfxml_trace_file;
@@ -796,7 +791,7 @@ void ETag_surfxml_trace(){
 void STag_surfxml_trace___connect()
 {
   parse_after_config();
-  TraceConnectCreationArgs trace_connect;
+  simgrid::kernel::routing::TraceConnectCreationArgs trace_connect;
 
   trace_connect.element = A_surfxml_trace___connect_element;
   trace_connect.trace = A_surfxml_trace___connect_trace;
@@ -804,19 +799,19 @@ void STag_surfxml_trace___connect()
   switch (A_surfxml_trace___connect_kind) {
   case AU_surfxml_trace___connect_kind:
   case A_surfxml_trace___connect_kind_SPEED:
-    trace_connect.kind = TraceConnectKind::SPEED;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::SPEED;
     break;
   case A_surfxml_trace___connect_kind_BANDWIDTH:
-    trace_connect.kind = TraceConnectKind::BANDWIDTH;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::BANDWIDTH;
     break;
   case A_surfxml_trace___connect_kind_HOST___AVAIL:
-    trace_connect.kind = TraceConnectKind::HOST_AVAIL;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL;
     break;
   case A_surfxml_trace___connect_kind_LATENCY:
-    trace_connect.kind = TraceConnectKind::LATENCY;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LATENCY;
     break;
   case A_surfxml_trace___connect_kind_LINK___AVAIL:
-    trace_connect.kind = TraceConnectKind::LINK_AVAIL;
+    trace_connect.kind = simgrid::kernel::routing::TraceConnectKind::LINK_AVAIL;
     break;
   default:
     surf_parse_error("Invalid trace kind");
@@ -841,7 +836,7 @@ void STag_surfxml_zone()
 {
   parse_after_config();
   ZONE_TAG                 = 1;
-  ZoneCreationArgs zone;
+  simgrid::kernel::routing::ZoneCreationArgs zone;
   zone.id      = A_surfxml_zone_id;
   zone.routing = static_cast<int>(A_surfxml_zone_routing);
 
@@ -907,7 +902,7 @@ void ETag_surfxml_process()
 
 void ETag_surfxml_actor()
 {
-  ActorCreationArgs actor;
+  simgrid::kernel::routing::ActorCreationArgs actor;
 
   actor.properties     = current_property_set;
   current_property_set = nullptr;
@@ -921,10 +916,10 @@ void ETag_surfxml_actor()
   switch (A_surfxml_actor_on___failure) {
   case AU_surfxml_actor_on___failure:
   case A_surfxml_actor_on___failure_DIE:
-    actor.on_failure = ActorOnFailure::DIE;
+    actor.on_failure = simgrid::kernel::routing::ActorOnFailure::DIE;
     break;
   case A_surfxml_actor_on___failure_RESTART:
-    actor.on_failure = ActorOnFailure::RESTART;
+    actor.on_failure = simgrid::kernel::routing::ActorOnFailure::RESTART;
     break;
   default:
     surf_parse_error("Invalid on failure behavior");
@@ -994,4 +989,3 @@ int surf_parse()
 {
   return surf_parse_lex();
 }
-}
index 9fde6ed..377992a 100644 (file)
@@ -1,6 +1,6 @@
 /* automaton - representation of büchi automaton */
 
-/* Copyright (c) 2011-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2011-2018. 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. */
@@ -212,7 +212,9 @@ static int call_simple_function(void* function)
   return ((int (*)(void)) function)();
 }
 
-xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new(xbt_automaton_t a, const char* id, int(*fct)(void)){
+xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new(xbt_automaton_t a, const char* id,
+                                                                            int (*fct)(void))
+{
   xbt_automaton_propositional_symbol_t prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
   prop_symb->pred = xbt_strdup(id);
   prop_symb->callback                            = &call_simple_function;
@@ -222,7 +224,9 @@ xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new(xbt_
   return prop_symb;
 }
 
-XBT_PUBLIC(xbt_automaton_propositional_symbol_t) xbt_automaton_propositional_symbol_new_pointer(xbt_automaton_t a, const char* id, int* value)
+XBT_PUBLIC xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new_pointer(xbt_automaton_t a,
+                                                                                               const char* id,
+                                                                                               int* value)
 {
   xbt_automaton_propositional_symbol_t prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
   prop_symb->pred = xbt_strdup(id);
@@ -233,10 +237,9 @@ XBT_PUBLIC(xbt_automaton_propositional_symbol_t) xbt_automaton_propositional_sym
   return prop_symb;
 }
 
-XBT_PUBLIC(xbt_automaton_propositional_symbol_t) xbt_automaton_propositional_symbol_new_callback(
-  xbt_automaton_t a, const char* id,
-  xbt_automaton_propositional_symbol_callback_type callback,
-  void* data, xbt_automaton_propositional_symbol_free_function_type free_function)
+XBT_PUBLIC xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new_callback(
+    xbt_automaton_t a, const char* id, xbt_automaton_propositional_symbol_callback_type callback, void* data,
+    xbt_automaton_propositional_symbol_free_function_type free_function)
 {
   xbt_automaton_propositional_symbol_t prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
   prop_symb->pred = xbt_strdup(id);
@@ -247,7 +250,7 @@ XBT_PUBLIC(xbt_automaton_propositional_symbol_t) xbt_automaton_propositional_sym
   return prop_symb;
 }
 
-XBT_PUBLIC(int) xbt_automaton_propositional_symbol_evaluate(xbt_automaton_propositional_symbol_t symbol)
+XBT_PUBLIC int xbt_automaton_propositional_symbol_evaluate(xbt_automaton_propositional_symbol_t symbol)
 {
   if (symbol->callback)
     return (symbol->callback)(symbol->data);
@@ -255,17 +258,18 @@ XBT_PUBLIC(int) xbt_automaton_propositional_symbol_evaluate(xbt_automaton_propos
     return *(int*) symbol->data;
 }
 
-XBT_PUBLIC(xbt_automaton_propositional_symbol_callback_type) xbt_automaton_propositional_symbol_get_callback(xbt_automaton_propositional_symbol_t symbol)
+XBT_PUBLIC xbt_automaton_propositional_symbol_callback_type
+xbt_automaton_propositional_symbol_get_callback(xbt_automaton_propositional_symbol_t symbol)
 {
   return symbol->callback;
 }
 
-XBT_PUBLIC(void*) xbt_automaton_propositional_symbol_get_data(xbt_automaton_propositional_symbol_t symbol)
+XBT_PUBLIC void* xbt_automaton_propositional_symbol_get_data(xbt_automaton_propositional_symbol_t symbol)
 {
   return symbol->data;
 }
 
-XBT_PUBLIC(const char*) xbt_automaton_propositional_symbol_get_name(xbt_automaton_propositional_symbol_t symbol)
+XBT_PUBLIC const char* xbt_automaton_propositional_symbol_get_name(xbt_automaton_propositional_symbol_t symbol)
 {
   return symbol->pred;
 }
index 022ae52..c05076a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2005-2018. 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 "src/internal_config.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
 
-}
-
 static bool startWith(std::string str, const char* prefix)
 {
   return strncmp(str.c_str(), prefix, strlen(prefix)) == 0;
index cb26929..16c47dc 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.     */
+/* Copyright (c) 2004-2018. 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 <typeinfo>
 #include <vector>
 
-#include <xbt/ex.hpp>
-#include <xbt/config.h>
-#include <xbt/config.hpp>
+#include "simgrid/sg_config.hpp"
+#include "xbt/dynar.h"
+#include "xbt/log.h"
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
-#include "xbt/log.h"
-#include "xbt/dynar.h"
+#include <xbt/config.h>
+#include <xbt/config.hpp>
+#include <xbt/ex.hpp>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
 
-XBT_EXPORT_NO_IMPORT(xbt_cfg_t) simgrid_config = nullptr;
-extern "C" {
-  XBT_PUBLIC(void) sg_config_finalize();
-}
+XBT_EXPORT_NO_IMPORT xbt_cfg_t simgrid_config = nullptr;
 
 namespace simgrid {
 namespace config {
@@ -379,16 +377,15 @@ void Config::help()
 
 // ***** getConfig *****
 
-template<class T>
-XBT_PUBLIC(T const&) getConfig(const char* name)
+template <class T> XBT_PUBLIC T const& getConfig(const char* name)
 {
   return (*simgrid_config)[name].getValue<T>();
 }
 
-template XBT_PUBLIC(int const&) getConfig<int>(const char* name);
-template XBT_PUBLIC(double const&) getConfig<double>(const char* name);
-template XBT_PUBLIC(bool const&) getConfig<bool>(const char* name);
-template XBT_PUBLIC(std::string const&) getConfig<std::string>(const char* name);
+template XBT_PUBLIC int const& getConfig<int>(const char* name);
+template XBT_PUBLIC double const& getConfig<double>(const char* name);
+template XBT_PUBLIC bool const& getConfig<bool>(const char* name);
+template XBT_PUBLIC std::string const& getConfig<std::string>(const char* name);
 
 // ***** alias *****
 
@@ -399,33 +396,33 @@ void alias(const char* realname, const char* aliasname)
 
 // ***** declareFlag *****
 
-template<class T>
-XBT_PUBLIC(void) declareFlag(const char* name, const char* description,
-  T value, std::function<void(const T&)> callback)
+template <class T>
+XBT_PUBLIC void declareFlag(const char* name, const char* description, T value, std::function<void(const T&)> callback)
 {
-  if (simgrid_config == nullptr) {
+  if (simgrid_config == nullptr)
     simgrid_config = xbt_cfg_new();
-    atexit(sg_config_finalize);
-  }
   simgrid_config->registerOption<T>(
     name, description, std::move(value), std::move(callback));
 }
 
-template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, int value, std::function<void(int const &)> callback);
-template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, double value, std::function<void(double const &)> callback);
-template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, bool value, std::function<void(bool const &)> callback);
-template XBT_PUBLIC(void) declareFlag(const char* name,
-  const char* description, std::string value, std::function<void(std::string const &)> callback);
-
+template XBT_PUBLIC void declareFlag(const char* name, const char* description, int value,
+                                     std::function<void(int const&)> callback);
+template XBT_PUBLIC void declareFlag(const char* name, const char* description, double value,
+                                     std::function<void(double const&)> callback);
+template XBT_PUBLIC void declareFlag(const char* name, const char* description, bool value,
+                                     std::function<void(bool const&)> callback);
+template XBT_PUBLIC void declareFlag(const char* name, const char* description, std::string value,
+                                     std::function<void(std::string const&)> callback);
 }
 }
 
 // ***** C bindings *****
 
-xbt_cfg_t xbt_cfg_new()        { return new simgrid::config::Config(); }
+xbt_cfg_t xbt_cfg_new()
+{
+  atexit(&sg_config_finalize);
+  return new simgrid::config::Config();
+}
 void xbt_cfg_free(xbt_cfg_t * cfg) { delete *cfg; }
 
 void xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cfg)
@@ -445,37 +442,29 @@ void xbt_cfg_register_double(const char *name, double default_value,
 
 void xbt_cfg_register_int(const char *name, int default_value,xbt_cfg_cb_t cb_set, const char *desc)
 {
-  if (simgrid_config == nullptr) {
+  if (simgrid_config == nullptr)
     simgrid_config = xbt_cfg_new();
-    atexit(&sg_config_finalize);
-  }
   simgrid_config->registerOption<int>(name, desc, default_value, cb_set);
 }
 
 void xbt_cfg_register_string(const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc)
 {
-  if (simgrid_config == nullptr) {
+  if (simgrid_config == nullptr)
     simgrid_config = xbt_cfg_new();
-    atexit(sg_config_finalize);
-  }
   simgrid_config->registerOption<std::string>(name, desc, default_value ? default_value : "", cb_set);
 }
 
 void xbt_cfg_register_boolean(const char *name, const char*default_value,xbt_cfg_cb_t cb_set, const char *desc)
 {
-  if (simgrid_config == nullptr) {
+  if (simgrid_config == nullptr)
     simgrid_config = xbt_cfg_new();
-    atexit(sg_config_finalize);
-  }
   simgrid_config->registerOption<bool>(name, desc, simgrid::config::parseBool(default_value), cb_set);
 }
 
 void xbt_cfg_register_alias(const char *realname, const char *aliasname)
 {
-  if (simgrid_config == nullptr) {
+  if (simgrid_config == nullptr)
     simgrid_config = xbt_cfg_new();
-    atexit(sg_config_finalize);
-  }
   simgrid_config->alias(realname, aliasname);
 }
 
@@ -765,7 +754,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_cfg);
 
 XBT_TEST_SUITE("config", "Configuration support");
 
-XBT_PUBLIC_DATA(xbt_cfg_t) simgrid_config;
+XBT_PUBLIC_DATA xbt_cfg_t simgrid_config;
 
 static void make_set()
 {
index 6ccf21c..6c8d2a5 100644 (file)
@@ -128,17 +128,17 @@ inline int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, char **key, v
   XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_get_or_free");
 
   if (!cursor || !(*cursor))
-    return FALSE;
+    return false;
 
   current = (*cursor)->current;
   if (current == NULL) {        /* no data left */
     xbt_dict_cursor_free(cursor);
-    return FALSE;
+    return false;
   }
 
   *key = current->key;
   *data = current->content;
-  return TRUE;
+  return true;
 }
 
 /**
index c6a637c..b2420da 100644 (file)
@@ -1,6 +1,6 @@
 /* a generic DYNamic ARray implementation.                                  */
 
-/* Copyright (c) 2004-2017. The SimGrid Team.
+/* Copyright (c) 2004-2018. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@ static inline void _xbt_dynar_get_elm(void *const dst, const xbt_dynar_t dynar,
   memcpy(dst, elm, dynar->elmsize);
 }
 
-extern "C" void xbt_dynar_dump(xbt_dynar_t dynar)
+void xbt_dynar_dump(xbt_dynar_t dynar)
 {
   XBT_INFO("Dynar dump: size=%lu; used=%lu; elmsize=%lu; data=%p; free_f=%p",
         dynar->size, dynar->used, dynar->elmsize, dynar->data, dynar->free_f);
@@ -89,7 +89,7 @@ extern "C" void xbt_dynar_dump(xbt_dynar_t dynar)
  * Creates a new dynar. If a free_func is provided, the elements have to be pointer of pointer. That is to say that
  * dynars can contain either base types (int, char, double, etc) or pointer of pointers (struct **).
  */
-extern "C" xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
+xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t const free_f)
 {
   xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t, 1);
 
@@ -105,7 +105,7 @@ extern "C" xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t
 /** @brief Initialize a dynar structure that was not malloc'ed
  * This can be useful to keep temporary dynars on the stack
  */
-extern "C" void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
+void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, void_f_pvoid_t const free_f)
 {
   dynar->size    = 0;
   dynar->used    = 0;
@@ -115,7 +115,7 @@ extern "C" void xbt_dynar_init(xbt_dynar_t dynar, const unsigned long elmsize, v
 }
 
 /** @brief Destroy a dynar that was created with xbt_dynar_init */
-extern "C" void xbt_dynar_free_data(xbt_dynar_t dynar)
+void xbt_dynar_free_data(xbt_dynar_t dynar)
 {
   xbt_dynar_reset(dynar);
   if (dynar)
@@ -129,7 +129,7 @@ extern "C" void xbt_dynar_free_data(xbt_dynar_t dynar)
  * kilkil a dynar BUT NOT its content. Ie, the array is freed, but the content is not touched (the \a free_f function
  * is not used)
  */
-extern "C" void xbt_dynar_free_container(xbt_dynar_t* dynar)
+void xbt_dynar_free_container(xbt_dynar_t* dynar)
 {
   if (dynar && *dynar) {
     xbt_dynar_t d = *dynar;
@@ -143,7 +143,7 @@ extern "C" void xbt_dynar_free_container(xbt_dynar_t* dynar)
  *
  * \param dynar who to squeeze
  */
-extern "C" void xbt_dynar_reset(xbt_dynar_t const dynar)
+void xbt_dynar_reset(xbt_dynar_t const dynar)
 {
   _sanity_check_dynar(dynar);
 
@@ -159,7 +159,7 @@ extern "C" void xbt_dynar_reset(xbt_dynar_t const dynar)
  * \param d1 dynar to keep
  * \param d2 dynar to merge into d1. This dynar is free at end.
  */
-extern "C" void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
+void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
 {
   if((*d1)->elmsize != (*d2)->elmsize)
     xbt_die("Element size must are not equal");
@@ -187,7 +187,7 @@ extern "C" void xbt_dynar_merge(xbt_dynar_t* d1, xbt_dynar_t* d2)
  * Set \a empty_slots_wanted to zero to reduce the dynar internal array as much as possible.
  * Note that if \a empty_slots_wanted is greater than the array size, the internal array is expanded instead of shrunk.
  */
-extern "C" void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
+void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
 {
   _xbt_dynar_resize(dynar, dynar->used + empty_slots_wanted);
 }
@@ -198,7 +198,7 @@ extern "C" void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted)
  *
  * kilkil a dynar and its content
  */
-extern "C" void xbt_dynar_free(xbt_dynar_t* dynar)
+void xbt_dynar_free(xbt_dynar_t* dynar)
 {
   if (dynar && *dynar) {
     xbt_dynar_reset(*dynar);
@@ -207,7 +207,7 @@ extern "C" void xbt_dynar_free(xbt_dynar_t* dynar)
 }
 
 /** \brief free a dynar passed as void* (handy to store dynar in dynars or dict) */
-extern "C" void xbt_dynar_free_voidp(void* d)
+void xbt_dynar_free_voidp(void* d)
 {
   xbt_dynar_t dynar = (xbt_dynar_t)d;
   xbt_dynar_free(&dynar);
@@ -217,7 +217,7 @@ extern "C" void xbt_dynar_free_voidp(void* d)
  *
  * \param dynar the dynar we want to mesure
  */
-extern "C" unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
+unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
 {
   return (dynar ? (unsigned long) dynar->used : (unsigned long) 0);
 }
@@ -226,7 +226,7 @@ extern "C" unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
  *
  *\param dynar the dynat we want to check
  */
-extern "C" int xbt_dynar_is_empty(const xbt_dynar_t dynar)
+int xbt_dynar_is_empty(const xbt_dynar_t dynar)
 {
   return (xbt_dynar_length(dynar) == 0);
 }
@@ -237,7 +237,7 @@ extern "C" int xbt_dynar_is_empty(const xbt_dynar_t dynar)
  * \param idx index of the slot we want to retrieve
  * \param[out] dst where to put the result to.
  */
-extern "C" void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst)
+void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void* const dst)
 {
   _sanity_check_dynar(dynar);
   _check_inbound_idx(dynar, idx);
@@ -254,7 +254,7 @@ extern "C" void xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long i
  * \warning The returned value is the actual content of the dynar.
  * Make a copy before fooling with it.
  */
-extern "C" void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx)
 {
   void *res;
   _sanity_check_dynar(dynar);
@@ -264,7 +264,7 @@ extern "C" void* xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long
   return res;
 }
 
-extern "C" void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx)
+void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned long idx)
 {
   _sanity_check_dynar(dynar);
 
@@ -286,7 +286,7 @@ extern "C" void* xbt_dynar_set_at_ptr(const xbt_dynar_t dynar, const unsigned lo
  *
  * If you want to free the previous content, use xbt_dynar_replace().
  */
-extern "C" void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* const src)
+void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* const src)
 {
   memcpy(xbt_dynar_set_at_ptr(dynar, idx), src, dynar->elmsize);
 }
@@ -300,7 +300,7 @@ extern "C" void xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void* cons
  * Set the Nth element of a dynar, expanding the dynar if needed, AND DO free the previous value at this position. If
  * you don't want to free the previous content, use xbt_dynar_set().
  */
-extern "C" void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* const object)
+void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void* const object)
 {
   _sanity_check_dynar(dynar);
 
@@ -318,7 +318,7 @@ extern "C" void xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, co
  * You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
  * xbt_dynar_insert_at_as() does.
  */
-extern "C" void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
+void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
 {
   void *res;
   unsigned long old_used;
@@ -349,7 +349,7 @@ extern "C" void* xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx)
  * Set the Nth element of a dynar, expanding the dynar if needed, and moving the previously existing value and all
  * subsequent ones to one position right in the dynar.
  */
-extern "C" void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* const src)
+void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, const void* const src)
 {
   /* checks done in xbt_dynar_insert_at_ptr */
   memcpy(xbt_dynar_insert_at_ptr(dynar, idx), src, dynar->elmsize);
@@ -363,7 +363,7 @@ extern "C" void xbt_dynar_insert_at(xbt_dynar_t const dynar, const int idx, cons
  * If the object argument of this function is a non-null pointer, the removed element is copied to this address. If not,
  * the element is freed using the free_f function passed at dynar creation.
  */
-extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
+void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void* const object)
 {
   _sanity_check_dynar(dynar);
   _check_inbound_idx(dynar, idx);
@@ -391,7 +391,7 @@ extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void
  *
  * Each of the removed elements is freed using the free_f function passed at dynar creation.
  */
-extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
+void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx)
 {
   if (not n)
     return;
@@ -434,7 +434,7 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
  * Raises not_found_error if not found. If you have less than 2 millions elements, you probably want to use
  * #xbt_dynar_search_or_negative() instead, so that you don't have to TRY/CATCH on element not found.
  */
-extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem)
+unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const elem)
 {
   unsigned long it;
 
@@ -444,7 +444,7 @@ extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const el
     }
 
   THROWF(not_found_error, 0, "Element %p not part of dynar %p", elem, dynar);
-  return -1; // Won't happen, just to please eclipse
+  return 0; // Won't happen, just to please eclipse
 }
 
 /** @brief Returns the position of the element in the dynar (or -1 if not found)
@@ -455,7 +455,7 @@ extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const el
  * Note that usually, the dynar indices are unsigned integers. If you have more than 2 million elements in your dynar,
  * this very function will not work (but the other will).
  */
-extern "C" signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem)
+signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void* const elem)
 {
   unsigned long it;
 
@@ -472,7 +472,7 @@ extern "C" signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void
  * Beware that if your dynar contains pointed values (such as strings) instead of scalar, this function is probably not
  * what you want. Check the documentation of xbt_dynar_search() for more info.
  */
-extern "C" int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
+int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
 {
   unsigned long it;
 
@@ -489,13 +489,13 @@ extern "C" int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
  * You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
  * xbt_dynar_push_as() does.
  */
-extern "C" void* xbt_dynar_push_ptr(xbt_dynar_t const dynar)
+void* xbt_dynar_push_ptr(xbt_dynar_t const dynar)
 {
   return xbt_dynar_insert_at_ptr(dynar, dynar->used);
 }
 
 /** @brief Add an element at the end of the dynar */
-extern "C" void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
+void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
 {
   /* checks done in xbt_dynar_insert_at_ptr */
   memcpy(xbt_dynar_insert_at_ptr(dynar, dynar->used), src, dynar->elmsize);
@@ -506,7 +506,7 @@ extern "C" void xbt_dynar_push(xbt_dynar_t const dynar, const void* const src)
  * You can then use regular affectation to set its value instead of relying on the slow memcpy. This is what
  * xbt_dynar_pop_as() does.
  */
-extern "C" void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
+void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
 {
   _check_populated_dynar(dynar);
   XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
@@ -515,7 +515,7 @@ extern "C" void* xbt_dynar_pop_ptr(xbt_dynar_t const dynar)
 }
 
 /** @brief Get and remove the last element of the dynar */
-extern "C" void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
+void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
 {
   /* sanity checks done by remove_at */
   XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar);
@@ -526,7 +526,7 @@ extern "C" void xbt_dynar_pop(xbt_dynar_t const dynar, void* const dst)
  *
  * This is less efficient than xbt_dynar_push()
  */
-extern "C" void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src)
+void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src)
 {
   /* sanity checks done by insert_at */
   xbt_dynar_insert_at(dynar, 0, src);
@@ -536,7 +536,7 @@ extern "C" void xbt_dynar_unshift(xbt_dynar_t const dynar, const void* const src
  *
  * This is less efficient than xbt_dynar_pop()
  */
-extern "C" void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
+void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
 {
   /* sanity checks done by remove_at */
   xbt_dynar_remove_at(dynar, 0, dst);
@@ -546,7 +546,7 @@ extern "C" void xbt_dynar_shift(xbt_dynar_t const dynar, void* const dst)
  *
  * The mapped function may change the value of the element itself, but should not mess with the structure of the dynar.
  */
-extern "C" void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
+void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
 {
   char *const data = (char *) dynar->data;
   const unsigned long elmsize = dynar->elmsize;
@@ -565,7 +565,7 @@ extern "C" void xbt_dynar_map(const xbt_dynar_t dynar, void_f_pvoid_t const op)
  *
  * This function can be used while traversing without problem.
  */
-extern "C" void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor)
+void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const cursor)
 {
   xbt_dynar_remove_at(dynar, *cursor, nullptr);
   *cursor -= 1;
@@ -597,7 +597,7 @@ extern "C" void xbt_dynar_cursor_rm(xbt_dynar_t dynar, unsigned int* const curso
  * \param dynar the dynar to sort
  * \param compar_fn comparison function of type (int (compar_fn*) (const void*) (const void*)).
  */
-extern "C" void xbt_dynar_sort(xbt_dynar_t dynar, int_f_cpvoid_cpvoid_t compar_fn)
+void xbt_dynar_sort(xbt_dynar_t dynar, int_f_cpvoid_cpvoid_t compar_fn)
 {
   if (dynar->data != nullptr)
     qsort(dynar->data, dynar->used, dynar->elmsize, compar_fn);
@@ -608,7 +608,7 @@ static int strcmp_voidp(const void *pa, const void *pb) {
 }
 
 /** @brief Sorts a dynar of strings (ie, char* data) */
-extern "C" xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
+xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
 {
   xbt_dynar_sort(dynar, strcmp_voidp);
   return dynar; // to enable functional uses
@@ -621,7 +621,7 @@ extern "C" xbt_dynar_t xbt_dynar_sort_strings(xbt_dynar_t dynar)
  *
  *  Note: The dynar won't be usable afterwards.
  */
-extern "C" void* xbt_dynar_to_array(xbt_dynar_t dynar)
+void* xbt_dynar_to_array(xbt_dynar_t dynar)
 {
   void *res;
   xbt_dynar_shrink(dynar, 1);
@@ -642,7 +642,7 @@ extern "C" void* xbt_dynar_to_array(xbt_dynar_t dynar)
  *  considered equal, and a value different of zero when they are considered different. Finally, d2 is destroyed
  *  afterwards.
  */
-extern "C" int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*))
+int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(const void*, const void*))
 {
   int i ;
   int size;
@@ -898,7 +898,7 @@ XBT_TEST_UNIT("double", test_dynar_double, "Dynars of doubles")
   xbt_test_add("==== Traverse the empty dynar");
   d = xbt_dynar_new(sizeof(int), nullptr);
   xbt_dynar_foreach(d, cursor, cpt) {
-    xbt_test_assert(FALSE, "Damnit, there is something in the empty dynar");
+    xbt_test_assert(false, "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
@@ -999,7 +999,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   xbt_test_add("==== Traverse the empty dynar");
   xbt_dynar_t d = xbt_dynar_new(sizeof(char*), &xbt_free_ref);
   xbt_dynar_foreach(d, iter, s1) {
-    xbt_test_assert(FALSE, "Damnit, there is something in the empty dynar");
+    xbt_test_assert(false, "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
index c439569..280c279 100644 (file)
@@ -1,45 +1,9 @@
 /* ex - Exception Handling                                                  */
 
-/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
-
-/*  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>       */
-/*  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>         */
-/*  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>           */
-/*  All rights reserved.                                                    */
-
-/* This code is inspirated from the OSSP version (as retrieved back in 2004)*/
-/* It was heavily modified to fit the SimGrid framework.                    */
-
-/* The OSSP version has the following copyright notice:
-**  OSSP ex - Exception Handling
-**  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
-**  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
-**  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
-**
-**  This file is part of OSSP ex, an exception handling library
-**  which can be found at http://www.ossp.org/pkg/lib/ex/.
-**
-**  Permission to use, copy, modify, and distribute this software for
-**  any purpose with or without fee is hereby granted, provided that
-**  the above copyright notice and this permission notice appear in all
-**  copies.
-**
-**  THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESSED OR IMPLIED
-**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
-**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-**  SUCH DAMAGE.
- */
-
-/* The extensions made for the SimGrid project can either be distributed    */
-/* under the same license, or under the LGPL v2.1                           */
+/* Copyright (c) 2005-2018. 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 <cstdio>
 #include <cstdlib>
 #include "xbt/backtrace.hpp"
 #include "src/xbt_modinter.h"       /* backtrace initialization headers */
 
-#include "simgrid/sg_config.h /* Configuration mechanism of SimGrid */
+#include "simgrid/sg_config.hpp" /* Configuration mechanism of SimGrid */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ex, xbt, "Exception mechanism");
 
-// Don't define ~xbt_ex() in ex.hpp.  It is defined here to ensure that there is an unique definition of xt_ex in
-// libsimgrid, but not in libsimgrid-java.  Otherwise, sone tests are broken (seen with clang/libc++ on freebsd).
+// DO NOT define ~xbt_ex() in ex.hpp.
+// Defining it here ensures that xbt_ex is defined only in libsimgrid, but not in libsimgrid-java.
+// Doing otherwise naturally breaks things (at least on freebsd with clang).
+
 xbt_ex::~xbt_ex() = default;
 
 void _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file, int line, const char* func)
index 1455134..0b6b899 100644 (file)
 #include <xbt/log.h>
 #include <xbt/log.hpp>
 
-extern "C" {
 XBT_LOG_EXTERNAL_CATEGORY(xbt);
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_exception, xbt, "Exceptions");
-}
 
 namespace simgrid {
 namespace xbt {
index 3073e99..7365993 100644 (file)
@@ -662,7 +662,7 @@ static void xbt_log_help(void)
          "in 'l'etter)\n"
          "         -> %%L: line number where the log event was raised (LOG4J compatible)\n"
          "         -> %%M: function name (LOG4J compatible -- called method name here of course).\n"
-         "                 Defined only when using gcc because there is no __FUNCTION__ elsewhere.\n"
+         "                 Defined only when using gcc because there is no __func__ elsewhere.\n"
          "\n"
          "         -> %%b: full backtrace (Called %%throwable in LOG4J). Defined only under windows or when using the "
          "GNU libc because\n"
index 7946e17..e5095be 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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. */
@@ -26,6 +26,6 @@ struct xbt_log_layout_s {
  *
  * Programatically alter a category's parent (don't use).
  */
-XBT_PUBLIC(void) xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent);
+XBT_PUBLIC void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent);
 
 #endif
index b575f5e..2be233b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
@@ -52,9 +52,7 @@
 
 #include "memory_map.hpp"
 
-extern "C" {
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_memory_map, xbt, "Logging specific to algorithms for memory_map");
-}
 
 namespace simgrid {
 namespace xbt {
index 640e09f..4854410 100644 (file)
@@ -277,13 +277,13 @@ struct mdesc {
 
 /* A default malloc descriptor for the single sbrk() managed region. */
 
-XBT_PUBLIC_DATA( struct mdesc ) *__mmalloc_default_mdp;
+XBT_PUBLIC_DATA struct mdesc* __mmalloc_default_mdp;
 
 /* Remap a mmalloc region that was previously mapped. */
 
-XBT_PUBLIC( void *)__mmalloc_remap_core(xbt_mheap_t mdp);
+XBT_PUBLIC void* __mmalloc_remap_core(xbt_mheap_t mdp);
 
-XBT_PUBLIC( void *)mmorecore(struct mdesc *mdp, ssize_t size);
+XBT_PUBLIC void* mmorecore(struct mdesc* mdp, ssize_t size);
 
 /** Thread-safety (if the mutex is already created)
  *
index c5fffcc..c6e841f 100644 (file)
  *   http://www.ijs.si/software/snprintf/
  */
 
+/* find vasprintf in stdio.h */
+#ifndef _GNU_SOURCE
+#  define _GNU_SOURCE
+#endif
+#include <stdio.h>
+
 #include "xbt/sysdep.h"           /* xbt_abort() */
 #include "src/internal_config.h"  /* Do we need vasprintf? */
-#include <stdio.h>
+
 #include <assert.h>
 
 #if !HAVE_VASPRINTF
index 85cb4d2..61d8a93 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "src/xbt_modinter.h"       /* prototype of other module's init/exit in XBT */
 
-#include "simgrid/sg_config.h"
+#include "simgrid/sg_config.hpp"
 
 #include "src/internal_config.h"
 #include <cstdio>
index beee5cd..a266f7e 100644 (file)
@@ -17,6 +17,7 @@ namespace xbt {
 
 std::ifstream* action_fs = nullptr;
 std::unordered_map<std::string, action_fun> action_funs;
+static std::unordered_map<std::string, std::queue<ReplayAction*>*> action_queues;
 
 static void read_and_trim_line(std::ifstream* fs, std::string* line)
 {
@@ -96,32 +97,20 @@ static ReplayAction* get_action(char* name)
     myqueue->pop();
     return action;
   }
+
   return nullptr;
 }
 
-static void handle_action(ReplayAction* action)
+static void handle_action(ReplayAction& action)
 {
-  XBT_DEBUG("%s replays a %s action", action->at(0).c_str(), action->at(1).c_str());
-  char** c_action     = new char*[action->size() + 1];
-  action_fun function = action_funs.at(action->at(1));
-  int i               = 0;
-  for (auto const& arg : *action) {
-    c_action[i] = xbt_strdup(arg.c_str());
-    i++;
-  }
-  c_action[i] = nullptr;
+  XBT_DEBUG("%s replays a %s action", action.at(0).c_str(), action.at(1).c_str());
+  action_fun function = action_funs.at(action.at(1));
   try {
-    function(c_action);
+    function(action);
   } catch (xbt_ex& e) {
-    for (unsigned int j = 0; j < action->size(); j++)
-      xbt_free(c_action[j]);
-    delete[] c_action;
-    action->clear();
+    action.clear();
     xbt_die("Replay error:\n %s", e.what());
   }
-  for (unsigned int j = 0; j < action->size(); j++)
-    xbt_free(c_action[j]);
-  delete[] c_action;
 }
 
 /**
@@ -133,9 +122,9 @@ int replay_runner(int argc, char* argv[])
   if (simgrid::xbt::action_fs) { // A unique trace file
     while (true) {
       simgrid::xbt::ReplayAction* evt = simgrid::xbt::get_action(argv[0]);
-      if (evt == nullptr)
+      if (!evt)
         break;
-      simgrid::xbt::handle_action(evt);
+      simgrid::xbt::handle_action(*evt);
       delete evt;
     }
     if (action_queues.find(std::string(argv[0])) != action_queues.end()) {
@@ -144,21 +133,19 @@ int replay_runner(int argc, char* argv[])
       action_queues.erase(std::string(argv[0]));
     }
   } else { // Should have got my trace file in argument
-    simgrid::xbt::ReplayAction* evt = new simgrid::xbt::ReplayAction();
+    simgrid::xbt::ReplayAction evt;
     xbt_assert(argc >= 2, "No '%s' agent function provided, no simulation-wide trace file provided, "
                           "and no process-wide trace file provided in deployment file. Aborting.",
                argv[0]);
-    simgrid::xbt::ReplayReader* reader = new simgrid::xbt::ReplayReader(argv[1]);
-    while (reader->get(evt)) {
-      if (evt->front().compare(argv[0]) == 0) {
+    simgrid::xbt::ReplayReader reader(argv[1]);
+    while (reader.get(&evt)) {
+      if (evt.front().compare(argv[0]) == 0) {
         simgrid::xbt::handle_action(evt);
       } else {
         XBT_WARN("Ignore trace element not for me");
       }
-      evt->clear();
+      evt.clear();
     }
-    delete evt;
-    delete reader;
   }
   return 0;
 }
index 5d42234..e1618b9 100644 (file)
@@ -3,6 +3,7 @@ foreach(x dwarf dwarf-expression)
     add_executable       (${x}  ${x}/${x}.cpp)
     target_link_libraries(${x}  simgrid)
     set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+    set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
   endif()
 
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
index b35cd9e..cc25995 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2015-2018. 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. */
@@ -19,7 +18,7 @@
  * and the MC does not find the counter-example.
  */
 
-#include "mc/mc.h"
+#include "simgrid/modelchecker.h"
 #include "simgrid/msg.h"
 #include <xbt/synchro.h>
 
index 9fbb738..b74603a 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2014-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2014-2018. 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. */
@@ -7,6 +6,8 @@
 #include <simgrid/msg.h>
 #include <simgrid/modelchecker.h>
 
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(random_bug, "Application");
 
 /** An (fake) application with a bug occuring for some random values */
index 49155a3..1cc6511 100644 (file)
@@ -1,6 +1,5 @@
 # C examples
-foreach(x actions-comm actions-storage
-          app-pingpong app-token-ring
+foreach(x app-pingpong app-token-ring
           async-wait async-waitall async-waitany
           cloud-capping cloud-migration cloud-sharing cloud-two-tasks cloud-simple
           get_sender host_on_off host_on_off_recv host_on_off_processes          
@@ -48,14 +47,7 @@ set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/ap
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend.tesh
                                    PARENT_SCOPE)
 set(bin_files    ${bin_files}      ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/generate.py                  PARENT_SCOPE)
-set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm.txt
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p0.txt
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p1.txt
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage.txt         PARENT_SCOPE)
-set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage_d.xml
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent_d.xml
+set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent_d.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend_d.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
                                    ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait_d.xml
@@ -86,7 +78,6 @@ set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/acti
                                    ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp2.5-hbp1.5.xml    PARENT_SCOPE)
 
 foreach(x 
-    actions-comm actions-storage
     async-wait async-waitall async-waitany
     app-bittorrent app-chainsend app-pingpong app-token-ring
     cloud-capping cloud-migration cloud-two-tasks cloud-simple
diff --git a/teshsuite/msg/actions-comm/actions-comm.c b/teshsuite/msg/actions-comm/actions-comm.c
deleted file mode 100644 (file)
index b431b35..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Copyright (c) 2009-2017. 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 <xbt/replay.hpp>
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(actions, "Messages specific for this msg example");
-int communicator_size = 0;
-
-static void action_Isend(const char* const* action);
-
-typedef struct {
-  int last_Irecv_sender_id;
-  int bcast_counter;
-  xbt_dynar_t isends; /* of msg_comm_t */
-  /* Used to implement irecv+wait */
-  xbt_dynar_t irecvs; /* of msg_comm_t */
-  xbt_dynar_t tasks;  /* of msg_task_t */
-} s_process_globals_t;
-
-typedef s_process_globals_t* process_globals_t;
-
-/* Helper function */
-static double parse_double(const char* string)
-{
-  double value;
-  char* endptr;
-
-  value = strtod(string, &endptr);
-  if (*endptr != '\0')
-    THROWF(unknown_error, 0, "%s is not a double", string);
-  return value;
-}
-
-#define ACT_DEBUG(...)                                                                                                 \
-  if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose)) {                                                          \
-    char* NAME = xbt_str_join_array(action, " ");                                                                      \
-    XBT_DEBUG(__VA_ARGS__);                                                                                            \
-    xbt_free(NAME);                                                                                                    \
-  } else                                                                                                               \
-  ((void)0)
-
-static void log_action(const char* const* action, double date)
-{
-  if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose)) {
-    char* name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, date);
-    xbt_free(name);
-  }
-}
-
-static void asynchronous_cleanup(void)
-{
-  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
-
-  /* Destroy any isend which correspond to completed communications */
-  msg_comm_t comm;
-  while (1 /*true*/) {
-    int pos_found = MSG_comm_testany(globals->isends);
-    if (pos_found == -1) /* none remaining */
-      break;
-    xbt_dynar_remove_at(globals->isends, pos_found, &comm);
-    MSG_comm_destroy(comm);
-  }
-}
-
-/* My actions */
-static void action_send(const char* const* action)
-{
-  char to[250];
-  const char* size_str = action[3];
-  double size          = parse_double(size_str);
-  double clock         = MSG_get_clock();
-
-  snprintf(to, 249, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
-
-  ACT_DEBUG("Entering Send: %s (size: %g)", NAME, size);
-  if (size < 65536) {
-    action_Isend(action);
-  } else {
-    MSG_task_send(MSG_task_create(to, 0, size, NULL), to);
-  }
-
-  log_action(action, MSG_get_clock() - clock);
-  asynchronous_cleanup();
-}
-
-static void action_Isend(const char* const* action)
-{
-  char to[250];
-  const char* size          = action[3];
-  double clock              = MSG_get_clock();
-  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
-
-  snprintf(to, 249, "%s_%s", MSG_process_get_name(MSG_process_self()), action[2]);
-  msg_comm_t comm = MSG_task_isend(MSG_task_create(to, 0, parse_double(size), NULL), to);
-  xbt_dynar_push(globals->isends, &comm);
-
-  XBT_DEBUG("Isend on %s", MSG_process_get_name(MSG_process_self()));
-  log_action(action, MSG_get_clock() - clock);
-  asynchronous_cleanup();
-}
-
-static void action_recv(const char* const* action)
-{
-  char mailbox_name[250];
-  msg_task_t task = NULL;
-  double clock    = MSG_get_clock();
-
-  snprintf(mailbox_name, 249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
-
-  ACT_DEBUG("Receiving: %s", NAME);
-  msg_error_t res = MSG_task_receive(&task, mailbox_name);
-  log_action(action, MSG_get_clock() - clock);
-
-  if (res == MSG_OK) {
-    MSG_task_destroy(task);
-  }
-  asynchronous_cleanup();
-}
-
-static void action_Irecv(const char* const* action)
-{
-  char mailbox[250];
-  double clock              = MSG_get_clock();
-  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
-
-  XBT_DEBUG("Irecv on %s", MSG_process_get_name(MSG_process_self()));
-
-  snprintf(mailbox, 249, "%s_%s", action[2], MSG_process_get_name(MSG_process_self()));
-  msg_task_t t = NULL;
-  xbt_dynar_push(globals->tasks, &t);
-  msg_comm_t c = MSG_task_irecv(xbt_dynar_get_ptr(globals->tasks, xbt_dynar_length(globals->tasks) - 1), mailbox);
-  xbt_dynar_push(globals->irecvs, &c);
-
-  log_action(action, MSG_get_clock() - clock);
-  asynchronous_cleanup();
-}
-
-static void action_wait(const char* const* action)
-{
-  msg_task_t task = NULL;
-  msg_comm_t comm;
-  double clock              = MSG_get_clock();
-  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
-
-  xbt_assert(xbt_dynar_length(globals->irecvs), "action wait not preceded by any irecv: %s",
-             xbt_str_join_array(action, " "));
-
-  ACT_DEBUG("Entering %s", NAME);
-  comm = xbt_dynar_pop_as(globals->irecvs, msg_comm_t);
-  MSG_comm_wait(comm, -1);
-  task = xbt_dynar_pop_as(globals->tasks, msg_task_t);
-  MSG_comm_destroy(comm);
-  MSG_task_destroy(task);
-
-  log_action(action, MSG_get_clock() - clock);
-}
-
-/* FIXME: that's a poor man's implementation: we should take the message exchanges into account */
-static void action_barrier(const char* const* action)
-{
-  static msg_bar_t barrier           = NULL;
-  static int processes_arrived_sofar = 0;
-
-  if (barrier == NULL) {                                    // first arriving on the barrier
-    msg_bar_t newbar = MSG_barrier_init(communicator_size); // This is a simcall, unscheduling the current process
-    if (barrier == NULL)                                    // Still null, commit our new value
-      barrier = newbar;
-    else // some other process commited a new barrier before me, so dismiss mine
-      MSG_barrier_destroy(newbar);
-  }
-
-  processes_arrived_sofar++;
-  MSG_barrier_wait(barrier);
-
-  ACT_DEBUG("Exiting barrier: %s", NAME);
-
-  processes_arrived_sofar--;
-  if (processes_arrived_sofar <= 0) {
-    MSG_barrier_destroy(barrier);
-    barrier = NULL;
-  }
-}
-
-static void action_bcast(const char* const* action)
-{
-  char mailbox[80];
-  double comm_size = parse_double(action[2]);
-  msg_task_t task  = NULL;
-  double clock     = MSG_get_clock();
-
-  process_globals_t counters = (process_globals_t)MSG_process_get_data(MSG_process_self());
-
-  xbt_assert(communicator_size, "Size of Communicator is not defined, can't use collective operations");
-
-  const char* process_name = MSG_process_get_name(MSG_process_self());
-
-  char* bcast_identifier = bprintf("bcast_%d", counters->bcast_counter);
-  counters->bcast_counter++;
-
-  if (!strcmp(process_name, "p0")) {
-    XBT_DEBUG("%s: %s is the Root", bcast_identifier, process_name);
-
-    msg_comm_t* comms = xbt_new0(msg_comm_t, communicator_size - 1);
-
-    for (int i = 1; i < communicator_size; i++) {
-      snprintf(mailbox, 79, "%s_p0_p%d", bcast_identifier, i);
-      comms[i - 1] = MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox);
-    }
-    MSG_comm_waitall(comms, communicator_size - 1, -1);
-    for (int i = 1; i < communicator_size; i++)
-      MSG_comm_destroy(comms[i - 1]);
-    xbt_free(comms);
-
-    XBT_DEBUG("%s: all messages sent by %s have been received", bcast_identifier, process_name);
-  } else {
-    snprintf(mailbox, 79, "%s_p0_%s", bcast_identifier, process_name);
-    MSG_task_receive(&task, mailbox);
-    MSG_task_destroy(task);
-    XBT_DEBUG("%s: %s has received", bcast_identifier, process_name);
-  }
-
-  log_action(action, MSG_get_clock() - clock);
-  xbt_free(bcast_identifier);
-}
-
-static void action_comm_size(const char* const* action)
-{
-  const char* size = action[2];
-  double clock     = MSG_get_clock();
-
-  communicator_size = parse_double(size);
-  log_action(action, MSG_get_clock() - clock);
-}
-
-static void action_compute(const char* const* action)
-{
-  const char* amount = action[2];
-  msg_task_t task    = MSG_task_create("task", parse_double(amount), 0, NULL);
-  double clock       = MSG_get_clock();
-
-  ACT_DEBUG("Entering %s", NAME);
-  MSG_task_execute(task);
-  MSG_task_destroy(task);
-  log_action(action, MSG_get_clock() - clock);
-}
-
-static void action_init(const char* const* action)
-{
-  XBT_DEBUG("Initialize the counters");
-  process_globals_t globals = (process_globals_t)calloc(1, sizeof(s_process_globals_t));
-  globals->isends           = xbt_dynar_new(sizeof(msg_comm_t), NULL);
-  globals->irecvs           = xbt_dynar_new(sizeof(msg_comm_t), NULL);
-  globals->tasks            = xbt_dynar_new(sizeof(msg_task_t), NULL);
-  MSG_process_set_data(MSG_process_self(), globals);
-}
-
-static void action_finalize(const char* const* action)
-{
-  process_globals_t globals = (process_globals_t)MSG_process_get_data(MSG_process_self());
-  if (globals) {
-    asynchronous_cleanup();
-    xbt_dynar_free_container(&(globals->isends));
-    xbt_dynar_free_container(&(globals->irecvs));
-    xbt_dynar_free_container(&(globals->tasks));
-    xbt_free(globals);
-  }
-}
-
-int main(int argc, char* argv[])
-{
-  /* Check the given arguments */
-  MSG_init(&argc, argv);
-  /* Explicit initialization of the action module is required now*/
-  MSG_action_init();
-
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file [action_files]\n"
-                       "\t# if all actions are in the same file\n"
-                       "\tExample: %s msg_platform.xml msg_deployment.xml actions\n"
-                       "\t# if actions are in separate files, specified in deployment\n"
-                       "\tExample: %s msg_platform.xml msg_deployment.xml ",
-             argv[0], argv[0], argv[0]);
-
-  MSG_create_environment(argv[1]);
-  MSG_launch_application(argv[2]);
-
-  /*   Action registration */
-  xbt_replay_action_register("init", action_init);
-  xbt_replay_action_register("finalize", action_finalize);
-  xbt_replay_action_register("comm_size", action_comm_size);
-  xbt_replay_action_register("send", action_send);
-  xbt_replay_action_register("Isend", action_Isend);
-  xbt_replay_action_register("recv", action_recv);
-  xbt_replay_action_register("Irecv", action_Irecv);
-  xbt_replay_action_register("wait", action_wait);
-  xbt_replay_action_register("barrier", action_barrier);
-  xbt_replay_action_register("bcast", action_bcast);
-  xbt_replay_action_register("compute", action_compute);
-
-  /* Actually do the simulation using MSG_action_trace_run */
-  msg_error_t res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here
-
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-
-  MSG_action_exit(); /* Explicit finalization of the action module */
-
-  return res != MSG_OK;
-}
diff --git a/teshsuite/msg/actions-comm/actions-comm.tesh b/teshsuite/msg/actions-comm/actions-comm.tesh
deleted file mode 100644 (file)
index 22108dc..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-! output sort 19
-$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_split_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 20.703314] (1:p0@Tremblay) p0 recv p1 20.703314
-> [ 20.703314] (2:p1@Ruby) p1 send p0 1e10 20.703314
-> [ 30.897513] (0:maestro@) Simulation time 30.8975
-> [ 30.897513] (1:p0@Tremblay) p0 compute 1e9 10.194200
-> [ 30.897513] (2:p1@Ruby) p1 compute 1e9 10.194200
-
-! output sort 19
-$ ${bindir:=.}/actions-comm --log=actions.thres=verbose ${platfdir}/small_platform_fatpipe.xml actions-comm_d.xml actions-comm.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:p0@Tremblay) p0 comm_size 3 0.000000
-> [  1.037020] (1:p0@Tremblay) p0 bcast 5e8 1.037020
-> [  1.037020] (2:p1@Ruby) p1 bcast 5e8 1.037020
-> [  1.037020] (3:p2@Perl) p2 bcast 5e8 1.037020
-> [  1.082894] (1:p0@Tremblay) p0 compute 4.5E6 0.045874
-> [  1.123670] (1:p0@Tremblay) p0 compute 4E6 0.040777
-> [  1.149156] (1:p0@Tremblay) p0 compute 2.5E6 0.025485
-> [  1.149156] (2:p1@Ruby) p1 Irecv p0 0.000000
-> [  1.149156] (3:p2@Perl) p2 Irecv p1 0.000000
-> [  3.221244] (1:p0@Tremblay) p0 send p1 1e9 2.072088
-> [  6.246256] (3:p2@Perl) p2 compute 5e8 5.097100
-> [ 11.343355] (2:p1@Ruby) p1 compute 1e9 10.194200
-> [ 11.343355] (2:p1@Ruby) p1 wait 0.000000
-> [ 11.343355] (2:p1@Ruby) p1 Isend p2 1e9 0.000000
-> [ 13.415443] (0:maestro@) Simulation time 13.4154
-> [ 13.415443] (1:p0@Tremblay) p0 compute 1e9 10.194200
-> [ 13.415443] (3:p2@Perl) p2 wait 7.169187
diff --git a/teshsuite/msg/actions-comm/actions-comm.txt b/teshsuite/msg/actions-comm/actions-comm.txt
deleted file mode 100644 (file)
index 94054f2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# sample action file
-p0 init
-p1 init
-p2 init
-
-p0 comm_size 3
-p0 bcast 5e8
-p1 bcast 5e8
-p2 bcast 5e8
-
-p0 compute 4.5E6
-p0 compute 4E6
-p0 compute 2.5E6
-
-p0 barrier
-p1 barrier
-p2 barrier
-
-p0 send p1 1e9
-p0 compute 1e9
-
-p1 Irecv p0
-p1 compute 1e9
-p1 wait
-p1 Isend p2 1e9
-
-p2 Irecv p1
-p2 compute 5e8
-p2 wait
-
-p0 barrier
-p1 barrier
-p2 barrier
-
-p0 finalize
-p1 finalize
-p2 finalize
-
diff --git a/teshsuite/msg/actions-comm/actions-comm_d.xml b/teshsuite/msg/actions-comm/actions-comm_d.xml
deleted file mode 100644 (file)
index dbecc0b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-  <actor host="Tremblay" function="p0"/>
-  <actor host="Ruby" function="p1"/>
-  <actor host="Perl" function="p2"/>
-</platform>
diff --git a/teshsuite/msg/actions-comm/actions-comm_split_d.xml b/teshsuite/msg/actions-comm/actions-comm_split_d.xml
deleted file mode 100644 (file)
index 831c9e0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-<!-- Example file of how to use trace replay, with actions split in separate files, one per actor.
-     Launch it like this:
-         ./actions-comm ../../platforms/platform.xml actions-comm_split_d.xml  -->
-
-  <actor host="Tremblay" function="p0">
-    <argument value="actions-comm_split_p0.txt"/>
-  </actor>
-  <actor host="Ruby"   function="p1">
-    <argument value="actions-comm_split_p1.txt"/>
-  </actor>
-</platform>
diff --git a/teshsuite/msg/actions-comm/actions-comm_split_p0.txt b/teshsuite/msg/actions-comm/actions-comm_split_p0.txt
deleted file mode 100644 (file)
index dd16140..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# sample action file (with only the actions for p0, to be launched by deployment file)
-p0 init
-p0 recv p1
-p0 compute 1e9
-p0 finalize
-
diff --git a/teshsuite/msg/actions-comm/actions-comm_split_p1.txt b/teshsuite/msg/actions-comm/actions-comm_split_p1.txt
deleted file mode 100644 (file)
index d7e9dfe..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# sample action file (with only the actions for p1, to be launched by deployment file)
-p1 init
-p1 send p0 1e10
-p1 compute 1e9
-p1 finalize
diff --git a/teshsuite/msg/actions-storage/actions-storage.c b/teshsuite/msg/actions-storage/actions-storage.c
deleted file mode 100644 (file)
index e4cfac8..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright (c) 2015-2017. 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 "simgrid/plugins/file_system.h"
-#include <xbt/replay.hpp>
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(storage_actions, "Messages specific for this example");
-
-static xbt_dict_t opened_files = NULL;
-
-#define ACT_DEBUG(...)                                                                                                 \
-  if (XBT_LOG_ISENABLED(storage_actions, xbt_log_priority_verbose)) {                                                  \
-    char* NAME = xbt_str_join_array(action, " ");                                                                      \
-    XBT_DEBUG(__VA_ARGS__);                                                                                            \
-    xbt_free(NAME);                                                                                                    \
-  } else                                                                                                               \
-  ((void)0)
-
-static void log_action(const char* const* action, double date)
-{
-  if (XBT_LOG_ISENABLED(storage_actions, xbt_log_priority_verbose)) {
-    char* name = xbt_str_join_array(action, " ");
-    XBT_VERB("%s %f", name, date);
-    xbt_free(name);
-  }
-}
-
-static msg_file_t get_file_descriptor(const char* file_name)
-{
-  char full_name[1024];
-
-  snprintf(full_name, 1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
-
-  msg_file_t file = (msg_file_t)xbt_dict_get_or_null(opened_files, full_name);
-  return file;
-}
-
-static sg_size_t parse_size(const char* string)
-{
-  sg_size_t size;
-  char* endptr;
-
-  size = strtoul(string, &endptr, 10);
-  if (*endptr != '\0')
-    THROWF(unknown_error, 0, "%s is not a long unsigned int (a.k.a. sg_size_t)", string);
-  return size;
-}
-
-static void action_open(const char* const* action)
-{
-  const char* file_name = action[2];
-  char full_name[1024];
-  msg_file_t file = NULL;
-  double clock    = MSG_get_clock();
-
-  snprintf(full_name, 1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
-
-  ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name);
-  file = MSG_file_open(file_name, NULL);
-
-  xbt_dict_set(opened_files, full_name, file, NULL);
-
-  log_action(action, MSG_get_clock() - clock);
-}
-
-static void action_read(const char* const* action)
-{
-  const char* file_name = action[2];
-  const char* size_str  = action[3];
-  sg_size_t size        = parse_size(size_str);
-
-  double clock = MSG_get_clock();
-
-  msg_file_t file = get_file_descriptor(file_name);
-
-  ACT_DEBUG("Entering Read: %s (size: %llu)", NAME, size);
-  MSG_file_read(file, size);
-
-  log_action(action, MSG_get_clock() - clock);
-}
-
-static void action_close(const char* const* action)
-{
-  const char* file_name = action[2];
-  msg_file_t file;
-  double clock = MSG_get_clock();
-
-  file = get_file_descriptor(file_name);
-
-  ACT_DEBUG("Entering Close: %s (filename: %s)", NAME, file_name);
-  MSG_file_close(file);
-
-  log_action(action, MSG_get_clock() - clock);
-}
-
-int main(int argc, char* argv[])
-{
-  MSG_init(&argc, argv);
-  MSG_storage_file_system_init();
-  /* Explicit initialization of the action module is required */
-  MSG_action_init();
-
-  xbt_assert(argc > 3,
-             "Usage: %s platform_file deployment_file [action_files]\n"
-             "\texample: %s platform.xml deployment.xml actions # if all actions are in the same file\n"
-             "\texample: %s platform.xml deployment.xml # if actions are in separate files, specified in deployment\n",
-             argv[0], argv[0], argv[0]);
-
-  MSG_create_environment(argv[1]);
-  MSG_launch_application(argv[2]);
-
-  /*   Action registration */
-  xbt_replay_action_register("open", action_open);
-  xbt_replay_action_register("read", action_read);
-  xbt_replay_action_register("close", action_close);
-
-  if (opened_files == NULL)
-    opened_files = xbt_dict_new_homogeneous(NULL);
-  /* Actually do the simulation using MSG_action_trace_run */
-  msg_error_t res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here
-
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-
-  if (opened_files)
-    xbt_dict_free(&opened_files);
-
-  /* Explicit finalization of the action module is required now*/
-  MSG_action_exit();
-
-  return res != MSG_OK;
-}
diff --git a/teshsuite/msg/actions-storage/actions-storage.tesh b/teshsuite/msg/actions-storage/actions-storage.tesh
deleted file mode 100644 (file)
index d9a69ee..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-! output sort 19
-$ ${bindir:=.}/actions-storage --log=storage_actions.thres=verbose ${platfdir}/storage/storage.xml actions-storage_d.xml actions-storage.txt "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:p0@denise) p0 open /home/lib/libsimgrid.so.3.6.2 0.000000
-> [  0.063552] (1:p0@denise) p0 read /home/lib/libsimgrid.so.3.6.2 12710497 0.063552
-> [  0.063552] (1:p0@denise) p0 close /home/lib/libsimgrid.so.3.6.2 0.000000
-> [  0.063552] (0:maestro@) Simulation time 0.0635525
diff --git a/teshsuite/msg/actions-storage/actions-storage.txt b/teshsuite/msg/actions-storage/actions-storage.txt
deleted file mode 100644 (file)
index cc9142a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-p0 open /home/lib/libsimgrid.so.3.6.2  
-p0 read /home/lib/libsimgrid.so.3.6.2 12710497
-p0 close /home/lib/libsimgrid.so.3.6.2
diff --git a/teshsuite/msg/actions-storage/actions-storage_d.xml b/teshsuite/msg/actions-storage/actions-storage_d.xml
deleted file mode 100644 (file)
index 3f52ae6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4.1">
-  <actor host="denise" function="p0"/>
-</platform>
index b735c70..540b6d5 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2018. 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. */
@@ -7,6 +6,8 @@
 #include "bittorrent-messages.h"
 #include "bittorrent.h"
 
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_messages, "Messages specific for the message factory");
 
 #define BITS_TO_BYTES(x) (((x) / 8 + (x) % 8) ? 1 : 0)
index 3a6e22f..f74cdf3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -7,10 +7,12 @@
 #include "bittorrent-messages.h"
 #include "connection.h"
 #include "tracker.h"
-#include <limits.h>
 #include <simgrid/msg.h>
 #include <xbt/RngStream.h>
 
+#include <limits.h>
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_peers, "Messages specific for the peers");
 
 /*
index 7cad511..d34d5d4 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2018. 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. */
@@ -10,6 +9,8 @@
 #include <simgrid/msg.h>
 #include <xbt/RngStream.h>
 
+#include <stdio.h> /* snprintf */
+
 /** Bittorrent example launcher */
 int main(int argc, char* argv[])
 {
index c4ed0d5..1c97447 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_pingpong, "Messages specific for this msg example");
 
 static int pinger(int argc, char* argv[])
index 5018672..013e9c3 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2008-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_token_ring, "Messages specific for this msg example");
 
 /* Main function of all processes used in this example */
index beb85ca..826bb5b 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_wait, "Messages specific for this msg example");
 
 /* Main function of the Sender process */
index b586690..abb6615 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2010-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_waitall, "Messages specific for this msg example");
 
 static int sender(int argc, char* argv[])
index 2ae48e6..9eb12ed 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2010-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_waitany, "Messages specific for this msg example");
 
 static int sender(int argc, char* argv[])
index 10ab828..a13d6b4 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2018. 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 <stdio.h> /* sscanf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 xbt_dynar_t tests;
index 0726701..6b098a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2014-2018. 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. */
@@ -6,6 +6,8 @@
 #include "simgrid/msg.h"
 #include <simgrid/plugins/file_system.h>
 
+#include <stdio.h> /* sscanf */
+
 #define INMEGA (1024 * 1024)
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(remote_io, "Messages specific for this io example");
index 2c22834..2b44583 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
@@ -6,6 +6,8 @@
 #include "simgrid/msg.h"
 #include "simgrid/plugins/file_system.h"
 
+#include <stdio.h> /* SEEK_SET */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(io_file, "Messages specific for this io example");
 
 static int host(int argc, char* argv[])
index 5514c92..f20bf79 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2018. 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 <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 /* Executed on process termination*/
index ada22e3..c6a6acb 100644 (file)
@@ -1,10 +1,12 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2017-2018. 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 <stdio.h> /* snprintf */
+
 /* This example does not much: It just spans over-polite processes that yield a large amount
  * of time before ending.
  *
index adf5200..3971b80 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2018. 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. */
@@ -7,6 +6,8 @@
 #include <xbt/ex.hpp>
 #include "simgrid/msg.h"
 
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
 
 static std::vector<msg_task_t> tasks = std::vector<msg_task_t>();
index be1e9de..c3be30e 100644 (file)
@@ -10,7 +10,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example")
 static void worker()
 {
   simgrid::s4u::this_actor::sleep_for(.5);
-  XBT_INFO("Worker started (PID:%lu, PPID:%lu)", simgrid::s4u::this_actor::getPid(),
+  XBT_INFO("Worker started (PID:%ld, PPID:%ld)", simgrid::s4u::this_actor::getPid(),
            simgrid::s4u::this_actor::getPpid());
   while (1) {
     XBT_INFO("Plop i am %ssuspended", simgrid::s4u::this_actor::isSuspended() ? "" : "not ");
@@ -26,7 +26,7 @@ static void master()
   simgrid::s4u::this_actor::getHost()->actorList(actor_list);
 
   for (auto const& actor : *actor_list) {
-    XBT_INFO("Actor (pid=%lu, ppid=%lu, name=%s)", actor->getPid(), actor->getPpid(), actor->getCname());
+    XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->getPid(), actor->getPpid(), actor->getCname());
     if (simgrid::s4u::this_actor::getPid() != actor->getPid())
       actor->kill();
   }
@@ -35,16 +35,16 @@ static void master()
       simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::getHost(), worker);
   simgrid::s4u::this_actor::sleep_for(2);
 
-  XBT_INFO("Suspend Actor (pid=%lu)", actor->getPid());
+  XBT_INFO("Suspend Actor (pid=%ld)", actor->getPid());
   actor->suspend();
 
-  XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
+  XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
   simgrid::s4u::this_actor::sleep_for(2);
 
-  XBT_INFO("Resume Actor (pid=%lu)", actor->getPid());
+  XBT_INFO("Resume Actor (pid=%ld)", actor->getPid());
   actor->resume();
 
-  XBT_INFO("Actor (pid=%lu) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
+  XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not ");
   simgrid::s4u::this_actor::sleep_for(2);
   actor->kill();
 
index 552f17c..69b7ff8 100644 (file)
@@ -42,10 +42,7 @@ int main(int argc, char* argv[])
   simgrid::s4u::Engine e(&argc, argv);
   e.loadPlatform(argv[1]);
 
-  if (argc > 2)
-    simgrid::s4u::Actor::killAll(atoi(argv[2]));
-  else
-    simgrid::s4u::Actor::killAll();
+  simgrid::s4u::Actor::killAll();
 
   simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
   simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid);
index 2c2c1ca..86011db 100644 (file)
@@ -11,17 +11,3 @@ $ ./pid ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
 > [  0.001206] (sendpid@Tremblay) Send of pid "3" done.
 > [  0.001206] (killall@Tremblay) Killing process "3".
 > [  0.001206] (sendpid@Tremblay) Process "3" killed.
-
-$ ./pid ${platfdir}/small_platform.xml 2 "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
-> [  0.000000] (sendpid@Tremblay) Sending pid of "2".
-> [  0.000000] (sendpid@Tremblay) Sending pid of "3".
-> [  0.000000] (sendpid@Tremblay) Sending pid of "4".
-> [  0.000402] (killall@Tremblay) Killing process "2".
-> [  0.000402] (sendpid@Tremblay) Send of pid "2" done.
-> [  0.000402] (sendpid@Tremblay) Process "2" killed.
-> [  0.000804] (sendpid@Tremblay) Send of pid "3" done.
-> [  0.000804] (killall@Tremblay) Killing process "3".
-> [  0.000804] (sendpid@Tremblay) Process "3" killed.
-> [  0.001206] (sendpid@Tremblay) Send of pid "4" done.
-> [  0.001206] (killall@Tremblay) Killing process "4".
-> [  0.001206] (sendpid@Tremblay) Process "4" killed.
index 3426e6b..a524e29 100644 (file)
@@ -1,13 +1,14 @@
-/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2018. 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/s4u.hpp"
-#include "src/plugins/file_system/FileSystem.hpp"
-#include <string>
+#include <simgrid/plugins/file_system.h>
+#include <simgrid/s4u.hpp>
 #include <xbt/string.hpp>
 
+#include <string>
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
 
 static void display_storage_properties(simgrid::s4u::Storage* storage)
@@ -90,14 +91,12 @@ static void get_set_storage_data(const std::string& storage_name)
 
 static void dump_platform_storages()
 {
-  std::map<std::string, simgrid::s4u::Storage*>* storages = new std::map<std::string, simgrid::s4u::Storage*>;
-  simgrid::s4u::getStorageList(storages);
+  std::vector<simgrid::s4u::Storage*> storages = simgrid::s4u::Engine::getInstance()->getAllStorages();
 
-  for (auto const& storage : *storages) {
-    XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname());
-    storage.second->setProperty("other usage", "gpfs");
+  for (auto const& s : storages) {
+    XBT_INFO("Storage %s is attached to %s", s->getCname(), s->getHost()->getCname());
+    s->setProperty("other usage", "gpfs");
   }
-  delete storages;
 }
 
 static void storage_info(simgrid::s4u::Host* host)
index f059384..b0d6575 100644 (file)
@@ -21,6 +21,7 @@ foreach(x flatifier is-router)
   add_executable       (${x}  ${x}/${x}.cpp)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+  set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
   set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
index d2dde0e..80e2785 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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. */
@@ -6,10 +6,6 @@
 //teshsuite/simdag/platforms/evaluate_parse_time ../examples/platforms/nancy.xml
 
 #include <stdio.h>
-#include "src/internal_config.h"
-#if HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
 
 #include "simgrid/simdag.h"
 #include "xbt/xbt_os_time.h"
@@ -29,7 +25,7 @@ int main(int argc, char **argv)
   printf("Workstation number: %zu, link number: %d\n", sg_host_count(), sg_link_count());
   if(argv[2]){
     printf("Wait for %ss\n",argv[2]);
-    sleep(atoi(argv[2]));
+    xbt_os_sleep(atoi(argv[2]));
   }
 
 
index cd94fdc..21b2947 100644 (file)
@@ -1,16 +1,14 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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 <xbt/xbt_os_time.h>
 
+#include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-
 #include "simgrid/simdag.h"
-
-#include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 
 #include <algorithm>
index 88b6530..5442286 100644 (file)
@@ -1,12 +1,13 @@
-/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2018. 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/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/simdag.h"
-#include "src/kernel/routing/NetPoint.hpp"
+
 #include <algorithm>
 #include <cstdio>
 
index f54367c..6c75a45 100644 (file)
@@ -34,8 +34,7 @@ set(tesh_files    ${tesh_files}     ${CMAKE_CURRENT_SOURCE_DIR}/coll-allreduce/c
                                     ${CMAKE_CURRENT_SOURCE_DIR}/coll-allreduce/coll-allreduce-automatic.tesh
                                     ${CMAKE_CURRENT_SOURCE_DIR}/coll-alltoall/clusters.tesh
                                     ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt-pingpong/broken_hostfiles.tesh
-                                    ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt-pingpong/TI_output.tesh              
-                                    ${CMAKE_CURRENT_SOURCE_DIR}/privatization/privatization_dlopen.tesh                             PARENT_SCOPE)
+                                    ${CMAKE_CURRENT_SOURCE_DIR}/pt2pt-pingpong/TI_output.tesh                                       PARENT_SCOPE)
 set(bin_files       ${bin_files}    ${CMAKE_CURRENT_SOURCE_DIR}/hostfile
                                     ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_cluster
                                     ${CMAKE_CURRENT_SOURCE_DIR}/hostfile_coll
@@ -120,9 +119,8 @@ if(enable_smpi)
 
   # Simple privatization tests
   if(HAVE_PRIVATIZATION)
-    ADD_TESH_FACTORIES(tesh-smpi-privatization-mmap  "thread;ucontext;raw;boost"   --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/privatization --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/privatization privatization.tesh)
+    foreach(PRIVATIZATION dlopen mmap)
+      ADD_TESH_FACTORIES(tesh-smpi-privatization-${PRIVATIZATION}  "thread;ucontext;raw;boost" --setenv privatization=${PRIVATIZATION} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/privatization --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/privatization privatization.tesh)
+    endforeach()
   endif()
-
-    ADD_TESH_FACTORIES(tesh-smpi-privatization-dlopen  "thread;ucontext;raw;boost"   --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/privatization --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/privatization privatization_dlopen.tesh)
-
 endif()
index e9d42a1..e1c5459 100644 (file)
@@ -25,7 +25,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
   add_executable(allred5 allred5.c)
   add_executable(allred6 allred6.c)
   if(HAVE_PRIVATIZATION)
-  add_executable(allred allred.c)
+    add_executable(allred allred.c)
   else()
     add_executable(allred allred_manual.c)
   endif()
@@ -209,60 +209,37 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
   # But at the same time, we'd like to check if they work for all factories and all privatization algorithm
   # Thus the current matrix
 
-  # Test default selector: THREAD if available; RAW if not (with mmap privatization or none)
-  if(HAVE_THREAD_CONTEXTS)
-    ADD_TEST(test-smpi-mpich3-coll-thread      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
-    SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-thread    PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-  else()
-    if(HAVE_RAW_CONTEXTS)
-    ADD_TEST(test-smpi-mpich3-coll-raw      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
-    SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+  MACRO(ADD_MPICH3_COLL SELECTOR FACTORY PRIVATIZATION)
+    set(NAME "test-smpi-mpich3-coll-${SELECTOR}")
+    set(ARGS "-execarg=--cfg=smpi/coll-selector:${SELECTOR}" ${ARGN})
+    string(TOUPPER "HAVE_${FACTORY}_CONTEXTS" HAVE_FACTORY)
+    if(NOT "${FACTORY}" STREQUAL "" AND ${HAVE_FACTORY})
+      set(NAME "${NAME}-${FACTORY}")
+      set(ARGS ${ARGS} "-execarg=--cfg=contexts/factory:${FACTORY}")
     endif()
-  endif()
-  
-  # Test OMPI selector: CONTEXT if available; RAW if not (with mmap privatization or none)
-  if(HAVE_UCONTEXT_CONTEXTS)
-    ADD_TEST(test-smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll-selector:ompi -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
-    SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-ompi-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-  else()
-    if(HAVE_RAW_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-coll-ompi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:ompi -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
-    SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-ompi-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+    if(NOT "${PRIVATIZATION}" STREQUAL "" AND HAVE_PRIVATIZATION)
+      set(NAME "${NAME}-${PRIVATIZATION}")
+      set(ARGS ${ARGS} "-execarg=--cfg=smpi/privatization:${PRIVATIZATION}")
     endif()
-  endif()
+    ADD_TEST(${NAME} ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist ${ARGS})
+    SET_TESTS_PROPERTIES(${NAME} PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+  ENDMACRO()
 
-  # Test MPICH selector: dlopen privatization and PTHREAD if exists (without priv and with raw if not)
-  if(HAVE_PRIVATIZATION AND HAVE_BOOST_CONTEXTS)
-    ADD_TEST(test-smpi-mpich3-coll-mpich-boost-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:boost -execarg=--cfg=smpi/coll-selector:mpich -execarg=--cfg=smpi/privatization:dlopen)
-    SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mpich-boost-dlopen PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-  else()
-    if(HAVE_RAW_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:mpich -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mpich-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    endif()
-  endif()
+  # Test default selector; default factory; default privatization
+  ADD_MPICH3_COLL(default "" "")
 
-  # Test MVAPICH2 selector: dlopen privatization and UCONTEXT if exists (without priv and with raw if not)
-  if(HAVE_PRIVATIZATION AND HAVE_UCONTEXT_CONTEXTS)
-    ADD_TEST(test-smpi-mpich3-coll-mvapich2-ucontext-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll-selector:mvapich2 -execarg=--cfg=smpi/privatization:dlopen)
-    SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mvapich2-ucontext-dlopen PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-  else()
-    if(HAVE_RAW_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-coll-mvapich2-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:mvapich2 -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mvapich2-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    endif()
-  endif()
+  # Test OMPI selector: thread factory, dlopen privatization
+  ADD_MPICH3_COLL(ompi "thread" "dlopen" -execarg=--cfg=smpi/bcast:binomial_tree)
+
+  # Test MPICH selector: boost factory, dlopen privatization
+  ADD_MPICH3_COLL(mpich "boost" "dlopen")
+
+  # Test MVAPICH2 selector: ucontext factory, mmap privatization
+  ADD_MPICH3_COLL(mvapich2 "ucontext" "mmap")
+
+  # Test IMPI selector: raw factory, mmap privatization
+  ADD_MPICH3_COLL(impi "raw" "mmap")
 
-  # Test IMPI selector: always raw, with dlopen if priv exists
-  if(HAVE_RAW_CONTEXTS)
-    if(HAVE_PRIVATIZATION)
-      ADD_TEST(test-smpi-mpich3-coll-impi-raw-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:impi -execarg=--cfg=smpi/privatization:dlopen)
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-impi-raw-dlopen  PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    else()
-      ADD_TEST(test-smpi-mpich3-coll-impi-raw-nopriv ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:impi -execarg=--cfg=smpi/privatization:no)
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-impi-raw-nopriv  PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    endif()
-  endif()
 endif()
 
 set(examples_src  ${examples_src}
index aa0817c..ae88669 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include "mpitest.h"
 
-int err = 0;
+int errs = 0;
 
 /* left(x,y) ==> x */
 void left(void *a, void *b, int *count, MPI_Datatype * type);
@@ -29,7 +29,7 @@ void left(void *a, void *b, int *count, MPI_Datatype * type)
 
     for (i = 0; i < *count; ++i) {
         if (in[i] > inout[i])
-            ++err;
+            ++errs;
         inout[i] = in[i];
     }
 }
@@ -44,7 +44,7 @@ void right(void *a, void *b, int *count, MPI_Datatype * type)
 
     for (i = 0; i < *count; ++i) {
         if (in[i] > inout[i])
-            ++err;
+            ++errs;
         inout[i] = inout[i];
     }
 }
@@ -99,18 +99,18 @@ int main(int argc, char **argv)
         MPI_Reduce_scatter_block(sendbuf, recvbuf, block_size, MPI_INT, left_op, comm);
         for (i = 0; i < block_size; ++i)
             if (recvbuf[i] != (rank * block_size + i))
-                ++err;
+                ++errs;
 
         MPI_Reduce_scatter_block(sendbuf, recvbuf, block_size, MPI_INT, right_op, comm);
         for (i = 0; i < block_size; ++i)
             if (recvbuf[i] != ((size - 1) + (rank * block_size) + i))
-                ++err;
+                ++errs;
 
         MPI_Reduce_scatter_block(sendbuf, recvbuf, block_size, MPI_INT, nc_sum_op, comm);
         for (i = 0; i < block_size; ++i) {
             int x = rank * block_size + i;
             if (recvbuf[i] != (size * x + (size - 1) * size / 2))
-                ++err;
+                ++errs;
         }
 
         free(recvbuf);
@@ -122,8 +122,8 @@ int main(int argc, char **argv)
     MPI_Op_free(&nc_sum_op);
 #endif
 
-    MTest_Finalize(err);
+    MTest_Finalize(errs);
     MPI_Finalize();
 
-    return err;
+    return errs;
 }
index 4c14537..1f59bcd 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include "mpitest.h"
 
-int err = 0;
+int errs = 0;
 
 /* left(x,y) ==> x */
 void left(void *a, void *b, int *count, MPI_Datatype * type);
@@ -29,7 +29,7 @@ void left(void *a, void *b, int *count, MPI_Datatype * type)
 
     for (i = 0; i < *count; ++i) {
         if (in[i] > inout[i])
-            ++err;
+            ++errs;
         inout[i] = in[i];
     }
 }
@@ -44,7 +44,7 @@ void right(void *a, void *b, int *count, MPI_Datatype * type)
 
     for (i = 0; i < *count; ++i) {
         if (in[i] > inout[i])
-            ++err;
+            ++errs;
         inout[i] = inout[i];
     }
 }
@@ -99,18 +99,18 @@ int main(int argc, char **argv)
         MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, MPI_INT, left_op, comm);
         for (i = 0; i < block_size; ++i)
             if (recvbuf[i] != (rank * block_size + i))
-                ++err;
+                ++errs;
 
         MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, MPI_INT, right_op, comm);
         for (i = 0; i < block_size; ++i)
             if (recvbuf[i] != ((size - 1) + (rank * block_size) + i))
-                ++err;
+                ++errs;
 
         MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, MPI_INT, nc_sum_op, comm);
         for (i = 0; i < block_size; ++i) {
             int x = rank * block_size + i;
             if (recvbuf[i] != (size * x + (size - 1) * size / 2))
-                ++err;
+                ++errs;
         }
 
         free(recvbuf);
@@ -122,8 +122,8 @@ int main(int argc, char **argv)
     MPI_Op_free(&right_op);
     MPI_Op_free(&nc_sum_op);
 
-    MTest_Finalize(err);
+    MTest_Finalize(errs);
     MPI_Finalize();
 
-    return err;
+    return errs;
 }
index b4bf519..44b28a7 100644 (file)
@@ -12,7 +12,8 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
   foreach(file blockindexed-zero-count contigstruct contig-zero-count cxx-types dataalign gaddress hindexed_block
           hindexed_block_contents hvecblklen large_vec localpack longdouble simple-commit simple-pack simple-resized simple-size-extent
           struct-derived-zeros struct-ezhov struct-pack struct-verydeep struct-zero-count tfree transpose-pack tresized2
-          tresized typecommit typefree typelb typename unpack vecblklen zeroblks zeroparms)
+          tresized typecommit typefree typelb typename unpack vecblklen zeroblks zeroparms
+          subarray subarray-pack)
     # not compiled files
     # blockindexed-misc contents darray-cyclic darray-pack get-elements get-elements-pairtype getpartelm get-struct
     # hindexed-zeros indexed-misc large-count large_type large_type_sendrec lbub lots-of-type pairtype-pack
@@ -33,7 +34,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
 endif()
 
 if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
-  ADD_TEST(test-smpi-mpich3-datatype-raw   ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/datatype ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/datatype -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+  ADD_TEST(test-smpi-mpich3-datatype-raw   ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/datatype ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/datatype -tests=testlist -execarg=--cfg=contexts/factory:raw)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-datatype-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
 endif()
 
index aa73700..09338a7 100644 (file)
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-static int verbose = 0;
+static int verbose = 1;
 
 /* tests */
 int subarray_1d_c_test1(void);
index c084bb3..98fb32c 100644 (file)
@@ -31,9 +31,8 @@ blockindexed-zero-count 1
 #needs better handling of lb/ub
 #blockindexed-misc 1
 #indexed-misc 1
-#needs MPI_Type_create_subarray
-#subarray-pack 1
-#subarray 2
+subarray-pack 1
+subarray 2
 #needs MPI_Type_create_darray
 #darray-pack 1
 #darray-pack 9
index bda4c89..330fd1f 100644 (file)
@@ -21,7 +21,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
 #  add_executable(typename3f typename3f.f)
 #  add_executable(typenamef typenamef.f)
 #  add_executable(typesnamef typesnamef.f)
-#  add_executable(typesubf typesubf.f)
+  add_executable(typesubf typesubf.f)
 
 #  target_link_libraries(allctypesf simgrid mtest_f77)
   target_link_libraries(gaddressf simgrid mtest_f77)
@@ -33,7 +33,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
 #  target_link_libraries(typename3f simgrid mtest_f77)
 #  target_link_libraries(typenamef simgrid mtest_f77)
 #  target_link_libraries(typesnamef simgrid mtest_f77)
-#  target_link_libraries(typesubf simgrid mtest_f77)
+  target_link_libraries(typesubf simgrid mtest_f77)
 endif()
 
 set(examples_src
index 5da0524..a9e8dcd 100644 (file)
@@ -3,7 +3,7 @@
 #typesnamef 1
 #typecntsf 1
 #typem2f 1
-#typesubf 1
+typesubf 1
 #packef 1
 gaddressf 1
 #allctypesf 1
index e7f7e95..652b019 100644 (file)
@@ -26,7 +26,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
 #  add_executable(typename3f90 typename3f90.f90)
 #  add_executable(typenamef90 typenamef90.f90)
 #  add_executable(typesnamef90 typesnamef90.f90)
-#  add_executable(typesubf90 typesubf90.f90)
+  add_executable(typesubf90 typesubf90.f90)
 #  target_link_libraries(allctypesf90 simgrid mtest_f90)
  # target_link_libraries(createf90 simgrid mtest_f90)
   target_link_libraries(gaddressf90 simgrid mtest_f90)
@@ -45,7 +45,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
 #  target_link_libraries(typename3f90 simgrid mtest_f90)
 #  target_link_libraries(typenamef90 simgrid mtest_f90)
 #  target_link_libraries(typesnamef90 simgrid mtest_f90)
-#  target_link_libraries(typesubf90 simgrid mtest_f90)
+  target_link_libraries(typesubf90 simgrid mtest_f90)
 endif()
 
 set(examples_src
index 123a623..3d05a6b 100644 (file)
@@ -6,8 +6,8 @@
 ! This test contributed by Kim McMahon, Cray
 !
       program main
-      implicit none
       use mpi
+      implicit none
 
       integer ierr, i, j, type, count,errs
       parameter (count = 4)
index 715c66a..5b158a0 100644 (file)
@@ -4,7 +4,7 @@
 #typesnamef90 1
 #typecntsf90 1
 #typem2f90 1
-#typesubf90 1
+typesubf90 1
 #packef90 1
 gaddressf90 1
 #allctypesf90 1
index f0534df..67b7148 100644 (file)
@@ -16,7 +16,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
 endif()
 
 if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
-  ADD_TEST(test-smpi-mpich3-info-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/info ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/info -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+  ADD_TEST(test-smpi-mpich3-info-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/info ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/info -tests=testlist -execarg=--cfg=contexts/factory:raw)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-info-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
 endif()
 
index e92bcd1..b00a3f7 100644 (file)
@@ -17,7 +17,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
 endif()
 
 if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
-  ADD_TEST(test-smpi-mpich3-perf-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -tests=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf/testlist -execarg=-platform\ ${CMAKE_HOME_DIRECTORY}/examples/platforms/cluster.xml -execarg=--log=root.thr:critical -execarg=--cfg=smpi/async-small-thresh:65536 -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/host-speed:-1)
+  ADD_TEST(test-smpi-mpich3-perf-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -tests=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf/testlist -execarg=-platform\ ${CMAKE_HOME_DIRECTORY}/examples/platforms/cluster.xml -execarg=--log=root.thr:critical -execarg=--cfg=smpi/async-small-thresh:65536 -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/simulate-computation:0)
 endif()
 
 foreach(file allredtrace commcreatep non_zero_root sendrecvl timer transp-datatype twovec dtpack indexperf manyrma 
index 553c2db..0ab6f41 100644 (file)
@@ -13,8 +13,6 @@
 
 #define ERROR_MARGIN 0.5
 
-static int verbose = 0;
-
 int main(int argc, char *argv[])
 {
     char *sbuf, *rbuf;
@@ -27,9 +25,6 @@ int main(int argc, char *argv[])
     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
     MPI_Comm_size(MPI_COMM_WORLD, &size);
 
-    if (getenv("MPITEST_VERBOSE"))
-        verbose = 1;
-
     /* Allocate memory regions to communicate */
     sbuf = (char *) malloc(SIZE);
     rbuf = (char *) malloc(size * SIZE);
index a56dd96..fe83c0d 100644 (file)
@@ -19,7 +19,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
 endif()
 
 if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
-  ADD_TEST(test-smpi-mpich3-pt2pt-raw      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/pt2pt ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/pt2pt -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+  ADD_TEST(test-smpi-mpich3-pt2pt-raw      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/pt2pt ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/pt2pt -tests=testlist -execarg=--cfg=contexts/factory:raw)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-pt2pt-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
 endif()
 
index 2cae007..8976b75 100644 (file)
@@ -11,8 +11,6 @@
 #endif
 #include "mpi.h"
 
-static int verbose = 0;
-
 int main(int argc, char *argv[]);
 int parse_args(int argc, char **argv);
 
@@ -74,12 +72,10 @@ int parse_args(int argc, char **argv)
      * {
      * switch (ret) {
      * case 'v':
-     * verbose = 1;
+     * verbose = 1; <-- never used, thus removed
      * break;
      * }
      * }
      */
-    if (argc > 1 && strcmp(argv[1], "-v") == 0)
-        verbose = 1;
     return 0;
 }
index 1a1dcad..51bcf55 100644 (file)
@@ -40,7 +40,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
 endif()
 
 if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
-  ADD_TEST(test-smpi-mpich3-rma-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/rma ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+  ADD_TEST(test-smpi-mpich3-rma-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/rma ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma -tests=testlist -execarg=--cfg=contexts/factory:raw)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-rma-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
 endif()
 
index af18147..eb661f5 100644 (file)
@@ -113,7 +113,7 @@ static void *MTestTypeContigInit(MTestDatatype * mtype)
         p = (unsigned char *) (mtype->buf);
         if (!p) {
             char errmsg[128] = { 0 };
-            sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+            sprintf(errmsg, "Out of memory in %s", __func__);
             MTestError(errmsg);
         }
         for (i = 0; i < totsize; i++) {
@@ -191,7 +191,7 @@ static void *MTestTypeVectorInit(MTestDatatype * mtype)
         p = (unsigned char *) (mtype->buf);
         if (!p) {
             char errmsg[128] = { 0 };
-            sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+            sprintf(errmsg, "Out of memory in %s", __func__);
             MTestError(errmsg);
         }
 
@@ -301,7 +301,7 @@ static void *MTestTypeIndexedInit(MTestDatatype * mtype)
         p = (unsigned char *) (mtype->buf);
         if (!p) {
             char errmsg[128] = { 0 };
-            sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+            sprintf(errmsg, "Out of memory in %s", __func__);
             MTestError(errmsg);
         }
 
@@ -419,7 +419,7 @@ static void *MTestTypeIndexedBlockInit(MTestDatatype * mtype)
         p = (unsigned char *) (mtype->buf);
         if (!p) {
             char errmsg[128] = { 0 };
-            sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+            sprintf(errmsg, "Out of memory in %s", __func__);
             MTestError(errmsg);
         }
 
@@ -530,7 +530,7 @@ static void *MTestTypeSubarrayInit(MTestDatatype * mtype)
         p = (unsigned char *) (mtype->buf);
         if (!p) {
             char errmsg[128] = { 0 };
-            sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+            sprintf(errmsg, "Out of memory in %s", __func__);
             MTestError(errmsg);
         }
 
@@ -630,7 +630,7 @@ static int MTestTypeSubarrayCheckbuf(MTestDatatype * mtype)
         }
     }
     if (err)
-        printf("%s error\n", __FUNCTION__);
+      printf("%s error\n", __func__);
     return err;
 }
 
@@ -813,7 +813,7 @@ static int MTestTypeIndexedCreate(MPI_Aint nblock, MPI_Aint blocklen, MPI_Aint s
     mtype->index = (int *) malloc(nblock * sizeof(int));
     if (!mtype->displs || !mtype->displ_in_bytes || !mtype->index) {
         char errmsg[128] = { 0 };
-        sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+        sprintf(errmsg, "Out of memory in %s", __func__);
         MTestError(errmsg);
     }
 
@@ -875,7 +875,7 @@ static inline int MTestTypeHindexedCreate(MPI_Aint nblock, MPI_Aint blocklen, MP
     mtype->displ_in_bytes = (MPI_Aint *) malloc(nblock * sizeof(MPI_Aint));
     if (!mtype->displ_in_bytes || !mtype->index) {
         char errmsg[128] = { 0 };
-        sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+        sprintf(errmsg, "Out of memory in %s", __func__);
         MTestError(errmsg);
     }
 
@@ -939,7 +939,7 @@ static int MTestTypeIndexedBlockCreate(MPI_Aint nblock, MPI_Aint blocklen, MPI_A
     mtype->displ_in_bytes = (MPI_Aint *) malloc(nblock * sizeof(MPI_Aint));
     if (!mtype->displs || !mtype->displ_in_bytes) {
         char errmsg[128] = { 0 };
-        sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+        sprintf(errmsg, "Out of memory in %s", __func__);
         MTestError(errmsg);
     }
 
@@ -1001,7 +1001,7 @@ static int MTestTypeHindexedBlockCreate(MPI_Aint nblock, MPI_Aint blocklen, MPI_
     mtype->displ_in_bytes = (MPI_Aint *) malloc(nblock * sizeof(MPI_Aint));
     if (!mtype->displ_in_bytes) {
         char errmsg[128] = { 0 };
-        sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+        sprintf(errmsg, "Out of memory in %s", __func__);
         MTestError(errmsg);
     }
 
@@ -1065,7 +1065,7 @@ static int MTestTypeStructCreate(MPI_Aint nblock, MPI_Aint blocklen, MPI_Aint st
     mtype->index = (int *) malloc(nblock * sizeof(int));
     if (!mtype->displ_in_bytes || !mtype->old_datatypes) {
         char errmsg[128] = { 0 };
-        sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+        sprintf(errmsg, "Out of memory in %s", __func__);
         MTestError(errmsg);
     }
 
@@ -1303,7 +1303,7 @@ void *MTestTypeInitRecv(MTestDatatype * mtype)
         p = (signed char *) (mtype->buf);
         if (!p) {
             char errmsg[128] = { 0 };
-            sprintf(errmsg, "Out of memory in %s", __FUNCTION__);
+            sprintf(errmsg, "Out of memory in %s", __func__);
             MTestError(errmsg);
         }
         for (i = 0; i < totsize; i++) {
index 11eb0de..76dd032 100644 (file)
@@ -335,9 +335,9 @@ static inline int MTestGetBasicDatatypes(MTestDatatype * sendtype,
     int merr = 0;
     int bdt_index = datatype_index - MTEST_BDT_START_IDX;
     if (bdt_index >= MTEST_BDT_MAX) {
-        printf("Wrong index:  global %d, bst %d in %s\n", datatype_index, bdt_index, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, bst %d in %s\n", datatype_index, bdt_index, __func__);
+      merr++;
+      return merr;
     }
 
     switch (bdt_index) {
@@ -400,20 +400,20 @@ static inline int MTestGetSendDerivedDatatypes(MTestDatatype * sendtype,
     ddt_datatype_index = datatype_index - MTEST_SEND_DDT_START_IDX;
     ddt_c_dt = ddt_datatype_index / MTEST_DDT_NUM_SUBTESTS;
     if (ddt_c_dt >= MTEST_DDT_MAX || !mtestDdtCreators[ddt_c_dt]) {
-        printf("Wrong index:  global %d, send %d send-ddt %d, or undefined creator in %s\n",
-               datatype_index, ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, send %d send-ddt %d, or undefined creator in %s\n", datatype_index,
+             ddt_datatype_index, ddt_c_dt, __func__);
+      merr++;
+      return merr;
     }
 
     /* Set datatype structure */
     merr = MTestDdtStructDefine(ddt_datatype_index, tot_count, &count, &blen,
                                 &stride, &align_tot_count, &lb);
     if (merr) {
-        printf("Wrong index:  global %d, send %d send-ddt %d, or undefined ddt structure in %s\n",
-               datatype_index, ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, send %d send-ddt %d, or undefined ddt structure in %s\n", datatype_index,
+             ddt_datatype_index, ddt_c_dt, __func__);
+      merr++;
+      return merr;
     }
 
     /* Create send datatype */
@@ -445,19 +445,19 @@ static inline int MTestGetRecvDerivedDatatypes(MTestDatatype * sendtype,
     ddt_datatype_index = datatype_index - MTEST_RECV_DDT_START_IDX;
     ddt_c_dt = ddt_datatype_index / MTEST_DDT_NUM_SUBTESTS;
     if (ddt_c_dt >= MTEST_DDT_MAX || !mtestDdtCreators[ddt_c_dt]) {
-        printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined creator in %s\n",
-               datatype_index, ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined creator in %s\n", datatype_index,
+             ddt_datatype_index, ddt_c_dt, __func__);
+      merr++;
+      return merr;
     }
 
     /* Set datatype structure */
     merr = MTestDdtStructDefine(ddt_datatype_index, tot_count, &count, &blen,
                                 &stride, &align_tot_count, &lb);
     if (merr) {
-        printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined ddt structure in %s\n",
-               datatype_index, ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        return merr;
+      printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined ddt structure in %s\n", datatype_index,
+             ddt_datatype_index, ddt_c_dt, __func__);
+      return merr;
     }
 
     /* Create receive datatype */
index 8076351..7e271d1 100644 (file)
@@ -341,9 +341,9 @@ static inline int MTestGetBasicDatatypes(MTestDatatype * sendtype,
     int merr = 0;
     int bdt_index = SMPI_VARGET_GLOBAL(datatype_index) - SMPI_VARGET_GLOBAL(MTEST_BDT_START_IDX);
     if (bdt_index >= MTEST_BDT_MAX) {
-        printf("Wrong index:  global %d, bst %d in %s\n", SMPI_VARGET_GLOBAL(datatype_index), bdt_index, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, bst %d in %s\n", SMPI_VARGET_GLOBAL(datatype_index), bdt_index, __func__);
+      merr++;
+      return merr;
     }
 
     switch (bdt_index) {
@@ -406,20 +406,20 @@ static inline int MTestGetSendDerivedDatatypes(MTestDatatype * sendtype,
     ddt_datatype_index = SMPI_VARGET_GLOBAL(datatype_index) - SMPI_VARGET_GLOBAL(MTEST_SEND_DDT_START_IDX);
     ddt_c_dt = ddt_datatype_index / MTEST_DDT_NUM_SUBTESTS;
     if (ddt_c_dt >= MTEST_DDT_MAX || !SMPI_VARGET_GLOBAL(mtestDdtCreators)[ddt_c_dt]) {
-        printf("Wrong index:  global %d, send %d send-ddt %d, or undefined creator in %s\n",
-               SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, send %d send-ddt %d, or undefined creator in %s\n",
+             SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __func__);
+      merr++;
+      return merr;
     }
 
     /* Set datatype structure */
     merr = MTestDdtStructDefine(ddt_datatype_index, tot_count, &count, &blen,
                                 &stride, &align_tot_count, &lb);
     if (merr) {
-        printf("Wrong index:  global %d, send %d send-ddt %d, or undefined ddt structure in %s\n",
-               SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, send %d send-ddt %d, or undefined ddt structure in %s\n",
+             SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __func__);
+      merr++;
+      return merr;
     }
 
     /* Create send datatype */
@@ -451,19 +451,19 @@ static inline int MTestGetRecvDerivedDatatypes(MTestDatatype * sendtype,
     ddt_datatype_index = SMPI_VARGET_GLOBAL(datatype_index) - SMPI_VARGET_GLOBAL(MTEST_RECV_DDT_START_IDX);
     ddt_c_dt = ddt_datatype_index / MTEST_DDT_NUM_SUBTESTS;
     if (ddt_c_dt >= MTEST_DDT_MAX || !SMPI_VARGET_GLOBAL(mtestDdtCreators)[ddt_c_dt]) {
-        printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined creator in %s\n",
-               SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        merr++;
-        return merr;
+      printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined creator in %s\n",
+             SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __func__);
+      merr++;
+      return merr;
     }
 
     /* Set datatype structure */
     merr = MTestDdtStructDefine(ddt_datatype_index, tot_count, &count, &blen,
                                 &stride, &align_tot_count, &lb);
     if (merr) {
-        printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined ddt structure in %s\n",
-               SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __FUNCTION__);
-        return merr;
+      printf("Wrong index:  global %d, recv %d recv-ddt %d, or undefined ddt structure in %s\n",
+             SMPI_VARGET_GLOBAL(datatype_index), ddt_datatype_index, ddt_c_dt, __func__);
+      return merr;
     }
 
     /* Create receive datatype */
index c749a9e..fa4352a 100644 (file)
@@ -1,4 +1,4 @@
 p Test privatization
 ! timeout 5
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:1 --log=simix_context.thres:error --log=xbt_memory_map.thres:critical
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:${privatization:=1} --log=simix_context.thres:error --log=xbt_memory_map.thres:critical
 > You requested to use 32 ranks, but there is only 5 processes in your hostfile...
diff --git a/teshsuite/smpi/privatization/privatization_dlopen.tesh b/teshsuite/smpi/privatization/privatization_dlopen.tesh
deleted file mode 100644 (file)
index 6dea653..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-p Test privatization with dlopen
-! timeout 5
-$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:dlopen --log=simix_context.thres:error
-> You requested to use 32 ranks, but there is only 5 processes in your hostfile...
index 8bede3c..467abf9 100644 (file)
@@ -2,6 +2,7 @@ foreach(x lmm_usage surf_usage surf_usage2)
   add_executable       (${x}  ${x}/${x}.cpp)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+  set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
   set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
@@ -10,6 +11,7 @@ endforeach()
 add_executable       (maxmin_bench maxmin_bench/maxmin_bench.cpp)
 target_link_libraries(maxmin_bench simgrid)
 set_target_properties(maxmin_bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/maxmin_bench)
+set_property(TARGET maxmin_bench APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 
 foreach(x small medium large)
   set(tesh_files     ${tesh_files}     ${CMAKE_CURRENT_SOURCE_DIR}/maxmin_bench/maxmin_bench_${x}.tesh)
index c4ea52e..6bfc152 100644 (file)
@@ -1,7 +1,6 @@
 /* A few tests for the maxmin library                                       */
 
-/* Copyright (c) 2007-2018s. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2018. 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. */
@@ -17,7 +16,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example");
 
-using namespace simgrid::surf;
+using namespace simgrid::kernel;
 
 #define PRINT_VAR(var) XBT_DEBUG(#var " = %g", (var)->get_value())
 #define SHOW_EXPR(expr) XBT_DEBUG(#expr " = %g",expr)
@@ -28,6 +27,19 @@ using namespace simgrid::surf;
 
 enum method_t { MAXMIN, LAGRANGE_RENO, LAGRANGE_VEGAS };
 
+static lmm::System* new_system(method_t method, bool update)
+{
+  switch (method) {
+    case MAXMIN:
+      return lmm::make_new_maxmin_system(update);
+    case LAGRANGE_VEGAS:
+    case LAGRANGE_RENO:
+      return lmm::make_new_lagrange_system(update);
+    default:
+      xbt_die("Invalid method");
+  }
+}
+
 static double dichotomy(double func(double), double min, double max, double min_error)
 {
   double overall_error = 2 * min_error;
@@ -92,21 +104,19 @@ static void test1(method_t method)
   double b = 10.0;
 
   if (method == LAGRANGE_VEGAS)
-    set_default_protocol_function(simgrid::kernel::lmm::func_vegas_f, simgrid::kernel::lmm::func_vegas_fp,
-                                  simgrid::kernel::lmm::func_vegas_fpi);
+    lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
   else if (method == LAGRANGE_RENO)
-    set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fpi,
-                                  simgrid::kernel::lmm::func_reno_fpi);
+    lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
-  lmm_system_t Sys    = new simgrid::kernel::lmm::System(true);
-  simgrid::kernel::lmm::Constraint* L1 = Sys->constraint_new(nullptr, a);
-  simgrid::kernel::lmm::Constraint* L2 = Sys->constraint_new(nullptr, b);
-  simgrid::kernel::lmm::Constraint* L3 = Sys->constraint_new(nullptr, a);
+  lmm::System* Sys    = new_system(method, true);
+  lmm::Constraint* L1 = Sys->constraint_new(nullptr, a);
+  lmm::Constraint* L2 = Sys->constraint_new(nullptr, b);
+  lmm::Constraint* L3 = Sys->constraint_new(nullptr, a);
 
-  simgrid::kernel::lmm::Variable* R_1_2_3 = Sys->variable_new(nullptr, 1.0, -1.0, 3);
-  simgrid::kernel::lmm::Variable* R_1     = Sys->variable_new(nullptr, 1.0, -1.0, 1);
-  simgrid::kernel::lmm::Variable* R_2     = Sys->variable_new(nullptr, 1.0, -1.0, 1);
-  simgrid::kernel::lmm::Variable* R_3     = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+  lmm::Variable* R_1_2_3 = Sys->variable_new(nullptr, 1.0, -1.0, 3);
+  lmm::Variable* R_1     = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+  lmm::Variable* R_2     = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+  lmm::Variable* R_3     = Sys->variable_new(nullptr, 1.0, -1.0, 1);
 
   Sys->update_variable_weight(R_1_2_3, 1.0);
   Sys->update_variable_weight(R_1, 1.0);
@@ -122,7 +132,7 @@ static void test1(method_t method)
   Sys->expand(L3, R_3, 1.0);
 
   if (method == MAXMIN) {
-    lmm_solve(Sys);
+    Sys->solve();
   } else {
     double x;
     if (method == LAGRANGE_VEGAS) {
@@ -147,7 +157,7 @@ static void test1(method_t method)
       xbt_die( "Invalid method");
     }
 
-    lagrange_solve(Sys);
+    Sys->solve();
 
     double max_deviation = 0.0;
     max_deviation        = std::max(max_deviation, fabs(R_1->get_value() - x));
@@ -180,18 +190,17 @@ static void test1(method_t method)
 static void test2(method_t method)
 {
   if (method == LAGRANGE_VEGAS)
-    set_default_protocol_function(simgrid::kernel::lmm::func_vegas_f, simgrid::kernel::lmm::func_vegas_fp,
-                                  simgrid::kernel::lmm::func_vegas_fpi);
+    lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
   if (method == LAGRANGE_RENO)
-    set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fp,
-                                  simgrid::kernel::lmm::func_reno_fpi);
+    lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
+
+  lmm::System* Sys = new_system(method, true);
 
-  lmm_system_t Sys      = new simgrid::kernel::lmm::System(true);
-  simgrid::kernel::lmm::Constraint* CPU1 = Sys->constraint_new(nullptr, 200.0);
-  simgrid::kernel::lmm::Constraint* CPU2 = Sys->constraint_new(nullptr, 100.0);
+  lmm::Constraint* CPU1 = Sys->constraint_new(nullptr, 200.0);
+  lmm::Constraint* CPU2 = Sys->constraint_new(nullptr, 100.0);
 
-  simgrid::kernel::lmm::Variable* T1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
-  simgrid::kernel::lmm::Variable* T2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+  lmm::Variable* T1 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
+  lmm::Variable* T2 = Sys->variable_new(nullptr, 1.0, -1.0, 1);
 
   Sys->update_variable_weight(T1, 1.0);
   Sys->update_variable_weight(T2, 1.0);
@@ -199,13 +208,7 @@ static void test2(method_t method)
   Sys->expand(CPU1, T1, 1.0);
   Sys->expand(CPU2, T2, 1.0);
 
-  if (method == MAXMIN) {
-    lmm_solve(Sys);
-  } else if (method == LAGRANGE_VEGAS || method == LAGRANGE_RENO) {
-    lagrange_solve(Sys);
-  } else {
-    xbt_die("Invalid method");
-  }
+  Sys->solve();
 
   PRINT_VAR(T1);
   PRINT_VAR(T2);
@@ -253,21 +256,19 @@ static void test3(method_t method)
   A[14][15] =                                        1.0;
 
   if (method == LAGRANGE_VEGAS)
-    set_default_protocol_function(simgrid::kernel::lmm::func_vegas_f, simgrid::kernel::lmm::func_vegas_fp,
-                                  simgrid::kernel::lmm::func_vegas_fpi);
+    lmm::Lagrange::set_default_protocol_function(lmm::func_vegas_f, lmm::func_vegas_fp, lmm::func_vegas_fpi);
   if (method == LAGRANGE_RENO)
-    set_default_protocol_function(simgrid::kernel::lmm::func_reno_f, simgrid::kernel::lmm::func_reno_fp,
-                                  simgrid::kernel::lmm::func_reno_fpi);
+    lmm::Lagrange::set_default_protocol_function(lmm::func_reno_f, lmm::func_reno_fp, lmm::func_reno_fpi);
 
-  lmm_system_t Sys = new simgrid::kernel::lmm::System(true);
+  lmm::System* Sys = new_system(method, true);
 
   /* Creates the constraints */
-  simgrid::kernel::lmm::Constraint** tmp_cnst = new simgrid::kernel::lmm::Constraint*[15];
+  lmm::Constraint** tmp_cnst = new lmm::Constraint*[15];
   for (int i = 0; i < 15; i++)
     tmp_cnst[i] = Sys->constraint_new(nullptr, B[i]);
 
   /* Creates the variables */
-  simgrid::kernel::lmm::Variable** tmp_var = new simgrid::kernel::lmm::Variable*[16];
+  lmm::Variable** tmp_var = new lmm::Variable*[16];
   for (int j = 0; j < 16; j++) {
     tmp_var[j] = Sys->variable_new(nullptr, 1.0, -1.0, 15);
     Sys->update_variable_weight(tmp_var[j], 1.0);
@@ -279,15 +280,7 @@ static void test3(method_t method)
       if (A[i][j])
         Sys->expand(tmp_cnst[i], tmp_var[j], 1.0);
 
-  if (method == MAXMIN) {
-    lmm_solve(Sys);
-  } else if (method == LAGRANGE_VEGAS) {
-    lagrange_solve(Sys);
-  } else if (method == LAGRANGE_RENO) {
-    lagrange_solve(Sys);
-  } else {
-    xbt_die("Invalid method");
-  }
+  Sys->solve();
 
   for (int j = 0; j < 16; j++)
     PRINT_VAR(tmp_var[j]);
index 1082238..c23689e 100644 (file)
@@ -17,7 +17,7 @@
 #include <cstdio>
 #include <cstdlib>
 
-using namespace simgrid::surf;
+using namespace simgrid::kernel;
 
 double date;
 int64_t seedx = 0;
@@ -40,11 +40,11 @@ static unsigned int int_random(int max)
 static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limit, unsigned int pw_max_limit,
                  float rate_no_limit, int max_share, int mode)
 {
-  simgrid::kernel::lmm::Constraint* cnst[nb_cnst];
-  simgrid::kernel::lmm::Variable* var[nb_var];
+  lmm::Constraint* cnst[nb_cnst];
+  lmm::Variable* var[nb_var];
   int used[nb_cnst];
 
-  lmm_system_t Sys = new simgrid::kernel::lmm::System(true);
+  lmm::System* Sys = new lmm::System(true);
 
   for (int i = 0; i < nb_cnst; i++) {
     cnst[i] = Sys->constraint_new(NULL, float_random(10.0));
@@ -81,7 +81,7 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
 
   fprintf(stderr,"Starting to solve(%i)\n",myrand()%1000);
   date = xbt_os_time() * 1000000;
-  lmm_solve(Sys);
+  Sys->solve();
   date = xbt_os_time() * 1000000 - date;
 
   if(mode==2){
index e05c1f5..412fe5a 100644 (file)
@@ -1,6 +1,6 @@
 /* A few basic tests for the surf library                                   */
 
-/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2018. 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. */
@@ -48,9 +48,9 @@ int main(int argc, char **argv)
   simgrid::kernel::resource::Action* actionB = hostB->pimpl_cpu->execution_start(1000.0);
   simgrid::kernel::resource::Action* actionC = hostB->pimpl_cpu->sleep(7.32);
 
-  simgrid::kernel::resource::Action::State stateActionA = actionA->getState();
-  simgrid::kernel::resource::Action::State stateActionB = actionB->getState();
-  simgrid::kernel::resource::Action::State stateActionC = actionC->getState();
+  simgrid::kernel::resource::Action::State stateActionA = actionA->get_state();
+  simgrid::kernel::resource::Action::State stateActionB = actionB->get_state();
+  simgrid::kernel::resource::Action::State stateActionC = actionC->get_state();
 
   /* And just look at the state of these tasks */
   XBT_INFO("actionA state: %s", string_action(stateActionA));
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
     XBT_INFO("Next Event : %g", surf_get_clock());
     XBT_DEBUG("\t CPU actions");
 
-    simgrid::kernel::resource::ActionList* action_list = surf_cpu_model_pm->getFailedActionSet();
+    simgrid::kernel::resource::Action::StateSet* action_list = surf_cpu_model_pm->get_failed_action_set();
     while (not action_list->empty()) {
       simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   CPU Failed action");
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
       action.unref();
     }
 
-    action_list = surf_cpu_model_pm->getDoneActionSet();
+    action_list = surf_cpu_model_pm->get_done_action_set();
     while (not action_list->empty()) {
       simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   CPU Done action");
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
       action.unref();
     }
 
-    action_list = surf_network_model->getFailedActionSet();
+    action_list = surf_network_model->get_failed_action_set();
     while (not action_list->empty()) {
       simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   Network Failed action");
@@ -90,7 +90,7 @@ int main(int argc, char **argv)
       action.unref();
     }
 
-    action_list = surf_network_model->getDoneActionSet();
+    action_list = surf_network_model->get_done_action_set();
     while (not action_list->empty()) {
       simgrid::kernel::resource::Action& action = action_list->front();
       XBT_INFO("   Network Done action");
@@ -98,8 +98,9 @@ int main(int argc, char **argv)
       action.unref();
     }
 
-  } while ((surf_network_model->getRunningActionSet()->size() ||
-           surf_cpu_model_pm->getRunningActionSet()->size()) && surf_solve(-1.0) >= 0.0);
+  } while (
+      (surf_network_model->get_running_action_set()->size() || surf_cpu_model_pm->get_running_action_set()->size()) &&
+      surf_solve(-1.0) >= 0.0);
 
   XBT_DEBUG("Simulation Terminated");
 
index 8a16af4..bd505c8 100644 (file)
@@ -11,6 +11,7 @@ foreach(x parmap_bench parmap_test)
   add_executable       (${x}  ${x}/${x}.cpp)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+  set_property(TARGET ${x} APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
   set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
@@ -19,7 +20,8 @@ endforeach()
 if(HAVE_MMALLOC)
   add_executable       (mmalloc_test ${CMAKE_CURRENT_SOURCE_DIR}/mmalloc/mmalloc_test.cpp)
   target_link_libraries(mmalloc_test simgrid)
-  set_target_properties(mmalloc_test  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mmalloc)
+  set_target_properties(mmalloc_test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mmalloc)
+  set_property(TARGET mmalloc_test APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 endif()
 
 set(tesh_files    ${tesh_files}     ${CMAKE_CURRENT_SOURCE_DIR}/log_usage/log_usage_ndebug.tesh
index 180b254..d8e3ffb 100644 (file)
@@ -1,6 +1,8 @@
 #include "xbt/mallocator.h"
 #include "xbt.h"
 
+#include <stdio.h> /* snprintf */
+
 typedef struct element {
   int value;
 } s_element_t;
index dc86382..a39cf7d 100644 (file)
@@ -1,7 +1,6 @@
 /* synchro_crashtest -- tries to crash the logging mechanism by doing parallel logs*/
 
-/* Copyright (c) 2007-2017. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2018. 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. */
@@ -9,6 +8,8 @@
 #include "simgrid/msg.h"
 #include "xbt.h"
 
+#include <stdio.h> /* snprintf */
+
 XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example");
 
 const int test_amount    = 99;  /* Up to 99 to not break the logs (and thus the testing mechanism) */
index 4fbead4..ad18340 100644 (file)
@@ -1,12 +1,12 @@
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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 "src/internal_config.h" // HAVE_FUTEX_H
+#include "xbt/parmap.hpp"
 #include <simgrid/msg.h>
 #include <xbt.h>
-#include <xbt/parmap.hpp>
 
 #include <cstdlib>
 #include <numeric> // std::iota
index 4bee3f7..c592888 100644 (file)
@@ -5,9 +5,10 @@ set(EXTRA_DIST
   src/include/instr/instr_interface.h
   src/include/mc/datatypes.h
   src/include/mc/mc.h
-  src/include/simgrid/sg_config.h
+  src/include/simgrid/sg_config.hpp
   src/include/surf/surf.hpp
   src/include/xbt/parmap.hpp
+  src/include/xbt/mmalloc.h
   src/mc/mc_mmu.hpp
   src/mc/mc_record.hpp
   src/mc/PageStore.hpp
@@ -303,37 +304,22 @@ set(SURF_SRC
   src/kernel/lmm/maxmin.hpp
   src/kernel/lmm/maxmin.cpp
   
-  src/kernel/resource/Action.hpp
   src/kernel/resource/Action.cpp
-  src/kernel/resource/Model.hpp
   src/kernel/resource/Model.cpp
-  src/kernel/resource/Resource.hpp
   src/kernel/resource/Resource.cpp
   
   src/kernel/routing/ClusterZone.cpp
-  src/kernel/routing/ClusterZone.hpp
   src/kernel/routing/DijkstraZone.cpp
-  src/kernel/routing/DijkstraZone.hpp
   src/kernel/routing/DragonflyZone.cpp
-  src/kernel/routing/DragonflyZone.hpp
   src/kernel/routing/EmptyZone.cpp
-  src/kernel/routing/EmptyZone.hpp
   src/kernel/routing/FatTreeZone.cpp
-  src/kernel/routing/FatTreeZone.hpp
   src/kernel/routing/FloydZone.cpp
-  src/kernel/routing/FloydZone.hpp
   src/kernel/routing/FullZone.cpp
-  src/kernel/routing/FullZone.hpp
   src/kernel/routing/NetPoint.cpp
-  src/kernel/routing/NetPoint.hpp
   src/kernel/routing/NetZoneImpl.cpp
-  src/kernel/routing/NetZoneImpl.hpp
-  src/kernel/routing/RoutedZone.cpp
-  src/kernel/routing/RoutedZone.hpp
   src/kernel/routing/TorusZone.cpp
-  src/kernel/routing/TorusZone.hpp
+  src/kernel/routing/RoutedZone.cpp
   src/kernel/routing/VivaldiZone.cpp
-  src/kernel/routing/VivaldiZone.hpp  
   
   src/kernel/EngineImpl.cpp
   src/kernel/EngineImpl.hpp
@@ -369,7 +355,6 @@ set(SURF_SRC
   )
 
 set(PLUGINS_SRC
-  src/plugins/file_system/FileSystem.hpp
   src/plugins/file_system/s4u_FileSystem.cpp
   src/plugins/vm/VirtualMachineImpl.hpp
   src/plugins/vm/s4u_VirtualMachine.cpp
@@ -457,12 +442,11 @@ set(SIMGRID_SRC
 set(MSG_SRC
   src/msg/instr_msg_process.cpp
   src/msg/instr_msg_task.cpp
-  src/msg/msg_actions.cpp
   src/msg/msg_deployment.cpp
   src/msg/msg_environment.cpp
   src/msg/msg_global.cpp
   src/msg/msg_gos.cpp
-  src/msg/msg_host.cpp
+  src/msg/msg_legacy.cpp
   src/msg/msg_mailbox.cpp
   src/msg/msg_process.cpp
   src/msg/msg_synchro.cpp
@@ -674,6 +658,8 @@ set(MC_SRC
 set(MC_SIMGRID_MC_SRC  src/mc/checker/simgrid_mc.cpp)
 
 set(headers_to_install
+
+  include/simgrid/actor.h
   include/simgrid/chrono.hpp
   include/simgrid/plugins/dvfs.h
   include/simgrid/plugins/energy.h
@@ -691,6 +677,9 @@ set(headers_to_install
   include/simgrid/kernel/future.hpp
   include/simgrid/host.h
   include/simgrid/link.h
+  include/simgrid/storage.h
+  include/simgrid/vm.h
+  include/simgrid/zone.h
   include/simgrid/s4u/forward.hpp
   include/simgrid/s4u/Activity.hpp
   include/simgrid/s4u/Actor.hpp
@@ -706,6 +695,24 @@ set(headers_to_install
   include/simgrid/s4u/Storage.hpp  
   include/simgrid/s4u/VirtualMachine.hpp  
   include/simgrid/s4u.hpp
+
+  include/simgrid/kernel/resource/Action.hpp
+  include/simgrid/kernel/resource/Model.hpp
+  include/simgrid/kernel/resource/Resource.hpp
+
+  include/simgrid/kernel/routing/ClusterZone.hpp
+  include/simgrid/kernel/routing/DijkstraZone.hpp
+  include/simgrid/kernel/routing/DragonflyZone.hpp
+  include/simgrid/kernel/routing/EmptyZone.hpp
+  include/simgrid/kernel/routing/FatTreeZone.hpp
+  include/simgrid/kernel/routing/FloydZone.hpp
+  include/simgrid/kernel/routing/FullZone.hpp
+  include/simgrid/kernel/routing/NetPoint.hpp
+  include/simgrid/kernel/routing/NetZoneImpl.hpp
+  include/simgrid/kernel/routing/RoutedZone.hpp
+  include/simgrid/kernel/routing/TorusZone.hpp
+  include/simgrid/kernel/routing/VivaldiZone.hpp  
+
   include/smpi/mpi.h
   include/smpi/smpi.h
   include/smpi/smpi_main.h
@@ -738,7 +745,6 @@ set(headers_to_install
   include/xbt/log.hpp
   include/xbt/mallocator.h
   include/xbt/misc.h
-  include/xbt/mmalloc.h
   include/xbt/module.h
   include/xbt/parmap.h
   include/xbt/range.hpp
index a4ca296..8a8c3d0 100644 (file)
@@ -5,7 +5,7 @@
 # doc
 file(MAKE_DIRECTORY ${CMAKE_HOME_DIRECTORY}/doc/html/)
 install(DIRECTORY "${CMAKE_HOME_DIRECTORY}/doc/html/"
-  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/html/)
+  DESTINATION doc/simgrid/html/)
 
 # binaries
 if(enable_smpi)
@@ -14,27 +14,30 @@ if(enable_smpi)
     ${CMAKE_BINARY_DIR}/bin/smpicxx
     ${CMAKE_BINARY_DIR}/bin/smpirun
     ${CMAKE_BINARY_DIR}/bin/smpimain
-    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+    DESTINATION bin/)
   if(SMPI_FORTRAN)
     install(PROGRAMS
       ${CMAKE_BINARY_DIR}/bin/smpif90
       ${CMAKE_BINARY_DIR}/bin/smpiff
-      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+      DESTINATION bin/)
+    install(PROGRAMS
+      ${CMAKE_BINARY_DIR}/include/smpi/mpi.mod
+      DESTINATION include/smpi/)
   endif()
 endif()
 
 if(enable_model-checking)
   install(
     PROGRAMS ${CMAKE_BINARY_DIR}/bin/simgrid-mc
-    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+    DESTINATION bin/)
 endif()
 
-install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/tesh  DESTINATION bin/)
 
-install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/graphicator  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/)
+install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/graphicator  DESTINATION bin/)
 
 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl
-  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
+  DESTINATION bin/
   RENAME simgrid-colorizer)
 
 add_custom_target(simgrid-colorizer ALL
@@ -42,7 +45,7 @@ add_custom_target(simgrid-colorizer ALL
   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/MSG_visualization/colorize.pl ${CMAKE_BINARY_DIR}/bin/colorize)
 
 install(PROGRAMS ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl
-  DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/
+  DESTINATION bin/
   RENAME simgrid_update_xml)
 
 add_custom_target(simgrid_update_xml ALL
@@ -50,30 +53,29 @@ add_custom_target(simgrid_update_xml ALL
   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_HOME_DIRECTORY}/tools/simgrid_update_xml.pl ${CMAKE_BINARY_DIR}/bin/simgrid_update_xml)
 
 # libraries
-install(TARGETS simgrid DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
+install(TARGETS simgrid DESTINATION lib/)
 
 if(enable_java)
   set(SIMGRID_JAR_TO_INSTALL "${SIMGRID_JAR}")
-  install(TARGETS simgrid-java   DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/)
+  install(TARGETS simgrid-java   DESTINATION lib/)
   install(FILES ${SIMGRID_JAR_TO_INSTALL}
-      DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/java/
+      DESTINATION java/
       RENAME simgrid.jar)
 endif()
 
 # include files
-set(HEADERS  ${headers_to_install}  ${generated_headers_to_install})
-foreach(file ${HEADERS})
+foreach(file ${headers_to_install}  ${generated_headers_to_install})
   get_filename_component(location ${file} PATH)
   string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" location "${location}")
-  install(FILES ${file} DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${location})
-endforeach(file ${HEADERS})
+  install(FILES ${file} DESTINATION ${location})
+endforeach()
 
 # example files
 foreach(file ${examples_to_install})
   string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/examples/" "" file ${file})
   get_filename_component(location ${file} PATH)
   install(FILES "examples/${file}"
-    DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/doc/simgrid/examples/${location})
+    DESTINATION doc/simgrid/examples/${location})
 endforeach(file ${examples_to_install})
 
 ###########################################
@@ -346,6 +348,7 @@ add_custom_target(maintainer-clean
   COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
+  COMMAND ${CMAKE_COMMAND} -E remove -f src/mpif.f90
   WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
 
 include(CPack)
index 8b4b980..2b86e58 100644 (file)
@@ -24,6 +24,13 @@ if(enable_compile_warnings)
   if(CMAKE_COMPILER_IS_GNUCC)
     set(warnCFLAGS "${warnCFLAGS} -Wclobbered -Wno-error=clobbered  -Wno-unused-local-typedefs -Wno-error=attributes")
   endif()
+  if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+    # ignore remark  #1418: external function definition with no prior declaration
+    # 3179: deprecated conversion of string literal to char* (should be const char*)
+    # 191: type qualifier is meaningless on cast type
+    # 597: entity-kind "entity" will not be called for implicit or explicit conversions
+    set(warnCFLAGS "${warnCFLAGS} -wd1418 -wd191 -wd3179 -ww597")
+  endif()
 
   set(warnCXXFLAGS "${warnCFLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing")
   if(CMAKE_COMPILER_IS_GNUCXX AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")))
@@ -167,6 +174,11 @@ if(enable_model-checking AND enable_compile_optimizations)
   endforeach()
 endif()
 
+if (CMAKE_C_COMPILER_ID MATCHES "Intel")
+  # honor parentheses when determining the order of expression evaluation.
+  set(optCFLAGS "${optCFLAGS} -fprotect-parens ")
+endif()
+
 if(NOT enable_debug)
   set(CMAKE_C_FLAGS "-DNDEBUG ${CMAKE_C_FLAGS}")
   set(CMAKE_CXX_FLAGS "-DNDEBUG ${CMAKE_CXX_FLAGS}")
index 24c0994..fecf92b 100644 (file)
@@ -28,6 +28,8 @@ endif()
 add_library(simgrid-java SHARED ${JMSG_C_SRC})
 set_target_properties(simgrid-java PROPERTIES VERSION          ${libsimgrid-java_version})
 set_target_properties(simgrid-java PROPERTIES SKIP_BUILD_RPATH ON)
+set_property(TARGET simgrid-java
+             APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 
 target_link_libraries(simgrid-java simgrid)
 
index 14a4c81..e279ee1 100644 (file)
@@ -157,8 +157,8 @@ if(enable_maintainer_mode AND NOT WIN32)
 
     ENDIF()
 
-    set(string1  "'s/extern *\\([^(]*\\)\\( \\|\\( \\*\\)\\)/XBT_PUBLIC_DATA(\\1\\3) /'")
-    set(string2  "'s/XBT_PUBLIC_DATA(\\([^)]*\\)) *\\([^(]*\\)(/XBT_PUBLIC(\\1) \\2(/'")
+    set(string1  "'s/extern /XBT_PUBLIC_DATA /'")
+    set(string2  "'s/XBT_PUBLIC_DATA \\([^(]*\\)(/XBT_PUBLIC \\1(/'")
     set(string5  "'s/SET(DOCTYPE)/SET(ROOT_dax__adag)/'")
     set(string9  "'s/#include <unistd.h>/#if defined(_WIN32)\\n#  ifndef __STRICT_ANSI__\\n#    include <io.h>\\n#    include <process.h>\\n#  endif\\n#else\\n#  include <unistd.h>\\n#endif/g'")
     set(string14 "'\\!^ \\* Generated [0-9/]\\{10\\} [0-9:]\\{8\\}\\.$$!d'")
index 3f634dd..66886a7 100644 (file)
@@ -20,6 +20,9 @@ endif()
 # Actually declare our libraries
 add_library(simgrid SHARED ${simgrid_sources})
 set_target_properties(simgrid PROPERTIES VERSION ${libsimgrid_version})
+# The library can obviously use the internal headers
+set_property(TARGET simgrid
+             APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
 
 add_dependencies(simgrid maintainer_files)
 
@@ -27,10 +30,13 @@ if(enable_model-checking)
   add_executable(simgrid-mc ${MC_SIMGRID_MC_SRC})
   target_link_libraries(simgrid-mc simgrid)
   set_target_properties(simgrid-mc
-    PROPERTIES
-      RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+                        PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+  set_property(TARGET simgrid-mc
+               APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
+
 endif()
 
+
 # Compute the dependencies of SimGrid
 #####################################
 if (HAVE_BOOST_CONTEXTS)
index fdbafe3..428fba4 100644 (file)
@@ -26,3 +26,6 @@ endif()
 
 target_link_libraries(simgrid  ${SIMGRID_DEP})
 
+# The library can obviously use the internal headers
+set_property(TARGET simgrid
+             APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
index 39e78d8..b1c99ef 100644 (file)
@@ -93,6 +93,12 @@ if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
   add_executable       (unit_tmgr src/surf/trace_mgr_test.cpp)
   target_link_libraries(unit_tmgr simgrid ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
   ADD_TEST(unit_tmgr ${CMAKE_BINARY_DIR}/unit_tmgr --build_info=yes)
+  set_property(
+    TARGET unit_tmgr
+    APPEND PROPERTY
+           INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
+          )  
+  
   
 else()
   set(EXTRA_DIST       ${EXTRA_DIST}       src/surf/trace_mgr_test.cpp)
index 43af655..cd3f9a4 100644 (file)
@@ -46,4 +46,9 @@ ADD_CUSTOM_COMMAND(
 
 add_executable       (testall ${EXTRACTED_TEST_SOURCE_FILES})
 target_link_libraries(testall simgrid)
+set_property(
+    TARGET testall
+    APPEND PROPERTY
+           INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
+          )  
 
index 2c0cfa3..353299d 100755 (executable)
@@ -33,6 +33,7 @@ elif [ "${SANITIZER}" = "thread" ]
 then
     export TSAN_OPTIONS="memory_limit_mb=1500"
     SANITIZER_OPTIONS="-Denable_address_sanitizer=OFF -Denable_undefined_sanitizer=OFF -Denable_thread_sanitizer=ON"
+    export SMPI_PRIVATIZATION="mmap" # TSAN don't play well with dlopen
 elif [ "${SANITIZER}" = "undefined" ]
 then
     export UBSAN_OPTIONS="print_stacktrace=1"
index a37449e..3aeeb20 100755 (executable)
@@ -45,6 +45,8 @@ else:
 #
 #
 
+def isWindows():
+    return sys.platform.startswith('win')
 
 # Singleton metaclass that works in Python 2 & 3
 # http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
@@ -106,6 +108,9 @@ except NameError:
 pgtokill = None
 
 def kill_process_group(pgid):
+    if pgid is None: # Nobody to kill. We don't know who to kill on windows, or we don't have anyone to kill on signal handler
+        return
+
     # print("Kill process group {}".format(pgid))
     try:
         os.killpg(pgid, signal.SIGTERM)
@@ -316,7 +321,8 @@ class Cmd(object):
         try:
             proc = subprocess.Popen(args, bufsize=1, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, start_new_session=True)
             try:
-                pgtokill = os.getpgid(proc.pid)
+                if not isWindows():
+                    pgtokill = os.getpgid(proc.pid)
             except OSError:
                 # os.getpgid failed. OK. No cleanup.
                 pass