1
1

While debugging collectives, came across a bug where the name of the

function really needs to be passed down via OMPI_ERR_INIT_FINALIZE.
So fix up that macro, the associated errhandler handling, and all the
MPI function that use that macro.

This commit was SVN r1436.
Этот коммит содержится в:
Jeff Squyres 2004-06-22 20:21:35 +00:00
родитель 737614ac0c
Коммит 21ada98b99
46 изменённых файлов: 323 добавлений и 187 удалений

Просмотреть файл

@ -17,9 +17,11 @@
/*
* These must correspond to the fortran handle indices
*/
#define OMPI_ERRHANDLER_NULL_FORTRAN 0
#define OMPI_ERRORS_ARE_FATAL_FORTRAN 1
#define OMPI_ERRORS_RETURN_FORTRAN 2
enum {
OMPI_ERRHANDLER_NULL_FORTRAN = 0,
OMPI_ERRORS_ARE_FATAL_FORTRAN,
OMPI_ERRORS_RETURN_FORTRAN
};
/**
@ -102,9 +104,9 @@ extern ompi_pointer_array_t *ompi_errhandler_f_to_c_table;
* when an error occurs because MPI_COMM_WORLD does not exist (because
* we're before MPI_Init() or after MPI_Finalize()).
*/
#define OMPI_ERR_INIT_FINALIZE \
#define OMPI_ERR_INIT_FINALIZE(name) \
if (!ompi_mpi_initialized || ompi_mpi_finalized) { \
ompi_mpi_errors_are_fatal_handler(NULL, NULL); \
ompi_mpi_errors_are_fatal_handler(NULL, NULL, name); \
}
/**
@ -141,7 +143,8 @@ extern ompi_pointer_array_t *ompi_errhandler_f_to_c_table;
*/
#define OMPI_ERRHANDLER_CHECK(rc, mpi_object, err_code, message) \
if (rc != OMPI_SUCCESS) { \
ompi_errhandler_invoke((mpi_object) != NULL ? (mpi_object)->error_handler : NULL, (mpi_object), \
ompi_errhandler_invoke((mpi_object) != NULL ? \
(mpi_object)->error_handler : NULL, (mpi_object), \
(err_code), (message)); \
return (err_code); \
}

Просмотреть файл

@ -28,7 +28,7 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
fortran_handle = comm->c_f_to_c_index;
errhandler->eh_func.fort_fn(&fortran_handle, &err_code);
} else {
errhandler->eh_func.c_comm_fn(&comm, &err_code, message);
errhandler->eh_func.c_comm_fn(&comm, &err_code, message, NULL);
}
break;
@ -38,7 +38,7 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
fortran_handle = win->w_f_to_c_index;
errhandler->eh_func.fort_fn(&fortran_handle, &err_code);
} else {
errhandler->eh_func.c_win_fn(&win, &err_code, message);
errhandler->eh_func.c_win_fn(&win, &err_code, message, NULL);
}
break;
@ -48,7 +48,7 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
fortran_handle = file->f_f_to_c_index;
errhandler->eh_func.fort_fn(&fortran_handle, &err_code);
} else {
errhandler->eh_func.c_file_fn(&file, &err_code, message);
errhandler->eh_func.c_file_fn(&file, &err_code, message, NULL);
}
break;
}

Просмотреть файл

@ -19,15 +19,23 @@
void ompi_mpi_errors_are_fatal_handler(struct ompi_communicator_t **comm,
int *error_code, ...)
{
char *arg;
va_list arglist;
#if __STDC__
va_start(arglist, error_code);
#else
va_start(arglist);
#endif
ompi_output(0, "*** An error occurred in %s", va_arg(arglist, char *));
if (comm != NULL && ompi_mpi_initialized && !ompi_mpi_finalized) {
arg = va_arg(arglist, char*);
if (NULL != arg) {
ompi_output(0, "*** An error occurred in %s", arg);
} else {
ompi_output(0, "*** An error occurred");
}
if (NULL != comm && ompi_mpi_initialized && !ompi_mpi_finalized) {
ompi_output(0, "*** on communicator %s", (*comm)->c_name);
} else if (!ompi_mpi_initialized) {
ompi_output(0, "*** before MPI was initialized");

Просмотреть файл

@ -18,18 +18,21 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Add_error_class";
int MPI_Add_error_class(int *errorclass)
{
int class;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
}
class = ompi_errclass_add();
if ( 0 > class ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Add_error_class");
FUNC_NAME);
}
*errorclass = class;

Просмотреть файл

@ -19,23 +19,26 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Add_error_code";
int MPI_Add_error_code(int errorclass, int *errorcode)
{
int code;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( ompi_errclass_is_invalid(errorclass) )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Add_error_code");
FUNC_NAME);
}
code = ompi_mpi_errcode_add ( errorclass);
if ( 0 > code ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Add_error_code");
FUNC_NAME);
}
*errorcode = code;

Просмотреть файл

@ -19,22 +19,25 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Add_error_code";
int MPI_Add_error_string(int errorcode, char *string)
{
int rc;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( ompi_mpi_errcode_is_invalid(errorcode) )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Add_error_string");
FUNC_NAME);
}
rc = ompi_mpi_errcode_add_string (errorcode, string, strlen(string)+1);
if ( OMPI_SUCCESS != rc ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Add_error_string");
FUNC_NAME);
}
return MPI_SUCCESS;

Просмотреть файл

@ -17,10 +17,13 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Close_port";
int MPI_Close_port(char *port_name)
{
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_accept";
int MPI_Comm_accept(char *port_name, MPI_Info info, int root,
MPI_Comm comm, MPI_Comm *newcomm)
{
@ -30,20 +33,20 @@ int MPI_Comm_accept(char *port_name, MPI_Info info, int root,
comp = (ompi_communicator_t *) comm;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_accept");
FUNC_NAME);
if ( OMPI_COMM_IS_INTER(comm))
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM,
"MPI_Comm_accept");
FUNC_NAME);
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_accept");
FUNC_NAME);
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_accept");
FUNC_NAME);
}
rank = ompi_comm_rank ( comm );
@ -51,7 +54,7 @@ int MPI_Comm_accept(char *port_name, MPI_Info info, int root,
if ( rank == root ) {
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_accept");
FUNC_NAME);
}
}
@ -134,7 +137,7 @@ int MPI_Comm_accept(char *port_name, MPI_Info info, int root,
}
if ( MPI_SUCCESS != rc ) {
*newcomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(comm, rc, "MPI_Comm_accept");
return OMPI_ERRHANDLER_INVOKE(comm, rc, FUNC_NAME);
}
*newcomm = newcomp;

Просмотреть файл

@ -17,6 +17,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_compare";
int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result) {
/* local variables */
@ -30,16 +33,16 @@ int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result) {
int found = 0;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm1 || MPI_COMM_NULL == comm2 ||
ompi_comm_invalid ( comm1 ) || ompi_comm_invalid (comm2) )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_compare");
FUNC_NAME);
if ( NULL == result )
return OMPI_ERRHANDLER_INVOKE(comm1, MPI_ERR_ARG,
"MPI_Comm_compare");
FUNC_NAME);
}
comp1 = (ompi_communicator_t *) comm1;

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_connect";
int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
MPI_Comm comm, MPI_Comm *newcomm)
{
@ -30,20 +33,20 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
comp = (ompi_communicator_t *) comm;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_connect");
FUNC_NAME);
if ( OMPI_COMM_IS_INTER(comm))
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM,
"MPI_Comm_connect");
FUNC_NAME);
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_connect");
FUNC_NAME);
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_connect");
FUNC_NAME);
}
rank = ompi_comm_rank ( comm );
@ -51,7 +54,7 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
if ( rank == root ) {
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_connect");
FUNC_NAME);
}
}
@ -133,7 +136,7 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
}
if ( MPI_SUCCESS != rc ) {
*newcomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(comm, rc, "MPI_Comm_accept");
return OMPI_ERRHANDLER_INVOKE(comm, rc, FUNC_NAME);
}
*newcomm = newcomp;

Просмотреть файл

@ -17,27 +17,30 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_create";
int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) {
int rc;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_create");
FUNC_NAME);
if ( MPI_GROUP_NULL == group )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_GROUP,
"MPI_Comm_create");
FUNC_NAME);
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_create");
FUNC_NAME);
}
rc = ompi_comm_create ( (ompi_communicator_t*)comm, (ompi_group_t*)group,
(ompi_communicator_t**)newcomm );
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, "MPI_Comm_create");
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}

Просмотреть файл

@ -17,15 +17,18 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_disconnect";
int MPI_Comm_disconnect(MPI_Comm *comm)
{
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == *comm || ompi_comm_invalid (*comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_disconnect");
FUNC_NAME);
}
/* disconnect means, just decrease the refcount, without calling

Просмотреть файл

@ -17,6 +17,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_dup";
int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
/* local variables */
@ -26,15 +29,15 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
/* argument checking */
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_dup");
FUNC_NAME);
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_dup");
FUNC_NAME);
}
comp = (ompi_communicator_t *) comm;
@ -61,7 +64,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
);
if ( MPI_COMM_NULL == newcomp ) {
OMPI_ERRHANDLER_INVOKE (comm, MPI_ERR_INTERN, "MPI_Comm_dup");
OMPI_ERRHANDLER_INVOKE (comm, MPI_ERR_INTERN, FUNC_NAME);
}
/* Determine context id. It is identical to f_2_c_handle */
@ -73,7 +76,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) {
mode ); /* mode */
if ( OMPI_SUCCESS != rc ) {
*newcomm = MPI_COMM_NULL;
OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INTERN, "MPI_Comm_dup");
OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_INTERN, FUNC_NAME);
}
*newcomm = newcomp;

Просмотреть файл

@ -18,15 +18,15 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_f2c";
MPI_Comm MPI_Comm_f2c(MPI_Fint comm)
{
size_t o_index= (size_t) comm;
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_f2c");
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( 0 > o_index ||
o_index >= ompi_pointer_array_get_size(&ompi_mpi_communicators)) {

Просмотреть файл

@ -17,15 +17,18 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_free";
int MPI_Comm_free(MPI_Comm *comm) {
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == *comm || MPI_COMM_WORLD == *comm ||
MPI_COMM_SELF == *comm || ompi_comm_invalid (*comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_free");
FUNC_NAME);
}
ompi_comm_free ( comm );

Просмотреть файл

@ -21,20 +21,23 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_get_name";
int MPI_Comm_get_name(MPI_Comm comm, char *name, int *length) {
ompi_communicator_t* comp;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid ( comm ) )
return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_get_name");
FUNC_NAME);
if ( NULL == name || NULL == length )
return OMPI_ERRHANDLER_INVOKE ( comm, MPI_ERR_ARG,
"MPI_Comm_get_name");
FUNC_NAME);
}
comp = (ompi_communicator_t*) comm;

Просмотреть файл

@ -17,24 +17,27 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_group";
int MPI_Comm_group(MPI_Comm comm, MPI_Group *group) {
int rc;
/* argument checking */
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm) )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_group");
FUNC_NAME);
if ( NULL == group )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_group");
FUNC_NAME);
} /* end if ( MPI_PARAM_CHECK) */
rc = ompi_comm_group ( (ompi_communicator_t*)comm, (ompi_group_t**)group );
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, "MPI_Comm_group");
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}

Просмотреть файл

@ -17,6 +17,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_join";
int MPI_Comm_join(int fd, MPI_Comm *intercomm)
{
int rc;
@ -27,11 +30,11 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
comp = (ompi_communicator_t *)MPI_COMM_SELF;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == intercomm )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Comm_join");
FUNC_NAME);
}
/* sendrecv OOB-name (port-name) through the socket connection.
@ -59,7 +62,7 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
&rproc, /* remote_leader */
OMPI_COMM_CID_INTRA_OOB); /* mode */
if ( OMPI_SUCCESS != rc ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_SELF, rc, "MPI_Comm_join");
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_SELF, rc, FUNC_NAME);
}

Просмотреть файл

@ -17,19 +17,21 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_rank";
int MPI_Comm_rank(MPI_Comm comm, int *rank)
{
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_rank");
FUNC_NAME);
if ( NULL == rank )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_rank");
FUNC_NAME);
}
*rank = ompi_comm_rank((ompi_communicator_t*)comm);

Просмотреть файл

@ -21,20 +21,23 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_set_name";
int MPI_Comm_set_name(MPI_Comm comm, char *name) {
ompi_communicator_t* comp;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid ( comm ) )
return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_set_name");
FUNC_NAME);
if ( NULL == name )
return OMPI_ERRHANDLER_INVOKE ( comm, MPI_ERR_ARG,
"MPI_Comm_set_name");
FUNC_NAME);
}
/* -- Thread safety entrance -- */

Просмотреть файл

@ -17,17 +17,20 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_comm_size";
int MPI_Comm_size(MPI_Comm comm, int *size) {
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD,
MPI_ERR_COMM, "MPI_Comm_size");
MPI_ERR_COMM, FUNC_NAME);
if ( NULL == size )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, "MPI_Comm_size");
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME);
}
*size = ompi_comm_size((ompi_communicator_t*)comm);

Просмотреть файл

@ -19,6 +19,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_spawn";
int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
int root, MPI_Comm comm, MPI_Comm *intercomm,
int *array_of_errcodes)
@ -31,23 +34,23 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
comp = (ompi_communicator_t *) comm;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_spawn");
FUNC_NAME);
if ( OMPI_COMM_IS_INTER(comm))
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM,
"MPI_Comm_spawn");
FUNC_NAME);
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
FUNC_NAME);
if ( NULL == intercomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
FUNC_NAME);
if ( NULL == array_of_errcodes )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
FUNC_NAME);
}
rank = ompi_comm_rank ( comm );
@ -55,13 +58,13 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
if ( rank == root ) {
if ( NULL == command )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
FUNC_NAME);
if ( NULL == argv )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
FUNC_NAME);
if ( 0 > maxprocs )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
FUNC_NAME);
}
}
@ -157,7 +160,7 @@ int MPI_Comm_spawn(char *command, char **argv, int maxprocs, MPI_Info info,
}
if ( MPI_SUCCESS != rc ) {
*intercomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(comm, rc, "MPI_Comm_spawn");
return OMPI_ERRHANDLER_INVOKE(comm, rc, FUNC_NAME);
}
*intercomm = newcomp;

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_spawn_multiple";
int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_of_argv,
int *array_of_maxprocs, MPI_Info *array_of_info,
int root, MPI_Comm comm, MPI_Comm *intercomm,
@ -32,23 +35,23 @@ int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_o
comp = (ompi_communicator_t *) comm;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( OMPI_COMM_IS_INTER(comm))
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == intercomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == array_of_errcodes )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
}
rank = ompi_comm_rank ( comm );
@ -56,29 +59,29 @@ int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_o
if ( rank == root ) {
if ( 0 > count )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == array_of_commands )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == array_of_argv )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == array_of_maxprocs )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == array_of_info )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
for ( i=0; i<count; i++ ) {
if ( NULL == array_of_commands[i] )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( NULL == array_of_argv[i] )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
if ( 0 > array_of_maxprocs[i] )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
FUNC_NAME);
}
}
}
@ -180,7 +183,7 @@ int MPI_Comm_spawn_multiple(int count, char **array_of_commands, char ***array_o
}
if ( MPI_SUCCESS != rc ) {
*intercomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(comm, rc, "MPI_Comm_spawn_multiple");
return OMPI_ERRHANDLER_INVOKE(comm, rc, FUNC_NAME);
}

Просмотреть файл

@ -17,27 +17,30 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_split";
int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm) {
int rc;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( comm == MPI_COMM_NULL || ompi_comm_invalid ( comm ))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_split");
FUNC_NAME);
if ( color < 0 && MPI_UNDEFINED != color )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_split");
FUNC_NAME);
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_split");
FUNC_NAME);
}
rc = ompi_comm_split ( (ompi_communicator_t*)comm, color, key,
(ompi_communicator_t**)newcomm );
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, "MPI_Comm_split");
OMPI_ERRHANDLER_RETURN ( rc, comm, rc, FUNC_NAME);
}

Просмотреть файл

@ -17,18 +17,21 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Comm_test_inter";
int MPI_Comm_test_inter(MPI_Comm comm, int *flag) {
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == comm || ompi_comm_invalid ( comm ) )
return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_test_inter");
FUNC_NAME);
if ( NULL == flag )
return OMPI_ERRHANDLER_INVOKE ( comm, MPI_ERR_ARG,
"MPI_Comm_test_inter");
FUNC_NAME);
}
*flag = (comm->c_flags & OMPI_COMM_INTER);

Просмотреть файл

@ -18,15 +18,18 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Error_class";
int MPI_Error_class(int errorcode, int *errorclass)
{
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( ompi_mpi_errcode_is_invalid(errorcode))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Error_class");
FUNC_NAME);
}

Просмотреть файл

@ -8,6 +8,7 @@
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "errhandler/errcode.h"
#include "errhandler/errhandler.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
@ -18,16 +19,19 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Error_string";
int MPI_Error_string(int errorcode, char *string, int *resultlen)
{
char *tmpstring;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( ompi_mpi_errcode_is_invalid(errorcode))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Error_string");
FUNC_NAME);
}
tmpstring = ompi_mpi_errcode_get_string (errorcode);

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_compare";
int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result) {
/* local variables */
@ -31,12 +34,12 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result) {
/* check for errors */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( ( MPI_GROUP_NULL == group1 ) || ( MPI_GROUP_NULL == group2 ) ||
(NULL == group1) || (NULL==group2) ){
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_compare");
FUNC_NAME);
}
}

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_difference";
int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
MPI_Group *new_group) {
@ -29,12 +32,12 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2,
/* error checking */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
(NULL == group1) || (NULL == group2) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_difference");
FUNC_NAME);
}
}

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_excl";
int MPI_Group_excl(MPI_Group group, int n, int *ranks,
MPI_Group *new_group) {
@ -30,19 +33,19 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks,
group_pointer = (ompi_group_t *)group;
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
/* verify that group is valid group */
if ( (MPI_GROUP_NULL == group) || (NULL == group) ||
(NULL == ranks) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_excl");
FUNC_NAME);
}
/* check that new group is no larger than old group */
if ( n > group_pointer->grp_proc_count) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_excl - II");
FUNC_NAME);
}
} /* end if( MPI_CHECK_ARGS) */
@ -55,7 +58,7 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks,
new_group_pointer=ompi_group_allocate(group_pointer->grp_proc_count-n);
if( NULL == new_group_pointer ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_union - III");
FUNC_NAME);
}
/* put group elements in the list */
@ -69,7 +72,7 @@ int MPI_Group_excl(MPI_Group group, int n, int *ranks,
if( ( 0 > excl_proc ) ||
(excl_proc >= group_pointer->grp_proc_count)){
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_union - IV");
FUNC_NAME);
}
if(excl_proc == proc ){
found=1;

Просмотреть файл

@ -18,18 +18,21 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_free";
int MPI_Group_free(MPI_Group *group)
{
ompi_group_t *l_group;
/* check to make sure we don't free GROUP_EMPTY or GROUP_NULL */
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((MPI_GROUP_NULL == *group) || (MPI_GROUP_EMPTY == *group) ||
(NULL == *group) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_free");
FUNC_NAME);
}
}

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_incl";
int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
{
/* local variables */
@ -28,19 +31,19 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
group_pointer = (ompi_group_t *)group;
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
/* verify that group is valid group */
if ( (MPI_GROUP_NULL == group) || ( NULL == group)
|| NULL == ranks ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_incl");
FUNC_NAME);
}
/* check that new group is no larger than old group */
if ( n > group_pointer->grp_proc_count) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_incl - II");
FUNC_NAME);
}
} /* end if( MPI_CHECK_ARGS) */
@ -50,7 +53,7 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
new_group_pointer=ompi_group_allocate(n);
if( NULL == new_group_pointer ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_incl - III");
FUNC_NAME);
}
/* put group elements in the list */
@ -58,7 +61,7 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *new_group)
if ((ranks[proc] < 0) ||
(ranks[proc] >= group_pointer->grp_proc_count)){
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_incl - IV");
FUNC_NAME);
}
new_group_pointer->grp_proc_pointers[proc] =

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_intersection";
int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
MPI_Group *new_group) {
@ -28,13 +31,13 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
ompi_proc_t *proc1_pointer, *proc2_pointer, *my_proc_pointer;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
/* verify that groups are valid */
if ( (MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
( NULL == group1) || (NULL == group2) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_intersection");
FUNC_NAME);
}
}
@ -65,7 +68,7 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2,
new_group_pointer=ompi_group_allocate(group_size);
if( NULL == new_group_pointer ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_intersection - II");
FUNC_NAME);
}
cnt = 0;

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_range_excl";
int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
MPI_Group *new_group) {
@ -31,11 +34,11 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
/* can't act on NULL group */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( (MPI_GROUP_NULL == group) || (NULL == group) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_range_excl");
FUNC_NAME);
}
}
@ -46,7 +49,7 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
malloc(sizeof(int) * group_pointer->grp_proc_count);
if (NULL == elements_int_list) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER,
"MPI_Group_range_excl - II");
FUNC_NAME);
}
for (proc = 0; proc < group_pointer->grp_proc_count; proc++) {
elements_int_list[proc] = -1;
@ -63,23 +66,23 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
if ((0 > first_rank) || (first_rank > group_pointer->grp_proc_count)) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - III");
FUNC_NAME);
}
if ((0 > last_rank) || (last_rank > group_pointer->grp_proc_count)) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - IV");
FUNC_NAME);
}
if (stride == 0) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - V");
FUNC_NAME);
}
if (first_rank < last_rank) {
if (stride < 0) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - VI");
FUNC_NAME);
}
/* positive stride */
@ -89,7 +92,7 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
if (elements_int_list[index] != -1) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - VII");
FUNC_NAME);
}
elements_int_list[index] = new_group_size;
index += stride;
@ -101,7 +104,7 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
if (stride > 0) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - VIII");
FUNC_NAME);
}
/* negative stride */
index = first_rank;
@ -110,7 +113,7 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
if (elements_int_list[index] != -1) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - IX");
FUNC_NAME);
}
elements_int_list[index] = new_group_size;
index += stride;
@ -123,7 +126,7 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
if (elements_int_list[index] != -1) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_excl - X");
FUNC_NAME);
}
elements_int_list[index] = new_group_size;
new_group_size++;
@ -138,7 +141,7 @@ int MPI_Group_range_excl(MPI_Group group, int n_triplets, int ranges[][3],
if( NULL == new_group_pointer ) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_range_excl - XI");
FUNC_NAME);
}
/* fill in group list */

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_range_incl";
int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
MPI_Group *new_group) {
/* local variables */
@ -30,11 +33,11 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
/* can't act on NULL group */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( (MPI_GROUP_NULL == group) || (NULL == group) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_range_incl");
FUNC_NAME);
}
}
@ -45,7 +48,7 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
(int *) malloc(sizeof(int) * group_pointer->grp_proc_count);
if (NULL == elements_int_list) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OTHER,
"MPI_Group_range_incl - II");
FUNC_NAME);
}
for (proc = 0; proc < group_pointer->grp_proc_count; proc++) {
elements_int_list[proc] = -1;
@ -61,7 +64,7 @@ int MPI_Group_range_incl(MPI_Group group, int n_triplets, int ranges[][3],
if(( 0 > first_rank ) || (first_rank > group_pointer->grp_proc_count)) {
free(elements_int_list);
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_RANK,
"MPI_Group_range_incl - III");
FUNC_NAME);
}
if((0 > last_rank) || (last_rank > group_pointer->grp_proc_count)) {
free(elements_int_list);

Просмотреть файл

@ -18,15 +18,18 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_rank";
int MPI_Group_rank(MPI_Group group, int *rank) {
/* error checking */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (MPI_GROUP_NULL == group) || ( NULL == group) ){
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_rank");
FUNC_NAME);
}
}

Просмотреть файл

@ -18,15 +18,18 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_size";
int MPI_Group_size(MPI_Group group, int *size) {
/* error checking */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if( (MPI_GROUP_NULL == group) || (NULL == group) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_size");
FUNC_NAME);
}
}

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_translate_ranks";
int MPI_Group_translate_ranks(MPI_Group group1, int n_ranks, int *ranks1,
MPI_Group group2, int *ranks2) {
@ -30,20 +33,20 @@ int MPI_Group_translate_ranks(MPI_Group group1, int n_ranks, int *ranks1,
/* check for errors */
if( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
(NULL == group1) || (NULL == group2) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_translate_ranks");
FUNC_NAME);
}
if( (n_ranks > group1_pointer->grp_proc_count) || (0 >= n_ranks) ){
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_translate_ranks - II ");
FUNC_NAME);
}
if( (NULL == ranks1) || (NULL == ranks2 ) ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_translate_ranks - III ");
FUNC_NAME);
}
}

Просмотреть файл

@ -18,6 +18,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Group_union";
int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group)
{
/* local variables */
@ -28,13 +31,13 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group)
/* check for errors */
if (MPI_PARAM_CHECK) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ((MPI_GROUP_NULL == group1) || (MPI_GROUP_NULL == group2) ||
(NULL == group1) || (NULL == group2) ) {
return
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_union");
FUNC_NAME);
}
}
@ -74,7 +77,7 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *new_group)
if (NULL == new_group_pointer) {
return
OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_GROUP,
"MPI_Group_union - II");
FUNC_NAME);
}
/* fill in the new group list */

Просмотреть файл

@ -19,6 +19,9 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Intercomm_create";
int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
MPI_Comm bridge_comm, int remote_leader,
int tag, MPI_Comm *newintercomm)
@ -29,20 +32,20 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
int rc, rsize;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == local_comm || ompi_comm_invalid ( local_comm ) ||
( local_comm->c_flags & OMPI_COMM_INTER ) )
return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Intercomm_create");
FUNC_NAME);
if ( NULL == newintercomm )
return OMPI_ERRHANDLER_INVOKE ( local_comm, MPI_ERR_ARG,
"MPI_Intercomm_create");
FUNC_NAME);
if ( tag < 0 || tag > MPI_TAG_UB )
return OMPI_ERRHANDLER_INVOKE ( local_comm, MPI_ERR_ARG,
"MPI_Intercomm_create");
FUNC_NAME);
}
local_size = ompi_comm_size ( local_comm );
@ -51,7 +54,7 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
if ( MPI_PARAM_CHECK ) {
if ( 0 < local_leader || local_leader > local_size )
return OMPI_ERRHANDLER_INVOKE ( local_comm, MPI_ERR_ARG,
"MPI_Intercomm_create");
FUNC_NAME);
/* remember that the remote_leader and bridge_comm arguments
just have to be valid at the local_leader */
@ -59,12 +62,12 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
if ( MPI_COMM_NULL == bridge_comm || ompi_comm_invalid ( bridge_comm) ||
bridge_comm->c_flags & OMPI_COMM_INTER ) {
return OMPI_ERRHANDLER_INVOKE ( local_comm, MPI_ERR_COMM,
"MPI_Intercomm_create");
FUNC_NAME);
}
if ( remote_leader < 0 || remote_leader > ompi_comm_size(bridge_comm)) {
return OMPI_ERRHANDLER_INVOKE ( local_comm, MPI_ERR_ARG,
"MPI_Intercomm_create");
FUNC_NAME);
}
} /* if ( local_rank == local_leader ) */
}
@ -112,7 +115,8 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
);
if ( newcomp == MPI_COMM_NULL ) {
return OMPI_ERRHANDLER_INVOKE (local_comm, MPI_ERR_INTERN, "MPI_Intercomm_create");
return OMPI_ERRHANDLER_INVOKE (local_comm, MPI_ERR_INTERN,
FUNC_NAME);
}
/* Determine context id. It is identical to f_2_c_handle */
@ -129,7 +133,7 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
if ( OMPI_SUCCESS != rc ) {
*newintercomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(local_comm, MPI_ERR_INTERN,
"MPI_Intercom_create");
FUNC_NAME);
}
*newintercomm = newcomp;

Просмотреть файл

@ -19,6 +19,9 @@
#define INTERCOMM_MERGE_TAG 1010
static char FUNC_NAME[] = "MPI_Intercomm_merge";
int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
MPI_Comm *newcomm)
{
@ -31,16 +34,16 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
int rc=MPI_SUCCESS;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( MPI_COMM_NULL == intercomm || ompi_comm_invalid ( intercomm ) ||
!( intercomm->c_flags & OMPI_COMM_INTER ) )
return OMPI_ERRHANDLER_INVOKE ( MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Intercomm_merge");
FUNC_NAME);
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE ( intercomm, MPI_ERR_ARG,
"MPI_Intercomm_merge");
FUNC_NAME);
}
local_size = ompi_comm_size ( intercomm );
@ -49,7 +52,8 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
total_size = local_size + remote_size;
procs = (ompi_proc_t **) malloc ( total_size * sizeof(ompi_proc_t *));
if ( NULL == procs ) {
return OMPI_ERRHANDLER_INVOKE(intercomm,MPI_ERR_INTERN, "MPI_Intercomm_merge");
return OMPI_ERRHANDLER_INVOKE(intercomm,MPI_ERR_INTERN,
FUNC_NAME);
}
first = ompi_comm_determine_first ( intercomm, high );
@ -79,7 +83,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
if ( newcomp == MPI_COMM_NULL ) {
return OMPI_ERRHANDLER_INVOKE (intercomm, MPI_ERR_INTERN,
"MPI_Intercomm_merge");
FUNC_NAME);
}
/* Determine context id. It is identical to f_2_c_handle */
@ -100,7 +104,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high,
if ( OMPI_SUCCESS != rc ) {
*newcomm = MPI_COMM_NULL;
return OMPI_ERRHANDLER_INVOKE(intercomm, MPI_ERR_INTERN,
"MPI_Intercom_merge");
FUNC_NAME);
}
*newcomm = newcomp;

Просмотреть файл

@ -18,20 +18,22 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Lookup_name";
int MPI_Lookup_name(char *service_name, MPI_Info info, char *port_name)
{
int rc;
char *tmp;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Lookup_name");
FUNC_NAME);
if ( NULL == service_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Lookup_name");
FUNC_NAME);
}
/*
@ -46,7 +48,7 @@ int MPI_Lookup_name(char *service_name, MPI_Info info, char *port_name)
tmp = (char *) ompi_comm_namelookup(service_name);
if ( NULL == tmp ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NAME,
"MPI_Lookup_name");
FUNC_NAME);
}
strncpy ( port_name, tmp, MPI_MAX_PORT_NAME );

Просмотреть файл

@ -18,14 +18,17 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Open_port";
int MPI_Open_port(MPI_Info info, char *port_name)
{
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Open_port");
FUNC_NAME);
}
if ( MPI_INFO_NULL != info ) {

Просмотреть файл

@ -18,20 +18,23 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Publish_name";
int MPI_Publish_name(char *service_name, MPI_Info info,
char *port_name)
{
int rc;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Publish_name");
FUNC_NAME);
if ( NULL == service_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Publish_name");
FUNC_NAME);
}
/*
@ -42,7 +45,7 @@ int MPI_Publish_name(char *service_name, MPI_Info info,
rc = ompi_comm_namepublish (service_name, port_name);
if ( OMPI_SUCCESS != rc ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Publish_name");
FUNC_NAME);
}
return MPI_SUCCESS;

Просмотреть файл

@ -31,7 +31,7 @@ int MPI_Send(void *buf, int count, MPI_Datatype type, int dest,
if ( MPI_PARAM_CHECK ) {
int rc = MPI_SUCCESS;
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if (ompi_comm_invalid(comm)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
FUNC_NAME);

Просмотреть файл

@ -9,6 +9,7 @@
#include "info/info.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#include "errhandler/errhandler.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Unpublish_name = PMPI_Unpublish_name
@ -18,20 +19,23 @@
#include "mpi/c/profile/defines.h"
#endif
static char FUNC_NAME[] = "MPI_Unpublish_name";
int MPI_Unpublish_name(char *service_name, MPI_Info info,
char *port_name)
{
int rc;
if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE;
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Unpublish_name");
FUNC_NAME);
if ( NULL == service_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Unpublish_name");
FUNC_NAME);
}
/*
@ -41,7 +45,7 @@ int MPI_Unpublish_name(char *service_name, MPI_Info info,
rc = ompi_comm_nameunpublish(service_name);
if ( OMPI_SUCCESS != rc ) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_SERVICE,
"MPI_Unpublish_name");
FUNC_NAME);
}
return MPI_SUCCESS;