src/replay/replay
src/testall
+teshsuite/bug-17132/bug-17132
teshsuite/smpi/allgather_coll
teshsuite/smpi/allgatherv_coll
teshsuite/smpi/allreduce_coll
ADD_TEST(smpi-struct-thread ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
ADD_TEST(smpi-pt2pt-thread ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
ADD_TEST(smpi-compute-thread ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
+
+ # https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165
+ ADD_TEST(smpi-bug-17132 ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.tesh)
+
if (NOT WIN32)
ADD_TEST(smpi-shared-thread ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared.tesh)
endif()
${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkLink.java
${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkAction.java
+ ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/RoutingEdge.java
+
+ ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/ActionState.java
+ ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/ResourceState.java
+
${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/LmmConstraint.java
+ ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/LmmVariable.java
${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/XbtDict.java
)
teshsuite/msg/CMakeLists.txt
teshsuite/msg/storage/CMakeLists.txt
teshsuite/msg/trace/CMakeLists.txt
+ teshsuite/bug-17132/CMakeLists.txt
teshsuite/simdag/CMakeLists.txt
teshsuite/simdag/availability/CMakeLists.txt
teshsuite/simdag/network/CMakeLists.txt
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132)
+
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simix)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi)
public void main(String[] args) throws MsgException {
Msg.info("helloo!");
- double communicationTime=0;
- Msg.info("try to get a task");
-
- Task task = Task.receive(getHost().getName());
- double timeGot = Msg.getClock();
-
- Msg.info("Got at time "+ timeGot);
- task.execute();
+ Task task;
+ task = Task.receive(getHost().getName());
+ task = Task.receive(getHost().getName());
+ task = Task.receive(getHost().getName());
Msg.info("goodbye!");
}
public class ReservationPlugin extends Plugin {
public ReservationPlugin() {
- activateCpuCreatedCallback();
- activateCpuDestructedCallback();
- activateCpuStateChangedCallback();
- activateCpuActionStateChangedCallback();
-
- activateNetworkLinkCreatedCallback();
- activateNetworkLinkDestructedCallback();
- activateNetworkLinkStateChangedCallback();
- activateNetworkActionStateChangedCallback();
-
- }
-
- public void init() {
- NetworkLink[] route = Surf.getRoute("Jacquelin", "Boivin");
- Msg.info("RouteLength:"+route.length);
- Msg.info("RouteName0:"+route[0].getName());
- Msg.info("RouteName1:"+route[1].getName());
+ activateNetworkCommunicateCallback();
}
- public void cpuCreatedCallback(Cpu cpu) {
- Msg.info("Trace: Cpu created "+cpu.getName());
- }
-
- public void cpuDestructedCallback(Cpu cpu) {
- Msg.info("Trace: Cpu destructed "+cpu.getName());
- }
-
- public void cpuStateChangedCallback(Cpu cpu){
- Msg.info("Trace: Cpu state changed "+cpu.getName());
- }
-
- public void cpuActionStateChangedCallback(CpuAction action){
- Msg.info("Trace: CpuAction state changed "+action.getModel().getName());
- }
-
- public void networkLinkCreatedCallback(NetworkLink link) {
- Msg.info("Trace: NetworkLink created "+link.getName());
- }
+ //HashMap<String,Reservation> reservations;
+ double bandwidth = 0;
+ String src = "";
+ String dst = "";
- public void networkLinkDestructedCallback(NetworkLink link) {
- Msg.info("Trace: NetworkLink destructed "+link.getName());
+ public void limitBandwidthActions(String src, String dst, double bandwidth){
+ this.bandwidth = bandwidth;
+ this.src = src;
+ this.dst = dst;
}
- public void networkLinkStateChangedCallback(NetworkLink link){
- Msg.info("Trace: NetworkLink state changed "+link.getName());
+ public void updateBandwidthRoute(String src, String dst, double bandwidth){
+ NetworkLink[] route = Surf.getRoute(src, dst);
+ for (int i =0; i<route.length; i++){
+ Msg.info("Trace: bandwidth of "+route[i].getName()+" before "+route[i].getBandwidth());
+ route[i].updateBandwidth(bandwidth);//getName();
+ Msg.info("Trace: bandwidth of "+route[i].getName()+" after "+route[i].getBandwidth());
+ }
}
- public void networkActionStateChangedCallback(NetworkAction action){
- Msg.info("Trace: NetworkAction state changed "+action.getModel().getName());
+ public void networkCommunicateCallback(NetworkAction action, RoutingEdge src, RoutingEdge dst, double size, double rate){
+ if (src.getName().equals(this.src) && dst.getName().equals(this.dst)) {
+ action.setBound(this.bandwidth);
+ }
+ Msg.info("Trace: Communicate message of size "+size+" with rate "+rate+" and bound "+action.getBound()+" from "+src.getName()+" to "+dst.getName());
}
}
Msg.info("helloo!");
- int hostCount = args.length;
-
- Msg.info("host count: " + hostCount);
- String mailboxes[] = new String[hostCount];
- double time;
+ String receiverName = args[0];
+ double oldTime, curTime;
double computeDuration = 10000;
Task task;
- for(int pos = 0; pos < args.length ; pos++) {
- try {
- mailboxes[pos] = Host.getByName(args[pos]).getName();
- } catch (HostNotFoundException e) {
- Msg.info("Invalid deployment file: " + e.toString());
- System.exit(1);
- }
- }
-
- for (int pos = 0; pos < hostCount; pos++) {
- time = Msg.getClock();
-
- Msg.info("sender time: " + time);
-
- task = new Task("no name",computeDuration,commSizeLat);
-
- task.send(mailboxes[pos]);
- }
-
- Msg.info("goodbye!");
+ oldTime = Msg.getClock();
+ task = new Task("no name",computeDuration,commSizeLat);
+ task.send(receiverName);
+ curTime = Msg.getClock();
+ Msg.info("Send duration: " + (curTime - oldTime));
+
+ TestPlugin.tp.updateBandwidthRoute("Jacquelin", "Boivin", 10E2);
+ oldTime = curTime;
+ task = new Task("no name",computeDuration,commSizeLat);
+ task.send(receiverName);
+ curTime = Msg.getClock();
+ Msg.info("Send duration with update bandwidth: " + (curTime - oldTime));
+
+ TestPlugin.tp.limitBandwidthActions("Jacquelin", "Boivin", 10E1);
+ oldTime = curTime;
+ task = new Task("no name",computeDuration,commSizeLat);
+ task.send(receiverName);
+ curTime = Msg.getClock();
+ Msg.info("Send normal duration with limited bandwidth: " + (curTime - oldTime));
+
+ Msg.info("goodbye!");
}
}
* java simgrid.msg.Msg
* which also contains such a launcher
*/
- static ReservationPlugin tp = new ReservationPlugin();
+ public static ReservationPlugin tp = new ReservationPlugin();
public static void main(String[] args) throws NativeException {
/* initialize the MSG simulation. Must be done before anything else (even logging). */
Msg.info("example : TestPlugin ping_pong_platform.xml ping_pong_deployment.xml");
System.exit(1);
}
+
/* construct the platform and deploy the application */
Msg.createEnvironment(args[0]);
Msg.deployApplication(args[1]);
- tp.init();
+
+
// getName());
/* execute the simulation. */
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
<platform version="3">
- <process host="Jacquelin" function="surfPlugin.Sender">
+ <process host="Jacquelin" function="reservationSurfPlugin.Sender">
<argument value="Boivin"/>
</process>
-<process host="Boivin" function="surfPlugin.Receiver"/>
+<process host="Boivin" function="reservationSurfPlugin.Receiver"/>
</platform>
<host id="Jacquelin" power="137.333Mf"/>
<host id="Boivin" power="98.095Mf"/>
<host id="TeX" power="68.667Mf"/>
- <link id="link0" bandwidth="1MBps" latency="100ms"/>
- <link id="link1" bandwidth="1MBps" latency="100ms"/>
- <link id="link2" bandwidth="1MBps" latency="100ms"/>
+ <link id="link0" bandwidth="1MBps" latency="1ms"/>
+ <link id="link1" bandwidth="1MBps" latency="1ms"/>
+ <link id="link2" bandwidth="1MBps" latency="1ms"/>
<route src="Jacquelin" dst="Boivin">
<link_ctn id="link0"/>
<link_ctn id="link1"/>
$ java -classpath ${classpath:=.} reservationSurfPlugin/TestPlugin ${srcdir:=.}/reservationSurfPlugin/reservationSurfPluginPlatform.xml ${srcdir:=.}/reservationSurfPlugin/reservationSurfPluginDeployment.xml
> [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created __loopback__
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed __loopback__
-> [0.000000] [jmsg/INFO] Trace: Cpu created Jacquelin
-> [0.000000] [jmsg/INFO] Trace: Cpu state changed Jacquelin
-> [0.000000] [jmsg/INFO] Trace: Cpu created Boivin
-> [0.000000] [jmsg/INFO] Trace: Cpu state changed Boivin
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created link
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed link
-> [Jacquelin:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] helloo!
-> [Jacquelin:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] host count: 1
-> [Jacquelin:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] sender time: 0.0
-> [Boivin:surfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] helloo!
-> [Boivin:surfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] try to get a task
-> [1.301001] [jmsg/INFO] Trace: NetworkAction state changed network
-> [Boivin:surfPlugin.Receiver:(2) 1.301001] [jmsg/INFO] Got at time 1.3010010824742269
-> [Jacquelin:surfPlugin.Sender:(1) 1.301001] [jmsg/INFO] goodbye!
-> [1.301103] [jmsg/INFO] Trace: CpuAction state changed cpu
-> [Boivin:surfPlugin.Receiver:(2) 1.301103] [jmsg/INFO] goodbye!
-> [1.301103] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
-> [1.301103] [jmsg/INFO] Trace: Cpu destructed Jacquelin
-> [1.301103] [jmsg/INFO] Trace: Cpu destructed Boivin
-> [1.301103] [jmsg/INFO] Trace: NetworkLink destructed link
-> [1.301103] [jmsg/INFO] Trace: NetworkLink destructed __loopback__
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.000000] [jmsg/INFO] helloo!
+> [Boivin:reservationSurfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] helloo!
+> [0.000000] [jmsg/INFO] Trace: Communicate message of size 1.0 with rate -1.0 and bound 1.048576E9 from Jacquelin to Boivin
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Send duration: 0.026021082474226805
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link0 before 1000000.0
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link0 after 1000.0
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link1 before 1000000.0
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link1 after 1000.0
+> [0.026021] [jmsg/INFO] Trace: Communicate message of size 1.0 with rate -1.0 and bound 1.048576E9 from Jacquelin to Boivin
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.053124] [jmsg/INFO] Send duration with update bandwidth: 0.027102474226804125
+> [0.053124] [jmsg/INFO] Trace: Communicate message of size 1.0 with rate -1.0 and bound 100.0 from Jacquelin to Boivin
+> [Boivin:reservationSurfPlugin.Receiver:(2) 0.089144] [jmsg/INFO] goodbye!
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.089144] [jmsg/INFO] Send normal duration with limited bandwidth: 0.036019999999999996
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.089144] [jmsg/INFO] goodbye!
+> [0.089144] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
Msg.info("Trace: Cpu destructed "+cpu.getName());
}
- public void cpuStateChangedCallback(Cpu cpu){
+ public void cpuStateChangedCallback(Cpu cpu, ResourceState old, ResourceState cur){
Msg.info("Trace: Cpu state changed "+cpu.getName());
}
- public void cpuActionStateChangedCallback(CpuAction action){
+ public void cpuActionStateChangedCallback(CpuAction action, ActionState old, ActionState cur){
Msg.info("Trace: CpuAction state changed "+action.getModel().getName());
}
Msg.info("Trace: NetworkLink destructed "+link.getName());
}
- public void networkLinkStateChangedCallback(NetworkLink link){
+ public void networkLinkStateChangedCallback(NetworkLink link, ResourceState old, ResourceState cur){
Msg.info("Trace: NetworkLink state changed "+link.getName());
}
- public void networkActionStateChangedCallback(NetworkAction action){
+ public void networkActionStateChangedCallback(NetworkAction action, ActionState old, ActionState cur){
Msg.info("Trace: NetworkAction state changed "+action.getModel().getName());
}
! expect signal SIGABRT
! timeout 20
-$ ${bindir:=.}/bugged1 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/bugged1 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/stack_size:256
> [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1'
> [ 0.000000] (0:@) Check a safety property
> [ 0.000000] (0:@) Get debug information ...
! expect signal SIGABRT
! timeout 20
-$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext
+$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack_size:256
> [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1'
> [ 0.000000] (0:@) Check the liveness property promela_bugged1_liveness
> [ 0.000000] (0:@) Get debug information ...
! expect signal SIGABRT
! timeout 90
-$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100
+$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --cfg=model-check:1 "--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
> [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1'
> [ 0.000000] (0:@) Configuration change: Set 'model-check/visited' to '100'
> [ 0.000000] (0:@) Check the liveness property promela_bugged1_liveness
! expect signal SIGABRT
! timeout 20
-$ ${bindir:=.}/bugged2 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/bugged2 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/stack_size:256
> [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1'
> [ 0.000000] (0:@) Check a safety property
> [ 0.000000] (0:@) Get debug information ...
add_executable(mc/bugged1_liveness mc/bugged1_liveness.c)
add_executable(mc/send_deterministic mc/send_deterministic.c)
add_executable(mc/non_deterministic mc/non_deterministic.c)
+ add_executable(mc/mutual_exclusion mc/mutual_exclusion.c)
target_link_libraries(mc/bugged1 simgrid)
target_link_libraries(mc/bugged2 simgrid)
target_link_libraries(mc/bugged1_liveness simgrid)
target_link_libraries(mc/send_deterministic simgrid)
target_link_libraries(mc/non_deterministic simgrid)
+ target_link_libraries(mc/mutual_exclusion simgrid)
endif()
target_link_libraries(bcbench simgrid)
${CMAKE_CURRENT_SOURCE_DIR}/mc/bugged1_liveness.c
${CMAKE_CURRENT_SOURCE_DIR}/mc/send_deterministic.c
${CMAKE_CURRENT_SOURCE_DIR}/mc/non_deterministic.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/mc/mutual_exclusion.c
PARENT_SCOPE
)
set(bin_files
${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_bugged2
${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_send_deterministic
${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_non_deterministic
+ ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_mutual_exclusion
PARENT_SCOPE
)
set(txt_files
--- /dev/null
+c-1.me
+c-2.me
+c-3.me
--- /dev/null
+#include <stdio.h>
+#include <mpi.h>
+#include <simgrid/modelchecker.h>
+
+#define GRANT_TAG 0
+#define REQUEST_TAG 1
+#define RELEASE_TAG 2
+
+int main(int argc, char **argv){
+
+ int err, size, rank;
+ int recv_buff;
+ MPI_Status status;
+ int CS_used = 0;
+ xbt_dynar_t requests = xbt_dynar_new(sizeof(int), NULL);
+
+ /* Initialize MPI */
+ err = MPI_Init(&argc, &argv);
+ if(err != MPI_SUCCESS){
+ printf("MPI initialization failed !\n");
+ exit(1);
+ }
+
+ MC_ignore(&(status.count), sizeof(status.count));
+
+ /* Get number of processes */
+ err = MPI_Comm_size(MPI_COMM_WORLD, &size);
+ /* Get id of this process */
+ err = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+ if(rank == 0){ /* Coordinator */
+ while(1){
+ MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+ if(status.MPI_TAG == REQUEST_TAG){
+ if(CS_used){
+ printf("CS already used. Queue the request.\n");
+ xbt_dynar_push(requests, &recv_buff);
+ }else{
+ printf("CS idle. Grant immediatly.\n");
+ MPI_Send(&rank, 1, MPI_INT, recv_buff, GRANT_TAG, MPI_COMM_WORLD);
+ CS_used = 1;
+ }
+ }else{
+ if(!xbt_dynar_is_empty(requests)){
+ printf("CS release. Grant to queued requests (queue size: %lu)",
+ xbt_dynar_length(requests));
+ xbt_dynar_shift(requests, &recv_buff);
+ MPI_Send(&rank, 1, MPI_INT, recv_buff, GRANT_TAG, MPI_COMM_WORLD);
+ CS_used = 1;
+ }else{
+ printf("CS release. Resource now idle.\n");
+ CS_used = 0;
+ }
+ }
+ }
+ }else{ /* Client */
+ while(1){
+ printf("%d asks the request.\n", rank);
+ MPI_Send(&rank, 1, MPI_INT, 0, REQUEST_TAG, MPI_COMM_WORLD);
+
+ MPI_Recv(&recv_buff, 1, MPI_INT, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+
+ printf("%d got the answer. Release it.\n", rank);
+ MPI_Send(&rank, 1, MPI_INT, 0, RELEASE_TAG, MPI_COMM_WORLD);
+
+ }
+ }
+
+ MPI_Finalize();
+
+ return 0;
+}
%typemap(out) NetworkLinkDynar {
long l = xbt_dynar_length($1);
$result = jenv->NewLongArray(l);
- NetworkLink **lout = (NetworkLink **)xbt_dynar_to_array($1);
- jenv->SetLongArrayRegion($result, 0, l, (const jlong*)lout);
- free(lout);
+ unsigned i;
+ NetworkLink *link;
+ jlong *elts = jenv->GetLongArrayElements($result, NULL);
+ xbt_dynar_foreach($1, i, link) {
+ elts[i] = (jlong)link;
+ }
+ jenv->ReleaseLongArrayElements($result, elts, 0);
+ xbt_dynar_free(&$1);
}
/* Allow to subclass Plugin and send java object to C++ code */
public:
NetworkLink();
~NetworkLink();
+ double getBandwidth();
+ void updateBandwidth(double value, double date=surf_get_clock());
+ double getLatency();
+ void updateLatency(double value, double date=surf_get_clock());
};
class Action {
public:
Model *getModel();
+ lmm_variable *getVariable();
+ double getBound();
+ void setBound(double bound);
};
class CpuAction : public Action {
}
};
+%nodefaultctor RoutingEdge;
+class RoutingEdge {
+public:
+ virtual char *getName()=0;
+};
+
%rename lmm_constraint LmmConstraint;
struct lmm_constraint {
%extend {
}
};
+%rename lmm_variable LmmVariable;
+struct lmm_variable {
+%extend {
+ double getValue() {return lmm_variable_getvalue($self);}
+}
+};
+
%rename s_xbt_dict XbtDict;
struct s_xbt_dict {
%extend {
char *getValue(char *key) {return (char*)xbt_dict_get_or_null($self, key);}
}
};
+
+%rename e_surf_action_state_t ActionState;
+typedef enum {
+ SURF_ACTION_READY = 0, /**< Ready */
+ SURF_ACTION_RUNNING, /**< Running */
+ SURF_ACTION_FAILED, /**< Task Failure */
+ SURF_ACTION_DONE, /**< Completed */
+ SURF_ACTION_TO_FREE, /**< Action to free in next cleanup */
+ SURF_ACTION_NOT_IN_THE_SYSTEM
+ /**< Not in the system anymore. Why did you ask ? */
+} e_surf_action_state_t;
+
+%rename e_surf_resource_state_t ResourceState;
+typedef enum {
+ SURF_RESOURCE_ON = 1, /**< Up & ready */
+ SURF_RESOURCE_OFF = 0 /**< Down & broken */
+} e_surf_resource_state_t;
xbt_die("TOTO");
if (dst==NULL)
xbt_die("TOTO");
- printf("src: %s\ndst: %s\n", src->getName(), dst->getName());
xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
routing_platf->getRouteAndLatency(src, dst, &route, NULL);
return route;
}
void Plugin::activateCpuStateChangedCallback(){
- surf_callback_connect(cpuStateChangedCallbacks, boost::bind(&Plugin::cpuStateChangedCallback, this, _1));
+ surf_callback_connect(cpuStateChangedCallbacks, boost::bind(&Plugin::cpuStateChangedCallback, this, _1, _2, _3));
}
void Plugin::activateCpuActionStateChangedCallback(){
- surf_callback_connect(cpuActionStateChangedCallbacks, boost::bind(&Plugin::cpuActionStateChangedCallback, this, _1));
+ surf_callback_connect(cpuActionStateChangedCallbacks, boost::bind(&Plugin::cpuActionStateChangedCallback, this, _1, _2, _3));
}
}
void Plugin::activateNetworkLinkStateChangedCallback(){
- surf_callback_connect(networkLinkStateChangedCallbacks, boost::bind(&Plugin::networkLinkStateChangedCallback, this, _1));
+ surf_callback_connect(networkLinkStateChangedCallbacks, boost::bind(&Plugin::networkLinkStateChangedCallback, this, _1, _2, _3));
}
void Plugin::activateNetworkActionStateChangedCallback(){
- surf_callback_connect(networkActionStateChangedCallbacks, boost::bind(&Plugin::networkActionStateChangedCallback, this, _1));
+ surf_callback_connect(networkActionStateChangedCallbacks, boost::bind(&Plugin::networkActionStateChangedCallback, this, _1, _2, _3));
}
+void Plugin::activateNetworkCommunicateCallback(){
+ surf_callback_connect(networkCommunicateCallbacks, boost::bind(&Plugin::networkCommunicateCallback, this, _1, _2, _3, _4, _5));
+}
+
+
virtual void cpuDestructedCallback(Cpu *cpu) {}
void activateCpuStateChangedCallback();
- virtual void cpuStateChangedCallback(Cpu *cpu) {}
+ virtual void cpuStateChangedCallback(Cpu *cpu, e_surf_resource_state_t, e_surf_resource_state_t) {}
void activateCpuActionStateChangedCallback();
- virtual void cpuActionStateChangedCallback(CpuAction *action) {}
+ virtual void cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t, e_surf_action_state_t) {}
void activateNetworkLinkCreatedCallback();
virtual void networkLinkDestructedCallback(NetworkLink *link) {}
void activateNetworkLinkStateChangedCallback();
- virtual void networkLinkStateChangedCallback(NetworkLink *link) {}
+ virtual void networkLinkStateChangedCallback(NetworkLink *link, e_surf_resource_state_t, e_surf_resource_state_t) {}
void activateNetworkActionStateChangedCallback();
- virtual void networkActionStateChangedCallback(NetworkAction *action) {}
+ virtual void networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) {}
+ void activateNetworkCommunicateCallback();
+ virtual void networkCommunicateCallback(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate) {}
};
-
-
unw_cursor_t c;
- int ret;
- for(ret = unw_init_local(&c, (unw_context_t *)stack_context); ret >= 0; ret = unw_step(&c)){
+ // TODO, check condition check (unw_init_local==0 means end of frame)
+ if(unw_init_local(&c, (unw_context_t *)stack_context)!=0) {
+
+ xbt_die("Could not initialize stack unwinding");
+
+ } else while(1) {
+
mc_stack_frame_t stack_frame = xbt_new(s_mc_stack_frame_t, 1);
xbt_dynar_push(result, &stack_frame);
stack_frame->frame_base = (unw_word_t)mc_find_frame_base(frame, frame->object_info, &c);
} else {
stack_frame->frame_base = 0;
+ stack_frame->frame_name = NULL;
}
/* Stop before context switch with maestro */
if(frame!=NULL && frame->name!=NULL && !strcmp(frame->name, "smx_ctx_sysv_wrapper"))
break;
+
+ int ret = ret = unw_step(&c);
+ if(ret==0) {
+ xbt_die("Unexpected end of stack.");
+ } else if(ret<0) {
+ xbt_die("Error while unwinding stack.");
+ }
}
if(xbt_dynar_length(result) == 0){
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdlib.h>
+#define DW_LANG_Objc DW_LANG_ObjC /* fix spelling error in older dwarf.h */
#include <dwarf.h>
#include <elfutils/libdw.h>
#include <inttypes.h>
if (!dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
if (type->type != DW_TAG_union_type) {
xbt_die(
- "Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%p>%s",
- member->name, type->id, type->name);
+ "Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%"PRIx64">%s",
+ member->name, (uint64_t) type->id, type->name);
} else {
return;
}
size_t len;
if (dwarf_getlocation(&attr, &expr, &len)) {
xbt_die(
- "Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%p>%s",
+ "Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%"PRIx64">%s",
MC_dwarf_attr_integrate_string(child, DW_AT_name),
- type->id, type->name);
+ (uint64_t) type->id, type->name);
}
if (len==1 && expr[0].atom == DW_OP_plus_uconst) {
member->offset = expr[0].number;
if (!dwarf_formudata(&attr, &offset))
member->offset = offset;
else
- xbt_die("Cannot get %s location <%p>%s",
+ xbt_die("Cannot get %s location <%"PRIx64">%s",
MC_dwarf_attr_integrate_string(child, DW_AT_name),
- type->id, type->name);
+ (uint64_t) type->id, type->name);
break;
}
case MC_DW_CLASS_LOCLISTPTR:
member->type = tag;
// Global Offset:
- member->id = (void *) dwarf_dieoffset(&child);
+ member->id = dwarf_dieoffset(&child);
const char* name = MC_dwarf_attr_integrate_string(&child, DW_AT_name);
if(name)
MC_dwarf_fill_member_location(type, member, &child);
if (!member->dw_type_id) {
- xbt_die("Missing type for member %s of <%p>%s", member->name, type->id, type->name);
+ xbt_die("Missing type for member %s of <%"PRIx64">%s", member->name, (uint64_t) type->id, type->name);
}
xbt_dynar_push(type->members, &member);
dw_type_t type = xbt_new0(s_dw_type_t, 1);
type->type = -1;
- type->id = NULL;
+ type->id = 0;
type->name = NULL;
type->byte_size = 0;
type->element_count = -1;
type->type = dwarf_tag(die);
// Global Offset
- type->id = (void *) dwarf_dieoffset(die);
+ type->id = dwarf_dieoffset(die);
const char* prefix = "";
switch (type->type) {
type->name = namespace ? bprintf("%s%s::%s", prefix, namespace, name) : bprintf("%s%s", prefix, name);
}
- XBT_DEBUG("Processing type <%p>%s", type->id, type->name);
-
type->dw_type_id = MC_dwarf_at_type(die);
// Computation of the byte_size;
size_t len;
if (dwarf_getlocation(&attr_location, &expr, &len)) {
xbt_die(
- "Could not read location expression in DW_AT_location of variable <%p>%s",
- (void*) variable->dwarf_offset, variable->name);
+ "Could not read location expression in DW_AT_location of variable <%"PRIx64">%s",
+ (uint64_t) variable->dwarf_offset, variable->name);
}
if (len==1 && expr[0].atom == DW_OP_addr) {
variable->global = 1;
- Dwarf_Off offset = expr[0].number;
- Dwarf_Off base = (Dwarf_Off) MC_object_base_address(info);
+ uintptr_t offset = (uintptr_t) expr[0].number;
+ uintptr_t base = (uintptr_t) MC_object_base_address(info);
variable->address = (void*) (base + offset);
} else {
mc_dwarf_location_list_init_from_expression(&variable->locations, len, expr);
mc_dwarf_location_list_init(&variable->locations, info, die, &attr_location);
break;
default:
- xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location in <%p>%s",
- form, form, klass, klass, (void*) variable->dwarf_offset, variable->name);
+ xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location in <%"PRIx64">%s",
+ form, form, klass, klass, (uint64_t) variable->dwarf_offset, variable->name);
}
// Handle start_scope:
variable->start_scope = dwarf_formudata(&attr, &value) == 0 ? (size_t) value : 0;
break;
}
+ case MC_DW_CLASS_RANGELISTPTR: // TODO
default:
xbt_die("Unhandled form 0x%x, class 0x%X for DW_AT_start_scope of variable %s",
form, klass, name==NULL ? "?" : name);
// Variables are filled in the (recursive) call of MC_dwarf_handle_children:
frame->variables = xbt_dynar_new(sizeof(dw_variable_t), dw_variable_free_voidp);
- frame->low_pc = ((char*) base) + MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
- // DW_AT_high_pc:
- {
+ // TODO, support DW_AT_ranges
+ uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
+ frame->low_pc = low_pc ? ((char*) base) + low_pc : 0;
+ if(low_pc) {
+ // DW_AT_high_pc:
Dwarf_Attribute attr;
- if(dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
- uint64_t high_pc;
- Dwarf_Addr value;
- if (dwarf_formaddr(&attr, &value) == 0)
- high_pc = (uint64_t) value;
- else
- high_pc = 0;
-
- int form = dwarf_whatform(&attr);
- int klass = MC_dwarf_form_get_class(form);
- if (klass == MC_DW_CLASS_CONSTANT)
- frame->high_pc = (void*) ((Dwarf_Off)frame->low_pc + high_pc);
- else if(klass == MC_DW_CLASS_ADDRESS)
- frame->high_pc = ((char*) base) + high_pc;
- else
- xbt_die("Unexpected class for DW_AT_high_pc");
- } else {
- frame->high_pc = 0;
+ if(!dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
+ xbt_die("Missing DW_AT_high_pc matching with DW_AT_low_pc");
+ }
+
+ Dwarf_Sword offset;
+ Dwarf_Addr high_pc;
+
+ switch(MC_dwarf_form_get_class(dwarf_whatform(&attr))) {
+
+ // DW_AT_high_pc if an offset from the low_pc:
+ case MC_DW_CLASS_CONSTANT:
+
+ if (dwarf_formsdata(&attr, &offset) !=0)
+ xbt_die("Could not read constant");
+ frame->high_pc = (void*) ((char*)frame->low_pc + offset);
+ break;
+
+ // DW_AT_high_pc is a relocatable address:
+ case MC_DW_CLASS_ADDRESS:
+ if (dwarf_formaddr(&attr, &high_pc) != 0)
+ xbt_die("Could not read address");
+ frame->high_pc = ((char*) base) + high_pc;
+ break;
+
+ default:
+ xbt_die("Unexpected class for DW_AT_high_pc");
+
}
}
return MC_EXPRESSION_E_NO_BASE_ADDRESS;
if(state->stack_size==MC_EXPRESSION_STACK_SIZE)
return MC_EXPRESSION_E_STACK_OVERFLOW;
- error = mc_dwarf_push_value(state, (Dwarf_Off)MC_object_base_address(state->object_info) + op->number);
+ error = mc_dwarf_push_value(state,
+ (Dwarf_Off)(uintptr_t)MC_object_base_address(state->object_info) + op->number);
break;
case DW_OP_const1u:
/** \brief Resolve a location expression
* \deprecated Use mc_dwarf_resolve_expression
*/
-Dwarf_Off mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
+uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
s_mc_expression_state_t state;
memset(&state, 0, sizeof(s_mc_expression_state_t));
state.frame_base = frame_pointer_address;
if(state.stack_size==0)
xbt_die("No value on the stack");
else
- return (Dwarf_Off) state.stack[state.stack_size-1];
+ return state.stack[state.stack_size-1];
}
-Dwarf_Off mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
+uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
unw_word_t ip;
if(c) {
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
+#include <sys/mman.h>
#include <libgen.h>
#include "simgrid/sg_config.h"
mc_libsimgrid_info = MC_find_object_info(maps, libsimgrid_path, 0);
mc_object_infos[1] = mc_libsimgrid_info;
+#ifdef MADV_MERGEABLE
+ for(int i=0; i!=mc_object_infos_size; ++i) {
+ void* start = mc_object_infos[i]->start_rw;
+ void* end = mc_object_infos[i]->end_rw;
+ madvise(start, (char*)end - (char*)start, MADV_MERGEABLE);
+ }
+#endif
+
// Use information of the other objects:
MC_post_process_object_info(mc_binary_info);
MC_post_process_object_info(mc_libsimgrid_info);
mc_expression_t locations;
} s_mc_location_list_t, *mc_location_list_t;
-Dwarf_Off mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
-Dwarf_Off mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
+uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
+uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
void mc_dwarf_expression_clear(mc_expression_t expression);
void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops);
struct s_dw_type{
e_dw_type_type type;
- void *id; /* Offset in the section (in hexadecimal form) */
+ Dwarf_Off id; /* Offset in the section (in hexadecimal form) */
char *name; /* Name of the type */
int byte_size; /* Size in bytes */
int element_count; /* Number of elements for array type */
/**
* \ingroup msg_file_management
* \brief Copy a file to another location on a remote host.
- * \param fd : the file to move
+ * \param file : the file to move
* \param host : the remote host where the file has to be copied
* \param fullpath : the complete path destination on the remote host
* \return If successful, the function returns MSG_OK. Otherwise, it returns
/**
* \ingroup msg_file_management
* \brief Move a file to another location on a remote host.
- * \param fd : the file to move
+ * \param file : the file to move
* \param host : the remote host where the file has to be moved
* \param fullpath : the complete path destination on the remote host
* \return If successful, the function returns MSG_OK. Otherwise, it returns
{
if (siginfo->si_signo == SIGSEGV && siginfo->si_code == SEGV_ACCERR) {
fprintf(stderr,
- "Access violation detected. This can result from a stack overflow.\n"
+ "Access violation detected.\n"
+ "This can result from a programming error in your code or, although less likely,\n"
+ "from a bug in SimGrid itself. This can also be the sign of a bug in the OS or\n"
+ "in third-party libraries. Failing hardware can sometimes generate such errors\n"
+ "too.\n"
+ "Finally, if nothing of the above applies, this can result from a stack overflow.\n"
"Try to increase stack size with --cfg=contexts/stack_size (current size is %d KiB).\n",
smx_context_stack_size / 1024);
if (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_debug)) {
action->io.surf_io = surf_workstation_write(host, fd->surf_file, size);
surf_action_set_data(action->io.surf_io, action);
- XBT_DEBUG("Create io action %p", action);
+ XBT_INFO("Create io action %p", action);
return action;
}
oldbuf = request->buf;
if (!_xbt_replay_is_active() && oldbuf && request->size!=0){
if((smpi_privatize_global_variables)
- && ((char*)request->buf >= start_data_exe)
- && ((char*)request->buf < start_data_exe + size_data_exe )
- ){
- XBT_WARN("Privatization : We are sending from a zone inside global memory. Switch data segment ");
- switch_data_segment(smpi_process_index());
- }
-
-
+ && ((char*)request->buf >= start_data_exe)
+ && ((char*)request->buf < start_data_exe + size_data_exe )){
+ XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment ");
+ switch_data_segment(smpi_process_index());
+ }
buf = xbt_malloc(request->size);
memcpy(buf,oldbuf,request->size);
}
if (loaded_page==dest)//no need to switch either
return;
+
+
#ifdef HAVE_MMAP
+ int i;
+ if(loaded_page==-1){//initial switch, do the copy from the real page here
+ for (i=0; i< SIMIX_process_count(); i++){
+ memcpy(mappings[i],TOPAGE(start_data_exe),size_data_exe);
+ }
+ }
int current= fds[dest];
XBT_VERB("Switching data frame to the one of process %d", dest);
void* tmp = mmap (TOPAGE(start_data_exe), size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0);
- msync(TOPAGE(start_data_exe), size_data_exe, MS_SYNC | MS_INVALIDATE );
if (tmp != TOPAGE(start_data_exe))
xbt_die("Couldn't map the new region");
loaded_page=dest;
#ifdef SMPI_F2C
smpi_current_rank = index;
#endif
+
data = smpi_process_remote_data(index);
simcall_process_set_data(proc, data);
if (*argc > 2) {
// set the process attached to the mailbox
simcall_rdv_set_receiver(data->mailbox_small, proc);
XBT_DEBUG("<%d> New process in the game: %p", index, proc);
+
+ if(smpi_privatize_global_variables){
+ switch_data_segment(index);
+ }
+
}
if (smpi_process_data() == NULL)
xbt_die("smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by MPI-2, this is currently not supported by SMPI.");
void smpi_process_destroy(void)
{
int index = smpi_process_index();
+ if(smpi_privatize_global_variables){
+ switch_data_segment(index);
+ }
process_data[index]->state = SMPI_FINALIZED;
XBT_DEBUG("<%d> Process left the game", index);
}
&& ((char*)buff >= start_data_exe)
&& ((char*)buff < start_data_exe + size_data_exe )
){
- XBT_WARN("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
+ XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.src_proc))->index);
tmpbuff = (void*)xbt_malloc(buff_size);
memcpy(tmpbuff, buff, buff_size);
&& ((char*)comm->comm.dst_buff >= start_data_exe)
&& ((char*)comm->comm.dst_buff < start_data_exe + size_data_exe )
){
- XBT_WARN("Privatization : We are copying to a zone inside global memory - Switch data segment");
+ XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.dst_proc))->index);
}
{
int retval = 0;
- smpi_bench_end();
if (provided == NULL) {
retval = MPI_ERR_ARG;
} else {
*provided = MPI_THREAD_MULTIPLE;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (flag == NULL) {
retval = MPI_ERR_ARG;
} else {
*flag = smpi_process_index() == 0;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (!address) {
retval = MPI_ERR_ARG;
} else {
*address = (MPI_Aint) location;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (!datatype) {
retval = MPI_ERR_ARG;
} else {
smpi_datatype_free(datatype);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (size == NULL) {
*size = (int) smpi_datatype_size(datatype);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (lb == NULL || extent == NULL) {
} else {
retval = smpi_datatype_extent(datatype, lb, extent);
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (extent == NULL) {
*extent = smpi_datatype_get_extent(datatype);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (disp == NULL) {
*disp = smpi_datatype_lb(datatype);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (disp == NULL) {
*disp = smpi_datatype_ub(datatype);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (function == NULL || op == NULL) {
retval = MPI_ERR_ARG;
} else {
*op = smpi_op_new(function, commute);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (op == NULL) {
retval = MPI_ERR_ARG;
} else if (*op == MPI_OP_NULL) {
*op = MPI_OP_NULL;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (group == NULL) {
retval = MPI_ERR_ARG;
} else {
*group = MPI_GROUP_NULL;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (size == NULL) {
*size = smpi_group_size(group);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (rank == NULL) {
*rank = smpi_group_rank(group, smpi_process_index());
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
MPI_Group group2, int *ranks2)
{
int retval, i, index;
- smpi_bench_end();
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (result == NULL) {
*result = smpi_group_compare(group1, group2);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, proc1, proc2, size, size2;
- smpi_bench_end();
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, proc1, proc2, size;
- smpi_bench_end();
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, proc1, proc2, size, size2;
- smpi_bench_end();
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, index;
- smpi_bench_end();
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, j, newsize, oldsize, index;
- smpi_bench_end();
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, j, rank, size, index;
- smpi_bench_end();
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval, i, rank, newrank,oldrank, size, index, add;
- smpi_bench_end();
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
} else if (newgroup == NULL) {
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
int PMPI_Comm_rank(MPI_Comm comm, int *rank)
{
int retval = 0;
-
- smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (rank == NULL) {
*rank = smpi_comm_rank(comm);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
int PMPI_Comm_size(MPI_Comm comm, int *size)
{
int retval = 0;
-
- smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (size == NULL) {
*size = smpi_comm_size(comm);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (name == NULL || len == NULL) {
smpi_comm_get_name(comm, name, len);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (group == NULL) {
smpi_group_use(*group);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (result == NULL) {
}
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (newcomm == NULL) {
*newcomm = smpi_comm_new(smpi_comm_group(comm));
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (group == MPI_GROUP_NULL) {
*newcomm = smpi_comm_new(group);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
{
int retval = 0;
- smpi_bench_end();
if (comm == NULL) {
retval = MPI_ERR_ARG;
} else if (*comm == MPI_COMM_NULL) {
*comm = MPI_COMM_NULL;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
/* TODO: wait until all communication in comm are done */
int retval = 0;
- smpi_bench_end();
if (comm == NULL) {
retval = MPI_ERR_ARG;
} else if (*comm == MPI_COMM_NULL) {
*comm = MPI_COMM_NULL;
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
{
int retval = 0;
-
smpi_bench_end();
+
if (comm_out == NULL) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_SUCCESS;
}
smpi_bench_begin();
+
return retval;
}
{
int retval = MPI_SUCCESS;
- smpi_bench_end();
strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
strlen(SIMIX_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
strlen(SIMIX_host_get_name(SIMIX_host_self())) +1 :
strlen(name) >
MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
- smpi_bench_begin();
return retval;
}
int retval = MPI_SUCCESS;
size_t size;
- smpi_bench_end();
if (status == NULL || count == NULL) {
retval = MPI_ERR_ARG;
} else if (datatype == MPI_DATATYPE_NULL) {
*count = smpi_mpi_get_count(status, datatype);
}
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0){
} else {
retval = smpi_datatype_contiguous(count, old_type, new_type, 0);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_commit(MPI_Datatype* datatype) {
int retval = 0;
- smpi_bench_end();
if (datatype == NULL || *datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else {
smpi_datatype_commit(datatype);
retval = MPI_SUCCESS;
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0 || blocklen<0){
} else {
retval = smpi_datatype_vector(count, blocklen, stride, old_type, new_type);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0 || blocklen<0){
} else {
retval = smpi_datatype_hvector(count, blocklen, stride, old_type, new_type);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0){
} else {
retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0){
} else {
retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval,i;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0){
retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
xbt_free(blocklens);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0){
} else {
retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval,i;
- smpi_bench_end();
if (old_type == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else if (count<0){
retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
xbt_free(blocklens);
}
- smpi_bench_begin();
return retval;
}
int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
int retval = 0;
- smpi_bench_end();
if (count<0){
retval = MPI_ERR_COUNT;
} else {
retval = smpi_datatype_struct(count, blocklens, indices, old_types, new_type);
}
- smpi_bench_begin();
return retval;
}
surf_callback(void, CpuPtr) cpuCreatedCallbacks;
surf_callback(void, CpuPtr) cpuDestructedCallbacks;
-surf_callback(void, CpuPtr) cpuStateChangedCallbacks;
-surf_callback(void, CpuActionPtr) cpuActionStateChangedCallbacks;
+surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
+surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
/*********
* Model *
void Cpu::setState(e_surf_resource_state_t state)
{
+ e_surf_resource_state_t old = Resource::getState();
Resource::setState(state);
- surf_callback_emit(cpuStateChangedCallbacks, this);
+ surf_callback_emit(cpuStateChangedCallbacks, this, old, state);
}
/**********
* Action *
}
void CpuAction::setState(e_surf_action_state_t state){
+ e_surf_action_state_t old = getState();
Action::setState(state);
- surf_callback_emit(cpuActionStateChangedCallbacks, this);
+ surf_callback_emit(cpuActionStateChangedCallbacks, this, old, state);
}
CpuPtr getActionCpu(CpuActionPtr action);
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu creation *
+ * @brief Callbacks handler which emit the callbacks after Cpu creation *
* @details Callback functions have the following signature: `void(CpuPtr)`
*/
extern surf_callback(void, CpuPtr) cpuCreatedCallbacks;
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu destruction *
+ * @brief Callbacks handler which emit the callbacks after Cpu destruction *
* @details Callback functions have the following signature: `void(CpuPtr)`
*/
extern surf_callback(void, CpuPtr) cpuDestructedCallbacks;
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu State changed *
- * @details Callback functions have the following signature: `void(CpuActionPtr)`
+ * @brief Callbacks handler which emit the callbacks after Cpu State changed *
+ * @details Callback functions have the following signature: `void(CpuActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, CpuPtr) cpuStateChangedCallbacks;
+extern surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after CpuAction State changed *
- * @details Callback functions have the following signature: `void(CpuActionPtr)`
+ * @brief Callbacks handler which emit the callbacks after CpuAction State changed *
+ * @details Callback functions have the following signature: `void(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
*/
-extern surf_callback(void, CpuActionPtr) cpuActionStateChangedCallbacks;
+extern surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
/*********
* Model *
public:
/**
* @brief CpuModel constructor
- *
+ *
* @param name The name of the model
*/
CpuModel(const char *name) : Model(name) {};
/**
* @brief Create a Cpu
- *
+ *
* @param name The name of the Cpu
- *
+ *
* @return The created Cpu
*/
CpuPtr createResource(string name);
/**
* @brief Cpu constructor
- *
+ *
* @param model The CpuModel associated to this Cpu
* @param name The name of the Cpu
* @param props Dictionary of properties associated to this Cpu
/**
* @brief Cpu constructor
- *
+ *
* @param model The CpuModel associated to this Cpu
* @param name The name of the Cpu
* @param props Dictionary of properties associated to this Cpu
/**
* @brief Execute some quantity of computation
- *
+ *
* @param size The value of the processing amount (in flop) needed to process
* @return The CpuAction corresponding to the processing
*/
/**
* @brief Make a process sleep for duration (in seconds)
- *
+ *
* @param duration The number of seconds to sleep
* @return The CpuAction corresponding to the sleeping
*/
/**
* @brief Get the number of cores of the current Cpu
- *
+ *
* @return The number of cores of the current Cpu
*/
virtual int getCore();
/**
* @brief Get the speed of the current Cpu
* @details [TODO] load * m_powerPeak
- *
+ *
* @param load [TODO]
- *
+ *
* @return The speed of the current Cpu
*/
virtual double getSpeed(double load);
/**
* @brief Get the available speed of the current Cpu
* @details [TODO]
- *
+ *
* @return The available speed of the current Cpu
*/
virtual double getAvailableSpeed();
/**
* @brief Get the current Cpu power peak
- *
+ *
* @return The current Cpu power peak
*/
virtual double getCurrentPowerPeak()=0;
virtual double getPowerPeakAt(int pstate_index)=0;
-
+
virtual int getNbPstates()=0;
-
+
virtual void setPowerPeakAt(int pstate_index)=0;
void setState(e_surf_resource_state_t state);
/**
* @brief CpuAction constructor
- *
+ *
* @param model The CpuModel associated to this CpuAction
* @param cost [TODO]
* @param failed [TODO]
/**
* @brief CpuAction constructor
- *
+ *
* @param model The CpuModel associated to this CpuAction
* @param cost [TODO]
* @param failed [TODO]
/**
* @brief Set the affinity of the current CpuAction
* @details [TODO]
- *
+ *
* @param cpu [TODO]
* @param mask [TODO]
*/
xbt_dynar_free(&route);
XBT_OUT();
+ surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
return action;
}
/* value, event_type); */
if (event_type == p_power.event) {
- double delta =
- sg_weight_S_parameter / value - sg_weight_S_parameter /
- (p_power.peak * p_power.scale);
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
- NetworkCm02ActionPtr action = NULL;
-
- p_power.peak = value;
- lmm_update_constraint_bound(getModel()->getMaxminSystem(),
- getConstraint(),
- sg_bandwidth_factor *
- (p_power.peak * p_power.scale));
-#ifdef HAVE_TRACING
- TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
-#endif
- if (sg_weight_S_parameter > 0) {
- while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
- action = (NetworkCm02ActionPtr) lmm_variable_id(var);
- action->m_weight += delta;
- if (!action->isSuspended())
- lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
- }
- }
+ updateBandwidth(value, date);
if (tmgr_trace_event_free(event_type))
p_power.event = NULL;
} else if (event_type == p_latEvent) {
- double delta = value - m_latCurrent;
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
- NetworkCm02ActionPtr action = NULL;
-
- m_latCurrent = value;
- while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
- action = (NetworkCm02ActionPtr) lmm_variable_id(var);
- action->m_latCurrent += delta;
- action->m_weight += delta;
- if (action->m_rate < 0)
- lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
- else {
- lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
- min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
-
- if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
- XBT_INFO("Flow is limited BYBANDWIDTH");
- } else {
- XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f",
- action->m_latCurrent);
- }
- }
- if (!action->isSuspended())
- lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
-
- }
+ updateLatency(value, date);
if (tmgr_trace_event_free(event_type))
p_latEvent = NULL;
} else if (event_type == p_stateEvent) {
return;
}
+void NetworkCm02Link::updateBandwidth(double value, double date){
+ double delta = sg_weight_S_parameter / value - sg_weight_S_parameter /
+ (p_power.peak * p_power.scale);
+ lmm_variable_t var = NULL;
+ lmm_element_t elem = NULL;
+ NetworkCm02ActionPtr action = NULL;
+
+ p_power.peak = value;
+ lmm_update_constraint_bound(getModel()->getMaxminSystem(),
+ getConstraint(),
+ sg_bandwidth_factor *
+ (p_power.peak * p_power.scale));
+#ifdef HAVE_TRACING
+ TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
+#endif
+ if (sg_weight_S_parameter > 0) {
+ while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+ action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+ action->m_weight += delta;
+ if (!action->isSuspended())
+ lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
+ }
+ }
+}
+
+void NetworkCm02Link::updateLatency(double value, double date){
+ double delta = value - m_latCurrent;
+ lmm_variable_t var = NULL;
+ lmm_element_t elem = NULL;
+ NetworkCm02ActionPtr action = NULL;
+
+ m_latCurrent = value;
+ while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+ action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+ action->m_latCurrent += delta;
+ action->m_weight += delta;
+ if (action->m_rate < 0)
+ lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
+ else {
+ lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
+ min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
+
+ if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
+ XBT_INFO("Flow is limited BYBANDWIDTH");
+ } else {
+ XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f",
+ action->m_latCurrent);
+ }
+ }
+ if (!action->isSuspended())
+ lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
+ }
+}
+
/**********
* Action *
**********/
tmgr_trace_t lat_trace,
e_surf_link_sharing_policy_t policy);
void updateState(tmgr_trace_event_t event_type, double value, double date);
+ void updateBandwidth(double value, double date=surf_get_clock());
+ void updateLatency(double value, double date=surf_get_clock());
};
NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor);
XBT_OUT();
+ surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
return action;
}
surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
-surf_callback(void, NetworkLinkPtr) networkLinkStateChangedCallbacks;
-surf_callback(void, NetworkActionPtr) networkActionStateChangedCallbacks;
+surf_callback(void, NetworkLinkPtr, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
+surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
+surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) networkCommunicateCallbacks;
/*********
* Model *
}
void NetworkLink::setState(e_surf_resource_state_t state){
+ e_surf_resource_state_t old = Resource::getState();
Resource::setState(state);
- surf_callback_emit(networkLinkStateChangedCallbacks, this);
+ surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state);
}
/**********
**********/
void NetworkAction::setState(e_surf_action_state_t state){
+ e_surf_action_state_t old = getState();
Action::setState(state);
- surf_callback_emit(networkActionStateChangedCallbacks, this);
+ surf_callback_emit(networkActionStateChangedCallbacks, this, old, state);
}
#endif /* NETWORK_INTERFACE_CPP_ */
*************/
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkLink creation *
+ * @brief Callbacks handler which emit the callbacks after NetworkLink creation
* @details Callback functions have the following signature: `void(NetworkLinkPtr)`
*/
extern surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkLink destruction *
+ * @brief Callbacks handler which emit the callbacks after NetworkLink destruction
* @details Callback functions have the following signature: `void(NetworkLinkPtr)`
*/
extern surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkLink State changed *
- * @details Callback functions have the following signature: `void(NetworkLinkActionPtr)`
+ * @brief Callbacks handler which emit the callbacks after NetworkLink State changed
+ * @details Callback functions have the following signature: `void(NetworkLinkActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, NetworkLinkPtr) networkLinkStateChangedCallbacks;
+extern surf_callback(void, NetworkLinkPtr, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkAction State changed *
- * @details Callback functions have the following signature: `void(NetworkActionPtr)`
+ * @brief Callbacks handler which emit the callbacks after NetworkAction State changed
+ * @details Callback functions have the following signature: `void(NetworkActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
*/
-extern surf_callback(void, NetworkActionPtr) networkActionStateChangedCallbacks;
+extern surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after communication created
+ * @details Callback functions have the following signature: `void(NetworkActionPtr action, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate)`
+ */
+extern surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) networkCommunicateCallbacks;
/*********
* Tools *
/**
* @brief NetworkModel constructor
- *
+ *
* @param name The name of the NetworkModel
*/
NetworkModel(const char *name) : Model(name) {
/**
* @brief Create a NetworkLink
- *
+ *
* @param name The name of the NetworkLink
* @param bw_initial The initial bandwidth of the NetworkLink in bytes per second
* @param bw_trace The trace associated to the NetworkLink bandwidth [TODO]
/**
* @brief Create a communication between two [TODO]
* @details [TODO]
- *
+ *
* @param src The source [TODO]
* @param dst The destination [TODO]
* @param size The size of the communication in bytes
- * @param rate The
+ * @param rate The
* @return The action representing the communication
*/
virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
/**
* @brief Function pointer to the function to use to solve the lmm_system_t
- *
+ *
* @param system The lmm_system_t to solve
*/
void (*f_networkSolve)(lmm_system_t);
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param size [description]
* @return [description]
*/
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param size [description]
* @return [description]
*/
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param rate [description]
* @param bound [description]
* @param size [description]
public:
/**
* @brief NetworkLink constructor
- *
+ *
* @param model The CpuModel associated to this NetworkLink
* @param name The name of the NetworkLink
* @param props Dictionary of properties associated to this NetworkLink
/**
* @brief NetworkLink constructor
- *
+ *
* @param model The CpuModel associated to this NetworkLink
* @param name The name of the NetworkLink
* @param props Dictionary of properties associated to this NetworkLink
/**
* @brief Get the bandwidth in bytes per second of current NetworkLink
- *
+ *
* @return The bandwith in bytes per second of the current NetworkLink
*/
virtual double getBandwidth();
+ /**
+ * @brief Update the bandwidth in bytes per second of current NetworkLink
+ */
+ virtual void updateBandwidth(double value, double date=surf_get_clock())=0;
+
/**
* @brief Get the latency in seconds of current NetworkLink
- *
+ *
* @return The latency in seconds of the current NetworkLink
*/
virtual double getLatency();
+ /**
+ * @brief Update the latency in seconds of current NetworkLink
+ */
+ virtual void updateLatency(double value, double date=surf_get_clock())=0;
+
/**
* @brief Check if the NetworkLink is shared
* @details [long description]
- *
+ *
* @return true if the current NetwokrLink is shared, false otherwise
*/
virtual bool isShared();
/**
* @brief Check if the NetworkLink is used
- *
+ *
* @return true if the current NetwokrLink is used, false otherwise
*/
bool isUsed();
public:
/**
* @brief NetworkAction constructor
- *
+ *
* @param model The NetworkModel associated to this NetworkAction
* @param cost The cost of this NetworkAction in [TODO]
* @param failed [description]
/**
* @brief NetworkAction constructor
- *
+ *
* @param model The NetworkModel associated to this NetworkAction
* @param cost The cost of this NetworkAction in [TODO]
* @param failed [description]
action->p_srcElm = src;
action->p_dstElm = dst;
#endif
+ surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
return (surf_action_t) action;
}
NetworkNS3Link::NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
double bw_initial, double lat_initial)
: NetworkLink(model, name, props)
- , p_bdw(bprintf("%f", bw_initial))
, p_lat(bprintf("%f", lat_initial))
+ , p_bdw(bprintf("%f", bw_initial))
, m_created(1)
{
}
void NetworkNS3Link::updateState(tmgr_trace_event_t event_type, double value, double date)
{
-}
-double NetworkNS3Link::getLatency()
-{
-
-}
-double NetworkNS3Link::getBandwidth()
-{
-
}
/**********
~NetworkNS3Link();
void updateState(tmgr_trace_event_t event_type, double value, double date);
- double getLatency();
- double getBandwidth();
+ double getLatency(){THROW_UNIMPLEMENTED;}
+ double getBandwidth(){THROW_UNIMPLEMENTED;}
+ void updateBandwidth(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
+ void updateLatency(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
//private:
char *p_id;
}
XBT_ERROR("The ns3/TcpModel must be : NewReno or Reno or Tahoe");
+ return 0;
}
void * ns3_add_host(const char * id)
return router;
}
-void * ns3_add_cluster(char * bw,char * lat,const char *id)
+void ns3_add_cluster(char * bw,char * lat,const char *id)
{
XBT_DEBUG("cluster_id: %s",id);
XBT_DEBUG("Number of %s nodes: %d",id,Cluster_nodes.GetN() - number_of_clusters_nodes);
NodeContainer Nodes;
- int i;
+ unsigned int i;
for(i = number_of_clusters_nodes; i < Cluster_nodes.GetN() ; i++){
Nodes.Add(Cluster_nodes.Get(i));
return bprintf("%s",s.c_str());
}
-void * ns3_add_link(int src, e_ns3_network_element_type_t type_src,
+void ns3_add_link(int src, e_ns3_network_element_type_t type_src,
int dst, e_ns3_network_element_type_t type_dst,
char * bw,char * lat)
{
}
}
-void * ns3_end_platform(void)
+void ns3_end_platform(void)
{
XBT_DEBUG("InitializeRoutes");
GlobalRouteManager::BuildGlobalRoutingDatabase();
XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
XBT_PUBLIC(void *) ns3_add_router(const char * id);
XBT_PUBLIC(void *) ns3_add_AS(const char * id);
-XBT_PUBLIC(void *) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
+XBT_PUBLIC(void) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
int dst, e_ns3_network_element_type_t type_dst,
char * bw,char * lat);
-XBT_PUBLIC(void *) ns3_end_platform(void);
-XBT_PUBLIC(void *) ns3_add_cluster(char * bw,char * lat,const char *id);
+XBT_PUBLIC(void) ns3_end_platform(void);
+XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
SG_END_DECL()
#include "../cpu_cas01.hpp"
/** @addtogroup SURF_plugin_energy
- *
- *
+ *
+ *
* BlaBla energy
*/
surf_energy->erase(cpuIt);
}
-static void energyCpuActionStateChangedCallback(CpuActionPtr action){
+static void energyCpuActionStateChangedCallback(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t cur){
CpuPtr cpu = getActionCpu(action);
CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
surf_callback(void, StoragePtr) storageCreatedCallbacks;
surf_callback(void, StoragePtr) storageDestructedCallbacks;
-surf_callback(void, StoragePtr) storageStateChangedCallbacks;
-surf_callback(void, StorageActionPtr) storageActionStateChangedCallbacks;
+surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
+surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
/*********
* Model *
void Storage::setState(e_surf_resource_state_t state)
{
+ e_surf_resource_state_t old = Resource::getState();
Resource::setState(state);
- surf_callback_emit(storageStateChangedCallbacks, this);
+ surf_callback_emit(storageStateChangedCallbacks, this, old, state);
}
xbt_dict_t Storage::getContent()
}
void StorageAction::setState(e_surf_action_state_t state){
+ e_surf_action_state_t old = getState();
Action::setState(state);
- surf_callback_emit(storageActionStateChangedCallbacks, this);
+ surf_callback_emit(storageActionStateChangedCallbacks, this, old, state);
}
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage State changed *
- * @details Callback functions have the following signature: `void(StorageActionPtr)`
+ * @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, StoragePtr) storageStateChangedCallbacks;
+extern surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after StorageAction State changed *
- * @details Callback functions have the following signature: `void(StorageActionPtr)`
+ * @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
*/
-extern surf_callback(void, StorageActionPtr) storageActionStateChangedCallbacks;
+extern surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
/*********
* Model *
/**
* @brief Create a Storage
- *
+ *
* @param id [description]
* @param type_id [description]
* @param content_name [description]
public:
/**
* @brief Storage constructor
- *
+ *
* @param model StorageModel associated to this Storage
* @param name The name of the Storage
* @param props Dictionary of properties associated to this Storage
/**
* @brief Storage constructor
- *
+ *
* @param model StorageModel associated to this Storage
* @param name The name of the Storage
* @param props Dictionary of properties associated to this Storage
/**
* @brief Check if the Storage is used
- *
+ *
* @return true if the current Storage is used, false otherwise
*/
bool isUsed();
/**
* @brief Update the state of the current Storage
- *
+ *
* @param event_type [description]
* @param value [description]
* @param date [description]
/**
* @brief Open a file
- *
+ *
* @param mount The mount point
* @param path The path to the file
- *
+ *
* @return The StorageAction corresponding to the opening
*/
virtual StorageActionPtr open(const char* mount, const char* path)=0;
/**
* @brief Close a file
- *
+ *
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
/**
* @brief List directory contents of a path
* @details [long description]
- *
+ *
* @param path The path to the directory
* @return The StorageAction corresponding to the ls action
*/
/**
* @brief Read a file
- *
+ *
* @param fd The file descriptor to read
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
/**
* @brief Write a file
- *
+ *
* @param fd The file descriptor to write
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
/**
* @brief Get the content of the current Storage
- *
+ *
* @return A xbt_dict_t with path as keys and size in bytes as values
*/
virtual xbt_dict_t getContent();
/**
* @brief Get the size in bytes of the current Storage
- *
+ *
* @return The size in bytes of the current Storage
*/
virtual sg_size_t getSize();
/**
* @brief StorageAction constructor
- *
+ *
* @param model The StorageModel associated to this StorageAction
* @param cost The cost of this NetworkAction in [TODO]
* @param failed [description]
/**
* @brief StorageAction constructor
- *
+ *
* @param model The StorageModel associated to this StorageAction
* @param cost The cost of this StorageAction in [TODO]
* @param failed [description]
"Y:\\",
"Z:\\"
};
-#endif
+#endif
/*
* Returns the initial path. On Windows the initial path is
if (p_variable)
lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound);
- if (getModel()->getUpdateMechanism() == UM_LAZY)
- heapRemove(getModel()->getActionHeap());
+ if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate()!=surf_get_clock())
+ heapRemove(getModel()->getActionHeap());
XBT_OUT();
}
surf_callback(void, WorkstationPtr) workstationCreatedCallbacks;
surf_callback(void, WorkstationPtr) workstationDestructedCallbacks;
-surf_callback(void, WorkstationPtr) workstationStateChangedCallbacks;
-surf_callback(void, WorkstationActionPtr) workstationActionStateChangedCallbacks;
+surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t) workstationStateChangedCallbacks;
+surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t) workstationActionStateChangedCallbacks;
/*********
* Model *
}
void Workstation::setState(e_surf_resource_state_t state){
+ e_surf_resource_state_t old = Resource::getState();
Resource::setState(state);
- surf_callback_emit(workstationStateChangedCallbacks, this);
+ surf_callback_emit(workstationStateChangedCallbacks, this, old, state);
}
int Workstation::getCore(){
**********/
void WorkstationAction::setState(e_surf_action_state_t state){
+ e_surf_action_state_t old = getState();
Action::setState(state);
- surf_callback_emit(workstationActionStateChangedCallbacks, this);
+ surf_callback_emit(workstationActionStateChangedCallbacks, this, old, state);
}
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Workstation State changed *
- * @details Callback functions have the following signature: `void(WorkstationActionPtr)`
+ * @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, WorkstationPtr) workstationStateChangedCallbacks;
+extern surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t) workstationStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after WorkstationAction State changed *
- * @details Callback functions have the following signature: `void(WorkstationActionPtr)`
+ * @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, WorkstationActionPtr) workstationActionStateChangedCallbacks;
+extern surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t) workstationActionStateChangedCallbacks;
/*********
* Tools *
*/
class WorkstationModel : public Model {
public:
- /**
+ /**
* @brief WorkstationModel constructor
- *
+ *
* @param name the name of the model
*/
WorkstationModel(const char *name);
* @details [long description]
*/
virtual void adjustWeightOfDummyCpuActions();
-
+
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param workstation_nb [description]
* @param workstation_list [description]
* @param computation_amount [description]
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param src [description]
* @param dst [description]
* @param size [description]
/**
* @brief Workstation constructor
- *
+ *
* @param model WorkstationModel associated to this Workstation
* @param name The name of the Workstation
* @param props Dictionary of properties associated to this Workstation
/**
* @brief Workstation constructor
- *
+ *
* @param model WorkstationModel associated to this Workstation
* @param name The name of the Workstation
* @param props Dictionary of properties associated to this Workstation
/**
* @brief Execute some quantity of computation
- *
+ *
* @param size The value of the processing amount (in flop) needed to process
* @return The CpuAction corresponding to the processing
* @see Cpu
/**
* @brief Make a process sleep for duration seconds
- *
+ *
* @param duration The number of seconds to sleep
* @return The CpuAction corresponding to the sleeping
* @see Cpu
/**
* @brief Get the number of cores of the associated Cpu
- *
+ *
* @return The number of cores of the associated Cpu
* @see Cpu
*/
/**
* @brief Get the speed of the associated Cpu
- *
+ *
* @param load [TODO]
* @return The speed of the associated Cpu
* @see Cpu
/**
* @brief Get the available speed of the associated Cpu
* @details [TODO]
- *
+ *
* @return The available speed of the associated Cpu
* @see Cpu
*/
/**
* @brief Get the associated Cpu power peak
- *
+ *
* @return The associated Cpu power peak
* @see Cpu
*/
/**
* @brief Return the storage of corresponding mount point
- *
+ *
* @param storage The mount point
* @return The corresponding Storage
*/
/**
* @brief Get the xbt_dict_t of mount_point: Storage
- *
+ *
* @return The xbt_dict_t of mount_point: Storage
*/
virtual xbt_dict_t getMountedStorageList();
/**
* @brief Open a file
- *
+ *
* @param fullpath The full path to the file
- *
+ *
* @return The StorageAction corresponding to the opening
*/
virtual ActionPtr open(const char* fullpath);
/**
* @brief Close a file
- *
+ *
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
/**
* @brief Unlink a file
* @details [long description]
- *
+ *
* @param fd [description]
* @return [description]
*/
/**
* @brief List directory contents of a path
* @details [long description]
- *
+ *
* @param mount [description]
* @param path The path to the directory
* @return The StorageAction corresponding to the ls action
/**
* @brief Get the size in bytes of the file
- *
+ *
* @param fd The file descriptor to read
* @return The size in bytes of the file
*/
/**
* @brief Read a file
- *
+ *
* @param fd The file descriptor to read
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
/**
* @brief Write a file
- *
+ *
* @param fd The file descriptor to write
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
* - the storage name,
* - the storage typeId,
* - the storage content type
- *
+ *
* @param fd The file descriptor
* @return An xbt_dynar_t with the file informations
*/
/**
* @brief Get the current position of the file descriptor
- *
+ *
* @param fd The file descriptor
* @return The current position of the file descriptor
*/
virtual sg_size_t fileTell(surf_file_t fd);
/**
- * @brief Get the available space of the storage at the mount point
- *
+ * @brief Get the available space of the storage at the mount point
+ *
* @param name The mount point
* @return The amount of availble space in bytes
*/
/**
* @brief Get the used space of the storage at the mount point
- *
+ *
* @param name The mount point
* @return The amount of used space in bytes
*/
/**
* @brief Set the position indictator assiociated with the file descriptor to a new position
* @details [long description]
- *
+ *
* @param fd The file descriptor
* @param offset The offset from the origin
* @param origin Position used as a reference for the offset
/**
* @brief Get the list of virtual machines on the current Workstation
- *
+ *
* @return The list of VMs
*/
xbt_dynar_t getVms();
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param params [description]
*/
void getParams(ws_params_t params);
/**
* @brief [brief description]
* @details [long description]
- *
+ *
* @param params [description]
*/
void setParams(ws_params_t params);
public:
/**
* @brief WorkstationAction constructor
- *
+ *
* @param model The WorkstationModel associated to this WorkstationAction
* @param cost The cost of this WorkstationAction in [TODO]
* @param failed [description]
/**
* @brief WorkstationAction constructor
- *
+ *
* @param model The WorkstationModel associated to this WorkstationAction
* @param cost The cost of this WorkstationAction in [TODO]
* @param failed [description]
void LinkL07::updateState(tmgr_trace_event_t event_type, double value, double date){
XBT_DEBUG("Updating link %s (%p) with value=%f for date=%g", getName(), this, value, date);
if (event_type == p_bwEvent) {
- m_bwCurrent = value;
- lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_bwCurrent);
+ updateBandwidth(value, date);
if (tmgr_trace_event_free(event_type))
p_bwEvent = NULL;
} else if (event_type == p_latEvent) {
- lmm_variable_t var = NULL;
- WorkstationL07ActionPtr action;
- lmm_element_t elem = NULL;
-
- m_latCurrent = value;
- while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
- action = (WorkstationL07ActionPtr) lmm_variable_id(var);
- action->updateBound();
- }
+ updateLatency(value, date);
if (tmgr_trace_event_free(event_type))
p_latEvent = NULL;
} else if (event_type == p_stateEvent) {
return m_bwCurrent;
}
+void LinkL07::updateBandwidth(double value, double date)
+{
+ m_bwCurrent = value;
+ lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_bwCurrent);
+}
+
double LinkL07::getLatency()
{
return m_latCurrent;
}
+void LinkL07::updateLatency(double value, double date)
+{
+ lmm_variable_t var = NULL;
+ WorkstationL07ActionPtr action;
+ lmm_element_t elem = NULL;
+
+ m_latCurrent = value;
+ while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
+ action = (WorkstationL07ActionPtr) lmm_variable_id(var);
+ action->updateBound();
+ }
+}
+
+
bool LinkL07::isShared()
{
return lmm_constraint_is_shared(getConstraint());
double getBandwidth();
double getLatency();
bool isShared();
+ void updateBandwidth(double value, double date=surf_get_clock());
+ void updateLatency(double value, double date=surf_get_clock());
double m_latCurrent;
tmgr_trace_event_t p_latEvent;
abort();
}
+#ifdef MADV_MERGEABLE
+ madvise(mapto, mapbytes, MADV_MERGEABLE);
+#endif
+
if (mdp->top == 0)
mdp->base = mdp->breakval = mapto;
--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+
+if(enable_smpi)
+ if(WIN32)
+ set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
+ else()
+ set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
+ endif()
+
+
+ set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+ add_executable(bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.c)
+ target_link_libraries(bug-17132 simgrid)
+
+ set(tesh_files
+ ${tesh_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/bug-17132.tesh
+ PARENT_SCOPE)
+ set(xml_files
+ ${xml_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/small_platform.xml
+ PARENT_SCOPE)
+ set(teshsuite_src
+ ${teshsuite_src}
+ ${CMAKE_CURRENT_SOURCE_DIR}/bug-17132.c
+ PARENT_SCOPE)
+ set(bin_files
+ ${bin_files}
+ PARENT_SCOPE)
+ set(txt_files
+ ${txt_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/hostfile.txt
+ ${CMAKE_CURRENT_SOURCE_DIR}/README
+ PARENT_SCOPE)
+
+endif(enable_smpi)
--- /dev/null
+This is the bug #17132 described on gforge [1]. This small SMPI code
+triggers an issue in SURF, which is still to be debugged.
+
+The problem seems to be related to the order of events, as changing it
+(with another platform or another message size or a MPI_barrier in
+between) fixes the problem.
+
+[1] https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165
\ No newline at end of file
--- /dev/null
+#include "xbt/log.h"
+#include <stdio.h>
+#include <mpi.h>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi, "Messages for this SMPI test");
+
+int main(int argc, char ** argv)
+{
+ size_t err;
+ size_t M = 8*1024;
+ size_t N = 32*1024;
+
+ MPI_Init(&argc, &argv);
+
+ double *a = malloc(sizeof(double) * M);
+ double *b = malloc(sizeof(double) * N);
+
+ // A broadcast
+ err = MPI_Bcast(a, M, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+ if (err != MPI_SUCCESS) {
+ perror("Error Bcast A\n"); MPI_Finalize(); exit(-1);
+ }
+
+// Uncommenting this barrier fixes it!
+// MPI_Barrier(MPI_COMM_WORLD);
+
+ // Another broadcast
+ err = MPI_Bcast(b, N, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+ if (err != MPI_SUCCESS) {
+ perror("Error Bcast B\n"); MPI_Finalize(); exit(-1);
+ }
+
+ // Commenting out this barrier fixes it!!
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ MPI_Finalize();
+ free(a);
+ free(b);
+ return 0;
+}
--- /dev/null
+$ ../../smpi_script/bin/smpirun -np 16 -platform ${srcdir:=.}/small_platform.xml -hostfile ${srcdir:=.}/hostfile.txt ./bug-17132 --cfg=smpi/cpu_threshold:-1 --log=smpi_kernel.thres:warning
+> You requested to use 16 processes, but there is only 2 processes in your hostfile...
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '-1'
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> (some sensible output)
--- /dev/null
+host1
+host2
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version='3'>
+ <AS id='AS0' routing='Full'>
+
+ <host id='host1' power='1.0'/>
+ <host id='host2' power='1.0'/>
+ <link id='link' bandwidth='1e+10' latency='1e-09'/>
+
+ <route src='host1' dst='host2' symmetrical="YES">
+ <link_ctn id='link'/>
+ </route>
+
+ </AS>
+</platform>
! expect signal SIGSEGV
$ ./simix/stack_overflow --cfg=contexts/stack_size:96 ${srcdir:=.}/simix/stack_overflow.xml
> [Tremblay:master:(0) 0.000000] [test/INFO] Launching our nice bugged recursive function...
-> Access violation detected. This can result from a stack overflow.
+> Access violation detected.
+> This can result from a programming error in your code or, although less likely,
+> from a bug in SimGrid itself. This can also be the sign of a bug in the OS or
+> in third-party libraries. Failing hardware can sometimes generate such errors
+> too.
+> Finally, if nothing of the above applies, this can result from a stack overflow.
> Try to increase stack size with --cfg=contexts/stack_size (current size is 96 KiB).
Dwarf_Op ops[60];
ops[0].atom = DW_OP_const8u;
- ops[0].number = (Dwarf_Word) &foo;
+ ops[0].number = (uintptr_t) &foo;
ops[1].atom = DW_OP_deref;
state->stack_size = 0;