teshsuite/smpi/mpich3-test/f77/datatype/hindex1f
teshsuite/smpi/mpich3-test/f77/datatype/hindexed_blockf
teshsuite/smpi/mpich3-test/f77/datatype/packef
-teshsuite/smpi/mpich3-test/f77/datatype/typeaints
teshsuite/smpi/mpich3-test/f77/datatype/typeaints.h
teshsuite/smpi/mpich3-test/f77/datatype/typecntsf
teshsuite/smpi/mpich3-test/f77/datatype/typem2f
endif()
else()
if(enable_model-checking)
- message(FATAL_ERROR "Please install libunwind-dev libdw-dev libevent-dev if you want to compile the SimGrid model checker.")
+ message(FATAL_ERROR "Please install libunwind-dev libdw-dev libelf-dev libevent-dev if you want to compile the SimGrid model checker.")
endif()
endif()
if(enable_model-checking)
find_package(Libdw REQUIRED)
+ find_package(Libelf REQUIRED)
find_package(Libevent REQUIRED)
- include_directories(${LIBDW_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR})
- set(SIMGRID_DEP "${SIMGRID_DEP} ${LIBEVENT_LIBRARIES} ${LIBDW_LIBRARIES}")
+ include_directories(${LIBDW_INCLUDE_DIR} ${LIBELF_INCLUDE_DIR} ${LIBEVENT_INCLUDE_DIR})
+ set(SIMGRID_DEP "${SIMGRID_DEP} ${LIBEVENT_LIBRARIES} ${LIBELF_LIBRARIES} ${LIBDW_LIBRARIES}")
set(SIMGRID_HAVE_MC 1)
if("${CMAKE_SYSTEM}" MATCHES "FreeBSD" AND enable_java)
message(WARNING "FreeBSD + Model-Checking + Java = too much for now. Disabling java")
xbt_dict_set(mydict, key, data, NULL);
}
- fclose(fInput);
+ fclose(fpInput);
}
/* Initializing xbt dictionary for StarPU version, reading xbt_hist_t entries line by line */
if (fgets(line, MAX_LINE_INJ, fpInput) == NULL) {
printf("Error input file is empty!"); // Skipping first row
+ fclose(fpInput);
return;
}
xbt_dict_set(mydict, key, data, NULL);
}
- fclose(fInput);
+ fclose(fpInput);
}
/* Injecting time */
of the targeted MPI implementations.
You can switch the automatic selector through the
-\c smpi/coll_selector configuration item. Possible values:
+\c smpi/coll-selector configuration item. Possible values:
- <b>ompi</b>: default selection logic of OpenMPI (version 1.7)
- <b>mpich</b>: default selection logic of MPICH (version 3.0.4)
- \c contexts/factory: \ref options_virt_factory
- \c contexts/guard-size: \ref options_virt_guard_size
- \c contexts/nthreads: \ref options_virt_parallel
-- \c contexts/parallel_threshold: \ref options_virt_parallel
+- \c contexts/parallel-threshold: \ref options_virt_parallel
- \c contexts/stack-size: \ref options_virt_stacksize
- \c contexts/synchro: \ref options_virt_parallel
can then fed to the graphviz dot tool to generate an corresponding graphical
representation.
-\subsection options_modelchecking_max_depth model-check/max_depth, Depth limit
+\subsection options_modelchecking_max_depth model-check/max-depth, Depth limit
The \b model-checker/max-depth can set the maximum depth of the exploration
graph of the model-checker. If this limit is reached, a logging message is
joinSuccess = join(knownId);
}
- if (joinSuccess) {
- double currentClock = Msg.getClock();
- while (currentClock < (initTime + deadline) && currentClock < Common.MAX_SIMULATION_TIME) {
- if (commReceive == null) {
- commReceive = Task.irecv(this.mailbox);
- }
- try {
- if (!commReceive.test()) {
- if (currentClock >= nextStabilizeDate) {
- stabilize();
- nextStabilizeDate = Msg.getClock() + Common.PERIODIC_STABILIZE_DELAY;
- } else if (currentClock >= nextFixFingersDate) {
- fixFingers();
- nextFixFingersDate = Msg.getClock() + Common.PERIODIC_FIX_FINGERS_DELAY;
- } else if (currentClock >= nextCheckPredecessorDate) {
- this.checkPredecessor();
- nextCheckPredecessorDate = Msg.getClock() + Common.PERIODIC_CHECK_PREDECESSOR_DELAY;
- } else if (currentClock >= nextLookupDate) {
- this.randomLookup();
- nextLookupDate = Msg.getClock() + Common.PERIODIC_LOOKUP_DELAY;
- } else {
- waitFor(5);
- }
- currentClock = Msg.getClock();
+
+ if (!joinSuccess) {
+ Msg.info("I couldn't join the ring");
+ return;
+ }
+
+ double currentClock = Msg.getClock();
+ while (currentClock < (initTime + deadline) && currentClock < Common.MAX_SIMULATION_TIME) {
+ if (commReceive == null) {
+ commReceive = Task.irecv(this.mailbox);
+ }
+ try {
+ if (!commReceive.test()) {
+ if (currentClock >= nextStabilizeDate) {
+ stabilize();
+ nextStabilizeDate = Msg.getClock() + Common.PERIODIC_STABILIZE_DELAY;
+ } else if (currentClock >= nextFixFingersDate) {
+ fixFingers();
+ nextFixFingersDate = Msg.getClock() + Common.PERIODIC_FIX_FINGERS_DELAY;
+ } else if (currentClock >= nextCheckPredecessorDate) {
+ this.checkPredecessor();
+ nextCheckPredecessorDate = Msg.getClock() + Common.PERIODIC_CHECK_PREDECESSOR_DELAY;
+ } else if (currentClock >= nextLookupDate) {
+ this.randomLookup();
+ nextLookupDate = Msg.getClock() + Common.PERIODIC_LOOKUP_DELAY;
} else {
- handleTask(commReceive.getTask());
- currentClock = Msg.getClock();
- commReceive = null;
+ waitFor(5);
}
- }
- catch (Exception e) {
+ currentClock = Msg.getClock();
+ } else {
+ handleTask(commReceive.getTask());
currentClock = Msg.getClock();
commReceive = null;
}
}
- leave();
- if (commReceive != null) {
+ catch (Exception e) {
+ currentClock = Msg.getClock();
commReceive = null;
}
- } else {
- Msg.info("I couldn't join the ring");
+ }
+ leave();
+ if (commReceive != null) {
+ commReceive = null;
}
}
}
public void main(String[] args) throws MsgException {
- String mount;
+ String mount = "/home";
String fileName;
switch (rank) {
case 4:
- mount = "/home";
fileName = mount + file1;
break;
case 0:
fileName = mount + file2;
break;
case 2:
- mount = "/home";
fileName = mount + file3;
break;
case 1:
- mount = "/home";
fileName = mount + file4;
break;
default:
- mount = "/home";
fileName = mount + file1;
+ break;
}
Msg.info("Open file " + fileName);
int partially_downloaded_piece(peer_t peer, connection_t remote_peer)
{
for (int i = 0; i < FILE_PIECES; i++) {
- if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer,i)&& peer_is_not_downloading_piece(peer, i)) {
- if (get_first_block(peer, i) > 0)
- return i;
- }
+ if (peer_has_not_piece(peer, i) && connection_has_piece(remote_peer, i) && peer_is_not_downloading_piece(peer, i) &&
+ get_first_block(peer, i) > 0)
+ return i;
}
return -1;
}
-/* Copyright (c) 2012-2016. The SimGrid Team.
+/* Copyright (c) 2012-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
{
unsigned int xor_number = table->id ^ id;
unsigned int prefix = get_node_prefix(xor_number, identifier_size);
- xbt_assert(prefix >= 0 && prefix <= identifier_size, "Tried to return a bucket that doesn't exist.");
+ xbt_assert(prefix <= identifier_size, "Tried to return a bucket that doesn't exist.");
bucket_t bucket = &table->buckets[prefix];
return bucket;
}
! expect return 1
! timeout 20
-$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning --cfg=contexts/stack_size:256
+$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning --cfg=contexts/stack-size:256
> [ 0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
> [ 0.000000] (2:client@HostB) Sent!
> [ 0.000000] (3:client@HostC) Sent!
! expect return 2
! timeout 20
! output ignore
-$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack_size:256 --cfg=model-check/property:promela_bugged1_liveness
+$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack-size:256 --cfg=model-check/property:promela_bugged1_liveness
> [ 0.000000] (0:maestro@) Check the liveness property promela_bugged1_liveness
> [ 0.000000] (2:client@Boivin) Ask the request
> [ 0.000000] (3:client@Fafard) Ask the request
! expect return 2
! timeout 20
! output ignore
-$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack_size:256 --cfg=model-check/sparse-checkpoint:yes --cfg=model-check/property:promela_bugged1_liveness
+$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack-size:256 --cfg=model-check/sparse-checkpoint:yes --cfg=model-check/property:promela_bugged1_liveness
> [ 0.000000] (0:maestro@) Check the liveness property promela_bugged1_liveness
> [ 0.000000] (2:client@Boivin) Ask the request
> [ 0.000000] (3:client@Fafard) Ask the request
${srcdir:=.}/deploy_bugged1_liveness.xml \
"--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" \
--cfg=contexts/factory:ucontext \
- --cfg=contexts/stack_size:256
+ --cfg=contexts/stack-size:256
assert 'test $? = 134'
}
! expect return 2
! timeout 20
! output ignore
-$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack_size:256 --cfg=model-check/property:promela_bugged1_liveness
+$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack-size:256 --cfg=model-check/property:promela_bugged1_liveness
> [ 0.000000] (0:maestro@) Check the liveness property promela_bugged1_liveness
> [ 0.000000] (2:client@Boivin) Ask the request
> [ 0.000000] (3:client@Fafard) Ask the request
! expect return 2
! timeout 20
! output ignore
-$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack_size:256 --cfg=model-check/sparse-checkpoint:yes --cfg=model-check/property:promela_bugged1_liveness
+$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack-size:256 --cfg=model-check/sparse-checkpoint:yes --cfg=model-check/property:promela_bugged1_liveness
> [ 0.000000] (0:maestro@) Check the liveness property promela_bugged1_liveness
> [ 0.000000] (2:client@Boivin) Ask the request
> [ 0.000000] (3:client@Fafard) Ask the request
! expect return 1
! timeout 20
-$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged2 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning --cfg=contexts/stack_size:256
+$ ${bindir:=.}/../../../bin/simgrid-mc ${bindir:=.}/bugged2 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --log=xbt_cfg.thresh:warning --cfg=contexts/stack-size:256
> [ 0.000000] (0:maestro@) Check a safety property. Reduction is: dpor.
> [ 0.000000] (2:client@HostB) Send 1
> [ 0.000000] (3:client@HostC) Send 2
/* This example implements one process which receives messages from two other */
/* processes. There is no bug on it, it is just provided to test the soundness*/
/* of the state space reduction with DPOR, if the maximum depth (defined with */
-/* --cfg=model-check/max_depth:) is reached. */
+/* --cfg=model-check/max-depth:) is reached. */
/******************************************************************************/
#include <simgrid/msg.h>
p Not tracing user variables
$ $SG_TEST_EXENV ${bindir:=.}/trace-host-user-variables$EXEEXT ${srcdir:=.}/small_platform.xml ${srcdir:=.}/../msg/app-masterworker/app-masterworker_d.xml
+
+$ rm -f simgrid.trace viva_graph.plist
ADD_TESH(smpi-mc-only-send-determinism --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/mc --cd ${CMAKE_BINARY_DIR}/examples/smpi/mc ${CMAKE_HOME_DIRECTORY}/examples/smpi/mc/only_send_deterministic.tesh)
endif()
- ADD_TESH(smpi-tracing --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace/trace.tesh)
- ADD_TESH(smpi-tracing-simple --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_simple/trace_simple.tesh)
- ADD_TESH(smpi-tracing-call-location --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_call_location/trace_call_location.tesh)
+ ADD_TESH(smpi-tracing --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi/trace ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace/trace.tesh)
+ ADD_TESH(smpi-tracing-simple --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi/trace_simple ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_simple/trace_simple.tesh)
+ ADD_TESH(smpi-tracing-call-location --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi/trace_call_location ${CMAKE_HOME_DIRECTORY}/examples/smpi/trace_call_location/trace_call_location.tesh)
ADD_TESH(smpi-replay --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi --cd ${CMAKE_BINARY_DIR}/examples/smpi ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/replay.tesh)
ADD_TESH_FACTORIES(smpi-energy "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/energy --cd ${CMAKE_BINARY_DIR}/examples/smpi/energy ${CMAKE_HOME_DIRECTORY}/examples/smpi/energy/energy.tesh)
endif()
/******************************************************************************/
/* Run :
- /usr/bin/time -f "clock:%e user:%U sys:%S swapped:%W exitval:%x max:%Mk" "$@" ../../../smpi_script/bin/smpirun -hostfile hostfile_bugged1_liveness -platform ../../platforms/cluster.xml --cfg=contexts/factory:ucontext --cfg=model-check/reduction:none --cfg=model-check/property:promela_bugged1_liveness --cfg=smpi/send-is-detached-thresh:0 --cfg=contexts/stack_size:128 --cfg=model-check/visited:100000 --cfg=model-check/max_depth:100000 ./bugged1_liveness */
+ /usr/bin/time -f "clock:%e user:%U sys:%S swapped:%W exitval:%x max:%Mk" "$@" \
+ ../../../smpi_script/bin/smpirun -hostfile hostfile_bugged1_liveness -platform ../../platforms/cluster.xml \
+ --cfg=contexts/factory:ucontext --cfg=model-check/reduction:none \
+ --cfg=model-check/property:promela_bugged1_liveness --cfg=smpi/send-is-detached-thresh:0 \
+ --cfg=contexts/stack-size:128 --cfg=model-check/visited:100000 --cfg=model-check/max-depth:100000 ./bugged1_liveness
+*/
#include <stdio.h>
#include <mpi.h>
#! ./tesh
! timeout 60
-$ ../../../smpi_script/bin/smpirun -wrapper ${bindir:=.}/../../../bin/simgrid-mc -hostfile ${srcdir:=.}/hostfile_non_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --log=xbt_cfg.thresh:warning --cfg=model-check/communications_determinism:1 --cfg=smpi/send-is-detached-thresh:0 --cfg=smpi/host-speed:1e9 ./smpi_non_deterministic
+$ ../../../smpi_script/bin/smpirun -wrapper ${bindir:=.}/../../../bin/simgrid-mc -hostfile ${srcdir:=.}/hostfile_non_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --log=xbt_cfg.thresh:warning --cfg=model-check/communications-determinism:1 --cfg=smpi/send-is-detached-thresh:0 --cfg=smpi/host-speed:1e9 ./smpi_non_deterministic
> [0.000000] [mc_global/INFO] Check communication determinism
> [0.000000] [mc_comm_determinism/INFO] The communications pattern of the process 1 is different! (Different communication : 1)
> [0.000000] [mc_comm_determinism/INFO] ****************************************************
#! ./tesh
! timeout 60
-$ ../../../smpi_script/bin/smpirun -wrapper "${bindir:=.}/../../../bin/simgrid-mc" --log=xbt_cfg.thresh:warning -hostfile ${srcdir:=.}/hostfile_only_send_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check/communications_determinism:1 --cfg=smpi/send-is-detached-thresh:0 --cfg=smpi/host-speed:1e9 ./smpi_only_send_deterministic
+$ ../../../smpi_script/bin/smpirun -wrapper "${bindir:=.}/../../../bin/simgrid-mc" --log=xbt_cfg.thresh:warning -hostfile ${srcdir:=.}/hostfile_only_send_deterministic -platform ${srcdir:=.}/../../platforms/cluster.xml --cfg=model-check/communications-determinism:1 --cfg=smpi/send-is-detached-thresh:0 --cfg=smpi/host-speed:1e9 ./smpi_only_send_deterministic
> [0.000000] [mc_comm_determinism/INFO] Check communication determinism
> [0.000000] [mc_comm_determinism/INFO] ******************************************************
> [0.000000] [mc_comm_determinism/INFO] **** Only-send-deterministic communication pattern ****
add_executable (replay_multiple replay_multiple.c)
target_link_libraries(replay_multiple simgrid)
- ADD_TESH(smpi-replay-multiple --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple --cd ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple ${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/replay_multiple.tesh)
+ ADD_TESH(smpi-replay-multiple --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR} --setenv bindir=${CMAKE_CURRENT_BINARY_DIR} --cd ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/replay_multiple.tesh)
endif()
set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/generate_multiple_deployment.sh
p Test the replay with multiple instances
p first generate the deployment file
-$ ${srcdir:=.}/generate_multiple_deployment.sh -platform ${srcdir:=.}/../../platforms/small_platform_with_routers.xml -hostfile ${srcdir:=.}/../hostfile ${srcdir:=.}/description_file ${srcdir:=.}/deployment.xml
+$ ${srcdir:=.}/generate_multiple_deployment.sh -platform ${srcdir:=.}/../../platforms/small_platform_with_routers.xml -hostfile ${srcdir:=.}/../hostfile ${srcdir:=.}/description_file ${bindir:=.}/deployment.xml
p This test needs maxmin/concurrency-limit=100 because it starts 64 hosts on 5 machines.
! timeout 120
-$ ./replay_multiple description_file ${srcdir:=.}/../../platforms/small_platform_with_routers.xml ${srcdir:=.}/deployment.xml --log=smpi.:info --cfg=maxmin/concurrency-limit:100
+$ ./replay_multiple description_file ${srcdir:=.}/../../platforms/small_platform_with_routers.xml ${bindir:=.}/deployment.xml --log=smpi.:info --cfg=maxmin/concurrency-limit:100
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/concurrency-limit' to '100'
> [0.000000] [msg_test/INFO] Initializing instance 1 of size 32
> [0.000000] [msg_test/INFO] Initializing instance 2 of size 32
> [0.000000] [smpi_kernel/INFO] You did not set the power of the host running the simulation. The timings will certainly not be accurate. Use the option "--cfg=smpi/host-speed:<flops>" to set its value.Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information.
> [Jupiter:2:(52) 1140688.493796] [smpi_replay/INFO] Simulation time 1124371.141124
> [1140688.493796] [msg_test/INFO] Simulation time 1.14069e+06
-
-$ rm -f deployment.xml
# Go for the first test
p Test instrumentation of SMPI
-$ ../../smpi_script/bin/smpirun -trace -trace-resource -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./trace/smpi_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace -trace-resource -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./smpi_trace --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
$ rm -f smpi_trace.trace
p Test SMPI with call-location tracing. This means that the binary must have
p already been compiled with the -trace-call-location switch.
-$ ../../smpi_script/bin/smpirun -trace -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=smpi/trace-call-location:1 -np 3 ${bindir:=.}/trace_call_location/smpi_trace_call_location --cfg=smpi/host-speed:-1 --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=smpi/trace-call-location:1 -np 3 ./smpi_trace_call_location --cfg=smpi/host-speed:-1 --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
$ grep --quiet "12 0.* 2 1 5 .*trace_call_location\.c\" 14$" ./smpi_trace.trace
# Go for the first test
p SMPI test
-$ ../../smpi_script/bin/smpirun -trace -trace-resource -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./trace_simple/smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace -trace-resource -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Another SMPI test, with only -trace
-$ ../../smpi_script/bin/smpirun -trace -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./trace_simple/smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Testing without trace parameters
-$ ../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./trace_simple/smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Testing grouped tracing
-$ ../../smpi_script/bin/smpirun -trace -trace-grouped -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./trace_simple/smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace -trace-grouped -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Testing generation of viva configuration files
-$ ../../smpi_script/bin/smpirun -trace -trace-resource -trace-viva -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg --cfg=smpi/simulate-computation:no -np 3 ./trace_simple/smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace -trace-resource -trace-viva -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg --cfg=smpi/simulate-computation:no -np 3 ./smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> [0.003952] [instr_config/INFO] No categories declared, ignoring generation of viva graph configuration
p Testing with parameters but without activating them with the safe switch (-trace)
-$ ../../smpi_script/bin/smpirun -trace-resource -trace-viva -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./trace_simple/smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
+$ ../../../smpi_script/bin/smpirun -trace-resource -trace-viva -trace-file smpi_trace.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../platforms/small_platform.xml --cfg=path:${srcdir:=.}/../msg -np 3 ./smpi_trace_simple --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
$ rm -f smpi_trace.trace smpi_uncat.plist smpi_cat.plist
-/* Copyright (c) 2016. The SimGrid Team.
+/* Copyright (c) 2016-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
xbt_assert(this->value_);
T* result = value_;
value_ = nullptr;
- return *value_;
+ return *result;
}
private:
XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
XBT_PUBLIC(void) MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
-static inline XBT_ATTRIB_DEPRECATED_v319(
- "Use MSG_zone_get_root() instead: v3.19 will remove MSG_environment_get_routing_root() completely.") msg_netzone_t
- MSG_environment_get_routing_root()
+static inline XBT_ATTRIB_DEPRECATED_v319("Use MSG_zone_get_root() instead: v3.19 will turn this warning into an error.")
+ msg_netzone_t MSG_environment_get_routing_root()
{
return MSG_zone_get_root();
}
-static inline XBT_ATTRIB_DEPRECATED_v319(
- "Use MSG_zone_get_name() instead: v3.19 will remove MSG_environment_as_get_name() completely.") const
- char* MSG_environment_as_get_name(msg_netzone_t zone)
+static inline XBT_ATTRIB_DEPRECATED_v319("Use MSG_zone_get_name() instead: v3.19 will turn this warning into an error.")
+ const char* MSG_environment_as_get_name(msg_netzone_t zone)
{
return MSG_zone_get_name(zone);
}
static inline XBT_ATTRIB_DEPRECATED_v319(
- "Use MSG_zone_get_by_name() instead: v3.19 will remove MSG_environment_as_get_by_name() completely.") msg_netzone_t
+ "Use MSG_zone_get_by_name() instead: v3.19 will turn this warning into an error.") msg_netzone_t
MSG_environment_as_get_by_name(const char* name)
{
return MSG_zone_get_by_name(name);
}
-static inline XBT_ATTRIB_DEPRECATED_v319(
- "Use MSG_zone_get_sons() instead: v3.19 will remove MSG_environment_as_get_routing_sons() completely.") xbt_dict_t
- MSG_environment_as_get_routing_sons(msg_netzone_t zone)
+static inline XBT_ATTRIB_DEPRECATED_v319("Use MSG_zone_get_sons() instead: v3.19 will turn this warning into an error.")
+ xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t zone)
{
xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
MSG_zone_get_sons(zone, res);
return res;
}
static inline XBT_ATTRIB_DEPRECATED_v319(
- "Use MSG_zone_get_property_value() instead: v3.19 will remove MSG_environment_as_get_property_value() completely.")
- const char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name)
+ "Use MSG_zone_get_property_value() instead: v3.19 will turn this warning into an error.") const
+ char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name)
{
return MSG_zone_get_property_value(zone, name);
}
/** Retrieve the property value (or nullptr if not set) */
const char* getProperty(const char* key);
void setProperty(const char* key, const char* value);
+ Actor* restart();
};
/** @ingroup s4u_api
this_actor::sleep_until(timeout_native.time_since_epoch().count());
}
- XBT_ATTRIB_DEPRECATED_v320("Use sleep_for(): v3.20 will drop sleep() completely.") inline void sleep(double duration)
+ XBT_ATTRIB_DEPRECATED_v320("Use sleep_for(): v3.20 will turn this warning into an error.") inline void sleep(
+ double duration)
{
return sleep_for(duration);
}
* See \ref Comm for the full communication API (including non blocking communications).
*/
XBT_PUBLIC(void*)
- XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will remove Actor::recv() completely.") recv(MailboxPtr chan);
+ XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will turn this warning into an error.") recv(MailboxPtr chan);
XBT_PUBLIC(void*)
- XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will remove Actor::recv() completely.")
+ XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get(): v3.20 will turn this warning into an error.")
recv(MailboxPtr chan, double timeout);
XBT_PUBLIC(CommPtr)
- XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::recv_async(): v3.20 will remove Actor::irecv() completely.")
+ XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::recv_async(): v3.20 will turn this warning into an error.")
irecv(MailboxPtr chan, void** data);
/** Block the actor until it delivers a message of the given simulated size to the given mailbox
* See \ref Comm for the full communication API (including non blocking communications).
*/
XBT_PUBLIC(void)
- XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will remove Actor::send() completely.")
+ XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will turn this warning into an error.")
send(MailboxPtr chan, void* payload, double simulatedSize); // 3.17
XBT_PUBLIC(void)
- XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will remove Actor::send() completely.")
+ XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put(): v3.20 will turn this warning into an error.")
send(MailboxPtr chan, void* payload, double simulatedSize, double timeout); // 3.17
XBT_PUBLIC(CommPtr)
- XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will remove Actor::isend() completely.")
+ XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will turn this warning into an error.")
isend(MailboxPtr chan, void* payload, double simulatedSize);
/** @brief Returns the actor ID of the current actor (same as pid). */
return idx;
}
/** Creates (but don't start) an async send to the mailbox @p dest */
- static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will remove Comm::send_init() completely.")
+ static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will turn this warning into an error.")
send_init(MailboxPtr dest)
{
return dest->put_init();
}
/** Creates (but don't start) an async send to the mailbox @p dest */
- static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will remove Comm::send_init() completely.")
+ static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_init(): v3.20 will turn this warning into an error.")
send_init(MailboxPtr dest, void* data, int simulatedByteAmount)
{
return dest->put_init(data, simulatedByteAmount);
}
/** Creates and start an async send to the mailbox @p dest */
- static CommPtr XBT_ATTRIB_DEPRECATED_v320(
- "Use Mailbox::put_async(): v3.20 will remove Comm::send_async() completely.")
+ static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::put_async(): v3.20 will turn this warning into an error.")
send_async(MailboxPtr dest, void* data, int simulatedByteAmount)
{
return dest->put_async(data, simulatedByteAmount);
}
/** Creates (but don't start) an async recv onto the mailbox @p from */
- static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get_init(): v3.20 will remove Comm::recv_init() completely.")
+ static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get_init(): v3.20 will turn this warning into an error.")
recv_init(MailboxPtr from)
{
return from->get_init();
}
/** Creates and start an async recv to the mailbox @p from */
- static CommPtr XBT_ATTRIB_DEPRECATED_v320(
- "Use Mailbox::get_async(): v3.20 will remove Comm::recv_async() completely.")
+ static CommPtr XBT_ATTRIB_DEPRECATED_v320("Use Mailbox::get_async(): v3.20 will turn this warning into an error.")
recv_async(MailboxPtr from, void** data)
{
return from->get_async(data);
void notify_one();
void notify_all();
- XBT_ATTRIB_DEPRECATED_v319("Use notify_one(): v3.19 will remove notify() completely.") void notify() { notify_one(); }
+ XBT_ATTRIB_DEPRECATED_v319("Use notify_one(): v3.19 will change this warning into an error.") void notify()
+ {
+ notify_one();
+ }
};
using ConditionVariablePtr = ConditionVariable::Ptr;
static simgrid::xbt::signal<void(NetZone&)> onSeal;
protected:
- std::vector<kernel::routing::NetPoint*>
- vertices_; // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
+ unsigned int getTableSize() { return vertices_.size(); }
+ std::vector<kernel::routing::NetPoint*> getVertices() { return vertices_; }
private:
+ // our content, as known to our graph routing algorithm (maps vertexId -> vertex)
+ std::vector<kernel::routing::NetPoint*> vertices_;
+
std::unordered_map<std::string, std::string> properties_;
NetZone* father_ = nullptr;
char* name_ = nullptr;
xbt_dict_t getProperties();
const char* getProperty(const char* key);
- void setProperty(const char* key, char* value);
+ void setProperty(const char* key, const char* value);
std::map<std::string, sg_size_t>* getContent();
void setUserdata(void* data) { userdata_ = data; }
XBT_PUBLIC(xbt_dynar_t) SD_dotload(const char *filename);
XBT_PUBLIC(xbt_dynar_t) SD_dotload_with_sched(const char *filename);
XBT_PUBLIC(xbt_dynar_t) SD_PTG_dotload(const char *filename);
-#ifdef __cplusplus
-namespace simgrid {
-namespace sd {
-XBT_PUBLIC(std::set<SD_task_t>*) simulate(double how_long);
-}
-}
-#endif
/** @} */
/* Support some backward compatibility */
//SD_route_get_list
//TRACE_sd_set_task_category
SG_END_DECL()
+
+#ifdef __cplusplus
+namespace simgrid {
+namespace sd {
+XBT_PUBLIC(std::set<SD_task_t>*) simulate(double how_long);
+}
+}
+#endif
+
#endif
double priority, double bound);
XBT_PUBLIC(smx_activity_t)
simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
- double* bytes_amount, double amount, double rate, double timeout);
+ double* bytes_amount, double rate, double timeout);
XBT_PUBLIC(void) simcall_execution_cancel(smx_activity_t execution);
XBT_PUBLIC(void) simcall_execution_set_priority(smx_activity_t execution, double priority);
XBT_PUBLIC(void) simcall_execution_set_bound(smx_activity_t execution, double bound);
XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_actor_t host);
XBT_PUBLIC(void) simcall_process_set_kill_time(smx_actor_t process, double kill_time);
XBT_PUBLIC(void) simcall_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void *data);
-XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_actor_t process, int auto_restart);
-XBT_PUBLIC(smx_actor_t) simcall_process_restart(smx_actor_t process);
XBT_PUBLIC(void) simcall_process_join(smx_actor_t process, double timeout);
/* Sleep control */
XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double max_duration);
XBT_PUBLIC(void) simcall_cond_broadcast(smx_cond_t cond);
-XBT_PUBLIC(smx_sem_t) simcall_sem_init(int capacity);
XBT_PUBLIC(void) SIMIX_sem_destroy(smx_sem_t sem);
-XBT_PUBLIC(void) simcall_sem_release(smx_sem_t sem);
-XBT_PUBLIC(int) simcall_sem_would_block(smx_sem_t sem);
XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem);
XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
-XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
/***************************** File **********************************/
XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size);
friend class Extendable<T>;
constexpr Extension(std::size_t id) : id_(id) {}
public:
- constexpr Extension() : id_(INVALID_ID) {}
+ explicit constexpr Extension() : id_(INVALID_ID) {}
std::size_t id() const { return id_; }
bool valid() { return id_ != INVALID_ID; }
};
xbt_dictelm_t next;
} s_xbt_dictelm_t;
-XBT_PUBLIC(xbt_dict_t) xbt_dict_new();
+XBT_PUBLIC(xbt_dict_t)
+XBT_ATTRIB_DEPRECATED_v319("Use xbt_dict_new_homogeneous(). v3.19 will turn this warning into an error.")
+ xbt_dict_new();
XBT_PUBLIC(xbt_dict_t) xbt_dict_new_homogeneous(void_f_pvoid_t free_ctn);
XBT_PUBLIC(void) xbt_dict_free(xbt_dict_t * dict);
XBT_PUBLIC(unsigned int) xbt_dict_size(xbt_dict_t dict);
procname_(xbt_procname()),
pid_(xbt_getpid())
{}
- WithContextException(Backtrace bt) :
- backtrace_(std::move(bt)),
- procname_(xbt_procname()),
- pid_(xbt_getpid())
+ explicit WithContextException(Backtrace bt) : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid())
{}
- WithContextException(ThrowPoint throwpoint, Backtrace bt) :
- backtrace_(std::move(bt)),
- procname_(xbt_procname()),
- pid_(xbt_getpid()),
- throwpoint_(throwpoint)
+ explicit WithContextException(ThrowPoint throwpoint, Backtrace bt)
+ : backtrace_(std::move(bt)), procname_(xbt_procname()), pid_(xbt_getpid()), throwpoint_(throwpoint)
{}
virtual ~WithContextException();
Backtrace const& backtrace() const
WithContext(E exception, WithContextException context) :
E(std::move(exception)),
WithContextException(std::move(context)) {}
- ~WithContext() override {}
+ ~WithContext() override = default;
};
/** Throw a C++ exception with some context
JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart (JNIEnv *env, jobject jprocess) {
msg_process_t process = jprocess_to_native(jprocess, env);
- xbt_ex_t e;
if (not process) {
jxbt_throw_notbound(env, "process", jprocess);
return;
}
- try {
- MSG_process_restart(process);
- }
- catch (xbt_ex& e) {
- // Nothing to do
- }
-
+ MSG_process_restart(process);
}
+
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env, jobject jprocess)
{
msg_process_t process = jprocess_to_native(jprocess, env);
/* surf parse file related (public because called from a test suite) */
XBT_PUBLIC(void) parse_platform_file(const char *file);
-/* For the trace and trace:connect tag (store their content till the end of the parsing) */
-XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
-
/*
* Returns the initial path. On Windows the initial path is the current directory for the current process in the other
* case the function returns "./" that represents the current directory on Unix/Linux platforms.
new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
}
- for (auto src : vertices_) {
+ for (auto src : getVertices()) {
if (not src->isRouter()) {
xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);
{
if (linkTable_ == nullptr) // Dealing with a parse error in the file?
return;
- int table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
/* Delete link_table */
- for (int i = 0; i < table_size; i++)
- for (int j = 0; j < table_size; j++)
+ for (unsigned int i = 0; i < table_size; i++)
+ for (unsigned int j = 0; j < table_size; j++)
routing_route_free(TO_FLOYD_LINK(i, j));
xbt_free(linkTable_);
void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
{
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
getRouteCheckParams(src, dst);
void FloydZone::addRoute(sg_platf_route_cbarg_t route)
{
/* set the size of table routing */
- int table_size = static_cast<int>(vertices_.size());
+ unsigned int table_size = getTableSize();
addRouteCheckParams(route);
linkTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); /* actual link between src and dst */
/* Initialize costs and predecessors */
- for (int i = 0; i < table_size; i++)
- for (int j = 0; j < table_size; j++) {
+ for (unsigned int i = 0; i < table_size; i++)
+ for (unsigned int j = 0; j < table_size; j++) {
TO_FLOYD_COST(i, j) = DBL_MAX;
TO_FLOYD_PRED(i, j) = -1;
TO_FLOYD_LINK(i, j) = nullptr;
void FloydZone::seal()
{
/* set the size of table routing */
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
if (not linkTable_) {
/* Create Cost, Predecessor and Link tables */
void FullZone::seal()
{
- int table_size = static_cast<int>(vertices_.size());
+ unsigned int table_size = getTableSize();
/* Create table if needed */
if (not routingTable_)
/* Add the loopback if needed */
if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
- for (int i = 0; i < table_size; i++) {
+ for (unsigned int i = 0; i < table_size; i++) {
sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i);
if (not e_route) {
e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
FullZone::~FullZone()
{
if (routingTable_) {
- int table_size = static_cast<int>(vertices_.size());
+ unsigned int table_size = getTableSize();
/* Delete routing table */
- for (int i = 0; i < table_size; i++)
- for (int j = 0; j < table_size; j++) {
+ for (unsigned int i = 0; i < table_size; i++)
+ for (unsigned int j = 0; j < table_size; j++) {
if (TO_ROUTE_FULL(i, j)) {
delete TO_ROUTE_FULL(i, j)->link_list;
xbt_free(TO_ROUTE_FULL(i, j));
{
XBT_DEBUG("full getLocalRoute from %s[%d] to %s[%d]", src->cname(), src->id(), dst->cname(), dst->id());
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(src->id(), dst->id());
if (e_route != nullptr) {
NetPoint* dst = route->dst;
addRouteCheckParams(route);
- size_t table_size = vertices_.size();
+ unsigned int table_size = getTableSize();
if (not routingTable_)
routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
{
- for (auto my_src : vertices_) {
- for (auto my_dst : vertices_) {
+ std::vector<kernel::routing::NetPoint*> vertices = getVertices();
+
+ for (auto my_src : vertices) {
+ for (auto my_dst : vertices) {
if (my_src == my_dst)
continue;
#include "src/mc/mc_mmu.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_page_snapshot, mc,
- "Logging specific to mc_page_snapshot");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_page_snapshot, mc, "Logging specific to mc_page_snapshot");
namespace simgrid {
namespace mc {
// ***** snapshot_page_manager
-PageStore::PageStore(size_t size) :
- memory_(nullptr), capacity_(0), top_index_(0)
+PageStore::PageStore(size_t size) : memory_(nullptr), capacity_(size), top_index_(0)
{
- // Using mmap in order to be able to expand the region
- // by relocating it somewhere else in the virtual memory
- // space:
+ // Using mmap in order to be able to expand the region by relocating it somewhere else in the virtual memory space:
void* memory = ::mmap(nullptr, size << xbt_pagebits, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, -1, 0);
if (memory == MAP_FAILED)
xbt_die("Could not mmap initial snapshot pages.");
this->top_index_ = 0;
- this->capacity_ = size;
this->memory_ = memory;
this->page_counts_.resize(size);
}
size_t res = this->free_pages_[this->free_pages_.size() - 1];
this->free_pages_.pop_back();
return res;
-
}
}
{
xbt_assert(top_index_ <= this->capacity_, "top_index is not consistent");
- // First, we check if a page with the same content is already in the page
- // store:
+ // First, we check if a page with the same content is already in the page store:
// 1. compute the hash of the page;
// 2. find pages with the same hash using `hash_index_`;
// 3. find a page with the same content.
const void* snapshot_page = this->get_page(pageno);
if (memcmp(page, snapshot_page, xbt_pagesize) == 0) {
- // If a page with the same content is already in the page store it is
- // reused and its reference count is incremented.
+ // If a page with the same content is already in the page store it's reused and its refcount is incremented.
page_counts_[pageno]++;
return pageno;
}
}
- // Otherwise, a new page is allocated in the page store and the content
- // of the page is `memcpy()`-ed to this new page.
+ // Otherwise, a new page is allocated in the page store and the content of the page is `memcpy()`-ed to this new page.
std::size_t pageno = alloc_page();
xbt_assert(this->page_counts_[pageno]==0, "Allocated page is already used");
void* snapshot_page = (void*) this->get_page(pageno);
xbt_test_add("Init");
std::size_t pagesize = (size_t) getpagesize();
- std::unique_ptr<PageStore> store
- = std::unique_ptr<PageStore>(new simgrid::mc::PageStore(500));
+ std::unique_ptr<PageStore> store = std::unique_ptr<PageStore>(new simgrid::mc::PageStore(500));
void* data = getpage();
xbt_test_assert(store->size()==0, "Bad size");
}
/** @brief Save the current state */
-VisitedState::VisitedState(unsigned long state_number)
+VisitedState::VisitedState(unsigned long state_number) : num(state_number)
{
simgrid::mc::RemoteClient* process = &(mc_model_checker->process());
this->heap_bytes_used = mmalloc_get_bytes_used_remote(
this->actors_count = mc_model_checker->process().actors().size();
this->system_state = simgrid::mc::take_snapshot(state_number);
- this->num = state_number;
this->original_num = -1;
}
-VisitedState::~VisitedState()
-{
-}
-
void VisitedStates::prune()
{
while (states_.size() > (std::size_t)_sg_mc_max_visited_states) {
int original_num = 0; // num field of the VisitedState to which I was declared equal to (used for dot_output)
explicit VisitedState(unsigned long state_number);
- ~VisitedState();
+ ~VisitedState() = default;
};
class XBT_PRIVATE VisitedStates {
namespace simgrid {
namespace mc {
-VisitedPair::VisitedPair(
- int pair_num, xbt_automaton_state_t automaton_state,
- std::shared_ptr<const std::vector<int>> atomic_propositions,
- std::shared_ptr<simgrid::mc::State> graph_state)
+VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
+ std::shared_ptr<const std::vector<int>> atomic_propositions,
+ std::shared_ptr<simgrid::mc::State> graph_state)
+ : num(pair_num), automaton_state(automaton_state)
{
simgrid::mc::RemoteClient* process = &(mc_model_checker->process());
this->graph_state = std::move(graph_state);
if(this->graph_state->system_state == nullptr)
this->graph_state->system_state = simgrid::mc::take_snapshot(pair_num);
- this->heap_bytes_used = mmalloc_get_bytes_used_remote(
- process->get_heap()->heaplimit,
- process->get_malloc_info());
+ this->heap_bytes_used = mmalloc_get_bytes_used_remote(process->get_heap()->heaplimit, process->get_malloc_info());
this->actors_count = mc_model_checker->process().actors().size();
- this->automaton_state = automaton_state;
- this->num = pair_num;
this->other_num = -1;
this->atomic_propositions = std::move(atomic_propositions);
}
};
struct XBT_PRIVATE VisitedPair {
- int num = 0;
+ int num;
int other_num = 0; /* Dot output for */
std::shared_ptr<simgrid::mc::State> graph_state = nullptr; /* System state included */
- xbt_automaton_state_t automaton_state = nullptr;
+ xbt_automaton_state_t automaton_state;
std::shared_ptr<const std::vector<int>> atomic_propositions;
std::size_t heap_bytes_used = 0;
int actors_count = 0;
-/* Copyright (c) 2015. The SimGrid Team.
+/* Copyright (c) 2015-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
int main(int argc, char** argv)
{
using simgrid::mc::Session;
+ XBT_LOG_CONNECT(mc_main);
try {
if (argc < 2)
xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
#endif
- return req->call == SIMCALL_COMM_ISEND
- || req->call == SIMCALL_COMM_IRECV
- || req->call == SIMCALL_COMM_WAIT
- || req->call == SIMCALL_COMM_WAITANY
- || req->call == SIMCALL_COMM_TEST
- || req->call == SIMCALL_COMM_TESTANY
- || req->call == SIMCALL_MC_RANDOM
- || req->call == SIMCALL_MUTEX_LOCK
- || req->call == SIMCALL_MUTEX_TRYLOCK
- ;
+ return req->call == SIMCALL_COMM_ISEND || req->call == SIMCALL_COMM_IRECV || req->call == SIMCALL_COMM_WAIT ||
+ req->call == SIMCALL_COMM_WAITANY || req->call == SIMCALL_COMM_TEST || req->call == SIMCALL_COMM_TESTANY ||
+ req->call == SIMCALL_MC_RANDOM || req->call == SIMCALL_MUTEX_LOCK || req->call == SIMCALL_MUTEX_TRYLOCK ||
+ req->call == SIMCALL_MUTEX_UNLOCK;
}
}
static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region, int process_index)
{
switch (region->storage_type()) {
- case simgrid::mc::StorageType::NoData:
- default:
- xbt_die("Storage type not supported");
-
case simgrid::mc::StorageType::Flat:
{
uintptr_t offset = (uintptr_t) addr - (uintptr_t) region->start().address();
return (void *) ((uintptr_t) region->flat_data().get() + offset);
}
-
case simgrid::mc::StorageType::Chunked:
return mc_translate_address_region_chunked(addr, region);
-
case simgrid::mc::StorageType::Privatized:
{
- xbt_assert(process_index >=0,
- "Missing process index for privatized region");
- xbt_assert((size_t) process_index < region->privatized_data().size(),
- "Out of range process index");
- simgrid::mc::RegionSnapshot& subregion= region->privatized_data()[process_index];
- return mc_translate_address_region(addr, &subregion, process_index);
+ xbt_assert(process_index >= 0, "Missing process index for privatized region");
+ xbt_assert((size_t)process_index < region->privatized_data().size(), "Out of range process index");
+ simgrid::mc::RegionSnapshot& subregion = region->privatized_data()[process_index];
+ return mc_translate_address_region(addr, &subregion, process_index);
}
+ case simgrid::mc::StorageType::NoData:
+ default:
+ xbt_die("Storage type not supported");
}
}
-XBT_PRIVATE mc_mem_region_t mc_get_snapshot_region(
- const void* addr, const simgrid::mc::Snapshot *snapshot, int process_index);
-
+XBT_PRIVATE mc_mem_region_t mc_get_snapshot_region(const void* addr, const simgrid::mc::Snapshot* snapshot,
+ int process_index);
}
// ***** MC Snapshot
typedef struct s_mc_snapshot_ignored_data {
void* start;
std::vector<char> data;
-} s_mc_snapshot_ignored_data_t, *mc_snapshot_ignored_data_t;
+} s_mc_snapshot_ignored_data_t;
typedef struct s_fd_infos{
std::string filename;
int number;
off_t current_position;
int flags;
-}s_fd_infos_t, *fd_infos_t;
+} s_fd_infos_t;
-/** Information about a given stack frame
- *
- */
+/** Information about a given stack frame */
typedef struct s_mc_stack_frame {
/** Instruction pointer */
unw_word_t ip;
simgrid::mc::Frame* frame;
std::string frame_name;
unw_cursor_t unw_cursor;
-} s_mc_stack_frame_t, *mc_stack_frame_t;
+} s_mc_stack_frame_t;
+typedef s_mc_stack_frame_t* mc_stack_frame_t;
typedef struct s_local_variable{
simgrid::mc::Frame* subprogram;
simgrid::mc::Type* type;
void *address;
int region;
-} s_local_variable_t, *local_variable_t;
+} s_local_variable_t;
+typedef s_local_variable_t* local_variable_t;
typedef struct XBT_PRIVATE s_mc_snapshot_stack {
std::vector<s_local_variable> local_variables;
const void* read_bytes(void* buffer, std::size_t size,
RemotePtr<void> address, int process_index = ProcessIndexAny,
ReadOptions options = ReadOptions::none()) const override;
-public: // To be private
+
+ // To be private
int num_state;
std::size_t heap_bytes_used;
std::vector<std::unique_ptr<s_mc_mem_region_t>> snapshot_regions;
namespace simgrid {
namespace mc {
-State::State(unsigned long state_number)
+State::State(unsigned long state_number) : num(state_number)
{
this->internal_comm.clear();
std::memset(&this->internal_req, 0, sizeof(this->internal_req));
std::memset(&this->executed_req, 0, sizeof(this->executed_req));
actorStates.resize(MC_smx_get_maxpid());
- num = state_number;
/* Stateful model checking */
if ((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
system_state = simgrid::mc::take_snapshot(num);
std::size_t State::interleaveSize() const
{
- return boost::range::count_if(this->actorStates,
- [](simgrid::mc::ProcessState const& p) { return p.isTodo(); });
+ return boost::range::count_if(this->actorStates, [](simgrid::mc::ProcessState const& p) { return p.isTodo(); });
}
Transition State::getTransition() const
* - which simcall can currently be executed (like a comm where the other partner is already known)
* Once we returned the last enabled transition of a process, it is marked done.
*
- * Things can get muddled with the WAITANY and TESTANY simcalls, that are rewritten
- * on the fly to a bunch of WAIT (resp TEST) transitions using the transition.argument
- * field to remember what was the last returned sub-transition.
+ * Things can get muddled with the WAITANY and TESTANY simcalls, that are rewritten on the fly to a bunch of WAIT
+ * (resp TEST) transitions using the transition.argument field to remember what was the last returned sub-transition.
*/
-static inline smx_simcall_t MC_state_get_request_for_process(
- simgrid::mc::State* state, smx_actor_t actor)
+static inline smx_simcall_t MC_state_get_request_for_process(simgrid::mc::State* state, smx_actor_t actor)
{
/* reset the outgoing transition */
simgrid::mc::ProcessState* procstate = &state->actorStates[actor->pid];
smx_simcall_t req = nullptr;
switch (actor->simcall.call) {
- case SIMCALL_COMM_WAITANY:
- state->transition.argument = -1;
- while (procstate->times_considered <
- read_length(mc_model_checker->process(),
- remote(simcall_comm_waitany__get__comms(&actor->simcall)))) {
- if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall,
- procstate->times_considered++)) {
- state->transition.argument = procstate->times_considered - 1;
- break;
- }
+ case SIMCALL_COMM_WAITANY:
+ state->transition.argument = -1;
+ while (procstate->times_considered <
+ read_length(mc_model_checker->process(), remote(simcall_comm_waitany__get__comms(&actor->simcall)))) {
+ if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall, procstate->times_considered++)) {
+ state->transition.argument = procstate->times_considered - 1;
+ break;
}
-
- if (procstate->times_considered >=
- simgrid::mc::read_length(mc_model_checker->process(),
- simgrid::mc::remote(simcall_comm_waitany__get__comms(&actor->simcall))))
- procstate->setDone();
- if (state->transition.argument != -1)
- req = &actor->simcall;
- break;
-
- case SIMCALL_COMM_TESTANY: {
- unsigned start_count = procstate->times_considered;
- state->transition.argument = -1;
- while (procstate->times_considered <
- simcall_comm_testany__get__count(&actor->simcall))
- if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall,
- procstate->times_considered++)) {
- state->transition.argument = procstate->times_considered - 1;
- break;
- }
-
- if (procstate->times_considered >=
- simcall_comm_testany__get__count(&actor->simcall))
- procstate->setDone();
-
- if (state->transition.argument != -1 || start_count == 0)
- req = &actor->simcall;
-
- break;
}
- case SIMCALL_COMM_WAIT: {
- simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
- remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(&actor->simcall)));
- simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
- mc_model_checker->process().read(temp_act, remote_act);
- simgrid::kernel::activity::CommImpl* act = temp_act.getBuffer();
- if (act->src_proc && act->dst_proc)
- state->transition.argument = 0;
- else if (act->src_proc == nullptr && act->type == SIMIX_COMM_READY
- && act->detached == 1)
- state->transition.argument = 0;
- else
- state->transition.argument = -1;
+ if (procstate->times_considered >=
+ simgrid::mc::read_length(mc_model_checker->process(),
+ simgrid::mc::remote(simcall_comm_waitany__get__comms(&actor->simcall))))
procstate->setDone();
+ if (state->transition.argument != -1)
req = &actor->simcall;
- break;
- }
+ break;
+
+ case SIMCALL_COMM_TESTANY: {
+ unsigned start_count = procstate->times_considered;
+ state->transition.argument = -1;
+ while (procstate->times_considered < simcall_comm_testany__get__count(&actor->simcall))
+ if (simgrid::mc::request_is_enabled_by_idx(&actor->simcall, procstate->times_considered++)) {
+ state->transition.argument = procstate->times_considered - 1;
+ break;
+ }
+
+ if (procstate->times_considered >= simcall_comm_testany__get__count(&actor->simcall))
+ procstate->setDone();
- case SIMCALL_MC_RANDOM: {
- int min_value = simcall_mc_random__get__min(&actor->simcall);
- state->transition.argument = procstate->times_considered + min_value;
- procstate->times_considered++;
- if (state->transition.argument == simcall_mc_random__get__max(&actor->simcall))
- procstate->setDone();
+ if (state->transition.argument != -1 || start_count == 0)
req = &actor->simcall;
- break;
- }
- default:
- procstate->setDone();
+ break;
+ }
+
+ case SIMCALL_COMM_WAIT: {
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(&actor->simcall)));
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
+ mc_model_checker->process().read(temp_act, remote_act);
+ simgrid::kernel::activity::CommImpl* act = temp_act.getBuffer();
+ if (act->src_proc && act->dst_proc)
state->transition.argument = 0;
- req = &actor->simcall;
- break;
+ else if (act->src_proc == nullptr && act->type == SIMIX_COMM_READY && act->detached == 1)
+ state->transition.argument = 0;
+ else
+ state->transition.argument = -1;
+ procstate->setDone();
+ req = &actor->simcall;
+ break;
+ }
+
+ case SIMCALL_MC_RANDOM: {
+ int min_value = simcall_mc_random__get__min(&actor->simcall);
+ state->transition.argument = procstate->times_considered + min_value;
+ procstate->times_considered++;
+ if (state->transition.argument == simcall_mc_random__get__max(&actor->simcall))
+ procstate->setDone();
+ req = &actor->simcall;
+ break;
+ }
+
+ default:
+ procstate->setDone();
+ state->transition.argument = 0;
+ req = &actor->simcall;
+ break;
}
if (not req)
return nullptr;
// Fetch the data of the request and translate it:
state->internal_req = *req;
- /* The waitany and testany request are transformed into a wait or test request
- * over the corresponding communication action so it can be treated later by
- * the dependence function. */
+ /* The waitany and testany request are transformed into a wait or test request over the corresponding communication
+ * action so it can be treated later by the dependence function. */
switch (req->call) {
case SIMCALL_COMM_WAITANY: {
state->internal_req.call = SIMCALL_COMM_WAIT;
simdata->compute =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(simcall_execution_parallel_start(
task->name, simdata->host_nb, simdata->host_list, simdata->flops_parallel_amount,
- simdata->bytes_parallel_amount, 1.0, -1.0, timeout));
+ simdata->bytes_parallel_amount, -1.0, timeout));
XBT_DEBUG("Parallel execution action created: %p", simdata->compute.get());
} else {
simdata->compute = boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(
*/
void MSG_process_kill(msg_process_t process)
{
- simcall_process_kill(process->getImpl());
+ process->kill();
}
/**
* If the flag is set to 1, the process will be automatically restarted when its host comes back up.
*/
XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart) {
- simcall_process_auto_restart_set(process->getImpl(), auto_restart);
+ process->setAutoRestart(auto_restart);
}
/**
* \ingroup m_process_management
* \brief Restarts a process from the beginning.
*/
XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) {
- return simcall_process_restart(process->getImpl())->ciface();
+ return process->restart();
}
/** @ingroup m_process_management
#include "xbt/ex.hpp"
#include "msg_private.h"
+#include "src/simix/smx_private.h"
#include "xbt/synchro.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_synchro, msg, "Logging specific to MSG (synchro)");
/** @brief creates a semaphore object of the given initial capacity */
msg_sem_t MSG_sem_init(int initial_value) {
- return simcall_sem_init(initial_value);
+ return simgrid::simix::kernelImmediate([initial_value] { return SIMIX_sem_init(initial_value); });
}
/** @brief locks on a semaphore object */
/** @brief releases the semaphore object */
void MSG_sem_release(msg_sem_t sem) {
- simcall_sem_release(sem);
+ simgrid::simix::kernelImmediate([sem] { SIMIX_sem_release(sem); });
}
int MSG_sem_get_capacity(msg_sem_t sem) {
- return simcall_sem_get_capacity(sem);
+ return simgrid::simix::kernelImmediate([sem] { return SIMIX_sem_get_capacity(sem); });
}
void MSG_sem_destroy(msg_sem_t sem) {
* But that's a classical semaphore issue, and SimGrid's semaphore are not different to usual ones here.
*/
int MSG_sem_would_block(msg_sem_t sem) {
- return simcall_sem_would_block(sem);
+ return simgrid::simix::kernelImmediate([sem] { return SIMIX_sem_would_block(sem); });
}
/*-**** barrier related functions ****-*/
}
void Actor::setAutoRestart(bool autorestart) {
- simcall_process_auto_restart_set(pimpl_,autorestart);
+ simgrid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; });
}
void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data)
});
}
+Actor* Actor::restart()
+{
+ return simgrid::simix::kernelImmediate([this]() { return pimpl_->restart(); });
+}
+
// ***** this_actor *****
namespace this_actor {
simcall_execution_wait(s);
}
-void* recv(MailboxPtr chan) {
+void* recv(MailboxPtr chan) // deprecated
+{
return chan->get();
}
-void* recv(MailboxPtr chan, double timeout)
+void* recv(MailboxPtr chan, double timeout) // deprecated
{
return chan->get(timeout);
}
-void send(MailboxPtr chan, void* payload, double simulatedSize)
+void send(MailboxPtr chan, void* payload, double simulatedSize) // deprecated
{
chan->put(payload, simulatedSize);
}
-void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout)
+void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout) // deprecated
{
chan->put(payload, simulatedSize, timeout);
}
-CommPtr isend(MailboxPtr chan, void* payload, double simulatedSize)
+CommPtr isend(MailboxPtr chan, void* payload, double simulatedSize) // deprecated
{
return chan->put_async(payload, simulatedSize);
}
-CommPtr irecv(MailboxPtr chan, void** data)
+CommPtr irecv(MailboxPtr chan, void** data) // deprecated
{
return chan->get_async(data);
}
return this->pimpl_->getProperty(key);
}
-void Storage::setProperty(const char* key, char* value)
+void Storage::setProperty(const char* key, const char* value)
{
simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); });
}
-/* Copyright (c) 2009-2010, 2012-2015. The SimGrid Team.
+/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
xbt_cfg_register_boolean("network/crosstraffic", "yes", _sg_cfg_cb__surf_network_crosstraffic,
"Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)");
- //For smpi/bw_factor and smpi/lat_factor
+ // For smpi/bw-factor and smpi/lat-factor
// SMPI model can be used without enable_smpi, so keep this out of the ifdef.
xbt_cfg_register_string("smpi/bw-factor",
"65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;1426:0.608902;732:0.341987;257:0.338112;0:0.812084", nullptr,
}
}
-ActorImpl* ActorImpl::restart(ActorImpl* issuer)
+simgrid::s4u::Actor* ActorImpl::restart()
{
XBT_DEBUG("Restarting process %s on %s", cname(), host->getCname());
arg.auto_restart = auto_restart;
// kill the old process
- SIMIX_process_kill(this, issuer);
+ SIMIX_process_kill(this, this);
// start the new process
ActorImpl* actor = simix_global->create_process_function(arg.name.c_str(), std::move(arg.code), arg.data, arg.host,
if (arg.kill_time >= 0)
simcall_process_set_kill_time(actor, arg.kill_time);
if (arg.auto_restart)
- simcall_process_auto_restart_set(actor, arg.auto_restart);
+ actor->auto_restart = arg.auto_restart;
- return actor;
+ return actor->ciface();
}
smx_activity_t ActorImpl::suspend(ActorImpl* issuer)
/**
* \brief Calling this function makes the process to yield.
*
- * Only the current process can call this function, giving back the control to
- * maestro.
+ * Only the current process can call this function, giving back the control to maestro.
*
* \param self the current process
*/
xbt_abort();
}
-/**
- * \brief Returns the list of processes to run.
- */
+/** @brief Returns the list of processes to run. */
xbt_dynar_t SIMIX_process_get_runnable()
{
return simix_global->process_to_run;
}
-/**
- * \brief Returns the process from PID.
- */
+/** @brief Returns the process from PID. */
smx_actor_t SIMIX_process_from_PID(aid_t PID)
{
if (simix_global->process_list.find(PID) == simix_global->process_list.end())
/**
* \brief Sets the auto-restart status of the process.
- * If set to 1, the process will be automatically restarted when its host
- * comes back.
+ * If set to 1, the process will be automatically restarted when its host comes back.
*/
void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart) {
process->auto_restart = auto_restart;
}
-smx_actor_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_actor_t process) {
- return process->restart(simcall->issuer);
-}
-
/** @brief Restart a process, starting it again from the beginning. */
/**
* \ingroup simix_process_management
void daemonize();
bool isDaemon() { return daemon; } /** Whether this actor has been daemonized */
bool isSuspended() { return suspended; }
- ActorImpl* restart(ActorImpl* issuer);
+ simgrid::s4u::Actor* restart();
smx_activity_t suspend(ActorImpl* issuer);
void resume();
smx_activity_t sleep(double duration);
* \return A new SIMIX execution synchronization
*/
smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list,
- double* flops_amount, double* bytes_amount, double amount, double rate,
- double timeout)
+ double* flops_amount, double* bytes_amount, double rate, double timeout)
{
/* checking for infinite values */
for (int i = 0 ; i < host_nb ; ++i) {
}
}
- xbt_assert(std::isfinite(amount), "amount is not finite!");
xbt_assert(std::isfinite(rate), "rate is not finite!");
- return simcall_BODY_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate,
- timeout);
+ return simcall_BODY_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout);
}
/**
{
simcall_BODY_process_on_exit(process, fun, data);
}
-/**
- * \ingroup simix_process_management
- * \brief Sets the process to be auto-restarted or not by SIMIX when its host comes back up.
- * Will restart the process when the host comes back up if auto_restart is set to 1.
- */
-
-XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_actor_t process, int auto_restart)
-{
- simcall_BODY_process_auto_restart_set(process, auto_restart);
-}
-/**
- * \ingroup simix_process_management
- * \brief Restarts the process, killing it and starting it again from scratch.
- */
-XBT_PUBLIC(smx_actor_t) simcall_process_restart(smx_actor_t process)
-{
- return (smx_actor_t) simcall_BODY_process_restart(process);
-}
/**
* \ingroup simix_process_management
* \brief Creates a new sleep SIMIX synchro.
fprintf(stderr,"You must run MSG_init before using MSG\n"); // We can't use xbt_die since we may get there before the initialization
xbt_abort();
}
- return simcall_BODY_mutex_init();
+ return simgrid::simix::kernelImmediate([] { return new simgrid::simix::MutexImpl(); });
}
/**
simcall_BODY_cond_broadcast(cond);
}
-/**
- * \ingroup simix_synchro_management
- *
- */
-smx_sem_t simcall_sem_init(int capacity)
-{
- return simcall_BODY_sem_init(capacity);
-}
-
-/**
- * \ingroup simix_synchro_management
- *
- */
-void simcall_sem_release(smx_sem_t sem)
-{
- simcall_BODY_sem_release(sem);
-}
-
-/**
- * \ingroup simix_synchro_management
- *
- */
-int simcall_sem_would_block(smx_sem_t sem)
-{
- return simcall_BODY_sem_would_block(sem);
-}
-
/**
* \ingroup simix_synchro_management
*
simcall_BODY_sem_acquire_timeout(sem, timeout);
}
-/**
- * \ingroup simix_synchro_management
- *
- */
-int simcall_sem_get_capacity(smx_sem_t sem)
-{
- return simcall_BODY_sem_get_capacity(sem);
-}
-
/**
* \ingroup simix_file_management
*
{
simgrid::simix::marshal<double*>(simcall->args[4], arg);
}
-static inline double simcall_execution_parallel_start__get__amount(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<double>(simcall->args[5]);
-}
-static inline double simcall_execution_parallel_start__getraw__amount(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[5]);
-}
-static inline void simcall_execution_parallel_start__set__amount(smx_simcall_t simcall, double arg)
-{
- simgrid::simix::marshal<double>(simcall->args[5], arg);
-}
static inline double simcall_execution_parallel_start__get__rate(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<double>(simcall->args[6]);
+ return simgrid::simix::unmarshal<double>(simcall->args[5]);
}
static inline double simcall_execution_parallel_start__getraw__rate(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[6]);
+ return simgrid::simix::unmarshal_raw<double>(simcall->args[5]);
}
static inline void simcall_execution_parallel_start__set__rate(smx_simcall_t simcall, double arg)
{
- simgrid::simix::marshal<double>(simcall->args[6], arg);
+ simgrid::simix::marshal<double>(simcall->args[5], arg);
}
static inline double simcall_execution_parallel_start__get__timeout(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<double>(simcall->args[7]);
+ return simgrid::simix::unmarshal<double>(simcall->args[6]);
}
static inline double simcall_execution_parallel_start__getraw__timeout(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[7]);
+ return simgrid::simix::unmarshal_raw<double>(simcall->args[6]);
}
static inline void simcall_execution_parallel_start__set__timeout(smx_simcall_t simcall, double arg)
{
- simgrid::simix::marshal<double>(simcall->args[7], arg);
+ simgrid::simix::marshal<double>(simcall->args[6], arg);
}
static inline boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
simcall_execution_parallel_start__get__result(smx_simcall_t simcall)
simgrid::simix::marshal<void*>(simcall->args[2], arg);
}
-static inline smx_actor_t simcall_process_auto_restart_set__get__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_auto_restart_set__getraw__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_auto_restart_set__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
- simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-static inline int simcall_process_auto_restart_set__get__auto_restart(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->args[1]);
-}
-static inline int simcall_process_auto_restart_set__getraw__auto_restart(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->args[1]);
-}
-static inline void simcall_process_auto_restart_set__set__auto_restart(smx_simcall_t simcall, int arg)
-{
- simgrid::simix::marshal<int>(simcall->args[1], arg);
-}
-
-static inline smx_actor_t simcall_process_restart__get__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_restart__getraw__process(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_restart__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
- simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-static inline smx_actor_t simcall_process_restart__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_actor_t>(simcall->result);
-}
-static inline smx_actor_t simcall_process_restart__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->result);
-}
-static inline void simcall_process_restart__set__result(smx_simcall_t simcall, smx_actor_t result){
- simgrid::simix::marshal<smx_actor_t>(simcall->result, result);
-}
-
static inline smx_mailbox_t simcall_comm_iprobe__get__mbox(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]);
simgrid::simix::marshal<int>(simcall->result, result);
}
-static inline smx_mutex_t simcall_mutex_init__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_mutex_t>(simcall->result);
-}
-static inline smx_mutex_t simcall_mutex_init__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_mutex_t>(simcall->result);
-}
-static inline void simcall_mutex_init__set__result(smx_simcall_t simcall, smx_mutex_t result){
- simgrid::simix::marshal<smx_mutex_t>(simcall->result, result);
-}
-
static inline smx_mutex_t simcall_mutex_lock__get__mutex(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]);
simgrid::simix::marshal<smx_cond_t>(simcall->args[0], arg);
}
-static inline unsigned int simcall_sem_init__get__capacity(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<unsigned int>(simcall->args[0]);
-}
-static inline unsigned int simcall_sem_init__getraw__capacity(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<unsigned int>(simcall->args[0]);
-}
-static inline void simcall_sem_init__set__capacity(smx_simcall_t simcall, unsigned int arg)
-{
- simgrid::simix::marshal<unsigned int>(simcall->args[0], arg);
-}
-static inline smx_sem_t simcall_sem_init__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_sem_t>(simcall->result);
-}
-static inline smx_sem_t simcall_sem_init__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_sem_t>(simcall->result);
-}
-static inline void simcall_sem_init__set__result(smx_simcall_t simcall, smx_sem_t result){
- simgrid::simix::marshal<smx_sem_t>(simcall->result, result);
-}
-
-static inline smx_sem_t simcall_sem_release__get__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
-}
-static inline smx_sem_t simcall_sem_release__getraw__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_sem_t>(simcall->args[0]);
-}
-static inline void simcall_sem_release__set__sem(smx_simcall_t simcall, smx_sem_t arg)
-{
- simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
-}
-
-static inline smx_sem_t simcall_sem_would_block__get__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
-}
-static inline smx_sem_t simcall_sem_would_block__getraw__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_sem_t>(simcall->args[0]);
-}
-static inline void simcall_sem_would_block__set__sem(smx_simcall_t simcall, smx_sem_t arg)
-{
- simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
-}
-static inline int simcall_sem_would_block__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->result);
-}
-static inline int simcall_sem_would_block__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->result);
-}
-static inline void simcall_sem_would_block__set__result(smx_simcall_t simcall, int result){
- simgrid::simix::marshal<int>(simcall->result, result);
-}
-
static inline smx_sem_t simcall_sem_acquire__get__sem(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
simgrid::simix::marshal<double>(simcall->args[1], arg);
}
-static inline smx_sem_t simcall_sem_get_capacity__get__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
-}
-static inline smx_sem_t simcall_sem_get_capacity__getraw__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_sem_t>(simcall->args[0]);
-}
-static inline void simcall_sem_get_capacity__set__sem(smx_simcall_t simcall, smx_sem_t arg)
-{
- simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
-}
-static inline int simcall_sem_get_capacity__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->result);
-}
-static inline int simcall_sem_get_capacity__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->result);
-}
-static inline void simcall_sem_get_capacity__set__result(smx_simcall_t simcall, int result){
- simgrid::simix::marshal<int>(simcall->result, result);
-}
-
static inline surf_file_t simcall_file_read__get__fd(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
XBT_PRIVATE void
simcall_HANDLER_execution_wait(smx_simcall_t simcall,
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution);
-XBT_PRIVATE smx_actor_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_actor_t process);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>
simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type, simix_match_func_t match_fun,
void* data);
XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall,
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>* comms,
size_t count);
-XBT_PRIVATE smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall);
XBT_PRIVATE void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout);
-XBT_PRIVATE void simcall_HANDLER_sem_release(smx_simcall_t simcall, smx_sem_t sem);
-XBT_PRIVATE int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t sem);
XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
-XBT_PRIVATE int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
inline static boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
simcall_BODY_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
- double* bytes_amount, double amount, double rate, double timeout)
+ double* bytes_amount, double rate, double timeout)
{
/* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, timeout);
+ if (0)
+ SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout);
return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>, const char*, int, sg_host_t*, double*,
- double*, double, double, double>(SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list,
- flops_amount, bytes_amount, amount, rate, timeout);
+ double*, double, double>(SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list, flops_amount,
+ bytes_amount, rate, timeout);
}
inline static void
return simcall<void, smx_actor_t, int_f_pvoid_pvoid_t, void*>(SIMCALL_PROCESS_ON_EXIT, process, fun, data);
}
-inline static void simcall_BODY_process_auto_restart_set(smx_actor_t process, int auto_restart) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_process_auto_restart_set(process, auto_restart);
- return simcall<void, smx_actor_t, int>(SIMCALL_PROCESS_AUTO_RESTART_SET, process, auto_restart);
- }
-
-inline static smx_actor_t simcall_BODY_process_restart(smx_actor_t process) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_process_restart(&SIMIX_process_self()->simcall, process);
- return simcall<smx_actor_t, smx_actor_t>(SIMCALL_PROCESS_RESTART, process);
- }
-
inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>
simcall_BODY_comm_iprobe(smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data)
{
comms, count);
}
-inline static smx_mutex_t simcall_BODY_mutex_init() {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_mutex_init(&SIMIX_process_self()->simcall);
- return simcall<smx_mutex_t>(SIMCALL_MUTEX_INIT);
- }
-
inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_mutex_lock(&SIMIX_process_self()->simcall, mutex);
return simcall<void, smx_cond_t>(SIMCALL_COND_BROADCAST, cond);
}
-inline static smx_sem_t simcall_BODY_sem_init(unsigned int capacity) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_sem_init(capacity);
- return simcall<smx_sem_t, unsigned int>(SIMCALL_SEM_INIT, capacity);
- }
-
-inline static void simcall_BODY_sem_release(smx_sem_t sem) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_sem_release(&SIMIX_process_self()->simcall, sem);
- return simcall<void, smx_sem_t>(SIMCALL_SEM_RELEASE, sem);
- }
-
-inline static int simcall_BODY_sem_would_block(smx_sem_t sem) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_sem_would_block(&SIMIX_process_self()->simcall, sem);
- return simcall<int, smx_sem_t>(SIMCALL_SEM_WOULD_BLOCK, sem);
- }
-
inline static void simcall_BODY_sem_acquire(smx_sem_t sem) {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_sem_acquire(&SIMIX_process_self()->simcall, sem);
return simcall<void, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
}
-inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_sem_get_capacity(&SIMIX_process_self()->simcall, sem);
- return simcall<int, smx_sem_t>(SIMCALL_SEM_GET_CAPACITY, sem);
- }
-
inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size)
{
/* Go to that function to follow the code flow through the simcall barrier */
SIMCALL_EXECUTION_SET_BOUND,
SIMCALL_EXECUTION_WAIT,
SIMCALL_PROCESS_ON_EXIT,
- SIMCALL_PROCESS_AUTO_RESTART_SET,
- SIMCALL_PROCESS_RESTART,
SIMCALL_COMM_IPROBE,
SIMCALL_COMM_SEND,
SIMCALL_COMM_ISEND,
SIMCALL_COMM_WAIT,
SIMCALL_COMM_TEST,
SIMCALL_COMM_TESTANY,
- SIMCALL_MUTEX_INIT,
SIMCALL_MUTEX_LOCK,
SIMCALL_MUTEX_TRYLOCK,
SIMCALL_MUTEX_UNLOCK,
SIMCALL_COND_WAIT,
SIMCALL_COND_WAIT_TIMEOUT,
SIMCALL_COND_BROADCAST,
- SIMCALL_SEM_INIT,
- SIMCALL_SEM_RELEASE,
- SIMCALL_SEM_WOULD_BLOCK,
SIMCALL_SEM_ACQUIRE,
SIMCALL_SEM_ACQUIRE_TIMEOUT,
- SIMCALL_SEM_GET_CAPACITY,
SIMCALL_FILE_READ,
SIMCALL_FILE_WRITE,
SIMCALL_MC_RANDOM,
"SIMCALL_EXECUTION_SET_BOUND",
"SIMCALL_EXECUTION_WAIT",
"SIMCALL_PROCESS_ON_EXIT",
- "SIMCALL_PROCESS_AUTO_RESTART_SET",
- "SIMCALL_PROCESS_RESTART",
"SIMCALL_COMM_IPROBE",
"SIMCALL_COMM_SEND",
"SIMCALL_COMM_ISEND",
"SIMCALL_COMM_WAIT",
"SIMCALL_COMM_TEST",
"SIMCALL_COMM_TESTANY",
- "SIMCALL_MUTEX_INIT",
"SIMCALL_MUTEX_LOCK",
"SIMCALL_MUTEX_TRYLOCK",
"SIMCALL_MUTEX_UNLOCK",
"SIMCALL_COND_WAIT",
"SIMCALL_COND_WAIT_TIMEOUT",
"SIMCALL_COND_BROADCAST",
- "SIMCALL_SEM_INIT",
- "SIMCALL_SEM_RELEASE",
- "SIMCALL_SEM_WOULD_BLOCK",
"SIMCALL_SEM_ACQUIRE",
"SIMCALL_SEM_ACQUIRE_TIMEOUT",
- "SIMCALL_SEM_GET_CAPACITY",
"SIMCALL_FILE_READ",
"SIMCALL_FILE_WRITE",
"SIMCALL_MC_RANDOM",
simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]),
simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]),
simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]),
- simgrid::simix::unmarshal<double>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7])));
+ simgrid::simix::unmarshal<double>(simcall->args[6])));
SIMIX_simcall_answer(simcall);
break;
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_PROCESS_AUTO_RESTART_SET:
- SIMIX_process_auto_restart_set(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]));
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_PROCESS_RESTART:
- simgrid::simix::marshal<smx_actor_t>(simcall->result, simcall_HANDLER_process_restart(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0])));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_COMM_IPROBE:
simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
simcall->result, simcall_HANDLER_comm_iprobe(simcall, simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]),
simgrid::simix::unmarshal<size_t>(simcall->args[1]));
break;
-case SIMCALL_MUTEX_INIT:
- simgrid::simix::marshal<smx_mutex_t>(simcall->result, simcall_HANDLER_mutex_init(simcall));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_MUTEX_LOCK:
simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
break;
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_SEM_INIT:
- simgrid::simix::marshal<smx_sem_t>(simcall->result, SIMIX_sem_init(simgrid::simix::unmarshal<unsigned int>(simcall->args[0])));
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_SEM_RELEASE:
- simcall_HANDLER_sem_release(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_SEM_WOULD_BLOCK:
- simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_sem_would_block(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0])));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_SEM_ACQUIRE:
simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
break;
simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
break;
-case SIMCALL_SEM_GET_CAPACITY:
- simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_sem_get_capacity(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0])));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_FILE_READ:
simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
int process_sleep(double duration) [[block]];
boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_start(const char* name, double flops_amount, double priority, double bound);
-boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate, double timeout) [[nohandler]];
+boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double rate, double timeout) [[nohandler]];
void execution_cancel(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[nohandler]];
void execution_set_priority(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution, double priority) [[nohandler]];
void execution_set_bound(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution, double bound) [[nohandler]];
int execution_wait(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[block]];
void process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data) [[nohandler]];
-void process_auto_restart_set(smx_actor_t process, int auto_restart) [[nohandler]];
-smx_actor_t process_restart(smx_actor_t process);
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_iprobe(smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data);
void comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) [[block]];
int comm_test(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm) [[block]];
int comm_testany(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>* comms, size_t count) [[block]];
-smx_mutex_t mutex_init();
void mutex_lock(smx_mutex_t mutex) [[block]];
int mutex_trylock(smx_mutex_t mutex);
void mutex_unlock(smx_mutex_t mutex);
void cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) [[block]];
void cond_broadcast(smx_cond_t cond) [[nohandler]];
-smx_sem_t sem_init(unsigned int capacity) [[nohandler]];
-void sem_release(smx_sem_t sem);
-int sem_would_block(smx_sem_t sem);
void sem_acquire(smx_sem_t sem) [[block]];
void sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
-int sem_get_capacity(smx_sem_t sem);
sg_size_t file_read(surf_file_t fd, sg_size_t size) [[block]];
sg_size_t file_write(surf_file_t fd, sg_size_t size) [[block]];
{
/* Clean Simulator data */
if (xbt_swag_size(process_list) != 0) {
- char *msg = xbt_strdup("Shutting down host, but it's not empty:");
- char *tmp;
+ std::string msg = std::string("Shutting down host, but it's not empty:");
smx_actor_t process = nullptr;
- xbt_swag_foreach(process, process_list) {
- tmp = bprintf("%s\n\t%s", msg, process->name.c_str());
- free(msg);
- msg = tmp;
- }
+ xbt_swag_foreach(process, process_list) msg = msg + "\n\t" + process->name.c_str();
+
SIMIX_display_process_status();
- THROWF(arg_error, 0, "%s", msg);
+ THROWF(arg_error, 0, "%s", msg.c_str());
}
for (auto arg : auto_restart_processes)
delete arg;
if (arg->kill_time >= 0)
simcall_process_set_kill_time(actor, arg->kill_time);
if (arg->auto_restart)
- simcall_process_auto_restart_set(actor, arg->auto_restart);
+ actor->auto_restart = arg->auto_restart;
}
}
if (arg->kill_time >= 0)
simcall_process_set_kill_time(actor, arg->kill_time);
if (arg->auto_restart)
- simcall_process_auto_restart_set(actor, arg->auto_restart);
+ actor->auto_restart = arg->auto_restart;
}
process_list.clear();
}
boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
- double* bytes_amount, double amount, double rate, double timeout)
+ double* bytes_amount, double rate, double timeout)
{
/* alloc structures and initialize */
SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
- double* bytes_amount, double amount, double rate, double timeout);
+ double* bytes_amount, double rate, double timeout);
#endif
intrusive_ptr_release(mutex);
}
-smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall)
-{
- return new simgrid::simix::MutexImpl();
-}
-
// Simcall handlers:
void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
XBT_OUT();
}
-void simcall_HANDLER_sem_release(smx_simcall_t simcall, smx_sem_t sem){
- SIMIX_sem_release(sem);
-}
/** @brief release the semaphore
*
* Unlock a process waiting on the semaphore.
return (sem->value <= 0);
}
-int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem){
- return SIMIX_sem_get_capacity(sem);
-}
/** @brief Returns the current capacity of the semaphore */
int SIMIX_sem_get_capacity(smx_sem_t sem)
{
_SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall);
XBT_OUT();
}
-int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t sem) {
- return SIMIX_sem_would_block(sem);
-}
*target_disp, simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win));
}
-void mpi_compare_and_swap_( int *origin_addr, int* compare_addr, int* result_addr,
- int* datatype, int* target_rank, MPI_Aint* target_disp, int* win, int* ierr){
+void mpi_compare_and_swap_(int* origin_addr, int* compare_addr, int* result_addr, int* datatype, int* target_rank,
+ MPI_Aint* target_disp, int* win, int* ierr)
+{
*ierr = MPI_Compare_and_swap( static_cast<void *>(origin_addr),static_cast<void *>(compare_addr),
static_cast<void *>(result_addr), simgrid::smpi::Datatype::f2c(*datatype),*target_rank,
*target_disp, simgrid::smpi::Win::f2c(*win));
void mpi_get_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr,
int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count,
int* target_datatype, int* op, int* win, int* ierr){
- *ierr = MPI_Get_accumulate( static_cast<void *>(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),
- static_cast<void *>(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype),
- *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
- simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win));
+ *ierr =
+ MPI_Get_accumulate(static_cast<void*>(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),
+ static_cast<void*>(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype),
+ *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
+ simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win));
}
void mpi_rget_accumulate_(int *origin_addr, int* origin_count, int* origin_datatype, int* result_addr,
int* result_count, int* result_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count,
int* target_datatype, int* op, int* win, int* request, int* ierr){
MPI_Request req;
- *ierr = MPI_Rget_accumulate( static_cast<void *>(origin_addr), *origin_count, simgrid::smpi::Datatype::f2c(*origin_datatype),
- static_cast<void *>(result_addr), *result_count, simgrid::smpi::Datatype::f2c(*result_datatype),
- *target_rank, *target_disp, *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
- simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win), &req);
+ *ierr = MPI_Rget_accumulate(static_cast<void*>(origin_addr), *origin_count,
+ simgrid::smpi::Datatype::f2c(*origin_datatype), static_cast<void*>(result_addr),
+ *result_count, simgrid::smpi::Datatype::f2c(*result_datatype), *target_rank, *target_disp,
+ *target_count, simgrid::smpi::Datatype::f2c(*target_datatype),
+ simgrid::smpi::Op::f2c(*op), simgrid::smpi::Win::f2c(*win), &req);
if(*ierr == MPI_SUCCESS) {
*request = req->add_f();
}
//following are automatically generated, and have to be checked
void mpi_finalized_ (int * flag, int* ierr){
-
*ierr = MPI_Finalized(flag);
}
}
void mpi_query_thread_ (int *provided, int* ierr){
-
*ierr = MPI_Query_thread(provided);
}
private:
int size_;
int *rank_to_index_map_;
- xbt_dict_t index_to_rank_map_;
+ std::unordered_map<int, int> index_to_rank_map_;
int refcount_;
public:
explicit Group();
TRACE_smpi_computing_out(rank);
} else {
- XBT_DEBUG("Real computation took %g while option smpi/cpu_threshold is set to %g => ignore it", duration,
+ XBT_DEBUG("Real computation took %g while option smpi/cpu-threshold is set to %g => ignore it", duration,
smpi_cpu_threshold);
}
}
XBT_LOG_CONNECT(smpi_datatype);
XBT_LOG_CONNECT(smpi_dvfs);
XBT_LOG_CONNECT(smpi_group);
+ XBT_LOG_CONNECT(smpi_host);
XBT_LOG_CONNECT(smpi_kernel);
XBT_LOG_CONNECT(smpi_mpi);
XBT_LOG_CONNECT(smpi_memory);
XBT_LOG_CONNECT(smpi_op);
XBT_LOG_CONNECT(smpi_pmpi);
+ XBT_LOG_CONNECT(smpi_process);
XBT_LOG_CONNECT(smpi_request);
XBT_LOG_CONNECT(smpi_replay);
XBT_LOG_CONNECT(smpi_rma);
Group::Group()
{
- size_=0; /* size */
- rank_to_index_map_=nullptr; /* rank_to_index_map_ */
- index_to_rank_map_=nullptr; /* index_to_rank_map_ */
- refcount_=1; /* refcount_: start > 0 so that this group never gets freed */
+ size_ = 0; /* size */
+ rank_to_index_map_ = nullptr; /* rank_to_index_map_ */
+ refcount_ = 1; /* refcount_: start > 0 so that this group never gets freed */
}
Group::Group(int n) : size_(n)
{
- rank_to_index_map_ = xbt_new(int, size_);
- index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f);
+ rank_to_index_map_ = new int[size_];
refcount_ = 1;
- for (int i = 0; i < size_; i++) {
+ for (int i = 0; i < size_; i++)
rank_to_index_map_[i] = MPI_UNDEFINED;
- }
}
Group::Group(MPI_Group origin)
{
- if(origin != MPI_GROUP_NULL
- && origin != MPI_GROUP_EMPTY)
- {
- size_ = origin->size();
- rank_to_index_map_ = xbt_new(int, size_);
- index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f);
- refcount_ = 1;
- for (int i = 0; i < size_; i++) {
- rank_to_index_map_[i] = origin->rank_to_index_map_[i];
- }
+ if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) {
+ size_ = origin->size();
+ rank_to_index_map_ = new int[size_];
+ refcount_ = 1;
+ for (int i = 0; i < size_; i++) {
+ rank_to_index_map_[i] = origin->rank_to_index_map_[i];
+ }
- char* key;
- char* ptr_rank;
- xbt_dict_cursor_t cursor = nullptr;
- xbt_dict_foreach(origin->index_to_rank_map_, cursor, key, ptr_rank) {
- int * cp = static_cast<int*>(xbt_malloc(sizeof(int)));
- *cp=*reinterpret_cast<int*>(ptr_rank);
- xbt_dict_set(index_to_rank_map_, key, cp, nullptr);
- }
+ for (auto elm : origin->index_to_rank_map_) {
+ index_to_rank_map_.insert({elm.first, elm.second});
}
+ }
}
Group::~Group()
{
- xbt_free(rank_to_index_map_);
- xbt_dict_free(&index_to_rank_map_);
+ delete[] rank_to_index_map_;
}
void Group::set_mapping(int index, int rank)
{
if (rank < size_) {
rank_to_index_map_[rank] = index;
- if (index!=MPI_UNDEFINED ) {
- int* val_rank = static_cast<int*>(xbt_malloc(sizeof(int)));
- *val_rank = rank;
-
- char * key = bprintf("%d", index);
- xbt_dict_set(index_to_rank_map_, key, val_rank, nullptr);
- xbt_free(key);
- }
+ if (index != MPI_UNDEFINED)
+ index_to_rank_map_.insert({index, rank});
}
}
int Group::rank(int index)
{
- int * ptr_rank = nullptr;
- if (this==MPI_GROUP_EMPTY)
+ if (this == MPI_GROUP_EMPTY)
return MPI_UNDEFINED;
- char * key = bprintf("%d", index);
- ptr_rank = static_cast<int*>(xbt_dict_get_or_null(index_to_rank_map_, key));
- xbt_free(key);
-
- if (ptr_rank==nullptr)
+ if (index_to_rank_map_.find(index) == index_to_rank_map_.end())
return MPI_UNDEFINED;
- return *ptr_rank;
+ else
+ return index_to_rank_map_.at(index);
}
void Group::ref()
~StorageImpl() override;
-public:
/** @brief Public interface */
s4u::Storage piface_;
static StorageImpl* byName(const char* name);
virtual std::string getHost() { return attach_; }
std::map<std::string, sg_size_t>* parseContent(const char* filename);
- static std::unordered_map<std::string, StorageImpl*>* storages;
static std::unordered_map<std::string, StorageImpl*>* storagesMap() { return StorageImpl::storages; }
lmm_constraint_t constraintWrite_; /* Constraint for maximum write bandwidth*/
private:
sg_size_t size_;
+ static std::unordered_map<std::string, StorageImpl*>* storages;
std::map<std::string, sg_size_t>* content_;
// Name of the host to which this storage is attached. Only used at platform parsing time, then the interface stores
// the Host directly.
: CpuAction(model_, cost, failed)
, cpu_(cpu)
{
+ indexHeap_ = -1;
cpu_->modified(true);
}
void setState(simgrid::surf::Action::State state) override;
int unref() override;
void cancel() override;
- void updateIndexHeap(int i);
+ void updateIndexHeap(int i) override;
void suspend() override;
void resume() override;
void setMaxDuration(double duration) override;
double getRemains() override;
CpuTi *cpu_;
- int indexHeap_ = -1;
- int suspended_ = 0;
boost::intrusive::list_member_hook<> action_ti_hook;
};
ActionList *runningActionSetThatDoesNotNeedBeingChecked_;
CpuTiList *modifiedCpu_;
xbt_heap_t tiActionHeap_;
-
-protected:
- void NotifyResourceTurnedOn(simgrid::surf::Resource*){};
- void NotifyResourceTurnedOff(simgrid::surf::Resource*){};
-
- void NotifyActionCancel(Action*){};
- void NotifyActionResume(Action*){};
- void NotifyActionSuspend(Action*){};
};
}
#include <cxxabi.h>
#include <limits>
#include <math.h>
-#include <stdio.h> /* sprintf */
#include <stdlib.h>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)");
int *data;
int pos;
int size;
-} s_dyn_light_t, *dyn_light_t;
+} s_dyn_light_t;
+typedef s_dyn_light_t* dyn_light_t;
double sg_maxmin_precision = 0.00001; /* Change this with --cfg=maxmin/precision:VALUE */
double sg_surf_precision = 0.00001; /* Change this with --cfg=surf/precision:VALUE */
static int Global_debug_id = 1;
static int Global_const_debug_id = 1;
-static void lmm_var_free(lmm_system_t sys, lmm_variable_t var);
static inline void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst);
static void lmm_on_disabled_var(lmm_system_t sys, lmm_constraint_t cnstr);
static int lmm_concurrency_slack(lmm_constraint_t cnstr);
static int lmm_cnstrs_min_concurrency_slack(lmm_variable_t var);
-static void lmm_check_concurrency(lmm_system_t sys);
-
inline int lmm_element_concurrency(lmm_element_t elem) {
//Ignore element with weight less than one (e.g. cross-traffic)
return (elem->consumption_weight >= 1) ? 1 : 0;
"Concurrency limit overflow!");
}
+static void lmm_check_concurrency(lmm_system_t sys)
+{
+ // These checks are very expensive, so do them only if we want to debug SURF LMM
+ if (not XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug))
+ return;
+
+ void* cnstIt;
+ xbt_swag_foreach(cnstIt, &(sys->constraint_set))
+ {
+ lmm_constraint_t cnst = (lmm_constraint_t)cnstIt;
+ int concurrency = 0;
+ void* elemIt;
+ xbt_swag_foreach(elemIt, &(cnst->enabled_element_set))
+ {
+ lmm_element_t elem = (lmm_element_t)elemIt;
+ xbt_assert(elem->variable->sharing_weight > 0);
+ concurrency += lmm_element_concurrency(elem);
+ }
+
+ xbt_swag_foreach(elemIt, &(cnst->disabled_element_set))
+ {
+ lmm_element_t elem = (lmm_element_t)elemIt;
+ // We should have staged variables only if concurrency is reached in some constraint
+ xbt_assert(cnst->concurrency_limit < 0 || elem->variable->staged_weight == 0 ||
+ lmm_cnstrs_min_concurrency_slack(elem->variable) < elem->variable->concurrency_share,
+ "should not have staged variable!");
+ }
+
+ xbt_assert(cnst->concurrency_limit < 0 || cnst->concurrency_limit >= concurrency, "concurrency check failed!");
+ xbt_assert(cnst->concurrency_current == concurrency, "concurrency_current is out-of-date!");
+ }
+
+ // Check that for each variable, all corresponding elements are in the same state (i.e. same element sets)
+ void* varIt;
+ xbt_swag_foreach(varIt, &(sys->variable_set))
+ {
+ lmm_variable_t var = (lmm_variable_t)varIt;
+
+ if (not var->cnsts_number)
+ continue;
+
+ lmm_element_t elem = &var->cnsts[0];
+ int belong_to_enabled = xbt_swag_belongs(elem, &(elem->constraint->enabled_element_set));
+ int belong_to_disabled = xbt_swag_belongs(elem, &(elem->constraint->disabled_element_set));
+ int belong_to_active = xbt_swag_belongs(elem, &(elem->constraint->active_element_set));
+
+ for (int i = 1; i < var->cnsts_number; i++) {
+ elem = &var->cnsts[i];
+ xbt_assert(belong_to_enabled == xbt_swag_belongs(elem, &(elem->constraint->enabled_element_set)),
+ "Variable inconsistency (1): enabled_element_set");
+ xbt_assert(belong_to_disabled == xbt_swag_belongs(elem, &(elem->constraint->disabled_element_set)),
+ "Variable inconsistency (2): disabled_element_set");
+ xbt_assert(belong_to_active == xbt_swag_belongs(elem, &(elem->constraint->active_element_set)),
+ "Variable inconsistency (3): active_element_set");
+ }
+ }
+}
+
+static inline void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
+{
+ XBT_IN("(sys=%p, var=%p)", sys, var);
+ sys->modified = 1;
+
+ // TODOLATER Can do better than that by leaving only the variable in only one enabled_element_set, call
+ // lmm_update_modified_set, and then remove it..
+ if (var->cnsts_number)
+ lmm_update_modified_set(sys, var->cnsts[0].constraint);
+
+ for (int i = 0; i < var->cnsts_number; i++) {
+ lmm_element_t elem = &var->cnsts[i];
+ if (var->sharing_weight > 0)
+ lmm_decrease_concurrency(elem);
+ xbt_swag_remove(elem, &(elem->constraint->enabled_element_set));
+ xbt_swag_remove(elem, &(elem->constraint->disabled_element_set));
+ xbt_swag_remove(elem, &(elem->constraint->active_element_set));
+ int nelements = xbt_swag_size(&(elem->constraint->enabled_element_set)) +
+ xbt_swag_size(&(elem->constraint->disabled_element_set));
+ if (nelements == 0)
+ make_constraint_inactive(sys, elem->constraint);
+ else
+ lmm_on_disabled_var(sys, elem->constraint);
+ }
+
+ // Check if we can enable new variables going through the constraints where var was.
+ // Do it after removing all elements, so he first disabled variables get priority over those with smaller requirement
+ for (int i = 0; i < var->cnsts_number; i++) {
+ lmm_element_t elem = &var->cnsts[i];
+ if (xbt_swag_size(&(elem->constraint->disabled_element_set)))
+ lmm_on_disabled_var(sys, elem->constraint);
+ }
+
+ var->cnsts_number = 0;
+
+ lmm_check_concurrency(sys);
+
+ XBT_OUT();
+}
+
+static void lmm_var_free(lmm_system_t sys, lmm_variable_t var)
+{
+ lmm_variable_remove(sys, var);
+ xbt_mallocator_release(sys->variable_mallocator, var);
+}
+
lmm_system_t lmm_system_new(bool selective_update)
{
- lmm_system_t l = nullptr;
s_lmm_variable_t var;
s_lmm_constraint_t cnst;
- l = xbt_new0(s_lmm_system_t, 1);
+ lmm_system_t l = xbt_new0(s_lmm_system_t, 1);
l->modified = 0;
l->selective_update_active = selective_update;
free(sys);
}
-static inline void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
-{
- int i;
-
- lmm_element_t elem = nullptr;
-
- XBT_IN("(sys=%p, var=%p)", sys, var);
- sys->modified = 1;
-
- //TODOLATER Can do better than that by leaving only the variable in only one enabled_element_set, call
- //lmm_update_modified_set, and then remove it..
- if(var->cnsts_number)
- lmm_update_modified_set(sys, var->cnsts[0].constraint);
-
- for (i = 0; i < var->cnsts_number; i++) {
- elem = &var->cnsts[i];
- if (var->sharing_weight > 0)
- lmm_decrease_concurrency(elem);
- xbt_swag_remove(elem, &(elem->constraint->enabled_element_set));
- xbt_swag_remove(elem, &(elem->constraint->disabled_element_set));
- xbt_swag_remove(elem, &(elem->constraint->active_element_set));
- int nelements = xbt_swag_size(&(elem->constraint->enabled_element_set)) +
- xbt_swag_size(&(elem->constraint->disabled_element_set));
- if (nelements == 0)
- make_constraint_inactive(sys, elem->constraint);
- else
- lmm_on_disabled_var(sys,elem->constraint);
- }
-
- //Check if we can enable new variables going through the constraints where var was.
- //Do it after removing all elements, so he first disabled variables get priority over those with smaller requirement
- for (i = 0; i < var->cnsts_number; i++) {
- elem = &var->cnsts[i];
- if(xbt_swag_size(&(elem->constraint->disabled_element_set)))
- lmm_on_disabled_var(sys,elem->constraint);
- }
-
- var->cnsts_number = 0;
-
- lmm_check_concurrency(sys);
-
- XBT_OUT();
-}
-
-static void lmm_var_free(lmm_system_t sys, lmm_variable_t var)
-{
- lmm_variable_remove(sys, var);
- xbt_mallocator_release(sys->variable_mallocator, var);
-}
-
static inline void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst)
{
make_constraint_inactive(sys, cnst);
lmm_variable_t lmm_variable_new(lmm_system_t sys, simgrid::surf::Action* id, double sharing_weight, double bound,
int number_of_constraints)
{
- lmm_variable_t var = nullptr;
- int i;
-
XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", sys, id, sharing_weight, bound, number_of_constraints);
- var = (lmm_variable_t) xbt_mallocator_get(sys->variable_mallocator);
+ lmm_variable_t var = (lmm_variable_t)xbt_mallocator_get(sys->variable_mallocator);
var->id = id;
var->id_int = Global_debug_id++;
var->cnsts = (s_lmm_element_t *) xbt_realloc(var->cnsts, number_of_constraints * sizeof(s_lmm_element_t));
- for (i = 0; i < number_of_constraints; i++) {
+ for (int i = 0; i < number_of_constraints; i++) {
var->cnsts[i].enabled_element_set_hookup.next = nullptr;
var->cnsts[i].enabled_element_set_hookup.prev = nullptr;
var->cnsts[i].disabled_element_set_hookup.next = nullptr;
lmm_element_t elem = nullptr;
int found = 0;
- int i;
- for (i = 0; i < var->cnsts_number; i++) {
+ for (int i = 0; i < var->cnsts_number; i++) {
elem = &(var->cnsts[i]);
if (elem->constraint == cnst) {
found = 1;
void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double consumption_weight)
{
- lmm_element_t elem = nullptr;
- int i,current_share;
-
sys->modified = 1;
//Check if this variable already has an active element in this constraint
//If it does, substract it from the required slack
- current_share=0;
+ int current_share = 0;
if(var->concurrency_share>1){
- for( i=0; i<var->cnsts_number;i++){
+ for (int i = 0; i < var->cnsts_number; i++) {
if(var->cnsts[i].constraint==cnst &&
xbt_swag_belongs(&var->cnsts[i],&(var->cnsts[i].constraint->enabled_element_set)))
current_share+=lmm_element_concurrency(&(var->cnsts[i]));
if (var->sharing_weight > 0 && var->concurrency_share - current_share > lmm_concurrency_slack(cnst)) {
double weight = var->sharing_weight;
lmm_disable_var(sys,var);
- for (i = 0; i < var->cnsts_number; i++)
+ for (int i = 0; i < var->cnsts_number; i++)
lmm_on_disabled_var(sys,var->cnsts[i].constraint);
consumption_weight = 0;
var->staged_weight=weight;
xbt_assert(var->cnsts_number < var->cnsts_size, "Too much constraints");
- elem = &(var->cnsts[var->cnsts_number++]);
+ lmm_element_t elem = &(var->cnsts[var->cnsts_number++]);
elem->consumption_weight = consumption_weight;
elem->constraint = cnst;
elem = (lmm_element_t)_elem;
//Visiting active_element_set, so, by construction, should never get a zero weight, correct?
xbt_assert(elem->variable->sharing_weight > 0);
- if ((elem->consumption_weight > 0))
+ if (elem->consumption_weight > 0)
xbt_swag_insert(elem->variable, &(sys->saturated_variable_set));
}
}
void lmm_print(lmm_system_t sys)
{
- void* _cnst;
- void* _elem;
- void* _var;
- lmm_constraint_t cnst = nullptr;
- lmm_element_t elem = nullptr;
- lmm_variable_t var = nullptr;
- xbt_swag_t cnst_list = nullptr;
- xbt_swag_t var_list = nullptr;
- xbt_swag_t elem_list = nullptr;
std::string buf = std::string("MAX-MIN ( ");
+ void* _var;
/* Printing Objective */
- var_list = &(sys->variable_set);
+ xbt_swag_t var_list = &(sys->variable_set);
xbt_swag_foreach(_var, var_list) {
- var = (lmm_variable_t)_var;
+ lmm_variable_t var = (lmm_variable_t)_var;
buf = buf + "'" + std::to_string(var->id_int) + "'(" + std::to_string(var->sharing_weight) + ") ";
}
buf += ")";
XBT_DEBUG("Constraints");
/* Printing Constraints */
- cnst_list = &(sys->active_constraint_set);
+ void* _cnst;
+ xbt_swag_t cnst_list = &(sys->active_constraint_set);
xbt_swag_foreach(_cnst, cnst_list) {
- cnst = (lmm_constraint_t)_cnst;
+ lmm_constraint_t cnst = (lmm_constraint_t)_cnst;
double sum = 0.0;
//Show the enabled variables
- elem_list = &(cnst->enabled_element_set);
+ void* _elem;
+ xbt_swag_t elem_list = &(cnst->enabled_element_set);
buf += "\t";
buf += ((cnst->sharing_policy) ? "(" : "max(");
xbt_swag_foreach(_elem, elem_list) {
- elem = (lmm_element_t)_elem;
+ lmm_element_t elem = (lmm_element_t)_elem;
buf = buf + std::to_string(elem->consumption_weight) + ".'" + std::to_string(elem->variable->id_int) + "'(" +
std::to_string(elem->variable->value) + ")" + ((cnst->sharing_policy) ? " + " : " , ");
if(cnst->sharing_policy)
//TODO: Adding disabled elements only for test compatibility, but do we really want them to be printed?
elem_list = &(cnst->disabled_element_set);
xbt_swag_foreach(_elem, elem_list) {
- elem = (lmm_element_t)_elem;
+ lmm_element_t elem = (lmm_element_t)_elem;
buf = buf + std::to_string(elem->consumption_weight) + ".'" + std::to_string(elem->variable->id_int) + "'(" +
std::to_string(elem->variable->value) + ")" + ((cnst->sharing_policy) ? " + " : " , ");
if(cnst->sharing_policy)
buf.clear();
xbt_assert(not double_positive(sum - cnst->bound, cnst->bound * sg_maxmin_precision),
"Incorrect value (%f is not smaller than %f): %g", sum, cnst->bound, sum - cnst->bound);
- // if(double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision))
- // XBT_ERROR("Incorrect value (%f is not smaller than %f): %g",sum, cnst->bound, sum - cnst->bound);
}
XBT_DEBUG("Variables");
/* Printing Result */
xbt_swag_foreach(_var, var_list) {
- var = (lmm_variable_t)_var;
+ lmm_variable_t var = (lmm_variable_t)_var;
if (var->bound > 0) {
XBT_DEBUG("'%d'(%f) : %f (<=%f)", var->id_int, var->sharing_weight, var->value, var->bound);
xbt_assert(not double_positive(var->value - var->bound, var->bound * sg_maxmin_precision),
void lmm_solve(lmm_system_t sys)
{
- void *_var, *_cnst, *_cnst_next, *_elem;
- lmm_variable_t var = nullptr;
- lmm_constraint_t cnst = nullptr;
- lmm_element_t elem = nullptr;
- xbt_swag_t cnst_list = nullptr;
- xbt_swag_t var_list = nullptr;
- xbt_swag_t elem_list = nullptr;
+ void* _cnst;
+ void* _cnst_next;
+ void* _elem;
double min_usage = -1;
double min_bound = -1;
/* Compute Usage and store the variables that reach the maximum. If selective_update_active is true, only constraints
* that changed are considered. Otherwise all constraints with active actions are considered.
*/
- cnst_list = sys->selective_update_active ? &(sys->modified_constraint_set) : &(sys->active_constraint_set);
+ xbt_swag_t cnst_list = sys->selective_update_active ? &(sys->modified_constraint_set) : &(sys->active_constraint_set);
XBT_DEBUG("Active constraints : %d", xbt_swag_size(cnst_list));
/* Init: Only modified code portions: reset the value of active variables */
xbt_swag_foreach(_cnst, cnst_list) {
- cnst = (lmm_constraint_t)_cnst;
- elem_list = &(cnst->enabled_element_set);
+ lmm_constraint_t cnst = (lmm_constraint_t)_cnst;
+ xbt_swag_t elem_list = &(cnst->enabled_element_set);
//XBT_DEBUG("Variable set : %d", xbt_swag_size(elem_list));
xbt_swag_foreach(_elem, elem_list) {
- var = ((lmm_element_t)_elem)->variable;
+ lmm_variable_t var = ((lmm_element_t)_elem)->variable;
xbt_assert(var->sharing_weight > 0.0);
var->value = 0.0;
}
saturated_constraint_set->data = xbt_new0(int, saturated_constraint_set->size);
xbt_swag_foreach_safe(_cnst, _cnst_next, cnst_list) {
- cnst = (lmm_constraint_t)_cnst;
+ lmm_constraint_t cnst = (lmm_constraint_t)_cnst;
/* INIT: Collect constraints that actually need to be saturated (i.e remaining and usage are strictly positive)
* into cnst_light_tab. */
cnst->remaining = cnst->bound;
if (not double_positive(cnst->remaining, cnst->bound * sg_maxmin_precision))
continue;
cnst->usage = 0;
- elem_list = &(cnst->enabled_element_set);
+ xbt_swag_t elem_list = &(cnst->enabled_element_set);
xbt_swag_foreach(_elem, elem_list) {
- elem = (lmm_element_t)_elem;
+ lmm_element_t elem = (lmm_element_t)_elem;
xbt_assert(elem->variable->sharing_weight > 0);
- if ((elem->consumption_weight > 0)) {
+ if (elem->consumption_weight > 0) {
if (cnst->sharing_policy)
cnst->usage += elem->consumption_weight / elem->variable->sharing_weight;
else if (cnst->usage < elem->consumption_weight / elem->variable->sharing_weight)
/* Saturated variables update */
do {
/* Fix the variables that have to be */
- var_list = &(sys->saturated_variable_set);
-
+ xbt_swag_t var_list = &(sys->saturated_variable_set);
+ void* _var;
+ lmm_variable_t var = nullptr;
xbt_swag_foreach(_var, var_list) {
var = (lmm_variable_t)_var;
if (var->sharing_weight <= 0.0)
/* Update the usage of contraints where this variable is involved */
for (i = 0; i < var->cnsts_number; i++) {
- elem = &var->cnsts[i];
- cnst = elem->constraint;
+ lmm_element_t elem = &var->cnsts[i];
+ lmm_constraint_t cnst = elem->constraint;
if (cnst->sharing_policy) {
//Remember: shared constraints require that sum(elem->value * var->value) < cnst->bound
double_update(&(cnst->remaining), elem->consumption_weight * var->value, cnst->bound * sg_maxmin_precision);
//Remember: non-shared constraints only require that max(elem->value * var->value) < cnst->bound
cnst->usage = 0.0;
make_elem_inactive(elem);
- elem_list = &(cnst->enabled_element_set);
+ xbt_swag_t elem_list = &(cnst->enabled_element_set);
xbt_swag_foreach(_elem, elem_list) {
elem = (lmm_element_t)_elem;
xbt_assert(elem->variable->sharing_weight > 0);
//A priori not a big performance issue, but we might do better by calling lmm_update_modified_set within the for loops
// (after doing the first for enabling==1, and before doing the last for disabling==1)
void lmm_enable_var(lmm_system_t sys, lmm_variable_t var){
- int i;
- lmm_element_t elem;
-
xbt_assert(lmm_can_enable_var(var));
var->sharing_weight = var->staged_weight;
var->staged_weight = 0;
- //Enabling the variable, move to var to list head. Subtility is: here, we need to call lmm_update_modified_set AFTER
+ // Enabling the variable, move to var to list head. Subtlety is: here, we need to call lmm_update_modified_set AFTER
// moving at least one element of var.
xbt_swag_remove(var, &(sys->variable_set));
xbt_swag_insert_at_head(var, &(sys->variable_set));
- for (i = 0; i < var->cnsts_number; i++) {
- elem = &var->cnsts[i];
+ for (int i = 0; i < var->cnsts_number; i++) {
+ lmm_element_t elem = &var->cnsts[i];
xbt_swag_remove(elem, &(elem->constraint->disabled_element_set));
xbt_swag_insert_at_head(elem, &(elem->constraint->enabled_element_set));
lmm_increase_concurrency(elem);
}
void lmm_disable_var(lmm_system_t sys, lmm_variable_t var){
- int i;
- lmm_element_t elem;
-
xbt_assert(not var->staged_weight, "Staged weight should have been cleared");
- //Disabling the variable, move to var to list tail. Subtility is: here, we need to call lmm_update_modified_set BEFORE
- //moving the last element of var.
+ // Disabling the variable, move to var to list tail. Subtlety is: here, we need to call lmm_update_modified_set BEFORE
+ // moving the last element of var.
xbt_swag_remove(var, &(sys->variable_set));
xbt_swag_insert_at_tail(var, &(sys->variable_set));
if (var->cnsts_number)
lmm_update_modified_set(sys, var->cnsts[0].constraint);
- for (i = 0; i < var->cnsts_number; i++) {
- elem = &var->cnsts[i];
+ for (int i = 0; i < var->cnsts_number; i++) {
+ lmm_element_t elem = &var->cnsts[i];
xbt_swag_remove(elem, &(elem->constraint->enabled_element_set));
xbt_swag_insert_at_tail(elem, &(elem->constraint->disabled_element_set));
*/
void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var, double weight)
{
-
xbt_assert(weight>=0,"Variable weight should not be negative!");
if (weight == var->sharing_weight)
return (lmm_constraint_t)xbt_swag_getNext(cnst, (sys->active_constraint_set).offset);
}
-/** \brief Update the constraint set propagating recursively to
- * other constraints so the system should not be entirely computed.
+/** \brief Update the constraint set propagating recursively to other constraints so the system should not be entirely
+ * computed.
*
* \param sys the lmm_system_t
* \param cnst the lmm_constraint_t affected by the change
}
/**
- * Returns resource load (in flop per second, or byte per second, or similar)
+ * Returns resource load (in flop per second, or byte per second, or similar)
*
- * If the resource is shared (the default case), the load is sum of
- * resource usage made by every variables located on this resource.
+ * If the resource is shared (the default case), the load is sum of resource usage made by every variables located on
+ * this resource.
+ *
+ * If the resource is not shared (ie in FATPIPE mode), then the load is the max (not the sum) of all resource usages
+ * located on this resource.
*
- * If the resource is not shared (ie in FATPIPE mode), then the the
- * load is the max (not the sum) of all resource usages located on this resource.
- * .
* \param cnst the lmm_constraint_t associated to the resource
*/
double lmm_constraint_get_usage(lmm_constraint_t cnst) {
- double usage = 0.0;
- xbt_swag_t elem_list = &(cnst->enabled_element_set);
- void *_elem;
-
- xbt_swag_foreach(_elem, elem_list) {
- lmm_element_t elem = (lmm_element_t)_elem;
- if (elem->consumption_weight > 0) {
- if (cnst->sharing_policy)
- usage += elem->consumption_weight * elem->variable->value;
- else if (usage < elem->consumption_weight * elem->variable->value)
- usage = std::max(usage, elem->consumption_weight * elem->variable->value);
- }
- }
+ double usage = 0.0;
+ xbt_swag_t elem_list = &(cnst->enabled_element_set);
+ void* _elem;
+
+ xbt_swag_foreach(_elem, elem_list)
+ {
+ lmm_element_t elem = (lmm_element_t)_elem;
+ if (elem->consumption_weight > 0) {
+ if (cnst->sharing_policy)
+ usage += elem->consumption_weight * elem->variable->value;
+ else if (usage < elem->consumption_weight * elem->variable->value)
+ usage = std::max(usage, elem->consumption_weight * elem->variable->value);
+ }
+ }
return usage;
}
+
int lmm_constraint_get_variable_amount(lmm_constraint_t cnst) {
int usage = 0;
xbt_swag_t elem_list = &(cnst->enabled_element_set);
}
return usage;
}
-
-void lmm_check_concurrency(lmm_system_t sys){
- //These checks are very expensive, so do them only if we want to debug SURF LMM
- if (XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug)) {
- void* cnstIt;
- xbt_swag_foreach(cnstIt, &(sys->constraint_set))
- {
- lmm_constraint_t cnst = (lmm_constraint_t)cnstIt;
- int concurrency = 0;
- void* elemIt;
- xbt_swag_foreach(elemIt, &(cnst->enabled_element_set))
- {
- lmm_element_t elem = (lmm_element_t)elemIt;
- xbt_assert(elem->variable->sharing_weight > 0);
- concurrency+=lmm_element_concurrency(elem);
- }
-
- xbt_swag_foreach(elemIt, &(cnst->disabled_element_set))
- {
- lmm_element_t elem = (lmm_element_t)elemIt;
- //We should have staged variables only if concurrency is reached in some constraint
- xbt_assert(cnst->concurrency_limit<0 || elem->variable->staged_weight==0 ||
- lmm_cnstrs_min_concurrency_slack(elem->variable) < elem->variable->concurrency_share,
- "should not have staged variable!");
- }
-
- xbt_assert(cnst->concurrency_limit<0 || cnst->concurrency_limit >= concurrency,"concurrency check failed!");
- xbt_assert(cnst->concurrency_current == concurrency, "concurrency_current is out-of-date!");
- }
-
- //Check that for each variable, all corresponding elements are in the same state (i.e. same element sets)
- void* varIt;
- xbt_swag_foreach(varIt, &(sys->variable_set))
- {
- lmm_variable_t var = (lmm_variable_t)varIt;
-
- if (not var->cnsts_number)
- continue;
-
- lmm_element_t elem = &var->cnsts[0];
- int belong_to_enabled = xbt_swag_belongs(elem, &(elem->constraint->enabled_element_set));
- int belong_to_disabled = xbt_swag_belongs(elem, &(elem->constraint->disabled_element_set));
- int belong_to_active = xbt_swag_belongs(elem, &(elem->constraint->active_element_set));
-
- for (int i = 1; i < var->cnsts_number; i++) {
- elem = &var->cnsts[i];
- xbt_assert(belong_to_enabled==xbt_swag_belongs(elem,&(elem->constraint->enabled_element_set)),
- "Variable inconsistency (1): enabled_element_set");
- xbt_assert(belong_to_disabled==xbt_swag_belongs(elem,&(elem->constraint->disabled_element_set)),
- "Variable inconsistency (2): disabled_element_set");
- xbt_assert(belong_to_active==xbt_swag_belongs(elem,&(elem->constraint->active_element_set)),
- "Variable inconsistency (3): active_element_set");
- }
- }
- }
-}
action->finish();
action->setState(Action::State::done);
action->heapRemove(actionHeap_);
-
- action->gapRemove();
}
}
}
((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) {
action->finish();
action->setState(Action::State::done);
- action->gapRemove();
}
}
}
"Trace '%s' must have either a content, or point to a file on disk.",trace->id);
tmgr_trace = tmgr_trace_new_from_string(trace->id, trace->pc_data, trace->periodicity);
}
- xbt_dict_set(traces_set_list, trace->id, static_cast<void*>(tmgr_trace), nullptr);
+ traces_set_list.insert({trace->id, tmgr_trace});
}
/* search relative files in the path */
for (auto path_elm : surf_path) {
- char* buff = bprintf("%s" FILE_DELIM "%s", path_elm.c_str(), name);
- file = fopen(buff, mode);
- free(buff);
+ std::string buff = path_elm + FILE_DELIM + name;
+ file = fopen(buff.c_str(), mode);
if (file)
return file;
delete stype->model_properties;
free(stype);
}
- for (auto s : *simgrid::surf::StorageImpl::storages)
+ for (auto s : *simgrid::surf::StorageImpl::storagesMap())
delete s.second;
- delete simgrid::surf::StorageImpl::storages;
+ delete simgrid::surf::StorageImpl::storagesMap();
for (auto model : *all_existing_models)
delete model;
heapRemove(getModel()->getActionHeap());
}
-void Action::gapRemove() {}
-
void Action::setSharingWeight(double weight)
{
XBT_IN("(%p,%g)", this, weight);
#include <boost/intrusive/list.hpp>
#include <string>
+#include <unordered_map>
#define NO_MAX_DURATION -1.0
extern XBT_PRIVATE double sg_weight_S_parameter;
extern XBT_PRIVATE int sg_network_crosstraffic;
extern XBT_PRIVATE std::vector<std::string> surf_path;
+extern XBT_PRIVATE std::unordered_map<std::string, tmgr_trace_t> traces_set_list;
extern "C" {
XBT_PUBLIC(double) surf_get_clock();
NOTSET
};
-/*********
- * Trace *
- *********/
-/* For the trace and trace:connect tag (store their content till the end of the parsing) */
-XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list;
-
/**********
* Action *
**********/
void heapInsert(xbt_heap_t heap, double key, enum heap_action_type hat);
void heapRemove(xbt_heap_t heap);
void heapUpdate(xbt_heap_t heap, double key, enum heap_action_type hat);
- void updateIndexHeap(int i);
+ virtual void updateIndexHeap(int i);
lmm_variable_t getVariable() {return variable_;}
double getLastUpdate() {return lastUpdate_;}
void refreshLastUpdate() {lastUpdate_ = surf_get_clock();}
enum heap_action_type getHat() {return hat_;}
bool is_linked() {return action_lmm_hook.is_linked();}
- void gapRemove();
protected:
lmm_variable_t variable_ = nullptr;
int main(int argc, char** argv)
{
+ XBT_LOG_CONNECT(unit);
xbt_log_init(&argc, argv);
return ::boost::unit_test::unit_test_main(&init_function, argc, argv);
}
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
-SG_BEGIN_DECL()
/* Trace related stuff */
-
-xbt_dict_t traces_set_list = nullptr;
+XBT_PRIVATE std::unordered_map<std::string, tmgr_trace_t> traces_set_list;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_host_avail;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_host_speed;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_avail;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_bw;
XBT_PRIVATE std::unordered_map<std::string, std::string> trace_connect_list_link_lat;
+SG_BEGIN_DECL()
void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect)
{
- xbt_assert(xbt_dict_get_or_null(traces_set_list, trace_connect->trace),
+ xbt_assert(traces_set_list.find(trace_connect->trace) != traces_set_list.end(),
"Cannot connect trace %s to %s: trace unknown", trace_connect->trace, trace_connect->element);
switch (trace_connect->kind) {
after_config_done = 0;
surf_parse_open(file);
- traces_set_list = xbt_dict_new_homogeneous(nullptr);
-
/* Do the actual parsing */
parse_status = surf_parse();
/* connect all traces relative to hosts */
for (auto elm : trace_connect_list_host_avail) {
- tmgr_trace_t trace = (tmgr_trace_t)xbt_dict_get_or_null(traces_set_list, elm.first.c_str());
- xbt_assert(trace, "Trace %s undefined", elm.first.c_str());
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
xbt_assert(host, "Host %s undefined", elm.second.c_str());
}
for (auto elm : trace_connect_list_host_speed) {
- tmgr_trace_t trace = (tmgr_trace_t)xbt_dict_get_or_null(traces_set_list, elm.first.c_str());
- xbt_assert(trace, "Trace %s undefined", elm.first.c_str());
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
simgrid::s4u::Host* host = sg_host_by_name(elm.second.c_str());
xbt_assert(host, "Host %s undefined", elm.second.c_str());
}
for (auto elm : trace_connect_list_link_avail) {
- tmgr_trace_t trace = (tmgr_trace_t)xbt_dict_get_or_null(traces_set_list, elm.first.c_str());
- xbt_assert(trace, "Trace %s undefined", elm.first.c_str());
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
xbt_assert(link, "Link %s undefined", elm.second.c_str());
}
for (auto elm : trace_connect_list_link_bw) {
- tmgr_trace_t trace = (tmgr_trace_t)xbt_dict_get_or_null(traces_set_list, elm.first.c_str());
- xbt_assert(trace, "Trace %s undefined", elm.first.c_str());
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
xbt_assert(link, "Link %s undefined", elm.second.c_str());
link->setBandwidthTrace(trace);
}
for (auto elm : trace_connect_list_link_lat) {
- tmgr_trace_t trace = (tmgr_trace_t)xbt_dict_get_or_null(traces_set_list, elm.first.c_str());
- xbt_assert(trace, "Trace %s undefined", elm.first.c_str());
+ xbt_assert(traces_set_list.find(elm.first) != traces_set_list.end(), "Trace %s undefined", elm.first.c_str());
+ tmgr_trace_t trace = traces_set_list.at(elm.first);
sg_link_t link = simgrid::s4u::Link::byName(elm.second.c_str());
xbt_assert(link, "Link %s undefined", elm.second.c_str());
link->setLatencyTrace(trace);
}
- /* Free my data */
- xbt_dict_free(&traces_set_list);
-
surf_parse_close();
if (parse_status)
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict, xbt, "Dictionaries provide the same functionalities as hash tables");
-/**
- * \brief Constructor
- * \return pointer to the destination
- * \see xbt_dict_new_homogenous(), xbt_dict_free()
- *
- * Creates and initialize a new dictionary with a default hashtable size.
- * The dictionary is heterogeneous: each element can have a different free function.
- */
xbt_dict_t xbt_dict_new()
{
XBT_WARN("Function xbt_dict_new() will soon be dropped. Please switch to xbt_dict_new_homogeneous()");
/* log - a generic logging facility in the spirit of log4j */
-/* Copyright (c) 2004-2015. The SimGrid Team.
+/* Copyright (c) 2004-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_LOG_CONNECT(s4u_channel);
XBT_LOG_CONNECT(s4u_comm);
XBT_LOG_CONNECT(s4u_file);
+ XBT_LOG_CONNECT(s4u_link);
+ XBT_LOG_CONNECT(s4u_vm);
/* sg */
XBT_LOG_CONNECT(sg_host);
XBT_LOG_CONNECT(simix_host);
XBT_LOG_CONNECT(simix_io);
XBT_LOG_CONNECT(simix_kernel);
+ XBT_LOG_CONNECT(simix_mailbox);
XBT_LOG_CONNECT(simix_network);
XBT_LOG_CONNECT(simix_process);
XBT_LOG_CONNECT(simix_popping);
XBT_LOG_CONNECT(surf_cpu_cas);
XBT_LOG_CONNECT(surf_cpu_ti);
XBT_LOG_CONNECT(surf_energy);
+ XBT_LOG_CONNECT(surf_file);
XBT_LOG_CONNECT(surf_kernel);
XBT_LOG_CONNECT(surf_lagrange);
XBT_LOG_CONNECT(surf_lagrange_dichotomy);
XBT_LOG_CONNECT(ns3);
#endif
XBT_LOG_CONNECT(surf_parse);
+ XBT_LOG_CONNECT(surf_plugin_load);
XBT_LOG_CONNECT(surf_route);
XBT_LOG_CONNECT(surf_routing_generic);
XBT_LOG_CONNECT(surf_route_cluster);
void xbt_log_init(int *argc, char **argv)
{
unsigned help_requested = 0; /* 1: logs; 2: categories */
- int i;
- int j;
- char *opt;
+ int j = 1;
/* uncomment to set the LOG category to debug directly */
// _XBT_LOGV(log).threshold = xbt_log_priority_debug;
xbt_log_connect_categories();
/* Set logs and init log submodule */
- for (j = i = 1; i < *argc; i++) {
+ for (int i = 1; i < *argc; i++) {
if (!strncmp(argv[i], "--log=", strlen("--log="))) {
- opt = strchr(argv[i], '=');
+ char* opt = strchr(argv[i], '=');
opt++;
xbt_log_control_set(opt);
XBT_DEBUG("Did apply '%s' as log setting", opt);
for (auto storage : *storages) {
XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname());
- storage.second->setProperty("other usage", xbt_strdup("gpfs"));
+ storage.second->setProperty("other usage", "gpfs");
}
delete storages;
}
foreach (test ${umpire_tests_passing})
write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! timeout 30")
write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! output display" APPEND)
- write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../smpi_script/bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll_selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
+ write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../smpi_script/bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll-selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
endforeach()
foreach (test ${umpire_tests_deadlock} ${umpire_tests_problematic} )
write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! timeout 30" )
write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! expect return 3" APPEND)
write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "! output display" APPEND)
- write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../smpi_script/bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll_selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
+ write_file(${CMAKE_CURRENT_BINARY_DIR}/${test}.tesh "\$ \${bindir:=.}/../../../../smpi_script/bin/smpirun -wrapper \"\${bindir:=.}/../../../../bin/simgrid-mc\" -hostfile ../../hostfile -platform ../../../../examples/platforms/small_platform.xml --log=xbt_cfg.thresh:warning -np 3 --cfg=smpi/host-speed:1e9 --cfg=smpi/coll-selector:mpich \${bindir:=.}/${test} --log=smpi_coll.thresh:error" APPEND)
endforeach()
endif()
# Test OMPI selector: CONTEXT if available; RAW if not (with mmap privatization or none)
if(HAVE_UCONTEXT_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
+ ADD_TEST(test-smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll-selector:ompi -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-ompi-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
else()
if(HAVE_RAW_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-coll-ompi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
+ ADD_TEST(test-smpi-mpich3-coll-ompi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:ompi -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-ompi-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
endif()
# Test MPICH selector: dlopen privatization and PTHREAD if exists (without priv and with raw if not)
if(HAVE_PRIVATIZATION AND HAVE_THREAD_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-coll-mpich-thread-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatization:dlopen)
+ ADD_TEST(test-smpi-mpich3-coll-mpich-thread-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll-selector:mpich -execarg=--cfg=smpi/privatization:dlopen)
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mpich-thread-dlopen PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
else()
if(HAVE_RAW_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+ ADD_TEST(test-smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:mpich -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mpich-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
endif()
# Test MVAPICH2 selector: dlopen privatization and UCONTEXT if exists (without priv and with raw if not)
if(HAVE_PRIVATIZATION AND HAVE_UCONTEXT_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-coll-mvapich2-ucontext-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:mvapich2 -execarg=--cfg=smpi/privatization:dlopen)
+ ADD_TEST(test-smpi-mpich3-coll-mvapich2-ucontext-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll-selector:mvapich2 -execarg=--cfg=smpi/privatization:dlopen)
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mvapich2-ucontext-dlopen PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
else()
if(HAVE_RAW_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-coll-mvapich2-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mvapich2 -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+ ADD_TEST(test-smpi-mpich3-coll-mvapich2-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:mvapich2 -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mvapich2-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
endif()
# Test IMPI selector: always raw, with dlopen if priv exists
if(HAVE_RAW_CONTEXTS)
if(HAVE_PRIVATIZATION)
- ADD_TEST(test-smpi-mpich3-coll-impi-raw-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:impi -execarg=--cfg=smpi/privatization:dlopen)
+ ADD_TEST(test-smpi-mpich3-coll-impi-raw-dlopen ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:impi -execarg=--cfg=smpi/privatization:dlopen)
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-impi-raw-dlopen PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
else()
- ADD_TEST(test-smpi-mpich3-coll-impi-raw-nopriv ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:impi -execarg=--cfg=smpi/privatization:no)
+ ADD_TEST(test-smpi-mpich3-coll-impi-raw-nopriv ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll-selector:impi -execarg=--cfg=smpi/privatization:no)
SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-impi-raw-nopriv PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
endif()
endif()
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../include/")
add_executable(attrmpi1f attrmpi1f.f)
add_executable(baseattr2f baseattr2f.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
# add_executable(allredint8f allredint8f.f)
# add_executable(allredopttf allredopttf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
# add_executable(commerrf commerrf.f)
# add_executable(commnamef commnamef.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/typeaints.h.in ${CMAKE_CURRENT_SOURCE_DIR}/typeaints.h @ONLY)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/typeaints.h.in typeaints.h @ONLY)
# add_executable(allctypesf allctypesf.f)
add_executable(gaddressf gaddressf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
# add_executable(allocmemf allocmemf.f)
# add_executable(c2f2cf c2f2cf.f c2f2c.c)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(infotest2f infotest2f.f ../util/mtestf.f)
add_executable(infotestf infotestf.f ../util/mtestf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(baseenvf baseenvf.f)
target_link_libraries(baseenvf simgrid mtest_f77)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(allpairf allpairf.f)
# add_executable(greqf greqf.f dummyf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(winaccf winaccf.f)
# add_executable(winerrf winerrf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(cartcrf cartcrf.f)
# add_executable(dgraph_unwgtf dgraph_unwgtf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
#F77 version of the mtest library
add_library(mtest_f77 STATIC ../util/mtestf.f)
endif()
include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
- include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(winaccf90 winaccf90.f90)
# add_executable(winerrf90 winerrf90.f90)
endif()
if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-perf-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/running-power:-1)
+ ADD_TEST(test-smpi-mpich3-perf-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/host-speed:-1)
endif()
foreach(file allredtrace commcreatep non_zero_root sendrecvl timer transp-datatype twovec dtpack indexperf manyrma
elsif (/--?maxnp=(.*)/) { $np_max = $1; }
elsif (/--?tests=(.*)/) { $listfiles = $1; }
elsif (/--?srcdir=(.*)/) { $srcdir = $1;
- $mpiexec="$mpiexec -platform ${srcdir}/../../../../examples/platforms/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile_coll --log=root.thr:critical --cfg=smpi/running-power:1e9 --cfg=smpi/async-small-thresh:65536"; }
+ $mpiexec="$mpiexec -platform ${srcdir}/../../../../examples/platforms/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile_coll --log=root.thr:critical --cfg=smpi/host-speed:1e9 --cfg=smpi/async-small-thresh:65536"; }
elsif (/--?verbose/) { $verbose = 1; }
elsif (/--?showprogress/) { $showProgress = 1; }
elsif (/--?debug/) { $debug = 1; }
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simgrid/msg.h"
#include "xbt.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(synchro_crashtest, "Logs of this example");
return NULL;
}
-static int crasher(int argc, char *argv[])
+static int crasher()
{
- int i;
- xbt_os_thread_t *crashers;
-
- xbt_init(&argc, argv);
-
/* initializations of the philosopher mechanisms */
id = xbt_new0(int, crasher_amount);
- crashers = xbt_new(xbt_os_thread_t, crasher_amount);
+ xbt_os_thread_t* crashers = xbt_new(xbt_os_thread_t, crasher_amount);
- for (i = 0; i < crasher_amount; i++)
+ for (int i = 0; i < crasher_amount; i++)
id[i] = i;
/* spawn threads */
- for (i = 0; i < crasher_amount; i++) {
+ for (int i = 0; i < crasher_amount; i++) {
char *name = bprintf("thread %d", i);
crashers[i] = xbt_os_thread_create(name, &crasher_thread, &id[i], NULL );
free(name);
}
/* wait for them */
- for (i = 0; i < crasher_amount; i++)
+ for (int i = 0; i < crasher_amount; i++)
xbt_os_thread_join(crashers[i],NULL);
xbt_free(crashers);
int main(int argc, char *argv[])
{
- return crasher(argc, argv);
+ MSG_init(&argc, argv);
+ return crasher();
}
tools/cmake/MakeLibWin.cmake
tools/cmake/Modules/FindGraphviz.cmake
tools/cmake/Modules/FindLibdw.cmake
+ tools/cmake/Modules/FindLibelf.cmake
tools/cmake/Modules/FindLibunwind.cmake
tools/cmake/Modules/FindLibevent.cmake
tools/cmake/Modules/FindLuaSimgrid.cmake
find_program(GCOV_PATH gcov)
if(GCOV_PATH)
set(COVERAGE_COMMAND "${GCOV_PATH}" CACHE TYPE FILEPATH FORCE)
+ set(COVERAGE_EXTRA_FLAGS "-l -p")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOVERAGE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
- set(TESH_OPTION --enable-coverage)
add_definitions(-fprofile-arcs -ftest-coverage)
endif()
endif()
--- /dev/null
+find_path(LIBELF_INCLUDE_DIR "libelf.h"
+ HINTS
+ $ENV{SIMGRID_LIBELF_LIBRARY_PATH}
+ $ENV{LD_LIBRARY_PATH}
+ $ENV{LIBELF_LIBRARY_PATH}
+ PATH_SUFFIXES include/ GnuWin32/include
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr)
+find_library(LIBELF_LIBRARY
+ NAMES elf
+ HINTS
+ $ENV{SIMGRID_LIBELF_LIBRARY_PATH}
+ $ENV{LD_LIBRARY_PATH}
+ $ENV{LIBELF_LIBRARY_PATH}
+ PATH_SUFFIXES lib/ GnuWin32/lib
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr)
+set(LIBELF_LIBRARIES "${LIBELF_LIBRARY}")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ Libelf
+ DEFAULT_MSG
+ LIBELF_LIBRARIES
+ LIBELF_INCLUDE_DIR)
+mark_as_advanced(LIBELF_INCLUDE_DIR LIBELF_LIBRARIES)
ENDIF()
IF(enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN AND HAVE_THREAD_CONTEXTS)
- ADD_TEST(test-smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/stack_size:8000 -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+ ADD_TEST(test-smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/stack-size:8000 -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
ADD_TEST(test-smpi-mpich3-thread-f90 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/factory:thread)
SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
add_executable (graphicator graphicator.c)
target_link_libraries(graphicator simgrid)
set_target_properties(graphicator PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-ADD_TESH(graphicator --setenv srcdir=${CMAKE_HOME_DIRECTORY} --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd ${CMAKE_HOME_DIRECTORY}/tools/graphicator graphicator.tesh)
+ADD_TESH(graphicator --setenv srcdir=${CMAKE_HOME_DIRECTORY} --setenv bindir=${CMAKE_BINARY_DIR}/bin --cd ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/graphicator.tesh)
## Clean generated files
get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
obj:/usr/bin/*
}
+{
+ Memory leak in cmake
+ Memcheck:Leak
+ ...
+ obj:cmake
+}
+
# There's a constant leak of 56 bytes in the depths of libc which
# manifests, for example, when using backtrace()
{