- MSG_storage_set_property_value()
* VM properties. Since msg_vm_t are msg_host_t, just use
MSG_host_get_property_value() and friends
-
+ * xbt heterogeneous dictionnaries (created with xbt_dict_new()).
+ Well, they are still there for now, but deprecated with a warning.
+ Please switch to xbt_dict_new_homogeneous() before this is removed
+ for real.
* Task affinity. Its intended behavior (that was very badly tested
and probably not really working) was deceiving what most users
would have hoped here.
peer->id = id;
snprintf(peer->mailbox,MAILBOX_SIZE-1, "%d", id);
snprintf(peer->mailbox_tracker,MAILBOX_SIZE-1, "tracker_%d", id);
- peer->peers = xbt_dict_new();
- peer->active_peers = xbt_dict_new();
+ peer->peers = xbt_dict_new_homogeneous(NULL);
+ peer->active_peers = xbt_dict_new_homogeneous(NULL);
peer->hostname = MSG_host_get_name(MSG_host_self());
peer->bitfield = xbt_new(char, FILE_PIECES + 1);
dp->prev_remaining = remaining;
}
if (!pimpl->dp_objs)
- pimpl->dp_objs = xbt_dict_new();
+ pimpl->dp_objs = xbt_dict_new_homogeneous(nullptr);
xbt_assert(xbt_dict_get_or_null(pimpl->dp_objs, key) == nullptr);
xbt_dict_set(pimpl->dp_objs, key, dp, nullptr);
XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, host->cname(), remaining, pimpl->dp_enabled);
int ret = MPI_SUCCESS;
if(comm->attributes !=nullptr){
- (*newcomm)->attributes=xbt_dict_new();
- xbt_dict_cursor_t cursor = nullptr;
- int *key;
- int flag;
- void* value_in;
- void* value_out;
- 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!=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;
- xbt_dict_cursor_free(&cursor);
- return ret;
- }
- if(flag)
- xbt_dict_set_ext((*newcomm)->attributes, reinterpret_cast<const char*>(key), sizeof(int),value_out, nullptr);
+ (*newcomm)->attributes = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_cursor_t cursor = nullptr;
+ int* key;
+ int flag;
+ void* value_in;
+ void* value_out;
+ 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 != 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;
+ xbt_dict_cursor_free(&cursor);
+ return ret;
}
+ if (flag)
+ xbt_dict_set_ext((*newcomm)->attributes, reinterpret_cast<const char*>(key), sizeof(int), value_out, nullptr);
+ }
}
}
return ret;
int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){
if(smpi_comm_keyvals==nullptr)
- smpi_comm_keyvals = xbt_dict_new();
+ smpi_comm_keyvals = xbt_dict_new_homogeneous(nullptr);
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==nullptr)
return ret;
}
if(comm->attributes==nullptr)
- comm->attributes=xbt_dict_new();
+ comm->attributes = xbt_dict_new_homogeneous(nullptr);
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==nullptr)
- smpi_comm_keyvals = xbt_dict_new();
+ smpi_comm_keyvals = xbt_dict_new_homogeneous(nullptr);
smpi_comm_key_elem value = static_cast<smpi_comm_key_elem>(xbt_new0(s_smpi_mpi_comm_key_elem_t,1));
if(datatype->name)
(*new_t)->name = xbt_strdup(datatype->name);
if(datatype->attributes !=nullptr){
- (*new_t)->attributes=xbt_dict_new();
- xbt_dict_cursor_t cursor = nullptr;
- int *key;
- int flag;
- void* value_in;
- void* value_out;
- 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 != 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;
- xbt_dict_cursor_free(&cursor);
- return ret;
- }
- if(flag)
- xbt_dict_set_ext((*new_t)->attributes, reinterpret_cast<const char*>(key), sizeof(int),value_out, nullptr);
+ (*new_t)->attributes = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_cursor_t cursor = nullptr;
+ int* key;
+ int flag;
+ void* value_in;
+ void* value_out;
+ 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 != 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;
+ xbt_dict_cursor_free(&cursor);
+ return ret;
}
+ if (flag)
+ xbt_dict_set_ext((*new_t)->attributes, reinterpret_cast<const char*>(key), sizeof(int), value_out, nullptr);
+ }
}
}
return ret;
int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){
if(smpi_type_keyvals==nullptr)
- smpi_type_keyvals = xbt_dict_new();
+ smpi_type_keyvals = xbt_dict_new_homogeneous(nullptr);
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==nullptr)
return ret;
}
if(type->attributes==nullptr)
- type->attributes=xbt_dict_new();
+ type->attributes = xbt_dict_new_homogeneous(nullptr);
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==nullptr)
- smpi_type_keyvals = xbt_dict_new();
+ smpi_type_keyvals = xbt_dict_new_homogeneous(nullptr);
smpi_type_key_elem value = (smpi_type_key_elem) xbt_new0(s_smpi_mpi_type_key_elem_t,1);
static int id=0;
// pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
if(((NetworkIBModel*)surf_network_model)->active_nodes==nullptr)
- ((NetworkIBModel*)surf_network_model)->active_nodes=xbt_dict_new();
+ ((NetworkIBModel*)surf_network_model)->active_nodes = xbt_dict_new_homogeneous(nullptr);
IBNode* act = new IBNode(id);
if ((cluster->properties != nullptr) && (!xbt_dict_is_empty(cluster->properties))) {
xbt_dict_cursor_t cursor=nullptr;
char *key,*data;
- host.properties = xbt_dict_new();
+ host.properties = xbt_dict_new_homogeneous(free);
xbt_dict_foreach(cluster->properties,cursor,key,data) {
- xbt_dict_set(host.properties, key, xbt_strdup(data),free);
+ xbt_dict_set(host.properties, key, xbt_strdup(data), nullptr);
}
}
}
else{
if (!current_property_set)
- current_property_set = xbt_dict_new(); // Maybe, it should raise an error
- xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), xbt_free_f);
+ current_property_set = xbt_dict_new_homogeneous(&xbt_free_f); // Maybe, it should raise an error
+ xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), nullptr);
XBT_DEBUG("add prop %s=%s into current property set", A_surfxml_prop_id, A_surfxml_prop_value);
}
}
*/
xbt_dict_t xbt_dict_new()
{
+ XBT_WARN("Function xbt_dict_new() will soon be dropped. Please switch to xbt_dict_new_homogeneous()");
xbt_dict_t dict = xbt_dict_new_homogeneous(nullptr);
dict->homogeneous = 0;