@@ -43,8 +43,9 @@ int sharp_query_collective(struct fid_domain *domain,
4343
4444 switch (coll ) {
4545 case FI_BARRIER :
46+ // return FI_SUCCESS; //XXX to be change when barier operation is implemented
4647 case FI_ALLREDUCE :
47- return FI_SUCCESS ;
48+ // return FI_SUCCESS; //XXX to be change when allreduce operation is implemented
4849 case FI_ALLGATHER :
4950 case FI_SCATTER :
5051 case FI_BROADCAST :
@@ -59,21 +60,43 @@ int sharp_query_collective(struct fid_domain *domain,
5960 return - FI_ENOSYS ;
6061}
6162
62- #if 0
6363static int sharp_mc_close (struct fid * fid )
6464{
65- #if 0
6665 struct sharp_mc * mc ;
6766
6867 mc = container_of (fid , struct sharp_mc , mc_fid .fid );
69- ofi_atomic_dec32 (& mc -> ep -> ref );
68+ if (mc -> oob_fid_mc ) {
69+ fi_close (& (mc -> oob_fid_mc -> fid ));
70+ mc -> oob_fid_mc = NULL ;
71+ }
72+ // ofi_atomic_dec32(&mc->ep->ref); //XXX
7073 free (mc );
7174 return 0 ;
72- #else
73- return - FI_ENOSYS ;
74- #endif
7575}
7676
77+
78+ int sharp_mc_bind (struct fid * fid , struct fid * bfid , uint64_t flags )
79+ {
80+ struct sharp_mc * mc ;
81+ struct fid_mc * fid_mc ;
82+ mc = container_of (fid , struct sharp_mc , mc_fid .fid );
83+ fid_mc = container_of (bfid , struct fid_mc , fid );
84+ mc -> oob_fid_mc = fid_mc ;
85+ return 0 ;
86+ }
87+
88+
89+ static struct fi_ops sharp_mc_fid_ops = {
90+ .size = sizeof (struct fi_ops ),
91+ .close = sharp_mc_close ,
92+ .bind = sharp_mc_bind ,
93+ .control = fi_no_control ,
94+ .ops_open = fi_no_ops_open ,
95+ };
96+
97+ #if 0
98+
99+
77100#if 0
78101static struct fi_ops sharp_mc_ops = {
79102 .size = sizeof (struct fi_ops ),
@@ -138,6 +161,16 @@ static int sharp_find_local_rank(struct fid_ep *ep, struct sharp_mc *sharp_mc)
138161int sharp_join_collective (struct fid_ep * fid , const void * addr , uint64_t flags ,
139162 struct fid_mc * * mc_fid , void * context )
140163{
164+ struct sharp_mc * mc ;
165+ //XXX struct fi_peer_transfer_context *peer_context = context;
166+
167+ mc = calloc (1 , sizeof (* mc ));
168+ if (!mc )
169+ return - FI_ENOMEM ;
170+
171+ * mc_fid = & mc -> mc_fid ;
172+ (* mc_fid )-> fid .ops = & sharp_mc_fid_ops ;
173+ return 0 ;
141174
142175#if 0
143176 struct fi_collective_addr * c_addr ;
@@ -180,8 +213,6 @@ int sharp_join_collective(struct fid_ep *fid, const void *addr, uint64_t flags,
180213 * mc_fid = & new_mc -> mc_fid ;
181214
182215 return 0 ; //XXX
183- #else
184- return - FI_ENOSYS ;
185216#endif
186217}
187218
0 commit comments