merging the memchecker into trunk.
This commit was SVN r17424.
This commit is contained in:
parent
357bbe00b3
commit
f5792bbda5
@ -33,6 +33,7 @@
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/attribute/attribute.h"
|
||||
#include "ompi/mca/topo/topo.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
/*
|
||||
** Table for Fortran <-> C communicator handle conversion
|
||||
@ -97,7 +98,8 @@ int ompi_comm_init(void)
|
||||
OMPI_COMM_SET_PML_ADDED(&ompi_mpi_comm_world);
|
||||
opal_pointer_array_set_item (&ompi_mpi_communicators, 0, &ompi_mpi_comm_world);
|
||||
|
||||
strncpy (ompi_mpi_comm_world.c_name, "MPI_COMM_WORLD",
|
||||
MEMCHECKER (memset (ompi_mpi_comm_world.c_name, 0, MPI_MAX_OBJECT_NAME));
|
||||
strncpy (ompi_mpi_comm_world.c_name, "MPI_COMM_WORLD",
|
||||
strlen("MPI_COMM_WORLD")+1 );
|
||||
ompi_mpi_comm_world.c_flags |= OMPI_COMM_NAMEISSET;
|
||||
ompi_mpi_comm_world.c_flags |= OMPI_COMM_INTRINSIC;
|
||||
@ -130,6 +132,7 @@ int ompi_comm_init(void)
|
||||
OMPI_COMM_SET_PML_ADDED(&ompi_mpi_comm_self);
|
||||
opal_pointer_array_set_item (&ompi_mpi_communicators, 1, &ompi_mpi_comm_self);
|
||||
|
||||
MEMCHECKER (memset (ompi_mpi_comm_self.c_name, 0, MPI_MAX_OBJECT_NAME));
|
||||
strncpy(ompi_mpi_comm_self.c_name,"MPI_COMM_SELF",strlen("MPI_COMM_SELF")+1);
|
||||
ompi_mpi_comm_self.c_flags |= OMPI_COMM_NAMEISSET;
|
||||
ompi_mpi_comm_self.c_flags |= OMPI_COMM_INTRINSIC;
|
||||
@ -138,7 +141,7 @@ int ompi_comm_init(void)
|
||||
predefined attributes. If a user defines an attribute on
|
||||
MPI_COMM_SELF, the keyhash will automatically be created. */
|
||||
ompi_mpi_comm_self.c_keyhash = NULL;
|
||||
|
||||
|
||||
/* Setup MPI_COMM_NULL */
|
||||
OBJ_CONSTRUCT(&ompi_mpi_comm_null, ompi_communicator_t);
|
||||
ompi_mpi_comm_null.c_local_group = &ompi_mpi_group_null;
|
||||
@ -154,6 +157,7 @@ int ompi_comm_init(void)
|
||||
OBJ_RETAIN( &ompi_mpi_errors_are_fatal );
|
||||
opal_pointer_array_set_item (&ompi_mpi_communicators, 2, &ompi_mpi_comm_null);
|
||||
|
||||
MEMCHECKER (memset (ompi_mpi_comm_null.c_name, 0, MPI_MAX_OBJECT_NAME));
|
||||
strncpy(ompi_mpi_comm_null.c_name,"MPI_COMM_NULL",strlen("MPI_COMM_NULL")+1);
|
||||
ompi_mpi_comm_null.c_flags |= OMPI_COMM_NAMEISSET;
|
||||
ompi_mpi_comm_null.c_flags |= OMPI_COMM_INTRINSIC;
|
||||
|
409
ompi/include/ompi/memchecker.h
Normal file
409
ompi/include/ompi/memchecker.h
Normal file
@ -0,0 +1,409 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef OMPI_MEMCHECKER_H
|
||||
#define OMPI_MEMCHECKER_H
|
||||
|
||||
#include "ompi_config.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
#include "ompi/group/group.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/request/request.h"
|
||||
#include "opal/mca/memchecker/base/base.h"
|
||||
#include "valgrind/valgrind.h"
|
||||
|
||||
#if OMPI_WANT_MEMCHECKER
|
||||
# define MEMCHECKER(x) do { \
|
||||
if(RUNNING_ON_VALGRIND){ \
|
||||
x; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
# define MEMCHECKER(x)
|
||||
#endif /* OMPI_WANT_MEMCHECKER */
|
||||
|
||||
/*
|
||||
* Set the corresponding memory area of count elements of type ty
|
||||
*
|
||||
*/
|
||||
static inline int memchecker_call (int (*f)(void *, size_t), void * p, size_t count, MPI_Datatype type)
|
||||
{
|
||||
int num_ints, num_adds, num_dtypes, i, combiner;
|
||||
int *array_of_ints;
|
||||
size_t j;
|
||||
MPI_Aint *array_of_adds;
|
||||
MPI_Datatype *array_of_dtypes;
|
||||
|
||||
if (ompi_ddt_is_contiguous_memory_layout(type, count)) {
|
||||
f(p, count * (type->true_ub - type->true_lb));
|
||||
} else {
|
||||
char * tmp = (char *)p;
|
||||
int disp;
|
||||
|
||||
MPI_Type_get_envelope(type, &num_ints, &num_adds, &num_dtypes, &combiner);
|
||||
|
||||
array_of_ints = (int *)malloc( num_ints * sizeof(int) );
|
||||
array_of_adds = (MPI_Aint *)malloc( num_adds * sizeof(MPI_Aint) );
|
||||
array_of_dtypes = (MPI_Datatype *)malloc( num_dtypes * sizeof(MPI_Datatype) );
|
||||
|
||||
MPI_Type_get_contents( type, num_ints, num_adds, num_dtypes,
|
||||
array_of_ints, array_of_adds, array_of_dtypes );
|
||||
|
||||
switch(combiner) {
|
||||
case MPI_COMBINER_NAMED:
|
||||
case MPI_COMBINER_CONTIGUOUS:
|
||||
/* the program never runs through here! */
|
||||
return 0;
|
||||
break;
|
||||
case MPI_COMBINER_VECTOR:
|
||||
/* Take care of datatypes created by MPI_Type_vector().
|
||||
|
||||
array_of_dtypes[0] : oldtype
|
||||
array_of_ints[0] : block_count, number of blocks
|
||||
array_of_ints[1] : block_len, number of elements in each block
|
||||
array_of_ints[2] : stride, integer
|
||||
*/
|
||||
for (j=0; j<count; j++) {
|
||||
for (i=0; i<array_of_ints[0]; i++) {
|
||||
/* disp = block_size * ( stride + block_len ) * block_count */
|
||||
disp = (array_of_dtypes[0]->true_ub-array_of_dtypes[0]->true_lb)*(array_of_ints[2]+array_of_ints[1])*i;
|
||||
memchecker_call(f, tmp + disp,
|
||||
array_of_ints[1], array_of_dtypes[0]);
|
||||
}
|
||||
tmp += (type->true_ub - type->true_lb);
|
||||
}
|
||||
break;
|
||||
case MPI_COMBINER_HVECTOR_INTEGER:
|
||||
case MPI_COMBINER_HVECTOR:
|
||||
/* Take care of datatypes created by MPI_Type_hvector().
|
||||
|
||||
array_of_dtypes[0] : oldtype
|
||||
array_of_ints[0] : block_count, number of blocks
|
||||
array_of_ints[1] : block_len, number of elements in each block
|
||||
array_of_adds[0] : stride, bytes
|
||||
*/
|
||||
for (j=0; j<count; j++) {
|
||||
for (i=0; i<array_of_ints[0]; i++) {
|
||||
/* disp = stride * block_count */
|
||||
disp = array_of_adds[0]*i;
|
||||
memchecker_call(f, tmp + disp,
|
||||
array_of_ints[1], array_of_dtypes[0]);
|
||||
}
|
||||
tmp += (type->true_ub - type->true_lb);
|
||||
}
|
||||
break;
|
||||
case MPI_COMBINER_INDEXED:
|
||||
/* Take care of datatypes created by MPI_Type_indexed().
|
||||
|
||||
array_of_dtypes[0] : oldtype
|
||||
array_of_ints[0] : block_count, number of blocks
|
||||
array_of_ints[1...block_count+1] : block_len, number of elements in each block
|
||||
array_of_ints[block_count...2*block_count] : displacement, array of integer
|
||||
*/
|
||||
for (j=0; j<count; j++) {
|
||||
for (i=0; i<array_of_ints[0]; i++) {
|
||||
/* disp = disp_int * block_ex */
|
||||
disp = array_of_ints[i+array_of_ints[0]+1] * (array_of_dtypes[0]->true_ub - array_of_dtypes[0]->true_lb);
|
||||
memchecker_call(f, tmp + disp, array_of_ints[i+1], array_of_dtypes[0]);
|
||||
}
|
||||
tmp += (type->true_ub - type->true_lb);
|
||||
}
|
||||
break;
|
||||
case MPI_COMBINER_HINDEXED_INTEGER:
|
||||
case MPI_COMBINER_HINDEXED:
|
||||
/* Take care of datatypes created by MPI_Type_hindexed().
|
||||
|
||||
array_of_dtypes[0] : oldtype
|
||||
array_of_ints[0] : block_count, number of blocks
|
||||
array_of_ints[1...block_count+1] : block_len, number of elements in each block
|
||||
array_of_adds[0...block_count] : bytes displacement, array of integer
|
||||
*/
|
||||
for (j=0; j<count; j++) {
|
||||
for (i=0; i<array_of_ints[0]; i++) {
|
||||
memchecker_call(f, tmp + array_of_adds[i], array_of_ints[i+1], array_of_dtypes[0]);
|
||||
}
|
||||
tmp += (type->true_ub - type->true_lb);
|
||||
}
|
||||
break;
|
||||
case MPI_COMBINER_INDEXED_BLOCK:
|
||||
/* Take care of datatypes created by MPI_Type_create_hindexed_block().
|
||||
|
||||
array_of_dtypes[0] : oldtype
|
||||
array_of_ints[0] : block_count, number of blocks
|
||||
array_of_ints[1] : block_len, number of elements in each block
|
||||
array_of_ints[2...block_count+2] : displacement, array of integer
|
||||
*/
|
||||
for (j=0; j<count; j++) {
|
||||
for (i=0; i<array_of_ints[0]; i++) {
|
||||
/* disp = disp_int * block_ex */
|
||||
disp = array_of_ints[i+2] * (array_of_dtypes[0]->true_ub - array_of_dtypes[0]->true_lb);
|
||||
memchecker_call(f, tmp, array_of_ints[1], array_of_dtypes[0]);
|
||||
}
|
||||
tmp += (type->true_ub - type->true_lb);
|
||||
}
|
||||
break;
|
||||
case MPI_COMBINER_STRUCT_INTEGER:
|
||||
case MPI_COMBINER_STRUCT:
|
||||
/* Take care of datatypes created by MPI_Type_struct().
|
||||
|
||||
array_of_dtypes[0] : oldtype
|
||||
array_of_ints[0] : block_count, number of blocks
|
||||
array_of_ints[1...block_count+1] : block_len, number of elements in each block
|
||||
array_of_adds[0...block_count] : bytes displacement, array of integer
|
||||
*/
|
||||
for (j=0; j<count; j++) {
|
||||
for (i=0; i<array_of_ints[0]; i++) {
|
||||
memchecker_call(f, tmp + array_of_adds[i], array_of_ints[i+1], array_of_dtypes[i]);
|
||||
}
|
||||
tmp += (type->true_ub - type->true_lb);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf( "ERROR:Unrecognized combiner type!\n" );
|
||||
}
|
||||
|
||||
free( array_of_ints );
|
||||
free( array_of_adds );
|
||||
free( array_of_dtypes );
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Flag: OMPI_WANT_MEMCHECKER_MPI_OBJECTS
|
||||
*
|
||||
* If set, definedness of Open MPI-internal objects is being checked.
|
||||
* To handle alignment, only the used members of structures are
|
||||
* being used -- therefore this depends on the corresponding
|
||||
* configure-flags.
|
||||
*
|
||||
* This is off by default, as this is rather expensive (for each member
|
||||
* the valgrind-magic is being inlined.
|
||||
* Only turn on, if You want to debug ompi-internal datastructures.
|
||||
*/
|
||||
/*#define OMPI_WANT_MEMCHECKER_MPI_OBJECTS*/
|
||||
|
||||
|
||||
/*
|
||||
* Check every member of the communicator, whether their memory areas are defined.
|
||||
*/
|
||||
#ifdef OMPI_WANT_MEMCHECKER_MPI_OBJECTS
|
||||
static inline int memchecker_comm(MPI_Comm comm)
|
||||
{
|
||||
/*
|
||||
* We should not check unterlying objects in this way -- either another opal/include/memchecker.h
|
||||
* However, let us assume, that underlying objects are initialized correctly
|
||||
*/
|
||||
#if 0
|
||||
/* c_base */
|
||||
opal_memchecker_base_isdefined (&comm->c_base.obj_class, sizeof(opal_class_t *));
|
||||
opal_memchecker_base_isdefined ((void*)&comm->c_base.obj_reference_count, sizeof(volatile int32_t));
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
opal_memchecker_base_isdefined (&comm->c_base.obj_magic_id, sizeof(opal_object_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_base.cls_init_file_name, sizeof(const char *));
|
||||
opal_memchecker_base_isdefined (&comm->c_base.cls_init_lineno, sizeof(int));
|
||||
#endif
|
||||
/* c_lock */
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.super.obj_class, sizeof(opal_class_t *));
|
||||
opal_memchecker_base_isdefined ((void*)&comm->c_lock.super.obj_reference_count, sizeof(volatile int32_t));
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.super.obj_magic_id, sizeof(uint64_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.super.cls_init_file_name, sizeof(const char *));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.super.cls_init_lineno, sizeof(int));
|
||||
#endif
|
||||
#if OMPI_HAVE_POSIX_THREADS
|
||||
/*
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_reserved, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_count, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_owner, sizeof(_pthread_descr));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_kind, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_lock.__status, sizeof(long int));
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_lock.__spinlock, sizeof(int));
|
||||
*/
|
||||
#endif
|
||||
#if OMPI_HAVE_SOLARIS_THREADS
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_solaris, sizeof(mutex_t));
|
||||
#endif
|
||||
/*
|
||||
* The storage of a union has the size of the initialized member.
|
||||
* Here we check the whole union.
|
||||
*/
|
||||
opal_memchecker_base_isdefined (&comm->c_lock.m_lock_atomic, sizeof(opal_atomic_lock_t));
|
||||
#endif /* 0 */
|
||||
opal_memchecker_base_isdefined (&comm->c_name, MPI_MAX_OBJECT_NAME);
|
||||
opal_memchecker_base_isdefined (&comm->c_my_rank, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_flags, sizeof(uint32_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_id_available, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_id_start_index, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_local_group, sizeof(ompi_group_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_remote_group, sizeof(ompi_group_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_keyhash, sizeof(struct opal_hash_table_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_cube_dim, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&comm->c_topo_component, sizeof(mca_base_component_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_topo, sizeof(const struct mca_topo_base_module_1_0_0_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_topo_comm, sizeof(struct mca_topo_base_comm_1_0_0_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_topo_module, sizeof(struct mca_topo_base_module_comm_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_f_to_c_index, sizeof(int));
|
||||
#ifdef OMPI_WANT_PERUSE
|
||||
opal_memchecker_base_isdefined (&comm->c_peruse_handles, sizeof(struct ompi_peruse_handle_t **));
|
||||
#endif
|
||||
opal_memchecker_base_isdefined (&comm->error_handler, sizeof(ompi_errhandler_t *));
|
||||
opal_memchecker_base_isdefined (&comm->errhandler_type, sizeof(ompi_errhandler_type_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_pml_comm, sizeof(struct mca_pml_comm_t *));
|
||||
/* c_coll */
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_module_init, sizeof(mca_coll_base_module_init_1_0_0_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_module_finalize, sizeof(mca_coll_base_module_finalize_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_allgather, sizeof(mca_coll_base_module_allgather_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_allgatherv, sizeof(mca_coll_base_module_allgatherv_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_allreduce, sizeof(mca_coll_base_module_allreduce_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_alltoall, sizeof(mca_coll_base_module_alltoall_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_alltoallv, sizeof(mca_coll_base_module_alltoallv_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_alltoallw, sizeof(mca_coll_base_module_alltoallw_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_barrier, sizeof(mca_coll_base_module_barrier_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_bcast, sizeof(mca_coll_base_module_bcast_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_exscan, sizeof(mca_coll_base_module_exscan_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_gather, sizeof(mca_coll_base_module_gather_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_gatherv, sizeof(mca_coll_base_module_gatherv_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_reduce, sizeof(mca_coll_base_module_reduce_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_reduce_scatter, sizeof(mca_coll_base_module_reduce_scatter_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_scan, sizeof(mca_coll_base_module_scan_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_scatter, sizeof(mca_coll_base_module_scatter_fn_t));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll.coll_scatterv, sizeof(mca_coll_base_module_scatterv_fn_t));
|
||||
|
||||
opal_memchecker_base_isdefined (&comm->c_coll_selected_component, sizeof(const mca_coll_base_component_1_0_0_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll_selected_module, sizeof(const mca_coll_base_module_1_0_0_t *));
|
||||
/* Somehow, this often shows up in petsc with comm_dup'ed communicators*/
|
||||
/* opal_memchecker_base_isdefined (&comm->c_coll_selected_data, sizeof(struct mca_coll_base_comm_t *)); */
|
||||
opal_memchecker_base_isdefined (&comm->c_coll_basic_module, sizeof(const mca_coll_base_module_1_0_0_t *));
|
||||
opal_memchecker_base_isdefined (&comm->c_coll_basic_data, sizeof(struct mca_coll_base_comm_t *));
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
#else
|
||||
#define memchecker_comm(comm)
|
||||
#endif /* OMPI_WANT_MEMCHECKER_MPI_OBJECTS */
|
||||
|
||||
|
||||
/*
|
||||
* Check every member of the request, whether their memory areas are defined.
|
||||
*/
|
||||
#ifdef OMPI_WANT_MEMCHECKER_MPI_OBJECTS
|
||||
static inline int memchecker_request(MPI_Request *request)
|
||||
{
|
||||
#if 0
|
||||
opal_memchecker_base_isdefined (&(*request)->super.super.super.obj_class, sizeof(opal_class_t *));
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->super.super.super.obj_reference_count, sizeof(volatile int32_t));
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
opal_memchecker_base_isdefined (&(*request)->super.super.super.obj_magic_id, sizeof(uint64_t));
|
||||
opal_memchecker_base_isdefined (&(*request)->super.super.super.cls_init_file_name, sizeof(const char *));
|
||||
opal_memchecker_base_isdefined (&(*request)->super.super.super.cls_init_lineno, sizeof(int));
|
||||
#endif
|
||||
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->super.super.opal_list_next, sizeof(volatile struct opal_list_item_t *));
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->super.super.opal_list_prev, sizeof(volatile struct opal_list_item_t *));
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->super.super.opal_list_item_refcount, sizeof(volatile int32_t));
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->super.super.opal_list_item_belong_to, sizeof(volatile struct opal_list_t *));
|
||||
#endif
|
||||
/* opal_memchecker_base_isdefined (&(*request)->super.user_data, sizeof(void *)); */
|
||||
#endif /* 0 */
|
||||
opal_memchecker_base_isdefined (&(*request)->req_type, sizeof(ompi_request_type_t));
|
||||
/* req_status */
|
||||
#if 0
|
||||
/* We do never initialize the req_status in the creation functions,
|
||||
* they are just used to transport values back up....
|
||||
*/
|
||||
opal_memchecker_base_isdefined (&(*request)->req_status.MPI_SOURCE, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_status.MPI_TAG, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_status.MPI_ERROR, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_status._count, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_status._cancelled, sizeof(int));
|
||||
#endif
|
||||
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->req_complete, sizeof(volatile _Bool));
|
||||
opal_memchecker_base_isdefined ((void*)&(*request)->req_state, sizeof(volatile ompi_request_state_t));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_persistent, sizeof(_Bool));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_f_to_c_index, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_free, sizeof(ompi_request_free_fn_t));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_cancel, sizeof(ompi_request_cancel_fn_t));
|
||||
/* req_mpi_object */
|
||||
opal_memchecker_base_isdefined (&(*request)->req_mpi_object.comm, sizeof(struct ompi_communicator_t *));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_mpi_object.file, sizeof(struct ompi_file_t *));
|
||||
opal_memchecker_base_isdefined (&(*request)->req_mpi_object.win, sizeof(struct ompi_win_t *));
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
#else
|
||||
#define memchecker_request(request)
|
||||
#endif /* OMPI_WANT_MEMCHECKER_MPI_OBJECTS */
|
||||
|
||||
|
||||
/*
|
||||
* Check every member of the status, whether their memory areas are defined.
|
||||
*/
|
||||
#ifdef OMPI_WANT_MEMCHECKER_MPI_OBJECTS
|
||||
static inline int memchecker_status(MPI_Status *status)
|
||||
{
|
||||
opal_memchecker_base_isdefined (&status->MPI_SOURCE, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&status->MPI_TAG, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&status->MPI_ERROR, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&status->_count, sizeof(int));
|
||||
opal_memchecker_base_isdefined (&status->_cancelled, sizeof(int));
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
#else
|
||||
#define memchecker_status(status)
|
||||
#endif /* OMPI_WANT_MEMCHECKER_MPI_OBJECTS */
|
||||
|
||||
|
||||
/*
|
||||
* Check every member of the datatype, whether their memory areas are defined.
|
||||
*/
|
||||
#ifdef OMPI_WANT_MEMCHECKER_MPI_OBJECTS
|
||||
static inline int memchecker_datatype(MPI_Datatype type)
|
||||
{
|
||||
/* the data description.*/
|
||||
opal_memchecker_base_isdefined (&type->size, sizeof(size_t));
|
||||
opal_memchecker_base_isdefined (&type->align, sizeof(uint32_t));
|
||||
opal_memchecker_base_isdefined (&type->true_lb, sizeof(ptrdiff_t));
|
||||
opal_memchecker_base_isdefined (&type->true_ub, sizeof(ptrdiff_t));
|
||||
opal_memchecker_base_isdefined (&type->lb, sizeof(ptrdiff_t));
|
||||
opal_memchecker_base_isdefined (&type->ub, sizeof(ptrdiff_t));
|
||||
opal_memchecker_base_isdefined (&type->flags, sizeof(uint16_t));
|
||||
opal_memchecker_base_isdefined (&type->id, sizeof(uint16_t));
|
||||
opal_memchecker_base_isdefined (&type->nbElems, sizeof(uint32_t));
|
||||
opal_memchecker_base_isdefined (&type->bdt_used, sizeof(uint64_t));
|
||||
|
||||
/* Attribute fields */
|
||||
opal_memchecker_base_isdefined (&type->d_keyhash, sizeof(opal_hash_table_t *));
|
||||
opal_memchecker_base_isdefined (&type->d_f_to_c_index, sizeof(int32_t));
|
||||
opal_memchecker_base_isdefined (&type->name, sizeof(char [64]));
|
||||
opal_memchecker_base_isdefined (&type->desc.length, sizeof(opal_ddt_count_t));
|
||||
opal_memchecker_base_isdefined (&type->desc.used, sizeof(opal_ddt_count_t));
|
||||
opal_memchecker_base_isdefined (&type->desc.desc, sizeof(dt_elem_desc_t *));
|
||||
opal_memchecker_base_isdefined (&type->opt_desc.length, sizeof(opal_ddt_count_t));
|
||||
opal_memchecker_base_isdefined (&type->opt_desc.used, sizeof(opal_ddt_count_t));
|
||||
opal_memchecker_base_isdefined (&type->opt_desc.desc, sizeof(dt_elem_desc_t *));
|
||||
opal_memchecker_base_isdefined (&type->args, sizeof(void *));
|
||||
opal_memchecker_base_isdefined (&type->packed_description, sizeof(void *));
|
||||
opal_memchecker_base_isdefined (&type->btypes, sizeof(uint32_t [42]));
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
#else
|
||||
#define memchecker_datatype(type)
|
||||
#endif /* OMPI_WANT_MEMCHECKER_MPI_OBJECTS */
|
||||
|
||||
#endif /* OMPI_MEMCHECKER_H */
|
@ -35,6 +35,7 @@
|
||||
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
#include "ompi/datatype/dt_arch.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
static int component_open(void);
|
||||
static void component_fragment_cb(ompi_osc_pt2pt_mpireq_t *mpireq);
|
||||
@ -671,7 +672,14 @@ component_fragment_cb(ompi_osc_pt2pt_mpireq_t *mpireq)
|
||||
opal_output_verbose(5, ompi_osc_base_output,
|
||||
"received one-sided packet for with unknown type");
|
||||
}
|
||||
|
||||
/*
|
||||
* Now, all communications have finished,
|
||||
* time to make user window/buffer accessable again.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined( module->p2p_win->w_baseptr, module->p2p_win->w_size );
|
||||
);
|
||||
|
||||
ret = MCA_PML_CALL(irecv(buffer->payload,
|
||||
mca_osc_pt2pt_component.p2p_c_eager_size,
|
||||
MPI_BYTE,
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "ompi/datatype/dt_arch.h"
|
||||
#include "ompi/mca/osc/base/base.h"
|
||||
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
|
||||
static inline int32_t
|
||||
@ -233,9 +234,14 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module,
|
||||
|
||||
iov.iov_len = max_data;
|
||||
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*) buffer->payload + written_data);
|
||||
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined((void *)sendreq->req_origin_convertor.pBaseBuf, sendreq->req_origin_convertor.local_size);
|
||||
);
|
||||
ret = ompi_convertor_pack(&sendreq->req_origin_convertor, &iov, &iov_count,
|
||||
&max_data );
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_noaccess((void *)sendreq->req_origin_convertor.pBaseBuf, sendreq->req_origin_convertor.local_size);
|
||||
);
|
||||
if (ret < 0) {
|
||||
ret = OMPI_ERR_FATAL;
|
||||
goto cleanup;
|
||||
@ -269,7 +275,10 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module,
|
||||
"%d sending sendreq to %d",
|
||||
ompi_comm_rank(sendreq->req_module->p2p_comm),
|
||||
sendreq->req_target_rank));
|
||||
|
||||
/* This might not be necessary. */
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_noaccess(buffer->payload, buffer->len);
|
||||
);
|
||||
ret = MCA_PML_CALL(isend(buffer->payload,
|
||||
buffer->len,
|
||||
MPI_BYTE,
|
||||
@ -278,6 +287,10 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module,
|
||||
MCA_PML_BASE_SEND_STANDARD,
|
||||
module->p2p_comm,
|
||||
&buffer->mpireq.request));
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined(buffer->payload, buffer->len);
|
||||
);
|
||||
|
||||
OPAL_THREAD_LOCK(&mca_osc_pt2pt_component.p2p_c_lock);
|
||||
opal_list_append(&mca_osc_pt2pt_component.p2p_c_pending_requests,
|
||||
&buffer->mpireq.super.super);
|
||||
@ -321,6 +334,14 @@ ompi_osc_pt2pt_sendreq_send(ompi_osc_pt2pt_module_t *module,
|
||||
}
|
||||
|
||||
done:
|
||||
/* Finished using original window/buffer, set it accessable. */
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
sendreq->req_origin_convertor.pBaseBuf,
|
||||
sendreq->req_origin_convertor.count,
|
||||
sendreq->req_origin_datatype);
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -420,9 +441,20 @@ ompi_osc_pt2pt_replyreq_send(ompi_osc_pt2pt_module_t *module,
|
||||
|
||||
iov.iov_len = max_data;
|
||||
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*) buffer->payload + written_data);
|
||||
|
||||
/*
|
||||
* Before copy to the target buffer, make the target part
|
||||
* accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined((void *)replyreq->rep_target_convertor.pBaseBuf, replyreq->rep_target_convertor.local_size);
|
||||
);
|
||||
ret = ompi_convertor_pack(&replyreq->rep_target_convertor, &iov, &iov_count,
|
||||
&max_data );
|
||||
/* Copy finished, make the target buffer unaccessable. */
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_noaccess((void *)replyreq->rep_target_convertor.pBaseBuf, replyreq->rep_target_convertor.local_size);
|
||||
);
|
||||
|
||||
if (ret < 0) {
|
||||
ret = OMPI_ERR_FATAL;
|
||||
goto cleanup;
|
||||
@ -554,10 +586,21 @@ ompi_osc_pt2pt_sendreq_recv_put(ompi_osc_pt2pt_module_t *module,
|
||||
iov.iov_len = header->hdr_msg_length;
|
||||
iov.iov_base = (IOVBASE_TYPE*)inbuf;
|
||||
max_data = iov.iov_len;
|
||||
/*
|
||||
* Before copy to the user buffer, make the target part
|
||||
* accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined( convertor.pBaseBuf, convertor.local_size );
|
||||
);
|
||||
ompi_convertor_unpack(&convertor,
|
||||
&iov,
|
||||
&iov_count,
|
||||
&max_data );
|
||||
/* Copy finished, make the user buffer unaccessable. */
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_noaccess( convertor.pBaseBuf, convertor.local_size );
|
||||
);
|
||||
OBJ_DESTRUCT(&convertor);
|
||||
OBJ_RELEASE(datatype);
|
||||
inmsg_mark_complete(module);
|
||||
@ -635,7 +678,14 @@ ompi_osc_pt2pt_sendreq_recv_accum_long_cb(ompi_osc_pt2pt_mpireq_t *mpireq)
|
||||
&iov_count,
|
||||
&max_data);
|
||||
OBJ_DESTRUCT(&convertor);
|
||||
} else {
|
||||
} else {
|
||||
/*
|
||||
* Before copy to the user buffer, make the target part
|
||||
* accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined( target, header->hdr_msg_length );
|
||||
);
|
||||
/* copy the data from the temporary buffer into the user window */
|
||||
ret = ompi_osc_base_process_op(target,
|
||||
payload,
|
||||
@ -643,6 +693,10 @@ ompi_osc_pt2pt_sendreq_recv_accum_long_cb(ompi_osc_pt2pt_mpireq_t *mpireq)
|
||||
longreq->req_datatype,
|
||||
header->hdr_target_count,
|
||||
longreq->req_op);
|
||||
/* Copy finished, make the user buffer unaccessable. */
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_noaccess( target, header->hdr_msg_length );
|
||||
);
|
||||
}
|
||||
|
||||
/* unlock the window for accumulates */
|
||||
@ -761,6 +815,13 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module,
|
||||
#else
|
||||
buffer = payload;
|
||||
#endif
|
||||
/*
|
||||
* Before copy to the user buffer, make the target part
|
||||
* accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined( target, header->hdr_msg_length );
|
||||
);
|
||||
/* copy the data from the temporary buffer into the user window */
|
||||
ret = ompi_osc_base_process_op(target,
|
||||
buffer,
|
||||
@ -768,6 +829,10 @@ ompi_osc_pt2pt_sendreq_recv_accum(ompi_osc_pt2pt_module_t *module,
|
||||
datatype,
|
||||
header->hdr_target_count,
|
||||
op);
|
||||
/* Copy finished, make the user buffer unaccessable. */
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_noaccess( target, header->hdr_msg_length );
|
||||
);
|
||||
|
||||
#if OMPI_ENABLE_HETEROGENEOUS_SUPPORT
|
||||
if (proc->proc_arch != ompi_proc_local()->proc_arch) {
|
||||
@ -889,11 +954,23 @@ ompi_osc_pt2pt_replyreq_recv(ompi_osc_pt2pt_module_t *module,
|
||||
iov.iov_len = header->hdr_msg_length;
|
||||
iov.iov_base = (IOVBASE_TYPE*)payload;
|
||||
max_data = iov.iov_len;
|
||||
/*
|
||||
* Before copy to the target buffer, make the target part
|
||||
* accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
opal_memchecker_base_mem_defined(sendreq->req_origin_convertor.pBaseBuf, sendreq->req_origin_convertor.local_size);
|
||||
);
|
||||
ompi_convertor_unpack(&sendreq->req_origin_convertor,
|
||||
&iov,
|
||||
&iov_count,
|
||||
&max_data );
|
||||
|
||||
/*
|
||||
* Copy finished, make the target buffer unaccessable.(Or just leave it accessable?)
|
||||
*/
|
||||
MEMCHECKER(
|
||||
/*opal_memchecker_base_mem_noaccess(sendreq->req_origin_convertor.pBaseBuf, sendreq->req_origin_convertor.local_size);*/
|
||||
);
|
||||
|
||||
OPAL_THREAD_LOCK(&module->p2p_lock);
|
||||
count = (sendreq->req_module->p2p_num_pending_out -= 1);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -25,6 +25,7 @@
|
||||
#include "ompi/class/ompi_free_list.h"
|
||||
#include "ompi/request/request.h"
|
||||
#include "ompi/datatype/convertor.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
@ -75,6 +76,15 @@ typedef struct mca_pml_base_request_t mca_pml_base_request_t;
|
||||
|
||||
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_pml_base_request_t);
|
||||
|
||||
static inline void MCA_PML_BASE_REQUEST_MEMCHECKER_DEFINED(mca_pml_base_request_t * req) {
|
||||
#if OMPI_WANT_MEMCHECKER
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
req->req_addr,
|
||||
req->req_count,
|
||||
req->req_datatype);
|
||||
#endif
|
||||
}
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -30,6 +30,7 @@
|
||||
#include "ompi/mca/bml/base/base.h"
|
||||
#include "orte/mca/errmgr/errmgr.h"
|
||||
#include "ompi/datatype/dt_arch.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
void mca_pml_ob1_recv_request_process_pending(void)
|
||||
{
|
||||
@ -67,7 +68,15 @@ static int mca_pml_ob1_recv_request_free(struct ompi_request_t** request)
|
||||
}
|
||||
|
||||
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
||||
|
||||
/*
|
||||
* Package successfully received, make user buffer accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
recvreq->req_recv.req_base.req_addr,
|
||||
recvreq->req_recv.req_base.req_count,
|
||||
recvreq->req_recv.req_base.req_datatype);
|
||||
);
|
||||
*request = MPI_REQUEST_NULL;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
@ -78,9 +87,18 @@ static int mca_pml_ob1_recv_request_cancel(struct ompi_request_t* ompi_request,
|
||||
mca_pml_ob1_comm_t* comm = request->req_recv.req_base.req_comm->c_pml_comm;
|
||||
|
||||
if( true == ompi_request->req_complete ) { /* way to late to cancel this one */
|
||||
return OMPI_SUCCESS;
|
||||
/*
|
||||
* Receive request completed, make user buffer accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
request->req_recv.req_base.req_addr,
|
||||
request->req_recv.req_base.req_count,
|
||||
request->req_recv.req_base.req_datatype);
|
||||
);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* The rest should be protected behind the match logic lock */
|
||||
OPAL_THREAD_LOCK(&comm->matching_lock);
|
||||
if( OMPI_ANY_TAG == ompi_request->req_status.MPI_TAG ) { /* the match has not been already done */
|
||||
@ -108,6 +126,15 @@ static int mca_pml_ob1_recv_request_cancel(struct ompi_request_t* ompi_request,
|
||||
*/
|
||||
MCA_PML_OB1_RECV_REQUEST_MPI_COMPLETE(request);
|
||||
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
||||
/*
|
||||
* Receive request cancelled, make user buffer accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
request->req_recv.req_base.req_addr,
|
||||
request->req_recv.req_base.req_count,
|
||||
request->req_recv.req_base.req_datatype);
|
||||
);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -457,6 +484,15 @@ void mca_pml_ob1_recv_request_progress( mca_pml_ob1_recv_request_t* recvreq,
|
||||
bytes_received -= sizeof(mca_pml_ob1_match_hdr_t);
|
||||
recvreq->req_recv.req_bytes_packed = bytes_received;
|
||||
MCA_PML_OB1_RECV_REQUEST_MATCHED(recvreq,&hdr->hdr_match);
|
||||
/*
|
||||
* Make user buffer accessable(defined) before unpacking.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
recvreq->req_recv.req_base.req_addr,
|
||||
recvreq->req_recv.req_base.req_count,
|
||||
recvreq->req_recv.req_base.req_datatype);
|
||||
);
|
||||
MCA_PML_OB1_RECV_REQUEST_UNPACK( recvreq,
|
||||
segments,
|
||||
num_segments,
|
||||
@ -464,6 +500,17 @@ void mca_pml_ob1_recv_request_progress( mca_pml_ob1_recv_request_t* recvreq,
|
||||
data_offset,
|
||||
bytes_received,
|
||||
bytes_delivered);
|
||||
/*
|
||||
* Unpacking finished, make the user buffer unaccessable again.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_noaccess,
|
||||
recvreq->req_recv.req_base.req_addr,
|
||||
recvreq->req_recv.req_base.req_count,
|
||||
recvreq->req_recv.req_base.req_datatype);
|
||||
);
|
||||
recvreq->req_match_received = true;
|
||||
opal_atomic_wmb();
|
||||
break;
|
||||
|
||||
case MCA_PML_OB1_HDR_TYPE_RNDV:
|
||||
@ -499,7 +546,16 @@ void mca_pml_ob1_recv_request_progress( mca_pml_ob1_recv_request_t* recvreq,
|
||||
|
||||
case MCA_PML_OB1_HDR_TYPE_FRAG:
|
||||
bytes_received -= sizeof(mca_pml_ob1_frag_hdr_t);
|
||||
data_offset = hdr->hdr_frag.hdr_frag_offset;
|
||||
data_offset = hdr->hdr_frag.hdr_frag_offset;
|
||||
/*
|
||||
* Make user buffer accessable(defined) before unpacking.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
recvreq->req_recv.req_base.req_addr,
|
||||
recvreq->req_recv.req_base.req_count,
|
||||
recvreq->req_recv.req_base.req_datatype);
|
||||
);
|
||||
MCA_PML_OB1_RECV_REQUEST_UNPACK( recvreq,
|
||||
segments,
|
||||
num_segments,
|
||||
@ -507,6 +563,15 @@ void mca_pml_ob1_recv_request_progress( mca_pml_ob1_recv_request_t* recvreq,
|
||||
data_offset,
|
||||
bytes_received,
|
||||
bytes_delivered );
|
||||
/*
|
||||
* Unpacking finished, make the user buffer unaccessable again.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_noaccess,
|
||||
recvreq->req_recv.req_base.req_addr,
|
||||
recvreq->req_recv.req_base.req_count,
|
||||
recvreq->req_recv.req_base.req_datatype);
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -16,10 +16,9 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "opal/prefetch.h"
|
||||
|
||||
#include "ompi/constants.h"
|
||||
#include "ompi/mca/pml/pml.h"
|
||||
#include "ompi/mca/btl/btl.h"
|
||||
@ -31,6 +30,7 @@
|
||||
#include "pml_ob1_rdmafrag.h"
|
||||
#include "pml_ob1_recvreq.h"
|
||||
#include "ompi/mca/bml/base/base.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
OBJ_CLASS_INSTANCE(mca_pml_ob1_send_range_t, ompi_free_list_item_t,
|
||||
NULL, NULL);
|
||||
@ -103,7 +103,7 @@ static int mca_pml_ob1_send_request_free(struct ompi_request_t** request)
|
||||
}
|
||||
|
||||
OPAL_THREAD_UNLOCK(&ompi_request_lock);
|
||||
|
||||
|
||||
*request = MPI_REQUEST_NULL;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
@ -443,11 +443,33 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq,
|
||||
/* pack the data into the supplied buffer */
|
||||
iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval +
|
||||
sizeof(mca_pml_ob1_match_hdr_t));
|
||||
iov.iov_len = size;
|
||||
iov_count = 1;
|
||||
iov.iov_len = size;
|
||||
iov_count = 1;
|
||||
/*
|
||||
* Before copy the user buffer, make the target part
|
||||
* accessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
sendreq->req_send.req_base.req_addr,
|
||||
sendreq->req_send.req_base.req_count,
|
||||
sendreq->req_send.req_base.req_datatype);
|
||||
);
|
||||
(void)ompi_convertor_pack( &sendreq->req_send.req_base.req_convertor,
|
||||
&iov, &iov_count, &max_data );
|
||||
&iov, &iov_count, &max_data );
|
||||
/*
|
||||
* Packing finished, make the user buffer unaccessable.
|
||||
*/
|
||||
MEMCHECKER(
|
||||
memchecker_call(&opal_memchecker_base_mem_defined,
|
||||
sendreq->req_send.req_base.req_addr,
|
||||
sendreq->req_send.req_base.req_count,
|
||||
sendreq->req_send.req_base.req_datatype);
|
||||
);
|
||||
|
||||
descriptor->des_cbfunc = mca_pml_ob1_match_completion_free;
|
||||
}
|
||||
|
||||
|
||||
/* build match header */
|
||||
hdr = (mca_pml_ob1_hdr_t*)segment->seg_addr.pval;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -22,6 +22,7 @@
|
||||
#include "pml_ob1.h"
|
||||
#include "pml_ob1_recvreq.h"
|
||||
#include "pml_ob1_sendreq.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
|
||||
int mca_pml_ob1_start(size_t count, ompi_request_t** requests)
|
||||
@ -106,6 +107,15 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests)
|
||||
return OMPI_ERR_REQUEST;
|
||||
}
|
||||
|
||||
/*
|
||||
* We do not distinguish on SEND or RECV-requests.
|
||||
*/
|
||||
MEMCHECKER (memchecker_call(&opal_memchecker_base_mem_noaccess,
|
||||
pml_request->req_addr,
|
||||
pml_request->req_count,
|
||||
pml_request->req_datatype));
|
||||
|
||||
|
||||
/* start the request */
|
||||
switch(pml_request->req_type) {
|
||||
case MCA_PML_REQUEST_SEND:
|
||||
@ -115,7 +125,7 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests)
|
||||
size_t offset = 0;
|
||||
/**
|
||||
* Reset the convertor in case we're dealing with the original
|
||||
* request, which when completed do not reset the convertor.
|
||||
* request, which when completed do not reset the convertor.
|
||||
*/
|
||||
ompi_convertor_set_position( &sendreq->req_send.req_base.req_convertor,
|
||||
&offset );
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
#include "ompi/communicator/communicator.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
@ -35,6 +36,10 @@ static const char FUNC_NAME[] = "MPI_Abort";
|
||||
|
||||
int MPI_Abort(MPI_Comm comm, int errorcode)
|
||||
{
|
||||
MEMCHECKER(
|
||||
memchecker_comm(comm);
|
||||
);
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
/* Don't even bother checking comm and errorcode values for
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -24,6 +24,7 @@
|
||||
#include "ompi/op/op.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/datatype/datatype_internal.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Accumulate = PMPI_Accumulate
|
||||
@ -45,6 +46,12 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
MEMCHECKER(
|
||||
memchecker_datatype(origin_datatype);
|
||||
memchecker_datatype(target_datatype);
|
||||
memchecker_call(&opal_memchecker_base_isdefined, origin_addr, origin_count, origin_datatype);
|
||||
);
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
rc = OMPI_SUCCESS;
|
||||
|
||||
@ -214,6 +221,12 @@ int MPI_Accumulate(void *origin_addr, int origin_count, MPI_Datatype origin_data
|
||||
|
||||
if (MPI_PROC_NULL == target_rank) return MPI_SUCCESS;
|
||||
|
||||
/* Set buffer to be unaccessable before sending it.
|
||||
* It's set accessable again in file osc_pt2pt_data_move. */
|
||||
MEMCHECKER (
|
||||
memchecker_call(&opal_memchecker_base_mem_noaccess, origin_addr, origin_count, origin_datatype);
|
||||
);
|
||||
|
||||
rc = ompi_win->w_osc_module->osc_accumulate(origin_addr,
|
||||
origin_count,
|
||||
origin_datatype,
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Allgather = PMPI_Allgather
|
||||
@ -35,10 +36,17 @@ static const char FUNC_NAME[] = "MPI_Allgather";
|
||||
|
||||
|
||||
int MPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
void *recvbuf, int recvcount, MPI_Datatype recvtype,
|
||||
MPI_Comm comm)
|
||||
void *recvbuf, int recvcount, MPI_Datatype recvtype,
|
||||
MPI_Comm comm)
|
||||
{
|
||||
int err;
|
||||
MEMCHECKER(
|
||||
memchecker_datatype(sendtype);
|
||||
memchecker_datatype(recvtype);
|
||||
memchecker_call(&opal_memchecker_base_isdefined, sendbuf, sendcount, sendtype);
|
||||
memchecker_comm(comm);
|
||||
);
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Allgatherv = PMPI_Allgatherv
|
||||
@ -39,6 +40,13 @@ int MPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
{
|
||||
int i, size, err;
|
||||
|
||||
MEMCHECKER(
|
||||
memchecker_datatype(sendtype);
|
||||
memchecker_datatype(recvtype);
|
||||
memchecker_call(&opal_memchecker_base_isdefined, sendbuf, sendcount, sendtype);
|
||||
memchecker_comm (comm);
|
||||
);
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -22,6 +22,7 @@
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/op/op.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Allreduce = PMPI_Allreduce
|
||||
@ -38,6 +39,12 @@ int MPI_Allreduce(void *sendbuf, void *recvbuf, int count,
|
||||
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
|
||||
{
|
||||
int err;
|
||||
MEMCHECKER(
|
||||
memchecker_datatype(datatype);
|
||||
memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
|
||||
memchecker_comm(comm);
|
||||
);
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Alltoall = PMPI_Alltoall
|
||||
@ -40,6 +41,13 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
|
||||
{
|
||||
int err;
|
||||
|
||||
MEMCHECKER(
|
||||
memchecker_datatype(sendtype);
|
||||
memchecker_datatype(recvtype);
|
||||
memchecker_call(&opal_memchecker_base_isdefined, sendbuf, sendcount, sendtype);
|
||||
memchecker_comm(comm);
|
||||
);
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "ompi/mpi/c/bindings.h"
|
||||
#include "ompi/datatype/datatype.h"
|
||||
#include "ompi/include/ompi/memchecker.h"
|
||||
|
||||
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
||||
#pragma weak MPI_Alltoallv = PMPI_Alltoallv
|
||||
@ -41,6 +42,18 @@ int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls,
|
||||
{
|
||||
int i, size, err;
|
||||
|
||||
MEMCHECKER(
|
||||
size = ompi_comm_remote_size(comm);
|
||||
|
||||
memchecker_datatype(sendtype);
|
||||
memchecker_datatype(recvtype);
|
||||
|
||||
for ( i = 0; i < size; i++ ) {
|
||||
memchecker_call(&opal_memchecker_base_isdefined, sendbuf+sdispls[i], sendcounts[i], sendtype);
|
||||
memchecker_comm(comm);
|
||||
}
|
||||
);
|
||||
|
||||
OPAL_CR_TEST_CHECKPOINT_READY();
|
||||
|
||||
if (MPI_PARAM_CHECK) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||