Skip to content

Commit

Permalink
osc/rdma: Remove usage of custom min() function
Browse files Browse the repository at this point in the history
Use the opal_min() function instead of a custom macro.

Signed-off-by: Brian Barrett <bbarrett@amazon.com>
  • Loading branch information
bwbarrett committed Feb 16, 2022
1 parent 222b7f3 commit 6e2af18
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions ompi/mca/osc/rdma/osc_rdma_accumulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "osc_rdma_accumulate.h"
#include "osc_rdma_request.h"
#include "osc_rdma_comm.h"
#include "osc_rdma_lock.h"
#include "osc_rdma_btl_comm.h"

#include "opal/util/minmax.h"
#include "ompi/mca/osc/base/base.h"
#include "ompi/mca/osc/base/osc_base_obj_convert.h"

Expand Down Expand Up @@ -583,9 +586,9 @@ static inline int ompi_osc_rdma_gacc_master (ompi_osc_rdma_sync_t *sync, const v

/* determine how much to put in this operation */
if (source_count) {
acc_len = min(min(target_iovec[target_iov_index].iov_len, source_iovec[source_iov_index].iov_len), acc_limit);
acc_len = opal_min(opal_min(target_iovec[target_iov_index].iov_len, source_iovec[source_iov_index].iov_len), acc_limit);
} else {
acc_len = min(target_iovec[target_iov_index].iov_len, acc_limit);
acc_len = opal_min(target_iovec[target_iov_index].iov_len, acc_limit);
}

if (0 != acc_len) {
Expand Down
7 changes: 5 additions & 2 deletions ompi/mca/osc/rdma/osc_rdma_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
* $HEADER$
*/

#include "ompi_config.h"

#include "osc_rdma_comm.h"
#include "osc_rdma_frag.h"
#include "osc_rdma_sync.h"
#include "osc_rdma_request.h"
#include "osc_rdma_dynamic.h"
#include "osc_rdma_btl_comm.h"

#include "ompi/mca/osc/base/osc_base_obj_convert.h"
#include "opal/align.h"
#include "opal/util/minmax.h"
#include "ompi/mca/osc/base/osc_base_obj_convert.h"

/* helper functions */
static inline void ompi_osc_rdma_cleanup_rdma (ompi_osc_rdma_sync_t *sync, bool dec_always, ompi_osc_rdma_frag_t *frag,
Expand Down Expand Up @@ -246,7 +249,7 @@ static int ompi_osc_rdma_master_noncontig (ompi_osc_rdma_sync_t *sync, void *loc
assert (0 != local_iov_count);

/* determine how much to transfer in this operation */
rdma_len = min(min(local_iovec[local_iov_index].iov_len, remote_iovec[remote_iov_index].iov_len), max_rdma_len);
rdma_len = opal_min(opal_min(local_iovec[local_iov_index].iov_len, remote_iovec[remote_iov_index].iov_len), max_rdma_len);

/* execute the get */
if (!subreq && alloc_reqs) {
Expand Down
1 change: 0 additions & 1 deletion ompi/mca/osc/rdma/osc_rdma_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#define OMPI_OSC_RDMA_DECODE_MAX 64

#define min(a,b) ((a) < (b) ? (a) : (b))
#define ALIGNMENT_MASK(x) ((x) ? (x) - 1 : 0)

/**
Expand Down

0 comments on commit 6e2af18

Please sign in to comment.