return ret;
}
-
static char *smpi_container(int rank, char *container, int n)
{
snprintf(container, n, "rank-%d", rank);
static char *TRACE_smpi_get_key(int src, int dst, char *key, int n);
-
static char *TRACE_smpi_put_key(int src, int dst, char *key, int n)
{
//get the dynar for src#dst
snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
xbt_dynar_t d = static_cast<xbt_dynar_t>(xbt_dict_get_or_null(keys, aux));
-
if(!xbt_dynar_is_empty(d)){
//receive was already pushed, perform a get instead
TRACE_smpi_get_key(src , dst, key ,n);
new_pajePushStateWithExtra (SIMIX_get_clock(), container, type, value, (void*)extra);
}
-
void TRACE_smpi_collective_out(int rank, int root, const char *operation)
{
if (!TRACE_smpi_is_enabled()) return;
new_pajePopState (SIMIX_get_clock(), container, type);
}
-
void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
{
//do not forget to set the color first, otherwise this will explode
#define RMA 0x200
#define ACCUMULATE 0x400
-
enum smpi_process_state{
SMPI_UNINITIALIZED,
SMPI_INITIALIZED,
int in_use;
} s_smpi_mpi_datatype_t;
-
#define COLL_TAG_REDUCE -112
#define COLL_TAG_SCATTER -223
#define COLL_TAG_SCATTERV -334
#define MPI_COMM_UNINITIALIZED ((MPI_Comm)-1)
-//*****************************************************************************************
-
typedef struct s_smpi_mpi_request {
void *buf;
/* in the case of non-contiguous memory the user address should be keep
int refcount;
} s_smpi_mpi_info_t;
-
XBT_PRIVATE void smpi_process_destroy(void);
XBT_PRIVATE void smpi_process_finalize(void);
XBT_PRIVATE int smpi_process_finalized(void);
XBT_PRIVATE int smpi_process_initialized(void);
XBT_PRIVATE void smpi_process_mark_as_initialized(void);
-
struct s_smpi_mpi_cart_topology;
typedef struct s_smpi_mpi_cart_topology *MPIR_Cart_Topology;
XBT_PRIVATE MPI_Topology smpi_topo_create(MPIR_Topo_type kind);
XBT_PRIVATE void smpi_cart_topo_destroy(MPIR_Cart_Topology cart);
XBT_PRIVATE MPI_Topology smpi_cart_topo_create(int ndims);
-XBT_PRIVATE int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[],
- int periods[], int reorder, MPI_Comm *comm_cart);
+XBT_PRIVATE int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder,
+ MPI_Comm *comm_cart);
XBT_PRIVATE int smpi_mpi_cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm);
-XBT_PRIVATE int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims,
- int coords[]);
-XBT_PRIVATE int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods,
- int* coords);
+XBT_PRIVATE int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]);
+XBT_PRIVATE int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords);
XBT_PRIVATE int smpi_mpi_cart_rank(MPI_Comm comm, int* coords, int* rank);
-XBT_PRIVATE int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp,
- int *rank_source, int *rank_dest);
+XBT_PRIVATE int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source, int *rank_dest);
XBT_PRIVATE int smpi_mpi_cartdim_get(MPI_Comm comm, int *ndims);
XBT_PRIVATE int smpi_mpi_dims_create(int nnodes, int ndims, int dims[]);
-
XBT_PRIVATE smpi_process_data_t smpi_process_data(void);
XBT_PRIVATE smpi_process_data_t smpi_process_remote_data(int index);
// smpi_process_[set/get]_user_data must be public
XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm**, xbt_bar_t*);
XBT_PRIVATE void smpi_deployment_cleanup_instances(void);
-XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_synchro_t comm,
- void *buff, size_t buff_size);
+XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size);
-XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm,
- void *buff, size_t buff_size);
+XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size);
XBT_PRIVATE void print_request(const char *message, MPI_Request request);
XBT_PRIVATE MPI_Aint smpi_datatype_lb(MPI_Datatype datatype);
XBT_PRIVATE MPI_Aint smpi_datatype_ub(MPI_Datatype datatype);
XBT_PRIVATE int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t);
-XBT_PRIVATE int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
- MPI_Aint * extent);
+XBT_PRIVATE int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent);
XBT_PRIVATE MPI_Aint smpi_datatype_get_extent(MPI_Datatype datatype);
XBT_PRIVATE void smpi_datatype_get_name(MPI_Datatype datatype, char* name, int* length);
XBT_PRIVATE void smpi_datatype_set_name(MPI_Datatype datatype, char* name);
-XBT_PRIVATE int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount,
+XBT_PRIVATE int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount,
MPI_Datatype recvtype);
XBT_PRIVATE void smpi_datatype_use(MPI_Datatype type);
XBT_PRIVATE void smpi_datatype_unuse(MPI_Datatype type);
-XBT_PRIVATE int smpi_datatype_contiguous(int count, MPI_Datatype old_type,
- MPI_Datatype* new_type, MPI_Aint lb);
-XBT_PRIVATE int smpi_datatype_vector(int count, int blocklen, int stride,
- MPI_Datatype old_type, MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type, MPI_Aint lb);
+XBT_PRIVATE int smpi_datatype_vector(int count, int blocklen, int stride, MPI_Datatype old_type,
+ MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride,
- MPI_Datatype old_type, MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_indexed(int count, int* blocklens, int* indices,
- MPI_Datatype old_type, MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices,
- MPI_Datatype old_type, MPI_Datatype* new_type);
-XBT_PRIVATE int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices,
- MPI_Datatype* old_types, MPI_Datatype* new_type);
-
-XBT_PRIVATE void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype, void *struct_type, int flags);
+XBT_PRIVATE int smpi_datatype_hvector(int count, int blocklen, MPI_Aint stride,MPI_Datatype old_type,
+ MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type);
+XBT_PRIVATE int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+ MPI_Datatype* new_type);
+XBT_PRIVATE void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype,
+ void *struct_type, int flags);
XBT_PRIVATE void smpi_datatype_free(MPI_Datatype* type);
XBT_PRIVATE void smpi_datatype_commit(MPI_Datatype* datatype);
-XBT_PRIVATE int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm);
-XBT_PRIVATE int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm);
+XBT_PRIVATE int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type,
+ MPI_Comm comm);
+XBT_PRIVATE int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position,
+ MPI_Comm comm);
XBT_PRIVATE void smpi_empty_status(MPI_Status * status);
XBT_PRIVATE MPI_Op smpi_op_new(MPI_User_function * function, int commute);
XBT_PRIVATE int smpi_op_is_commute(MPI_Op op);
XBT_PRIVATE void smpi_op_destroy(MPI_Op op);
-XBT_PRIVATE void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
- MPI_Datatype * datatype);
+XBT_PRIVATE void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len, MPI_Datatype * datatype);
XBT_PRIVATE MPI_Group smpi_group_new(int size);
XBT_PRIVATE MPI_Group smpi_group_copy(MPI_Group origin);
XBT_PRIVATE int smpi_group_compare(MPI_Group group1, MPI_Group group2);
XBT_PRIVATE int smpi_group_incl(MPI_Group group, int n, int* ranks, MPI_Group* newgroup);
-
XBT_PRIVATE MPI_Topology smpi_comm_topo(MPI_Comm comm);
XBT_PRIVATE MPI_Comm smpi_comm_new(MPI_Group group, MPI_Topology topo);
XBT_PRIVATE void smpi_comm_destroy(MPI_Comm comm);
XBT_PRIVATE int smpi_info_c2f(MPI_Info info);
XBT_PRIVATE MPI_Info smpi_info_f2c(int info);
-XBT_PRIVATE MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype,
- int src, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
+ MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag,
+ MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_ssend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
+ MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_start(MPI_Request request);
XBT_PRIVATE void smpi_mpi_startall(int count, MPI_Request * requests);
XBT_PRIVATE void smpi_mpi_request_free(MPI_Request * request);
-XBT_PRIVATE MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_issend_init(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
- int src, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
- int src, int tag, MPI_Comm comm);
-XBT_PRIVATE MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype,
- int src, int dst, int tag, MPI_Comm comm, MPI_Op op);
-XBT_PRIVATE MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype,
- int src, int dst, int tag, MPI_Comm comm, MPI_Op op);
-XBT_PRIVATE void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
- int tag, MPI_Comm comm, MPI_Status * status);
-XBT_PRIVATE void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- int dst, int sendtag, void *recvbuf, int recvcount,
- MPI_Datatype recvtype, int src, int recvtag,
- MPI_Comm comm, MPI_Status * status);
+XBT_PRIVATE MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_issend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
+XBT_PRIVATE MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag,
+ MPI_Comm comm, MPI_Op op);
+XBT_PRIVATE MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag,
+ MPI_Comm comm, MPI_Op op);
+XBT_PRIVATE void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,int tag, MPI_Comm comm,
+ MPI_Status * status);
+XBT_PRIVATE void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag,
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag,
+ MPI_Comm comm, MPI_Status * status);
XBT_PRIVATE int smpi_mpi_test(MPI_Request * request, MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
- MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_testall(int count, MPI_Request requests[],
- MPI_Status status[]);
+XBT_PRIVATE int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * status);
+XBT_PRIVATE int smpi_mpi_testall(int count, MPI_Request requests[], MPI_Status status[]);
XBT_PRIVATE void smpi_mpi_probe(int source, int tag, MPI_Comm comm, MPI_Status* status);
-XBT_PRIVATE void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag,
- MPI_Status* status);
+XBT_PRIVATE void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status);
XBT_PRIVATE int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
XBT_PRIVATE void smpi_mpi_wait(MPI_Request * request, MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_waitany(int count, MPI_Request requests[],
- MPI_Status * status);
-XBT_PRIVATE int smpi_mpi_waitall(int count, MPI_Request requests[],
- MPI_Status status[]);
-XBT_PRIVATE int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
- MPI_Status status[]);
-XBT_PRIVATE int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
- MPI_Status status[]);
-XBT_PRIVATE void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
- MPI_Comm comm);
+XBT_PRIVATE int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status * status);
+XBT_PRIVATE int smpi_mpi_waitall(int count, MPI_Request requests[], MPI_Status status[]);
+XBT_PRIVATE int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[]);
+XBT_PRIVATE int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[]);
+XBT_PRIVATE void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_barrier(MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm);
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts, int *displs,
- MPI_Datatype recvtype, int root, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_allgather(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int *recvcounts, int *displs,
- MPI_Datatype recvtype, MPI_Comm comm);
+ void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+ int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+ int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
- MPI_Datatype sendtype, void *recvbuf, int recvcount,
- MPI_Datatype recvtype, int root, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, int root,
- MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
-XBT_PRIVATE void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype,
+ void *recvbuf, int recvcount,MPI_Datatype recvtype, int root, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
+ MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,MPI_Datatype datatype, MPI_Op op,
+ MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,MPI_Datatype datatype, MPI_Op op, MPI_Comm comm);
+XBT_PRIVATE void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
+ MPI_Comm comm);
XBT_PRIVATE int smpi_mpi_win_free( MPI_Win* win);
XBT_PRIVATE int smpi_mpi_accumulate( 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_Op op, MPI_Win win);
-XBT_PRIVATE void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root,
- MPI_Comm comm, int arity);
+XBT_PRIVATE void nary_tree_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm, int arity);
XBT_PRIVATE void nary_tree_barrier(MPI_Comm comm, int arity);
-XBT_PRIVATE int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm);
-XBT_PRIVATE int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm);
-XBT_PRIVATE int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount,
- MPI_Datatype sendtype,
- void *recvbuf, int recvcount,
- MPI_Datatype recvtype,
- MPI_Comm comm);
-XBT_PRIVATE int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts,
- int *senddisps, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts,
- int *recvdisps, MPI_Datatype recvtype,
- MPI_Comm comm);
-
-XBT_PRIVATE int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state);
+XBT_PRIVATE int smpi_coll_tuned_alltoall_ompi2(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+ int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE int smpi_coll_tuned_alltoall_bruck(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+ int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE int smpi_coll_tuned_alltoall_basic_linear(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm);
+XBT_PRIVATE int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MPI_Datatype sendtype,
+ void *recvbuf, int *recvcounts, int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm);
+
+XBT_PRIVATE int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn,
+ int* keyval, void* extra_state);
XBT_PRIVATE int smpi_comm_keyval_free(int* keyval);
XBT_PRIVATE int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag);
XBT_PRIVATE int smpi_comm_attr_delete(MPI_Comm comm, int keyval);
XBT_PRIVATE int smpi_type_attr_delete(MPI_Datatype type, int keyval);
XBT_PRIVATE int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag);
XBT_PRIVATE int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value);
-XBT_PRIVATE int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state);
+XBT_PRIVATE int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn,
+ int* keyval, void* extra_state);
XBT_PRIVATE int smpi_type_keyval_free(int* keyval);
// utilities
extern XBT_PRIVATE double smpi_cpu_threshold;
extern XBT_PRIVATE char* smpi_start_data_exe; //start of the data+bss segment of the executable
extern XBT_PRIVATE int smpi_size_data_exe; //size of the data+bss segment of the executable
-
XBT_PRIVATE void smpi_switch_data_segment(int dest);
XBT_PRIVATE void smpi_really_switch_data_segment(int dest);
XBT_PRIVATE int smpi_is_privatisation_file(char* file);
XBT_PRIVATE XBT_PRIVATE int smpi_comm_attr_delete(MPI_Comm comm, int keyval);
XBT_PRIVATE int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value);
-
-
// f77 wrappers
void mpi_init_(int*);
void mpi_finalize_(int*);
void mpi_comm_split_(int* comm, int* color, int* key, int* comm_out, int* ierr);
void mpi_group_incl_(int* group, int* n, int* key, int* group_out, int* ierr) ;
void mpi_comm_group_(int* comm, int* group_out, int* ierr);
-void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag,
- int* comm, int* request, int* ierr);
-void mpi_isend_(void *buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* request, int* ierr);
-void mpi_irsend_(void *buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* request, int* ierr);
-void mpi_send_(void* buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* ierr);
-void mpi_rsend_(void* buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* ierr);
-void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag,
- int* comm, int* request, int* ierr);
-void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag,
- int* comm, int* request, int* ierr);
-void mpi_recv_(void* buf, int* count, int* datatype, int* src,
- int* tag, int* comm, MPI_Status* status, int* ierr);
+void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr);
+void mpi_isend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr);
+void mpi_irsend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr);
+void mpi_send_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr);
+void mpi_rsend_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr);
+void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr);
+void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr);
+void mpi_recv_(void* buf, int* count, int* datatype, int* src, int* tag, int* comm, MPI_Status* status, int* ierr);
void mpi_start_(int* request, int* ierr);
void mpi_startall_(int* count, int* requests, int* ierr);
void mpi_wait_(int* request, MPI_Status* status, int* ierr);
void mpi_barrier_(int* comm, int* ierr);
void mpi_bcast_(void* buf, int* count, int* datatype, int* root, int* comm, int* ierr);
-void mpi_reduce_(void* sendbuf, void* recvbuf, int* count,
- int* datatype, int* op, int* root, int* comm, int* ierr);
-void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype,
- int* op, int* comm, int* ierr);
-void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
- int* op, int* comm, int* ierr) ;
-void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
+void mpi_reduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* ierr);
+void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
+void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* ierr) ;
+void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr);
void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
- int* root, int* comm, int* ierr);
-void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
+ void* recvbuf, int* recvcount, int* recvtype, int* root, int* comm, int* ierr);
+void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr);
void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcounts, int* displs, int* recvtype,
- int* root, int* comm, int* ierr);
+ void* recvbuf, int* recvcounts, int* displs, int* recvtype, int* root, int* comm, int* ierr);
void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
- int* comm, int* ierr);
+ void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount,int* displs, int* recvtype,
- int* comm, int* ierr) ;
+ void* recvbuf, int* recvcount,int* displs, int* recvtype, int* comm, int* ierr) ;
void mpi_type_size_(int* datatype, int *size, int* ierr);
-void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype,
- int* op, int* comm, int* ierr);
+void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
void mpi_alltoall_(void* sendbuf, int* sendcount, int* sendtype,
void* recvbuf, int* recvcount, int* recvtype, int* comm, int* ierr);
void mpi_alltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendtype,
void mpi_accumulate_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank,
MPI_Aint* target_disp, int* target_count, int* target_datatype, int* op, int* win, int* ierr);
void mpi_error_string_(int* errorcode, char* string, int* resultlen, int* ierr);
-void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst,
- int* sendtag, void *recvbuf, int* recvcount,
- int* recvtype, int* src, int* recvtag,
- int* comm, MPI_Status* status, int* ierr);
+void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst, int* sendtag, void *recvbuf, int* recvcount,
+ int* recvtype, int* src, int* recvtag, int* comm, MPI_Status* status, int* ierr);
void mpi_finalized_ (int * flag, int* ierr);
void mpi_init_thread_ (int *required, int *provided, int* ierr);
void mpi_testany_ (int* count, int* requests, int *index, int *flag, MPI_Status* status, int* ierr);
void mpi_waitsome_ (int* incount, int* requests, int *outcount, int *indices, MPI_Status* status, int* ierr);
void mpi_reduce_local_ (void *inbuf, void *inoutbuf, int* count, int* datatype, int* op, int* ierr);
-void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm, int* ierr);
+void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm,
+ int* ierr);
void mpi_pack_size_ (int* incount, int* datatype, int* comm, int* size, int* ierr) ;
void mpi_cart_coords_ (int* comm, int* rank, int* maxdims, int* coords, int* ierr) ;
void mpi_cart_create_ (int* comm_old, int* ndims, int* dims, int* periods, int* reorder, int* comm_cart, int* ierr) ;
void mpi_buffer_detach_ (void* buffer, int* size, int* ierr) ;
void mpi_testsome_ (int* incount, int* requests, int* outcount, int* indices, MPI_Status* statuses, int* ierr) ;
void mpi_comm_test_inter_ (int* comm, int* flag, int* ierr) ;
-void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm, int* ierr) ;
+void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm,
+ int* ierr) ;
void mpi_pack_external_size_ (char *datarep, int* incount, int* datatype, MPI_Aint *size, int* ierr);
-void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount, MPI_Aint *position, int* ierr);
-void mpi_unpack_external_ ( char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf, int* outcount, int* datatype, int* ierr);
+void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount,
+ MPI_Aint *position, int* ierr);
+void mpi_unpack_external_ (char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf,
+ int* outcount, int* datatype, int* ierr);
void mpi_type_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr) ;
-void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr) ;
-void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype, int* ierr) ;
+void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr);
+void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype,
+ int* ierr) ;
void mpi_type_indexed_ (int* count, int* blocklens, int* indices, int* old_type, int* newtype, int* ierr) ;
-void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, int* old_type, int*newtype, int* ierr);
+void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, int* old_type, int*newtype,
+ int* ierr);
void mpi_type_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr) ;
-void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr) ;
+void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr);
void mpi_ssend_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr) ;
void mpi_ssend_init_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* request, int* ierr) ;
-void mpi_intercomm_create_ (int* local_comm, int* local_leader, int* peer_comm, int* remote_leader, int* tag, int* comm_out, int* ierr) ;
+void mpi_intercomm_create_ (int* local_comm, int* local_leader, int* peer_comm, int* remote_leader, int* tag,
+ int* comm_out, int* ierr) ;
void mpi_intercomm_merge_ (int* comm, int* high, int* comm_out, int* ierr) ;
void mpi_bsend_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* ierr) ;
void mpi_bsend_init_ (void* buf, int* count, int* datatype, int* dest, int* tag, int* comm, int* request, int* ierr) ;
void mpi_keyval_create_ (void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr) ;
void mpi_keyval_free_ (int* keyval, int* ierr) ;
void mpi_test_cancelled_ (MPI_Status* status, int* flag, int* ierr) ;
-void mpi_pack_ (void* inbuf, int* incount, int* type, void* outbuf, int* outcount, int* position, int* comm, int* ierr) ;
+void mpi_pack_ (void* inbuf, int* incount, int* type, void* outbuf, int* outcount, int* position, int* comm, int* ierr);
void mpi_get_elements_ (MPI_Status* status, int* datatype, int* elements, int* ierr) ;
void mpi_dims_create_ (int* nnodes, int* ndims, int* dims, int* ierr) ;
void mpi_iprobe_ (int* source, int* tag, int* comm, int* flag, MPI_Status* status, int* ierr) ;
-void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner, int* ierr);
-void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
+void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner,
+ int* ierr);
+void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes,
+ int* array_of_integers, MPI_Aint* array_of_addresses,
int*array_of_datatypes, int* ierr);
-void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
+void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs,
+ int* array_of_dargs, int* array_of_psizes,
int* order, int* oldtype, int*newtype, int* ierr) ;
void mpi_type_create_resized_ (int* oldtype,MPI_Aint* lb, MPI_Aint* extent, int*newtype, int* ierr);
-void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int* order, int* oldtype, int*newtype, int* ierr);
+void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts,
+ int* order, int* oldtype, int*newtype, int* ierr);
void mpi_type_match_size_ (int* typeclass,int* size,int*datatype, int* ierr);
-void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int*sendtypes, void *recvbuf, int *recvcnts, int *rdispls, int*recvtypes,
- int* comm, int* ierr);
+void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int*sendtypes, void *recvbuf, int *recvcnts,
+ int *rdispls, int*recvtypes, int* comm, int* ierr);
void mpi_exscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr);
void mpi_comm_set_name_ (int* comm, char* name, int* ierr, int size);
void mpi_comm_dup_with_info_ (int* comm, int* info, int* newcomm, int* ierr);
void mpi_open_port_ ( int* info, char *port_name, int* ierr);
void mpi_close_port_ ( char *port_name, int* ierr);
void mpi_comm_accept_ ( char *port_name, int* info, int* root, int* comm, int* newcomm, int* ierr);
-void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int*intercomm, int* array_of_errcodes, int* ierr);
-void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs, int* array_of_info, int* root,
- int* comm, int*intercomm, int* array_of_errcodes, int* ierr);
+void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int*intercomm,
+ int* array_of_errcodes, int* ierr);
+void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs,
+ int* array_of_info, int* root, int* comm, int*intercomm, int* array_of_errcodes, int* ierr);
void mpi_comm_get_parent_ ( int*parent, int* ierr);
-
/********** Tracing **********/
/* from instr_smpi.c */
XBT_PRIVATE void TRACE_internal_smpi_set_category (const char *category);
}
SG_END_DECL()
-
#endif
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi, "Logging specific to SMPI (base)");
-
static int match_recv(void* a, void* b, smx_synchro_t ignored) {
MPI_Request ref = (MPI_Request)a;
MPI_Request req = (MPI_Request)b;
} else return 0;
}
-
// Methods used to parse and store the values for timing injections in smpi
// These are taken from surf/network.c and generalized to have more values for each factor
typedef struct s_smpi_factor_multival *smpi_os_factor_multival_t;
(((s_smpi_factor_multival_t*)pa)->factor < ((s_smpi_factor_multival_t*)pb)->factor) ? -1 : 0;
}
-
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
{
char *value = NULL;
unsigned int iter = 0;
s_smpi_factor_multival_t fact;
double current=0.0;
- // Iterate over all the sections that were specified and find the right
- // value. (fact.factor represents the interval sizes; we want to find the
- // section that has fact.factor <= size and no other such fact.factor <= size)
+ // Iterate over all the sections that were specified and find the right value. (fact.factor represents the interval
+ // sizes; we want to find the section that has fact.factor <= size and no other such fact.factor <= size)
// Note: parse_factor() (used before) already sorts the dynar we iterate over!
xbt_dynar_foreach(smpi_ois_values, iter, fact) {
- if (size <= fact.factor) { // Values already too large, use the previously
- // computed value of current!
+ if (size <= fact.factor) { // Values already too large, use the previously computed value of current!
XBT_DEBUG("ois : %f <= %ld return %f", size, fact.factor, current);
return current;
}else{
unsigned int iter = 0;
s_smpi_factor_multival_t fact;
double current=0.0;
- // Iterate over all the sections that were specified and find the right
- // value. (fact.factor represents the interval sizes; we want to find the
- // section that has fact.factor <= size and no other such fact.factor <= size)
+ // Iterate over all the sections that were specified and find the right value. (fact.factor represents the interval
+ // sizes; we want to find the section that has fact.factor <= size and no other such fact.factor <= size)
// Note: parse_factor() (used before) already sorts the dynar we iterate over!
xbt_dynar_foreach(smpi_or_values, iter, fact) {
if (size <= fact.factor) { // Values already too large, use the previously
return time;
}
-static MPI_Request build_request(void *buf, int count,
- MPI_Datatype datatype, int src, int dst,
- int tag, MPI_Comm comm, unsigned flags)
+static MPI_Request build_request(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
+ unsigned flags)
{
MPI_Request request = NULL;
}
request->buf = buf;
- // This part handles the problem of non-contiguous memory (for the
- // unserialisation at the reception)
+ // This part handles the problem of non-contiguous memory (for the unserialisation at the reception)
request->old_buf = old_buf;
request->old_type = datatype;
return request;
}
-
void smpi_empty_status(MPI_Status * status)
{
if(status != MPI_STATUS_IGNORE) {
int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, PERSISTENT | SEND | PREPARED);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag, comm, PERSISTENT | SEND | PREPARED);
return request;
}
int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, PERSISTENT | SSEND | SEND | PREPARED);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag, comm, PERSISTENT | SSEND | SEND | PREPARED);
return request;
}
int src, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
- comm, PERSISTENT | RECV | PREPARED);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype,
+ src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src),
+ smpi_process_index(), tag, comm, PERSISTENT | RECV | PREPARED);
return request;
}
void smpi_mpi_start(MPI_Request request)
{
smx_mailbox_t mailbox;
-
+
xbt_assert(!request->action, "Cannot (re)start a non-finished communication");
request->flags &= ~PREPARED;
request->flags &= ~FINISHED;
if (async_small_thresh == 0 && !(request->flags & RMA)) {
mailbox = smpi_process_mailbox();
- }
- else if (request->flags & RMA || static_cast<int>(request->size) < async_small_thresh){
- //We have to check both mailboxes (because SSEND messages are sent to the large mbox). begin with the more appropriate one : the small one.
+ } else if (request->flags & RMA || static_cast<int>(request->size) < async_small_thresh){
+ //We have to check both mailboxes (because SSEND messages are sent to the large mbox).
+ //begin with the more appropriate one : the small one.
mailbox = smpi_process_mailbox_small();
XBT_DEBUG("Is there a corresponding send already posted in the small mailbox %p (in case of SSEND)?", mailbox);
smx_synchro_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
simcall_process_sleep(sleeptime);
XBT_DEBUG("receiving size of %zu : sleep %f ", request->size, smpi_or(request->size));
}
-
+
// we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
request->real_size=request->size;
smpi_datatype_use(request->old_type);
smpi_comm_use(request->comm);
- request->action = simcall_comm_irecv(SIMIX_process_self(), mailbox, request->buf,
- &request->real_size, &match_recv,
+ request->action = simcall_comm_irecv(SIMIX_process_self(), mailbox, request->buf, &request->real_size, &match_recv,
!smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
- : &smpi_comm_null_copy_buffer_callback,
- request, -1.0);
+ : &smpi_comm_null_copy_buffer_callback, request, -1.0);
XBT_DEBUG("recv simcall posted");
if (async_small_thresh != 0 || (request->flags & RMA))
xbt_mutex_release(mut);
} else {
-
-
int receiver = request->dst;
int rank = request->src;
TRACE_smpi_send(rank, rank, receiver,request->size);
}
print_request("New send", request);
-
- //if we are giving back the control to the user without waiting for completion, we have to inject timings
+
+ //if we are giving back the control to the user without waiting for completion, we have to inject timings
double sleeptime = 0.0;
if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend
//isend and send timings may be different
}
void* buf = request->buf;
- if ( (! (request->flags & SSEND)) && (static_cast<int>(request->size) < sg_cfg_get_int("smpi/send_is_detached_thresh"))) {
+ if ( (! (request->flags & SSEND)) &&
+ (static_cast<int>(request->size) < sg_cfg_get_int("smpi/send_is_detached_thresh"))) {
void *oldbuf = NULL;
request->detached = 1;
XBT_DEBUG("Send request %p is detached", request);
request->real_size=request->size;
smpi_datatype_use(request->old_type);
smpi_comm_use(request->comm);
- request->action =
- simcall_comm_isend(SIMIX_process_from_PID(request->src+1), mailbox, request->size, -1.0,
- buf, request->real_size,
- &match_send,
+ request->action = simcall_comm_isend(SIMIX_process_from_PID(request->src+1), mailbox, request->size, -1.0,
+ buf, request->real_size, &match_send,
&xbt_free_f, // how to free the userdata if a detached send fails
!smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback
- : &smpi_comm_null_copy_buffer_callback,
- request,
+ : &smpi_comm_null_copy_buffer_callback, request,
// detach if msg size < eager/rdv switch limit
request->detached);
XBT_DEBUG("send simcall posted");
-
-
/* FIXME: detached sends are not traceable (request->action == NULL) */
if (request->action)
simcall_set_category(request->action, TRACE_internal_smpi_get_category());
if (async_small_thresh != 0 || request->flags & RMA)
xbt_mutex_release(mut);
}
-
}
void smpi_mpi_startall(int count, MPI_Request * requests)
{
- int i;
if(requests==NULL) return;
- for(i = 0; i < count; i++) {
+ for(int i = 0; i < count; i++) {
smpi_mpi_start(requests[i]);
}
}
}
}
-
-MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype,
- int src, int dst, int tag, MPI_Comm comm, MPI_Op op)
+MPI_Request smpi_rma_send_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
+ MPI_Op op)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
if(op==MPI_OP_NULL){
return request;
}
-MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype,
- int src, int dst, int tag, MPI_Comm comm, MPI_Op op)
+MPI_Request smpi_rma_recv_init(void *buf, int count, MPI_Datatype datatype, int src, int dst, int tag, MPI_Comm comm,
+ MPI_Op op)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
if(op==MPI_OP_NULL){
return request;
}
-
-MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm)
+MPI_Request smpi_isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf , count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, PERSISTENT | ISEND | SEND | PREPARED);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf , count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag,comm, PERSISTENT | ISEND | SEND | PREPARED);
return request;
}
-MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm)
+MPI_Request smpi_mpi_isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM?(void*)0:buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, NON_PERSISTENT | ISEND | SEND);
+ request = build_request(buf==MPI_BOTTOM?(void*)0:buf, count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | ISEND | SEND);
smpi_mpi_start(request);
return request;
}
-MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm)
+MPI_Request smpi_mpi_issend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, NON_PERSISTENT | ISEND | SSEND | SEND);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag,comm, NON_PERSISTENT | ISEND | SSEND | SEND);
smpi_mpi_start(request);
return request;
}
-MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype,
- int src, int tag, MPI_Comm comm)
+MPI_Request smpi_irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+ smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
comm, PERSISTENT | RECV | PREPARED);
return request;
}
-MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype,
- int src, int tag, MPI_Comm comm)
+MPI_Request smpi_mpi_irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag,
- comm, NON_PERSISTENT | RECV);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+ smpi_group_index(smpi_comm_group(comm), src), smpi_process_index(), tag, comm,
+ NON_PERSISTENT | RECV);
smpi_mpi_start(request);
return request;
}
-void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
- int tag, MPI_Comm comm, MPI_Status * status)
+void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
request = smpi_mpi_irecv(buf, count, datatype, src, tag, comm);
request = NULL;
}
-
-
-void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm)
+void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, NON_PERSISTENT | SEND);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | SEND);
smpi_mpi_start(request);
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
request = NULL;
}
-void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm)
+void smpi_mpi_ssend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
MPI_Request request = NULL; /* MC needs the comm to be set to NULL during the call */
- request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(), smpi_group_index(smpi_comm_group(comm), dst), tag,
- comm, NON_PERSISTENT | SSEND | SEND);
+ request = build_request(buf==MPI_BOTTOM ? (void*)0 : buf, count, datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(comm), dst), tag, comm, NON_PERSISTENT | SSEND | SEND);
smpi_mpi_start(request);
smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
request = NULL;
}
-void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- int dst, int sendtag, void *recvbuf, int recvcount,
- MPI_Datatype recvtype, int src, int recvtag,
+void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int dst, int sendtag,
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int src, int recvtag,
MPI_Comm comm, MPI_Status * status)
{
MPI_Request requests[2];
MPI_Status stats[2];
int myid=smpi_process_index();
- if ((smpi_group_index(smpi_comm_group(comm), dst) == myid) && (smpi_group_index(smpi_comm_group(comm), src) == myid)) {
- smpi_datatype_copy(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype);
+ if ((smpi_group_index(smpi_comm_group(comm), dst) == myid) && (smpi_group_index(smpi_comm_group(comm), src) == myid)){
+ smpi_datatype_copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype);
return;
}
- requests[0] =
- smpi_isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm);
- requests[1] =
- smpi_irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
+ requests[0] = smpi_isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm);
+ requests[1] = smpi_irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm);
smpi_mpi_startall(2, requests);
smpi_mpi_waitall(2, requests, stats);
smpi_mpi_request_free(&requests[0]);
MPI_Request req = *request;
smpi_empty_status(status);
- if(!(req->detached && req->flags & SEND)
- && !(req->flags & PREPARED)){
+ if(!(req->detached && req->flags & SEND) && !(req->flags & PREPARED)){
if(status != MPI_STATUS_IGNORE) {
int src = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(req->comm), src);
status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
status->MPI_ERROR = req->truncated ? MPI_ERR_TRUNCATE : MPI_SUCCESS;
// this handles the case were size in receive differs from size in send
- // FIXME: really this should just contain the count of receive-type blocks,
- // right?
+ // FIXME: really this should just contain the count of receive-type blocks, right?
status->count = req->real_size;
}
if((req->flags & ACCUMULATE) || (datatype->has_subtype == 1)){
if (!smpi_process_get_replaying()){
- if( smpi_privatize_global_variables
- && ((char*)req->old_buf >= smpi_start_data_exe)
- && ((char*)req->old_buf < smpi_start_data_exe + smpi_size_data_exe )
- ){
+ if( smpi_privatize_global_variables && ((char*)req->old_buf >= smpi_start_data_exe)
+ && ((char*)req->old_buf < smpi_start_data_exe + smpi_size_data_exe )){
XBT_VERB("Privatization : We are unserializing to a zone in global memory - Switch data segment ");
smpi_switch_data_segment(smpi_process_index());
}
}
if(datatype->has_subtype == 1){
- // This part handles the problem of non-contignous memory
- // the unserialization at the reception
+ // This part handles the problem of non-contignous memory the unserialization at the reception
s_smpi_subtype_t *subtype = static_cast<s_smpi_subtype_t*>(datatype->substruct);
if(req->flags & RECV)
- subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) , datatype->substruct, req->op);
+ subtype->unserialize(req->buf, req->old_buf, req->real_size/smpi_datatype_size(datatype) ,
+ datatype->substruct, req->op);
if(req->detached == 0) free(req->buf);
}else if(req->flags & RECV){//apply op on contiguous buffer for accumulate
int n =req->real_size/smpi_datatype_size(datatype);
}
smpi_comm_unuse(req->comm);
smpi_datatype_unuse(datatype);
-
}
if (TRACE_smpi_view_internals()) {
req->flags |= FINISHED;
smpi_mpi_request_free(request);
-
}
int smpi_mpi_test(MPI_Request * request, MPI_Status * status) {
- int flag;
-
//assume that request is not MPI_REQUEST_NULL (filtered in PMPI_Test or smpi_mpi_testall before)
// to avoid deadlocks if used as a break condition, such as
// while (MPI_Test(request, flag, status) && flag) {
// }
- // because the time will not normally advance when only calls to MPI_Test
- // are made -> deadlock
+ // because the time will not normally advance when only calls to MPI_Test are made -> deadlock
// multiplier to the sleeptime, to increase speed of execution, each failed test will increase it
static int nsleeps = 1;
if(smpi_test_sleep > 0) simcall_process_sleep(nsleeps*smpi_test_sleep);
smpi_empty_status(status);
- flag = 1;
+ int flag = 1;
if (!((*request)->flags & PREPARED)) {
if ((*request)->action != NULL)
flag = simcall_comm_test((*request)->action);
return flag;
}
-int smpi_mpi_testany(int count, MPI_Request requests[], int *index,
- MPI_Status * status)
+int smpi_mpi_testany(int count, MPI_Request requests[], int *index, MPI_Status * status)
{
xbt_dynar_t comms;
int i, flag, size;
map = xbt_new(int, count);
size = 0;
for(i = 0; i < count; i++) {
- if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action &&
- !(requests[i]->flags & PREPARED)) {
+ if ((requests[i] != MPI_REQUEST_NULL) && requests[i]->action && !(requests[i]->flags & PREPARED)) {
xbt_dynar_push(comms, &requests[i]->action);
map[size] = i;
size++;
return flag;
}
-
-int smpi_mpi_testall(int count, MPI_Request requests[],
- MPI_Status status[])
+int smpi_mpi_testall(int count, MPI_Request requests[], MPI_Status status[])
{
MPI_Status stat;
MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status){
- MPI_Request request =build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : smpi_group_index(smpi_comm_group(comm), source), smpi_comm_rank(comm), tag,
- comm, PERSISTENT | RECV);
+ MPI_Request request =build_request(NULL, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
+ smpi_group_index(smpi_comm_group(comm), source), smpi_comm_rank(comm), tag, comm, PERSISTENT | RECV);
// to avoid deadlock, we have to sleep some time here, or the timer won't advance and we will only do iprobe simcalls
// (especially when used as a break condition, such as while(MPI_Iprobe(...)) ... )
simcall_comm_wait((*request)->action, -1.0);
if((MC_is_active() || MC_record_replay_is_active()) && (*request)->action)
- (*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to NULL for system state comparison
+ (*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to
+ // NULL for system state comparison
}
finish_wait(request, status);
// FIXME for a detached send, finish_wait is not called:
}
-int smpi_mpi_waitany(int count, MPI_Request requests[],
- MPI_Status * status)
+int smpi_mpi_waitany(int count, MPI_Request requests[], MPI_Status * status)
{
xbt_dynar_t comms;
int i, size, index;
size = 0;
XBT_DEBUG("Wait for one of %d", count);
for(i = 0; i < count; i++) {
- if (requests[i] != MPI_REQUEST_NULL
- && !(requests[i]->flags & PREPARED)
- && !(requests[i]->flags & FINISHED)) {
+ if (requests[i] != MPI_REQUEST_NULL && !(requests[i]->flags & PREPARED) && !(requests[i]->flags & FINISHED)) {
if (requests[i]->action != NULL) {
XBT_DEBUG("Waiting any %p ", requests[i]);
xbt_dynar_push(comms, &requests[i]->action);
return index;
}
-int smpi_mpi_waitall(int count, MPI_Request requests[],
- MPI_Status status[])
+int smpi_mpi_waitall(int count, MPI_Request requests[], MPI_Status status[])
{
int index, c;
MPI_Status stat;
//tag invalid requests in the set
if (status != MPI_STATUSES_IGNORE) {
for (c = 0; c < count; c++) {
- if (requests[c] == MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL ||
- (requests[c]->flags & PREPARED)) {
+ if (requests[c] == MPI_REQUEST_NULL || requests[c]->dst == MPI_PROC_NULL || (requests[c]->flags & PREPARED)) {
smpi_empty_status(&status[c]);
} else if (requests[c]->src == MPI_PROC_NULL) {
smpi_empty_status(&status[c]);
return retvalue;
}
-int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
- MPI_Status status[])
+int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[])
{
int i, count, index;
MPI_Status stat;
return count;
}
-int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
- MPI_Status status[])
+int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[])
{
int i, count, count_dead;
MPI_Status stat;
else return count;
}
-void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root,
- MPI_Comm comm)
+void smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
{
smpi_coll_tuned_bcast_binomial_tree(buf, count, datatype, root, comm);
}
}
void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm)
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int system_tag = COLL_TAG_GATHER;
int rank, size, src, index;
// FIXME: check for errors
smpi_datatype_extent(recvtype, &lb, &recvext);
// Local copy from root
- smpi_datatype_copy(sendbuf, sendcount, sendtype,
- (char *)recvbuf + root * recvcount * recvext, recvcount, recvtype);
+ smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + root * recvcount * recvext, recvcount, recvtype);
// Receive buffers from senders
requests = xbt_new(MPI_Request, size - 1);
index = 0;
for(src = 0; src < size; src++) {
if(src != root) {
- requests[index] = smpi_irecv_init((char *)recvbuf + src * recvcount * recvext,
- recvcount, recvtype,
+ requests[index] = smpi_irecv_init((char *)recvbuf + src * recvcount * recvext, recvcount, recvtype,
src, system_tag, comm);
index++;
}
}
}
-
-void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op,
+ MPI_Comm comm)
{
int i, size, count;
int *displs;
tmpbuf=(void*)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
mpi_coll_reduce_fun(sendbuf, tmpbuf, count, datatype, op, 0, comm);
- smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf,
- recvcounts[rank], datatype, 0, comm);
+ smpi_mpi_scatterv(tmpbuf, recvcounts, displs, datatype, recvbuf, recvcounts[rank], datatype, 0, comm);
xbt_free(displs);
smpi_free_tmp_buffer(tmpbuf);
}
-void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts, int *displs,
+void smpi_mpi_gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int system_tag = COLL_TAG_GATHERV;
// FIXME: check for errors
smpi_datatype_extent(recvtype, &lb, &recvext);
// Local copy from root
- smpi_datatype_copy(sendbuf, sendcount, sendtype,
- (char *)recvbuf + displs[root] * recvext,
+ smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + displs[root] * recvext,
recvcounts[root], recvtype);
// Receive buffers from senders
requests = xbt_new(MPI_Request, size - 1);
index = 0;
for(src = 0; src < size; src++) {
if(src != root) {
- requests[index] =
- smpi_irecv_init((char *)recvbuf + displs[src] * recvext,
+ requests[index] = smpi_irecv_init((char *)recvbuf + displs[src] * recvext,
recvcounts[src], recvtype, src, system_tag, comm);
index++;
}
}
}
-void smpi_mpi_allgather(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm)
+void smpi_mpi_allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+ void *recvbuf,int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
{
int system_tag = COLL_TAG_ALLGATHER;
int rank, size, other, index;
// FIXME: check for errors
smpi_datatype_extent(recvtype, &lb, &recvext);
// Local copy from self
- smpi_datatype_copy(sendbuf, sendcount, sendtype,
- (char *)recvbuf + rank * recvcount * recvext, recvcount,
- recvtype);
+ smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + rank * recvcount * recvext, recvcount, recvtype);
// Send/Recv buffers to/from others;
requests = xbt_new(MPI_Request, 2 * (size - 1));
index = 0;
for(other = 0; other < size; other++) {
if(other != rank) {
- requests[index] =
- smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,
- comm);
+ requests[index] = smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,comm);
index++;
- requests[index] = smpi_irecv_init((char *)recvbuf + other * recvcount * recvext,
- recvcount, recvtype, other,
+ requests[index] = smpi_irecv_init((char *)recvbuf + other * recvcount * recvext, recvcount, recvtype, other,
system_tag, comm);
index++;
}
xbt_free(requests);
}
-void smpi_mpi_allgatherv(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int *recvcounts, int *displs,
- MPI_Datatype recvtype, MPI_Comm comm)
+void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+ int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm)
{
int system_tag = COLL_TAG_ALLGATHERV;
int rank, size, other, index;
// FIXME: check for errors
smpi_datatype_extent(recvtype, &lb, &recvext);
// Local copy from self
- smpi_datatype_copy(sendbuf, sendcount, sendtype,
- (char *)recvbuf + displs[rank] * recvext,
- recvcounts[rank], recvtype);
+ smpi_datatype_copy(sendbuf, sendcount, sendtype, (char *)recvbuf + displs[rank] * recvext,recvcounts[rank], recvtype);
// Send buffers to others;
requests = xbt_new(MPI_Request, 2 * (size - 1));
index = 0;
for(other = 0; other < size; other++) {
if(other != rank) {
requests[index] =
- smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag,
- comm);
+ smpi_isend_init(sendbuf, sendcount, sendtype, other, system_tag, comm);
index++;
- requests[index] =
- smpi_irecv_init((char *)recvbuf + displs[other] * recvext, recvcounts[other],
- recvtype, other, system_tag, comm);
+ requests[index] = smpi_irecv_init((char *)recvbuf + displs[other] * recvext, recvcounts[other],
+ recvtype, other, system_tag, comm);
index++;
}
}
}
void smpi_mpi_scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm)
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int system_tag = COLL_TAG_SCATTER;
int rank, size, dst, index;
size = smpi_comm_size(comm);
if(rank != root) {
// Recv buffer from root
- smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm,
- MPI_STATUS_IGNORE);
+ smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE);
} else {
// FIXME: check for errors
smpi_datatype_extent(sendtype, &lb, &sendext);
index = 0;
for(dst = 0; dst < size; dst++) {
if(dst != root) {
- requests[index] = smpi_isend_init((char *)sendbuf + dst * sendcount * sendext,
- sendcount, sendtype, dst,
+ requests[index] = smpi_isend_init((char *)sendbuf + dst * sendcount * sendext, sendcount, sendtype, dst,
system_tag, comm);
index++;
}
}
}
-void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs,
- MPI_Datatype sendtype, void *recvbuf, int recvcount,
+void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int system_tag = COLL_TAG_SCATTERV;
size = smpi_comm_size(comm);
if(rank != root) {
// Recv buffer from root
- smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm,
- MPI_STATUS_IGNORE);
+ smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE);
} else {
// FIXME: check for errors
smpi_datatype_extent(sendtype, &lb, &sendext);
index = 0;
for(dst = 0; dst < size; dst++) {
if(dst != root) {
- requests[index] =
- smpi_isend_init((char *)sendbuf + displs[dst] * sendext, sendcounts[dst],
- sendtype, dst, system_tag, comm);
+ requests[index] = smpi_isend_init((char *)sendbuf + displs[dst] * sendext, sendcounts[dst],
+ sendtype, dst, system_tag, comm);
index++;
}
}
}
}
-void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, int root,
+void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
MPI_Comm comm)
{
int system_tag = COLL_TAG_REDUCE;
MPI_Request *requests;
void **tmpbufs;
-
char* sendtmpbuf = (char*) sendbuf;
if( sendbuf == MPI_IN_PLACE ) {
sendtmpbuf = (char *)smpi_get_tmp_sendbuffer(count*smpi_datatype_get_extent(datatype));
size = smpi_comm_size(comm);
//non commutative case, use a working algo from openmpi
if(!smpi_op_is_commute(op)){
- smpi_coll_tuned_reduce_ompi_basic_linear(sendtmpbuf, recvbuf, count,
- datatype, op, root, comm);
+ smpi_coll_tuned_reduce_ompi_basic_linear(sendtmpbuf, recvbuf, count, datatype, op, root, comm);
return;
}
else
tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
requests[index] =
- smpi_irecv_init(tmpbufs[index], count, datatype, src,
- system_tag, comm);
+ smpi_irecv_init(tmpbufs[index], count, datatype, src, system_tag, comm);
index++;
}
}
}
}
-void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
smpi_mpi_reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
smpi_mpi_bcast(recvbuf, count, datatype, 0, comm);
}
-void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int system_tag = -888;
int rank, size, other, index;
// FIXME: possibly overkill we we have contiguous/noncontiguous data
// mapping...
tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
- requests[index] =
- smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
- comm);
+ requests[index] = smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag, comm);
index++;
}
for(other = rank + 1; other < size; other++) {
- requests[index] =
- smpi_isend_init(sendbuf, count, datatype, other, system_tag, comm);
+ requests[index] = smpi_isend_init(sendbuf, count, datatype, other, system_tag, comm);
index++;
}
// Wait for completion of all comms.
xbt_free(requests);
}
-void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int system_tag = -888;
int rank, size, other, index;
// mapping...
tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
requests[index] =
- smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag,
- comm);
+ smpi_irecv_init(tmpbufs[index], count, datatype, other, system_tag, comm);
index++;
}
for(other = rank + 1; other < size; other++) {
#define MAP_ANONYMOUS MAP_ANON
#endif
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi,
- "Logging specific to SMPI (benchmarking)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_bench, smpi, "Logging specific to SMPI (benchmarking)");
/* Shared allocations are handled through shared memory segments.
* Associated data and metadata are used as follows:
/** Some location in the source code
*
- * This information is used by SMPI_SHARED_MALLOC to allocate
- * some shared memory for all simulated processes.
+ * This information is used by SMPI_SHARED_MALLOC to allocate some shared memory for all simulated processes.
*/
class smpi_source_location {
public:
return (int)private_sleep((double)usecs / 1000000.0);
}
-
int smpi_gettimeofday(struct timeval *tv, void* tz)
{
double now;
return bprintf("%s:%d:%d", file, line, smpi_process_index());
}
}
+
static int sample_enough_benchs(local_data_t *data) {
int res = data->count >= data->iters;
if (data->threshold>0.0) {
res = 0; // stderr too high yet
}
XBT_DEBUG("%s (count:%d iter:%d stderr:%f thres:%f mean:%fs)",
- (res?"enough benchs":"need more data"),
- data->count, data->iters, data->relstderr, data->threshold, data->mean);
+ (res?"enough benchs":"need more data"), data->count, data->iters, data->relstderr, data->threshold, data->mean);
return res;
}
XBT_DEBUG("XXXXX First time ever on benched nest %s.",loc);
} else {
if (data->iters != iters || data->threshold != threshold) {
- XBT_ERROR("Asked to bench block %s with different settings %d, %f is not %d, %f. How did you manage to give two numbers at the same line??",
- loc, data->iters, data->threshold, iters,threshold);
+ XBT_ERROR("Asked to bench block %s with different settings %d, %f is not %d, %f. "
+ "How did you manage to give two numbers at the same line??",
+ loc, data->iters, data->threshold, iters,threshold);
THROW_IMPOSSIBLE;
}
- // if we already have some data, check whether sample_2 should get one more bench or whether it should emulate the computation instead
+ // if we already have some data, check whether sample_2 should get one more bench or whether it should emulate
+ // the computation instead
data->benching = !sample_enough_benchs(data);
- XBT_DEBUG("XXXX Re-entering the benched nest %s. %s",loc, (data->benching?"more benching needed":"we have enough data, skip computes"));
+ XBT_DEBUG("XXXX Re-entering the benched nest %s. %s",loc,
+ (data->benching?"more benching needed":"we have enough data, skip computes"));
}
xbt_free(loc);
}
data->count, data->iters, data->relstderr, data->threshold, data->mean);
res = 1;
} else {
- // Enough data, no more bench (either we got enough data from previous visits to this benched nest, or we just ran one bench and need to bail out now that our job is done).
- // Just sleep instead
- XBT_DEBUG("No benchmark (either no need, or just ran one): count >= iter (%d >= %d) or stderr<thres (%f<=%f). apply the %fs delay instead",
- data->count, data->iters, data->relstderr, data->threshold, data->mean);
+ // Enough data, no more bench (either we got enough data from previous visits to this benched nest, or we just
+ //ran one bench and need to bail out now that our job is done). Just sleep instead
+ XBT_DEBUG("No benchmark (either no need, or just ran one): count >= iter (%d >= %d) or stderr<thres (%f<=%f)."
+ " apply the %fs delay instead", data->count, data->iters, data->relstderr, data->threshold, data->mean);
smpi_execute(data->mean);
smpi_process_set_sampling(0);
res = 0; // prepare to capture future, unrelated computations
return res;
}
-
void smpi_sample_3(int global, const char *file, int line)
{
char *loc = sample_location(global, file, line);
data->mean = data->sum / n;
data->relstderr = sqrt((data->sum_pow2 / n - data->mean * data->mean) / n) / data->mean;
if (!sample_enough_benchs(data)) {
- data->mean = sample; // Still in benching process; We want sample_2 to simulate the exact time of this loop occurrence before leaving, not the mean over the history
+ data->mean = sample; // Still in benching process; We want sample_2 to simulate the exact time of this loop
+ // occurrence before leaving, not the mean over the history
}
XBT_DEBUG("Average mean after %d steps is %f, relative standard error is %f (sample was %f)", data->count,
data->mean, data->relstderr, sample);
// Generate a shared memory name from the address of the shared_data:
char shmname[32]; // cannot be longer than PSHMNAMLEN = 31 on Mac OS X (shm_open raises ENAMETOOLONG otherwise)
snprintf(shmname, 31, "/shmalloc%p", &*data);
- fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
switch(errno) {
case EEXIST:
return data;
}
-
-
-
#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
-
-/** Map a given SMPI privatization segment (make a SMPI process active)
- */
+/** Map a given SMPI privatization segment (make a SMPI process active) */
void smpi_switch_data_segment(int dest){
-
if (smpi_loaded_page==dest)//no need to switch either
return;
smpi_really_switch_data_segment(dest);
}
-/** Map a given SMPI privatization segment (make a SMPI process active)
- * even if SMPI thinks it is already active
+/** Map a given SMPI privatization segment (make a SMPI process active) even if SMPI thinks it is already active
*
- * When doing a state restoration, the state of the restored variables
- * might not be consistent with the state of the virtual memory.
- * In this case, we to change the data segment.
+ * When doing a state restoration, the state of the restored variables might not be consistent with the state of the
+ * virtual memory. In this case, we to change the data segment.
*/
void smpi_really_switch_data_segment(int dest) {
-
if(smpi_size_data_exe == 0)//no need to switch
return;
#ifdef HAVE_PRIVATIZATION
- int i;
if(smpi_loaded_page==-1){//initial switch, do the copy from the real page here
- for (i=0; i< smpi_process_count(); i++){
- memcpy(smpi_privatisation_regions[i].address,
- TOPAGE(smpi_start_data_exe), smpi_size_data_exe);
+ for (int i=0; i< smpi_process_count(); i++){
+ memcpy(smpi_privatisation_regions[i].address, TOPAGE(smpi_start_data_exe), smpi_size_data_exe);
}
}
return;
#else
- int i = 0;
smpi_get_executable_global_size();
- XBT_DEBUG ("bss+data segment found : size %d starting at %p",
- smpi_size_data_exe, smpi_start_data_exe );
+ XBT_DEBUG ("bss+data segment found : size %d starting at %p", smpi_size_data_exe, smpi_start_data_exe );
if (smpi_size_data_exe == 0){//no need to switch
smpi_privatize_global_variables=0;
return;
}
- smpi_privatisation_regions = (smpi_privatisation_region_t) malloc(
- smpi_process_count() * sizeof(struct s_smpi_privatisation_region));
+ smpi_privatisation_regions =
+ (smpi_privatisation_region_t) malloc(smpi_process_count() * sizeof(struct s_smpi_privatisation_region));
- for (i=0; i< smpi_process_count(); i++){
+ for (int i=0; i< smpi_process_count(); i++){
//create SIMIX_process_count() mappings of this size with the same data inside
void *address = NULL;
char path[] = "/dev/shm/my-buffer-XXXXXX";
smpi_privatisation_regions[i].file_descriptor = file_descriptor;
smpi_privatisation_regions[i].address = address;
}
-
#endif
-
}
void smpi_destroy_global_memory_segments(){
int i;
for (i=0; i< smpi_process_count(); i++){
if(munmap(smpi_privatisation_regions[i].address, smpi_size_data_exe) < 0) {
- XBT_WARN("Unmapping of fd %d failed: %s",
- smpi_privatisation_regions[i].file_descriptor, strerror(errno));
+ XBT_WARN("Unmapping of fd %d failed: %s", smpi_privatisation_regions[i].file_descriptor, strerror(errno));
}
close(smpi_privatisation_regions[i].file_descriptor);
}
xbt_free(smpi_privatisation_regions);
#endif
-
}
#include "colls/colls.h"
#include "simgrid/sg_config.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi,
- "Logging specific to SMPI (coll)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll)");
s_mpi_coll_description_t mpi_coll_gather_description[] = {
- {"default",
- "gather default collective",
- (void*)smpi_mpi_gather},
-COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA),
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {"default", "gather default collective", (void*)smpi_mpi_gather},
+ COLL_GATHERS(COLL_DESCRIPTION, COLL_COMMA), {NULL, NULL, NULL} /* this array must be NULL terminated */
};
#include "colls/colls.h"
#include "xbt/ex.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi,
- "Logging specific to SMPI (comm)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)");
xbt_dict_t smpi_comm_keyvals = NULL;
int comm_keyval_id = 0;//avoid collisions
-/* Support for cartesian topology was added, but there are 2 other types of
- * topology, graph et dist graph. In order to support them, we have to add a
- * field MPIR_Topo_type, and replace the MPI_Topology field by an union. */
+/* Support for cartesian topology was added, but there are 2 other types of topology, graph et dist graph. In order to
+ * support them, we have to add a field MPIR_Topo_type, and replace the MPI_Topology field by an union. */
typedef struct s_smpi_mpi_communicator {
MPI_Group group;
}
int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){
- if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+ if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
smpi_switch_data_segment(smpi_process_index());
}
(*newcomm) = smpi_comm_new(smpi_comm_group(comm), smpi_comm_topo(comm));
void* value_in;
void* value_out;
xbt_dict_foreach(comm->attributes, cursor, key, value_in){
- smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)key, sizeof(int)));
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)key, sizeof(int)));
if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){
ret = elem->copy_fn(comm, *key, NULL, value_in, &value_out, &flag );
if(ret!=MPI_SUCCESS){
return ret;
}
-
MPI_Group smpi_comm_group(MPI_Comm comm)
{
if (comm == MPI_COMM_UNINITIALIZED)
comm = smpi_process_comm_world();
-
return comm->group;
}
{
if (comm == MPI_COMM_UNINITIALIZED)
comm = smpi_process_comm_world();
-
return smpi_group_size(smpi_comm_group(comm));
}
void * value;
int flag;
xbt_dict_foreach(comm->attributes, cursor, key, value){
- smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key));
if(elem && elem->delete_fn)
elem->delete_fn(comm, *key, value, &flag);
}
}
}
-static int
-compare_ints (const void *a, const void *b)
+static int compare_ints (const void *a, const void *b)
{
const int *da = (const int *) a;
const int *db = (const int *) b;
int comm_size =smpi_comm_size(comm);
// If we are in replay - perform an ugly hack
- // say to SimGrid that we are not in replay for a while, because we need
- // the buffers to be copied for the following calls
+ // tell SimGrid we are not in replay for a while, because we need the buffers to be copied for the following calls
int replaying = 0; //cache data to set it back again after
if(smpi_process_get_replaying()){
replaying=1;
smpi_process_set_replaying(0);
}
- if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+ if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
smpi_switch_data_segment(smpi_process_index());
}
//identify neighbours in comm
// smpi_process_set_comm_intra(MPI_COMM_SELF);
// return;
// }
-
-
int i =0;
int min_index=INT_MAX;//the minimum index will be the leader
smx_process_t process = NULL;
}
}
-
MPI_Comm comm_intra = smpi_comm_new(group_intra, NULL);
//MPI_Comm shmem_comm = smpi_process_comm_intra();
//int intra_rank = smpi_comm_rank(shmem_comm);
-
//if(smpi_process_index()==min_index)
leader=min_index;
smpi_coll_tuned_allgather_mpich(&leader, 1, MPI_INT , leaders_map, 1, MPI_INT, comm);
- if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+ if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
smpi_switch_data_segment(smpi_process_index());
}
-
+
if(!comm->leaders_map){
comm->leaders_map= leaders_map;
}else{
MPI_Group leaders_group = smpi_group_new(leader_group_size);
-
MPI_Comm leader_comm = MPI_COMM_NULL;
if(MPI_COMM_WORLD!=MPI_COMM_UNINITIALIZED && comm!=MPI_COMM_WORLD){
//create leader_communicator
smpi_comm_set_leaders_comm(comm, leader_comm);
smpi_comm_set_intra_comm(comm, comm_intra);
- //create intracommunicator
+ //create intracommunicator
// smpi_comm_set_intra_comm(comm, smpi_comm_split(comm, *(int*)SIMIX_host_self(), comm_rank));
}else{
for (i=0; i< leader_group_size;i++)
}
smpi_coll_tuned_bcast_mpich(&(comm->is_uniform),1, MPI_INT, 0, comm_intra );
- if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+ if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
smpi_switch_data_segment(smpi_process_index());
}
// Are the ranks blocked ? = allocated contiguously on the SMP nodes
}
int global_blocked;
- smpi_mpi_allreduce(&is_blocked, &(global_blocked), 1,
- MPI_INT, MPI_LAND, comm);
+ smpi_mpi_allreduce(&is_blocked, &(global_blocked), 1, MPI_INT, MPI_LAND, comm);
if(MPI_COMM_WORLD==MPI_COMM_UNINITIALIZED || comm==MPI_COMM_WORLD){
if(smpi_comm_rank(comm)==0){
}
int smpi_comm_attr_delete(MPI_Comm comm, int keyval){
- smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
if(!elem)
return MPI_ERR_ARG;
if(elem->delete_fn!=MPI_NULL_DELETE_FN){
int ret = elem->delete_fn(comm, keyval, value, &flag);
if(ret!=MPI_SUCCESS) return ret;
}
- }
+ }
if(comm->attributes==NULL)
return MPI_ERR_ARG;
}
int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){
- smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
if(!elem)
return MPI_ERR_ARG;
xbt_ex_t ex;
TRY {
*(void**)attr_value = xbt_dict_get_ext(comm->attributes, (const char*)&keyval, sizeof(int));
*flag=1;
- }
- CATCH(ex) {
+ } CATCH(ex) {
*flag=0;
xbt_ex_free(ex);
}
int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){
if(!smpi_comm_keyvals)
smpi_comm_keyvals = xbt_dict_new();
- smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)));
if(!elem )
return MPI_ERR_ARG;
int flag;
return MPI_SUCCESS;
}
-int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state){
-
+int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state){
if(!smpi_comm_keyvals)
smpi_comm_keyvals = xbt_dict_new();
-
+
smpi_comm_key_elem value = (smpi_comm_key_elem) xbt_new0(s_smpi_mpi_comm_key_elem_t,1);
-
+
value->copy_fn=copy_fn;
value->delete_fn=delete_fn;
-
+
*keyval = comm_keyval_id;
xbt_dict_set_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int),(void*)value, NULL);
comm_keyval_id++;
}
int smpi_comm_keyval_free(int* keyval){
- smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int)));
+ smpi_comm_key_elem elem =
+ static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int)));
if(!elem){
return MPI_ERR_ARG;
}
xbt_bar_t finalization_barrier;
} s_smpi_mpi_instance_t;
-
/** \ingroup smpi_simulation
* \brief Registers a running instance of a MPI program.
*
* FIXME : remove MSG from the loop at some point.
* \param name the reference name of the function.
- * \param code the main mpi function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[]))
+ * \param code the main mpi function (must have a int ..(int argc, char *argv[])) prototype
* \param num_processes the size of the instance we want to deploy
*/
void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes)
{
SIMIX_function_register(name, code);
- s_smpi_mpi_instance_t* instance =
- (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t));
+ s_smpi_mpi_instance_t* instance = (s_smpi_mpi_instance_t*)xbt_malloc(sizeof(s_smpi_mpi_instance_t));
instance->name = name;
instance->size = num_processes;
return;
}
-
//get the index of the process in the process_data array
void smpi_deployment_register_process(const char* instance_id, int rank, int index,MPI_Comm** comm, xbt_bar_t* bar){
return;
}
- s_smpi_mpi_instance_t* instance = static_cast<s_smpi_mpi_instance_t*>(xbt_dict_get_or_null(smpi_instances, instance_id));
+ s_smpi_mpi_instance_t* instance =
+ static_cast<s_smpi_mpi_instance_t*>(xbt_dict_get_or_null(smpi_instances, instance_id));
xbt_assert(instance, "Error, unknown instance %s", instance_id);
if(instance->comm_world == MPI_COMM_NULL){
#include "smpi/smpi.h"
#include "src/internal_config.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi,
- "Logging specific to SMPI (experimental DVFS support)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_dvfs, smpi, "Logging specific to SMPI (experimental DVFS support)");
/**
* \brief Return the speed of the processor (in flop/s) at a given pstate
return sg_host_get_consumed_energy(SIMIX_host_self());
}
-
#ifdef SMPI_FORTRAN
#if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
#endif
/* Bindings for MPI special values */
-
struct s_smpi_common {
integer _MPI_IN_PLACE;
integer _MPI_BOTTOM;
integer _MPI_STATUSES_IGNORE;
} smpi_;
-
-
/* Convert between Fortran and C */
#define FORT_ADDR(addr, val) \
(((void *)(addr) == (void*) &(smpi_._ ## val)) \
#define KEY_SIZE (sizeof(int) * 2 + 1)
-
static char* get_key(char* key, int id) {
snprintf(key, KEY_SIZE, "%x",id);
return key;
}
+
static char* get_key_id(char* key, int id) {
snprintf(key, KEY_SIZE, "%x_%d",id, smpi_process_index());
return key;
}
-
-
static void smpi_init_fortran_types(){
if(!comm_lookup){
comm_lookup = xbt_dict_new_homogeneous(NULL);
}
}
-
int smpi_comm_c2f(MPI_Comm comm) {
static int comm_id = 0;
char key[KEY_SIZE];
return MPI_COMM_SELF;
}else if(comm==0){
return MPI_COMM_WORLD;
- } else if(comm_lookup && comm >= 0) {
-
+ } else if(comm_lookup && comm >= 0) {
char key[KEY_SIZE];
MPI_Comm tmp = (MPI_Comm)xbt_dict_get_or_null(comm_lookup,get_key_id(key, comm));
return tmp != NULL ? tmp : MPI_COMM_NULL ;
xbt_dict_remove(group_lookup, get_key(key, group));
}
-
-
int smpi_request_c2f(MPI_Request req) {
static int request_id = 0;
char key[KEY_SIZE];
MPI_Datatype smpi_type_f2c(int datatype) {
smpi_init_fortran_types();
char key[KEY_SIZE];
- return datatype >= 0
- ? (MPI_Datatype)xbt_dict_get_or_null(datatype_lookup, get_key(key, datatype))
- : MPI_DATATYPE_NULL;
+ return datatype >= 0 ? (MPI_Datatype)xbt_dict_get_or_null(datatype_lookup, get_key(key, datatype)): MPI_DATATYPE_NULL;
}
static void free_datatype(int datatype) {
MPI_Op smpi_op_f2c(int op) {
smpi_init_fortran_types();
char key[KEY_SIZE];
- return op >= 0
- ? (MPI_Op)xbt_dict_get_or_null(op_lookup, get_key(key, op))
- : MPI_OP_NULL;
+ return op >= 0 ? (MPI_Op)xbt_dict_get_or_null(op_lookup, get_key(key, op)): MPI_OP_NULL;
}
static void free_op(int op) {
MPI_Win smpi_win_f2c(int win) {
smpi_init_fortran_types();
char key[KEY_SIZE];
- return win >= 0
- ? (MPI_Win)xbt_dict_get_or_null(win_lookup, get_key(key, win))
- : MPI_WIN_NULL;
+ return win >= 0 ? (MPI_Win)xbt_dict_get_or_null(win_lookup, get_key(key, win)) : MPI_WIN_NULL;
}
static void free_win(int win) {
xbt_dict_remove(win_lookup, get_key(key, win));
}
-
int smpi_info_c2f(MPI_Info info) {
static int info_id = 0;
char key[KEY_SIZE];
MPI_Info smpi_info_f2c(int info) {
smpi_init_fortran_types();
char key[KEY_SIZE];
- return info >= 0
- ? (MPI_Info)xbt_dict_get_or_null(info_lookup, get_key(key, info))
- : MPI_INFO_NULL;
+ return info >= 0 ? (MPI_Info)xbt_dict_get_or_null(info_lookup, get_key(key, info)) : MPI_INFO_NULL;
}
static void free_info(int info) {
xbt_dict_remove(info_lookup, get_key(key, info));
}
-
void mpi_init_(int* ierr) {
smpi_init_fortran_types();
*ierr = MPI_Init(NULL, NULL);
}
}
-
void mpi_comm_free_(int* comm, int* ierr) {
MPI_Comm tmp = smpi_comm_f2c(*comm);
}
}
-
void mpi_initialized_(int* flag, int* ierr){
*ierr = MPI_Initialized(flag);
}
-void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag,
- int* comm, int* request, int* ierr) {
+void mpi_send_init_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Send_init(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
- smpi_comm_f2c(*comm), &req);
+ *ierr = MPI_Send_init(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm), &req);
if(*ierr == MPI_SUCCESS) {
*request = smpi_request_c2f(req);
}
}
-void mpi_isend_(void *buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* request, int* ierr) {
+void mpi_isend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Isend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
- smpi_comm_f2c(*comm), &req);
+ *ierr = MPI_Isend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm), &req);
if(*ierr == MPI_SUCCESS) {
*request = smpi_request_c2f(req);
}
}
-void mpi_irsend_(void *buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* request, int* ierr) {
+void mpi_irsend_(void *buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Irsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
- smpi_comm_f2c(*comm), &req);
+ *ierr = MPI_Irsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm), &req);
if(*ierr == MPI_SUCCESS) {
*request = smpi_request_c2f(req);
}
}
-void mpi_send_(void* buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* ierr) {
+void mpi_send_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr) {
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Send(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
- smpi_comm_f2c(*comm));
+ *ierr = MPI_Send(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm));
}
-void mpi_rsend_(void* buf, int* count, int* datatype, int* dst,
- int* tag, int* comm, int* ierr) {
+void mpi_rsend_(void* buf, int* count, int* datatype, int* dst, int* tag, int* comm, int* ierr) {
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Rsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag,
- smpi_comm_f2c(*comm));
+ *ierr = MPI_Rsend(buf, *count, smpi_type_f2c(*datatype), *dst, *tag, smpi_comm_f2c(*comm));
}
-void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst,
- int* sendtag, void *recvbuf, int* recvcount,
- int* recvtype, int* src, int* recvtag,
- int* comm, MPI_Status* status, int* ierr) {
+void mpi_sendrecv_(void* sendbuf, int* sendcount, int* sendtype, int* dst, int* sendtag, void *recvbuf, int* recvcount,
+ int* recvtype, int* src, int* recvtag, int* comm, MPI_Status* status, int* ierr) {
sendbuf = (char *) FORT_BOTTOM(sendbuf);
recvbuf = (char *) FORT_BOTTOM(recvbuf);
- *ierr = MPI_Sendrecv(sendbuf, *sendcount, smpi_type_f2c(*sendtype), *dst,
- *sendtag, recvbuf, *recvcount,smpi_type_f2c(*recvtype), *src, *recvtag,
- smpi_comm_f2c(*comm), FORT_STATUS_IGNORE(status));
+ *ierr = MPI_Sendrecv(sendbuf, *sendcount, smpi_type_f2c(*sendtype), *dst, *sendtag, recvbuf, *recvcount,
+ smpi_type_f2c(*recvtype), *src, *recvtag, smpi_comm_f2c(*comm), FORT_STATUS_IGNORE(status));
}
-void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag,
- int* comm, int* request, int* ierr) {
+void mpi_recv_init_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Recv_init(buf, *count, smpi_type_f2c(*datatype), *src, *tag,
- smpi_comm_f2c(*comm), &req);
+ *ierr = MPI_Recv_init(buf, *count, smpi_type_f2c(*datatype), *src, *tag, smpi_comm_f2c(*comm), &req);
if(*ierr == MPI_SUCCESS) {
*request = smpi_request_c2f(req);
}
}
-void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag,
- int* comm, int* request, int* ierr) {
+void mpi_irecv_(void *buf, int* count, int* datatype, int* src, int* tag, int* comm, int* request, int* ierr) {
MPI_Request req;
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Irecv(buf, *count, smpi_type_f2c(*datatype), *src, *tag,
- smpi_comm_f2c(*comm), &req);
+ *ierr = MPI_Irecv(buf, *count, smpi_type_f2c(*datatype), *src, *tag, smpi_comm_f2c(*comm), &req);
if(*ierr == MPI_SUCCESS) {
*request = smpi_request_c2f(req);
}
}
-void mpi_recv_(void* buf, int* count, int* datatype, int* src,
- int* tag, int* comm, MPI_Status* status, int* ierr) {
+void mpi_recv_(void* buf, int* count, int* datatype, int* src, int* tag, int* comm, MPI_Status* status, int* ierr) {
buf = (char *) FORT_BOTTOM(buf);
- *ierr = MPI_Recv(buf, *count, smpi_type_f2c(*datatype), *src, *tag,
- smpi_comm_f2c(*comm), status);
+ *ierr = MPI_Recv(buf, *count, smpi_type_f2c(*datatype), *src, *tag, smpi_comm_f2c(*comm), status);
}
void mpi_start_(int* request, int* ierr) {
*ierr = MPI_Bcast(buf, *count, smpi_type_f2c(*datatype), *root, smpi_comm_f2c(*comm));
}
-void mpi_reduce_(void* sendbuf, void* recvbuf, int* count,
- int* datatype, int* op, int* root, int* comm, int* ierr) {
+void mpi_reduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* root, int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
sendbuf = (char *) FORT_BOTTOM(sendbuf);
recvbuf = (char *) FORT_BOTTOM(recvbuf);
- *ierr = MPI_Reduce(sendbuf, recvbuf, *count,
- smpi_type_f2c(*datatype), smpi_op_f2c(*op), *root, smpi_comm_f2c(*comm));
+ *ierr = MPI_Reduce(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype), smpi_op_f2c(*op), *root, smpi_comm_f2c(*comm));
}
-void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype,
- int* op, int* comm, int* ierr) {
+void mpi_allreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
- *ierr = MPI_Allreduce(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype),
- smpi_op_f2c(*op), smpi_comm_f2c(*comm));
+ *ierr = MPI_Allreduce(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype), smpi_op_f2c(*op), smpi_comm_f2c(*comm));
}
-void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype,
- int* op, int* comm, int* ierr) {
+void mpi_reduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* datatype, int* op, int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, smpi_type_f2c(*datatype),
smpi_op_f2c(*op), smpi_comm_f2c(*comm));
}
-void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
+void mpi_scatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr) {
recvbuf = (char *) FORT_IN_PLACE(recvbuf);
*ierr = MPI_Scatter(sendbuf, *sendcount, smpi_type_f2c(*sendtype),
recvbuf, *recvcount, smpi_type_f2c(*recvtype), *root, smpi_comm_f2c(*comm));
}
-
void mpi_scatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
- int* root, int* comm, int* ierr) {
+ void* recvbuf, int* recvcount, int* recvtype, int* root, int* comm, int* ierr) {
recvbuf = (char *) FORT_IN_PLACE(recvbuf);
*ierr = MPI_Scatterv(sendbuf, sendcounts, displs, smpi_type_f2c(*sendtype),
recvbuf, *recvcount, smpi_type_f2c(*recvtype), *root, smpi_comm_f2c(*comm));
}
-void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
+void mpi_gather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
int* root, int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
sendbuf = (char *) FORT_BOTTOM(sendbuf);
}
void mpi_gatherv_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcounts, int* displs, int* recvtype,
- int* root, int* comm, int* ierr) {
+ void* recvbuf, int* recvcounts, int* displs, int* recvtype, int* root, int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
sendbuf = (char *) FORT_BOTTOM(sendbuf);
recvbuf = (char *) FORT_BOTTOM(recvbuf);
recvbuf, recvcounts, displs, smpi_type_f2c(*recvtype), *root, smpi_comm_f2c(*comm));
}
-void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcount, int* recvtype,
+void mpi_allgather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, int* recvcount, int* recvtype,
int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Allgather(sendbuf, *sendcount, smpi_type_f2c(*sendtype),
}
void mpi_allgatherv_(void* sendbuf, int* sendcount, int* sendtype,
- void* recvbuf, int* recvcounts,int* displs, int* recvtype,
- int* comm, int* ierr) {
+ void* recvbuf, int* recvcounts,int* displs, int* recvtype, int* comm, int* ierr) {
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
*ierr = MPI_Allgatherv(sendbuf, *sendcount, smpi_type_f2c(*sendtype),
recvbuf, recvcounts, displs, smpi_type_f2c(*recvtype), smpi_comm_f2c(*comm));
}
-void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype,
- int* op, int* comm, int* ierr) {
+void mpi_scan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr) {
*ierr = MPI_Scan(sendbuf, recvbuf, *count, smpi_type_f2c(*datatype),
smpi_op_f2c(*op), smpi_comm_f2c(*comm));
}
}
}
-
void mpi_testall_ (int* count, int * requests, int *flag, MPI_Status * statuses, int* ierr){
MPI_Request* reqs;
int i;
}
}
-
void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
*ierr = MPI_Get_processor_name(name, resultlen);
}
*target_disp, *target_count,smpi_type_f2c(*tarsmpi_type_f2c), smpi_win_f2c(*win));
}
-
//following are automatically generated, and have to be checked
void mpi_finalized_ (int * flag, int* ierr){
void mpi_type_create_keyval_ (void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr){
- *ierr = MPI_Type_create_keyval((MPI_Type_copy_attr_function*)copy_fn, (MPI_Type_delete_attr_function*) delete_fn, keyval, extra_state) ;
+ *ierr = MPI_Type_create_keyval((MPI_Type_copy_attr_function*)copy_fn, (MPI_Type_delete_attr_function*) delete_fn,
+ keyval, extra_state) ;
}
void mpi_type_free_keyval_ (int* keyval, int* ierr) {
void mpi_comm_create_keyval_ (void* copy_fn, void* delete_fn, int* keyval, void* extra_state, int* ierr){
- *ierr = MPI_Comm_create_keyval((MPI_Comm_copy_attr_function*)copy_fn, (MPI_Comm_delete_attr_function*)delete_fn, keyval, extra_state) ;
+ *ierr = MPI_Comm_create_keyval((MPI_Comm_copy_attr_function*)copy_fn, (MPI_Comm_delete_attr_function*)delete_fn,
+ keyval, extra_state) ;
}
void mpi_comm_free_keyval_ (int* keyval, int* ierr) {
}
void mpi_sendrecv_replace_ (void *buf, int* count, int* datatype, int* dst, int* sendtag, int* src, int* recvtag,
- int* comm, MPI_Status* status, int* ierr)
+ int* comm, MPI_Status* status, int* ierr)
{
-
*ierr = MPI_Sendrecv_replace(buf, *count, smpi_type_f2c(*datatype), *dst, *sendtag, *src,
*recvtag, smpi_comm_f2c(*comm), FORT_STATUS_IGNORE(status));
}
*ierr = MPI_Reduce_local(inbuf, inoutbuf, *count, smpi_type_f2c(*datatype), smpi_op_f2c(*op));
}
-void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm, int* ierr)
+void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, int* datatype, int* op, int* comm,
+ int* ierr)
{
sendbuf = (char *) FORT_IN_PLACE(sendbuf);
- *ierr = MPI_Reduce_scatter_block(sendbuf, recvbuf, *recvcount, smpi_type_f2c(*datatype), smpi_op_f2c(*op), smpi_comm_f2c(*comm));
+ *ierr = MPI_Reduce_scatter_block(sendbuf, recvbuf, *recvcount, smpi_type_f2c(*datatype), smpi_op_f2c(*op),
+ smpi_comm_f2c(*comm));
}
void mpi_pack_size_ (int* incount, int* datatype, int* comm, int* size, int* ierr) {
*ierr = MPI_Comm_test_inter(smpi_comm_f2c(*comm), flag);
}
-void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm, int* ierr) {
+void mpi_unpack_ (void* inbuf, int* insize, int* position, void* outbuf, int* outcount, int* type, int* comm,
+ int* ierr) {
*ierr = MPI_Unpack(inbuf, *insize, position, outbuf, *outcount, smpi_type_f2c(*type), smpi_comm_f2c(*comm));
}
*ierr = MPI_Pack_external_size(datarep, *incount, smpi_type_f2c(*datatype), size);
}
-void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount, MPI_Aint *position, int* ierr){
+void mpi_pack_external_ (char *datarep, void *inbuf, int* incount, int* datatype, void *outbuf, MPI_Aint* outcount,
+ MPI_Aint *position, int* ierr){
*ierr = MPI_Pack_external(datarep, inbuf, *incount, smpi_type_f2c(*datatype), outbuf, *outcount, position);
}
-void mpi_unpack_external_ ( char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf, int* outcount, int* datatype, int* ierr){
+void mpi_unpack_external_ ( char *datarep, void *inbuf, MPI_Aint* insize, MPI_Aint *position, void *outbuf,
+ int* outcount, int* datatype, int* ierr){
*ierr = MPI_Unpack_external( datarep, inbuf, *insize, position, outbuf, *outcount, smpi_type_f2c(*datatype));
}
}
}
-void mpi_type_create_hindexed_ (int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr) {
+void mpi_type_create_hindexed_(int* count, int* blocklens, MPI_Aint* indices, int* old_type, int* newtype, int* ierr){
MPI_Datatype tmp;
*ierr = MPI_Type_create_hindexed(*count, blocklens, indices, smpi_type_f2c(*old_type), &tmp);
if(*ierr == MPI_SUCCESS) {
}
}
-void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype, int* ierr) {
+void mpi_type_create_hindexed_block_ (int* count, int* blocklength, MPI_Aint* indices, int* old_type, int* newtype,
+ int* ierr) {
MPI_Datatype tmp;
*ierr = MPI_Type_create_hindexed_block(*count, *blocklength, indices, smpi_type_f2c(*old_type), &tmp);
if(*ierr == MPI_SUCCESS) {
}
}
-void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, int* old_type, int*newtype, int* ierr){
+void mpi_type_create_indexed_block_ (int* count, int* blocklength, int* indices, int* old_type, int*newtype,
+ int* ierr){
MPI_Datatype tmp;
*ierr = MPI_Type_create_indexed_block(*count, *blocklength, indices, smpi_type_f2c(*old_type), &tmp);
if(*ierr == MPI_SUCCESS) {
xbt_free(types);
}
-void mpi_type_create_struct_ (int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr) {
+void mpi_type_create_struct_(int* count, int* blocklens, MPI_Aint* indices, int* old_types, int* newtype, int* ierr){
MPI_Datatype tmp;
int i=0;
MPI_Datatype* types = (MPI_Datatype*)xbt_malloc(*count*sizeof(MPI_Datatype));
}
}
-void mpi_intercomm_create_ (int* local_comm, int *local_leader, int* peer_comm, int* remote_leader, int* tag, int* comm_out, int* ierr) {
+void mpi_intercomm_create_ (int* local_comm, int *local_leader, int* peer_comm, int* remote_leader, int* tag,
+ int* comm_out, int* ierr) {
MPI_Comm tmp;
- *ierr = MPI_Intercomm_create(smpi_comm_f2c(*local_comm), *local_leader,smpi_comm_f2c(*peer_comm), *remote_leader, *tag, &tmp);
+ *ierr = MPI_Intercomm_create(smpi_comm_f2c(*local_comm), *local_leader,smpi_comm_f2c(*peer_comm), *remote_leader,
+ *tag, &tmp);
if(*ierr == MPI_SUCCESS) {
*comm_out = smpi_comm_c2f(tmp);
}
*ierr = MPI_Iprobe(*source, *tag, smpi_comm_f2c(*comm), flag, status);
}
-void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner, int* ierr){
-
+void mpi_type_get_envelope_ ( int* datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner,
+ int* ierr){
*ierr = MPI_Type_get_envelope( smpi_type_f2c(*datatype), num_integers,
num_addresses, num_datatypes, combiner);
}
-void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
+void mpi_type_get_contents_ (int* datatype, int* max_integers, int* max_addresses, int* max_datatypes,
+ int* array_of_integers, MPI_Aint* array_of_addresses,
int* array_of_datatypes, int* ierr){
- *ierr = MPI_Type_get_contents(smpi_type_f2c(*datatype), *max_integers, *max_addresses,*max_datatypes, array_of_integers, array_of_addresses, (MPI_Datatype*)array_of_datatypes);
+ *ierr = MPI_Type_get_contents(smpi_type_f2c(*datatype), *max_integers, *max_addresses,*max_datatypes,
+ array_of_integers, array_of_addresses, (MPI_Datatype*)array_of_datatypes);
}
-void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
+void mpi_type_create_darray_ (int* size, int* rank, int* ndims, int* array_of_gsizes, int* array_of_distribs,
+ int* array_of_dargs, int* array_of_psizes,
int* order, int* oldtype, int*newtype, int* ierr) {
MPI_Datatype tmp;
*ierr = MPI_Type_create_darray(*size, *rank, *ndims, array_of_gsizes,
}
}
-void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts, int* order, int* oldtype, int*newtype, int* ierr){
+void mpi_type_create_subarray_ (int* ndims,int *array_of_sizes, int *array_of_subsizes, int *array_of_starts,
+ int* order, int* oldtype, int*newtype, int* ierr){
MPI_Datatype tmp;
- *ierr = MPI_Type_create_subarray(*ndims,array_of_sizes, array_of_subsizes, array_of_starts, *order, smpi_type_f2c(*oldtype), &tmp);
+ *ierr = MPI_Type_create_subarray(*ndims,array_of_sizes, array_of_subsizes, array_of_starts, *order,
+ smpi_type_f2c(*oldtype), &tmp);
if(*ierr == MPI_SUCCESS) {
*newtype = smpi_type_c2f(tmp);
}
}
}
-void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int* sendtypes, void *recvbuf, int *recvcnts, int *rdispls, int* recvtypes,
- int* comm, int* ierr){
- *ierr = MPI_Alltoallw( sendbuf, sendcnts, sdispls, (MPI_Datatype*) sendtypes, recvbuf, recvcnts, rdispls, (MPI_Datatype*)recvtypes, smpi_comm_f2c(*comm));
+void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int* sendtypes, void *recvbuf, int *recvcnts,
+ int *rdispls, int* recvtypes, int* comm, int* ierr){
+ *ierr = MPI_Alltoallw( sendbuf, sendcnts, sdispls, (MPI_Datatype*) sendtypes, recvbuf, recvcnts, rdispls,
+ (MPI_Datatype*)recvtypes, smpi_comm_f2c(*comm));
}
void mpi_exscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr){
}
}
-
void mpi_comm_create_errhandler_ ( void *function, void *errhandler, int* ierr){
*ierr = MPI_Comm_create_errhandler( (MPI_Comm_errhandler_fn*) function, (MPI_Errhandler*)errhandler);
}
void mpi_grequest_start_ ( void *query_fn, void *free_fn, void *cancel_fn, void *extra_state, int*request, int* ierr){
MPI_Request tmp;
- *ierr = MPI_Grequest_start( (MPI_Grequest_query_function*)query_fn, (MPI_Grequest_free_function*)free_fn, (MPI_Grequest_cancel_function*)cancel_fn, extra_state, &tmp);
+ *ierr = MPI_Grequest_start( (MPI_Grequest_query_function*)query_fn, (MPI_Grequest_free_function*)free_fn,
+ (MPI_Grequest_cancel_function*)cancel_fn, extra_state, &tmp);
if(*ierr == MPI_SUCCESS) {
*request = smpi_request_c2f(tmp);
}
}
}
-void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int* intercomm, int* array_of_errcodes, int* ierr){
+void mpi_comm_spawn_ ( char *command, char *argv, int* maxprocs, int* info, int* root, int* comm, int* intercomm,
+ int* array_of_errcodes, int* ierr){
MPI_Comm tmp;
- *ierr = MPI_Comm_spawn( command, NULL, *maxprocs, *(MPI_Info*)info, *root, smpi_comm_f2c(*comm), &tmp, array_of_errcodes);
+ *ierr = MPI_Comm_spawn( command, NULL, *maxprocs, *(MPI_Info*)info, *root, smpi_comm_f2c(*comm), &tmp,
+ array_of_errcodes);
if(*ierr == MPI_SUCCESS) {
*intercomm = smpi_comm_c2f(tmp);
}
}
-void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs, int* array_of_info, int* root,
+void mpi_comm_spawn_multiple_ ( int* count, char *array_of_commands, char** array_of_argv, int* array_of_maxprocs,
+ int* array_of_info, int* root,
int* comm, int* intercomm, int* array_of_errcodes, int* ierr){
MPI_Comm tmp;
*ierr = MPI_Comm_spawn_multiple(* count, &array_of_commands, &array_of_argv, array_of_maxprocs,
*parent = smpi_comm_c2f(tmp);
}
}
-
#include <stdio.h>
#include <stdlib.h>
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi,
- "Logging specific to SMPI (kernel)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
typedef struct s_smpi_process_data {
double simulated;
static char *get_mailbox_name(char *str, int index)
{
- snprintf(str, MAILBOX_NAME_MAXLEN, "SMPI-%0*x", (int) (sizeof(int) * 2),
- index);
+ snprintf(str, MAILBOX_NAME_MAXLEN, "SMPI-%0*x", (int) (sizeof(int) * 2), index);
return str;
}
static char *get_mailbox_name_small(char *str, int index)
{
- snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", (int) (sizeof(int) * 2),
- index);
+ snprintf(str, MAILBOX_NAME_MAXLEN, "small%0*x", (int) (sizeof(int) * 2), index);
return str;
}
// set the process attached to the mailbox
simcall_rdv_set_receiver(data->mailbox_small, proc);
XBT_DEBUG("<%d> New process in the game: %p", index, proc);
-
}
xbt_assert(smpi_process_data(),
- "smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by MPI-2, this is currently not supported by SMPI.");
+ "smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by "
+ "MPI-2, this is currently not supported by SMPI.");
}
void smpi_process_destroy(void)
XBT_DEBUG("<%d> Process left the game", index);
}
-/**
- * @brief Prepares the current process for termination.
- */
+/** @brief Prepares the current process for termination. */
void smpi_process_finalize(void)
{
- // This leads to an explosion of the search graph
- // which cannot be reduced:
+ // This leads to an explosion of the search graph which cannot be reduced:
if(MC_is_active() || MC_record_replay_is_active())
return;
xbt_barrier_wait(process_data[index_to_process_data[index]]->finalization_barrier);
}
-/**
- * @brief Check if a process is finalized
- */
+/** @brief Check if a process is finalized */
int smpi_process_finalized()
{
int index = smpi_process_index();
return 0;
}
-/**
- * @brief Check if a process is initialized
- */
+/** @brief Check if a process is initialized */
int smpi_process_initialized(void)
{
if (!index_to_process_data){
return false;
- }
- else{
+ } else{
int index = smpi_process_index();
- return ( (index != MPI_UNDEFINED)
- && (process_data[index_to_process_data[index]]->state == SMPI_INITIALIZED));
+ return ((index != MPI_UNDEFINED) && (process_data[index_to_process_data[index]]->state == SMPI_INITIALIZED));
}
}
-/**
- * @brief Mark a process as initialized (=MPI_Init called)
- */
+/** @brief Mark a process as initialized (=MPI_Init called) */
void smpi_process_mark_as_initialized(void)
{
int index = smpi_process_index();
else return _xbt_replay_is_active();
}
-
int smpi_global_size(void)
{
char *value = getenv("SMPI_GLOBAL_SIZE");
return data->mailbox;
}
-
smx_mailbox_t smpi_process_remote_mailbox_small(int index)
{
smpi_process_data_t data = smpi_process_remote_data(index);
return data->sampling;
}
-
void print_request(const char *message, MPI_Request request)
{
- XBT_VERB
- ("%s request %p [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
- message, request, request->buf, request->size, request->src,
- request->dst, request->tag, request->flags);
+ XBT_VERB("%s request %p [buf = %p, size = %zu, src = %d, dst = %d, tag = %d, flags = %x]",
+ message, request, request->buf, request->size, request->src, request->dst, request->tag, request->flags);
}
-void smpi_comm_copy_buffer_callback(smx_synchro_t comm,
- void *buff, size_t buff_size)
+void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size)
{
XBT_DEBUG("Copy the data over");
void* tmpbuff=buff;
- if((smpi_privatize_global_variables)
- && ((char*)buff >= smpi_start_data_exe)
+ if((smpi_privatize_global_variables) && ((char*)buff >= smpi_start_data_exe)
&& ((char*)buff < smpi_start_data_exe + smpi_size_data_exe )
){
XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
memcpy(tmpbuff, buff, buff_size);
}
-
- if((smpi_privatize_global_variables)
- && ((char*)comm->comm.dst_buff >= smpi_start_data_exe)
- && ((char*)comm->comm.dst_buff < smpi_start_data_exe + smpi_size_data_exe )
- ){
+ if((smpi_privatize_global_variables) && ((char*)comm->comm.dst_buff >= smpi_start_data_exe)
+ && ((char*)comm->comm.dst_buff < smpi_start_data_exe + smpi_size_data_exe )){
XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
smpi_switch_data_segment(((smpi_process_data_t)(((simdata_process_t)SIMIX_process_get_data(comm->comm.dst_proc))->data))->index);
}
-
memcpy(comm->comm.dst_buff, tmpbuff, buff_size);
if (comm->comm.detached) {
// if this is a detached send, the source buffer was duplicated by SMPI
// sender to make the original buffer available to the application ASAP
xbt_free(buff);
- //It seems that the request is used after the call there this should
- //be free somewhereelse but where???
- //xbt_free(comm->comm.src_data);// inside SMPI the request is keep
- //inside the user data and should be free
+ //It seems that the request is used after the call there this should be free somewhere else but where???
+ //xbt_free(comm->comm.src_data);// inside SMPI the request is kept inside the user data and should be free
comm->comm.src_buff = NULL;
}
if(tmpbuff!=buff)xbt_free(tmpbuff);
-
}
-
-void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm,
- void *buff, size_t buff_size)
+void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size)
{
return;
}
static void smpi_check_options(){
//check correctness of MPI parameters
- xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <=
- sg_cfg_get_int("smpi/send_is_detached_thresh"));
+ xbt_assert(sg_cfg_get_int("smpi/async_small_thresh") <= sg_cfg_get_int("smpi/send_is_detached_thresh"));
if (sg_cfg_is_default_value("smpi/running_power")) {
XBT_INFO("You did not set the power of the host running the simulation. "
process_data[i]->argc = NULL;
process_data[i]->argv = NULL;
process_data[i]->mailbox = simcall_rdv_create(get_mailbox_name(name, i));
- process_data[i]->mailbox_small =
- simcall_rdv_create(get_mailbox_name_small(name, i));
+ process_data[i]->mailbox_small = simcall_rdv_create(get_mailbox_name_small(name, i));
process_data[i]->mailboxes_mutex = xbt_mutex_init();
process_data[i]->timer = xbt_os_timer_new();
if (MC_is_active())
process_data[i]->sampling = 0;
process_data[i]->finalization_barrier = NULL;
}
- //if the process was launched through smpirun script
- //we generate a global mpi_comm_world
- //if not, we let MPI_COMM_NULL, and the comm world
- //will be private to each mpi instance
+ //if the process was launched through smpirun script we generate a global mpi_comm_world
+ //if not, we let MPI_COMM_NULL, and the comm world will be private to each mpi instance
if(smpirun){
group = smpi_group_new(process_count);
MPI_COMM_WORLD = smpi_comm_new(group, NULL);
/* Connect log categories. See xbt/log.c */
- XBT_LOG_CONNECT(smpi); /* Keep this line as soon as possible in this
- function: xbt_log_appender_file.c depends on it
- DO NOT connect this in XBT or so, or it will be
- useless to xbt_log_appender_file.c */
-
+ XBT_LOG_CONNECT(smpi); /* Keep this line as soon as possible in this function: xbt_log_appender_file.c depends on it
+ DO NOT connect this in XBT or so, or it will be useless to xbt_log_appender_file.c */
XBT_LOG_CONNECT(instr_smpi);
XBT_LOG_CONNECT(smpi_base);
XBT_LOG_CONNECT(smpi_bench);
}
static void smpi_init_options(){
- int gather_id = find_coll_description(mpi_coll_gather_description,
- sg_cfg_get_string("smpi/gather"),"gather");
- mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype,
- void *, int, MPI_Datatype, int, MPI_Comm))
+ int gather_id = find_coll_description(mpi_coll_gather_description, sg_cfg_get_string("smpi/gather"),"gather");
+ mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm))
mpi_coll_gather_description[gather_id].coll;
int allgather_id = find_coll_description(mpi_coll_allgather_description,
sg_cfg_get_string("smpi/allgather"),"allgather");
- mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype,
- void *, int, MPI_Datatype, MPI_Comm))
+ mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm))
mpi_coll_allgather_description[allgather_id].coll;
int allgatherv_id = find_coll_description(mpi_coll_allgatherv_description,
sg_cfg_get_string("smpi/allgatherv"),"allgatherv");
- mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype, void *, int *,
- int *, MPI_Datatype, MPI_Comm))
+ mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm))
mpi_coll_allgatherv_description[allgatherv_id].coll;
int allreduce_id = find_coll_description(mpi_coll_allreduce_description,
sg_cfg_get_string("smpi/allreduce"),"allreduce");
- mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount,
- MPI_Datatype dtype, MPI_Op op,
- MPI_Comm comm))
+ mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm))
mpi_coll_allreduce_description[allreduce_id].coll;
int alltoall_id = find_coll_description(mpi_coll_alltoall_description,
sg_cfg_get_string("smpi/alltoall"),"alltoall");
- mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype,
- void *, int, MPI_Datatype, MPI_Comm))
+ mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm))
mpi_coll_alltoall_description[alltoall_id].coll;
int alltoallv_id = find_coll_description(mpi_coll_alltoallv_description,
sg_cfg_get_string("smpi/alltoallv"),"alltoallv");
- mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype,
- void *, int *, int *, MPI_Datatype,
- MPI_Comm))
+ mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm))
mpi_coll_alltoallv_description[alltoallv_id].coll;
- int bcast_id = find_coll_description(mpi_coll_bcast_description,
- sg_cfg_get_string("smpi/bcast"),"bcast");
- mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype,
- int root, MPI_Comm com))
+ int bcast_id = find_coll_description(mpi_coll_bcast_description, sg_cfg_get_string("smpi/bcast"),"bcast");
+ mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com))
mpi_coll_bcast_description[bcast_id].coll;
- int reduce_id = find_coll_description(mpi_coll_reduce_description,
- sg_cfg_get_string("smpi/reduce"),"reduce");
- mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count,
- MPI_Datatype datatype, MPI_Op op,
- int root, MPI_Comm comm))
- mpi_coll_reduce_description[reduce_id].coll;
+ int reduce_id = find_coll_description(mpi_coll_reduce_description, sg_cfg_get_string("smpi/reduce"),"reduce");
+ mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
+ MPI_Comm comm)) mpi_coll_reduce_description[reduce_id].coll;
int reduce_scatter_id =
find_coll_description(mpi_coll_reduce_scatter_description,
sg_cfg_get_string("smpi/reduce_scatter"),"reduce_scatter");
- mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts,
- MPI_Datatype dtype, MPI_Op op,
- MPI_Comm comm))
- mpi_coll_reduce_scatter_description[reduce_scatter_id].coll;
-
- int scatter_id = find_coll_description(mpi_coll_scatter_description,
- sg_cfg_get_string("smpi/scatter"),"scatter");
- mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount,
- MPI_Datatype sendtype, void *recvbuf,
- int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm))
+ mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype, MPI_Op op,
+ MPI_Comm comm)) mpi_coll_reduce_scatter_description[reduce_scatter_id].coll;
+
+ int scatter_id = find_coll_description(mpi_coll_scatter_description, sg_cfg_get_string("smpi/scatter"),"scatter");
+ mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
+ int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm))
mpi_coll_scatter_description[scatter_id].coll;
- int barrier_id = find_coll_description(mpi_coll_barrier_description,
- sg_cfg_get_string("smpi/barrier"),"barrier");
- mpi_coll_barrier_fun = (int (*)(MPI_Comm comm))
- mpi_coll_barrier_description[barrier_id].coll;
+ int barrier_id = find_coll_description(mpi_coll_barrier_description, sg_cfg_get_string("smpi/barrier"),"barrier");
+ mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll;
smpi_cpu_threshold = sg_cfg_get_double("smpi/cpu_threshold");
smpi_running_power = sg_cfg_get_double("smpi/running_power");
smpi_privatize_global_variables = sg_cfg_get_boolean("smpi/privatize_global_variables");
if (smpi_cpu_threshold < 0)
smpi_cpu_threshold = DBL_MAX;
-
}
int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
srand(SMPI_RAND_SEED);
if (getenv("SMPI_PRETEND_CC") != NULL) {
- /* Hack to ensure that smpicc can pretend to be a simple
- * compiler. Particularly handy to pass it to the configuration tools */
+ /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the
+ * configuration tools */
return 0;
}
-
smpi_init_logs();
TRACE_global_init(&argc, argv);
-
TRACE_add_start_function(TRACE_smpi_alloc);
TRACE_add_end_function(TRACE_smpi_release);
double global_time = xbt_os_timer_elapsed(global_timer);
XBT_INFO("Simulated time: %g seconds. \n\n"
"The simulation took %g seconds (after parsing and platform setup)\n"
- "%g seconds were actual computation of the application"
- , SIMIX_get_clock(), global_time , smpi_total_benched_time);
+ "%g seconds were actual computation of the application",
+ SIMIX_get_clock(), global_time , smpi_total_benched_time);
if (smpi_total_benched_time/global_time>=0.75)
XBT_INFO("More than 75%% of the time was spent inside the application code.\n"
"You may want to use sampling functions or trace replay to reduce this.");
}
}
-
smpi_global_destroy();
TRACE_end();
#include "private.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi,
- "Logging specific to SMPI (group)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi, "Logging specific to SMPI (group)");
typedef struct s_smpi_mpi_group {
int size;
xbt_dict_cursor_t cursor = NULL;
int i;
- if(origin!= smpi_comm_group(MPI_COMM_WORLD)
- && origin != MPI_GROUP_NULL
- && origin != smpi_comm_group(MPI_COMM_SELF)
- && origin != MPI_GROUP_EMPTY)
+ if(origin!= smpi_comm_group(MPI_COMM_WORLD) && origin != MPI_GROUP_NULL
+ && origin != smpi_comm_group(MPI_COMM_SELF) && origin != MPI_GROUP_EMPTY)
{
group = xbt_new(s_smpi_mpi_group_t, 1);
group->size = origin->size;
return group;
}
-
void smpi_group_destroy(MPI_Group group)
{
if(group!= smpi_comm_group(MPI_COMM_WORLD)
return 0;
}
return group->refcount;
-
}
int smpi_group_size(MPI_Group group)
#include "private.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi,
- "Memory layout support for SMPI");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI");
#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize)
// anonymous data segment. This does not happen in practice, however.
// File backed RW entry:
- if (i->pathname == full_name
- && (i->prot & PROT_RWX) == PROT_RW) {
+ if (i->pathname == full_name && (i->prot & PROT_RWX) == PROT_RW) {
smpi_start_data_exe = (char*) i->start_addr;
smpi_size_data_exe = i->end_addr - i->start_addr;
++i;
/* Here we are making the assumption that a suitable empty region
following the rw- area is the end of the data segment. It would
be better to check with the size of the data segment. */
- if (i != map.end()
- && i->pathname.empty()
- && (i->prot & PROT_RWX) == PROT_RW
+ if (i != map.end() && i->pathname.empty() && (i->prot & PROT_RWX) == PROT_RW
&& i->start_addr == (std::uint64_t) smpi_start_data_exe + smpi_size_data_exe) {
smpi_size_data_exe = i->end_addr - (std::uint64_t) smpi_start_data_exe;
}
}
xbt_die("Did not find my data segment.");
}
-
#endif
#include "private.h"
#include "simgrid/sg_config.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi,
- "Logging specific to SMPI (mpi)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi, smpi, "Logging specific to SMPI (mpi)");
/* MPI User level calls */
int MPI_Init(int *argc, char ***argv)
{
-
return PMPI_Init(argc, argv);
}
return PMPI_Type_delete_attr (type, type_keyval);
}
-int MPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int MPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state)
{
return PMPI_Type_create_keyval(copy_fn, delete_fn, keyval, extra_state) ;
}
return PMPI_Group_rank(group, rank);
}
-int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
- MPI_Group group2, int *ranks2)
+int MPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1, MPI_Group group2, int *ranks2)
{
return PMPI_Group_translate_ranks(group1, n, ranks1, group2, ranks2);
}
return PMPI_Group_excl(group, n, ranks, newgroup);
}
-int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
- MPI_Group * newgroup)
+int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
{
return PMPI_Group_range_incl(group, n, ranges, newgroup);
}
-int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
- MPI_Group * newgroup)
+int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
{
return PMPI_Group_range_excl(group, n, ranges, newgroup);
}
return PMPI_Comm_delete_attr (comm, comm_keyval);
}
-int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state)
{
return PMPI_Comm_create_keyval(copy_fn, delete_fn, keyval, extra_state) ;
}
return PMPI_Comm_split(comm, color, key, comm_out);
}
-int MPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
{
return PMPI_Send_init(buf, count, datatype, dst, tag, comm, request);
}
-int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
- int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
{
return PMPI_Recv_init(buf, count, datatype, src, tag, comm, request);
}
return PMPI_Request_free(request);
}
-int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
- int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
{
return PMPI_Irecv(buf, count, datatype, src, tag, comm, request);
}
-int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm, MPI_Request * request)
+int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
{
return PMPI_Isend(buf, count, datatype, dst, tag, comm, request);
}
-int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
- MPI_Comm comm, MPI_Status * status)
+int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
{
return PMPI_Recv(buf, count, datatype, src, tag, comm, status);
}
-int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
- MPI_Comm comm)
+int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
return PMPI_Send(buf, count, datatype, dst, tag, comm);
}
-int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- int dst, int sendtag, void *recvbuf, int recvcount,
- MPI_Datatype recvtype, int src, int recvtag,
- MPI_Comm comm, MPI_Status * status)
+int MPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int dst, int sendtag, void *recvbuf, int recvcount,
+ MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status * status)
{
- return PMPI_Sendrecv(sendbuf, sendcount, sendtype, dst, sendtag,
- recvbuf, recvcount, recvtype, src, recvtag,
+ return PMPI_Sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf, recvcount, recvtype, src, recvtag,
comm, status);
}
-int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
- int dst, int sendtag, int src, int recvtag,
+int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dst, int sendtag, int src, int recvtag,
MPI_Comm comm, MPI_Status * status)
{
- return PMPI_Sendrecv_replace(buf, count, datatype, dst, sendtag, src,
- recvtag, comm, status);
+ return PMPI_Sendrecv_replace(buf, count, datatype, dst, sendtag, src, recvtag, comm, status);
}
int MPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
return PMPI_Test(request, flag, status);
}
-int MPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
- MPI_Status * status)
+int MPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status)
{
return PMPI_Testany(count, requests, index, flag, status);
}
return PMPI_Waitall(count, requests, status);
}
-int MPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
- int *indices, MPI_Status status[])
+int MPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int *indices, MPI_Status status[])
{
return PMPI_Waitsome(incount, requests, outcount, indices, status);
}
return PMPI_Barrier(comm);
}
-int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
+int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm)
{
- return PMPI_Gather(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype,
- root, comm);
+ return PMPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
}
-int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts, int *displs,
+int MPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, int root, MPI_Comm comm)
{
- return PMPI_Gatherv(sendbuf, sendcount, sendtype,
- recvbuf, recvcounts, displs, recvtype,
- root, comm);
+ return PMPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm);
}
-int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm)
+int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount,
+ MPI_Datatype recvtype, MPI_Comm comm)
{
- return PMPI_Allgather(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype,
- comm);
+ return PMPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
}
-int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts, int *displs,
+int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, MPI_Comm comm)
{
- return PMPI_Allgatherv(sendbuf, sendcount, sendtype,
- recvbuf, recvcounts, displs, recvtype,
- comm);
+ return PMPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
}
-int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
+int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,
int root, MPI_Comm comm)
{
- return PMPI_Scatter(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype,
- root, comm);
+ return PMPI_Scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
}
-int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
- MPI_Datatype sendtype, void *recvbuf, int recvcount,
+int MPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount,
MPI_Datatype recvtype, int root, MPI_Comm comm)
{
- return PMPI_Scatterv(sendbuf, sendcounts, displs, sendtype,
- recvbuf, recvcount, recvtype,
- root, comm);
+ return PMPI_Scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
}
-int MPI_Reduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
+int MPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
{
return PMPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
}
-int MPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
- MPI_Datatype datatype, MPI_Op op){
+int MPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op){
return PMPI_Reduce_local(inbuf, inoutbuf, count, datatype, op);
}
-int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
return PMPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
}
-int MPI_Scan(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
return PMPI_Scan(sendbuf, recvbuf, count, datatype, op, comm);
}
-int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
return PMPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm);
}
-int MPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int MPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op,
+ MPI_Comm comm)
{
return PMPI_Reduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm);
}
-int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm)
+int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount,
+ MPI_Datatype recvtype, MPI_Comm comm)
{
- return PMPI_Alltoall(sendbuf, sendcount, sendtype,
- recvbuf, recvcount, recvtype,
- comm);
+ return PMPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
}
-int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
- MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
+int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps, MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
{
- return PMPI_Alltoallv(sendbuf, sendcounts, senddisps, sendtype,
- recvbuf, recvcounts, recvdisps, recvtype,
- comm);
+ return PMPI_Alltoallv(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype, comm);
}
int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr){
return PMPI_Pack_external_size(datarep, incount, datatype, size);
}
-int MPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position){
+int MPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount,
+ MPI_Aint *position){
return PMPI_Pack_external(datarep, inbuf, incount, datatype, outbuf, outcount, position);
}
-int MPI_Unpack_external( char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype){
+int MPI_Unpack_external(char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount,
+ MPI_Datatype datatype){
return PMPI_Unpack_external( datarep, inbuf, insize, position, outbuf, outcount, datatype);
}
return PMPI_Type_hindexed(count, blocklens, indices, old_type, newtype);
}
-int MPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int MPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type) {
return PMPI_Type_create_hindexed(count, blocklens,indices,old_type,new_type);
}
-int MPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) {
+int MPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type,
+ MPI_Datatype* newtype) {
return PMPI_Type_create_hindexed_block(count, blocklength, indices, old_type, newtype);
}
return PMPI_Type_create_indexed(count, blocklens, indices, old_type, newtype);
}
-int MPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype *newtype){
+int MPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type,
+ MPI_Datatype *newtype){
return PMPI_Type_create_indexed_block(count, blocklength, indices, old_type, newtype);
}
return PMPI_Type_struct(count, blocklens, indices, old_types, newtype);
}
-int MPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) {
+int MPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+ MPI_Datatype* newtype) {
return PMPI_Type_create_struct(count, blocklens, indices, old_types, newtype);
}
return PMPI_Ssend(buf, count, datatype, dest, tag, comm);
}
-int MPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int MPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request){
return PMPI_Ssend_init(buf, count, datatype, dest, tag, comm, request);
}
-int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
+int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag,
+ MPI_Comm* comm_out) {
return PMPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, comm_out);
}
return PMPI_Bsend(buf, count, datatype, dest, tag, comm);
}
-int MPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int MPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request){
return PMPI_Bsend_init(buf, count, datatype, dest, tag, comm, request);
}
return PMPI_Rsend(buf, count, datatype, dest, tag, comm);
}
-int MPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int MPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request){
return PMPI_Rsend_init(buf, count, datatype, dest, tag, comm, request);
}
int MPI_Get( 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){
- return PMPI_Get( origin_addr,origin_count, origin_datatype,target_rank,
- target_disp, target_count,target_datatype, win);
+ return PMPI_Get(origin_addr,origin_count, origin_datatype,target_rank, target_disp, target_count,target_datatype,win);
}
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){
- return PMPI_Put( origin_addr,origin_count, origin_datatype,target_rank,
- target_disp, target_count,target_datatype, win);
+ return PMPI_Put(origin_addr,origin_count, origin_datatype,target_rank,target_disp, target_count,target_datatype, win);
}
int MPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
int MPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers,
int *num_addresses, int *num_datatypes, int *combiner){
- return PMPI_Type_get_envelope( datatype, num_integers,
- num_addresses, num_datatypes, combiner);
+ return PMPI_Type_get_envelope( datatype, num_integers, num_addresses, num_datatypes, combiner);
}
-int MPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses,
- int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
- MPI_Datatype *array_of_datatypes){
- return PMPI_Type_get_contents(datatype, max_integers, max_addresses,
- max_datatypes, array_of_integers, array_of_addresses,
- array_of_datatypes);
+int MPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes,
+ int* array_of_integers, MPI_Aint* array_of_addresses, MPI_Datatype *array_of_datatypes){
+ return PMPI_Type_get_contents(datatype, max_integers, max_addresses,max_datatypes, array_of_integers,
+ array_of_addresses, array_of_datatypes);
}
-int MPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes,
- int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
- int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
- return PMPI_Type_create_darray(size, rank, ndims, array_of_gsizes,
- array_of_distribs, array_of_dargs, array_of_psizes,
+int MPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes, int* array_of_distribs,
+ int* array_of_dargs, int* array_of_psizes,int order, MPI_Datatype oldtype,
+ MPI_Datatype *newtype) {
+ return PMPI_Type_create_darray(size, rank, ndims, array_of_gsizes,array_of_distribs, array_of_dargs, array_of_psizes,
order, oldtype, newtype) ;
}
return PMPI_Type_create_resized(oldtype,lb, extent, newtype);
}
-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){
+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){
return PMPI_Type_create_subarray(ndims,array_of_sizes, array_of_subsizes, array_of_starts, order, oldtype, newtype);
}
}
int MPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
- void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes,
- MPI_Comm comm){
- return PMPI_Alltoallw( sendbuf, sendcnts, sdispls, sendtypes,
- recvbuf, recvcnts, rdispls, recvtypes,
- comm);
+ void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes, MPI_Comm comm){
+ return PMPI_Alltoallw( sendbuf, sendcnts, sdispls, sendtypes, recvbuf, recvcnts, rdispls, recvtypes, comm);
}
-int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
- MPI_Op op, MPI_Comm comm){
+int MPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm){
return PMPI_Exscan(sendbuf, recvbuf, count, datatype, op, comm);
}
return PMPI_Request_get_status( request, flag, status);
}
-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){
+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){
return PMPI_Grequest_start( query_fn, free_fn, cancel_fn, extra_state, request);
}
return PMPI_Comm_spawn( command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes);
}
-int MPI_Comm_spawn_multiple( int count, char **array_of_commands, char*** array_of_argv,
- int* array_of_maxprocs, MPI_Info* array_of_info, int root,
- MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
+int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char*** array_of_argv, int* array_of_maxprocs,
+ MPI_Info* array_of_info, int root, MPI_Comm comm, MPI_Comm *intercomm,
+ int* array_of_errcodes){
return PMPI_Comm_spawn_multiple( count, array_of_commands, array_of_argv, array_of_maxprocs,
array_of_info, root, comm, intercomm, array_of_errcodes);
}
#include "xbt/replay.h"
#include "simgrid/modelchecker.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi,
- "Logging specific to SMPI (datatype)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi, "Logging specific to SMPI (datatype)");
xbt_dict_t smpi_type_keyvals = NULL;
int type_keyval_id=0;//avoid collisions
// Internal use only
CREATE_MPI_DATATYPE(MPI_PTR, void*);
-/** Check if the datatype is usable for communications
- */
+/** Check if the datatype is usable for communications */
int is_datatype_valid(MPI_Datatype datatype) {
- return datatype != MPI_DATATYPE_NULL
- && (datatype->flags & DT_FLAG_COMMITED);
+ return datatype != MPI_DATATYPE_NULL && (datatype->flags & DT_FLAG_COMMITED);
}
size_t smpi_datatype_size(MPI_Datatype datatype)
void* value_in;
void* value_out;
xbt_dict_foreach(datatype->attributes, cursor, key, value_in){
- smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)));
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)));
if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){
ret = elem->copy_fn(datatype, *key, NULL, value_in, &value_out, &flag );
if(ret!=MPI_SUCCESS){
return ret;
}
-int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb,
- MPI_Aint * extent)
+int smpi_datatype_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent)
{
if(datatype == MPI_DATATYPE_NULL){
*lb=0;
}else{
s_smpi_subtype_t *subtype = static_cast<s_smpi_subtype_t*>(sendtype->substruct);
-
void * buf_tmp = xbt_malloc(count);
subtype->serialize( sendbuf, buf_tmp,count/smpi_datatype_size(sendtype), subtype);
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void serialize_vector( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type)
+void serialize_vector( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type)
{
s_smpi_mpi_vector_t* type_c = (s_smpi_mpi_vector_t*)type;
int i;
for (i = 0; i < type_c->block_count * count; i++) {
if (type_c->old_type->has_subtype == 0)
- memcpy(contiguous_vector_char,
- noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
+ memcpy(contiguous_vector_char, noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
else
((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_vector_char,
contiguous_vector_char,
- type_c->block_length,
- type_c->old_type->substruct);
+ type_c->block_length, type_c->old_type->substruct);
contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
if((i+1)%type_c->block_count ==0)
- noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
+ noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
else
- noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
+ noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
}
}
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void unserialize_vector( const void *contiguous_vector,
- void *noncontiguous_vector,
- int count,
- void *type,
- MPI_Op op)
+void unserialize_vector( const void *contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
{
s_smpi_mpi_vector_t* type_c = (s_smpi_mpi_vector_t*)type;
int i;
/* memcpy(noncontiguous_vector_char,
contiguous_vector_char, type_c->block_length * type_c->size_oldtype);*/
else
- ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_vector_char,
- noncontiguous_vector_char,
- type_c->block_length,
- type_c->old_type->substruct,
- op);
+ ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize(contiguous_vector_char, noncontiguous_vector_char,
+ type_c->block_length,type_c->old_type->substruct,
+ op);
contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
if((i+1)%type_c->block_count ==0)
- noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
+ noncontiguous_vector_char += type_c->block_length*smpi_datatype_get_extent(type_c->old_type);
else
- noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
+ noncontiguous_vector_char += type_c->block_stride*smpi_datatype_get_extent(type_c->old_type);
}
}
-/*
- * Create a Sub type vector to be able to serialize and unserialize it
- * the structure s_smpi_mpi_vector_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
- *
- */
-s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride,
- int block_length,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype){
+/* Create a Sub type vector to be able to serialize and unserialize it the structure s_smpi_mpi_vector_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize */
+s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride, int block_length, int block_count,
+ MPI_Datatype old_type, int size_oldtype){
s_smpi_mpi_vector_t *new_t= xbt_new(s_smpi_mpi_vector_t,1);
new_t->base.serialize = &serialize_vector;
new_t->base.unserialize = &unserialize_vector;
return new_t;
}
-void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype,
- void *struct_type, int flags){
+void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int has_subtype, void *struct_type,
+ int flags){
MPI_Datatype new_t= xbt_new(s_smpi_mpi_datatype_t,1);
new_t->name = NULL;
new_t->size = size;
void smpi_datatype_free(MPI_Datatype* type){
xbt_assert((*type)->in_use >= 0);
if((*type)->attributes !=NULL){
- xbt_dict_cursor_t cursor = NULL;
- int* key;
- void * value;
- int flag;
- xbt_dict_foreach((*type)->attributes, cursor, key, value){
- smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)));
- if(elem && elem->delete_fn)
- elem->delete_fn(*type,*key, value, &flag);
- }
+ xbt_dict_cursor_t cursor = NULL;
+ int* key;
+ void * value;
+ int flag;
+ xbt_dict_foreach((*type)->attributes, cursor, key, value){
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)));
+ if(elem && elem->delete_fn)
+ elem->delete_fn(*type,*key, value, &flag);
+ }
}
if((*type)->flags & DT_FLAG_PREDEFINED)return;
#endif
}
-
void smpi_datatype_unuse(MPI_Datatype type){
if (type->in_use > 0)
type->in_use--;
#endif
}
+/*Contiguous Implementation*/
-
-
-/*
-Contiguous Implementation
-*/
-
-
-/*
- * Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
* @param contiguous_hvector - output hvector
* @param noncontiguous_hvector - input hvector
* @param type - pointer contening :
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void serialize_contiguous( const void *noncontiguous_hvector,
- void *contiguous_hvector,
- int count,
- void *type)
+void serialize_contiguous( const void *noncontiguous_hvector, void *contiguous_hvector, int count, void *type)
{
s_smpi_mpi_contiguous_t* type_c = (s_smpi_mpi_contiguous_t*)type;
char* contiguous_vector_char = (char*)contiguous_hvector;
char* noncontiguous_vector_char = (char*)noncontiguous_hvector+type_c->lb;
- memcpy(contiguous_vector_char,
- noncontiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);
+ memcpy(contiguous_vector_char, noncontiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);
}
-/*
- * Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
* @param noncontiguous_vector - output hvector
* @param contiguous_vector - input hvector
* @param type - pointer contening :
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void unserialize_contiguous( const void *contiguous_vector,
- void *noncontiguous_vector,
- int count,
- void *type,
- MPI_Op op)
+void unserialize_contiguous(const void *contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
{
s_smpi_mpi_contiguous_t* type_c = (s_smpi_mpi_contiguous_t*)type;
char* contiguous_vector_char = (char*)contiguous_vector;
char* noncontiguous_vector_char = (char*)noncontiguous_vector+type_c->lb;
int n= count* type_c->block_count;
- smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &n,
- &type_c->old_type);
- /*memcpy(noncontiguous_vector_char,
- contiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);*/
+ smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &n, &type_c->old_type);
+ /*memcpy(noncontiguous_vector_char, contiguous_vector_char, count* type_c->block_count * type_c->size_oldtype);*/
}
void free_contiguous(MPI_Datatype* d){
smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
}
-/*
- * Create a Sub type contiguous to be able to serialize and unserialize it
- * the structure s_smpi_mpi_contiguous_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
- *
- */
-s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb,
- int block_count,
- MPI_Datatype old_type,
+/* Create a Sub type contiguous to be able to serialize and unserialize it the structure s_smpi_mpi_contiguous_t is
+ * erived from s_smpi_subtype which required the functions unserialize and serialize */
+s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count, MPI_Datatype old_type,
int size_oldtype){
s_smpi_mpi_contiguous_t *new_t= xbt_new(s_smpi_mpi_contiguous_t,1);
new_t->base.serialize = &serialize_contiguous;
return new_t;
}
-
-
-
int smpi_datatype_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type, MPI_Aint lb)
{
int retval;
return smpi_datatype_hvector(count, 1, smpi_datatype_get_extent(old_type), old_type, new_type);
}
- s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
- count,
- old_type,
- smpi_datatype_size(old_type));
-
- smpi_datatype_create(new_type,
- count * smpi_datatype_size(old_type),
- lb,lb + count * smpi_datatype_size(old_type),
+ s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, count, old_type,smpi_datatype_size(old_type));
+
+ smpi_datatype_create(new_type, count * smpi_datatype_size(old_type),lb,lb + count * smpi_datatype_size(old_type),
1,subtype, DT_FLAG_CONTIGUOUS);
retval=MPI_SUCCESS;
return retval;
}
if(old_type->has_subtype || stride != blocklen){
-
- s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create( stride,
- blocklen,
- count,
- old_type,
+ s_smpi_mpi_vector_t* subtype = smpi_datatype_vector_create(stride, blocklen, count, old_type,
smpi_datatype_size(old_type));
- smpi_datatype_create(new_type,
- count * (blocklen) * smpi_datatype_size(old_type), lb,
- ub,
- 1,
- subtype,
+ smpi_datatype_create(new_type, count * (blocklen) * smpi_datatype_size(old_type), lb, ub, 1, subtype,
DT_FLAG_VECTOR);
retval=MPI_SUCCESS;
}else{
- /* in this situation the data are contignous thus it's not
- * required to serialize and unserialize it*/
- smpi_datatype_create(new_type, count * blocklen *
- smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
- smpi_datatype_size(old_type),
- 0,
- NULL,
- DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+ /* in this situation the data are contignous thus it's not required to serialize and unserialize it*/
+ smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), 0, ((count -1) * stride + blocklen)*
+ smpi_datatype_size(old_type), 0, NULL, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
retval=MPI_SUCCESS;
}
return retval;
smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*d)->substruct)->old_type);
}
-/*
-Hvector Implementation - Vector with stride in bytes
-*/
-
+/* Hvector Implementation - Vector with stride in bytes */
-/*
- * Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
* @param contiguous_hvector - output hvector
* @param noncontiguous_hvector - input hvector
* @param type - pointer contening :
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void serialize_hvector( const void *noncontiguous_hvector,
- void *contiguous_hvector,
- int count,
- void *type)
+void serialize_hvector( const void *noncontiguous_hvector, void *contiguous_hvector, int count, void *type)
{
s_smpi_mpi_hvector_t* type_c = (s_smpi_mpi_hvector_t*)type;
int i;
for (i = 0; i < type_c->block_count * count; i++) {
if (type_c->old_type->has_subtype == 0)
- memcpy(contiguous_vector_char,
- noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
+ memcpy(contiguous_vector_char, noncontiguous_vector_char, type_c->block_length * type_c->size_oldtype);
else
((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_vector_char,
contiguous_vector_char,
- type_c->block_length,
- type_c->old_type->substruct);
+ type_c->block_length, type_c->old_type->substruct);
contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
if((i+1)%type_c->block_count ==0)
- noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
+ noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
else
- noncontiguous_vector_char += type_c->block_stride;
+ noncontiguous_vector_char += type_c->block_stride;
}
}
-/*
- * Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
* @param noncontiguous_vector - output hvector
* @param contiguous_vector - input hvector
* @param type - pointer contening :
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void unserialize_hvector( const void *contiguous_vector,
- void *noncontiguous_vector,
- int count,
- void *type,
- MPI_Op op)
+void unserialize_hvector( const void *contiguous_vector, void *noncontiguous_vector, int count, void *type, MPI_Op op)
{
s_smpi_mpi_hvector_t* type_c = (s_smpi_mpi_hvector_t*)type;
int i;
for (i = 0; i < type_c->block_count * count; i++) {
if (type_c->old_type->has_subtype == 0)
- smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &type_c->block_length,
- &type_c->old_type);
+ smpi_op_apply(op, contiguous_vector_char, noncontiguous_vector_char, &type_c->block_length, &type_c->old_type);
/*memcpy(noncontiguous_vector_char,
contiguous_vector_char, type_c->block_length * type_c->size_oldtype);*/
else
- ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_vector_char,
- noncontiguous_vector_char,
- type_c->block_length,
- type_c->old_type->substruct,
+ ((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_vector_char, noncontiguous_vector_char,
+ type_c->block_length, type_c->old_type->substruct,
op);
contiguous_vector_char += type_c->block_length*type_c->size_oldtype;
if((i+1)%type_c->block_count ==0)
- noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
+ noncontiguous_vector_char += type_c->block_length*type_c->size_oldtype;
else
- noncontiguous_vector_char += type_c->block_stride;
+ noncontiguous_vector_char += type_c->block_stride;
}
}
-/*
- * Create a Sub type vector to be able to serialize and unserialize it
- * the structure s_smpi_mpi_vector_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
+/* Create a Sub type vector to be able to serialize and unserialize it the structure s_smpi_mpi_vector_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize
*
*/
-s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride,
- int block_length,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype){
+s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int block_length, int block_count,
+ MPI_Datatype old_type, int size_oldtype){
s_smpi_mpi_hvector_t *new_t= xbt_new(s_smpi_mpi_hvector_t,1);
new_t->base.serialize = &serialize_hvector;
new_t->base.unserialize = &unserialize_hvector;
ub=((count-1)*stride)+(blocklen-1)*smpi_datatype_get_extent(old_type)+smpi_datatype_ub(old_type);
}
if(old_type->has_subtype || stride != blocklen*smpi_datatype_get_extent(old_type)){
- s_smpi_mpi_hvector_t* subtype = smpi_datatype_hvector_create( stride,
- blocklen,
- count,
- old_type,
+ s_smpi_mpi_hvector_t* subtype = smpi_datatype_hvector_create( stride, blocklen, count, old_type,
smpi_datatype_size(old_type));
- smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),
- lb,ub,
- 1,
- subtype,
- DT_FLAG_VECTOR);
+ smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type), lb,ub, 1, subtype, DT_FLAG_VECTOR);
retval=MPI_SUCCESS;
}else{
- smpi_datatype_create(new_type, count * blocklen *
- smpi_datatype_size(old_type),0,count * blocklen *
- smpi_datatype_size(old_type),
- 0,
- NULL,
- DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
+ smpi_datatype_create(new_type, count * blocklen * smpi_datatype_size(old_type),0,count * blocklen *
+ smpi_datatype_size(old_type), 0, NULL, DT_FLAG_VECTOR|DT_FLAG_CONTIGUOUS);
retval=MPI_SUCCESS;
}
return retval;
}
+/* Indexed Implementation */
-/*
-Indexed Implementation
-*/
-
-/*
- * Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
* @param contiguous_indexed - output indexed
* @param noncontiguous_indexed - input indexed
* @param type - pointer contening :
* - block_indices - indices of each data, in element
* - count - the number of rows of matrix
*/
-void serialize_indexed( const void *noncontiguous_indexed,
- void *contiguous_indexed,
- int count,
- void *type)
+void serialize_indexed( const void *noncontiguous_indexed, void *contiguous_indexed, int count, void *type)
{
s_smpi_mpi_indexed_t* type_c = (s_smpi_mpi_indexed_t*)type;
int i,j;
for(j=0; j<count;j++){
for (i = 0; i < type_c->block_count; i++) {
if (type_c->old_type->has_subtype == 0)
- memcpy(contiguous_indexed_char,
- noncontiguous_indexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
+ memcpy(contiguous_indexed_char, noncontiguous_indexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
else
((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_indexed_char,
contiguous_indexed_char,
type_c->block_lengths[i],
type_c->old_type->substruct);
-
contiguous_indexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
- if (i<type_c->block_count-1)noncontiguous_indexed_char = (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
- else noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+ if (i<type_c->block_count-1)
+ noncontiguous_indexed_char =
+ (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
+ else
+ noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
}
noncontiguous_indexed=(void*)noncontiguous_indexed_char;
}
}
-/*
- * Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
* @param noncontiguous_indexed - output indexed
* @param contiguous_indexed - input indexed
* @param type - pointer contening :
* - block_indices - indices of each data, in element
* - count - the number of rows of matrix
*/
-void unserialize_indexed( const void *contiguous_indexed,
- void *noncontiguous_indexed,
- int count,
- void *type,
- MPI_Op op)
+void unserialize_indexed( const void *contiguous_indexed, void *noncontiguous_indexed, int count, void *type, MPI_Op op)
{
-
s_smpi_mpi_indexed_t* type_c = (s_smpi_mpi_indexed_t*)type;
int i,j;
char* contiguous_indexed_char = (char*)contiguous_indexed;
- char* noncontiguous_indexed_char = (char*)noncontiguous_indexed+type_c->block_indices[0]*smpi_datatype_get_extent(type_c->old_type);
+ char* noncontiguous_indexed_char =
+ (char*)noncontiguous_indexed+type_c->block_indices[0]*smpi_datatype_get_extent(type_c->old_type);
for(j=0; j<count;j++){
for (i = 0; i < type_c->block_count; i++) {
if (type_c->old_type->has_subtype == 0)
((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_indexed_char,
noncontiguous_indexed_char,
type_c->block_lengths[i],
- type_c->old_type->substruct,
- op);
+ type_c->old_type->substruct, op);
contiguous_indexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
if (i<type_c->block_count-1)
- noncontiguous_indexed_char = (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
- else noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+ noncontiguous_indexed_char =
+ (char*)noncontiguous_indexed + type_c->block_indices[i+1]*smpi_datatype_get_extent(type_c->old_type);
+ else
+ noncontiguous_indexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
}
noncontiguous_indexed=(void*)noncontiguous_indexed_char;
}
smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*type)->substruct)->old_type);
}
-/*
- * Create a Sub type indexed to be able to serialize and unserialize it
- * the structure s_smpi_mpi_indexed_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
- */
-s_smpi_mpi_indexed_t* smpi_datatype_indexed_create( int* block_lengths,
- int* block_indices,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype){
+/* Create a Sub type indexed to be able to serialize and unserialize it the structure s_smpi_mpi_indexed_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize */
+s_smpi_mpi_indexed_t* smpi_datatype_indexed_create( int* block_lengths, int* block_indices, int block_count,
+ MPI_Datatype old_type, int size_oldtype){
s_smpi_mpi_indexed_t *new_t= xbt_new(s_smpi_mpi_indexed_t,1);
new_t->base.serialize = &serialize_indexed;
new_t->base.unserialize = &unserialize_indexed;
return new_t;
}
-
int smpi_datatype_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
{
int i;
contiguous=0;
if(!contiguous){
- s_smpi_mpi_indexed_t* subtype = smpi_datatype_indexed_create( blocklens,
- indices,
- count,
- old_type,
+ s_smpi_mpi_indexed_t* subtype = smpi_datatype_indexed_create( blocklens, indices, count, old_type,
smpi_datatype_size(old_type));
- smpi_datatype_create(new_type, size *
- smpi_datatype_size(old_type),lb,ub,1, subtype, DT_FLAG_DATA);
+ smpi_datatype_create(new_type, size * smpi_datatype_size(old_type),lb,ub,1, subtype, DT_FLAG_DATA);
}else{
- s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
- size,
- old_type,
+ s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, size, old_type,
smpi_datatype_size(old_type));
- smpi_datatype_create(new_type, size *
- smpi_datatype_size(old_type),lb,ub,1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
+ smpi_datatype_create(new_type, size * smpi_datatype_size(old_type), lb, ub, 1, subtype,
+ DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
}
retval=MPI_SUCCESS;
return retval;
}
+/* Hindexed Implementation - Indexed with indices in bytes */
-
-/*
-Hindexed Implementation - Indexed with indices in bytes
-*/
-
-/*
- * Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
* @param contiguous_hindexed - output hindexed
* @param noncontiguous_hindexed - input hindexed
* @param type - pointer contening :
* - block_indices - indices of each data, in bytes
* - count - the number of rows of matrix
*/
-void serialize_hindexed( const void *noncontiguous_hindexed,
- void *contiguous_hindexed,
- int count,
- void *type)
+void serialize_hindexed( const void *noncontiguous_hindexed, void *contiguous_hindexed, int count, void *type)
{
s_smpi_mpi_hindexed_t* type_c = (s_smpi_mpi_hindexed_t*)type;
int i,j;
for(j=0; j<count;j++){
for (i = 0; i < type_c->block_count; i++) {
if (type_c->old_type->has_subtype == 0)
- memcpy(contiguous_hindexed_char,
- noncontiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
+ memcpy(contiguous_hindexed_char, noncontiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);
else
((s_smpi_subtype_t*)type_c->old_type->substruct)->serialize( noncontiguous_hindexed_char,
contiguous_hindexed_char,
type_c->old_type->substruct);
contiguous_hindexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
- if (i<type_c->block_count-1)noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
- else noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+ if (i<type_c->block_count-1)
+ noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
+ else
+ noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
}
noncontiguous_hindexed=(void*)noncontiguous_hindexed_char;
}
}
-/*
- * Copies contiguous data into noncontiguous memory.
+/* Copies contiguous data into noncontiguous memory.
* @param noncontiguous_hindexed - output hindexed
* @param contiguous_hindexed - input hindexed
* @param type - pointer contening :
* - block_indices - indices of each data, in bytes
* - count - the number of rows of matrix
*/
-void unserialize_hindexed( const void *contiguous_hindexed,
- void *noncontiguous_hindexed,
- int count,
- void *type,
+void unserialize_hindexed( const void *contiguous_hindexed, void *noncontiguous_hindexed, int count, void *type,
MPI_Op op)
{
s_smpi_mpi_hindexed_t* type_c = (s_smpi_mpi_hindexed_t*)type;
if (type_c->old_type->has_subtype == 0)
smpi_op_apply(op, contiguous_hindexed_char, noncontiguous_hindexed_char, &type_c->block_lengths[i],
&type_c->old_type);
- /*memcpy(noncontiguous_hindexed_char,
- contiguous_hindexed_char, type_c->block_lengths[i] * type_c->size_oldtype);*/
+ /*memcpy(noncontiguous_hindexed_char,contiguous_hindexed_char,type_c->block_lengths[i]*type_c->size_oldtype);*/
else
((s_smpi_subtype_t*)type_c->old_type->substruct)->unserialize( contiguous_hindexed_char,
noncontiguous_hindexed_char,
type_c->block_lengths[i],
- type_c->old_type->substruct,
- op);
+ type_c->old_type->substruct, op);
contiguous_hindexed_char += type_c->block_lengths[i]*type_c->size_oldtype;
- if (i<type_c->block_count-1)noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
- else noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
+ if (i<type_c->block_count-1)
+ noncontiguous_hindexed_char = (char*)noncontiguous_hindexed + type_c->block_indices[i+1];
+ else
+ noncontiguous_hindexed_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_type);
}
noncontiguous_hindexed=(void*)noncontiguous_hindexed_char;
}
smpi_datatype_unuse(((s_smpi_mpi_indexed_t *)(*type)->substruct)->old_type);
}
-/*
- * Create a Sub type hindexed to be able to serialize and unserialize it
- * the structure s_smpi_mpi_hindexed_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
+/* Create a Sub type hindexed to be able to serialize and unserialize it the structure s_smpi_mpi_hindexed_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize
*/
-s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths,
- MPI_Aint* block_indices,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype){
+s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create( int* block_lengths, MPI_Aint* block_indices, int block_count,
+ MPI_Datatype old_type, int size_oldtype){
s_smpi_mpi_hindexed_t *new_t= xbt_new(s_smpi_mpi_hindexed_t,1);
new_t->base.serialize = &serialize_hindexed;
new_t->base.unserialize = &unserialize_hindexed;
return new_t;
}
-
int smpi_datatype_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type)
{
int i;
contiguous=0;
if(!contiguous){
- s_smpi_mpi_hindexed_t* subtype = smpi_datatype_hindexed_create( blocklens,
- indices,
- count,
- old_type,
+ s_smpi_mpi_hindexed_t* subtype = smpi_datatype_hindexed_create( blocklens, indices, count, old_type,
smpi_datatype_size(old_type));
- smpi_datatype_create(new_type, size * smpi_datatype_size(old_type),
- lb,
- ub
- ,1, subtype, DT_FLAG_DATA);
+ smpi_datatype_create(new_type, size * smpi_datatype_size(old_type), lb, ub ,1, subtype, DT_FLAG_DATA);
}else{
- s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
- size,
- old_type,
- smpi_datatype_size(old_type));
- smpi_datatype_create(new_type, size * smpi_datatype_size(old_type),
- 0,size * smpi_datatype_size(old_type),
+ s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create(lb,size, old_type, smpi_datatype_size(old_type));
+ smpi_datatype_create(new_type, size * smpi_datatype_size(old_type), 0,size * smpi_datatype_size(old_type),
1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
}
retval=MPI_SUCCESS;
return retval;
}
+/* struct Implementation - Indexed with indices in bytes */
-/*
-struct Implementation - Indexed with indices in bytes
-*/
-
-/*
- * Copies noncontiguous data into contiguous memory.
+/* Copies noncontiguous data into contiguous memory.
* @param contiguous_struct - output struct
* @param noncontiguous_struct - input struct
* @param type - pointer contening :
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void serialize_struct( const void *noncontiguous_struct,
- void *contiguous_struct,
- int count,
- void *type)
+void serialize_struct( const void *noncontiguous_struct, void *contiguous_struct, int count, void *type)
{
s_smpi_mpi_struct_t* type_c = (s_smpi_mpi_struct_t*)type;
int i,j;
for(j=0; j<count;j++){
for (i = 0; i < type_c->block_count; i++) {
if (type_c->old_types[i]->has_subtype == 0)
- memcpy(contiguous_struct_char,
- noncontiguous_struct_char, type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));
+ memcpy(contiguous_struct_char, noncontiguous_struct_char,
+ type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));
else
((s_smpi_subtype_t*)type_c->old_types[i]->substruct)->serialize( noncontiguous_struct_char,
contiguous_struct_char,
contiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_size(type_c->old_types[i]);
- if (i<type_c->block_count-1)noncontiguous_struct_char = (char*)noncontiguous_struct + type_c->block_indices[i+1];
- else noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);//let's hope this is MPI_UB ?
+ if (i<type_c->block_count-1)
+ noncontiguous_struct_char = (char*)noncontiguous_struct + type_c->block_indices[i+1];
+ else //let's hope this is MPI_UB ?
+ noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
}
noncontiguous_struct=(void*)noncontiguous_struct_char;
}
}
-/*
- * Copies contiguous data into noncontiguous memory.
+
+/* Copies contiguous data into noncontiguous memory.
* @param noncontiguous_struct - output struct
* @param contiguous_struct - input struct
* @param type - pointer contening :
* - block_length - the width or height of blocked matrix
* - count - the number of rows of matrix
*/
-void unserialize_struct( const void *contiguous_struct,
- void *noncontiguous_struct,
- int count,
- void *type,
- MPI_Op op)
+void unserialize_struct( const void *contiguous_struct, void *noncontiguous_struct, int count, void *type, MPI_Op op)
{
s_smpi_mpi_struct_t* type_c = (s_smpi_mpi_struct_t*)type;
int i,j;
if (type_c->old_types[i]->has_subtype == 0)
smpi_op_apply(op, contiguous_struct_char, noncontiguous_struct_char, &type_c->block_lengths[i],
& type_c->old_types[i]);
- /*memcpy(noncontiguous_struct_char,
- contiguous_struct_char, type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));*/
+ /*memcpy(noncontiguous_struct_char,
+ contiguous_struct_char, type_c->block_lengths[i] * smpi_datatype_size(type_c->old_types[i]));*/
else
((s_smpi_subtype_t*)type_c->old_types[i]->substruct)->unserialize( contiguous_struct_char,
noncontiguous_struct_char,
type_c->block_lengths[i],
- type_c->old_types[i]->substruct,
- op);
+ type_c->old_types[i]->substruct, op);
contiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_size(type_c->old_types[i]);
- if (i<type_c->block_count-1)noncontiguous_struct_char = (char*)noncontiguous_struct + type_c->block_indices[i+1];
- else noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
+ if (i<type_c->block_count-1)
+ noncontiguous_struct_char = (char*)noncontiguous_struct + type_c->block_indices[i+1];
+ else
+ noncontiguous_struct_char += type_c->block_lengths[i]*smpi_datatype_get_extent(type_c->old_types[i]);
}
noncontiguous_struct=(void*)noncontiguous_struct_char;
-
}
}
xbt_free(((s_smpi_mpi_struct_t *)(*type)->substruct)->old_types);
}
-/*
- * Create a Sub type struct to be able to serialize and unserialize it
- * the structure s_smpi_mpi_struct_t is derived from s_smpi_subtype which
- * required the functions unserialize and serialize
+/* Create a Sub type struct to be able to serialize and unserialize it the structure s_smpi_mpi_struct_t is derived
+ * from s_smpi_subtype which required the functions unserialize and serialize
*/
-s_smpi_mpi_struct_t* smpi_datatype_struct_create( int* block_lengths,
- MPI_Aint* block_indices,
- int block_count,
+s_smpi_mpi_struct_t* smpi_datatype_struct_create( int* block_lengths, MPI_Aint* block_indices, int block_count,
MPI_Datatype* old_types){
s_smpi_mpi_struct_t *new_t= xbt_new(s_smpi_mpi_struct_t,1);
new_t->base.serialize = &serialize_struct;
return new_t;
}
-
int smpi_datatype_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type)
{
int i;
}
if(!forced_lb && indices[i]+smpi_datatype_lb(old_types[i])<lb) lb = indices[i];
- if(!forced_ub && indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i])>ub) ub = indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i]);
+ if(!forced_ub && indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i])>ub)
+ ub = indices[i]+blocklens[i]*smpi_datatype_ub(old_types[i]);
if ( (i< count -1) && (indices[i]+blocklens[i]*static_cast<int>(smpi_datatype_size(old_types[i])) != indices[i+1]) )
contiguous=0;
}
if(!contiguous){
- s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocklens,
- indices,
- count,
- old_types);
+ s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocklens, indices, count, old_types);
smpi_datatype_create(new_type, size, lb, ub,1, subtype, DT_FLAG_DATA);
}else{
- s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb,
- size,
- MPI_CHAR,
- 1);
+ s_smpi_mpi_contiguous_t* subtype = smpi_datatype_contiguous_create( lb, size, MPI_CHAR, 1);
smpi_datatype_create(new_type, size, lb, ub,1, subtype, DT_FLAG_DATA|DT_FLAG_CONTIGUOUS);
}
return MPI_SUCCESS;
} \
}
-static void max_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void max_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, MAX_OP);
}
}
-static void min_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void min_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, MIN_OP);
}
}
-static void sum_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void sum_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, SUM_OP);
}
}
-static void prod_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void prod_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, PROD_OP);
}
}
-static void land_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void land_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, LAND_OP);
}
}
-static void lor_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void lor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, LOR_OP);
}
}
-static void lxor_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void lxor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, LXOR_OP);
}
}
-static void band_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void band_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, BAND_OP);
}
}
-static void bor_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void bor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, BOR_OP);
}
}
-static void bxor_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void bxor_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_CHAR) {
APPLY_FUNC(a, b, length, char, BXOR_OP);
}
}
-static void minloc_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void minloc_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_FLOAT_INT) {
APPLY_FUNC(a, b, length, float_int, MINLOC_OP);
}
}
-static void maxloc_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void maxloc_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
if (*datatype == MPI_FLOAT_INT) {
APPLY_FUNC(a, b, length, float_int, MAXLOC_OP);
}
}
-static void replace_func(void *a, void *b, int *length,
- MPI_Datatype * datatype)
+static void replace_func(void *a, void *b, int *length, MPI_Datatype * datatype)
{
memcpy(b, a, *length * smpi_datatype_size(*datatype));
}
CREATE_MPI_OP(MPI_MINLOC, minloc_func);
CREATE_MPI_OP(MPI_REPLACE, replace_func);
-
MPI_Op smpi_op_new(MPI_User_function * function, int commute)
{
MPI_Op op;
xbt_free(op);
}
-void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len,
- MPI_Datatype * datatype)
+void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len, MPI_Datatype * datatype)
{
if(op==MPI_OP_NULL)
return;
- if(smpi_privatize_global_variables){ //we need to switch here, as the called function may silently touch global variables
+ if(smpi_privatize_global_variables){//we need to switch as the called function may silently touch global variables
XBT_DEBUG("Applying operation, switch to the right data frame ");
smpi_switch_data_segment(smpi_process_index());
}
}
int smpi_type_attr_delete(MPI_Datatype type, int keyval){
- smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
if(!elem)
return MPI_ERR_ARG;
if(elem->delete_fn!=MPI_NULL_DELETE_FN){
}
int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag){
- smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
if(!elem)
return MPI_ERR_ARG;
xbt_ex_t ex;
int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){
if(!smpi_type_keyvals)
smpi_type_keyvals = xbt_dict_new();
- smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)));
if(!elem )
return MPI_ERR_ARG;
int flag;
return MPI_SUCCESS;
}
-int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state){
-
+int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state){
if(!smpi_type_keyvals)
smpi_type_keyvals = xbt_dict_new();
-
+
smpi_type_key_elem value = (smpi_type_key_elem) xbt_new0(s_smpi_mpi_type_key_elem_t,1);
-
+
value->copy_fn=copy_fn;
value->delete_fn=delete_fn;
-
+
*keyval = type_keyval_id;
xbt_dict_set_ext(smpi_type_keyvals,(const char*)keyval, sizeof(int),(void*)value, NULL);
type_keyval_id++;
}
int smpi_type_keyval_free(int* keyval){
- smpi_type_key_elem elem = static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)keyval, sizeof(int)));
+ smpi_type_key_elem elem =
+ static_cast<smpi_type_key_elem>(xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)keyval, sizeof(int)));
if(!elem){
return MPI_ERR_ARG;
}
return MPI_SUCCESS;
}
-int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm){
+int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position,MPI_Comm comm){
size_t size = smpi_datatype_size(type);
if (outcount - *position < incount*static_cast<int>(size))
return MPI_ERR_BUFFER;
- smpi_datatype_copy(inbuf, incount, type,
- (char*)outbuf + *position, outcount, MPI_CHAR);
+ smpi_datatype_copy(inbuf, incount, type, (char*)outbuf + *position, outcount, MPI_CHAR);
*position += incount * size;
return MPI_SUCCESS;
}
-int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm){
+int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type,MPI_Comm comm){
int size = static_cast<int>(smpi_datatype_size(type));
if (outcount*size> insize)
return MPI_ERR_BUFFER;
- smpi_datatype_copy((char*)inbuf + *position, insize, MPI_CHAR,
- outbuf, outcount, type);
+ smpi_datatype_copy((char*)inbuf + *position, insize, MPI_CHAR, outbuf, outcount, type);
*position += outcount * size;
return MPI_SUCCESS;
}
* We should make the difference here between the predefined contiguous and non contiguous
* datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
*/
-#define DT_FLAG_BASIC (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
+#define DT_FLAG_BASIC (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
extern const MPI_Datatype MPI_PTR;
-
-//*****************************************************************************************
-
-/*
- These are the structures that handle complex data type information,
- used for serialization/unserialization of messages
-*/
-
+/* Structures that handle complex data type information, used for serialization/unserialization of messages */
typedef struct s_smpi_mpi_contiguous{
s_smpi_subtype_t base;
MPI_Datatype old_type;
Functions to handle serialization/unserialization of messages, 3 for each type of MPI_Type
One for creating the substructure to handle, one for serialization, one for unserialization
*/
-XBT_PRIVATE void unserialize_contiguous( const void *contiguous_vector,
- void *noncontiguous_vector,
- int count,
- void *type,
- MPI_Op op);
-
-XBT_PRIVATE void serialize_contiguous( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type);
-
+XBT_PRIVATE void unserialize_contiguous( const void *contiguous_vector, void *noncontiguous_vector, int count,
+ void *type, MPI_Op op);
+XBT_PRIVATE void serialize_contiguous( const void *noncontiguous_vector, void *contiguous_vector, int count,void *type);
XBT_PRIVATE void free_contiguous(MPI_Datatype* type);
-
-XBT_PRIVATE s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype);
+XBT_PRIVATE s_smpi_mpi_contiguous_t* smpi_datatype_contiguous_create( MPI_Aint lb, int block_count,
+ MPI_Datatype old_type, int size_oldtype);
-XBT_PRIVATE void unserialize_vector( const void *contiguous_vector,
- void *noncontiguous_vector,
- int count,
- void *type,
+XBT_PRIVATE void unserialize_vector( const void *contiguous_vector, void *noncontiguous_vector, int count,void *type,
MPI_Op op);
-
-XBT_PRIVATE void serialize_vector( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type);
-
+XBT_PRIVATE void serialize_vector( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
XBT_PRIVATE void free_vector(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride, int block_length, int block_count,
+ MPI_Datatype old_type, int size_oldtype);
-XBT_PRIVATE s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride,
- int block_length,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype);
-
-XBT_PRIVATE void unserialize_hvector( const void *contiguous_vector,
- void *noncontiguous_vector,
- int count,
- void *type,
+XBT_PRIVATE void unserialize_hvector( const void *contiguous_vector, void *noncontiguous_vector, int count, void *type,
MPI_Op op);
-
-XBT_PRIVATE void serialize_hvector( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type);
-
+XBT_PRIVATE void serialize_hvector( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
XBT_PRIVATE void free_hvector(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride, int block_length,
+ int block_count, MPI_Datatype old_type, int size_oldtype);
-XBT_PRIVATE s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride,
- int block_length,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype);
-
-
-XBT_PRIVATE void unserialize_indexed( const void *contiguous_indexed,
- void *noncontiguous_indexed,
- int count,
- void *type,
- MPI_Op op);
-
-XBT_PRIVATE void serialize_indexed( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type);
-
+XBT_PRIVATE void unserialize_indexed( const void *contiguous_indexed, void *noncontiguous_indexed, int count,
+ void *type, MPI_Op op);
+XBT_PRIVATE void serialize_indexed( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
XBT_PRIVATE void free_indexed(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_indexed_t* smpi_datatype_indexed_create(int* block_lengths, int* block_indices,
+ int block_count, MPI_Datatype old_type, int size_oldtype);
-XBT_PRIVATE s_smpi_mpi_indexed_t* smpi_datatype_indexed_create(int* block_lengths,
- int* block_indices,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype);
-
-XBT_PRIVATE void unserialize_hindexed( const void *contiguous_indexed,
- void *noncontiguous_indexed,
- int count,
- void *type,
- MPI_Op op);
-
-XBT_PRIVATE void serialize_hindexed( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type);
-
+XBT_PRIVATE void unserialize_hindexed( const void *contiguous_indexed, void *noncontiguous_indexed, int count,
+ void *type, MPI_Op op);
+XBT_PRIVATE void serialize_hindexed( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
XBT_PRIVATE void free_hindexed(MPI_Datatype* type);
+XBT_PRIVATE s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create(int* block_lengths, MPI_Aint* block_indices,
+ int block_count, MPI_Datatype old_type, int size_oldtype);
-XBT_PRIVATE s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create(int* block_lengths,
- MPI_Aint* block_indices,
- int block_count,
- MPI_Datatype old_type,
- int size_oldtype);
-
-XBT_PRIVATE void unserialize_struct( const void *contiguous_indexed,
- void *noncontiguous_indexed,
- int count,
- void *type,
+XBT_PRIVATE void unserialize_struct( const void *contiguous_indexed, void *noncontiguous_indexed, int count, void *type,
MPI_Op op);
-
-XBT_PRIVATE void serialize_struct( const void *noncontiguous_vector,
- void *contiguous_vector,
- int count,
- void *type);
-
+XBT_PRIVATE void serialize_struct( const void *noncontiguous_vector, void *contiguous_vector, int count, void *type);
XBT_PRIVATE void free_struct(MPI_Datatype* type);
-
-XBT_PRIVATE s_smpi_mpi_struct_t* smpi_datatype_struct_create(int* block_lengths,
- MPI_Aint* block_indices,
- int block_count,
- MPI_Datatype* old_types);
+XBT_PRIVATE s_smpi_mpi_struct_t* smpi_datatype_struct_create(int* block_lengths, MPI_Aint* block_indices,
+ int block_count, MPI_Datatype* old_types);
SG_END_DECL()
-
#endif
#include "private.h"
#include "smpi_mpi_dt_private.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi,
- "Logging specific to SMPI (pmpi)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
//this function need to be here because of the calls to smpi_bench
void TRACE_smpi_set_category(const char *category)
int PMPI_Get_library_version (char *version,int *len){
int retval = MPI_SUCCESS;
smpi_bench_end();
- snprintf(version,MPI_MAX_LIBRARY_VERSION_STRING,"SMPI Version %d.%d. Copyright The Simgrid Team 2007-2015",SIMGRID_VERSION_MAJOR,
- SIMGRID_VERSION_MINOR);
+ snprintf(version,MPI_MAX_LIBRARY_VERSION_STRING,"SMPI Version %d.%d. Copyright The Simgrid Team 2007-2015",
+ SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR);
*len = strlen(version) > MPI_MAX_LIBRARY_VERSION_STRING ? MPI_MAX_LIBRARY_VERSION_STRING : strlen(version);
smpi_bench_begin();
return retval;
int PMPI_Type_free(MPI_Datatype * datatype)
{
int retval = 0;
- /* Free a predefined datatype is an error according to the standard, and
- should be checked for */
+ /* Free a predefined datatype is an error according to the standard, and should be checked for */
if (*datatype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_ARG;
} else {
return retval;
}
-int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
- MPI_Group group2, int *ranks2)
+int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1, MPI_Group group2, int *ranks2)
{
int retval, i, index;
if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
return retval;
}
-int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
- MPI_Group * newgroup)
+int PMPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
{
int retval, i, proc1, proc2, size, size2;
return retval;
}
-int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2,
- MPI_Group * newgroup)
+int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2, MPI_Group * newgroup)
{
int retval, i, proc1, proc2, size;
} else {
if (n == 0) {
*newgroup = group;
- if(group!= smpi_comm_group(MPI_COMM_WORLD)
- && group != MPI_GROUP_NULL
- && group != smpi_comm_group(MPI_COMM_SELF)
- && group != MPI_GROUP_EMPTY)
+ if(group!= smpi_comm_group(MPI_COMM_WORLD) && group != MPI_GROUP_NULL
+ && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY)
smpi_group_use(group);
} else if (n == smpi_group_size(group)) {
*newgroup = MPI_GROUP_EMPTY;
return retval;
}
-int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
- MPI_Group * newgroup)
+int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
{
int retval, i, j, rank, size, index;
return retval;
}
-int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
- MPI_Group * newgroup)
+int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3], MPI_Group * newgroup)
{
int retval, i, rank, newrank,oldrank, size, index, add;
} else {
if (n == 0) {
*newgroup = group;
- if(group!= smpi_comm_group(MPI_COMM_WORLD)
- && group != MPI_GROUP_NULL
- && group != smpi_comm_group(MPI_COMM_SELF)
- && group != MPI_GROUP_EMPTY)
+ if(group!= smpi_comm_group(MPI_COMM_WORLD) && group != MPI_GROUP_NULL
+ && group != smpi_comm_group(MPI_COMM_SELF) && group != MPI_GROUP_EMPTY)
smpi_group_use(group);
} else {
size = smpi_group_size(group);
retval = MPI_ERR_ARG;
} else {
*group = smpi_comm_group(comm);
- if(*group!= smpi_comm_group(MPI_COMM_WORLD)
- && *group != MPI_GROUP_NULL
- && *group != smpi_comm_group(MPI_COMM_SELF)
- && *group != MPI_GROUP_EMPTY)
+ if(*group!= smpi_comm_group(MPI_COMM_WORLD) && *group != MPI_GROUP_NULL
+ && *group != smpi_comm_group(MPI_COMM_SELF) && *group != MPI_GROUP_EMPTY)
smpi_group_use(*group);
retval = MPI_SUCCESS;
}
if (comm1 == comm2) { /* Same communicators means same groups */
*result = MPI_IDENT;
} else {
- *result =
- smpi_group_compare(smpi_comm_group(comm1),
- smpi_comm_group(comm2));
+ *result = smpi_group_compare(smpi_comm_group(comm1), smpi_comm_group(comm2));
if (*result == MPI_IDENT) {
*result = MPI_CONGRUENT;
}
return retval;
}
-int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
{
int retval = 0;
return retval;
}
-int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src,
- int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
{
int retval = 0;
return retval;
}
-int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm, MPI_Request* request)
+int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
{
int retval = 0;
return retval;
}
-int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src,
- int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
{
int retval = 0;
}
-int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst,
- int tag, MPI_Comm comm, MPI_Request * request)
+int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
{
int retval = 0;
return retval;
}
-int PMPI_Issend(void* buf, int count, MPI_Datatype datatype,
- int dst, int tag, MPI_Comm comm, MPI_Request* request)
+int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
{
int retval = 0;
return retval;
}
-int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag,
- MPI_Comm comm, MPI_Status * status)
+int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
{
int retval = 0;
return retval;
}
-int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag,
- MPI_Comm comm)
+int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
{
int retval = 0;
if(!known)
dt_size_send = smpi_datatype_size(datatype);
extra->send_size = count*dt_size_send;
- TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype));
+ TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
+ TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype));
smpi_mpi_ssend(buf, count, datatype, dst, tag, comm);
retval = MPI_SUCCESS;
smpi_bench_begin();
return retval;}
-
-int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- int dst, int sendtag, void *recvbuf, int recvcount,
- MPI_Datatype recvtype, int src, int recvtag,
- MPI_Comm comm, MPI_Status * status)
+int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void *recvbuf,
+ int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status * status)
{
int retval = 0;
return retval;
}
-int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
- int dst, int sendtag, int src, int recvtag,
+int PMPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype, int dst, int sendtag, int src, int recvtag,
MPI_Comm comm, MPI_Status * status)
{
//TODO: suboptimal implementation
} else {
int size = smpi_datatype_get_extent(datatype) * count;
recvbuf = xbt_new0(char, size);
- retval =
- MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count,
- datatype, src, recvtag, comm, status);
+ retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count, datatype, src, recvtag, comm, status);
if(retval==MPI_SUCCESS){
smpi_datatype_copy(recvbuf, count, datatype, buf, count, datatype);
}
smpi_empty_status(status);
retval = MPI_SUCCESS;
} else {
- int rank = request && (*request)->comm != MPI_COMM_NULL
- ? smpi_process_index()
- : -1;
+ int rank = request && (*request)->comm != MPI_COMM_NULL ? smpi_process_index() : -1;
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_TEST;
return retval;
}
-int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag,
- MPI_Status * status)
+int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status)
{
int retval = 0;
return retval;
}
-
int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
int retval = 0;
smpi_bench_end();
retval = MPI_SUCCESS;
} else {
- int rank = request && (*request)->comm != MPI_COMM_NULL
- ? smpi_process_index()
- : -1;
+ int rank = request && (*request)->comm != MPI_COMM_NULL ? smpi_process_index() : -1;
int src_traced = (*request)->src;
int dst_traced = (*request)->dst;
if (is_wait_for_receive) {
if(srcs[*index]==MPI_ANY_SOURCE)
src_traced = (status!=MPI_STATUSES_IGNORE) ?
- smpi_group_rank(smpi_comm_group(comms[*index]), status->MPI_SOURCE) :
- srcs[*index];
+ smpi_group_rank(smpi_comm_group(comms[*index]), status->MPI_SOURCE) : srcs[*index];
TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
}
TRACE_smpi_ptp_out(rank_traced, src_traced, dst_traced, __FUNCTION__);
int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
{
-
smpi_bench_end();
//save information from requests
int i;
if (is_wait_for_receive) {
if(src_traced==MPI_ANY_SOURCE)
src_traced = (status!=MPI_STATUSES_IGNORE) ?
- smpi_group_rank(smpi_comm_group(comms[i]), status[i].MPI_SOURCE) :
- srcs[i];
+ smpi_group_rank(smpi_comm_group(comms[i]), status[i].MPI_SOURCE) : srcs[i];
TRACE_smpi_recv(rank_traced, src_traced, dst_traced);
}
}
return retval;
}
-int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount,
- int *indices, MPI_Status status[])
+int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int *indices, MPI_Status status[])
{
int retval = 0;
return retval;
}
-int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount,
- int* indices, MPI_Status status[])
+int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount, int* indices, MPI_Status status[])
{
int retval = 0;
return retval;
}
-int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm)
+int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbuf, int recvcount, MPI_Datatype recvtype,
+ int root, MPI_Comm comm)
{
int retval = 0;
} else if ((( sendbuf != MPI_IN_PLACE) && (sendtype == MPI_DATATYPE_NULL)) ||
((smpi_comm_rank(comm) == root) && (recvtype == MPI_DATATYPE_NULL))){
retval = MPI_ERR_TYPE;
- } else if ((( sendbuf != MPI_IN_PLACE) && (sendcount <0)) ||
- ((smpi_comm_rank(comm) == root) && (recvcount <0))){
+ } else if ((( sendbuf != MPI_IN_PLACE) && (sendcount <0)) || ((smpi_comm_rank(comm) == root) && (recvcount <0))){
retval = MPI_ERR_COUNT;
} else {
TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra);
- mpi_coll_gather_fun(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount,
- recvtype, root, comm);
+ mpi_coll_gather_fun(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, root, comm);
-
- retval = MPI_SUCCESS;
+ retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
}
return retval;
}
-int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts, int *displs,
+int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs,
MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int retval = 0;
}
TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
- smpi_mpi_gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts,
- displs, recvtype, root, comm);
+ smpi_mpi_gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, displs, recvtype, root, comm);
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
}
}
int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm)
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
{
int retval = 0;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
- mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
- recvtype, comm);
+ mpi_coll_allgather_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
}
int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int *recvcounts, int *displs,
- MPI_Datatype recvtype, MPI_Comm comm)
+ void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, MPI_Comm comm)
{
int retval = 0;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
- mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts,
- displs, recvtype, comm);
+ mpi_coll_allgatherv_fun(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
}
int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- int root, MPI_Comm comm)
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int retval = 0;
extra->recv_size = recvcount*dt_size_recv;
TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
- mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount,
- recvtype, root, comm);
+ mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
}
}
int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
- MPI_Datatype sendtype, void *recvbuf, int recvcount,
- MPI_Datatype recvtype, int root, MPI_Comm comm)
+ MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
{
int retval = 0;
extra->recv_size = recvcount*dt_size_recv;
TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra);
- smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf,
- recvcount, recvtype, root, comm);
+ smpi_mpi_scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
return retval;
}
-int PMPI_Reduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
+int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
{
int retval = 0;
return retval;
}
-int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count,
- MPI_Datatype datatype, MPI_Op op){
+int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op){
int retval = 0;
smpi_bench_end();
return retval;
}
-int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int retval = 0;
return retval;
}
-int PMPI_Scan(void *sendbuf, void *recvbuf, int count,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int retval = 0;
return retval;
}
-int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
- MPI_Op op, MPI_Comm comm){
+int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm){
int retval = 0;
smpi_bench_end();
return retval;
}
-int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int retval = 0;
smpi_bench_end();
if(sendbuf==MPI_IN_PLACE)
sendtmpbuf=recvbuf;
- mpi_coll_reduce_scatter_fun(sendtmpbuf, recvbuf, recvcounts,
- datatype, op, comm);
+ mpi_coll_reduce_scatter_fun(sendtmpbuf, recvbuf, recvcounts, datatype, op, comm);
retval = MPI_SUCCESS;
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
}
int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
- MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+ MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
int retval,i;
smpi_bench_end();
int* recvcounts=(int*)xbt_malloc(count);
for (i=0; i<count;i++)recvcounts[i]=recvcount;
- mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts,
- datatype, op, comm);
+ mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, datatype, op, comm);
xbt_free(recvcounts);
retval = MPI_SUCCESS;
}
int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
- void *recvbuf, int recvcount, MPI_Datatype recvtype,
- MPI_Comm comm)
+ void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
{
int retval = 0;
return retval;
}
-int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
- MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
+int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
{
int retval = 0;
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
- } else if (sendtype == MPI_DATATYPE_NULL
- || recvtype == MPI_DATATYPE_NULL) {
+ } else if (sendtype == MPI_DATATYPE_NULL || recvtype == MPI_DATATYPE_NULL) {
retval = MPI_ERR_TYPE;
- } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL
- || recvdisps == NULL) {
+ } else if (sendcounts == NULL || senddisps == NULL || recvcounts == NULL || recvdisps == NULL) {
retval = MPI_ERR_ARG;
} else {
int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1;
extra->num_processes = size;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
- retval =
- mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, sendtype,
- recvbuf, recvcounts, recvdisps, recvtype,
+ retval = mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, sendtype, recvbuf, recvcounts, recvdisps, recvtype,
comm);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
}
strncpy(name, sg_host_get_name(SIMIX_host_self()),
strlen(sg_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
- strlen(sg_host_get_name(SIMIX_host_self())) +1 :
- MPI_MAX_PROCESSOR_NAME - 1 );
- *resultlen =
- strlen(name) >
- MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
+ strlen(sg_host_get_name(SIMIX_host_self())) +1 : MPI_MAX_PROCESSOR_NAME - 1 );
+ *resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
return retval;
}
return retval;
}
-
int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
return retval;
}
-int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type) {
int retval,i;
if (old_type == MPI_DATATYPE_NULL) {
return retval;
}
-
int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
int retval = 0;
return retval;
}
-int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type) {
return PMPI_Type_hindexed(count, blocklens,indices,old_type,new_type);
}
-int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
+int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type,
+ MPI_Datatype* new_type) {
int retval,i;
if (old_type == MPI_DATATYPE_NULL) {
return retval;
}
-
int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
int retval = 0;
return retval;
}
-int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
+int PMPI_Type_create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+ MPI_Datatype* new_type) {
return PMPI_Type_struct(count, blocklens, indices, old_types, new_type);
}
-
int PMPI_Error_class(int errorcode, int* errorclass) {
// assume smpi uses only standard mpi error codes
*errorclass=errorcode;
return MPI_SUCCESS;
}
-
int PMPI_Initialized(int* flag) {
*flag=smpi_process_initialized();
return MPI_SUCCESS;
}
-/* The topo part of MPI_COMM_WORLD should always be NULL. When other topologies
- * will be implemented, not only should we check if the topology is NULL, but
- * we should check if it is the good topology type (so we have to add a
+/* The topo part of MPI_COMM_WORLD should always be NULL. When other topologies will be implemented, not only should we
+ * check if the topology is NULL, but we should check if it is the good topology type (so we have to add a
* MPIR_Topo_Type field, and replace the MPI_Topology field by an union)*/
int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periodic, int reorder, MPI_Comm* comm_cart) {
int retval = 0;
if (comm_old == MPI_COMM_NULL){
retval = MPI_ERR_COMM;
- } else if (ndims < 0 ||
- (ndims > 0 && (dims == NULL ||
- periodic == NULL)) ||
- comm_cart == NULL) {
+ } else if (ndims < 0 || (ndims > 0 && (dims == NULL || periodic == NULL)) || comm_cart == NULL) {
retval = MPI_ERR_ARG;
} else{
retval = smpi_mpi_cart_create(comm_old, ndims, dims, periodic, reorder, comm_cart);
MPI_Aint disps[3] = { lb, 0, lb+extent };
MPI_Datatype types[3] = { MPI_LB, oldtype, MPI_UB };
- s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocks,
- disps,
- 3,
- types
- );
+ s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocks, disps, 3, types);
smpi_datatype_create(newtype,oldtype->size, lb, lb + extent, 1 , subtype, DT_FLAG_VECTOR);
(*newtype)->flags &= ~DT_FLAG_COMMITED;
return MPI_SUCCESS;
}
-
-
int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
int retval = 0;
smpi_bench_end();
if (comm == MPI_COMM_NULL) {
retval= MPI_ERR_COMM;
- }else if ((base == NULL && size != 0)
- || disp_unit <= 0 || size < 0 ){
+ }else if ((base == NULL && size != 0) || disp_unit <= 0 || size < 0 ){
retval= MPI_ERR_OTHER;
}else{
*win = smpi_mpi_win_create( base, size, disp_unit, info, comm);
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL);
retval = smpi_mpi_win_fence(assert, win);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
-
}
smpi_bench_begin();
return retval;
retval = MPI_ERR_COUNT;
} else if (origin_addr==NULL && origin_count > 0){
retval = MPI_ERR_COUNT;
- } else if ((!is_datatype_valid(origin_datatype)) ||
- (!is_datatype_valid(target_datatype))) {
+ } else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process_index();
int src_traced = smpi_group_index(group, target_rank);
TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL);
- retval = smpi_mpi_get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win);
+ retval = smpi_mpi_get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
+ target_datatype, win);
TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
}
retval = MPI_ERR_COUNT;
} else if (origin_addr==NULL && origin_count > 0){
retval = MPI_ERR_COUNT;
- } else if ((!is_datatype_valid(origin_datatype)) ||
- (!is_datatype_valid(target_datatype))) {
+ } else if ((!is_datatype_valid(origin_datatype)) || (!is_datatype_valid(target_datatype))) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process_index();
TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, NULL);
TRACE_smpi_send(rank, rank, dst_traced, origin_count*smpi_datatype_size(origin_datatype));
- retval = smpi_mpi_put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win);
+ retval = smpi_mpi_put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
+ target_datatype, win);
TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__);
}
return retval;
}
-
int PMPI_Accumulate( 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_Op op, MPI_Win win){
int retval = 0;
int src_traced = smpi_group_index(group, target_rank);
TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL);
- retval = smpi_mpi_accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, op, win);
+ retval = smpi_mpi_accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count,
+ target_datatype, op, win);
TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
}
return retval;
}
-
int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){
int retval = 0;
smpi_bench_end();
return retval;
}
-
int PMPI_Win_complete(MPI_Win win){
int retval = 0;
smpi_bench_end();
return retval;
}
-
MPI_Datatype PMPI_Type_f2c(MPI_Fint datatype){
return smpi_type_f2c(datatype);
}
}
int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
- if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO
- ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
+ if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
return MPI_ERR_ARG;
else if (comm==MPI_COMM_NULL)
*flag = 1;
*(int**)attr_value = &zero;
return MPI_SUCCESS;
-
case MPI_UNIVERSE_SIZE:
*flag = 1;
*(int**)attr_value = &smpi_universe_size;
return MPI_SUCCESS;
-
case MPI_LASTUSEDCODE:
*flag = 1;
*(int**)attr_value = &last_used_code;
return MPI_SUCCESS;
-
case MPI_TAG_UB:
*flag=1;
*(int**)attr_value = &tag_ub;
return MPI_SUCCESS;
-
case MPI_WTIME_IS_GLOBAL:
*flag = 1;
*(int**)attr_value = &one;
return MPI_SUCCESS;
-
default:
return smpi_comm_attr_get(comm, keyval, attr_value, flag);
}
}
int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
- if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO
- ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
+ if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
return MPI_ERR_ARG;
else if (comm==MPI_COMM_NULL)
return PMPI_Attr_delete(comm, comm_keyval);
}
-int PMPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int PMPI_Comm_create_keyval(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state)
{
return PMPI_Keyval_create(copy_fn, delete_fn, keyval, extra_state);
}
return PMPI_Keyval_free(keyval);
}
-
int PMPI_Type_get_attr (MPI_Datatype type, int type_keyval, void *attribute_val, int* flag)
{
if (type==MPI_DATATYPE_NULL)
return smpi_type_attr_delete(type, type_keyval);
}
-int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state)
+int PMPI_Type_create_keyval(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+ void* extra_state)
{
return smpi_type_keyval_create(copy_fn, delete_fn, keyval, extra_state);
}
return MPI_ERR_INFO_VALUE;
char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key);
if(tmpvalue){
- memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < static_cast<size_t>(valuelen)) ?
- strlen(tmpvalue) + 1 : valuelen);
+ memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < static_cast<size_t>(valuelen)) ? strlen(tmpvalue) + 1 : valuelen);
*flag=TRUE;
}
return MPI_SUCCESS;
NOT_YET_IMPLEMENTED
}
-
-int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
+int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag,
+ MPI_Comm* comm_out) {
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int PMPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
+ MPI_Request* request) {
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+int PMPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
+ MPI_Request* request) {
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-
-
int PMPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size){
NOT_YET_IMPLEMENTED
}
-int PMPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount, MPI_Aint *position){
+int PMPI_Pack_external(char *datarep, void *inbuf, int incount, MPI_Datatype datatype, void *outbuf, MPI_Aint outcount,
+ MPI_Aint *position){
NOT_YET_IMPLEMENTED
}
-int PMPI_Unpack_external( char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount, MPI_Datatype datatype){
+int PMPI_Unpack_external(char *datarep, void *inbuf, MPI_Aint insize, MPI_Aint *position, void *outbuf, int outcount,
+ MPI_Datatype datatype){
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-
-
-int PMPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers,
- int *num_addresses, int *num_datatypes, int *combiner){
+int PMPI_Type_get_envelope(MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes,
+ int *combiner){
NOT_YET_IMPLEMENTED
}
-int PMPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses,
- int max_datatypes, int* array_of_integers, MPI_Aint* array_of_addresses,
- MPI_Datatype* array_of_datatypes){
+int PMPI_Type_get_contents(MPI_Datatype datatype, int max_integers, int max_addresses, int max_datatypes,
+ int* array_of_integers, MPI_Aint* array_of_addresses, MPI_Datatype* array_of_datatypes){
NOT_YET_IMPLEMENTED
}
-int PMPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes,
- int* array_of_distribs, int* array_of_dargs, int* array_of_psizes,
- int order, MPI_Datatype oldtype, MPI_Datatype *newtype) {
+int PMPI_Type_create_darray(int size, int rank, int ndims, int* array_of_gsizes, int* array_of_distribs,
+ int* array_of_dargs, int* array_of_psizes,int order, MPI_Datatype oldtype,
+ MPI_Datatype *newtype) {
NOT_YET_IMPLEMENTED
}
-int PMPI_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){
+int PMPI_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){
NOT_YET_IMPLEMENTED
}
}
int PMPI_Alltoallw( void *sendbuf, int *sendcnts, int *sdispls, MPI_Datatype *sendtypes,
- void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes,
- MPI_Comm comm){
+ void *recvbuf, int *recvcnts, int *rdispls, MPI_Datatype *recvtypes, MPI_Comm comm){
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-int PMPI_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){
+int PMPI_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){
NOT_YET_IMPLEMENTED
}
NOT_YET_IMPLEMENTED
}
-int PMPI_Comm_spawn( char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int* array_of_errcodes){
+int PMPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info, int root, MPI_Comm comm,
+ MPI_Comm *intercomm, int* array_of_errcodes){
NOT_YET_IMPLEMENTED
}
}
}
-
static xbt_dynar_t get_reqq_self()
{
char * key = bprintf("%d", smpi_process_index());
free(key);
}
-
//allocate a single buffer for all sends, growing it if needed
void* smpi_get_tmp_sendbuffer(int size)
{
}
return sendbuffer;
}
+
//allocate a single buffer for all recv
void* smpi_get_tmp_recvbuffer(int size){
if (!smpi_process_get_replaying())
static MPI_Datatype decode_datatype(const char *const action)
{
// Declared datatypes,
-
- switch(atoi(action))
- {
+ switch(atoi(action)) {
case 0:
MPI_CURRENT_TYPE=MPI_DOUBLE;
break;
break;
default:
MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
-
}
return MPI_CURRENT_TYPE;
}
const char* encode_datatype(MPI_Datatype datatype, int* known)
{
-
//default type for output is set to MPI_BYTE
// MPI_DEFAULT_TYPE is not set for output, use directly MPI_BYTE
if(known)*known=1;
"Please contact the Simgrid team if support is needed", __FUNCTION__, i, mandatory, optional);\
}
-
static void action_init(const char *const *action)
{
XBT_DEBUG("Initialize the counters");
}
set_reqq_self(xbt_dynar_new(sizeof(MPI_Request),&xbt_free_ref));
-
- /*
- reqq=xbt_new0(xbt_dynar_t,active_processes);
-
- for(i=0;i<active_processes;i++){
- reqq[i]=xbt_dynar_new(sizeof(MPI_Request),&xbt_free_ref);
- }
- }
- */
}
static void action_finalize(const char *const *action)
flag = smpi_mpi_test(&request, &status);
XBT_DEBUG("MPI_Test result: %d", flag);
- /* push back request in dynar to be caught by a subsequent wait. if the test
- * did succeed, the request is now NULL.
- */
+ /* push back request in dynar to be caught by a subsequent wait. if the test did succeed, the request is now NULL.*/
xbt_dynar_push_as(get_reqq_self(),MPI_Request, request);
TRACE_smpi_testing_out(rank);
request = xbt_dynar_pop_as(get_reqq_self(),MPI_Request);
if (!request){
- /* Assuming that the trace is well formed, this mean the comm might have
- * been caught by a MPI_test. Then just return.
- */
+ /* Assume that the trace is well formed, meaning the comm might have been caught by a MPI_test. Then just return.*/
return;
}
- int rank = request->comm != MPI_COMM_NULL
- ? smpi_comm_rank(request->comm)
- : -1;
+ int rank = request->comm != MPI_COMM_NULL ? smpi_comm_rank(request->comm) : -1;
MPI_Group group = smpi_comm_group(request->comm);
int src_traced = smpi_group_rank(group, request->src);
xbt_dynar_foreach(get_reqq_self(),i,requests[i]);
//save information from requests
-
xbt_dynar_t srcs = xbt_dynar_new(sizeof(int), NULL);
xbt_dynar_t dsts = xbt_dynar_new(sizeof(int), NULL);
xbt_dynar_t recvs = xbt_dynar_new(sizeof(int), NULL);
log_timed_action (action, clock);
}
-
static void action_bcast(const char *const *action)
{
CHECK_ACTION_PARAMS(action, 1, 2);
double size = parse_double(action[2]);
double clock = smpi_process_simulated_elapsed();
int root=0;
- /*
- * Initialize MPI_CURRENT_TYPE in order to decrease
- * the number of the checks
- * */
+ /* Initialize MPI_CURRENT_TYPE in order to decrease the number of the checks */
MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
if(action[3]) {
MPI_CURRENT_TYPE=decode_datatype(action[5]);
}
}
-
-
int rank = smpi_process_index();
int root_traced = smpi_group_rank(smpi_comm_group(MPI_COMM_WORLD), root);
void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* smpi_datatype_size(MPI_CURRENT_TYPE));
- mpi_coll_reduce_fun(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, root, MPI_COMM_WORLD);
- smpi_execute_flops(comp_size);
+ mpi_coll_reduce_fun(sendbuf, recvbuf, comm_size, MPI_CURRENT_TYPE, MPI_OP_NULL, root, MPI_COMM_WORLD);
+ smpi_execute_flops(comp_size);
TRACE_smpi_collective_out(rank, root_traced, __FUNCTION__);
log_timed_action (action, clock);
log_timed_action (action, clock);
}
-
static void action_gather(const char *const *action) {
- /*
- The structure of the gather action for the rank 0 (total 4 processes)
- is the following:
+ /* The structure of the gather action for the rank 0 (total 4 processes) is the following:
0 gather 68 68 0 0 0
where:
TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra);
- mpi_coll_gather_fun(send, send_size, MPI_CURRENT_TYPE,
- recv, recv_size, MPI_CURRENT_TYPE2,
- root, MPI_COMM_WORLD);
+ mpi_coll_gather_fun(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
TRACE_smpi_collective_out(smpi_process_index(), -1, __FUNCTION__);
log_timed_action (action, clock);
}
-
-
static void action_gatherv(const char *const *action) {
- /*
- The structure of the gatherv action for the rank 0 (total 4 processes)
- is the following:
+ /* The structure of the gatherv action for the rank 0 (total 4 processes) is the following:
0 gather 68 68 10 10 10 0 0 0
where:
TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra);
- smpi_mpi_gatherv(send, send_size, MPI_CURRENT_TYPE,
- recv, recvcounts, disps, MPI_CURRENT_TYPE2,
- root, MPI_COMM_WORLD);
+ smpi_mpi_gatherv(send, send_size, MPI_CURRENT_TYPE, recv, recvcounts, disps, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
TRACE_smpi_collective_out(smpi_process_index(), -1, __FUNCTION__);
log_timed_action (action, clock);
}
static void action_reducescatter(const char *const *action) {
-
- /*
- The structure of the reducescatter action for the rank 0 (total 4 processes)
- is the following:
+ /* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
0 reduceScatter 275427 275427 275427 204020 11346849 0
where:
2) The value 11346849 is the amount of instructions
3) The last value corresponds to the datatype, see decode_datatype().
- We analyze a MPI_Reduce_scatter call to one MPI_Reduce and one MPI_Scatterv.
-
- */
-
+ We analyze a MPI_Reduce_scatter call to one MPI_Reduce and one MPI_Scatterv. */
double clock = smpi_process_simulated_elapsed();
int comm_size = smpi_comm_size(MPI_COMM_WORLD);
CHECK_ACTION_PARAMS(action, comm_size+1, 1);
void *sendbuf = smpi_get_tmp_sendbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
void *recvbuf = smpi_get_tmp_recvbuffer(size* smpi_datatype_size(MPI_CURRENT_TYPE));
- mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL,
- MPI_COMM_WORLD);
+ mpi_coll_reduce_scatter_fun(sendbuf, recvbuf, recvcounts, MPI_CURRENT_TYPE, MPI_OP_NULL, MPI_COMM_WORLD);
smpi_execute_flops(comp_size);
-
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
xbt_free(recvcounts);
xbt_free(disps);
}
static void action_allgather(const char *const *action) {
- /*
- The structure of the allgather action for the rank 0 (total 4 processes)
- is the following:
+ /* The structure of the allgather action for the rank 0 (total 4 processes) is the following:
0 allGather 275427 275427
where:
1) 275427 is the sendcount
2) 275427 is the recvcount
- 3) No more values mean that the datatype for sent and receive buffer
- is the default one, see decode_datatype().
-
- */
-
+ 3) No more values mean that the datatype for sent and receive buffer is the default one, see decode_datatype(). */
double clock = smpi_process_simulated_elapsed();
CHECK_ACTION_PARAMS(action, 2, 2);
MPI_CURRENT_TYPE2 = decode_datatype(action[5]);
} else {
MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
- MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
+ MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
}
void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE));
void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* smpi_datatype_size(MPI_CURRENT_TYPE2));
}
static void action_allgatherv(const char *const *action) {
-
- /*
- The structure of the allgatherv action for the rank 0 (total 4 processes)
- is the following:
+ /* The structure of the allgatherv action for the rank 0 (total 4 processes) is the following:
0 allGatherV 275427 275427 275427 275427 204020
where:
1) 275427 is the sendcount
2) The next four elements declare the recvcounts array
3) No more values mean that the datatype for sent and receive buffer
- is the default one, see decode_datatype().
-
- */
-
+ is the default one, see decode_datatype(). */
double clock = smpi_process_simulated_elapsed();
int comm_size = smpi_comm_size(MPI_COMM_WORLD);
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
- mpi_coll_allgatherv_fun(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcounts, disps, MPI_CURRENT_TYPE2, MPI_COMM_WORLD);
+ mpi_coll_allgatherv_fun(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcounts, disps, MPI_CURRENT_TYPE2,
+ MPI_COMM_WORLD);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
log_timed_action (action, clock);
}
static void action_allToAllv(const char *const *action) {
- /*
- The structure of the allToAllV action for the rank 0 (total 4 processes)
- is the following:
+ /* The structure of the allToAllV action for the rank 0 (total 4 processes) is the following:
0 allToAllV 100 1 7 10 12 100 1 70 10 5
where:
1) 100 is the size of the send buffer *sizeof(int),
2) 1 7 10 12 is the sendcounts array
3) 100*sizeof(int) is the size of the receiver buffer
- 4) 1 70 10 5 is the recvcounts array
-
- */
-
-
+ 4) 1 70 10 5 is the recvcounts array */
double clock = smpi_process_simulated_elapsed();
int comm_size = smpi_comm_size(MPI_COMM_WORLD);
recvcounts[i] = atoi(action[i+4+comm_size]);
}
-
int rank = smpi_process_index();
instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
extra->type = TRACING_ALLTOALLV;
TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra);
- mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, MPI_CURRENT_TYPE,
- recvbuf, recvcounts, recvdisps, MPI_CURRENT_TYPE,
- MPI_COMM_WORLD);
+ mpi_coll_alltoallv_fun(sendbuf, sendcounts, senddisps, MPI_CURRENT_TYPE,recvbuf, recvcounts, recvdisps,
+ MPI_CURRENT_TYPE, MPI_COMM_WORLD);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
log_timed_action (action, clock);
xbt_replay_action_register("reduceScatter", action_reducescatter);
xbt_replay_action_register("compute", action_compute);
}
-
+
//if we have a delayed start, sleep here.
if(*argc>2){
char *endptr;
XBT_DEBUG("Force context switch by smpi_execute_flops - Sleeping for 0.0 flops ");
smpi_execute_flops(0.0);
}
-
+
/* Actually run the replay */
xbt_replay_action_runner(*argc, *argv);
/* and now, finalize everything */
double sim_time= 1.;
/* One active process will stop. Decrease the counter*/
- XBT_DEBUG("There are %lu elements in reqq[*]",
- xbt_dynar_length(get_reqq_self()));
+ XBT_DEBUG("There are %lu elements in reqq[*]", xbt_dynar_length(get_reqq_self()));
if (!xbt_dynar_is_empty(get_reqq_self())){
int count_requests=xbt_dynar_length(get_reqq_self());
MPI_Request requests[count_requests];
/* end the simulated timer */
sim_time = smpi_process_simulated_elapsed();
}
-
//TODO xbt_dynar_free_container(get_reqq_self()));
xbt_dict_free(&reqq); //not need, data have been freed ???
reqq = NULL;
}
-
+
instr_extra_data extra_fin = xbt_new0(s_instr_extra_data_t,1);
extra_fin->type = TRACING_FINALIZE;
operation =bprintf("%s_finalize",__FUNCTION__);
MPI_Win smpi_mpi_win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm){
-
MPI_Win win;
-
+
int comm_size = smpi_comm_size(comm);
int rank=smpi_comm_rank(comm);
XBT_DEBUG("Creating window");
win->requests = xbt_dynar_new(sizeof(MPI_Request), NULL);
win->connected_wins = xbt_new0(MPI_Win, comm_size);
win->connected_wins[rank] = win;
-
+
if(rank==0){
win->bar=xbt_barrier_init(comm_size);
}
-
- mpi_coll_allgather_fun(&(win->connected_wins[rank]),
- sizeof(MPI_Win),
- MPI_BYTE,
- win->connected_wins,
- sizeof(MPI_Win),
- MPI_BYTE,
- comm);
-
- mpi_coll_bcast_fun( &(win->bar),
- sizeof(xbt_bar_t),
- MPI_BYTE,
- 0,
- comm);
-
+
+ mpi_coll_allgather_fun(&(win->connected_wins[rank]), sizeof(MPI_Win), MPI_BYTE, win->connected_wins, sizeof(MPI_Win),
+ MPI_BYTE, comm);
+
+ mpi_coll_bcast_fun( &(win->bar), sizeof(xbt_bar_t), MPI_BYTE, 0, comm);
+
mpi_coll_barrier_fun(comm);
-
+
return win;
}
int smpi_mpi_win_free( MPI_Win* win){
-
//As per the standard, perform a barrier to ensure every async comm is finished
xbt_barrier_wait((*win)->bar);
xbt_dynar_free(&(*win)->requests);
win->name = xbt_strdup(name);;
}
-
int smpi_mpi_win_fence( int assert, MPI_Win win){
-
XBT_DEBUG("Entering fence");
if(!win->opened)
win->opened=1;
}
win->assert = assert;
-
+
xbt_barrier_wait(win->bar);
XBT_DEBUG("Leaving fence ");
int smpi_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)
{
-
if(!win->opened)//check that post/start has been done
return MPI_ERR_WIN;
//get receiver pointer
if(target_rank != smpi_comm_rank(win->comm)){
//prepare send_request
- MPI_Request sreq = smpi_rma_send_init(origin_addr, origin_count, origin_datatype,
- smpi_process_index(), smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, win->comm, MPI_OP_NULL);
+ MPI_Request sreq = smpi_rma_send_init(origin_addr, origin_count, origin_datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, win->comm, MPI_OP_NULL);
//prepare receiver request
- MPI_Request rreq = smpi_rma_recv_init(recv_addr, target_count, target_datatype,
- smpi_process_index(), smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, recv_win->comm, MPI_OP_NULL);
+ MPI_Request rreq = smpi_rma_recv_init(recv_addr, target_count, target_datatype, smpi_process_index(),
+ smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+1, recv_win->comm, MPI_OP_NULL);
//push request to receiver's win
xbt_dynar_push_as(recv_win->requests, MPI_Request, rreq);
//push request to sender's win
xbt_dynar_push_as(win->requests, MPI_Request, sreq);
}else{
- smpi_datatype_copy(origin_addr, origin_count, origin_datatype,
- recv_addr, target_count, target_datatype);
+ smpi_datatype_copy(origin_addr, origin_count, origin_datatype, recv_addr, target_count, target_datatype);
}
return MPI_SUCCESS;
if(target_rank != smpi_comm_rank(win->comm)){
//prepare send_request
MPI_Request sreq = smpi_rma_send_init(send_addr, target_count, target_datatype,
- smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, send_win->comm, MPI_OP_NULL);
+ smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, send_win->comm,
+ MPI_OP_NULL);
//prepare receiver request
MPI_Request rreq = smpi_rma_recv_init(origin_addr, origin_count, origin_datatype,
- smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, win->comm, MPI_OP_NULL);
-
+ smpi_group_index(smpi_comm_group(win->comm),target_rank), smpi_process_index(), RMA_TAG+2, win->comm,
+ MPI_OP_NULL);
+
//start the send, with another process than us as sender.
smpi_mpi_start(sreq);
-
+
//push request to receiver's win
xbt_dynar_push_as(send_win->requests, MPI_Request, sreq);
//push request to sender's win
xbt_dynar_push_as(win->requests, MPI_Request, rreq);
}else{
- smpi_datatype_copy(send_addr, target_count, target_datatype,
- origin_addr, origin_count, origin_datatype);
+ smpi_datatype_copy(send_addr, target_count, target_datatype, origin_addr, origin_count, origin_datatype);
}
return MPI_SUCCESS;
smpi_datatype_use(origin_datatype);
smpi_datatype_use(target_datatype);
-
//prepare send_request
MPI_Request sreq = smpi_rma_send_init(origin_addr, origin_count, origin_datatype,
smpi_process_index(), smpi_group_index(smpi_comm_group(win->comm),target_rank), RMA_TAG+3, win->comm, op);
xbt_dynar_push_as(recv_win->requests, MPI_Request, rreq);
//start send
smpi_mpi_start(sreq);
-
+
//push request to sender's win
xbt_dynar_push_as(win->requests, MPI_Request, sreq);
-
-
return MPI_SUCCESS;
}
int smpi_mpi_win_start(MPI_Group group, int assert, MPI_Win win){
/* From MPI forum advices
- The call to MPI_WIN_COMPLETE does not return until the put call has completed at
- the origin; and the target window will be accessed by the put operation only
- after the call to MPI_WIN_START has matched a call to MPI_WIN_POST by the target
- process. This still leaves much choice to implementors. The call to
- MPI_WIN_START can block until the matching call to MPI_WIN_POST occurs at all
- target processes. One can also have implementations where the call to
- MPI_WIN_START is nonblocking, but the call to MPI_PUT blocks until the matching
- call to MPI_WIN_POST occurred; or implementations where the first two calls are
- nonblocking, but the call to MPI_WIN_COMPLETE blocks until the call to
- MPI_WIN_POST occurred; or even implementations where all three calls can
- complete before any target process called MPI_WIN_POST --- the data put must be
- buffered, in this last case, so as to allow the put to complete at the origin
- ahead of its completion at the target. However, once the call to MPI_WIN_POST is
- issued, the sequence above must complete, without further dependencies.
- */
-
+ The call to MPI_WIN_COMPLETE does not return until the put call has completed at the origin; and the target window
+ will be accessed by the put operation only after the call to MPI_WIN_START has matched a call to MPI_WIN_POST by
+ the target process. This still leaves much choice to implementors. The call to MPI_WIN_START can block until the
+ matching call to MPI_WIN_POST occurs at all target processes. One can also have implementations where the call to
+ MPI_WIN_START is nonblocking, but the call to MPI_PUT blocks until the matching call to MPI_WIN_POST occurred; or
+ implementations where the first two calls are nonblocking, but the call to MPI_WIN_COMPLETE blocks until the call
+ to MPI_WIN_POST occurred; or even implementations where all three calls can complete before any target process
+ called MPI_WIN_POST --- the data put must be buffered, in this last case, so as to allow the put to complete at the
+ origin ahead of its completion at the target. However, once the call to MPI_WIN_POST is issued, the sequence above
+ must complete, without further dependencies. */
+
//naive, blocking implementation.
int i=0,j=0;
int size = smpi_group_size(group);
MPI_Request* reqs = xbt_new0(MPI_Request, size);
-
+
// for(i=0;i<size;i++){
while(j!=size){
int src=smpi_group_index(group,j);
int i=0,j=0;
int size = smpi_group_size(group);
MPI_Request* reqs = xbt_new0(MPI_Request, size);
-
+
while(j!=size){
int dst=smpi_group_index(group,j);
if(dst!=smpi_process_index()){
- reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst,
- RMA_TAG+4, MPI_COMM_WORLD);
+ reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, RMA_TAG+4, MPI_COMM_WORLD);
i++;
}
j++;
}
size=i;
-
+
smpi_mpi_startall(size, reqs);
smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE);
for(i=0;i<size;i++){
//MPI_Comm comm = smpi_comm_new(win->group, NULL);
//mpi_coll_barrier_fun(comm);
//smpi_comm_destroy(comm);
-
+
XBT_DEBUG("Entering MPI_Win_Complete");
int i=0,j=0;
int size = smpi_group_size(win->group);
MPI_Request* reqs = xbt_new0(MPI_Request, size);
-
+
while(j!=size){
int dst=smpi_group_index(win->group,j);
if(dst!=smpi_process_index()){
- reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst,
- RMA_TAG+5, MPI_COMM_WORLD);
+ reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, RMA_TAG+5, MPI_COMM_WORLD);
i++;
}
j++;
XBT_DEBUG("Win_complete - Sending sync messages to %d processes", size);
smpi_mpi_startall(size, reqs);
smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE);
-
+
for(i=0;i<size;i++){
smpi_mpi_request_free(&reqs[i]);
}
xbt_free(reqs);
-
+
//now we can finish RMA calls
-
+
xbt_dynar_t reqqs = win->requests;
size = xbt_dynar_length(reqqs);
-
+
XBT_DEBUG("Win_complete - Finishing %d RMA calls", size);
unsigned int cpt=0;
MPI_Request req;
return MPI_SUCCESS;
}
-
-
int smpi_mpi_win_wait(MPI_Win win){
// xbt_barrier_wait(win->bar);
//MPI_Comm comm = smpi_comm_new(win->group, NULL);
int i=0,j=0;
int size = smpi_group_size(win->group);
MPI_Request* reqs = xbt_new0(MPI_Request, size);
-
+
// for(i=0;i<size;i++){
while(j!=size){
int src=smpi_group_index(win->group,j);
xbt_dynar_t reqqs = win->requests;
size = xbt_dynar_length(reqqs);
-
+
XBT_DEBUG("Win_complete - Finishing %d RMA calls", size);
unsigned int cpt=0;
/* reorder is ignored, don't know what would be the consequences of a dumb
* reordering but neither do I see the point of reordering*/
-int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[],
- int periods[], int reorder, MPI_Comm *comm_cart) {
+int smpi_mpi_cart_create(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart) {
int retval = MPI_SUCCESS;
int i;
MPI_Topology newCart;
MPI_Group newGroup, oldGroup;
int rank, nranks, newSize;
-
+
rank = smpi_comm_rank(comm_old);
-
+
newSize = 1;
if(ndims != 0) {
for (i = 0 ; i < ndims ; i++) {
for (i = 0 ; i < newSize ; i++) {
smpi_group_set_mapping(newGroup, smpi_group_index(oldGroup, i), i);
}
-
+
newCart->topo.cart->nnodes = newSize;
- /* memcpy(newCart->topo.cart->dims, dims, */
- /* ndims * sizeof(*newCart->topo.cart->dims)); */
- /* memcpy(newCart->topo.cart->periodic, periods, */
- /* ndims * sizeof(*newCart->topo.cart->periodic)); */
-
+ /* memcpy(newCart->topo.cart->dims, dims, ndims * sizeof(*newCart->topo.cart->dims)); */
+ /* memcpy(newCart->topo.cart->periodic, periods, ndims * sizeof(*newCart->topo.cart->periodic)); */
+
// FIXME : code duplication... See smpi_mpi_cart_coords
nranks = newSize;
- for (i=0; i<ndims; i++)
- {
+ for (i=0; i<ndims; i++) {
newCart->topo.cart->dims[i] = dims[i];
newCart->topo.cart->periodic[i] = periods[i];
nranks = nranks / dims[i];
}
*comm_cart = smpi_comm_new(newGroup, newCart);
- }
- else {
+ } else {
if (rank == 0) {
newCart = smpi_cart_topo_create(ndims);
*comm_cart = smpi_comm_new(smpi_comm_group(MPI_COMM_SELF), newCart);
- }
- else {
+ } else {
*comm_cart = MPI_COMM_NULL;
}
}
return smpi_mpi_cart_create(comm, newNDims, newDims, newPeriodic, 0, newcomm);
}
-
-
-
-int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims,
- int coords[]) {
+int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]) {
int nnodes;
- int i;
+
MPI_Topology topo = smpi_comm_topo(comm);
-
+
nnodes = topo->topo.cart->nnodes;
- for ( i=0; i < topo->topo.cart->ndims; i++ ) {
+ for (int i=0; i < topo->topo.cart->ndims; i++ ) {
nnodes = nnodes / topo->topo.cart->dims[i];
coords[i] = rank / nnodes;
rank = rank % nnodes;
int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
MPI_Topology topo = smpi_comm_topo(comm);
- int i;
- for(i = 0 ; i < maxdims ; i++) {
+
+ for(int i = 0 ; i < maxdims ; i++) {
dims[i] = topo->topo.cart->dims[i];
periods[i] = topo->topo.cart->periodic[i];
coords[i] = topo->topo.cart->position[i];
for ( i=ndims-1; i >=0; i-- ) {
coord = coords[i];
- /* The user can give us whatever coordinates he wants. If one of them is
- * out of range, either this dimension is periodic, and then we
- * consider the equivalent coordinate inside the bounds, or it is not
- * and then it is an error
+ /* The user can give us whatever coordinates he wants. If one of them is out of range, either this dimension is
+ * periodic, and we consider the equivalent coordinate inside the bounds, or it's not and then it's an error
*/
if (coord >= topo->topo.cart->dims[i]) {
if ( topo->topo.cart->periodic[i] ) {
coord = coord % topo->topo.cart->dims[i];
- }
- else {
+ } else {
// Should I do that ?
*rank = -1;
return MPI_ERR_ARG;
}
- }
- else if (coord < 0) {
+ } else if (coord < 0) {
if(topo->topo.cart->periodic[i]) {
coord = coord % topo->topo.cart->dims[i];
if (coord) coord = topo->topo.cart->dims[i] + coord;
- }
- else {
+ } else {
*rank = -1;
return MPI_ERR_ARG;
}
}
-
+
*rank += multiplier * coord;
multiplier *= topo->topo.cart->dims[i];
}
return MPI_SUCCESS;
}
-int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp,
- int *rank_source, int *rank_dest) {
+int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source, int *rank_dest) {
MPI_Topology topo = smpi_comm_topo(comm);
int position[topo->topo.cart->ndims];
-
if(topo->topo.cart->ndims == 0) {
return MPI_ERR_ARG;
}
return MPI_ERR_DIMS;
}
- smpi_mpi_cart_coords(comm, smpi_comm_rank(comm), topo->topo.cart->ndims,
- position);
+ smpi_mpi_cart_coords(comm, smpi_comm_rank(comm), topo->topo.cart->ndims, position);
position[direction] += disp;
if(position[direction] < 0 ||
if(topo->topo.cart->periodic[direction]) {
position[direction] %= topo->topo.cart->dims[direction];
smpi_mpi_cart_rank(comm, position, rank_dest);
- }
- else {
+ } else {
*rank_dest = MPI_PROC_NULL;
}
- }
- else {
+ } else {
smpi_mpi_cart_rank(comm, position, rank_dest);
}
position[direction] = topo->topo.cart->position[direction] - disp;
- if(position[direction] < 0 ||
- position[direction] >= topo->topo.cart->dims[direction]) {
+ if(position[direction] < 0 || position[direction] >= topo->topo.cart->dims[direction]) {
if(topo->topo.cart->periodic[direction]) {
position[direction] %= topo->topo.cart->dims[direction];
smpi_mpi_cart_rank(comm, position, rank_source);
- }
- else {
+ } else {
*rank_source = MPI_PROC_NULL;
}
- }
- else {
+ } else {
smpi_mpi_cart_rank(comm, position, rank_source);
}
return MPI_SUCCESS;
}
-
-
// Everything below has been taken from ompi, but could be easily rewritten.
/*
* $HEADER$
*/
-
/* static functions */
static int assignnodes(int ndim, int nfactor, int *pfacts,int **pdims);
static int getfactors(int num, int *nfators, int **factors);
* - array of prime factors
* Returns: - MPI_SUCCESS or ERROR
*/
-static int
-getfactors(int num, int *nfactors, int **factors) {
+static int getfactors(int num, int *nfactors, int **factors) {
int size;
int d;
int i;
(*nfactors) = i;
return MPI_SUCCESS;
}
-
#!/bin/sh
-#---- smpitools.sh --------------------------------------------------------#
# Copyright (c) 2013-2014. The SimGrid Team.
# All rights reserved.
SAVEIFS="$IFS"
LISTSEP="$(printf '\b')"
-# Create a temporary file, with its name of the form $1_XXX$2, where XXX is
-# replaced by an unique string.
+# Create a temporary file, with its name of the form $1_XXX$2, where XXX is replaced by an unique string.
# $1: prefix, $2: suffix
mymktemp () {
tmp=$(mktemp --suffix="$2" "$1_XXXXXXXXXX" 2> /dev/null)
list_add "$@"
}
-# Get the content of a list: positional parameters ($1, $2, ...) are set to the
-# content of the list
+# Get the content of a list: positional parameters ($1, $2, ...) are set to the content of the list
# $1: list
# usage: eval $(list_get list)
list_get () {
printf 'IFS="$LISTSEP"; eval set -- \\$%s; IFS="$SAVEIFS"' "$1"
}
-
-#---- end of smpitools.sh -------------------------------------------------#