A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
smpi
/
include
/
smpi_keyvals.hpp
diff --git
a/src/smpi/include/smpi_keyvals.hpp
b/src/smpi/include/smpi_keyvals.hpp
index
bc3e2af
..
1f8ce73
100644
(file)
--- a/
src/smpi/include/smpi_keyvals.hpp
+++ b/
src/smpi/include/smpi_keyvals.hpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2010-201
7
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-201
8
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-7,29
+7,28
@@
#define SMPI_KEYVALS_HPP_INCLUDED
#include "smpi/smpi.h"
#define SMPI_KEYVALS_HPP_INCLUDED
#include "smpi/smpi.h"
-#include "xbt/ex.hpp"
#include <unordered_map>
#include <unordered_map>
-
typedef struct smpi_delete_fn
{
+
struct smpi_delete_fn
{
MPI_Comm_delete_attr_function *comm_delete_fn;
MPI_Type_delete_attr_function *type_delete_fn;
MPI_Win_delete_attr_function *win_delete_fn;
MPI_Comm_delete_attr_function *comm_delete_fn;
MPI_Type_delete_attr_function *type_delete_fn;
MPI_Win_delete_attr_function *win_delete_fn;
-}
smpi_delete_fn
;
+};
-
typedef struct smpi_copy_fn
{
+
struct smpi_copy_fn
{
MPI_Comm_copy_attr_function *comm_copy_fn;
MPI_Type_copy_attr_function *type_copy_fn;
MPI_Win_copy_attr_function *win_copy_fn;
MPI_Comm_copy_attr_function *comm_copy_fn;
MPI_Type_copy_attr_function *type_copy_fn;
MPI_Win_copy_attr_function *win_copy_fn;
-}
smpi_copy_fn
;
+};
-
typedef struct s_smpi_key_elem
{
+
struct s_smpi_key_elem_t
{
smpi_copy_fn copy_fn;
smpi_delete_fn delete_fn;
int refcount;
smpi_copy_fn copy_fn;
smpi_delete_fn delete_fn;
int refcount;
-}
s_smpi_mpi_key_elem_t
;
+};
-typedef s
truct s_smpi_key_elem *
smpi_key_elem;
+typedef s
_smpi_key_elem_t*
smpi_key_elem;
namespace simgrid{
namespace smpi{
namespace simgrid{
namespace smpi{
@@
-54,7
+53,7
@@
class Keyval{
template <typename T> int Keyval::keyval_create(smpi_copy_fn copy_fn, smpi_delete_fn delete_fn, int* keyval, void* extra_state){
template <typename T> int Keyval::keyval_create(smpi_copy_fn copy_fn, smpi_delete_fn delete_fn, int* keyval, void* extra_state){
- smpi_key_elem value =
(smpi_key_elem) xbt_new0(s_smpi_mpi_key_elem_t,1)
;
+ smpi_key_elem value =
new s_smpi_key_elem_t
;
value->copy_fn=copy_fn;
value->delete_fn=delete_fn;
value->copy_fn=copy_fn;
value->delete_fn=delete_fn;
@@
-75,7
+74,7
@@
template <typename T> int Keyval::keyval_free(int* keyval){
}
if(elem->refcount==1){
T::keyvals_.erase(*keyval);
}
if(elem->refcount==1){
T::keyvals_.erase(*keyval);
-
xbt_free(elem)
;
+
delete elem
;
}else{
elem->refcount--;
}
}else{
elem->refcount--;
}
@@
-109,11
+108,12
@@
template <typename T> int Keyval::attr_get(int keyval, void* attr_value, int* fl
*flag=0;
return MPI_SUCCESS;
}
*flag=0;
return MPI_SUCCESS;
}
- try {
- *static_cast<void**>(attr_value) = attributes()->at(keyval);
+ const auto& attribs = attributes();
+ auto attr = attribs->find(keyval);
+ if (attr != attribs->end()) {
+ *static_cast<void**>(attr_value) = attr->second;
*flag=1;
*flag=1;
- }
- catch (const std::out_of_range& oor) {
+ } else {
*flag=0;
}
return MPI_SUCCESS;
*flag=0;
}
return MPI_SUCCESS;
@@
-139,13
+139,14
@@
template <typename T> int Keyval::attr_put(int keyval, void* attr_value){
template <typename T> void Keyval::cleanup_attr(){
if (not attributes()->empty()) {
int flag=0;
template <typename T> void Keyval::cleanup_attr(){
if (not attributes()->empty()) {
int flag=0;
- for(auto it : attributes_){
- try{
- smpi_key_elem elem = T::keyvals_.at(it.first);
+ for (auto const& it : attributes_) {
+ auto elm = T::keyvals_.find(it.first);
+ if (elm != T::keyvals_.end()) {
+ smpi_key_elem elem = elm->second;
if(elem != nullptr){
call_deleter<T>((T*)this, elem, it.first,it.second,&flag);
}
if(elem != nullptr){
call_deleter<T>((T*)this, elem, it.first,it.second,&flag);
}
- }
catch(const std::out_of_range& oor)
{
+ }
else
{
//already deleted, not a problem;
flag=0;
}
//already deleted, not a problem;
flag=0;
}