2007-12-21 09:02:00 +03:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
2004-01-29 05:50:02 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2010-07-22 00:07:00 +04:00
|
|
|
* Copyright (c) 2004-2010 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2007-10-22 15:28:49 +04:00
|
|
|
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
== Highlights ==
1. New mpifort wrapper compiler: you can utilize mpif.h, use mpi, and use mpi_f08 through this one wrapper compiler
1. mpif77 and mpif90 still exist, but are sym links to mpifort and may be removed in a future release
1. The mpi module has been re-implemented and is significantly "mo' bettah"
1. The mpi_f08 module offers many, many improvements over mpif.h and the mpi module
This stuff is coming from a VERY long-lived mercurial branch (3 years!); it'll almost certainly take a few SVN commits and a bunch of testing before I get it correctly committed to the SVN trunk.
== More details ==
Craig Rasmussen and I have been working with the MPI-3 Fortran WG and Fortran J3 committees for a long, long time to make a prototype MPI-3 Fortran bindings implementation. We think we're at a stable enough state to bring this stuff back to the trunk, with the goal of including it in OMPI v1.7.
Special thanks go out to everyone who has been incredibly patient and helpful to us in this journey:
* Rolf Rabenseifner/HLRS (mastermind/genius behind the entire MPI-3 Fortran effort)
* The Fortran J3 committee
* Tobias Burnus/gfortran
* Tony !Goetz/Absoft
* Terry !Donte/Oracle
* ...and probably others whom I'm forgetting :-(
There's still opportunities for optimization in the mpi_f08 implementation, but by and large, it is as far along as it can be until Fortran compilers start implementing the new F08 dimension(..) syntax.
Note that gfortran is currently unsupported for the mpi_f08 module and the new mpi module. gfortran users will a) fall back to the same mpi module implementation that is in OMPI v1.5.x, and b) not get the new mpi_f08 module. The gfortran maintainers are actively working hard to add the necessary features to support both the new mpi_f08 module and the new mpi module implementations. This will take some time.
As mentioned above, ompi/mpi/f77 and ompi/mpi/f90 no longer exist. All the fortran bindings implementations have been collated under ompi/mpi/fortran; each implementation has its own subdirectory:
{{{
ompi/mpi/fortran/
base/ - glue code
mpif-h/ - what used to be ompi/mpi/f77
use-mpi-tkr/ - what used to be ompi/mpi/f90
use-mpi-ignore-tkr/ - new mpi module implementation
use-mpi-f08/ - new mpi_f08 module implementation
}}}
There's also a prototype 6-function-MPI implementation under use-mpi-f08-desc that emulates the new F08 dimension(..) syntax that isn't fully available in Fortran compilers yet. We did that to prove it to ourselves that it could be done once the compilers fully support it. This directory/implementation will likely eventually replace the use-mpi-f08 version.
Other things that were done:
* ompi_info grew a few new output fields to describe what level of Fortran support is included
* Existing Fortran examples in examples/ were renamed; new mpi_f08 examples were added
* The old Fortran MPI libraries were renamed:
* libmpi_f77 -> libmpi_mpifh
* libmpi_f90 -> libmpi_usempi
* The configury for Fortran was consolidated and significantly slimmed down. Note that the F77 env variable is now IGNORED for configure; you should only use FC. Example:
{{{
shell$ ./configure CC=icc CXX=icpc FC=ifort ...
}}}
All of this work was done in a Mercurial branch off the SVN trunk, and hosted at Bitbucket. This branch has got to be one of OMPI's longest-running branches. Its first commit was Tue Apr 07 23:01:46 2009 -0400 -- it's over 3 years old! :-) We think we've pulled in all relevant changes from the OMPI trunk (e.g., Fortran implementations of the new MPI-3 MPROBE stuff for mpif.h, use mpi, and use mpi_f08, and the recent Fujitsu Fortran patches).
I anticipate some instability when we bring this stuff into the trunk, simply because it touches a LOT of code in the MPI layer in the OMPI code base. We'll try our best to make it as pain-free as possible, but please bear with us when it is committed.
This commit was SVN r26283.
2012-04-18 19:57:29 +04:00
|
|
|
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
2009-02-24 20:17:33 +03:00
|
|
|
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2012-03-21 21:46:15 +04:00
|
|
|
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-29 05:50:02 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-08 21:12:36 +04:00
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2009-02-24 20:17:33 +03:00
|
|
|
#include "ompi/communicator/communicator.h"
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/request/request.h"
|
2007-12-06 12:23:44 +03:00
|
|
|
#include "ompi/request/request_default.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2004-01-29 05:50:02 +03:00
|
|
|
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_t ompi_request_f_to_c_table;
|
2006-08-24 20:38:08 +04:00
|
|
|
size_t ompi_request_waiting = 0;
|
|
|
|
size_t ompi_request_completed = 0;
|
2012-03-21 21:46:15 +04:00
|
|
|
size_t ompi_request_failed = 0;
|
2006-08-24 20:38:08 +04:00
|
|
|
opal_mutex_t ompi_request_lock;
|
|
|
|
opal_condition_t ompi_request_cond;
|
2009-02-24 20:17:33 +03:00
|
|
|
ompi_predefined_request_t ompi_request_null;
|
== Highlights ==
1. New mpifort wrapper compiler: you can utilize mpif.h, use mpi, and use mpi_f08 through this one wrapper compiler
1. mpif77 and mpif90 still exist, but are sym links to mpifort and may be removed in a future release
1. The mpi module has been re-implemented and is significantly "mo' bettah"
1. The mpi_f08 module offers many, many improvements over mpif.h and the mpi module
This stuff is coming from a VERY long-lived mercurial branch (3 years!); it'll almost certainly take a few SVN commits and a bunch of testing before I get it correctly committed to the SVN trunk.
== More details ==
Craig Rasmussen and I have been working with the MPI-3 Fortran WG and Fortran J3 committees for a long, long time to make a prototype MPI-3 Fortran bindings implementation. We think we're at a stable enough state to bring this stuff back to the trunk, with the goal of including it in OMPI v1.7.
Special thanks go out to everyone who has been incredibly patient and helpful to us in this journey:
* Rolf Rabenseifner/HLRS (mastermind/genius behind the entire MPI-3 Fortran effort)
* The Fortran J3 committee
* Tobias Burnus/gfortran
* Tony !Goetz/Absoft
* Terry !Donte/Oracle
* ...and probably others whom I'm forgetting :-(
There's still opportunities for optimization in the mpi_f08 implementation, but by and large, it is as far along as it can be until Fortran compilers start implementing the new F08 dimension(..) syntax.
Note that gfortran is currently unsupported for the mpi_f08 module and the new mpi module. gfortran users will a) fall back to the same mpi module implementation that is in OMPI v1.5.x, and b) not get the new mpi_f08 module. The gfortran maintainers are actively working hard to add the necessary features to support both the new mpi_f08 module and the new mpi module implementations. This will take some time.
As mentioned above, ompi/mpi/f77 and ompi/mpi/f90 no longer exist. All the fortran bindings implementations have been collated under ompi/mpi/fortran; each implementation has its own subdirectory:
{{{
ompi/mpi/fortran/
base/ - glue code
mpif-h/ - what used to be ompi/mpi/f77
use-mpi-tkr/ - what used to be ompi/mpi/f90
use-mpi-ignore-tkr/ - new mpi module implementation
use-mpi-f08/ - new mpi_f08 module implementation
}}}
There's also a prototype 6-function-MPI implementation under use-mpi-f08-desc that emulates the new F08 dimension(..) syntax that isn't fully available in Fortran compilers yet. We did that to prove it to ourselves that it could be done once the compilers fully support it. This directory/implementation will likely eventually replace the use-mpi-f08 version.
Other things that were done:
* ompi_info grew a few new output fields to describe what level of Fortran support is included
* Existing Fortran examples in examples/ were renamed; new mpi_f08 examples were added
* The old Fortran MPI libraries were renamed:
* libmpi_f77 -> libmpi_mpifh
* libmpi_f90 -> libmpi_usempi
* The configury for Fortran was consolidated and significantly slimmed down. Note that the F77 env variable is now IGNORED for configure; you should only use FC. Example:
{{{
shell$ ./configure CC=icc CXX=icpc FC=ifort ...
}}}
All of this work was done in a Mercurial branch off the SVN trunk, and hosted at Bitbucket. This branch has got to be one of OMPI's longest-running branches. Its first commit was Tue Apr 07 23:01:46 2009 -0400 -- it's over 3 years old! :-) We think we've pulled in all relevant changes from the OMPI trunk (e.g., Fortran implementations of the new MPI-3 MPROBE stuff for mpif.h, use mpi, and use mpi_f08, and the recent Fujitsu Fortran patches).
I anticipate some instability when we bring this stuff into the trunk, simply because it touches a LOT of code in the MPI layer in the OMPI code base. We'll try our best to make it as pain-free as possible, but please bear with us when it is committed.
This commit was SVN r26283.
2012-04-18 19:57:29 +04:00
|
|
|
ompi_predefined_request_t *ompi_request_null_addr = &ompi_request_null;
|
2006-08-24 20:38:08 +04:00
|
|
|
ompi_request_t ompi_request_empty;
|
2005-11-10 03:45:27 +03:00
|
|
|
ompi_status_public_t ompi_status_empty;
|
2007-12-06 12:23:44 +03:00
|
|
|
ompi_request_fns_t ompi_request_functions = {
|
|
|
|
ompi_request_default_test,
|
|
|
|
ompi_request_default_test_any,
|
|
|
|
ompi_request_default_test_all,
|
|
|
|
ompi_request_default_test_some,
|
|
|
|
ompi_request_default_wait,
|
|
|
|
ompi_request_default_wait_any,
|
|
|
|
ompi_request_default_wait_all,
|
|
|
|
ompi_request_default_wait_some
|
|
|
|
};
|
2004-01-29 05:50:02 +03:00
|
|
|
|
2004-06-21 19:24:40 +04:00
|
|
|
static void ompi_request_construct(ompi_request_t* req)
|
2004-01-29 05:50:02 +03:00
|
|
|
{
|
2006-03-16 01:53:41 +03:00
|
|
|
OMPI_REQUEST_INIT(req, false);
|
2007-12-21 09:02:00 +03:00
|
|
|
req->req_free = NULL;
|
|
|
|
req->req_cancel = NULL;
|
|
|
|
req->req_complete_cb = NULL;
|
2011-07-01 00:05:16 +04:00
|
|
|
req->req_complete_cb_data = NULL;
|
2004-10-23 23:24:00 +04:00
|
|
|
req->req_f_to_c_index = MPI_UNDEFINED;
|
2006-10-27 16:32:36 +04:00
|
|
|
req->req_mpi_object.comm = (struct ompi_communicator_t*) NULL;
|
2004-01-29 05:50:02 +03:00
|
|
|
}
|
|
|
|
|
2004-06-21 19:24:40 +04:00
|
|
|
static void ompi_request_destruct(ompi_request_t* req)
|
2004-01-29 05:50:02 +03:00
|
|
|
{
|
2006-03-16 01:53:41 +03:00
|
|
|
assert( MPI_UNDEFINED == req->req_f_to_c_index );
|
|
|
|
assert( OMPI_REQUEST_INVALID == req->req_state );
|
2004-01-29 05:50:02 +03:00
|
|
|
}
|
|
|
|
|
2004-10-20 02:00:19 +04:00
|
|
|
static int ompi_request_null_free(ompi_request_t** request)
|
2004-10-12 19:50:01 +04:00
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ompi_request_null_cancel(ompi_request_t* request, int flag)
|
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-27 21:25:12 +04:00
|
|
|
static int ompi_request_empty_free(ompi_request_t** request)
|
|
|
|
{
|
2009-02-24 20:17:33 +03:00
|
|
|
*request = &ompi_request_null.request;
|
2005-07-27 21:25:12 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-10-27 16:35:27 +04:00
|
|
|
int ompi_request_persistent_proc_null_free(ompi_request_t** request)
|
|
|
|
{
|
2006-10-30 19:02:29 +03:00
|
|
|
OMPI_REQUEST_FINI(*request);
|
2006-10-27 16:35:27 +04:00
|
|
|
(*request)->req_state = OMPI_REQUEST_INVALID;
|
|
|
|
OBJ_RELEASE(*request);
|
2009-02-24 20:17:33 +03:00
|
|
|
*request = &ompi_request_null.request;
|
2006-10-27 16:35:27 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-01-29 05:50:02 +03:00
|
|
|
|
2004-06-21 19:24:40 +04:00
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
ompi_request_t,
|
2006-06-12 20:44:00 +04:00
|
|
|
ompi_free_list_item_t,
|
2004-06-21 19:24:40 +04:00
|
|
|
ompi_request_construct,
|
|
|
|
ompi_request_destruct);
|
|
|
|
|
|
|
|
|
2004-10-08 21:12:36 +04:00
|
|
|
int ompi_request_init(void)
|
|
|
|
{
|
2005-07-04 02:45:48 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_request_lock, opal_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&ompi_request_cond, opal_condition_t);
|
2004-10-12 19:50:01 +04:00
|
|
|
|
2007-10-22 15:28:49 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_request_null, ompi_request_t);
|
2007-12-21 09:02:00 +03:00
|
|
|
OBJ_CONSTRUCT(&ompi_request_f_to_c_table, opal_pointer_array_t);
|
|
|
|
if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_request_f_to_c_table,
|
2009-06-01 23:02:34 +04:00
|
|
|
0, OMPI_FORTRAN_HANDLE_MAX, 64) ) {
|
2007-12-21 09:02:00 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2009-02-24 20:17:33 +03:00
|
|
|
ompi_request_null.request.req_type = OMPI_REQUEST_NULL;
|
|
|
|
ompi_request_null.request.req_status.MPI_SOURCE = MPI_PROC_NULL;
|
|
|
|
ompi_request_null.request.req_status.MPI_TAG = MPI_ANY_TAG;
|
|
|
|
ompi_request_null.request.req_status.MPI_ERROR = MPI_SUCCESS;
|
2010-07-22 00:07:00 +04:00
|
|
|
ompi_request_null.request.req_status._ucount = 0;
|
2009-02-24 20:17:33 +03:00
|
|
|
ompi_request_null.request.req_status._cancelled = 0;
|
|
|
|
|
|
|
|
ompi_request_null.request.req_complete = true;
|
|
|
|
ompi_request_null.request.req_state = OMPI_REQUEST_INACTIVE;
|
|
|
|
ompi_request_null.request.req_persistent = false;
|
|
|
|
ompi_request_null.request.req_f_to_c_index =
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_add(&ompi_request_f_to_c_table, &ompi_request_null);
|
2009-02-24 20:17:33 +03:00
|
|
|
ompi_request_null.request.req_free = ompi_request_null_free;
|
|
|
|
ompi_request_null.request.req_cancel = ompi_request_null_cancel;
|
|
|
|
ompi_request_null.request.req_mpi_object.comm = &ompi_mpi_comm_world.comm;
|
2004-10-12 19:50:01 +04:00
|
|
|
|
2009-02-24 20:17:33 +03:00
|
|
|
if (0 != ompi_request_null.request.req_f_to_c_index) {
|
2004-10-08 21:12:36 +04:00
|
|
|
return OMPI_ERR_REQUEST;
|
|
|
|
}
|
2004-10-27 01:55:20 +04:00
|
|
|
|
2005-07-27 05:00:02 +04:00
|
|
|
/* We need a way to distinguish between the user provided
|
|
|
|
* MPI_REQUEST_NULL to MPI_Wait* and a non-active (MPI_PROC_NULL)
|
|
|
|
* request passed to any P2P non-blocking function.
|
|
|
|
*
|
|
|
|
* The main difference to ompi_request_null is
|
|
|
|
* req_state being OMPI_REQUEST_ACTIVE, so that MPI_Waitall
|
2005-07-27 21:25:12 +04:00
|
|
|
* does not set the status to ompi_status_empty and the different
|
2006-03-16 01:53:41 +03:00
|
|
|
* req_free function, which resets the
|
2005-07-27 21:25:12 +04:00
|
|
|
* request to MPI_REQUEST_NULL.
|
|
|
|
* The req_cancel function need not be changed.
|
2005-07-27 05:00:02 +04:00
|
|
|
*/
|
2007-10-22 15:28:49 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_request_empty, ompi_request_t);
|
|
|
|
ompi_request_empty.req_type = OMPI_REQUEST_NULL;
|
2005-07-27 05:00:02 +04:00
|
|
|
ompi_request_empty.req_status.MPI_SOURCE = MPI_PROC_NULL;
|
|
|
|
ompi_request_empty.req_status.MPI_TAG = MPI_ANY_TAG;
|
|
|
|
ompi_request_empty.req_status.MPI_ERROR = MPI_SUCCESS;
|
2010-07-22 00:07:00 +04:00
|
|
|
ompi_request_empty.req_status._ucount = 0;
|
2005-07-27 05:00:02 +04:00
|
|
|
ompi_request_empty.req_status._cancelled = 0;
|
|
|
|
|
|
|
|
ompi_request_empty.req_complete = true;
|
2007-10-22 15:28:49 +04:00
|
|
|
ompi_request_empty.req_state = OMPI_REQUEST_ACTIVE;
|
|
|
|
ompi_request_empty.req_persistent = false;
|
2005-07-27 05:00:02 +04:00
|
|
|
ompi_request_empty.req_f_to_c_index =
|
2007-12-21 09:02:00 +03:00
|
|
|
opal_pointer_array_add(&ompi_request_f_to_c_table, &ompi_request_empty);
|
2007-10-22 15:28:49 +04:00
|
|
|
ompi_request_empty.req_free = ompi_request_empty_free;
|
|
|
|
ompi_request_empty.req_cancel = ompi_request_null_cancel;
|
2009-02-24 20:17:33 +03:00
|
|
|
ompi_request_empty.req_mpi_object.comm = &ompi_mpi_comm_world.comm;
|
2005-07-27 05:00:02 +04:00
|
|
|
|
|
|
|
if (1 != ompi_request_empty.req_f_to_c_index) {
|
|
|
|
return OMPI_ERR_REQUEST;
|
|
|
|
}
|
|
|
|
|
2004-10-27 01:55:20 +04:00
|
|
|
ompi_status_empty.MPI_SOURCE = MPI_ANY_SOURCE;
|
|
|
|
ompi_status_empty.MPI_TAG = MPI_ANY_TAG;
|
|
|
|
ompi_status_empty.MPI_ERROR = MPI_SUCCESS;
|
2010-07-22 00:07:00 +04:00
|
|
|
ompi_status_empty._ucount = 0;
|
2005-02-24 03:12:26 +03:00
|
|
|
ompi_status_empty._cancelled = 0;
|
2004-10-27 01:55:20 +04:00
|
|
|
|
2004-10-08 21:12:36 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ompi_request_finalize(void)
|
|
|
|
{
|
2009-02-24 20:17:33 +03:00
|
|
|
OMPI_REQUEST_FINI( &ompi_request_null.request );
|
|
|
|
OBJ_DESTRUCT( &ompi_request_null.request );
|
2006-03-16 01:53:41 +03:00
|
|
|
OMPI_REQUEST_FINI( &ompi_request_empty );
|
|
|
|
OBJ_DESTRUCT( &ompi_request_empty );
|
|
|
|
OBJ_DESTRUCT( &ompi_request_cond );
|
|
|
|
OBJ_DESTRUCT( &ompi_request_lock );
|
|
|
|
OBJ_DESTRUCT( &ompi_request_f_to_c_table );
|
2004-10-12 19:50:01 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|