static int factor_cmp(const void *pa, const void *pb)
{
- return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor);
+ return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor) ? 1 :
+ (((s_smpi_factor_t*)pa)->factor < ((s_smpi_factor_t*)pb)->factor) ? -1 : 0;
}
char *value = NULL;
unsigned int iter = 0;
s_smpi_factor_t fact;
+ fact.nb_values=0;
int i=0;
xbt_dynar_t smpi_factor, radical_elements, radical_elements2 = NULL;
smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_t), NULL);
radical_elements = xbt_str_split(smpi_coef_string, ";");
xbt_dynar_foreach(radical_elements, iter, value) {
- fact.nb_values=0;
+ memset(&fact, 0, sizeof(s_smpi_factor_t));
radical_elements2 = xbt_str_split(value, ":");
if (xbt_dynar_length(radical_elements2) <2 || xbt_dynar_length(radical_elements2) > 5)
xbt_die("Malformed radical for smpi factor!");
double current=0.0;
xbt_dynar_foreach(smpi_os_values, iter, fact) {
if (size <= fact.factor) {
- XBT_DEBUG("os : %lf <= %ld return %f", size, fact.factor, current);
+ XBT_DEBUG("os : %f <= %ld return %f", size, fact.factor, current);
return current;
}else{
current=fact.values[0]+fact.values[1]*size;
}
}
- XBT_DEBUG("os : %lf > %ld return %f", size, fact.factor, current);
+ XBT_DEBUG("os : %f > %ld return %f", size, fact.factor, current);
return current;
}
double current=0.0;
xbt_dynar_foreach(smpi_ois_values, iter, fact) {
if (size <= fact.factor) {
- XBT_DEBUG("ois : %lf <= %ld return %f", size, fact.factor, current);
+ XBT_DEBUG("ois : %f <= %ld return %f", size, fact.factor, current);
return current;
}else{
current=fact.values[0]+fact.values[1]*size;
}
}
- XBT_DEBUG("ois : %lf > %ld return %f", size, fact.factor, current);
+ XBT_DEBUG("ois : %f > %ld return %f", size, fact.factor, current);
return current;
}
double current=0.0;
xbt_dynar_foreach(smpi_or_values, iter, fact) {
if (size <= fact.factor) {
- XBT_DEBUG("or : %lf <= %ld return %f", size, fact.factor, current);
+ XBT_DEBUG("or : %f <= %ld return %f", size, fact.factor, current);
return current;
}else
current=fact.values[0]+fact.values[1]*size;
}
- XBT_DEBUG("or : %lf > %ld return %f", size, fact.factor, current);
+ XBT_DEBUG("or : %f > %ld return %f", size, fact.factor, current);
return current;
}
MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, PERSISTENT | SEND | PREPARED);
request->refcount++;
MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, PERSISTENT | SSEND | SEND | PREPARED);
request->refcount++;
MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
int src, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
comm, PERSISTENT | RECV | PREPARED);
request->refcount++;
double sleeptime = request->detached ? smpi_or(request->size) : 0.0;
if(sleeptime!=0.0){
simcall_process_sleep(sleeptime);
- XBT_DEBUG("receiving size of %zu : sleep %lf ", request->size, smpi_or(request->size));
+ XBT_DEBUG("receiving size of %zu : sleep %f ", request->size, smpi_or(request->size));
}
} else {
if(sleeptime!=0.0){
simcall_process_sleep(sleeptime);
- XBT_DEBUG("sending size of %zu : sleep %lf ", request->size, smpi_os(request->size));
+ XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size));
}
request->action =
void smpi_mpi_startall(int count, MPI_Request * requests)
{
int i;
+ if(requests==NULL) return;
for(i = 0; i < count; i++) {
smpi_mpi_start(requests[i]);
MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf , count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, NON_PERSISTENT | ISEND | SEND | PREPARED);
return request;
MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM?(void*)0:buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, NON_PERSISTENT | ISEND | SEND);
smpi_mpi_start(request);
MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, NON_PERSISTENT | ISEND | SSEND | SEND);
smpi_mpi_start(request);
MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
int src, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
comm, NON_PERSISTENT | RECV | PREPARED);
return request;
MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
int src, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
comm, NON_PERSISTENT | RECV);
smpi_mpi_start(request);
void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
int tag, MPI_Comm comm, MPI_Status * status)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
smpi_mpi_wait(&request, status);
request = NULL;
void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, NON_PERSISTENT | SEND);
void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL;
+ MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
comm, NON_PERSISTENT | SSEND | SEND);