📄 mpif77-condor.in
字号:
#! /bin/sh# MPICH-V# Copyright (C) 2002, 2003 Groupe Cluster et Grid, LRI, Universite de Paris Sud### This file is part of MPICH-V.## MPICH-V is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## MPICH-V is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with MPICH-V; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA## $Id: mpif77-condor.in,v 1.1 2004/04/08 10:42:32 herault Exp $DoLink=1DoCompile=0show_compile=0show_link=0MPILOG=Show=evalallargs=compileargs=linkargs=linkobjs=gettinglinkarg=0HasDashC=0UsesPmpi=0verbose=0# Default compiler configuration## Directory locations: Fixed for any MPI implementationprefix=@prefix@exec_prefix=@exec_prefix@sysconfdir=@sysconfdir@includedir=@includedir@libdir=@libdir@## Directory locations: Can change for each Fortran versionf77includedir=@f77includedir@f77libdir=@f77libdir@#F77BASE="${libdir}/condor-libs/condor_compile @F77@"FLINKERBASE="${libdir}/condor-libs/condor_compile @F77LINKER@"LDFLAGSBASE="@LDFLAGS@"BASE_FFLAGS="@BASE_FFLAGS@ @F77_GETARG_FFLAGS@"FINC="@F77_INCDIR@"USER_FFLAGS="@FFLAGS@"## Linker flagsF77_LDFLAGS="@F77_LDFLAGS@"BASE_LIB_LIST="@BASE_LIB_LIST@"FLIB_LIST="@F77_GETARG_LDFLAGS@"FLIB_PATH_LEADER="@F77_LIBDIR_LEADER@"FLIB_PATH="${libdir}"LIB_PATH="@LIB_PATH@"MPILIBNAME="@MPILIBNAME@"MPIVERSION="@MPIVERSION@"FWRAPNAME="@FWRAPNAME@"FLIBNAME="@FLIBNAME@"# set to yes if the PMPI routines are in the same library with the MPI routines# (for example, they are built with weak symbols).MPI_WITH_PMPI="@MPI_WITH_PMPI@"proflib=-lp${MPILIBNAME}proflibfullname=${libdir}/libp${MPILIBNAME}.a#hasMPE="@hasMPE@"# Shared library supportSHAREDKIND="@SHAREDKIND@"SHARED_LIB_SEARCH_PATH_LEADER='@SHARED_LIB_SEARCH_PATH_LEADER@'SHARED_LIB_LOCALDIR="@SHARED_LIB_LOCALDIR@"sharedlibdir=@sharedlib_dir@## Override the compilers using environment variablesF77LINKER="${MPICH_FLINKER-$FLINKERBASE}"if [ -n "$MPICH_F77" ] ; then F77="$MPICH_F77" F77name=`echo $F77 | sed 's/ /-/g'` if [ -s $sysconfdir/mpif77-$F77name.conf ] ; then . $sysconfdir/mpif77-$F77name.conf fielse F77="$F77BASE"fiUseSharedLib=${MPICH_USE_SHLIB-no}#for arg in "$@" ; do# echo procssing arg $arg # Special processing for -o name if [ $gettinglinkarg = 1 ] ; then linkargs="$linkargs $arg" gettinglinkarg=0 outputfilename="$arg" continue fi case "$arg" in -c) # If -c is NOT specified, then we need to perform a link step. allargs="$allargs $arg" compileargs="$compileargs $arg" # If -o was set, then we need to move the output file option # to the compile line (note that this is non-standard, and should # not be used in portable codes) if [ $DoLink = 1 -a -n "$outputfilename" ] ; then compileargs="$compileargs -o $outputfilename" fi DoLink=0 HasDashC=1 ;; -o) # Need to link allargs="$allargs $arg" if [ $HasDashC = 1 ] ; then # Some BUT NOT ALL compilers support -o with -c. Allow # the user to make use of the feature, IF IT EXISTS. compileargs="$compileargs $arg" else linkargs="$linkargs $arg" compileargs="$compileargs -c" # Still need to add the target of the -o gettinglinkarg=1 DoLink=1 fi ;; -mpilog) if [ $UsesPmpi = 1 ] ; then echo "Only one of -mpilog, -mpitrace, or -mpianim may be used." exit 1 else UsesPmpi=1 fi if [ "$hasMPE" = "yes" ] ; then MPILOG="-l${FWRAPNAME} -llmpe -lmpe" else echo "-mpilog requires the MPE libraries" fi ;; -mpitrace) if [ $UsesPmpi = 1 ] ; then echo "Only one of -mpilog, -mpitrace, or -mpianim may be used." exit 1 else UsesPmpi=1 fi if [ "$hasMPE" = "yes" ] ; then MPILOG="-l${FWRAPNAME} -ltmpe -lmpe" else echo "-mpitrace requires the MPE libraries" fi ;; -mpianim) if [ $UsesPmpi = 1 ] ; then echo "Only one of -mpilog, -mpitrace, or -mpianim may be used." exit 1 else UsesPmpi=1 fi if [ "$hasMPE" = "yes" ] ; then MPILOG="-l${FWRAPNAME} -lampe -lmpe" else echo "-mpianim requires the MPE libraries" fi ;; -echo) set -x ;; -show) Show=echo ;; -config=*) FCname=`echo A$arg | sed -e 's/A-config=//g'` if [ -s $sysconfdir/mpif77-$FCname.conf ] ; then . $sysconfdir/mpif77-$FCname.conf else echo "Configuration file mpif77-$FCname.conf not found" fi ;; -fc=*) F77=`echo A$arg | sed -e 's/A-fc=//g'` F77LINKER="$F77" ;; -compile_info) show_compile=1 DoLink=0 Show=echo ;; -link_info) show_link=1 Show=echo ;; -shlib) UseSharedLib=yes ;; -noshlib) UseSharedLib=no ;; -v) verbose=1 echo "mpif77 for $MPIVERSION" compileargs="$compileargs -v" linkargs="$linkargs -v" ;; -l*) # This SHOULD be the -l<lib> argument. Only for the linker linkargs="$linkargs $arg" allargs="$allargs $arg" ;; -help)cat <<EOFThis is a program to compile or link MPI programsIn addition, the following special options are supported -mpilog - Build version that generate MPE log files -mpitrace - Build version that generates traces -mpianim - Build version that generates real-time animation -fc=pgm - Change the program to use to compile and link MPI programs. WARNING! The program that you choose MUST be compatible with the MPICH libraries. If you have trouble, you should reconfigure and rebuild MPICH, selecting this compiler. -show - Show the commands that would be used without runnning them -compile_info - Show how to compile a program -link_info - Show how to link a program -help - Give this help -echo - Show exactly what this program is doing. This option should normally not be used.This should be used just like the usual Fortran compilerFor example, $0 -c foo.f and $0 -o foo foo.oCombining compilation and linking in a single command $0 -o foo foo.fmay not work on some systems, and is not recommended.EOF exit 1 ;; #*\"*) #allargs="$allargs `echo $arg | sed 's/\"/\\\"/g'`" #compileargs="$compileargs `echo $arg | sed 's/\"/\\\"/g'`" #linkargs="$linkargs `echo $arg | sed 's/\"/\\\"/g'`" #;; # Unrecognized args. Because we do an eval, we need to # carefully quote any args that contain quotes. *\"*) qarg="'"$arg"'" allargs="$allargs $qarg" compileargs="$compileargs $qarg" linkargs="$linkargs $qarg" ;; *\'*) qarg='\"'"$arg"'\"' allargs="$allargs $qarg" compileargs="$compileargs $qarg" linkargs="$linkargs $qarg" ;; *) allargs="$allargs $arg" if [ -s "$arg" ] ; then ext=`expr "$arg" : '.*\(\..*\)'` if [ "$ext" = ".f" -o "$ext" = ".F" -o \ "$ext" = ".for" -o "$ext" = ".FOR" ] ; then DoCompile=1 compileargs="$compileargs $arg" fname=`basename $arg $ext` linkobjs="$linkobjs $fname.o" elif [ "$ext" = ".o" ] ; then if [ $HasDashC = 1 ] ; then compileargs="$compileargs $arg" else DoLink=1 linkobjs="$linkobjs $arg" fi else compileargs="$compileargs $arg" linkargs="$linkargs $arg" fi else compileargs="$compileargs $arg" linkargs="$linkargs $arg" fi ;; esacdone## Take care of mpif.h; try to add the link if necessaryadded_link=0if [ -z "$FINC" ] ; then # -r is true if we can read the file, which is what we want if [ ! -r mpif.h ] ; then #echo "Adding a symbolic link for mpif.h" trap "$Show /bin/rm mpif.h" 0 $Show ln -s $f77includedir/mpif.h mpif.h added_link=1 fielse FINC="$FINC$f77includedir"fistatus=0if [ $DoCompile = 1 -o $show_compile = 1 ] ; then if [ $HasDashC != 1 ] ; then compileargs="-c $compileargs" fi $Show $F77 $FINC $BASE_FFLAGS $FFLAGS $compileargs status=$? if [ $status != 0 ] ; then exit $status fifiif [ $DoLink = 1 -o $show_link = 1 ] ; then # If no LDFLAGS defined, use the ones that MPICH was built with if [ -z "$LDFLAGS" ] ; then LDFLAGS="$LDFLAGSBASE" fi # Figure out the library list. Because we want to support both a single # mpi library containing both C and Fortran interfaces, as well as # a library that allows multiple Fortran interfaces, we may need different # library link lines. With a unified C/Fortran library, we just # use -l${MPILIBNAME}. With separate Fortran libraries, we need # -l<fortranwrapperlib> -l${MPILIBNAME} -l<fortransuplib> # We also handle the profiling library here, which may not be needed # for those systems that support weak symbols. if [ "${MPILIBNAME}" = "${FLIBNAME}" ] ; then mpilibs="-l${MPILIBNAME}" else mpilibs="-l${FLIBNAME} -l${MPILIBNAME} -l${FLIBNAME}fsup" fi#DEBUG# mpilibs="$mpilibs -lc -lcondorsyscall -lnss_files -lnss_dns -lz -lresolv -L${libdir}/condor-libs/"#DEBUG # If the profiling library doesn't exist, or MPICH_NO_PROF environment # variable is set, skip the profiling library. if [ -n "$MPICH_NO_PROF" -o ! -s "$proflibfullname" ] ; then proflib="" fi # IRIX complains if we include a library twice. In the case of a # library using weak symbols, we don't need the proflib. Just # in case we do, there is an enviroment variable that # can be used to override this test. if [ "$MPI_WITH_PMPI" = "yes" -a "$MPICH_INCLUDE_PROFLIB" != yes ] ; then proflib="" fi # If proflib is non-empty, then add it if [ -n "$proflib" ] ; then mpilibs="$proflib $mpilibs $proflib" fi # See the comment in mpicc about UseSharedLib # Also, don't use if the shared libraries don't exist yet # (because -lmpichfarg.a won't exist yet) if [ "$SHAREDKIND" != "ignore" -a $UseSharedLib = "yes" -a \ -s ${libdir}/lib${FLIBNAME}farg.a ] ; then # We also add a library containing MPI_Init and the routines # that it uses to call getarg/iarg. flibpath="${FLIB_PATH_LEADER}$sharedlibdir" if [ -n "$SHARED_LIB_SEARCH_PATH_LEADER" ] ; then flibpath="${SHARED_LIB_SEARCH_PATH_LEADER}$sharedlibdir $flibpath" fi if [ -n "$SHAREDLIB_LOCALDIR" ] ; then flibpath="${FLIB_PATH_LEADER}$SHAREDLIB_LOCALDIR $flibpath" if [ -n "$SHARED_LIB_SEARCH_PATH_LEADER" ] ; then flibpath="${SHARED_LIB_SEARCH_PATH_LEADER}$SHAREDLIB_LOCALDIR $flibpath" fi fi mpilibs="-l${FLIBNAME}farg $mpilibs" fi # The last F77_LDFLAGS is used in case there are Fortran libraries that # need to be added to the link line (in the case where we use the C # compiler to link programs) if [ "$F77LINKER" != "$F77" ] ; then F77_LAST_LDFLAGS="$F77_LDFLAGS" fi $Show $F77LINKER $F77_LDFLAGS $LDFLAGS $BASE_FFLAGS $flibpath ${FLIB_PATH_LEADER}${FLIB_PATH} $linkobjs $MPILOG $linkargs $mpilibs $BASE_LIB_LIST $FLIB_LIST $F77_LAST_LDFLAGS status=$?fi## If we added the link, remove it.if [ $added_link = 1 ] ; then $Show rm mpif.h trap 0fiexit $status
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -