This source file includes following definitions.
- OMPI_CR_Checkpoint
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 #include "ompi_config.h"
  13 #include <stdio.h>
  14 
  15 #include "ompi/mpi/c/bindings.h"
  16 #include "ompi/info/info.h"
  17 #include "ompi/runtime/params.h"
  18 #include "ompi/communicator/communicator.h"
  19 #include "orte/mca/snapc/snapc.h"
  20 
  21 #include "ompi/mpiext/cr/c/mpiext_cr_c.h"
  22 
  23 static const char FUNC_NAME[] = "OMPI_CR_Checkpoint";
  24 #define HANDLE_SIZE_MAX 256
  25 
  26 int OMPI_CR_Checkpoint(char **handle, int *seq, MPI_Info *info)
  27 {
  28     int ret = MPI_SUCCESS;
  29     MPI_Comm comm = MPI_COMM_WORLD;
  30     orte_snapc_base_request_op_t *datum = NULL;
  31     int state = 0;
  32     int my_rank;
  33 
  34     
  35     if (MPI_PARAM_CHECK) {
  36         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  37     }
  38 
  39     
  40 
  41 
  42     datum = OBJ_NEW(orte_snapc_base_request_op_t);
  43     datum->event = ORTE_SNAPC_OP_CHECKPOINT;
  44     datum->is_active = true;
  45 
  46     MPI_Comm_rank(comm, &my_rank);
  47     if( 0 == my_rank ) {
  48         datum->leader = OMPI_PROC_MY_NAME->vpid;
  49     } else {
  50         datum->leader = -1; 
  51     }
  52 
  53     
  54 
  55 
  56     MPI_Barrier(comm);
  57 
  58     
  59 
  60 
  61     OPAL_CR_ENTER_LIBRARY();
  62     ret = orte_snapc.request_op(datum);
  63     if( OMPI_SUCCESS != ret ) {
  64         OBJ_RELEASE(datum);
  65         OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OTHER,
  66                                FUNC_NAME);
  67     }
  68     OPAL_CR_EXIT_LIBRARY();
  69 
  70     
  71 
  72 
  73     if( datum->leader == (int)OMPI_PROC_MY_NAME->vpid ) {
  74         *handle = strdup(datum->global_handle);
  75         *seq = datum->seq_num;
  76         state = 0;
  77     } else {
  78         *handle = (char*)malloc(sizeof(char)*HANDLE_SIZE_MAX);
  79     }
  80 
  81     MPI_Bcast(&state, 1, MPI_INT, 0, comm);
  82     MPI_Bcast(seq,    1, MPI_INT, 0, comm);
  83     MPI_Bcast(*handle, HANDLE_SIZE_MAX, MPI_CHAR, 0, comm);
  84 
  85     datum->is_active = false;
  86     OBJ_RELEASE(datum);
  87 
  88     return ret;
  89 }