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
[simix] Dexbtization: remove xbt_dynar_t argument in simcall_comm_waitany
[simgrid.git]
/
src
/
smpi
/
smpi_bench.cpp
diff --git
a/src/smpi/smpi_bench.cpp
b/src/smpi/smpi_bench.cpp
index
3128889
..
adbbd3d
100644
(file)
--- a/
src/smpi/smpi_bench.cpp
+++ b/
src/smpi/smpi_bench.cpp
@@
-12,6
+12,7
@@
#include "src/internal_config.h"
#include "private.h"
#include "private.hpp"
#include "src/internal_config.h"
#include "private.h"
#include "private.hpp"
+#include <xbt/ex.hpp>
#include "xbt/dict.h"
#include "xbt/sysdep.h"
#include "xbt/ex.h"
#include "xbt/dict.h"
#include "xbt/sysdep.h"
#include "xbt/ex.h"
@@
-97,10
+98,10
@@
namespace {
class smpi_source_location {
public:
smpi_source_location(const char* filename, int line)
class smpi_source_location {
public:
smpi_source_location(const char* filename, int line)
- : filename(
filename
), filename_length(strlen(filename)), line(line) {}
+ : filename(
xbt_strdup(filename)
), filename_length(strlen(filename)), line(line) {}
/** Pointer to a static string containing the file name */
/** Pointer to a static string containing the file name */
- c
onst c
har* filename = nullptr;
+ char* filename = nullptr;
int filename_length = 0;
int line = 0;
int filename_length = 0;
int line = 0;
@@
-174,7
+175,7
@@
static void* shm_map(int fd, size_t size, shared_data_key_type* data) {
mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if(mem == MAP_FAILED) {
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));
+ xbt_die("Could not map fd %d
with size %zu: %s", fd, size
, strerror(errno));
}
snprintf(loc, PTR_STRLEN, "%p", mem);
meta.size = size;
}
snprintf(loc, PTR_STRLEN, "%p", mem);
meta.size = size;
@@
-567,7
+568,7
@@
void smpi_sample_3(int global, const char *file, int line)
void *smpi_shared_malloc(size_t size, const char *file, int line)
{
void* mem;
void *smpi_shared_malloc(size_t size, const char *file, int line)
{
void* mem;
- if (xbt_cfg_get_boolean("smpi/use-shared-malloc")){
+ if (
size > 0 &&
xbt_cfg_get_boolean("smpi/use-shared-malloc")){
int fd;
smpi_source_location loc(file, line);
auto res = allocs.insert(std::make_pair(loc, shared_data_t()));
int fd;
smpi_source_location loc(file, line);
auto res = allocs.insert(std::make_pair(loc, shared_data_t()));
@@
-612,7
+613,7
@@
void smpi_shared_free(void *ptr)
snprintf(loc, PTR_STRLEN, "%p", ptr);
auto meta = allocs_metadata.find(ptr);
if (meta == allocs_metadata.end()) {
snprintf(loc, PTR_STRLEN, "%p", ptr);
auto meta = allocs_metadata.find(ptr);
if (meta == allocs_metadata.end()) {
- XBT_WARN("Cannot free: %p was not shared-allocated by SMPI", ptr);
+ XBT_WARN("Cannot free: %p was not shared-allocated by SMPI
- maybe its size was 0?
", ptr);
return;
}
shared_data_t* data = &meta->second.data->second;
return;
}
shared_data_t* data = &meta->second.data->second;
@@
-620,11
+621,12
@@
void smpi_shared_free(void *ptr)
XBT_WARN("Unmapping of fd %d failed: %s", data->fd, strerror(errno));
}
data->count--;
XBT_WARN("Unmapping of fd %d failed: %s", data->fd, strerror(errno));
}
data->count--;
- XBT_DEBUG("Shared free - no removal - of %p, count = %d", ptr, data->count);
if (data->count <= 0) {
close(data->fd);
allocs.erase(allocs.find(meta->second.data->first));
XBT_DEBUG("Shared free - with removal - of %p", ptr);
if (data->count <= 0) {
close(data->fd);
allocs.erase(allocs.find(meta->second.data->first));
XBT_DEBUG("Shared free - with removal - of %p", ptr);
+ }else{
+ XBT_DEBUG("Shared free - no removal - of %p, count = %d", ptr, data->count);
}
}else{
XBT_DEBUG("Classic free of %p", ptr);
}
}else{
XBT_DEBUG("Classic free of %p", ptr);