git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7379
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
status->MPI_TAG = (*request)->tag;
status->MPI_ERROR = MPI_SUCCESS;
status->_count = (*request)->size; // size in bytes
status->MPI_TAG = (*request)->tag;
status->MPI_ERROR = MPI_SUCCESS;
status->_count = (*request)->size; // size in bytes
- status->_cancelled = 0; // FIXME: cancellation of requests not handled yet
+ status->_cancelled = 0; // FIXME: cancellation of requests not handled yet
}
DEBUG3("finishing wait for %p [data = %p, complete = %d]", *request, data, data->complete);
// data == *request if sender is first to finish its wait
}
DEBUG3("finishing wait for %p [data = %p, complete = %d]", *request, data, data->complete);
// data == *request if sender is first to finish its wait
int rank, size, src, index, datasize;
MPI_Request* requests;
void** tmpbufs;
int rank, size, src, index, datasize;
MPI_Request* requests;
void** tmpbufs;
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
if(rank != root) {
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
if(rank != root) {
} else {
datasize = smpi_datatype_size(datatype);
// Local copy from root
} else {
datasize = smpi_datatype_size(datatype);
// Local copy from root
- memcpy(recvbuf, sendbuf, count * datasize * sizeof(char));
+ memcpy(recvbuf, sendbuf, count * datasize * sizeof(char));
// Receive buffers from senders
//TODO: make a MPI_barrier here ?
requests = xbt_new(MPI_Request, size - 1);
// Receive buffers from senders
//TODO: make a MPI_barrier here ?
requests = xbt_new(MPI_Request, size - 1);
int rank, size, other, index, datasize;
MPI_Request* requests;
void** tmpbufs;
int rank, size, other, index, datasize;
MPI_Request* requests;
void** tmpbufs;
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
datasize = smpi_datatype_size(datatype);
// Local copy from self
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
datasize = smpi_datatype_size(datatype);
// Local copy from self
- memcpy(recvbuf, sendbuf, count * datasize * sizeof(char));
+ memcpy(recvbuf, sendbuf, count * datasize * sizeof(char));
// Send/Recv buffers to/from others;
//TODO: make a MPI_barrier here ?
requests = xbt_new(MPI_Request, 2 * (size - 1));
// Send/Recv buffers to/from others;
//TODO: make a MPI_barrier here ?
requests = xbt_new(MPI_Request, 2 * (size - 1));
int total;
MPI_Request* requests;
void** tmpbufs;
int total;
MPI_Request* requests;
void** tmpbufs;
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
datasize = smpi_datatype_size(datatype);
// Local copy from self
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
datasize = smpi_datatype_size(datatype);
// Local copy from self
- memcpy(recvbuf, sendbuf, count * datasize * sizeof(char));
+ memcpy(recvbuf, sendbuf, count * datasize * sizeof(char));
// Send/Recv buffers to/from others;
total = rank + (size - (rank + 1));
requests = xbt_new(MPI_Request, total);
// Send/Recv buffers to/from others;
total = rank + (size - (rank + 1));
requests = xbt_new(MPI_Request, total);
tree = xbt_new(struct s_proc_tree, 1);
tree->PROCTREE_A = arity;
tree = xbt_new(struct s_proc_tree, 1);
tree->PROCTREE_A = arity;
tree->numChildren = 0;
tree->child = xbt_new(int, arity);
for(i = 0; i < arity; i++) {
tree->numChildren = 0;
tree->child = xbt_new(int, arity);
for(i = 0; i < arity; i++) {
}
smpi_mpi_waitall(tree->numChildren, requests, MPI_STATUS_IGNORE);
xbt_free(requests);
}
smpi_mpi_waitall(tree->numChildren, requests, MPI_STATUS_IGNORE);
xbt_free(requests);
- * bcast with a binary, ternary, or whatever tree ..
+ * bcast with a binary, ternary, or whatever tree ..
**/
void nary_tree_bcast(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm, int arity) {
**/
void nary_tree_bcast(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm, int arity) {
- proc_tree_t tree = alloc_tree(arity);
+ proc_tree_t tree = alloc_tree(arity);
int rank, size;
rank = smpi_comm_rank(comm);
int rank, size;
rank = smpi_comm_rank(comm);
- * barrier with a binary, ternary, or whatever tree ..
+ * barrier with a binary, ternary, or whatever tree ..
**/
void nary_tree_barrier(MPI_Comm comm, int arity) {
**/
void nary_tree_barrier(MPI_Comm comm, int arity) {
- proc_tree_t tree = alloc_tree( arity );
+ proc_tree_t tree = alloc_tree( arity );
int rank, size;
char dummy='$';
int rank, size;
char dummy='$';
*
* Openmpi calls this routine when the message size sent to each rank < 2000 bytes and size < 12
**/
*
* Openmpi calls this routine when the message size sent to each rank < 2000 bytes and size < 12
**/
requests[count] = smpi_mpi_irecv(&((char*)recvbuf)[i * recvinc], recvcount, recvtype, i, system_tag, comm);
count++;
}
requests[count] = smpi_mpi_irecv(&((char*)recvbuf)[i * recvinc], recvcount, recvtype, i, system_tag, comm);
count++;
}
- /* Now post all sends in reverse order
+ /* Now post all sends in reverse order
* - We would like to minimize the search time through message queue
* when messages actually arrive in the order in which they were posted.
* TODO: check the previous assertion
* - We would like to minimize the search time through message queue
* when messages actually arrive in the order in which they were posted.
* TODO: check the previous assertion
*
* this algorithm performs size steps (1<=s<=size) and
* at each step s, a process p sends iand receive to.from a unique distinct remote process
*
* this algorithm performs size steps (1<=s<=size) and
* at each step s, a process p sends iand receive to.from a unique distinct remote process
- * size=5 : s=1: 4->0->1, 0->1->2, 1->2->3, ...
+ * size=5 : s=1: 4->0->1, 0->1->2, 1->2->3, ...
* s=2: 3->0->2, 4->1->3, 0->2->4, 1->3->0 , 2->4->1
* s=2: 3->0->2, 4->1->3, 0->2->4, 1->3->0 , 2->4->1
* Openmpi calls this routine when the message size sent to each rank is greater than 3000 bytes
**/
int smpi_coll_tuned_alltoall_pairwise(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) {
* Openmpi calls this routine when the message size sent to each rank is greater than 3000 bytes
**/
int smpi_coll_tuned_alltoall_pairwise(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) {
*
* smpi_coll_private.h -- functions of smpi_coll.c that are exported to other SMPI modules.
*
*
* smpi_coll_private.h -- functions of smpi_coll.c that are exported to other SMPI modules.
*
SIMIX_init();
while (SIMIX_solve(NULL, NULL) != -1.0);
SIMIX_init();
while (SIMIX_solve(NULL, NULL) != -1.0);
if (xbt_cfg_get_int(_surf_cfg_set, "display_timing"))
INFO1("simulation time %g", SIMIX_get_clock());
if (xbt_cfg_get_int(_surf_cfg_set, "display_timing"))
INFO1("simulation time %g", SIMIX_get_clock());
int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) {
int retval;
/*
int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count) {
int retval;
/*
- * Returns the number of entries received. (Again, we count entries, each of type datatype, not bytes.)
+ * Returns the number of entries received. (Again, we count entries, each of type datatype, not bytes.)
* The datatype argument should match the argument provided by the receive call that set the status variable.
* The datatype argument should match the argument provided by the receive call that set the status variable.
- * If the size of the datatype is zero, this routine will return a count of zero.
- * If the amount of data in status is not an exact multiple of the size of datatype
+ * If the size of the datatype is zero, this routine will return a count of zero.
+ * If the amount of data in status is not an exact multiple of the size of datatype
* (so that count would not be integral), a count of MPI_UNDEFINED is returned instead.
*
*/
* (so that count would not be integral), a count of MPI_UNDEFINED is returned instead.
*
*/
} else if(sendcounts == NULL || senddisps == NULL || recvcounts == NULL || recvdisps == NULL) {
retval = MPI_ERR_ARG;
} else {
} else if(sendcounts == NULL || senddisps == NULL || recvcounts == NULL || recvdisps == NULL) {
retval = MPI_ERR_ARG;
} else {
- retval = smpi_coll_basic_alltoallv(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype, comm);
+ retval = smpi_coll_basic_alltoallv(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype, comm);
}
smpi_bench_begin(rank, "Alltoallv");
return retval;
}
smpi_bench_begin(rank, "Alltoallv");
return retval;
/* $Id$tag */
/* smpi_mpi_dt.c -- MPI primitives to handle datatypes */
/* $Id$tag */
/* smpi_mpi_dt.c -- MPI primitives to handle datatypes */
/* Note: a very incomplete implementation */
/* Copyright (c) 2009 Stephane Genaud. */
/* Note: a very incomplete implementation */
/* Copyright (c) 2009 Stephane Genaud. */
//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
typedef struct { float value; int index;} float_int;
//The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC.
typedef struct { float value; int index;} float_int;
-typedef struct { long value; int index;} long_int ;
+typedef struct { long value; int index;} long_int ;
typedef struct { double value; int index;} double_int;
typedef struct { short value; int index;} short_int;
typedef struct { int value; int index;} int_int;
typedef struct { double value; int index;} double_int;
typedef struct { short value; int index;} short_int;
typedef struct { int value; int index;} int_int;
-typedef struct { long double value; int index;} long_double_int;
+typedef struct { long double value; int index;} long_double_int;
// Predefined data types
CREATE_MPI_DATATYPE(MPI_CHAR, char);
// Predefined data types
CREATE_MPI_DATATYPE(MPI_CHAR, char);
memcpy(recvbuf, sendbuf, smpi_datatype_size(sendtype) * count);
retval = sendcount > recvcount ? MPI_ERR_TRUNCATE : MPI_SUCCESS;
} else {
memcpy(recvbuf, sendbuf, smpi_datatype_size(sendtype) * count);
retval = sendcount > recvcount ? MPI_ERR_TRUNCATE : MPI_SUCCESS;
} else {
- /* FIXME: cases
- * - If receive packed.
+ /* FIXME: cases
+ * - If receive packed.
* - If send packed
* to be treated once we have the MPI_Pack things ...
**/
* - If send packed
* to be treated once we have the MPI_Pack things ...
**/
APPLY_FUNC(a, b, length, long double, MAX_OP);
}
}
APPLY_FUNC(a, b, length, long double, MAX_OP);
}
}
static void min_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, MIN_OP);
static void min_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, MIN_OP);
APPLY_FUNC(a, b, length, long double, MIN_OP);
}
}
APPLY_FUNC(a, b, length, long double, MIN_OP);
}
}
static void sum_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, SUM_OP);
static void sum_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, SUM_OP);
APPLY_FUNC(a, b, length, long double _Complex, SUM_OP);
}
}
APPLY_FUNC(a, b, length, long double _Complex, SUM_OP);
}
}
static void prod_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, PROD_OP);
static void prod_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, PROD_OP);
APPLY_FUNC(a, b, length, long double _Complex, PROD_OP);
}
}
APPLY_FUNC(a, b, length, long double _Complex, PROD_OP);
}
}
static void land_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, LAND_OP);
static void land_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, LAND_OP);
APPLY_FUNC(a, b, length, _Bool, LAND_OP);
}
}
APPLY_FUNC(a, b, length, _Bool, LAND_OP);
}
}
static void lor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, LOR_OP);
static void lor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, LOR_OP);
APPLY_FUNC(a, b, length, _Bool, LOR_OP);
}
}
APPLY_FUNC(a, b, length, _Bool, LOR_OP);
}
}
static void lxor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, LXOR_OP);
static void lxor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, LXOR_OP);
APPLY_FUNC(a, b, length, _Bool, LXOR_OP);
}
}
APPLY_FUNC(a, b, length, _Bool, LXOR_OP);
}
}
static void band_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, BAND_OP);
static void band_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, BAND_OP);
APPLY_FUNC(a, b, length, uint8_t, BAND_OP);
}
}
APPLY_FUNC(a, b, length, uint8_t, BAND_OP);
}
}
static void bor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, BOR_OP);
static void bor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, BOR_OP);
APPLY_FUNC(a, b, length, uint8_t, BOR_OP);
}
}
APPLY_FUNC(a, b, length, uint8_t, BOR_OP);
}
}
static void bxor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, BXOR_OP);
static void bxor_func(void* a, void* b, int* length, MPI_Datatype* datatype) {
if(*datatype == MPI_SHORT) {
APPLY_FUNC(a, b, length, short, BXOR_OP);
*
* smpi_mpi_dt_private.h -- functions of smpi_mpi_dt.c that are exported to other SMPI modules.
*
*
* smpi_mpi_dt_private.h -- functions of smpi_mpi_dt.c that are exported to other SMPI modules.
*
#define DT_FLAG_UNAVAILABLE 0x0400 /**< datatypes unavailable on the build (OS or compiler dependant) */
#define DT_FLAG_VECTOR 0x0800 /**< valid only for loops. The loop contain only one element
**< without extent. It correspond to the vector type. */
#define DT_FLAG_UNAVAILABLE 0x0400 /**< datatypes unavailable on the build (OS or compiler dependant) */
#define DT_FLAG_VECTOR 0x0800 /**< valid only for loops. The loop contain only one element
**< without extent. It correspond to the vector type. */
* We should make the difference here between the predefined contiguous and non contiguous
* datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
*/
* We should make the difference here between the predefined contiguous and non contiguous
* datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
*/
"-map")
MAPOPT="true"
shift 1
"-map")
MAPOPT="true"
shift 1
- "-help" | "--help" | "-h")
+ "-help" | "--help" | "-h")
echo "usage:"
echo "$0 [-quiet] [-keep-temps] [-np <numprocs>] -platform <xmldesc> -hostfile <hostfile> [-map] program [program-options]"
echo "or (deprecated usage):"
echo "usage:"
echo "$0 [-quiet] [-keep-temps] [-np <numprocs>] -platform <xmldesc> -hostfile <hostfile> [-map] program [program-options]"
echo "or (deprecated usage):"
"--cfg="*|"--log="*)
for OPT in ${1#*=}
do
SIMOPTS="$SIMOPTS ${1%%=*}=$OPT"
"--cfg="*|"--log="*)
for OPT in ${1#*=}
do
SIMOPTS="$SIMOPTS ${1%%=*}=$OPT"
##-------------------------------- DEFAULT or SPECIFIED PLATFORM --------------------------------------
##-------------------------------- DEFAULT or SPECIFIED PLATFORM --------------------------------------
-if [ -z "${PLATFORM}" ]; then
+if [ -z "${PLATFORM}" ]; then
PLATFORMTMP="$(mktemp tmpXXXXXX)"
cat > ${PLATFORMTMP} <<PLATFORMHEAD
PLATFORMTMP="$(mktemp tmpXXXXXX)"
cat > ${PLATFORMTMP} <<PLATFORMHEAD
##---- generate <process> tags------------------------------
##---- generate <process> tags------------------------------
do
if [ -n "${HOSTFILE}" ]; then
j=$(( $i % ${NUMHOSTS} ))
do
if [ -n "${HOSTFILE}" ]; then
j=$(( $i % ${NUMHOSTS} ))
##---- optional display of ranks to process mapping
if [ -n "${MAPOPT}" ]; then
##---- optional display of ranks to process mapping
if [ -n "${MAPOPT}" ]; then
- echo "[rank $i] -> ${hostnames[$j]}"
+ echo "[rank $i] -> ${hostnames[$j]}"
fi
if [ -z "${hostnames[$j]}" ]; then
fi
if [ -z "${hostnames[$j]}" ]; then
if [ -z "${KEEP}" ] ; then
if [ -z "${PLATFORM}" ]; then
if [ -z "${KEEP}" ] ; then
if [ -z "${PLATFORM}" ]; then
fi
rm ${APPLICATIONTMP}
fi
fi
rm ${APPLICATIONTMP}
fi