-/* Copyright (c) 2007, 2009-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/simix.h"
#include "smpi/smpi.h"
-#include "src/smpi/smpi_group.hpp"
-#include "src/smpi/smpi_comm.hpp"
-#include "src/smpi/smpi_topo.hpp"
#include "src/include/smpi/smpi_interface.h"
#include "src/instr/instr_private.h"
#include "src/internal_config.h"
#include "xbt/base.h"
#include "xbt/synchro.h"
#include "xbt/xbt_os_time.h"
-
+#include "src/smpi/smpi_group.hpp"
+#include "src/smpi/smpi_comm.hpp"
+#include "src/smpi/smpi_request.hpp"
+#include "src/smpi/smpi_topo.hpp"
+#include "src/smpi/smpi_win.hpp"
SG_BEGIN_DECL()
+
+using namespace simgrid::smpi;
+
struct s_smpi_process_data;
typedef struct s_smpi_process_data *smpi_process_data_t;
extern XBT_PRIVATE MPI_Comm MPI_COMM_UNINITIALIZED;
-typedef struct s_smpi_mpi_request {
- void *buf;
- /* in the case of non-contiguous memory the user address should be keep
- * to unserialize the data inside the user memory*/
- void *old_buf;
- /* this let us know how to unserialize at the end of
- * the communication*/
- MPI_Datatype old_type;
- size_t size;
- int src;
- int dst;
- int tag;
- //to handle cases where we have an unknown sender
- //We can't override src, tag, and size, because the request may be reused later
- int real_src;
- int real_tag;
- int truncated;
- size_t real_size;
- MPI_Comm comm;
- smx_activity_t action;
- unsigned flags;
- int detached;
- MPI_Request detached_sender;
- int refcount;
- MPI_Op op;
- int send;
- int recv;
-} s_smpi_mpi_request_t;
+
typedef struct s_smpi_mpi_comm_key_elem {
MPI_Comm_copy_attr_function* copy_fn;
MPI_Comm comm);
XBT_PRIVATE void smpi_empty_status(MPI_Status * status);
+XBT_PRIVATE int smpi_mpi_get_count(MPI_Status * status, MPI_Datatype datatype);
XBT_PRIVATE MPI_Op smpi_op_new(MPI_User_function * function, bool commute);
XBT_PRIVATE bool smpi_op_is_commute(MPI_Op op);
XBT_PRIVATE void smpi_op_destroy(MPI_Op op);
XBT_PRIVATE int smpi_info_add_f(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 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 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 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 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 void smpi_mpi_barrier(MPI_Comm comm);
XBT_PRIVATE void smpi_mpi_gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
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 MPI_Win smpi_mpi_win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm);
-
-XBT_PRIVATE void smpi_mpi_win_get_name(MPI_Win win, char* name, int* length);
-XBT_PRIVATE void smpi_mpi_win_get_group(MPI_Win win, MPI_Group* group);
-XBT_PRIVATE void smpi_mpi_win_set_name(MPI_Win win, char* name);
-
-XBT_PRIVATE int smpi_mpi_win_fence( int assert, MPI_Win win);
-
-XBT_PRIVATE int smpi_mpi_win_post(MPI_Group group, int assert, MPI_Win win);
-XBT_PRIVATE int smpi_mpi_win_start(MPI_Group group, int assert, MPI_Win win);
-XBT_PRIVATE int smpi_mpi_win_complete(MPI_Win win);
-XBT_PRIVATE int smpi_mpi_win_wait(MPI_Win win);
-
-XBT_PRIVATE int smpi_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);
-XBT_PRIVATE 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);
-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_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,