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

Topic/v1.10/nag configury #1216

Merged
merged 6 commits into from
Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions autogen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -899,10 +899,15 @@ sub patch_autotools_output {
# enough Libtool that dosn't need this patch. But don't alarm the
# user and make them think that autogen failed if this patch fails --
# make the errors be silent.
# Also patch ltmain.sh for NAG compiler
if (-f "config/ltmain.sh") {
verbose "$indent_str"."Patching PGI compiler version numbers in ltmain.sh\n";
system("$patch_prog -N -p0 < $topdir/config/ltmain_pgi_tp.diff >/dev/null 2>&1");
unlink("config/ltmain.sh.rej");

verbose "$indent_str"."Patching \"-pthread\" option for NAG compiler in ltmain.sh\n";
system("$patch_prog -N -p0 < $topdir/config/ltmain_nag_pthread.diff >/dev/null 2>&1");
unlink("config/ltmain.sh.rej");
}

# Total ugh. We have to patch the configure script itself. See below
Expand Down Expand Up @@ -969,6 +974,25 @@ sub patch_autotools_output {
$c =~ s/$search_string/$replace_string/;
}

foreach my $tag (("", "_FC")) {

# We have to change the search pattern and substitution on each
# iteration to take into account the tag changing
my $search_string = 'lf95\052.*# Lahey Fortran 8.1\n\s+' .
"whole_archive_flag_spec${tag}=" . '\n\s+' .
"tmp_sharedflag='--shared' ;;" . '\n\s+' .
'xl';
my $replace_string = "lf95*) # Lahey Fortran 8.1
whole_archive_flag_spec${tag}=
tmp_sharedflag='--shared' ;;
nagfor*) # NAGFOR 5.3
tmp_sharedflag='-Wl,-shared';;
xl";

verbose "$indent_str"."Patching configure for NAG compiler ($tag)\n";
$c =~ s/$search_string/$replace_string/;
}

# Oracle has apparently begun (as of 12.5-beta) removing the "Sun" branding.
# So this patch (cumulative over the previous one) is required.
verbose "$indent_str"."Patching configure for Oracle Studio Fortran version strings\n";
Expand Down
7 changes: 5 additions & 2 deletions config/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved.
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -21,8 +23,9 @@

EXTRA_DIST = \
distscript.csh \
opal_get_version.m4sh \
ltmain_pgi_tp.diff \
opal_get_version.m4sh \
ltmain_nag_pthread.diff \
ltmain_pgi_tp.diff \
ompi_mca_priority_sort.pl

maintainer-clean-local:
Expand Down
18 changes: 18 additions & 0 deletions config/ltmain_nag_pthread.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- config/ltmain.sh
+++ config/ltmain.sh
@@ -6417,8 +6417,14 @@
func_source "$lib"

# Convert "-framework foo" to "foo.ltframework"
+ # and "-pthread" to "-Wl,-pthread" if NAG compiler
if test -n "$inherited_linker_flags"; then
- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ case "$CC" in
+ nagfor*)
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g' | $SED 's/-pthread/-Wl,-pthread'`;;
+ *)
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`;;
+ esac
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
28 changes: 26 additions & 2 deletions config/ompi_setup_fc.m4
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -41,7 +43,7 @@ AC_DEFUN_ONCE([_OMPI_SETUP_FC_COMPILER],[
# Fortran compilers (excluding the f77 compiler names) from AC's
# default list of compilers and use it here. This is the main
# reason we have an OMPI-ized version of the PROG_FC macro.
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90])
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90 nagfor])
FCFLAGS="$ompi_fcflags_save"
OPAL_VAR_SCOPE_POP
])
Expand Down Expand Up @@ -107,7 +109,29 @@ AC_DEFUN([OMPI_SETUP_FC],[
;;
esac])
AC_SUBST(OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS)


# The Absoft compiler does not like the fact that we use lots of
# "ignore TKR" comment pragmas that it doesn't understand, and
# will warn about them. From Tony Goetz at Absoft, we can use the
# -Z790 flag to quell these warnings.
# The NAG compiler is too picky about naming conventions, so use the
# -mismatch flag to keep it happy
AC_MSG_CHECKING([for $FC warnings flags])
fc_version=`$FC --version 2>&1`
case "$fc_version" in
*Absoft*)
AC_MSG_RESULT([-Z790])
FCFLAGS="$FCFLAGS -Z790"
;;
*NAG*)
AC_MSG_RESULT([-mismatch])
FCFLAGS="$FCFLAGS -mismatch"
;;
*)
AC_MSG_RESULT([none])
;;
esac

# If we're still good, then save the extra file types. Do this last
# because it implies tests that should be invoked by the above tests
# (e.g., running the fortran compiler).
Expand Down
86 changes: 79 additions & 7 deletions config/opal_setup_wrappers.m4
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
Expand Down Expand Up @@ -172,7 +172,33 @@ EOF

AS_IF([test -n "$rpath_args"],
[WRAPPER_RPATH_SUPPORT=rpath
AC_MSG_RESULT([yes ($rpath_args)])],
cat > $rpath_script <<EOF
#!/bin/sh

# Slurp in the libtool config into my environment

# Apparently, "libtoool --config" calls "exit", so we can't source it
# (because if script A sources script B, and B calls "exit", then both
# B and A will exit). Instead, we have to send the output to a file
# and then source that.
$OPAL_TOP_BUILDDIR/libtool --tag=FC --config > $rpath_outfile

chmod +x $rpath_outfile
. ./$rpath_outfile
rm -f $rpath_outfile

# Evaluate \$hardcode_libdir_flag_spec, and substitute in LIBDIR for \$libdir
libdir=LIBDIR
flags="\`eval echo \$hardcode_libdir_flag_spec\`"
echo \$flags

# Done
exit 0
EOF
chmod +x $rpath_script
rpath_fc_args=`./$rpath_script`
rm -f $rpath_script
AC_MSG_RESULT([yes ($rpath_args + $rpath_fc_args)])],
[WRAPPER_RPATH_SUPPORT=unnecessary
AC_MSG_RESULT([yes (no extra flags needed)])])

Expand All @@ -191,7 +217,7 @@ EOF
# If DT_RUNPATH is supported, then we'll use *both* the RPATH and
# RUNPATH flags in the LDFLAGS.
AC_DEFUN([OPAL_SETUP_RUNPATH],[
OPAL_VAR_SCOPE_PUSH([LDFLAGS_save])
OPAL_VAR_SCOPE_PUSH([LDFLAGS_save rpath_script rpath_outfile wl_fc])

AC_MSG_CHECKING([if linker supports RUNPATH])
# Set the output in $runpath_args
Expand All @@ -205,6 +231,44 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])],
[AC_MSG_RESULT([no])])
AC_LANG_POP([C])
# Output goes into globally-visible $rpath_args. Run this in a
# sub-process so that we don't pollute the current process
# environment.
rpath_script=conftest.$$.sh
rpath_outfile=conftest.$$.out
rm -f $rpath_script $rpath_outfile
cat > $rpath_script <<EOF
#!/bin/sh

# Slurp in the libtool config into my environment

# Apparently, "libtoool --config" calls "exit", so we can't source it
# (because if script A sources script B, and B calls "exit", then both
# B and A will exit). Instead, we have to send the output to a file
# and then source that.
$OPAL_TOP_BUILDDIR/libtool --tag=FC--config > $rpath_outfile

chmod +x $rpath_outfile
. ./$rpath_outfile
rm -f $rpath_outfile

wl="\`eval echo \$wl\`"
echo \$wl

# Done
exit 0
EOF
chmod +x $rpath_script
wl_fc=`./$rpath_script`
rm -f $rpath_script

LDFLAGS="$LDFLAGS_save ${wl_fc}--enable-new-dtags"
AC_LANG_PUSH([Fortran])
AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
end program]])],
[runpath_fc_args="${wl_fc}--enable-new-dtags"],
[runpath_fc_args=""])
AC_LANG_POP([Fortran])
LDFLAGS=$LDFLAGS_save

OPAL_VAR_SCOPE_POP
Expand All @@ -214,27 +278,31 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
# for each of them. Then also add in an RPATH for @{libdir} (which
# will be replaced by the wrapper compile to the installdir libdir at
# runtime), and the RUNPATH args, if we have them.
AC_DEFUN([RPATHIFY_LDFLAGS],[
AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL],[
OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp])
AS_IF([test "$enable_wrapper_rpath" = "yes" && test "$WRAPPER_RPATH_SUPPORT" != "disabled" && test "$WRAPPER_RPATH_SUPPORT" != "unnecessary"], [
rpath_out=""
for val in ${$1}; do
case $val in
-L*)
rpath_dir=`echo $val | cut -c3-`
rpath_tmp=`echo $rpath_args | sed -e s@LIBDIR@$rpath_dir@`
rpath_tmp=`echo ${$2} | sed -e s@LIBDIR@$rpath_dir@`
rpath_out="$rpath_out $rpath_tmp"
;;
esac
done

# Now add in the RPATH args for @{libdir}, and the RUNPATH args
rpath_tmp=`echo $rpath_args | sed -e s/LIBDIR/@{libdir}/`
$1="${$1} $rpath_out $rpath_tmp $runpath_args"
rpath_tmp=`echo ${$2} | sed -e s/LIBDIR/@{libdir}/`
$1="${$1} $rpath_out $rpath_tmp ${$3}"
])
OPAL_VAR_SCOPE_POP
])

AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args], [runpath_args])])

AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args], [runpath_fc_args])])


dnl
dnl Avoid some repetitive code below
Expand Down Expand Up @@ -430,9 +498,12 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[

AC_MSG_CHECKING([for OMPI LDFLAGS])
OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
OMPI_WRAPPER_EXTRA_FC_LDFLAGS=$OMPI_WRAPPER_EXTRA_LDFLAGS
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS])
RPATHIFY_FC_LDFLAGS([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
AC_SUBST([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])

# Convert @{libdir} to ${libdir} for pkg-config
_OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([OMPI])
Expand All @@ -441,6 +512,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
OMPI_WRAPPER_EXTRA_LIBS="$ompi_mca_wrapper_extra_libs"
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OMPI_WRAPPER_EXTRA_LIBS="$OMPI_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$LIBS])
AC_SUBST([OMPI_WRAPPER_EXTRA_LIBS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LIBS])

Expand Down
4 changes: 2 additions & 2 deletions ompi/tools/wrappers/mpifort-wrapper-data.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ compiler=@FC@
module_option=@OMPI_FC_MODULE_FLAG@
extra_includes=
preprocessor_flags=
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
# intentionally only link in the MPI libraries (ORTE, OPAL, etc. are
# pulled in implicitly) because we intend MPI applications to only use
Expand Down
2 changes: 1 addition & 1 deletion oshmem/tools/wrappers/shmemfort-wrapper-data.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ compiler_flags_env=FCFLAGS
compiler=@FC@
preprocessor_flags=
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
# intentionally only link in the SHMEM and MPI libraries (ORTE, OPAL,
# etc. are pulled in implicitly) because we intend SHMEM/MPI
Expand Down