Skip to content

Commit

Permalink
src: Add initial NIC selection logic for multiplexing
Browse files Browse the repository at this point in the history
  • Loading branch information
philipmarshall21 committed May 7, 2024
1 parent 4205387 commit 706bc18
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 84 deletions.
80 changes: 55 additions & 25 deletions src/atomic_c.c4
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,12 @@ SHMEM_DEFINE_FOR_EXTENDED_AMO(`SHMEM_PROF_DEF_CTX_ATOMIC_SET')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_swap(ctx, target, &value, &newval, \
sizeof(TYPE), pe, ITYPE); \
shmem_internal_get_wait(ctx); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return newval; \
}

Expand All @@ -251,8 +254,11 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_PE(pe);
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(long));

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, &value, &newval, sizeof(long), pe, SHM_INTERNAL_LONG);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT);
size_t nic_idx = 0;
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx);

shmem_internal_swap(SHMEM_CTX_DEFAULT, target, &value, &newval, sizeof(long), pe, SHM_INTERNAL_LONG, nic_idx);
shmem_internal_get_wait(SHMEM_CTX_DEFAULT, nic_idx);
return newval;
}
#endif
Expand All @@ -267,9 +273,12 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_cswap(ctx, target, &value, &newval, &cond, \
sizeof(TYPE), pe, ITYPE); \
shmem_internal_get_wait(ctx); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return newval; \
}

Expand All @@ -283,9 +292,12 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_cswap(ctx, target, &value, &newval, &cond, \
sizeof(TYPE), pe, ITYPE); \
shmem_internal_get_wait(ctx); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return newval; \
}

Expand All @@ -311,10 +323,13 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &tmp, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_SUM, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand All @@ -327,10 +342,13 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &tmp, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_SUM, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand Down Expand Up @@ -358,10 +376,12 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &value, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_SUM, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand All @@ -375,10 +395,12 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &value, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_SUM, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand All @@ -393,9 +415,11 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(source, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_atomic_fetch(ctx, &val, (void *) source, \
sizeof(TYPE), pe, ITYPE); \
shmem_internal_get_wait(ctx); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return val; \
}

Expand Down Expand Up @@ -454,18 +478,20 @@ shmem_swap(long *target, long value, int pe)

#define SHMEM_DEF_FETCH_XOR(STYPE,TYPE,ITYPE) \
TYPE SHMEM_FUNCTION_ATTRIBUTES \
SHMEM_FUNC_PROTOTYPE(STYPE, fetch_xor, TYPE *target, TYPE value, \
SHMEM_FUNC_PROTOTYPE(STYPE, fetch_xor, TYPE *target, TYPE value, \
int pe) \
TYPE oldval; \
SHMEM_ERR_CHECK_INITIALIZED(); \
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &value, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_BXOR, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand All @@ -479,10 +505,12 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &value, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_BAND, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand All @@ -496,10 +524,12 @@ shmem_swap(long *target, long value, int pe)
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(target, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_fetch_atomic(ctx, target, &value, &oldval, \
sizeof(TYPE), pe, SHM_INTERNAL_BOR, \
ITYPE); \
shmem_internal_get_wait(ctx); \
ITYPE, nic_idx); \
shmem_internal_get_wait(ctx, nic_idx); \
return oldval; \
}

Expand Down
5 changes: 4 additions & 1 deletion src/atomic_nbi_c.c4
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,11 @@ SHMEM_DEFINE_FOR_BITWISE_AMO(`SHMEM_PROF_DEF_CTX_FETCH_XOR_NBI')
SHMEM_ERR_CHECK_PE(pe); \
SHMEM_ERR_CHECK_CTX(ctx); \
SHMEM_ERR_CHECK_SYMMETRIC(source, sizeof(TYPE)); \
\
size_t nic_idx = 0; \
SHMEM_GET_TRANSMIT_NIC_IDX(nic_idx); \
shmem_internal_atomic_fetch(ctx, fetch, (void *) source, \
sizeof(TYPE), pe, ITYPE); \
sizeof(TYPE), pe, ITYPE, nic_idx); \
}


Expand Down
Loading

0 comments on commit 706bc18

Please sign in to comment.