A
lgorithmique
N
umérique
D
istribuée
Private GIT Repository
projects
/
loba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor fixes (cosmetics only).
[loba.git]
/
simple_async.cpp
diff --git
a/simple_async.cpp
b/simple_async.cpp
index 2ad0cbc3146a101a24205c6454d9a24c2ad19b06..c4d33e485e7e43bde270e6f5a0d22336a7bf3d44 100644
(file)
--- a/
simple_async.cpp
+++ b/
simple_async.cpp
@@
-2,7
+2,9
@@
#include <cstdio> // sprintf
#include <time.h> // clock()
#include <msg/msg.h>
#include <cstdio> // sprintf
#include <time.h> // clock()
#include <msg/msg.h>
+#define XBT_LOG_OLD_STYLE
#include <xbt/log.h>
#include <xbt/log.h>
+#include "simgrid_features.h"
// Creates a new log category and makes it the default
XBT_LOG_NEW_DEFAULT_CATEGORY(simu, "Simulation messages");
// Creates a new log category and makes it the default
XBT_LOG_NEW_DEFAULT_CATEGORY(simu, "Simulation messages");
@@
-19,11
+21,11
@@
enum {
EXIT_FAILURE_CLEAN = 0x08, // error at cleanup
};
EXIT_FAILURE_CLEAN = 0x08, // error at cleanup
};
-int sender(int, char
*
[])
+int sender(int, char
*
[])
{
char mbox_stack[N_MBOX][100];
msg_comm_t comm_stack[N_MBOX * N_MESG];
{
char mbox_stack[N_MBOX][100];
msg_comm_t comm_stack[N_MBOX * N_MESG];
- msg_comm_t
*
comm = comm_stack;
+ msg_comm_t
* p
comm = comm_stack;
for (int i = 0 ; i < N_MBOX ; i++)
sprintf(mbox_stack[i], "MBox_%02d", i);
for (int i = 0 ; i < N_MBOX ; i++)
sprintf(mbox_stack[i], "MBox_%02d", i);
@@
-32,7
+34,7
@@
int sender(int, char *[])
for (int i = 0 ; i < N_MBOX ; i++)
for (int j = 0 ; j < N_MESG ; j++) {
char task_name[100];
for (int i = 0 ; i < N_MBOX ; i++)
for (int j = 0 ; j < N_MESG ; j++) {
char task_name[100];
- const char
*
mailbox = mbox_stack[i];
+ const char
*
mailbox = mbox_stack[i];
unsigned shift = j;
unsigned comm_size = 1 << shift;
m_task_t task;
unsigned shift = j;
unsigned comm_size = 1 << shift;
m_task_t task;
@@
-42,18
+44,22
@@
int sender(int, char *[])
INFO4("At %02d, send %s, size %.0f to \"%s\"", n,
MSG_task_get_name(task),
MSG_task_get_data_size(task), mailbox);
INFO4("At %02d, send %s, size %.0f to \"%s\"", n,
MSG_task_get_name(task),
MSG_task_get_data_size(task), mailbox);
- *comm++ = MSG_task_isend(task, mailbox);
+ *
p
comm++ = MSG_task_isend(task, mailbox);
++n;
}
INFO0("Wait for communications to terminate...");
++n;
}
INFO0("Wait for communications to terminate...");
- MSG_comm_waitall(comm_stack, comm - comm_stack, -1.0);
+ MSG_comm_waitall(comm_stack, pcomm - comm_stack, -1.0);
+ if (!MSG_WAIT_DESTROYS_COMMS) {
+ while (pcomm > comm_stack)
+ MSG_comm_destroy(*--pcomm);
+ }
INFO0("Finished.");
return 0;
}
INFO0("Finished.");
return 0;
}
-int receiver(int, char
*
[])
+int receiver(int, char
*
[])
{
char mbox[N_MBOX][100];
int comm_count[N_MBOX];
{
char mbox[N_MBOX][100];
int comm_count[N_MBOX];
@@
-77,7
+83,7
@@
int receiver(int, char *[])
}
}
int n = 0;
}
}
int n = 0;
- while (
xbt_dynar_length
(dcomms)) {
+ while (
!xbt_dynar_is_empty
(dcomms)) {
MSG_comm_waitany(dcomms);
xbt_dynar_reset(dcomms);
for (int i = 0 ; i < N_MBOX ; i++) {
MSG_comm_waitany(dcomms);
xbt_dynar_reset(dcomms);
for (int i = 0 ; i < N_MBOX ; i++) {
@@
-111,10
+117,10
@@
int receiver(int, char *[])
return 0;
}
return 0;
}
-int main(int argc, char
*
argv[])
+int main(int argc, char
*
argv[])
{
{
- const char
*
platform_file;
- const char
*
application_file;
+ const char
*
platform_file;
+ const char
*
application_file;
// Note: variables used after THROW must be declared as volatile.
volatile int exit_status; // global exit status
volatile double simulated_time = -1.0;
// Note: variables used after THROW must be declared as volatile.
volatile int exit_status; // global exit status
volatile double simulated_time = -1.0;