From: Frederic Suter Date: Fri, 3 Nov 2017 14:24:01 +0000 (+0100) Subject: reindent X-Git-Tag: v3.18~308 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1b0ebbb89e434f546d7e9aa2e07512afeed3982b reindent --- diff --git a/src/smpi/include/smpi_datatype.hpp b/src/smpi/include/smpi_datatype.hpp index 2fc90cf185..97beb461c1 100644 --- a/src/smpi/include/smpi_datatype.hpp +++ b/src/smpi/include/smpi_datatype.hpp @@ -75,59 +75,58 @@ namespace simgrid{ 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 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 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); }; } diff --git a/src/smpi/include/smpi_datatype_derived.hpp b/src/smpi/include/smpi_datatype_derived.hpp index b450bd9f98..5c46639a24 100644 --- a/src/smpi/include/smpi_datatype_derived.hpp +++ b/src/smpi/include/smpi_datatype_derived.hpp @@ -13,91 +13,84 @@ namespace simgrid{ 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); }; diff --git a/src/smpi/mpi/smpi_datatype.cpp b/src/smpi/mpi/smpi_datatype.cpp index e23986d976..b738b7ba33 100644 --- a/src/smpi/mpi/smpi_datatype.cpp +++ b/src/smpi/mpi/smpi_datatype.cpp @@ -189,7 +189,6 @@ void Datatype::commit() flags_ |= DT_FLAG_COMMITED; } - bool Datatype::is_valid(){ return (flags_ & DT_FLAG_COMMITED); } diff --git a/src/smpi/mpi/smpi_datatype_derived.cpp b/src/smpi/mpi/smpi_datatype_derived.cpp index 3be87a2df3..2624ca35f2 100644 --- a/src/smpi/mpi/smpi_datatype_derived.cpp +++ b/src/smpi/mpi/smpi_datatype_derived.cpp @@ -8,29 +8,29 @@ #include "smpi_op.hpp" #include -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(contiguous_buf); char* noncontiguous_buf_char = static_cast(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(contiguous_buf); char* noncontiguous_buf_char = static_cast(noncontiguous_buf)+lb(); int n= count*block_count_;