1
1

adding parameter verification for all routines involved in

dynamic process management.

Started to sketch the algorithms and the open questions.

Added (if appropriate) the list of info-objects, which we
might have to verify in the according functions.

This commit was SVN r1298.
Этот коммит содержится в:
Edgar Gabriel 2004-06-16 01:41:01 +00:00
родитель ceec782bcd
Коммит fc10938f3c
12 изменённых файлов: 466 добавлений и 12 удалений

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

@ -6,6 +6,8 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Close_port = PMPI_Close_port
@ -15,6 +17,21 @@
#include "mpi/c/profile/defines.h"
#endif
int MPI_Close_port(char *port_name) {
int MPI_Close_port(char *port_name)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Close_port");
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Close_port");
}
/* As far as I can see at the moment, this is an empty function.
Since we are relying on OOB, we did not allocate any 'address',
therefore we don't have to free an 'address'.
*/
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "info/info.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_accept = PMPI_Comm_accept
@ -16,6 +19,54 @@
#endif
int MPI_Comm_accept(char *port_name, MPI_Info info, int root,
MPI_Comm comm, MPI_Comm *newcomm) {
MPI_Comm comm, MPI_Comm *newcomm)
{
int rank;
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_accept");
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_accept");
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_accept");
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_accept");
}
rank = ompi_comm_rank ( comm );
if ( MPI_PARAM_CHECK ) {
if ( rank == root ) {
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_accept");
}
}
if ( rank == root && MPI_INFO_NULL != info ) {
/* parse the info object */
/* no prefedined values for this function in MPI-2*/
/* accept connection from other app */
/* recv number of procs of other app */
/* recv list of procs of other app */
/* send number of procs to other app */
/* send list of process to other app */
}
/* bcast number of procs of other app to comm */
/* bcast list of procs of other app to comm */
/* setup the proc-structures for the new processes, which are not yet known */
/* setup the intercomm-structure using ompi_comm_set (); */
/* PROBLEM: How to determine the new comm-cid ? */
/* PROBLEM: do we have to re-start some low level stuff
to enable the usage of fast communication devices
between the two worlds ? */
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "info/info.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_connect = PMPI_Comm_connect
@ -16,6 +19,53 @@
#endif
int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
MPI_Comm comm, MPI_Comm *newcomm) {
MPI_Comm comm, MPI_Comm *newcomm)
{
int rank;
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_connect");
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_connect");
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_connect");
if ( NULL == newcomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_connect");
}
rank = ompi_comm_rank ( comm );
if ( MPI_PARAM_CHECK ) {
if ( rank == root ) {
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_connect");
}
}
if ( rank == root && MPI_INFO_NULL != info ) {
/* parse the info object */
/* no prefedined values for this function in MPI-2*/
/* connect to other app */
/* send number of procs */
/* send list of procs */
/* receive number of procs of other app */
/* receive list of process of other app */
}
/* bcast number of procs of other app to comm */
/* bcast list of procs of other app to comm */
/* setup the proc-structures for the new processes which we don't know yet*/
/* setup the intercomm-structure using ompi_comm_set (); */
/* PROBLEM: How to determine the new comm-cid ? */
/* PROBLEM: do we have to re-start some low level stuff
to enable the usage of fast communication devices
between the two worlds ? */
return MPI_SUCCESS;
}

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

@ -6,6 +6,8 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_disconnect = PMPI_Comm_disconnect
@ -15,6 +17,27 @@
#include "mpi/c/profile/defines.h"
#endif
int MPI_Comm_disconnect(MPI_Comm *comm) {
int MPI_Comm_disconnect(MPI_Comm *comm)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_disconnect");
if ( MPI_COMM_NULL == *comm || ompi_comm_invalid (*comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_disconnect");
}
/* disconnect means, just decrease the refcount, without calling
attribute delete fnct. etc. (to be verified.).
Question: do we need a flag verifying which communicators
we are allowed to disconnect from ? E.g. what happens,
if we disconnect from an MPI-1 communicator derived
from MPI_COMM_WORLD ? */
OBJ_RETAIN(*comm);
*comm = MPI_COMM_NULL;
return MPI_SUCCESS;
}

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

@ -6,6 +6,8 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_get_parent = PMPI_Comm_get_parent
@ -15,6 +17,24 @@
#include "mpi/c/profile/defines.h"
#endif
int MPI_Comm_get_parent(MPI_Comm *parent) {
int MPI_Comm_get_parent(MPI_Comm *parent)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_get_parent");
if ( NULL == parent )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Comm_get_parent");
}
/*
* ompi_mpi_comm_parent is MPI_COMM_NULL, in case this
* world has not been spawned. This is also the return
* value required by MPI-2.
*parent = &ompi_mpi_comm_parent;
*/
return MPI_SUCCESS;
}

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

@ -6,6 +6,8 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_join = PMPI_Comm_join
@ -15,6 +17,27 @@
#include "mpi/c/profile/defines.h"
#endif
int MPI_Comm_join(int fd, MPI_Comm *intercomm) {
int MPI_Comm_join(int fd, MPI_Comm *intercomm)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_join");
if ( NULL == intercomm )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Comm_join");
}
/* sendrecv OOB-name (port-name) through the socket connection.
Need to determine somehow how to avoid a potential deadlock
here. *o/
/* if proc unknown, set up the proc-structure */
/* setup the intercomm-structure using ompi_comm_set (); */
/* setup comm_cid: need a separate routine for that,
since it is so trivial ? How about multi-threaded case ? */
/* PROBLEM: do we have to re-start some low level stuff
to enable the usage of fast communication devices
between the two worlds ? */
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "info/info.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_spawn = PMPI_Comm_spawn
@ -17,6 +20,81 @@
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) {
int *array_of_errcodes)
{
int rank;
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_spawn");
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_spawn");
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
if ( NULL == intercomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
if ( NULL == array_of_errcodes )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
}
rank = ompi_comm_rank ( comm );
if ( MPI_PARAM_CHECK ) {
if ( rank == root ) {
if ( NULL == command )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
if ( NULL == argv )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
if ( 0 > maxprocs )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn");
}
}
if ( rank == root && MPI_INFO_NULL != info ) {
/* parse the info object */
/* check potentially for:
- "host": desired host where to spawn the processes
- "arch": desired architecture
- "wdir": directory, where executable can be found
- "path": list of directories where to look for the executable
- "file": filename, where additional information is provided.
- "soft": see page 92 of MPI-2.
*/
/* map potentially MPI_ARGV_NULL to the value required by the start-cmd */
/* start processes */
/* publish your name */
/* accept connection from other group.
Root in the new application is rank 0 in their COMM_WORLD ? */
/* unpublish name */
/* send list of procs to other app */
/* receive list of procs from other app */
}
/* bcast maxprocs to all processes in comm */
/* bcast list of remote procs to all processes in comm */
/* setup the proc-structures for the new processes */
/* setup the intercomm-structure using ompi_comm_set (); */
/* PROBLEM: How to determine the new comm-cid ? */
/* PROBLEM: do we have to re-start some low level stuff
to enable the usage of fast communication devices
between the two worlds ? */
/* set array of errorcodes */
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "info/info.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Comm_spawn_multiple = PMPI_Comm_spawn_multiple
@ -18,6 +21,99 @@
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,
int *array_of_errcodes) {
int *array_of_errcodes)
{
int i;
int rank;
int totalnumprocs=0;
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Comm_spawn_multiple");
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm))
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
"MPI_Comm_spawn_multiple");
if ( 0 > root || ompi_comm_size(comm) < root )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == intercomm )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == array_of_errcodes )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
}
rank = ompi_comm_rank ( comm );
if ( MPI_PARAM_CHECK ) {
if ( rank == root ) {
if ( 0 > count )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == array_of_commands )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == array_of_argv )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == array_of_maxprocs )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == array_of_info )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
for ( i=0; i<count; i++ ) {
if ( NULL == array_of_commands[i] )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( NULL == array_of_argv[i] )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
if ( 0 > array_of_maxprocs[i] )
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
"MPI_Comm_spawn_multiple");
}
}
}
if ( rank == root ) {
for ( i=0; i < count; i++ ) {
totalnumprocs += array_of_maxprocs[i];
/* parse the info[i] */
/* check potentially for:
- "host": desired host where to spawn the processes
- "arch": desired architecture
- "wdir": directory, where executable can be found
- "path": list of directories where to look for the executable
- "file": filename, where additional information is provided.
- "soft": see page 92 of MPI-2.
*/
}
/* map potentially array_of_argvs == MPI_ARGVS_NULL to a correct value */
/* map potentially array_of_argvs[i] == MPI_ARGV_NULL to a correct value */
/* start processes */
/* publish name */
/* accept connection from other group.
Root in the new application is rank 0 in their COMM_WORLD ? */
/* unpublish name */
/* send list of procs from other app */
/* receive list of procs from other app */
}
/* bcast totalnumprocs to all processes in comm */
/* bcast list of remote procs to all processes in comm */
/* setup the proc-structures for the new processes */
/* setup the intercomm-structure using ompi_comm_set (); */
/* PROBLEM: How to determine the new comm-cid ? */
/* PROBLEM: do we have to re-start some low level stuff
to enable the usage of fast communication devices
between the two worlds ? */
/* set array of errorcodes */
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "info/info.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Lookup_name = PMPI_Lookup_name
@ -15,6 +18,24 @@
#include "mpi/c/profile/defines.h"
#endif
int MPI_Lookup_name(char *service_name, MPI_Info info, char *port_name) {
int MPI_Lookup_name(char *service_name, MPI_Info info, char *port_name)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Lookup_name");
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Lookup_name");
if ( NULL == service_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Lookup_name");
}
/* parse info-object. No predefined info-objects for this function
in MPI-2 */
/* retrieve information from registry using service_name as a key */
/* copy data into port_name, if found */
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "info/info.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Open_port = PMPI_Open_port
@ -15,6 +18,35 @@
#include "mpi/c/profile/defines.h"
#endif
int MPI_Open_port(MPI_Info info, char *port_name) {
int MPI_Open_port(MPI_Info info, char *port_name)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Open_port");
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Open_port");
}
if ( MPI_INFO_NULL != info ) {
/* in theory, they user might tell us here
how to establish the address. Since our communication
is relying on OOB, we probably
won't use the info-object.
potential values defined in MPI-2:
- "ip_port" : value contains IP port number
- "ip_address" : value contains IP address
*/
}
/* According to our current understanding, the port_name will
be the OOB-name. No real port has to be opne, since
OOB always accepts new connections (e.g. has a pending accept).
memcpy ( port_name, oob-whatever-fcnt, strlen(oob-whatever-fctn));
*/
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "runtime/runtime.h"
#include "info/info.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Publish_name = PMPI_Publish_name
@ -16,6 +19,24 @@
#endif
int MPI_Publish_name(char *service_name, MPI_Info info,
char *port_name) {
char *port_name)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Publish_name");
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Publish_name");
if ( NULL == service_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Publish_name");
}
/* parse info-object. No predefined info-objects for this function
in MPI-2 */
/* send information to registry, using service_name, jobid
and vpid as keys. */
return MPI_SUCCESS;
}

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

@ -6,6 +6,9 @@
#include "mpi.h"
#include "mpi/c/bindings.h"
#include "info/info.h"
#include "runtime/runtime.h"
#include "communicator/communicator.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Unpublish_name = PMPI_Unpublish_name
@ -16,6 +19,25 @@
#endif
int MPI_Unpublish_name(char *service_name, MPI_Info info,
char *port_name) {
char *port_name)
{
if ( MPI_PARAM_CHECK ) {
if ( ompi_mpi_finalized )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
"MPI_Unpublish_name");
if ( NULL == port_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Unpublish_name");
if ( NULL == service_name )
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
"MPI_Unpublish_name");
}
/* parse info-object. No predefined info-objects for this function
in MPI-2 */
/* delete information from registry, using service_name,
jobid and vpid as keys */
return MPI_SUCCESS;
}