Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MPI_Aint_add and MPI_Aint_diff #44

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
417 changes: 212 additions & 205 deletions doc/source/developer_guide.rst

Large diffs are not rendered by default.

39 changes: 33 additions & 6 deletions src/common/override.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
//# #
//########################################################################

#ifdef MPI_WAITANY_OVERRRIDE
#include "override.h"
#include "app_mpi.h"
#include "engine.h"
#include "mappers.h"
#include "run_mpi.h"

extern __thread int in_w;

#ifdef MPI_WAITANY_OVERRIDE
int A_MPI_Waitany(int count, A_MPI_Request array_of_requests[], int *indx,
A_MPI_Status *status) {
#ifdef DEBUG
Expand Down Expand Up @@ -75,7 +83,7 @@ int A_MPI_Waitany(int count, A_MPI_Request array_of_requests[], int *indx,
}
#endif

#ifdef MPI_WAITALL_OVERRRIDE
#ifdef MPI_WAITALL_OVERRIDE
int A_MPI_Waitall(int count, A_MPI_Request array_of_requests[],
A_MPI_Status array_of_statuses[]) {
#ifdef DEBUG
Expand Down Expand Up @@ -146,7 +154,7 @@ int A_MPI_Waitall(int count, A_MPI_Request array_of_requests[],
}
#endif

#ifdef MPI_WAITSOME_OVERRRIDE
#ifdef MPI_WAITSOME_OVERRIDE
int A_MPI_Waitsome(int incount, A_MPI_Request array_of_requests[],
int *outcount, int array_of_indices[],
A_MPI_Status array_of_statuses[]) {
Expand Down Expand Up @@ -195,7 +203,7 @@ int A_MPI_Waitsome(int incount, A_MPI_Request array_of_requests[],
}
#endif

#ifdef MPI_TESTANY_OVERRRIDE
#ifdef MPI_TESTANY_OVERRIDE
int A_MPI_Testany(int count, A_MPI_Request array_of_requests[], int *indx,
int *flag, A_MPI_Status *status) {
#ifdef DEBUG
Expand Down Expand Up @@ -231,7 +239,7 @@ int A_MPI_Testany(int count, A_MPI_Request array_of_requests[], int *indx,
}
#endif

#ifdef MPI_TESTALL_OVERRRIDE
#ifdef MPI_TESTALL_OVERRIDE
int A_MPI_Testall(int count, A_MPI_Request array_of_requests[], int *flag,
A_MPI_Status array_of_statuses[]) {
#ifdef DEBUG
Expand Down Expand Up @@ -280,7 +288,7 @@ int A_MPI_Testall(int count, A_MPI_Request array_of_requests[], int *flag,
}
#endif

#ifdef MPI_TESTSOME_OVERRRIDE
#ifdef MPI_TESTSOME_OVERRIDE
int A_MPI_Testsome(int incount, A_MPI_Request array_of_requests[],
int *outcount, int array_of_indices[],
A_MPI_Status array_of_statuses[]) {
Expand Down Expand Up @@ -328,3 +336,22 @@ int A_MPI_Testsome(int incount, A_MPI_Request array_of_requests[],
return error_code_conv_r2a(ret_tmp);
}
#endif

#ifdef MPI_AINT_ADD_OVERRIDE
A_MPI_Aint A_MPI_Aint_add(A_MPI_Aint lhs, A_MPI_Aint rhs) {
// The MPI 3.1 addition MPI_Aint_add is defined in MPICH as a symbol by the
// library, but is compiled as a macro by OpenMPI. This leads to an unresolved
// symbol crash when running MPICH-compiled binaries with OpenMPI.
//
// This function is meant to override the default ASM symbol chooser and
// reimplement the OpenMPI macro when running with OpenMPI as the R_MPI.

return lhs + rhs;
}
#endif

#ifdef MPI_AINT_DIFF_OVERRIDE
A_MPI_Aint A_MPI_Aint_diff(A_MPI_Aint lhs, A_MPI_Aint rhs) { // Same as above
return lhs - rhs;
}
#endif
9 changes: 3 additions & 6 deletions src/common/override.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@

#ifndef NO_OVERRIDE

#define MPI_WAITANY_OVERRRIDE
#define MPI_WAITALL_OVERRRIDE
#define MPI_WAITSOME_OVERRRIDE
#define MPI_TESTANY_OVERRRIDE
#define MPI_TESTALL_OVERRRIDE
#define MPI_TESTSOME_OVERRRIDE
// Override a function globally by setting a macro definition here
// Must have a matching function definition in common/override.c
// #define MPI_XXX_OVERRIDE

#endif
4 changes: 4 additions & 0 deletions src/interface/header/_OMPI/app_mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#define A_MPI_ MPI_
#define A_PMPI_ PMPI_
#endif

#define MPI_AINT_ADD_OVERRIDE
#define MPI_AINT_DIFF_OVERRIDE

typedef unsigned long size_t;
typedef size_t A_MPI_Aint;
typedef size_t A_MPI_Offset;
Expand Down
3 changes: 3 additions & 0 deletions src/interface/interface_utils/include/mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,9 @@ enum {
double MPI_Wtick(void);
double MPI_Wtime(void);

MPI_Aint MPI_Aint_add(MPI_Aint, MPI_Aint);
MPI_Aint MPI_Aint_diff(MPI_Aint, MPI_Aint);

/*
* Profiling MPI API
*/
Expand Down
1 change: 1 addition & 0 deletions src/preload/gen/mpi_translation_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "override.h"
#include <dlfcn.h>
#include <stdio.h>
/*ompi constante*/
Expand Down
3 changes: 3 additions & 0 deletions src/preload/header/INTEL_OMPI/app_mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
#ifndef A_MPI_INCLUDED
#define A_MPI_INCLUDED

#define MPI_AINT_ADD_OVERRIDE
#define MPI_AINT_DIFF_OVERRIDE

/* user include file for MPI programs */
#if !defined(_WIN32) && !defined(_WIN64) /* Linux only */
# include <stdint.h> /* for __WORDSIZE definition */
Expand Down
3 changes: 3 additions & 0 deletions src/preload/header/MPICH_OMPI/app_mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
#ifndef A_MPI_INCLUDED
#define A_MPI_INCLUDED

#define MPI_AINT_ADD_OVERRIDE
#define MPI_AINT_DIFF_OVERRIDE

/* user include file for MPI programs */
#if !defined(_WIN32) && !defined(_WIN64) /* Linux only */
# include <stdint.h> /* for __WORDSIZE definition */
Expand Down