A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update XBT_ATTRIB_DEPRECATED_v??? in comments.
[simgrid.git]
/
teshsuite
/
smpi
/
gh-139
/
gh-139.c
diff --git
a/teshsuite/smpi/gh-139/gh-139.c
b/teshsuite/smpi/gh-139/gh-139.c
index 69a127f8bdff5de012a47c2ce9d362e38239a754..68e9b5c8eeb3a231b88b6ec0b44a5c1c98ec7893 100644
(file)
--- a/
teshsuite/smpi/gh-139/gh-139.c
+++ b/
teshsuite/smpi/gh-139/gh-139.c
@@
-1,12
+1,12
@@
-/* Copyright (c) 2019-202
0
. The SimGrid Team.
+/* Copyright (c) 2019-202
3
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <mpi.h>
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <mpi.h>
-#include <simgrid/
msg
.h>
-#include <simgrid/
simix
.h>
+#include <simgrid/
actor
.h>
+#include <simgrid/
host
.h>
#include <stdio.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(smpi_test, "Messages specific for this SMPI example");
#include <stdio.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(smpi_test, "Messages specific for this SMPI example");
@@
-27,33
+27,30
@@
void* req_wait(void* bar);
// Thread creation helper
// Thread creation helper
-static
int
thread_create_wrapper(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+static
void
thread_create_wrapper(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
{
int the_global_rank = global_rank;
{
int the_global_rank = global_rank;
- struct threadwrap* t = (struct threadwrap*)sg_actor_self_data();
+ struct threadwrap* t = (struct threadwrap*)sg_actor_self_
get_
data();
XBT_INFO("new thread has parameter rank %d and global variable rank %d", ((struct param*)(t->param))->rank,
the_global_rank);
XBT_INFO("new thread has parameter rank %d and global variable rank %d", ((struct param*)(t->param))->rank,
the_global_rank);
-
sg_actor_self_data_set(t->father_data
);
+
SMPI_thread_create(
);
t->f(t->param);
t->f(t->param);
- sg_actor_self_data_set(NULL);
- free(t);
- return 0;
+ xbt_free(t);
}
static void mpi_thread_create(const char* name, void* (*f)(void*), void* param)
{
}
static void mpi_thread_create(const char* name, void* (*f)(void*), void* param)
{
- struct threadwrap* threadwrap = (struct threadwrap*)malloc(sizeof(*threadwrap));
- threadwrap->father_data = sg_actor_self_data();
+ struct threadwrap* threadwrap = xbt_malloc(sizeof(*threadwrap));
threadwrap->f = f;
threadwrap->param = param;
sg_actor_t actor = sg_actor_init(name, sg_host_self());
threadwrap->f = f;
threadwrap->param = param;
sg_actor_t actor = sg_actor_init(name, sg_host_self());
- sg_actor_
data_set
(actor, threadwrap);
+ sg_actor_
set_data
(actor, threadwrap);
sg_actor_start(actor, thread_create_wrapper, 0, NULL);
}
static void mythread_create(const char* name, MPI_Request* req, int rank)
{
sg_actor_start(actor, thread_create_wrapper, 0, NULL);
}
static void mythread_create(const char* name, MPI_Request* req, int rank)
{
- struct param* param =
(struct param*)
malloc(sizeof(*param));
+ struct param* param =
xbt_
malloc(sizeof(*param));
param->req = req;
param->rank = rank;
mpi_thread_create(name, req_wait, param);
param->req = req;
param->rank = rank;
mpi_thread_create(name, req_wait, param);
@@
-66,15
+63,17
@@
void* req_wait(void* bar)
struct param* param = (struct param*)bar;
int rank;
MPI_Status status;
struct param* param = (struct param*)bar;
int rank;
MPI_Status status;
-
+ char err_string[1024];
+ int length = 1024;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
XBT_INFO("%d has MPI rank %d and global variable rank %d", param->rank, rank, global_rank);
XBT_INFO("%d waiting request", rank);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
XBT_INFO("%d has MPI rank %d and global variable rank %d", param->rank, rank, global_rank);
XBT_INFO("%d waiting request", rank);
- MPI_Wait(param->req, &status);
- XBT_INFO("%d request done", rank);
+ int ret = MPI_Wait(param->req, &status);
+ MPI_Error_string(ret, err_string, &length);
+ XBT_INFO("%d request done, return %s", rank, err_string);
XBT_INFO("%d still has MPI rank %d and global variable %d", param->rank, rank, global_rank);
XBT_INFO("%d still has MPI rank %d and global variable %d", param->rank, rank, global_rank);
- free(param);
+
xbt_
free(param);
return NULL;
}
return NULL;
}