insertIntoBuffer();
}
-LinkEvent::LinkEvent(double timestamp, container_t container, Type* type, e_event_type event_type, container_t endpoint,
+LinkEvent::LinkEvent(container_t container, Type* type, e_event_type event_type, container_t endpoint,
std::string value, std::string key)
- : LinkEvent(timestamp, container, type, event_type, endpoint, value, key, -1)
+ : LinkEvent(container, type, event_type, endpoint, value, key, -1)
{
}
-LinkEvent::LinkEvent(double timestamp, container_t container, Type* type, e_event_type event_type, container_t endpoint,
+LinkEvent::LinkEvent(container_t container, Type* type, e_event_type event_type, container_t endpoint,
std::string value, std::string key, int size)
- : PajeEvent(container, type, timestamp, event_type), endpoint_(endpoint), value_(value), key_(key), size_(size)
+ : PajeEvent(container, type, SIMIX_get_clock(), event_type)
+ , endpoint_(endpoint)
+ , value_(value)
+ , key_(key)
+ , size_(size)
{
XBT_DEBUG("%s: event_type=%u, timestamp=%f, value:%s", __FUNCTION__, eventType_, timestamp_, value_.c_str());
insertIntoBuffer();
insertIntoBuffer();
}
-StateEvent::StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value)
- : StateEvent(timestamp, container, type, event_type, value, nullptr)
+StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value)
+ : StateEvent(container, type, event_type, value, nullptr)
{
}
-StateEvent::StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value,
- void* extra)
- : PajeEvent::PajeEvent(container, type, timestamp, event_type), value(value), extra_(extra)
+StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, void* extra)
+ : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra)
{
#if HAVE_SMPI
if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
void* extra_ = nullptr;
public:
- StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value);
- StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value,
- void* extra);
+ StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value);
+ StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, void* extra);
void print() override;
};
int size_ = -1;
public:
- LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
- std::string value, std::string key);
- LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
- std::string value, std::string key, int size);
+ LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
+ std::string key);
+ LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
+ std::string key, int size);
void print() override;
};
};
}
}
-
#endif
void StateType::setEvent(std::string value_name)
{
- events_.push_back(new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_SetState, getEntityValue(value_name)));
+ events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, getEntityValue(value_name)));
}
void StateType::pushEvent(std::string value_name, void* extra)
{
- events_.push_back(
- new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_PushState, getEntityValue(value_name), extra));
+ events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name), extra));
}
void StateType::pushEvent(std::string value_name)
{
- events_.push_back(new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_PushState, getEntityValue(value_name)));
+ events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name)));
}
void StateType::popEvent()
{
- events_.push_back(new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_PopState, nullptr));
+ events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr));
}
VariableType::VariableType(std::string name, std::string color, Type* father) : Type(name, name, color, father)
void LinkType::startEvent(container_t startContainer, std::string value, std::string key, int size)
{
- new LinkEvent(SIMIX_get_clock(), issuer_, this, PAJE_StartLink, startContainer, value, key, size);
+ new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, key, size);
}
void LinkType::endEvent(container_t endContainer, std::string value, std::string key)
{
- new LinkEvent(SIMIX_get_clock(), issuer_, this, PAJE_EndLink, endContainer, value, key);
+ new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key);
}
void Type::logDefinition(e_event_type event_type)
namespace smpi{
class Datatype : public F2C, public Keyval{
- private:
- char* name_;
- size_t size_;
- MPI_Aint lb_;
- MPI_Aint ub_;
- int flags_;
- int refcount_;
-
- public:
- static std::unordered_map<int, smpi_key_elem> keyvals_;
- static int keyval_id_;
-
- Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags);
- Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags);
- Datatype(Datatype *datatype, int* ret);
- virtual ~Datatype();
-
- char* name();
- size_t size();
- MPI_Aint lb();
- MPI_Aint ub();
- int flags();
- int refcount();
-
- void ref();
- static void unref(MPI_Datatype datatype);
- void commit();
- bool is_valid();
- void addflag(int flag);
- int extent(MPI_Aint * lb, MPI_Aint * extent);
- MPI_Aint get_extent();
- void get_name(char* name, int* length);
- void set_name(char* name);
- static int copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype);
- virtual void serialize( void* noncontiguous, void *contiguous,
- int count);
- virtual void unserialize( void* contiguous, void *noncontiguous,
- int count, MPI_Op op);
- static int keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state);
- static int keyval_free(int* keyval);
- int pack(void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
- int unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm comm);
-
-
- static int create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type);
- static int create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type);
- static int create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type);
- static int create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
- static int create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
- static int create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type);
-
- static Datatype* f2c(int id);
+ char* name_;
+ size_t size_;
+ MPI_Aint lb_;
+ MPI_Aint ub_;
+ int flags_;
+ int refcount_;
+
+public:
+ static std::unordered_map<int, smpi_key_elem> keyvals_;
+ static int keyval_id_;
+
+ Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags);
+ Datatype(char* name, int size, MPI_Aint lb, MPI_Aint ub, int flags);
+ Datatype(Datatype* datatype, int* ret);
+ virtual ~Datatype();
+
+ char* name();
+ size_t size();
+ MPI_Aint lb();
+ MPI_Aint ub();
+ int flags();
+ int refcount();
+
+ void ref();
+ static void unref(MPI_Datatype datatype);
+ void commit();
+ bool is_valid();
+ void addflag(int flag);
+ int extent(MPI_Aint* lb, MPI_Aint* extent);
+ MPI_Aint get_extent();
+ void get_name(char* name, int* length);
+ void set_name(char* name);
+ static int copy(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
+ MPI_Datatype recvtype);
+ virtual void serialize(void* noncontiguous, void* contiguous, int count);
+ virtual void unserialize(void* contiguous, void* noncontiguous, int count, MPI_Op op);
+ static int keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state);
+ static int keyval_free(int* keyval);
+ int pack(void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
+ int unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm comm);
+
+ static int create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type);
+ static int create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type);
+ static int create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type);
+ static int create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
+ static int create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type);
+ static int create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+ MPI_Datatype* new_type);
+
+ static Datatype* f2c(int id);
};
}
namespace smpi{
class Type_Contiguous: public Datatype {
- private:
- int block_count_;
- MPI_Datatype old_type_;
- public:
- Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
- ~Type_Contiguous();
- void serialize( void* noncontiguous, void *contiguous,
- int count);
- void unserialize( void* contiguous_vector, void *noncontiguous_vector,
- int count, MPI_Op op);
+ int block_count_;
+ MPI_Datatype old_type_;
+
+public:
+ Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
+ ~Type_Contiguous();
+ void serialize(void* noncontiguous, void* contiguous, int count);
+ void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Vector: public Datatype{
- private:
- int block_count_;
- int block_length_;
- int block_stride_;
- MPI_Datatype old_type_;
- public:
- Type_Vector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride, MPI_Datatype old_type);
- ~Type_Vector();
- void serialize( void* noncontiguous, void *contiguous,
- int count);
- void unserialize( void* contiguous_vector, void *noncontiguous_vector,
- int count, MPI_Op op);
+ int block_count_;
+ int block_length_;
+ int block_stride_;
+ MPI_Datatype old_type_;
+
+public:
+ Type_Vector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride,
+ MPI_Datatype old_type);
+ ~Type_Vector();
+ void serialize(void* noncontiguous, void* contiguous, int count);
+ void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Hvector: public Datatype{
- private:
- int block_count_;
- int block_length_;
- MPI_Aint block_stride_;
- MPI_Datatype old_type_;
- public:
- Type_Hvector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride, MPI_Datatype old_type);
- ~Type_Hvector();
- void serialize( void* noncontiguous, void *contiguous,
- int count);
- void unserialize( void* contiguous_vector, void *noncontiguous_vector,
- int count, MPI_Op op);
+ int block_count_;
+ int block_length_;
+ MPI_Aint block_stride_;
+ MPI_Datatype old_type_;
+
+public:
+ Type_Hvector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride,
+ MPI_Datatype old_type);
+ ~Type_Hvector();
+ void serialize(void* noncontiguous, void* contiguous, int count);
+ void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Indexed: public Datatype{
- private:
- int block_count_;
- int* block_lengths_;
- int* block_indices_;
- MPI_Datatype old_type_;
- public:
- Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices, MPI_Datatype old_type);
- ~Type_Indexed();
- void serialize( void* noncontiguous, void *contiguous,
- int count);
- void unserialize( void* contiguous_vector, void *noncontiguous_vector,
- int count, MPI_Op op);
+ int block_count_;
+ int* block_lengths_;
+ int* block_indices_;
+ MPI_Datatype old_type_;
+
+public:
+ Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
+ MPI_Datatype old_type);
+ ~Type_Indexed();
+ void serialize(void* noncontiguous, void* contiguous, int count);
+ void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Hindexed: public Datatype{
- private:
- int block_count_;
- int* block_lengths_;
- MPI_Aint* block_indices_;
- MPI_Datatype old_type_;
- public:
- Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type);
- ~Type_Hindexed();
- void serialize( void* noncontiguous, void *contiguous,
- int count);
- void unserialize( void* contiguous_vector, void *noncontiguous_vector,
- int count, MPI_Op op);
+ int block_count_;
+ int* block_lengths_;
+ MPI_Aint* block_indices_;
+ MPI_Datatype old_type_;
+
+public:
+ Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
+ MPI_Aint* block_indices, MPI_Datatype old_type);
+ ~Type_Hindexed();
+ void serialize(void* noncontiguous, void* contiguous, int count);
+ void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Struct: public Datatype{
- private:
- int block_count_;
- int* block_lengths_;
- MPI_Aint* block_indices_;
- MPI_Datatype* old_types_;
- public:
- Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types);
- ~Type_Struct();
- void serialize( void* noncontiguous, void *contiguous,
- int count);
- void unserialize( void* contiguous_vector, void *noncontiguous_vector,
- int count, MPI_Op op);
+ int block_count_;
+ int* block_lengths_;
+ MPI_Aint* block_indices_;
+ MPI_Datatype* old_types_;
+
+public:
+ Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
+ MPI_Aint* block_indices, MPI_Datatype* old_types);
+ ~Type_Struct();
+ void serialize(void* noncontiguous, void* contiguous, int count);
+ void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
flags_ |= DT_FLAG_COMMITED;
}
-
bool Datatype::is_valid(){
return (flags_ & DT_FLAG_COMMITED);
}
#include "smpi_op.hpp"
#include <xbt/log.h>
-XBT_LOG_EXTERNAL_CATEGORY(smpi_datatype);
-
namespace simgrid{
namespace smpi{
-
-Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(block_count), old_type_(old_type){
+Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type)
+ : Datatype(size, lb, ub, flags), block_count_(block_count), old_type_(old_type)
+{
old_type_->ref();
}
-Type_Contiguous::~Type_Contiguous(){
+Type_Contiguous::~Type_Contiguous()
+{
Datatype::unref(old_type_);
}
-
-void Type_Contiguous::serialize( void* noncontiguous_buf, void *contiguous_buf,
- int count){
+void Type_Contiguous::serialize(void* noncontiguous_buf, void* contiguous_buf, int count)
+{
char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb();
memcpy(contiguous_buf_char, noncontiguous_buf_char, count * block_count_ * old_type_->size());
}
-void Type_Contiguous::unserialize( void* contiguous_buf, void *noncontiguous_buf,
- int count, MPI_Op op){
+
+void Type_Contiguous::unserialize(void* contiguous_buf, void* noncontiguous_buf, int count, MPI_Op op)
+{
char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb();
int n= count*block_count_;