Skip to content

Commit

Permalink
Option to disable non-fetch AMO (Sandia-OpenSHMEM#1131)
Browse files Browse the repository at this point in the history
* Workaround for non-fetch AMO on CXI

* Switching to fetch AMO

* CI check for disable of non-fetch AMO
  • Loading branch information
wrrobin authored Jun 5, 2024
1 parent 6f9f731 commit fab23f4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ jobs:
- config_name: Without OFI inject
sos_config: --disable-ofi-inject --enable-pmi-simple
libfabric_version: v1.13.x
- config_name: Without Non-fetch AMO
sos_config: --disable-nonfetch-amo --enable-pmi-simple
libfabric_version: v1.13.x

name: OFI ${{ matrix.libfabric_version }} (${{ matrix.config_name }})

Expand Down
8 changes: 7 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,13 @@ AC_ARG_ENABLE([ofi-inject],
[AC_HELP_STRING([--disable-ofi-inject],
[Disable OFI inject by default (default: enabled)])])
AS_IF([test "$enable_ofi_inject" = "no"],
[AC_DEFINE([DISABLE_OFI_INJECT], [0], [If defined, the OFI will not use fi_inject.])])
[AC_DEFINE([DISABLE_OFI_INJECT], [1], [If defined, the OFI will not use fi_inject.])])

AC_ARG_ENABLE([nonfetch-amo],
[AC_HELP_STRING([--disable-nonfetch-amo],
[Disable non-fetching AMO and replace them with fetching AMO (default: enabled)])])
AS_IF([test "$enable_nonfetch_amo" = "no"],
[AC_DEFINE([DISABLE_NONFETCH_AMO], [1], [If defined, SOS will fetch values for any AMO.])])

AC_ARG_WITH([oshrun-launcher],
[AC_HELP_STRING([--with-oshrun-launcher],
Expand Down
14 changes: 14 additions & 0 deletions src/shmem_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,15 @@ shmem_internal_atomic(shmem_ctx_t ctx, void *target, const void *source, size_t
if (shmem_shr_transport_use_atomic(ctx, target, len, pe, datatype)) {
shmem_shr_transport_atomic(ctx, target, source, len, pe, op, datatype);
} else {
#ifdef DISABLE_NONFETCH_AMO
unsigned long long tmp_fetch = 0;
shmem_transport_fetch_atomic((shmem_transport_ctx_t *)ctx, target,
source, &tmp_fetch, len, pe, op, datatype);
shmem_transport_get_wait((shmem_transport_ctx_t *)ctx);
#else
shmem_transport_atomic((shmem_transport_ctx_t *)ctx, target, source,
len, pe, op, datatype);
#endif
}
}

Expand Down Expand Up @@ -276,8 +283,15 @@ shmem_internal_atomic_set(shmem_ctx_t ctx, void *target, const void *source, siz
if (shmem_shr_transport_use_atomic(ctx, target, len, pe, datatype)) {
shmem_shr_transport_atomic_set(ctx, target, source, len, pe, datatype);
} else {
#ifdef DISABLE_NONFETCH_AMO
unsigned long long tmp_fetch = 0;
shmem_transport_fetch_atomic((shmem_transport_ctx_t *)ctx, target,
source, &tmp_fetch, len, pe, FI_ATOMIC_WRITE, datatype);
shmem_transport_get_wait((shmem_transport_ctx_t *)ctx);
#else
shmem_transport_atomic_set((shmem_transport_ctx_t *)ctx, target,
source, len, pe, datatype);
#endif
}
}

Expand Down

0 comments on commit fab23f4

Please sign in to comment.