Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fabtests/rdm_atomic, ubertest: move atomic verification to common code and use in functional test #10155

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
4 changes: 2 additions & 2 deletions fabtests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ libfabtests_la_SOURCES = \
common/hmem_ze.c \
common/hmem_neuron.c \
common/hmem_synapseai.c \
common/ofi_atomic.c \
include/ofi_atomic.h \
include/shared.h \
include/ft_list.h \
include/hmem.h \
Expand Down Expand Up @@ -468,8 +470,6 @@ unit_fi_setopt_test_LDADD = libfabtests.la

ubertest_fi_ubertest_SOURCES = \
ubertest/fabtest.h \
ubertest/ofi_atomic.h \
ubertest/ofi_atomic.c \
ubertest/uber.c \
ubertest/connect.c \
ubertest/cq.c \
Expand Down
2 changes: 1 addition & 1 deletion fabtests/Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CFLAGS = $(CFLAGS) /O2 /MT
basedeps = common\hmem.c common\shared.c \
common\windows\getopt.c common\windows\osd.c \
common\hmem_cuda.c common\hmem_rocr.c common\hmem_ze.c \
common\hmem_neuron.c common\hmem_synapseai.c
common\hmem_neuron.c common\hmem_synapseai.c common\ofi_atomic.c

includes = /Iinclude /Iinclude\windows /I..\include /FIft_osd.h \
/Iinclude\windows\getopt /Imultinode\include
Expand Down
4 changes: 4 additions & 0 deletions fabtests/common/hmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ int ft_hmem_free_host(enum fi_hmem_iface iface, void *buf)
return hmem_ops[iface].free_host(buf);
}

/*
* Matches the behavior of memset where value is an int but
* used as a unsigned char
*/
int ft_hmem_memset(enum fi_hmem_iface iface, uint64_t device, void *buf,
int value, size_t size)
{
Expand Down
4 changes: 3 additions & 1 deletion fabtests/common/hmem_ze.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,16 @@ int ft_ze_free(void *buf)

int ft_ze_memset(uint64_t device, void *buf, int value, size_t size)
{
unsigned char set_value = (unsigned char) value;
ze_result_t ze_ret;

ze_ret = (*libze_ops.zeCommandListReset)(cmd_list);
if (ze_ret)
return -FI_EINVAL;

ze_ret = (*libze_ops.zeCommandListAppendMemoryFill)(
cmd_list, buf, &value, sizeof(value),
cmd_list, buf, &set_value,
sizeof(set_value),
size, NULL, 0, NULL);
if (ze_ret)
return -FI_EINVAL;
Expand Down
40 changes: 11 additions & 29 deletions fabtests/ubertest/ofi_atomic.c → fabtests/common/ofi_atomic.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2017 Intel Corporation. All rights reserved.
* Copyright (c) Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
Expand Down Expand Up @@ -124,24 +124,14 @@
static void ofi_read_## op ##_## type \
(void *dst, const void *src, void *res, size_t cnt) \
{ \
size_t i; \
type *d = (dst); \
type *r = (res); \
OFI_UNUSED(src); \
for (i = 0; i < cnt; i++) \
r[i] = d[i]; \
memcpy(res, dst, sizeof(type) * cnt); \
}

#define OFI_DEF_READ_COMPLEX_FUNC(op, type) \
static void ofi_read_## op ##_## type \
(void *dst, const void *src, void *res, size_t cnt) \
{ \
size_t i; \
ofi_complex_##type *d = (dst); \
ofi_complex_##type *r = (res); \
OFI_UNUSED(src); \
for (i = 0; i < cnt; i++) \
r[i] = d[i]; \
memcpy(res, dst, sizeof(ofi_complex_##type) * cnt); \
}

/*
Expand All @@ -157,11 +147,9 @@
size_t i; \
type *d = (dst); \
const type *s = (src); \
type *r = (res); \
for (i = 0; i < cnt; i++) { \
r[i] = d[i]; \
memcpy(res, dst, sizeof(type) * cnt); \
for (i = 0; i < cnt; i++) \
op(type, d[i], s[i]); \
} \
}

#define OFI_DEF_READWRITE_COMPLEX_FUNC(op, type) \
Expand All @@ -171,11 +159,9 @@
size_t i; \
ofi_complex_##type *d = (dst); \
const ofi_complex_##type *s = (src); \
ofi_complex_##type *r = (res); \
for (i = 0; i < cnt; i++) { \
r[i] = d[i]; \
memcpy(res, dst, sizeof(ofi_complex_##type) * cnt); \
for (i = 0; i < cnt; i++) \
op(type, d[i], s[i]); \
} \
}

/*
Expand All @@ -193,11 +179,9 @@
type *d = (dst); \
const type *s = (src); \
const type *c = (cmp); \
type *r = (res); \
for (i = 0; i < cnt; i++) { \
r[i] = d[i]; \
memcpy(res, dst, sizeof(type) * cnt); \
for (i = 0; i < cnt; i++) \
op(type, d[i], s[i], c[i]); \
} \
}

#define OFI_DEF_CSWAP_COMPLEX_FUNC(op, type) \
Expand All @@ -209,11 +193,9 @@
ofi_complex_##type *d = (dst); \
const ofi_complex_##type *s = (src); \
const ofi_complex_##type *c = (cmp); \
ofi_complex_##type *r = (res); \
for (i = 0; i < cnt; i++) { \
r[i] = d[i]; \
memcpy(res, dst, sizeof(ofi_complex_##type) * cnt); \
for (i = 0; i < cnt; i++) \
op(type, d[i], s[i], c[i]); \
} \
}


Expand Down
Loading