MPI_CALL(XBT_PUBLIC int, MPI_Type_hindexed,
(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hindexed,
- (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+ (int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hindexed_block,
- (int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+ (int count, int blocklength, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_hvector,
(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_hvector,
(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_indexed,
- (int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+ (int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_indexed,
- (int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+ (int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_indexed_block,
- (int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
+ (int count, int blocklength, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_struct,
(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_struct,
- (int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype));
+ (int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_vector,
(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_contiguous, (int count, MPI_Datatype old_type, MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_get_name, (MPI_Datatype datatype, char* name, int* len));
MPI_CALL(XBT_PUBLIC int, MPI_Pack,
- (void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm));
+ (const void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm));
MPI_CALL(XBT_PUBLIC int, MPI_Pack_size, (int incount, MPI_Datatype datatype, MPI_Comm comm, int* size));
MPI_CALL(XBT_PUBLIC int, MPI_Unpack,
- (void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm));
+ (const void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm));
MPI_CALL(XBT_PUBLIC int, MPI_Op_create, (MPI_User_function * function, int commute, MPI_Op* op));
MPI_CALL(XBT_PUBLIC int, MPI_Op_free, (MPI_Op * op));
MPI_CALL(XBT_PUBLIC int, MPI_Unpack_external, (char* datarep, void* inbuf, MPI_Aint insize, MPI_Aint* position,
void* outbuf, int outcount, MPI_Datatype datatype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_create_subarray,
- (int ndims, int* array_of_sizes, int* array_of_subsizes, int* array_of_starts, int order, MPI_Datatype oldtype,
+ (int ndims, const int* array_of_sizes, const int* array_of_subsizes, const int* array_of_starts, int order, MPI_Datatype oldtype,
MPI_Datatype* newtype));
MPI_CALL(XBT_PUBLIC int, MPI_Type_match_size, (int typeclass, int size, MPI_Datatype* datatype));
MPI_CALL(XBT_PUBLIC int, MPI_Comm_set_info, (MPI_Comm comm, MPI_Info info));
WRAPPED_PMPI_CALL(int,MPI_Op_free,(MPI_Op * op),(op))
WRAPPED_PMPI_CALL(int,MPI_Op_commutative,(MPI_Op op, int *commute), (op, commute))
WRAPPED_PMPI_CALL(int,MPI_Pack_size,(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) ,(incount, datatype, comm, size))
-WRAPPED_PMPI_CALL(int,MPI_Pack,(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) ,(inbuf, incount, type, outbuf, outcount, position, comm))
+WRAPPED_PMPI_CALL(int,MPI_Pack,(const void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) ,(inbuf, incount, type, outbuf, outcount, position, comm))
WRAPPED_PMPI_CALL(int,MPI_Probe,(int source, int tag, MPI_Comm comm, MPI_Status* status) ,(source, tag, comm, status))
WRAPPED_PMPI_CALL(int,MPI_Put,( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win),(origin_addr,origin_count, origin_datatype,target_rank,target_disp, target_count,target_datatype, win))
WRAPPED_PMPI_CALL(int,MPI_Query_thread,(int *provided),(provided))
WRAPPED_PMPI_CALL(int,MPI_Grequest_start,(MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn,MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request),( query_fn, free_fn, cancel_fn, extra_state, request))
WRAPPED_PMPI_CALL(int,MPI_Type_commit,(MPI_Datatype* datatype) ,(datatype))
WRAPPED_PMPI_CALL(int,MPI_Type_contiguous,(int count, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, old_type, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Type_create_hindexed_block,(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklength, indices, old_type, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Type_create_hindexed,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,MPI_Datatype* new_type) ,(count, blocklens,indices,old_type,new_type))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_hindexed_block,(int count, int blocklength, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklength, indices, old_type, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_hindexed,(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type,MPI_Datatype* new_type) ,(count, blocklens,indices,old_type,new_type))
WRAPPED_PMPI_CALL(int,MPI_Type_create_hvector,(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) ,(count, blocklen, stride, old_type, new_type))
-WRAPPED_PMPI_CALL(int,MPI_Type_create_indexed_block,(int count, int blocklength, int* indices,MPI_Datatype old_type,MPI_Datatype *newtype),(count, blocklength, indices, old_type, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Type_create_indexed,(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_indexed_block,(int count, int blocklength, const int* indices,MPI_Datatype old_type,MPI_Datatype *newtype),(count, blocklength, indices, old_type, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_indexed,(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
WRAPPED_PMPI_CALL(int,MPI_Type_create_keyval,(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,void* extra_state),(copy_fn,delete_fn,keyval,extra_state))
WRAPPED_PMPI_CALL(int,MPI_Type_create_resized,(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype),(oldtype,lb, extent, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Type_create_struct,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Type_create_subarray,(int ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int order,MPI_Datatype oldtype, MPI_Datatype *newtype),(ndims,array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_struct,(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_create_subarray,(int ndims,const int *array_of_sizes, const int *array_of_subsizes, const int *array_of_starts, int order,MPI_Datatype oldtype, MPI_Datatype *newtype),(ndims,array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype))
WRAPPED_PMPI_CALL(int,MPI_Type_delete_attr ,(MPI_Datatype type, int type_keyval),(type,type_keyval))
WRAPPED_PMPI_CALL(int,MPI_Type_dup,(MPI_Datatype datatype, MPI_Datatype * newdatatype),(datatype, newdatatype))
WRAPPED_PMPI_CALL(int,MPI_Type_extent,(MPI_Datatype datatype, MPI_Aint * extent),(datatype, extent))
WRAPPED_PMPI_CALL(int,MPI_Type_get_true_extent,(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent),(datatype, lb, extent))
WRAPPED_PMPI_CALL(int,MPI_Type_hindexed,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
WRAPPED_PMPI_CALL(int,MPI_Type_hvector,(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklen, stride, old_type, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Type_indexed,(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
+WRAPPED_PMPI_CALL(int,MPI_Type_indexed,(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklens, indices, old_type, newtype))
WRAPPED_PMPI_CALL(int,MPI_Type_lb,(MPI_Datatype datatype, MPI_Aint * disp),(datatype, disp))
WRAPPED_PMPI_CALL(int,MPI_Type_set_attr ,(MPI_Datatype type, int type_keyval, void *attribute_val),( type, type_keyval, attribute_val))
WRAPPED_PMPI_CALL(int,MPI_Type_set_name,(MPI_Datatype datatype, char * name),(datatype, name))
WRAPPED_PMPI_CALL(int,MPI_Type_struct,(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) ,(count, blocklens, indices, old_types, newtype))
WRAPPED_PMPI_CALL(int,MPI_Type_ub,(MPI_Datatype datatype, MPI_Aint * disp),(datatype, disp))
WRAPPED_PMPI_CALL(int,MPI_Type_vector,(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype) ,(count, blocklen, stride, old_type, newtype))
-WRAPPED_PMPI_CALL(int,MPI_Unpack,(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) ,(inbuf, insize, position, outbuf, outcount, type, comm))
+WRAPPED_PMPI_CALL(int,MPI_Unpack,(const void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) ,(inbuf, insize, position, outbuf, outcount, type, comm))
WRAPPED_PMPI_CALL(int,MPI_Waitall,(int count, MPI_Request requests[], MPI_Status status[]),(count, requests, status))
WRAPPED_PMPI_CALL(int,MPI_Waitany,(int count, MPI_Request requests[], int *index, MPI_Status * status),(count, requests, index, status))
WRAPPED_PMPI_CALL(int,MPI_Wait,(MPI_Request * request, MPI_Status * status),(request, status))
return MPI_Type_hvector(count, blocklen, stride, old_type, new_type);
}
-int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_indexed(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
if (old_type == MPI_DATATYPE_NULL) {
return MPI_ERR_TYPE;
} else if (count<0){
}
}
-int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_indexed(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
if (old_type == MPI_DATATYPE_NULL) {
return MPI_ERR_TYPE;
} else if (count<0){
}
}
-int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type,
+int PMPI_Type_create_indexed_block(int count, int blocklength, const int* indices, MPI_Datatype old_type,
MPI_Datatype* new_type)
{
if (old_type == MPI_DATATYPE_NULL) {
}
}
-int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+int PMPI_Type_create_hindexed(int count, const int* blocklens, const MPI_Aint* indices, MPI_Datatype old_type,
MPI_Datatype* new_type) {
- return PMPI_Type_hindexed(count, blocklens,indices,old_type,new_type);
+ return PMPI_Type_hindexed(count, const_cast<int*>(blocklens),const_cast<MPI_Aint*>(indices),old_type,new_type);
}
-int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type,
+int PMPI_Type_create_hindexed_block(int count, int blocklength, const MPI_Aint* indices, MPI_Datatype old_type,
MPI_Datatype* new_type) {
if (old_type == MPI_DATATYPE_NULL) {
return MPI_ERR_TYPE;
}
}
-int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+int PMPI_Type_create_struct(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,
MPI_Datatype* new_type) {
- return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
+ return PMPI_Type_struct(count, const_cast<int*>(blocklens), const_cast<MPI_Aint*>(indices), const_cast<MPI_Datatype*>(old_types), new_type);
}
-int PMPI_Type_create_subarray(int ndims, int* array_of_sizes,
- int* array_of_subsizes, int* array_of_starts,
+int PMPI_Type_create_subarray(int ndims, const int* array_of_sizes,
+ const int* array_of_subsizes, const int* array_of_starts,
int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
if (ndims<0){
return MPI_ERR_COUNT;
return simgrid::smpi::Keyval::keyval_free<simgrid::smpi::Datatype>(keyval);
}
-int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
+int PMPI_Unpack(const void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
if(incount<0 || outcount < 0){
return MPI_ERR_COUNT;
} else if (inbuf==nullptr || outbuf==nullptr){
}
}
-int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
+int PMPI_Pack(const void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
if(incount<0){
return MPI_ERR_COUNT;
} else if(inbuf==nullptr || outbuf==nullptr || outcount < 0){
MPI_Aint get_extent() { return ub_ - lb_; };
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,
+ static int copy(const 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);
+ virtual void serialize(const void* noncontiguous, void* contiguous, int count);
+ virtual void unserialize(const 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);
+ int pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
+ int unpack(const 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,
+ static int create_indexed(int count, const int* blocklens, const int* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
+ static int create_hindexed(int count, const int* blocklens, const 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,
+ static int create_struct(int count, const int* blocklens, const MPI_Aint* indices, const MPI_Datatype* old_types,
MPI_Datatype* new_type);
- static int create_subarray(int ndims, int* array_of_sizes,
- int* array_of_subsizes, int* array_of_starts,
+ static int create_subarray(int ndims, const int* array_of_sizes,
+ const int* array_of_subsizes, const int* array_of_starts,
int order, MPI_Datatype oldtype, MPI_Datatype *newtype);
static int create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent,
MPI_Datatype *newtype);
Type_Contiguous(const Type_Contiguous&) = delete;
Type_Contiguous& operator=(const Type_Contiguous&) = delete;
~Type_Contiguous();
- void serialize(void* noncontiguous, void* contiguous, int count);
- void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+ void serialize(const void* noncontiguous, void* contiguous, int count);
+ void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Hvector: public Datatype{
Type_Hvector(const Type_Hvector&) = delete;
Type_Hvector& operator=(const Type_Hvector&) = delete;
~Type_Hvector();
- void serialize(void* noncontiguous, void* contiguous, int count);
- void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+ void serialize(const void* noncontiguous, void* contiguous, int count);
+ void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Vector : public Type_Hvector {
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(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
+ Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths,
+ const MPI_Aint* block_indices, MPI_Datatype old_type);
+ Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths, const int* block_indices,
MPI_Datatype old_type, MPI_Aint factor);
Type_Hindexed(const Type_Hindexed&) = delete;
Type_Hindexed& operator=(const Type_Hindexed&) = delete;
~Type_Hindexed();
- void serialize(void* noncontiguous, void* contiguous, int count);
- void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+ void serialize(const void* noncontiguous, void* contiguous, int count);
+ void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
class Type_Indexed : public Type_Hindexed {
public:
- Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
+ Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths, const int* block_indices,
MPI_Datatype old_type);
};
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(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths,
+ const MPI_Aint* block_indices, const MPI_Datatype* old_types);
Type_Struct(const Type_Struct&) = delete;
Type_Struct& operator=(const Type_Struct&) = delete;
~Type_Struct();
- void serialize(void* noncontiguous, void* contiguous, int count);
- void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+ void serialize(const void* noncontiguous, void* contiguous, int count);
+ void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
};
} // namespace smpi
bool is_fortran_op() { return is_fortran_op_; }
// tell that we were created from fortran, so we need to translate the type to fortran when called
void set_fortran_op() { is_fortran_op_ = true; }
- void apply(void* invec, void* inoutvec, int* len, MPI_Datatype datatype);
+ void apply(const void* invec, void* inoutvec, int* len, MPI_Datatype datatype);
static Op* f2c(int id);
void ref();
static void unref(MPI_Op* op);
name_ = xbt_strdup(name);
}
-int Datatype::pack(void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm)
+int Datatype::pack(const void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm)
{
if (outcount - *position < incount*static_cast<int>(size_))
return MPI_ERR_OTHER;
return MPI_SUCCESS;
}
-int Datatype::unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm)
+int Datatype::unpack(const void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm)
{
if (outcount*static_cast<int>(size_)> insize)
return MPI_ERR_OTHER;
- Datatype::copy(static_cast<char*>(inbuf) + *position, insize, MPI_CHAR, outbuf, outcount, this);
+ Datatype::copy(static_cast<const char*>(inbuf) + *position, insize, MPI_CHAR, outbuf, outcount, this);
*position += outcount * size_;
return MPI_SUCCESS;
}
-int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+int Datatype::copy(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype){
// FIXME Handle the case of a partial shared malloc.
}
//Default serialization method : memcpy.
-void Datatype::serialize(void* noncontiguous_buf, void* contiguous_buf, int count)
+void Datatype::serialize(const 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_;
+ const char* noncontiguous_buf_char = static_cast<const char*>(noncontiguous_buf)+lb_;
memcpy(contiguous_buf_char, noncontiguous_buf_char, count*size_);
}
-void Datatype::unserialize( void* contiguous_buf, void *noncontiguous_buf, int count, MPI_Op op){
- char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+void Datatype::unserialize(const void* contiguous_buf, void *noncontiguous_buf, int count, MPI_Op op){
+ const char* contiguous_buf_char = static_cast<const char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb_;
int n=count;
if(op!=MPI_OP_NULL)
return retval;
}
-int Datatype::create_indexed(int count, int* block_lengths, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type){
+int Datatype::create_indexed(int count, const int* block_lengths, const int* indices, MPI_Datatype old_type, MPI_Datatype* new_type){
int size = 0;
bool contiguous=true;
MPI_Aint lb = 0;
return MPI_SUCCESS;
}
-int Datatype::create_hindexed(int count, int* block_lengths, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type){
+int Datatype::create_hindexed(int count, const int* block_lengths, const MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type){
int size = 0;
bool contiguous=true;
MPI_Aint lb = 0;
return MPI_SUCCESS;
}
-int Datatype::create_struct(int count, int* block_lengths, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type){
+int Datatype::create_struct(int count, const int* block_lengths, const MPI_Aint* indices, const MPI_Datatype* old_types, MPI_Datatype* new_type){
size_t size = 0;
bool contiguous=true;
size = 0;
return MPI_SUCCESS;
}
-int Datatype::create_subarray(int ndims, int* array_of_sizes,
- int* array_of_subsizes, int* array_of_starts,
+int Datatype::create_subarray(int ndims, const int* array_of_sizes,
+ const int* array_of_subsizes, const int* array_of_starts,
int order, MPI_Datatype oldtype, MPI_Datatype *newtype){
MPI_Datatype tmp;
Datatype::unref(old_type_);
}
-void Type_Contiguous::serialize(void* noncontiguous_buf, void* contiguous_buf, int count)
+void Type_Contiguous::serialize(const 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();
+ const char* noncontiguous_buf_char = static_cast<const 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(const void* contiguous_buf, void* noncontiguous_buf, int count, MPI_Op op)
{
- char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+ const char* contiguous_buf_char = static_cast<const char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb();
int n= count*block_count_;
if(op!=MPI_OP_NULL)
Datatype::unref(old_type_);
}
-void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf,
+void Type_Hvector::serialize(const 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);
+ const char* noncontiguous_buf_char = static_cast<const char*>(noncontiguous_buf);
for (int i = 0; i < block_count_ * count; i++) {
if (not(old_type_->flags() & DT_FLAG_DERIVED))
}
}
-void Type_Hvector::unserialize( void* contiguous_buf, void *noncontiguous_buf,
+void Type_Hvector::unserialize(const void* contiguous_buf, void *noncontiguous_buf,
int count, MPI_Op op){
- char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+ const char* contiguous_buf_char = static_cast<const char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf);
for (int i = 0; i < block_count_ * count; i++) {
{
}
-Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths,
- MPI_Aint* block_indices, MPI_Datatype old_type)
+Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
+ const MPI_Aint* block_indices, MPI_Datatype old_type)
: Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
{
old_type_->ref();
}
}
-Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths,
- int* block_indices, MPI_Datatype old_type, MPI_Aint factor)
+Type_Hindexed::Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
+ const int* block_indices, MPI_Datatype old_type, MPI_Aint factor)
: Datatype(size, lb, ub, flags), block_count_(count), old_type_(old_type)
{
old_type_->ref();
}
}
-void Type_Hindexed::serialize( void* noncontiguous_buf, void *contiguous_buf,
+void Type_Hindexed::serialize(const 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)+ block_indices_[0];
+ const char* noncontiguous_buf_iter = static_cast<const char*>(noncontiguous_buf);
+ const char* noncontiguous_buf_char = noncontiguous_buf_iter + block_indices_[0];
for (int j = 0; j < count; j++) {
for (int i = 0; i < block_count_; i++) {
if (not(old_type_->flags() & DT_FLAG_DERIVED))
contiguous_buf_char += block_lengths_[i]*old_type_->size();
if (i<block_count_-1)
- noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf) + block_indices_[i+1];
+ noncontiguous_buf_char = noncontiguous_buf_iter + block_indices_[i+1];
else
noncontiguous_buf_char += block_lengths_[i]*old_type_->get_extent();
}
- noncontiguous_buf=static_cast<void*>(noncontiguous_buf_char);
+ noncontiguous_buf_iter=noncontiguous_buf_char;
}
}
-void Type_Hindexed::unserialize( void* contiguous_buf, void *noncontiguous_buf,
+void Type_Hindexed::unserialize(const void* contiguous_buf, void *noncontiguous_buf,
int count, MPI_Op op){
- char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+ const char* contiguous_buf_char = static_cast<const char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
for (int j = 0; j < count; j++) {
for (int i = 0; i < block_count_; i++) {
}
}
-Type_Indexed::Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths,
- int* block_indices, MPI_Datatype old_type)
+Type_Indexed::Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths,
+ const int* block_indices, MPI_Datatype old_type)
: Type_Hindexed(size, lb, ub, flags, count, block_lengths, block_indices, old_type, old_type->get_extent())
{
}
-Type_Struct::Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types): Datatype(size, lb, ub, flags), block_count_(count), block_lengths_(block_lengths), block_indices_(block_indices), old_types_(old_types){
+Type_Struct::Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, const int* block_lengths, const MPI_Aint* block_indices, const MPI_Datatype* old_types): Datatype(size, lb, ub, flags), block_count_(count){
block_lengths_= new int[count];
block_indices_= new MPI_Aint[count];
old_types_= new MPI_Datatype[count];
}
-void Type_Struct::serialize( void* noncontiguous_buf, void *contiguous_buf,
+void Type_Struct::serialize(const 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)+ block_indices_[0];
+ const char* noncontiguous_buf_iter = static_cast<const char*>(noncontiguous_buf);
+ const char* noncontiguous_buf_char = noncontiguous_buf_iter + block_indices_[0];
for (int j = 0; j < count; j++) {
for (int i = 0; i < block_count_; i++) {
if (not(old_types_[i]->flags() & DT_FLAG_DERIVED))
contiguous_buf_char += block_lengths_[i]*old_types_[i]->size();
if (i<block_count_-1)
- noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf) + block_indices_[i+1];
+ noncontiguous_buf_char = noncontiguous_buf_iter + block_indices_[i+1];
else //let's hope this is MPI_UB ?
noncontiguous_buf_char += block_lengths_[i]*old_types_[i]->get_extent();
}
- noncontiguous_buf=static_cast<void*>(noncontiguous_buf_char);
+ noncontiguous_buf_iter=noncontiguous_buf_char;
}
}
-void Type_Struct::unserialize( void* contiguous_buf, void *noncontiguous_buf,
+void Type_Struct::unserialize(const void* contiguous_buf, void *noncontiguous_buf,
int count, MPI_Op op){
- char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
+ const char* contiguous_buf_char = static_cast<const char*>(contiguous_buf);
char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+ block_indices_[0];
for (int j = 0; j < count; j++) {
for (int i = 0; i < block_count_; i++) {
namespace simgrid{
namespace smpi{
-void Op::apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype)
+void Op::apply(const void *invec, void *inoutvec, int *len, MPI_Datatype datatype)
{
if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
// we need to switch as the called function may silently touch global variables
if (not smpi_process()->replaying() && *len > 0) {
if (not is_fortran_op_)
- this->func_(invec, inoutvec, len, &datatype);
+ this->func_(const_cast<void*>(invec), inoutvec, len, &datatype);
else{
XBT_DEBUG("Applying operation of length %d from %p and from/to %p", *len, invec, inoutvec);
int tmp = datatype->c2f();
/* Unfortunately, the C and Fortran version of the MPI standard do not agree on the type here,
thus the reinterpret_cast. */
- this->func_(invec, inoutvec, len, reinterpret_cast<MPI_Datatype*>(&tmp) );
+ this->func_(const_cast<void*>(invec), inoutvec, len, reinterpret_cast<MPI_Datatype*>(&tmp) );
}
}
}