00001
00002
00003
00004
00005
00006
00007
00008 #include "ampiimpl.h"
00009
00010 AMPI_API_IMPL(int, MPIX_Grequest_start, MPI_Grequest_query_function *query_fn,
00011 MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn,
00012 MPIX_Grequest_poll_function *poll_fn, void *extra_state, MPI_Request *request)
00013 {
00014 AMPI_API("AMPIX_Grequest_start");
00015
00016 ampi* ptr = getAmpiInstance(MPI_COMM_SELF);
00017 GReq *newreq = new GReq(query_fn, free_fn, cancel_fn, poll_fn, extra_state);
00018 *request = ptr->postReq(newreq);
00019
00020 return MPI_SUCCESS;
00021 }
00022
00023
00024 AMPI_API_IMPL(int, MPIX_Grequest_class_create, MPI_Grequest_query_function *query_fn,
00025 MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn,
00026 MPIX_Grequest_poll_function *poll_fn, MPIX_Grequest_wait_function *wait_fn,
00027 MPIX_Grequest_class *greq_class)
00028 {
00029 AMPI_API("AMPIX_Grequest_class_create");
00030
00031 greq_class_desc g;
00032 g.query_fn = query_fn;
00033 g.free_fn = free_fn;
00034 g.cancel_fn = cancel_fn;
00035 g.poll_fn = poll_fn;
00036 g.wait_fn = wait_fn;
00037
00038 ampi* ptr = getAmpiInstance(MPI_COMM_SELF);
00039
00040 ptr->greq_classes.push_back(g);
00041
00042 *greq_class = ptr->greq_classes.size()-1;
00043
00044 return MPI_SUCCESS;
00045 }
00046
00047 AMPI_API_IMPL(int, MPIX_Grequest_class_allocate, MPIX_Grequest_class greq_class,
00048 void *extra_state, MPI_Request *request)
00049 {
00050 AMPI_API("AMPIX_Grequest_class_allocate");
00051
00052 ampi* ptr = getAmpiInstance(MPI_COMM_SELF);
00053
00054 greq_class_desc g = ptr->greq_classes[greq_class];
00055 CkAssert(greq_class < ptr->greq_classes.size());
00056
00057 GReq *newreq = new GReq(g.query_fn, g.free_fn, g.cancel_fn, g.poll_fn, g.wait_fn, extra_state);
00058 *request = ptr->postReq(newreq);
00059
00060 return MPI_SUCCESS;
00061 }