Commit 1aa13314 authored by Pavan Balaji's avatar Pavan Balaji Committed by Junchao Zhang
Browse files

build system fixes for f08

No review since F08 binding is experimental now.
parent fd3f06f6
......@@ -134,7 +134,7 @@ endif BUILD_F77_BINDING
mpi_sources =
mpi_f77_sources =
mpi_fc_sources =
mpi_f08_sources =
mpi_fc_modules =
mpi_cxx_sources =
mpi_core_sources =
......@@ -178,11 +178,9 @@ lib_lib@MPIFCLIBNAME@_la_CPPFLAGS += -DMPICH_MPI_FROM_PMPI -DUSE_ONLY_MPI_NAMES
endif BUILD_PROFILING_LIB
lib_lib@MPIFCLIBNAME@_la_SOURCES = $(mpi_f77_sources)
if BUILD_FC_BINDING
modinc_HEADERS = $(mpi_fc_modules)
lib_lib@MPIFCLIBNAME@_la_SOURCES += $(mpi_fc_sources)
endif BUILD_FC_BINDING
if BUILD_F08_BINDING
lib_lib@MPIFCLIBNAME@_la_SOURCES += $(mpi_f08_sources)
endif BUILD_F08_BINDING
lib_lib@MPIFCLIBNAME@_la_LDFLAGS = $(ABIVERSIONFLAGS)
lib_lib@MPIFCLIBNAME@_la_LIBADD = lib/lib@MPILIBNAME@.la
endif BUILD_F77_BINDING
......
......@@ -1128,8 +1128,7 @@ AC_COMPILE_IFELSE([
AC_LANG_SOURCE(
[[
#include <ISO_Fortran_binding.h>
]],
[[
int foo_c(CFI_cdesc_t * a_desc, CFI_cdesc_t * b_desc)
{
char * a_row = (char*) a_desc->base_addr;
......
......@@ -2182,8 +2182,6 @@ if test "$enable_fc" = "yes" ; then
bindings="$bindings f90"
if test "$enable_f08" = "yes" ; then
f08_works=yes
elif test "$enable_f08" = "auto" ; then
PAC_FC_2008_SUPPORT([f08_works=yes],[f08_works=no])
fi
fi
......
......@@ -1012,19 +1012,16 @@ createModSteps('src/binding/fortran/use_mpi/$(MPIBASEMOD).$(MOD)',
## shouldn't be necessary, now the deps should be right...
# avoid dependency problems and attain an effect similar to simplemake's "all-preamble"
#BUILT_SOURCES += \$(mpi_f90_modules)
#BUILT_SOURCES += \$(mpi_fc_modules)
print MAKEFD <<EOT;
mpi_f90_modules = \\
mpi_fc_modules += \\
src/binding/fortran/use_mpi/\$(MPIMOD).\$(MOD) \\
src/binding/fortran/use_mpi/\$(MPISIZEOFMOD).\$(MOD) \\
src/binding/fortran/use_mpi/\$(MPICONSTMOD).\$(MOD) \\
src/binding/fortran/use_mpi/\$(MPIBASEMOD).\$(MOD)
# the modules are effectively precompiled headers for Fortran programs
modinc_HEADERS = \$(mpi_f90_modules)
# We need a free-format version of mpif.h with no external commands,
# including no wtime/wtick (removing MPI_WTICK also removes MPI_WTIME,
# but leave MPI_WTIME_IS_GLOBAL).
......@@ -1042,7 +1039,7 @@ CLEANFILES += src/binding/fortran/use_mpi/mpifnoext.h
EOT
print MAKEFD "MAINTAINERCLEANFILES += \$(mpi_sources) fproto.h\n";
print MAKEFD "CLEANFILES += \$(mpi_f90_modules)\n";
print MAKEFD "CLEANFILES += \$(mpi_fc_modules)\n";
print MAKEFD "\n";
#print MAKEFD "install_BIN = mpifort\n";
......
......@@ -95,52 +95,91 @@ if BUILD_F08_BINDING
EOT
print $makefile_fh "AM_FCFLAGS += \@FCINCFLAG\@$cur_dir\n\n";
print $makefile_fh "AM_FCFLAGS += \@FCINCFLAG\@src/binding/fortran/use_mpi\n\n";
print $makefile_fh "mpi_f08_sources += \\\n";
@files = glob("*mpi_f08*.F90");
for (my $i=0; $i<=$#files; $i++) {
print $makefile_fh "\t$cur_dir/$files[$i]";
if ($i != $#files) {
print $makefile_fh " \\\n";
} else {
print $makefile_fh "\n\n";
}
print $makefile_fh <<EOT;
mpi_fc_sources += \\
src/binding/fortran/use_mpi_f08/pmpi_f08.F90 \\
src/binding/fortran/use_mpi_f08/mpi_f08.F90 \\
src/binding/fortran/use_mpi_f08/mpi_f08_callbacks.F90 \\
src/binding/fortran/use_mpi_f08/mpi_f08_compile_constants.F90 \\
src/binding/fortran/use_mpi_f08/mpi_f08_link_constants.F90 \\
src/binding/fortran/use_mpi_f08/mpi_f08_types.F90 \\
src/binding/fortran/use_mpi_f08/mpi_c_interface_cdesc.F90 \\
src/binding/fortran/use_mpi_f08/mpi_c_interface_glue.F90 \\
src/binding/fortran/use_mpi_f08/mpi_c_interface_nobuf.F90 \\
src/binding/fortran/use_mpi_f08/mpi_c_interface_types.F90 \\
src/binding/fortran/use_mpi/pmpi_f08.\$(MOD) \\
src/binding/fortran/use_mpi/mpi_f08.\$(MOD) \\
src/binding/fortran/use_mpi/mpi_f08_callbacks.\$(MOD) \\
src/binding/fortran/use_mpi/mpi_f08_compile_constants.\$(MOD) \\
src/binding/fortran/use_mpi/mpi_f08_link_constants.\$(MOD) \\
src/binding/fortran/use_mpi/mpi_f08_types.\$(MOD)
EOT
print $makefile_fh "mpi_fc_modules += src/binding/fortran/use_mpi/mpi_f08.\$(MOD)\n\n";
my %f08_mods = (
"mpi_c_interface" => "mpi_c_interface_cdesc",
"mpi_c_interface_cdesc" => "mpi_c_interface_nobuf",
"mpi_c_interface_nobuf" => "mpi_c_interface_glue",
"mpi_c_interface_glue" => "mpi_f08",
"mpi_f08" => "pmpi_f08",
"pmpi_f08" => "mpi_f08_link_constants",
"mpi_f08_link_constants" => "mpi_f08_callbacks",
"mpi_f08_callbacks" => "mpi_f08_compile_constants",
"mpi_f08_compile_constants" => "mpi_f08_types",
"mpi_f08_types" => "mpi_c_interface_types",
"mpi_c_interface_types" => "",
);
print $makefile_fh "BUILT_SOURCES += ";
foreach my $x (keys %f08_mods) {
print $makefile_fh "src/binding/fortran/use_mpi/$x.\$(MOD) ";
}
print $makefile_fh "\n\n";
print $makefile_fh "mpi_f08_sources += \\\n";
@files = glob("*mpi_f08*.F90");
for (my $i=0; $i<=$#files; $i++) {
my $file = $files[$i];
$file =~ s{.*/}{}; # removes path
$file =~ s{\.[^.]+$}{}; # removes extension
print $makefile_fh "\t$cur_dir/$file.\$(MOD)";
if ($i != $#files) { print $makefile_fh " \\\n"; } else { print $makefile_fh "\n\n"; }
print $makefile_fh "CLEANFILES += ";
foreach my $x (keys %f08_mods) {
print $makefile_fh "src/binding/fortran/use_mpi/$x.\$(MOD) ";
}
print $makefile_fh "\n\n";
print $makefile_fh "modinc_HEADERS = \$(mpi_f08_modules)\n\n";
foreach my $x (keys %f08_mods) {
print $makefile_fh "src/binding/fortran/use_mpi/$x.\$(MOD) src/binding/fortran/use_mpi_f08/$x.lo:";
if ($f08_mods{$x}) {print $makefile_fh " src/binding/fortran/use_mpi/$f08_mods{$x}.\$(MOD)";}
print $makefile_fh "\n";
print $makefile_fh "\t\$(mod_verbose)\$(FC_COMPILE_MODS) -c src/binding/fortran/use_mpi_f08/`echo \$\@ | cut -f1 -d '.' | sed -e 's+.*/++g'`.F90 -o src/binding/fortran/use_mpi_f08/`echo \$\@ | cut -f1 -d '.' | sed -e 's+.*/++g'`.lo\n\n";
}
print $makefile_fh "mpi_f08_sources += \\\n";
@files = glob("mpi_c_interface_*.F90");
print $makefile_fh "mpi_fc_sources += \\\n";
@files = glob("$wrappers_f_dir/*.F90");
for (my $i=0; $i<=$#files; $i++) {
print $makefile_fh "\t$cur_dir/$files[$i]";
if ($i != $#files) { print $makefile_fh " \\\n"; } else { print $makefile_fh "\n\n"; }
}
print $makefile_fh "mpi_f08_sources += \\\n";
@files = glob("$wrappers_f_dir/*.F90");
for (my $i=0; $i<=$#files; $i++) {
print $makefile_fh "\t$cur_dir/$files[$i]";
if ($i != $#files) { print $makefile_fh " \\\n"; } else { print $makefile_fh "\n\n"; }
my $fname = $files[$i];
$fname =~ s/\.F90/.lo/g;
print $makefile_fh "$cur_dir/$fname: src/binding/fortran/use_mpi/mpi_f08.\$(MOD) src/binding/fortran/use_mpi/mpi_c_interface.\$(MOD)\n\n";
}
print $makefile_fh "mpi_core_sources += \\\n";
print $makefile_fh "mpi_fc_sources += \\\n";
@files = glob("$pmpi_dir/*.F90");
for (my $i=0; $i<=$#files; $i++) {
print $makefile_fh "\t$cur_dir/$files[$i]";
if ($i != $#files) { print $makefile_fh " \\\n"; } else { print $makefile_fh "\n\n"; }
}
for (my $i=0; $i<=$#files; $i++) {
my $fname = $files[$i];
$fname =~ s/\.F90/.lo/g;
print $makefile_fh "$cur_dir/$fname: src/binding/fortran/use_mpi/mpi_f08.\$(MOD) src/binding/fortran/use_mpi/mpi_c_interface.\$(MOD)\n\n";
}
print $makefile_fh "include \$(top_srcdir)/src/binding/fortran/use_mpi_f08/wrappers_c/Makefile.mk\n\n";
print $makefile_fh "endif BUILD_F08_BINDING\n";
......
......@@ -175,7 +175,7 @@ unless (-e "Makefile.mk") {
EXTRA_DIST += src/binding/fortran/use_mpi_f08/wrappers_c/buildiface
if BUILD_F08_BINDING
mpi_f08_sources += \\
mpi_fc_sources += \\
EOT
} else {
open(MAKEFD, ">>Makefile.mk") || die "Could not open Makefile.mk\n";
......
......@@ -1181,16 +1181,9 @@ AM_CONDITIONAL([BUILD_F90_TESTS],[test "X$f90dir" = "f90"])
f08dir="#"
AC_SUBST(f08dir)
# Determine if tests for Fortran 2008 should be run.
if test "$enable_f08" = "yes" ; then
otherlangs="$otherlangs f08"
f08dir=f08
elif test "$enable_f08" = "auto" ; then
# FIXME add a test to compile a Fortran 2008 MPI program
PAC_FC_2008_SUPPORT([
otherlangs="$otherlangs f08"
f08dir=f08
],[no])
# FIXME if $FROM_MPICH is no, we should test build an MPI F08 program
if test "$enable_f08" = "yes" -a "$FROM_MPICH" = "yes" ; then
f08dir=f08
fi
# Running C++ compiler tests
......@@ -1605,6 +1598,8 @@ AC_OUTPUT(maint/testmerge \
errors/f77/io/iooffset.h \
errors/f90/Makefile \
errors/f90/io/Makefile \
errors/f08/Makefile \
errors/f08/io/Makefile \
ckpoint/Makefile \
ft/Makefile \
manual/Makefile \
......
......@@ -11,6 +11,6 @@ include $(top_srcdir)/Makefile.mtest
# simplemake version for some reason and is also missing from the testlist
# file
static_subdirs = attr coll comm datatype group pt2pt rma topo basic faults
all_lang_subdirs = cxx f77 f90
all_lang_subdirs = cxx f77 f90 f08
SUBDIRS = $(static_subdirs) $(iodir) $(otherlangs) $(spawndir)
DIST_SUBDIRS = $(static_subdirs) io $(all_lang_subdirs) spawn
# -*- Mode: Makefile; -*-
# vim: set ft=automake :
#
# (C) 2011 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
#
include $(top_srcdir)/Makefile_f08.mtest
EXTRA_DIST = testlist
SUBDIRS = @iodir@
DIST_SUBDIRS = io
# This Makefile.am generated automatically by f77tof90
# from test/mpi/errors/f77/io/Makefile.am. DO NOT EDIT
# -*- Mode: Makefile; -*-
# vim: set ft=automake :
#
# (C) 2011 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
#
include $(top_srcdir)/Makefile_f08.mtest
EXTRA_DIST = testlist
AM_DEFAULT_SOURCE_EXT = .f90
## for all programs that are just built from the single corresponding source
## file, we don't need per-target _SOURCES rules, automake will infer them
## correctly
noinst_PROGRAMS = uerrhandf08
! This file created from test/mpi/errors/f77/io/uerrhandf.f with f77tof90
! -*- Mode: Fortran; -*-
!
! (C) 2013 by Argonne National Laboratory.
! See COPYRIGHT in top-level directory.
!
program main
use mpi_f08
integer (kind=MPI_ADDRESS_KIND) asize
integer (kind=MPI_OFFSET_KIND) offset
integer ierr, rank, i
integer errs
external comm_errh_fn, win_errh_fn, file_errh_fn
TYPE(MPI_Errhandles) comm_errh, win_errh, file_errh
integer winbuf(2), wdsize, sizeofint, id
TYPE(MPI_Win) winh
TYPE(MPI_Comm) wdup
integer fh
TYPE(MPI_Status) status
common /ec/ iseen
integer iseen(3)
save /ec/
iseen(1) = 0
iseen(2) = 0
iseen(3) = 0
ierr = -1
errs = 0
call mtest_init( ierr )
call mpi_type_size( MPI_INTEGER, sizeofint, ierr )
call mpi_comm_create_errhandler( comm_errh_fn, comm_errh, ierr )
if (ierr .ne. MPI_SUCCESS) then
call mtestprinterrormsg( "Comm_create_errhandler:", ierr )
errs = errs + 1
endif
call mpi_win_create_errhandler( win_errh_fn, win_errh, ierr )
if (ierr .ne. MPI_SUCCESS) then
call mtestprinterrormsg( "Win_create_errhandler:", ierr )
errs = errs + 1
endif
call mpi_file_create_errhandler( file_errh_fn, file_errh, ierr )
if (ierr .ne. MPI_SUCCESS) then
call mtestprinterrormsg( "File_create_errhandler:", ierr )
errs = errs + 1
endif
!
call mpi_comm_dup( MPI_COMM_WORLD, wdup, ierr )
call mpi_comm_set_errhandler( wdup, comm_errh, ierr )
call mpi_comm_size( wdup, wdsize, ierr )
call mpi_send( id, 1, MPI_INTEGER, wdsize, -37, wdup, ierr )
if (ierr .eq. MPI_SUCCESS) then
print *, ' Failed to detect error in use of MPI_SEND'
errs = errs + 1
else
if (iseen(1) .ne. 1) then
errs = errs + 1
print *, ' Failed to increment comm error counter'
endif
endif
asize = 2*sizeofint
call mpi_win_create( winbuf, asize, sizeofint, MPI_INFO_NULL &
& , wdup, winh, ierr )
if (ierr .ne. MPI_SUCCESS) then
call mtestprinterrormsg( "Win_create:", ierr )
errs = errs + 1
endif
call mpi_win_set_errhandler( winh, win_errh, ierr )
asize = 0
call mpi_put( winbuf, 1, MPI_INT, wdsize, asize, 1, MPI_INT, winh, &
& ierr )
if (ierr .eq. MPI_SUCCESS) then
print *, ' Failed to detect error in use of MPI_PUT'
errs = errs + 1
else
if (iseen(3) .ne. 1) then
errs = errs + 1
print *, ' Failed to increment win error counter'
endif
endif
call mpi_file_open( MPI_COMM_SELF, 'ftest', MPI_MODE_CREATE + &
& MPI_MODE_RDWR + MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, fh, &
& ierr )
if (ierr .ne. MPI_SUCCESS) then
call mtestprinterrormsg( "File_open:", ierr )
errs = errs + 1
endif
call mpi_file_set_errhandler( fh, file_errh, ierr )
offset = -100
call mpi_file_read_at( fh, offset, winbuf, 1, MPI_INTEGER, status, &
& ierr )
if (ierr .eq. MPI_SUCCESS) then
print *, ' Failed to detect error in use of MPI_PUT'
errs = errs + 1
else
if (iseen(2) .ne. 1) then
errs = errs + 1
print *, ' Failed to increment file error counter'
endif
endif
call mpi_comm_free( wdup, ierr )
call mpi_win_free( winh, ierr )
call mpi_file_close( fh, ierr )
call mpi_errhandler_free( win_errh, ierr )
call mpi_errhandler_free( comm_errh, ierr )
call mpi_errhandler_free( file_errh, ierr )
call mtest_finalize( errs )
call mpi_finalize( ierr )
end
!
subroutine comm_errh_fn( comm, ec )
integer comm, ec
common /ec/ iseen
integer iseen(3)
save /ec/
!
iseen(1) = iseen(1) + 1
!
end
!
subroutine win_errh_fn( win, ec )
integer win, ec
common /ec/ iseen
integer iseen(3)
save /ec/
!
iseen(3) = iseen(3) + 1
!
end
subroutine file_errh_fn( fh, ec )
integer fh, ec
common /ec/ iseen
integer iseen(3)
save /ec/
!
iseen(2) = iseen(2) + 1
!
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment