X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b9e5f3cda750dceba00cad0b026441b56c86096c..3c072dea92bbf0e4df46b1d8d56cd62e68883b33:/src/smpi/private.h diff --git a/src/smpi/private.h b/src/smpi/private.h index 15c29d9582..3ee7f8bcf7 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -27,6 +27,10 @@ typedef struct smpi_mpi_communicator_t { // smpi mpi datatype typedef struct smpi_mpi_datatype_t { size_t size; + ptrdiff_t lb; + ptrdiff_t ub; + uint16_t flags; /* flags: has it been committed, etc ...*/ + uint16_t id; /* unused so far : data id, normally the index in the data array. */ } s_smpi_mpi_datatype_t; // smpi mpi request @@ -41,6 +45,7 @@ typedef struct smpi_mpi_request_t { smpi_mpi_datatype_t datatype; short int completed:1; + short int consumed:1; /* for waitany */ smx_mutex_t mutex; smx_cond_t cond; @@ -83,24 +88,13 @@ typedef struct smpi_global_t { double reference_speed; // state vars - - smx_host_t *hosts; - int host_count; + int process_count; xbt_mallocator_t request_mallocator; xbt_mallocator_t message_mallocator; - // FIXME: request queues should be moved to host data... - xbt_fifo_t *pending_send_request_queues; - xbt_fifo_t *pending_recv_request_queues; - xbt_fifo_t *received_message_queues; - - smx_process_t *sender_processes; - smx_process_t *receiver_processes; - - int running_hosts_count; + smx_process_t *main_processes; xbt_os_timer_t timer; - smx_mutex_t timer_mutex; smx_cond_t timer_cond; // keeps track of previous times @@ -116,19 +110,40 @@ typedef struct smpi_host_data_t { int index; smx_mutex_t mutex; smx_cond_t cond; -} s_smpi_host_data_t; -typedef struct smpi_host_data_t *smpi_host_data_t; + + smx_process_t main; + smx_process_t sender; + smx_process_t receiver; + + int finalize; /* so that main process stops its sender&receiver */ + + xbt_fifo_t pending_recv_request_queue; + xbt_fifo_t pending_send_request_queue; + xbt_fifo_t received_message_queue; +} s_smpi_process_data_t; +typedef struct smpi_host_data_t *smpi_process_data_t; // function prototypes -void smpi_process_init(void); +void smpi_process_init(int *argc, char ***argv); void smpi_process_finalize(void); int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm); +int smpi_mpi_type_get_extent(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent); +int smpi_mpi_bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm); int smpi_mpi_barrier(smpi_mpi_communicator_t comm); + int smpi_mpi_isend(smpi_mpi_request_t request); int smpi_mpi_irecv(smpi_mpi_request_t request); +int smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm); +int smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, + void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, + MPI_Comm comm, MPI_Status *status); int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t * status); +int smpi_mpi_waitall(int count, smpi_mpi_request_t requests[], smpi_mpi_status_t status[]); +int smpi_mpi_waitany(int count, smpi_mpi_request_t requests[], int *index, smpi_mpi_status_t status[]); + +// utilities void smpi_execute(double duration); void smpi_start_timer(void); double smpi_stop_timer(void); @@ -138,17 +153,16 @@ void smpi_bench_skip(void); void smpi_global_init(void); void smpi_global_destroy(void); -int smpi_host_index(void); -smx_mutex_t smpi_host_mutex(void); -smx_cond_t smpi_host_cond(void); +int smpi_process_index(void); +smx_mutex_t smpi_process_mutex(void); +smx_cond_t smpi_process_cond(void); int smpi_run_simulation(int *argc, char **argv); int smpi_create_request(void *buf, int count, smpi_mpi_datatype_t datatype, int src, int dst, int tag, smpi_mpi_communicator_t comm, smpi_mpi_request_t * request); -int smpi_sender(int argc, char **argv); - -int smpi_receiver(int argc, char **argv); +int smpi_sender(int argc, char *argv[]); +int smpi_receiver(int argc, char *argv[]); #endif