Skip to content

Commit

Permalink
COMMIT MESSAGE TO BE AMENDED
Browse files Browse the repository at this point in the history
This PR is not yet final. It is more-or-less a cherry-pick from open-mpi#8203,
but with some v4.1.x-specific fixes and some not-relevant-to-v4.1.x
fixes dropped.

--> Final commit from open-mpi#8203 may be: 14aa5fa

The commit message on the commit(s) on this PR will be updated after

Fixes open-mpi#8195. This PR doesn't fix all the warnings from open-mpi#8195, but
fixes many of them (e.g., I didn't get the "string might be truncated"
warnings on my Mac).

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
  • Loading branch information
jsquyres committed Nov 14, 2020
1 parent 129b5ee commit dbaa448
Show file tree
Hide file tree
Showing 24 changed files with 163 additions and 111 deletions.
2 changes: 1 addition & 1 deletion ompi/mca/coll/adapt/coll_adapt_ireduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count,
OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output,
"[%d]: distance %d, inbuf %p, inbuf->buff %p, inbuf->buff-lb %p, to_inbuf %p, inbuf_list %p\n",
rank, con->distance, (void *) temp_inbuf, (void *) temp_inbuf->buff,
(char *) temp_inbuf->buff - lower_bound,
(void *) ((char *) temp_inbuf->buff - lower_bound),
(void *) to_inbuf((char *) temp_inbuf->buff - lower_bound, con->distance),
(void *) &con->inbuf_list));
opal_free_list_return_st(&con->inbuf_list, (opal_free_list_item_t *) temp_inbuf);
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/coll/base/coll_base_allgatherv.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount,
{
int line = -1, err = 0, rank, size, sendto, recvfrom, distance, blockcount, i;
int *new_rcounts = NULL, *new_rdispls = NULL, *new_scounts = NULL, *new_sdispls = NULL;
ptrdiff_t slb, rlb, sext, rext;
ptrdiff_t rlb, rext;
char *tmpsend = NULL, *tmprecv = NULL;
struct ompi_datatype_t *new_rdtype, *new_sdtype;

Expand Down Expand Up @@ -226,7 +226,7 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount,
mca_coll_base_module_t *module)
{
int line = -1, rank, size, sendto, recvfrom, i, recvdatafrom, senddatafrom, err = 0;
ptrdiff_t slb, rlb, sext, rext;
ptrdiff_t rlb, rext;
char *tmpsend = NULL, *tmprecv = NULL;

size = ompi_comm_size(comm);
Expand Down Expand Up @@ -355,7 +355,7 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount,
int line = -1, rank, size, i, even_rank, err = 0;
int neighbor[2], offset_at_step[2], recv_data_from[2], send_data_from;
int new_scounts[2], new_sdispls[2], new_rcounts[2], new_rdispls[2];
ptrdiff_t slb, rlb, sext, rext;
ptrdiff_t rlb, rext;
char *tmpsend = NULL, *tmprecv = NULL;
struct ompi_datatype_t *new_rdtype, *new_sdtype;

Expand Down Expand Up @@ -500,7 +500,7 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount,
{
int line = -1, err = 0, rank, remote;
char *tmpsend = NULL, *tmprecv = NULL;
ptrdiff_t sext, rext, lb;
ptrdiff_t rext, lb;

rank = ompi_comm_rank(comm);

Expand Down
3 changes: 3 additions & 0 deletions ompi/mca/common/monitoring/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ lib_LTLIBRARIES += $(component_install)
lib_LTLIBRARIES += ompi_monitoring_prof.la

ompi_monitoring_prof_la_SOURCES = monitoring_prof.c
if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
ompi_monitoring_prof_la_SOURCES += monitoring_prof_f.c
endif
ompi_monitoring_prof_la_LDFLAGS= \
-module -avoid-version -shared $(WRAPPER_EXTRA_LDFLAGS)
ompi_monitoring_prof_la_LIBADD = \
Expand Down
64 changes: 0 additions & 64 deletions ompi/mca/common/monitoring/monitoring_prof.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,67 +378,3 @@ int write_mat(char * filename, size_t * mat, unsigned int dim)

return 0;
}

/**
* MPI binding for fortran
*/

#include <stdbool.h>
#include "ompi_config.h"
#include "opal/threads/thread_usage.h"
#include "ompi/mpi/fortran/base/constants.h"
#include "ompi/mpi/fortran/base/fint_2_int.h"

void monitoring_prof_mpi_init_f2c( MPI_Fint * );
void monitoring_prof_mpi_finalize_f2c( MPI_Fint * );

void monitoring_prof_mpi_init_f2c( MPI_Fint *ierr ) {
int c_ierr;
int argc = 0;
char ** argv = NULL;

c_ierr = MPI_Init(&argc, &argv);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}

void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) {
int c_ierr;

c_ierr = MPI_Finalize();
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}

#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_INIT = monitoring_prof_mpi_init_f2c
#pragma weak mpi_init = monitoring_prof_mpi_init_f2c
#pragma weak mpi_init_ = monitoring_prof_mpi_init_f2c
#pragma weak mpi_init__ = monitoring_prof_mpi_init_f2c
#pragma weak MPI_Init_f = monitoring_prof_mpi_init_f2c
#pragma weak MPI_Init_f08 = monitoring_prof_mpi_init_f2c

#pragma weak MPI_FINALIZE = monitoring_prof_mpi_finalize_f2c
#pragma weak mpi_finalize = monitoring_prof_mpi_finalize_f2c
#pragma weak mpi_finalize_ = monitoring_prof_mpi_finalize_f2c
#pragma weak mpi_finalize__ = monitoring_prof_mpi_finalize_f2c
#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c
#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c
#elif OMPI_BUILD_FORTRAN_BINDINGS
#define OMPI_F77_PROTOTYPES_MPI_H
#include "ompi/mpi/fortran/mpif-h/bindings.h"

OMPI_GENERATE_F77_BINDINGS (MPI_INIT,
mpi_init,
mpi_init_,
mpi_init__,
monitoring_prof_mpi_init_f2c,
(MPI_Fint *ierr),
(ierr) )

OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZE,
mpi_finalize,
mpi_finalize_,
mpi_finalize__,
monitoring_prof_mpi_finalize_f2c,
(MPI_Fint *ierr),
(ierr) )
#endif
82 changes: 82 additions & 0 deletions ompi/mca/common/monitoring/monitoring_prof_f.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2013-2017 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2013-2017 Inria. All rights reserved.
* Copyright (c) 2013-2015 Bull SAS. All rights reserved.
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/

/*
* MPI binding for fortran
*/

#define OMPI_BUILD_MPI_PROFILING 0
#define OMPI_COMPILING_FORTRAN_WRAPPERS 1

#include <stdbool.h>

#include "ompi_config.h"

#include "ompi/mpi/fortran/mpif-h/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"


void monitoring_prof_mpi_init_f2c( MPI_Fint * );
void monitoring_prof_mpi_finalize_f2c( MPI_Fint * );

void monitoring_prof_mpi_init_f2c( MPI_Fint *ierr ) {
int c_ierr;
int argc = 0;
char ** argv = NULL;

c_ierr = PMPI_Init(&argc, &argv);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}

void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) {
int c_ierr;

c_ierr = PMPI_Finalize();
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
}

#if OPAL_HAVE_WEAK_SYMBOLS
#pragma weak MPI_INIT = monitoring_prof_mpi_init_f2c
#pragma weak mpi_init = monitoring_prof_mpi_init_f2c
#pragma weak mpi_init_ = monitoring_prof_mpi_init_f2c
#pragma weak mpi_init__ = monitoring_prof_mpi_init_f2c
#pragma weak MPI_Init_f = monitoring_prof_mpi_init_f2c
#pragma weak MPI_Init_f08 = monitoring_prof_mpi_init_f2c

#pragma weak MPI_FINALIZE = monitoring_prof_mpi_finalize_f2c
#pragma weak mpi_finalize = monitoring_prof_mpi_finalize_f2c
#pragma weak mpi_finalize_ = monitoring_prof_mpi_finalize_f2c
#pragma weak mpi_finalize__ = monitoring_prof_mpi_finalize_f2c
#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c
#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c
#else

OMPI_GENERATE_F77_BINDINGS (MPI_INIT,
mpi_init,
mpi_init_,
mpi_init__,
monitoring_prof_mpi_init_f2c,
(MPI_Fint *ierr),
(ierr) )

OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZE,
mpi_finalize,
mpi_finalize_,
mpi_finalize__,
monitoring_prof_mpi_finalize_f2c,
(MPI_Fint *ierr),
(ierr) )
#endif
12 changes: 6 additions & 6 deletions ompi/mca/osc/rdma/osc_rdma_dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ static bool ompi_osc_rdma_find_conflicting_attachment (ompi_osc_rdma_handle_t *h

OPAL_LIST_FOREACH(attachment, &handle->attachments, ompi_osc_rdma_attachment_t) {
intptr_t region_bound = attachment->base + attachment->len;
if (base >= attachment->base && base < region_bound ||
bound > attachment->base && bound <= region_bound) {
if ((base >= attachment->base && base < region_bound) ||
(bound > attachment->base && bound <= region_bound)) {
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "existing region {%p, %p} overlaps region {%p, %p}",
(void *) attachment->base, (void *) region_bound, (void *) base, (void *) bound);
return true;
Expand Down Expand Up @@ -295,8 +295,7 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base)
ompi_osc_rdma_handle_t *rdma_region_handle;
osc_rdma_counter_t region_count, region_id;
ompi_osc_rdma_region_t *region;
void *bound;
int start_index = INT_MAX, region_index;
int region_index;

if (module->flavor != MPI_WIN_FLAVOR_DYNAMIC) {
return OMPI_ERR_WIN;
Expand All @@ -313,9 +312,10 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base)
rdma_region_handle = module->dynamic_handles[region_index];
region = (ompi_osc_rdma_region_t *) ((intptr_t) module->state->regions + region_index * module->region_size);
OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "checking attachments at index %d {.base=%p, len=%lu} for attachment %p"
", region handle=%p", region_index, (void *) region->base, region->len, base, rdma_region_handle);
", region handle=%p", region_index, (void *) region->base,
(unsigned long) region->len, base, (void *) rdma_region_handle);

if (region->base > (uintptr_t) base || (region->base + region->len) < (uintptr_t) base) {
if (region->base > (intptr_t) base || (region->base + region->len) < (uintptr_t) base) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/osc/rdma/osc_rdma_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ struct ompi_osc_rdma_peer_t;
#if OPAL_HAVE_ATOMIC_MATH_64

typedef int64_t osc_rdma_base_t;
typedef int64_t osc_rdma_size_t;
typedef uint64_t osc_rdma_size_t;
typedef int64_t osc_rdma_counter_t;

#define ompi_osc_rdma_counter_add opal_atomic_add_fetch_64

#else

typedef int32_t osc_rdma_base_t;
typedef int32_t osc_rdma_size_t;
typedef uint32_t osc_rdma_size_t;
typedef int32_t osc_rdma_counter_t;

#define ompi_osc_rdma_counter_add opal_atomic_add_fetch_32
Expand Down
2 changes: 1 addition & 1 deletion ompi/tools/mpisync/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ AM_CFLAGS = \
-DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \
-DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
-DOMPI_BUILD_USER="\"$$USER\"" \
-DOMPI_BUILD_HOST="\"`$${HOSTNAME:-(hostname || uname -n) | sed 1q`\"" \
-DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \
-DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \
-DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
-DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
Expand Down
2 changes: 1 addition & 1 deletion ompi/tools/ompi_info/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ AM_CFLAGS = \
-DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \
-DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \
-DOMPI_BUILD_USER="\"$$USER\"" \
-DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \
-DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \
-DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \
-DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \
-DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \
Expand Down
2 changes: 1 addition & 1 deletion opal/datatype/opal_convertor_raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ opal_convertor_merge_iov( struct iovec* iov, uint32_t* iov_count,
uint32_t* idx )
{
if( 0 != iov[*idx].iov_len ) {
if( (base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len)) ) {
if (base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len)) {
iov[*idx].iov_len += len; /* merge with previous iovec */
return 0;
} /* cannot merge, move to the next position */
Expand Down
2 changes: 1 addition & 1 deletion opal/datatype/opal_datatype_pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pack_partial_blocklen( opal_convertor_t* CONVERTOR,
OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf,
(CONVERTOR)->pDesc, (CONVERTOR)->count );
DO_DEBUG( opal_output( 0, "pack memcpy( %p, %p, %lu ) => space %lu [partial]\n",
_packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); );
(void*) _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); );
MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) );
*(memory) += (ptrdiff_t)do_now_bytes;
if( do_now == left_in_block ) /* compensate if completed a blocklen */
Expand Down
2 changes: 1 addition & 1 deletion opal/mca/btl/usnic/btl_usnic_cagent.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static opal_event_t ipc_event;
static struct timeval ack_timeout;
static opal_list_t udp_port_listeners;
static opal_list_t ipc_listeners;
static volatile int ipc_accepts = 0;
static volatile uint32_t ipc_accepts = 0;
/* JMS The pings_pending and ping_results should probably both be hash
tables for more efficient lookups */
static opal_list_t pings_pending;
Expand Down
Loading

0 comments on commit dbaa448

Please sign in to comment.