⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpicc-condor.in

📁 Path MPICH-V for MPICH the MPI Implementation
💻 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: mpicc-condor.in,v 1.1 2004/04/08 10:42:32 herault Exp $## Script to compile and link MPI programs# We'd like to just add a few libraries to the link line and an include# directory to the compile line, but some systems that MPICH supports make# that difficult because the compiler and the linker are different programs.# Thus, this code tries to figure out which options go where, at least for# things that are different between compile and link steps.## New Organization:# To better support a range of compilers and library formats, the compilation# scripts can now read a configuration file describing the compiler (defaults# are provided in the script for the default case, i.e., same as MPICH was # built with.  This file is mpicc-<compilername>.conf.  For example, a# typical installation might have mpicc-cc.conf and mpicc-gcc.conf, for the # vendor compiler and gcc, respectively.  These are selected by either setting# the environment variable CC, or using the -config name switch.#DoLink=1DoCompile=0show_compile=0show_link=0MPILOG=Show=evalallargs=compileargs=linkargs=linkobjs=gettinglinkarg=0HasDashC=0UsesPmpi=0verbose=0## Directory locations: Fixed for any MPI implementationprefix=@prefix@exec_prefix=@exec_prefix@sysconfdir=@sysconfdir@includedir=@includebuild_dir@libdir=@libbuild_dir@### Default compiler configuration.  A configuration file may override any# of these (including the location of the MPI library), but must do so# consistently with the MPICH library chosen.  By including the library# and include paths here, we can use the same mpicc for a range of # libraries and compilers, including ones for 32 and 64 bit systems.CCBASE="${libdir}/condor-libs/condor_compile @CC@"CLINKERBASE="${libdir}/condor-libs/condor_compile @CLINKER@"LDFLAGSBASE="@LDFLAGS@"USER_CFLAGS="@USER_CFLAGS@"ROMIO_TCFLAGS="@ROMIO_TCFLAGS@"ROMIO_LFLAGS="@ROMIO_LFLAGS@"BASE_LIB_LIST="@BASE_LIB_LIST@"LIB_PATH="@LIB_PATH@"MPILIBNAME="@MPILIBNAME@"MPIVERSION="@MPIVERSION@"FLIBNAME="@FLIBNAME@"# F77_IN_C_LIBS are the libraries needed to link with the Fortran routines# referenced from MPI_Init.  With any luck, this will usually be emptyF77_IN_C_LIBS="@F77_IN_C_LIBS@"hasMPE=@hasMPE@#MPI_WITH_PMPI="@MPI_WITH_PMPI@"proflib=-lp${MPILIBNAME}proflibfullname=${libdir}/libp${MPILIBNAME}.a# Shared library supportSHAREDKIND="@SHAREDKIND@"SHARED_LIB_SEARCH_PATH_LEADER='@SHARED_LIB_SEARCH_PATH_LEADER@'SHARED_LIB_LOCALDIR="@SHARED_LIB_LOCALDIR@"sharedlibdir=@sharedlibbuild_dir@## Override the compilers using environment variablesCLINKER="${MPICH_CLINKER-$CLINKERBASE}"if [ -n "$MPICH_CC" ] ; then    CC="$MPICH_CC"    CCname=`echo $CC | sed 's/ /-/g'`    if [ -s $sysconfdir/mpicc-$CCname.conf ] ; then        . $sysconfdir/mpicc-$CCname.conf    fielse    CC="$CCBASE"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"	outputfilename="$arg"	gettinglinkarg=0	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"	    # Still need to add the target of the -o	    gettinglinkarg=1	    DoLink=1        fi	;;	-E|-M)	# For compilers that support -E as a way to get at the C preprocessor	# Also, for compilers that support -M for creating dependencies	allargs="$allargs $arg"	compileargs="$compileargs $arg"	HasDashC=1	DoLink=0	;;	-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="-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="-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="-lampe -lmpe"	else	    echo "-mpianim requires the MPE libraries"	fi	;;	-echo)	set -x	;;	-show)	Show=echo	;;	-config=*)	CCname=`echo A$arg | sed -e 's/A-config=//g'`        if [ -s $sysconfdir/mpicc-$CCname.conf ] ; then	    . $sysconfdir/mpicc-$CCname.conf 	else	    echo "Configuration file mpicc-$CCname.conf not found"	fi	;;	-cc=*)	CC=`echo A$arg | sed -e 's/A-cc=//g'`	CLINKER="$CC"	;;	-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 "mpicc 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)	echo "This is a program to compile or link MPI programs"	echo "In addition, the following special options are supported"	echo "    -mpilog    - Build version that generate MPE log files"	echo "    -mpitrace  - Build version that generates traces"	echo "    -mpianim   - Build version that generates real-time"	echo "                 animation"	echo "    -cc=pgm    - Change the program to use to compile and link"        echo "                 MPI programs.  WARNING! The program that you"        echo "                 choose MUST be compatible with the MPICH "        echo "                 libraries.  If you have trouble, you should"        echo "                 reconfigure and rebuild MPICH, selecting"        echo "                 this compiler."	echo "    -show      - Show the commands that would be used without"	echo "                 runnning them"	echo "    -compile_info - Show how to compile a program"	echo "    -link_info - Show how to link a program"	echo "    -help      - Give this help"	echo "    -echo      - Show exactly what this program is doing."	echo "                 This option should normally not be used."	echo "This should be used just like the usual C compiler"	echo "For example,"	echo "   $0 -c foo.c "	echo "and"	echo "   $0 -o foo foo.o"	echo "Combining compilation and linking in a single command"	echo "   $0 -o foo foo.c"	echo "may not work on some systems, and is not recommended."	exit 1	;;		# 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" = ".c" ] ; then	        DoCompile=1	        compileargs="$compileargs $arg"	        fname=`basename $arg .c`	        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#status=0if [ $DoCompile = 1 -o $show_compile = 1 ] ; then     if [ $HasDashC != 1 ] ; then        compileargs="-c $compileargs"    fi    $Show $CC $USER_CFLAGS $ROMIO_TCFLAGS -I$includedir $compileargs    status=$?    if [ $status != 0 ] ; then 	exit $status    fifi## Here's a tricky issue:  If there is no mpi library yet, we can't link,# but if we are building other tools that need mpicc, they may need to # build and run non-mpi programs.  This is currently handled in the configure# by making a dummy library.# if [ $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}" -o -z "${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"#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    # Only use the shared libraries if explicitly requested.  This is    # necessary because some (all?) systems are quite happy to link with    # a shared library *and then forget where it is*!  You often need to    # set an environment variable like LD_LIBRARY_PATH to include the    # path where the shared libraries are (is this broken or what?).    # Since that enviroment variable would then need to be set for all    # hosts where the program might run (since rsh doesn't propagate     # the environment), we don't make this the default.    if [ "${SHAREDKIND}" != "ignore" -a $UseSharedLib = "yes" ] ; then	clibpath="-L${sharedlibdir}"        if [ -n "${SHARED_LIB_SEARCH_PATH_LEADER}" ] ; then	    clibpath="${SHARED_LIB_SEARCH_PATH_LEADER}${sharedlibdir} $clibpath"  	    fi	if [ -n "${SHAREDLIB_LOCALDIR}" ] ; then	    clibpath="-L${SHAREDLIB_LOCALDIR} $clibpath" 	    if [ -n "${SHARED_LIB_SEARCH_PATH_LEADER}" ] ; then	        clibpath="${SHARED_LIB_SEARCH_PATH_LEADER}${SHAREDLIB_LOCALDIR} $clibpath"  	    fi	fi    fi    # TEMP HACK: ${MPILIBNAME}fsup is the Fortran support library (initfutil.o)    # It contains routines called by MPI_Init, and external symbols    # used in some of the C/Fortran routines.  For Fortran subroutines,    # we need to add the Fortran routines in a separate library     # ahead of the C implementation.    $Show $CLINKER $USER_CFLAGS $LDFLAGS $ROMIO_LFLAGS $clibpath $LIB_PATH $linkobjs $MPILOG $linkargs $mpilibs $BASE_LIB_LIST $F77_IN_C_LIBS    status=$?fiexit $status

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -