Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions ompi/request/req_wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,13 @@ int ompi_request_default_wait_any(size_t count,
int *index,
ompi_status_public_t * status)
{
size_t completed = count, num_requests_null_inactive = 0;
int i, rc = OMPI_SUCCESS;
ompi_request_t **rptr=NULL;
size_t i, completed = count, num_requests_null_inactive = 0;
int rc = OMPI_SUCCESS;
ompi_request_t *request=NULL;
ompi_wait_sync_t sync;

WAIT_SYNC_INIT(&sync, 1);

rptr = requests;
num_requests_null_inactive = 0;
for (i = 0; i < count; i++) {
request = requests[i];
Expand Down Expand Up @@ -177,10 +175,10 @@ int ompi_request_default_wait_all( size_t count,
ompi_request_t ** requests,
ompi_status_public_t * statuses )
{
size_t completed = 0, failed = 0;
size_t i, completed = 0, failed = 0;
ompi_request_t **rptr;
ompi_request_t *request;
int i, mpi_error = OMPI_SUCCESS;
int mpi_error = OMPI_SUCCESS;
ompi_wait_sync_t sync;

WAIT_SYNC_INIT(&sync, count);
Expand Down
4 changes: 2 additions & 2 deletions opal/mca/memory/patcher/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2008-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
Expand Down Expand Up @@ -84,7 +84,7 @@ AC_DEFUN([MCA_opal_memory_patcher_CONFIG],[
AC_DEFINE_UNQUOTED([OPAL_MEMORY_PATCHER_HAVE___SYSCALL], [$memory_patcher_have___syscall],
[Whether the internal __syscall call exists])

AC_CHECK_HEADERS([linux/mman.h])
AC_CHECK_HEADERS([linux/mman.h sys/syscall.h])

[$1]

Expand Down
27 changes: 22 additions & 5 deletions opal/mca/memory/patcher/memory_patcher_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "opal/mca/memory/base/empty.h"
#include "opal/mca/memory/base/base.h"
#include "opal/memoryhooks/memory.h"
#include "opal/mca/patcher/base/base.h"

#include <stdlib.h>
#include <stdint.h>
Expand All @@ -41,8 +42,9 @@
#include <dlfcn.h>
#include <assert.h>
#include <sys/time.h>
#if defined(HAVE_SYS_SYSCALL_H)
#include <sys/syscall.h>

#endif
#if defined(HAVE_LINUX_MMAN_H)
#include <linux/mman.h>
#endif
Expand Down Expand Up @@ -367,7 +369,9 @@ static int intercept_shmdt (const void *shmaddr)
OPAL_PATCHER_BEGIN;
int result;

opal_mem_hooks_release_hook (shmaddr, memory_patcher_get_shm_seg_size (shmaddr), false);
/* opal_mem_hooks_release_hook should probably be updated to take a const void *.
* for now just cast away the const */
opal_mem_hooks_release_hook ((void *) shmaddr, memory_patcher_get_shm_seg_size (shmaddr), false);

if (original_shmdt) {
result = original_shmdt (shmaddr);
Expand All @@ -393,11 +397,16 @@ static int patcher_register (void)

static int patcher_query (int *priority)
{
if (opal_patcher->patch_symbol) {
*priority = mca_memory_patcher_priority;
} else {
int rc;

rc = mca_base_framework_open (&opal_patcher_base_framework, 0);
if (OPAL_SUCCESS != rc) {
*priority = -1;
return OPAL_SUCCESS;
}

*priority = mca_memory_patcher_priority;

return OPAL_SUCCESS;
}

Expand All @@ -412,6 +421,12 @@ static int patcher_open (void)

was_executed_already = 1;

rc = opal_patcher_base_select ();
if (OPAL_SUCCESS != rc) {
mca_base_framework_close (&opal_patcher_base_framework);
return OPAL_ERR_NOT_AVAILABLE;
}

/* set memory hooks support level */
opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT);

Expand Down Expand Up @@ -459,6 +474,8 @@ static int patcher_open (void)

static int patcher_close(void)
{
mca_base_framework_close (&opal_patcher_base_framework);

/* Note that we don't need to unpatch any symbols here; the
patcher framework will take care of all of that for us. */
return OPAL_SUCCESS;
Expand Down
2 changes: 0 additions & 2 deletions opal/runtime/opal_finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "opal/mca/memchecker/base/base.h"
#include "opal/mca/memcpy/base/base.h"
#include "opal/mca/memory/base/base.h"
#include "opal/mca/patcher/base/base.h"
#include "opal/mca/backtrace/base/base.h"
#include "opal/mca/sec/base/base.h"
#include "opal/mca/timer/base/base.h"
Expand Down Expand Up @@ -148,7 +147,6 @@ opal_finalize(void)
hooks to the bowels of the mem_free code can still occur any
time between now and end of application (even post main()!) */
(void) mca_base_framework_close(&opal_memory_base_framework);
(void) mca_base_framework_close(&opal_patcher_base_framework);

/* close the memcpy framework */
(void) mca_base_framework_close(&opal_memcpy_base_framework);
Expand Down
8 changes: 0 additions & 8 deletions opal/runtime/opal_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,6 @@ opal_init(int* pargc, char*** pargv)
goto return_error;
}

if (OPAL_SUCCESS != (ret = mca_base_framework_open(&opal_patcher_base_framework, 0))) {
error = "opal_patcher_base_open";
goto return_error;
}

/* select a patcher module. if a patcher module can not be found it is not an error. */
(void) opal_patcher_base_select ();

/* open the memory manager components. Memory hooks may be
triggered before this (any time after mem_free_init(),
actually). This is a hook available for memory manager hooks
Expand Down