Skip to content

Commit f3c43a1

Browse files
committed
dummy fi_join implementation with dummy mc handling
Signed-off-by: Tomasz Gromadzki <[email protected]>
1 parent 4f6fd60 commit f3c43a1

File tree

2 files changed

+44
-12
lines changed

2 files changed

+44
-12
lines changed

prov/sharp/src/sharp.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
#define SHARP_IOV_LIMIT 1
7373
#define SHARP_TX_OP_FLAGS (0)
7474
#define SHARP_RX_OP_FLAGS (0)
75-
#define SHARP_DOMAIN_CAPS (FI_LOCAL_COMM | FI_REMOTE_COMM)
75+
#define SHARP_DOMAIN_CAPS (FI_COLLECTIVE | FI_LOCAL_COMM | FI_REMOTE_COMM)
7676
enum {
7777
SHARP_RX_SIZE = 65536,
7878
SHARP_TX_SIZE = 16384,
@@ -132,8 +132,9 @@ struct sharp_av {
132132
#define sharp_coll_comm_t void
133133
#endif
134134
struct sharp_mc {
135-
struct util_coll_mc coll_mc;
136-
135+
struct fid_mc mc_fid;
136+
struct util_coll_mc coll_mc; //XXX will replace mc_fid in the future
137+
struct fid_mc *oob_fid_mc;
137138
struct sharp_ep *ep;
138139
sharp_coll_comm_t *sharp_context;
139140
};

prov/sharp/src/sharp_coll.c

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
6363
static 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
78101
static 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)
138161
int 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

Comments
 (0)