/* smpi_datatype.cpp -- MPI primitives to handle datatypes */
-/* Copyright (c) 2009-2015. The SimGrid Team.
+/* Copyright (c) 2009-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_datatype, smpi, "Logging specific to SMPI (datatype)");
#define CREATE_MPI_DATATYPE(name, type) \
- static Datatype mpi_##name ( \
+ static simgrid::smpi::Datatype mpi_##name ( \
(char*) # name, \
sizeof(type), /* size */ \
0, /* lb */ \
const MPI_Datatype name = &mpi_##name;
#define CREATE_MPI_DATATYPE_NULL(name) \
- static Datatype mpi_##name ( \
+ static simgrid::smpi::Datatype mpi_##name ( \
(char*) # name, \
0, /* size */ \
0, /* lb */ \
int Datatype::keyval_id_=0;
Datatype::Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(nullptr), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(1){
-#if HAVE_MC
+#if SIMGRID_HAVE_MC
if(MC_is_active())
MC_ignore(&(refcount_), sizeof(refcount_));
#endif
//for predefined types, so in_use = 0.
Datatype::Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags) : name_(name), size_(size), lb_(lb), ub_(ub), flags_(flags), refcount_(0){
-#if HAVE_MC
+#if SIMGRID_HAVE_MC
if(MC_is_active())
MC_ignore(&(refcount_), sizeof(refcount_));
#endif
refcount_++;
-#if HAVE_MC
+#if SIMGRID_HAVE_MC
if(MC_is_active())
MC_ignore(&(refcount_), sizeof(refcount_));
#endif
if (datatype->refcount_ == 0 && !(datatype->flags_ & DT_FLAG_PREDEFINED))
delete datatype;
-#if HAVE_MC
+#if SIMGRID_HAVE_MC
if(MC_is_active())
MC_ignore(&(datatype->refcount_), sizeof(datatype->refcount_));
#endif
int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype){
int count;
- if(smpi_privatize_global_variables){
- smpi_switch_data_segment(smpi_process_index());
+
+// FIXME Handle the case of a partial shared malloc.
+
+ if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){
+ smpi_switch_data_segment(smpi_process()->index());
}
/* First check if we really have something to do */
if (recvcount > 0 && recvbuf != sendbuf) {
count = sendcount < recvcount ? sendcount : recvcount;
if(!(sendtype->flags() & DT_FLAG_DERIVED) && !(recvtype->flags() & DT_FLAG_DERIVED)) {
- if(!smpi_process_get_replaying())
+ if(!smpi_process()->replaying())
memcpy(recvbuf, sendbuf, count);
}
else if (!(sendtype->flags() & DT_FLAG_DERIVED))