This source file includes following definitions.
- mca_pml_ob1_comm_proc_construct
- mca_pml_ob1_comm_proc_destruct
- mca_pml_ob1_comm_construct
- mca_pml_ob1_comm_destruct
- mca_pml_ob1_comm_init_size
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23 #include <string.h>
24
25 #include "pml_ob1.h"
26 #include "pml_ob1_comm.h"
27
28
29
30 static void mca_pml_ob1_comm_proc_construct(mca_pml_ob1_comm_proc_t* proc)
31 {
32 proc->ompi_proc = NULL;
33 proc->expected_sequence = 1;
34 proc->send_sequence = 0;
35 proc->frags_cant_match = NULL;
36 #if !MCA_PML_OB1_CUSTOM_MATCH
37 OBJ_CONSTRUCT(&proc->specific_receives, opal_list_t);
38 OBJ_CONSTRUCT(&proc->unexpected_frags, opal_list_t);
39 #endif
40 }
41
42
43 static void mca_pml_ob1_comm_proc_destruct(mca_pml_ob1_comm_proc_t* proc)
44 {
45 assert(NULL == proc->frags_cant_match);
46 #if !MCA_PML_OB1_CUSTOM_MATCH
47 OBJ_DESTRUCT(&proc->specific_receives);
48 OBJ_DESTRUCT(&proc->unexpected_frags);
49 #endif
50 if (proc->ompi_proc) {
51 OBJ_RELEASE(proc->ompi_proc);
52 }
53 }
54
55
56 OBJ_CLASS_INSTANCE(mca_pml_ob1_comm_proc_t, opal_object_t,
57 mca_pml_ob1_comm_proc_construct,
58 mca_pml_ob1_comm_proc_destruct);
59
60
61 static void mca_pml_ob1_comm_construct(mca_pml_ob1_comm_t* comm)
62 {
63 #if !MCA_PML_OB1_CUSTOM_MATCH
64 OBJ_CONSTRUCT(&comm->wild_receives, opal_list_t);
65 #else
66 comm->prq = custom_match_prq_init();
67 comm->umq = custom_match_umq_init();
68 #endif
69 OBJ_CONSTRUCT(&comm->matching_lock, opal_mutex_t);
70 OBJ_CONSTRUCT(&comm->proc_lock, opal_mutex_t);
71 comm->recv_sequence = 0;
72 comm->procs = NULL;
73 comm->last_probed = 0;
74 comm->num_procs = 0;
75 }
76
77
78 static void mca_pml_ob1_comm_destruct(mca_pml_ob1_comm_t* comm)
79 {
80 if (NULL != comm->procs) {
81 for (size_t i = 0; i < comm->num_procs; ++i) {
82 if (comm->procs[i]) {
83 OBJ_RELEASE(comm->procs[i]);
84 }
85 }
86
87 free(comm->procs);
88 }
89
90 #if !MCA_PML_OB1_CUSTOM_MATCH
91 OBJ_DESTRUCT(&comm->wild_receives);
92 #else
93 custom_match_prq_destroy(comm->prq);
94 custom_match_umq_destroy(comm->umq);
95 #endif
96 OBJ_DESTRUCT(&comm->matching_lock);
97 OBJ_DESTRUCT(&comm->proc_lock);
98 }
99
100
101 OBJ_CLASS_INSTANCE(
102 mca_pml_ob1_comm_t,
103 opal_object_t,
104 mca_pml_ob1_comm_construct,
105 mca_pml_ob1_comm_destruct);
106
107
108 int mca_pml_ob1_comm_init_size (mca_pml_ob1_comm_t* comm, size_t size)
109 {
110
111 comm->procs = (mca_pml_ob1_comm_proc_t **) calloc(size, sizeof (mca_pml_ob1_comm_proc_t *));
112 if(NULL == comm->procs) {
113 return OMPI_ERR_OUT_OF_RESOURCE;
114 }
115 comm->num_procs = size;
116 return OMPI_SUCCESS;
117 }
118
119