Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit b049180

Browse files
committed
add fortran interfaces to the new nb collective I/O functions
1 parent 488860a commit b049180

File tree

10 files changed

+573
-0
lines changed

10 files changed

+573
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* $COPYRIGHT$
14+
*
15+
* Additional copyrights may follow
16+
*
17+
* $HEADER$
18+
*/
19+
20+
#include "ompi_config.h"
21+
22+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
23+
#include "ompi/mpi/fortran/base/constants.h"
24+
25+
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
26+
#pragma weak PMPI_FILE_IREAD_ALL = ompi_file_iread_all_f
27+
#pragma weak pmpi_file_iread_all = ompi_file_iread_all_f
28+
#pragma weak pmpi_file_iread_all_ = ompi_file_iread_all_f
29+
#pragma weak pmpi_file_iread_all__ = ompi_file_iread_all_f
30+
31+
#pragma weak PMPI_File_iread_all_f = ompi_file_iread_all_f
32+
#pragma weak PMPI_File_iread_all_f08 = ompi_file_iread_all_f
33+
#elif OMPI_PROFILE_LAYER
34+
OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_IREAD_ALL,
35+
pmpi_file_iread_all,
36+
pmpi_file_iread_all_,
37+
pmpi_file_iread_all__,
38+
pompi_file_iread_all_f,
39+
(MPI_Fint *fh, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
40+
(fh, buf, count, datatype, request, ierr) )
41+
#endif
42+
43+
#if OPAL_HAVE_WEAK_SYMBOLS
44+
#pragma weak MPI_FILE_IREAD_ALL = ompi_file_iread_all_f
45+
#pragma weak mpi_file_iread_all = ompi_file_iread_all_f
46+
#pragma weak mpi_file_iread_all_ = ompi_file_iread_all_f
47+
#pragma weak mpi_file_iread_all__ = ompi_file_iread_all_f
48+
49+
#pragma weak MPI_File_iread_all_f = ompi_file_iread_all_f
50+
#pragma weak MPI_File_iread_all_f08 = ompi_file_iread_all_f
51+
#endif
52+
53+
#if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
54+
OMPI_GENERATE_F77_BINDINGS (MPI_FILE_IREAD_ALL,
55+
mpi_file_iread_all,
56+
mpi_file_iread_all_,
57+
mpi_file_iread_all__,
58+
ompi_file_iread_all_f,
59+
(MPI_Fint *fh, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
60+
(fh, buf, count, datatype, request, ierr) )
61+
#endif
62+
63+
64+
#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
65+
#include "ompi/mpi/fortran/mpif-h/profile/defines.h"
66+
#endif
67+
68+
void ompi_file_iread_all_f(MPI_Fint *fh, char *buf, MPI_Fint *count,
69+
MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr)
70+
{
71+
int c_ierr;
72+
MPI_File c_fh = MPI_File_f2c(*fh);
73+
MPI_Datatype c_type = MPI_Type_f2c(*datatype);
74+
MPI_Request c_request;
75+
76+
c_ierr = MPI_File_iread_all(c_fh, OMPI_F2C_BOTTOM(buf),
77+
OMPI_FINT_2_INT(*count),
78+
c_type, &c_request);
79+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
80+
81+
if (MPI_SUCCESS == c_ierr) {
82+
*request = MPI_Request_c2f(c_request);
83+
}
84+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* $COPYRIGHT$
14+
*
15+
* Additional copyrights may follow
16+
*
17+
* $HEADER$
18+
*/
19+
20+
#include "ompi_config.h"
21+
22+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
23+
#include "ompi/mpi/fortran/base/constants.h"
24+
25+
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
26+
#pragma weak PMPI_FILE_IREAD_AT_ALL = ompi_file_iread_at_all_f
27+
#pragma weak pmpi_file_iread_at_all = ompi_file_iread_at_all_f
28+
#pragma weak pmpi_file_iread_at_all_ = ompi_file_iread_at_all_f
29+
#pragma weak pmpi_file_iread_at_all__ = ompi_file_iread_at_all_f
30+
31+
#pragma weak PMPI_File_iread_at_all_f = ompi_file_iread_at_all_f
32+
#pragma weak PMPI_File_iread_at_all_f08 = ompi_file_iread_at_all_f
33+
#elif OMPI_PROFILE_LAYER
34+
OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_IREAD_AT_ALL,
35+
pmpi_file_iread_at_all,
36+
pmpi_file_iread_at_all_,
37+
pmpi_file_iread_at_all__,
38+
pompi_file_iread_at_all_f,
39+
(MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
40+
(fh, offset, buf, count, datatype, request, ierr) )
41+
#endif
42+
43+
#if OPAL_HAVE_WEAK_SYMBOLS
44+
#pragma weak MPI_FILE_IREAD_AT_ALL = ompi_file_iread_at_all_f
45+
#pragma weak mpi_file_iread_at_all = ompi_file_iread_at_all_f
46+
#pragma weak mpi_file_iread_at_all_ = ompi_file_iread_at_all_f
47+
#pragma weak mpi_file_iread_at_all__ = ompi_file_iread_at_all_f
48+
49+
#pragma weak MPI_File_iread_at_all_f = ompi_file_iread_at_all_f
50+
#pragma weak MPI_File_iread_at_all_f08 = ompi_file_iread_at_all_f
51+
#endif
52+
53+
#if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
54+
OMPI_GENERATE_F77_BINDINGS (MPI_FILE_IREAD_AT_ALL,
55+
mpi_file_iread_at_all,
56+
mpi_file_iread_at_all_,
57+
mpi_file_iread_at_all__,
58+
ompi_file_iread_at_all_f,
59+
(MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
60+
(fh, offset, buf, count, datatype, request, ierr) )
61+
#endif
62+
63+
64+
#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
65+
#include "ompi/mpi/fortran/mpif-h/profile/defines.h"
66+
#endif
67+
68+
void ompi_file_iread_at_all_f(MPI_Fint *fh, MPI_Offset *offset,
69+
char *buf, MPI_Fint *count,
70+
MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr)
71+
{
72+
int c_ierr;
73+
MPI_File c_fh = MPI_File_f2c(*fh);
74+
MPI_Datatype c_type = MPI_Type_f2c(*datatype);
75+
MPI_Request c_request;
76+
77+
c_ierr = MPI_File_iread_at_all(c_fh, (MPI_Offset) *offset,
78+
OMPI_F2C_BOTTOM(buf),
79+
OMPI_FINT_2_INT(*count),
80+
c_type,
81+
&c_request);
82+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
83+
84+
if (MPI_SUCCESS == c_ierr) {
85+
*request = MPI_Request_c2f(c_request);
86+
}
87+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* $COPYRIGHT$
14+
*
15+
* Additional copyrights may follow
16+
*
17+
* $HEADER$
18+
*/
19+
20+
#include "ompi_config.h"
21+
22+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
23+
#include "ompi/mpi/fortran/base/constants.h"
24+
25+
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
26+
#pragma weak PMPI_FILE_IWRITE_ALL = ompi_file_iwrite_all_f
27+
#pragma weak pmpi_file_iwrite_all = ompi_file_iwrite_all_f
28+
#pragma weak pmpi_file_iwrite_all_ = ompi_file_iwrite_all_f
29+
#pragma weak pmpi_file_iwrite_all__ = ompi_file_iwrite_all_f
30+
31+
#pragma weak PMPI_File_iwrite_all_f = ompi_file_iwrite_all_f
32+
#pragma weak PMPI_File_iwrite_all_f08 = ompi_file_iwrite_all_f
33+
#elif OMPI_PROFILE_LAYER
34+
OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_IWRITE_ALL,
35+
pmpi_file_iwrite_all,
36+
pmpi_file_iwrite_all_,
37+
pmpi_file_iwrite_all__,
38+
pompi_file_iwrite_all_f,
39+
(MPI_Fint *fh, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
40+
(fh, buf, count, datatype, request, ierr) )
41+
#endif
42+
43+
#if OPAL_HAVE_WEAK_SYMBOLS
44+
#pragma weak MPI_FILE_IWRITE_ALL = ompi_file_iwrite_all_f
45+
#pragma weak mpi_file_iwrite_all = ompi_file_iwrite_all_f
46+
#pragma weak mpi_file_iwrite_all_ = ompi_file_iwrite_all_f
47+
#pragma weak mpi_file_iwrite_all__ = ompi_file_iwrite_all_f
48+
49+
#pragma weak MPI_File_iwrite_all_f = ompi_file_iwrite_all_f
50+
#pragma weak MPI_File_iwrite_all_f08 = ompi_file_iwrite_all_f
51+
#endif
52+
53+
#if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
54+
OMPI_GENERATE_F77_BINDINGS (MPI_FILE_IWRITE_ALL,
55+
mpi_file_iwrite_all,
56+
mpi_file_iwrite_all_,
57+
mpi_file_iwrite_all__,
58+
ompi_file_iwrite_all_f,
59+
(MPI_Fint *fh, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
60+
(fh, buf, count, datatype, request, ierr) )
61+
#endif
62+
63+
64+
#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
65+
#include "ompi/mpi/fortran/mpif-h/profile/defines.h"
66+
#endif
67+
68+
void ompi_file_iwrite_all_f(MPI_Fint *fh, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr)
69+
{
70+
int c_ierr;
71+
MPI_File c_fh = MPI_File_f2c(*fh);
72+
MPI_Datatype c_type = MPI_Type_f2c(*datatype);
73+
MPI_Request c_request;
74+
75+
c_ierr = MPI_File_iwrite_all(c_fh, OMPI_F2C_BOTTOM(buf),
76+
OMPI_FINT_2_INT(*count),
77+
c_type, &c_request);
78+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
79+
80+
if (MPI_SUCCESS == c_ierr) {
81+
*request = MPI_Request_c2f(c_request);
82+
}
83+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3+
* University Research and Technology
4+
* Corporation. All rights reserved.
5+
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* of Tennessee Research Foundation. All rights
7+
* reserved.
8+
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9+
* University of Stuttgart. All rights reserved.
10+
* Copyright (c) 2004-2005 The Regents of the University of California.
11+
* All rights reserved.
12+
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
13+
* $COPYRIGHT$
14+
*
15+
* Additional copyrights may follow
16+
*
17+
* $HEADER$
18+
*/
19+
20+
#include "ompi_config.h"
21+
22+
#include "ompi/mpi/fortran/mpif-h/bindings.h"
23+
#include "ompi/mpi/fortran/base/constants.h"
24+
25+
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
26+
#pragma weak PMPI_FILE_IWRITE_AT_ALL = ompi_file_iwrite_at_all_f
27+
#pragma weak pmpi_file_iwrite_at_all = ompi_file_iwrite_at_all_f
28+
#pragma weak pmpi_file_iwrite_at_all_ = ompi_file_iwrite_at_all_f
29+
#pragma weak pmpi_file_iwrite_at_all__ = ompi_file_iwrite_at_all_f
30+
31+
#pragma weak PMPI_File_iwrite_at_all_f = ompi_file_iwrite_at_all_f
32+
#pragma weak PMPI_File_iwrite_at_all_f08 = ompi_file_iwrite_at_all_f
33+
#elif OMPI_PROFILE_LAYER
34+
OMPI_GENERATE_F77_BINDINGS (PMPI_FILE_IWRITE_AT_ALL,
35+
pmpi_file_iwrite_at_all,
36+
pmpi_file_iwrite_at_all_,
37+
pmpi_file_iwrite_at_all__,
38+
pompi_file_iwrite_at_all_f,
39+
(MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
40+
(fh, offset, buf, count, datatype, request, ierr) )
41+
#endif
42+
43+
#if OPAL_HAVE_WEAK_SYMBOLS
44+
#pragma weak MPI_FILE_IWRITE_AT_ALL = ompi_file_iwrite_at_all_f
45+
#pragma weak mpi_file_iwrite_at_all = ompi_file_iwrite_at_all_f
46+
#pragma weak mpi_file_iwrite_at_all_ = ompi_file_iwrite_at_all_f
47+
#pragma weak mpi_file_iwrite_at_all__ = ompi_file_iwrite_at_all_f
48+
49+
#pragma weak MPI_File_iwrite_at_all_f = ompi_file_iwrite_at_all_f
50+
#pragma weak MPI_File_iwrite_at_all_f08 = ompi_file_iwrite_at_all_f
51+
#endif
52+
53+
#if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
54+
OMPI_GENERATE_F77_BINDINGS (MPI_FILE_IWRITE_AT_ALL,
55+
mpi_file_iwrite_at_all,
56+
mpi_file_iwrite_at_all_,
57+
mpi_file_iwrite_at_all__,
58+
ompi_file_iwrite_at_all_f,
59+
(MPI_Fint *fh, MPI_Offset *offset, char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *request, MPI_Fint *ierr),
60+
(fh, offset, buf, count, datatype, request, ierr) )
61+
#endif
62+
63+
64+
#if OMPI_PROFILE_LAYER && ! OPAL_HAVE_WEAK_SYMBOLS
65+
#include "ompi/mpi/fortran/mpif-h/profile/defines.h"
66+
#endif
67+
68+
void ompi_file_iwrite_at_all_f(MPI_Fint *fh, MPI_Offset *offset, char *buf,
69+
MPI_Fint *count, MPI_Fint *datatype,
70+
MPI_Fint *request, MPI_Fint *ierr)
71+
{
72+
int c_ierr;
73+
MPI_File c_fh = MPI_File_f2c(*fh);
74+
MPI_Datatype c_type = MPI_Type_f2c(*datatype);
75+
MPI_Request c_request;
76+
77+
c_ierr = MPI_File_iwrite_at_all(c_fh, (MPI_Offset) *offset,
78+
OMPI_F2C_BOTTOM(buf),
79+
OMPI_FINT_2_INT(*count),
80+
c_type, &c_request);
81+
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
82+
83+
if (MPI_SUCCESS == c_ierr) {
84+
*request = MPI_Request_c2f(c_request);
85+
}
86+
}

ompi/mpi/fortran/use-mpi-f08/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,13 @@ mpi_api_files += \
393393
file_get_view_f08.F90 \
394394
file_iread_at_f08.F90 \
395395
file_iread_f08.F90 \
396+
file_iread_at_all_f08.F90 \
397+
file_iread_all_f08.F90 \
396398
file_iread_shared_f08.F90 \
397399
file_iwrite_at_f08.F90 \
398400
file_iwrite_f08.F90 \
401+
file_iwrite_at_all_f08.F90 \
402+
file_iwrite_all_f08.F90 \
399403
file_iwrite_shared_f08.F90 \
400404
file_open_f08.F90 \
401405
file_preallocate_f08.F90 \
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
! -*- f90 -*-
2+
!
3+
! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
4+
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
5+
! All Rights reserved.
6+
! $COPYRIGHT$
7+
8+
#include "ompi/mpi/fortran/configure-fortran-output.h"
9+
10+
subroutine MPI_File_iread_all_f08(fh,buf,count,datatype,request,ierror)
11+
use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request
12+
use :: mpi_f08, only : ompi_file_iread_all_f
13+
implicit none
14+
TYPE(MPI_File), INTENT(IN) :: fh
15+
OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf
16+
INTEGER, INTENT(IN) :: count
17+
TYPE(MPI_Datatype), INTENT(IN) :: datatype
18+
TYPE(MPI_Request), INTENT(OUT) :: request
19+
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
20+
integer :: c_ierror
21+
22+
call ompi_file_iread_all_f(fh%MPI_VAL,buf,count,datatype%MPI_VAL,request%MPI_VAL,c_ierror)
23+
if (present(ierror)) ierror = c_ierror
24+
25+
end subroutine MPI_File_iread_all_f08

0 commit comments

Comments
 (0)