Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'xbt_random' into 'master'
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 19 Nov 2019 00:13:06 +0000 (01:13 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 19 Nov 2019 00:13:06 +0000 (01:13 +0100)
A module for RNG calls

See merge request simgrid/simgrid!20

341 files changed:
.gitlab-ci.yml
ChangeLog
MANIFEST.in
contrib/benchmarking_code_block/inject.h
doc/doxygen/inside_extending.doc
docs/Build.sh
docs/find-missing.py [new file with mode: 0755]
docs/ignored_symbols
docs/requirements.txt
docs/source/Configuring_SimGrid.rst
docs/source/Deploying_your_Application.rst
docs/source/Doxyfile
docs/source/Experimental_Setup.rst
docs/source/Introduction.rst
docs/source/Platform_Examples.rst
docs/source/Plugins.rst
docs/source/XML_Reference.rst
docs/source/_ext/autodoxy.py [new file with mode: 0644]
docs/source/_ext/hidden_code_block.py [deleted file]
docs/source/_ext/showfile.css [new file with mode: 0644]
docs/source/_ext/showfile.js [new file with mode: 0644]
docs/source/_ext/showfile.py [new file with mode: 0644]
docs/source/app_msg.rst
docs/source/app_s4u.rst
docs/source/app_smpi.rst
docs/source/application.rst
docs/source/conf.py
docs/source/img/lang_cpp.png [deleted file]
docs/source/img/lang_python.png [deleted file]
docs/source/index.rst
docs/source/platform.rst
docs/source/platform_howtos.rst
examples/README.rst [new file with mode: 0644]
examples/deprecated/java/app/bittorrent/generate.py
examples/deprecated/msg/dht-kademlia/generate.py
examples/deprecated/msg/dht-kademlia/task.c
examples/deprecated/msg/dht-pastry/generate.py
examples/deprecated/msg/platform-failures/platform-failures.c
examples/python/actor-create/actor-create.py
examples/python/actor-daemon/actor-daemon.py
examples/python/actor-join/actor-join.py
examples/python/actor-kill/actor-kill.py
examples/python/actor-lifetime/actor-lifetime.py
examples/python/actor-migrate/actor-migrate.py
examples/python/actor-suspend/actor-suspend.py
examples/python/actor-yield/actor-yield.py
examples/python/async-wait/async-wait.py
examples/python/async-waitall/async-waitall.py
examples/python/async-waitany/async-waitany.py
examples/python/exec-async/exec-async.py
examples/python/exec-basic/exec-basic.py
examples/python/exec-dvfs/exec-dvfs.py
examples/python/exec-remote/exec-remote.py
examples/s4u/CMakeLists.txt
examples/s4u/README.rst [deleted file]
examples/s4u/actor-migrate/s4u-actor-migrate.cpp
examples/s4u/app-bittorrent/s4u-peer.cpp
examples/s4u/dht-kademlia/generate.py
examples/s4u/io-file-system/s4u-io-file-system.cpp
examples/smpi/ampi_test/ampi_test.cpp
include/simgrid/Exception.hpp
include/simgrid/actor.h
include/simgrid/barrier.h
include/simgrid/cond.h
include/simgrid/config.h.in
include/simgrid/engine.h
include/simgrid/forward.h
include/simgrid/host.h
include/simgrid/instr.h
include/simgrid/jedule/jedule_sd_binding.h
include/simgrid/kernel/resource/Action.hpp
include/simgrid/kernel/resource/Model.hpp
include/simgrid/link.h
include/simgrid/mailbox.h
include/simgrid/modelchecker.h
include/simgrid/msg.h
include/simgrid/mutex.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/plugins/load_balancer.h
include/simgrid/s4u/Activity.hpp
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Barrier.hpp
include/simgrid/s4u/ConditionVariable.hpp
include/simgrid/s4u/Engine.hpp
include/simgrid/semaphore.h
include/simgrid/simdag.h
include/simgrid/simix.h
include/simgrid/storage.h
include/simgrid/vm.h
include/simgrid/zone.h
include/smpi/forward.hpp
include/smpi/sampi.h
include/smpi/smpi.h
include/xbt/Extendable.hpp
include/xbt/asserts.h
include/xbt/automaton.h
include/xbt/backtrace.hpp
include/xbt/base.h
include/xbt/config.h
include/xbt/dict.h
include/xbt/dynar.h
include/xbt/ex.h
include/xbt/function_types.h
include/xbt/graph.h
include/xbt/log.h
include/xbt/mallocator.h
include/xbt/misc.h
include/xbt/module.h
include/xbt/str.h
include/xbt/synchro.h
include/xbt/sysdep.h
include/xbt/virtu.h
include/xbt/xbt_os_time.h
sonar-project.properties
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_comm.h
src/bindings/java/jmsg_file.h
src/bindings/java/jmsg_host.h
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_process.h
src/bindings/java/jmsg_storage.h
src/bindings/java/jmsg_synchro.h
src/bindings/java/jmsg_task.h
src/bindings/java/jmsg_vm.h
src/bindings/java/jtrace.cpp
src/bindings/lua/lua_host.cpp
src/bindings/lua/lua_platf.cpp
src/bindings/python/simgrid_python.cpp
src/include/mc/datatypes.h
src/include/mc/mc.h
src/include/xbt/coverage.h
src/include/xbt/mmalloc.h
src/instr/instr_platform.cpp
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp
src/kernel/activity/ConditionVariableImpl.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/kernel/resource/DiskImpl.hpp
src/kernel/routing/FatTreeZone.cpp
src/mc/checker/simgrid_mc.cpp
src/mc/mc_client_api.cpp
src/mc/mc_comm_pattern.cpp
src/mc/mc_config.cpp
src/mc/mc_memory.cpp
src/mc/mc_state.cpp
src/mc/remote/RemoteClient.cpp
src/mc/remote/mc_protocol.h
src/mc/sosp/PageStore.cpp
src/mc/sosp/Region.cpp
src/msg/msg_comm.cpp
src/msg/msg_global.cpp
src/msg/msg_legacy.cpp
src/msg/msg_private.hpp
src/msg/msg_process.cpp
src/msg/msg_task.cpp
src/plugins/file_system/s4u_FileSystem.cpp
src/plugins/host_energy.cpp
src/plugins/host_load.cpp
src/plugins/link_energy.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_Barrier.cpp
src/s4u/s4u_Engine.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Io.cpp
src/s4u/s4u_Link.cpp
src/s4u/s4u_Netzone.cpp
src/s4u/s4u_Storage.cpp
src/simix/libsmx.cpp
src/simix/smx_deployment.cpp
src/simix/smx_global.cpp
src/simix/smx_private.hpp
src/smpi/bindings/smpi_f77.cpp
src/smpi/colls/allgather/allgather-2dmesh.cpp
src/smpi/colls/allgather/allgather-3dmesh.cpp
src/smpi/colls/allgather/allgather-GB.cpp
src/smpi/colls/allgather/allgather-NTSLR-NB.cpp
src/smpi/colls/allgather/allgather-NTSLR.cpp
src/smpi/colls/allgather/allgather-SMP-NTS.cpp
src/smpi/colls/allgather/allgather-bruck.cpp
src/smpi/colls/allgather/allgather-loosely-lr.cpp
src/smpi/colls/allgather/allgather-mvapich-smp.cpp
src/smpi/colls/allgather/allgather-ompi-neighborexchange.cpp
src/smpi/colls/allgather/allgather-pair.cpp
src/smpi/colls/allgather/allgather-rdb.cpp
src/smpi/colls/allgather/allgather-rhv.cpp
src/smpi/colls/allgather/allgather-ring.cpp
src/smpi/colls/allgather/allgather-smp-simple.cpp
src/smpi/colls/allgather/allgather-spreading-simple.cpp
src/smpi/colls/allgatherv/allgatherv-GB.cpp
src/smpi/colls/allgatherv/allgatherv-mpich-rdb.cpp
src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp
src/smpi/colls/allgatherv/allgatherv-ompi-bruck.cpp
src/smpi/colls/allgatherv/allgatherv-ompi-neighborexchange.cpp
src/smpi/colls/allgatherv/allgatherv-pair.cpp
src/smpi/colls/allgatherv/allgatherv-ring.cpp
src/smpi/colls/allreduce/allreduce-lr.cpp
src/smpi/colls/allreduce/allreduce-mvapich-rs.cpp
src/smpi/colls/allreduce/allreduce-mvapich-two-level.cpp
src/smpi/colls/allreduce/allreduce-ompi-ring-segmented.cpp
src/smpi/colls/allreduce/allreduce-rab-rdb.cpp
src/smpi/colls/allreduce/allreduce-rab1.cpp
src/smpi/colls/allreduce/allreduce-rab2.cpp
src/smpi/colls/allreduce/allreduce-rdb.cpp
src/smpi/colls/allreduce/allreduce-redbcast.cpp
src/smpi/colls/allreduce/allreduce-smp-binomial-pipeline.cpp
src/smpi/colls/allreduce/allreduce-smp-binomial.cpp
src/smpi/colls/allreduce/allreduce-smp-rdb.cpp
src/smpi/colls/allreduce/allreduce-smp-rsag-lr.cpp
src/smpi/colls/allreduce/allreduce-smp-rsag-rab.cpp
src/smpi/colls/allreduce/allreduce-smp-rsag.cpp
src/smpi/colls/alltoall/alltoall-2dmesh.cpp
src/smpi/colls/alltoall/alltoall-3dmesh.cpp
src/smpi/colls/alltoall/alltoall-basic-linear.cpp
src/smpi/colls/alltoall/alltoall-bruck.cpp
src/smpi/colls/alltoall/alltoall-mvapich-scatter-dest.cpp
src/smpi/colls/alltoall/alltoall-pair-light-barrier.cpp
src/smpi/colls/alltoall/alltoall-pair-mpi-barrier.cpp
src/smpi/colls/alltoall/alltoall-pair-one-barrier.cpp
src/smpi/colls/alltoall/alltoall-pair.cpp
src/smpi/colls/alltoall/alltoall-rdb.cpp
src/smpi/colls/alltoall/alltoall-ring-light-barrier.cpp
src/smpi/colls/alltoall/alltoall-ring-mpi-barrier.cpp
src/smpi/colls/alltoall/alltoall-ring-one-barrier.cpp
src/smpi/colls/alltoall/alltoall-ring.cpp
src/smpi/colls/alltoallv/alltoallv-bruck.cpp
src/smpi/colls/alltoallv/alltoallv-ompi-basic-linear.cpp
src/smpi/colls/alltoallv/alltoallv-pair-light-barrier.cpp
src/smpi/colls/alltoallv/alltoallv-pair-mpi-barrier.cpp
src/smpi/colls/alltoallv/alltoallv-pair-one-barrier.cpp
src/smpi/colls/alltoallv/alltoallv-pair.cpp
src/smpi/colls/alltoallv/alltoallv-ring-light-barrier.cpp
src/smpi/colls/alltoallv/alltoallv-ring-mpi-barrier.cpp
src/smpi/colls/alltoallv/alltoallv-ring-one-barrier.cpp
src/smpi/colls/alltoallv/alltoallv-ring.cpp
src/smpi/colls/barrier/barrier-mpich-smp.cpp
src/smpi/colls/barrier/barrier-mvapich2-pair.cpp
src/smpi/colls/barrier/barrier-ompi.cpp
src/smpi/colls/bcast/bcast-NTSB.cpp
src/smpi/colls/bcast/bcast-NTSL-Isend.cpp
src/smpi/colls/bcast/bcast-NTSL.cpp
src/smpi/colls/bcast/bcast-SMP-binary.cpp
src/smpi/colls/bcast/bcast-SMP-binomial.cpp
src/smpi/colls/bcast/bcast-SMP-linear.cpp
src/smpi/colls/bcast/bcast-arrival-pattern-aware-wait.cpp
src/smpi/colls/bcast/bcast-arrival-pattern-aware.cpp
src/smpi/colls/bcast/bcast-arrival-scatter.cpp
src/smpi/colls/bcast/bcast-binomial-tree.cpp
src/smpi/colls/bcast/bcast-flattree-pipeline.cpp
src/smpi/colls/bcast/bcast-flattree.cpp
src/smpi/colls/bcast/bcast-mvapich-smp.cpp
src/smpi/colls/bcast/bcast-ompi-pipeline.cpp
src/smpi/colls/bcast/bcast-ompi-split-bintree.cpp
src/smpi/colls/bcast/bcast-scatter-LR-allgather.cpp
src/smpi/colls/bcast/bcast-scatter-rdb-allgather.cpp
src/smpi/colls/gather/gather-mvapich.cpp
src/smpi/colls/gather/gather-ompi.cpp
src/smpi/colls/reduce/reduce-NTSL.cpp
src/smpi/colls/reduce/reduce-arrival-pattern-aware.cpp
src/smpi/colls/reduce/reduce-binomial.cpp
src/smpi/colls/reduce/reduce-flat-tree.cpp
src/smpi/colls/reduce/reduce-mvapich-knomial.cpp
src/smpi/colls/reduce/reduce-mvapich-two-level.cpp
src/smpi/colls/reduce/reduce-ompi.cpp
src/smpi/colls/reduce/reduce-rab.cpp
src/smpi/colls/reduce/reduce-scatter-gather.cpp
src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp
src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
src/smpi/colls/scatter/scatter-mvapich-two-level.cpp
src/smpi/colls/scatter/scatter-ompi.cpp
src/smpi/colls/smpi_automatic_selector.cpp
src/smpi/colls/smpi_coll.cpp
src/smpi/colls/smpi_default_selector.cpp
src/smpi/colls/smpi_intel_mpi_selector.cpp
src/smpi/colls/smpi_mpich_selector.cpp
src/smpi/colls/smpi_mvapich2_selector.cpp
src/smpi/colls/smpi_mvapich2_selector_stampede.hpp
src/smpi/colls/smpi_openmpi_selector.cpp
src/smpi/include/smpi_coll.hpp
src/smpi/internals/smpi_global.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_group.cpp
src/smpi/plugins/ampi/ampi.cpp
src/smpi/plugins/ampi/instr_ampi.cpp
src/smpi/plugins/sampi_loadbalancer.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.hpp
src/surf/host_clm03.cpp
src/surf/host_clm03.hpp
src/surf/network_cm02.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_wifi.cpp
src/surf/ptask_L07.cpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.cpp
src/surf/xml/platf.hpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/automaton/automaton.c
src/xbt/automaton/automatonparse_promela.c
src/xbt/automaton/parserPromela.tab.cacc
src/xbt/automaton/parserPromela.tab.hacc
src/xbt/backtrace.cpp
src/xbt/dict.cpp
src/xbt/dict_elm.c
src/xbt/dict_private.h
src/xbt/dict_test.cpp
src/xbt/exception.cpp
src/xbt/mmalloc/mmprivate.h
src/xbt/xbt_os_synchro.cpp
src/xbt_modinter.h
teshsuite/msg/app-bittorrent/bittorrent-peer.c
teshsuite/msg/app-bittorrent/bittorrent.c
teshsuite/msg/app-bittorrent/generate.py
teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp
teshsuite/s4u/CMakeLists.txt
teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp
teshsuite/s4u/actor-migration/actor-migration.cpp [deleted file]
teshsuite/s4u/actor-migration/actor-migration.tesh [deleted file]
teshsuite/simdag/flatifier/bogus_disk_attachment.tesh
teshsuite/simdag/flatifier/bogus_missing_gateway.tesh
teshsuite/smpi/CMakeLists.txt
teshsuite/smpi/bug-17132/bug-17132.c
teshsuite/smpi/gh-139/gh-139.c [new file with mode: 0644]
teshsuite/smpi/gh-139/gh-139.tesh [new file with mode: 0644]
tools/cmake/DefinePackages.cmake
tools/cmake/Flags.cmake
tools/cmake/MaintainerMode.cmake
tools/docker/Dockerfile.build-deps
tools/graphicator/graphicator.c

index 9b9b09b..7c355ce 100644 (file)
@@ -1,17 +1,17 @@
 image: simgrid/build-deps
 
-stages:
- - build
- - test
+#stages:
+# - build
+# - test
 
 pages:
-  stage: test
+#  stage: test
   script:
   - cmake -Denable_model-checking=OFF -Denable_documentation=ON -Denable_compile_optimizations=OFF -Denable_smpi=OFF -Dpython=ON .
   - make -j4
   - pip3 install --requirement docs/requirements.txt
   - cd docs
-  - LC_ALL=C.UTF-8 ./Build.sh
+  - LC_ALL=C.UTF-8 SPHINXOPTS=-vv ./Build.sh
   - mv build/html ../public
   # - The CSS contains a reference to a font or something, not something we gonna fix on our side
   # - The javasphinx output does not exist in the git, so the "edit on FramaGit" link is broken.
@@ -27,7 +27,7 @@ pages:
   - master
 
 ctest:
-  stage: build
+#  stage: build
   except:
   - stable
   script:
@@ -36,7 +36,7 @@ ctest:
 
 pip:
   image: debian:testing
-  stage: build
+#  stage: build
   except:
   - stable
   script:
@@ -45,7 +45,7 @@ pip:
   - cd dist && tar xfz simgrid*.tar.gz && cd simgrid-*/ && python3 setup.py build
 
 release:
-  stage: build
+#  stage: build
   only:
   - stable
   script:
index d665a77..5ead4c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,9 +2,27 @@
 
 SimGrid (3.24.1) NOT RELEASED YET (v3.25 expected December 22. 2029, 04:19 UTC)
 
+S4U:
+- Actor: Merge signals on_migration_start/end into on_host_change
+- Actor: Rename migrate() into set_host()
+
+XML:
+- Parse errors now raise a simgrid::ParseError that you may want to catch.
+
+Kernel:
+- In simgrid::kernel::resource::Model, the methods next_occuring_event*() have
+  been renamed to fix a spelling error. As usual, the previous definitions are
+  kept with a deprecation warning. However, to avoid runtime errors, it is now
+  forbidden to override these deprecated methods in a derived class. Please use
+  the new names immediately if you need to override them.
+
+XBT:
+- Remove unused parameter 'free_ctn' for xbt_dict_set() and xbt_dict_set_ext().
+
 Fixed bugs (FG#.. -> framagit bugs; FG!.. -> framagit merge requests):
  - GH#31: [MC] please provide an option to make MPI_Send asynchronous
- - GH#305: Unscheduled tasks are still excuted 
+ - GH#305: Unscheduled tasks are still excuted
+ - GH#323: Crash when an actor turn off his physical host
  - FG!19: Removing RngStream
 
 ----------------------------------------------------------------------------
index d0d6fa9..af8fabf 100644 (file)
@@ -273,7 +273,6 @@ include examples/python/exec-dvfs/exec-dvfs.py
 include examples/python/exec-dvfs/exec-dvfs.tesh
 include examples/python/exec-remote/exec-remote.py
 include examples/python/exec-remote/exec-remote.tesh
-include examples/s4u/README.rst
 include examples/s4u/actor-create/s4u-actor-create.cpp
 include examples/s4u/actor-create/s4u-actor-create.tesh
 include examples/s4u/actor-create/s4u-actor-create_d.xml
@@ -690,8 +689,6 @@ include teshsuite/s4u/activity-lifecycle/activity-lifecycle.tesh
 include teshsuite/s4u/activity-lifecycle/testing_platform.xml
 include teshsuite/s4u/actor-autorestart/actor-autorestart.cpp
 include teshsuite/s4u/actor-autorestart/actor-autorestart.tesh
-include teshsuite/s4u/actor-migration/actor-migration.cpp
-include teshsuite/s4u/actor-migration/actor-migration.tesh
 include teshsuite/s4u/actor/actor.cpp
 include teshsuite/s4u/actor/actor.tesh
 include teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp
@@ -831,6 +828,8 @@ include teshsuite/smpi/coll-scatter/coll-scatter.c
 include teshsuite/smpi/coll-scatter/coll-scatter.tesh
 include teshsuite/smpi/fort_args/fort_args.f90
 include teshsuite/smpi/fort_args/fort_args.tesh
+include teshsuite/smpi/gh-139/gh-139.c
+include teshsuite/smpi/gh-139/gh-139.tesh
 include teshsuite/smpi/hostfile
 include teshsuite/smpi/hostfile_cluster
 include teshsuite/smpi/hostfile_coll
@@ -1747,6 +1746,7 @@ include doc/doxygen/uhood.doc
 include doc/doxygen/uhood_arch.doc
 include doc/doxygen/uhood_switch.doc
 include docs/Build.sh
+include docs/find-missing.py
 include docs/ignored_symbols
 include docs/manpages/smpicc.1
 include docs/manpages/smpicxx.1
@@ -1767,7 +1767,10 @@ include docs/source/Start_Your_Own_Project.rst
 include docs/source/Tutorial_Algorithms.rst
 include docs/source/Tutorial_MPI_Applications.rst
 include docs/source/XML_Reference.rst
-include docs/source/_ext/hidden_code_block.py
+include docs/source/_ext/autodoxy.py
+include docs/source/_ext/showfile.css
+include docs/source/_ext/showfile.js
+include docs/source/_ext/showfile.py
 include docs/source/_templates/breadcrumbs.html
 include docs/source/app_msg.rst
 include docs/source/app_s4u.rst
@@ -1779,8 +1782,6 @@ include docs/source/img/eclipseScreenShot.png
 include docs/source/img/extlink.png
 include docs/source/img/extlink.svg
 include docs/source/img/graphical-toc.svg
-include docs/source/img/lang_cpp.png
-include docs/source/img/lang_python.png
 include docs/source/img/smpi_simgrid_alltoall_pair_16.png
 include docs/source/img/smpi_simgrid_alltoall_ring_16.png
 include docs/source/img/zone_hierarchy.png
@@ -1810,6 +1811,7 @@ include docs/source/tuto_smpi/gemm_mpi.cpp
 include docs/source/tuto_smpi/img/big-picture.svg
 include docs/source/tuto_smpi/img/lu.S.4.png
 include docs/source/tuto_smpi/roundtrip.c
+include examples/README.rst
 include examples/deprecated/java/.classpath
 include examples/deprecated/java/.project
 include examples/deprecated/java/CMakeLists.txt
index f5a9261..50bab56 100644 (file)
@@ -86,7 +86,7 @@ static inline void xbt_inject_init(char *inputfile)
     for (int i            = 0; i < (data->n - 1); i++)
       data->percentage[i] = atof(strtok_r(NULL, "\t", &saveptr));
 
-    xbt_dict_set(mydict, key, data, NULL);
+    xbt_dict_set(mydict, key, data);
   }
   fclose(fpInput);
 }
@@ -139,7 +139,7 @@ static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre
       data->percentage[i] = atof(strtok_r(NULL, "\t", &saveptr));
     }
 
-    xbt_dict_set(mydict, key, data, NULL);
+    xbt_dict_set(mydict, key, data);
   }
   fclose(fpInput);
 }
index b47395f..f0f02b6 100644 (file)
@@ -55,7 +55,7 @@ and add an entry in the corresponding array in surf_interface.cpp
 ~~~~
 s_surf_model_description_t surf_cpu_model_description[] = {
   {"Cas01",
-   "Simplistic CPU model (time=size/power).",
+   "Simplistic CPU model (time=size/speed).",
    surf_cpu_model_init_Cas01},
   {"Plop",
    "The new plop CPU model.",
index d51e6ed..8bb15b2 100755 (executable)
@@ -38,30 +38,24 @@ set +x
 perl -pe 's/(xlink:href="(?:http|.*\.html))/target="_top" $1/' \
      source/img/graphical-toc.svg > build/html/graphical-toc.svg
 
-echo "List of missing references:"
-for f in $( (grep '<name>' build/xml/msg_8h.xml; \
-             grep '<name>' build/xml/namespacesimgrid_1_1s4u.xml; \
-             grep '<innerclass refid=' build/xml/namespacesimgrid_1_1s4u.xml ; \
-            ) | sed 's/<[^>]*>//g' | sort )
+echo
+echo "Undocumented examples:"
+for ex in $( (cd .. ; \
+              find examples/s4u/ -name '*.cpp'; \
+              find examples/python -name '*.py'; \
+             ) | sort )
 do
-
-  if grep $f source/*rst | grep -q '.. doxygen[^::]*:: '"$f"'$' ||
-     grep $f source/*rst | grep -q '.. doxygen[^::]*:: simgrid::[^:]*::[^:]*::'"$f"'$'  ; then :   
-#    echo "$f documented"
-  else 
-    if grep -q $f ignored_symbols ; then : 
-#      echo "$f ignored" # not documented
+    if grep -q "example-tab:: $ex" ../examples/README.rst ; then :
+#        echo "found example-tab:: $ex"
+    elif grep -q "showfile:: $ex" ../examples/README.rst ; then :
     else
-      echo "$f"
+        echo $ex
     fi
-  fi
 done
 
-if [ -e /opt/simgrid ] ; then chmod -x /opt/simgrid; fi
-
-set +e # Don't fail
+set +e # Don't fail
 if [ -e /usr/bin/linkchecker ] ; then
-  linkchecker --no-status -o csv --ignore-url='.*\.css$' --ignore-url=public/java/org build/html \
+    linkchecker --no-status -o csv --ignore-url='.*\.css$' --ignore-url=build/html/_modules  --ignore-url=public/java/org build/html \
      | grep -v '^#' \
      | grep -v 'urlname;parentname;baseref;result;warningstring'
   echo "done."
diff --git a/docs/find-missing.py b/docs/find-missing.py
new file mode 100755 (executable)
index 0000000..4e1afee
--- /dev/null
@@ -0,0 +1,203 @@
+#! /usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2019. 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.
+
+"""
+Search for symbols documented in both the XML files produced by Doxygen and the python modules,
+but not documented with autodoxy in the RST files.
+
+This script is tailored to SimGrid own needs and should be made more generic for autodoxy.
+"""
+
+import fnmatch
+import os
+import re
+import sys
+import xml.etree.ElementTree as ET
+import inspect
+
+xml_files = [
+    'build/xml/classsimgrid_1_1s4u_1_1Activity.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Actor.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Barrier.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Comm.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1ConditionVariable.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Disk.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Engine.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1ExecPar.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1ExecSeq.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Exec.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Host.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Io.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Link.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Mailbox.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Mutex.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1NetZone.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1Semaphore.xml',
+    'build/xml/classsimgrid_1_1s4u_1_1VirtualMachine.xml'
+]
+
+python_modules = [
+    'simgrid'
+]
+python_ignore = [
+    'simgrid.ActorKilled'
+]
+
+
+############ Search the python elements in the source, and report undocumented ones
+############
+
+# data structure in which we store the declaration we find
+python_decl = {}
+
+def handle_python_module(fullname, englobing, elm):
+    """Recursive function exploring the python modules."""
+
+    def found_decl(kind, obj):
+        """Helper function that add an object in the python_decl data structure"""
+        if kind not in python_decl: python_decl[kind] = []
+        python_decl[kind].append(obj)
+
+
+    if fullname in python_ignore:
+        print ("Ignore Python symbol '{}' as requested.".format(fullname))
+        return
+
+    if inspect.isroutine(elm) and inspect.isclass(englobing):
+        found_decl("method", fullname)
+#        print('.. automethod:: {}'.format(fullname))
+    elif inspect.isroutine(elm) and (not inspect.isclass(englobing)):
+        found_decl("function", fullname)
+#        print('.. autofunction:: {}'.format(fullname))
+    elif inspect.isdatadescriptor(elm):
+        found_decl("attribute", fullname)
+#        print('.. autoattribute:: {}'.format(fullname))
+    elif isinstance(elm, str) or isinstance(elm, int): # We do have such a data, directly in the SimGrid top module
+        found_decl("data", fullname)
+#        print('.. autodata:: {}'.format(fullname))
+    elif inspect.ismodule(elm) or inspect.isclass(elm):
+        for name, data in inspect.getmembers(elm):
+            if name.startswith('__'):
+                continue
+#            print("Recurse on {}.{}".format(fullname, name))
+            handle_python_module("{}.{}".format(fullname, name), elm, data)
+    else:
+        print('UNHANDLED TYPE {} : {!r} Type: {}'.format(fullname, elm, type(elm)))
+
+# Start the recursion on the provided Python modules
+for name in python_modules:
+    try:
+        module = __import__(name)
+    except Exception:
+        print("Cannot import {}. Did you set PYTHONPATH=../lib accordingly?".format(name))
+        sys.exit(1)
+    for sub in dir(module):
+        if sub[0] == '_':
+            continue
+        handle_python_module("{}.{}".format(name, sub), module, getattr(module, sub))
+
+# Forget about the python declarations that were actually done in the RST
+for kind in python_decl:
+    with os.popen('grep \'[[:blank:]]*auto{}::\' source/*rst|sed \'s/^.*auto{}:: //\''.format(kind, kind)) as pse:
+        for fullname in (l.strip() for l in pse):
+            if fullname not in python_decl[kind]:
+                print("Warning: {} documented but declaration not found in python.".format(fullname))
+            else:
+                python_decl[kind].remove(fullname)
+# Dump the missing ones
+for kind in python_decl:
+    for fullname in python_decl[kind]:
+        print(" .. auto{}:: {}".format(kind, fullname))
+
+################ And now deal with Doxygen declarations
+################
+
+doxy_funs = {} # {classname: {func_name: [args]} }
+doxy_vars = {} # {classname: [names]}
+
+# find the declarations in the XML files
+for arg in xml_files[:3]:
+    if arg[-4:] != '.xml':
+        print ("Argument '{}' does not end with '.xml'".format(arg))
+        continue
+    print("Parse file {}".format(arg))
+    tree = ET.parse(arg)
+    for elem in tree.findall(".//compounddef"):
+        if elem.attrib["prot"] != "public":
+            continue
+        if "compoundname" in elem:
+            raise Exception("Compound {} has no 'compoundname' child tag.".format(elem))
+        compoundname = elem.find("compoundname").text
+        #print ("compoundname {}".format(compoundname))
+        for member in elem.findall('.//memberdef'):
+            if member.attrib["prot"] != "public":
+                continue
+            kind = member.attrib["kind"]
+            name = member.find("name").text
+            if kind == "variable":
+                if compoundname not in doxy_vars: doxy_vars[compoundname] = []
+                doxy_vars[compoundname].append(name)
+            elif kind == "function":
+                args = member.find('argsstring').text
+                args = re.sub('\)[^)]*$', ')', args) # ignore what's after the parameters (eg, '=0' or ' const')
+
+                if compoundname not in doxy_funs: doxy_funs[compoundname] = {}
+                if name not in doxy_funs[compoundname]: doxy_funs[compoundname][name] = []
+                doxy_funs[compoundname][name].append(args)
+            else:
+                print ("member {}::{} is of kind {}".format(compoundname, name, kind))
+
+# Forget about the declarations that are done in the RST
+with os.popen('grep autodoxymethod:: source/*rst|sed \'s/^.*autodoxymethod:: //\'') as pse:
+    for line in (l.strip() for l in pse):
+        (klass, obj, args) = (None, None, None)
+        if "(" in line:
+            (line, args) = line.split('(', 1)
+            args = "({}".format(args)
+        (klass, obj) = line.rsplit('::', 1)
+
+        if klass not in doxy_funs:
+            print("Warning: {} documented, but class {} not found in doxygen.".format(line, klass))
+            continue
+        if obj not in doxy_funs[klass]:
+            print("Warning: Object {} documented but not found in {}".format(line, klass))
+        elif len(doxy_funs[klass][obj])==1:
+            del doxy_funs[klass][obj]
+        elif args not in doxy_funs[klass][obj]:
+            print("Warning: Function {}{} not found in {}".format(obj, args, klass))
+        else:
+#            print("Found {} in {}".format(line, klass))
+            doxy_funs[klass][obj].remove(args)
+            if len(doxy_funs[klass][obj]) == 0:
+                del doxy_funs[klass][obj]
+with os.popen('grep autodoxyvar:: source/*rst|sed \'s/^.*autodoxyvar:: //\'') as pse:
+    for line in (l.strip() for l in pse):
+        (klass, var) = line.rsplit('::', 1)
+
+        if klass not in doxy_vars:
+            print("Warning: {} documented, but class {} not found in doxygen.".format(line, klass))
+            continue
+        if var not in doxy_vars[klass]:
+            print("Warning: Object {} documented but not found in {}".format(line, klass))
+        else:
+#            print("Found {} in {}".format(line, klass))
+            doxy_vars[klass].remove(var)
+            if len(doxy_vars[klass]) == 0:
+                del doxy_vars[klass]
+
+# Dump the undocumented Doxygen declarations 
+for obj in sorted(doxy_funs):
+    for meth in sorted(doxy_funs[obj]):
+        for args in sorted(doxy_funs[obj][meth]):
+            print(".. autodoxymethod:: {}::{}{}".format(obj, meth, args))
+
+for obj in doxy_vars:
+    for meth in sorted(doxy_vars[obj]):
+        print(".. autodoxyvar:: {}::{}".format(obj, meth))
+
index f8f9244..d039c80 100644 (file)
@@ -15,4 +15,5 @@ MSG_init_nocheck
 intrusive_ptr_release
 intrusive_ptr_add_ref
 get_filtered_netzones_recursive
-simgrid::s4u::Storage
\ No newline at end of file
+simgrid::s4u::Storage
+simgrid::s4u::Activity_T
index 0e10180..4302bfe 100644 (file)
@@ -1,4 +1,5 @@
 breathe
 sphinx>=1.8.0
 sphinx_rtd_theme
+sphinx_tabs
 javasphinx
index c629d16..db03b0a 100644 (file)
@@ -5,7 +5,7 @@ Configuring SimGrid
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("ConfigBox")
@@ -225,7 +225,7 @@ models for all existing resources.
 - ``cpu/model``: specify the used CPU model.  We have only one model
   for now:
 
-  - **Cas01:** Simplistic CPU model (time=size/power)
+  - **Cas01:** Simplistic CPU model (time=size/speed)
 
 - ``host/model``: The host concept is the aggregation of a CPU with a
   network card. Three models exists, but actually, only 2 of them are
index 7c1a299..23dab05 100644 (file)
@@ -5,7 +5,7 @@ Deploying your Application
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("DeployBox")
index 95c020c..44b2cb5 100644 (file)
@@ -2,6 +2,18 @@
 INPUT                  = ../../include/simgrid/forward.h
 INPUT                 += ../../include/simgrid/s4u
 INPUT                 += ../../include/simgrid/msg.h
+INPUT                 += ../../include/simgrid/actor.h
+INPUT                 += ../../include/simgrid/barrier.h
+INPUT                 += ../../include/simgrid/cond.h
+INPUT                 += ../../include/simgrid/engine.h
+INPUT                 += ../../include/simgrid/host.h
+#INPUT                 += ../../include/simgrid/instr.h
+INPUT                 += ../../include/simgrid/link.h
+INPUT                 += ../../include/simgrid/mailbox.h
+INPUT                 += ../../include/simgrid/mutex.h
+INPUT                 += ../../include/simgrid/semaphore.h
+INPUT                 += ../../include/simgrid/vm.h
+INPUT                 += ../../include/simgrid/zone.h
 INPUT                 += ../../src/msg/
 INPUT                 += ../../src/plugins/
 RECURSIVE              = YES
@@ -19,7 +31,7 @@ XML_PROGRAMLISTING     = NO # No program listings, please
 CREATE_SUBDIRS         = NO # Mandatory for exhale
 
 # Allow for rst directives and advanced functions e.g. grid tables
-ALIASES                = "rst=\verbatim embed:rst:leading-asterisk"
+ALIASES                = "beginrst=\verbatim "
 ALIASES               += "endrst=\endverbatim"
 
 # Enable preprocessing and related preprocessor necessities
@@ -31,6 +43,8 @@ SKIP_FUNCTION_MACROS   = NO
 PREDEFINED             += \
     __cplusplus \
     DOXYGEN \
+    SG_BEGIN_DECL= \
+    SG_END_DECL= \
     XBT_PUBLIC= \
     XBT_EXPORT_NO_IMPORT= \
     XBT_IMPORT_NO_EXPORT= \
index 280b809..d6879ae 100644 (file)
@@ -2,7 +2,7 @@
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("XPSetupBox")
index 76070c9..a48c6c6 100644 (file)
@@ -6,7 +6,7 @@ Main Concepts
 
 .. raw:: html
 
-   <object data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object data="graphical-toc.svg" type="image/svg+xml"></object>
    <br/>
    <br/>
 
index fcfb76f..c15fc54 100644 (file)
@@ -1,6 +1,6 @@
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("ExamplesBox")
index 08bec4e..8f55ae3 100644 (file)
@@ -5,7 +5,7 @@ SimGrid Plugins
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("PluginsBox")
index 1f509f0..2e09bb2 100644 (file)
@@ -1,6 +1,6 @@
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("ReferenceBox")
diff --git a/docs/source/_ext/autodoxy.py b/docs/source/_ext/autodoxy.py
new file mode 100644 (file)
index 0000000..ea3d805
--- /dev/null
@@ -0,0 +1,592 @@
+"""
+This is autodoxy, a sphinx extension providing autodoc-like directives
+that are feed with Doxygen files.
+
+It is highly inspired from the autodoc_doxygen sphinx extension, but
+adapted to my own needs in SimGrid.
+https://github.com/rmcgibbo/sphinxcontrib-autodoc_doxygen
+
+Licence: MIT
+Copyright (c) 2015 Robert T. McGibbon
+Copyright (c) 2019 Martin Quinson
+"""
+from __future__ import print_function, absolute_import, division
+
+import os.path
+import re
+import sys
+
+from six import itervalues
+from lxml import etree as ET
+from sphinx.ext.autodoc import Documenter, AutoDirective, members_option, ALL
+from sphinx.errors import ExtensionError
+from sphinx.util import logging
+
+
+##########################################################################
+# XML utils
+##########################################################################
+def format_xml_paragraph(xmlnode):
+    """Format an Doxygen XML segment (principally a detaileddescription)
+    as a paragraph for inclusion in the rst document
+
+    Parameters
+    ----------
+    xmlnode
+
+    Returns
+    -------
+    lines
+        A list of lines.
+    """
+    return [l.rstrip() for l in _DoxygenXmlParagraphFormatter().generic_visit(xmlnode).lines]
+
+
+class _DoxygenXmlParagraphFormatter(object):
+    # This class follows the model of the stdlib's ast.NodeVisitor for tree traversal
+    # where you dispatch on the element type to a different method for each node
+    # during the traverse.
+
+    # It's supposed to handle paragraphs, references, preformatted text (code blocks), and lists.
+
+    def __init__(self):
+        self.lines = ['']
+        self.continue_line = False
+
+    def visit(self, node):
+        method = 'visit_' + node.tag
+        visitor = getattr(self, method, self.generic_visit)
+        return visitor(node)
+
+    def generic_visit(self, node):
+        for child in node.getchildren():
+            self.visit(child)
+        return self
+
+    def visit_ref(self, node):
+        ref = get_doxygen_root().findall('.//*[@id="%s"]' % node.get('refid'))
+        if ref:
+            ref = ref[0]
+            if ref.tag == 'memberdef':
+                parent = ref.xpath('./ancestor::compounddef/compoundname')[0].text
+                name = ref.find('./name').text
+                real_name = parent + '::' + name
+            elif ref.tag in ('compounddef', 'enumvalue'):
+                name_node = ref.find('./name')
+                real_name = name_node.text if name_node is not None else ''
+            else:
+                raise NotImplementedError(ref.tag)
+        else:
+            real_name = None
+
+        val = [':cpp:any:`', node.text]
+        if real_name:
+            val.extend((' <', real_name, '>`'))
+        else:
+            val.append('`')
+        if node.tail is not None:
+            val.append(node.tail)
+
+        self.lines[-1] += ''.join(val)
+
+    def visit_para(self, node):
+        if node.text is not None:
+            if self.continue_line:
+                self.lines[-1] += node.text
+            else:
+                self.lines.append(node.text)
+        self.generic_visit(node)
+        self.lines.append('')
+        self.continue_line = False
+
+    def visit_verbatim(self, node):
+        if node.text is not None:
+            # remove the leading ' *' of any lines
+            lines = [re.sub('^\s*\*','', l) for l in node.text.split('\n')]
+            # Merge each paragraph together
+            text = re.sub("\n\n", "PaRaGrraphSplit", '\n'.join(lines))
+            text = re.sub('\n', '', text)
+            lines = text.split('PaRaGrraphSplit')
+
+            # merge content to the built doc
+            if self.continue_line:
+                self.lines[-1] += lines[0]
+                lines = lines[1:]
+            for l in lines:
+                self.lines.append('')
+                self.lines.append(l)
+        self.generic_visit(node)
+        self.lines.append('')
+        self.continue_line = False
+
+    def visit_parametername(self, node):
+        if 'direction' in node.attrib:
+            direction = '[%s] ' % node.get('direction')
+        else:
+            direction = ''
+
+        self.lines.append('**%s** -- %s' % (
+            node.text, direction))
+        self.continue_line = True
+
+    def visit_parameterlist(self, node):
+        lines = [l for l in type(self)().generic_visit(node).lines if l is not '']
+        self.lines.extend([':parameters:', ''] + ['* %s' % l for l in lines] + [''])
+
+    def visit_simplesect(self, node):
+        if node.get('kind') == 'return':
+            self.lines.append(':returns: ')
+            self.continue_line = True
+        self.generic_visit(node)
+
+    def visit_listitem(self, node):
+        self.lines.append('   - ')
+        self.continue_line = True
+        self.generic_visit(node)
+
+    def visit_preformatted(self, node):
+        segment = [node.text if node.text is not None else '']
+        for n in node.getchildren():
+            segment.append(n.text)
+            if n.tail is not None:
+                segment.append(n.tail)
+
+        lines = ''.join(segment).split('\n')
+        self.lines.extend(('.. code-block:: C++', ''))
+        self.lines.extend(['  ' + l for l in lines])
+
+    def visit_computeroutput(self, node):
+        c = node.find('preformatted')
+        if c is not None:
+            return self.visit_preformatted(c)
+        return self.visit_preformatted(node)
+
+    def visit_xrefsect(self, node):
+        if node.find('xreftitle').text == 'Deprecated':
+            sublines = type(self)().generic_visit(node).lines
+            self.lines.extend(['.. admonition:: Deprecated'] + ['   ' + s for s in sublines])
+        else:
+            raise ValueError(node)
+
+    def visit_subscript(self, node):
+        self.lines[-1] += '\ :sub:`%s` %s' % (node.text, node.tail)
+
+
+##########################################################################
+# Directives
+##########################################################################
+
+
+class DoxygenDocumenter(Documenter):
+    # Variables to store the names of the object being documented. modname and fullname are redundant,
+    # and objpath is always the empty list. This is inelegant, but we need to work with the superclass.
+
+    fullname = None  # example: "OpenMM::NonbondedForce" or "OpenMM::NonbondedForce::methodName""
+    modname = None   # example: "OpenMM::NonbondedForce" or "OpenMM::NonbondedForce::methodName""
+    objname = None   # example: "NonbondedForce"  or "methodName"
+    objpath = []     # always the empty list
+    object = None    # the xml node for the object
+
+    option_spec = {
+        'members': members_option,
+    }
+
+    def __init__(self, directive, name, indent=u'', id=None):
+        super(DoxygenDocumenter, self).__init__(directive, name, indent)
+        if id is not None:
+            self.parse_id(id)
+
+    def parse_id(self, id):
+        return False
+
+    def parse_name(self):
+        """Determine what module to import and what attribute to document.
+        Returns True and sets *self.modname*, *self.objname*, *self.fullname*,
+        if parsing and resolving was successful.
+        """
+        # To view the context and order in which all of these methods get called,
+        # See, Documenter.generate(). That's the main "entry point" that first
+        # calls parse_name(), follwed by import_object(), format_signature(),
+        # add_directive_header(), and then add_content() (which calls get_doc())
+
+        # If we were provided a prototype, that must be an overloaded function. Save it.
+        self.argsstring = None
+        if "(" in self.name:
+            (self.name, self.argsstring) = self.name.split('(', 1)
+            self.argsstring = "({}".format(self.argsstring)
+
+        # methods in the superclass sometimes use '.' to join namespace/class
+        # names with method names, and we don't want that.
+        self.name = self.name.replace('.', '::')
+        self.fullname = self.name
+        self.modname = self.fullname
+        self.objpath = []
+
+        if '::' in self.name:
+            parts = self.name.split('::')
+            self.klassname = parts[-2]
+            self.objname = parts[-1]
+        else:
+            self.objname = self.name
+            self.klassname = ""
+
+        return True
+
+    def add_directive_header(self, sig):
+        """Add the directive header and options to the generated content."""
+        domain = getattr(self, 'domain', 'cpp')
+        directive = getattr(self, 'directivetype', self.objtype)
+        name = self.format_name()
+        sourcename = self.get_sourcename()
+        self.add_line(u'.. %s:%s:: %s%s' % (domain, directive, name, sig),
+                      sourcename)
+
+    def document_members(self, all_members=False):
+        """Generate reST for member documentation.
+        If *all_members* is True, do all members, else those given by
+        *self.options.members*.
+        """
+        want_all = all_members or self.options.inherited_members or \
+            self.options.members is ALL
+        # find out which members are documentable
+        members_check_module, members = self.get_object_members(want_all)
+
+        # remove members given by exclude-members
+        if self.options.exclude_members:
+            members = [(membername, member) for (membername, member) in members
+                       if membername not in self.options.exclude_members]
+
+        # document non-skipped members
+        memberdocumenters = []
+        for (mname, member, isattr) in self.filter_members(members, want_all):
+            classes = [cls for cls in itervalues(AutoDirective._registry)
+                       if cls.can_document_member(member, mname, isattr, self)]
+            if not classes:
+                # don't know how to document this member
+                continue
+
+            # prefer the documenter with the highest priority
+            classes.sort(key=lambda cls: cls.priority)
+
+            documenter = classes[-1](self.directive, mname, indent=self.indent, id=member.get('id'))
+            memberdocumenters.append((documenter, isattr))
+
+        for documenter, isattr in memberdocumenters:
+            documenter.generate(
+                all_members=True, real_modname=self.real_modname,
+                check_module=members_check_module and not isattr)
+
+        # reset current objects
+        self.env.temp_data['autodoc:module'] = None
+        self.env.temp_data['autodoc:class'] = None
+
+
+class DoxygenClassDocumenter(DoxygenDocumenter):
+    objtype = 'doxyclass'
+    directivetype = 'class'
+    domain = 'cpp'
+    priority = 100
+
+    option_spec = {
+        'members': members_option,
+    }
+
+    @classmethod
+    def can_document_member(cls, member, membername, isattr, parent):
+        # this method is only called from Documenter.document_members
+        # when a higher level documenter (module or namespace) is trying
+        # to choose the appropriate documenter for each of its lower-level
+        # members. Currently not implemented since we don't have a higher-level
+        # doumenter like a DoxygenNamespaceDocumenter.
+        return False
+
+    def import_object(self):
+        """Import the object and set it as *self.object*.  In the call sequence, this
+        is executed right after parse_name(), so it can use *self.fullname*, *self.objname*,
+        and *self.modname*.
+
+        Returns True if successful, False if an error occurred.
+        """
+        xpath_query = './/compoundname[text()="%s"]/..' % self.fullname
+        match = get_doxygen_root().xpath(xpath_query)
+        if len(match) != 1:
+            raise ExtensionError('[autodoxy] could not find class (fullname="%s"). I tried'
+                                 'the following xpath: "%s"' % (self.fullname, xpath_query))
+
+        self.object = match[0]
+        return True
+
+    def format_signature(self):
+        return ''
+
+    def format_name(self):
+        return self.fullname
+
+    def get_doc(self, encoding):
+        detaileddescription = self.object.find('detaileddescription')
+        doc = [format_xml_paragraph(detaileddescription)]
+        return doc
+
+    def get_object_members(self, want_all):
+        all_members = self.object.xpath('.//sectiondef[@kind="public-func" '
+            'or @kind="public-static-func"]/memberdef[@kind="function"]')
+
+        if want_all:
+            return False, ((m.find('name').text, m) for m in all_members)
+        else:
+            if not self.options.members:
+                return False, []
+            else:
+                return False, ((m.find('name').text, m) for m in all_members
+                               if m.find('name').text in self.options.members)
+
+    def filter_members(self, members, want_all):
+        ret = []
+        for (membername, member) in members:
+            ret.append((membername, member, False))
+        return ret
+
+    def document_members(self, all_members=False):
+        super(DoxygenClassDocumenter, self).document_members(all_members=all_members)
+        # Uncomment to view the generated rst for the class.
+        # print('\n'.join(self.directive.result))
+
+class DoxygenMethodDocumenter(DoxygenDocumenter):
+    objtype = 'doxymethod'
+    directivetype = 'function'
+    domain = 'cpp'
+    priority = 100
+
+    @classmethod
+    def can_document_member(cls, member, membername, isattr, parent):
+        if ET.iselement(member) and member.tag == 'memberdef' and member.get('kind') == 'function':
+            return True
+        return False
+
+    def parse_id(self, id):
+        xp = './/*[@id="%s"]' % id
+        match = get_doxygen_root().xpath(xp)
+        if len(match) > 0:
+            match = match[0]
+            self.fullname = match.find('./definition').text.split()[-1]
+            self.modname = self.fullname
+            self.objname = match.find('./name').text
+            self.object = match
+        return False
+
+    def import_object(self):
+        if ET.iselement(self.object):
+            # self.object already set from DoxygenDocumenter.parse_name(),
+            # caused by passing in the `id` of the node instead of just a
+            # classname or method name
+            return True
+
+        (obj, meth) = self.fullname.rsplit('::', 1)
+
+        xpath_query_noparam = ('.//compoundname[text()="{:s}"]/../sectiondef[@kind="public-func" or @kind="public-static-func"]'
+                               '/memberdef[@kind="function"]/name[text()="{:s}"]/..').format(obj, meth)
+        xpath_query = ""
+#        print("fullname {}".format(self.fullname))
+        if self.argsstring != None:
+            xpath_query = ('.//compoundname[text()="{:s}"]/../sectiondef[@kind="public-func" or @kind="public-static-func"]'
+                           '/memberdef[@kind="function" and argsstring/text()="{:s}"]/name[text()="{:s}"]/..').format(obj,self.argsstring,meth)
+        else:
+            xpath_query = xpath_query_noparam
+        match = get_doxygen_root().xpath(xpath_query)
+        if len(match) == 0:
+            logger = logging.getLogger(__name__)
+
+            if self.argsstring != None:
+                candidates = get_doxygen_root().xpath(xpath_query_noparam)
+                if len(candidates) == 1:
+                    logger.warning("[autodoxy] Using method '{}::{}{}' instead of '{}::{}{}'. You may want to drop your specification of the signature, or to fix it."
+                                   .format(obj, meth, candidates[0].find('argsstring').text, obj, meth, self.argsstring))
+                    self.object = candidates[0]
+                    return True
+                logger.warning("[autodoxy] WARNING: Could not find method {}::{}{}".format(obj, meth, self.argsstring))
+                for cand in candidates:
+                    logger.warning("[autodoxy] WARNING:   Existing candidate: {}::{}{}".format(obj, meth, cand.find('argsstring').text))
+            else:
+                logger.warning("[autodoxy] WARNING: could not find method {}::{} in Doxygen files".format(obj, meth))
+            return False
+        self.object = match[0]
+        return True
+
+    def get_doc(self, encoding):
+        detaileddescription = self.object.find('detaileddescription')
+        doc = [format_xml_paragraph(detaileddescription)]
+        return doc
+
+    def format_name(self):
+        def text(el):
+            if el.text is not None:
+                return el.text
+            return ''
+
+        def tail(el):
+            if el.tail is not None:
+                return el.tail
+            return ''
+
+        rtype_el = self.object.find('type')
+        rtype_el_ref = rtype_el.find('ref')
+        if rtype_el_ref is not None:
+            rtype = text(rtype_el) + text(rtype_el_ref) + tail(rtype_el_ref)
+        else:
+            rtype = rtype_el.text
+
+ #       print("rtype: {}".format(rtype))
+        signame = (rtype and (rtype + ' ') or '') + self.klassname + "::"+ self.objname
+        return self.format_template_name() + signame
+
+    def format_template_name(self):
+        types = [e.text for e in self.object.findall('templateparamlist/param/type')]
+        if len(types) == 0:
+            return ''
+        ret = 'template <%s>' % ','.join(types)
+#        print ("template: {}".format(ret))
+        return ret
+
+    def format_signature(self):
+        args = self.object.find('argsstring').text
+        return args
+
+    def document_members(self, all_members=False):
+        pass
+
+class DoxygenVariableDocumenter(DoxygenDocumenter):
+    objtype = 'doxyvar'
+    directivetype = 'var'
+    domain = 'cpp'
+    priority = 100
+
+    @classmethod
+    def can_document_member(cls, member, membername, isattr, parent):
+        if ET.iselement(member) and member.tag == 'memberdef' and member.get('kind') == 'variable':
+            return True
+        return False
+
+    def import_object(self):
+        if ET.iselement(self.object):
+            # self.object already set from DoxygenDocumenter.parse_name(),
+            # caused by passing in the `id` of the node instead of just a
+            # classname or method name
+            return True
+
+        (obj, var) = self.fullname.rsplit('::', 1)
+
+        xpath_query = ('.//compoundname[text()="{:s}"]/../sectiondef[@kind="public-attrib" or @kind="public-static-attrib"]'
+                       '/memberdef[@kind="variable"]/name[text()="{:s}"]/..').format(obj, var)
+#        print("fullname {}".format(self.fullname))
+        match = get_doxygen_root().xpath(xpath_query)
+        if len(match) == 0:
+            logger = logging.getLogger(__name__)
+
+            logger.warning("[autodoxy] WARNING: could not find variable {}::{} in Doxygen files".format(obj, var))
+            return False
+        self.object = match[0]
+        return True
+
+    def parse_id(self, id):
+        xp = './/*[@id="%s"]' % id
+        match = get_doxygen_root().xpath(xp)
+        if len(match) > 0:
+            match = match[0]
+            self.fullname = match.find('./definition').text.split()[-1]
+            self.modname = self.fullname
+            self.objname = match.find('./name').text
+            self.object = match
+        return False
+
+    def format_name(self):
+        def text(el):
+            if el.text is not None:
+                return el.text
+            return ''
+
+        def tail(el):
+            if el.tail is not None:
+                return el.tail
+            return ''
+
+        rtype_el = self.object.find('type')
+        rtype_el_ref = rtype_el.find('ref')
+        if rtype_el_ref is not None:
+            rtype = text(rtype_el) + text(rtype_el_ref) + tail(rtype_el_ref)
+        else:
+            rtype = rtype_el.text
+
+ #       print("rtype: {}".format(rtype))
+        signame = (rtype and (rtype + ' ') or '') + self.klassname + "::" + self.objname
+        return self.format_template_name() + signame
+
+    def get_doc(self, encoding):
+        detaileddescription = self.object.find('detaileddescription')
+        doc = [format_xml_paragraph(detaileddescription)]
+        return doc
+
+    def format_template_name(self):
+        types = [e.text for e in self.object.findall('templateparamlist/param/type')]
+        if len(types) == 0:
+            return ''
+        ret = 'template <%s>' % ','.join(types)
+#        print ("template: {}".format(ret))
+        return ret
+
+    def document_members(self, all_members=False):
+        pass
+
+
+##########################################################################
+# Setup the extension
+##########################################################################
+def set_doxygen_xml(app):
+    """Load all doxygen XML files from the app config variable
+    `app.config.doxygen_xml` which should be a path to a directory
+    containing doxygen xml output
+    """
+    err = ExtensionError(
+        '[autodoxy] No doxygen xml output found in doxygen_xml="%s"' % app.config.doxygen_xml)
+
+    if not os.path.isdir(app.config.doxygen_xml):
+        raise err
+
+    files = [os.path.join(app.config.doxygen_xml, f)
+             for f in os.listdir(app.config.doxygen_xml)
+             if f.lower().endswith('.xml') and not f.startswith('._')]
+    if len(files) == 0:
+        raise err
+
+    setup.DOXYGEN_ROOT = ET.ElementTree(ET.Element('root')).getroot()
+    for file in files:
+        root = ET.parse(file).getroot()
+        for node in root:
+            setup.DOXYGEN_ROOT.append(node)
+
+
+def get_doxygen_root():
+    """Get the root element of the doxygen XML document.
+    """
+    if not hasattr(setup, 'DOXYGEN_ROOT'):
+        setup.DOXYGEN_ROOT = ET.Element("root")  # dummy
+    return setup.DOXYGEN_ROOT
+
+
+def setup(app):
+    import sphinx.ext.autosummary
+
+    app.connect("builder-inited", set_doxygen_xml)
+#    app.connect("builder-inited", process_generate_options)
+
+    app.setup_extension('sphinx.ext.autodoc')
+#    app.setup_extension('sphinx.ext.autosummary')
+
+    app.add_autodocumenter(DoxygenClassDocumenter)
+    app.add_autodocumenter(DoxygenMethodDocumenter)
+    app.add_autodocumenter(DoxygenVariableDocumenter)
+    app.add_config_value("doxygen_xml", "", True)
+
+#    app.add_directive('autodoxysummary', DoxygenAutosummary)
+#    app.add_directive('autodoxyenum', DoxygenAutoEnum)
+
+    return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
diff --git a/docs/source/_ext/hidden_code_block.py b/docs/source/_ext/hidden_code_block.py
deleted file mode 100644 (file)
index a009d43..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-"""Simple, inelegant Sphinx extension which adds a directive for a
-highlighted code-block that may be toggled hidden and shown in HTML.  
-This is possibly useful for teaching courses.
-
-The directive, like the standard code-block directive, takes
-a language argument and an optional linenos parameter.  The
-hidden-code-block adds starthidden and label as optional 
-parameters.
-
-Examples:
-
-.. hidden-code-block:: python
-    :starthidden: False
-
-    a = 10
-    b = a + 5
-
-.. hidden-code-block:: python
-    :label: --- SHOW/HIDE ---
-
-    x = 10
-    y = x + 5
-
-Thanks to http://www.javascriptkit.com/javatutors/dom3.shtml for 
-inspiration on the javascript.  
-
-Thanks to Milad 'animal' Fatenejad for suggesting this extension 
-in the first place.
-
-Written by Anthony 'el Scopz' Scopatz, January 2012.
-https://github.com/scopatz/hiddencode
-
-Released under the WTFPL (http://sam.zoy.org/wtfpl/).
-"""
-
-from docutils import nodes
-from docutils.parsers.rst import directives
-from sphinx.directives.code import CodeBlock
-
-HCB_COUNTER = 0
-
-js_showhide = """\
-<script type="text/javascript">
-    function showhide(element){
-        if (!document.getElementById)
-            return
-
-        if (element.style.display == "block")
-            element.style.display = "none"
-        else
-            element.style.display = "block"
-    };
-</script>
-"""
-
-def nice_bool(arg):
-    tvalues = ('true',  't', 'yes', 'y')
-    fvalues = ('false', 'f', 'no',  'n')
-    arg = directives.choice(arg, tvalues + fvalues)
-    return arg in tvalues
-
-
-class hidden_code_block(nodes.General, nodes.FixedTextElement):
-    pass
-
-
-class HiddenCodeBlock(CodeBlock):
-    """Hidden code block is Hidden"""
-
-    option_spec = dict(starthidden=nice_bool, 
-                       label=str,
-                       **CodeBlock.option_spec)
-
-    def run(self):
-        # Body of the method is more or less copied from CodeBlock
-        code = u'\n'.join(self.content)
-        hcb = hidden_code_block(code, code)
-        hcb['language'] = self.arguments[0]
-        hcb['linenos'] = 'linenos' in self.options
-        hcb['starthidden'] = self.options.get('starthidden', True)
-        hcb['label'] = self.options.get('label', '+ show/hide code')
-        hcb.line = self.lineno
-        return [hcb]
-
-
-def visit_hcb_html(self, node):
-    """Visit hidden code block"""
-    global HCB_COUNTER
-    HCB_COUNTER += 1
-
-    # We want to use the original highlighter so that we don't
-    # have to reimplement it.  However it raises a SkipNode 
-    # error at the end of the function call.  Thus we intercept
-    # it and raise it again later.
-    try: 
-        self.visit_literal_block(node)
-    except nodes.SkipNode:
-        pass
-
-    # The last element of the body should be the literal code 
-    # block that was just made.
-    code_block = self.body[-1]
-
-    fill_header = {'divname': 'hiddencodeblock{0}'.format(HCB_COUNTER), 
-                   'startdisplay': 'none' if node['starthidden'] else 'block', 
-                   'label': node.get('label'), 
-                   }
-
-    divheader = ("""<a href="javascript:showhide(document.getElementById('{divname}'))">"""
-                 """{label}</a><br />"""
-                 '''<div id="{divname}" style="display: {startdisplay}">'''
-                 ).format(**fill_header)
-
-    code_block = js_showhide + divheader + code_block + "</div>"
-
-    # reassign and exit
-    self.body[-1] = code_block
-    raise nodes.SkipNode
-
-
-def depart_hcb_html(self, node):
-    """Depart hidden code block"""
-    # Stub because of SkipNode in visit
-
-
-def setup(app):
-    app.add_directive('hidden-code-block', HiddenCodeBlock)
-    app.add_node(hidden_code_block, html=(visit_hcb_html, depart_hcb_html))
diff --git a/docs/source/_ext/showfile.css b/docs/source/_ext/showfile.css
new file mode 100644 (file)
index 0000000..1e3b831
--- /dev/null
@@ -0,0 +1,28 @@
+
+/**
+ *
+ */
+.toggle-tab {
+    margin-bottom: 40px;
+}
+
+.toggle-header {
+    display: block;
+    clear: both;
+    cursor: pointer;
+}
+.toggle-header p {display: inline; }
+.toggle-header strong {color: #2980b9 }
+
+.toggle-header:after {
+    content: " â–¼";
+}
+
+.toggle-header.open:after {
+    content: " â¯‡";
+}
+
+.toggle-content {
+    display: none;
+    margin-bottom: 20px;
+}
diff --git a/docs/source/_ext/showfile.js b/docs/source/_ext/showfile.js
new file mode 100644 (file)
index 0000000..fd8ae6c
--- /dev/null
@@ -0,0 +1,12 @@
+
+$(function() {
+    /**
+     * Toggle logic
+     */
+    $('.hidden-content').hide()
+    $('.toggle-header').click(function () {
+        $(this).toggleClass("open");
+        $(this).next('.toggle-content').toggle('400');
+    })
+});
+
diff --git a/docs/source/_ext/showfile.py b/docs/source/_ext/showfile.py
new file mode 100644 (file)
index 0000000..06845d4
--- /dev/null
@@ -0,0 +1,164 @@
+# -*- coding: utf-8 -*-
+
+# Useful doc: https://www.sphinx-doc.org/en/master/extdev/markupapi.html
+# Example: https://www.sphinx-doc.org/en/master/development/tutorials/recipe.html
+
+import os
+from docutils.parsers.rst import Directive, directives
+from docutils import nodes
+from docutils.statemachine import StringList
+from sphinx.util.osutil import copyfile
+from sphinx.util import logging
+
+CSS_FILE = 'showfile.css'
+JS_FILE = 'showfile.js'
+
+class ShowFileDirective(Directive):
+    """
+    Show a file or propose it to download.
+    """
+
+    has_content = False
+    optional_arguments = 1
+    option_spec = {
+        'language': directives.unchanged
+    }
+
+    def run(self):
+
+        filename = self.arguments[0]
+        language = "python"
+        if 'language' in self.options:
+            language = self.options['language']
+
+        logger = logging.getLogger(__name__)
+#        logger.info('showfile {} in {}'.format(filename, language))
+
+        new_content = [
+          '.. toggle-header::',
+          '   :header: View {}'.format(filename),
+          '',
+          '   `Download {} <https://framagit.org/simgrid/simgrid/tree/{}>`_'.format(os.path.basename(filename), filename),
+          '',
+          '   .. literalinclude:: ../../{}'.format(filename),
+          '      :language: {}'.format(language),
+          ''
+        ]
+
+        for idx, line in enumerate(new_content):
+#            logger.info('{} {}'.format(idx,line))
+            self.content.data.insert(idx, line)
+            self.content.items.insert(idx, (None, idx))
+
+        node = nodes.container()
+        self.state.nested_parse(self.content, self.content_offset, node)
+        return node.children
+
+class ExampleTabDirective(Directive):
+    """
+    A group-tab for a given language, in the presentation of the examples.
+    """
+    has_content = True
+    optional_arguments = 0
+    mandatory_argument = 0
+
+    def run(self):
+        self.assert_has_content()
+
+        filename = self.content[0].strip()
+        self.content.trim_start(1)
+
+        (language, langcode) = (None, None)
+        if filename[-3:] == '.py':
+            language = 'Python'
+            langcode = 'py'
+        elif filename[-4:] == '.cpp':
+            language = 'C++'
+            langcode = 'cpp'
+        elif filename[-4:] == '.xml':
+            language = 'XML'
+            langcode = 'xml'
+        else:
+            raise Exception("Unknown language '{}'. Please choose '.cpp', '.py' or '.xml'".format(language))
+
+        for idx, line in enumerate(self.content.data):
+            self.content.data[idx] = '   ' + line
+
+        for idx, line in enumerate([
+            '.. group-tab:: {}'.format(language),
+            '   ']):
+            self.content.data.insert(idx, line)
+            self.content.items.insert(idx, (None, idx))
+
+        for line in [
+            '',
+            '   .. showfile:: {}'.format(filename),
+            '      :language: {}'.format(langcode),
+            '']:
+            idx = len(self.content.data)
+            self.content.data.insert(idx, line)
+            self.content.items.insert(idx, (None, idx))
+
+#        logger = logging.getLogger(__name__)
+#        logger.info('------------------')
+#        for line in self.content.data:
+#            logger.info('{}'.format(line))
+
+        node = nodes.container()
+        self.state.nested_parse(self.content, self.content_offset, node)
+        return node.children
+
+class ToggleDirective(Directive):
+    has_content = True
+    option_spec = {
+        'header': directives.unchanged,
+        'show': directives.flag
+    }
+    optional_arguments = 1
+
+    def run(self):
+        node = nodes.container()
+        node['classes'].append('toggle-content')
+        if "show" not in self.options:
+            # This :show: thing is not working, and I fail to see why.
+            # Only the hidden-content class gets a call to hide() in the Javascript,
+            # and :show:n block# still get hidden when I load the page.
+            # No idea what's going on (Mt)
+            node['classes'].append('hidden-content')
+
+        par = nodes.container()
+        par['classes'].append('toggle-header')
+        if self.arguments and self.arguments[0]:
+            par['classes'].append(self.arguments[0])
+
+        self.state.nested_parse(StringList([self.options["header"]]), self.content_offset, par)
+        self.state.nested_parse(self.content, self.content_offset, node)
+
+        return [par, node]
+
+def add_assets(app):
+    app.add_stylesheet(CSS_FILE)
+    app.add_javascript(JS_FILE)
+
+
+def copy_assets(app, exception):
+    if app.builder.name not in ['html', 'readthedocs'] or exception:
+        return
+    logger = logging.getLogger(__name__)
+    logger.info('Copying showfile stylesheet/javascript... ', nonl=True)
+    dest = os.path.join(app.builder.outdir, '_static', CSS_FILE)
+    source = os.path.join(os.path.abspath(os.path.dirname(__file__)), CSS_FILE)
+    copyfile(source, dest)
+    dest = os.path.join(app.builder.outdir, '_static', JS_FILE)
+    source = os.path.join(os.path.abspath(os.path.dirname(__file__)), JS_FILE)
+    copyfile(source, dest)
+    logger.info('done')
+
+def setup(app):
+    app.add_directive('toggle-header', ToggleDirective)
+    app.add_directive('showfile', ShowFileDirective)
+    app.add_directive('example-tab', ExampleTabDirective)
+
+    app.connect('builder-inited', add_assets)
+    app.connect('build-finished', copy_assets)
+
index 23f2fea..dbf2749 100644 (file)
@@ -44,7 +44,6 @@ The basic workflow is the following:
 .. doxygendefine:: MSG_init
 .. doxygenfunction:: MSG_launch_application
 .. doxygenfunction:: MSG_main
-.. doxygenfunction:: MSG_set_function
 
 Process Management
 ==================
@@ -88,7 +87,6 @@ This describes the process structure :cpp:type:`msg_process_t` and the functions
 .. doxygenfunction:: MSG_process_sleep
 .. doxygenfunction:: MSG_process_suspend
 .. doxygenfunction:: MSG_process_unref
-.. doxygenfunction:: MSG_process_userdata_init
 .. doxygenfunction:: MSG_process_yield
 
 Host Management
index 885a6a9..01aada4 100644 (file)
@@ -5,7 +5,7 @@ The S4U Interface
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("ActorBox")
@@ -28,7 +28,7 @@ releases. When this happens, compiling your code will produce
 deprecation warnings for 4 releases (one year) before the removal of
 the old symbols. 
 If you want an API that will never ever evolve in the future, you
-should use the deprecated MSG API instead. 
+should use the :ref:`deprecated MSG API <MSG_doc>` instead. 
 
 Main Concepts
 *************
@@ -64,60 +64,60 @@ Virtual machines can also be migrated between hosts.
 The :ref:`simgrid::s4u::this_actor <API_s4u_this_actor>` namespace
 provides many helper functions to simplify the code of actors.
 
-- **Global Classes**
+- **Simulation Elements**
 
-  - :ref:`class s4u::Actor <API_s4u_Actor>`:
+  - :ref:`class Actor <API_s4u_Actor>`:
     Active entities executing your application.
-  - :ref:`class s4u::Engine <API_s4u_Engine>`
+  - :ref:`class Engine <API_s4u_Engine>`
     Simulation engine (singleton).
-  - :ref:`class s4u::Mailbox <API_s4u_Mailbox>`
-    Communication rendez-vous.
+  - :ref:`class Mailbox <API_s4u_Mailbox>`
+    Communication rendez-vous, with which actors meet each other.
 
-- **Platform Elements**
+- **Resources**
 
-  - :ref:`class s4u::Disk <API_s4u_Disk>`
+  - :ref:`class Disk <API_s4u_Disk>`
     Resource on which actors can write and read data.
-  - :ref:`class s4u::Host <API_s4u_Host>`:
+  - :ref:`class Host <API_s4u_Host>`:
     Actor location, providing computational power.
-  - :ref:`class s4u::Link <API_s4u_Link>`
+  - :ref:`class Link <API_s4u_Link>`
     Interconnecting hosts.
-  - :ref:`class s4u::NetZone <API_s4u_NetZone>`:
+  - :ref:`class NetZone <API_s4u_NetZone>`:
     Sub-region of the platform, containing resources (Hosts, Links, etc).
-  - :ref:`class s4u::VirtualMachine <API_s4u_VirtualMachine>`:
+  - :ref:`class VirtualMachine <API_s4u_VirtualMachine>`:
     Execution containers that can be moved between Hosts.
 
-- **Activities** (:ref:`class s4u::Activity <API_s4u_Activity>`):
+- **Activities** (:ref:`class Activity <API_s4u_Activity>`):
   The things that actors can do on resources
 
-  - :ref:`class s4u::Comm <API_s4u_Comm>`
+  - :ref:`class Comm <API_s4u_Comm>`
     Communication activity, started on Mailboxes and consuming links.
-  - :ref:`class s4u::Exec <API_s4u_Exec>`
+  - :ref:`class Exec <API_s4u_Exec>`
     Computation activity, started on Host and consuming CPU resources.
-  - :ref:`class s4u::Io <API_s4u_Io>`
+  - :ref:`class Io <API_s4u_Io>`
     I/O activity, started on and consumming disks.
 
-- **Synchronization Mechanisms**: Classical IPC that actors can use
+- **Synchronization Objects**: Classical IPC that actors can use
 
-  - :ref:`class s4u::Barrier <API_s4u_Barrier>`
-  - :ref:`class s4u::ConditionVariable <API_s4u_ConditionVariable>`
-  - :ref:`class s4u::Mutex <API_s4u_Mutex>`
-  - :ref:`class s4u::Semaphore <API_s4u_Semaphore>`
+  - :ref:`class Barrier <API_s4u_Barrier>`
+  - :ref:`class ConditionVariable <API_s4u_ConditionVariable>`
+  - :ref:`class Mutex <API_s4u_Mutex>`
+  - :ref:`class Semaphore <API_s4u_Semaphore>`
 
 
 .. |API_s4u_Actors| replace:: **Actors**
-.. _API_s4u_Actors: #s4u-actor
+.. _API_s4u_Actors: #api-s4u-actor
 
 .. |API_s4u_Activities| replace:: **Activities**
-.. _API_s4u_Activities: #s4u-activity
+.. _API_s4u_Activities: #api-s4u-activity
 
 .. |API_s4u_Hosts| replace:: **Hosts**
-.. _API_s4u_Hosts: #s4u-host
+.. _API_s4u_Hosts: #api-s4u-host
 
 .. |API_s4u_Links| replace:: **Links**
-.. _API_s4u_Links: #s4u-link
+.. _API_s4u_Links: #api-s4u-link
 
 .. |API_s4u_Disks| replace:: **Disks**
-.. _API_s4u_Disks: #s4u-disk
+.. _API_s4u_Disks: #api-s4u-disk
 
 .. |API_s4u_VirtualMachine| replace:: **VirtualMachines**
 
@@ -138,16 +138,16 @@ provides many helper functions to simplify the code of actors.
 
 .. |API_s4u_Mutex| replace:: **Mutex**
 
-.. THE EXAMPLES
-
-.. include:: ../../examples/s4u/README.rst
+.. _s4u_Activities:
 
 Activities
 **********
 
 Activities represent the actions that consume a resource, such as a
-:ref:`s4u::Comm <API_s4u_Comm>` that consumes the *transmitting power* of
-:ref:`s4u::Link <API_s4u_Link>` resources.
+:ref:`Comm <API_s4u_Comm>` that consumes the *transmitting power* of 
+:ref:`Link <API_s4u_Link>` resources, or an :ref:`Exec <API_s4u_Exec>`
+that consumes the *computing power* of :ref:`Host <API_s4u_Host>` resources.
+See also the :ref:`full API <API_s4u_Activity>` below.
 
 =======================
 Asynchronous Activities
@@ -369,54 +369,224 @@ pointers (yet?). This means that it is currently impossible to destroy a
 mailbox or a link. You can still destroy an host (but probably
 shouldn't), using :cpp:func:`simgrid::s4u::Host::destroy`.
 
-C++ API Reference
-*****************
+.. THE EXAMPLES
+
+.. include:: ../../examples/README.rst
+
+API Reference
+*************
 
 .. _API_s4u_this_actor:
 
-=========================
-namespace s4u::this_actor
-=========================
+==================================
+Interacting with the current actor
+==================================
+
+Static methods working on the current actor (see :ref:`API_s4u_Actor`).
 
 .. doxygennamespace:: simgrid::s4u::this_actor
+
 .. _API_s4u_Activity:
 
-=============
-s4u::Activity
-=============
+==============
+class Activity
+==============
+
+.. autodoxyclass:: simgrid::s4u::Activity
+
+   **Known subclasses:**
+   :ref:`Communications <API_s4u_Comm>` (started on Mailboxes and consuming links),
+   :ref:`Executions <API_s4u_Exec>` (started on Host and consuming CPU resources)
+   :ref:`I/O <API_s4u_Io>` (started on and consumming disks).
+   See also the :ref:`section on activities <s4u_Activities>` above.
+
+Querying info about activities
+------------------------------
+
+   .. autodoxymethod:: simgrid::s4u::Activity::get_remaining()
+   .. autodoxymethod:: simgrid::s4u::Activity::get_state()
+   .. autodoxymethod:: simgrid::s4u::Activity::set_remaining(double remains)
+   .. autodoxymethod:: simgrid::s4u::Activity::get_impl
+
+Activities lifecycle
+--------------------
+
+   .. autodoxymethod:: simgrid::s4u::Activity::start
+   .. autodoxymethod:: simgrid::s4u::Activity::cancel
+   .. autodoxymethod:: simgrid::s4u::Activity::test
+   .. autodoxymethod:: simgrid::s4u::Activity::wait
+   .. autodoxymethod:: simgrid::s4u::Activity::wait_for
+   .. autodoxymethod:: simgrid::s4u::Activity::wait_until(double time_limit)
 
-.. doxygenclass:: simgrid::s4u::Activity
-   :members:
-   :protected-members:
-   :undoc-members:
 
 .. _API_s4u_Actor:
 
-==========
-s4u::Actor
-==========
+===========
+class Actor
+===========
 
 .. doxygentypedef:: ActorPtr
 
 .. doxygentypedef:: aid_t
 
-.. doxygenclass:: simgrid::s4u::Actor
-   :members:
-   :protected-members:
-   :undoc-members:
+.. autodoxyclass:: simgrid::s4u::Actor
+
+Creating actors
+---------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::function< void()> &code)
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code)
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code, Args... args)
+      .. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::string &function, std::vector< std::string > args)
+
+      .. autodoxymethod:: simgrid::s4u::Actor::init(const std::string &name, s4u::Host *host)
+      .. autodoxymethod:: simgrid::s4u::Actor::start(const std::function< void()> &code)
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Actor.create
+
+Searching specific actors
+-------------------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::by_pid(aid_t pid)
+      .. autodoxymethod:: simgrid::s4u::Actor::self()
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Actor.by_pid
+      .. automethod:: simgrid.Actor.self
+
+Querying info about actors
+--------------------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::get_cname
+      .. autodoxymethod:: simgrid::s4u::Actor::get_name
+      .. autodoxymethod:: simgrid::s4u::Actor::get_pid
+      .. autodoxymethod:: simgrid::s4u::Actor::get_ppid
+      .. autodoxymethod:: simgrid::s4u::Actor::get_properties() const
+      .. autodoxymethod:: simgrid::s4u::Actor::get_property(const std::string &key) const
+      .. autodoxymethod:: simgrid::s4u::Actor::set_property(const std::string &key, const std::string &value) 
+
+      .. autodoxymethod:: simgrid::s4u::Actor::get_host
+      .. autodoxymethod:: simgrid::s4u::Actor::set_host
+
+      .. autodoxymethod:: simgrid::s4u::Actor::get_refcount()
+      .. autodoxymethod:: simgrid::s4u::Actor::get_impl
+
+   .. group-tab:: Python
+                  
+      .. autoattribute:: simgrid.Actor.name
+      .. autoattribute:: simgrid.Actor.host
+      .. autoattribute:: simgrid.Actor.pid
+      .. autoattribute:: simgrid.Actor.ppid
+
+      .. automethod:: simgrid.Actor.migrate
+
+Suspending and resuming actors
+------------------------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::suspend()
+      .. autodoxymethod:: simgrid::s4u::Actor::resume()
+      .. autodoxymethod:: simgrid::s4u::Actor::is_suspended()
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Actor.resume
+      .. automethod:: simgrid.Actor.suspend
+      .. automethod:: simgrid.Actor.is_suspended
+
+Specifying when actors should terminate
+---------------------------------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::kill()
+      .. autodoxymethod:: simgrid::s4u::Actor::kill_all()
+      .. autodoxymethod:: simgrid::s4u::Actor::set_kill_time(double time)
+      .. autodoxymethod:: simgrid::s4u::Actor::get_kill_time()
+
+      .. autodoxymethod:: simgrid::s4u::Actor::restart()
+      .. autodoxymethod:: simgrid::s4u::Actor::daemonize()
+      .. autodoxymethod:: simgrid::s4u::Actor::is_daemon
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Actor.kill
+      .. automethod:: simgrid.Actor.kill_all
+
+      .. automethod:: simgrid.Actor.daemonize
+      .. automethod:: simgrid.Actor.is_daemon
+
+Reacting to the end of actors
+-----------------------------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxymethod:: simgrid::s4u::Actor::on_exit
+      .. autodoxymethod:: simgrid::s4u::Actor::join()
+      .. autodoxymethod:: simgrid::s4u::Actor::join(double timeout)
+      .. autodoxymethod:: simgrid::s4u::Actor::set_auto_restart(bool autorestart)
+
+   .. group-tab:: Python
+
+      .. automethod:: simgrid.Actor.join
+
+Signals
+-------
+
+.. tabs::
+
+   .. group-tab:: C++
+
+      .. autodoxyvar:: simgrid::s4u::Actor::on_creation
+      .. autodoxyvar:: simgrid::s4u::Actor::on_suspend
+      .. autodoxyvar:: simgrid::s4u::Actor::on_resume
+      .. autodoxyvar:: simgrid::s4u::Actor::on_sleep
+      .. autodoxyvar:: simgrid::s4u::Actor::on_wake_up
+      .. autodoxyvar:: simgrid::s4u::Actor::on_migration_start
+      .. autodoxyvar:: simgrid::s4u::Actor::on_migration_end
+      .. autodoxyvar:: simgrid::s4u::Actor::on_termination
+      .. autodoxyvar:: simgrid::s4u::Actor::on_destruction
 
 .. _API_s4u_Barrier:
 
-============
-s4u::Barrier
-============
+=============
+class Barrier
+=============
 
 .. doxygentypedef:: BarrierPtr
 
-.. doxygenclass:: simgrid::s4u::Barrier
-   :members:
-   :protected-members:
-   :undoc-members:
+.. autodoxyclass:: simgrid::s4u::Barrier
+
+   .. tabs::
+
+      .. group-tab:: C++
+
+         .. autodoxymethod:: simgrid::s4u::Barrier::Barrier(unsigned int count)
+         .. autodoxymethod:: simgrid::s4u::Barrier::create(unsigned int expected_actors)
+         .. autodoxymethod:: simgrid::s4u::Barrier::wait()
+
 
 .. _API_s4u_Comm:
 
@@ -601,11 +771,37 @@ s4u::VirtualMachine
    :protected-members:
    :undoc-members:
 
+C API Reference
+***************
+
+==============
+Main functions
+==============
+
+.. doxygenfunction:: simgrid_init
+.. doxygenfunction:: simgrid_get_clock
+.. doxygenfunction:: simgrid_load_deployment
+.. doxygenfunction:: simgrid_load_platform
+.. doxygenfunction:: simgrid_register_default
+.. doxygenfunction:: simgrid_register_function
+.. doxygenfunction:: simgrid_run
+
+==================
+Condition Variable
+==================
+
+See also the :ref:`C++ API <API_s4u_ConditionVariable>`.
+
+.. doxygenfunction:: sg_cond_init
+.. doxygenfunction:: sg_cond_notify_all
+.. doxygenfunction:: sg_cond_notify_one
+.. doxygenfunction:: sg_cond_wait
+.. doxygenfunction:: sg_cond_wait_for
 
 Python API Reference
 ********************
 
-The Python API is generated with pybind11. It closely mimicks the C++
+The Python API is automatically generated with pybind11. It closely mimicks the C++
 API, to which you should refer for more information.
 
 ==========
@@ -656,3 +852,7 @@ Class Mailbox
 
 .. autoclass:: simgrid.Mailbox
    :members:
+
+.. |hr| raw:: html
+
+   <hr />
index 5f5d529..89a8b65 100644 (file)
@@ -6,7 +6,7 @@ SMPI: Simulate MPI Applications
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("SMPIBox")
index 3711593..a568dc4 100644 (file)
@@ -5,7 +5,7 @@ Describing your Application
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("ApplicationBox")
index a3cf000..1839d11 100644 (file)
@@ -50,39 +50,27 @@ version = u'3.24.1'
 extensions = [
     'sphinx.ext.todo',
     'breathe',
-    #    'exhale',
     'sphinx.ext.autodoc',
     'sphinx.ext.intersphinx',
-    #    'sphinx.ext.napoleon',
     'sphinx.ext.autosummary',
-    'hidden_code_block',
+    'sphinx_tabs.tabs',
     'javasphinx',
+    'showfile',
+    'autodoxy',
 ]
 
 todo_include_todos = True
 
+# Setup the breath extension
 breathe_projects = {'simgrid': '../build/xml'}
 breathe_default_project = "simgrid"
 
-# Setup the exhale extension
-
-exhale_args = {
-    # These arguments are required
-    "containmentFolder": "./api",
-    "rootFileName": "library_root.rst",
-    "rootFileTitle": "SimGrid Full API",
-    "doxygenStripFromPath": "..",
-    # Suggested optional arguments
-    "createTreeView": True,
-    "exhaleExecutesDoxygen": False,
-    # "exhaleUseDoxyfile":     True,
-}
-
+# Setup the autodoxy extension
+doxygen_xml = os.path.join(os.path.dirname(__file__), "..", "build", "xml")
 
 # For cross-ref generation
 primary_domain = 'cpp'
 
-
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
diff --git a/docs/source/img/lang_cpp.png b/docs/source/img/lang_cpp.png
deleted file mode 100644 (file)
index ad7a89a..0000000
Binary files a/docs/source/img/lang_cpp.png and /dev/null differ
diff --git a/docs/source/img/lang_python.png b/docs/source/img/lang_python.png
deleted file mode 100644 (file)
index 585bc0d..0000000
Binary files a/docs/source/img/lang_python.png and /dev/null differ
index cc183c9..590292f 100644 (file)
@@ -80,7 +80,6 @@ of every page. Bugs in the code should be reported
       Â Â Â ns-3 as a SimGrid model <ns3.rst>
       SimGrid Plugins <Plugins.rst>
       Simulation Outcomes <outcomes.rst>
-      Use Cases and Howto <howto.rst>
       The SimGrid Community <community.rst>
       Frequently Asked Questions <faq.rst>
 
index bc020e7..758990f 100644 (file)
@@ -1,8 +1,6 @@
-.. _platform:
-
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("PlatformBox")
@@ -12,6 +10,8 @@
    <br/>
    <br/>
 
+.. _platform:
+
 Describing your Simulated Platform
 ##################################
 
index b0826ed..577ef26 100644 (file)
@@ -2,7 +2,7 @@
 
 .. raw:: html
 
-   <object id="TOC" data="graphical-toc.svg" width="100%" type="image/svg+xml"></object>
+   <object id="TOC" data="graphical-toc.svg" type="image/svg+xml"></object>
    <script>
    window.onload=function() { // Wait for the SVG to be loaded before changing it
      var elem=document.querySelector("#TOC").contentDocument.getElementById("PlatformBox")
diff --git a/examples/README.rst b/examples/README.rst
new file mode 100644 (file)
index 0000000..ecd2ab4
--- /dev/null
@@ -0,0 +1,728 @@
+.. S4U (Simgrid for you) is the modern interface of SimGrid, which new project should use.
+..
+.. This file follows the ReStructured syntax to be included in the
+.. documentation, but it should remain readable directly.
+
+
+Examples
+********
+
+SimGrid comes with an extensive set of examples, documented on this
+page. Most of them only demonstrate one single feature, with some
+larger examplars listed below. 
+
+The C++ examples can be found under examples/s4u while python examples
+are in examples/python. Each such directory contains the source code (also listed
+from this page), and the so-called tesh file containing how to call
+the binary obtained by compiling this example and also the expected
+output. Tesh files are used to turn each of our examples into an
+integration test. Some examples also contain other files, on need.
+
+A good way to bootstrap your own project is to copy and combine some
+of the provided examples to constitute the skeleton of what you plan
+to simulate.
+
+.. _s4u_ex_actors:
+
+===========================
+Actors: the Active Entities
+===========================
+
+Starting and Stoping Actors
+---------------------------
+
+  - **Creating actors:**
+    Most actors are started from the deployment XML file, because this
+    is a :ref:`better scientific habbit <howto_science>`, but you can
+    also create them directly from your code.
+
+    .. tabs::
+    
+       .. example-tab:: examples/s4u/actor-create/s4u-actor-create.cpp
+       
+          You create actors either:
+             
+          - Directly with :cpp:func:`simgrid::s4u::Actor::create`
+          - From XML with :cpp:func:`simgrid::s4u::Engine::register_actor` (if your actor is a class)
+            or :cpp:func:`simgrid::s4u::Engine::register_function` (if your actor is a function)
+            and then :cpp:func:`simgrid::s4u::Engine::load_deployment`
+             
+       .. example-tab:: examples/python/actor-create/actor-create.py
+       
+          You create actors either:
+            
+          - Directly with :py:func:`simgrid.Actor.create()`
+          - From XML with :py:func:`simgrid.Engine.register_actor()` and then :py:func:`simgrid.Engine.load_deployment()`
+             
+       .. example-tab:: examples/python/actor-create/actor-create_d.xml
+       
+          The following file is used in both C++ and Python.
+
+  - **React to the end of actors:** You can attach callbacks to the end of
+    actors. There is several ways of doing so, depending on whether you want to
+    attach your callback to a given actor and on how you define the end of a
+    given actor. User code probably want to react to the termination of an actor
+    while some plugins want to react to the destruction (memory collection) of
+    actors.
+
+    .. tabs::
+    
+       .. example-tab:: examples/s4u/actor-exiting/s4u-actor-exiting.cpp
+
+          This example shows how to attach a callback to:
+
+          - the end of a specific actor: :cpp:func:`simgrid::s4u::this_actor::on_exit()`
+          - the end of any actor: :cpp:member:`simgrid::s4u::Actor::on_termination()`
+          - the destruction of any actor: :cpp:member:`simgrid::s4u::Actor::on_destruction()`
+
+  - **Kill actors:**
+    Actors can forcefully stop other actors.
+    
+    .. tabs::
+    
+       .. example-tab:: examples/s4u/actor-kill/s4u-actor-kill.cpp
+       
+          See also :cpp:func:`void simgrid::s4u::Actor::kill(void)`, :cpp:func:`void simgrid::s4u::Actor::kill_all()`,
+          :cpp:func:`simgrid::s4u::this_actor::exit`.
+
+       .. example-tab:: examples/python/actor-kill/actor-kill.py
+
+          See also :py:func:`simgrid.Actor.kill`, :py:func:`simgrid.Actor.kill_all`, :py:func:`simgrid.this_actor.exit`.
+
+  - **Controling the actor life cycle from the XML:**
+    You can specify a start time and a kill time in the deployment file.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp
+
+          This file is not really interesting: the important matter is in the XML file.
+
+       .. example-tab:: examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml
+
+          This demonstrates the ``start_time`` and ``kill_time`` attribute of the :ref:`pf_tag_actor` tag.
+
+  - **Daemonize actors:**
+    Some actors may be intended to simulate daemons that run in background. This example show how to transform a regular
+    actor into a daemon that will be automatically killed once the simulation is over.
+    
+    .. tabs::
+
+       .. example-tab:: examples/s4u/actor-daemon/s4u-actor-daemon.cpp
+
+          See also :cpp:func:`simgrid::s4u::Actor::daemonize()` and :cpp:func:`simgrid::s4u::Actor::is_daemon()`.
+
+       .. example-tab:: examples/python/actor-daemon/actor-daemon.py
+
+          See also :py:func:`simgrid.Actor.daemonize()` and :py:func:`simgrid.Actor.is_daemon()`.
+
+Inter-Actors Interactions
+-------------------------
+
+See also the examples on :ref:`inter-actors communications
+<s4u_ex_communication>` and the ones on :ref:`classical
+synchronization objects <s4u_ex_IPC>`.
+
+  - **Suspend and Resume actors:**    
+    Actors can be suspended and resumed during their executions.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/actor-suspend/s4u-actor-suspend.cpp
+
+          See also :cpp:func:`simgrid::s4u::this_actor::suspend()`,
+          :cpp:func:`simgrid::s4u::Actor::suspend()`, :cpp:func:`simgrid::s4u::Actor::resume()` and
+          :cpp:func:`simgrid::s4u::Actor::is_suspended()`.
+
+       .. example-tab:: examples/python/actor-suspend/actor-suspend.py
+
+          See also :py:func:`simgrid.this_actor.suspend()`,
+          :py:func:`simgrid.Actor.suspend()`, :py:func:`simgrid.Actor.resume()` and
+          :py:func:`simgrid.Actor.is_suspended()`.
+
+  - **Migrating Actors:**
+    Actors can move or be moved from a host to another very easily.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/actor-migrate/s4u-actor-migrate.cpp
+
+          See also :cpp:func:`simgrid::s4u::this_actor::migrate()` and :cpp:func:`simgrid::s4u::Actor::migrate()`.
+
+       .. example-tab:: examples/python/actor-migrate/actor-migrate.py
+
+          See also :py:func:`simgrid.this_actor.migrate()` and :py:func:`simgrid.Actor.migrate()`.
+
+  - **Waiting for the termination of an actor:** (joining on it)
+    You can block the current actor until the end of another actor.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/actor-join/s4u-actor-join.cpp
+
+          See also :cpp:func:`simgrid::s4u::Actor::join()`.
+
+       .. example-tab:: examples/python/actor-join/actor-join.py
+
+          See also :py:func:`simgrid.Actor.join()`.
+
+  - **Yielding to other actors**.
+    The ```yield()``` function interrupts the execution of the current
+    actor, leaving a chance to the other actors that are ready to run
+    at this timestamp.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/actor-yield/s4u-actor-yield.cpp
+
+          See also :cpp:func:`simgrid::s4u::this_actor::yield()`.
+
+       .. example-tab:: examples/python/actor-yield/actor-yield.py
+
+          See also :py:func:`simgrid.this_actor.yield_()`.
+
+Traces Replay as a Workload
+---------------------------
+
+This section details how to run trace-driven simulations. It is very
+handy when you want to test an algorithm or protocol that only react
+to external events. For example, many P2P protocols react to user
+requests, but do nothing if there is no such event.
+
+In such situations, you should write your protocol in C++, and separate
+the workload that you want to play onto your protocol in a separate
+text file. Declare a function handling each type of the events in your
+trace, register them using :cpp:func:`xbt_replay_action_register()` in
+your main, and then run the simulation.
+
+Then, you can either have one trace file containing all your events,
+or a file per simulated process: the former may be easier to work
+with, but the second is more efficient on very large traces. Check
+also the tesh files in the example directories for details.
+
+  - **Communication replay:**
+    Presents a set of event handlers reproducing classical communication
+    primitives (asynchronous send/receive at the moment).
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/replay-comm/s4u-replay-comm.cpp
+
+  - **I/O replay:**
+    Presents a set of event handlers reproducing classical I/O
+    primitives (open, read, close).
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/replay-io/s4u-replay-io.cpp
+
+==========================
+Activities: what Actors do
+==========================
+
+.. _s4u_ex_communication:
+
+Communications on the Network
+-----------------------------
+
+ - **Basic asynchronous communications:**
+   Illustrates how to have non-blocking communications, that are
+   communications running in the background leaving the process free
+   to do something else during their completion. 
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/async-wait/s4u-async-wait.cpp
+
+         See also :cpp:func:`simgrid::s4u::Mailbox::put_async()` and :cpp:func:`simgrid::s4u::Comm::wait()`.
+
+      .. example-tab:: examples/python/async-wait/async-wait.py
+
+         See also :py:func:`simgrid.Mailbox.put_async()` and :py:func:`simgrid.Comm.wait()`.
+
+ - **Waiting for all communications in a set:**
+   The ``wait_all()`` function is useful when you want to block until
+   all activities in a given set have completed. 
+   
+   .. tabs::
+
+      .. example-tab:: examples/s4u/async-waitall/s4u-async-waitall.cpp
+
+         See also :cpp:func:`simgrid::s4u::Comm::wait_all()`.
+
+      .. example-tab:: examples/python/async-waitall/async-waitall.py
+
+         See also :py:func:`simgrid.Comm.wait_all()`.
+
+ - **Waiting for the first completed communication in a set:**
+   The ``wait_any()`` function is useful
+   when you want to block until one activity of the set completes, no
+   matter which terminates first.
+   
+   .. tabs::
+
+      .. example-tab:: examples/s4u/async-waitany/s4u-async-waitany.cpp
+
+         See also :cpp:func:`simgrid::s4u::Comm::wait_any()`.
+
+      .. example-tab:: examples/python/async-waitany/async-waitany.py
+
+         See also :py:func:`simgrid.Comm.wait_any()`.
+     
+.. _s4u_ex_execution:
+
+Executions on the CPU
+---------------------
+
+  - **Basic execution:**
+    The computations done in your program are not reported to the
+    simulated world, unless you explicitly request the simulator to pause
+    the actor until a given amount of flops gets computed on its simulated
+    host. Some executions can be given an higher priority so that they
+    get more resources.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/exec-basic/s4u-exec-basic.cpp
+
+          See also :cpp:func:`void simgrid::s4u::this_actor::execute(double)`
+          and :cpp:func:`void simgrid::s4u::this_actor::execute(double, double)`.
+
+       .. example-tab:: examples/python/exec-basic/exec-basic.py
+
+          See also :py:func:`simgrid.this_actor.execute()`.
+
+  - **Asynchronous execution:**
+    You can start asynchronous executions, just like you would fire
+    background threads.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/exec-async/s4u-exec-async.cpp
+
+          See also :cpp:func:`simgrid::s4u::this_actor::exec_init()`,
+          :cpp:func:`simgrid::s4u::Activity::start()`,
+          :cpp:func:`simgrid::s4u::Activity::wait()`,
+          :cpp:func:`simgrid::s4u::Activity::get_remaining()`,
+          :cpp:func:`simgrid::s4u::Exec::get_remaining_ratio()`,
+          :cpp:func:`simgrid::s4u::this_actor::exec_async()` and
+          :cpp:func:`simgrid::s4u::Activity::cancel()`.
+
+       .. example-tab:: examples/python/exec-async/exec-async.py
+    
+          See also :py:func:`simgrid.this_actor::exec_init()`,
+          :py:func:`simgrid.Activity::start()`,
+          :py:func:`simgrid.Activity.wait()`,
+          :py:func:`simgrid.Activity.get_remaining()`,
+          :py:func:`simgrid.Exec.get_remaining_ratio()`,
+          :py:func:`simgrid.this_actor.exec_async()` and
+          :py:func:`simgrid.Activity.cancel()`.
+
+  - **Remote execution:**
+    You can start executions on remote hosts, or even change the host
+    on which they occur during their execution.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/exec-remote/s4u-exec-remote.cpp
+
+          See also :cpp:func:`simgrid::s4u::Exec::set_host()`.
+
+       .. example-tab:: examples/python/exec-remote/exec-remote.py
+
+          See also :py:func:`simgrid.Exec.set_host()`.
+
+  - **Parallel executions:**
+    These objects are convenient abstractions of parallel
+    computational kernels that span over several machines, such as a
+    PDGEM and the other ScaLAPACK routines. Note that this only works
+    with the "ptask_L07" host model (``--cfg=host/model:ptask_L07``).
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/exec-ptask/s4u-exec-ptask.cpp
+    
+          See also :cpp:func:`simgrid::s4u::this_actor::parallel_execute()`.
+
+  - **Using Pstates on a host:**
+    This example shows how define a set of pstates in the XML. The current pstate
+    of an host can then be accessed and changed from the program.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp
+
+          See also :cpp:func:`simgrid::s4u::Host::get_pstate_speed` and :cpp:func:`simgrid::s4u::Host::set_pstate`.
+
+       .. example-tab:: examples/python/exec-dvfs/exec-dvfs.py
+
+          See also :py:func:`Host.get_pstate_speed` and :py:func:`Host.set_pstate`.
+
+       .. example-tab:: examples/platforms/energy_platform.xml
+
+I/O on Disks and Files
+----------------------
+
+SimGrid provides two levels of abstraction to interact with the
+simulated disks. At the simplest level, you simply create read and
+write actions on the disk resources.
+
+  - **Access to raw disk devices:**
+    This example illustrates how to simply read and write data on a
+    simulated disk resource.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp
+
+       .. example-tab:: examples/platforms/hosts_with_disks.xml
+
+          This shows how to declare disks in XML.
+
+The FileSystem plugin provides a more detailed view, with the
+classical operations over files: open, move, unlink, and of course
+read and write. The file and disk sizes are also dealt with and can
+result in short reads and short write, as in reality.
+
+  - **File Management:**
+    This example illustrates the use of operations on files
+    (read, write, seek, tell, unlink, etc).
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/io-file-system/s4u-io-file-system.cpp
+
+  - **Remote I/O:**
+    I/O operations on files can also be done in a remote fashion, 
+    i.e. when the accessed disk is not mounted on the caller's host.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/io-file-remote/s4u-io-file-remote.cpp
+
+.. _s4u_ex_IPC:
+
+Classical synchronization objects
+---------------------------------
+
+ - **Mutex:**
+   Shows how to use simgrid::s4u::Mutex synchronization objects.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/synchro-mutex/s4u-synchro-mutex.cpp
+
+ - **Barrier:**
+   Shows how to use simgrid::s4u::Barrier synchronization objects.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/synchro-barrier/s4u-synchro-barrier.cpp
+
+ - **Semaphore:**
+   Shows how to use simgrid::s4u::Semaphore synchronization objects.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/synchro-semaphore/s4u-synchro-semaphore.cpp
+
+=============================
+Interacting with the Platform
+=============================
+
+ - **User-defined properties:**
+   You can attach arbitrary information to most platform elements from
+   the XML file, and then interact with these values from your
+   program. Note that the changes are not written permanently on disk,
+   in the XML file nor anywhere else. They only last until the end of
+   your simulation.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/platform-properties/s4u-platform-properties.cpp
+
+         - :cpp:func:`simgrid::s4u::Actor::get_property()` and :cpp:func:`simgrid::s4u::Actor::set_property()`
+         - :cpp:func:`simgrid::s4u::Host::get_property()` and :cpp:func:`simgrid::s4u::Host::set_property()`
+         - :cpp:func:`simgrid::s4u::Link::get_property()` and :cpp:func:`simgrid::s4u::Link::set_property()`
+         - :cpp:func:`simgrid::s4u::NetZone::get_property()` and :cpp:func:`simgrid::s4u::NetZone::set_property()`
+
+      .. group-tab:: XML
+
+         **Deployment file:**
+
+         .. showfile:: examples/s4u/platform-properties/s4u-platform-properties_d.xml
+            :language: xml
+
+         |br|
+         **Platform file:**
+
+         .. showfile:: examples/platforms/prop.xml
+            :language: xml
+
+ - **Retrieving the netzones matching a given criteria:**
+   Shows how to filter the cluster netzones.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp
+
+ - **Retrieving the list of hosts matching a given criteria:**
+   Shows how to filter the actors that match a given criteria.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/engine-filtering/s4u-engine-filtering.cpp
+
+ - **Specifying state profiles:** shows how to specify when the
+   resources must be turned off and on again, and how to react to such
+   failures in your code. See also :ref:`howto_churn`.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/platform-failures/s4u-platform-failures.cpp
+
+      .. group-tab:: XML
+
+         .. showfile:: examples/platforms/small_platform_failures.xml
+            :language: xml
+
+         .. showfile:: examples/platforms/profiles/jupiter_state.profile
+
+         .. showfile:: examples/platforms/profiles/bourassa_state.profile
+
+         .. showfile:: examples/platforms/profiles/fafard_state.profile
+
+ - **Specifying speed profiles:** shows how to specify an external
+   load to resources, variating their peak speed over time.
+
+   .. tabs::
+
+      .. example-tab:: examples/s4u/platform-profile/s4u-platform-profile.cpp
+
+      .. group-tab:: XML  
+
+         .. showfile:: examples/platforms/small_platform_profile.xml
+            :language: xml
+
+         .. showfile:: examples/platforms/profiles/jupiter_speed.profile
+
+         .. showfile:: examples/platforms/profiles/link1_bandwidth.profile
+
+         .. showfile:: examples/platforms/profiles/link1_latency.profile
+
+=================
+Energy Simulation
+=================
+
+  - **Describing the energy profiles in the platform:**
+    This platform file contains the energy profile of each links and
+    hosts, which is necessary to get energy consumption predictions.
+    As usual, you should not trust our example, and you should strive
+    to double-check that your instantiation matches your target platform.
+
+    .. tabs::
+
+       .. example-tab:: examples/platforms/energy_platform.xml
+
+  - **Consumption due to the CPU:** 
+    This example shows how to retrieve the amount of energy consumed
+    by the CPU during computations, and the impact of the pstate.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/energy-exec/s4u-energy-exec.cpp
+
+  - **Consumption due to the network:**
+    This example shows how to retrieve and display the energy consumed
+    by the network during communications.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/energy-link/s4u-energy-link.cpp
+
+  - **Modeling the shutdown and boot of hosts:**
+    Simple example of model of model for the energy consumption during
+    the host boot and shutdown periods.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/energy-boot/platform_boot.xml
+
+       .. example-tab:: examples/s4u/energy-boot/s4u-energy-boot.cpp
+
+=======================
+Tracing and Visualizing
+=======================
+
+Tracing can be activated by various configuration options which
+are illustrated in these example. See also the 
+:ref:`full list of options related to tracing <tracing_tracing_options>`.
+
+It is interesting to run the process-create example with the following
+options to see the task executions:
+
+  - **Platform Tracing:**
+    This program is a toy example just loading the platform, so that
+    you can play with the platform visualization. Recommanded options:
+    ``--cfg=tracing:yes --cfg=tracing/categorized:yes``
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/trace-platform/s4u-trace-platform.cpp
+
+========================
+Larger SimGrid Examplars
+========================
+
+This section contains application examples that are somewhat larger
+than the previous examples.
+
+  - **Ping Pong:**
+    This simple example just sends one message back and forth.
+    The tesh file laying in the directory show how to start the simulator binary, highlighting how to pass options to 
+    the simulators (as detailed in Section :ref:`options`).
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/app-pingpong/s4u-app-pingpong.cpp
+
+  - **Token ring:**
+    Shows how to implement a classical communication pattern, where a
+    token is exchanged along a ring to reach every participant.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/app-token-ring/s4u-app-token-ring.cpp
+
+  - **Master Workers:**
+    Another good old example, where one Master process has a bunch of task to dispatch to a set of several Worker 
+    processes.
+
+    .. tabs::
+
+       .. group-tab:: C++
+
+          This example comes in two equivalent variants, one where the actors
+          are specified as simple functions (which is easier to understand for
+          newcomers) and one where the actors are specified as classes (which is
+          more powerful for the users wanting to build their own projects upon
+          the example).
+
+          .. showfile:: examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp
+             :language: cpp
+    
+Data diffusion
+--------------
+
+  - **Bit Torrent:** 
+    Classical protocol for Peer-to-Peer data diffusion.
+
+    .. tabs::
+
+       .. group-tab:: C++
+
+          .. showfile:: examples/s4u/app-bittorrent/s4u-bittorrent.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/app-bittorrent/s4u-peer.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/app-bittorrent/s4u-tracker.cpp
+             :language: cpp
+
+  - **Chained Send:** 
+    Data broadcast over a ring of processes.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/app-chainsend/s4u-app-chainsend.cpp
+
+Distributed Hash Tables (DHT)
+-----------------------------
+
+  - **Chord Protocol** 
+    One of the most famous DHT protocol.
+
+    .. tabs::
+
+       .. group-tab:: C++
+
+          .. showfile:: examples/s4u/dht-chord/s4u-dht-chord.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/dht-chord/s4u-dht-chord-node.cpp
+             :language: cpp
+
+  - **Kademlia**
+    Another well-known DHT protocol.
+
+    .. tabs::
+
+       .. group-tab:: C++
+
+          .. showfile:: examples/s4u/dht-kademlia/s4u-dht-kademlia.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/dht-kademlia/routing_table.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/dht-kademlia/answer.cpp
+             :language: cpp
+
+          .. showfile:: examples/s4u/dht-kademlia/node.cpp
+             :language: cpp
+
+.. _s4u_ex_clouds:
+
+Simulating Clouds
+-----------------
+
+  - **Cloud basics**
+    This example starts some computations both on PMs and VMs, and
+    migrates some VMs around.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/cloud-simple/s4u-cloud-simple.cpp
+
+  - **Migrating VMs**
+    This example shows how to migrate VMs between PMs.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/cloud-migration/s4u-cloud-migration.cpp
+
+=======================
+Model-Checking Examples
+=======================
+
+The model-checker can be used to exhaustively search for issues in the
+tested application. It must be activated at compile time, but this
+mode is rather experimental in SimGrid (as of v3.22). You should not
+enable it unless you really want to formally verify your applications:
+SimGrid is slower and maybe less robust when MC is enabled.
+
+  - **Failing assert**
+    In this example, two actors send some data to a central server,
+    which asserts that the messages are always received in the same order.
+    This is obviously wrong, and the model-checker correctly finds a
+    counter-example to that assertion.
+
+    .. tabs::
+
+       .. example-tab:: examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp
+
+.. |br| raw:: html
+
+   <br />
+
+.. |cpp| image:: /img/lang_cpp.png
+   :align: middle
+   :width: 12
+
+.. |py| image:: /img/lang_python.png
+   :align: middle
+   :width: 12
index 556e2b4..feaea00 100755 (executable)
@@ -30,17 +30,18 @@ all_ids = [42]
 sys.stdout.write("<?xml version='1.0'?>\n"
                  "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n"
                  "<platform version=\"3\">\n"
-                 "  <process host=\"c-0.me\" function=\"bittorrent.Tracker\"><argument value=\"%d\"/></process>\n" % end_date)
+                 "  <process host=\"c-0.me\" function=\"bittorrent.Tracker\"><argument value=\"%d\"/></process>\n" %
+                 end_date)
 
 for i in range(1, nb_nodes):
 
     ok = False
     while not ok:
         my_id = random.randint(0, max_id)
-        ok = not my_id in all_ids
+        ok = my_id not in all_ids
     start_date = i * 10
-    line = "  <process host=\"c-%d.me\" function=\"bittorrent.Peer\"><argument value=\"%d\" /><argument value=\"%d\" />" % (
-        i, my_id, end_date)
+    line = "  <process host=\"c-%d.me\" function=\"bittorrent.Peer\"><argument value=\"%d\" />" \
+           "<argument value=\"%d\" />" % (i, my_id, end_date)
     if random.randint(0, 100) < seed_percentage:
         line += "<argument value=\"1\" />"
     line += "</process>\n"
index 5e920cc..bf86345 100755 (executable)
@@ -30,7 +30,7 @@ for i in range(1, nb_nodes):
     ok = False
     while not ok:
         my_id = random.randint(0, max_id)
-        ok = not my_id in all_ids
+        ok = my_id not in all_ids
     known_id = all_ids[random.randint(0, len(all_ids) - 1)]
     start_date = i * 10
     line = "  <process host=\"node-%d.simgrid.org\" function=\"node\">\n    <argument value=\"%s\"/>"\
index 126a15d..bcfc228 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "task.h"
 #include "answer.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_kademlia_task, "Messages specific for this msg example");
 
 /** @brief Creates a new "find node" task
   * @param sender_id the id of the node who sends the task
index d80d1ee..cc0d24f 100755 (executable)
@@ -29,19 +29,21 @@ all_ids = [42]
 sys.stdout.write("<?xml version='1.0'?>\n"
                  "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n"
                  "<platform version=\"3\">\n"
-                 "  <process host=\"node-0.simgrid.org\" function=\"node\"><argument value=\"42\"/><argument value=\"%d\"/></process>\n" % end_date)
+                 "  <process host=\"node-0.simgrid.org\" function=\"node\"><argument value=\"42\"/>"
+                 "<argument value=\"%d\"/></process>\n" % end_date)
 
 for i in range(1, nb_nodes):
 
     ok = False
     while not ok:
         my_id = random.randint(0, max_id)
-        ok = not my_id in all_ids
+        ok = my_id not in all_ids
 
     known_id = all_ids[random.randint(0, len(all_ids) - 1)]
     start_date = i * 10
-    line = "  <process host=\"node-%d.simgrid.org\" function=\"node\"><argument value=\"%d\" /><argument value=\"%d\" /><argument value=\"%d\" /><argument value=\"%d\" /></process>\n" % (
-        i, my_id, known_id, start_date, end_date)
+    line = "  <process host=\"node-%d.simgrid.org\" function=\"node\"><argument value=\"%d\" />" \
+           "<argument value=\"%d\" /><argument value=\"%d\" /><argument value=\"%d\" /></process>\n" % (
+               i, my_id, known_id, start_date, end_date)
     sys.stdout.write(line)
     all_ids.append(my_id)
 
index c199e82..9ce18b4 100644 (file)
@@ -13,8 +13,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
 
 static void task_cleanup_handler(void* task)
 {
-  if (task)
-    MSG_task_destroy(task);
+  MSG_task_destroy(task);
 }
 
 static int master(int argc, char *argv[])
index 2c03dfa..28bb728 100644 (file)
@@ -16,8 +16,8 @@
 # application and the settings to test it. This is a better scientific methodology. Actually, starting an actor with
 # Actor.create() is mostly useful to start an actor from another actor.
 
+from simgrid import Actor, Engine, Host, Mailbox, this_actor
 import sys
-from simgrid import *
 
 
 def receiver(mailbox_name):
index 6679d86..4389d3f 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.
 
-from simgrid import *
+from simgrid import Actor, Engine, Host, this_actor
 import sys
 
 
index 0a59caf..b7a7f55 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.
 
-from simgrid import *
+from simgrid import Actor, Engine, Host, this_actor
 import sys
 
 
index 73e2bb4..ec51e8e 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.
 
-from simgrid import *
+from simgrid import Actor, Engine, Host, this_actor
 import sys
 
 
index 7c9f569..b64e9b5 100644 (file)
@@ -6,7 +6,7 @@
 # This Python file acts as the foil to the corresponding XML file, where the
 # action takes place: Actors are started and stopped at predefined time
 
-from simgrid import *
+from simgrid import Engine, this_actor
 import sys
 
 
index cf95683..c48a0eb 100644 (file)
@@ -15,7 +15,7 @@
 # Note that worker() takes an uncommon set of parameters,
 # and that this is perfectly accepted by create().
 
-from simgrid import *
+from simgrid import Actor, Engine, Host, this_actor
 import sys
 
 
@@ -25,7 +25,7 @@ def worker(first_host, second_host):
     this_actor.info("Let's move to {:s} to execute {:.2f} Mflops (5sec on {:s} and 5sec on {:s})".format(
         first_host.name, flop_amount / 1e6, first_host.name, second_host.name))
 
-    this_actor.migrate(first_host)
+    this_actor.set_host(first_host)
     this_actor.execute(flop_amount)
 
     this_actor.info("I wake up on {:s}. Let's suspend a bit".format(
@@ -48,12 +48,12 @@ def monitor():
 
     this_actor.info(
         "After 5 seconds, move the process to {:s}".format(jacquelin.name))
-    actor.migrate(jacquelin)
+    actor.host = jacquelin
 
     this_actor.sleep_until(15)
     this_actor.info(
         "At t=15, move the process to {:s} and resume it.".format(fafard.name))
-    actor.migrate(fafard)
+    actor.host = fafard
     actor.resume()
 
 
index 703ba15..1e6a16e 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.
 
-from simgrid import *
+from simgrid import Actor, Engine, this_actor
 import sys
 
 
index dc108bd..e1df6ad 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Engine, this_actor
 import sys
-from simgrid import *
 
 # This example does not much: It just spans over-polite actor that yield a large amount
 # of time before ending.
index 39ab1ea..5a3a37b 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Engine, Mailbox, this_actor
 import sys
-from simgrid import *
 
 # This example shows how to use simgrid::s4u::this_actor::wait() to wait for a given communication.
 #
index 46cd50c..f6fc401 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Comm, Engine, Mailbox, this_actor
 import sys
-from simgrid import *
 
 # This example shows how to block on the completion of a set of communications.
 #
index 274b96a..0b45a12 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Comm, Engine, Mailbox, this_actor
 import sys
-from simgrid import *
 
 # This example shows how to block on the completion of a set of communications.
 #
index 42313ea..6132e63 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Actor, Engine, Host, this_actor
 import sys
-from simgrid import *
 
 
 class Waiter:
index 7d08847..60e0bf6 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Actor, Engine, Host, this_actor
 import sys
-from simgrid import *
 
 
 def executor():
index b04e0b9..e712791 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Actor, Engine, Host, this_actor
 import sys
-from simgrid import *
 
 
 class Dvfs:
index ffb834e..45475ee 100644 (file)
@@ -3,8 +3,8 @@
 # This program is free software you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
+from simgrid import Actor, Engine, Host, this_actor
 import sys
-from simgrid import *
 
 
 class Wizard:
index 034f340..29ecf4f 100644 (file)
@@ -187,6 +187,5 @@ set(bin_files     ${bin_files}    ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/gener
 set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
                                   ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/README.rst                                   PARENT_SCOPE)
+                                  ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt                  PARENT_SCOPE)
 
diff --git a/examples/s4u/README.rst b/examples/s4u/README.rst
deleted file mode 100644 (file)
index e8bd855..0000000
+++ /dev/null
@@ -1,450 +0,0 @@
-.. S4U (Simgrid for you) is the next interface of SimGrid, expected to be released with SimGrid 4.0.
-..
-.. Even if it is not completely rock stable yet, it may well already fit
-.. your needs. You are welcome to try it and report any interface
-.. glitches that you see. Be however warned that the interface may change
-.. until the final release.  You will have to adapt your code on the way.
-.. 
-.. This file follows the ReStructured syntax to be included in the
-.. documentation, but it should remain readable directly.
-
-
-S4U Examples
-************
-
-SimGrid comes with an extensive set of examples, documented on this
-page. Most of them only demonstrate one single feature, with some
-larger examplars listed below. 
-
-The C++ examples can be found under examples/s4u while python examples
-are in examples/python. Each such directory contains the source code (also listed
-from this page), and the so-called tesh file containing how to call
-the binary obtained by compiling this example and also the expected
-output. Tesh files are used to turn each of our examples into an
-integration test. Some examples also contain other files, on need.
-
-A good way to bootstrap your own project is to copy and combine some
-of the provided examples to constitute the skeleton of what you plan
-to simulate.
-
-===========================
-Actors: the Active Entities
-===========================
-
-.. _s4u_ex_actors:
-
-Starting and Stoping Actors
----------------------------
-
-  - **Creating actors:**
-    Most actors are started from the deployment XML file, but there is other methods.
-    This example show them all.
-    `examples/python/actor-create/actor-create_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-create/actor-create_d.xml>`_
-    
-    - |cpp| `examples/s4u/actor-create/s4u-actor-create.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-create/s4u-actor-create.cpp>`_
-    - |py|  `examples/python/actor-create/actor-create.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-create/actor-create.py>`_
-
-  - **React to the end of actors:**
-    You can attach a callback to the end of actors. There is two ways
-    of doing so, depending of whether you want your callback to be
-    executed when a specific actor ends (with ```this_actor::on_exit()```)
-    or whether it should be executed when any actor ends (with
-    ```Actor::on_termination()```) or when it gets destroyed (with
-    ```Actor::on_destruction()```)
-
-    - |cpp| `examples/s4u/actor-exiting/s4u-actor-exiting.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-exiting/s4u-actor-exiting.cpp>`_
-
-  - **Kill actors:**
-    Actors can forcefully stop other actors.
-    
-    - |cpp| `examples/s4u/actor-kill/s4u-actor-kill.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-kill/s4u-actor-kill.cpp>`_
-      :cpp:func:`void simgrid::s4u::Actor::kill(void)`,
-      :cpp:func:`void simgrid::s4u::Actor::kill_all()`,
-      :cpp:func:`simgrid::s4u::this_actor::exit`.
-    - |py| `examples/python/actor-kill/actor-kill.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-kill/actor-kill.py>`_
-      :py:func:`simgrid.Actor.kill`,
-      :py:func:`simgrid.Actor.kill_all`, 
-      :py:func:`simgrid.this_actor.exit`.
-
-  - **Controling the actor life cycle from the XML:**
-    You can specify a start time and a kill time in the deployment
-    file.
-    |br| `examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp>`_
-    |br| `examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-lifetime/s4u-actor-lifetime_d.xml>`_
-
-  - **Daemonize actors:**
-    Some actors may be intended to simulate daemons that run in background. This example show how to transform a regular
-    actor into a daemon that will be automatically killed once the simulation is over.
-    
-    - |cpp| `examples/s4u/actor-daemon/s4u-actor-daemon.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-daemon/s4u-actor-daemon.cpp>`_
-    - |py|  `examples/python/actor-daemon/actor-daemon.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-daemon/actor-daemon.py>`_
-    
-Inter-Actors Interactions
--------------------------
-
-See also the examples on :ref:`inter-actors communications
-<s4u_ex_communication>` and the ones on :ref:`classical
-synchronization objects <s4u_ex_IPC>`.
-
-  - **Suspend and Resume actors:**    
-    Actors can be suspended and resumed during their executions.
-    
-    - |cpp| `examples/s4u/actor-suspend/s4u-actor-suspend.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-suspend/s4u-actor-suspend.cpp>`_
-      :cpp:func:`simgrid::s4u::this_actor::suspend()`,
-      :cpp:func:`simgrid::s4u::Actor::suspend()`, :cpp:func:`simgrid::s4u::Actor::resume()`, :cpp:func:`simgrid::s4u::Actor::is_suspended()`.
-    - |py|  `examples/python/actor-suspend/actor-suspend.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-suspend/actor-suspend.py>`_
-      :py:func:`simgrid.this_actor.suspend()`,
-      :py:func:`simgrid.Actor.suspend()`, :py:func:`simgrid.Actor.resume()`, :py:func:`simgrid.Actor.is_suspended()`.
-
-  - **Migrating Actors:**
-    Actors can move or be moved from a host to another very easily.
-    
-    - |cpp| `examples/s4u/actor-migrate/s4u-actor-migrate.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-migrate/s4u-actor-migrate.cpp>`_
-      :cpp:func:`simgrid::s4u::this_actor::migrate()`
-    - |py|  `examples/python/actor-migrate/actor-migrate.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-migrate/actor-migrate.py>`_
-      :py:func:`simgrid.this_actor.migrate()`
-
-  - **Waiting for the termination of an actor:** (joining on it)
-    You can block the current actor until the end of another actor.
-    
-    - |cpp| `examples/s4u/actor-join/s4u-actor-join.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-join/s4u-actor-join.cpp>`_
-      :cpp:func:`simgrid::s4u::Actor::join()`
-    - |py|  `examples/python/actor-join/actor-join.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-join/actor-join.py>`_
-      :py:func:`simgrid.Actor.join()`
-
-  - **Yielding to other actors**.
-    The ```yield()``` function interrupts the execution of the current
-    actor, leaving a chance to the other actors that are ready to run
-    at this timestamp.
-    
-    - |cpp| `examples/s4u/actor-yield/s4u-actor-yield.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/actor-yield/s4u-actor-yield.cpp>`_
-      :cpp:func:`simgrid::s4u::this_actor::yield()`
-    - |py|  `examples/python/actor-yield/actor-yield.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/actor-yield/actor-yield.py>`_
-      :py:func:`simgrid.this_actor.yield_()`
-
-Traces Replay as a Workload
----------------------------
-
-This section details how to run trace-driven simulations. It is very
-handy when you want to test an algorithm or protocol that only react
-to external events. For example, many P2P protocols react to user
-requests, but do nothing if there is no such event.
-
-In such situations, you should write your protocol in C++, and separate
-the workload that you want to play onto your protocol in a separate
-text file. Declare a function handling each type of the events in your
-trace, register them using :cpp:func:`xbt_replay_action_register()` in
-your main, and then run the simulation.
-
-Then, you can either have one trace file containing all your events,
-or a file per simulated process: the former may be easier to work
-with, but the second is more efficient on very large traces. Check
-also the tesh files in the example directories for details.
-
-  - **Communication replay:**
-    Presents a set of event handlers reproducing classical communication
-    primitives (asynchronous send/receive at the moment).
-    |br| `examples/s4u/replay-comm/s4u-replay-comm.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/replay-comm/s4u-replay-comm.cpp>`_
-
-  - **I/O replay:**
-    Presents a set of event handlers reproducing classical I/O
-    primitives (open, read, close).
-    |br| `examples/s4u/replay-io/s4u-replay-io.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/replay-io/s4u-replay-io.cpp>`_
-
-==========================
-Activities: what Actors do
-==========================
-
-.. _s4u_ex_communication:
-
-Communications on the Network
------------------------------
-
- - **Basic asynchronous communications:**
-   Illustrates how to have non-blocking communications, that are
-   communications running in the background leaving the process free
-   to do something else during their completion. 
-   
-   - |cpp| `examples/s4u/async-wait/s4u-async-wait.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/async-wait/s4u-async-wait.cpp>`_
-     :cpp:func:`simgrid::s4u::Mailbox::put_async()` and :cpp:func:`simgrid::s4u::Comm::wait()`
-   - |py|  `examples/python/async-wait/async-wait.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/async-wait/async-wait.py>`_
-     :py:func:`simgrid.Mailbox.put_async()` :py:func:`simgrid.Comm.wait()`
-
- - **Waiting for all communications in a set:**
-   The `wait_all()` function is useful when you want to block until
-   all activities in a given set have completed. 
-   
-   - |cpp| `examples/s4u/async-waitall/s4u-async-waitall.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/async-waitall/s4u-async-waitall.cpp>`_
-     :cpp:func:`simgrid::s4u::Comm::wait_all()`
-   - |py| `examples/python/async-waitall/async-waitall.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/async-waitall/async-waitall.py>`_
-     :py:func:`simgrid.Comm.wait_all()`
-
- - **Waiting for the first completed communication in a set:**
-   The `wait_any()` function is useful
-   when you want to block until one activity of the set completes, no
-   matter which terminates first.
-   
-   - |cpp| `examples/s4u/async-waitany/s4u-async-waitany.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/async-waitany/s4u-async-waitany.cpp>`_
-     :cpp:func:`simgrid::s4u::Comm::wait_any()`
-   - |py| `examples/python/async-waitany/async-waitany.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/async-waitany/async-waitany.py>`_
-     :py:func:`simgrid.Comm.wait_any()`
-     
-.. todo:: review the `ready` and `waituntil` examples and add them here.
-   
-.. _s4u_ex_execution:
-
-Executions on the CPU
----------------------
-
-  - **Basic execution:**
-    The computations done in your program are not reported to the
-    simulated world, unless you explicitly request the simulator to pause
-    the actor until a given amount of flops gets computed on its simulated
-    host. Some executions can be given an higher priority so that they
-    get more resources.
-    
-    - |cpp| `examples/s4u/exec-basic/s4u-exec-basic.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-basic/s4u-exec-basic.cpp>`_
-    - |py|  `examples/python/exec-basic/exec-basic.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-basic/exec-basic.py>`_
-
-  - **Asynchronous execution:**
-    You can start asynchronous executions, just like you would fire
-    background threads.
-    
-    - |cpp| `examples/s4u/exec-async/s4u-exec-async.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-async/s4u-exec-async.cpp>`_
-    - |py|  `examples/python/exec-async/exec-async.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-async/exec-async.py>`_
-    
-  - **Remote execution:**
-    You can start executions on remote hosts, or even change the host
-    on which they occur during their execution.
-    
-    - |cpp| `examples/s4u/exec-remote/s4u-exec-remote.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-remote/s4u-exec-remote.cpp>`_
-    - |py| `examples/python/exec-remote/exec-remote.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-remote/exec-remote.py>`_
-
-  - **Parallel executions:**
-    These objects are convenient abstractions of parallel
-    computational kernels that span over several machines, such as a
-    PDGEM and the other ScaLAPACK routines. Note that this only works
-    with the "ptask_L07" host model (``--cfg=host/model:ptask_L07``).
-    |br| `examples/s4u/exec-ptask/s4u-exec-ptask.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-ptask/s4u-exec-ptask.cpp>`_
-    
-  - **Using Pstates on a host:**
-    `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
-    shows how define a set of pstates in the XML. The current pstate
-    of an host can then be accessed and changed from the program.
-
-    - |cpp| `examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp>`_
-      :cpp:func:`simgrid::s4u::Host::get_pstate_speed` and :cpp:func:`simgrid::s4u::Host::set_pstate`.
-    - |py|  `examples/python/exec-dvfs/exec-dvfs.py <https://framagit.org/simgrid/simgrid/tree/master/examples/python/exec-dvfs/exec-dvfs.py>`_
-      :py:func:`Host.get_pstate_speed` and :py:func:`Host.set_pstate`.
-
-I/O on Disks and Files
-----------------------
-
-SimGrid provides two levels of abstraction to interact with the
-simulated disks. At the simplest level, you simply create read and
-write actions on the disk resources.
-
-  - **Access to raw disk devices:**
-    This example illustrates how to simply read and write data on a
-    simulated disk resource.
-    |br| `examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp>`_
-
-The FileSystem plugin provides a more detailed view, with the
-classical operations over files: open, move, unlink, and of course
-read and write. The file and disk sizes are also dealt with and can
-result in short reads and short write, as in reality.
-
-  - **File Management:**
-    This example illustrates the use of operations on files
-    (read, write, seek, tell, unlink, etc).
-    |br| `examples/s4u/io-file-system/s4u-io-file-system.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-file-system/s4u-io-file-system.cpp>`_
-
-  - **Remote I/O:**
-    I/O operations on files can also be done in a remote fashion, 
-    i.e. when the accessed disk is not mounted on the caller's host.
-    |br| `examples/s4u/io-file-remote/s4u-io-file-remote.cpp  <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/io-file-remote/s4u-io-file-remote.cpp>`_
-
-.. _s4u_ex_IPC:
-
-Classical synchronization objects
----------------------------------
-
- - **Mutex:**
-   Shows how to use simgrid::s4u::Mutex synchronization objects.
-   |br| `examples/s4u/synchro-mutex/s4u-synchro-mutex.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/synchro-mutex/s4u-synchro-mutex.cpp>`_
-
- - **Barrier:**
-   Shows how to use simgrid::s4u::Barrier synchronization objects.
-   |br| `examples/s4u/synchro-barrier/s4u-synchro-barrier.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/synchro-barrier/s4u-synchro-barrier.cpp>`_
-
- - **Semaphore:**
-   Shows how to use simgrid::s4u::Semaphore synchronization objects.
-   |br| `examples/s4u/synchro-semaphore/s4u-synchro-semaphore.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/synchro-semaphore/s4u-synchro-semaphore.cpp>`_
-
-=============================
-Interacting with the Platform
-=============================
-
- - **Retrieving the list of hosts matching a given criteria:**
-   Shows how to filter the actors that match a given criteria.
-   |br| `examples/s4u/engine-filtering/s4u-engine-filtering.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/engine-filtering/s4u-engine-filtering.cpp>`_
-
- - **User-defined properties:**
-   You can attach arbitrary information to most platform elements from
-   the XML file, and then interact with these values from your
-   program. Note that the changes are not written permanently on disk,
-   in the XML file nor anywhere else. They only last until the end of
-   your simulation.
-   
-   - :cpp:func:`simgrid::s4u::Actor::get_property()` and :cpp:func:`simgrid::s4u::Actor::set_property()`
-   - :cpp:func:`simgrid::s4u::Host::get_property()` and :cpp:func:`simgrid::s4u::Host::set_property()`
-   - :cpp:func:`simgrid::s4u::Link::get_property()` and :cpp:func:`simgrid::s4u::Link::set_property()`
-   - :cpp:func:`simgrid::s4u::NetZone::get_property()` and :cpp:func:`simgrid::s4u::NetZone::set_property()`
-     
-   |br| `examples/s4u/platform-properties/s4u-platform-properties.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/platform-properties/s4u-platform-properties.cpp>`_
-   |br| `examples/s4u/platform-properties/s4u-platform-properties_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/platform-properties/s4u-platform-properties_d.xml>`_
-   |br| `examples/platforms/prop.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/prop.xml>`_
-
- - **Specifying state profiles:** shows how to specify when the
-   resources must be turned off and on again, and how to react to such
-   failures in your code.
-   
-   |br| `examples/platforms/small_platform_failures.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/small_platform_failures.xml>`_
-   |br| The state profiles in `examples/platforms/profiles <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/profiles>`_
-
- - **Specifying speed profiles:** shows how to specify an external
-   load to resources, variating their peak speed over time.
-   
-   |br| `examples/platforms/small_platform_profile.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/small_platform_profile.xml>`_
-   |br| The speed, bandwidth and latency profiles in `examples/platforms/profiles  <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/profiles>`_
-
-=================
-Energy Simulation
-=================
-
-  - **Describing the energy profiles in the platform:**
-    This platform file contains the energy profile of each links and
-    hosts, which is necessary to get energy consumption predictions.
-    As usual, you should not trust our example, and you should strive
-    to double-check that your instantiation matches your target platform.
-    |br| `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
-
-  - **Consumption due to the CPU:** 
-    This example shows how to retrieve the amount of energy consumed
-    by the CPU during computations, and the impact of the pstate.
-    |br| `examples/s4u/energy-exec/s4u-energy-exec.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-exec/s4u-energy-exec.cpp>`_
-
-  - **Consumption due to the network:**
-    This example shows how to retrieve and display the energy consumed
-    by the network during communications.
-    |br| `examples/s4u/energy-link/s4u-energy-link.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-link/s4u-energy-link.cpp>`_
-
-  - **Modeling the shutdown and boot of hosts:**
-    Simple example of model of model for the energy consumption during
-    the host boot and shutdown periods.
-    |br| `examples/s4u/energy-boot/platform_boot.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-boot/platform_boot.xml>`_
-    |br| `examples/s4u/energy-boot/s4u-energy-boot.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/energy-boot/s4u-energy-boot.cpp>`_
-
-=======================
-Tracing and Visualizing
-=======================
-
-Tracing can be activated by various configuration options which
-are illustrated in these example. See also the 
-:ref:`full list of options related to tracing <tracing_tracing_options>`.
-
-It is interesting to run the process-create example with the following
-options to see the task executions:
-
-  - **Platform Tracing:**
-    This program is a toy example just loading the platform, so that
-    you can play with the platform visualization. Recommanded options:
-    ``--cfg=tracing:yes --cfg=tracing/categorized:yes``
-    |br| `examples/s4u/trace-platform/s4u-trace-platform.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/trace-platform/s4u-trace-platform.cpp>`_
-
-========================
-Larger SimGrid Examplars
-========================
-
-This section contains application examples that are somewhat larger
-than the previous examples.
-
-  - **Ping Pong:**
-    This simple example just sends one message back and forth.
-    The tesh file laying in the directory show how to start the simulator binary, highlighting how to pass options to 
-    the simulators (as detailed in Section :ref:`options`). 
-    |br| `examples/s4u/app-pingpong/s4u-app-pingpong.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-pingpong/s4u-app-pingpong.cpp>`_
-
-  - **Token ring:**
-    Shows how to implement a classical communication pattern, where a
-    token is exchanged along a ring to reach every participant.
-    |br| `examples/s4u/app-token-ring/s4u-app-token-ring.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-token-ring/s4u-app-token-ring.cpp>`_
-
-  - **Master Workers:**
-    Another good old example, where one Master process has a bunch of task to dispatch to a set of several Worker 
-    processes. This example comes in two equivalent variants, one
-    where the actors are specified as simple functions (which is easier to
-    understand for newcomers) and one where the actors are specified
-    as classes (which is more powerful for the users wanting to build
-    their own projects upon the example).
-    |br| `examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp>`_
-    |br| `examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp>`_
-    
-Data diffusion
---------------
-
-  - **Bit Torrent:** 
-    Classical protocol for Peer-to-Peer data diffusion.
-    |br| `examples/s4u/app-bittorrent/s4u-bittorrent.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-bittorrent/s4u-bittorrent.cpp>`_
-    
-  - **Chained Send:** 
-    Data broadcast over a ring of processes.
-    |br| `examples/s4u/app-chainsend/s4u-app-chainsend.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/app-chainsend/s4u-app-chainsend.cpp>`_
-
-Distributed Hash Tables (DHT)
------------------------------
-
-  - **Chord Protocol** 
-    One of the most famous DHT protocol.
-    |br| `examples/s4u/dht-chord/s4u-dht-chord.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/dht-chord/s4u-dht-chord.cpp>`_
-
-.. _s4u_ex_clouds:
-
-Simulating Clouds
------------------
-
-  - **Cloud basics**
-    This example starts some computations both on PMs and VMs, and
-    migrates some VMs around.
-    |br| `examples/s4u/cloud-simple/s4u-cloud-simple.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/cloud-simple/s4u-cloud-simple.cpp>`_
-
-.. TODO:: document here the examples about clouds and plugins
-
-=======================
-Model-Checking Examples
-=======================
-
-The model-checker can be used to exhaustively search for issues in the
-tested application. It must be activated at compile time, but this
-mode is rather experimental in SimGrid (as of v3.22). You should not
-enable it unless you really want to formally verify your applications:
-SimGrid is slower and maybe less robust when MC is enabled.
-
-  - **Failing assert**
-    In this example, two actors send some data to a central server,
-    which asserts that the messages are always received in the same order.
-    This is obviously wrong, and the model-checker correctly finds a
-    counter-example to that assertion.
-    |br| `examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp>`_
-
-.. |br| raw:: html
-
-   <br />
-
-.. |cpp| image:: /img/lang_cpp.png
-   :align: middle
-   :width: 12
-
-.. |py| image:: /img/lang_python.png
-   :align: middle
-   :width: 12
index c1b3608..be035df 100644 (file)
@@ -28,7 +28,7 @@ static void worker(simgrid::s4u::Host* first, simgrid::s4u::Host* second)
   XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", first->get_cname(), flopAmount / 1e6,
            first->get_cname(), second->get_cname());
 
-  simgrid::s4u::this_actor::migrate(first);
+  simgrid::s4u::this_actor::set_host(first);
   simgrid::s4u::this_actor::execute(flopAmount);
 
   XBT_INFO("I wake up on %s. Let's suspend a bit", simgrid::s4u::this_actor::get_host()->get_cname());
@@ -50,11 +50,11 @@ static void monitor()
   simgrid::s4u::this_actor::sleep_for(5);
 
   XBT_INFO("After 5 seconds, move the process to %s", jacquelin->get_cname());
-  actor->migrate(jacquelin);
+  actor->set_host(jacquelin);
 
   simgrid::s4u::this_actor::sleep_until(15);
   XBT_INFO("At t=15, move the process to %s and resume it.", fafard->get_cname());
-  actor->migrate(fafard);
+  actor->set_host(fafard);
   actor->resume();
 }
 
index e335d11..a5e59bb 100644 (file)
@@ -22,7 +22,6 @@ constexpr int BLOCK_SIZE              = 16384;
 /** Number of blocks asked by each request */
 constexpr unsigned long BLOCKS_REQUESTED = 2UL;
 
-constexpr bool ENABLE_END_GAME_MODE = true;
 constexpr double SLEEP_DURATION     = 1.0;
 #define BITS_TO_BYTES(x) (((x) / 8 + (x) % 8) ? 1 : 0)
 
@@ -369,10 +368,6 @@ void Peer::handleMessage()
       XBT_DEBUG(" \t for piece %d (%d,%d)", message->piece, message->block_index,
                 message->block_index + message->block_length);
       xbt_assert(not remote_peer->choked_download);
-      xbt_assert(remote_peer->am_interested || ENABLE_END_GAME_MODE,
-                 "Can't received a piece if I'm not interested without end-game mode!"
-                 "piece (%d) bitfield (%u) remote bitfield (%u)",
-                 message->piece, bitfield_, remote_peer->bitfield);
       xbt_assert(not remote_peer->choked_download, "Can't received a piece if I'm choked !");
       xbt_assert((message->piece >= 0 && static_cast<unsigned int>(message->piece) < FILE_PIECES),
                  "Wrong piece received");
@@ -394,7 +389,6 @@ void Peer::handleMessage()
         }
       } else {
         XBT_DEBUG("However, we already have it");
-        xbt_assert(ENABLE_END_GAME_MODE, "Should not happen because we don't use end game mode !");
         requestNewPieceTo(remote_peer);
       }
       break;
@@ -444,8 +438,6 @@ int Peer::selectPieceToDownload(Connection* remote_peer)
 
   // end game mode
   if (countPieces(current_pieces) >= (FILE_PIECES - countPieces(bitfield_)) && isInterestedBy(remote_peer)) {
-    if (not ENABLE_END_GAME_MODE)
-      return -1;
     int nb_interesting_pieces = 0;
     // compute the number of interesting pieces
     for (unsigned int i = 0; i < FILE_PIECES; i++)
index 5e920cc..bf86345 100755 (executable)
@@ -30,7 +30,7 @@ for i in range(1, nb_nodes):
     ok = False
     while not ok:
         my_id = random.randint(0, max_id)
-        ok = not my_id in all_ids
+        ok = my_id not in all_ids
     known_id = all_ids[random.randint(0, len(all_ids) - 1)]
     start_date = i * 10
     line = "  <process host=\"node-%d.simgrid.org\" function=\"node\">\n    <argument value=\"%s\"/>"\
index 4c91e69..6a74e1b 100644 (file)
@@ -56,8 +56,8 @@ public:
     file->move(newpath);
 
     // Test attaching some user data to the file
-    file->set_userdata(new std::string("777"));
-    std::string* file_data = static_cast<std::string*>(file->get_userdata());
+    file->set_data(new std::string("777"));
+    std::string* file_data = static_cast<std::string*>(file->get_data());
     XBT_INFO("User data attached to the file: %s", file_data->c_str());
     delete file_data;
 
index 9c7650a..05b2efa 100644 (file)
@@ -7,8 +7,6 @@
 #include "smpi/smpi.h"
 #include "smpi/sampi.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_plugin_load_balancer_example, smpi, "Simple tracing test for SAMPI functions");
-
 int main(int argc, char* argv[])
 {
   MPI_Init(&argc, &argv);
index 5ea1158..7f3918f 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <xbt/backtrace.hpp>
 #include <xbt/ex.h>
+#include <xbt/string.hpp>
 
 #include <atomic>
 #include <functional>
@@ -157,6 +158,23 @@ public:
   }
 };
 
+class XBT_PUBLIC ParseError : public Exception, public std::invalid_argument {
+  int line_;
+  std::string file_;
+  std::string msg_;
+
+public:
+  ParseError(int line, std::string& file, std::string&& msg)
+      : Exception(XBT_THROW_POINT, std::move(msg)), std::invalid_argument(msg), line_(line), file_(file), msg_(msg)
+  {
+  }
+
+  const char* what() const noexcept override
+  {
+    return bprintf("Parse error at %s:%d: %s", file_.c_str(), line_, msg_.c_str());
+  }
+};
+
 class XBT_PUBLIC ForcefulKillException {
   /** @brief Exception launched to kill an actor; DO NOT BLOCK IT!
    *
index 9b38ab5..90836fa 100644 (file)
@@ -11,7 +11,7 @@
 #include <xbt/dict.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 /** @brief Actor datatype.
     @ingroup m_actor_management
 
@@ -20,6 +20,11 @@ SG_BEGIN_DECL()
     You should not access directly to the fields of the pointed structure, but always use the provided API to interact
     with actors.
  */
+XBT_PUBLIC sg_actor_t sg_actor_init(const char* name, sg_host_t host);
+/** Start the previously initialized actor.
+ *
+ * Note that argv is copied over, so you should free your own copy once the actor is started. */
+XBT_PUBLIC void sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char** argv);
 XBT_PUBLIC aid_t sg_actor_get_PID(sg_actor_t actor);
 XBT_PUBLIC aid_t sg_actor_get_PPID(sg_actor_t actor);
 XBT_PUBLIC sg_actor_t sg_actor_by_PID(aid_t pid);
@@ -33,7 +38,11 @@ XBT_PUBLIC int sg_actor_is_suspended(sg_actor_t actor);
 XBT_PUBLIC sg_actor_t sg_actor_restart(sg_actor_t actor);
 void sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart);
 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_ATTRIB_DEPRECATED_v329("Please use sg_actor_set_host() instead") XBT_PUBLIC
+    void sg_actor_migrate(sg_actor_t process, sg_host_t host);
+
+XBT_PUBLIC void sg_actor_set_host(sg_actor_t actor, 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_kill_all();
@@ -46,12 +55,14 @@ XBT_PUBLIC sg_actor_t sg_actor_self();
 XBT_PUBLIC aid_t sg_actor_self_get_pid();
 XBT_PUBLIC aid_t sg_actor_self_get_ppid();
 XBT_PUBLIC const char* sg_actor_self_get_name();
+XBT_PUBLIC void* sg_actor_self_data();
+XBT_PUBLIC void sg_actor_self_data_set(void* data);
 XBT_PUBLIC void sg_actor_self_execute(double flops);
 XBT_PUBLIC void sg_actor_ref(sg_actor_t actor);
 XBT_PUBLIC void sg_actor_unref(sg_actor_t actor);
-XBT_PUBLIC void* sg_actor_data(sg_actor_t actor);
+XBT_PUBLIC void* sg_actor_data(const_sg_actor_t actor);
 XBT_PUBLIC void sg_actor_data_set(sg_actor_t actor, void* userdata);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_ACTOR_H_ */
index 2837633..83347fe 100644 (file)
@@ -17,12 +17,12 @@ constexpr int SG_BARRIER_SERIAL_THREAD = -1;
 #endif
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC sg_bar_t sg_barrier_init(unsigned int count);
 XBT_PUBLIC void sg_barrier_destroy(sg_bar_t bar);
 XBT_PUBLIC int sg_barrier_wait(sg_bar_t bar);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_BARRIER_H_ */
index 08c3318..2bdfc41 100644 (file)
@@ -9,7 +9,7 @@
 #include <simgrid/forward.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 /** @brief Creates a condition variable */
 XBT_PUBLIC sg_cond_t sg_cond_init();
 
@@ -25,6 +25,6 @@ XBT_PUBLIC void sg_cond_notify_all(sg_cond_t cond);
 /** @brief Destroys the given mutex variable */
 XBT_PUBLIC void sg_cond_destroy(sg_cond_t cond);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_COND_H_ */
index 37ce363..6fd16ee 100644 (file)
 #define SIMGRID_VERSION_PATCH @SIMGRID_VERSION_PATCH@
 #define SIMGRID_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
 
-SG_BEGIN_DECL()
+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);
 
 /** Display the version information and some additional blurb. */
 XBT_PUBLIC void sg_version();
-SG_END_DECL()
+SG_END_DECL
 
 
 /* Version as a single integer. v3.4 is 30400, v3.16.2 is 31602, v42 will be 420000, and so on. */
index e946b5c..4a2247e 100644 (file)
@@ -8,17 +8,48 @@
 
 #include <simgrid/forward.h>
 
-/* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL /* C interface */
+/** Initialize the SimGrid engine, taking the command line parameters of your main function. */
 XBT_PUBLIC void simgrid_init(int* argc, char** argv);
+
+/** Creates a new platform, including hosts, links, and the routing table.
+ *
+ * \rst
+ * See also: :ref:`platform`.
+ * \endrst
+ */
 XBT_PUBLIC void simgrid_load_platform(const char* filename);
+/** Load a deployment file and launch the actors that it contains
+ *
+ * \rst
+ * See also: :ref:`deploy`.
+ * \endrst
+ */
 XBT_PUBLIC void simgrid_load_deployment(const char* filename);
+/** Run the simulation after initialization */
 XBT_PUBLIC void simgrid_run();
+/** Registers the main function of an actor that will be launched from the deployment file */
 XBT_PUBLIC void simgrid_register_function(const char* name, int (*code)(int, char**));
+/** 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/s4u/replay-comms and similar).
+ */
 XBT_PUBLIC void simgrid_register_default(int (*code)(int, char**));
+/** Retrieve the simulation time (in seconds) */
 XBT_PUBLIC double simgrid_get_clock();
+/** Retrieve the number of actors in the simulation */
+XBT_PUBLIC int simgrid_get_actor_count();
 
+/** @brief Allow other libraries to react to the --help flag, too
+ *
+ * When finding --help on the command line, simgrid usually stops right after displaying its help message.
+ * If you are writing a library using simgrid, you may want to display your own help message before everything stops.
+ * If so, just call this function before having simgrid parsing the command line, and you will be given the control
+ * even if the user is asking for help.
+ */
 XBT_PUBLIC void sg_config_continue_after_help();
-SG_END_DECL()
+
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_ENGINE_H_ */
index 8ce7d7b..08cdf5b 100644 (file)
@@ -236,6 +236,7 @@ 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 const s4u_Actor* const_sg_actor_t;
 
 typedef struct s_smx_simcall* smx_simcall_t;
 
index 368531c..a7cce00 100644 (file)
@@ -10,7 +10,7 @@
 #include <xbt/dynar.h>
 #include <simgrid/forward.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 /** @brief Host datatype.
  *
  *   A <em>location</em> (or <em>host</em>) is any possible place where an actor may run. Thus it is represented as a
@@ -139,6 +139,6 @@ void sg_host_send_to(sg_host_t from, sg_host_t to, double byte_amount);
 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()
+SG_END_DECL
 
 #endif /* SIMGRID_HOST_H_ */
index 664f90b..211df99 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <simgrid/msg.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Functions to manage tracing categories */
 XBT_PUBLIC void TRACE_category(const char* category);
@@ -80,6 +80,6 @@ XBT_PUBLIC void TRACE_host_pop_state(const char* host, const char* state);
 XBT_PUBLIC xbt_dynar_t TRACE_get_node_types();
 XBT_PUBLIC xbt_dynar_t TRACE_get_edge_types();
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif                          /* INSTR_H_ */
index a6826e6..c570bfc 100644 (file)
@@ -8,11 +8,11 @@
 
 #include <simgrid/simdag.h>
 
-SG_BEGIN_DECL()
+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);
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* JEDULE_SD_BINDING_H_ */
index 2821e7f..00ae0df 100644 (file)
@@ -47,7 +47,14 @@ public:
 /** @details An action is a consumption on a resource (e.g.: a communication for the network).
  *
  * It is related (but still different) from activities, that are the stuff on which an actor can be blocked.
- * See simgrid::s4u::Activity for more details.
+ *
+ * - A sequential execution activity encompasses 2 actions: one for the exec itself,
+ *   and a time-limited sleep used as timeout detector.
+ * - A point-to-point communication activity encompasses 3 actions: one for the comm itself
+ *   (which spans on all links of the path), and one infinite sleep used as failure detector
+ *   on both sender and receiver hosts.
+ * - Synchronization activities may possibly be connected to no action.
+
  */
 class XBT_PUBLIC Action {
   friend ActionHeap;
index a226509..ee23a15 100644 (file)
@@ -74,15 +74,17 @@ public:
   virtual double next_occurring_event_lazy(double now);
   virtual double next_occurring_event_full(double now);
 
-  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event()") double next_occuring_event(double now)
+  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event()") virtual double next_occuring_event(double now) final
   {
     return next_occurring_event(now);
   }
-  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_lazy()") double next_occuring_event_lazy(double now)
+  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_lazy()") virtual double next_occuring_event_lazy(
+      double now) final
   {
     return next_occurring_event_lazy(now);
   }
-  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_full()") double next_occuring_event_full(double now)
+  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_full()") virtual double next_occuring_event_full(
+      double now) final
   {
     return next_occurring_event_full(now);
   }
@@ -111,7 +113,8 @@ public:
    */
   virtual bool next_occurring_event_is_idempotent() { return true; }
 
-  XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_is_idempotent()") bool next_occuring_event_is_idempotent()
+  XBT_ATTRIB_DEPRECATED_v329(
+      "Please use next_occurring_event_is_idempotent()") virtual bool next_occuring_event_is_idempotent() final
   {
     return next_occurring_event_is_idempotent();
   }
index a7280a6..2664a53 100644 (file)
@@ -12,7 +12,7 @@
 #include <xbt/base.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+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);
@@ -22,6 +22,6 @@ 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();
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_LINK_H_ */
index 4bae8cb..a21900a 100644 (file)
 #include <xbt/base.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_mailbox_set_receiver(const char* alias);
 XBT_PUBLIC int sg_mailbox_listen(const char* alias);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_MAILBOX_H_ */
index 2ddf8a9..b4eb10c 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <stddef.h> /* size_t */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC int MC_random(int min, int max);
 
@@ -67,6 +67,6 @@ XBT_PUBLIC void MC_ignore_global_variable(const char* var_name);
 
 #endif
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* SIMGRID_MODELCHECKER_H */
index 7b2ce4a..a29e549 100644 (file)
@@ -303,8 +303,12 @@ XBT_PUBLIC void MSG_function_register_default(xbt_main_func_t code);
 XBT_PUBLIC void MSG_create_environment(const char* file);
 /** @brief Creates the application described in the provided file */
 XBT_PUBLIC void MSG_launch_application(const char* file);
+
+#ifndef DOXYGEN
 /** @brief register functions bypassing the parser */
-XBT_PUBLIC void MSG_set_function(const char* host_id, const char* function_name, xbt_dynar_t arguments);
+XBT_ATTRIB_DEPRECATED_v329("This function will be removed. Speak up if you need it.") XBT_PUBLIC
+    void MSG_set_function(const char* host_id, const char* function_name, xbt_dynar_t arguments);
+#endif
 
 /** @brief A clock (in second). */
 XBT_PUBLIC double MSG_get_clock();
@@ -312,7 +316,6 @@ XBT_PUBLIC double MSG_get_clock();
 XBT_PUBLIC unsigned long int MSG_get_sent_msg();
 
 /************************** Process handling *********************************/
-XBT_PUBLIC void MSG_process_userdata_init();
 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);
index 47222d9..29ca335 100644 (file)
@@ -9,13 +9,13 @@
 #include <simgrid/forward.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 XBT_PUBLIC sg_mutex_t sg_mutex_init();
 XBT_PUBLIC void sg_mutex_lock(sg_mutex_t mutex);
 XBT_PUBLIC void sg_mutex_unlock(sg_mutex_t mutex);
 XBT_PUBLIC int sg_mutex_try_lock(sg_mutex_t mutex);
 XBT_PUBLIC void sg_mutex_destroy(sg_mutex_t mutex);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_MUTEX_H_ */
index 70a8392..ba35740 100644 (file)
 #include <simgrid/forward.h>
 #include <xbt/base.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_host_dvfs_plugin_init();
 
 #define MSG_host_dvfs_plugin_init() sg_host_dvfs_plugin_init()
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index 3bf3429..630d327 100644 (file)
@@ -9,7 +9,7 @@
 #include <xbt/base.h>
 #include <simgrid/forward.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_host_energy_plugin_init();
 XBT_PUBLIC void sg_host_energy_update_all();
@@ -34,6 +34,6 @@ XBT_PUBLIC int sg_link_energy_is_inited();
 #define MSG_host_get_power_range_slope_at(host,pstate) sg_host_get_power_range_slope_at((host), (pstate))
 #define MSG_host_get_current_consumption(host) sg_host_get_current_consumption(host)
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index d33ac81..179ab9f 100644 (file)
@@ -22,7 +22,7 @@
 ////////////////
 typedef sg_file_t msg_file_t; // MSG backwards compatibility
 
-SG_BEGIN_DECL()
+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);
@@ -77,7 +77,7 @@ XBT_PUBLIC xbt_dict_t sg_host_get_storage_content(sg_host_t host);
 
 #define MSG_host_get_storage_content(st) sg_host_get_storage_content(st)
 
-SG_END_DECL()
+SG_END_DECL
 
 // C++ interface
 //////////////////
@@ -95,7 +95,7 @@ namespace s4u {
  * mountpoints.
  * For now, you cannot change the mountpoints programmatically, and must declare them from your platform file.
  */
-class XBT_PUBLIC File {
+class XBT_PUBLIC File : public xbt::Extendable<File> {
 public:
   File(const std::string& fullpath, void* userdata);
   File(const std::string& fullpath, sg_host_t host, void* userdata);
@@ -113,9 +113,9 @@ public:
   sg_size_t write(sg_size_t size, int write_inside=0);
 
   /** Allows to store user data on that host */
-  void set_userdata(void* data) { userdata_ = data; }
+  XBT_ATTRIB_DEPRECATED_v329("Please use set_data()") void set_userdata(void* data) { set_data(data); }
   /** Retrieves the previously stored data */
-  void* get_userdata() { return userdata_; }
+  XBT_ATTRIB_DEPRECATED_v329("Please use get_data()") void* get_userdata() { return get_data(); }
 
   sg_size_t size();
   void seek(sg_offset_t pos);             /** Sets the file head to the given position. */
@@ -140,7 +140,6 @@ private:
   std::string path_;
   std::string fullpath_;
   sg_size_t current_position_ = SEEK_SET;
-  void* userdata_             = nullptr;
 };
 
 class XBT_PUBLIC FileSystemDiskExt {
index 085c03b..18e747b 100644 (file)
@@ -9,7 +9,7 @@
 #include <simgrid/forward.h>
 #include <xbt/base.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_vm_live_migration_plugin_init();
 XBT_PRIVATE void sg_vm_dirty_page_tracking_init();
@@ -36,6 +36,6 @@ XBT_PUBLIC sg_vm_t sg_vm_create_migratable(sg_host_t pm, const char* name, int c
 #define MSG_vm_is_migrating(vm) sg_vm_is_migrating(vm)
 #define MSG_vm_migrate(vm, dst_pm) sg_vm_migrate((vm), (dst_pm))
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index 75f3019..8880e9d 100644 (file)
@@ -9,7 +9,7 @@
 #include <simgrid/forward.h>
 #include <xbt/base.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_host_load_plugin_init();
 XBT_PUBLIC double sg_host_get_current_load(sg_host_t host);
@@ -28,6 +28,6 @@ XBT_PUBLIC void sg_host_load_reset(sg_host_t host);
 #define MSG_host_get_computed_flops(host) sg_host_get_computed_flops(host)
 #define MSG_host_get_avg_load(host) sg_host_get_avg_load(host)
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index 57f85be..5f34d0c 100644 (file)
@@ -8,10 +8,10 @@
 #include <simgrid/forward.h>
 #include <xbt/base.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void sg_load_balancer_plugin_init();
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index b846b3c..c7bc18d 100644 (file)
@@ -19,16 +19,6 @@ namespace s4u {
  *
  * This class is the ancestor of every activities that an actor can undertake.
  * That is, activities are all the things that do take time to the actor in the simulated world.
- *
- * They are somewhat linked but not identical to simgrid::kernel::resource::Action,
- * that are stuff occurring on a resource:
- *
- * - A sequential execution activity encompasses 2 actions: one for the exec itself,
- *   and a time-limited sleep used as timeout detector.
- * - A point-to-point communication activity encompasses 3 actions: one for the comm itself
- *   (which spans on all links of the path), and one infinite sleep used as failure detector
- *   on both sender and receiver hosts.
- * - Synchronization activities may possibly be connected to no action.
  */
 class XBT_PUBLIC Activity {
   friend Comm;
@@ -86,8 +76,7 @@ public:
    * It is forbidden to change the amount of work once the Activity is started */
   Activity* set_remaining(double remains);
 
-  /** Put some user data onto the Activity */
-
+  /** Returns the internal implementation of this Activity */
   kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); }
 
 private:
index 0eda16d..ca1183e 100644 (file)
 namespace simgrid {
 namespace s4u {
 
-/**
- *
- * An actor is an independent stream of execution in your distributed application.
+/** \beginrst An actor is an independent stream of execution in your distributed application.
+ * It is located on a (simulated) :cpp:class:`host <simgrid::s4u::Host>`, but can interact
+ * with the whole simulated platform.
  *
  * You can think of an actor as a process in your distributed application, or as a thread in a multithreaded program.
  * This is the only component in SimGrid that actually does something on its own, executing its own code.
  * A resource will not get used if you don't schedule activities on them. This is the code of Actors that create and
- * schedule these activities.
- *
- * An actor is located on a (simulated) host, but it can interact
- * with the whole simulated platform.
- *
- * The s4u::Actor API is strongly inspired from the C++11 threads.
- * The <a href="http://en.cppreference.com/w/cpp/thread">documentation
- * of this standard</a> may help to understand the philosophy of the S4U
- * Actors.
- *
- * @section s4u_actor_def Defining the skeleton of an Actor
- *
- * As in the <a href="http://en.cppreference.com/w/cpp/thread">C++11
- * standard</a>, you can declare the code of your actor either as a
- * pure function or as an object. It is very simple with functions:
- *
- * @code{.cpp}
- * #include <simgrid/s4u/actor.hpp>
- *
- * // Declare the code of your worker
- * void worker() {
- *   printf("Hello s4u");
- *   simgrid::s4u::this_actor::execute(5*1024*1024); // Get the worker executing a task of 5 MFlops
- * };
- *
- * // From your main or from another actor, create your actor on the host Jupiter
- * // The following line actually creates a new actor, even if there is no "new".
- * Actor("Alice", simgrid::s4u::Host::by_name("Jupiter"), worker);
- * @endcode
- *
- * But some people prefer to encapsulate their actors in classes and
- * objects to save the actor state in a cleanly dedicated location.
- * The syntax is slightly more complicated, but not much.
- *
- * @code{.cpp}
- * #include <simgrid/s4u/actor.hpp>
- *
- * // Declare the class representing your actors
- * class Worker {
- * public:
- *   void operator()() { // Two pairs of () because this defines the method called ()
- *     printf("Hello s4u");
- *     simgrid::s4u::this_actor::execute(5*1024*1024); // Get the worker executing a task of 5 MFlops
- *   }
- * };
- *
- * // From your main or from another actor, create your actor. Note the () after Worker
- * Actor("Bob", simgrid::s4u::Host::by_name("Jupiter"), Worker());
- * @endcode
- *
- * @section s4u_actor_flesh Fleshing your actor
- *
- * The body of your actor can use the functions of the
- * simgrid::s4u::this_actor namespace to interact with the world.
- * This namespace contains the methods to start new activities
- * (executions, communications, etc), and to get informations about
- * the currently running thread (its location, etc).
- *
- * Please refer to the @link simgrid::s4u::this_actor full API @endlink.
- *
- *
- * @section s4u_actor_deploy Using a deployment file
- *
- * @warning This is currently not working with S4U. Sorry about that.
- *
- * The best practice is to use an external deployment file as
- * follows, because it makes it easier to test your application in
- * differing settings. Load this file with
- * s4u::Engine::loadDeployment() before the simulation starts.
- * Refer to the @ref deployment section for more information.
+ * schedule these activities. **Please refer to the** :ref:`examples <s4u_ex_actors>` **for more information.**
  *
- * @code{.xml}
- * <?xml version='1.0'?>
- * <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
- * <platform version="4.1">
+ * This API is strongly inspired from the C++11 threads.
+ * The `documentation of this standard <http://en.cppreference.com/w/cpp/thread>`_
+ * may help to understand the philosophy of the SimGrid actors.
  *
- *   <!-- Start an actor called 'master' on the host called 'Tremblay' -->
- *   <actor host="Tremblay" function="master">
- *      <!-- Here come the parameter that you want to feed to this instance of master -->
- *      <argument value="20"/>        <!-- argv[1] -->
- *      <argument value="50000000"/>  <!-- argv[2] -->
- *      <argument value="1000000"/>   <!-- argv[3] -->
- *      <argument value="5"/>         <!-- argv[4] -->
- *   </actor>
- *
- *   <!-- Start an actor called 'worker' on the host called 'Jupiter' -->
- *   <actor host="Jupiter" function="worker"/> <!-- Don't provide any parameter ->>
- *
- * </platform>
- * @endcode
- *
- *  @{
- */
-
-/** @brief Simulation Agent */
+ * \endrst */
 class XBT_PUBLIC Actor : public xbt::Extendable<Actor> {
 #ifndef DOXYGEN
   friend Exec;
@@ -136,7 +48,7 @@ class XBT_PUBLIC Actor : public xbt::Extendable<Actor> {
   explicit Actor(smx_actor_t pimpl) : pimpl_(pimpl) {}
 
 public:
-
+#ifndef DOXYGEN
   // ***** No copy *****
   Actor(Actor const&) = delete;
   Actor& operator=(Actor const&) = delete;
@@ -144,6 +56,8 @@ public:
   // ***** Reference count *****
   friend XBT_PUBLIC void intrusive_ptr_add_ref(Actor * actor);
   friend XBT_PUBLIC void intrusive_ptr_release(Actor * actor);
+#endif
+  /** Retrieve the amount of references on that object. Useful to debug the automatic refcounting */
   int get_refcount();
 
   // ***** Actor creation *****
@@ -160,10 +74,13 @@ public:
   static xbt::signal<void(Actor const&)> on_sleep;
   /** Signal to others that an actor wakes up for a sleep **/
   static xbt::signal<void(Actor const&)> on_wake_up;
-  /** Signal to others that an actor is going to migrated to another host**/
-  static xbt::signal<void(Actor const&)> on_migration_start;
   /** Signal to others that an actor is has been migrated to another host **/
-  static xbt::signal<void(Actor const&)> on_migration_end;
+  static xbt::signal<void(Actor const&, Host const& previous_location)> on_host_change;
+#ifndef DOXYGEN
+  static xbt::signal<void(Actor const&)> on_migration_start; // XBT_ATTRIB_DEPRECATED_v329
+  static xbt::signal<void(Actor const&)> on_migration_end;   // XBT_ATTRIB_DEPRECATED_v329
+#endif
+
   /** Signal indicating that an actor terminated its code.
    *  The actor may continue to exist if it is still referenced in the simulation, but it's not active anymore.
    *  If you want to free extra data when the actor's destructor is called, use Actor::on_destruction.
@@ -175,18 +92,17 @@ public:
    *  If you want to register to the termination of a given actor, use this_actor::on_exit() instead.*/
   static xbt::signal<void(Actor const&)> on_destruction;
 
-  /** Create an actor from a std::function<void()>
-   *
-   *  If the actor is restarted, the actor has a fresh copy of the function.
-   */
+  /** Create an actor from a std::function<void()>.
+   *  If the actor is restarted, it gets a fresh copy of the function. */
   static ActorPtr create(const std::string& name, s4u::Host* host, const std::function<void()>& code);
+  /** Create an actor, but don't start it yet.
+   *
+   * This is usefull to set some properties or extension before actually starting it */
   static ActorPtr init(const std::string& name, s4u::Host* host);
+  /** Start a previously initialized actor */
   ActorPtr start(const std::function<void()>& code);
 
-  /** Create an actor from a std::function
-   *
-   *  If the actor is restarted, the actor has a fresh copy of the function.
-   */
+  /** Create an actor from a callable thing. */
   template <class F> static ActorPtr create(const std::string& name, s4u::Host* host, F code)
   {
     return create(name, host, std::function<void()>(std::move(code)));
@@ -203,7 +119,7 @@ public:
     return create(name, host, std::bind(std::move(code), std::move(args)...));
   }
 
-  // Create actor from function name:
+  /** Create actor from function name and a vector of strings as arguments. */
   static ActorPtr create(const std::string& name, s4u::Host* host, const std::string& function,
                          std::vector<std::string> args);
 
@@ -225,10 +141,10 @@ public:
   /** Retrieves the actor ID of that actor's creator */
   aid_t get_ppid() const;
 
-  /** Suspend an actor, that is blocked until resume()ed by another actor */
+  /** Suspend an actor, that is blocked until resumeed by another actor */
   void suspend();
 
-  /** Resume an actor that was previously suspend()ed */
+  /** Resume an actor that was previously suspended */
   void resume();
 
   /** Returns true if the actor is suspended. */
@@ -264,15 +180,15 @@ public:
    * Asynchronous activities started by the actor are not migrated automatically, so you have
    * to take care of this yourself (only you knows which ones should be migrated).
    */
-  void migrate(Host * new_host);
+  void set_host(Host* new_host);
+#ifndef DOXYGEN
+  XBT_ATTRIB_DEPRECATED_v329("Please use set_host() instead") void migrate(Host* new_host) { set_host(new_host); }
+#endif
 
   /** Ask the actor to die.
    *
    * Any blocking activity will be canceled, and it will be rescheduled to free its memory.
    * Being killed is not something that actors can defer or avoid.
-   *
-   * SimGrid still have sometimes issues when you kill actors that are currently communicating and such.
-   * Still. Please report any bug that you may encounter with a minimal working example.
    */
   void kill();
 
@@ -292,6 +208,7 @@ public:
    * blocked until bob terminates.
    */
   void join(double timeout);
+  /** Kill that actor and restart it from start. */
   Actor* restart();
 
   /** Kill all actors (but the issuer). Being killed is not something that actors can delay or avoid. */
@@ -394,14 +311,13 @@ XBT_PUBLIC void execute(double flop, double priority);
 XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
                                  const std::vector<double>& bytes_amounts);
 
-/** \rst
- * Block the current actor until the built :ref:`parallel execution <API_s4u_parallel_execute>` completes, or until the
- * timeout. \endrst
- */
+/** Block the current actor until the built parallel execution completes, or until the timeout. */
 XBT_PUBLIC void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
                                  const std::vector<double>& bytes_amounts, double timeout);
 
+/** Initialize a sequential execution that must then be started manually */
 XBT_PUBLIC ExecPtr exec_init(double flops_amounts);
+/** Initialize a parallel execution that must then be started manually */
 XBT_PUBLIC ExecPtr exec_init(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
                              const std::vector<double>& bytes_amounts);
 
@@ -450,7 +366,10 @@ XBT_PUBLIC void exit();
 XBT_PUBLIC void on_exit(const std::function<void(bool)>& fun);
 
 /** @brief Migrate the current actor to a new host. */
-XBT_PUBLIC void migrate(Host* new_host);
+XBT_PUBLIC void set_host(Host* new_host);
+#ifndef DOXYGEN
+XBT_ATTRIB_DEPRECATED_v329("Please use set_host() instead") XBT_PUBLIC void migrate(Host* new_host);
+#endif
 
 /** @} */
 }
index 6a2dcb7..db8e05e 100644 (file)
@@ -29,14 +29,17 @@ private:
   std::atomic_int_fast32_t refcount_{0};
 
 public:
+  /** Creates a barrier for the given amount of actors */
   explicit Barrier(unsigned int count);
-  ~Barrier()              = default;
 #ifndef DOXYGEN
+  ~Barrier()              = default;
   Barrier(Barrier const&) = delete;
   Barrier& operator=(Barrier const&) = delete;
 #endif
 
+  /** Creates a barrier for the given amount of actors */
   static BarrierPtr create(unsigned int expected_actors);
+  /** Blocks into the barrier. Every waiting actors will be unlocked once the expected amount of actors reaches the barrier */
   int wait();
 
 #ifndef DOXYGEN
index f11df5c..946a2d5 100644 (file)
@@ -30,11 +30,14 @@ private:
 
 public:
   explicit ConditionVariable(kernel::activity::ConditionVariableImpl* cond) : cond_(cond) {}
+
+#ifndef DOXYGEN
   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);
+#endif
 
   static ConditionVariablePtr create();
 
index ea53d1c..1741d9a 100644 (file)
@@ -36,7 +36,7 @@ public:
   /** Finalize the default engine and all its dependencies */
   static void shutdown();
 
-  /** @brief Run the simulation */
+  /** @brief Run the simulation after initialization */
   void run();
 
   /** @brief Retrieve the simulation time (in seconds) */
@@ -44,23 +44,10 @@ public:
   /** @brief Retrieve the engine singleton */
   static s4u::Engine* get_instance();
 
-  /** @brief Load a platform file describing the environment
-   *
-   * The environment is either a XML file following the simgrid.dtd formalism, or a lua file.
-   * Some examples can be found in the directory examples/platforms.
-   */
   void load_platform(const std::string& platf);
 
-  /** Registers the main function of an actor that will be launched from the deployment file */
   void register_function(const std::string& name, int (*code)(int, char**));
-  /** Registers the main function of an actor that will be launched from the deployment file */
   void register_function(const std::string& name, void (*code)(std::vector<std::string>));
-
-  /** 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/s4u/replay-comms and similar).
-   */
   void register_default(int (*code)(int, char**));
 
   template <class F> void register_actor(const std::string& name)
@@ -80,7 +67,6 @@ public:
     });
   }
 
-  /** @brief Load a deployment file and launch the actors that it contains */
   void load_deployment(const std::string& deploy);
 
 protected:
index d52dc91..a1eb19e 100644 (file)
@@ -11,7 +11,7 @@
 #include <simgrid/forward.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 XBT_PUBLIC sg_sem_t sg_sem_init(int initial_value);
 XBT_PUBLIC void sg_sem_acquire(sg_sem_t sem);
 XBT_PUBLIC int sg_sem_acquire_timeout(sg_sem_t sem, double timeout);
@@ -20,6 +20,6 @@ XBT_PUBLIC int sg_sem_get_capacity(sg_sem_t sem);
 XBT_PUBLIC void sg_sem_destroy(sg_sem_t sem);
 XBT_PUBLIC int sg_sem_would_block(sg_sem_t sem);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_SEMAPHORE_H_ */
index 5031939..4957244 100644 (file)
@@ -15,7 +15,7 @@
 #include <set>
 #endif
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @brief Link opaque datatype
     @ingroup SD_link_api
@@ -195,7 +195,7 @@ XBT_PUBLIC xbt_dynar_t SD_PTG_dotload(const char* filename);
 //SD_route_get_size
 //SD_route_get_list
 //TRACE_sd_set_task_category
-SG_END_DECL()
+SG_END_DECL
 
 #ifdef __cplusplus
 namespace simgrid {
index fa67056..0b4c715 100644 (file)
@@ -46,19 +46,11 @@ typedef enum {
 } e_smx_state_t;
 /** @} */
 
-/* ****************************** Process *********************************** */
-
-typedef enum {
-  SMX_EXIT_SUCCESS = 0,
-  SMX_EXIT_FAILURE = 1
-} smx_process_exit_status_t;
-/** @} */
-
 /******************************* Networking ***********************************/
 extern unsigned smx_context_stack_size;
 extern unsigned smx_context_guard_size;
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC smx_actor_t SIMIX_process_from_PID(aid_t PID);
 
@@ -95,31 +87,36 @@ XBT_ATTRIB_DEPRECATED_v329("Please use simgrid::simix::Timer::get_date()") XBT_P
     double SIMIX_timer_get_date(smx_timer_t timer);
 
 XBT_PUBLIC void SIMIX_display_process_status();
-SG_END_DECL()
+SG_END_DECL
 
 /******************************** Deployment **********************************/
-SG_BEGIN_DECL()
-XBT_PUBLIC void SIMIX_function_register_default(xbt_main_func_t code);
+SG_BEGIN_DECL
+XBT_ATTRIB_DEPRECATED_v329("Please use simgrid_register_default() or Engine::register_default()") XBT_PUBLIC
+    void SIMIX_function_register_default(xbt_main_func_t code);
+XBT_ATTRIB_DEPRECATED_v329("This function will be removed in 3.29") XBT_PUBLIC void SIMIX_init_application();
 
-XBT_PUBLIC void SIMIX_init_application();
 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);
-SG_END_DECL()
+SG_END_DECL
 
 #ifdef __cplusplus
-XBT_PUBLIC void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>));
-XBT_PUBLIC void SIMIX_function_register(const std::string& name, xbt_main_func_t code);
-XBT_PUBLIC void SIMIX_launch_application(const std::string& file);
+XBT_ATTRIB_DEPRECATED_v329("Please use simgrid_register_function() or Engine::register_function()") XBT_PUBLIC
+    void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>));
+XBT_ATTRIB_DEPRECATED_v329("Please use simgrid_register_function() or Engine::register_function()") XBT_PUBLIC
+    void SIMIX_function_register(const std::string& name, xbt_main_func_t code);
+XBT_ATTRIB_DEPRECATED_v329("Please use simgrid_load_deployment() or Engine::load_deployment()") XBT_PUBLIC
+    void SIMIX_launch_application(const std::string& file);
 #endif
 
 /********************************* Process ************************************/
-SG_BEGIN_DECL()
-XBT_PUBLIC int SIMIX_process_count();
+SG_BEGIN_DECL
+XBT_ATTRIB_DEPRECATED_v329("Please use simgrid_get_actor_count()") 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();
-SG_END_DECL()
+XBT_ATTRIB_DEPRECATED_v329("This function will be removed in 3.29") XBT_PUBLIC
+    void SIMIX_process_self_set_data(void* data);
+XBT_ATTRIB_DEPRECATED_v329("This function will be removed in 3.29") XBT_PUBLIC void* SIMIX_process_self_get_data();
+SG_END_DECL
 
 #ifdef __cplusplus
 XBT_PUBLIC void SIMIX_process_on_exit(smx_actor_t process, const std::function<void(bool /*failed*/)>& fun);
@@ -151,16 +148,17 @@ XBT_PUBLIC bool simcall_execution_test(const smx_activity_t& execution);
 #endif
 
 /**************************** Process simcalls ********************************/
-SG_BEGIN_DECL()
-void simcall_process_set_data(smx_actor_t process, void* data);
+SG_BEGIN_DECL
+XBT_ATTRIB_DEPRECATED_v329("This function will be removed in 3.29") void simcall_process_set_data(smx_actor_t process,
+                                                                                                  void* data);
 XBT_ATTRIB_DEPRECATED_v328("Please use Actor::suspend()") XBT_PUBLIC void simcall_process_suspend(smx_actor_t process);
 
 XBT_ATTRIB_DEPRECATED_v328("Please use Actor::join()") 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);
-SG_END_DECL()
+XBT_ATTRIB_DEPRECATED_v329("Please use sg_actor_sleep_for()") XBT_PUBLIC e_smx_state_t
+    simcall_process_sleep(double duration);
+SG_END_DECL
 
 /************************** Communication simcalls ****************************/
 
@@ -204,7 +202,7 @@ XBT_PUBLIC int simcall_comm_testany(simgrid::kernel::activity::CommImpl* comms[]
 #endif
 
 /************************** Synchro simcalls **********************************/
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 XBT_PUBLIC smx_mutex_t simcall_mutex_init();
 XBT_PUBLIC void simcall_mutex_lock(smx_mutex_t mutex);
 XBT_PUBLIC int simcall_mutex_trylock(smx_mutex_t mutex);
@@ -216,15 +214,15 @@ XBT_PUBLIC int simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, dou
 
 XBT_PUBLIC void simcall_sem_acquire(smx_sem_t sem);
 XBT_PUBLIC int simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
-SG_END_DECL()
+SG_END_DECL
 
 /*****************************   Io   **************************************/
 #ifdef __cplusplus
 XBT_PUBLIC e_smx_state_t simcall_io_wait(const smx_activity_t& io);
 #endif
 /************************** MC simcalls   **********************************/
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 XBT_PUBLIC int simcall_mc_random(int min, int max);
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index f82d864..8336287 100644 (file)
@@ -12,7 +12,7 @@
 #include <xbt/base.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+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);
@@ -26,6 +26,6 @@ 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()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_STORAGE_H_ */
index b123867..83f180a 100644 (file)
@@ -12,7 +12,7 @@
 #include <xbt/base.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @brief Opaque type describing a Virtual Machine.
  *  @ingroup msg_VMs
@@ -41,6 +41,6 @@ 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()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_VM_H_ */
index e2772bc..909f9f9 100644 (file)
@@ -13,7 +13,7 @@
 #include <xbt/dict.h>
 
 /* C interface */
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC sg_netzone_t sg_zone_get_root();
 XBT_PUBLIC const char* sg_zone_get_name(sg_netzone_t zone);
@@ -23,6 +23,6 @@ XBT_PUBLIC const char* sg_zone_get_property_value(sg_netzone_t as, const char* n
 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()
+SG_END_DECL
 
 #endif /* INCLUDE_SIMGRID_ZONE_H_ */
index fd92dd6..b9e0f29 100644 (file)
@@ -13,7 +13,6 @@
 namespace simgrid {
 namespace smpi {
 
-class Coll;
 class Colls;
 class Comm;
 class Datatype;
index e7c7d7c..b51f8ee 100644 (file)
@@ -21,7 +21,7 @@
 #define free(ptr) _sampi_free(ptr)
 #endif
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void* _sampi_malloc(size_t size);
 XBT_PUBLIC void* _sampi_calloc(size_t n_elm, size_t elm_size);
@@ -32,6 +32,6 @@ AMPI_CALL(XBT_PUBLIC int, MPI_Iteration_in, (MPI_Comm comm))
 AMPI_CALL(XBT_PUBLIC int, MPI_Iteration_out, (MPI_Comm comm))
 AMPI_CALL(XBT_PUBLIC void, MPI_Migrate, (MPI_Comm comm))
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index 5af6d62..cae3e1f 100644 (file)
@@ -29,7 +29,7 @@
   type _XBT_CONCAT(P, name) args
 #endif
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 #define MPI_THREAD_SINGLE     0
 #define MPI_THREAD_FUNNELED   1
 #define MPI_THREAD_SERIALIZED 2
@@ -298,7 +298,7 @@ XBT_PUBLIC_DATA const MPI_Datatype MPI_INTEGER16;
 XBT_PUBLIC_DATA const MPI_Datatype MPI_COUNT;
 
 //defines for fortran compatibility
-#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
+#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__) || defined(__aarch64__)
 #define MPI_INTEGER MPI_INT
 #define MPI_2INTEGER MPI_2INT
 #define MPI_LOGICAL MPI_INT
@@ -1057,7 +1057,7 @@ XBT_PUBLIC void SMPI_app_instance_register(const char* name, xbt_main_func_t cod
 XBT_PUBLIC void SMPI_init();
 XBT_PUBLIC void SMPI_finalize();
 
-SG_END_DECL()
+SG_END_DECL
 
 /* C++ declarations for shared_malloc */
 #ifdef __cplusplus
index d95d186..c85201f 100644 (file)
@@ -110,9 +110,7 @@ public:
   void set_data(void* data){
     extensions_[0]=data;
   }
-  void* get_data(){
-    return extensions_[0];
-  }
+  void* get_data() const { return extensions_[0]; }
   // Convenience extension access when the type has a associated EXTENSION ID:
   template <class U> U* extension() const { return extension<U>(U::EXTENSION_ID); }
   template<class U> void extension_set(U* p) { extension_set<U>(U::EXTENSION_ID, p); }
index 585b123..29f5625 100644 (file)
@@ -12,7 +12,7 @@
 #include <xbt/log.h>
 #include <xbt/misc.h>
 
-SG_BEGIN_DECL()
+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 void xbt_backtrace_display_current();
@@ -48,5 +48,5 @@ XBT_PUBLIC void xbt_backtrace_display_current();
 #endif
 
 /** @} */
-SG_END_DECL()
+SG_END_DECL
 #endif                          /* XBT_ASSERTS_H */
index 8a78ff0..03339f7 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <xbt/dynar.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 typedef struct xbt_automaton_state {
   char* id;
@@ -114,6 +114,6 @@ 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()
+SG_END_DECL
 
 #endif
index 27b9f8e..ad83cea 100644 (file)
 #include <string>
 #include <vector>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 /** @brief Shows a backtrace of the current location */
 XBT_PUBLIC void xbt_backtrace_display_current();
-SG_END_DECL()
+SG_END_DECL
 
 namespace simgrid {
 namespace xbt {
index 04ab9f3..5dbeb50 100644 (file)
 /* C++ users need love */
 #ifndef SG_BEGIN_DECL
 # ifdef __cplusplus
-#  define SG_BEGIN_DECL() extern "C" {
+#  define SG_BEGIN_DECL extern "C" {
 # else
-#  define SG_BEGIN_DECL()
+#  define SG_BEGIN_DECL
 # endif
 #endif
 
 #ifndef SG_END_DECL
 # ifdef __cplusplus
-#  define SG_END_DECL() }
+#  define SG_END_DECL }
 # else
-#  define SG_END_DECL()
+#  define SG_END_DECL
 # endif
 #endif
 /* End of cruft for C++ */
index c1b7fbc..517909c 100644 (file)
@@ -61,7 +61,7 @@ typedef simgrid::config::Config* xbt_cfg_t;
 typedef void* xbt_cfg_t;
 #endif
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Set the value of the cell @a name in @a cfg with the provided value.*/
 XBT_PUBLIC void sg_cfg_set_int(const char* name, int val);
@@ -99,5 +99,5 @@ XBT_PUBLIC double sg_cfg_get_double(const char* name);
 XBT_PUBLIC int sg_cfg_get_boolean(const char* name);
 /** @} */
 
-SG_END_DECL()
+SG_END_DECL
 #endif /* XBT_CONFIG_H */
index f27f5d3..e36d2b9 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <stdint.h>             /* uintptr_t */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @addtogroup XBT_dict
  *  @brief The dictionary data structure (comparable to hash tables)
@@ -30,10 +30,10 @@ SG_BEGIN_DECL()
  char buff[512];
 
  sprintf(buff,"some very precious data");
- xbt_dict_set(mydict,"my data", strdup(buff), NULL);
+ xbt_dict_set(mydict,"my data", strdup(buff));
 
  sprintf(buff,"another good stuff");
- xbt_dict_set(mydict,"my data", strdup(buff), NULL); // previous data gets erased (and freed) by second add
+ xbt_dict_set(mydict,"my data", strdup(buff)); // previous data gets erased (and freed) by second add
 @endverbatim
  */
 
@@ -69,7 +69,7 @@ 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_set(xbt_dict_t dict, const char* key, void* data);
 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);
@@ -89,7 +89,7 @@ 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_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data);
 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);
@@ -164,6 +164,6 @@ xbt_dict_foreach(head, cursor, key, data) {
 
 /** @} */
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* XBT_DICT_H */
index 7891732..46fa9c8 100644 (file)
@@ -13,7 +13,7 @@
 #include <xbt/base.h> /* SG_BEGIN_DECL */
 #include <xbt/function_types.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @addtogroup XBT_dynar
  * @brief DynArr are dynamically sized vector which may contain any type of variables.
@@ -248,6 +248,6 @@ xbt_dynar_foreach (dyn,cpt,str) {
        (_cursor)++)
 #endif
 /** @} */
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* XBT_DYNAR_H */
index f598781..bb9ff8f 100644 (file)
@@ -21,7 +21,7 @@
  *  exactly play nicely together.
  */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** Helper function used to throw exceptions in C */
 XBT_ATTRIB_NORETURN XBT_PUBLIC void _xbt_throw(char* message, int value, const char* file, int line, const char* func);
@@ -55,7 +55,7 @@ XBT_ATTRIB_NORETURN XBT_PUBLIC void xbt_throw_unimplemented(const char* file, in
  */
 #define DIE_IMPOSSIBLE xbt_die("The Impossible Did Happen (yet again)")
 
-SG_END_DECL()
+SG_END_DECL
 
 /** @} */
 #endif                          /* __XBT_EX_H__ */
index 84b8b3a..3bbef68 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <xbt/base.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 typedef void (*void_f_pvoid_t) (void *);
 typedef void *(*pvoid_f_void_t) (void);
@@ -23,5 +23,5 @@ typedef int (*int_f_cpvoid_cpvoid_t) (const void *, const void *);
 
 typedef int (*xbt_main_func_t) (int argc, char *argv[]);
 
-SG_END_DECL()
+SG_END_DECL
 #endif                          /* XBT_FUNCTION_TYPE_H */
index 98e7661..b60194f 100644 (file)
@@ -9,13 +9,13 @@
 #include <xbt/dynar.h>
 #include <xbt/misc.h> /* SG_BEGIN_DECL */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
-  /** @addtogroup XBT_graph
  *  @brief A graph data type with several interesting algorithms
  *
  * @{
  */
+/** @addtogroup XBT_graph
+ *  @brief A graph data type with several interesting algorithms
+ *
+ * @{
+ */
 
 typedef struct xbt_node *xbt_node_t;
 typedef struct xbt_edge *xbt_edge_t;
@@ -68,6 +68,6 @@ 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()
+SG_END_DECL
 #endif /* XBT_GRAPH_H */
 /** @} */
index 6261dfc..c5415c1 100644 (file)
@@ -33,7 +33,7 @@
 #include <stddef.h> /* NULL */
 #include <stdio.h>  /* FILE */
 #include <xbt/misc.h>
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 /**@brief Log priorities
  * @ingroup XBT_log
  *
@@ -102,7 +102,7 @@ typedef enum {
  * Implementation of XBT_LOG_NEW_SUBCATEGORY, which must declare "extern parent" in addition to avoid an extra
  * declaration of root when XBT_LOG_NEW_SUBCATEGORY is called by XBT_LOG_NEW_CATEGORY */
 #define XBT_LOG_NEW_SUBCATEGORY_helper(catName, parent, desc)                                                          \
-  SG_BEGIN_DECL()                                                                                                      \
+  SG_BEGIN_DECL                                                                                                        \
   extern void _XBT_LOGV_CTOR(catName)(void) XBT_ATTRIB_CONSTRUCTOR(600);                                               \
   void _XBT_LOGV_CTOR(catName)(void)                                                                                   \
   {                                                                                                                    \
@@ -111,7 +111,7 @@ typedef enum {
       _xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized);                                          \
     }                                                                                                                  \
   }                                                                                                                    \
-  SG_END_DECL()                                                                                                        \
+  SG_END_DECL                                                                                                          \
   XBT_EXPORT_NO_IMPORT s_xbt_log_category_t _XBT_LOGV(catName) = {                                                     \
       &_XBT_LOGV(parent),                                                                                              \
       NULL /* firstChild */,                                                                                           \
@@ -492,5 +492,5 @@ extern xbt_log_layout_t xbt_log_default_layout;
  */
 #define XBT_HELP(...) XBT_CINFO(xbt_help, __VA_ARGS__)
 
-SG_END_DECL()
+SG_END_DECL
 #endif                          /* ! _XBT_LOG_H_ */
index 135eb92..4575ee8 100644 (file)
@@ -11,7 +11,7 @@
 #include <xbt/function_types.h>
 #include <xbt/misc.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @addtogroup XBT_mallocator
  *  @brief The mallocator system
@@ -50,5 +50,5 @@ XBT_PUBLIC void xbt_mallocator_release(xbt_mallocator_t mallocator, void* object
 XBT_PUBLIC void xbt_mallocator_initialization_is_done(int protect);
 /** @} */
 
-SG_END_DECL()
+SG_END_DECL
 #endif                          /* _XBT_MALLOCATOR_H */
index 878a7ee..2af7be8 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <stdarg.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** Cache the size of a memory page for the current system. */
 XBT_PUBLIC_DATA int xbt_pagesize;
@@ -39,6 +39,6 @@ XBT_PUBLIC char* bvprintf(const char* fmt, va_list ap);
 XBT_PUBLIC char* bprintf(const char* fmt, ...) XBT_ATTRIB_PRINTF(1, 2);
 /** @} */
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif                          /* XBT_MISC_H */
index b104c88..1ad8aa6 100644 (file)
 
 #include <xbt/misc.h>           /* XBT_PUBLIC */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC void xbt_init(int* argc, char** argv);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* XBT_MODULE_H */
index b98b00e..352d544 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <stdarg.h> /* va_* */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @addtogroup XBT_str
  *  @brief String manipulation functions
@@ -111,5 +111,5 @@ static inline unsigned int xbt_str_hash(const char *str)
 }
 
 /**@}*/
-SG_END_DECL()
+SG_END_DECL
 #endif                          /* XBT_STR_H */
index 5648131..d11e3e3 100644 (file)
@@ -12,7 +12,7 @@
 #include <xbt/function_types.h>
 #include <xbt/misc.h> /* SG_BEGIN_DECL */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @addtogroup XBT_synchro
  *  @brief XBT synchronization tools
@@ -80,5 +80,5 @@ XBT_ATTRIB_DEPRECATED_v328("Please use sg_cond_destroy") XBT_PUBLIC void xbt_con
 
 /** @} */
 
-SG_END_DECL()
+SG_END_DECL
 #endif /* _XBT_THREAD_H */
index f24b717..4f11f0e 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <stdarg.h>             /* va_list */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* They live in asserts.h, but need to be declared before this module.
    double declaration to cut dependency cycle */
@@ -123,7 +123,7 @@ XBT_PUBLIC void xbt_free_f(void* p) XBT_FREE_NOEXCEPT;
 /** @brief should be given a pointer to pointer, and frees the second one */
 XBT_PUBLIC void xbt_free_ref(void* d) XBT_FREE_NOEXCEPT;
 
-SG_END_DECL()
+SG_END_DECL
 
 #define xbt_new(type, count)  ((type*)xbt_malloc (sizeof (type) * (count)))
 /** @brief like calloc, but xbt_die() on error
index 3bd0a75..98cd941 100644 (file)
@@ -13,7 +13,7 @@
 #include <xbt/function_types.h>
 #include <xbt/misc.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 XBT_PUBLIC const char* xbt_procname(void);
 
@@ -25,5 +25,5 @@ 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;
 
-SG_END_DECL()
+SG_END_DECL
 #endif /* XBT_VIRTU_H */
index 730a364..77b27e1 100644 (file)
@@ -11,7 +11,7 @@
 #include <xbt/misc.h>           /* XBT_PUBLIC */
 #include <stddef.h>             /* size_t */
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** @brief get time in seconds
  *
@@ -39,6 +39,6 @@ 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()
+SG_END_DECL
 
 #endif
index 5ea8aa1..ee9764b 100644 (file)
@@ -181,6 +181,6 @@ sonar.java.binaries=CMakeFiles/simgrid-java_jar.dir,examples/deprecated/java
 #sonar.java.binaries
 #sonar.cfamily.build-wrapper-output
 #sonar.cfamily.gcov.reportsPath
-#sonar.python.coverage.reportPath
+#sonar.python.coverage.reportPaths
 #sonar.coverage.jacoco.xmlReportPaths
 #sonar.cfamily.threads
index ebe9597..66231b3 100644 (file)
@@ -238,7 +238,7 @@ Java_org_simgrid_msg_Msg_deployApplication(JNIEnv * env, jclass cls, jstring jde
 {
   const char *deploymentFile = env->GetStringUTFChars(jdeploymentFile, 0);
 
-  SIMIX_function_register_default(java_main);
+  simgrid_register_default(java_main);
   MSG_launch_application(deploymentFile);
 }
 
index 6150c2c..e38f067 100644 (file)
@@ -11,7 +11,7 @@
 #include "simgrid/msg.h"
 #include <jni.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
 #ifndef JNIEXPORT
@@ -35,5 +35,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, job
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitAll(JNIEnv *env, jclass cls, jobjectArray jcomms, jdouble timeout);
 JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls, jobjectArray jcomms);
 
-SG_END_DECL()
+SG_END_DECL
 #endif
index 1da1742..6c145fb 100644 (file)
@@ -12,7 +12,7 @@
 #include "simgrid/plugins/file_system.h"
 #include <jni.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
 #ifndef JNIEXPORT
@@ -35,5 +35,5 @@ JNIEXPORT jlong JNICALL Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfi
 JNIEXPORT void JNICALL Java_org_simgrid_msg_File_seek(JNIEnv *env, jobject jfile, jlong joffset, jlong jorigin);
 JNIEXPORT void JNICALL Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfile);
 
-SG_END_DECL()
+SG_END_DECL
 #endif
index 9097244..08a48d5 100644 (file)
@@ -12,7 +12,7 @@
 #include "simgrid/plugins/file_system.h"
 #include <jni.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
 #ifndef JNIEXPORT
@@ -73,5 +73,5 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getLoad(JNIEnv* env, jobject
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentLoad(JNIEnv *env, jobject jhost);
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getAvgLoad(JNIEnv *env, jobject jhost);
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getComputedFlops (JNIEnv *env, jobject jhost);
-SG_END_DECL()
+SG_END_DECL
 #endif
index 5d57308..cb71bba 100644 (file)
@@ -282,7 +282,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobjec
   }
 
   /* change the host of the process */
-  process->migrate(host);
+  process->set_host(host);
 
   /* change the host java side */
   env->SetObjectField(jprocess, jprocess_field_Process_host, jhost);
index 620754f..06b38dc 100644 (file)
@@ -11,7 +11,7 @@
 #include "simgrid/msg.h"
 #include <jni.h>
 
-SG_BEGIN_DECL();
+SG_BEGIN_DECL;
 
 /* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
 #ifndef JNIEXPORT
@@ -66,5 +66,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_yield(JNIEnv* env, jclass cl
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_setKillTime(JNIEnv* env, jobject jprocess, jdouble jkilltime);
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Process_getCount(JNIEnv * env, jclass cls);
 
-SG_END_DECL();
+SG_END_DECL;
 #endif
index 4c76b0c..77e2d14 100644 (file)
@@ -11,7 +11,7 @@
 #include "simgrid/msg.h"
 #include <jni.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** Returns a new java instance of a storage. */
 jobject jstorage_new_instance(JNIEnv * env);
@@ -43,5 +43,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_setProperty(JNIEnv* env, job
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage);
 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv *env, jclass cls);
 
-SG_END_DECL()
+SG_END_DECL
 #endif
index a5172a1..26d7c33 100644 (file)
@@ -11,7 +11,7 @@
 #include "xbt/base.h"
 #include <jni.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_nativeInit(JNIEnv *env, jclass cls);
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Mutex_init(JNIEnv * env, jobject obj);
@@ -25,5 +25,5 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_release(JNIEnv * env, jobj
 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Semaphore_wouldBlock(JNIEnv * env, jobject obj);
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Semaphore_nativeFinalize(JNIEnv * env, jobject obj);
 
-SG_END_DECL()
+SG_END_DECL
 #endif
index b4f877b..787384f 100644 (file)
@@ -11,7 +11,7 @@
 #include <jni.h>
 #include "simgrid/msg.h"
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /** Binds a native instance to a java instance. */
 void jtask_bind(jobject jtask, msg_task_t task, JNIEnv * env);
@@ -60,5 +60,5 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Task_listen(JNIEnv* env, jclass
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFromHost(JNIEnv* env, jclass cls, jstring jalias, jobject jhost);
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Task_listenFrom(JNIEnv* env, jclass cls, jstring jalias);
 
-SG_END_DECL()
+SG_END_DECL
 #endif
index 90a3b37..ec16719 100644 (file)
@@ -11,7 +11,7 @@
 #include <jni.h>
 #include "simgrid/msg.h"
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
 #ifndef JNIEXPORT
@@ -48,6 +48,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_resume(JNIEnv* env, jobject jvm);
 JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_shutdown(JNIEnv* env, jobject jvm);
 JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_destroy(JNIEnv* env, jobject jvm);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index 35d9c7b..d30e299 100644 (file)
@@ -17,9 +17,6 @@
 #endif
 /* end of eclipse-mandated pimple */
 
-// Define a new category
-XBT_LOG_NEW_DEFAULT_CATEGORY (jtrace, "TRACE for Java(TM)");
-
 JNIEXPORT void JNICALL Java_org_simgrid_trace_Trace_hostStateDeclare(JNIEnv * env, jclass cls, jstring js)
 {
   const char *s = env->GetStringUTFChars(js, 0);
index c9e1523..a633422 100644 (file)
@@ -9,8 +9,6 @@
 #include "simgrid/s4u/Host.hpp"
 #include <lauxlib.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(lua_host, "Lua Host module");
-
 constexpr char HOST_MODULE_NAME[] = "simgrid.host";
 constexpr char HOST_FIELDNAME[]   = "__simgrid_host";
 
index 404887f..2316b7b 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <lauxlib.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(lua_platf, "Lua bindings (platform module)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_platf, lua, "Lua bindings (platform module)");
 
 constexpr char PLATF_MODULE_NAME[] = "simgrid.engine";
 constexpr char AS_FIELDNAME[]      = "__simgrid_as";
index 4b70a2d..2cc272a 100644 (file)
@@ -83,8 +83,9 @@ PYBIND11_MODULE(simgrid, m)
          py::arg("flops"), py::arg("priority") = 1);
   m2.def("exec_init", [](double flops){return simgrid::s4u::this_actor::exec_init(flops);});
   m2.def("get_host", &simgrid::s4u::this_actor::get_host, "Retrieves host on which the current actor is located");
-  m2.def("migrate", &simgrid::s4u::this_actor::migrate, "Moves the current actor to another host, see :cpp:func:`void simgrid::s4u::this_actor::migrate()`",
-      py::arg("dest"));
+  m2.def("set_host", &simgrid::s4u::this_actor::set_host,
+         "Moves the current actor to another host, see :cpp:func:`void simgrid::s4u::this_actor::set_host()`",
+         py::arg("dest"));
   m2.def("sleep_for", sleep_for_fun,
       "Block the actor sleeping for that amount of seconds, see :cpp:func:`void simgrid::s4u::this_actor::sleep_for`", py::arg("duration"));
   m2.def("sleep_until", sleep_until_fun,
@@ -250,20 +251,24 @@ PYBIND11_MODULE(simgrid, m)
                }
              });
            },
-           "Create an actor from a function or an object, see :cpp:func:`simgrid::s4u::Actor::create()`")
-      .def_property("host", &Actor::get_host, &Actor::migrate, "The host on which this actor is located")
+           "Create an actor from a function or an object.")
+      .def_property("host", &Actor::get_host, &Actor::set_host, "The host on which this actor is located")
+      .def_property_readonly("name", &Actor::get_cname, "The name of this actor.")
       .def_property_readonly("pid", &Actor::get_pid, "The PID (unique identifier) of this actor.")
+      .def_property_readonly("ppid", &Actor::get_ppid,
+                             "The PID (unique identifier) of the actor that created this one.")
       .def("by_pid", &Actor::by_pid, "Retrieve an actor by its PID")
       .def("daemonize", &Actor::daemonize,
-           "This actor will be automatically terminated when the last non-daemon actor finishes, see :cpp:func:`void "
-           "simgrid::s4u::Actor::daemonize()`")
+           "This actor will be automatically terminated when the last non-daemon actor finishes (more info in the C++ "
+           "documentation).")
+      .def("is_daemon", &Actor::is_daemon,
+           "Returns True if that actor is a daemon and will be terminated automatically when the last non-daemon actor "
+           "terminates.")
       .def("join", py::overload_cast<double>(&Actor::join),
-           "Wait for the actor to finish, see :cpp:func:`void simgrid::s4u::Actor::join(double)`", py::arg("timeout"))
+           "Wait for the actor to finish (more info in the C++ documentation).", py::arg("timeout"))
       .def("kill", [](ActorPtr act) { act->kill(); }, "Kill that actor")
       .def("kill_all", &Actor::kill_all, "Kill all actors but the caller.")
-      .def("migrate", &Actor::migrate,
-           "Moves that actor to another host, see :cpp:func:`void simgrid::s4u::Actor::migrate()`", py::arg("dest"))
-      .def("self", &Actor::self, "Retrieves the current actor, see :cpp:func:`void simgrid::s4u::Actor::self()`")
+      .def("self", &Actor::self, "Retrieves the current actor.")
       .def("is_suspended", &Actor::is_suspended, "Returns True if that actor is currently suspended.")
       .def("suspend", &Actor::suspend, "Suspend that actor, that is blocked until resume()ed by another actor.")
       .def("resume", &Actor::resume, "Resume that actor, that was previously suspend()ed.");
index 9371068..5a7e2da 100644 (file)
@@ -13,7 +13,7 @@
 #include <ucontext.h>
 #endif
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 struct s_stack_region{
   void *address;
@@ -25,6 +25,6 @@ struct s_stack_region{
 };
 typedef struct s_stack_region  s_stack_region_t;
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index b502542..c662db5 100644 (file)
@@ -22,7 +22,7 @@
 
 #define STD_HEAP_SIZE   (sizeof(void*)<=4 ? (100*1024*1024) : (1ll*1024*1024*1024*1024))
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /********************************* Global *************************************/
 XBT_ATTRIB_NORETURN XBT_PUBLIC void MC_run();
@@ -33,6 +33,6 @@ XBT_PRIVATE void MC_automaton_load(const char *file);
 /********************************* Memory *************************************/
 XBT_PUBLIC void MC_memory_init(); /* Initialize the memory subsystem */
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index c301f41..a3b5295 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <xbt/base.h>
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 #ifdef COVERAGE
 extern void __gcov_flush();
@@ -17,6 +17,6 @@ extern void __gcov_flush();
 #define coverage_checkpoint() (void)0
 #endif
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index f71e3b4..8e879e3 100644 (file)
@@ -17,7 +17,7 @@
 #include "xbt/dict.h"
 #include "xbt/dynar.h"
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Datatype representing a separate heap. The whole point of the mmalloc module is to allow several such heaps in the
  * process. It thus works by redefining all the classical memory management functions (malloc and friends) with an
@@ -55,6 +55,6 @@ XBT_PUBLIC void* xbt_mheap_destroy(xbt_mheap_t md);
 xbt_mheap_t mmalloc_get_current_heap(void);
 
 #endif
-SG_END_DECL()
+SG_END_DECL
 
 #endif /* SIMGRID_MMALLOC_H */
index f72c308..f0dd78a 100644 (file)
@@ -312,26 +312,21 @@ static void instr_actor_on_creation(simgrid::s4u::Actor const& actor)
   });
 }
 
-static long long int counter = 0;
-
-static void instr_actor_on_migration_start(simgrid::s4u::Actor const& actor)
+static void instr_actor_on_host_change(simgrid::s4u::Actor const& actor,
+                                       simgrid::s4u::Host const& /*previous_location*/)
 {
-  // start link
+  static long long int counter = 0;
   container_t container = simgrid::instr::Container::by_name(instr_pid(actor));
-  simgrid::instr::Container::get_root()->get_link("ACTOR_LINK")->start_event(container, "M", std::to_string(counter));
+  simgrid::instr::LinkType* link = simgrid::instr::Container::get_root()->get_link("ACTOR_LINK");
 
+  // start link
+  link->start_event(container, "M", std::to_string(counter));
   // destroy existing container of this process
   container->remove_from_parent();
-}
-
-static void instr_actor_on_migration_end(simgrid::s4u::Actor const& actor)
-{
   // create new container on the new_host location
   simgrid::instr::Container::by_name(actor.get_host()->get_name())->create_child(instr_pid(actor), "ACTOR");
   // end link
-  simgrid::instr::Container::get_root()
-      ->get_link("ACTOR_LINK")
-      ->end_event(simgrid::instr::Container::by_name(instr_pid(actor)), "M", std::to_string(counter));
+  link->end_event(simgrid::instr::Container::by_name(instr_pid(actor)), "M", std::to_string(counter));
   counter++;
 }
 
@@ -403,8 +398,7 @@ void instr_define_callbacks()
     simgrid::s4u::Comm::on_completion.connect([](simgrid::s4u::Actor const& actor) {
       simgrid::instr::Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->pop_event();
     });
-    simgrid::s4u::Actor::on_migration_start.connect(instr_actor_on_migration_start);
-    simgrid::s4u::Actor::on_migration_end.connect(instr_actor_on_migration_end);
+    simgrid::s4u::Actor::on_host_change.connect(instr_actor_on_host_change);
   }
 
   if (TRACE_vm_is_enabled()) {
index 4d98ab4..d22046d 100644 (file)
@@ -4,12 +4,17 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/kernel/EngineImpl.hpp"
+#include "simgrid/Exception.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/kernel/resource/DiskImpl.hpp"
+#include "src/simix/smx_private.hpp"
 #include "src/surf/StorageImpl.hpp"
 #include "src/surf/network_interface.hpp"
+#include "src/surf/xml/platf_private.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
+
+extern int surf_parse_lineno;
 
 namespace simgrid {
 namespace kernel {
@@ -29,11 +34,42 @@ EngineImpl::~EngineImpl()
 
   for (auto const& kv : storages_)
     if (kv.second)
-      kv.second->get_impl()->destroy();
+      kv.second->destroy();
 
   for (auto const& kv : links_)
     if (kv.second)
-      kv.second->get_impl()->destroy();
+      kv.second->destroy();
+}
+
+void EngineImpl::load_deployment(const std::string& file)
+{
+  sg_platf_exit();
+  sg_platf_init();
+
+  surf_parse_open(file);
+  surf_parse();
+  surf_parse_close();
+}
+void EngineImpl::register_function(const std::string& name, xbt_main_func_t code)
+{
+  simix_global->registered_functions[name] = [code](std::vector<std::string> args) {
+    return simgrid::xbt::wrap_main(code, std::move(args));
+  };
 }
+
+void EngineImpl::register_function(const std::string& name, void (*code)(std::vector<std::string>))
+{
+  simix_global->registered_functions[name] = [code](std::vector<std::string> args) {
+    return std::bind(std::move(code), std::move(args));
+  };
 }
+
+void EngineImpl::register_default(xbt_main_func_t code)
+{
+  simix_global->default_function = [code](std::vector<std::string> args) {
+    return simgrid::xbt::wrap_main(code, std::move(args));
+  };
 }
+
+} // namespace kernel
+} // namespace simgrid
index f824149..c45e02f 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/s4u/NetZone.hpp>
-
 #include <map>
+#include <simgrid/s4u/NetZone.hpp>
+#include <simgrid/simix.hpp>
 #include <string>
 #include <unordered_map>
 
@@ -14,8 +14,8 @@ namespace kernel {
 
 class EngineImpl {
   std::map<std::string, s4u::Host*> hosts_;
-  std::map<std::string, s4u::Link*> links_;
-  std::map<std::string, s4u::Storage*> storages_;
+  std::map<std::string, resource::LinkImpl*> links_;
+  std::map<std::string, resource::StorageImpl*> storages_;
   std::unordered_map<std::string, routing::NetPoint*> netpoints_;
   friend s4u::Engine;
 
@@ -25,6 +25,12 @@ public:
   EngineImpl(const EngineImpl&) = delete;
   EngineImpl& operator=(const EngineImpl&) = delete;
   virtual ~EngineImpl();
+
+  void load_deployment(const std::string& file);
+  void register_function(const std::string& name, xbt_main_func_t code);
+  void register_function(const std::string& name, void (*code)(std::vector<std::string>));
+  void register_default(xbt_main_func_t code);
+
   routing::NetZoneImpl* netzone_root_ = nullptr;
 };
 
index 5efb83c..027ef16 100644 (file)
@@ -8,7 +8,7 @@
 #include "src/kernel/activity/MutexImpl.hpp"
 #include "src/kernel/activity/SynchroRaw.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ConditionVariable, simix_synchro, "Condition variables");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_condition, simix_synchro, "Condition variables");
 
 /********************************* Condition **********************************/
 
index 8ac6401..6cea03b 100644 (file)
@@ -98,7 +98,7 @@ ActorImplPtr ActorImpl::attach(const std::string& name, void* data, s4u::Host* h
     actor->set_properties(*properties);
 
   /* Add the process to it's host process list */
-  host->pimpl_->process_list_.push_back(*actor);
+  host->pimpl_->add_actor(actor);
 
   /* Now insert it in the global process list and in the process to run list */
   simix_global->process_list[actor->get_pid()] = actor;
@@ -171,8 +171,8 @@ void ActorImpl::cleanup()
   simix_global->mutex.lock();
 
   simix_global->process_list.erase(pid_);
-  if (host_ && host_process_list_hook.is_linked())
-    simgrid::xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
+  if (host_ && host_actor_list_hook.is_linked())
+    host_->pimpl_->remove_actor(this);
   if (not smx_destroy_list_hook.is_linked()) {
 #if SIMGRID_HAVE_MC
     xbt_dynar_push_as(simix_global->dead_actors_vector, ActorImpl*, this);
@@ -222,6 +222,7 @@ void ActorImpl::exit()
 
 void ActorImpl::kill(ActorImpl* actor)
 {
+  xbt_assert(actor != simix_global->maestro_process, "Killing maestro is a rather bad idea");
   if (actor->finished_) {
     XBT_DEBUG("Ignoring request to kill actor %s@%s that is already dead", actor->get_cname(),
               actor->host_->get_cname());
@@ -276,7 +277,6 @@ void ActorImpl::yield()
 
   if (context_->iwannadie) {
     XBT_DEBUG("Actor %s@%s is dead", get_cname(), host_->get_cname());
-    // throw simgrid::kernel::context::ForcefulKillException(); Does not seem to properly kill the actor
     context_->stop();
     THROW_IMPOSSIBLE;
   }
@@ -443,9 +443,9 @@ void ActorImpl::simcall_answer()
 
 void ActorImpl::set_host(s4u::Host* dest)
 {
-  xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
+  host_->pimpl_->remove_actor(this);
   host_ = dest;
-  dest->pimpl_->process_list_.push_back(*this);
+  dest->pimpl_->add_actor(this);
 }
 
 ActorImplPtr ActorImpl::init(const std::string& name, s4u::Host* host)
@@ -477,7 +477,7 @@ ActorImpl* ActorImpl::start(const simix::ActorCode& code)
   XBT_DEBUG("Start context '%s'", get_cname());
 
   /* Add the actor to its host's actor list */
-  host_->pimpl_->process_list_.push_back(*this);
+  host_->pimpl_->add_actor(this);
   simix_global->process_list[pid_] = this;
 
   /* Now insert it in the global actor list and in the actor to run list */
@@ -529,11 +529,12 @@ void create_maestro(const std::function<void()>& code)
 } // namespace kernel
 } // namespace simgrid
 
-int SIMIX_process_count()
+int SIMIX_process_count() // XBT_ATTRIB_DEPRECATED_v329
 {
   return simix_global->process_list.size();
 }
 
+// XBT_DEPRECATED_v329
 void* SIMIX_process_self_get_data()
 {
   smx_actor_t self = SIMIX_process_self();
@@ -544,6 +545,7 @@ void* SIMIX_process_self_get_data()
   return self->get_user_data();
 }
 
+// XBT_DEPRECATED_v329
 void SIMIX_process_self_set_data(void* data)
 {
   SIMIX_process_self()->set_user_data(data);
@@ -553,12 +555,7 @@ void SIMIX_process_self_set_data(void* data)
    by exceptions and logging events */
 const char* SIMIX_process_self_get_name()
 {
-
-  smx_actor_t process = SIMIX_process_self();
-  if (process == nullptr || process == simix_global->maestro_process)
-    return "maestro";
-
-  return process->get_cname();
+  return SIMIX_is_maestro() ? "maestro" : SIMIX_process_self()->get_cname();
 }
 
 /**
index ee082de..423debc 100644 (file)
@@ -21,6 +21,7 @@ namespace actor {
 
 class XBT_PUBLIC ActorImpl : public surf::PropertyHolder {
   s4u::Host* host_   = nullptr; /* the host on which the actor is running */
+  // XBT_DEPRECATED_v329
   void* userdata_    = nullptr; /* kept for compatibility, it should be replaced with moddata */
   aid_t pid_         = 0;
   aid_t ppid_        = -1;
@@ -36,7 +37,7 @@ public:
 
   double get_kill_time();
   void set_kill_time(double kill_time);
-  boost::intrusive::list_member_hook<> host_process_list_hook; /* simgrid::simix::Host::process_list */
+  boost::intrusive::list_member_hook<> host_actor_list_hook;   /* simgrid::simix::Host::process_list */
   boost::intrusive::list_member_hook<> smx_destroy_list_hook;  /* simix_global->actors_to_destroy */
   boost::intrusive::list_member_hook<> smx_synchro_hook;       /* {mutex,cond,sem}->sleeping */
 
@@ -46,7 +47,9 @@ public:
   // Accessors to private fields
   s4u::Host* get_host() { return host_; }
   void set_host(s4u::Host* dest);
+  // XBT_DEPRECATED_v329
   void* get_user_data() { return userdata_; }
+  // XBT_DEPRECATED_v329
   void set_user_data(void* data) { userdata_ = data; }
   aid_t get_pid() const { return pid_; }
   aid_t get_ppid() const { return ppid_; }
index 80ae7a6..c25b0a2 100644 (file)
@@ -50,6 +50,7 @@ public:
 class DiskImpl : public Resource, public surf::PropertyHolder {
   bool currently_destroying_ = false;
   s4u::Host* host_           = nullptr;
+  s4u::Disk piface_;
 
 public:
   DiskImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double read_bw, double bwrite_bw);
@@ -59,7 +60,6 @@ public:
   ~DiskImpl() override;
 
   /** @brief Public interface */
-  s4u::Disk piface_;
   s4u::Disk* get_iface() { return &piface_; }
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool is_used() override;
index c277462..0c30abf 100644 (file)
@@ -363,51 +363,51 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   std::vector<std::string> parameters;
   std::vector<std::string> tmp;
   boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";"));
-  const std::string error_msg {"Fat trees are defined by the levels number and 3 vectors, see the documentation for more information"};
 
   // TODO : we have to check for zeros and negative numbers, or it might crash
-  if (parameters.size() != 4) {
-    surf_parse_error(error_msg);
-  }
+  surf_parse_assert(
+      parameters.size() == 4,
+      "Fat trees are defined by the levels number and 3 vectors, see the documentation for more information.");
 
   // The first parts of topo_parameters should be the levels number
   try {
     this->levels_ = std::stoi(parameters[0]);
   } catch (const std::invalid_argument&) {
-    throw std::invalid_argument(std::string("First parameter is not the amount of levels:") + parameters[0]);
+    surf_parse_error(std::string("First parameter is not the amount of levels: ") + parameters[0]);
   }
 
   // Then, a l-sized vector standing for the children number by level
   boost::split(tmp, parameters[1], boost::is_any_of(","));
-  if (tmp.size() != this->levels_) {
-    surf_parse_error(error_msg);
-  }
+  surf_parse_assert(tmp.size() == this->levels_, std::string("You specified ") + std::to_string(this->levels_) +
+                                                     " levels but the child count vector (the first one) contains " +
+                                                     std::to_string(tmp.size()) + " levels.");
+
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
       this->num_children_per_node_.push_back(std::stoi(tmp[i]));
     } catch (const std::invalid_argument&) {
-      throw std::invalid_argument(std::string("Invalid lower level node number:") + tmp[i]);
+      surf_parse_error(std::string("Invalid child count: ") + tmp[i]);
     }
   }
 
   // Then, a l-sized vector standing for the parents number by level
   boost::split(tmp, parameters[2], boost::is_any_of(","));
-  if (tmp.size() != this->levels_) {
-    surf_parse_error(error_msg);
-  }
+  surf_parse_assert(tmp.size() == this->levels_, std::string("You specified ") + std::to_string(this->levels_) +
+                                                     " levels but the parent count vector (the second one) contains " +
+                                                     std::to_string(tmp.size()) + " levels.");
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
       this->num_parents_per_node_.push_back(std::stoi(tmp[i]));
     } catch (const std::invalid_argument&) {
-      throw std::invalid_argument(std::string("Invalid upper level node number:") + tmp[i]);
+      surf_parse_error(std::string("Invalid parent count: ") + tmp[i]);
     }
   }
 
   // Finally, a l-sized vector standing for the ports number with the lower level
   boost::split(tmp, parameters[3], boost::is_any_of(","));
-  if (tmp.size() != this->levels_) {
-    surf_parse_error(error_msg);
-  }
+  surf_parse_assert(tmp.size() == this->levels_, std::string("You specified ") + std::to_string(this->levels_) +
+                                                     " levels but the port count vector (the third one) contains " +
+                                                     std::to_string(tmp.size()) + " levels.");
   for (size_t i = 0; i < tmp.size(); i++) {
     try {
       this->num_port_lower_level_.push_back(std::stoi(tmp[i]));
index 010cbfe..6e91f11 100644 (file)
@@ -14,8 +14,6 @@
 #include <memory>
 #include <unistd.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc");
-
 static inline
 char** argvdup(int argc, char** argv)
 {
index d2c13d6..ac87f79 100644 (file)
@@ -18,9 +18,6 @@
  *  communicate with the MC (declared in modelchecker.h).
  */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client_api, mc,
-  "Public API for the model-checked application");
-
 // MC_random() is in mc_base.cpp
 
 void MC_assert(int prop)
index 8e4b405..7700754 100644 (file)
@@ -10,9 +10,6 @@
 
 using simgrid::mc::remote;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_pattern, mc,
-                                "Logging specific to MC communication patterns");
-
 static void MC_patterns_copy(std::vector<simgrid::mc::PatternCommunication*>& dest,
                              std::vector<simgrid::mc::PatternCommunication> const& source)
 {
index 2ba61a4..e6b4fb4 100644 (file)
@@ -11,8 +11,6 @@
 
 #include <climits>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_config, mc, "Configuration of the Model Checker");
-
 #if SIMGRID_HAVE_MC
 namespace simgrid {
 namespace mc {
index 15015f0..ff6bbb2 100644 (file)
@@ -7,15 +7,10 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "xbt/log.h"
-
 #include "mc/mc.h"
 #include "src/mc/mc_private.hpp"
 #include "src/xbt/mmalloc/mmprivate.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc,
-                                "Logging specific to MC (memory)");
-
 /* Initialize the model-checker memory subsystem */
 /* It creates the two heap regions: std_heap and mc_heap */
 void MC_memory_init()
index 535dae9..b811c1d 100644 (file)
@@ -13,8 +13,6 @@
 
 using simgrid::mc::remote;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc, "Logging specific to MC (state)");
-
 namespace simgrid {
 namespace mc {
 
index 3f65ed5..72840d0 100644 (file)
@@ -407,14 +407,9 @@ std::string RemoteClient::read_string(RemotePtr<char> address) const
 
   while (1) {
     ssize_t c = pread(this->memory_file, res.data() + off, res.size() - off, (off_t)address.address() + off);
-    if (c == -1) {
-      if (errno == EINTR)
-        continue;
-      else
-        xbt_die("Could not read from from remote process");
-    }
-    if (c == 0)
-      xbt_die("Could not read string from remote process");
+    if (c == -1 && errno == EINTR)
+      continue;
+    xbt_assert(c > 0, "Could not read string from remote process");
 
     void* p = memchr(res.data() + off, '\0', c);
     if (p)
index fd79b48..3bf8823 100644 (file)
@@ -10,7 +10,7 @@
 #include "simgrid/forward.h"
 #include "stdint.h"
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 // ***** Environment variables for passing context to the model-checked process
 
@@ -109,6 +109,6 @@ struct s_mc_message_actor_enabled_t {
 
 XBT_PRIVATE const char* MC_message_type_name(enum e_mc_message_type type);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index e99c188..e11d653 100644 (file)
@@ -21,8 +21,6 @@
 #include <cstring> // memcpy, memcmp
 #include <unistd.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_page_snapshot, mc, "Logging specific to mc_page_snapshot");
-
 namespace simgrid {
 namespace mc {
 
index 8c27e7c..3208437 100644 (file)
@@ -16,8 +16,6 @@
 #define MAP_POPULATE MAP_PREFAULT_READ
 #endif
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_RegionSnaphot, mc, "Logging specific to region snapshots");
-
 namespace simgrid {
 namespace mc {
 
index c386327..463619d 100644 (file)
@@ -13,8 +13,6 @@
 #include "src/instr/instr_private.hpp"
 #include "src/msg/msg_private.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_comm, msg, "Logging specific to MSG (comm)");
-
 namespace simgrid {
 namespace msg {
 
index e061e0c..9608ac7 100644 (file)
 #include <xbt/config.hpp>
 
 XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
 
 bool MSG_Global_t::debug_multiple_use = false;
 
 MSG_Global_t* msg_global = nullptr;
-simgrid::xbt::Extension<simgrid::s4u::Actor, simgrid::msg::ActorUserData> simgrid::msg::ActorUserData::EXTENSION_ID;
 
 static void MSG_exit();
 
@@ -43,7 +41,12 @@ void MSG_init_nocheck(int *argc, char **argv) {
     msg_global->sent_msg = 0;
     msg_global->task_copy_callback = nullptr;
     msg_global->process_data_cleanup = nullptr;
-    MSG_process_userdata_init();
+    simgrid::s4u::Actor::on_termination.connect([](simgrid::s4u::Actor const& actor) {
+      // free the data if a function was provided
+      void* userdata = sg_actor_data(&actor);
+      if (userdata && msg_global->process_data_cleanup)
+        msg_global->process_data_cleanup(userdata);
+    });
   }
 
   if(MC_is_active()){
index 344a8f9..124b077 100644 (file)
@@ -102,7 +102,7 @@ void MSG_process_daemonize(sg_actor_t actor)
 }
 void MSG_process_migrate(sg_actor_t actor, sg_host_t host)
 {
-  sg_actor_migrate(actor, host);
+  sg_actor_set_host(actor, host);
 }
 void MSG_process_join(sg_actor_t actor, double timeout)
 {
@@ -135,6 +135,30 @@ msg_error_t MSG_process_sleep(double duration)
   }
 }
 
+/** @brief Returns the user data of a process.
+ *
+ * This function checks whether @a process is a valid pointer and returns the user data associated to this process.
+ */
+void* MSG_process_get_data(msg_process_t process)
+{
+  xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
+
+  /* get from SIMIX the MSG process data, and then the user data */
+  return sg_actor_data(process);
+}
+
+/** @brief Sets the user data of a process.
+ *
+ * This function checks whether @a process is a valid pointer and sets the user data associated to this process.
+ */
+msg_error_t MSG_process_set_data(msg_process_t process, void* data)
+{
+  xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
+  sg_actor_data_set(process, data);
+
+  return MSG_OK;
+}
+
 msg_process_t MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties)
 {
   return sg_actor_attach(name, data, host, properties);
@@ -182,7 +206,11 @@ void MSG_process_unref(msg_process_t process)
 {
   sg_actor_unref(process);
 }
-
+/** @brief Return the current number MSG processes. */
+int MSG_process_get_number()
+{
+  return simgrid_get_actor_count();
+}
 /* ************************** NetZones *************************** */
 sg_netzone_t MSG_zone_get_root()
 {
index 35c3ee5..505c892 100644 (file)
 #include "simgrid/msg.h"
 #include "src/kernel/activity/CommImpl.hpp"
 #include <simgrid/modelchecker.h>
+#include <xbt/Extendable.hpp>
 
 #include <cmath>
 
 /**************** datatypes **********************************/
 namespace simgrid {
 namespace msg {
-class Task {
+class Task : public xbt::Extendable<Task> {
   std::string name_             = "";
   std::string tracing_category_ = "";
-  void* userdata_               = nullptr;
   long long int id_;
 
   double timeout_  = 0.0;
@@ -59,8 +59,8 @@ public:
   void set_tracing_category(const char* category) { tracing_category_ = category ? std::string(category) : ""; }
   const std::string& get_tracing_category() { return tracing_category_; }
   bool has_tracing_category() { return not tracing_category_.empty(); }
-  void* get_user_data() { return userdata_; }
-  void set_user_data(void* data) { userdata_ = data; }
+  XBT_ATTRIB_DEPRECATED_v329("Please use set_data()") void* get_user_data() { return get_data(); }
+  XBT_ATTRIB_DEPRECATED_v329("Please use get_data()") void set_user_data(void* data) { set_data(data); }
   long long int get_id() { return id_; }
   double get_priority() { return priority_; }
   void set_priority(double priority);
@@ -101,16 +101,6 @@ public:
   msg_error_t get_status() { return status_; }
 };
 
-class ActorUserData {
-  void* userdata_      = nullptr;
-
-public:
-  static xbt::Extension<simgrid::s4u::Actor, ActorUserData> EXTENSION_ID;
-
-  void set_user_data(void* data) { userdata_ = data; }
-  void* get_user_data() { return userdata_; }
-};
-
 } // namespace msg
 } // namespace simgrid
 
index d6db894..0997ce7 100644 (file)
@@ -9,35 +9,11 @@
 #include "src/instr/instr_private.hpp"
 #include "src/simix/smx_private.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_process, msg, "Logging specific to MSG (process)");
-
 std::string instr_pid(simgrid::s4u::Actor const& proc)
 {
   return std::string(proc.get_name()) + "-" + std::to_string(proc.get_pid());
 }
 
-void MSG_process_userdata_init()
-{
-  if (not msg_global)
-    msg_global = new MSG_Global_t();
-
-  if (not simgrid::msg::ActorUserData::EXTENSION_ID.valid())
-    simgrid::msg::ActorUserData::EXTENSION_ID = simgrid::s4u::Actor::extension_create<simgrid::msg::ActorUserData>();
-  simgrid::s4u::Actor::on_creation.connect([](simgrid::s4u::Actor& actor) {
-    XBT_DEBUG("creating the extension to store user data");
-    actor.extension_set(new simgrid::msg::ActorUserData());
-  });
-
-  simgrid::s4u::Actor::on_destruction.connect([](simgrid::s4u::Actor const& actor) {
-    // free the data if a function was provided
-    auto extension = actor.extension<simgrid::msg::ActorUserData>();
-    void* userdata = extension ? extension->get_user_data() : nullptr;
-    if (userdata && msg_global->process_data_cleanup) {
-      msg_global->process_data_cleanup(userdata);
-    }
-  });
-}
-
 /******************************** Process ************************************/
 /** @brief Creates and runs a new #msg_process_t.
  *
@@ -89,24 +65,18 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun
                                                   int argc, char **argv, xbt_dict_t properties)
 {
   xbt_assert(host != nullptr, "Invalid parameters: host param must not be nullptr");
-  simgrid::simix::ActorCode function;
-  if (code)
-    function = simgrid::xbt::wrap_main(code, argc, static_cast<const char* const*>(argv));
-
-  simgrid::s4u::ActorPtr actor;
+  sg_actor_t actor = sg_actor_init(std::move(name), host);
 
   try {
     if (data != nullptr) {
-      actor = simgrid::s4u::Actor::init(std::move(name), host);
-      actor->extension<simgrid::msg::ActorUserData>()->set_user_data(data);
+      sg_actor_data_set(actor, data);
       xbt_dict_cursor_t cursor = nullptr;
       char* key;
       char* value;
       xbt_dict_foreach (properties, cursor, key, value)
         actor->set_property(key, value);
-      actor->start(std::move(function));
-    } else
-      actor = simgrid::s4u::Actor::create(std::move(name), host, std::move(function));
+    }
+    sg_actor_start(actor, code, argc, argv);
   } catch (simgrid::HostFailureException const&) {
     xbt_die("Could not launch a new process on failed host %s.", host->get_cname());
   }
@@ -117,31 +87,7 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun
   xbt_free(argv);
 
   simgrid::s4u::this_actor::yield();
-  return actor.get();
-}
-
-/** @brief Returns the user data of a process.
- *
- * This function checks whether @a process is a valid pointer and returns the user data associated to this process.
- */
-void* MSG_process_get_data(msg_process_t process)
-{
-  xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
-
-  /* get from SIMIX the MSG process data, and then the user data */
-  return process->extension<simgrid::msg::ActorUserData>()->get_user_data();
-}
-
-/** @brief Sets the user data of a process.
- *
- * This function checks whether @a process is a valid pointer and sets the user data associated to this process.
- */
-msg_error_t MSG_process_set_data(msg_process_t process, void *data)
-{
-  xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!");
-  process->extension<simgrid::msg::ActorUserData>()->set_user_data(data);
-
-  return MSG_OK;
+  return actor;
 }
 
 /** @brief Sets a cleanup function to be called to free the userdata of a process when a process is destroyed.
@@ -162,18 +108,11 @@ xbt_dynar_t MSG_processes_as_dynar() {
   return res;
 }
 
-/** @brief Return the current number MSG processes. */
-int MSG_process_get_number()
-{
-  return SIMIX_process_count();
-}
-
 /** @brief Add a function to the list of "on_exit" functions for the current process.
  *  The on_exit functions are the functions executed when your process is killed.
  *  You should use them to free the data used by your process.
  */
 void MSG_process_on_exit(int_f_int_pvoid_t fun, void* data)
 {
-  simgrid::s4u::this_actor::on_exit(
-      [fun, data](bool failed) { fun(failed ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS, data); });
+  simgrid::s4u::this_actor::on_exit([fun, data](bool failed) { fun(failed ? 1 /*FAILURE*/ : 0 /*SUCCESS*/, data); });
 }
index 9a62572..f87e1d8 100644 (file)
@@ -19,10 +19,11 @@ namespace simgrid {
 namespace msg {
 
 Task::Task(const std::string& name, double flops_amount, double bytes_amount, void* data)
-    : name_(name), userdata_(data), flops_amount(flops_amount), bytes_amount(bytes_amount)
+    : name_(name), flops_amount(flops_amount), bytes_amount(bytes_amount)
 {
   static std::atomic_ullong counter{0};
   id_ = counter++;
+  set_data(data);
   if (MC_is_active())
     MC_ignore_heap(&(id_), sizeof(id_));
 }
@@ -243,13 +244,13 @@ msg_task_t MSG_parallel_task_create(const char *name, int host_nb, const msg_hos
 /** @brief Return the user data of the given task */
 void* MSG_task_get_data(msg_task_t task)
 {
-  return task->get_user_data();
+  return task->get_data();
 }
 
 /** @brief Sets the user data of a given task */
 void MSG_task_set_data(msg_task_t task, void *data)
 {
-  task->set_user_data(data);
+  task->set_data(data);
 }
 
 /** @brief Returns the sender of the given task */
index 9585a66..5ab8307 100644 (file)
@@ -17,7 +17,7 @@
 #include <fstream>
 #include <numeric>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_file, "S4U files");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_file, s4u, "S4U files");
 int sg_storage_max_file_descriptors = 1024;
 
 namespace simgrid {
@@ -28,8 +28,9 @@ simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTE
 
 File::File(const std::string& fullpath, void* userdata) : File(fullpath, Host::current(), userdata){};
 
-File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath), userdata_(userdata)
+File::File(const std::string& fullpath, sg_host_t host, void* userdata) : fullpath_(fullpath)
 {
+  this->set_data(userdata);
   // this cannot fail because we get a xbt_die if the mountpoint does not exist
   if (not host->get_mounted_storages().empty()) {
     Storage* st                  = nullptr;
@@ -640,12 +641,12 @@ void sg_file_dump(sg_file_t fd)
 
 void* sg_file_get_data(sg_file_t fd)
 {
-  return fd->get_userdata();
+  return fd->get_data();
 }
 
 void sg_file_set_data(sg_file_t fd, void* data)
 {
-  fd->set_userdata(data);
+  fd->set_data(data);
 }
 
 /**
@@ -747,7 +748,7 @@ xbt_dict_t sg_storage_get_content(sg_storage_t storage)
   for (auto const& entry : *content) {
     sg_size_t* psize = new sg_size_t;
     *psize           = entry.second;
-    xbt_dict_set(content_as_dict, entry.first.c_str(), psize, nullptr);
+    xbt_dict_set(content_as_dict, entry.first.c_str(), psize);
   }
   return content_as_dict;
 }
@@ -757,7 +758,7 @@ xbt_dict_t sg_host_get_storage_content(sg_host_t host)
   xbt_assert((host != nullptr), "Invalid parameters");
   xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
   for (auto const& elm : host->get_mounted_storages())
-    xbt_dict_set(contents, elm.first.c_str(), sg_storage_get_content(elm.second), nullptr);
+    xbt_dict_set(contents, elm.first.c_str(), sg_storage_get_content(elm.second));
 
   return contents;
 }
index 5cbb75c..bd348e2 100644 (file)
@@ -18,7 +18,7 @@ SIMGRID_REGISTER_PLUGIN(host_energy, "Cpu energy consumption.", &sg_host_energy_
 
 /** @defgroup plugin_host_energy
 
-  @rst
+  @beginrst
 This is the energy plugin, enabling to account not only for computation time, but also for the dissipated energy in the
 simulated platform.
 To activate this plugin, first call :cpp:func:`sg_host_energy_plugin_init()` before your :cpp:func:`MSG_init()`, and then use
@@ -460,7 +460,7 @@ static void on_creation(simgrid::s4u::Host& host)
   if (dynamic_cast<simgrid::s4u::VirtualMachine*>(&host)) // Ignore virtual machines
     return;
 
-  // TODO Trace: set to zero the energy variable associated to host->getName()
+  // TODO Trace: set to zero the energy variable associated to host->get_name()
 
   host.extension_set(new HostEnergy(&host));
 }
@@ -581,6 +581,13 @@ void sg_host_energy_update_all()
   });
 }
 
+static void ensure_plugin_inited()
+{
+  if (not HostEnergy::EXTENSION_ID.valid())
+    throw std::logic_error("The Energy plugin is not active. Please call sg_host_energy_plugin_init() before calling "
+                           "any function related to that plugin.");
+}
+
 /** @ingroup plugin_host_energy
  *  @brief Returns the total energy consumed by the host so far (in Joules)
  *
@@ -590,8 +597,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_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_consumed_energy();
 }
 
@@ -600,8 +606,7 @@ double sg_host_get_consumed_energy(sg_host_t host)
  */
 double sg_host_get_idle_consumption(sg_host_t host)
 {
-  xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_idle_at(0);
 }
 
@@ -610,8 +615,7 @@ double sg_host_get_idle_consumption(sg_host_t host)
  */
 double sg_host_get_idle_consumption_at(sg_host_t host, int pstate)
 {
-  xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_idle_at(pstate);
 }
 
@@ -620,8 +624,7 @@ double sg_host_get_idle_consumption_at(sg_host_t host, int pstate)
  */
 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_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_min_at(pstate);
 }
 /** @ingroup plugin_host_energy
@@ -629,8 +632,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_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_watt_max_at(pstate);
 }
 /** @ingroup plugin_host_energy
@@ -638,8 +640,7 @@ double sg_host_get_wattmax_at(sg_host_t host, int pstate)
  */
 double sg_host_get_power_range_slope_at(sg_host_t host, int pstate)
 {
-  xbt_assert(HostEnergy::EXTENSION_ID.valid(),
-             "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_power_range_slope_at(pstate);
 }
 /** @ingroup plugin_host_energy
@@ -647,7 +648,6 @@ double sg_host_get_power_range_slope_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_host_energy_plugin_init() during initialization.");
+  ensure_plugin_inited();
   return host->extension<HostEnergy>()->get_current_watts_value();
 }
index 73debe7..3885580 100644 (file)
@@ -14,7 +14,7 @@ SIMGRID_REGISTER_PLUGIN(host_load, "Cpu load", &sg_host_load_plugin_init)
 
 /** @defgroup plugin_host_load
 
-  @rst
+  @beginrst
 
 Simple plugin that monitors the current load for each host.
 
index 01b0bab..b2b5e10 100644 (file)
@@ -159,7 +159,7 @@ static void on_communicate(simgrid::kernel::resource::NetworkAction const& actio
       continue;
 
     XBT_DEBUG("Update link %s", link->get_cname());
-    LinkEnergy* link_energy = link->piface_.extension<LinkEnergy>();
+    LinkEnergy* link_energy = link->get_iface()->extension<LinkEnergy>();
     link_energy->init_watts_range_list();
     link_energy->update();
   }
@@ -211,7 +211,7 @@ void sg_link_energy_plugin_init()
       simgrid::kernel::resource::NetworkAction const& action, simgrid::kernel::resource::Action::State /* previous */) {
     for (simgrid::kernel::resource::LinkImpl* link : action.links()) {
       if (link != nullptr)
-        link->piface_.extension<LinkEnergy>()->update();
+        link->get_iface()->extension<LinkEnergy>()->update();
     }
   });
 
@@ -228,5 +228,8 @@ void sg_link_energy_plugin_init()
  */
 double sg_link_get_consumed_energy(sg_link_t link)
 {
+  if (not LinkEnergy::EXTENSION_ID.valid())
+    throw std::logic_error("The Energy plugin is not active. Please call sg_link_energy_plugin_init() before calling "
+                           "sg_link_get_consumed_energy().");
   return link->extension<LinkEnergy>()->get_consumed_energy();
 }
index 51fae17..b7ccd74 100644 (file)
@@ -200,16 +200,16 @@ void VirtualMachineImpl::suspend(smx_actor_t issuer)
     throw VmFailureException(XBT_THROW_POINT, xbt::string_printf("Actor %s cannot suspend the VM %s in which it runs",
                                                                  issuer->get_cname(), piface_->get_cname()));
 
-  XBT_DEBUG("suspend VM(%s), where %zu processes exist", piface_->get_cname(), process_list_.size());
+  XBT_DEBUG("suspend VM(%s), where %zu actors exist", piface_->get_cname(), get_actor_count());
 
   action_->suspend();
 
-  for (auto& smx_process : process_list_) {
-    XBT_DEBUG("suspend %s", smx_process.get_cname());
-    smx_process.suspend();
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("suspend %s", actor.get_cname());
+    actor.suspend();
   }
 
-  XBT_DEBUG("suspend all processes on the VM done done");
+  XBT_DEBUG("suspend all actors on the VM done done");
 
   vm_state_ = s4u::VirtualMachine::state::SUSPENDED;
 }
@@ -220,13 +220,13 @@ void VirtualMachineImpl::resume()
     throw VmFailureException(XBT_THROW_POINT,
                              xbt::string_printf("Cannot resume VM %s: it was not suspended", piface_->get_cname()));
 
-  XBT_DEBUG("Resume VM %s, containing %zu processes.", piface_->get_cname(), process_list_.size());
+  XBT_DEBUG("Resume VM %s, containing %zu actors.", piface_->get_cname(), get_actor_count());
 
   action_->resume();
 
-  for (auto& smx_process : process_list_) {
-    XBT_DEBUG("resume %s", smx_process.get_cname());
-    smx_process.resume();
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("resume %s", actor.get_cname());
+    actor.resume();
   }
 
   vm_state_ = s4u::VirtualMachine::state::RUNNING;
@@ -259,12 +259,12 @@ void VirtualMachineImpl::shutdown(smx_actor_t issuer)
     XBT_VERB("Shutting down the VM %s even if it's not running but %s", piface_->get_cname(), stateName);
   }
 
-  XBT_DEBUG("shutdown VM %s, that contains %zu processes", piface_->get_cname(), process_list_.size());
+  XBT_DEBUG("shutdown VM %s, that contains %zu actors", piface_->get_cname(), get_actor_count());
 
-  for (auto& smx_process : process_list_) {
-    XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", smx_process.get_cname(),
-              smx_process.get_host()->get_cname(), issuer->get_cname());
-    issuer->kill(&smx_process);
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("kill %s@%s on behalf of %s which shutdown that VM.", actor.get_cname(), actor.get_host()->get_cname(),
+              issuer->get_cname());
+    issuer->kill(&actor);
   }
 
   set_state(s4u::VirtualMachine::state::DESTROYED);
index 615d0f2..8f27c16 100644 (file)
@@ -84,6 +84,11 @@ public:
 
   double next_occurring_event(double now) override;
   void update_actions_state(double /*now*/, double /*delta*/) override{};
+  kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                             const double* bytes_amount, double rate) override
+  {
+    return nullptr;
+  };
 };
 }
 }
index 90b5553..a828f8a 100644 (file)
@@ -9,7 +9,7 @@
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
 #include "src/plugins/vm/VmHostExt.hpp"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(vm_live_migration, "S4U virtual machines live migration");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(vm_live_migration, s4u, "S4U virtual machines live migration");
 
 namespace simgrid {
 namespace vm {
index e812231..803eaed 100644 (file)
@@ -11,8 +11,7 @@
 #include "src/plugins/vm/VmHostExt.hpp"
 #include "src/surf/cpu_cas01.hpp"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_vm, "S4U virtual machines");
-
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_vm, s4u, "S4U virtual machines");
 
 namespace simgrid {
 namespace s4u {
index 5859a09..2d2f2c6 100644 (file)
 #include "src/include/mc/mc.h"
 #include "src/kernel/activity/ExecImpl.hpp"
 #include "src/mc/mc_replay.hpp"
-#include "src/simix/smx_private.hpp"
 #include "src/surf/HostImpl.hpp"
 
 #include <algorithm>
 #include <sstream>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor, "S4U actors");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_actor, s4u, "S4U actors");
 
 namespace simgrid {
 namespace s4u {
@@ -29,8 +28,9 @@ xbt::signal<void(Actor const&)> s4u::Actor::on_suspend;
 xbt::signal<void(Actor const&)> s4u::Actor::on_resume;
 xbt::signal<void(Actor const&)> s4u::Actor::on_sleep;
 xbt::signal<void(Actor const&)> s4u::Actor::on_wake_up;
-xbt::signal<void(Actor const&)> s4u::Actor::on_migration_start;
-xbt::signal<void(Actor const&)> s4u::Actor::on_migration_end;
+xbt::signal<void(Actor const&)> s4u::Actor::on_migration_start; // deprecated
+xbt::signal<void(Actor const&)> s4u::Actor::on_migration_end;   // deprecated
+xbt::signal<void(Actor const&, Host const& previous_location)> s4u::Actor::on_host_change;
 xbt::signal<void(Actor const&)> s4u::Actor::on_termination;
 xbt::signal<void(Actor const&)> s4u::Actor::on_destruction;
 
@@ -43,9 +43,10 @@ Actor* Actor::self()
 
   return self_context->get_actor()->ciface();
 }
+
 ActorPtr Actor::init(const std::string& name, s4u::Host* host)
 {
-  smx_actor_t self = SIMIX_process_self();
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
   kernel::actor::ActorImpl* actor =
       kernel::actor::simcall([self, &name, host] { return self->init(name, host).get(); });
   return actor->iface();
@@ -59,7 +60,7 @@ ActorPtr Actor::start(const std::function<void()>& code)
 
 ActorPtr Actor::create(const std::string& name, s4u::Host* host, const std::function<void()>& code)
 {
-  smx_actor_t self = SIMIX_process_self();
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
   kernel::actor::ActorImpl* actor =
       kernel::actor::simcall([self, &name, host, &code] { return self->init(name, host)->start(code); });
 
@@ -95,8 +96,8 @@ void Actor::join()
 
 void Actor::join(double timeout)
 {
-  auto issuer = SIMIX_process_self();
-  auto target = pimpl_;
+  kernel::actor::ActorImpl* issuer = SIMIX_process_self();
+  kernel::actor::ActorImpl* target = pimpl_;
   kernel::actor::simcall_blocking<void>([issuer, target, timeout] {
     if (target->finished_) {
       // The joined process is already finished, just wake up the issuer right away
@@ -115,8 +116,8 @@ void Actor::set_auto_restart(bool autorestart)
     pimpl_->set_auto_restart(autorestart);
 
     kernel::actor::ProcessArg* arg = new kernel::actor::ProcessArg(pimpl_->get_host(), pimpl_);
-    XBT_DEBUG("Adding Process %s to the actors_at_boot_ list of Host %s", arg->name.c_str(), arg->host->get_cname());
-    pimpl_->get_host()->pimpl_->actors_at_boot_.emplace_back(arg);
+    XBT_DEBUG("Adding %s to the actors_at_boot_ list of Host %s", arg->name.c_str(), arg->host->get_cname());
+    pimpl_->get_host()->pimpl_->add_actor_at_boot(arg);
   });
 }
 
@@ -125,9 +126,19 @@ void Actor::on_exit(const std::function<void(bool /*failed*/)>& fun) const
   kernel::actor::simcall([this, &fun] { SIMIX_process_on_exit(pimpl_, fun); });
 }
 
-void Actor::migrate(Host* new_host)
+void Actor::set_host(Host* new_host)
 {
-  s4u::Actor::on_migration_start(*this);
+  if (s4u::Actor::on_migration_start.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329
+    static bool already_warned = false;
+    if (not already_warned) {
+      XBT_INFO("Please use s4u::Actor::on_host_change instead of s4u::Actor::on_migration_start. This will be removed "
+               "in v3.29");
+      already_warned = true;
+    }
+    s4u::Actor::on_migration_start(*this);
+  }
+
+  auto* previous_location = get_host();
 
   kernel::actor::simcall([this, new_host]() {
     if (pimpl_->waiting_synchro != nullptr) {
@@ -141,7 +152,17 @@ void Actor::migrate(Host* new_host)
     this->pimpl_->set_host(new_host);
   });
 
-  s4u::Actor::on_migration_end(*this);
+  if (s4u::Actor::on_migration_end.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329
+    static bool already_warned = false;
+    if (not already_warned) {
+      XBT_INFO("Please use s4u::Actor::on_host_change instead of s4u::Actor::on_migration_end. This will be removed in "
+               "v3.29");
+      already_warned = true;
+    }
+    s4u::Actor::on_migration_end(*this);
+  }
+
+  s4u::Actor::on_host_change(*this, *previous_location);
 }
 
 s4u::Host* Actor::get_host() const
@@ -181,8 +202,8 @@ aid_t Actor::get_ppid() const
 
 void Actor::suspend()
 {
-  auto issuer = SIMIX_process_self();
-  auto target = pimpl_;
+  kernel::actor::ActorImpl* issuer = SIMIX_process_self();
+  kernel::actor::ActorImpl* target = pimpl_;
   s4u::Actor::on_suspend(*this);
   kernel::actor::simcall_blocking<void>([issuer, target]() {
     target->suspend();
@@ -217,20 +238,17 @@ double Actor::get_kill_time()
 
 void Actor::kill()
 {
-  kernel::actor::ActorImpl* process = SIMIX_process_self();
-  kernel::actor::simcall([this, process] {
-    xbt_assert(pimpl_ != simix_global->maestro_process, "Killing maestro is a rather bad idea");
-    process->kill(pimpl_);
-  });
+  kernel::actor::ActorImpl* self = SIMIX_process_self();
+  kernel::actor::simcall([this, self] { self->kill(pimpl_); });
 }
 
 // ***** Static functions *****
 
 ActorPtr Actor::by_pid(aid_t pid)
 {
-  kernel::actor::ActorImpl* process = SIMIX_process_from_PID(pid);
-  if (process != nullptr)
-    return process->iface();
+  kernel::actor::ActorImpl* actor = SIMIX_process_from_PID(pid);
+  if (actor != nullptr)
+    return actor->iface();
   else
     return ActorPtr();
 }
@@ -277,8 +295,7 @@ namespace this_actor {
  */
 bool is_maestro()
 {
-  kernel::actor::ActorImpl* process = SIMIX_process_self();
-  return process == nullptr || process == simix_global->maestro_process;
+  return SIMIX_is_maestro();
 }
 
 void sleep_for(double duration)
@@ -429,9 +446,13 @@ void on_exit(const std::function<void(bool)>& fun)
  *
  * @see simgrid::s4u::Actor::migrate() for more information
  */
-void migrate(Host* new_host)
+void set_host(Host* new_host)
 {
-  SIMIX_process_self()->iface()->migrate(new_host);
+  SIMIX_process_self()->iface()->set_host(new_host);
+}
+void migrate(Host* new_host) // deprecated
+{
+  set_host(new_host);
 }
 
 } // namespace this_actor
@@ -440,6 +461,19 @@ void migrate(Host* new_host)
 
 /* **************************** Public C interface *************************** */
 
+sg_actor_t sg_actor_init(const char* name, sg_host_t host)
+{
+  return simgrid::s4u::Actor::init(name, host).get();
+}
+
+void sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char** argv)
+{
+  simgrid::simix::ActorCode function;
+  if (code)
+    function = simgrid::xbt::wrap_main(code, argc, static_cast<const char* const*>(argv));
+  actor->start(std::move(function));
+}
+
 /** @ingroup m_actor_management
  * @brief Returns the process ID of @a actor.
  *
@@ -516,7 +550,7 @@ xbt_dict_t sg_actor_get_properties(sg_actor_t actor)
   if (props == nullptr)
     return nullptr;
   for (auto const& kv : *props) {
-    xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()), nullptr);
+    xbt_dict_set(as_dict, kv.first.c_str(), xbt_strdup(kv.second.c_str()));
   }
   return as_dict;
 }
@@ -585,9 +619,13 @@ void sg_actor_daemonize(sg_actor_t actor)
  *
  * 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)
+void sg_actor_set_host(sg_actor_t actor, sg_host_t host)
+{
+  actor->set_host(host);
+}
+void sg_actor_migrate(sg_actor_t process, sg_host_t host) // deprecated
 {
-  process->migrate(host);
+  process->set_host(host);
 }
 
 /** @ingroup m_actor_management
@@ -676,6 +714,16 @@ const char* sg_actor_self_get_name()
   return simgrid::s4u::this_actor::get_cname();
 }
 
+void* sg_actor_self_data()
+{
+  return simgrid::s4u::Actor::self()->get_data();
+}
+
+void sg_actor_self_data_set(void* userdata)
+{
+  simgrid::s4u::Actor::self()->set_data(userdata);
+}
+
 sg_actor_t sg_actor_self()
 {
   return simgrid::s4u::Actor::self();
@@ -698,7 +746,7 @@ void sg_actor_unref(sg_actor_t actor)
 }
 
 /** @brief Return the user data of a #sg_actor_t */
-void* sg_actor_data(sg_actor_t actor)
+void* sg_actor_data(const_sg_actor_t actor)
 {
   return actor->get_data();
 }
index be8bb6e..7289a6c 100644 (file)
@@ -12,7 +12,7 @@
 #include "simgrid/simix.h"
 #include "xbt/log.hpp"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_barrier, "S4U barrier");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_barrier, s4u, "S4U barrier");
 
 namespace simgrid {
 namespace s4u {
index 1d12c11..583175b 100644 (file)
@@ -18,6 +18,7 @@
 #include "src/instr/instr_private.hpp"
 #include "src/kernel/EngineImpl.hpp"
 #include "src/simix/smx_private.hpp" // For access to simix_global->process_list
+#include "src/surf/StorageImpl.hpp"
 #include "src/surf/network_interface.hpp"
 #include "surf/surf.hpp" // routing_platf. FIXME:KILLME. SOON
 #include <simgrid/Exception.hpp>
@@ -74,47 +75,54 @@ double Engine::get_clock()
 }
 
 /**
- * @brief A platform loader.
+ * Creates a new platform, including hosts, links, and the routing table.
  *
- * Creates a new platform, including hosts, links, and the routing_table.
- * @param platf a filename of the XML description of a platform. This file follows this DTD :
- *
- *     @include src/surf/xml/simgrid.dtd
- *
- * Here is a small example of such a platform
- *
- *     @include examples/platforms/small_platform.xml
+ * \rst
+ * See also: :ref:`platform`.
+ * \endrst
  */
 void Engine::load_platform(const std::string& platf)
 {
   double start = xbt_os_time();
-  try {
-    parse_platform_file(platf);
-  } catch (const Exception& e) {
-    xbt_die("Error while loading %s: %s", platf.c_str(), e.what());
-  }
+  parse_platform_file(platf);
 
   double end = xbt_os_time();
   XBT_DEBUG("PARSE TIME: %g", (end - start));
 }
 
+/** Registers the main function of an actor that will be launched from the deployment file */
 void Engine::register_function(const std::string& name, int (*code)(int, char**))
 {
-  SIMIX_function_register(name, code);
+  pimpl->register_function(name, code);
 }
+
+/** Registers the main function of an actor that will be launched from the deployment file */
 void Engine::register_function(const std::string& name, void (*code)(std::vector<std::string>))
 {
-  SIMIX_function_register(name, code);
+  pimpl->register_function(name, code);
 }
+/** 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/s4u/replay-comms and similar).
+ */
 void Engine::register_default(int (*code)(int, char**))
 {
-  SIMIX_function_register_default(code);
+  pimpl->register_default(code);
 }
+
+/** Load a deployment file and launch the actors that it contains
+ *
+ * \rst
+ * See also: :ref:`deploy`.
+ * \endrst
+ */
 void Engine::load_deployment(const std::string& deploy)
 {
-  SIMIX_launch_application(deploy);
+  pimpl->load_deployment(deploy);
 }
-/** @brief Returns the amount of hosts in the platform */
+
+/** Returns the amount of hosts in the platform */
 size_t Engine::get_host_count()
 {
   return pimpl->hosts_.size();
@@ -176,19 +184,19 @@ Link* Engine::link_by_name(const std::string& name)
   if (pimpl->links_.find(name) == pimpl->links_.end())
     throw std::invalid_argument(std::string("Link not found: ") + name);
 
-  return pimpl->links_.at(name);
+  return pimpl->links_.at(name)->get_iface();
 }
 
 /** @brief Find an link from its name (or nullptr if that link does not exist) */
 Link* Engine::link_by_name_or_null(const std::string& name)
 {
   auto link = pimpl->links_.find(name);
-  return link == pimpl->links_.end() ? nullptr : link->second;
+  return link == pimpl->links_.end() ? nullptr : link->second->get_iface();
 }
 
 void Engine::link_register(const std::string& name, Link* link)
 {
-  pimpl->links_[name] = link;
+  pimpl->links_[name] = link->get_impl();
 }
 
 void Engine::link_unregister(const std::string& name)
@@ -207,7 +215,7 @@ std::vector<Storage*> Engine::get_all_storages()
 {
   std::vector<Storage*> res;
   for (auto const& kv : pimpl->storages_)
-    res.push_back(kv.second);
+    res.push_back(kv.second->get_iface());
   return res;
 }
 
@@ -220,19 +228,19 @@ Storage* Engine::storage_by_name(const std::string& name)
   if (pimpl->storages_.find(name) == pimpl->storages_.end())
     throw std::invalid_argument(std::string("Storage not found: ") + name);
 
-  return pimpl->storages_.at(name);
+  return pimpl->storages_.at(name)->get_iface();
 }
 
 /** @brief Find a storage from its name (or nullptr if that storage does not exist) */
 Storage* Engine::storage_by_name_or_null(const std::string& name)
 {
   auto storage = pimpl->storages_.find(name);
-  return storage == pimpl->storages_.end() ? nullptr : storage->second;
+  return storage == pimpl->storages_.end() ? nullptr : storage->second->get_iface();
 }
 
 void Engine::storage_register(const std::string& name, Storage* storage)
 {
-  pimpl->storages_[name] = storage;
+  pimpl->storages_[name] = storage->get_impl();
 }
 
 void Engine::storage_unregister(const std::string& name)
@@ -251,16 +259,18 @@ std::vector<Link*> Engine::get_all_links()
 {
   std::vector<Link*> res;
   for (auto const& kv : pimpl->links_)
-    res.push_back(kv.second);
+    res.push_back(kv.second->get_iface());
   return res;
 }
 
 std::vector<Link*> Engine::get_filtered_links(const std::function<bool(Link*)>& filter)
 {
   std::vector<Link*> filtered_list;
-  for (auto const& kv : pimpl->links_)
-    if (filter(kv.second))
-      filtered_list.push_back(kv.second);
+  for (auto const& kv : pimpl->links_) {
+    Link* l = kv.second->get_iface();
+    if (filter(l))
+      filtered_list.push_back(l);
+  }
   return filtered_list;
 }
 
@@ -407,3 +417,7 @@ double simgrid_get_clock()
 {
   return simgrid::s4u::Engine::get_clock();
 }
+int simgrid_get_actor_count()
+{
+  return simgrid::s4u::Engine::get_instance()->get_actor_count();
+}
index 459c290..c2e0169 100644 (file)
@@ -9,7 +9,6 @@
 #include "simgrid/s4u/Exec.hpp"
 #include "simgrid/s4u/VirtualMachine.hpp"
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
-#include "src/simix/smx_private.hpp"
 #include "src/surf/HostImpl.hpp"
 
 #include <algorithm>
@@ -97,14 +96,15 @@ void Host::turn_on()
 void Host::turn_off()
 {
   if (is_on()) {
-    kernel::actor::simcall([this] {
+    kernel::actor::ActorImpl* self = SIMIX_process_self();
+    kernel::actor::simcall([this, self] {
       for (VirtualMachine* const& vm : vm::VirtualMachineImpl::allVms_)
         if (vm->get_pm() == this) {
           vm->shutdown();
           vm->turn_off();
         }
       this->pimpl_cpu->turn_off();
-      this->pimpl_->turn_off();
+      this->pimpl_->turn_off(self);
 
       on_state_change(*this);
     });
@@ -154,7 +154,7 @@ void Host::route_to(Host* dest, std::vector<Link*>& links, double* latency)
   std::vector<kernel::resource::LinkImpl*> linkImpls;
   this->route_to(dest, linkImpls, latency);
   for (kernel::resource::LinkImpl* const& l : linkImpls)
-    links.push_back(&l->piface_);
+    links.push_back(l->get_iface());
 }
 
 /** @brief Just like Host::routeTo, but filling an array of link implementations */
@@ -311,7 +311,7 @@ std::unordered_map<std::string, Storage*> const& Host::get_mounted_storages()
   if (mounts_ == nullptr) {
     mounts_ = new std::unordered_map<std::string, Storage*>();
     for (auto const& m : this->pimpl_->storage_) {
-      mounts_->insert({m.first, &m.second->piface_});
+      mounts_->insert({m.first, m.second->get_iface()});
     }
   }
   return *mounts_;
@@ -428,7 +428,7 @@ xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host)
   for (auto const& elm : host->get_mounted_storages()) {
     const char* mount_name = elm.first.c_str();
     sg_storage_t storage   = elm.second;
-    xbt_dict_set(res, mount_name, (void*)storage->get_cname(), nullptr);
+    xbt_dict_set(res, mount_name, (void*)storage->get_cname());
   }
 
   return res;
@@ -550,7 +550,7 @@ xbt_dict_t sg_host_get_properties(sg_host_t host)
   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);
+    xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()));
   }
   return as_dict;
 }
@@ -654,18 +654,13 @@ void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto)
 
 sg_host_t sg_host_self()
 {
-  smx_actor_t process = SIMIX_process_self();
-  return (process == nullptr) ? nullptr : process->get_host();
+  return SIMIX_is_maestro() ? nullptr : SIMIX_process_self()->get_host();
 }
 
 /* needs to be public and without simcall for exceptions and logging events */
 const char* sg_host_self_get_name()
 {
-  sg_host_t host = sg_host_self();
-  if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
-    return "";
-
-  return host->get_cname();
+  return SIMIX_is_maestro() ? "" : SIMIX_process_self()->get_host()->get_cname();
 }
 
 double sg_host_load(sg_host_t host)
index 30ebf50..cca68b0 100644 (file)
@@ -9,8 +9,6 @@
 #include "src/kernel/activity/IoImpl.hpp"
 #include "xbt/log.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_io, s4u_activity, "S4U asynchronous IOs");
-
 namespace simgrid {
 namespace s4u {
 
index bb48a1b..742f062 100644 (file)
@@ -13,8 +13,6 @@
 #include "src/surf/network_interface.hpp"
 #include "xbt/log.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_link, s4u, "Logging specific to the S4U links");
-
 namespace simgrid {
 namespace s4u {
 
index dec17ec..807bf42 100644 (file)
@@ -9,8 +9,6 @@
 #include "simgrid/s4u/NetZone.hpp"
 #include "simgrid/zone.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_netzone, "S4U Networking Zones");
-
 namespace simgrid {
 namespace s4u {
 
@@ -115,7 +113,7 @@ sg_netzone_t sg_zone_get_by_name(const char* name)
 void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
 {
   for (auto const& elem : netzone->get_children()) {
-    xbt_dict_set(whereto, elem->get_cname(), static_cast<void*>(elem), nullptr);
+    xbt_dict_set(whereto, elem->get_cname(), static_cast<void*>(elem));
   }
 }
 
index 08ad078..59667fd 100644 (file)
@@ -122,7 +122,7 @@ xbt_dict_t sg_storage_get_properties(sg_storage_t storage)
   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);
+    xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()));
   }
   return as_dict;
 }
index 49d76b5..387fd23 100644 (file)
@@ -44,17 +44,17 @@ unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl*
   return simcall_BODY_execution_waitany_for(execs, count, timeout);
 }
 
-void simcall_process_join(smx_actor_t process, double timeout)
+void simcall_process_join(smx_actor_t process, double timeout) // XBT_DEPRECATED_v328
 {
   SIMIX_process_self()->join(process, timeout);
 }
 
-void simcall_process_suspend(smx_actor_t process)
+void simcall_process_suspend(smx_actor_t process) // XBT_DEPRECATED_v328
 {
   process->iface()->suspend();
 }
 
-e_smx_state_t simcall_process_sleep(double duration)
+e_smx_state_t simcall_process_sleep(double duration) // XBT_DEPRECATED_v329
 {
   SIMIX_process_self()->sleep(duration);
   return SIMIX_DONE;
index 422f0a8..1955bf7 100644 (file)
@@ -3,97 +3,38 @@
 /* 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/Exception.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "smx_private.hpp"
 #include "src/surf/xml/platf_private.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
 #include <simgrid/engine.h>
+#include <simgrid/s4u/Engine.hpp>
 
 #include <string>
 #include <vector>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_deployment, simix, "Logging specific to SIMIX (deployment)");
 
-extern int surf_parse_lineno;
-
-void SIMIX_init_application()
+void SIMIX_init_application() // XBT_DEPRECATED_v329
 {
   sg_platf_exit();
   sg_platf_init();
 }
 
-/**
- * @brief An application deployer.
- *
- * Creates the process described in @a file.
- * @param file a filename of a xml description of the application. This file
- * follows this DTD :
- *
- *     @include surfxml.dtd
- *
- * Here is a small example of such a platform
- *
- *     @include small_deployment.xml
- *
- */
-void SIMIX_launch_application(const std::string& file)
-{
-  XBT_ATTRIB_UNUSED int parse_status;
-  xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_launch_application.");
-
-  SIMIX_init_application();
-
-  surf_parse_open(file);
-  try {
-    parse_status = surf_parse();
-    surf_parse_close();
-    xbt_assert(not parse_status, "Parse error at %s:%d", file.c_str(), surf_parse_lineno);
-  } catch (const simgrid::Exception&) {
-    XBT_ERROR(
-        "Unrecoverable error at %s:%d. The full exception stack follows, in case it helps you to diagnose the problem.",
-        file.c_str(), surf_parse_lineno);
-    throw;
-  }
-}
-
-// Wrap a main() function into a ActorCodeFactory:
-static simgrid::simix::ActorCodeFactory toActorCodeFactory(xbt_main_func_t code)
+void SIMIX_launch_application(const std::string& file) // XBT_DEPRECATED_v329
 {
-  return [code](std::vector<std::string> args) { return simgrid::xbt::wrap_main(code, std::move(args)); };
+  simgrid_load_deployment(file.c_str());
 }
-static simgrid::simix::ActorCodeFactory toActorCodeFactory(void (*code)(std::vector<std::string>))
+void SIMIX_function_register(const std::string& name, xbt_main_func_t code) // XBT_DEPRECATED_v329
 {
-  return [code](std::vector<std::string> args) { return std::bind(std::move(code), std::move(args)); };
+  simgrid::s4u::Engine::get_instance()->register_function(name, code);
 }
-
-/**
- * @brief Registers a #xbt_main_func_t code in a global table.
- *
- * Registers a code function in a global table.
- * This table is then used by #SIMIX_launch_application.
- * @param name the reference name of the function.
- * @param code the function
- */
-void SIMIX_function_register(const std::string& name, xbt_main_func_t code)
+void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>)) // XBT_DEPRECATED_v329
 {
-  simix_global->registered_functions[name] = toActorCodeFactory(code);
+  simgrid::s4u::Engine::get_instance()->register_function(name, code);
 }
-void SIMIX_function_register(const std::string& name, void (*code)(std::vector<std::string>))
-{
-  simix_global->registered_functions[name] = toActorCodeFactory(code);
-}
-
-/**
- * @brief Registers a #xbt_main_func_t code as default value.
- *
- * Registers a code function as being the default value. This function will get used by SIMIX_launch_application() when
- * there is no registered function of the requested name in.
- * @param code the function
- */
-void SIMIX_function_register_default(xbt_main_func_t code)
+void SIMIX_function_register_default(xbt_main_func_t code) // XBT_DEPRECATED_v329
 {
-  xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_function_register.");
-  simix_global->default_function = toActorCodeFactory(code);
+  simgrid::s4u::Engine::get_instance()->register_default(code);
 }
 
 /**
@@ -119,7 +60,7 @@ simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const std::string
 /** @brief Bypass the parser, get arguments, and set function to each process */
 
 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)
+                                double process_start_time, double process_kill_time) // XBT_ATTRIB_DEPRECATED_v329
 {
   simgrid::kernel::routing::ActorCreationArgs actor;
 
index a006997..83c6f92 100644 (file)
@@ -34,10 +34,10 @@ void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr) = nullptr;
 
 namespace simgrid {
 namespace simix {
-simgrid::config::Flag<double> cfg_verbose_exit{
-    "debug/verbose-exit", {"verbose-exit"}, "Display the actor status at exit", true};
-}
+config::Flag<double> cfg_verbose_exit{"debug/verbose-exit", {"verbose-exit"}, "Display the actor status at exit", true};
+} // namespace simix
 } // namespace simgrid
+
 XBT_ATTRIB_NORETURN static void inthandler(int)
 {
   if (simgrid::simix::cfg_verbose_exit) {
@@ -134,7 +134,7 @@ static void install_segvhandler()
 namespace simgrid {
 namespace simix {
 
-Timer* Timer::set(double date, simgrid::xbt::Task<void()>&& callback)
+Timer* Timer::set(double date, xbt::Task<void()>&& callback)
 {
   Timer* timer   = new Timer(date, std::move(callback));
   timer->handle_ = simix_timers.emplace(std::make_pair(date, timer));
@@ -144,7 +144,7 @@ Timer* Timer::set(double date, simgrid::xbt::Task<void()>&& callback)
 /** @brief cancels a timer that was added earlier */
 void Timer::remove()
 {
-  simgrid::simix::simix_timers.erase(handle_);
+  simix_timers.erase(handle_);
   delete this;
 }
 
@@ -173,7 +173,7 @@ bool Global::execute_tasks()
 void Global::empty_trash()
 {
   while (not actors_to_destroy.empty()) {
-    smx_actor_t actor = &actors_to_destroy.front();
+    kernel::actor::ActorImpl* actor = &actors_to_destroy.front();
     actors_to_destroy.pop_front();
     XBT_DEBUG("Getting rid of %s (refcount: %d)", actor->get_cname(), actor->get_refcount());
     intrusive_ptr_release(actor);
@@ -197,10 +197,10 @@ void Global::run_all_actors()
   actors_to_run.clear();
 }
 
-simgrid::config::Flag<double> cfg_breakpoint{
+config::Flag<double> cfg_breakpoint{
     "debug/breakpoint", {"simix/breakpoint"}, "When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
-}
-}
+} // namespace simix
+} // namespace simgrid
 
 static simgrid::simix::ActorCode maestro_code;
 void SIMIX_set_maestro(void (*code)(void*), void* data)
@@ -276,7 +276,7 @@ void SIMIX_clean()
   }
 
 #if HAVE_SMPI
-  if (SIMIX_process_count()>0){
+  if (simix_global->process_list.size() > 0) {
     if(smpi_process()->initialized()){
       xbt_die("Process exited without calling MPI_Finalize - Killing simulation");
     }else{
@@ -288,7 +288,7 @@ void SIMIX_clean()
 
   /* Kill all processes (but maestro) */
   simix_global->maestro_process->kill_all();
-  simix_global->context_factory->run_all();
+  simix_global->run_all_actors();
   simix_global->empty_trash();
 
   /* Exit the SIMIX network module */
@@ -470,9 +470,9 @@ void SIMIX_run()
        *   That would thus be a pure waste of time.
        */
 
-      for (smx_actor_t const& process : simix_global->actors_that_ran) {
-        if (process->simcall.call_ != SIMCALL_NONE) {
-          process->simcall_handle(0);
+      for (auto const& actor : simix_global->actors_that_ran) {
+        if (actor->simcall.call_ != SIMCALL_NONE) {
+          actor->simcall_handle(0);
         }
       }
 
@@ -562,7 +562,7 @@ void SIMIX_display_process_status()
   /*  List the process and their state */
   XBT_INFO("Legend of the following listing: \"Process <pid> (<name>@<host>): <status>\"");
   for (auto const& kv : simix_global->process_list) {
-    smx_actor_t actor = kv.second;
+    simgrid::kernel::actor::ActorImpl* actor = kv.second;
 
     if (actor->waiting_synchro) {
 
@@ -600,6 +600,8 @@ void SIMIX_display_process_status()
 
 int SIMIX_is_maestro()
 {
-  smx_actor_t self = SIMIX_process_self();
-  return simix_global == nullptr /*SimDag*/ || self == nullptr || self == simix_global->maestro_process;
+  if (simix_global == nullptr) // SimDag
+    return true;
+  simgrid::kernel::actor::ActorImpl* self = SIMIX_process_self();
+  return self == nullptr || self == simix_global->maestro_process;
 }
index 2689334..bc6f129 100644 (file)
@@ -21,8 +21,6 @@ namespace simgrid {
 namespace simix {
 
 class Global {
-  friend XBT_PUBLIC bool simgrid::s4u::this_actor::is_maestro();
-
 public:
   bool execute_tasks();
   /**
@@ -34,9 +32,9 @@ public:
   void run_all_actors();
 
   smx_context_factory_t context_factory = nullptr;
-  std::vector<smx_actor_t> actors_to_run;
-  std::vector<smx_actor_t> actors_that_ran;
-  std::map<aid_t, smx_actor_t> process_list;
+  std::vector<kernel::actor::ActorImpl*> actors_to_run;
+  std::vector<kernel::actor::ActorImpl*> actors_that_ran;
+  std::map<aid_t, kernel::actor::ActorImpl*> process_list;
   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>>
@@ -50,23 +48,23 @@ public:
    * That way, the MCer would not need to have the list of actors on its side.
    * These info could be published by the MCed to the MCer in a way inspired of vd.so
    */
-  xbt_dynar_t actors_vector      = xbt_dynar_new(sizeof(smx_actor_t), nullptr);
-  xbt_dynar_t dead_actors_vector = xbt_dynar_new(sizeof(smx_actor_t), nullptr);
+  xbt_dynar_t actors_vector      = xbt_dynar_new(sizeof(kernel::actor::ActorImpl*), nullptr);
+  xbt_dynar_t dead_actors_vector = xbt_dynar_new(sizeof(kernel::actor::ActorImpl*), nullptr);
 #endif
-  smx_actor_t maestro_process   = nullptr;
+  kernel::actor::ActorImpl* maestro_process = nullptr;
 
   // Maps function names to actor code:
-  std::unordered_map<std::string, simgrid::simix::ActorCodeFactory> registered_functions;
+  std::unordered_map<std::string, simix::ActorCodeFactory> registered_functions;
 
   // This might be used when no corresponding function name is registered:
-  simgrid::simix::ActorCodeFactory default_function;
+  simix::ActorCodeFactory default_function;
 
   std::mutex mutex;
 
-  std::vector<simgrid::xbt::Task<void()>> tasks;
-  std::vector<simgrid::xbt::Task<void()>> tasksTemp;
+  std::vector<xbt::Task<void()>> tasks;
+  std::vector<xbt::Task<void()>> tasksTemp;
 
-  std::vector<simgrid::kernel::actor::ActorImpl*> daemons;
+  std::vector<kernel::actor::ActorImpl*> daemons;
 };
 }
 }
index 9e96429..ad939da 100644 (file)
@@ -19,13 +19,13 @@ void smpi_init_fortran_types(){
      MPI_COMM_WORLD->add_f();
      MPI_BYTE->add_f();//MPI_BYTE
      MPI_CHAR->add_f();//MPI_CHARACTER
-#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
-     MPI_C_BOOL->add_f();//MPI_LOGICAL
-     MPI_INT->add_f();//MPI_INTEGER
-#else
-     MPI_C_BOOL->add_f();//MPI_LOGICAL
-     MPI_LONG->add_f();//MPI_INTEGER
-#endif
+     if(sizeof(void*)==8) {
+       MPI_C_BOOL->add_f();//MPI_LOGICAL
+       MPI_INT->add_f();//MPI_INTEGER
+     } else {
+       MPI_C_BOOL->add_f();//MPI_LOGICAL
+       MPI_LONG->add_f();//MPI_INTEGER
+     }
      MPI_INT8_T->add_f();//MPI_INTEGER1
      MPI_INT16_T->add_f();//MPI_INTEGER2
      MPI_INT32_T->add_f();//MPI_INTEGER4
@@ -36,11 +36,10 @@ void smpi_init_fortran_types(){
      MPI_DOUBLE->add_f();//MPI_DOUBLE_PRECISION
      MPI_COMPLEX8->add_f();//MPI_COMPLEX
      MPI_COMPLEX16->add_f();//MPI_DOUBLE_COMPLEX
-#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
-     MPI_2INT->add_f();//MPI_2INTEGER
-#else
-     MPI_2LONG->add_f();//MPI_2INTEGER
-#endif
+     if(sizeof(void*)==8)
+       MPI_2INT->add_f();//MPI_2INTEGER
+     else
+       MPI_2LONG->add_f();//MPI_2INTEGER
      MPI_UINT8_T->add_f();//MPI_LOGICAL1
      MPI_UINT16_T->add_f();//MPI_LOGICAL2
      MPI_UINT32_T->add_f();//MPI_LOGICAL4
index 0bf9bbc..0a774ad 100644 (file)
@@ -111,9 +111,9 @@ namespace smpi{
 
 
 int
-Coll_allgather_2dmesh::allgather(const void *send_buff, int send_count, MPI_Datatype
-                                 send_type, void *recv_buff, int recv_count,
-                                 MPI_Datatype recv_type, MPI_Comm comm)
+allgather__2dmesh(const void *send_buff, int send_count, MPI_Datatype
+                  send_type, void *recv_buff, int recv_count,
+                  MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Aint extent;
 
index fa370fe..02e5d12 100644 (file)
@@ -96,10 +96,10 @@ namespace simgrid{
 namespace smpi{
 
 
-int Coll_allgather_3dmesh::allgather(const void *send_buff, int send_count,
-                                     MPI_Datatype send_type, void *recv_buff,
-                                     int recv_count, MPI_Datatype recv_type,
-                                     MPI_Comm comm)
+int allgather__3dmesh(const void *send_buff, int send_count,
+                      MPI_Datatype send_type, void *recv_buff,
+                      int recv_count, MPI_Datatype recv_type,
+                      MPI_Comm comm)
 {
   MPI_Aint extent;
 
index 26ded0b..a0a320a 100644 (file)
@@ -9,10 +9,10 @@
 namespace simgrid{
 namespace smpi{
 // Allgather - gather/bcast algorithm
-int Coll_allgather_GB::allgather(const void *send_buff, int send_count,
-                                 MPI_Datatype send_type, void *recv_buff,
-                                 int recv_count, MPI_Datatype recv_type,
-                                 MPI_Comm comm)
+int allgather__GB(const void *send_buff, int send_count,
+                  MPI_Datatype send_type, void *recv_buff,
+                  int recv_count, MPI_Datatype recv_type,
+                  MPI_Comm comm)
 {
   int num_procs;
   num_procs = comm->size();
index 7ffaed9..d1cdb55 100644 (file)
@@ -11,9 +11,9 @@ namespace smpi{
 
 // Allgather-Non-Topology-Specific-Logical-Ring algorithm
 int
-Coll_allgather_NTSLR_NB::allgather(const void *sbuf, int scount, MPI_Datatype stype,
-                                   void *rbuf, int rcount, MPI_Datatype rtype,
-                                   MPI_Comm comm)
+allgather__NTSLR_NB(const void *sbuf, int scount, MPI_Datatype stype,
+                    void *rbuf, int rcount, MPI_Datatype rtype,
+                    MPI_Comm comm)
 {
   MPI_Aint rextent, sextent;
   MPI_Status status, status2;
@@ -31,7 +31,7 @@ Coll_allgather_NTSLR_NB::allgather(const void *sbuf, int scount, MPI_Datatype st
   // irregular case use default MPI fucntions
   if (scount * sextent != rcount * rextent) {
     XBT_WARN("MPI_allgather_NTSLR_NB use default MPI_allgather.");
-    Coll_allgather_default::allgather(sbuf, scount, stype, rbuf, rcount, rtype, comm);
+    allgather__default(sbuf, scount, stype, rbuf, rcount, rtype, comm);
     return MPI_SUCCESS;
   }
 
index 8c65ed8..c7a5380 100644 (file)
@@ -11,9 +11,9 @@ namespace smpi{
 
 // Allgather-Non-Topology-Specific-Logical-Ring algorithm
 int
-Coll_allgather_NTSLR::allgather(const void *sbuf, int scount, MPI_Datatype stype,
-                                void *rbuf, int rcount, MPI_Datatype rtype,
-                                MPI_Comm comm)
+allgather__NTSLR(const void *sbuf, int scount, MPI_Datatype stype,
+                 void *rbuf, int rcount, MPI_Datatype rtype,
+                 MPI_Comm comm)
 {
   MPI_Aint rextent, sextent;
   MPI_Status status;
@@ -29,7 +29,7 @@ Coll_allgather_NTSLR::allgather(const void *sbuf, int scount, MPI_Datatype stype
   // irregular case use default MPI fucntions
   if (scount * sextent != rcount * rextent) {
     XBT_WARN("MPI_allgather_NTSLR use default MPI_allgather.");
-    Coll_allgather_default::allgather(sbuf, scount, stype, rbuf, rcount, rtype, comm);
+    allgather__default(sbuf, scount, stype, rbuf, rcount, rtype, comm);
     return MPI_SUCCESS;
   }
 
index cb1acff..afaabc3 100644 (file)
@@ -10,10 +10,10 @@ namespace simgrid{
 namespace smpi{
 
 
-int Coll_allgather_SMP_NTS::allgather(const void *sbuf, int scount,
-                                      MPI_Datatype stype, void *rbuf,
-                                      int rcount, MPI_Datatype rtype,
-                                      MPI_Comm comm)
+int allgather__SMP_NTS(const void *sbuf, int scount,
+                       MPI_Datatype stype, void *rbuf,
+                       int rcount, MPI_Datatype rtype,
+                       MPI_Comm comm)
 {
   int src, dst, comm_size, rank;
   comm_size = comm->size();
@@ -47,7 +47,7 @@ int Coll_allgather_SMP_NTS::allgather(const void *sbuf, int scount,
   /* for too small number of processes, use default implementation */
   if (comm_size <= num_core) {
     XBT_WARN("MPI_allgather_SMP_NTS use default MPI_allgather.");
-    Coll_allgather_default::allgather(sbuf, scount, stype, rbuf, rcount, rtype, comm);
+    allgather__default(sbuf, scount, stype, rbuf, rcount, rtype, comm);
     return MPI_SUCCESS;
   }
 
index b2c49f7..0c3706e 100644 (file)
@@ -72,10 +72,10 @@ namespace smpi{
 
 
 
-int Coll_allgather_bruck::allgather(const void *send_buff, int send_count,
-                                    MPI_Datatype send_type, void *recv_buff,
-                                    int recv_count, MPI_Datatype recv_type,
-                                    MPI_Comm comm)
+int allgather__bruck(const void *send_buff, int send_count,
+                     MPI_Datatype send_type, void *recv_buff,
+                     int recv_count, MPI_Datatype recv_type,
+                     MPI_Comm comm)
 {
   // MPI variables
   MPI_Status status;
index 5596db8..2cbbe65 100644 (file)
@@ -10,10 +10,10 @@ namespace simgrid{
 namespace smpi{
 
 
-int Coll_allgather_loosely_lr::allgather(const void *sbuf, int scount,
-                                         MPI_Datatype stype, void *rbuf,
-                                         int rcount, MPI_Datatype rtype,
-                                         MPI_Comm comm)
+int allgather__loosely_lr(const void *sbuf, int scount,
+                          MPI_Datatype stype, void *rbuf,
+                          int rcount, MPI_Datatype rtype,
+                          MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLGATHER;
index 1a73c48..b53f6f9 100644 (file)
@@ -38,7 +38,7 @@
 namespace simgrid{
 namespace smpi{
 
-int Coll_allgather_mvapich2_smp::allgather(const void *sendbuf,int sendcnt, MPI_Datatype sendtype,
+int allgather__mvapich2_smp(const void *sendbuf,int sendcnt, MPI_Datatype sendtype,
                             void *recvbuf, int recvcnt,MPI_Datatype recvtype,
                             MPI_Comm  comm)
 {
@@ -138,7 +138,7 @@ int Coll_allgather_mvapich2_smp::allgather(const void *sendbuf,int sendcnt, MPI_
 
 
 
-            mpi_errno = Coll_allgather_mpich::allgather(sendtmpbuf,
+            mpi_errno = allgather__mpich(sendtmpbuf,
                                                (recvcnt*local_size),
                                                recvtype,
                                                recvbuf, (recvcnt*local_size), recvtype,
index 0b0a0b2..ad4f6a2 100644 (file)
@@ -68,7 +68,7 @@ namespace simgrid{
 namespace smpi{
 
 int
-Coll_allgather_ompi_neighborexchange::allgather(const void *sbuf, int scount,
+allgather__ompi_neighborexchange(const void *sbuf, int scount,
                                                  MPI_Datatype sdtype,
                                                  void* rbuf, int rcount,
                                                  MPI_Datatype rdtype,
@@ -90,9 +90,9 @@ Coll_allgather_ompi_neighborexchange::allgather(const void *sbuf, int scount,
       XBT_DEBUG(
                    "coll:tuned:allgather_intra_neighborexchange WARNING: odd size %d, switching to ring algorithm",
                    size);
-      return Coll_allgather_ring::allgather(sbuf, scount, sdtype,
-                                                  rbuf, rcount, rdtype,
-                                                  comm);
+      return allgather__ring(sbuf, scount, sdtype,
+                             rbuf, rcount, rdtype,
+                             comm);
    }
 
    XBT_DEBUG(
index 5505bd5..35372f7 100644 (file)
@@ -70,10 +70,10 @@ namespace smpi{
 
 
 int
-Coll_allgather_pair::allgather(const void *send_buff, int send_count,
-                               MPI_Datatype send_type, void *recv_buff,
-                               int recv_count, MPI_Datatype recv_type,
-                               MPI_Comm comm)
+allgather__pair(const void *send_buff, int send_count,
+                MPI_Datatype send_type, void *recv_buff,
+                int recv_count, MPI_Datatype recv_type,
+                MPI_Comm comm)
 {
 
   MPI_Aint extent;
index 5811d72..7c62e75 100644 (file)
@@ -10,10 +10,10 @@ namespace simgrid{
 namespace smpi{
 
 int
-Coll_allgather_rdb::allgather(const void *sbuf, int send_count,
-                              MPI_Datatype send_type, void *rbuf,
-                              int recv_count, MPI_Datatype recv_type,
-                              MPI_Comm comm)
+allgather__rdb(const void *sbuf, int send_count,
+               MPI_Datatype send_type, void *rbuf,
+               int recv_count, MPI_Datatype recv_type,
+               MPI_Comm comm)
 {
   // MPI variables
   MPI_Status status;
index 9673350..3fc59a6 100644 (file)
@@ -13,10 +13,10 @@ namespace smpi{
 // now only work with power of two processes
 
 int
-Coll_allgather_rhv::allgather(const void *sbuf, int send_count,
-                              MPI_Datatype send_type, void *rbuf,
-                              int recv_count, MPI_Datatype recv_type,
-                              MPI_Comm comm)
+allgather__rhv(const void *sbuf, int send_count,
+               MPI_Datatype send_type, void *rbuf,
+               int recv_count, MPI_Datatype recv_type,
+               MPI_Comm comm)
 {
   MPI_Status status;
   MPI_Aint s_extent, r_extent;
@@ -46,8 +46,8 @@ Coll_allgather_rhv::allgather(const void *sbuf, int send_count,
 
   if (send_chunk != recv_chunk) {
     XBT_WARN("MPI_allgather_rhv use default MPI_allgather.");
-    Coll_allgather_default::allgather(sbuf, send_count, send_type, rbuf, recv_count,
-                              recv_type, comm);
+    allgather__default(sbuf, send_count, send_type, rbuf, recv_count,
+                       recv_type, comm);
     return MPI_SUCCESS;
   }
 
index fa619db..9716db3 100644 (file)
@@ -69,10 +69,10 @@ namespace smpi{
 
 
 int
-Coll_allgather_ring::allgather(const void *send_buff, int send_count,
-                               MPI_Datatype send_type, void *recv_buff,
-                               int recv_count, MPI_Datatype recv_type,
-                               MPI_Comm comm)
+allgather__ring(const void *send_buff, int send_count,
+                MPI_Datatype send_type, void *recv_buff,
+                int recv_count, MPI_Datatype recv_type,
+                MPI_Comm comm)
 {
 
   MPI_Aint extent;
index c11d643..8163bfb 100644 (file)
@@ -10,10 +10,10 @@ namespace simgrid{
 namespace smpi{
 
 
-int Coll_allgather_smp_simple::allgather(const void *send_buf, int scount,
-                                         MPI_Datatype stype, void *recv_buf,
-                                         int rcount, MPI_Datatype rtype,
-                                         MPI_Comm comm)
+int allgather__smp_simple(const void *send_buf, int scount,
+                          MPI_Datatype stype, void *recv_buf,
+                          int rcount, MPI_Datatype rtype,
+                          MPI_Comm comm)
 {
   int src, dst, comm_size, rank;
   comm_size = comm->size();
index 0536c32..06332d5 100644 (file)
@@ -72,11 +72,11 @@ namespace smpi{
 
 
 int
-Coll_allgather_spreading_simple::allgather(const void *send_buff, int send_count,
-                                           MPI_Datatype send_type,
-                                           void *recv_buff, int recv_count,
-                                           MPI_Datatype recv_type,
-                                           MPI_Comm comm)
+allgather__spreading_simple(const void *send_buff, int send_count,
+                            MPI_Datatype send_type,
+                            void *recv_buff, int recv_count,
+                            MPI_Datatype recv_type,
+                            MPI_Comm comm)
 {
   MPI_Aint extent;
   int i, src, dst, rank, num_procs, num_reqs;
index d3de949..d6f9e51 100644 (file)
@@ -10,10 +10,10 @@ namespace simgrid{
 namespace smpi{
 
 // Allgather - gather/bcast algorithm
-int Coll_allgatherv_GB::allgatherv(const void *send_buff, int send_count,
-                                 MPI_Datatype send_type, void *recv_buff,
-                                 const int *recv_counts, const int *recv_disps, MPI_Datatype recv_type,
-                                 MPI_Comm comm)
+int allgatherv__GB(const void *send_buff, int send_count,
+                   MPI_Datatype send_type, void *recv_buff,
+                   const int *recv_counts, const int *recv_disps, MPI_Datatype recv_type,
+                   MPI_Comm comm)
 {
   Colls::gatherv(send_buff, send_count, send_type, recv_buff, recv_counts, recv_disps, recv_type, 0, comm);
   int num_procs, i, current, max = 0;
index 1434b0e..0087dd7 100644 (file)
@@ -13,7 +13,7 @@
 namespace simgrid{
 namespace smpi{
 
-int Coll_allgatherv_mpich_rdb::allgatherv (
+int allgatherv__mpich_rdb(
   const void *sendbuf,
   int sendcount,
   MPI_Datatype sendtype,
index 155b24f..7855b11 100644 (file)
 namespace simgrid{
 namespace smpi{
 
-int
-Coll_allgatherv_mpich_ring::allgatherv(const void *sendbuf, int sendcount,
-    MPI_Datatype send_type, void *recvbuf,
-    const int *recvcounts, const int *displs, MPI_Datatype recvtype,
-    MPI_Comm comm)
+int allgatherv__mpich_ring(const void *sendbuf, int sendcount,
+                           MPI_Datatype send_type, void *recvbuf,
+                           const int *recvcounts, const int *displs, MPI_Datatype recvtype,
+                           MPI_Comm comm)
 {
 
   char * sbuf = NULL, * rbuf = NULL;
index 91d9977..dae1b2d 100644 (file)
  *         [6]    [6]    [6]    [6]    [6]    [6]    [6]
  */
 
-namespace simgrid{
-namespace smpi{
-
-int Coll_allgatherv_ompi_bruck::allgatherv(const void *sbuf, int scount,
-                                           MPI_Datatype sdtype,
-                                           void *rbuf, const int *rcounts,
-                                           const int *rdispls,
-                                           MPI_Datatype rdtype,
-                                           MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+
+int allgatherv__ompi_bruck(const void *sbuf, int scount,
+                           MPI_Datatype sdtype,
+                           void *rbuf, const int *rcounts,
+                           const int *rdispls,
+                           MPI_Datatype rdtype,
+                           MPI_Comm comm)
 {
    int sendto, recvfrom, blockcount, i;
    unsigned int distance;
index 74542de..d026ec5 100644 (file)
@@ -69,11 +69,11 @@ namespace simgrid{
 namespace smpi{
 
 int
-Coll_allgatherv_ompi_neighborexchange::allgatherv(const void *sbuf, int scount,
-                                                  MPI_Datatype sdtype,
-                                                  void* rbuf, const int *rcounts, const int *rdispls,
-                                                  MPI_Datatype rdtype,
-                                                  MPI_Comm comm)
+allgatherv__ompi_neighborexchange(const void *sbuf, int scount,
+                                  MPI_Datatype sdtype,
+                                  void* rbuf, const int *rcounts, const int *rdispls,
+                                  MPI_Datatype rdtype,
+                                  MPI_Comm comm)
 {
     int line = -1;
     int rank, size;
@@ -89,10 +89,9 @@ Coll_allgatherv_ompi_neighborexchange::allgatherv(const void *sbuf, int scount,
     rank = comm->rank();
 
     if (size % 2) {
-        XBT_DEBUG(
-                     "coll:tuned:allgatherv_ompi_neighborexchange WARNING: odd size %d, switching to ring algorithm",
+        XBT_DEBUG("allgatherv__ompi_neighborexchange WARNING: odd size %d, switching to ring algorithm",
                      size);
-        return Coll_allgatherv_ring::allgatherv(sbuf, scount, sdtype,
+        return allgatherv__ring(sbuf, scount, sdtype,
                                                      rbuf, rcounts,
                                                      rdispls, rdtype,
                                                      comm);
index f721970..7bf4271 100644 (file)
@@ -69,10 +69,10 @@ namespace simgrid{
 namespace smpi{
 
 int
-Coll_allgatherv_pair::allgatherv(const void *send_buff, int send_count,
-                               MPI_Datatype send_type, void *recv_buff,
-                               const int *recv_counts, const int *recv_disps, MPI_Datatype recv_type,
-                               MPI_Comm comm)
+allgatherv__pair(const void *send_buff, int send_count,
+                 MPI_Datatype send_type, void *recv_buff,
+                 const int *recv_counts, const int *recv_disps, MPI_Datatype recv_type,
+                 MPI_Comm comm)
 {
 
   MPI_Aint extent;
index d6a9bec..851c6c4 100644 (file)
@@ -68,10 +68,10 @@ namespace simgrid{
 namespace smpi{
 
 int
-Coll_allgatherv_ring::allgatherv(const void *send_buff, int send_count,
-                               MPI_Datatype send_type, void *recv_buff,
-                               const int *recv_counts, const int *recv_disps, MPI_Datatype recv_type,
-                               MPI_Comm comm)
+allgatherv__ring(const void *send_buff, int send_count,
+                 MPI_Datatype send_type, void *recv_buff,
+                 const int *recv_counts, const int *recv_disps, MPI_Datatype recv_type,
+                 MPI_Comm comm)
 {
 
   MPI_Aint extent;
index 9df5ace..5cd9bb6 100644 (file)
 */
 
 //#include <star-reduction.c>
-namespace simgrid{
-namespace smpi{
-int
-Coll_allreduce_lr::allreduce(const void *sbuf, void *rbuf, int rcount,
-                             MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int allreduce__lr(const void *sbuf, void *rbuf, int rcount,
+                  MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
 {
   int tag = COLL_TAG_ALLREDUCE;
   MPI_Status status;
@@ -40,7 +39,7 @@ Coll_allreduce_lr::allreduce(const void *sbuf, void *rbuf, int rcount,
   /* when communication size is smaller than number of process (not support) */
   if (rcount < size) {
     XBT_WARN("MPI_allreduce_lr use default MPI_allreduce.");
-    Coll_allreduce_default::allreduce(sbuf, rbuf, rcount, dtype, op, comm);
+    allreduce__default(sbuf, rbuf, rcount, dtype, op, comm);
     return MPI_SUCCESS;
   }
 
index 5c29b30..cbfdaa7 100644 (file)
 #include "../colls_private.hpp"
 #include <algorithm>
 
-namespace simgrid{
-namespace smpi{
-int Coll_allreduce_mvapich2_rs::allreduce(const void *sendbuf,
-                            void *recvbuf,
-                            int count,
-                            MPI_Datatype datatype,
-                            MPI_Op op, MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int allreduce__mvapich2_rs(const void *sendbuf,
+                           void *recvbuf,
+                           int count,
+                           MPI_Datatype datatype,
+                           MPI_Op op, MPI_Comm comm)
 {
     int mpi_errno = MPI_SUCCESS;
     int newrank = 0;
index 3250168..61ee55d 100644 (file)
@@ -37,8 +37,8 @@
 
 #include "../colls_private.hpp"
 
-#define MPIR_Allreduce_pt2pt_rd_MV2 Coll_allreduce_rdb::allreduce
-#define MPIR_Allreduce_pt2pt_rs_MV2 Coll_allreduce_mvapich2_rs::allreduce
+#define MPIR_Allreduce_pt2pt_rd_MV2 allreduce__rdb
+#define MPIR_Allreduce_pt2pt_rs_MV2 allreduce__mvapich2_rs
 
 extern int (*MV2_Allreducection)(const void *sendbuf,
     void *recvbuf,
@@ -78,7 +78,7 @@ static  int MPIR_Allreduce_reduce_shmem_MV2(const void *sendbuf,
 
 
 /* general two level allreduce helper function */
-int Coll_allreduce_mvapich2_two_level::allreduce(const void *sendbuf,
+int allreduce__mvapich2_two_level(const void *sendbuf,
                              void *recvbuf,
                              int count,
                              MPI_Datatype datatype,
@@ -92,9 +92,9 @@ int Coll_allreduce_mvapich2_two_level::allreduce(const void *sendbuf,
 
     //if not set (use of the algo directly, without mvapich2 selector)
     if(MV2_Allreduce_intra_function==NULL)
-      MV2_Allreduce_intra_function = Coll_allreduce_mpich::allreduce;
+      MV2_Allreduce_intra_function = allreduce__mpich;
     if(MV2_Allreducection==NULL)
-      MV2_Allreducection = Coll_allreduce_rdb::allreduce;
+      MV2_Allreducection = allreduce__rdb;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
       comm->init_smp();
index 48ce160..dfa142a 100644 (file)
 
 #include "../colls_private.hpp"
 
-namespace simgrid{
-namespace smpi{
-int
-Coll_allreduce_ompi_ring_segmented::allreduce(const void *sbuf, void *rbuf, int count,
-                                               MPI_Datatype dtype,
-                                               MPI_Op op,
-                                               MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int allreduce__ompi_ring_segmented(const void *sbuf, void *rbuf, int count,
+                                   MPI_Datatype dtype,
+                                   MPI_Op op,
+                                   MPI_Comm comm)
 {
    int ret = MPI_SUCCESS;
    int line;
@@ -205,8 +204,7 @@ Coll_allreduce_ompi_ring_segmented::allreduce(const void *sbuf, void *rbuf, int
    /* Special case for count less than size * segcount - use regular ring */
    if (count < size * segcount) {
       XBT_DEBUG( "coll:tuned:allreduce_ring_segmented rank %d/%d, count %d, switching to regular ring", rank, size, count);
-      return (Coll_allreduce_lr::allreduce(sbuf, rbuf, count, dtype, op,
-                                                   comm));
+      return (allreduce__lr(sbuf, rbuf, count, dtype, op, comm));
    }
 
    /* Determine the number of phases of the algorithm */
index d9f4d2c..209fbf4 100644 (file)
@@ -7,9 +7,9 @@
 #include "../colls_private.hpp"
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_rab_rdb::allreduce(const void *sbuff, void *rbuff, int count,
-                                      MPI_Datatype dtype, MPI_Op op,
-                                      MPI_Comm comm)
+int allreduce__rab_rdb(const void *sbuff, void *rbuff, int count,
+                       MPI_Datatype dtype, MPI_Op op,
+                       MPI_Comm comm)
 {
   int tag = COLL_TAG_ALLREDUCE;
   unsigned int mask, pof2, i, recv_idx, last_idx, send_idx, send_cnt;
index 34be1cd..355b6fe 100644 (file)
@@ -9,9 +9,9 @@
 namespace simgrid{
 namespace smpi{
 // NP pow of 2 for now
-int Coll_allreduce_rab1::allreduce(const void *sbuff, void *rbuff,
-                                   int count, MPI_Datatype dtype,
-                                   MPI_Op op, MPI_Comm comm)
+int allreduce__rab1(const void *sbuff, void *rbuff,
+                    int count, MPI_Datatype dtype,
+                    MPI_Op op, MPI_Comm comm)
 {
   MPI_Status status;
   MPI_Aint extent;
index ae9f3a2..b060f47 100644 (file)
@@ -10,9 +10,9 @@
 namespace simgrid{
 namespace smpi{
 // this requires that count >= NP
-int Coll_allreduce_rab2::allreduce(const void *sbuff, void *rbuff,
-                                   int count, MPI_Datatype dtype,
-                                   MPI_Op op, MPI_Comm comm)
+int allreduce__rab2(const void *sbuff, void *rbuff,
+                    int count, MPI_Datatype dtype,
+                    MPI_Op op, MPI_Comm comm)
 {
   MPI_Aint s_extent;
   int i, rank, nprocs;
index ba19511..e0859ce 100644 (file)
@@ -8,8 +8,8 @@
 //#include <star-reduction.c>
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_rdb::allreduce(const void *sbuff, void *rbuff, int count,
-                                  MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
+int allreduce__rdb(const void *sbuff, void *rbuff, int count,
+                   MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
 {
   int nprocs, rank, tag = COLL_TAG_ALLREDUCE;
   int mask, dst, pof2, newrank, rem, newdst;
index 1f5863c..8c967ce 100644 (file)
@@ -7,9 +7,9 @@
 #include "../colls_private.hpp"
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_redbcast::allreduce(const void *buf, void *buf2, int count,
-                                       MPI_Datatype datatype, MPI_Op op,
-                                       MPI_Comm comm)
+int allreduce__redbcast(const void *buf, void *buf2, int count,
+                        MPI_Datatype datatype, MPI_Op op,
+                        MPI_Comm comm)
 {
   Colls::reduce(buf, buf2, count, datatype, op, 0, comm);
   Colls::bcast(buf2, count, datatype, 0, comm);
index eb85fbd..e772a91 100644 (file)
@@ -38,10 +38,10 @@ This fucntion performs all-reduce operation as follow. ** in a pipeline fashion
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_smp_binomial_pipeline::allreduce(const void *send_buf,
-                                                    void *recv_buf, int count,
-                                                    MPI_Datatype dtype,
-                                                    MPI_Op op, MPI_Comm comm)
+int allreduce__smp_binomial_pipeline(const void *send_buf,
+                                     void *recv_buf, int count,
+                                     MPI_Datatype dtype,
+                                     MPI_Op op, MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLREDUCE;
index cea1643..81e6b9d 100644 (file)
@@ -28,9 +28,9 @@ This fucntion performs all-reduce operation as follow.
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_smp_binomial::allreduce(const void *send_buf, void *recv_buf,
-                                           int count, MPI_Datatype dtype,
-                                           MPI_Op op, MPI_Comm comm)
+int allreduce__smp_binomial(const void *send_buf, void *recv_buf,
+                            int count, MPI_Datatype dtype,
+                            MPI_Op op, MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLREDUCE;
index 12f6448..eb6c76a 100644 (file)
@@ -27,9 +27,9 @@ This fucntion performs all-reduce operation as follow.
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_smp_rdb::allreduce(const void *send_buf, void *recv_buf, int count,
-                                      MPI_Datatype dtype, MPI_Op op,
-                                      MPI_Comm comm)
+int allreduce__smp_rdb(const void *send_buf, void *recv_buf, int count,
+                       MPI_Datatype dtype, MPI_Op op,
+                       MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLREDUCE;
index fd5718f..caf0808 100644 (file)
@@ -16,9 +16,9 @@ This fucntion performs all-reduce operation as follow.
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_smp_rsag_lr::allreduce(const void *send_buf, void *recv_buf,
-                                          int count, MPI_Datatype dtype,
-                                          MPI_Op op, MPI_Comm comm)
+int allreduce__smp_rsag_lr(const void *send_buf, void *recv_buf,
+                           int count, MPI_Datatype dtype,
+                           MPI_Op op, MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLREDUCE;
index b4bfacc..2b40358 100644 (file)
@@ -20,9 +20,9 @@ This fucntion performs all-reduce operation as follow.
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_smp_rsag_rab::allreduce(const void *sbuf, void *rbuf, int count,
-                                           MPI_Datatype dtype, MPI_Op op,
-                                           MPI_Comm comm)
+int allreduce__smp_rsag_rab(const void *sbuf, void *rbuf, int count,
+                            MPI_Datatype dtype, MPI_Op op,
+                            MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLREDUCE;
index 06d5e41..c1316e8 100644 (file)
@@ -15,9 +15,9 @@ This fucntion performs all-reduce operation as follow.
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_smp_rsag::allreduce(const void *send_buf, void *recv_buf,
-                                       int count, MPI_Datatype dtype, MPI_Op op,
-                                       MPI_Comm comm)
+int allreduce__smp_rsag(const void *send_buf, void *recv_buf,
+                        int count, MPI_Datatype dtype, MPI_Op op,
+                        MPI_Comm comm)
 {
   int comm_size, rank;
   int tag = COLL_TAG_ALLREDUCE;
index 918a242..7da2954 100644 (file)
@@ -55,10 +55,10 @@ static int alltoall_check_is_2dmesh(int num, int *i, int *j)
 namespace simgrid{
 namespace smpi{
 
-int Coll_alltoall_2dmesh::alltoall(const void *send_buff, int send_count,
-                                    MPI_Datatype send_type,
-                                    void *recv_buff, int recv_count,
-                                    MPI_Datatype recv_type, MPI_Comm comm)
+int alltoall__2dmesh(const void *send_buff, int send_count,
+                     MPI_Datatype send_type,
+                     void *recv_buff, int recv_count,
+                     MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint extent;
index 4bf3d39..485d7b1 100644 (file)
@@ -47,10 +47,10 @@ static int alltoall_check_is_3dmesh(int num, int *i, int *j, int *k)
 }
 namespace simgrid{
 namespace smpi{
-int Coll_alltoall_3dmesh::alltoall(const void *send_buff, int send_count,
-                                    MPI_Datatype send_type,
-                                    void *recv_buff, int recv_count,
-                                    MPI_Datatype recv_type, MPI_Comm comm)
+int alltoall__3dmesh(const void *send_buff, int send_count,
+                     MPI_Datatype send_type,
+                     void *recv_buff, int recv_count,
+                     MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Aint extent;
   MPI_Status status;
index c8aeff2..799bccc 100644 (file)
@@ -13,8 +13,8 @@ namespace simgrid{
 namespace smpi{
 
 
-int Coll_alltoall_basic_linear::alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                                          void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
+int alltoall__basic_linear(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+                           void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
   int system_tag = COLL_TAG_ALLTOALL;
   int i;
index 568ee25..0f001cd 100644 (file)
@@ -32,10 +32,10 @@ namespace smpi{
 
 
 int
-Coll_alltoall_bruck::alltoall(const void *send_buff, int send_count,
-                               MPI_Datatype send_type, void *recv_buff,
-                               int recv_count, MPI_Datatype recv_type,
-                               MPI_Comm comm)
+alltoall__bruck(const void *send_buff, int send_count,
+                MPI_Datatype send_type, void *recv_buff,
+                int recv_count, MPI_Datatype recv_type,
+                MPI_Comm comm)
 {
   MPI_Status status;
   MPI_Aint extent;
index e4dc8a0..0930b20 100644 (file)
 #include "../colls_private.hpp"
 namespace simgrid{
 namespace smpi{
-int Coll_alltoall_mvapich2_scatter_dest::alltoall(
-                            const void *sendbuf,
-                            int sendcount,
-                            MPI_Datatype sendtype,
-                            void *recvbuf,
-                            int recvcount,
-                            MPI_Datatype recvtype,
-                            MPI_Comm comm)
+int alltoall__mvapich2_scatter_dest(const void *sendbuf,
+                                    int sendcount,
+                                    MPI_Datatype sendtype,
+                                    void *recvbuf,
+                                    int recvcount,
+                                    MPI_Datatype recvtype,
+                                    MPI_Comm comm)
 {
     int          comm_size, i, j;
     MPI_Aint     sendtype_extent = 0, recvtype_extent = 0;
index bcaaaf2..26b629d 100644 (file)
 namespace simgrid{
 namespace smpi{
 int
-Coll_alltoall_pair_light_barrier::alltoall(const void *send_buff, int send_count,
-                                            MPI_Datatype send_type,
-                                            void *recv_buff, int recv_count,
-                                            MPI_Datatype recv_type,
-                                            MPI_Comm comm)
+alltoall__pair_light_barrier(const void *send_buff, int send_count,
+                             MPI_Datatype send_type,
+                             void *recv_buff, int recv_count,
+                             MPI_Datatype recv_type,
+                             MPI_Comm comm)
 {
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
index 2dcf9e3..b113714 100644 (file)
 namespace simgrid{
 namespace smpi{
 int
-Coll_alltoall_pair_mpi_barrier::alltoall(const void *send_buff, int send_count,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, int recv_count,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+alltoall__pair_mpi_barrier(const void *send_buff, int send_count,
+                           MPI_Datatype send_type,
+                           void *recv_buff, int recv_count,
+                           MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index a440cd8..79c5133 100644 (file)
 namespace simgrid{
 namespace smpi{
 int
-Coll_alltoall_pair_one_barrier::alltoall(const void *send_buff, int send_count,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, int recv_count,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+alltoall__pair_one_barrier(const void *send_buff, int send_count,
+                           MPI_Datatype send_type,
+                           void *recv_buff, int recv_count,
+                           MPI_Datatype recv_type, MPI_Comm comm)
 {
 
   MPI_Aint send_chunk, recv_chunk;
index 25ba861..6b53837 100644 (file)
@@ -30,9 +30,9 @@
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int Coll_alltoall_pair_rma::alltoall(const void *send_buff, int send_count, MPI_Datatype send_type,
-                  void *recv_buff, int recv_count, MPI_Datatype recv_type,
-                  MPI_Comm comm)
+int alltoall__pair_rma(const void *send_buff, int send_count, MPI_Datatype send_type,
+                       void *recv_buff, int recv_count, MPI_Datatype recv_type,
+                       MPI_Comm comm)
 {
 
   MPI_Aint send_chunk, recv_chunk;
@@ -64,10 +64,10 @@ int Coll_alltoall_pair_rma::alltoall(const void *send_buff, int send_count, MPI_
 }
 
 
-int Coll_alltoall_pair::alltoall(const void *send_buff, int send_count,
-                                  MPI_Datatype send_type,
-                                  void *recv_buff, int recv_count,
-                                  MPI_Datatype recv_type, MPI_Comm comm)
+int alltoall__pair(const void *send_buff, int send_count,
+                   MPI_Datatype send_type,
+                   void *recv_buff, int recv_count,
+                   MPI_Datatype recv_type, MPI_Comm comm)
 {
 
   MPI_Aint send_chunk, recv_chunk;
index 942288e..f073888 100644 (file)
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int Coll_alltoall_rdb::alltoall(const void *send_buff, int send_count,
-                                 MPI_Datatype send_type,
-                                 void *recv_buff, int recv_count,
-                                 MPI_Datatype recv_type, MPI_Comm comm)
+int alltoall__rdb(const void *send_buff, int send_count,
+                  MPI_Datatype send_type,
+                  void *recv_buff, int recv_count,
+                  MPI_Datatype recv_type, MPI_Comm comm)
 {
   /* MPI variables */
   MPI_Status status;
index 39fbde1..9c50d21 100644 (file)
 namespace simgrid{
 namespace smpi{
 int
-Coll_alltoall_ring_light_barrier::alltoall(const void *send_buff, int send_count,
-                                            MPI_Datatype send_type,
-                                            void *recv_buff, int recv_count,
-                                            MPI_Datatype recv_type,
-                                            MPI_Comm comm)
+alltoall__ring_light_barrier(const void *send_buff, int send_count,
+                             MPI_Datatype send_type,
+                             void *recv_buff, int recv_count,
+                             MPI_Datatype recv_type,
+                             MPI_Comm comm)
 {
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
index 2c61768..1d72cc6 100644 (file)
 namespace simgrid{
 namespace smpi{
 int
-Coll_alltoall_ring_mpi_barrier::alltoall(const void *send_buff, int send_count,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, int recv_count,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+alltoall__ring_mpi_barrier(const void *send_buff, int send_count,
+                           MPI_Datatype send_type,
+                           void *recv_buff, int recv_count,
+                           MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index c52d5c5..b184b18 100644 (file)
 namespace simgrid{
 namespace smpi{
 int
-Coll_alltoall_ring_one_barrier::alltoall(const void *send_buff, int send_count,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, int recv_count,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+alltoall__ring_one_barrier(const void *send_buff, int send_count,
+                           MPI_Datatype send_type,
+                           void *recv_buff, int recv_count,
+                           MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index 6d51492..7068328 100644 (file)
  * Author: Ahmad Faraj
 
  ****************************************************************************/
-namespace simgrid{
-namespace smpi{
-int
-Coll_alltoall_ring::alltoall(const void *send_buff, int send_count,
-                              MPI_Datatype send_type, void *recv_buff,
-                              int recv_count, MPI_Datatype recv_type,
-                              MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int alltoall__ring(const void *send_buff, int send_count,
+                   MPI_Datatype send_type, void *recv_buff,
+                   int recv_count, MPI_Datatype recv_type,
+                   MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index 8b3794f..d32380b 100644 (file)
  **/
 namespace simgrid{
 namespace smpi{
-int Coll_alltoallv_bruck::alltoallv(const void *sendbuf, const int *sendcounts, const int *senddisps,
-                                   MPI_Datatype sendtype, void *recvbuf,
-                                   const int *recvcounts,const int *recvdisps, MPI_Datatype recvtype,
-                                   MPI_Comm comm)
+int alltoallv__bruck(const void *sendbuf, const int *sendcounts, const int *senddisps,
+                     MPI_Datatype sendtype, void *recvbuf,
+                     const int *recvcounts,const int *recvdisps, MPI_Datatype recvtype,
+                     MPI_Comm comm)
 {
   int system_tag = COLL_TAG_ALLTOALLV;
   int i, rank, size, err, count;
index de140a3..d317ed5 100644 (file)
  */
 namespace simgrid{
 namespace smpi{
-int
-Coll_alltoallv_ompi_basic_linear::alltoallv(const void *sbuf, const int *scounts, const int *sdisps,
-                                            MPI_Datatype sdtype,
-                                            void *rbuf, const int *rcounts, const int *rdisps,
-                                            MPI_Datatype rdtype,
-                                            MPI_Comm comm)
+int alltoallv__ompi_basic_linear(const void *sbuf, const int *scounts, const int *sdisps,
+                                 MPI_Datatype sdtype,
+                                 void *rbuf, const int *rcounts, const int *rdisps,
+                                 MPI_Datatype rdtype,
+                                 MPI_Comm comm)
 {
     int i, size, rank;
     char *psnd, *prcv;
index 448ca1a..655c4b1 100644 (file)
  * Author: Ahmad Faraj
 
  ****************************************************************************/
-namespace simgrid{
-namespace smpi{
-int
-Coll_alltoallv_pair_light_barrier::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                            MPI_Datatype send_type,
-                                            void *recv_buff, const int *recv_counts, const int *recv_disps,
-                                            MPI_Datatype recv_type,
-                                            MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int alltoallv__pair_light_barrier(const void *send_buff, const int *send_counts, const int *send_disps,
+                                  MPI_Datatype send_type,
+                                  void *recv_buff, const int *recv_counts, const int *recv_disps,
+                                  MPI_Datatype recv_type,
+                                  MPI_Comm comm)
 {
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
index b63b487..68d9852 100644 (file)
  * Author: Ahmad Faraj
 
  ****************************************************************************/
-namespace simgrid{
-namespace smpi{
-int
-Coll_alltoallv_pair_mpi_barrier::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, const int *recv_counts, const int *recv_disps,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int alltoallv__pair_mpi_barrier(const void *send_buff, const int *send_counts, const int *send_disps,
+                                MPI_Datatype send_type,
+                                void *recv_buff, const int *recv_counts, const int *recv_disps,
+                                MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index 3a78afe..7ef7a10 100644 (file)
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int
-Coll_alltoallv_pair_one_barrier::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff,  const int *recv_counts, const int *recv_disps,                                                                                  MPI_Datatype recv_type, MPI_Comm comm)
+int alltoallv__pair_one_barrier(const void *send_buff, const int *send_counts, const int *send_disps,
+                                MPI_Datatype send_type,
+                                void *recv_buff,  const int *recv_counts, const int *recv_disps,                                                                                  MPI_Datatype recv_type, MPI_Comm comm)
 {
 
   MPI_Aint send_chunk, recv_chunk;
index 1492073..ff7ed2a 100644 (file)
  * Author: Ahmad Faraj
 
  ****************************************************************************/
-namespace simgrid{
-namespace smpi{
-int Coll_alltoallv_pair::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                  MPI_Datatype send_type,
-                                  void *recv_buff, const int *recv_counts, const int *recv_disps,
-                                  MPI_Datatype recv_type, MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int alltoallv__pair(const void *send_buff, const int *send_counts, const int *send_disps,
+                    MPI_Datatype send_type,
+                    void *recv_buff, const int *recv_counts, const int *recv_disps,
+                    MPI_Datatype recv_type, MPI_Comm comm)
 {
 
   MPI_Aint send_chunk, recv_chunk;
index 87ccfdc..05d0ada 100644 (file)
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int
-Coll_alltoallv_ring_light_barrier::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                            MPI_Datatype send_type,
-                                            void *recv_buff, const int *recv_counts, const int *recv_disps,
-                                            MPI_Datatype recv_type,
-                                            MPI_Comm comm)
+int alltoallv__ring_light_barrier(const void *send_buff, const int *send_counts, const int *send_disps,
+                                  MPI_Datatype send_type,
+                                  void *recv_buff, const int *recv_counts, const int *recv_disps,
+                                  MPI_Datatype recv_type,
+                                  MPI_Comm comm)
 {
   MPI_Aint send_chunk, recv_chunk;
   MPI_Status s;
index 69202b4..44a32f4 100644 (file)
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int
-Coll_alltoallv_ring_mpi_barrier::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, const int *recv_counts, const int *recv_disps,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+int alltoallv__ring_mpi_barrier(const void *send_buff, const int *send_counts, const int *send_disps,
+                                MPI_Datatype send_type,
+                                void *recv_buff, const int *recv_counts, const int *recv_disps,
+                                MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index 09e712d..f265fba 100644 (file)
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int
-Coll_alltoallv_ring_one_barrier::alltoallv(const void *send_buff, const int *send_counts, const int *send_disps,
-                                          MPI_Datatype send_type,
-                                          void *recv_buff, const int *recv_counts, const int *recv_disps,
-                                          MPI_Datatype recv_type, MPI_Comm comm)
+int alltoallv__ring_one_barrier(const void *send_buff, const int *send_counts, const int *send_disps,
+                                MPI_Datatype send_type,
+                                void *recv_buff, const int *recv_counts, const int *recv_disps,
+                                MPI_Datatype recv_type, MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index fbb0e53..53969d3 100644 (file)
@@ -27,9 +27,9 @@
  ****************************************************************************/
 namespace simgrid{
 namespace smpi{
-int Coll_alltoallv_ring::alltoallv(const void* send_buff, const int* send_counts, const int* send_disps, MPI_Datatype send_type,
-                                   void* recv_buff, const int* recv_counts, const int* recv_disps, MPI_Datatype recv_type,
-                                   MPI_Comm comm)
+int alltoallv__ring(const void* send_buff, const int* send_counts, const int* send_disps, MPI_Datatype send_type,
+                    void* recv_buff, const int* recv_counts, const int* recv_disps, MPI_Datatype recv_type,
+                    MPI_Comm comm)
 {
   MPI_Status s;
   MPI_Aint send_chunk, recv_chunk;
index cf37e01..a0e3027 100644 (file)
@@ -17,7 +17,7 @@
 
 namespace simgrid{
 namespace smpi{
-int Coll_barrier_mpich_smp::barrier(MPI_Comm comm)
+int barrier__mpich_smp(MPI_Comm comm)
 {
     int mpi_errno = MPI_SUCCESS;
     int mpi_errno_ret = MPI_SUCCESS;
@@ -32,7 +32,7 @@ int Coll_barrier_mpich_smp::barrier(MPI_Comm comm)
     local_rank = shmem_comm->rank();
     /* do the intranode barrier on all nodes */
     if (shmem_comm != NULL) {
-        mpi_errno = Coll_barrier_mpich::barrier(shmem_comm);
+        mpi_errno = barrier__mpich(shmem_comm);
         if (mpi_errno) {
           mpi_errno_ret+=mpi_errno;
         }
@@ -41,7 +41,7 @@ int Coll_barrier_mpich_smp::barrier(MPI_Comm comm)
     leader_comm = comm->get_leaders_comm();
     /* do the barrier across roots of all nodes */
     if (leader_comm != NULL && local_rank == 0) {
-        mpi_errno = Coll_barrier_mpich::barrier(leader_comm);
+        mpi_errno = barrier__mpich(leader_comm);
         if (mpi_errno) {
           mpi_errno_ret+=mpi_errno;
         }
@@ -52,7 +52,7 @@ int Coll_barrier_mpich_smp::barrier(MPI_Comm comm)
      * anything) */
     if (shmem_comm != NULL) {
         int i = 0;
-        mpi_errno = Coll_bcast_mpich::bcast(&i, 1, MPI_BYTE, 0, shmem_comm);
+        mpi_errno = bcast__mpich(&i, 1, MPI_BYTE, 0, shmem_comm);
         if (mpi_errno) {
           mpi_errno_ret+=mpi_errno;
         }
index 9d9c782..e877c7d 100644 (file)
@@ -43,7 +43,7 @@
 #include "../colls_private.hpp"
 namespace simgrid{
 namespace smpi{
-int Coll_barrier_mvapich2_pair::barrier(MPI_Comm comm)
+int barrier__mvapich2_pair(MPI_Comm comm)
 {
 
     int size, rank;
index e87e5fd..802481f 100644 (file)
@@ -42,9 +42,9 @@
  * synchronous guarantee made by last ring of sends are synchronous
  *
  */
-namespace simgrid{
-namespace smpi{
-int Coll_barrier_ompi_doublering::barrier(MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int barrier__ompi_doublering(MPI_Comm comm)
 {
     int rank, size;
     int left, right;
@@ -104,7 +104,7 @@ int Coll_barrier_ompi_doublering::barrier(MPI_Comm comm)
  * To make synchronous, uses sync sends and sync sendrecvs
  */
 
-int Coll_barrier_ompi_recursivedoubling::barrier(MPI_Comm comm)
+int barrier__ompi_recursivedoubling(MPI_Comm comm)
 {
     int rank, size, adjsize;
     int mask, remote;
@@ -178,7 +178,7 @@ int Coll_barrier_ompi_recursivedoubling::barrier(MPI_Comm comm)
  * To make synchronous, uses sync sends and sync sendrecvs
  */
 
-int Coll_barrier_ompi_bruck::barrier(MPI_Comm comm)
+int barrier__ompi_bruck(MPI_Comm comm)
 {
     int rank, size;
     int distance, to, from;
@@ -210,7 +210,7 @@ int Coll_barrier_ompi_bruck::barrier(MPI_Comm comm)
  * To make synchronous, uses sync sends and sync sendrecvs
  */
 /* special case for two processes */
-int Coll_barrier_ompi_two_procs::barrier(MPI_Comm comm)
+int barrier__ompi_two_procs(MPI_Comm comm)
 {
     int remote;
 
@@ -242,7 +242,7 @@ int Coll_barrier_ompi_two_procs::barrier(MPI_Comm comm)
 
 /* copied function (with appropriate renaming) starts here */
 
-int Coll_barrier_ompi_basic_linear::barrier(MPI_Comm comm)
+int barrier__ompi_basic_linear(MPI_Comm comm)
 {
     int i;
     int size = comm->size();
@@ -292,7 +292,7 @@ int Coll_barrier_ompi_basic_linear::barrier(MPI_Comm comm)
  * Another recursive doubling type algorithm, but in this case
  * we go up the tree and back down the tree.
  */
-int Coll_barrier_ompi_tree::barrier(MPI_Comm comm)
+int barrier__ompi_tree(MPI_Comm comm)
 {
     int rank, size, depth;
     int jump, partner;
index 8decb7b..632eda4 100644 (file)
@@ -9,8 +9,8 @@
 int bcast_NTSB_segment_size_in_byte = 8192;
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_NTSB::bcast(void *buf, int count, MPI_Datatype datatype,
-                               int root, MPI_Comm comm)
+int bcast__NTSB(void *buf, int count, MPI_Datatype datatype,
+                int root, MPI_Comm comm)
 {
   int tag = COLL_TAG_BCAST;
   MPI_Status status;
index 57857c0..0ceb9d8 100644 (file)
@@ -13,8 +13,8 @@ static int bcast_NTSL_segment_size_in_byte = 8192;
 */
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_NTSL_Isend::bcast(void *buf, int count, MPI_Datatype datatype,
-                               int root, MPI_Comm comm)
+int bcast__NTSL_Isend(void *buf, int count, MPI_Datatype datatype,
+                      int root, MPI_Comm comm)
 {
   int tag = COLL_TAG_BCAST;
   MPI_Status status;
index 97e55c8..115abd9 100644 (file)
@@ -13,8 +13,8 @@ static int bcast_NTSL_segment_size_in_byte = 8192;
 */
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_NTSL::bcast(void *buf, int count, MPI_Datatype datatype,
-                               int root, MPI_Comm comm)
+int bcast__NTSL(void *buf, int count, MPI_Datatype datatype,
+                int root, MPI_Comm comm)
 {
   int tag = COLL_TAG_BCAST;
   MPI_Status status;
index 3ce7918..259b90d 100644 (file)
@@ -9,9 +9,9 @@
 int bcast_SMP_binary_segment_byte = 8192;
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_SMP_binary::bcast(void *buf, int count,
-                                     MPI_Datatype datatype, int root,
-                                     MPI_Comm comm)
+int bcast__SMP_binary(void *buf, int count,
+                      MPI_Datatype datatype, int root,
+                      MPI_Comm comm)
 {
   int tag = COLL_TAG_BCAST;
   MPI_Status status;
@@ -31,8 +31,7 @@ int Coll_bcast_SMP_binary::bcast(void *buf, int count,
     host_num_core = comm->get_intra_comm()->size();
   }else{
     //implementation buggy in this case
-    return Coll_bcast_mpich::bcast( buf , count, datatype,
-              root, comm);
+    return bcast__mpich(buf , count, datatype, root, comm);
   }
 
   int segment = bcast_SMP_binary_segment_byte / extent;
index d5b1481..986bf92 100644 (file)
@@ -7,9 +7,9 @@
 #include "../colls_private.hpp"
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_SMP_binomial::bcast(void *buf, int count,
-                                       MPI_Datatype datatype, int root,
-                                       MPI_Comm comm)
+int bcast__SMP_binomial(void *buf, int count,
+                        MPI_Datatype datatype, int root,
+                        MPI_Comm comm)
 {
   int mask = 1;
   int size;
@@ -28,8 +28,7 @@ int Coll_bcast_SMP_binomial::bcast(void *buf, int count,
     num_core = comm->get_intra_comm()->size();
   }else{
     //implementation buggy in this case
-    return Coll_bcast_mpich::bcast( buf , count, datatype,
-              root, comm);
+    return bcast__mpich(buf, count, datatype, root, comm);
   }
 
   int to_intra, to_inter;
index a8c6bec..ea576fe 100644 (file)
@@ -9,9 +9,9 @@
 int bcast_SMP_linear_segment_byte = 8192;
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_SMP_linear::bcast(void *buf, int count,
-                                     MPI_Datatype datatype, int root,
-                                     MPI_Comm comm)
+int bcast__SMP_linear(void *buf, int count,
+                      MPI_Datatype datatype, int root,
+                      MPI_Comm comm)
 {
   int tag = COLL_TAG_BCAST;
   MPI_Status status;
@@ -31,8 +31,7 @@ int Coll_bcast_SMP_linear::bcast(void *buf, int count,
     num_core = comm->get_intra_comm()->size();
   }else{
     //implementation buggy in this case
-    return Coll_bcast_mpich::bcast( buf , count, datatype,
-              root, comm);
+    return bcast__mpich(buf, count, datatype, root, comm);
   }
 
   int segment = bcast_SMP_linear_segment_byte / extent;
@@ -52,7 +51,7 @@ int Coll_bcast_SMP_linear::bcast(void *buf, int count,
   // call native when MPI communication size is too small
   if (size <= num_core) {
     XBT_WARN("MPI_bcast_SMP_linear use default MPI_bcast.");
-    Coll_bcast_default::bcast(buf, count, datatype, root, comm);
+    bcast__default(buf, count, datatype, root, comm);
     return MPI_SUCCESS;
   }
   // if root is not zero send to rank zero first
index 46e6125..6f1dc20 100644 (file)
@@ -18,9 +18,9 @@ int bcast_arrival_pattern_aware_wait_segment_size_in_byte = 8192;
 namespace simgrid{
 namespace smpi{
 /* Non-topology-specific pipelined linear-bcast function */
-int Coll_bcast_arrival_pattern_aware_wait::bcast(void *buf, int count,
-                                                     MPI_Datatype datatype,
-                                                     int root, MPI_Comm comm)
+int bcast__arrival_pattern_aware_wait(void *buf, int count,
+                                      MPI_Datatype datatype,
+                                      int root, MPI_Comm comm)
 {
   MPI_Status status;
   MPI_Request request;
index 1552b72..fab160a 100644 (file)
@@ -14,9 +14,9 @@ static int bcast_NTSL_segment_size_in_byte = 8192;
 namespace simgrid{
 namespace smpi{
 /* Non-topology-specific pipelined linear-bcast function */
-int Coll_bcast_arrival_pattern_aware::bcast(void *buf, int count,
-                                                MPI_Datatype datatype, int root,
-                                                MPI_Comm comm)
+int bcast__arrival_pattern_aware(void *buf, int count,
+                                 MPI_Datatype datatype, int root,
+                                 MPI_Comm comm)
 {
   int tag = -COLL_TAG_BCAST;
   MPI_Status status;
index 7891c76..0e13cfa 100644 (file)
@@ -16,9 +16,9 @@
 namespace simgrid{
 namespace smpi{
 /* Non-topology-specific pipelined linear-bcast function */
-int Coll_bcast_arrival_scatter::bcast(void *buf, int count,
-                                          MPI_Datatype datatype, int root,
-                                          MPI_Comm comm)
+int bcast__arrival_scatter(void *buf, int count,
+                           MPI_Datatype datatype, int root,
+                           MPI_Comm comm)
 {
   int tag = -COLL_TAG_BCAST;//in order to use ANY_TAG, make this one positive
   int header_tag = -10;
index 251ed58..29d5a65 100644 (file)
@@ -67,12 +67,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * Author: MPIH / modified by Ahmad Faraj
 
  ****************************************************************************/
-namespace simgrid{
-namespace smpi{
-int
-Coll_bcast_binomial_tree::bcast(void *buff, int count,
-                                    MPI_Datatype data_type, int root,
-                                    MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int bcast__binomial_tree(void *buff, int count,
+                         MPI_Datatype data_type, int root,
+                         MPI_Comm comm)
 {
   int src, dst, rank, num_procs, mask, relative_rank;
   int tag = COLL_TAG_BCAST;
index 07e4384..2899d05 100644 (file)
@@ -7,12 +7,11 @@
 #include "../colls_private.hpp"
 
 int flattree_segment_in_byte = 8192;
-namespace simgrid{
-namespace smpi{
-int
-Coll_bcast_flattree_pipeline::bcast(void *buff, int count,
-                                        MPI_Datatype data_type, int root,
-                                        MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int bcast__flattree_pipeline(void *buff, int count,
+                             MPI_Datatype data_type, int root,
+                             MPI_Comm comm)
 {
   int i, j, rank, num_procs;
   int tag = COLL_TAG_BCAST;
@@ -26,7 +25,7 @@ Coll_bcast_flattree_pipeline::bcast(void *buff, int count,
   int increment = segment * extent;
   if (pipe_length==0) {
     XBT_WARN("MPI_bcast_flattree_pipeline use default MPI_bcast_flattree.");
-    return Coll_bcast_flattree::bcast(buff, count, data_type, root, comm);
+    return bcast__flattree(buff, count, data_type, root, comm);
   }
   rank = comm->rank();
   num_procs = comm->size();
index 175c875..5c73a9f 100644 (file)
@@ -5,11 +5,10 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "../colls_private.hpp"
-namespace simgrid{
-namespace smpi{
-int
-Coll_bcast_flattree::bcast(void *buff, int count, MPI_Datatype data_type,
-                               int root, MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int bcast__flattree(void *buff, int count, MPI_Datatype data_type,
+                    int root, MPI_Comm comm)
 {
   int i, rank, num_procs;
   int tag = COLL_TAG_BCAST;
index 8abda57..70239f6 100644 (file)
@@ -51,17 +51,17 @@ extern int mv2_intra_node_knomial_factor;
 extern int mv2_bcast_two_level_system_size;
 #define INTRA_NODE_ROOT 0
 
-#define MPIR_Pipelined_Bcast_Zcpy_MV2 Coll_bcast_mpich::bcast
-#define MPIR_Pipelined_Bcast_MV2 Coll_bcast_mpich::bcast
-#define MPIR_Bcast_binomial_MV2 Coll_bcast_binomial_tree::bcast
-#define MPIR_Bcast_scatter_ring_allgather_shm_MV2 Coll_bcast_scatter_LR_allgather::bcast
-#define MPIR_Bcast_scatter_doubling_allgather_MV2 Coll_bcast_scatter_rdb_allgather::bcast
-#define MPIR_Bcast_scatter_ring_allgather_MV2 Coll_bcast_scatter_LR_allgather::bcast
-#define MPIR_Shmem_Bcast_MV2 Coll_bcast_mpich::bcast
-#define MPIR_Bcast_tune_inter_node_helper_MV2 Coll_bcast_mvapich2_inter_node::bcast
-#define MPIR_Bcast_inter_node_helper_MV2 Coll_bcast_mvapich2_inter_node::bcast
-#define MPIR_Knomial_Bcast_intra_node_MV2 Coll_bcast_mvapich2_knomial_intra_node::bcast
-#define MPIR_Bcast_intra_MV2 Coll_bcast_mvapich2_intra_node::bcast
+#define MPIR_Pipelined_Bcast_Zcpy_MV2 bcast__mpich
+#define MPIR_Pipelined_Bcast_MV2 bcast__mpich
+#define MPIR_Bcast_binomial_MV2 bcast__binomial_tree
+#define MPIR_Bcast_scatter_ring_allgather_shm_MV2 bcast__scatter_LR_allgather
+#define MPIR_Bcast_scatter_doubling_allgather_MV2 bcast__scatter_rdb_allgather
+#define MPIR_Bcast_scatter_ring_allgather_MV2 bcast__scatter_LR_allgather
+#define MPIR_Shmem_Bcast_MV2 bcast__mpich
+#define MPIR_Bcast_tune_inter_node_helper_MV2 bcast__mvapich2_inter_node
+#define MPIR_Bcast_inter_node_helper_MV2 bcast__mvapich2_inter_node
+#define MPIR_Knomial_Bcast_intra_node_MV2 bcast__mvapich2_knomial_intra_node
+#define MPIR_Bcast_intra_MV2 bcast__mvapich2_intra_node
 
 extern int zcpy_knomial_factor;
 extern int mv2_pipelined_zcpy_knomial_factor;
@@ -73,13 +73,13 @@ extern int mv2_intra_node_knomial_factor;
 #define mv2_bcast_large_msg            512*1024
 #define mv2_knomial_intra_node_threshold 131072
 #define mv2_scatter_rd_inter_leader_bcast 1
-namespace simgrid{
-namespace smpi{
-int Coll_bcast_mvapich2_inter_node::bcast(void *buffer,
-                                                 int count,
-                                                 MPI_Datatype datatype,
-                                                 int root,
-                                                 MPI_Comm  comm)
+namespace simgrid {
+namespace smpi {
+int bcast__mvapich2_inter_node(void *buffer,
+                               int count,
+                               MPI_Datatype datatype,
+                               int root,
+                               MPI_Comm  comm)
 {
     int rank;
     int mpi_errno = MPI_SUCCESS;
@@ -93,11 +93,11 @@ int Coll_bcast_mvapich2_inter_node::bcast(void *buffer,
 
 
     if (MV2_Bcast_function==NULL){
-      MV2_Bcast_function=Coll_bcast_mpich::bcast;
+      MV2_Bcast_function = bcast__mpich;
     }
 
     if (MV2_Bcast_intra_node_function==NULL){
-      MV2_Bcast_intra_node_function= Coll_bcast_mpich::bcast;
+      MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
@@ -170,21 +170,21 @@ int Coll_bcast_mvapich2_inter_node::bcast(void *buffer,
 }
 
 
-int Coll_bcast_mvapich2_knomial_intra_node::bcast(void *buffer,
-                                      int count,
-                                      MPI_Datatype datatype,
-                                      int root, MPI_Comm  comm)
+int bcast__mvapich2_knomial_intra_node(void *buffer,
+                                       int count,
+                                       MPI_Datatype datatype,
+                                       int root, MPI_Comm  comm)
 {
     int local_size = 0, rank;
     int mpi_errno = MPI_SUCCESS;
     int src, dst, mask, relative_rank;
     int k;
     if (MV2_Bcast_function==NULL){
-      MV2_Bcast_function=Coll_bcast_mpich::bcast;
+      MV2_Bcast_function = bcast__mpich;
     }
 
     if (MV2_Bcast_intra_node_function==NULL){
-      MV2_Bcast_intra_node_function= Coll_bcast_mpich::bcast;
+      MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
@@ -243,10 +243,10 @@ int Coll_bcast_mvapich2_knomial_intra_node::bcast(void *buffer,
 }
 
 
-int Coll_bcast_mvapich2_intra_node::bcast(void *buffer,
-                         int count,
-                         MPI_Datatype datatype,
-                         int root, MPI_Comm  comm)
+int bcast__mvapich2_intra_node(void *buffer,
+                               int count,
+                               MPI_Datatype datatype,
+                               int root, MPI_Comm  comm)
 {
     int mpi_errno = MPI_SUCCESS;
     int comm_size;
@@ -260,11 +260,11 @@ int Coll_bcast_mvapich2_intra_node::bcast(void *buffer,
     if (count == 0)
         return MPI_SUCCESS;
     if (MV2_Bcast_function==NULL){
-      MV2_Bcast_function=Coll_bcast_mpich::bcast;
+      MV2_Bcast_function = bcast__mpich;
     }
 
     if (MV2_Bcast_intra_node_function==NULL){
-      MV2_Bcast_intra_node_function= Coll_bcast_mpich::bcast;
+      MV2_Bcast_intra_node_function = bcast__mpich;
     }
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
index 7a5cbeb..393b714 100644 (file)
 
 namespace simgrid{
 namespace smpi{
-int Coll_bcast_ompi_pipeline::bcast( void* buffer,
-                                      int original_count,
-                                      MPI_Datatype datatype,
-                                      int root,
-                                      MPI_Comm comm)
+int bcast__ompi_pipeline( void* buffer,
+                          int original_count,
+                          MPI_Datatype datatype,
+                          int root,
+                          MPI_Comm comm)
 {
     int count_by_segment = original_count;
     size_t type_size;
index be50cd2..b4e7de5 100644 (file)
 #include "../coll_tuned_topo.hpp"
 #include "../colls_private.hpp"
 #define MAXTREEFANOUT 32
-namespace simgrid{
-namespace smpi{
-
-int
-Coll_bcast_ompi_split_bintree::bcast ( void* buffer,
-                                            int count,
-                                            MPI_Datatype datatype,
-                                            int root,
-                                            MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+
+int bcast__ompi_split_bintree( void* buffer,
+                               int count,
+                               MPI_Datatype datatype,
+                               int root,
+                               MPI_Comm comm)
 {
     unsigned int segsize ;
     int rank, size;
@@ -136,8 +135,7 @@ Coll_bcast_ompi_split_bintree::bcast ( void* buffer,
         (segsize > counts[0] * type_size) ||
         (segsize > counts[1] * type_size) ) {
         /* call linear version here ! */
-        return (Coll_bcast_SMP_linear::bcast ( buffer, count, datatype,
-                                                    root, comm));
+        return bcast__SMP_linear( buffer, count, datatype, root, comm);
     }
     type_extent = datatype->get_extent();
 
index 41844ce..5ac3dc6 100644 (file)
@@ -67,12 +67,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * Author: MPIH / modified by Ahmad Faraj
 
  ****************************************************************************/
-namespace simgrid{
-namespace smpi{
-int
-Coll_bcast_scatter_LR_allgather::bcast(void *buff, int count,
-                                           MPI_Datatype data_type, int root,
-                                           MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int bcast__scatter_LR_allgather(void *buff, int count,
+                                MPI_Datatype data_type, int root,
+                                MPI_Comm comm)
 {
   MPI_Aint extent;
   MPI_Status status;
index d8cb946..9cf489b 100644 (file)
@@ -102,8 +102,7 @@ static int scatter_for_bcast(
 }
 
 
-int
-Coll_bcast_scatter_rdb_allgather::bcast (
+int bcast__scatter_rdb_allgather(
     void *buffer,
     int count,
     MPI_Datatype datatype,
index adeb3ce..c5ca478 100644 (file)
@@ -38,9 +38,9 @@
 #include "../colls_private.hpp"
 #include <algorithm>
 
-#define MPIR_Gather_MV2_Direct Coll_gather_ompi_basic_linear::gather
-#define MPIR_Gather_MV2_two_level_Direct Coll_gather_ompi_basic_linear::gather
-#define MPIR_Gather_intra Coll_gather_mpich::gather
+#define MPIR_Gather_MV2_Direct gather__ompi_basic_linear
+#define MPIR_Gather_MV2_two_level_Direct gather__ompi_basic_linear
+#define MPIR_Gather_intra gather__mpich
 typedef int (*MV2_Gather_function_ptr) (const void *sendbuf,
     int sendcnt,
     MPI_Datatype sendtype,
@@ -127,14 +127,14 @@ static int MPIR_pt_pt_intra_gather( const void *sendbuf, int sendcnt, MPI_Dataty
 
 
 
-int Coll_gather_mvapich2_two_level::gather(const void *sendbuf,
-                                            int sendcnt,
-                                            MPI_Datatype sendtype,
-                                            void *recvbuf,
-                                            int recvcnt,
-                                            MPI_Datatype recvtype,
-                                            int root,
-                                            MPI_Comm comm)
+int gather__mvapich2_two_level(const void *sendbuf,
+                               int sendcnt,
+                               MPI_Datatype sendtype,
+                               void *recvbuf,
+                               int recvcnt,
+                               MPI_Datatype recvtype,
+                               int root,
+                               MPI_Comm comm)
 {
   unsigned char* leader_gather_buf = NULL;
   int comm_size, rank;
@@ -151,7 +151,7 @@ int Coll_gather_mvapich2_two_level::gather(const void *sendbuf,
 
   // if not set (use of the algo directly, without mvapich2 selector)
   if (MV2_Gather_intra_node_function == NULL)
-    MV2_Gather_intra_node_function = Coll_gather_mpich::gather;
+    MV2_Gather_intra_node_function = gather__mpich;
 
   if (comm->get_leaders_comm() == MPI_COMM_NULL) {
     comm->init_smp();
index 812ec45..36fbe6b 100644 (file)
 #include "../coll_tuned_topo.hpp"
 #include "../colls_private.hpp"
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid {
+namespace smpi {
 
-int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
-                                      MPI_Datatype rdtype, int root, MPI_Comm comm)
+int gather__ompi_binomial(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
+                          MPI_Datatype rdtype, int root, MPI_Comm comm)
 {
     int line = -1;
     int i;
@@ -202,12 +202,12 @@ int Coll_gather_ompi_binomial::gather(const void* sbuf, int scount, MPI_Datatype
  *  Accepts:  - same arguments as MPI_Gather(), first segment size
  *  Returns:  - MPI_SUCCESS or error code
  */
-int Coll_gather_ompi_linear_sync::gather(const void *sbuf, int scount,
-                                         MPI_Datatype sdtype,
-                                         void *rbuf, int rcount,
-                                         MPI_Datatype rdtype,
-                                         int root,
-                                         MPI_Comm comm)
+int gather__ompi_linear_sync(const void *sbuf, int scount,
+                             MPI_Datatype sdtype,
+                             void *rbuf, int rcount,
+                             MPI_Datatype rdtype,
+                             int root,
+                             MPI_Comm comm)
 {
     int i;
     int ret, line;
@@ -355,8 +355,8 @@ int Coll_gather_ompi_linear_sync::gather(const void *sbuf, int scount,
  *  Accepts:  - same arguments as MPI_Gather()
  *  Returns:  - MPI_SUCCESS or error code
  */
-int Coll_gather_ompi_basic_linear::gather(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
-                                          MPI_Datatype rdtype, int root, MPI_Comm comm)
+int gather__ompi_basic_linear(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
+                              MPI_Datatype rdtype, int root, MPI_Comm comm)
 {
     int i;
     int err;
index b341762..a3f4e60 100644 (file)
@@ -12,11 +12,11 @@ int reduce_NTSL_segment_size_in_byte = 8192;
 /* Non-topology-specific pipelined linear-bcast function
    0->1, 1->2 ,2->3, ....., ->last node : in a pipeline fashion
 */
-namespace simgrid{
-namespace smpi{
-int Coll_reduce_NTSL::reduce(const void *buf, void *rbuf, int count,
-                                MPI_Datatype datatype, MPI_Op op, int root,
-                                MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int reduce__NTSL(const void *buf, void *rbuf, int count,
+                 MPI_Datatype datatype, MPI_Op op, int root,
+                 MPI_Comm comm)
 {
   int tag = COLL_TAG_REDUCE;
   MPI_Status status;
@@ -133,9 +133,9 @@ int Coll_reduce_NTSL::reduce(const void *buf, void *rbuf, int count,
   /* when count is not divisible by block size, use default BCAST for the remainder */
   if ((remainder != 0) && (count > segment)) {
     XBT_WARN("MPI_reduce_NTSL use default MPI_reduce.");
-    Coll_reduce_default::reduce((char *)buf + (pipe_length * increment),
-               (char *)rbuf + (pipe_length * increment), remainder, datatype, op, root,
-               comm);
+    reduce__default((char *)buf + (pipe_length * increment),
+                    (char *)rbuf + (pipe_length * increment), remainder, datatype, op, root,
+                    comm);
   }
 
   smpi_free_tmp_buffer(tmp_buf);
index 1ff8bd4..63c4245 100644 (file)
@@ -19,11 +19,11 @@ int reduce_arrival_pattern_aware_segment_size_in_byte = 8192;
 namespace simgrid{
 namespace smpi{
 /* Non-topology-specific pipelined linear-reduce function */
-int Coll_reduce_arrival_pattern_aware::reduce(const void *buf, void *rbuf,
-                                                 int count,
-                                                 MPI_Datatype datatype,
-                                                 MPI_Op op, int root,
-                                                 MPI_Comm comm)
+int reduce__arrival_pattern_aware(const void *buf, void *rbuf,
+                                  int count,
+                                  MPI_Datatype datatype,
+                                  MPI_Op op, int root,
+                                  MPI_Comm comm)
 {
   int rank = comm->rank();
   int tag = -COLL_TAG_REDUCE;
@@ -332,8 +332,8 @@ int Coll_reduce_arrival_pattern_aware::reduce(const void *buf, void *rbuf,
 
   /* when count is not divisible by block size, use default BCAST for the remainder */
   if ((remainder != 0) && (count > segment)) {
-    Coll_reduce_default::reduce((char*)buf + (pipe_length * increment), (char*)rbuf + (pipe_length * increment),
-                                remainder, datatype, op, root, comm);
+    reduce__default((char*)buf + (pipe_length * increment), (char*)rbuf + (pipe_length * increment),
+                    remainder, datatype, op, root, comm);
   }
 
   smpi_free_tmp_buffer(tmp_buf);
index 3525231..a47f49a 100644 (file)
@@ -10,9 +10,9 @@
 //#include <star-reduction.c>
 namespace simgrid{
 namespace smpi{
-int Coll_reduce_binomial::reduce(const void *sendbuf, void *recvbuf, int count,
-                                    MPI_Datatype datatype, MPI_Op op, int root,
-                                    MPI_Comm comm)
+int reduce__binomial(const void *sendbuf, void *recvbuf, int count,
+                     MPI_Datatype datatype, MPI_Op op, int root,
+                     MPI_Comm comm)
 {
   MPI_Status status;
   int comm_size, rank;
index e9ffc8a..2eaffae 100644 (file)
@@ -6,12 +6,11 @@
 
 #include "../colls_private.hpp"
 //#include <star-reduction.c>
-namespace simgrid{
-namespace smpi{
-int
-Coll_reduce_flat_tree::reduce(const void *sbuf, void *rbuf, int count,
-                                 MPI_Datatype dtype, MPI_Op op,
-                                 int root, MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int reduce__flat_tree(const void *sbuf, void *rbuf, int count,
+                     MPI_Datatype dtype, MPI_Op op,
+                     int root, MPI_Comm comm)
 {
   int i, tag = COLL_TAG_REDUCE;
   int size;
index 57069b0..866ab8a 100644 (file)
@@ -116,9 +116,9 @@ static int MPIR_Reduce_knomial_trace(int root, int reduce_knomial_factor,
     return 0;
 }
 
-namespace simgrid{
-namespace smpi{
-int Coll_reduce_mvapich2_knomial::reduce (
+namespace simgrid {
+namespace smpi {
+int reduce__mvapich2_knomial(
         const void *sendbuf,
         void *recvbuf,
         int count,
index 4d47d23..f3017a8 100644 (file)
 #define SHMEM_COLL_BLOCK_SIZE (local_size * mv2_g_shmem_coll_max_msg_size)
 #define mv2_use_knomial_reduce 1
 
-#define MPIR_Reduce_inter_knomial_wrapper_MV2 Coll_reduce_mvapich2_knomial::reduce
-#define MPIR_Reduce_intra_knomial_wrapper_MV2 Coll_reduce_mvapich2_knomial::reduce
-#define MPIR_Reduce_binomial_MV2 Coll_reduce_binomial::reduce
-#define MPIR_Reduce_redscat_gather_MV2 Coll_reduce_scatter_gather::reduce
-#define MPIR_Reduce_shmem_MV2 Coll_reduce_ompi_basic_linear::reduce
+#define MPIR_Reduce_inter_knomial_wrapper_MV2 reduce__mvapich2_knomial
+#define MPIR_Reduce_intra_knomial_wrapper_MV2 reduce__mvapich2_knomial
+#define MPIR_Reduce_binomial_MV2 reduce__binomial
+#define MPIR_Reduce_redscat_gather_MV2 reduce__scatter_gather
+#define MPIR_Reduce_shmem_MV2 reduce__ompi_basic_linear
 
 extern int (*MV2_Reduce_function)( const void *sendbuf,
     void *recvbuf,
@@ -73,15 +73,15 @@ static int (*reduce_fn)(const void *sendbuf,
                              int count,
                              MPI_Datatype datatype,
                              MPI_Op op, int root, MPI_Comm  comm);
-namespace simgrid{
-namespace smpi{
-int Coll_reduce_mvapich2_two_level::reduce( const void *sendbuf,
-                                     void *recvbuf,
-                                     int count,
-                                     MPI_Datatype datatype,
-                                     MPI_Op op,
-                                     int root,
-                                     MPI_Comm comm)
+namespace simgrid {
+namespace smpi {
+int reduce__mvapich2_two_level( const void *sendbuf,
+                                void *recvbuf,
+                                int count,
+                                MPI_Datatype datatype,
+                                MPI_Op op,
+                                int root,
+                                MPI_Comm comm)
 {
     int mpi_errno = MPI_SUCCESS;
     int my_rank, total_size, local_rank, local_size;
@@ -96,9 +96,9 @@ int Coll_reduce_mvapich2_two_level::reduce( const void *sendbuf,
 
     //if not set (use of the algo directly, without mvapich2 selector)
     if(MV2_Reduce_function==NULL)
-      MV2_Reduce_function=Coll_reduce_mpich::reduce;
+      MV2_Reduce_function = reduce__mpich;
     if(MV2_Reduce_intra_function==NULL)
-      MV2_Reduce_intra_function=Coll_reduce_mpich::reduce;
+      MV2_Reduce_intra_function = reduce__mpich;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
       comm->init_smp();
index dd72d7b..3f3cdb6 100644 (file)
@@ -328,11 +328,11 @@ int smpi_coll_tuned_ompi_reduce_generic(const void* sendbuf, void* recvbuf, int
 */
 
 
-int Coll_reduce_ompi_chain::reduce(const void *sendbuf, void *recvbuf, int count,
-                                        MPI_Datatype datatype,
-                                        MPI_Op  op, int root,
-                                        MPI_Comm  comm
-                                        )
+int reduce__ompi_chain(const void *sendbuf, void *recvbuf, int count,
+                       MPI_Datatype datatype,
+                       MPI_Op  op, int root,
+                       MPI_Comm  comm
+                       )
 {
     uint32_t segsize=64*1024;
     int segcount = count;
@@ -356,10 +356,10 @@ int Coll_reduce_ompi_chain::reduce(const void *sendbuf, void *recvbuf, int count
 }
 
 
-int Coll_reduce_ompi_pipeline::reduce(const void *sendbuf, void *recvbuf,
-                                           int count, MPI_Datatype datatype,
-                                           MPI_Op  op, int root,
-                                           MPI_Comm  comm  )
+int reduce__ompi_pipeline(const void *sendbuf, void *recvbuf,
+                          int count, MPI_Datatype datatype,
+                          MPI_Op  op, int root,
+                          MPI_Comm  comm  )
 {
 
     uint32_t segsize;
@@ -400,10 +400,10 @@ int Coll_reduce_ompi_pipeline::reduce(const void *sendbuf, void *recvbuf,
                                            segcount, 0);
 }
 
-int Coll_reduce_ompi_binary::reduce(const void *sendbuf, void *recvbuf,
-                                         int count, MPI_Datatype datatype,
-                                         MPI_Op  op, int root,
-                                         MPI_Comm  comm)
+int reduce__ompi_binary(const void *sendbuf, void *recvbuf,
+                        int count, MPI_Datatype datatype,
+                        MPI_Op  op, int root,
+                        MPI_Comm  comm)
 {
     uint32_t segsize;
     int segcount = count;
@@ -430,10 +430,10 @@ int Coll_reduce_ompi_binary::reduce(const void *sendbuf, void *recvbuf,
                                            segcount, 0);
 }
 
-int Coll_reduce_ompi_binomial::reduce(const void *sendbuf, void *recvbuf,
-                                           int count, MPI_Datatype datatype,
-                                           MPI_Op  op, int root,
-                                           MPI_Comm  comm)
+int reduce__ompi_binomial(const void *sendbuf, void *recvbuf,
+                          int count, MPI_Datatype datatype,
+                          MPI_Op  op, int root,
+                          MPI_Comm  comm)
 {
 
     uint32_t segsize=0;
@@ -477,11 +477,11 @@ int Coll_reduce_ompi_binomial::reduce(const void *sendbuf, void *recvbuf,
  * Accepts:       same as MPI_Reduce()
  * Returns:       MPI_SUCCESS or error code
  */
-int Coll_reduce_ompi_in_order_binary::reduce(const void *sendbuf, void *recvbuf,
-                                                  int count,
-                                                  MPI_Datatype datatype,
-                                                  MPI_Op  op, int root,
-                                                  MPI_Comm  comm)
+int reduce__ompi_in_order_binary(const void *sendbuf, void *recvbuf,
+                                 int count,
+                                 MPI_Datatype datatype,
+                                 MPI_Op  op, int root,
+                                 MPI_Comm  comm)
 {
     uint32_t segsize=0;
     int ret;
@@ -586,12 +586,11 @@ int Coll_reduce_ompi_in_order_binary::reduce(const void *sendbuf, void *recvbuf,
  *  Returns:    - MPI_SUCCESS or error code
  */
 
-int
-Coll_reduce_ompi_basic_linear::reduce(const void *sbuf, void *rbuf, int count,
-                                          MPI_Datatype dtype,
-                                          MPI_Op op,
-                                          int root,
-                                          MPI_Comm comm)
+int reduce__ompi_basic_linear(const void *sbuf, void *rbuf, int count,
+                              MPI_Datatype dtype,
+                              MPI_Op op,
+                              int root,
+                              MPI_Comm comm)
 {
     int i, rank, size;
     ptrdiff_t true_extent, lb, extent;
index ef73930..4e8cdb0 100644 (file)
@@ -949,12 +949,12 @@ static int MPI_I_anyReduce(const void* Sendbuf, void* Recvbuf, int count, MPI_Da
 #endif /*REDUCE_LIMITS*/
 
 
-int Coll_reduce_rab::reduce(const void* Sendbuf, void* Recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
+int reduce__rab(const void* Sendbuf, void* Recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
 {
   return( MPI_I_anyReduce(Sendbuf, Recvbuf, count, datatype, op, root, comm, 0) );
 }
 
-int Coll_allreduce_rab::allreduce(const void* Sendbuf, void* Recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int allreduce__rab(const void* Sendbuf, void* Recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   return( MPI_I_anyReduce(Sendbuf, Recvbuf, count, datatype, op,   -1, comm, 1) );
 }
index 2c2eead..fa74378 100644 (file)
@@ -12,9 +12,9 @@
  */
 namespace simgrid{
 namespace smpi{
-int Coll_reduce_scatter_gather::reduce(const void *sendbuf, void *recvbuf,
-                                          int count, MPI_Datatype datatype,
-                                          MPI_Op op, int root, MPI_Comm comm)
+int reduce__scatter_gather(const void *sendbuf, void *recvbuf,
+                           int count, MPI_Datatype datatype,
+                           MPI_Op op, int root, MPI_Comm comm)
 {
   MPI_Status status;
   int comm_size, rank, pof2, rem, newrank;
index 3679390..2f75f1f 100644 (file)
@@ -24,8 +24,8 @@ static inline int MPIU_Mirror_permutation(unsigned int x, int bits)
 namespace simgrid{
 namespace smpi{
 
-int Coll_reduce_scatter_mpich_pair::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
-                              MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int reduce_scatter__mpich_pair(const void *sendbuf, void *recvbuf, const int recvcounts[],
+                               MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
     int   rank, comm_size, i;
     MPI_Aint extent, true_extent, true_lb;
@@ -144,8 +144,8 @@ int Coll_reduce_scatter_mpich_pair::reduce_scatter(const void *sendbuf, void *re
 }
 
 
-int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
-                              MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int reduce_scatter__mpich_noncomm(const void *sendbuf, void *recvbuf, const int recvcounts[],
+                                  MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
     int mpi_errno = MPI_SUCCESS;
     int comm_size = comm->size() ;
@@ -264,7 +264,7 @@ int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(const void *sendbuf, void
 
 
 
-int Coll_reduce_scatter_mpich_rdb::reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
+int reduce_scatter__mpich_rdb(const void *sendbuf, void *recvbuf, const int recvcounts[],
                               MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
     int   rank, comm_size, i;
index 93ae0dc..79f77d7 100644 (file)
  *  Returns:    - MPI_SUCCESS or error code
  *  Limitation: - Works only for commutative operations.
  */
-namespace simgrid{
-namespace smpi{
-int
-Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(const void *sbuf,
-                                                            void *rbuf,
-                                                            const int *rcounts,
-                                                            MPI_Datatype dtype,
-                                                            MPI_Op op,
-                                                            MPI_Comm comm
-                                                            )
+namespace simgrid {
+namespace smpi {
+int reduce_scatter__ompi_basic_recursivehalving(const void *sbuf,
+                                                void *rbuf,
+                                                const int *rcounts,
+                                                MPI_Datatype dtype,
+                                                MPI_Op op,
+                                                MPI_Comm comm
+                                                )
 {
     int i, rank, size, count, err = MPI_SUCCESS;
     int tmp_size = 1, remain = 0, tmp_rank;
@@ -348,12 +347,11 @@ Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(const void *sbuf
  *    DONE :)
  *
  */
-int
-Coll_reduce_scatter_ompi_ring::reduce_scatter(const void *sbuf, void *rbuf, const int *rcounts,
-                                          MPI_Datatype dtype,
-                                          MPI_Op op,
-                                          MPI_Comm comm
-                                          )
+int reduce_scatter__ompi_ring(const void *sbuf, void *rbuf, const int *rcounts,
+                              MPI_Datatype dtype,
+                              MPI_Op op,
+                              MPI_Comm comm
+                              )
 {
     int ret, line, rank, size, i, k, recv_from, send_to, total_count, max_block_count;
     int inbi;
index 35e57e4..ec056fa 100644 (file)
@@ -36,8 +36,8 @@
  */
 #include "../colls_private.hpp"
 
-#define MPIR_Scatter_MV2_Binomial Coll_scatter_ompi_binomial::scatter
-#define MPIR_Scatter_MV2_Direct Coll_scatter_ompi_basic_linear::scatter
+#define MPIR_Scatter_MV2_Binomial scatter__ompi_binomial
+#define MPIR_Scatter_MV2_Direct scatter__ompi_basic_linear
 
 extern int (*MV2_Scatter_intra_function) (const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     void *recvbuf, int recvcount, MPI_Datatype recvtype,
@@ -46,13 +46,13 @@ extern int (*MV2_Scatter_intra_function) (const void *sendbuf, int sendcount, MP
 namespace simgrid{
 namespace smpi{
 
-int Coll_scatter_mvapich2_two_level_direct::scatter(const void *sendbuf,
-                                      int sendcnt,
-                                      MPI_Datatype sendtype,
-                                      void *recvbuf,
-                                      int recvcnt,
-                                      MPI_Datatype recvtype,
-                                      int root, MPI_Comm  comm)
+int scatter__mvapich2_two_level_direct(const void *sendbuf,
+                                       int sendcnt,
+                                       MPI_Datatype sendtype,
+                                       void *recvbuf,
+                                       int recvcnt,
+                                       MPI_Datatype recvtype,
+                                       int root, MPI_Comm  comm)
 {
     int comm_size, rank;
     int local_rank, local_size;
@@ -66,7 +66,7 @@ int Coll_scatter_mvapich2_two_level_direct::scatter(const void *sendbuf,
     MPI_Comm shmem_comm, leader_comm;
     //if not set (use of the algo directly, without mvapich2 selector)
     if(MV2_Scatter_intra_function==NULL)
-      MV2_Scatter_intra_function=Coll_scatter_mpich::scatter;
+      MV2_Scatter_intra_function = scatter__mpich;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
       comm->init_smp();
@@ -223,13 +223,13 @@ int Coll_scatter_mvapich2_two_level_direct::scatter(const void *sendbuf,
 }
 
 
-int Coll_scatter_mvapich2_two_level_binomial::scatter(const void *sendbuf,
-                                        int sendcnt,
-                                        MPI_Datatype sendtype,
-                                        void *recvbuf,
-                                        int recvcnt,
-                                        MPI_Datatype recvtype,
-                                        int root, MPI_Comm comm)
+int scatter__mvapich2_two_level_binomial(const void *sendbuf,
+                                         int sendcnt,
+                                         MPI_Datatype sendtype,
+                                         void *recvbuf,
+                                         int recvcnt,
+                                         MPI_Datatype recvtype,
+                                         int root, MPI_Comm comm)
 {
     int comm_size, rank;
     int local_rank, local_size;
@@ -245,7 +245,7 @@ int Coll_scatter_mvapich2_two_level_binomial::scatter(const void *sendbuf,
 
     //if not set (use of the algo directly, without mvapich2 selector)
     if(MV2_Scatter_intra_function==NULL)
-      MV2_Scatter_intra_function=Coll_scatter_mpich::scatter;
+      MV2_Scatter_intra_function = scatter__mpich;
 
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
       comm->init_smp();
index 3138569..50d24eb 100644 (file)
@@ -25,8 +25,8 @@
 namespace simgrid{
 namespace smpi{
 
-int Coll_scatter_ompi_binomial::scatter(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
-                                        MPI_Datatype rdtype, int root, MPI_Comm comm)
+int scatter__ompi_binomial(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
+                           MPI_Datatype rdtype, int root, MPI_Comm comm)
 {
     int line = -1;
     int i;
@@ -194,8 +194,8 @@ int Coll_scatter_ompi_binomial::scatter(const void* sbuf, int scount, MPI_Dataty
  *  Accepts:  - same arguments as MPI_Scatter()
  *  Returns:  - MPI_SUCCESS or error code
  */
-int Coll_scatter_ompi_basic_linear::scatter(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
-                                            MPI_Datatype rdtype, int root, MPI_Comm comm)
+int scatter__ompi_basic_linear(const void* sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount,
+                               MPI_Datatype rdtype, int root, MPI_Comm comm)
 {
     int i, rank, size, err;
     char *ptmp;
index 2772069..f01efcf 100644 (file)
@@ -23,7 +23,7 @@
   }
 
 #define AUTOMATIC_COLL_BENCH(cat, ret, args, args2)                                                                    \
-  ret _XBT_CONCAT3(Coll_, cat, _automatic)::cat(COLL_UNPAREN args)                                                     \
+  ret _XBT_CONCAT2(cat, __automatic)(COLL_UNPAREN args)                                                                \
   {                                                                                                                    \
     double time1, time2, time_min = DBL_MAX;                                                                           \
     int min_coll = -1, global_coll = -1;                                                                               \
@@ -34,7 +34,7 @@
         continue;                                                                                                      \
       if (Colls::_XBT_CONCAT3(mpi_coll_, cat, _description)[i].name == "default")                                      \
         continue;                                                                                                      \
-      Coll_barrier_default::barrier(comm);                                                                             \
+      barrier__default(comm);                                                                                          \
       TRACE_AUTO_COLL(cat)                                                                                             \
       time1 = SIMIX_get_clock();                                                                                       \
       try {                                                                                                            \
@@ -44,7 +44,7 @@
       }                                                                                                                \
       time2   = SIMIX_get_clock();                                                                                     \
       buf_out = time2 - time1;                                                                                         \
-      Coll_reduce_default::reduce((void*)&buf_out, (void*)&buf_in, 1, MPI_DOUBLE, MPI_MAX, 0, comm);                   \
+      reduce__default((void*)&buf_out, (void*)&buf_in, 1, MPI_DOUBLE, MPI_MAX, 0, comm);                               \
       if (time2 - time1 < time_min) {                                                                                  \
         min_coll = i;                                                                                                  \
         time_min = time2 - time1;                                                                                      \
index 2978f86..fdc25ee 100644 (file)
@@ -13,7 +13,7 @@
 #include "smpi_request.hpp"
 #include "xbt/config.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI collectives.");
 
 #define COLL_SETTER(cat, ret, args, args2)                                                                             \
   int(*Colls::cat) args;                                                                                               \
@@ -81,7 +81,20 @@ int Colls::find_coll_description(s_mpi_coll_description_t* table, const std::str
   return -1;
 }
 
-COLL_APPLY(COLL_SETTER,COLL_GATHER_SIG,"");
+int(*Colls::gather) (const void *send_buff, int send_count, MPI_Datatype send_type,
+                     void *recv_buff, int recv_count, MPI_Datatype recv_type,
+                         int root, MPI_Comm comm);
+void Colls::set_gather(const std::string& name)
+{
+  int id = find_coll_description(mpi_coll_gather_description, name, "gather");
+  gather = reinterpret_cast<int(*)(const void *send_buff, int send_count, MPI_Datatype send_type,
+                                    void *recv_buff, int recv_count, MPI_Datatype recv_type,
+                                        int root, MPI_Comm comm)>(mpi_coll_gather_description[id].coll);
+  if (gather == nullptr)
+    xbt_die("Collective gather set to nullptr!");
+}
+
+//COLL_APPLY(COLL_SETTER,COLL_GATHER_SIG,"");
 COLL_APPLY(COLL_SETTER,COLL_ALLGATHER_SIG,"");
 COLL_APPLY(COLL_SETTER,COLL_ALLGATHERV_SIG,"");
 COLL_APPLY(COLL_SETTER,COLL_REDUCE_SIG,"");
index 6ae0e42..4b00cd1 100644 (file)
 namespace simgrid{
 namespace smpi{
 
-int Coll_bcast_default::bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
+int bcast__default(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
 {
-  return Coll_bcast_binomial_tree::bcast(buf, count, datatype, root, comm);
+  return bcast__binomial_tree(buf, count, datatype, root, comm);
 }
 
-int Coll_barrier_default::barrier(MPI_Comm comm)
+int barrier__default(MPI_Comm comm)
 {
-  return Coll_barrier_ompi_basic_linear::barrier(comm);
+  return barrier__ompi_basic_linear(comm);
 }
 
 
-int Coll_gather_default::gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+int gather__default(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                      void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   MPI_Request request;
@@ -30,8 +30,8 @@ int Coll_gather_default::gather(const void *sendbuf, int sendcount, MPI_Datatype
   return Request::wait(&request, MPI_STATUS_IGNORE);
 }
 
-int Coll_reduce_scatter_default::reduce_scatter(const void *sendbuf, void *recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op,
-                             MPI_Comm comm)
+int reduce_scatter__default(const void *sendbuf, void *recvbuf, const int *recvcounts, MPI_Datatype datatype, MPI_Op op,
+                            MPI_Comm comm)
 {
   int rank = comm->rank();
 
@@ -45,7 +45,7 @@ int Coll_reduce_scatter_default::reduce_scatter(const void *sendbuf, void *recvb
   }
   unsigned char* tmpbuf = smpi_get_tmp_sendbuffer(count * datatype->get_extent());
 
-  int ret = Coll_reduce_default::reduce(sendbuf, tmpbuf, count, datatype, op, 0, comm);
+  int ret = reduce__default(sendbuf, tmpbuf, count, datatype, op, 0, comm);
   if(ret==MPI_SUCCESS)
     ret = Colls::scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf, recvcounts[rank], datatype, 0, comm);
   delete[] displs;
@@ -54,16 +54,16 @@ int Coll_reduce_scatter_default::reduce_scatter(const void *sendbuf, void *recvb
 }
 
 
-int Coll_allgather_default::allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                        void *recvbuf,int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
+int allgather__default(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+                       void *recvbuf,int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
   MPI_Request request;
   Colls::iallgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, &request);
   return Request::wait(&request, MPI_STATUS_IGNORE);
 }
 
-int Coll_allgatherv_default::allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
-                         const int *recvcounts, const int *displs, MPI_Datatype recvtype, MPI_Comm comm)
+int allgatherv__default(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+                        const int *recvcounts, const int *displs, MPI_Datatype recvtype, MPI_Comm comm)
 {
   MPI_Request request;
   Colls::iallgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm, &request, 0);
@@ -78,45 +78,45 @@ int Coll_allgatherv_default::allgatherv(const void *sendbuf, int sendcount, MPI_
   return MPI_SUCCESS;
 }
 
-int Coll_scatter_default::scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                      void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
+int scatter__default(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+                     void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
 {
   MPI_Request request;
   Colls::iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, &request, 0);
   return Request::wait(&request, MPI_STATUS_IGNORE);
 }
 
-int Coll_reduce_default::reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
-                     MPI_Comm comm)
+int reduce__default(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
+                    MPI_Comm comm)
 {
   //non commutative case, use a working algo from openmpi
   if (op != MPI_OP_NULL && (datatype->flags() & DT_FLAG_DERIVED || not op->is_commutative())) {
-    return Coll_reduce_ompi_basic_linear::reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
+    return reduce__ompi_basic_linear(sendbuf, recvbuf, count, datatype, op, root, comm);
   }
   MPI_Request request;
   Colls::ireduce(sendbuf, recvbuf, count, datatype, op, root, comm, &request, 0);
   return Request::wait(&request, MPI_STATUS_IGNORE);
 }
 
-int Coll_allreduce_default::allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int allreduce__default(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
 {
   //FIXME: have mpi_ireduce and iallreduce handle derived datatypes correctly
   if(datatype->flags() & DT_FLAG_DERIVED)
-    return Coll_allreduce_ompi::allreduce(sendbuf, recvbuf, count, datatype, op, comm);
+    return allreduce__ompi(sendbuf, recvbuf, count, datatype, op, comm);
   int ret;
-  ret = Coll_reduce_default::reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
+  ret = reduce__default(sendbuf, recvbuf, count, datatype, op, 0, comm);
   if(ret==MPI_SUCCESS)
-    ret = Coll_bcast_default::bcast(recvbuf, count, datatype, 0, comm);
+    ret = bcast__default(recvbuf, count, datatype, 0, comm);
   return ret;
 }
 
-int Coll_alltoall_default::alltoall(const void *sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount, MPI_Datatype rdtype, MPI_Comm comm)
+int alltoall__default(const void *sbuf, int scount, MPI_Datatype sdtype, void* rbuf, int rcount, MPI_Datatype rdtype, MPI_Comm comm)
 {
-  return Coll_alltoall_ompi::alltoall(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm);
+  return alltoall__ompi(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm);
 }
 
-int Coll_alltoallv_default::alltoallv(const void *sendbuf, const int *sendcounts, const int *senddisps, MPI_Datatype sendtype,
-                              void *recvbuf, const int *recvcounts, const int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
+int alltoallv__default(const void *sendbuf, const int *sendcounts, const int *senddisps, MPI_Datatype sendtype,
+                       void *recvbuf, const int *recvcounts, const int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
 {
   MPI_Request request;
   Colls::ialltoallv(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype, comm, &request, 0);
index a126d72..7a87309 100644 (file)
@@ -55,14 +55,14 @@ int (*intel_allreduce_functions_table[])(const void *sendbuf,
       int count,
       MPI_Datatype datatype,
       MPI_Op op, MPI_Comm comm) ={
-      Coll_allreduce_rdb::allreduce,
-      Coll_allreduce_rab1::allreduce,
-      Coll_allreduce_redbcast::allreduce,
-      Coll_allreduce_mvapich2_two_level::allreduce,
-      Coll_allreduce_smp_binomial::allreduce,
-      Coll_allreduce_mvapich2_two_level::allreduce,
-      Coll_allreduce_ompi_ring_segmented::allreduce,
-      Coll_allreduce_ompi_ring_segmented::allreduce
+      allreduce__rdb,
+      allreduce__rab1,
+      allreduce__redbcast,
+      allreduce__mvapich2_two_level,
+      allreduce__smp_binomial,
+      allreduce__mvapich2_two_level,
+      allreduce__ompi_ring_segmented,
+      allreduce__ompi_ring_segmented
 };
 
 intel_tuning_table_element intel_allreduce_table[] =
@@ -639,10 +639,10 @@ int (*intel_alltoall_functions_table[])(const void *sbuf, int scount,
                                              void* rbuf, int rcount,
                                              MPI_Datatype rdtype,
                                              MPI_Comm comm) ={
-      Coll_alltoall_bruck::alltoall,
-      Coll_alltoall_mvapich2_scatter_dest::alltoall,
-      Coll_alltoall_pair::alltoall,
-      Coll_alltoall_mvapich2::alltoall//Plum is proprietary ? (and super efficient)
+      alltoall__bruck,
+      alltoall__mvapich2_scatter_dest,
+      alltoall__pair,
+      alltoall__mvapich2//Plum is proprietary ? (and super efficient)
 };
 
 /*I_MPI_ADJUST_BARRIER
@@ -659,15 +659,15 @@ MPI_Barrier
 */
 static int intel_barrier_gather_scatter(MPI_Comm comm){
     //our default barrier performs a antibcast/bcast
-    Coll_barrier_default::barrier(comm);
+    barrier__default(comm);
     return MPI_SUCCESS;
 }
 
 int (*intel_barrier_functions_table[])(MPI_Comm comm) ={
-      Coll_barrier_ompi_basic_linear::barrier,
-      Coll_barrier_ompi_recursivedoubling::barrier,
-      Coll_barrier_ompi_basic_linear::barrier,
-      Coll_barrier_ompi_recursivedoubling::barrier,
+      barrier__ompi_basic_linear,
+      barrier__ompi_recursivedoubling,
+      barrier__ompi_basic_linear,
+      barrier__ompi_recursivedoubling,
       intel_barrier_gather_scatter,
       intel_barrier_gather_scatter
 };
@@ -801,15 +801,15 @@ MPI_Bcast
 int (*intel_bcast_functions_table[])(void *buff, int count,
                                           MPI_Datatype datatype, int root,
                                           MPI_Comm  comm) ={
-      Coll_bcast_binomial_tree::bcast,
-      //Coll_bcast_scatter_rdb_allgather::bcast,
-      Coll_bcast_NTSL::bcast,
-      Coll_bcast_NTSL::bcast,
-      Coll_bcast_SMP_binomial::bcast,
-      //Coll_bcast_scatter_rdb_allgather::bcast,
-      Coll_bcast_NTSL::bcast,
-      Coll_bcast_SMP_linear::bcast,
-      Coll_bcast_mvapich2::bcast,//we don't know shumilin's algo'
+      bcast__binomial_tree,
+      //bcast__scatter_rdb_allgather,
+      bcast__NTSL,
+      bcast__NTSL,
+      bcast__SMP_binomial,
+      //bcast__scatter_rdb_allgather,
+      bcast__NTSL,
+      bcast__SMP_linear,
+      bcast__mvapich2,//we don't know shumilin's algo'
 };
 
 intel_tuning_table_element intel_bcast_table[] =
@@ -971,12 +971,12 @@ int (*intel_reduce_functions_table[])(const void *sendbuf, void *recvbuf,
                                             int count, MPI_Datatype  datatype,
                                             MPI_Op   op, int root,
                                             MPI_Comm   comm) ={
-      Coll_reduce_mvapich2::reduce,
-      Coll_reduce_binomial::reduce,
-      Coll_reduce_mvapich2::reduce,
-      Coll_reduce_mvapich2_two_level::reduce,
-      Coll_reduce_rab::reduce,
-      Coll_reduce_rab::reduce
+      reduce__mvapich2,
+      reduce__binomial,
+      reduce__mvapich2,
+      reduce__mvapich2_two_level,
+      reduce__rab,
+      reduce__rab
 };
 
 intel_tuning_table_element intel_reduce_table[] =
@@ -1061,7 +1061,7 @@ static  int intel_reduce_scatter_reduce_scatterv(const void *sbuf, void *rbuf,
                                                     MPI_Op  op,
                                                     MPI_Comm  comm)
 {
-  Coll_reduce_scatter_default::reduce_scatter(sbuf, rbuf, rcounts,dtype, op,comm);
+  reduce_scatter__default(sbuf, rbuf, rcounts,dtype, op,comm);
   return MPI_SUCCESS;
 }
 
@@ -1072,9 +1072,9 @@ static  int  intel_reduce_scatter_recursivehalving(const void *sbuf, void *rbuf,
                                                     MPI_Comm  comm)
 {
   if(op==MPI_OP_NULL || op->is_commutative())
-    return Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(sbuf, rbuf, rcounts,dtype, op,comm);
+    return reduce_scatter__ompi_basic_recursivehalving(sbuf, rbuf, rcounts,dtype, op,comm);
   else
-    return Coll_reduce_scatter_mvapich2::reduce_scatter(sbuf, rbuf, rcounts,dtype, op,comm);
+    return reduce_scatter__mvapich2(sbuf, rbuf, rcounts,dtype, op,comm);
 }
 
 int (*intel_reduce_scatter_functions_table[])( const void *sbuf, void *rbuf,
@@ -1084,8 +1084,8 @@ int (*intel_reduce_scatter_functions_table[])( const void *sbuf, void *rbuf,
                                                     MPI_Comm  comm
                                                     ) ={
       intel_reduce_scatter_recursivehalving,
-      Coll_reduce_scatter_mpich_pair::reduce_scatter,
-      Coll_reduce_scatter_mpich_rdb::reduce_scatter,
+      reduce_scatter__mpich_pair,
+      reduce_scatter__mpich_rdb,
       intel_reduce_scatter_reduce_scatterv,
       intel_reduce_scatter_reduce_scatterv
 };
@@ -1493,10 +1493,10 @@ int (*intel_allgather_functions_table[])(const void *sbuf, int scount,
                                               MPI_Datatype rdtype,
                                               MPI_Comm  comm
                                                     ) ={
-      Coll_allgather_rdb::allgather,
-      Coll_allgather_bruck::allgather,
-      Coll_allgather_ring::allgather,
-      Coll_allgather_GB::allgather
+      allgather__rdb,
+      allgather__bruck,
+      allgather__ring,
+      allgather__GB
 };
 
 intel_tuning_table_element intel_allgather_table[] =
@@ -1663,10 +1663,10 @@ int (*intel_allgatherv_functions_table[])(const void *sbuf, int scount,
                                                MPI_Datatype rdtype,
                                                MPI_Comm  comm
                                                     ) ={
-      Coll_allgatherv_mpich_rdb::allgatherv,
-      Coll_allgatherv_ompi_bruck::allgatherv,
-      Coll_allgatherv_ring::allgatherv,
-      Coll_allgatherv_GB::allgatherv
+      allgatherv__mpich_rdb,
+      allgatherv__ompi_bruck,
+      allgatherv__ring,
+      allgatherv__GB
 };
 
 intel_tuning_table_element intel_allgatherv_table[] =
@@ -1874,9 +1874,9 @@ int (*intel_gather_functions_table[])(const void *sbuf, int scount,
                                            int root,
                                            MPI_Comm  comm
                                                     ) ={
-      Coll_gather_ompi_binomial::gather,
-      Coll_gather_ompi_binomial::gather,
-      Coll_gather_mvapich2::gather
+      gather__ompi_binomial,
+      gather__ompi_binomial,
+      gather__mvapich2
 };
 
 intel_tuning_table_element intel_gather_table[] =
@@ -1977,9 +1977,9 @@ int (*intel_scatter_functions_table[])(const void *sbuf, int scount,
                                             MPI_Datatype rdtype,
                                             int root, MPI_Comm  comm
                                                     ) ={
-      Coll_scatter_ompi_binomial::scatter,
-      Coll_scatter_ompi_binomial::scatter,
-      Coll_scatter_mvapich2::scatter
+      scatter__ompi_binomial,
+      scatter__ompi_binomial,
+      scatter__mvapich2
 };
 
 intel_tuning_table_element intel_scatter_table[] =
@@ -2151,8 +2151,8 @@ int (*intel_alltoallv_functions_table[])(const void *sbuf, const int *scounts, c
                                               MPI_Datatype rdtype,
                                               MPI_Comm  comm
                                                     ) ={
-      Coll_alltoallv_ompi_basic_linear::alltoallv,
-      Coll_alltoallv_bruck::alltoallv
+      alltoallv__ompi_basic_linear,
+      alltoallv__bruck
 };
 
 intel_tuning_table_element intel_alltoallv_table[] =
@@ -2263,7 +2263,7 @@ intel_tuning_table_element intel_alltoallv_table[] =
   size_t block_dsize = 1;
 
 #define IMPI_COLL_SELECT(cat, ret, args, args2)                                                                        \
-  ret _XBT_CONCAT3(Coll_, cat, _impi)::cat(COLL_UNPAREN args)                                                          \
+  ret _XBT_CONCAT2(cat, __impi)(COLL_UNPAREN args)                                                          \
   {                                                                                                                    \
     int comm_size = comm->size();                                                                                      \
     int i         = 0;                                                                                                 \
index 11de914..3c0f27a 100644 (file)
@@ -58,7 +58,7 @@
 */
 namespace simgrid{
 namespace smpi{
-int Coll_allreduce_mpich::allreduce(const void *sbuf, void *rbuf, int count,
+int allreduce__mpich(const void *sbuf, void *rbuf, int count,
                         MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
 {
     size_t dsize, block_dsize;
@@ -74,7 +74,7 @@ int Coll_allreduce_mpich::allreduce(const void *sbuf, void *rbuf, int count,
         comm->init_smp();
       }
       if(op->is_commutative())
-        return Coll_allreduce_mvapich2_two_level::allreduce (sbuf, rbuf,count, dtype, op, comm);
+        return allreduce__mvapich2_two_level(sbuf, rbuf,count, dtype, op, comm);
     }
 
     /* find nearest power-of-two less than or equal to comm_size */
@@ -84,10 +84,10 @@ int Coll_allreduce_mpich::allreduce(const void *sbuf, void *rbuf, int count,
 
     if (block_dsize > large_message && count >= pof2 && (op==MPI_OP_NULL || op->is_commutative())) {
       //for long messages
-       return Coll_allreduce_rab_rdb::allreduce (sbuf, rbuf, count, dtype, op, comm);
+       return allreduce__rab_rdb(sbuf, rbuf, count, dtype, op, comm);
     }else {
       //for short ones and count < pof2
-      return Coll_allreduce_rdb::allreduce (sbuf, rbuf, count, dtype, op, comm);
+      return allreduce__rdb(sbuf, rbuf, count, dtype, op, comm);
     }
 }
 
@@ -138,11 +138,11 @@ int Coll_allreduce_mpich::allreduce(const void *sbuf, void *rbuf, int count,
    End Algorithm: MPI_Alltoall
 */
 
-int Coll_alltoall_mpich::alltoall(const void *sbuf, int scount,
-                                             MPI_Datatype sdtype,
-                                             void* rbuf, int rcount,
-                                             MPI_Datatype rdtype,
-                                             MPI_Comm comm)
+int alltoall__mpich(const void *sbuf, int scount,
+                    MPI_Datatype sdtype,
+                    void* rbuf, int rcount,
+                    MPI_Datatype rdtype,
+                    MPI_Comm comm)
 {
     int communicator_size;
     size_t dsize, block_dsize;
@@ -168,42 +168,42 @@ int Coll_alltoall_mpich::alltoall(const void *sbuf, int scount,
     block_dsize = dsize * scount;
 
     if ((block_dsize < short_size) && (communicator_size >= 8)) {
-        return Coll_alltoall_bruck::alltoall(sbuf, scount, sdtype,
-                                                    rbuf, rcount, rdtype,
-                                                    comm);
+        return alltoall__bruck(sbuf, scount, sdtype,
+                               rbuf, rcount, rdtype,
+                               comm);
 
     } else if (block_dsize < medium_size) {
-        return Coll_alltoall_mvapich2_scatter_dest::alltoall(sbuf, scount, sdtype,
-                                                           rbuf, rcount, rdtype,
-                                                           comm);
+        return alltoall__mvapich2_scatter_dest(sbuf, scount, sdtype,
+                                               rbuf, rcount, rdtype,
+                                               comm);
     }else if (communicator_size%2){
-        return Coll_alltoall_pair::alltoall(sbuf, scount, sdtype,
-                                                           rbuf, rcount, rdtype,
-                                                           comm);
+        return alltoall__pair(sbuf, scount, sdtype,
+                              rbuf, rcount, rdtype,
+                              comm);
     }
 
-    return Coll_alltoall_ring::alltoall (sbuf, scount, sdtype,
-                                                    rbuf, rcount, rdtype,
-                                                    comm);
+    return alltoall__ring(sbuf, scount, sdtype,
+                          rbuf, rcount, rdtype,
+                          comm);
 }
 
-int Coll_alltoallv_mpich::alltoallv(const void *sbuf, const int *scounts, const int *sdisps,
-                                              MPI_Datatype sdtype,
-                                              void *rbuf, const int *rcounts, const int *rdisps,
-                                              MPI_Datatype rdtype,
-                                              MPI_Comm  comm
-                                              )
+int alltoallv__mpich(const void *sbuf, const int *scounts, const int *sdisps,
+                     MPI_Datatype sdtype,
+                     void *rbuf, const int *rcounts, const int *rdisps,
+                     MPI_Datatype rdtype,
+                     MPI_Comm  comm
+                     )
 {
     /* For starters, just keep the original algorithm. */
-    return Coll_alltoallv_bruck::alltoallv(sbuf, scounts, sdisps, sdtype,
-                                                        rbuf, rcounts, rdisps,rdtype,
-                                                        comm);
+    return alltoallv__bruck(sbuf, scounts, sdisps, sdtype,
+                            rbuf, rcounts, rdisps,rdtype,
+                            comm);
 }
 
 
-int Coll_barrier_mpich::barrier(MPI_Comm  comm)
+int barrier__mpich(MPI_Comm  comm)
 {
-    return Coll_barrier_ompi_bruck::barrier(comm);
+    return barrier__ompi_bruck(comm);
 }
 
 /* This is the default implementation of broadcast. The algorithm is:
@@ -249,9 +249,9 @@ int Coll_barrier_mpich::barrier(MPI_Comm  comm)
 */
 
 
-int Coll_bcast_mpich::bcast(void *buff, int count,
-                                          MPI_Datatype datatype, int root,
-                                          MPI_Comm  comm
+int bcast__mpich(void *buff, int count,
+                 MPI_Datatype datatype, int root,
+                 MPI_Comm  comm
                                           )
 {
     /* Decision function based on MX results for
@@ -268,7 +268,7 @@ int Coll_bcast_mpich::bcast(void *buff, int count,
         comm->init_smp();
       }
       if(comm->is_uniform())
-        return Coll_bcast_SMP_binomial::bcast(buff, count, datatype, root, comm);
+        return bcast__SMP_binomial(buff, count, datatype, root, comm);
     }
 
     communicator_size = comm->size();
@@ -281,18 +281,15 @@ int Coll_bcast_mpich::bcast(void *buff, int count,
        single-element broadcasts */
     if ((message_size < small_message_size) || (communicator_size <= 8)) {
         /* Binomial without segmentation */
-        return  Coll_bcast_binomial_tree::bcast (buff, count, datatype,
-                                                      root, comm);
+        return  bcast__binomial_tree(buff, count, datatype, root, comm);
 
     } else if (message_size < intermediate_message_size && !(communicator_size%2)) {
         // SplittedBinary with 1KB segments
-        return Coll_bcast_scatter_rdb_allgather::bcast(buff, count, datatype,
-                                                         root, comm);
+        return bcast__scatter_rdb_allgather(buff, count, datatype, root, comm);
 
     }
      //Handle large message sizes
-     return Coll_bcast_scatter_LR_allgather::bcast (buff, count, datatype,
-                                                     root, comm);
+     return bcast__scatter_LR_allgather(buff, count, datatype, root, comm);
 
 }
 
@@ -353,7 +350,7 @@ int Coll_bcast_mpich::bcast(void *buff, int count,
 */
 
 
-int Coll_reduce_mpich::reduce(const void *sendbuf, void *recvbuf,
+int reduce__mpich(const void *sendbuf, void *recvbuf,
                                             int count, MPI_Datatype  datatype,
                                             MPI_Op   op, int root,
                                             MPI_Comm   comm
@@ -367,7 +364,7 @@ int Coll_reduce_mpich::reduce(const void *sendbuf, void *recvbuf,
         comm->init_smp();
       }
       if (op->is_commutative() == 1)
-        return Coll_reduce_mvapich2_two_level::reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
+        return reduce__mvapich2_two_level(sendbuf, recvbuf, count, datatype, op, root, comm);
     }
 
     communicator_size = comm->size();
@@ -381,9 +378,9 @@ int Coll_reduce_mpich::reduce(const void *sendbuf, void *recvbuf,
     pof2 >>= 1;
 
     if ((count < pof2) || (message_size < 2048) || (op != MPI_OP_NULL && not op->is_commutative())) {
-      return Coll_reduce_binomial::reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
+      return reduce__binomial(sendbuf, recvbuf, count, datatype, op, root, comm);
     }
-        return Coll_reduce_scatter_gather::reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
+    return reduce__scatter_gather(sendbuf, recvbuf, count, datatype, op, root, comm);
 }
 
 
@@ -436,12 +433,12 @@ int Coll_reduce_mpich::reduce(const void *sendbuf, void *recvbuf,
 */
 
 
-int Coll_reduce_scatter_mpich::reduce_scatter(const void *sbuf, void *rbuf,
-                                                    const int *rcounts,
-                                                    MPI_Datatype dtype,
-                                                    MPI_Op  op,
-                                                    MPI_Comm  comm
-                                                    )
+int reduce_scatter__mpich(const void *sbuf, void *rbuf,
+                          const int *rcounts,
+                          MPI_Datatype dtype,
+                          MPI_Op  op,
+                          MPI_Comm  comm
+                          )
 {
     int comm_size, i;
     size_t total_message_size;
@@ -458,9 +455,7 @@ int Coll_reduce_scatter_mpich::reduce_scatter(const void *sbuf, void *rbuf,
     }
 
     if( (op==MPI_OP_NULL || op->is_commutative()) &&  total_message_size > 524288) {
-        return Coll_reduce_scatter_mpich_pair::reduce_scatter (sbuf, rbuf, rcounts,
-                                                                    dtype, op,
-                                                                    comm);
+        return reduce_scatter__mpich_pair(sbuf, rbuf, rcounts, dtype, op, comm);
     } else if ((op != MPI_OP_NULL && not op->is_commutative())) {
       int is_block_regular = 1;
       for (i = 0; i < (comm_size - 1); ++i) {
@@ -477,12 +472,12 @@ int Coll_reduce_scatter_mpich::reduce_scatter(const void *sbuf, void *rbuf,
 
       if (pof2 == comm_size && is_block_regular) {
         /* noncommutative, pof2 size, and block regular */
-        return Coll_reduce_scatter_mpich_noncomm::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+        return reduce_scatter__mpich_noncomm(sbuf, rbuf, rcounts, dtype, op, comm);
       }
 
-      return Coll_reduce_scatter_mpich_rdb::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+      return reduce_scatter__mpich_rdb(sbuf, rbuf, rcounts, dtype, op, comm);
     }else{
-       return Coll_reduce_scatter_mpich_rdb::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+       return reduce_scatter__mpich_rdb(sbuf, rbuf, rcounts, dtype, op, comm);
     }
 }
 
@@ -532,12 +527,12 @@ int Coll_reduce_scatter_mpich::reduce_scatter(const void *sbuf, void *rbuf,
    End Algorithm: MPI_Allgather
 */
 
-int Coll_allgather_mpich::allgather(const void *sbuf, int scount,
-                                              MPI_Datatype sdtype,
-                                              void* rbuf, int rcount,
-                                              MPI_Datatype rdtype,
-                                              MPI_Comm  comm
-                                              )
+int allgather__mpich(const void *sbuf, int scount,
+                     MPI_Datatype sdtype,
+                     void* rbuf, int rcount,
+                     MPI_Datatype rdtype,
+                     MPI_Comm  comm
+                     )
 {
     int communicator_size, pow2_size;
     size_t dsize, total_dsize;
@@ -560,17 +555,11 @@ int Coll_allgather_mpich::allgather(const void *sbuf, int scount,
        - for everything else use ring.
     */
     if ((pow2_size == communicator_size) && (total_dsize < 524288)) {
-        return Coll_allgather_rdb::allgather(sbuf, scount, sdtype,
-                                                                 rbuf, rcount, rdtype,
-                                                                 comm);
+        return allgather__rdb(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm);
     } else if (total_dsize <= 81920) {
-        return Coll_allgather_bruck::allgather(sbuf, scount, sdtype,
-                                                     rbuf, rcount, rdtype,
-                                                     comm);
+        return allgather__bruck(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm);
     }
-    return Coll_allgather_ring::allgather(sbuf, scount, sdtype,
-                                                rbuf, rcount, rdtype,
-                                                comm);
+    return allgather__ring(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm);
 }
 
 
@@ -610,13 +599,13 @@ int Coll_allgather_mpich::allgather(const void *sbuf, int scount,
 
    End Algorithm: MPI_Allgatherv
 */
-int Coll_allgatherv_mpich::allgatherv(const void *sbuf, int scount,
-                                               MPI_Datatype sdtype,
-                                               void* rbuf, const int *rcounts,
-                                               const int *rdispls,
-                                               MPI_Datatype rdtype,
-                                               MPI_Comm  comm
-                                               )
+int allgatherv__mpich(const void *sbuf, int scount,
+                      MPI_Datatype sdtype,
+                      void* rbuf, const int *rcounts,
+                      const int *rdispls,
+                      MPI_Datatype rdtype,
+                      MPI_Comm  comm
+                      )
 {
     int communicator_size, pow2_size,i;
     size_t total_dsize;
@@ -633,17 +622,11 @@ int Coll_allgatherv_mpich::allgatherv(const void *sbuf, int scount,
     for (pow2_size  = 1; pow2_size < communicator_size; pow2_size <<=1);
 
     if ((pow2_size == communicator_size) && (total_dsize < 524288)) {
-        return Coll_allgatherv_mpich_rdb::allgatherv(sbuf, scount, sdtype,
-                                                                 rbuf, rcounts, rdispls, rdtype,
-                                                                 comm);
+        return allgatherv__mpich_rdb(sbuf, scount, sdtype, rbuf, rcounts, rdispls, rdtype, comm);
     } else if (total_dsize <= 81920) {
-        return Coll_allgatherv_ompi_bruck::allgatherv(sbuf, scount, sdtype,
-                                                     rbuf, rcounts, rdispls, rdtype,
-                                                     comm);
+        return allgatherv__ompi_bruck(sbuf, scount, sdtype, rbuf, rcounts, rdispls, rdtype, comm);
     }
-    return Coll_allgatherv_mpich_ring::allgatherv(sbuf, scount, sdtype,
-                                                rbuf, rcounts, rdispls, rdtype,
-                                                comm);
+    return allgatherv__mpich_ring(sbuf, scount, sdtype, rbuf, rcounts, rdispls, rdtype, comm);
 }
 
 /* This is the default implementation of gather. The algorithm is:
@@ -668,17 +651,17 @@ int Coll_allgatherv_mpich::allgatherv(const void *sbuf, int scount,
    End Algorithm: MPI_Gather
 */
 
-int Coll_gather_mpich::gather(const void *sbuf, int scount,
-                                           MPI_Datatype sdtype,
-                                           void* rbuf, int rcount,
-                                           MPI_Datatype rdtype,
-                                           int root,
-                                           MPI_Comm  comm
-                                           )
+int gather__mpich(const void *sbuf, int scount,
+                  MPI_Datatype sdtype,
+                  void* rbuf, int rcount,
+                  MPI_Datatype rdtype,
+                  int root,
+                  MPI_Comm  comm
+                  )
 {
-        return Coll_gather_ompi_binomial::gather (sbuf, scount, sdtype,
-                                                      rbuf, rcount, rdtype,
-                                                      root, comm);
+    return gather__ompi_binomial(sbuf, scount, sdtype,
+                                 rbuf, rcount, rdtype,
+                                 root, comm);
 }
 
 /* This is the default implementation of scatter. The algorithm is:
@@ -703,12 +686,12 @@ int Coll_gather_mpich::gather(const void *sbuf, int scount,
 */
 
 
-int Coll_scatter_mpich::scatter(const void *sbuf, int scount,
-                                            MPI_Datatype sdtype,
-                                            void* rbuf, int rcount,
-                                            MPI_Datatype rdtype,
-                                            int root, MPI_Comm  comm
-                                            )
+int scatter__mpich(const void *sbuf, int scount,
+                   MPI_Datatype sdtype,
+                   void* rbuf, int rcount,
+                   MPI_Datatype rdtype,
+                   int root, MPI_Comm  comm
+                   )
 {
   std::unique_ptr<unsigned char[]> tmp_buf;
   if(comm->rank()!=root){
@@ -717,7 +700,7 @@ int Coll_scatter_mpich::scatter(const void *sbuf, int scount,
     scount = rcount;
     sdtype = rdtype;
   }
-  return Coll_scatter_ompi_binomial::scatter(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm);
+  return scatter__ompi_binomial(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm);
 }
 }
 }
index d7840cf..2128f77 100644 (file)
 
 #include "smpi_mvapich2_selector_stampede.hpp"
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid {
+namespace smpi {
 
 
-int Coll_alltoall_mvapich2::alltoall( const void *sendbuf, int sendcount,
-    MPI_Datatype sendtype,
-    void* recvbuf, int recvcount,
-    MPI_Datatype recvtype,
-    MPI_Comm comm)
+int alltoall__mvapich2( const void *sendbuf, int sendcount,
+                        MPI_Datatype sendtype,
+                        void* recvbuf, int recvcount,
+                        MPI_Datatype recvtype,
+                        MPI_Comm comm)
 {
 
   if(mv2_alltoall_table_ppn_conf==NULL)
@@ -78,7 +78,7 @@ int Coll_alltoall_mvapich2::alltoall( const void *sendbuf, int sendcount,
   return (mpi_errno);
 }
 
-int Coll_allgather_mvapich2::allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+int allgather__mvapich2(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     void *recvbuf, int recvcount, MPI_Datatype recvtype,
     MPI_Comm comm)
 {
@@ -157,7 +157,7 @@ int Coll_allgather_mvapich2::allgather(const void *sendbuf, int sendcount, MPI_D
                             recvbuf, recvcount, recvtype,
                             comm);
       }else{
-      mpi_errno = Coll_allgather_mpich::allgather(sendbuf, sendcount, sendtype,
+      mpi_errno = allgather__mpich(sendbuf, sendcount, sendtype,
                             recvbuf, recvcount, recvtype,
                             comm);
       }
@@ -179,7 +179,7 @@ int Coll_allgather_mvapich2::allgather(const void *sendbuf, int sendcount, MPI_D
   return mpi_errno;
 }
 
-int Coll_gather_mvapich2::gather(const void *sendbuf,
+int gather__mvapich2(const void *sendbuf,
     int sendcnt,
     MPI_Datatype sendtype,
     void *recvbuf,
@@ -245,7 +245,7 @@ int Coll_gather_mvapich2::gather(const void *sendbuf,
 
     } else {
   // Indeed, direct (non SMP-aware)gather is MPICH one
-  mpi_errno = Coll_gather_mpich::gather(sendbuf, sendcnt, sendtype,
+  mpi_errno = gather__mpich(sendbuf, sendcnt, sendtype,
       recvbuf, recvcnt, recvtype,
       root, comm);
   }
@@ -253,7 +253,7 @@ int Coll_gather_mvapich2::gather(const void *sendbuf,
   return mpi_errno;
 }
 
-int Coll_allgatherv_mvapich2::allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
+int allgatherv__mvapich2(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     void *recvbuf, const int *recvcounts, const int *displs,
     MPI_Datatype recvtype, MPI_Comm  comm )
 {
@@ -315,7 +315,7 @@ int Coll_allgatherv_mvapich2::allgatherv(const void *sendbuf, int sendcount, MPI
 
 
 
-int Coll_allreduce_mvapich2::allreduce(const void *sendbuf,
+int allreduce__mvapich2(const void *sendbuf,
     void *recvbuf,
     int count,
     MPI_Datatype datatype,
@@ -434,7 +434,7 @@ int Coll_allreduce_mvapich2::allreduce(const void *sendbuf,
 }
 
 
-int Coll_alltoallv_mvapich2::alltoallv(const void *sbuf, const int *scounts, const int *sdisps,
+int alltoallv__mvapich2(const void *sbuf, const int *scounts, const int *sdisps,
     MPI_Datatype sdtype,
     void *rbuf, const int *rcounts, const int *rdisps,
     MPI_Datatype rdtype,
@@ -443,28 +443,28 @@ int Coll_alltoallv_mvapich2::alltoallv(const void *sbuf, const int *scounts, con
 {
 
   if (sbuf == MPI_IN_PLACE) {
-      return Coll_alltoallv_ompi_basic_linear::alltoallv(sbuf, scounts, sdisps, sdtype,
-          rbuf, rcounts, rdisps,rdtype,
-          comm);
+      return alltoallv__ompi_basic_linear(sbuf, scounts, sdisps, sdtype,
+                                          rbuf, rcounts, rdisps, rdtype,
+                                          comm);
   } else     /* For starters, just keep the original algorithm. */
-  return Coll_alltoallv_ring::alltoallv(sbuf, scounts, sdisps, sdtype,
-      rbuf, rcounts, rdisps,rdtype,
-      comm);
+  return alltoallv__ring(sbuf, scounts, sdisps, sdtype,
+                         rbuf, rcounts, rdisps, rdtype,
+                         comm);
 }
 
 
-int Coll_barrier_mvapich2::barrier(MPI_Comm  comm)
+int barrier__mvapich2(MPI_Comm  comm)
 {
-  return Coll_barrier_mvapich2_pair::barrier(comm);
+  return barrier__mvapich2_pair(comm);
 }
 
 
 
 
-int Coll_bcast_mvapich2::bcast(void *buffer,
-    int count,
-    MPI_Datatype datatype,
-    int root, MPI_Comm comm)
+int bcast__mvapich2(void *buffer,
+                    int count,
+                    MPI_Datatype datatype,
+                    int root, MPI_Comm comm)
 {
     int mpi_errno = MPI_SUCCESS;
     int comm_size/*, rank*/;
@@ -656,7 +656,7 @@ int Coll_bcast_mvapich2::bcast(void *buffer,
 
 
 
-int Coll_reduce_mvapich2::reduce(const void *sendbuf,
+int reduce__mvapich2(const void *sendbuf,
     void *recvbuf,
     int count,
     MPI_Datatype datatype,
@@ -774,7 +774,7 @@ int Coll_reduce_mvapich2::reduce(const void *sendbuf,
 }
 
 
-int Coll_reduce_scatter_mvapich2::reduce_scatter(const void *sendbuf, void *recvbuf, const int *recvcnts,
+int reduce_scatter__mvapich2(const void *sendbuf, void *recvbuf, const int *recvcnts,
     MPI_Datatype datatype, MPI_Op op,
     MPI_Comm comm)
 {
@@ -838,9 +838,9 @@ int Coll_reduce_scatter_mvapich2::reduce_scatter(const void *sendbuf, void *recv
               recvcnts, datatype,
               op, comm);
       }
-      mpi_errno =  Coll_reduce_scatter_mpich_rdb::reduce_scatter(sendbuf, recvbuf,
-          recvcnts, datatype,
-          op, comm);
+      mpi_errno =  reduce_scatter__mpich_rdb(sendbuf, recvbuf,
+                                             recvcnts, datatype,
+                                             op, comm);
   }
   delete[] disps;
   return mpi_errno;
@@ -849,7 +849,7 @@ int Coll_reduce_scatter_mvapich2::reduce_scatter(const void *sendbuf, void *recv
 
 
 
-int Coll_scatter_mvapich2::scatter(const void *sendbuf,
+int scatter__mvapich2(const void *sendbuf,
     int sendcnt,
     MPI_Datatype sendtype,
     void *recvbuf,
index 9762cf2..25df8f1 100644 (file)
@@ -42,11 +42,11 @@ int mv2_alltoall_num_ppn_conf                             = 1;
 int* mv2_size_alltoall_tuning_table                       = NULL;
 mv2_alltoall_tuning_table** mv2_alltoall_thresholds_table = NULL;
 
-#define MPIR_Alltoall_bruck_MV2 simgrid::smpi::Coll_alltoall_bruck::alltoall
-#define MPIR_Alltoall_RD_MV2 simgrid::smpi::Coll_alltoall_rdb::alltoall
-#define MPIR_Alltoall_Scatter_dest_MV2 simgrid::smpi::Coll_alltoall_mvapich2_scatter_dest::alltoall
-#define MPIR_Alltoall_pairwise_MV2 simgrid::smpi::Coll_alltoall_pair::alltoall
-#define MPIR_Alltoall_inplace_MV2 simgrid::smpi::Coll_alltoall_ring::alltoall
+#define MPIR_Alltoall_bruck_MV2 simgrid::smpi::alltoall__bruck
+#define MPIR_Alltoall_RD_MV2 simgrid::smpi::alltoall__rdb
+#define MPIR_Alltoall_Scatter_dest_MV2 simgrid::smpi::alltoall__mvapich2_scatter_dest
+#define MPIR_Alltoall_pairwise_MV2 simgrid::smpi::alltoall__pair
+#define MPIR_Alltoall_inplace_MV2 simgrid::smpi::alltoall__ring
 
 static void init_mv2_alltoall_tables_stampede()
 {
@@ -358,10 +358,10 @@ static int MPIR_Allgather_RD_Allgather_Comm_MV2(const void* sendbuf, int sendcou
   return 0;
 }
 
-#define MPIR_Allgather_Bruck_MV2 simgrid::smpi::Coll_allgather_bruck::allgather
-#define MPIR_Allgather_RD_MV2 simgrid::smpi::Coll_allgather_rdb::allgather
-#define MPIR_Allgather_Ring_MV2 simgrid::smpi::Coll_allgather_ring::allgather
-#define MPIR_2lvl_Allgather_MV2 simgrid::smpi::Coll_allgather_mvapich2_smp::allgather
+#define MPIR_Allgather_Bruck_MV2 simgrid::smpi::allgather__bruck
+#define MPIR_Allgather_RD_MV2 simgrid::smpi::allgather__rdb
+#define MPIR_Allgather_Ring_MV2 simgrid::smpi::allgather__ring
+#define MPIR_2lvl_Allgather_MV2 simgrid::smpi::allgather__mvapich2_smp
 
 static void init_mv2_allgather_tables_stampede()
 {
@@ -583,9 +583,9 @@ typedef int (*MV2_Gather_function_ptr)(const void* sendbuf, int sendcnt, MPI_Dat
 MV2_Gather_function_ptr MV2_Gather_inter_leader_function = NULL;
 MV2_Gather_function_ptr MV2_Gather_intra_node_function   = NULL;
 
-#define MPIR_Gather_MV2_Direct simgrid::smpi::Coll_gather_ompi_basic_linear::gather
-#define MPIR_Gather_MV2_two_level_Direct simgrid::smpi::Coll_gather_mvapich2_two_level::gather
-#define MPIR_Gather_intra simgrid::smpi::Coll_gather_mpich::gather
+#define MPIR_Gather_MV2_Direct simgrid::smpi::gather__ompi_basic_linear
+#define MPIR_Gather_MV2_two_level_Direct simgrid::smpi::gather__mvapich2_two_level
+#define MPIR_Gather_intra simgrid::smpi::gather__mpich
 
 static void init_mv2_gather_tables_stampede()
 {
@@ -668,9 +668,9 @@ int (*MV2_Allgatherv_function)(const void* sendbuf, int sendcount, MPI_Datatype
 int mv2_size_allgatherv_tuning_table                         = 0;
 mv2_allgatherv_tuning_table* mv2_allgatherv_thresholds_table = NULL;
 
-#define MPIR_Allgatherv_Rec_Doubling_MV2 simgrid::smpi::Coll_allgatherv_mpich_rdb::allgatherv
-#define MPIR_Allgatherv_Bruck_MV2 simgrid::smpi::Coll_allgatherv_ompi_bruck::allgatherv
-#define MPIR_Allgatherv_Ring_MV2 simgrid::smpi::Coll_allgatherv_mpich_ring::allgatherv
+#define MPIR_Allgatherv_Rec_Doubling_MV2 simgrid::smpi::allgatherv__mpich_rdb
+#define MPIR_Allgatherv_Bruck_MV2 simgrid::smpi::allgatherv__ompi_bruck
+#define MPIR_Allgatherv_Ring_MV2 simgrid::smpi::allgatherv__mpich_ring
 
 static void init_mv2_allgatherv_tables_stampede()
 {
@@ -780,9 +780,9 @@ static int MPIR_Allreduce_reduce_shmem_MV2(const void* sendbuf, void* recvbuf, i
   return MPI_SUCCESS;
 }
 
-#define MPIR_Allreduce_pt2pt_rd_MV2 simgrid::smpi::Coll_allreduce_rdb::allreduce
-#define MPIR_Allreduce_pt2pt_rs_MV2 simgrid::smpi::Coll_allreduce_mvapich2_rs::allreduce
-#define MPIR_Allreduce_two_level_MV2 simgrid::smpi::Coll_allreduce_mvapich2_two_level::allreduce
+#define MPIR_Allreduce_pt2pt_rd_MV2 simgrid::smpi::allreduce__rdb
+#define MPIR_Allreduce_pt2pt_rs_MV2 simgrid::smpi::allreduce__mvapich2_rs
+#define MPIR_Allreduce_two_level_MV2 simgrid::smpi::allreduce__mvapich2_two_level
 
 static void init_mv2_allreduce_tables_stampede()
 {
@@ -955,17 +955,17 @@ int mv2_intra_node_knomial_factor     = 4;
 
 #define INTRA_NODE_ROOT 0
 
-#define MPIR_Pipelined_Bcast_Zcpy_MV2 simgrid::smpi::Coll_bcast_mpich::bcast
-#define MPIR_Pipelined_Bcast_MV2 simgrid::smpi::Coll_bcast_mpich::bcast
-#define MPIR_Bcast_binomial_MV2 simgrid::smpi::Coll_bcast_binomial_tree::bcast
-#define MPIR_Bcast_scatter_ring_allgather_shm_MV2 simgrid::smpi::Coll_bcast_scatter_LR_allgather::bcast
-#define MPIR_Bcast_scatter_doubling_allgather_MV2 simgrid::smpi::Coll_bcast_scatter_rdb_allgather::bcast
-#define MPIR_Bcast_scatter_ring_allgather_MV2 simgrid::smpi::Coll_bcast_scatter_LR_allgather::bcast
-#define MPIR_Shmem_Bcast_MV2 simgrid::smpi::Coll_bcast_mpich::bcast
-#define MPIR_Bcast_tune_inter_node_helper_MV2 simgrid::smpi::Coll_bcast_mvapich2_inter_node::bcast
-#define MPIR_Bcast_inter_node_helper_MV2 simgrid::smpi::Coll_bcast_mvapich2_inter_node::bcast
-#define MPIR_Knomial_Bcast_intra_node_MV2 simgrid::smpi::Coll_bcast_mvapich2_knomial_intra_node::bcast
-#define MPIR_Bcast_intra_MV2 simgrid::smpi::Coll_bcast_mvapich2_intra_node::bcast
+#define MPIR_Pipelined_Bcast_Zcpy_MV2 simgrid::smpi::bcast__mpich
+#define MPIR_Pipelined_Bcast_MV2 simgrid::smpi::bcast__mpich
+#define MPIR_Bcast_binomial_MV2 simgrid::smpi::bcast__binomial_tree
+#define MPIR_Bcast_scatter_ring_allgather_shm_MV2 simgrid::smpi::bcast__scatter_LR_allgather
+#define MPIR_Bcast_scatter_doubling_allgather_MV2 simgrid::smpi::bcast__scatter_rdb_allgather
+#define MPIR_Bcast_scatter_ring_allgather_MV2 simgrid::smpi::bcast__scatter_LR_allgather
+#define MPIR_Shmem_Bcast_MV2 simgrid::smpi::bcast__mpich
+#define MPIR_Bcast_tune_inter_node_helper_MV2 simgrid::smpi::bcast__mvapich2_inter_node
+#define MPIR_Bcast_inter_node_helper_MV2 simgrid::smpi::bcast__mvapich2_inter_node
+#define MPIR_Knomial_Bcast_intra_node_MV2 simgrid::smpi::bcast__mvapich2_knomial_intra_node
+#define MPIR_Bcast_intra_MV2 simgrid::smpi::bcast__mvapich2_intra_node
 
 static void init_mv2_bcast_tables_stampede()
 {
@@ -1176,12 +1176,12 @@ int (*MV2_Reduce_function)(const void* sendbuf, void* recvbuf, int count, MPI_Da
 int (*MV2_Reduce_intra_function)(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
                                  MPI_Comm comm_ptr) = NULL;
 
-#define MPIR_Reduce_inter_knomial_wrapper_MV2 simgrid::smpi::Coll_reduce_mvapich2_knomial::reduce
-#define MPIR_Reduce_intra_knomial_wrapper_MV2 simgrid::smpi::Coll_reduce_mvapich2_knomial::reduce
-#define MPIR_Reduce_binomial_MV2 simgrid::smpi::Coll_reduce_binomial::reduce
-#define MPIR_Reduce_redscat_gather_MV2 simgrid::smpi::Coll_reduce_scatter_gather::reduce
-#define MPIR_Reduce_shmem_MV2 simgrid::smpi::Coll_reduce_ompi_basic_linear::reduce
-#define MPIR_Reduce_two_level_helper_MV2 simgrid::smpi::Coll_reduce_mvapich2_two_level::reduce
+#define MPIR_Reduce_inter_knomial_wrapper_MV2 simgrid::smpi::reduce__mvapich2_knomial
+#define MPIR_Reduce_intra_knomial_wrapper_MV2 simgrid::smpi::reduce__mvapich2_knomial
+#define MPIR_Reduce_binomial_MV2 simgrid::smpi::reduce__binomial
+#define MPIR_Reduce_redscat_gather_MV2 simgrid::smpi::reduce__scatter_gather
+#define MPIR_Reduce_shmem_MV2 simgrid::smpi::reduce__ompi_basic_linear
+#define MPIR_Reduce_two_level_helper_MV2 simgrid::smpi::reduce__mvapich2_two_level
 
 static void init_mv2_reduce_tables_stampede()
 {
@@ -1400,13 +1400,12 @@ int (*MV2_Red_scat_function)(const void* sendbuf, void* recvbuf, const int* recv
 static int MPIR_Reduce_Scatter_Basic_MV2(const void* sendbuf, void* recvbuf, const int* recvcnts, MPI_Datatype datatype, MPI_Op op,
                                          MPI_Comm comm)
 {
-  simgrid::smpi::Coll_reduce_scatter_default::reduce_scatter(sendbuf, recvbuf, recvcnts, datatype, op, comm);
+  simgrid::smpi::reduce_scatter__default(sendbuf, recvbuf, recvcnts, datatype, op, comm);
   return MPI_SUCCESS;
 }
-#define MPIR_Reduce_scatter_non_comm_MV2 simgrid::smpi::Coll_reduce_scatter_mpich_noncomm::reduce_scatter
-#define MPIR_Reduce_scatter_Rec_Halving_MV2                                                                            \
-  simgrid::smpi::Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter
-#define MPIR_Reduce_scatter_Pair_Wise_MV2 simgrid::smpi::Coll_reduce_scatter_mpich_pair::reduce_scatter
+#define MPIR_Reduce_scatter_non_comm_MV2 simgrid::smpi::reduce_scatter__mpich_noncomm
+#define MPIR_Reduce_scatter_Rec_Halving_MV2 simgrid::smpi::reduce_scatter__ompi_basic_recursivehalving
+#define MPIR_Reduce_scatter_Pair_Wise_MV2 simgrid::smpi::reduce_scatter__mpich_pair
 
 static void init_mv2_reduce_scatter_tables_stampede()
 {
@@ -1504,10 +1503,10 @@ int MPIR_Scatter_mcst_wrap_MV2(const void* sendbuf, int sendcnt, MPI_Datatype se
   return 0;
 }
 
-#define MPIR_Scatter_MV2_Binomial simgrid::smpi::Coll_scatter_ompi_binomial::scatter
-#define MPIR_Scatter_MV2_Direct simgrid::smpi::Coll_scatter_ompi_basic_linear::scatter
-#define MPIR_Scatter_MV2_two_level_Binomial simgrid::smpi::Coll_scatter_mvapich2_two_level_binomial::scatter
-#define MPIR_Scatter_MV2_two_level_Direct simgrid::smpi::Coll_scatter_mvapich2_two_level_direct::scatter
+#define MPIR_Scatter_MV2_Binomial simgrid::smpi::scatter__ompi_binomial
+#define MPIR_Scatter_MV2_Direct simgrid::smpi::scatter__ompi_basic_linear
+#define MPIR_Scatter_MV2_two_level_Binomial simgrid::smpi::scatter__mvapich2_two_level_binomial
+#define MPIR_Scatter_MV2_two_level_Direct simgrid::smpi::scatter__mvapich2_two_level_direct
 
 static void init_mv2_scatter_tables_stampede()
 {
index 3461709..46eca5e 100644 (file)
@@ -8,11 +8,11 @@
 
 #include "colls_private.hpp"
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid {
+namespace smpi {
 
-int Coll_allreduce_ompi::allreduce(const void *sbuf, void *rbuf, int count,
-                        MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
+int allreduce__ompi(const void *sbuf, void *rbuf, int count,
+                    MPI_Datatype dtype, MPI_Op op, MPI_Comm comm)
 {
     size_t dsize, block_dsize;
     int comm_size = comm->size();
@@ -29,9 +29,7 @@ int Coll_allreduce_ompi::allreduce(const void *sbuf, void *rbuf, int count,
     block_dsize = dsize * count;
 
     if (block_dsize < intermediate_message) {
-        return (Coll_allreduce_rdb::allreduce (sbuf, rbuf,
-                                                                   count, dtype,
-                                                                   op, comm));
+        return allreduce__rdb(sbuf, rbuf, count, dtype, op, comm);
     }
 
     if( ((op==MPI_OP_NULL) || op->is_commutative()) && (count > comm_size) ) {
@@ -39,27 +37,22 @@ int Coll_allreduce_ompi::allreduce(const void *sbuf, void *rbuf, int count,
         if ((comm_size * segment_size >= block_dsize)) {
             //FIXME: ok, these are not the right algorithms, try to find closer ones
             // lr is a good match for allreduce_ring (difference is mainly the use of sendrecv)
-            return Coll_allreduce_lr::allreduce(sbuf, rbuf, count, dtype,
-                                              op, comm);
+            return allreduce__lr(sbuf, rbuf, count, dtype, op, comm);
         } else {
-           return (Coll_allreduce_ompi_ring_segmented::allreduce (sbuf, rbuf,
-                                                                    count, dtype,
-                                                                    op, comm
-                                                                    /*segment_size*/));
+           return allreduce__ompi_ring_segmented(sbuf, rbuf, count, dtype, op, comm /*segment_size*/);
         }
     }
 
-    return (Coll_allreduce_redbcast::allreduce(sbuf, rbuf, count,
-                                                            dtype, op, comm));
+    return allreduce__redbcast(sbuf, rbuf, count, dtype, op, comm);
 }
 
 
 
-int Coll_alltoall_ompi::alltoall(const void *sbuf, int scount,
-                                             MPI_Datatype sdtype,
-                                             void* rbuf, int rcount,
-                                             MPI_Datatype rdtype,
-                                             MPI_Comm comm)
+int alltoall__ompi(const void *sbuf, int scount,
+                   MPI_Datatype sdtype,
+                   void* rbuf, int rcount,
+                   MPI_Datatype rdtype,
+                   MPI_Comm comm)
 {
     int communicator_size;
     size_t dsize, block_dsize;
@@ -73,40 +66,36 @@ int Coll_alltoall_ompi::alltoall(const void *sbuf, int scount,
     block_dsize = dsize * scount;
 
     if ((block_dsize < 200) && (communicator_size > 12)) {
-        return Coll_alltoall_bruck::alltoall(sbuf, scount, sdtype,
-                                                    rbuf, rcount, rdtype,
-                                                    comm);
+        return alltoall__bruck(sbuf, scount, sdtype,
+                               rbuf, rcount, rdtype, comm);
 
     } else if (block_dsize < 3000) {
-        return Coll_alltoall_basic_linear::alltoall(sbuf, scount, sdtype,
-                                                           rbuf, rcount, rdtype,
-                                                           comm);
+        return alltoall__basic_linear(sbuf, scount, sdtype,
+                                      rbuf, rcount, rdtype, comm);
     }
 
-    return Coll_alltoall_ring::alltoall (sbuf, scount, sdtype,
-                                                    rbuf, rcount, rdtype,
-                                                    comm);
+    return alltoall__ring(sbuf, scount, sdtype,
+                          rbuf, rcount, rdtype, comm);
 }
 
-int Coll_alltoallv_ompi::alltoallv(const void *sbuf, const int *scounts, const int *sdisps,
-                                              MPI_Datatype sdtype,
-                                              void *rbuf, const int *rcounts, const int *rdisps,
-                                              MPI_Datatype rdtype,
-                                              MPI_Comm  comm
-                                              )
+int alltoallv__ompi(const void *sbuf, const int *scounts, const int *sdisps,
+                    MPI_Datatype sdtype,
+                    void *rbuf, const int *rcounts, const int *rdisps,
+                    MPI_Datatype rdtype,
+                    MPI_Comm  comm
+                    )
 {
     /* For starters, just keep the original algorithm. */
-    return Coll_alltoallv_ring::alltoallv(sbuf, scounts, sdisps, sdtype,
-                                                        rbuf, rcounts, rdisps,rdtype,
-                                                        comm);
+    return alltoallv__ring(sbuf, scounts, sdisps, sdtype,
+                           rbuf, rcounts, rdisps,rdtype,
+                           comm);
 }
 
-
-int Coll_barrier_ompi::barrier(MPI_Comm  comm)
+int barrier__ompi(MPI_Comm  comm)
 {    int communicator_size = comm->size();
 
     if( 2 == communicator_size )
-        return Coll_barrier_ompi_two_procs::barrier(comm);
+        return barrier__ompi_two_procs(comm);
 /*     * Basic optimisation. If we have a power of 2 number of nodes*/
 /*     * the use the recursive doubling algorithm, otherwise*/
 /*     * bruck is the one we want.*/
@@ -115,18 +104,15 @@ int Coll_barrier_ompi::barrier(MPI_Comm  comm)
         for( ; communicator_size > 0; communicator_size >>= 1 ) {
             if( communicator_size & 0x1 ) {
                 if( has_one )
-                    return Coll_barrier_ompi_bruck::barrier(comm);
+                    return barrier__ompi_bruck(comm);
                 has_one = 1;
             }
         }
     }
-    return Coll_barrier_ompi_recursivedoubling::barrier(comm);
+    return barrier__ompi_recursivedoubling(comm);
 }
 
-int Coll_bcast_ompi::bcast(void *buff, int count,
-                                          MPI_Datatype datatype, int root,
-                                          MPI_Comm  comm
-                                          )
+int bcast__ompi(void *buff, int count, MPI_Datatype datatype, int root, MPI_Comm  comm)
 {
     /* Decision function based on MX results for
        messages up to 36MB and communicator sizes up to 64 nodes */
@@ -153,82 +139,73 @@ int Coll_bcast_ompi::bcast(void *buff, int count,
        single-element broadcasts */
     if ((message_size < small_message_size) || (count <= 1)) {
         /* Binomial without segmentation */
-        return  Coll_bcast_binomial_tree::bcast (buff, count, datatype,
-                                                      root, comm);
+        return bcast__binomial_tree(buff, count, datatype, root, comm);
 
     } else if (message_size < intermediate_message_size) {
         // SplittedBinary with 1KB segments
-        return Coll_bcast_ompi_split_bintree::bcast(buff, count, datatype,
-                                                         root, comm);
+        return bcast__ompi_split_bintree(buff, count, datatype, root, comm);
 
     }
      //Handle large message sizes
     else if (communicator_size < (a_p128 * message_size + b_p128)) {
         //Pipeline with 128KB segments
         //segsize = 1024  << 7;
-        return Coll_bcast_ompi_pipeline::bcast (buff, count, datatype,
-                                                     root, comm);
+        return bcast__ompi_pipeline(buff, count, datatype, root, comm);
 
 
     } else if (communicator_size < 13) {
         // Split Binary with 8KB segments
-        return Coll_bcast_ompi_split_bintree::bcast(buff, count, datatype,
-                                                         root, comm);
+        return bcast__ompi_split_bintree(buff, count, datatype, root, comm);
 
     } else if (communicator_size < (a_p64 * message_size + b_p64)) {
         // Pipeline with 64KB segments
         //segsize = 1024 << 6;
-        return Coll_bcast_ompi_pipeline::bcast (buff, count, datatype,
-                                                     root, comm);
+        return bcast__ompi_pipeline(buff, count, datatype, root, comm);
 
 
     } else if (communicator_size < (a_p16 * message_size + b_p16)) {
         //Pipeline with 16KB segments
         //segsize = 1024 << 4;
-        return Coll_bcast_ompi_pipeline::bcast (buff, count, datatype,
-                                                     root, comm);
+        return bcast__ompi_pipeline(buff, count, datatype, root, comm);
 
 
     }
     /* Pipeline with 8KB segments */
     //segsize = 1024 << 3;
-    return Coll_bcast_flattree_pipeline::bcast (buff, count, datatype,
-                                                 root, comm
-                                                 /*segsize*/);
+    return bcast__flattree_pipeline(buff, count, datatype, root, comm /*segsize*/);
 #if 0
     /* this is based on gige measurements */
 
     if (communicator_size  < 4) {
-        return Coll_bcast_intra_basic_linear::bcast (buff, count, datatype, root, comm, module);
+        return bcast__intra_basic_linear(buff, count, datatype, root, comm, module);
     }
     if (communicator_size == 4) {
         if (message_size < 524288) segsize = 0;
         else segsize = 16384;
-        return Coll_bcast_intra_bintree::bcast (buff, count, datatype, root, comm, module, segsize);
+        return bcast__intra_bintree(buff, count, datatype, root, comm, module, segsize);
     }
     if (communicator_size <= 8 && message_size < 4096) {
-        return Coll_bcast_intra_basic_linear::bcast (buff, count, datatype, root, comm, module);
+        return bcast__intra_basic_linear(buff, count, datatype, root, comm, module);
     }
     if (communicator_size > 8 && message_size >= 32768 && message_size < 524288) {
         segsize = 16384;
-        return  Coll_bcast_intra_bintree::bcast (buff, count, datatype, root, comm, module, segsize);
+        return  bcast__intra_bintree(buff, count, datatype, root, comm, module, segsize);
     }
     if (message_size >= 524288) {
         segsize = 16384;
-        return Coll_bcast_intra_pipeline::bcast (buff, count, datatype, root, comm, module, segsize);
+        return bcast__intra_pipeline(buff, count, datatype, root, comm, module, segsize);
     }
     segsize = 0;
     /* once tested can swap this back in */
-    /* return Coll_bcast_intra_bmtree::bcast (buff, count, datatype, root, comm, segsize); */
-    return Coll_bcast_intra_bintree::bcast (buff, count, datatype, root, comm, module, segsize);
+    /* return bcast__intra_bmtree(buff, count, datatype, root, comm, segsize); */
+    return bcast__intra_bintree(buff, count, datatype, root, comm, module, segsize);
 #endif  /* 0 */
 }
 
-int Coll_reduce_ompi::reduce(const void *sendbuf, void *recvbuf,
-                                            int count, MPI_Datatype  datatype,
-                                            MPI_Op   op, int root,
-                                            MPI_Comm   comm
-                                            )
+int reduce__ompi(const void *sendbuf, void *recvbuf,
+                 int count, MPI_Datatype  datatype,
+                 MPI_Op   op, int root,
+                 MPI_Comm   comm)
 {
     int communicator_size=0;
     //int segsize = 0;
@@ -257,35 +234,34 @@ int Coll_reduce_ompi::reduce(const void *sendbuf, void *recvbuf,
      */
     if ((op != MPI_OP_NULL) && not op->is_commutative()) {
       if ((communicator_size < 12) && (message_size < 2048)) {
-        return Coll_reduce_ompi_basic_linear::reduce(sendbuf, recvbuf, count, datatype, op, root, comm /*, module*/);
+        return reduce__ompi_basic_linear(sendbuf, recvbuf, count, datatype, op, root, comm /*, module*/);
       }
-      return Coll_reduce_ompi_in_order_binary::reduce(sendbuf, recvbuf, count, datatype, op, root, comm /*, module,
+      return reduce__ompi_in_order_binary(sendbuf, recvbuf, count, datatype, op, root, comm /*, module,
                                                              0, max_requests*/);
     }
 
     if ((communicator_size < 8) && (message_size < 512)){
         /* Linear_0K */
-        return Coll_reduce_ompi_basic_linear::reduce (sendbuf, recvbuf, count, datatype, op, root, comm);
+        return reduce__ompi_basic_linear(sendbuf, recvbuf, count, datatype, op, root, comm);
     } else if (((communicator_size < 8) && (message_size < 20480)) ||
                (message_size < 2048) || (count <= 1)) {
         /* Binomial_0K */
         //segsize = 0;
-        return Coll_reduce_ompi_binomial::reduce(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
-                                                     segsize, max_requests*/);
+        return reduce__ompi_binomial(sendbuf, recvbuf, count, datatype, op, root, comm/*, module, segsize, max_requests*/);
     } else if (communicator_size > (a1 * message_size + b1)) {
         // Binomial_1K
         //segsize = 1024;
-        return Coll_reduce_ompi_binomial::reduce(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
+        return reduce__ompi_binomial(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
                                                      segsize, max_requests*/);
     } else if (communicator_size > (a2 * message_size + b2)) {
         // Pipeline_1K
         //segsize = 1024;
-        return Coll_reduce_ompi_pipeline::reduce (sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
+        return reduce__ompi_pipeline(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
                                                       segsize, max_requests*/);
     } else if (communicator_size > (a3 * message_size + b3)) {
         // Binary_32K
         //segsize = 32*1024;
-        return Coll_reduce_ompi_binary::reduce( sendbuf, recvbuf, count, datatype, op, root,
+        return reduce__ompi_binary( sendbuf, recvbuf, count, datatype, op, root,
                                                     comm/*, module, segsize, max_requests*/);
     }
 //    if (communicator_size > (a4 * message_size + b4)) {
@@ -295,7 +271,7 @@ int Coll_reduce_ompi::reduce(const void *sendbuf, void *recvbuf,
         // Pipeline_64K
 //        segsize = 64*1024;
 //    }
-    return Coll_reduce_ompi_pipeline::reduce (sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
+    return reduce__ompi_pipeline(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
                                                   segsize, max_requests*/);
 
 #if 0
@@ -305,8 +281,8 @@ int Coll_reduce_ompi::reduce(const void *sendbuf, void *recvbuf,
         fanout = communicator_size - 1;
         /* when linear implemented or taken from basic put here, right now using chain as a linear system */
         /* it is implemented and I shouldn't be calling a chain with a fanout bigger than MAXTREEFANOUT from topo.h! */
-        return Coll_reduce_intra_basic_linear::reduce (sendbuf, recvbuf, count, datatype, op, root, comm, module);
-        /*        return Coll_reduce_intra_chain::reduce (sendbuf, recvbuf, count, datatype, op, root, comm, segsize, fanout); */
+        return reduce__intra_basic_linear(sendbuf, recvbuf, count, datatype, op, root, comm, module);
+        /*        return reduce__intra_chain(sendbuf, recvbuf, count, datatype, op, root, comm, segsize, fanout); */
     }
     if (message_size < 524288) {
         if (message_size <= 65536 ) {
@@ -318,21 +294,21 @@ int Coll_reduce_ompi::reduce(const void *sendbuf, void *recvbuf,
         }
         /* later swap this for a binary tree */
         /*         fanout = 2; */
-        return Coll_reduce_intra_chain::reduce (sendbuf, recvbuf, count, datatype, op, root, comm, module,
-                                                   segsize, fanout, max_requests);
+        return reduce__intra_chain(sendbuf, recvbuf, count, datatype, op, root, comm, module,
+                                   segsize, fanout, max_requests);
     }
     segsize = 1024;
-    return Coll_reduce_intra_pipeline::reduce (sendbuf, recvbuf, count, datatype, op, root, comm, module,
-                                                  segsize, max_requests);
+    return reduce__intra_pipeline(sendbuf, recvbuf, count, datatype, op, root, comm, module,
+                                  segsize, max_requests);
 #endif  /* 0 */
 }
 
-int Coll_reduce_scatter_ompi::reduce_scatter(const void *sbuf, void *rbuf,
-                                                    const int *rcounts,
-                                                    MPI_Datatype dtype,
-                                                    MPI_Op  op,
-                                                    MPI_Comm  comm
-                                                    )
+int reduce_scatter__ompi(const void *sbuf, void *rbuf,
+                         const int *rcounts,
+                         MPI_Datatype dtype,
+                         MPI_Op  op,
+                         MPI_Comm  comm
+                         )
 {
     int comm_size, i, pow2;
     size_t total_message_size, dsize;
@@ -342,7 +318,7 @@ int Coll_reduce_scatter_ompi::reduce_scatter(const void *sbuf, void *rbuf,
     const size_t large_message_size = 256 * 1024;
     int zerocounts = 0;
 
-    XBT_DEBUG("Coll_reduce_scatter_ompi::reduce_scatter");
+    XBT_DEBUG("reduce_scatter__ompi");
 
     comm_size = comm->size();
     // We need data size for decision function
@@ -356,7 +332,7 @@ int Coll_reduce_scatter_ompi::reduce_scatter(const void *sbuf, void *rbuf,
     }
 
     if (((op != MPI_OP_NULL) && not op->is_commutative()) || (zerocounts)) {
-      Coll_reduce_scatter_default::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+      reduce_scatter__default(sbuf, rbuf, rcounts, dtype, op, comm);
       return MPI_SUCCESS;
     }
 
@@ -368,25 +344,17 @@ int Coll_reduce_scatter_ompi::reduce_scatter(const void *sbuf, void *rbuf,
     if ((total_message_size <= small_message_size) ||
         ((total_message_size <= large_message_size) && (pow2 == comm_size)) ||
         (comm_size >= a * total_message_size + b)) {
-        return
-            Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(sbuf, rbuf, rcounts,
-                                                                        dtype, op,
-                                                                        comm);
+        return reduce_scatter__ompi_basic_recursivehalving(sbuf, rbuf, rcounts, dtype, op, comm);
     }
-    return Coll_reduce_scatter_ompi_ring::reduce_scatter(sbuf, rbuf, rcounts,
-                                                     dtype, op,
-                                                     comm);
-
-
-
+    return reduce_scatter__ompi_ring(sbuf, rbuf, rcounts, dtype, op, comm);
 }
 
-int Coll_allgather_ompi::allgather(const void *sbuf, int scount,
-                                              MPI_Datatype sdtype,
-                                              void* rbuf, int rcount,
-                                              MPI_Datatype rdtype,
-                                              MPI_Comm  comm
-                                              )
+int allgather__ompi(const void *sbuf, int scount,
+                    MPI_Datatype sdtype,
+                    void* rbuf, int rcount,
+                    MPI_Datatype rdtype,
+                    MPI_Comm  comm
+                    )
 {
     int communicator_size, pow2_size;
     size_t dsize, total_dsize;
@@ -395,9 +363,9 @@ int Coll_allgather_ompi::allgather(const void *sbuf, int scount,
 
     /* Special case for 2 processes */
     if (communicator_size == 2) {
-        return Coll_allgather_pair::allgather (sbuf, scount, sdtype,
-                                                          rbuf, rcount, rdtype,
-                                                          comm/*, module*/);
+        return allgather__pair(sbuf, scount, sdtype,
+                               rbuf, rcount, rdtype,
+                               comm/*, module*/);
     }
 
     /* Determine complete data size */
@@ -416,23 +384,23 @@ int Coll_allgather_ompi::allgather(const void *sbuf, int scount,
     */
     if (total_dsize < 50000) {
         if (pow2_size == communicator_size) {
-            return Coll_allgather_rdb::allgather(sbuf, scount, sdtype,
-                                                                     rbuf, rcount, rdtype,
-                                                                     comm);
+            return allgather__rdb(sbuf, scount, sdtype,
+                                  rbuf, rcount, rdtype,
+                                  comm);
         } else {
-            return Coll_allgather_bruck::allgather(sbuf, scount, sdtype,
-                                                         rbuf, rcount, rdtype,
-                                                         comm);
+            return allgather__bruck(sbuf, scount, sdtype,
+                                    rbuf, rcount, rdtype,
+                                    comm);
         }
     } else {
         if (communicator_size % 2) {
-            return Coll_allgather_ring::allgather(sbuf, scount, sdtype,
-                                                        rbuf, rcount, rdtype,
-                                                        comm);
+            return allgather__ring(sbuf, scount, sdtype,
+                                   rbuf, rcount, rdtype,
+                                   comm);
         } else {
-            return  Coll_allgather_ompi_neighborexchange::allgather(sbuf, scount, sdtype,
-                                                                     rbuf, rcount, rdtype,
-                                                                     comm);
+            return allgather__ompi_neighborexchange(sbuf, scount, sdtype,
+                                                    rbuf, rcount, rdtype,
+                                                    comm);
         }
     }
 
@@ -447,27 +415,27 @@ int Coll_allgather_ompi::allgather(const void *sbuf, int scount,
        - for everything else use ring.
     */
     if ((pow2_size == communicator_size) && (total_dsize < 524288)) {
-        return Coll_allgather_rdb::allgather(sbuf, scount, sdtype,
-                                                                 rbuf, rcount, rdtype,
-                                                                 comm);
+        return allgather__rdb(sbuf, scount, sdtype,
+                              rbuf, rcount, rdtype,
+                              comm);
     } else if (total_dsize <= 81920) {
-        return Coll_allgather_bruck::allgather(sbuf, scount, sdtype,
-                                                     rbuf, rcount, rdtype,
-                                                     comm);
+        return allgather__bruck(sbuf, scount, sdtype,
+                                rbuf, rcount, rdtype,
+                                comm);
     }
-    return Coll_allgather_ring::allgather(sbuf, scount, sdtype,
-                                                rbuf, rcount, rdtype,
-                                                comm);
+    return allgather__ring(sbuf, scount, sdtype,
+                           rbuf, rcount, rdtype,
+                           comm);
 #endif  /* defined(USE_MPICH2_DECISION) */
 }
 
-int Coll_allgatherv_ompi::allgatherv(const void *sbuf, int scount,
-                                               MPI_Datatype sdtype,
-                                               void* rbuf, const int *rcounts,
-                                               const int *rdispls,
-                                               MPI_Datatype rdtype,
-                                               MPI_Comm  comm
-                                               )
+int allgatherv__ompi(const void *sbuf, int scount,
+                     MPI_Datatype sdtype,
+                     void* rbuf, const int *rcounts,
+                     const int *rdispls,
+                     MPI_Datatype rdtype,
+                     MPI_Comm  comm
+                     )
 {
     int i;
     int communicator_size;
@@ -477,9 +445,9 @@ int Coll_allgatherv_ompi::allgatherv(const void *sbuf, int scount,
 
     /* Special case for 2 processes */
     if (communicator_size == 2) {
-        return Coll_allgatherv_pair::allgatherv(sbuf, scount, sdtype,
-                                                           rbuf, rcounts, rdispls, rdtype,
-                                                           comm);
+        return allgatherv__pair(sbuf, scount, sdtype,
+                                rbuf, rcounts, rdispls, rdtype,
+                                comm);
     }
 
     /* Determine complete data size */
@@ -491,30 +459,30 @@ int Coll_allgatherv_ompi::allgatherv(const void *sbuf, int scount,
 
     /* Decision based on allgather decision.   */
     if (total_dsize < 50000) {
-        return Coll_allgatherv_ompi_bruck::allgatherv(sbuf, scount, sdtype,
-                                                      rbuf, rcounts, rdispls, rdtype,
-                                                      comm);
+        return allgatherv__ompi_bruck(sbuf, scount, sdtype,
+                                      rbuf, rcounts, rdispls, rdtype,
+                                      comm);
 
     } else {
         if (communicator_size % 2) {
-            return Coll_allgatherv_ring::allgatherv(sbuf, scount, sdtype,
-                                                         rbuf, rcounts, rdispls, rdtype,
-                                                         comm);
+            return allgatherv__ring(sbuf, scount, sdtype,
+                                    rbuf, rcounts, rdispls, rdtype,
+                                    comm);
         } else {
-            return  Coll_allgatherv_ompi_neighborexchange::allgatherv(sbuf, scount, sdtype,
-                                                                      rbuf, rcounts, rdispls, rdtype,
-                                                                      comm);
+            return  allgatherv__ompi_neighborexchange(sbuf, scount, sdtype,
+                                                      rbuf, rcounts, rdispls, rdtype,
+                                                      comm);
         }
     }
 }
 
-int Coll_gather_ompi::gather(const void *sbuf, int scount,
-                                           MPI_Datatype sdtype,
-                                           void* rbuf, int rcount,
-                                           MPI_Datatype rdtype,
-                                           int root,
-                                           MPI_Comm  comm
-                                           )
+int gather__ompi(const void *sbuf, int scount,
+                 MPI_Datatype sdtype,
+                 void* rbuf, int rcount,
+                 MPI_Datatype rdtype,
+                 int root,
+                 MPI_Comm  comm
+                 )
 {
     //const int large_segment_size = 32768;
     //const int small_segment_size = 1024;
@@ -549,31 +517,31 @@ int Coll_gather_ompi::gather(const void *sbuf, int scount,
 /*                                                         root, comm);*/
 
 /*    } else*/ if (block_size > intermediate_block_size) {
-        return Coll_gather_ompi_linear_sync::gather (sbuf, scount, sdtype,
-                                                         rbuf, rcount, rdtype,
-                                                         root, comm);
+        return gather__ompi_linear_sync(sbuf, scount, sdtype,
+                                        rbuf, rcount, rdtype,
+                                        root, comm);
 
     } else if ((communicator_size > large_communicator_size) ||
                ((communicator_size > small_communicator_size) &&
                 (block_size < small_block_size))) {
-        return Coll_gather_ompi_binomial::gather (sbuf, scount, sdtype,
-                                                      rbuf, rcount, rdtype,
-                                                      root, comm);
+        return gather__ompi_binomial(sbuf, scount, sdtype,
+                                     rbuf, rcount, rdtype,
+                                     root, comm);
 
     }
     // Otherwise, use basic linear
-    return Coll_gather_ompi_basic_linear::gather (sbuf, scount, sdtype,
-                                                      rbuf, rcount, rdtype,
-                                                      root, comm);
+    return gather__ompi_basic_linear(sbuf, scount, sdtype,
+                                     rbuf, rcount, rdtype,
+                                     root, comm);
 }
 
 
-int Coll_scatter_ompi::scatter(const void *sbuf, int scount,
-                                            MPI_Datatype sdtype,
-                                            void* rbuf, int rcount,
-                                            MPI_Datatype rdtype,
-                                            int root, MPI_Comm  comm
-                                            )
+int scatter__ompi(const void *sbuf, int scount,
+                  MPI_Datatype sdtype,
+                  void* rbuf, int rcount,
+                  MPI_Datatype rdtype,
+                  int root, MPI_Comm  comm
+                  )
 {
     const size_t small_block_size = 300;
     const int small_comm_size = 10;
@@ -602,11 +570,11 @@ int Coll_scatter_ompi::scatter(const void *sbuf, int scount,
         scount = rcount;
         sdtype = rdtype;
       }
-      return Coll_scatter_ompi_binomial::scatter(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm);
+      return scatter__ompi_binomial(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm);
     }
-    return Coll_scatter_ompi_basic_linear::scatter (sbuf, scount, sdtype,
-                                                       rbuf, rcount, rdtype,
-                                                       root, comm);
+    return scatter__ompi_basic_linear(sbuf, scount, sdtype,
+                                      rbuf, rcount, rdtype,
+                                      root, comm);
 }
 
 }
index 537510b..0264478 100644 (file)
 #define COLL_DESCRIPTION(cat, ret, args, name)                                                                         \
   {                                                                                                                    \
     _XBT_STRINGIFY(name)                                                                                               \
-    , _XBT_STRINGIFY(cat) " " _XBT_STRINGIFY(name) " collective", (void*)_XBT_CONCAT4(Coll_, cat, _, name)::cat        \
+    , _XBT_STRINGIFY(cat) " " _XBT_STRINGIFY(name) " collective", (void*)_XBT_CONCAT3(cat, __, name)        \
   }
 
 #define COLL_PROTO(cat, ret, args, name)                                                                               \
-  class _XBT_CONCAT4(Coll_, cat, _, name) : public Coll {                                                              \
-  public:                                                                                                              \
-    static ret cat(COLL_UNPAREN args);                                                                                 \
-  };
+  ret _XBT_CONCAT3(cat, __, name) args;
 
 #define COLL_UNPAREN(...)  __VA_ARGS__
 
@@ -96,6 +93,10 @@ public:
   static void set_collectives();
 
   // for each collective type, create the set_* prototype, the description array and the function pointer
+//  static void set_gather(const std::string& name);
+//  static s_mpi_coll_description_t mpi_coll_gather_description[];
+//  static int(*gather)(const void *send_buff, int send_count, MPI_Datatype send_type, void *recv_buff, int recv_count, MPI_Datatype recv_type,
+//                      int root, MPI_Comm comm);
   COLL_APPLY(COLL_DEFS, COLL_GATHER_SIG, "")
   COLL_APPLY(COLL_DEFS, COLL_ALLGATHER_SIG, "")
   COLL_APPLY(COLL_DEFS, COLL_ALLGATHERV_SIG, "")
@@ -160,22 +161,6 @@ public:
   static void (*smpi_coll_cleanup_callback)();
 };
 
-class Coll {
-public:
-  // for each collective type, create a function member
-  COLL_APPLY(COLL_SIG, COLL_GATHER_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_ALLGATHER_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_ALLGATHERV_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_REDUCE_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_ALLREDUCE_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_REDUCE_SCATTER_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_SCATTER_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_BARRIER_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_BCAST_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_ALLTOALL_SIG, "")
-  COLL_APPLY(COLL_SIG, COLL_ALLTOALLV_SIG, "")
-};
-
 /*************
  * GATHER *
  *************/
index c1d5476..38d58de 100644 (file)
@@ -132,11 +132,11 @@ MPI_Info smpi_process_info_env(){
 }
 
 void * smpi_process_get_user_data(){
-  return simgrid::s4u::Actor::self()->get_impl()->get_user_data();
+  return simgrid::s4u::Actor::self()->get_data();
 }
 
 void smpi_process_set_user_data(void *data){
-  simgrid::s4u::Actor::self()->get_impl()->set_user_data(data);
+  simgrid::s4u::Actor::self()->set_data(data);
 }
 
 void smpi_comm_set_copy_data_callback(void (*callback) (smx_activity_t, void*, size_t))
index c404c1b..fdd8b69 100644 (file)
@@ -250,7 +250,7 @@ MPI_Comm Comm::split(int color, int key)
   } else {
     recvbuf = nullptr;
   }
-  Coll_gather_default::gather(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
+  gather__default(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, this);
   xbt_free(sendbuf);
   /* Do the actual job */
   if (myrank == 0) {
@@ -340,10 +340,10 @@ void Comm::unref(Comm* comm){
 
 MPI_Comm Comm::find_intra_comm(int * leader){
   //get the indices of all processes sharing the same simix host
-  auto& process_list      = sg_host_self()->pimpl_->process_list_;
+  auto& actor_list        = sg_host_self()->pimpl_->actor_list_;
   int intra_comm_size     = 0;
   int min_index           = INT_MAX; // the minimum index will be the leader
-  for (auto& actor : process_list) {
+  for (auto& actor : actor_list) {
     int index = actor.get_pid();
     if (this->group()->rank(actor.ciface()) != MPI_UNDEFINED) { // Is this process in the current group?
       intra_comm_size++;
@@ -354,7 +354,7 @@ MPI_Comm Comm::find_intra_comm(int * leader){
   XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
   MPI_Group group_intra = new  Group(intra_comm_size);
   int i = 0;
-  for (auto& actor : process_list) {
+  for (auto& actor : actor_list) {
     if (this->group()->rank(actor.ciface()) != MPI_UNDEFINED) {
       group_intra->set_mapping(actor.ciface(), i);
       i++;
@@ -393,7 +393,7 @@ void Comm::init_smp(){
   std::fill_n(leaders_map, comm_size, 0);
   std::fill_n(leader_list, comm_size, -1);
 
-  Coll_allgather_ring::allgather(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
+  allgather__ring(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, this);
 
   if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
     // we need to switch as the called function may silently touch global variables
@@ -451,7 +451,7 @@ void Comm::init_smp(){
   if(comm_intra->rank()==0) {
     int is_uniform       = 1;
     int* non_uniform_map = xbt_new0(int,leader_group_size);
-    Coll_allgather_ring::allgather(&my_local_size, 1, MPI_INT,
+    allgather__ring(&my_local_size, 1, MPI_INT,
         non_uniform_map, 1, MPI_INT, leader_comm);
     for(i=0; i < leader_group_size; i++) {
       if(non_uniform_map[0] != non_uniform_map[i]) {
@@ -466,7 +466,7 @@ void Comm::init_smp(){
     }
     is_uniform_=is_uniform;
   }
-  Coll_bcast_scatter_LR_allgather::bcast(&(is_uniform_),1, MPI_INT, 0, comm_intra );
+  bcast__scatter_LR_allgather(&(is_uniform_),1, MPI_INT, 0, comm_intra );
 
   if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
     // we need to switch as the called function may silently touch global variables
@@ -485,7 +485,7 @@ void Comm::init_smp(){
   }
 
   int global_blocked;
-  Coll_allreduce_default::allreduce(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, this);
+  allreduce__default(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, this);
 
   if(MPI_COMM_WORLD==MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD){
     if(this->rank()==0){
@@ -571,6 +571,7 @@ MPI_Comm Comm::split_type(int type, int /*key*/, MPI_Info)
   if(type != MPI_UNDEFINED)
     return res;
   else{
+    xbt_assert(res->refcount_ == 1); // ensure the next call to Comm::destroy really frees the comm
     Comm::destroy(res);
     return MPI_COMM_NULL;
   }
index fb70b84..00d32b2 100644 (file)
@@ -7,9 +7,6 @@
 #include "smpi_group.hpp"
 #include "smpi_comm.hpp"
 #include <string>
-#include <xbt/log.h>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi, "Logging specific to SMPI (group)");
 
 simgrid::smpi::Group mpi_MPI_GROUP_EMPTY;
 MPI_Group MPI_GROUP_EMPTY=&mpi_MPI_GROUP_EMPTY;
index 852bf1c..9888163 100644 (file)
@@ -15,8 +15,6 @@
 #include "ampi.hpp"
 #include <smpi/sampi.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(plugin_pampi, smpi, "Logging specific to the AMPI functions");
-
 static std::vector<size_t> memory_size(500, 0); // FIXME cheinrich This needs to be dynamic
 static std::map</*address*/ void*, size_t> alloc_table; // Keep track of all allocations
 
index bc1320d..7bd5141 100644 (file)
@@ -9,8 +9,6 @@
 #include <src/instr/instr_smpi.hpp>
 #include <src/smpi/include/smpi_actor.hpp>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_sampi, instr, "Tracing (S)AMPI");
-
 static std::map<std::string, std::string> ampi_colors = {{"migrate", "0.2 0.5 0.2"},
   {"iteration", "0.5 0.5 0.5"}
 };
index c58d907..7e09b46 100644 (file)
@@ -93,7 +93,7 @@ public:
       // Update the process and host mapping in SimGrid.
       XBT_DEBUG("Migrating process %li from %s to %s", my_proc_id, cur_host->get_cname(), migrate_to_host->get_cname());
       TRACE_smpi_process_change_host(my_proc_id, migrate_to_host);
-      simgrid::s4u::this_actor::migrate(migrate_to_host);
+      simgrid::s4u::this_actor::set_host(migrate_to_host);
     }
 
     smpilb_bar.wait();
index c5817fe..0765a88 100644 (file)
@@ -22,52 +22,6 @@ namespace surf {
 /*********
  * Model *
  *********/
-/* Helper function for executeParallelTask */
-static inline double has_cost(const double* array, size_t pos)
-{
-  if (array)
-    return array[pos];
-  return -1.0;
-}
-
-kernel::resource::Action* HostModel::execute_parallel(const std::vector<s4u::Host*>& host_list,
-                                                      const double* flops_amount, const double* bytes_amount,
-                                                      double rate)
-{
-  kernel::resource::Action* action = nullptr;
-  if ((host_list.size() == 1) && (has_cost(bytes_amount, 0) <= 0) && (has_cost(flops_amount, 0) > 0)) {
-    action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
-  } else if ((host_list.size() == 1) && (has_cost(flops_amount, 0) <= 0)) {
-    action = surf_network_model->communicate(host_list[0], host_list[0], bytes_amount[0], rate);
-  } else if ((host_list.size() == 2) && (has_cost(flops_amount, 0) <= 0) && (has_cost(flops_amount, 1) <= 0)) {
-    int nb = 0;
-    double value = 0.0;
-
-    for (size_t i = 0; i < host_list.size() * host_list.size(); i++) {
-      if (has_cost(bytes_amount, i) > 0.0) {
-        nb++;
-        value = has_cost(bytes_amount, i);
-      }
-    }
-    if (nb == 1) {
-      action = surf_network_model->communicate(host_list[0], host_list[1], value, rate);
-    } else if (nb == 0) {
-      xbt_die("Cannot have a communication with no flop to exchange in this model. You should consider using the "
-          "ptask model");
-    } else {
-      xbt_die("Cannot have a communication that is not a simple point-to-point in this model. You should consider "
-          "using the ptask model");
-    }
-  } else {
-    xbt_die(
-        "This model only accepts one of the following. You should consider using the ptask model for the other cases.\n"
-        " - execution with one host only and no communication\n"
-        " - Self-comms with one host only\n"
-        " - Communications with two hosts and no computation");
-  }
-  return action;
-}
-
 /************
  * Resource *
  ************/
@@ -81,9 +35,9 @@ HostImpl::HostImpl(s4u::Host* host) : piface_(host)
 HostImpl::~HostImpl()
 {
   /* All processes should be gone when the host is turned off (by the end of the simulation). */
-  if (not process_list_.empty()) {
+  if (not actor_list_.empty()) {
     std::string msg = std::string("Shutting down host, but it's not empty:");
-    for (auto const& process : process_list_)
+    for (auto const& process : actor_list_)
       msg += "\n\t" + std::string(process.get_name());
 
     SIMIX_display_process_status();
@@ -119,14 +73,12 @@ void HostImpl::turn_on()
 }
 
 /** Kill all actors hosted here */
-void HostImpl::turn_off()
+void HostImpl::turn_off(kernel::actor::ActorImpl* issuer)
 {
-  if (not process_list_.empty()) {
-    for (auto& actor : process_list_) {
-      XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
-                actor.get_host()->get_cname(), SIMIX_process_self()->get_cname());
-      SIMIX_process_self()->kill(&actor);
-    }
+  for (auto& actor : actor_list_) {
+    XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
+              actor.get_host()->get_cname(), issuer->get_cname());
+    issuer->kill(&actor);
   }
   // When a host is turned off, we want to keep only the actors that should restart for when it will boot again.
   // Then get rid of the others.
@@ -142,20 +94,20 @@ void HostImpl::turn_off()
 std::vector<s4u::ActorPtr> HostImpl::get_all_actors()
 {
   std::vector<s4u::ActorPtr> res;
-  for (auto& actor : process_list_)
+  for (auto& actor : actor_list_)
     res.push_back(actor.ciface());
   return res;
 }
 size_t HostImpl::get_actor_count()
 {
-  return process_list_.size();
+  return actor_list_.size();
 }
 
 std::vector<s4u::Disk*> HostImpl::get_disks()
 {
   std::vector<s4u::Disk*> disks;
   for (auto const& d : disks_)
-    disks.push_back(&d->piface_);
+    disks.push_back(d->get_iface());
   return disks;
 }
 
@@ -181,7 +133,7 @@ std::vector<const char*> HostImpl::get_attached_storages()
   std::vector<const char*> storages;
   for (auto const& s : storage_)
     if (s.second->get_host() == piface_->get_cname())
-      storages.push_back(s.second->piface_.get_cname());
+      storages.push_back(s.second->get_iface()->get_cname());
   return storages;
 }
 
index 6583e66..0aef460 100644 (file)
@@ -32,7 +32,7 @@ public:
 
   virtual kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list,
                                                      const double* flops_amount, const double* bytes_amount,
-                                                     double rate);
+                                                     double rate) = 0;
 };
 
 /************
@@ -43,8 +43,11 @@ public:
  * @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
  */
 class XBT_PRIVATE HostImpl : public simgrid::surf::PropertyHolder {
+  std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
+  s4u::Host* piface_ = nullptr; // FIXME: why don't we store a s4u::Host here as we do everywhere else?
 
 public:
+  friend simgrid::vm::VirtualMachineImpl;
   explicit HostImpl(s4u::Host* host);
   virtual ~HostImpl();
 
@@ -58,22 +61,24 @@ public:
   std::map<std::string, kernel::resource::StorageImpl*> storage_;
   std::vector<kernel::resource::DiskImpl*> disks_;
 
-  s4u::Host* piface_ = nullptr;
+  s4u::Host* get_iface() { return piface_; }
 
   void turn_on();
-  void turn_off();
+  void turn_off(kernel::actor::ActorImpl* issuer);
   std::vector<s4u::ActorPtr> get_all_actors();
   size_t get_actor_count();
+  void add_actor(kernel::actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
+  void remove_actor(kernel::actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
+  void add_actor_at_boot(kernel::actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); }
 
   typedef 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>>
+                                    &kernel::actor::ActorImpl::host_actor_list_hook>>
       ActorList;
 
   // FIXME: make these private
-  ActorList process_list_;
-  std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
+  ActorList actor_list_;
 };
 }
 }
index 3590cae..bd885d0 100644 (file)
@@ -60,6 +60,8 @@ public:
  * @details A Storage represent a storage unit (e.g.: hard drive, usb key)
  */
 class StorageImpl : public Resource, public surf::PropertyHolder {
+  s4u::Storage piface_;
+
 public:
   /** @brief Storage constructor */
   StorageImpl(Model* model, const std::string& name, kernel::lmm::System* maxmin_system, double bread, double bwrite,
@@ -69,9 +71,7 @@ public:
 
   ~StorageImpl() override;
 
-  /** @brief Public interface */
-  s4u::Storage piface_;
-
+  s4u::Storage* get_iface() { return &piface_; }
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool is_used() override;
 
index d7f2995..18b646e 100644 (file)
@@ -30,6 +30,7 @@ HostCLM03Model::HostCLM03Model()
 {
   all_existing_models.push_back(this);
 }
+
 double HostCLM03Model::next_occurring_event(double now)
 {
   double min_by_cpu = surf_cpu_model_pm->next_occurring_event(now);
@@ -57,5 +58,51 @@ void HostCLM03Model::update_actions_state(double /*now*/, double /*delta*/)
   /* I've no action to update */
 }
 
+/* Helper function for executeParallelTask */
+static inline double has_cost(const double* array, size_t pos)
+{
+  if (array)
+    return array[pos];
+  return -1.0;
+}
+
+kernel::resource::Action* HostCLM03Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
+                                                           const double* flops_amount, const double* bytes_amount,
+                                                           double rate)
+{
+  kernel::resource::Action* action = nullptr;
+  if ((host_list.size() == 1) && (has_cost(bytes_amount, 0) <= 0) && (has_cost(flops_amount, 0) > 0)) {
+    action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
+  } else if ((host_list.size() == 1) && (has_cost(flops_amount, 0) <= 0)) {
+    action = surf_network_model->communicate(host_list[0], host_list[0], bytes_amount[0], rate);
+  } else if ((host_list.size() == 2) && (has_cost(flops_amount, 0) <= 0) && (has_cost(flops_amount, 1) <= 0)) {
+    int nb       = 0;
+    double value = 0.0;
+
+    for (size_t i = 0; i < host_list.size() * host_list.size(); i++) {
+      if (has_cost(bytes_amount, i) > 0.0) {
+        nb++;
+        value = has_cost(bytes_amount, i);
+      }
+    }
+    if (nb == 1) {
+      action = surf_network_model->communicate(host_list[0], host_list[1], value, rate);
+    } else if (nb == 0) {
+      xbt_die("Cannot have a communication with no flop to exchange in this model. You should consider using the "
+              "ptask model");
+    } else {
+      xbt_die("Cannot have a communication that is not a simple point-to-point in this model. You should consider "
+              "using the ptask model");
+    }
+  } else {
+    xbt_die(
+        "This model only accepts one of the following. You should consider using the ptask model for the other cases.\n"
+        " - execution with one host only and no communication\n"
+        " - Self-comms with one host only\n"
+        " - Communications with two hosts and no computation");
+  }
+  return action;
+}
+
 } // namespace surf
 } // namespace simgrid
index 65ed7f5..7ab9e0e 100644 (file)
@@ -20,6 +20,8 @@ public:
   HostCLM03Model();
   double next_occurring_event(double now) override;
   void update_actions_state(double now, double delta) override;
+  kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+                                             const double* bytes_amount, double rate) override;
 };
 }
 }
index 4c04ee8..c8f084c 100644 (file)
@@ -242,14 +242,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
     if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
       NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
 
-      double rate = wifi_link->get_host_rate(src);
-      if (rate == -1)
-        rate = wifi_link->get_host_rate(dst);
-      xbt_assert(rate != -1,
+      double wifi_rate = wifi_link->get_host_rate(src);
+      if (wifi_rate == -1.0)
+        wifi_rate = wifi_link->get_host_rate(dst);
+      xbt_assert(wifi_rate != -1.0,
                  "None of the source (%s) or destination (%s) is connected to the Access Point '%s'. "
                  "Please use set_host_rate() on all stations.",
                  src->get_cname(), dst->get_cname(), link->get_cname());
-      get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / rate);
+      get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / wifi_rate);
 
     } else {
       get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0);
@@ -306,7 +306,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& nam
   if (policy == s4u::Link::SharingPolicy::FATPIPE)
     get_constraint()->unshare();
 
-  simgrid::s4u::Link::on_creation(this->piface_);
+  simgrid::s4u::Link::on_creation(*get_iface());
 }
 
 void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
index ea9039e..d5ecd17 100644 (file)
@@ -109,6 +109,7 @@ public:
  */
 class LinkImpl : public Resource, public surf::PropertyHolder {
   bool currently_destroying_ = false;
+  s4u::Link piface_;
 
 protected:
   LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint* constraint);
@@ -120,7 +121,7 @@ public:
   void destroy(); // Must be called instead of the destructor
 
   /** @brief Public interface */
-  s4u::Link piface_;
+  s4u::Link* get_iface() { return &piface_; }
 
   /** @brief Get the bandwidth in bytes per second of current Link */
   virtual double get_bandwidth();
index be6a65d..711f4f2 100644 (file)
@@ -285,7 +285,7 @@ LinkNS3::LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwid
   bandwidth_.peak = bandwidth;
   latency_.peak   = latency;
 
-  s4u::Link::on_creation(this->piface_);
+  s4u::Link::on_creation(*this->get_iface());
 }
 
 LinkNS3::~LinkNS3() = default;
index 10eb70b..f7b761f 100644 (file)
@@ -24,7 +24,7 @@ NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& nam
   for (auto bandwidth : bandwidths)
     bandwidths_.push_back({bandwidth, 1.0, nullptr});
 
-  simgrid::s4u::Link::on_creation(this->piface_);
+  simgrid::s4u::Link::on_creation(*get_iface());
 }
 
 void NetworkWifiLink::set_host_rate(s4u::Host* host, int rate_level)
index 260757a..3b1ca2e 100644 (file)
@@ -254,7 +254,7 @@ LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwid
   if (policy == s4u::Link::SharingPolicy::FATPIPE)
     get_constraint()->unshare();
 
-  s4u::Link::on_creation(this->piface_);
+  s4u::Link::on_creation(*get_iface());
 }
 
 kernel::resource::CpuAction* CpuL07::execution_start(double size)
index 9f7b635..c86fbbb 100644 (file)
@@ -460,7 +460,7 @@ void sg_platf_new_actor(simgrid::kernel::routing::ActorCreationArgs* actor)
   simgrid::kernel::actor::ProcessArg* arg =
       new simgrid::kernel::actor::ProcessArg(actor_name, code, nullptr, host, kill_time, properties, auto_restart);
 
-  host->pimpl_->actors_at_boot_.emplace_back(arg);
+  host->pimpl_->add_actor_at_boot(arg);
 
   if (start_time > SIMIX_get_clock()) {
 
index 22246c5..90a77b4 100644 (file)
@@ -96,7 +96,7 @@ StorageN11::StorageN11(StorageModel* model, const std::string& name, lmm::System
     : 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);
-  s4u::Storage::on_creation(this->piface_);
+  s4u::Storage::on_creation(*get_iface());
 }
 
 StorageAction* StorageN11::io_start(sg_size_t size, s4u::Io::OpType type)
index 0b2ea3c..3f3dc80 100644 (file)
@@ -92,7 +92,7 @@ void surf_network_model_init_NS3() {
 #endif
 
 const std::vector<surf_model_description_t> surf_cpu_model_description = {
-    {"Cas01", "Simplistic CPU model (time=size/power).", &surf_cpu_model_init_Cas01},
+    {"Cas01", "Simplistic CPU model (time=size/speed).", &surf_cpu_model_init_Cas01},
 };
 
 const std::vector<surf_model_description_t> surf_host_model_description = {
index 35d4bca..f046293 100644 (file)
@@ -14,8 +14,8 @@ XBT_PUBLIC void sg_platf_exit();
 
 XBT_PUBLIC void surf_parse_open(const std::string& file);
 XBT_PUBLIC void surf_parse_close();
-XBT_PUBLIC void surf_parse_assert(bool cond, const std::string& msg);
-XBT_ATTRIB_NORETURN XBT_PUBLIC void surf_parse_error(const std::string& msg);
+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(const std::string& hostname, const std::string& pre,
                                            const std::string& post);
 
@@ -28,6 +28,6 @@ XBT_PUBLIC std::vector<double> surf_parse_get_bandwidths(const char* string, con
                                                          const std::string& name);
 XBT_PUBLIC double surf_parse_get_speed(const char* string, const char* entity_kind, const std::string& name);
 
-XBT_PUBLIC int surf_parse(); /* Entry-point to the parser */
+XBT_PUBLIC void surf_parse(); /* Entry-point to the parser */
 
 #endif
index f95634f..8446b10 100644 (file)
@@ -32,9 +32,8 @@ XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link
 
 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());
+  surf_parse_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
+         std::string("Cannot connect trace ")+ trace_connect->trace+ " to "+trace_connect->element+": trace unknown");
 
   switch (trace_connect->kind) {
     case simgrid::kernel::routing::TraceConnectKind::HOST_AVAIL:
@@ -92,64 +91,57 @@ void parse_platform_file(const std::string& file)
 
   // Use XML parser
 
-  int parse_status;
-
   /* init the flex parser */
   surf_parse_open(file);
 
   /* Do the actual parsing */
-  parse_status = surf_parse();
+  surf_parse();
 
   /* connect all profiles relative to hosts */
   for (auto const& elm : trace_connect_list_host_avail) {
-    xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
-    simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
-
-    simgrid::s4u::Host* host = simgrid::s4u::Host::by_name_or_null(elm.second);
-    xbt_assert(host, "Host %s undefined", elm.second.c_str());
-    simgrid::kernel::resource::Cpu* cpu = host->pimpl_cpu;
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"HOST_AVAIL\">: Trace ")+elm.first+" undefined.");
+    auto profile = traces_set_list.at(elm.first);
 
-    cpu->set_state_profile(profile);
+    auto host = simgrid::s4u::Host::by_name_or_null(elm.second);
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"HOST_AVAIL\">: Host ")+elm.second+" undefined.");
+    host->set_state_profile(profile);
   }
 
   for (auto const& elm : trace_connect_list_host_speed) {
-    xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
-    simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
-
-    simgrid::s4u::Host* host = simgrid::s4u::Host::by_name_or_null(elm.second);
-    xbt_assert(host, "Host %s undefined", elm.second.c_str());
-    simgrid::kernel::resource::Cpu* cpu = host->pimpl_cpu;
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"SPEED\">: Trace ")+elm.first+" undefined.");
+    auto profile = traces_set_list.at(elm.first);
 
-    cpu->set_speed_profile(profile);
+    auto host = simgrid::s4u::Host::by_name_or_null(elm.second);
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"SPEED\">: Host ")+elm.second+" undefined.");
+    host->set_speed_profile(profile);
   }
 
   for (auto const& elm : trace_connect_list_link_avail) {
-    xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
-    simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LINK_AVAIL\">: Trace ")+elm.first+" undefined.");
+    auto profile = traces_set_list.at(elm.first);
 
-    sg_link_t link = simgrid::s4u::Link::by_name(elm.second);
-    xbt_assert(link, "Link %s undefined", elm.second.c_str());
+    auto link = simgrid::s4u::Link::by_name(elm.second);
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LINK_AVAIL\">: Link ")+elm.second+" undefined.");
     link->set_state_profile(profile);
   }
 
   for (auto const& elm : trace_connect_list_link_bw) {
-    xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
-    simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
-    sg_link_t link                             = simgrid::s4u::Link::by_name(elm.second);
-    xbt_assert(link, "Link %s undefined", elm.second.c_str());
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"BANDWIDTH\">: Trace ")+elm.first+" undefined.");
+    auto profile = traces_set_list.at(elm.first);
+
+    auto link                             = simgrid::s4u::Link::by_name(elm.second);
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"BANDWIDTH\">: Link ")+elm.second+" undefined.");
     link->set_bandwidth_profile(profile);
   }
 
   for (auto const& elm : trace_connect_list_link_lat) {
-    xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
-    simgrid::kernel::profile::Profile* profile = traces_set_list.at(elm.first);
-    sg_link_t link                             = simgrid::s4u::Link::by_name(elm.second);
-    xbt_assert(link, "Link %s undefined", elm.second.c_str());
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LATENCY\">: Trace ")+elm.first+" undefined.");
+    auto profile = traces_set_list.at(elm.first);
+
+    auto link    = simgrid::s4u::Link::by_name(elm.second);
+    surf_parse_assert(traces_set_list.find(elm.first) != traces_set_list.end(), std::string("<trace_connect kind=\"LATENCY\">: Link ")+elm.second+" undefined.");
     link->set_latency_profile(profile);
   }
 
   surf_parse_close();
-
-  if (parse_status)
-    surf_parse_error(std::string("Parse error in ") + file);
 }
index cf6f7af..ffec861 100644 (file)
@@ -3,6 +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 "simgrid/Exception.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/sg_config.hpp"
@@ -33,24 +34,15 @@ std::vector<simgrid::kernel::resource::DiskImpl*> parsed_disk_list; /* temporary
 /*
  * Helping functions
  */
-void surf_parse_assert(bool cond, const std::string& msg)
+void surf_parse_assert(bool cond, std::string&& msg)
 {
-  if (not cond) {
-    int lineno = surf_parse_lineno;
-    cleanup();
-    XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename.c_str(), lineno, msg.c_str());
-    surf_exit();
-    xbt_die("Exiting now");
-  }
+  if (not cond)
+    surf_parse_error(std::move(msg));
 }
 
-void surf_parse_error(const std::string& msg)
+void surf_parse_error(std::string&& msg)
 {
-  int lineno = surf_parse_lineno;
-  cleanup();
-  XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename.c_str(), lineno, msg.c_str());
-  surf_exit();
-  xbt_die("Exiting now");
+  throw simgrid::ParseError(surf_parse_lineno, surf_parsed_filename, std::move(msg));
 }
 
 void surf_parse_assert_netpoint(const std::string& hostname, const std::string& pre, const std::string& post)
@@ -81,7 +73,7 @@ void surf_parse_assert_netpoint(const std::string& hostname, const std::string&
       break;
     }
   }
-  surf_parse_error(msg);
+  surf_parse_error(std::move(msg));
 }
 
 double surf_parse_get_double(const std::string& s)
@@ -361,7 +353,7 @@ void ETag_surfxml_include()
 void STag_surfxml_platform() {
   XBT_ATTRIB_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
 
-  xbt_assert((version >= 1.0), "******* BIG FAT WARNING *********\n "
+  surf_parse_assert((version >= 1.0), "******* BIG FAT WARNING *********\n "
       "You're using an ancient XML file.\n"
       "Since SimGrid 3.1, units are Bytes, Flops, and seconds "
       "instead of MBytes, MFlops and seconds.\n"
@@ -375,13 +367,13 @@ void STag_surfxml_platform() {
 
       "Last, do not forget to also update your values for "
       "the calls to MSG_task_create (if any).");
-  xbt_assert((version >= 3.0), "******* BIG FAT WARNING *********\n "
+  surf_parse_assert((version >= 3.0), "******* BIG FAT WARNING *********\n "
       "You're using an old XML file.\n"
       "Use simgrid_update_xml to update your file automatically. "
       "This program is installed automatically with SimGrid, or "
       "available in the tools/ directory of the source archive.");
-  xbt_assert((version >= 4.0),
-             "******* FILE %s IS TOO OLD (v:%.1f) *********\n "
+  surf_parse_assert((version >= 4.0),
+             std::string("******* THIS FILE IS TOO OLD (v:")+std::to_string(version)+") *********\n "
              "Changes introduced in SimGrid 3.13:\n"
              "  - 'power' attribute of hosts (and others) got renamed to 'speed'.\n"
              "  - In <trace_connect>, attribute kind=\"POWER\" is now kind=\"SPEED\".\n"
@@ -390,8 +382,7 @@ void STag_surfxml_platform() {
              "\n\n"
              "Use simgrid_update_xml to update your file automatically. "
              "This program is installed automatically with SimGrid, or "
-             "available in the tools/ directory of the source archive.",
-             surf_parsed_filename.c_str(), version);
+             "available in the tools/ directory of the source archive.");
   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"
@@ -400,11 +391,10 @@ void STag_surfxml_platform() {
              "available in the tools/ directory of the source archive.",
              version, surf_parsed_filename.c_str());
   }
-  xbt_assert(version <= 4.1,
-             "******* FILE %s COMES FROM THE FUTURE (v:%.1f) *********\n "
+  surf_parse_assert(version <= 4.1,
+             std::string("******* THIS FILE COMES FROM THE FUTURE (v:")+std::to_string(version)+") *********\n "
              "The most recent formalism that this version of SimGrid understands is v4.1.\n"
-             "Please update your code, or use another, more adapted, file.",
-             surf_parsed_filename.c_str(), version);
+             "Please update your code, or use another, more adapted, file.");
 }
 void ETag_surfxml_platform(){
   simgrid::s4u::Engine::on_platform_created();
@@ -1032,7 +1022,8 @@ void surf_parse_close()
 }
 
 /* Call the lexer to parse the currently opened file */
-int surf_parse()
+void surf_parse()
 {
-  return surf_parse_lex();
+  bool err = surf_parse_lex();
+  surf_parse_assert(not err, "Flex returned an error code");
 }
index fd3e111..2a65be1 100644 (file)
@@ -7,11 +7,8 @@
 
 #include "xbt/automaton.h"
 #include <stdio.h> /* printf */
-#include <xbt/log.h>
 #include <xbt/sysdep.h>
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_automaton, xbt, "Automaton");
-
 struct xbt_automaton_propositional_symbol{
   char* pred;
   /** Callback used to evaluate the value of the symbol */
index bf93af4..bb18110 100644 (file)
 #if HAVE_UNISTD_H
 # include <unistd.h>   /* isatty */
 #endif
-#include <xbt/log.h>
 #include <xbt/sysdep.h>
 
 #include "parserPromela.tab.cacc"
 
-XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_automaton);
-
 static xbt_automaton_t parsed_automaton;
 char* state_id_src;
 
index 5585076..0024345 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.4.1.  */
+/* A Bison parser, made by GNU Bison 3.4.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
@@ -48,7 +48,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.4.1"
+#define YYBISON_VERSION "3.4.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -118,7 +118,7 @@ static void new_transition(char* id, xbt_automaton_exp_label_t label);
 # define YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
-# define YYDEBUG 0
+# define YYDEBUG 1
 #endif
 #if YYDEBUG
 extern int xbt_automaton_parser_debug;
@@ -666,7 +666,9 @@ yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
   if (yytype < YYNTOKENS)
     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
 # endif
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -1267,53 +1269,53 @@ yyreduce:
   case 4:
 #line 64 "parserPromela.yacc"
     { new_state((yyvsp[-1].string), 1);}
-#line 1271 "parserPromela.tab.cacc"
+#line 1273 "parserPromela.tab.cacc"
     break;
 
   case 7:
 #line 68 "parserPromela.yacc"
     { new_transition((yyvsp[-1].string), (yyvsp[-4].label));}
-#line 1277 "parserPromela.tab.cacc"
+#line 1279 "parserPromela.tab.cacc"
     break;
 
   case 8:
 #line 71 "parserPromela.yacc"
     { (yyval.label) = (yyvsp[-1].label); }
-#line 1283 "parserPromela.tab.cacc"
+#line 1285 "parserPromela.tab.cacc"
     break;
 
   case 9:
 #line 72 "parserPromela.yacc"
     { (yyval.label) = xbt_automaton_exp_label_new_or((yyvsp[-2].label), (yyvsp[0].label)); }
-#line 1289 "parserPromela.tab.cacc"
+#line 1291 "parserPromela.tab.cacc"
     break;
 
   case 10:
 #line 73 "parserPromela.yacc"
     { (yyval.label) = xbt_automaton_exp_label_new_and((yyvsp[-2].label), (yyvsp[0].label)); }
-#line 1295 "parserPromela.tab.cacc"
+#line 1297 "parserPromela.tab.cacc"
     break;
 
   case 11:
 #line 74 "parserPromela.yacc"
     { (yyval.label) = xbt_automaton_exp_label_new_not((yyvsp[0].label)); }
-#line 1301 "parserPromela.tab.cacc"
+#line 1303 "parserPromela.tab.cacc"
     break;
 
   case 12:
 #line 75 "parserPromela.yacc"
     { (yyval.label) = xbt_automaton_exp_label_new_one(); }
-#line 1307 "parserPromela.tab.cacc"
+#line 1309 "parserPromela.tab.cacc"
     break;
 
   case 13:
 #line 76 "parserPromela.yacc"
     { (yyval.label) = xbt_automaton_exp_label_new_predicat((yyvsp[0].string)); }
-#line 1313 "parserPromela.tab.cacc"
+#line 1315 "parserPromela.tab.cacc"
     break;
 
 
-#line 1317 "parserPromela.tab.cacc"
+#line 1319 "parserPromela.tab.cacc"
 
       default: break;
     }
index 18c33f7..3add96d 100644 (file)
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.4.1.  */
+/* A Bison parser, made by GNU Bison 3.4.2.  */
 
 /* Bison interface for Yacc-like parsers in C
 
@@ -38,7 +38,7 @@
 # define YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
-# define YYDEBUG 0
+# define YYDEBUG 1
 #endif
 #if YYDEBUG
 extern int xbt_automaton_parser_debug;
index 74126b1..17f5e9c 100644 (file)
@@ -6,7 +6,6 @@
 #include "src/internal_config.h"
 
 #include <xbt/backtrace.hpp>
-#include <xbt/log.h>
 #include <xbt/string.hpp>
 #include <xbt/sysdep.h>
 #include <xbt/virtu.h>
@@ -34,8 +33,6 @@
 #include <boost/stacktrace.hpp>
 #endif
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_backtrace, xbt, "Backtrace");
-
 /** @brief show the backtrace of the current point (lovely while debugging) */
 void xbt_backtrace_display_current()
 {
index 256c277..44361dc 100644 (file)
@@ -130,13 +130,11 @@ static void xbt_dict_rehash(xbt_dict_t dict)
  * @param key the key to set the new data
  * @param key_len the size of the @a key
  * @param data the data to add in the dict
- * @param free_ctn unused parameter (kept for compatibility)
  *
  * Set the @a data in the structure under the @a key, which can be any kind of data, as long as its length is provided
  * in @a key_len.
  */
-void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data,
-                      XBT_ATTRIB_UNUSED void_f_pvoid_t free_ctn)
+void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data)
 {
   unsigned int hash_code = xbt_str_hash_ext(key, key_len);
 
@@ -178,13 +176,12 @@ void xbt_dict_set_ext(xbt_dict_t dict, const char* key, int key_len, void* data,
  * @param dict the dict
  * @param key the key to set the new data
  * @param data the data to add in the dict
- * @param free_ctn unused parameter (kept for compatibility)
  *
  * set the @a data in the structure under the @a key, which is a null terminated string.
  */
-void xbt_dict_set(xbt_dict_t dict, const char *key, void *data, void_f_pvoid_t free_ctn)
+void xbt_dict_set(xbt_dict_t dict, const char* key, void* data)
 {
-  xbt_dict_set_ext(dict, key, strlen(key), data, free_ctn);
+  xbt_dict_set_ext(dict, key, strlen(key), data);
 }
 
 /**
index be4d8a0..9c5bc3b 100644 (file)
@@ -7,8 +7,6 @@
 
 #include "dict_private.h"       /* prototypes of this module */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_elm, xbt_dict, "Dictionaries internals");
-
 xbt_mallocator_t dict_elm_mallocator = NULL;
 
 xbt_dictelm_t xbt_dictelm_new(const char* key, int key_len, unsigned int hash_code, void* content)
index 1fad6b4..15a5d69 100644 (file)
@@ -17,7 +17,7 @@
 #include "xbt/dict.h"
 #include "xbt/mallocator.h"
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 typedef struct s_xbt_dict {
   void_f_pvoid_t free_f;
@@ -37,6 +37,6 @@ XBT_PRIVATE xbt_dictelm_t xbt_dictelm_new(const char* key, int key_len, unsigned
 XBT_PRIVATE void xbt_dictelm_free(xbt_dict_t dict, xbt_dictelm_t element);
 XBT_PRIVATE void xbt_dictelm_set_data(xbt_dict_t dict, xbt_dictelm_t element, void* data);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index dd47436..c7588cd 100644 (file)
@@ -25,7 +25,7 @@ static void debugged_add_ext(xbt_dict_t head, const char* key, const char* data_
 
   INFO("Add " << STR(data_to_fill) << " under " << STR(key));
 
-  xbt_dict_set(head, key, data, nullptr);
+  xbt_dict_set(head, key, data);
 }
 
 static void debugged_add(xbt_dict_t head, const char* key)
@@ -173,19 +173,19 @@ TEST_CASE("xbt::dict: dict data container", "dict")
     head = new_fixture();
     count_check_get_key(head, 7);
     INFO("Change 123 to 'Changed 123'");
-    xbt_dict_set(head, "123", xbt_strdup("Changed 123"), nullptr);
+    xbt_dict_set(head, "123", xbt_strdup("Changed 123"));
     count_check_get_key(head, 7);
 
     INFO("Change 123 back to '123'");
-    xbt_dict_set(head, "123", xbt_strdup("123"), nullptr);
+    xbt_dict_set(head, "123", xbt_strdup("123"));
     count_check_get_key(head, 7);
 
     INFO("Change 12a to 'Dummy 12a'");
-    xbt_dict_set(head, "12a", xbt_strdup("Dummy 12a"), nullptr);
+    xbt_dict_set(head, "12a", xbt_strdup("Dummy 12a"));
     count_check_get_key(head, 7);
 
     INFO("Change 12a to '12a'");
-    xbt_dict_set(head, "12a", xbt_strdup("12a"), nullptr);
+    xbt_dict_set(head, "12a", xbt_strdup("12a"));
     count_check_get_key(head, 7);
 
     INFO("Traverse the resulting dictionary");
@@ -270,7 +270,7 @@ TEST_CASE("xbt::dict: dict data container", "dict")
     xbt_dict_t head = new_fixture();
 
     INFO("Store nullptr under 'null'");
-    xbt_dict_set(head, "null", nullptr, nullptr);
+    xbt_dict_set(head, "null", nullptr);
     search_ext(head, "null", nullptr);
 
     INFO("Check whether I see it while traversing...");
@@ -311,7 +311,7 @@ TEST_CASE("xbt::dict: dict data container", "dict")
           data               = (char*)xbt_dict_get_or_null(head, key);
         } while (data != nullptr);
 
-        xbt_dict_set(head, key, key, nullptr);
+        xbt_dict_set(head, key, key);
         data = (char*)xbt_dict_get(head, key);
         REQUIRE(not strcmp(key, data)); // Retrieved value != Injected value
 
@@ -328,7 +328,7 @@ TEST_CASE("xbt::dict: dict data container", "dict")
       char* key = (char*)xbt_malloc(10);
 
       snprintf(key, 10, "%d", j);
-      xbt_dict_set(head, key, key, nullptr);
+      xbt_dict_set(head, key, key);
     }
 
     INFO("Count the elements (retrieving the key and data for each)");
@@ -367,7 +367,7 @@ TEST_CASE("xbt::dict: dict data container", "dict")
 
     INFO("Insert elements");
     for (int i = 0; i < count; ++i)
-      xbt_dict_set_ext(dict, (char*)&i, sizeof(i), (void*)(intptr_t)i, nullptr);
+      xbt_dict_set_ext(dict, (char*)&i, sizeof(i), (void*)(intptr_t)i);
     REQUIRE(xbt_dict_size(dict) == (unsigned)count); // Bad number of elements in the dictionary
 
     INFO("Check elements");
index c89f325..7e4366a 100644 (file)
@@ -84,8 +84,7 @@ static std::terminate_handler previous_terminate_handler = nullptr;
 
 static void handler()
 {
-  // Avoid doing crazy things if we get an uncaught exception inside
-  // an uncaught exception
+  // Avoid doing crazy things if we get an uncaught exception inside an uncaught exception
   static std::atomic_flag lock = ATOMIC_FLAG_INIT;
   if (lock.test_and_set()) {
     XBT_ERROR("Handling an exception raised an exception. Bailing out.");
@@ -99,6 +98,13 @@ static void handler()
     std::rethrow_exception(e);
   }
 
+  // Parse error are handled differently, as the call stack does not matter, only the file location
+  catch (simgrid::ParseError& e) {
+    XBT_ERROR("%s", e.what());
+    XBT_ERROR("Exiting now.");
+    std::abort();
+  }
+
   // We manage C++ exception ourselves
   catch (std::exception& e) {
     log_exception(xbt_log_priority_critical, "Uncaught exception", e);
@@ -108,8 +114,7 @@ static void handler()
 
   catch (const simgrid::ForcefulKillException&) {
     XBT_ERROR("Received a ForcefulKillException at the top-level exception handler. Maybe a Java->C++ call that is not "
-              "protected "
-              "in a try/catch?");
+              "protected in a try/catch?");
     show_backtrace(bt);
   }
 
@@ -124,6 +129,7 @@ static void handler()
       std::abort();
     }
   }
+  XBT_INFO("BAM");
 }
 
 void install_exception_handler()
index 7ed76dd..db3ee33 100644 (file)
@@ -94,7 +94,7 @@
 
 #define ADDRESS(B) ((void*) (((ADDR2UINT(B)) - 1) * BLOCKSIZE + (char*) mdp -> heapbase))
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Doubly linked lists of free fragments.  */
 struct list {
@@ -293,6 +293,6 @@ XBT_PRIVATE int malloc_use_mmalloc(void);
 
 XBT_PRIVATE size_t mmalloc_get_bytes_used_remote(size_t heaplimit, const malloc_info* heapinfo);
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index 1992ab4..14bde58 100644 (file)
@@ -12,8 +12,6 @@
 #include "src/kernel/activity/MutexImpl.hpp"
 #include "xbt/synchro.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism");
-
 /****** mutex related functions ******/
 xbt_mutex_t xbt_mutex_init(void)
 {
index 0b5b855..f7e2f17 100644 (file)
@@ -9,7 +9,7 @@
 #define XBT_MODINTER_H
 #include "xbt/misc.h"
 
-SG_BEGIN_DECL()
+SG_BEGIN_DECL
 
 /* Modules definitions */
 
@@ -25,6 +25,6 @@ void mmalloc_postexit(void);
 extern int smx_cleaned;
 extern int xbt_initialized;
 
-SG_END_DECL()
+SG_END_DECL
 
 #endif
index f959e9c..7abd4e9 100644 (file)
@@ -26,7 +26,6 @@ static const unsigned long int FILE_SIZE = FILE_PIECES * PIECES_BLOCKS * BLOCK_S
 /** Number of blocks asked by each request */
 #define BLOCKS_REQUESTED 2
 
-#define ENABLE_END_GAME_MODE 1
 #define SLEEP_DURATION 1
 
 int count_pieces(unsigned int bitfield)
@@ -204,7 +203,7 @@ int get_peers_data(peer_t peer)
       // Add the peers the tracker gave us to our peer list.
       xbt_dynar_foreach (data->peers, i, peer_id) {
         if (peer_id != peer->id)
-          xbt_dict_set_ext(peer->peers, (char*)&peer_id, sizeof(int), connection_new(peer_id), NULL);
+          xbt_dict_set_ext(peer->peers, (char*)&peer_id, sizeof(int), connection_new(peer_id));
       }
       success = 1;
       // free the communication and the task
@@ -292,7 +291,7 @@ void update_active_peers_set(peer_t peer, connection_t remote_peer)
 {
   if ((remote_peer->interested != 0) && (remote_peer->choked_upload == 0)) {
     // add in the active peers set
-    xbt_dict_set_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int), remote_peer, NULL);
+    xbt_dict_set_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int), remote_peer);
   } else if (xbt_dict_get_or_null_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int))) {
     xbt_dict_remove_ext(peer->active_peers, (char*)&remote_peer->id, sizeof(int));
   }
@@ -317,7 +316,7 @@ void handle_message(peer_t peer, msg_task_t task)
     case MESSAGE_HANDSHAKE:
       // Check if the peer is in our connection list.
       if (remote_peer == 0) {
-        xbt_dict_set_ext(peer->peers, (char*)&message->peer_id, sizeof(int), connection_new(message->peer_id), NULL);
+        xbt_dict_set_ext(peer->peers, (char*)&message->peer_id, sizeof(int), connection_new(message->peer_id));
         send_handshake(peer, message->mailbox);
       }
       // Send our bitfield to the peer
@@ -390,10 +389,6 @@ void handle_message(peer_t peer, msg_task_t task)
       XBT_DEBUG(" \t for piece %d (%d,%d)", message->index, message->block_index,
                 message->block_index + message->block_length);
       xbt_assert(!remote_peer->choked_download);
-      xbt_assert(remote_peer->am_interested || ENABLE_END_GAME_MODE,
-                 "Can't received a piece if I'm not interested wihtout end-game mode!"
-                 "piece (%d) bitfield(%u) remote bitfield(%u)",
-                 message->index, peer->bitfield, remote_peer->bitfield);
       xbt_assert(remote_peer->choked_download != 1, "Can't received a piece if I'm choked !");
       xbt_assert((message->index >= 0 && message->index < FILE_PIECES), "Wrong piece received");
       // TODO: Execute Ã  computation.
@@ -417,7 +412,6 @@ void handle_message(peer_t peer, msg_task_t task)
         }
       } else {
         XBT_DEBUG("However, we already have it");
-        xbt_assert(ENABLE_END_GAME_MODE, "Should not happen because we don't use end game mode !");
         request_new_piece_to_peer(peer, remote_peer);
       }
       break;
@@ -485,9 +479,6 @@ int select_piece_to_download(peer_t peer, connection_t remote_peer)
   // end game mode
   if (count_pieces(peer->current_pieces) >= (FILE_PIECES - count_pieces(peer->bitfield)) &&
       (is_interested(peer, remote_peer) != 0)) {
-#if ENABLE_END_GAME_MODE == 0
-    return -1;
-#endif
     int nb_interesting_pieces = 0;
     // compute the number of interesting pieces
     for (int i = 0; i < FILE_PIECES; i++) {
@@ -586,15 +577,15 @@ void update_choked_peers(peer_t peer)
   // update the current round
   peer->round = (peer->round + 1) % 3;
   char* key;
-  char* key_choked         = NULL;
-  connection_t peer_chosen = NULL;
-  connection_t peer_choked = NULL;
+  char* choked_key         = NULL;
+  connection_t chosen_peer = NULL;
+  connection_t choked_peer = NULL;
   // remove a peer from the list
   xbt_dict_cursor_t cursor = NULL;
   xbt_dict_cursor_first(peer->active_peers, &cursor);
   if (!xbt_dict_is_empty(peer->active_peers)) {
-    key_choked  = xbt_dict_cursor_get_key(cursor);
-    peer_choked = xbt_dict_cursor_get_data(cursor);
+    choked_key  = xbt_dict_cursor_get_key(cursor);
+    choked_peer = xbt_dict_cursor_get_data(cursor);
   }
   xbt_dict_cursor_free(&cursor);
 
@@ -607,7 +598,7 @@ void update_choked_peers(peer_t peer)
       if (connection->last_unchoke < unchoke_time && (connection->interested != 0) &&
           (connection->choked_upload != 0)) {
         unchoke_time = connection->last_unchoke;
-        peer_chosen  = connection;
+        chosen_peer  = connection;
       }
     }
   } else {
@@ -624,19 +615,19 @@ void update_choked_peers(peer_t peer)
         connection_t connection;
         xbt_dict_foreach (peer->peers, cursor, key, connection) {
           if (i == id_chosen) {
-            peer_chosen = connection;
+            chosen_peer = connection;
             break;
           }
           i++;
         }
         xbt_dict_cursor_free(&cursor);
-        xbt_assert(peer_chosen != NULL, "A peer should have been selected at this point");
-        if ((peer_chosen->interested == 0) || (peer_chosen->choked_upload == 0))
-          peer_chosen = NULL;
+        xbt_assert(chosen_peer != NULL, "A peer should have been selected at this point");
+        if ((chosen_peer->interested == 0) || (chosen_peer->choked_upload == 0))
+          chosen_peer = NULL;
         else
           XBT_DEBUG("Nothing to do, keep going");
         j++;
-      } while (peer_chosen == NULL && j < MAXIMUM_PEERS);
+      } while (chosen_peer == NULL && j < MAXIMUM_PEERS);
     } else {
       // Use the "fastest download" policy.
       connection_t connection;
@@ -644,34 +635,34 @@ void update_choked_peers(peer_t peer)
       xbt_dict_foreach (peer->peers, cursor, key, connection) {
         if (connection->peer_speed > fastest_speed && (connection->choked_upload != 0) &&
             (connection->interested != 0)) {
-          peer_chosen   = connection;
+          chosen_peer   = connection;
           fastest_speed = connection->peer_speed;
         }
       }
     }
   }
 
-  if (peer_chosen != NULL)
-    XBT_DEBUG("(%d) update_choked peers unchoked (%d) ; int (%d) ; choked (%d) ", peer->id, peer_chosen->id,
-              peer_chosen->interested, peer_chosen->choked_upload);
-
-  if (peer_choked != peer_chosen) {
-    if (peer_choked != NULL) {
-      xbt_assert((!peer_choked->choked_upload), "Tries to choked a choked peer");
-      peer_choked->choked_upload = 1;
-      xbt_assert((*((int*)key_choked) == peer_choked->id));
-      update_active_peers_set(peer, peer_choked);
-      XBT_DEBUG("(%d) Sending a CHOKE to %d", peer->id, peer_choked->id);
-      send_choked(peer, peer_choked->mailbox);
+  if (chosen_peer != NULL)
+    XBT_DEBUG("(%d) update_choked peers unchoked (%d) ; int (%d) ; choked (%d) ", peer->id, chosen_peer->id,
+              chosen_peer->interested, chosen_peer->choked_upload);
+
+  if (choked_peer != chosen_peer) {
+    if (choked_peer != NULL) {
+      xbt_assert((!choked_peer->choked_upload), "Tries to choked a choked peer");
+      choked_peer->choked_upload = 1;
+      xbt_assert((*((int*)choked_key) == choked_peer->id));
+      update_active_peers_set(peer, choked_peer);
+      XBT_DEBUG("(%d) Sending a CHOKE to %d", peer->id, choked_peer->id);
+      send_choked(peer, choked_peer->mailbox);
     }
-    if (peer_chosen != NULL) {
-      xbt_assert((peer_chosen->choked_upload), "Tries to unchoked an unchoked peer");
-      peer_chosen->choked_upload = 0;
-      xbt_dict_set_ext(peer->active_peers, (char*)&peer_chosen->id, sizeof(int), peer_chosen, NULL);
-      peer_chosen->last_unchoke = MSG_get_clock();
-      XBT_DEBUG("(%d) Sending a UNCHOKE to %d", peer->id, peer_chosen->id);
-      update_active_peers_set(peer, peer_chosen);
-      send_unchoked(peer, peer_chosen->mailbox);
+    if (chosen_peer != NULL) {
+      xbt_assert((chosen_peer->choked_upload), "Tries to unchoked an unchoked peer");
+      chosen_peer->choked_upload = 0;
+      xbt_dict_set_ext(peer->active_peers, (char*)&chosen_peer->id, sizeof(int), chosen_peer);
+      chosen_peer->last_unchoke = MSG_get_clock();
+      XBT_DEBUG("(%d) Sending a UNCHOKE to %d", peer->id, chosen_peer->id);
+      update_active_peers_set(peer, chosen_peer);
+      send_unchoked(peer, chosen_peer->mailbox);
     }
   }
 }
index d278ae0..aebee13 100644 (file)
@@ -8,14 +8,9 @@
 #include "tracker.h"
 #include <simgrid/msg.h>
 
-#include <stdio.h> /* snprintf */
-
 /** Bittorrent example launcher */
 int main(int argc, char* argv[])
 {
-  msg_host_t host;
-  unsigned i;
-
   MSG_init(&argc, argv);
 
   /* Check the arguments */
@@ -23,12 +18,6 @@ int main(int argc, char* argv[])
 
   MSG_create_environment(argv[1]);
 
-  xbt_dynar_t host_list = MSG_hosts_as_dynar();
-  xbt_dynar_foreach (host_list, i, host) {
-    char descr[512];
-    snprintf(descr, sizeof descr, "RngSream<%s>", MSG_host_get_name(host));
-  }
-
   MSG_function_register("tracker", tracker);
   MSG_function_register("peer", peer);
 
@@ -36,7 +25,5 @@ int main(int argc, char* argv[])
 
   MSG_main();
 
-  xbt_dynar_free(&host_list);
-
   return 0;
 }
index fde8f93..04e689e 100755 (executable)
@@ -38,7 +38,7 @@ for i in range(1, nb_nodes):
     ok = False
     while not ok:
         my_id = random.randint(0, max_id)
-        ok = not my_id in all_ids
+        ok = my_id not in all_ids
     start_date = i * 10
     line = "  <process host=\"node-%d.simgrid.org\" function=\"peer\">\n" % i
     line += "    <argument value=\"%d\"/>\n    <argument value=\"%d\"/>\n" % (
index 5c52339..b4a467a 100644 (file)
@@ -15,8 +15,7 @@ int tasks_done = 0;
 
 static void task_cleanup_handler(void* task)
 {
-  if (task)
-    MSG_task_destroy(static_cast<msg_task_t>(task));
+  MSG_task_destroy(static_cast<msg_task_t>(task));
 }
 
 static int process_daemon(int /*argc*/, char** /*argv*/)
index 2109376..464fb57 100644 (file)
@@ -1,4 +1,4 @@
-foreach(x actor actor-autorestart actor-migration
+foreach(x actor actor-autorestart
         activity-lifecycle
         comm-pt2pt wait-any-for
         cloud-interrupt-migration cloud-sharing
@@ -13,7 +13,7 @@ endforeach()
 
 ## Add the tests.
 ## Some need to be run with all factories, some need not tesh to run
-foreach(x actor actor-autorestart actor-migration 
+foreach(x actor actor-autorestart
         activity-lifecycle wait-any-for
        cloud-interrupt-migration concurrent_rw) # TODO: actor-autorestart is disabled for now
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
index 97bc3fd..783367f 100644 (file)
@@ -122,21 +122,28 @@ static void test_sleep_restart_middle()
   sleeper5->get_host()->turn_on();
   XBT_INFO("Test %s is ending", __func__);
 }
+
 static void test_sleep_restart_end()
 {
   XBT_INFO("%s: Launch a sleep(5), and restart its host right when it stops", __func__);
   bool sleeper_done = false;
 
   simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], [&sleeper_done]() {
-    assert_exit(true, 5);
+    assert_exit(false, 5);
     simgrid::s4u::this_actor::sleep_for(5);
-    all_hosts[1]->turn_off(); // kill the host right at the end of this sleep and of this actor
     sleeper_done = true;
   });
+  simgrid::s4u::Actor::create("killer", all_hosts[0], []() {
+    simgrid::s4u::this_actor::sleep_for(5);
+    XBT_INFO("Killer!");
+    all_hosts[1]->turn_off();
+    all_hosts[1]->turn_on();
+  });
   simgrid::s4u::this_actor::sleep_for(9);
-  xbt_assert(sleeper_done, "Not sure of how the actor survived the shutdown of its host.");
-  all_hosts[1]->turn_on();
+  xbt_assert(sleeper_done,
+             "Restarted actor was already dead in the scheduling round during which the host_off simcall was issued");
 }
+
 static void test_exec()
 {
   XBT_INFO("%s: Launch a execute(5s), and let it proceed", __func__);
@@ -210,6 +217,7 @@ static void test_exec_restart_middle()
   exec5->get_host()->turn_on();
   XBT_INFO("Test %s is ending", __func__);
 }
+
 static void test_exec_restart_end()
 {
   XBT_INFO("%s: Launch a execute(5s), and restart its host right when it stops", __func__);
@@ -231,6 +239,21 @@ static void test_exec_restart_end()
              "Restarted actor was already dead in the scheduling round during which the host_off simcall was issued");
 }
 
+static void test_turn_off_itself()
+{
+  XBT_INFO("%s: Launch a sleep(5), then saw off the branch it's sitting on", __func__);
+
+  simgrid::s4u::Actor::create("sleep5_restarted", all_hosts[1], []() {
+    assert_exit(true, 5);
+    simgrid::s4u::this_actor::sleep_for(5);
+    simgrid::s4u::this_actor::get_host()->turn_off();
+    xbt_die("I should be dead now");
+  });
+  simgrid::s4u::this_actor::sleep_for(9);
+  all_hosts[1]->turn_on();
+  XBT_INFO("Test %s is ending", __func__);
+}
+
 static void test_comm()
 {
   XBT_INFO("%s: Launch a communication", __func__);
@@ -537,7 +560,7 @@ static void main_dispatcher()
    * to avoid that they exit before their victim dereferences their name */
   run_test("sleep restarted at start", test_sleep_restart_begin);
   run_test("sleep restarted in middle", test_sleep_restart_middle);
-  // run_test("sleep restarted at end", test_sleep_restart_end);
+  run_test("sleep restarted at end", test_sleep_restart_end);
 
   run_test("exec", test_exec);
   run_test("exec killed at start", test_exec_kill_begin);
@@ -546,6 +569,8 @@ static void main_dispatcher()
   run_test("exec restarted in middle", test_exec_restart_middle);
   run_test("exec restarted at end", test_exec_restart_end);
 
+  run_test("turn off its own host", test_turn_off_itself);
+
   run_test("comm", test_comm);
   run_test("comm dsend and quit (put before get)", test_comm_dsend_and_quit_put_before_get);
   run_test("comm dsend and quit (get before put)", test_comm_dsend_and_quit_get_before_put);
diff --git a/teshsuite/s4u/actor-migration/actor-migration.cpp b/teshsuite/s4u/actor-migration/actor-migration.cpp
deleted file mode 100644 (file)
index 7138a05..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (c) 2018-2019. 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_migration, "Messages specific for this s4u example");
-
-simgrid::s4u::Barrier* barrier;
-static simgrid::s4u::ActorPtr controlled_process;
-
-/* The Emigrant process will be moved from host to host. */
-static void emigrant()
-{
-  XBT_INFO("I'll look for a new job on another machine ('Boivin') where the grass is greener.");
-  simgrid::s4u::this_actor::migrate(
-      simgrid::s4u::Host::by_name("Boivin")); /* - First, move to another host by myself */
-
-  XBT_INFO("Yeah, found something to do");
-  simgrid::s4u::this_actor::execute(98095000); /* - Execute some work there */
-  simgrid::s4u::this_actor::sleep_for(2);
-  XBT_INFO("Moving back home after work");
-  simgrid::s4u::this_actor::migrate(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move back to original location */
-  simgrid::s4u::this_actor::migrate(simgrid::s4u::Host::by_name("Boivin"));    /* - Go back to the other host to sleep*/
-  simgrid::s4u::this_actor::sleep_for(4);
-  controlled_process = simgrid::s4u::Actor::self(); /* - Get controlled at checkpoint */
-  barrier->wait();
-  simgrid::s4u::this_actor::suspend();
-  simgrid::s4u::Host* h = simgrid::s4u::this_actor::get_host();
-  XBT_INFO("I've been moved on this new host: %s", h->get_cname());
-  XBT_INFO("Uh, nothing to do here. Stopping now");
-}
-
-/* The policeman check for emigrants and move them back to 'Jacquelin' */
-static void policeman()
-{
-  XBT_INFO("Wait at the checkpoint."); /* - block on the mutex+condition */
-  barrier->wait();
-  controlled_process->migrate(simgrid::s4u::Host::by_name("Jacquelin")); /* - Move an emigrant to Jacquelin */
-  XBT_INFO("I moved the emigrant");
-  controlled_process->resume();
-}
-
-int main(int argc, char* argv[])
-{
-  simgrid::s4u::Engine e(&argc, argv);
-  e.load_platform(argv[1]);
-
-  simgrid::s4u::Actor::create("emigrant", simgrid::s4u::Host::by_name("Jacquelin"), emigrant);
-  simgrid::s4u::Actor::create("policeman", simgrid::s4u::Host::by_name("Boivin"), policeman);
-
-  barrier = new simgrid::s4u::Barrier(2);
-  e.run();
-  XBT_INFO("Simulation time %g", e.get_clock());
-  delete barrier;
-
-  return 0;
-}
diff --git a/teshsuite/s4u/actor-migration/actor-migration.tesh b/teshsuite/s4u/actor-migration/actor-migration.tesh
deleted file mode 100644 (file)
index 2dcf6e5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env tesh
-
-p Testing the migration feature of S4U
-
-! output sort 19
-$ ${bindir:=.}/actor-migration ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:emigrant@Jacquelin) I'll look for a new job on another machine ('Boivin') where the grass is greener.
-> [  0.000000] (1:emigrant@Boivin) Yeah, found something to do
-> [  0.000000] (2:policeman@Boivin) Wait at the checkpoint.
-> [  3.000000] (1:emigrant@Boivin) Moving back home after work
-> [  7.000000] (0:maestro@) Simulation time 7
-> [  7.000000] (1:emigrant@Jacquelin) I've been moved on this new host: Jacquelin
-> [  7.000000] (1:emigrant@Jacquelin) Uh, nothing to do here. Stopping now
-> [  7.000000] (2:policeman@Boivin) I moved the emigrant
index ae49cdc..c3ad26c 100644 (file)
@@ -2,4 +2,4 @@
 $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/flatifier ../platforms/bogus_disk_attachment.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
 > [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:maestro@] Parse error at ../platforms/bogus_disk_attachment.xml:19: Unable to attach storage cdisk: host plouf does not exist.
-> [  0.000000] [0:maestro@] Exiting now
+> [  0.000000] [0:maestro@] Exiting now.
index 20f2519..f9e194d 100644 (file)
@@ -3,11 +3,11 @@ $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/flatifier ../platforms/bogus_missing_src_
 > [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:maestro@] Parse error at ../platforms/bogus_missing_src_gateway.xml:14: zoneRoute gw_src='nod-cluster_router.cluster.us' does name a node. Existing netpoints: 
 > 'node-1.cluster.us','node-2.cluster.us','node-3.cluster.us','node-4.cluster.us','node-cluster_router.cluster.us','noeud-1.grappe.fr','noeud-2.grappe.fr','noeud-3.grappe.fr','noeud-4.grappe.fr','noeud-grappe_router.grappe.fr'
-> [  0.000000] [0:maestro@] Exiting now
+> [  0.000000] [0:maestro@] Exiting now.
 
 ! expect signal SIGABRT
 $ $VALGRIND_NO_LEAK_CHECK ${bindir:=.}/flatifier ../platforms/bogus_missing_dst_gateway.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
 > [  0.000000] [0:maestro@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:maestro@] Parse error at ../platforms/bogus_missing_dst_gateway.xml:14: zoneRoute gw_dst='neud-grappe_router.grappe.fr' does name a node. Existing netpoints: 
 > 'node-1.cluster.us','node-2.cluster.us','node-3.cluster.us','node-4.cluster.us','node-cluster_router.cluster.us','noeud-1.grappe.fr','noeud-2.grappe.fr','noeud-3.grappe.fr','noeud-4.grappe.fr','noeud-grappe_router.grappe.fr'
-> [  0.000000] [0:maestro@] Exiting now
+> [  0.000000] [0:maestro@] Exiting now.
index 33d629b..178c155 100644 (file)
@@ -8,7 +8,7 @@ if(enable_smpi)
   include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
   foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast
             coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong
-            type-hvector type-indexed type-struct type-vector bug-17132 timers privatization 
+            type-hvector type-indexed type-struct type-vector bug-17132 gh-139 timers privatization 
             io-simple io-simple-at io-all io-all-at io-shared io-ordered)
     add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.c)
     target_link_libraries(${x}  simgrid)
@@ -37,7 +37,7 @@ endif()
 
 foreach(x coll-allgather coll-allgatherv coll-allreduce coll-alltoall coll-alltoallv coll-barrier coll-bcast
     coll-gather coll-reduce coll-reduce-scatter coll-scatter macro-sample pt2pt-dsend pt2pt-pingpong
-    type-hvector type-indexed type-struct type-vector bug-17132 timers privatization
+    type-hvector type-indexed type-struct type-vector bug-17132 gh-139 timers privatization
     macro-shared macro-partial-shared macro-partial-shared-communication
     io-simple io-simple-at io-all io-all-at io-shared io-ordered)
   set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
@@ -139,7 +139,8 @@ if(enable_smpi)
   # Extra pt2pt pingpong test: broken usage ti-tracing
   ADD_TESH_FACTORIES(tesh-smpi-broken  "thread"   --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pt2pt-pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong broken_hostfiles.tesh)
   ADD_TESH(tesh-smpi-replay-ti-tracing            --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi/pt2pt-pingpong ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong/TI_output.tesh)
-
+  ADD_TESH_FACTORIES(tesh-smpi-gh-139  "thread"   --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/gh-139 --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/gh-139 gh-139.tesh)
+  
   # Simple privatization tests
   if(HAVE_PRIVATIZATION)
     foreach(PRIVATIZATION dlopen mmap)
index 090c3ff..673f567 100644 (file)
@@ -6,12 +6,9 @@
 
 /* Bug report: https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165 */
 
-#include "xbt/log.h"
 #include <stdio.h>
 #include <mpi.h>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi, "Messages for this SMPI test");
-
 int main(int argc, char ** argv)
 {
   size_t M = 8*1024;
diff --git a/teshsuite/smpi/gh-139/gh-139.c b/teshsuite/smpi/gh-139/gh-139.c
new file mode 100644 (file)
index 0000000..f1de933
--- /dev/null
@@ -0,0 +1,106 @@
+/* Copyright (c) 2019. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <mpi.h>
+#include <simgrid/msg.h>
+#include <simgrid/simix.h>
+#include <stdio.h>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(smpi_test, "Messages specific for this SMPI example");
+
+struct param {
+  MPI_Request* req;
+  int rank;
+};
+
+struct threadwrap {
+  void* father_data;
+  void* (*f)(void*);
+  void* param;
+};
+
+static int global_rank;
+void* req_wait(void* bar);
+
+// Thread creation helper
+
+static int thread_create_wrapper(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+  int the_global_rank  = global_rank;
+  struct threadwrap* t = (struct threadwrap*)sg_actor_self_data();
+  XBT_INFO("new thread has parameter rank %d and global variable rank %d", ((struct param*)(t->param))->rank,
+           the_global_rank);
+  sg_actor_self_data_set(t->father_data);
+  t->f(t->param);
+  sg_actor_self_data_set(NULL);
+  free(t);
+  return 0;
+}
+
+static void mpi_thread_create(const char* name, void* (*f)(void*), void* param)
+{
+  struct threadwrap* threadwrap = (struct threadwrap*)malloc(sizeof(*threadwrap));
+  threadwrap->father_data       = sg_actor_self_data();
+  threadwrap->f                 = f;
+  threadwrap->param             = param;
+  sg_actor_t actor              = sg_actor_init(name, sg_host_self());
+  sg_actor_data_set(actor, threadwrap);
+  sg_actor_start(actor, thread_create_wrapper, 0, NULL);
+}
+
+static void mythread_create(const char* name, MPI_Request* req, int rank)
+{
+  struct param* param = (struct param*)malloc(sizeof(*param));
+  param->req          = req;
+  param->rank         = rank;
+  mpi_thread_create(name, req_wait, param);
+}
+
+// Actual application
+
+void* req_wait(void* bar)
+{
+  struct param* param = (struct param*)bar;
+  int rank;
+  MPI_Status status;
+
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+  XBT_INFO("%d has MPI rank %d and global variable rank %d", param->rank, rank, global_rank);
+  XBT_INFO("%d waiting request", rank);
+  MPI_Wait(param->req, &status);
+  XBT_INFO("%d request done", rank);
+  XBT_INFO("%d still has MPI rank %d and global variable %d", param->rank, rank, global_rank);
+  free(param);
+  return NULL;
+}
+
+int main(int argc, char* argv[])
+{
+  int rank;
+  int size;
+  char c = 0;
+  MPI_Request req;
+  MPI_Init(&argc, &argv);
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  MPI_Comm_size(MPI_COMM_WORLD, &size);
+  XBT_INFO("I'm %d/%d", rank, size);
+  global_rank = rank;
+
+  if (rank == 0) {
+    c = 42;
+    MPI_Isend(&c, 1, MPI_CHAR, 1, 0, MPI_COMM_WORLD, &req);
+    mythread_create("wait send", &req, rank);
+  } else if (rank == 1) {
+    MPI_Irecv(&c, 1, MPI_CHAR, 0, 0, MPI_COMM_WORLD, &req);
+    mythread_create("wait recv", &req, rank);
+  }
+
+  sg_actor_sleep_for(1 + rank);
+  MPI_Finalize();
+  XBT_INFO("finally %d", c);
+  return 0;
+}
diff --git a/teshsuite/smpi/gh-139/gh-139.tesh b/teshsuite/smpi/gh-139/gh-139.tesh
new file mode 100644 (file)
index 0000000..791b307
--- /dev/null
@@ -0,0 +1,15 @@
+$ ${bindir:=.}/../../../smpi_script/bin/smpirun -np 2 -platform ../../../examples/platforms/small_platform.xml -hostfile ../hostfile ${bindir:=.}/gh-139 --cfg=smpi/simulate-computation:no --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+> [Tremblay:0:(1) 0.000000] [smpi_test/INFO] I'm 0/2
+> [Jupiter:1:(2) 0.000000] [smpi_test/INFO] I'm 1/2
+> [Tremblay:wait send:(3) 0.000000] [smpi_test/INFO] new thread has parameter rank 0 and global variable rank 0
+> [Tremblay:wait send:(3) 0.000000] [smpi_test/INFO] 0 has MPI rank -333 and global variable rank 0
+> [Tremblay:wait send:(3) 0.000000] [smpi_test/INFO] -333 waiting request
+> [Tremblay:wait send:(3) 0.000000] [smpi_test/INFO] -333 request done
+> [Tremblay:wait send:(3) 0.000000] [smpi_test/INFO] 0 still has MPI rank -333 and global variable 0
+> [Jupiter:wait recv:(4) 0.000000] [smpi_test/INFO] new thread has parameter rank 1 and global variable rank 1
+> [Jupiter:wait recv:(4) 0.000000] [smpi_test/INFO] 1 has MPI rank -333 and global variable rank 1
+> [Jupiter:wait recv:(4) 0.000000] [smpi_test/INFO] -333 waiting request
+> [Jupiter:wait recv:(4) 0.002945] [smpi_test/INFO] -333 request done
+> [Jupiter:wait recv:(4) 0.002945] [smpi_test/INFO] 1 still has MPI rank -333 and global variable 1
+> [Tremblay:0:(1) 1.000000] [smpi_test/INFO] finally 42
+> [Jupiter:1:(2) 2.000000] [smpi_test/INFO] finally 42
index d084dd1..b350536 100644 (file)
@@ -864,6 +864,8 @@ set(DOC_SOURCES
   doc/doxygen/uhood_switch.doc
   doc/doxygen/uhood_arch.doc
 
+  examples/README.rst
+
   docs/manpages/smpicc.1
   docs/manpages/smpicxx.1
   docs/manpages/smpif90.1
@@ -875,15 +877,17 @@ set(DOC_SOURCES
   docs/requirements.txt
   docs/source/conf.py
   docs/source/Doxyfile
-  docs/source/_ext/hidden_code_block.py
+  docs/find-missing.py
+  docs/source/_ext/autodoxy.py
+  docs/source/_ext/showfile.css
+  docs/source/_ext/showfile.js
+  docs/source/_ext/showfile.py
   docs/source/_templates/breadcrumbs.html
 
   docs/source/img/eclipseScreenShot.png
   docs/source/img/extlink.png
   docs/source/img/extlink.svg
   docs/source/img/graphical-toc.svg
-  docs/source/img/lang_cpp.png
-  docs/source/img/lang_python.png
   docs/source/img/smpi_simgrid_alltoall_pair_16.png
   docs/source/img/smpi_simgrid_alltoall_ring_16.png
   docs/source/img/zone_hierarchy.png
index cb7a0c2..e752365 100644 (file)
@@ -49,8 +49,11 @@ if(enable_compile_warnings)
 
   if(CMAKE_Fortran_COMPILER_ID MATCHES "GCC|PGI")
     set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall")
-  endif()
-  if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
+  elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
+    # flang >= 7 has a bug with common and debug flags. Ignore cmake-added -g in this case.
+    # https://github.com/flang-compiler/flang/issues/671
+    set(CMAKE_Fortran_FLAGS "-Wall")
+  elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
     set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn all")
   endif()
   set(CMAKE_JAVA_COMPILE_FLAGS "-Xlint")
index 000cc6f..f1be39c 100644 (file)
@@ -90,7 +90,7 @@ if(enable_maintainer_mode AND NOT WIN32)
       ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/parserPromela.yacc
 
       COMMENT "Generating automaton source files"
-      COMMAND ${BISON_EXE} --name-prefix=xbt_automaton_parser_ -d parserPromela.yacc
+      COMMAND ${BISON_EXE} --name-prefix=xbt_automaton_parser_ -d -t parserPromela.yacc
       COMMAND ${LEX_EXE} --prefix=xbt_automaton_parser_ --outfile=automaton_lexer.yy.c parserPromela.lex
       WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/src/xbt/automaton/
       )
index f4dfef2..8bade76 100644 (file)
@@ -18,6 +18,5 @@ RUN apt-get --allow-releaseinfo-change update && \
        chrpath \
        libdw-dev libevent-dev libunwind8-dev \
        linkchecker \
-       && \
-    pip3 install breathe 'sphinx>=1.8.0b1' sphinx_rtd_theme
+       python3-sphinx python3-breathe python3-sphinx-rtd-theme
                   
\ No newline at end of file
index 0cb86c8..7494197 100644 (file)
@@ -7,8 +7,6 @@
 #include "simgrid/msg.h"
 #include "xbt/graph.h"
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(graphicator, "Graphicator Logging System");
-
 int main(int argc, char **argv)
 {
   MSG_init(&argc, argv);