"win_wait", "1 0.8 0",
"win_start", "0.8 0 1",
"win_complete", "0.8 1 0",
- NULL, NULL,
+ nullptr, nullptr,
};
static char *str_tolower (const char *str)
static const char *instr_find_color (const char *state)
{
char *target = str_tolower (state);
- const char *ret = NULL;
+ const char *ret = nullptr;
unsigned int i = 0;
const char *current = smpi_colors[i];
- while ((current != NULL)){
+ while ((current != nullptr)){
if (strcmp (state, current) == 0 //exact match
|| strstr(target, current) != 0 ){//as substring
ret = smpi_colors[i+1];
return key;
}
- if (d == NULL) {
+ if (d == nullptr) {
d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
- xbt_dict_set(keys, aux, d, NULL);
+ xbt_dict_set(keys, aux, d, nullptr);
}
//generate the key
char *s = xbt_dynar_get_as (d, 0, char *);
snprintf (key, n, "%s", s);
- xbt_dynar_remove_at (d, 0, NULL);
+ xbt_dynar_remove_at (d, 0, nullptr);
return key;
}
static xbt_dict_t process_category;
static void cleanup_extra_data (instr_extra_data extra){
- if(extra!=NULL){
- if(extra->sendcounts!=NULL)
+ if(extra!=nullptr){
+ if(extra->sendcounts!=nullptr)
xbt_free(extra->sendcounts);
- if(extra->recvcounts!=NULL)
+ if(extra->recvcounts!=nullptr)
xbt_free(extra->recvcounts);
xbt_free(extra);
}
snprintf (processid, INSTR_DEFAULT_STR_SIZE, "%p", SIMIX_process_self());
if (xbt_dict_get_or_null (process_category, processid))
xbt_dict_remove (process_category, processid);
- if (category != NULL)
- xbt_dict_set (process_category, processid, xbt_strdup(category), NULL);
+ if (category != nullptr)
+ xbt_dict_set (process_category, processid, xbt_strdup(category), nullptr);
}
const char *TRACE_internal_smpi_get_category (void)
{
if (!TRACE_smpi_is_enabled())
- return NULL;
+ return nullptr;
char processid[INSTR_DEFAULT_STR_SIZE];
snprintf (processid, INSTR_DEFAULT_STR_SIZE, "%p", SIMIX_process_self());
}else{
father = PJ_container_get_root ();
}
- xbt_assert(father!=NULL,
+ xbt_assert(father!=nullptr,
"Could not find a parent for mpi rank %s at function %s", str, __FUNCTION__);
PJ_container_new(str, INSTR_SMPI, father);
}
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
- val_t value = PJ_value_get_or_new ("computing", NULL, type);
+ val_t value = PJ_value_get_or_new ("computing", nullptr, type);
new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
- val_t value = PJ_value_get_or_new ("sleeping", NULL, type);
+ val_t value = PJ_value_get_or_new ("sleeping", nullptr, type);
new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
type_t type = PJ_type_get ("MPI_STATE", container->type);
- val_t value = PJ_value_get_or_new ("test", NULL, type);
+ val_t value = PJ_value_get_or_new ("test", nullptr, type);
new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, static_cast<void*>(extra));
}
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
{
- char *value = NULL;
+ char *value = nullptr;
unsigned int iter = 0;
s_smpi_factor_multival_t fact;
fact.nb_values=0;
unsigned int i=0;
- xbt_dynar_t radical_elements2 = NULL;
+ xbt_dynar_t radical_elements2 = nullptr;
- xbt_dynar_t smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_multival_t), NULL);
+ xbt_dynar_t smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_multival_t), nullptr);
xbt_dynar_t radical_elements = xbt_str_split(smpi_coef_string, ";");
xbt_dynar_foreach(radical_elements, iter, value) {
memset(&fact, 0, sizeof(s_smpi_factor_multival_t));
static MPI_Request build_request(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
unsigned flags)
{
- MPI_Request request = NULL;
+ MPI_Request request = nullptr;
- void *old_buf = NULL;
+ void *old_buf = nullptr;
request = xbt_new(s_smpi_mpi_request_t, 1);
if((((flags & RECV) != 0) && ((flags & ACCUMULATE) !=0)) || (datatype->sizeof_substruct != 0)){
// This part handles the problem of non-contiguous memory
old_buf = buf;
- buf = count==0 ? NULL : xbt_malloc(count*smpi_datatype_size(datatype));
+ buf = count==0 ? nullptr : xbt_malloc(count*smpi_datatype_size(datatype));
if ((datatype->sizeof_substruct != 0) && ((flags & SEND) != 0)) {
subtype->serialize(old_buf, buf, count, datatype->substruct);
}
MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process_index(),
smpi_group_index(smpi_comm_group(comm), dst), tag, comm, PERSISTENT | SEND | PREPARED);
return request;
}
MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype,
int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process_index(),
smpi_group_index(smpi_comm_group(comm), dst), tag, comm, PERSISTENT | SSEND | SEND | PREPARED);
return request;
}
MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
int src, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype,
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : 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);
return request;
void* buf = request->buf;
if ( (request->flags & SSEND) == 0
&& ( (request->flags & RMA) != 0 || static_cast<int>(request->size) < xbt_cfg_get_int("smpi/send-is-detached-thresh") ) ) {
- void *oldbuf = NULL;
+ void *oldbuf = nullptr;
request->detached = 1;
XBT_DEBUG("Send request %p is detached", request);
request->refcount++;
if(request->old_type->sizeof_substruct == 0){
oldbuf = request->buf;
- if (!smpi_process_get_replaying() && oldbuf != NULL && request->size!=0){
+ if (!smpi_process_get_replaying() && oldbuf != nullptr && request->size!=0){
if((smpi_privatize_global_variables != 0)
&& (static_cast<char*>(request->buf) >= smpi_start_data_exe)
&& (static_cast<char*>(request->buf) < smpi_start_data_exe + smpi_size_data_exe )){
MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
MPI_Op op)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
if(op==MPI_OP_NULL){
- request = build_request(buf==MPI_BOTTOM ? NULL : buf , count, datatype, src, dst, tag,
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf , count, datatype, src, dst, tag,
comm, RMA | NON_PERSISTENT | ISEND | SEND | PREPARED);
}else{
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, src, dst, tag,
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag,
comm, RMA | NON_PERSISTENT | ISEND | SEND | PREPARED | ACCUMULATE);
request->op = op;
}
MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
MPI_Op op)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
if(op==MPI_OP_NULL){
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, src, dst, tag,
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag,
comm, RMA | NON_PERSISTENT | RECV | PREPARED);
}else{
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, src, dst, tag,
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, src, dst, tag,
comm, RMA | NON_PERSISTENT | RECV | PREPARED | ACCUMULATE);
request->op = op;
}
MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf , count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf , count, datatype, smpi_process_index(),
smpi_group_index(smpi_comm_group(comm), dst), tag,comm, 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; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process_index(),
smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | ISEND | SEND);
smpi_mpi_start(request);
return request;
MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : 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);
return request;
MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : 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);
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; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : 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; /* MC needs the comm to be set to NULL during the call */
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
smpi_mpi_wait(&request, status);
- request = NULL;
+ request = nullptr;
}
void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process_index(),
smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | SEND);
smpi_mpi_start(request);
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
- request = NULL;
+ request = nullptr;
}
void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
- MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? NULL : buf, count, datatype, smpi_process_index(),
+ MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */
+ request = build_request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, smpi_process_index(),
smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | SSEND | SEND);
smpi_mpi_start(request);
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
- request = NULL;
+ request = nullptr;
}
void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int dst, int sendtag,
TRACE_smpi_recv(rank, src_traced, rank);
}
- if(req->detached_sender!=NULL){
+ if(req->detached_sender != nullptr){
//integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
double sleeptime = smpi_or(req->real_size);
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size, sleeptime);
}
-
smpi_mpi_request_free(&(req->detached_sender));
}
if(req->flags & PERSISTENT)
- req->action = NULL;
+ req->action = nullptr;
req->flags |= FINISHED;
smpi_mpi_request_free(request);
smpi_empty_status(status);
int flag = 1;
if (((*request)->flags & PREPARED) == 0) {
- if ((*request)->action != NULL)
+ if ((*request)->action != nullptr)
flag = simcall_comm_test((*request)->action);
if (flag) {
finish_wait(request, status);
int size = 0;
*index = MPI_UNDEFINED;
- comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL);
+ comms = xbt_dynar_new(sizeof(smx_synchro_t), nullptr);
map = xbt_new(int, count);
for(i = 0; i < count; i++) {
if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action && !(requests[i]->flags & PREPARED)) {
void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status){
- MPI_Request request = build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+ MPI_Request request = build_request(nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
smpi_group_index(smpi_comm_group(comm), source), smpi_comm_rank(comm), tag, comm, PERSISTENT | RECV);
// to avoid deadlock, we have to sleep some time here, or the timer won't advance and we will only do iprobe simcalls
return;
}
- if ((*request)->action != NULL)
+ if ((*request)->action != nullptr)
// this is not a detached send
simcall_comm_wait((*request)->action, -1.0);
if(count > 0) {
// Wait for a request to complete
- comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL);
+ comms = xbt_dynar_new(sizeof(smx_synchro_t), nullptr);
map = xbt_new(int, count);
XBT_DEBUG("Wait for one of %d", count);
for(i = 0; i < count; i++) {
if (requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags & PREPARED) && !(requests[i]->flags & FINISHED)) {
- if (requests[i]->action != NULL) {
+ if (requests[i]->action != nullptr) {
XBT_DEBUG("Waiting any %p ", requests[i]);
xbt_dynar_push(comms, &requests[i]->action);
map[size] = i;
} else {
smpi_datatype_extent(datatype, &lb, &dataext);
// Local copy from root
- if (sendtmpbuf != NULL && recvbuf != NULL)
+ if (sendtmpbuf != nullptr && recvbuf != nullptr)
smpi_datatype_copy(sendtmpbuf, count, datatype, recvbuf, count, datatype);
// Receive buffers from senders
requests = xbt_new(MPI_Request, size - 1);
#define PTR_STRLEN (2 + 2 * sizeof(void*) + 1)
-xbt_dict_t samples = NULL; /* Allocated on first use */
-xbt_dict_t calls = NULL; /* Allocated on first use */
+xbt_dict_t samples = nullptr; /* Allocated on first use */
+xbt_dict_t calls = nullptr; /* Allocated on first use */
double smpi_cpu_threshold;
double smpi_running_power;
int smpi_loaded_page = -1;
-char* smpi_start_data_exe = NULL;
+char* smpi_start_data_exe = nullptr;
int smpi_size_data_exe = 0;
bool smpi_privatize_global_variables;
double smpi_total_benched_time = 0;
xbt_die("Could not truncate fd %d to %zu: %s", fd, size, strerror(errno));
}
- mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if(mem == MAP_FAILED) {
xbt_die("Could not map fd %d: %s", fd, strerror(errno));
}
smpi_bench_end(); /* Take time from previous, unrelated computation into account */
smpi_process_set_sampling(1);
- if (samples==NULL)
+ if (samples==nullptr)
samples = xbt_dict_new_homogeneous(free);
data = static_cast<local_data_t *>(xbt_dict_get_or_null(samples, loc));
- if (data==NULL) {
+ if (data==nullptr) {
xbt_assert(threshold>0 || iters>0,
"You should provide either a positive amount of iterations to bench, or a positive maximal stderr (or both)");
data = static_cast<local_data_t *>( xbt_new(local_data_t, 1));
data->threshold = threshold;
data->benching = 1; // If we have no data, we need at least one
data->mean = 0;
- xbt_dict_set(samples, loc, data, NULL);
+ xbt_dict_set(samples, loc, data, nullptr);
XBT_DEBUG("XXXXX First time ever on benched nest %s.",loc);
} else {
if (data->iters != iters || data->threshold != threshold) {
xbt_ex_t ex;
int known = 0;
- if (calls==NULL) {
- calls = xbt_dict_new_homogeneous(NULL);
+ if (calls==nullptr) {
+ calls = xbt_dict_new_homogeneous(nullptr);
}
TRY {
xbt_dict_get(calls, loc); /* Succeed or throw */
char* loc = bprintf("%s:%s", func, input);
void* data;
- if(calls==NULL) {
- calls = xbt_dict_new_homogeneous(NULL);
+ if(calls==nullptr) {
+ calls = xbt_dict_new_homogeneous(nullptr);
}
data = xbt_dict_get(calls, loc);
xbt_free(loc);
char* loc = bprintf("%s:%s", func, input);
if(calls==0) {
- calls = xbt_dict_new_homogeneous(NULL);
+ calls = xbt_dict_new_homogeneous(nullptr);
}
- xbt_dict_set(calls, loc, data, NULL);
+ xbt_dict_set(calls, loc, data, nullptr);
xbt_free(loc);
return data;
}
for (int i=0; i< smpi_process_count(); i++){
//create SIMIX_process_count() mappings of this size with the same data inside
- void *address = NULL;
+ void *address = nullptr;
char path[] = "/dev/shm/my-buffer-XXXXXX";
int status;
xbt_die("Impossible to set the size of the temporary file for memory mapping");
/* Ask for a free region */
- address = mmap (NULL, smpi_size_data_exe, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, 0);
+ address = mmap (nullptr, smpi_size_data_exe, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, 0);
if (address == MAP_FAILED)
xbt_die("Couldn't find a free region for memory mapping");
s_mpi_coll_description_t mpi_coll_gather_description[] = {
{"default", "gather default collective", reinterpret_cast<void*>(&smpi_mpi_gather)},
- COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA), {NULL, NULL, NULL} /* this array must be NULL terminated */
+ COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA), {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
"allgather default collective",
reinterpret_cast<void*>(&smpi_mpi_allgather)},
COLL_ALLGATHERS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_allgatherv_description[] = {
"allgatherv default collective",
reinterpret_cast<void*>(&smpi_mpi_allgatherv)},
COLL_ALLGATHERVS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_allreduce_description[] = {
"allreduce default collective",
reinterpret_cast<void*>(&smpi_mpi_allreduce)},
COLL_ALLREDUCES(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_reduce_scatter_description[] = {
"reduce_scatter default collective",
reinterpret_cast<void*>(&smpi_mpi_reduce_scatter)},
COLL_REDUCE_SCATTERS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_scatter_description[] = {
"scatter default collective",
reinterpret_cast<void*>(&smpi_mpi_scatter)},
COLL_SCATTERS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_barrier_description[] = {
"barrier default collective",
reinterpret_cast<void*>(&smpi_mpi_barrier)},
COLL_BARRIERS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_alltoall_description[] = {
{"default",
{"basic_linear",
"Alltoall basic linear (SG) collective",
reinterpret_cast<void*>(&smpi_coll_tuned_alltoall_basic_linear)},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_alltoallv_description[] = {
"Ompi alltoallv default collective",
reinterpret_cast<void*>(&smpi_coll_basic_alltoallv)},
COLL_ALLTOALLVS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_bcast_description[] = {
"bcast default collective ",
reinterpret_cast<void*>(&smpi_mpi_bcast)},
COLL_BCASTS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_mpi_coll_description_t mpi_coll_reduce_description[] = {
"reduce default collective",
reinterpret_cast<void*>(&smpi_mpi_reduce)},
COLL_REDUCES(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
int find_coll_description(s_mpi_coll_description_t * table,
char *name, const char *desc)
{
- char *name_list = NULL;
+ char *name_list = nullptr;
int selector_on=0;
- if (name==NULL || name[0] == '\0') {
+ if (name==nullptr || name[0] == '\0') {
//no argument provided, use active selector's algorithm
name=static_cast<char*>(xbt_cfg_get_string("smpi/coll-selector"));
selector_on=1;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)");
-xbt_dict_t smpi_comm_keyvals = NULL;
+xbt_dict_t smpi_comm_keyvals = nullptr;
int comm_keyval_id = 0;//avoid collisions
/* Support for cartesian topology was added, but there are 2 other types of topology, graph et dist graph. In order to
comm->intra_comm = MPI_COMM_NULL;
comm->leaders_comm = MPI_COMM_NULL;
comm->is_uniform=1;
- comm->non_uniform_map = NULL;
- comm->leaders_map = NULL;
+ comm->non_uniform_map = nullptr;
+ comm->leaders_map = nullptr;
comm->is_blocked=0;
- comm->attributes=NULL;
+ comm->attributes=nullptr;
return comm;
}
(*newcomm) = smpi_comm_new(cp, smpi_comm_topo(comm));
int ret = MPI_SUCCESS;
- if(comm->attributes !=NULL){
+ if(comm->attributes !=nullptr){
(*newcomm)->attributes=xbt_dict_new();
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
int *key;
int flag;
void* value_in;
xbt_dict_foreach(comm->attributes, cursor, key, value_in){
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(key), sizeof(int)));
- if(elem!=NULL && elem->copy_fn!=MPI_NULL_COPY_FN){
- ret = elem->copy_fn(comm, *key, NULL, value_in, &value_out, &flag );
+ if(elem!=nullptr && elem->copy_fn!=MPI_NULL_COPY_FN){
+ ret = elem->copy_fn(comm, *key, nullptr, value_in, &value_out, &flag );
if(ret!=MPI_SUCCESS){
smpi_comm_destroy(*newcomm);
*newcomm=MPI_COMM_NULL;
return ret;
}
if(flag)
- xbt_dict_set_ext((*newcomm)->attributes, reinterpret_cast<const char*>(key), sizeof(int),value_out, NULL);
+ xbt_dict_set_ext((*newcomm)->attributes, reinterpret_cast<const char*>(key), sizeof(int),value_out, nullptr);
}
}
}
MPI_Topology smpi_comm_topo(MPI_Comm comm) {
if (comm != MPI_COMM_NULL)
return comm->topo;
- return NULL;
+ return nullptr;
}
int smpi_comm_size(MPI_Comm comm)
MPI_Group* group_snd;
MPI_Request* requests;
- group_root = NULL;
- group_out = NULL;
+ group_root = nullptr;
+ group_out = nullptr;
group = smpi_comm_group(comm);
rank = smpi_comm_rank(comm);
size = smpi_comm_size(comm);
if(rank == 0) {
recvbuf = xbt_new(int, 2 * size);
} else {
- recvbuf = NULL;
+ recvbuf = nullptr;
}
smpi_mpi_gather(sendbuf, 2, MPI_INT, recvbuf, 2, MPI_INT, 0, comm);
xbt_free(sendbuf);
} else {
if(color != MPI_UNDEFINED) {
smpi_mpi_recv(&group_out, 1, MPI_PTR, 0, system_tag, comm, MPI_STATUS_IGNORE);
- } /* otherwise, exit with group_out == NULL */
+ } /* otherwise, exit with group_out == nullptr */
}
- return group_out!=NULL ? smpi_comm_new(group_out, NULL) : MPI_COMM_NULL;
+ return group_out!=nullptr ? smpi_comm_new(group_out, nullptr) : MPI_COMM_NULL;
}
void smpi_comm_use(MPI_Comm comm){
}
void smpi_comm_cleanup_attributes(MPI_Comm comm){
- if(comm->attributes !=NULL){
- xbt_dict_cursor_t cursor = NULL;
+ if(comm->attributes !=nullptr){
+ xbt_dict_cursor_t cursor = nullptr;
int* key;
void * value;
int flag;
xbt_dict_foreach(comm->attributes, cursor, key, value){
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, reinterpret_cast<const char*>(key)));
- if(elem!=NULL && elem->delete_fn!=NULL)
+ if(elem!=nullptr && elem->delete_fn!=nullptr)
elem->delete_fn(comm, *key, value, &flag);
}
xbt_dict_free(&comm->attributes);
smpi_comm_unuse(comm->intra_comm);
if(comm->leaders_comm != MPI_COMM_NULL)
smpi_comm_unuse(comm->leaders_comm);
- if(comm->non_uniform_map !=NULL)
+ if(comm->non_uniform_map !=nullptr)
xbt_free(comm->non_uniform_map);
- if(comm->leaders_map !=NULL)
+ if(comm->leaders_map !=nullptr)
xbt_free(comm->leaders_map);
}
int intra_comm_size = 0;
int i =0;
int min_index=INT_MAX;//the minimum index will be the leader
- smx_process_t process = NULL;
+ smx_process_t process = nullptr;
xbt_swag_foreach(process, process_list) {
int index = SIMIX_process_get_PID(process) -1;
XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
MPI_Group group_intra = smpi_group_new(intra_comm_size);
i=0;
- process = NULL;
+ process = nullptr;
xbt_swag_foreach(process, process_list) {
int index = SIMIX_process_get_PID(process) -1;
if(smpi_group_rank(smpi_comm_group(comm), index)!=MPI_UNDEFINED){
}
}
- MPI_Comm comm_intra = smpi_comm_new(group_intra, NULL);
+ MPI_Comm comm_intra = smpi_comm_new(group_intra, nullptr);
leader=min_index;
int * leaders_map= static_cast<int*>(xbt_malloc0(sizeof(int)*comm_size));
smpi_switch_data_segment(smpi_process_index());
}
- if(comm->leaders_map==NULL){
+ if(comm->leaders_map==nullptr){
comm->leaders_map= leaders_map;
}else{
xbt_free(leaders_map);
//create leader_communicator
for (i=0; i< leader_group_size;i++)
smpi_group_set_mapping(leaders_group, leader_list[i], i);
- leader_comm = smpi_comm_new(leaders_group, NULL);
+ leader_comm = smpi_comm_new(leaders_group, nullptr);
smpi_comm_set_leaders_comm(comm, leader_comm);
smpi_comm_set_intra_comm(comm, comm_intra);
smpi_group_set_mapping(leaders_group, leader_list[i], i);
if(smpi_comm_get_leaders_comm(comm)==MPI_COMM_NULL){
- leader_comm = smpi_comm_new(leaders_group, NULL);
+ leader_comm = smpi_comm_new(leaders_group, nullptr);
smpi_comm_set_leaders_comm(comm, leader_comm);
}else{
leader_comm=smpi_comm_get_leaders_comm(comm);
int smpi_comm_attr_delete(MPI_Comm comm, int keyval){
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
if(elem->delete_fn!=MPI_NULL_DELETE_FN){
void * value;
return ret;
}
}
- if(comm->attributes==NULL)
+ if(comm->attributes==nullptr)
return MPI_ERR_ARG;
xbt_dict_remove_ext(comm->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int));
int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
xbt_ex_t ex;
- if(comm->attributes==NULL){
+ if(comm->attributes==nullptr){
*flag=0;
return MPI_SUCCESS;
}
}
int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){
- if(smpi_comm_keyvals==NULL)
+ if(smpi_comm_keyvals==nullptr)
smpi_comm_keyvals = xbt_dict_new();
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
int flag;
void* value;
if(ret!=MPI_SUCCESS)
return ret;
}
- if(comm->attributes==NULL)
+ if(comm->attributes==nullptr)
comm->attributes=xbt_dict_new();
- xbt_dict_set_ext(comm->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, NULL);
+ xbt_dict_set_ext(comm->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, nullptr);
return MPI_SUCCESS;
}
int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
void* extra_state){
- if(smpi_comm_keyvals==NULL)
+ if(smpi_comm_keyvals==nullptr)
smpi_comm_keyvals = xbt_dict_new();
smpi_comm_key_elem value = static_cast<smpi_comm_key_elem>(xbt_new0(s_smpi_mpi_comm_key_elem_t,1));
value->delete_fn=delete_fn;
*keyval = comm_keyval_id;
- xbt_dict_set_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(keyval), sizeof(int),static_cast<void*>(value), NULL);
+ xbt_dict_set_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(keyval), sizeof(int),static_cast<void*>(value), nullptr);
comm_keyval_id++;
return MPI_SUCCESS;
}
int smpi_comm_keyval_free(int* keyval){
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
xbt_dict_remove_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(keyval), sizeof(int));
xbt_free(elem);
#include "xbt/log.h"
#include "xbt/dict.h"
-static xbt_dict_t smpi_instances = NULL;
+static xbt_dict_t smpi_instances = nullptr;
extern int process_count;
extern int* index_to_process_data;
process_count+=num_processes;
- if(smpi_instances==NULL){
+ if(smpi_instances==nullptr){
smpi_instances = xbt_dict_new_homogeneous(xbt_free_f);
}
- xbt_dict_set(smpi_instances, name, (void*)instance, NULL);
+ xbt_dict_set(smpi_instances, name, (void*)instance, nullptr);
return;
}
//get the index of the process in the process_data array
void smpi_deployment_register_process(const char* instance_id, int rank, int index,MPI_Comm** comm, xbt_bar_t* bar){
- if(smpi_instances==NULL){//no instance registered, we probably used smpirun.
+ if(smpi_instances==nullptr){//no instance registered, we probably used smpirun.
index_to_process_data[index]=index;
- *bar = NULL;
- *comm = NULL;
+ *bar = nullptr;
+ *comm = nullptr;
return;
}
if(instance->comm_world == MPI_COMM_NULL){
MPI_Group group = smpi_group_new(instance->size);
- instance->comm_world = smpi_comm_new(group, NULL);
+ instance->comm_world = smpi_comm_new(group, nullptr);
}
instance->present_processes++;
index_to_process_data[index]=instance->index+rank;
}
void smpi_deployment_cleanup_instances(){
- xbt_dict_cursor_t cursor = NULL;
- s_smpi_mpi_instance_t* instance = NULL;
- char *name = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
+ s_smpi_mpi_instance_t* instance = nullptr;
+ char *name = nullptr;
xbt_dict_foreach(smpi_instances, cursor, name, instance) {
if(instance->comm_world!=MPI_COMM_NULL)
while (smpi_group_unuse(smpi_comm_group(instance->comm_world)) > 0);
#include "private.h"
#include "xbt.h"
-static xbt_dict_t comm_lookup = NULL;
-static xbt_dict_t group_lookup = NULL;
-static xbt_dict_t request_lookup = NULL;
-static xbt_dict_t datatype_lookup = NULL;
-static xbt_dict_t op_lookup = NULL;
-static xbt_dict_t win_lookup = NULL;
-static xbt_dict_t info_lookup = NULL;
+static xbt_dict_t comm_lookup = nullptr;
+static xbt_dict_t group_lookup = nullptr;
+static xbt_dict_t request_lookup = nullptr;
+static xbt_dict_t datatype_lookup = nullptr;
+static xbt_dict_t op_lookup = nullptr;
+static xbt_dict_t win_lookup = nullptr;
+static xbt_dict_t info_lookup = nullptr;
static int running_processes = 0;
}
static void smpi_init_fortran_types(){
- if(comm_lookup == NULL){
- comm_lookup = xbt_dict_new_homogeneous(NULL);
+ if(comm_lookup == nullptr){
+ comm_lookup = xbt_dict_new_homogeneous(nullptr);
smpi_comm_c2f(MPI_COMM_WORLD);
- group_lookup = xbt_dict_new_homogeneous(NULL);
- request_lookup = xbt_dict_new_homogeneous(NULL);
- datatype_lookup = xbt_dict_new_homogeneous(NULL);
- win_lookup = xbt_dict_new_homogeneous(NULL);
- info_lookup = xbt_dict_new_homogeneous(NULL);
+ group_lookup = xbt_dict_new_homogeneous(nullptr);
+ request_lookup = xbt_dict_new_homogeneous(nullptr);
+ datatype_lookup = xbt_dict_new_homogeneous(nullptr);
+ win_lookup = xbt_dict_new_homogeneous(nullptr);
+ info_lookup = xbt_dict_new_homogeneous(nullptr);
smpi_type_c2f(MPI_BYTE);//MPI_BYTE
smpi_type_c2f(MPI_CHAR);//MPI_CHARACTER
#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
smpi_type_c2f(MPI_DATATYPE_NULL);//MPI_COMPLEX16
smpi_type_c2f(MPI_DATATYPE_NULL);//MPI_COMPLEX32
smpi_type_c2f(MPI_DATATYPE_NULL);//MPI_PACKED
- op_lookup = xbt_dict_new_homogeneous(NULL);
+ op_lookup = xbt_dict_new_homogeneous(nullptr);
smpi_op_c2f(MPI_MAX);
smpi_op_c2f(MPI_MIN);
smpi_op_c2f(MPI_MAXLOC);
int smpi_comm_c2f(MPI_Comm comm) {
static int comm_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(comm_lookup, comm==MPI_COMM_WORLD? get_key(key, comm_id) : get_key_id(key, comm_id), comm, NULL);
+ xbt_dict_set(comm_lookup, comm==MPI_COMM_WORLD? get_key(key, comm_id) : get_key_id(key, comm_id), comm, nullptr);
comm_id++;
return comm_id-1;
}
return MPI_COMM_SELF;
} else if(comm==0){
return MPI_COMM_WORLD;
- } else if(comm_lookup != NULL && comm >= 0) {
+ } else if(comm_lookup != nullptr && comm >= 0) {
char key[KEY_SIZE];
MPI_Comm tmp = static_cast<MPI_Comm>(xbt_dict_get_or_null(comm_lookup,get_key_id(key, comm)));
- return tmp != NULL ? tmp : MPI_COMM_NULL ;
+ return tmp != nullptr ? tmp : MPI_COMM_NULL ;
} else {
return MPI_COMM_NULL;
}
int smpi_group_c2f(MPI_Group group) {
static int group_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(group_lookup, get_key(key, group_id), group, NULL);
+ xbt_dict_set(group_lookup, get_key(key, group_id), group, nullptr);
group_id++;
return group_id-1;
}
smpi_init_fortran_types();
if(group == -2) {
return MPI_GROUP_EMPTY;
- } else if(group_lookup != NULL && group >= 0) {
+ } else if(group_lookup != nullptr && group >= 0) {
char key[KEY_SIZE];
return static_cast<MPI_Group>(xbt_dict_get_or_null(group_lookup, get_key(key, group)));
} else {
int smpi_request_c2f(MPI_Request req) {
static int request_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(request_lookup, get_key_id(key, request_id), req, NULL);
+ xbt_dict_set(request_lookup, get_key_id(key, request_id), req, nullptr);
request_id++;
return request_id-1;
}
int smpi_type_c2f(MPI_Datatype datatype) {
static int datatype_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(datatype_lookup, get_key(key, datatype_id), datatype, NULL);
+ xbt_dict_set(datatype_lookup, get_key(key, datatype_id), datatype, nullptr);
datatype_id++;
return datatype_id-1;
}
int smpi_op_c2f(MPI_Op op) {
static int op_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(op_lookup, get_key(key, op_id), op, NULL);
+ xbt_dict_set(op_lookup, get_key(key, op_id), op, nullptr);
op_id++;
return op_id-1;
}
int smpi_win_c2f(MPI_Win win) {
static int win_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(win_lookup, get_key(key, win_id), win, NULL);
+ xbt_dict_set(win_lookup, get_key(key, win_id), win, nullptr);
win_id++;
return win_id-1;
}
int smpi_info_c2f(MPI_Info info) {
static int info_id = 0;
char key[KEY_SIZE];
- xbt_dict_set(info_lookup, get_key(key, info_id), info, NULL);
+ xbt_dict_set(info_lookup, get_key(key, info_id), info, nullptr);
info_id++;
return info_id-1;
}
void mpi_init_(int* ierr) {
smpi_init_fortran_types();
- *ierr = MPI_Init(NULL, NULL);
+ *ierr = MPI_Init(nullptr, nullptr);
running_processes++;
}
void mpi_init_thread_ (int* required, int *provided, int* ierr){
smpi_init_fortran_types();
- *ierr = MPI_Init_thread(NULL, NULL,*required, provided);
+ *ierr = MPI_Init_thread(nullptr, nullptr,*required, provided);
running_processes++;
}
void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int* intercomm,
int* array_of_errcodes, int* ierr){
MPI_Comm tmp;
- *ierr = MPI_Comm_spawn( command, NULL, *maxprocs, *reinterpret_cast<MPI_Info*>(info), *root, smpi_comm_f2c(*comm), &tmp,
+ *ierr = MPI_Comm_spawn( command, nullptr, *maxprocs, *reinterpret_cast<MPI_Info*>(info), *root, smpi_comm_f2c(*comm), &tmp,
array_of_errcodes);
if(*ierr == MPI_SUCCESS) {
*intercomm = smpi_comm_c2f(tmp);
smpi_trace_call_location_t* trace_call_loc;
} s_smpi_process_data_t;
-static smpi_process_data_t *process_data = NULL;
+static smpi_process_data_t *process_data = nullptr;
int process_count = 0;
int smpi_universe_size = 0;
-int* index_to_process_data = NULL;
+int* index_to_process_data = nullptr;
extern double smpi_total_benched_time;
xbt_os_timer_t global_timer;
MPI_Comm MPI_COMM_WORLD = MPI_COMM_UNINITIALIZED;
-MPI_Errhandler *MPI_ERRORS_RETURN = NULL;
-MPI_Errhandler *MPI_ERRORS_ARE_FATAL = NULL;
-MPI_Errhandler *MPI_ERRHANDLER_NULL = NULL;
+MPI_Errhandler *MPI_ERRORS_RETURN = nullptr;
+MPI_Errhandler *MPI_ERRORS_ARE_FATAL = nullptr;
+MPI_Errhandler *MPI_ERRHANDLER_NULL = nullptr;
#define MAILBOX_NAME_MAXLEN (5 + sizeof(int) * 2 + 1)
smpi_process_data_t data;
smx_process_t proc;
- if (argc != NULL && argv != NULL) {
+ if (argc != nullptr && argv != nullptr) {
proc = SIMIX_process_self();
SIMIX_process_set_cleanup_function(proc, MSG_process_cleanup_from_SIMIX);
char* instance_id = (*argv)[1];
int rank = xbt_str_parse_int((*argv)[2], "Invalid rank: %s");
index = smpi_process_index_of_smx_process(proc);
- if(index_to_process_data == NULL){
+ if(index_to_process_data == nullptr){
index_to_process_data=static_cast<int*>(xbt_malloc(SIMIX_process_count()*sizeof(int)));
}
smpi_deployment_register_process(instance_id, rank, index, &temp_comm_world, &temp_bar);
data = smpi_process_remote_data(index);
data->comm_world = temp_comm_world;
- if(temp_bar != NULL)
+ if(temp_bar != nullptr)
data->finalization_barrier = temp_bar;
data->index = index;
data->instance_id = instance_id;
if (*argc > 3) {
free((*argv)[1]);
memmove(&(*argv)[0], &(*argv)[2], sizeof(char *) * (*argc - 2));
- (*argv)[(*argc) - 1] = NULL;
- (*argv)[(*argc) - 2] = NULL;
+ (*argv)[(*argc) - 1] = nullptr;
+ (*argv)[(*argc) - 2] = nullptr;
}
(*argc)-=2;
data->argc = argc;
XBT_DEBUG("<%d> New process in the game: %p", index, proc);
}
xbt_assert(smpi_process_data(),
- "smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by "
+ "smpi_process_data() returned nullptr. You probably gave a nullptr parameter to MPI_Init. Although it's required by "
"MPI-2, this is currently not supported by SMPI.");
}
/** @brief Check if a process is initialized */
int smpi_process_initialized()
{
- if (index_to_process_data == NULL){
+ if (index_to_process_data == nullptr){
return false;
} else{
int index = smpi_process_index();
{
smpi_process_data_t data = smpi_process_data();
//return -1 if not initialized
- return data != NULL ? data->index : MPI_UNDEFINED;
+ return data != nullptr ? data->index : MPI_UNDEFINED;
}
MPI_Comm smpi_process_comm_world()
{
smpi_process_data_t data = smpi_process_data();
//return MPI_COMM_NULL if not initialized
- return data != NULL ? *data->comm_world : MPI_COMM_NULL;
+ return data != nullptr ? *data->comm_world : MPI_COMM_NULL;
}
smx_mailbox_t smpi_process_mailbox()
smpi_process_data_t data = smpi_process_data();
if(data->comm_self==MPI_COMM_NULL){
MPI_Group group = smpi_group_new(1);
- data->comm_self = smpi_comm_new(group, NULL);
+ data->comm_self = smpi_comm_new(group, nullptr);
smpi_group_set_mapping(group, smpi_process_index(), 0);
}
xbt_free(buff);
//It seems that the request is used after the call there this should be free somewhere else but where???
//xbt_free(comm->comm.src_data);// inside SMPI the request is kept inside the user data and should be free
- comm->src_buff = NULL;
+ comm->src_buff = nullptr;
}
if(tmpbuff!=buff)xbt_free(tmpbuff);
}
int smpi_enabled() {
- return process_data != NULL;
+ return process_data != nullptr;
}
void smpi_global_init()
process_data = xbt_new0(smpi_process_data_t, process_count);
for (i = 0; i < process_count; i++) {
process_data[i] = xbt_new(s_smpi_process_data_t, 1);
- process_data[i]->argc = NULL;
- process_data[i]->argv = NULL;
+ process_data[i]->argc = nullptr;
+ process_data[i]->argv = nullptr;
process_data[i]->mailbox = simcall_mbox_create(get_mailbox_name(name, i));
process_data[i]->mailbox_small = simcall_mbox_create(get_mailbox_name_small(name, i));
process_data[i]->mailboxes_mutex = xbt_mutex_init();
MC_ignore_heap(process_data[i]->timer, xbt_os_timer_size());
process_data[i]->comm_self = MPI_COMM_NULL;
process_data[i]->comm_intra = MPI_COMM_NULL;
- process_data[i]->comm_world = NULL;
+ process_data[i]->comm_world = nullptr;
process_data[i]->state = SMPI_UNINITIALIZED;
process_data[i]->sampling = 0;
- process_data[i]->finalization_barrier = NULL;
+ process_data[i]->finalization_barrier = nullptr;
process_data[i]->return_value = 0;
if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
//if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
if(smpirun){
group = smpi_group_new(process_count);
- MPI_COMM_WORLD = smpi_comm_new(group, NULL);
+ MPI_COMM_WORLD = smpi_comm_new(group, nullptr);
MPI_Attr_put(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE, reinterpret_cast<void *>(process_count));
xbt_bar_t bar=xbt_barrier_init(process_count);
xbt_free(process_data[i]);
}
xbt_free(process_data);
- process_data = NULL;
+ process_data = nullptr;
if (MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED){
smpi_comm_cleanup_smp(MPI_COMM_WORLD);
smpi_comm_cleanup_attributes(MPI_COMM_WORLD);
- if(smpi_coll_cleanup_callback!=NULL)
+ if(smpi_coll_cleanup_callback!=nullptr)
smpi_coll_cleanup_callback();
xbt_free(MPI_COMM_WORLD);
}
mpi_coll_barrier_fun = reinterpret_cast<int (*)(MPI_Comm comm)>
(mpi_coll_barrier_description[barrier_id].coll);
- smpi_coll_cleanup_callback=NULL;
+ smpi_coll_cleanup_callback=nullptr;
smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
smpi_running_power = xbt_cfg_get_double("smpi/running-power");
smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables");
{
srand(SMPI_RAND_SEED);
- if (getenv("SMPI_PRETEND_CC") != NULL) {
+ if (getenv("SMPI_PRETEND_CC") != nullptr) {
/* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the
* configuration tools */
return 0;
static s_smpi_mpi_group_t mpi_MPI_GROUP_EMPTY = {
0, /* size */
- NULL, /* rank_to_index_map */
- NULL, /* index_to_rank_map */
+ nullptr, /* rank_to_index_map */
+ nullptr, /* index_to_rank_map */
1, /* refcount: start > 0 so that this group never gets freed */
};
MPI_Group group=origin;
char *key;
char *ptr_rank;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
int i;
if(origin != MPI_GROUP_NULL
xbt_dict_foreach(origin->index_to_rank_map, cursor, key, ptr_rank) {
int * cp = static_cast<int*>(xbt_malloc(sizeof(int)));
*cp=*reinterpret_cast<int*>(ptr_rank);
- xbt_dict_set(group->index_to_rank_map, key, cp, NULL);
+ xbt_dict_set(group->index_to_rank_map, key, cp, nullptr);
}
}
*val_rank = rank;
char * key = bprintf("%d", index);
- xbt_dict_set(group->index_to_rank_map, key, val_rank, NULL);
+ xbt_dict_set(group->index_to_rank_map, key, val_rank, nullptr);
xbt_free(key);
}
}
int smpi_group_rank(MPI_Group group, int index)
{
- int * ptr_rank = NULL;
+ int * ptr_rank = nullptr;
char * key = bprintf("%d", index);
ptr_rank = static_cast<int*>(xbt_dict_get_or_null(group->index_to_rank_map, key));
xbt_free(key);
- if (ptr_rank==NULL)
+ if (ptr_rank==nullptr)
return MPI_UNDEFINED;
return *ptr_rank;
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi, "Logging specific to SMPI (datatype)");
-xbt_dict_t smpi_type_keyvals = NULL;
+xbt_dict_t smpi_type_keyvals = nullptr;
int type_keyval_id=0;//avoid collisions
#define CREATE_MPI_DATATYPE(name, type) \
0, /* lb */ \
sizeof(type), /* ub = lb + size */ \
DT_FLAG_BASIC, /* flags */ \
- NULL, /* attributes */ \
- NULL, /* pointer on extended struct*/ \
+ nullptr, /* attributes */ \
+ nullptr, /* pointer on extended struct*/ \
0 /* in_use counter */ \
}; \
const MPI_Datatype name = &mpi_##name;
0, /* lb */ \
0, /* ub = lb + size */ \
DT_FLAG_BASIC, /* flags */ \
- NULL, /* attributes */ \
- NULL, /* pointer on extended struct*/ \
+ nullptr, /* attributes */ \
+ nullptr, /* pointer on extended struct*/ \
0 /* in_use counter */ \
}; \
const MPI_Datatype name = &mpi_##name;
}
if(datatype->name)
(*new_t)->name = xbt_strdup(datatype->name);
- if(datatype->attributes !=NULL){
+ if(datatype->attributes !=nullptr){
(*new_t)->attributes=xbt_dict_new();
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
int *key;
int flag;
void* value_in;
xbt_dict_foreach(datatype->attributes, cursor, key, value_in){
smpi_type_key_elem elem =
static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(key), sizeof(int)));
- if(elem != NULL && elem->copy_fn!=MPI_NULL_COPY_FN){
- ret = elem->copy_fn(datatype, *key, NULL, value_in, &value_out, &flag );
+ if(elem != nullptr && elem->copy_fn!=MPI_NULL_COPY_FN){
+ ret = elem->copy_fn(datatype, *key, nullptr, value_in, &value_out, &flag );
if(ret!=MPI_SUCCESS){
smpi_datatype_unuse(*new_t);
*new_t=MPI_DATATYPE_NULL;
return ret;
}
if(flag)
- xbt_dict_set_ext((*new_t)->attributes, reinterpret_cast<const char*>(key), sizeof(int),value_out, NULL);
+ xbt_dict_set_ext((*new_t)->attributes, reinterpret_cast<const char*>(key), sizeof(int),value_out, nullptr);
}
}
}
}
void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
- if(datatype->name!=NULL && (datatype->flags & DT_FLAG_PREDEFINED) == 0)
+ if(datatype->name!=nullptr && (datatype->flags & DT_FLAG_PREDEFINED) == 0)
xbt_free(datatype->name);
datatype->name = xbt_strdup(name);
}
void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int sizeof_substruct, void *struct_type,
int flags){
MPI_Datatype new_t= xbt_new(s_smpi_mpi_datatype_t,1);
- new_t->name = NULL;
+ new_t->name = nullptr;
new_t->size = size;
new_t->sizeof_substruct = size>0? sizeof_substruct:0;
new_t->lb = lb;
new_t->flags = flags;
new_t->substruct = struct_type;
new_t->in_use=1;
- new_t->attributes=NULL;
+ new_t->attributes=nullptr;
*new_type = new_t;
#if HAVE_MC
return;
}
- if((*type)->attributes !=NULL){
- xbt_dict_cursor_t cursor = NULL;
+ if((*type)->attributes !=nullptr){
+ xbt_dict_cursor_t cursor = nullptr;
int* key;
void * value;
int flag;
xbt_dict_foreach((*type)->attributes, cursor, key, value){
smpi_type_key_elem elem =
static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(key), sizeof(int)));
- if(elem!=NULL && elem->delete_fn!=NULL)
+ if(elem!=nullptr && elem->delete_fn!=nullptr)
elem->delete_fn(*type,*key, value, &flag);
}
xbt_dict_free(&(*type)->attributes);
s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count, MPI_Datatype old_type,
int size_oldtype){
if(block_count==0)
- return NULL;
+ return nullptr;
s_smpi_mpi_contiguous_t *new_t= xbt_new(s_smpi_mpi_contiguous_t,1);
new_t->base.serialize = &serialize_contiguous;
new_t->base.unserialize = &unserialize_contiguous;
}else{
/* in this situation the data are contignous thus it's not required to serialize and unserialize it*/
smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
- smpi_datatype_size(old_type), 0, NULL, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+ smpi_datatype_size(old_type), 0, nullptr, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
retval=MPI_SUCCESS;
}
return retval;
retval=MPI_SUCCESS;
}else{
smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),0,count * blocklen *
- smpi_datatype_size(old_type), 0, NULL, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+ smpi_datatype_size(old_type), 0, nullptr, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
retval=MPI_SUCCESS;
}
return retval;
int smpi_type_attr_delete(MPI_Datatype type, int keyval){
smpi_type_key_elem elem =
static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
if(elem->delete_fn!=MPI_NULL_DELETE_FN){
void * value;
return ret;
}
}
- if(type->attributes==NULL)
+ if(type->attributes==nullptr)
return MPI_ERR_ARG;
xbt_dict_remove_ext(type->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int));
int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag){
smpi_type_key_elem elem =
static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
xbt_ex_t ex;
- if(type->attributes==NULL){
+ if(type->attributes==nullptr){
*flag=0;
return MPI_SUCCESS;
}
}
int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){
- if(smpi_type_keyvals==NULL)
+ if(smpi_type_keyvals==nullptr)
smpi_type_keyvals = xbt_dict_new();
smpi_type_key_elem elem =
static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
- if(elem==NULL)
+ if(elem==nullptr)
return MPI_ERR_ARG;
int flag;
void* value;
if(ret!=MPI_SUCCESS)
return ret;
}
- if(type->attributes==NULL)
+ if(type->attributes==nullptr)
type->attributes=xbt_dict_new();
- xbt_dict_set_ext(type->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, NULL);
+ xbt_dict_set_ext(type->attributes, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, nullptr);
return MPI_SUCCESS;
}
int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
void* extra_state){
- if(smpi_type_keyvals==NULL)
+ if(smpi_type_keyvals==nullptr)
smpi_type_keyvals = xbt_dict_new();
smpi_type_key_elem value = (smpi_type_key_elem) xbt_new0(s_smpi_mpi_type_key_elem_t,1);
value->delete_fn=delete_fn;
*keyval = type_keyval_id;
- xbt_dict_set_ext(smpi_type_keyvals,reinterpret_cast<const char*>(keyval), sizeof(int),reinterpret_cast<void*>(value), NULL);
+ xbt_dict_set_ext(smpi_type_keyvals,reinterpret_cast<const char*>(keyval), sizeof(int),reinterpret_cast<void*>(value), nullptr);
type_keyval_id++;
return MPI_SUCCESS;
}
int PMPI_Init_thread(int *argc, char ***argv, int required, int *provided)
{
- if (provided != NULL) {
+ if (provided != nullptr) {
*provided = MPI_THREAD_SINGLE;
}
return MPI_Init(argc, argv);
{
int retval = 0;
- if (provided == NULL) {
+ if (provided == nullptr) {
retval = MPI_ERR_ARG;
} else {
*provided = MPI_THREAD_SINGLE;
{
int retval = 0;
- if (flag == NULL) {
+ if (flag == nullptr) {
retval = MPI_ERR_ARG;
} else {
*flag = smpi_process_index() == 0;
{
int retval = 0;
- if (address==NULL) {
+ if (address==nullptr) {
retval = MPI_ERR_ARG;
} else {
*address = reinterpret_cast<MPI_Aint>(location);
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (size == NULL) {
+ } else if (size == nullptr) {
retval = MPI_ERR_ARG;
} else {
*size = static_cast<int>(smpi_datatype_size(datatype));
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (lb == NULL || extent == NULL) {
+ } else if (lb == nullptr || extent == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = smpi_datatype_extent(datatype, lb, extent);
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (extent == NULL) {
+ } else if (extent == nullptr) {
retval = MPI_ERR_ARG;
} else {
*extent = smpi_datatype_get_extent(datatype);
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (disp == NULL) {
+ } else if (disp == nullptr) {
retval = MPI_ERR_ARG;
} else {
*disp = smpi_datatype_lb(datatype);
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (disp == NULL) {
+ } else if (disp == nullptr) {
retval = MPI_ERR_ARG;
} else {
*disp = smpi_datatype_ub(datatype);
{
int retval = 0;
- if (function == NULL || op == NULL) {
+ if (function == nullptr || op == nullptr) {
retval = MPI_ERR_ARG;
} else {
*op = smpi_op_new(function, (commute!=0));
{
int retval = 0;
- if (op == NULL) {
+ if (op == nullptr) {
retval = MPI_ERR_ARG;
} else if (*op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
{
int retval = 0;
- if (group == NULL) {
+ if (group == nullptr) {
retval = MPI_ERR_ARG;
} else {
smpi_group_destroy(*group);
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (size == NULL) {
+ } else if (size == nullptr) {
retval = MPI_ERR_ARG;
} else {
*size = smpi_group_size(group);
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (rank == NULL) {
+ } else if (rank == nullptr) {
retval = MPI_ERR_ARG;
} else {
*rank = smpi_group_rank(group, smpi_process_index());
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (result == NULL) {
+ } else if (result == nullptr) {
retval = MPI_ERR_ARG;
} else {
*result = smpi_group_compare(group1, group2);
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
size = smpi_group_size(group1);
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
size = smpi_group_size(group2);
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
size = smpi_group_size(group1);
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = smpi_group_incl(group, n, ranks, newgroup);
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
if (n == 0) {
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
if (n == 0) {
if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newgroup == NULL) {
+ } else if (newgroup == nullptr) {
retval = MPI_ERR_ARG;
} else {
if (n == 0) {
int retval = 0;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (rank == NULL) {
+ } else if (rank == nullptr) {
retval = MPI_ERR_ARG;
} else {
*rank = smpi_comm_rank(comm);
int retval = 0;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (size == NULL) {
+ } else if (size == nullptr) {
retval = MPI_ERR_ARG;
} else {
*size = smpi_comm_size(comm);
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (name == NULL || len == NULL) {
+ } else if (name == nullptr || len == nullptr) {
retval = MPI_ERR_ARG;
} else {
smpi_comm_get_name(comm, name, len);
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (group == NULL) {
+ } else if (group == nullptr) {
retval = MPI_ERR_ARG;
} else {
*group = smpi_comm_group(comm);
if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (result == NULL) {
+ } else if (result == nullptr) {
retval = MPI_ERR_ARG;
} else {
if (comm1 == comm2) { /* Same communicators means same groups */
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (newcomm == NULL) {
+ } else if (newcomm == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = smpi_comm_dup(comm, newcomm);
retval = MPI_ERR_COMM;
} else if (group == MPI_GROUP_NULL) {
retval = MPI_ERR_GROUP;
- } else if (newcomm == NULL) {
+ } else if (newcomm == nullptr) {
retval = MPI_ERR_ARG;
} else if(smpi_group_rank(group,smpi_process_index())==MPI_UNDEFINED){
*newcomm= MPI_COMM_NULL;
retval = MPI_SUCCESS;
}else{
smpi_group_use(group);
- *newcomm = smpi_comm_new(group, NULL);
+ *newcomm = smpi_comm_new(group, nullptr);
retval = MPI_SUCCESS;
}
return retval;
{
int retval = 0;
- if (comm == NULL) {
+ if (comm == nullptr) {
retval = MPI_ERR_ARG;
} else if (*comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
/* TODO: wait until all communication in comm are done */
int retval = 0;
- if (comm == NULL) {
+ if (comm == nullptr) {
retval = MPI_ERR_ARG;
} else if (*comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
int retval = 0;
smpi_bench_end();
- if (comm_out == NULL) {
+ if (comm_out == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
int retval = 0;
smpi_bench_end();
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
retval = MPI_SUCCESS;
}
smpi_bench_begin();
- if (retval != MPI_SUCCESS && request != NULL)
+ if (retval != MPI_SUCCESS && request != nullptr)
*request = MPI_REQUEST_NULL;
return retval;
}
int retval = 0;
smpi_bench_end();
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
retval = MPI_SUCCESS;
}
smpi_bench_begin();
- if (retval != MPI_SUCCESS && request != NULL)
+ if (retval != MPI_SUCCESS && request != nullptr)
*request = MPI_REQUEST_NULL;
return retval;
}
int retval = 0;
smpi_bench_end();
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
retval = MPI_SUCCESS;
}
smpi_bench_begin();
- if (retval != MPI_SUCCESS && request != NULL)
+ if (retval != MPI_SUCCESS && request != nullptr)
*request = MPI_REQUEST_NULL;
return retval;
}
int retval = 0;
smpi_bench_end();
- if (request == NULL || *request == MPI_REQUEST_NULL) {
+ if (request == nullptr || *request == MPI_REQUEST_NULL) {
retval = MPI_ERR_REQUEST;
} else {
smpi_mpi_start(*request);
int retval;
int i = 0;
smpi_bench_end();
- if (requests == NULL) {
+ if (requests == nullptr) {
retval = MPI_ERR_ARG;
} else {
retval = MPI_SUCCESS;
smpi_bench_end();
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
retval = MPI_SUCCESS;
} else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
retval = MPI_ERR_RANK;
- } else if ((count < 0) || (buf==NULL && count > 0)) {
+ } else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
} else if (!is_datatype_valid(datatype)) {
retval = MPI_ERR_TYPE;
}
smpi_bench_begin();
- if (retval != MPI_SUCCESS && request != NULL)
+ if (retval != MPI_SUCCESS && request != nullptr)
*request = MPI_REQUEST_NULL;
return retval;
}
int retval = 0;
smpi_bench_end();
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
retval = MPI_SUCCESS;
} else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
retval = MPI_ERR_RANK;
- } else if ((count < 0) || (buf==NULL && count > 0)) {
+ } else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
} else if (!is_datatype_valid(datatype)) {
retval = MPI_ERR_TYPE;
}
smpi_bench_begin();
- if (retval != MPI_SUCCESS && request!=NULL)
+ if (retval != MPI_SUCCESS && request!=nullptr)
*request = MPI_REQUEST_NULL;
return retval;
}
int retval = 0;
smpi_bench_end();
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
retval = MPI_SUCCESS;
} else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
retval = MPI_ERR_RANK;
- } else if ((count < 0)|| (buf==NULL && count > 0)) {
+ } else if ((count < 0)|| (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
} else if (!is_datatype_valid(datatype)) {
retval = MPI_ERR_TYPE;
}
smpi_bench_begin();
- if (retval != MPI_SUCCESS && request!=NULL)
+ if (retval != MPI_SUCCESS && request!=nullptr)
*request = MPI_REQUEST_NULL;
return retval;
}
retval = MPI_SUCCESS;
} else if (src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0)){
retval = MPI_ERR_RANK;
- } else if ((count < 0) || (buf==NULL && count > 0)) {
+ } else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
} else if (!is_datatype_valid(datatype)) {
retval = MPI_ERR_TYPE;
retval = MPI_SUCCESS;
} else if (dst >= smpi_group_size(smpi_comm_group(comm)) || dst <0){
retval = MPI_ERR_RANK;
- } else if ((count < 0) || (buf==NULL && count > 0)) {
+ } else if ((count < 0) || (buf==nullptr && count > 0)) {
retval = MPI_ERR_COUNT;
} else if (!is_datatype_valid(datatype)){
retval = MPI_ERR_TYPE;
(src!=MPI_ANY_SOURCE && (src >= smpi_group_size(smpi_comm_group(comm)) || src <0))){
retval = MPI_ERR_RANK;
} else if ((sendcount < 0 || recvcount<0) ||
- (sendbuf==NULL && sendcount > 0) || (recvbuf==NULL && recvcount>0)) {
+ (sendbuf==nullptr && sendcount > 0) || (recvbuf==nullptr && recvcount>0)) {
retval = MPI_ERR_COUNT;
} else if((sendtag<0 && sendtag != MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
retval = MPI_ERR_TAG;
{
int retval = 0;
smpi_bench_end();
- if (request == NULL || flag == NULL) {
+ if (request == nullptr || flag == nullptr) {
retval = MPI_ERR_ARG;
} else if (*request == MPI_REQUEST_NULL) {
*flag= true;
smpi_empty_status(status);
retval = MPI_SUCCESS;
} else {
- int rank = (request!=NULL && (*request)->comm != MPI_COMM_NULL) ? smpi_process_index() : -1;
+ int rank = (request!=nullptr && (*request)->comm != MPI_COMM_NULL) ? smpi_process_index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_TEST;
int retval = 0;
smpi_bench_end();
- if (index == NULL || flag == NULL) {
+ if (index == nullptr || flag == nullptr) {
retval = MPI_ERR_ARG;
} else {
*flag = smpi_mpi_testany(count, requests, index, status);
int retval = 0;
smpi_bench_end();
- if (flag == NULL) {
+ if (flag == nullptr) {
retval = MPI_ERR_ARG;
} else {
*flag = smpi_mpi_testall(count, requests, statuses);
int retval = 0;
smpi_bench_end();
- if (status == NULL) {
+ if (status == nullptr) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
int retval = 0;
smpi_bench_end();
- if ((flag == NULL) || (status == NULL)) {
+ if ((flag == nullptr) || (status == nullptr)) {
retval = MPI_ERR_ARG;
} else if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
smpi_empty_status(status);
- if (request == NULL) {
+ if (request == nullptr) {
retval = MPI_ERR_ARG;
} else if (*request == MPI_REQUEST_NULL) {
retval = MPI_SUCCESS;
} else {
- int rank = (request!=NULL && (*request)->comm != MPI_COMM_NULL) ? smpi_process_index() : -1;
+ int rank = (request!=nullptr && (*request)->comm != MPI_COMM_NULL) ? smpi_process_index() : -1;
int src_traced = (*request)->src;
int dst_traced = (*request)->dst;
int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status)
{
- if (index == NULL)
+ if (index == nullptr)
return MPI_ERR_ARG;
smpi_bench_end();
//save requests information for tracing
int i;
- int *srcs = NULL, *dsts = NULL, *recvs = NULL;
- MPI_Comm* comms = NULL;
+ int *srcs = nullptr, *dsts = nullptr, *recvs = nullptr;
+ MPI_Comm* comms = nullptr;
if(count>0){
srcs = xbt_new0(int, count);
dsts = xbt_new0(int, count);
int retval = 0;
smpi_bench_end();
- if (outcount == NULL) {
+ if (outcount == nullptr) {
retval = MPI_ERR_ARG;
} else {
*outcount = smpi_mpi_waitsome(incount, requests, indices, status);
int retval = 0;
smpi_bench_end();
- if (outcount == NULL) {
+ if (outcount == nullptr) {
retval = MPI_ERR_ARG;
} else {
*outcount = smpi_mpi_testsome(incount, requests, indices, status);
retval = MPI_ERR_TYPE;
} else if (( sendbuf != MPI_IN_PLACE) && (sendcount <0)){
retval = MPI_ERR_COUNT;
- } else if (recvcounts == NULL || displs == NULL) {
+ } else if (recvcounts == nullptr || displs == nullptr) {
retval = MPI_ERR_ARG;
} else {
char* sendtmpbuf = static_cast<char*>(sendbuf);
retval = MPI_ERR_TYPE;
} else if (( sendbuf != MPI_IN_PLACE) && (sendcount <0)){
retval = MPI_ERR_COUNT;
- } else if (recvcounts == NULL || displs == NULL) {
+ } else if (recvcounts == nullptr || displs == nullptr) {
retval = MPI_ERR_ARG;
} else {
|| ((recvbuf !=MPI_IN_PLACE) && (!is_datatype_valid(recvtype)))){
retval = MPI_ERR_TYPE;
} else if ((sendbuf == recvbuf) ||
- ((smpi_comm_rank(comm)==root) && sendcount>0 && (sendbuf == NULL))){
+ ((smpi_comm_rank(comm)==root) && sendcount>0 && (sendbuf == nullptr))){
retval = MPI_ERR_BUFFER;
}else {
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (sendcounts == NULL || displs == NULL) {
+ } else if (sendcounts == nullptr || displs == nullptr) {
retval = MPI_ERR_ARG;
} else if (((smpi_comm_rank(comm)==root) && (sendtype == MPI_DATATYPE_NULL))
|| ((recvbuf !=MPI_IN_PLACE) && (recvtype == MPI_DATATYPE_NULL))) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
- } else if (recvcounts == NULL) {
+ } else if (recvcounts == nullptr) {
retval = MPI_ERR_ARG;
} else {
int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
retval = MPI_ERR_COMM;
} else if (sendtype == MPI_DATATYPE_NULL || recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL || recvdisps == NULL) {
+ } else if (sendcounts == nullptr || senddisps == nullptr || recvcounts == nullptr || recvdisps == nullptr) {
retval = MPI_ERR_ARG;
} else {
int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
int retval = MPI_SUCCESS;
size_t size;
- if (status == NULL || count == NULL) {
+ if (status == nullptr || count == nullptr) {
retval = MPI_ERR_ARG;
} else if (!is_datatype_valid(datatype)) {
retval = MPI_ERR_TYPE;
int PMPI_Type_commit(MPI_Datatype* datatype) {
int retval = 0;
- if (datatype == NULL || *datatype == MPI_DATATYPE_NULL) {
+ if (datatype == nullptr || *datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
} else {
smpi_datatype_commit(datatype);
return MPI_SUCCESS;
}
-/* The topo part of MPI_COMM_WORLD should always be NULL. When other topologies will be implemented, not only should we
- * check if the topology is NULL, but we should check if it is the good topology type (so we have to add a
+/* The topo part of MPI_COMM_WORLD should always be nullptr. When other topologies will be implemented, not only should we
+ * check if the topology is nullptr, but we should check if it is the good topology type (so we have to add a
* MPIR_Topo_Type field, and replace the MPI_Topology field by an union)*/
int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periodic, int reorder, MPI_Comm* comm_cart) {
int retval = 0;
if (comm_old == MPI_COMM_NULL){
retval = MPI_ERR_COMM;
- } else if (ndims < 0 || (ndims > 0 && (dims == NULL || periodic == NULL)) || comm_cart == NULL) {
+ } else if (ndims < 0 || (ndims > 0 && (dims == nullptr || periodic == nullptr)) || comm_cart == nullptr) {
retval = MPI_ERR_ARG;
} else{
retval = smpi_mpi_cart_create(comm_old, ndims, dims, periodic, reorder, comm_cart);
}
int PMPI_Cart_rank(MPI_Comm comm, int* coords, int* rank) {
- if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == nullptr) {
return MPI_ERR_TOPOLOGY;
}
- if (coords == NULL) {
+ if (coords == nullptr) {
return MPI_ERR_ARG;
}
return smpi_mpi_cart_rank(comm, coords, rank);
}
int PMPI_Cart_shift(MPI_Comm comm, int direction, int displ, int* source, int* dest) {
- if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == nullptr) {
return MPI_ERR_TOPOLOGY;
}
- if (source == NULL || dest == NULL || direction < 0 ) {
+ if (source == nullptr || dest == nullptr || direction < 0 ) {
return MPI_ERR_ARG;
}
return smpi_mpi_cart_shift(comm, direction, displ, source, dest);
}
int PMPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
- if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == nullptr) {
return MPI_ERR_TOPOLOGY;
}
if (rank < 0 || rank >= smpi_comm_size(comm)) {
if (maxdims <= 0) {
return MPI_ERR_ARG;
}
- if(coords == NULL) {
+ if(coords == nullptr) {
return MPI_ERR_ARG;
}
return smpi_mpi_cart_coords(comm, rank, maxdims, coords);
}
int PMPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
- if(comm == NULL || smpi_comm_topo(comm) == NULL) {
+ if(comm == nullptr || smpi_comm_topo(comm) == nullptr) {
return MPI_ERR_TOPOLOGY;
}
- if(maxdims <= 0 || dims == NULL || periods == NULL || coords == NULL) {
+ if(maxdims <= 0 || dims == nullptr || periods == nullptr || coords == nullptr) {
return MPI_ERR_ARG;
}
return smpi_mpi_cart_get(comm, maxdims, dims, periods, coords);
}
int PMPI_Cartdim_get(MPI_Comm comm, int* ndims) {
- if (comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ if (comm == MPI_COMM_NULL || smpi_comm_topo(comm) == nullptr) {
return MPI_ERR_TOPOLOGY;
}
- if (ndims == NULL) {
+ if (ndims == nullptr) {
return MPI_ERR_ARG;
}
return smpi_mpi_cartdim_get(comm, ndims);
}
int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
- if(dims == NULL) {
+ if(dims == nullptr) {
return MPI_ERR_ARG;
}
if (ndims < 1 || nnodes < 1) {
}
int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
- if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == nullptr) {
return MPI_ERR_TOPOLOGY;
}
- if (comm_new == NULL) {
+ if (comm_new == nullptr) {
return MPI_ERR_ARG;
}
return smpi_mpi_cart_sub(comm, remain_dims, comm_new);
smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval= MPI_ERR_COMM;
- }else if ((base == NULL && size != 0) || disp_unit <= 0 || size < 0 ){
+ }else if ((base == nullptr && size != 0) || disp_unit <= 0 || size < 0 ){
retval= MPI_ERR_OTHER;
}else{
*win = smpi_mpi_win_create( base, size, disp_unit, info, comm);
int PMPI_Win_free( MPI_Win* win){
int retval = 0;
smpi_bench_end();
- if (win == NULL || *win == MPI_WIN_NULL) {
+ if (win == nullptr || *win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
}else{
retval=smpi_mpi_win_free(win);
int retval = 0;
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_TYPE;
- } else if (name == NULL) {
+ } else if (name == nullptr) {
retval = MPI_ERR_ARG;
} else {
smpi_mpi_win_set_name(win, name);
if (win == MPI_WIN_NULL) {
retval = MPI_ERR_WIN;
- } else if (name == NULL) {
+ } else if (name == nullptr) {
retval = MPI_ERR_ARG;
} else {
smpi_mpi_win_get_name(win, name, len);
retval = MPI_ERR_WIN;
} else {
int rank = smpi_process_index();
- TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
+ TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = smpi_mpi_win_fence(assert, win);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
} else if (target_disp <0){
retval = MPI_ERR_ARG;
} else if ((origin_count < 0 || target_count < 0) ||
- (origin_addr==NULL && origin_count > 0)){
+ (origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
} else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
retval = MPI_ERR_TYPE;
MPI_Group group;
smpi_mpi_win_get_group(win, &group);
int src_traced = smpi_group_index(group, target_rank);
- TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL);
+ TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, nullptr);
retval = smpi_mpi_get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
target_datatype, win);
} else if (target_disp <0){
retval = MPI_ERR_ARG;
} else if ((origin_count < 0 || target_count < 0) ||
- (origin_addr==NULL && origin_count > 0)){
+ (origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
} else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
retval = MPI_ERR_TYPE;
MPI_Group group;
smpi_mpi_win_get_group(win, &group);
int dst_traced = smpi_group_index(group, target_rank);
- TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, NULL);
+ TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, nullptr);
TRACE_smpi_send(rank, rank, dst_traced, origin_count*smpi_datatype_size(origin_datatype));
retval = smpi_mpi_put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
} else if (target_disp <0){
retval = MPI_ERR_ARG;
} else if ((origin_count < 0 || target_count < 0) ||
- (origin_addr==NULL && origin_count > 0)){
+ (origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
} else if ((!is_datatype_valid(origin_datatype)) ||
(!is_datatype_valid(target_datatype))) {
MPI_Group group;
smpi_mpi_win_get_group(win, &group);
int src_traced = smpi_group_index(group, target_rank);
- TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL);
+ TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, nullptr);
retval = smpi_mpi_accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
target_datatype, op, win);
}
else {
int rank = smpi_process_index();
- TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
+ TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = smpi_mpi_win_post(group,assert,win);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
}
else {
int rank = smpi_process_index();
- TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
+ TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = smpi_mpi_win_start(group,assert,win);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
}
else {
int rank = smpi_process_index();
- TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
+ TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = smpi_mpi_win_complete(win);
}
else {
int rank = smpi_process_index();
- TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
+ TRACE_smpi_collective_in(rank, -1, __FUNCTION__, nullptr);
retval = smpi_mpi_win_wait(win);
int PMPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr){
void *ptr = xbt_malloc(size);
- if(ptr==NULL)
+ if(ptr==nullptr)
return MPI_ERR_NO_MEM;
else {
*static_cast<void**>(baseptr) = ptr;
int retval = 0;
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (name == NULL) {
+ } else if (name == nullptr) {
retval = MPI_ERR_ARG;
} else {
smpi_datatype_set_name(datatype, name);
if (datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (name == NULL) {
+ } else if (name == nullptr) {
retval = MPI_ERR_ARG;
} else {
smpi_datatype_get_name(datatype, name, len);
}
int PMPI_Info_create( MPI_Info *info){
- if (info == NULL)
+ if (info == nullptr)
return MPI_ERR_ARG;
*info = xbt_new(s_smpi_mpi_info_t, 1);
- (*info)->info_dict= xbt_dict_new_homogeneous(NULL);
+ (*info)->info_dict= xbt_dict_new_homogeneous(nullptr);
(*info)->refcount=1;
return MPI_SUCCESS;
}
int PMPI_Info_set( MPI_Info info, char *key, char *value){
- if (info == NULL || key == NULL || value == NULL)
+ if (info == nullptr || key == nullptr || value == nullptr)
return MPI_ERR_ARG;
- xbt_dict_set(info->info_dict, key, (void*)value, NULL);
+ xbt_dict_set(info->info_dict, key, (void*)value, nullptr);
return MPI_SUCCESS;
}
int PMPI_Info_free( MPI_Info *info){
- if (info == NULL || *info==NULL)
+ if (info == nullptr || *info==nullptr)
return MPI_ERR_ARG;
(*info)->refcount--;
if((*info)->refcount==0){
int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){
*flag=false;
- if (info == NULL || key == NULL || valuelen <0)
+ if (info == nullptr || key == nullptr || valuelen <0)
return MPI_ERR_ARG;
- if (value == NULL)
+ if (value == nullptr)
return MPI_ERR_INFO_VALUE;
char* tmpvalue=static_cast<char*>(xbt_dict_get_or_null(info->info_dict, key));
if(tmpvalue){
}
int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){
- if (info == NULL || newinfo==NULL)
+ if (info == nullptr || newinfo==nullptr)
return MPI_ERR_ARG;
*newinfo = xbt_new(s_smpi_mpi_info_t, 1);
- (*newinfo)->info_dict= xbt_dict_new_homogeneous(NULL);
+ (*newinfo)->info_dict= xbt_dict_new_homogeneous(nullptr);
(*newinfo)->refcount=1;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
int *key;
void* data;
xbt_dict_foreach(info->info_dict,cursor,key,data){
- xbt_dict_set((*newinfo)->info_dict, reinterpret_cast<char*>(key), data, NULL);
+ xbt_dict_set((*newinfo)->info_dict, reinterpret_cast<char*>(key), data, nullptr);
}
return MPI_SUCCESS;
}
int PMPI_Info_delete(MPI_Info info, char *key){
xbt_ex_t e;
- if (info == NULL || key==NULL)
+ if (info == nullptr || key==nullptr)
return MPI_ERR_ARG;
TRY {
xbt_dict_remove(info->info_dict, key);
}
int PMPI_Info_get_nkeys( MPI_Info info, int *nkeys){
- if (info == NULL || nkeys==NULL)
+ if (info == nullptr || nkeys==nullptr)
return MPI_ERR_ARG;
*nkeys=xbt_dict_size(info->info_dict);
return MPI_SUCCESS;
}
int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){
- if (info == NULL || key==NULL || n<0 || n> MPI_MAX_INFO_KEY)
+ if (info == nullptr || key==nullptr || n<0 || n> MPI_MAX_INFO_KEY)
return MPI_ERR_ARG;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
char *keyn;
void* data;
int num=0;
int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){
*flag=false;
- if (info == NULL || key == NULL || valuelen==NULL)
+ if (info == nullptr || key == nullptr || valuelen==nullptr)
return MPI_ERR_ARG;
char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key);
if(tmpvalue){
}
int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
- if(incount<0 || outcount < 0 || inbuf==NULL || outbuf==NULL)
+ if(incount<0 || outcount < 0 || inbuf==nullptr || outbuf==nullptr)
return MPI_ERR_ARG;
if(!is_datatype_valid(type))
return MPI_ERR_TYPE;
}
int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
- if(incount<0 || outcount < 0|| inbuf==NULL || outbuf==NULL)
+ if(incount<0 || outcount < 0|| inbuf==nullptr || outbuf==nullptr)
return MPI_ERR_ARG;
if(!is_datatype_valid(type))
return MPI_ERR_TYPE;
int communicator_size = 0;
static int active_processes = 0;
-xbt_dict_t reqq = NULL;
+xbt_dict_t reqq = nullptr;
MPI_Datatype MPI_DEFAULT_TYPE;
MPI_Datatype MPI_CURRENT_TYPE;
static int sendbuffer_size=0;
-char* sendbuffer=NULL;
+char* sendbuffer=nullptr;
static int recvbuffer_size=0;
-char* recvbuffer=NULL;
+char* recvbuffer=nullptr;
static void log_timed_action (const char *const *action, double clock){
if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
{
//default type for output is set to MPI_BYTE
// MPI_DEFAULT_TYPE is not set for output, use directly MPI_BYTE
- if(known!=NULL)
+ if(known!=nullptr)
*known=1;
if (datatype==MPI_BYTE){
return "";
if(datatype==MPI_FLOAT)
return "5";
//tell that the datatype is not handled by replay, and that its size should be measured and replayed as size*MPI_BYTE
- if(known!=NULL)
+ if(known!=nullptr)
*known=0;
// default - not implemented.
// do not warn here as we pass in this function even for other trace formats
#define CHECK_ACTION_PARAMS(action, mandatory, optional) {\
int i=0;\
- while(action[i]!=NULL)\
+ while(action[i]!=nullptr)\
i++;\
if(i<mandatory+2) \
THROWF(arg_error, 0, "%s replay failed.\n" \
/*initialize the number of active processes */
active_processes = smpi_process_count();
- if (reqq==NULL) {
+ if (reqq==nullptr) {
reqq = xbt_dict_new();
}
extra->send_size = size;
extra->src = rank;
extra->dst = dst_traced;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
if (!TRACE_smpi_view_internals()) {
TRACE_smpi_send(rank, rank, dst_traced, size*smpi_datatype_size(MPI_CURRENT_TYPE));
}
- smpi_mpi_send(NULL, size, MPI_CURRENT_TYPE, to , 0, MPI_COMM_WORLD);
+ smpi_mpi_send(nullptr, size, MPI_CURRENT_TYPE, to , 0, MPI_COMM_WORLD);
log_timed_action (action, clock);
extra->send_size = size;
extra->src = rank;
extra->dst = dst_traced;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
if (!TRACE_smpi_view_internals()) {
TRACE_smpi_send(rank, rank, dst_traced, size*smpi_datatype_size(MPI_CURRENT_TYPE));
}
- request = smpi_mpi_isend(NULL, size, MPI_CURRENT_TYPE, to, 0,MPI_COMM_WORLD);
+ request = smpi_mpi_isend(nullptr, size, MPI_CURRENT_TYPE, to, 0,MPI_COMM_WORLD);
TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
request->send = 1;
extra->send_size = size;
extra->src = src_traced;
extra->dst = rank;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra);
//unknow size from the receiver pov
size=status.count;
}
- smpi_mpi_recv(NULL, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD, &status);
+ smpi_mpi_recv(nullptr, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD, &status);
TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
if (!TRACE_smpi_view_internals()) {
extra->send_size = size;
extra->src = src_traced;
extra->dst = rank;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra);
MPI_Status status;
//unknow size from the receiver pov
size=status.count;
}
- request = smpi_mpi_irecv(NULL, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD);
+ request = smpi_mpi_irecv(nullptr, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD);
TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
request->recv = 1;
//if request is null here, this may mean that a previous test has succeeded
//Different times in traced application and replayed version may lead to this
//In this case, ignore the extra calls.
- if(request!=NULL){
+ if(request!=nullptr){
int rank = smpi_process_index();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type=TRACING_TEST;
flag = smpi_mpi_test(&request, &status);
XBT_DEBUG("MPI_Test result: %d", flag);
- /* push back request in dynar to be caught by a subsequent wait. if the test did succeed, the request is now NULL.*/
+ /* push back request in dynar to be caught by a subsequent wait. if the test did succeed, the request is now nullptr.*/
xbt_dynar_push_as(get_reqq_self(),MPI_Request, request);
TRACE_smpi_testing_out(rank);
xbt_str_join_array(action," "));
request = xbt_dynar_pop_as(get_reqq_self(),MPI_Request);
- if (request==NULL){
+ if (request==nullptr){
/* Assume that the trace is well formed, meaning the comm might have been caught by a MPI_test. Then just return.*/
return;
}
xbt_dynar_foreach(get_reqq_self(),i,requests[i]);
//save information from requests
- xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), NULL);
- xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
- xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
+ xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), nullptr);
+ xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), nullptr);
+ xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), nullptr);
for (i = 0; static_cast<int>(i) < count_requests; i++) {
if(requests[i]){
int *asrc = xbt_new(int, 1);
extra->type = TRACING_BCAST;
extra->send_size = size;
extra->root = root_traced;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
void *sendbuf = smpi_get_tmp_sendbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
extra->type = TRACING_REDUCE;
extra->send_size = comm_size;
extra->comp_size = comp_size;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
extra->root = root_traced;
TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
extra->type = TRACING_ALLREDUCE;
extra->send_size = comm_size;
extra->comp_size = comp_size;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
extra->type = TRACING_ALLTOALL;
extra->send_size = send_size;
extra->recv_size = recv_size;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
- extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
+ extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
MPI_CURRENT_TYPE2=MPI_DEFAULT_TYPE;
}
void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE));
- void *recv = NULL;
+ void *recv = nullptr;
int root=0;
if(action[4])
root=atoi(action[4]);
extra->send_size = send_size;
extra->recv_size = recv_size;
extra->root = root;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
- extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
+ extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra);
MPI_CURRENT_TYPE2=MPI_DEFAULT_TYPE;
}
void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE));
- void *recv = NULL;
+ void *recv = nullptr;
for(i=0;i<comm_size;i++) {
recvcounts[i] = atoi(action[i+3]);
recv_sum=recv_sum+recvcounts[i];
extra->recvcounts[i] = recvcounts[i];
extra->root = root;
extra->num_processes = comm_size;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
- extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
+ extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra);
extra->recvcounts= xbt_new(int, comm_size);
for(i=0; i< comm_size; i++)//copy data to avoid bad free
extra->recvcounts[i] = recvcounts[i];
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
extra->comp_size = comp_size;
extra->num_processes = comm_size;
extra->type = TRACING_ALLGATHER;
extra->send_size = sendcount;
extra->recv_size= recvcount;
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
- extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
+ extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
extra->num_processes = smpi_comm_size(MPI_COMM_WORLD);
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
extra->recvcounts= xbt_new(int, comm_size);
for(i=0; i< comm_size; i++)//copy data to avoid bad free
extra->recvcounts[i] = recvcounts[i];
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
- extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
+ extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
extra->num_processes = comm_size;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
extra->recv_size += recvcounts[i];
extra->recvcounts[i] = recvcounts[i];
}
- extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL);
- extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL);
+ extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
+ extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, nullptr);
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
xbt_free(sendbuffer);
xbt_free(recvbuffer);
xbt_dict_free(&reqq); //not need, data have been freed ???
- reqq = NULL;
+ reqq = nullptr;
}
instr_extra_data extra_fin = xbt_new0(s_instr_extra_data_t,1);
#define RMA_TAG -1234
-xbt_bar_t creation_bar = NULL;
+xbt_bar_t creation_bar = nullptr;
typedef struct s_smpi_mpi_win{
void* base;
if(info!=MPI_INFO_NULL)
info->refcount++;
win->comm = comm;
- win->name = NULL;
+ win->name = nullptr;
win->opened = 0;
win->group = MPI_GROUP_NULL;
- win->requests = xbt_dynar_new(sizeof(MPI_Request), NULL);
+ win->requests = xbt_dynar_new(sizeof(MPI_Request), nullptr);
win->connected_wins = xbt_new0(MPI_Win, comm_size);
win->connected_wins[rank] = win;
xbt_barrier_wait((*win)->bar);
xbt_dynar_free(&(*win)->requests);
xbt_free((*win)->connected_wins);
- if ((*win)->name != NULL){
+ if ((*win)->name != nullptr){
xbt_free((*win)->name);
}
if((*win)->info!=MPI_INFO_NULL){
}
void smpi_mpi_win_get_name(MPI_Win win, char* name, int* length){
- if(win->name==NULL){
+ if(win->name==nullptr){
*length=0;
- name=NULL;
+ name=nullptr;
return;
}
*length = strlen(win->name);
}
MPI_Request* treqs = static_cast<MPI_Request*>(xbt_dynar_to_array(reqs));
- win->requests=xbt_dynar_new(sizeof(MPI_Request), NULL);
+ win->requests=xbt_dynar_new(sizeof(MPI_Request), nullptr);
smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
xbt_free(treqs);
while(j!=size){
int src=smpi_group_index(group,j);
if(src!=smpi_process_index()){
- reqs[i]=smpi_irecv_init(NULL, 0, MPI_CHAR, src,RMA_TAG+4, MPI_COMM_WORLD);
+ reqs[i]=smpi_irecv_init(nullptr, 0, MPI_CHAR, src,RMA_TAG+4, MPI_COMM_WORLD);
i++;
}
j++;
while(j!=size){
int dst=smpi_group_index(group,j);
if(dst!=smpi_process_index()){
- reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, RMA_TAG+4, MPI_COMM_WORLD);
+ reqs[i]=smpi_mpi_send_init(nullptr, 0, MPI_CHAR, dst, RMA_TAG+4, MPI_COMM_WORLD);
i++;
}
j++;
while(j!=size){
int dst=smpi_group_index(win->group,j);
if(dst!=smpi_process_index()){
- reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, RMA_TAG+5, MPI_COMM_WORLD);
+ reqs[i]=smpi_mpi_send_init(nullptr, 0, MPI_CHAR, dst, RMA_TAG+5, MPI_COMM_WORLD);
i++;
}
j++;
}
MPI_Request* treqs = static_cast<MPI_Request*>(xbt_dynar_to_array(reqqs));
- win->requests=xbt_dynar_new(sizeof(MPI_Request), NULL);
+ win->requests=xbt_dynar_new(sizeof(MPI_Request), nullptr);
smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
xbt_free(treqs);
smpi_group_unuse(win->group);
while(j!=size){
int src=smpi_group_index(win->group,j);
if(src!=smpi_process_index()){
- reqs[i]=smpi_irecv_init(NULL, 0, MPI_CHAR, src,RMA_TAG+5, MPI_COMM_WORLD);
+ reqs[i]=smpi_irecv_init(nullptr, 0, MPI_CHAR, src,RMA_TAG+5, MPI_COMM_WORLD);
i++;
}
j++;
}
MPI_Request* treqs = static_cast<MPI_Request*>(xbt_dynar_to_array(reqqs));
- win->requests=xbt_dynar_new(sizeof(MPI_Request), NULL);
+ win->requests=xbt_dynar_new(sizeof(MPI_Request), nullptr);
smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
xbt_free(treqs);
smpi_group_unuse(win->group);
} s_smpi_mpi_topology_t;
void smpi_topo_destroy(MPI_Topology topo) {
- if(topo == NULL) {
+ if(topo == nullptr) {
return;
}
switch (topo->kind) {
int smpi_mpi_cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm) {
MPI_Topology oldTopo = smpi_comm_topo(comm);
int oldNDims = oldTopo->topo.cart->ndims;
- int i, j = 0, newNDims, *newDims = NULL, *newPeriodic = NULL;
+ int i, j = 0, newNDims, *newDims = nullptr, *newPeriodic = nullptr;
- if (remain_dims == NULL && oldNDims != 0) {
+ if (remain_dims == nullptr && oldNDims != 0) {
return MPI_ERR_ARG;
}
newNDims = 0;
/* Allocate and initialize the bins */
bins = (int *) malloc((unsigned) ndim * sizeof(int));
- if (NULL == bins) {
+ if (nullptr == bins) {
return MPI_ERR_NO_MEM;
}
*pdims = bins;
if(num < 2) {
(*nfactors) = 0;
- (*factors) = NULL;
+ (*factors) = nullptr;
return MPI_SUCCESS;
}
/* Allocate the array of prime factors which cannot exceed log_2(num) entries */