1
1

* Remove the old wrapper compilers and add the correct data files for the

new wrapper compilers for the OMPI layer.  This should require no changes
  at all for anyone (other than running autogen, of course)

This commit was SVN r8772.
Этот коммит содержится в:
Brian Barrett 2006-01-21 02:05:58 +00:00
родитель 2fadddebc8
Коммит ab6f4de6e5
14 изменённых файлов: 36 добавлений и 1345 удалений

Просмотреть файл

@ -1592,10 +1592,10 @@ AC_CONFIG_FILES([
ompi/tools/ompi_info/Makefile
ompi/tools/wrappers/Makefile
ompi/tools/wrappers/ompicc-wrapper-data.txt
ompi/tools/wrappers/ompic++-wrapper-data.txt
ompi/tools/wrappers/ompif77-wrapper-data.txt
ompi/tools/wrappers/ompif90-wrapper-data.txt
ompi/tools/wrappers/mpicc-wrapper-data.txt
ompi/tools/wrappers/mpic++-wrapper-data.txt
ompi/tools/wrappers/mpif77-wrapper-data.txt
ompi/tools/wrappers/mpif90-wrapper-data.txt
test/Makefile
test/asm/Makefile

Просмотреть файл

@ -16,152 +16,58 @@
# $HEADER$
#
dist_pkgdata_DATA = help-wrapper.txt \
ompicc-wrapper-data.txt \
ompic++-wrapper-data.txt \
ompif77-wrapper-data.txt \
ompif90-wrapper-data.txt
dist_pkgdata_DATA = mpicc-wrapper-data.txt \
mpic++-wrapper-data.txt \
mpif77-wrapper-data.txt \
mpif90-wrapper-data.txt
# This is ugly, but we need it so that people can change things at
# "make" time (e.g., "make sysconfdir=/foo/bar all") as documented in
# autoconf.
AM_CPPFLAGS = \
-DOMPI_PREFIX="\"$(prefix)\"" \
-DOMPI_INCDIR="\"$(includedir)\"" \
-DOMPI_LIBDIR="\"$(libdir)\"" \
-DOMPI_FC_MODULE_FLAG="\"$(OMPI_FC_MODULE_FLAG)\""
if WANT_INSTALL_HEADERS
AM_CPPFLAGS += -DOMPI_WANT_DEVEL_HEADERS=1
else
AM_CPPFLAGS += -DOMPI_WANT_DEVEL_HEADERS=0
endif
EXTRA_DIST = wrap.cc wrap_engine.cc
bin_PROGRAMS = mpicc mpic++ mpif77 mpif90
libs = \
$(top_builddir)/opal/libopal.la
wrap_sources = wrap.cc wrap_engine.cc ompi_wrap.h
mpicc_SOURCES = mpicc.cc ompi_wrap.h $(wrap_sources)
mpicc_LDADD = $(libs)
mpicc_LDFLAGS =
mpicc_DEPENDENCIES = $(libs)
mpic___SOURCES = mpicxx.cc ompi_wrap.h $(wrap_sources)
mpic___LDADD = $(libs)
mpic___LDFLAGS =
mpic___DEPENDENCIES = $(libs)
mpif77_SOURCES = mpif77.cc ompi_wrap.h $(wrap_sources)
mpif77_LDADD = $(libs)
mpif77_LDFLAGS =
mpif77_DEPENDENCIES = $(libs)
mpif90_SOURCES = mpif90.cc ompi_wrap.h $(wrap_sources)
mpif90_LDADD = $(libs)
mpif90_LDFLAGS =
mpif90_DEPENDENCIES = $(libs)
# Since this is C++ and we use templates (the STL), also ditch the
# template repository directory
clean-local:
test -z "$(OMPI_CXX_TEMPLATE_REPOSITORY)" || $(RM) -rf $(OMPI_CXX_TEMPLATE_REPOSITORY)
if WANT_DEPRECATED_EXECUTABLE_NAMES
if CASE_SENSITIVE_FS
install-exec-hook:
(cd $(DESTDIR)$(bindir); rm -f hcc$(EXEEXT); $(LN_S) mpicc hcc)
(cd $(DESTDIR)$(bindir); rm -f hcp$(EXEEXT); $(LN_S) mpiCC hcp)
(cd $(DESTDIR)$(bindir); rm -f hf77$(EXEEXT); $(LN_S) mpif77 hf77)
(cd $(DESTDIR)$(bindir); rm -f mpiCC$(EXEEXT); $(LN_S) mpic++ mpiCC)
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) mpic++ mpicxx)
else
install-exec-hook:
(cd $(DESTDIR)$(bindir); rm -f hcc$(EXEEXT); $(LN_S) mpicc hcc)
(cd $(DESTDIR)$(bindir); rm -f hcp$(EXEEXT); $(LN_S) mpic++ hcp)
(cd $(DESTDIR)$(bindir); rm -f hf77$(EXEEXT); $(LN_S) mpif77 hf77)
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) mpic++ mpicxx)
endif
#
# mpiCC might be a symlink we created, so be nice....
#
if CASE_SENSITIVE_FS
uninstall-local:
rm -f $(DESTDIR)$(bindir)/hcc$(EXEEXT) \
$(DESTDIR)$(bindir)/hcp$(EXEEXT) \
$(DESTDIR)$(bindir)/hf77$(EXEEXT) \
$(DESTDIR)$(bindir)/mpiCC$(EXEEXT) \
$(DESTDIR)$(bindir)/mpicxx$(EXEEXT)
else
uninstall-local:
rm -f $(DESTDIR)$(bindir)/hcc$(EXEEXT) \
$(DESTDIR)$(bindir)/hcp$(EXEEXT) \
$(DESTDIR)$(bindir)/hf77$(EXEEXT) \
$(DESTDIR)$(bindir)/mpicxx$(EXEEXT)
endif
else
#
# If we don't have deprecated names, just do the mpiCC / mpic++ stuff.
# If we are on a non-case sensitive file system, don't do anything
# with mpiCC, since that is the same as mpicc, and there is no way
# that can end good.
#
if CASE_SENSITIVE_FS
install-exec-hook:
(cd $(DESTDIR)$(bindir); rm -f mpiCC$(EXEEXT); $(LN_S) mpic++ mpiCC)
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) mpic++ mpicxx)
(cd $(DESTDIR)$(bindir); rm -f ompicc$(EXEEXT); $(LN_S) opal_wrapper ompicc)
(cd $(DESTDIR)$(bindir); rm -f ompic++$(EXEEXT); $(LN_S) opal_wrapper ompic++)
(cd $(DESTDIR)$(bindir); rm -f ompiCC$(EXEEXT); $(LN_S) opal_wrapper ompiCC)
(cd $(DESTDIR)$(bindir); rm -f ompicxx$(EXEEXT); $(LN_S) opal_wrapper ompicxx)
(cd $(DESTDIR)$(bindir); rm -f ompif77$(EXEEXT); $(LN_S) opal_wrapper ompif77)
(cd $(DESTDIR)$(bindir); rm -f ompif90$(EXEEXT); $(LN_S) opal_wrapper ompif90)
(cd $(DESTDIR)$(bindir); rm -f mpicc$(EXEEXT); $(LN_S) opal_wrapper mpicc)
(cd $(DESTDIR)$(bindir); rm -f mpic++$(EXEEXT); $(LN_S) opal_wrapper mpic++)
(cd $(DESTDIR)$(bindir); rm -f mpiCC$(EXEEXT); $(LN_S) opal_wrapper mpiCC)
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) opal_wrapper mpicxx)
(cd $(DESTDIR)$(bindir); rm -f mpif77$(EXEEXT); $(LN_S) opal_wrapper mpif77)
(cd $(DESTDIR)$(bindir); rm -f mpif90$(EXEEXT); $(LN_S) opal_wrapper mpif90)
(cd $(DESTDIR)$(pkgdatadir); rm -f ompiCC-wrapper-data.txt; $(LN_S) ompic++-wrapper-data.txt ompiCC-wrapper-data.txt)
(cd $(DESTDIR)$(pkgdatadir); rm -f ompicxx-wrapper-data.txt; $(LN_S) ompic++-wrapper-data.txt ompicxx-wrapper-data.txt)
(cd $(DESTDIR)$(pkgdatadir); rm -f mpiCC-wrapper-data.txt; $(LN_S) mpic++-wrapper-data.txt mpiCC-wrapper-data.txt)
(cd $(DESTDIR)$(pkgdatadir); rm -f mpicxx-wrapper-data.txt; $(LN_S) mpic++-wrapper-data.txt mpicxx-wrapper-data.txt)
else
install-exec-hook:
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) mpic++ mpicxx)
(cd $(DESTDIR)$(bindir); rm -f ompicc$(EXEEXT); $(LN_S) opal_wrapper ompicc)
(cd $(DESTDIR)$(bindir); rm -f ompic++$(EXEEXT); $(LN_S) opal_wrapper ompic++)
(cd $(DESTDIR)$(bindir); rm -f ompicxx$(EXEEXT); $(LN_S) opal_wrapper ompicxx)
(cd $(DESTDIR)$(bindir); rm -f ompif77$(EXEEXT); $(LN_S) opal_wrapper ompif77)
(cd $(DESTDIR)$(bindir); rm -f ompif90$(EXEEXT); $(LN_S) opal_wrapper ompif90)
(cd $(DESTDIR)$(bindir); rm -f mpicc$(EXEEXT); $(LN_S) opal_wrapper mpicc)
(cd $(DESTDIR)$(bindir); rm -f mpic++$(EXEEXT); $(LN_S) opal_wrapper mpic++)
(cd $(DESTDIR)$(bindir); rm -f mpicxx$(EXEEXT); $(LN_S) opal_wrapper mpicxx)
(cd $(DESTDIR)$(bindir); rm -f mpif77$(EXEEXT); $(LN_S) opal_wrapper mpif77)
(cd $(DESTDIR)$(bindir); rm -f mpif90$(EXEEXT); $(LN_S) opal_wrapper mpif90)
(cd $(DESTDIR)$(pkgdatadir); rm -f ompicxx-wrapper-data.txt; $(LN_S) ompic++-wrapper-data.txt ompicxx-wrapper-data.txt)
(cd $(DESTDIR)$(pkgdatadir); rm -f mpicxx-wrapper-data.txt; $(LN_S) mpic++-wrapper-data.txt mpicxx-wrapper-data.txt)
endif
if CASE_SENSITIVE_FS
uninstall-local:
rm -f $(DESTDIR)$(bindir)/mpiCC$(EXEEXT) \
$(DESTDIR)$(bindir)/mpicxx$(EXEEXT) \
$(DESTDIR)$(bindir)/ompicc$(EXEEXT) \
$(DESTDIR)$(bindir)/ompic++$(EXEEXT) \
$(DESTDIR)$(bindir)/ompiCC$(EXEEXT) \
$(DESTDIR)$(bindir)/ompicxx$(EXEEXT) \
$(DESTDIR)$(bindir)/ompif77$(EXEEXT) \
$(DESTDIR)$(bindir)/ompif90$(EXEEXT) \
$(DESTDIR)$(pkgdatadir)/ompiCC-wrapper-data.txt \
$(DESTDIR)$(pkgdatadir)/ompicxx-wrapper-data.txt
$(DESTDIR)$(bindir)/mpicc$(EXEEXT) \
$(DESTDIR)$(bindir)/mpic++$(EXEEXT) \
$(DESTDIR)$(bindir)/mpiCC$(EXEEXT) \
$(DESTDIR)$(bindir)/mpicxx$(EXEEXT) \
$(DESTDIR)$(bindir)/mpif77$(EXEEXT) \
$(DESTDIR)$(bindir)/mpif90$(EXEEXT) \
$(DESTDIR)$(pkgdatadir)/mpiCC-wrapper-data.txt \
$(DESTDIR)$(pkgdatadir)/mpicxx-wrapper-data.txt
else
uninstall-local:
rm -f $(DESTDIR)$(bindir)/mpicxx$(EXEEXT) \
$(DESTDIR)$(bindir)/ompicc$(EXEEXT) \
$(DESTDIR)$(bindir)/ompic++$(EXEEXT) \
$(DESTDIR)$(bindir)/ompicxx$(EXEEXT) \
$(DESTDIR)$(bindir)/ompif77$(EXEEXT) \
$(DESTDIR)$(bindir)/ompif90$(EXEEXT) \
$(DESTDIR)$(pkgdatadir)/ompicxx-wrapper-data.txt
endif
$(DESTDIR)$(bindir)/mpicc$(EXEEXT) \
$(DESTDIR)$(bindir)/mpic++$(EXEEXT) \
$(DESTDIR)$(bindir)/mpicxx$(EXEEXT) \
$(DESTDIR)$(bindir)/mpif77$(EXEEXT) \
$(DESTDIR)$(bindir)/mpif90$(EXEEXT) \
$(DESTDIR)$(pkgdatadir)/mpicxx-wrapper-data.txt
endif

Просмотреть файл

@ -1,34 +0,0 @@
# -*- text -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This is the US/English help file for Open MPI wrapper compiler error
# messages.
#
[no-fortran-support]
Unfortunately, this installation of Open MPI was not compiled with
Fortran %d support. As such, the %s compiler is non-functional.
[no-profilig-support]
warning: "-lpmpi" was included on the command line indicating use of MPI
warning: profiling layer. However, Open MPI was not compiled with support
warning: for the MPI profiling layer; this flag has been ignored.
[no-compiler-found]
The Open MPI wrapper compiler was unable to find the specified compiler
%s in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.

Просмотреть файл

@ -1,60 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include "ompi_config.h"
#include "tools/wrappers/ompi_wrap.h"
int
main(int argc, char *argv[])
{
// The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the
// work, and pass in just a few arguments to customize for the
// language of this wrapper compiler.
ompi_sv_t compiler;
ompi_sv_t cppflags;
ompi_sv_t cflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
compiler.clear();
compiler.push_back("OMPI_MPICC");
cppflags.clear();
cppflags.push_back("OMPI_MPICC_CPPFLAGS");
cppflags.push_back("OMPI_CPPFLAGS");
cflags.clear();
cflags.push_back("OMPI_MPICC_CFLAGS");
cflags.push_back("OMPI_CFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPICC_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPICC_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, cppflags, cflags,
ldflags, libs, OMPI_CC, WRAPPER_EXTRA_CFLAGS,
false, false, false);
}

Просмотреть файл

@ -1,60 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include "ompi_config.h"
#include "tools/wrappers/ompi_wrap.h"
int
main(int argc, char *argv[])
{
// The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the
// work, and pass in just a few arguments to customize for the
// language of this wrapper compiler.
ompi_sv_t compiler;
ompi_sv_t cxxcppflags;
ompi_sv_t cxxflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
compiler.clear();
compiler.push_back("OMPI_MPICXX");
cxxcppflags.clear();
cxxcppflags.push_back("OMPI_MPICXX_CXXCPPFLAGS");
cxxcppflags.push_back("OMPI_CXXCPPFLAGS");
cxxflags.clear();
cxxflags.push_back("OMPI_MPICXX_CXXFLAGS");
cxxflags.push_back("OMPI_CXXFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPICXX_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPICXX_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, cxxcppflags, cxxflags,
ldflags, libs, OMPI_CXX,
WRAPPER_EXTRA_CXXFLAGS, true, false, false);
}

Просмотреть файл

@ -1,70 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include "ompi_config.h"
#include "opal/util/show_help.h"
#include "tools/wrappers/ompi_wrap.h"
#include <iostream>
using namespace std;
int
main(int argc, char *argv[])
{
// The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the
// work, and pass in just a few arguments to customize for the
// language of this wrapper compiler.
#if !OMPI_WANT_F77_BINDINGS
opal_show_help("help-wrapper.txt", "no-fortran-support", true,
77, "mpif77");
return 1;
#else
ompi_sv_t compiler;
ompi_sv_t fppflags;
ompi_sv_t fflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
compiler.clear();
compiler.push_back("OMPI_MPIF77");
fppflags.clear();
fppflags.push_back("OMPI_MPIF77_FPPFLAGS");
fppflags.push_back("OMPI_FPPFLAGS");
fflags.clear();
fflags.push_back("OMPI_MPIF77_FFLAGS");
fflags.push_back("OMPI_FFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPIF77_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPIF77_LIBS");
libs.push_back("OMPI_LIBS");
return ompi_wrap_engine(argc, argv, compiler, fppflags, fflags,
ldflags, libs, OMPI_F77, WRAPPER_EXTRA_FFLAGS,
false, false, true);
#endif
}

Просмотреть файл

@ -1,77 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include "ompi_config.h"
#include "opal/util/show_help.h"
#include "tools/wrappers/ompi_wrap.h"
#include <iostream>
using namespace std;
int
main(int argc, char *argv[])
{
// The four wrapper compilers are extremely similar. So similar,
// in fact, that they can be parameterized on what is different.
// Hence, we call the "wrapper compiler engine" to do all the
// work, and pass in just a few arguments to customize for the
// language of this wrapper compiler.
#if !OMPI_WANT_F90_BINDINGS
opal_show_help("help-wrapper.txt", "no-fortran-support", true,
90, "mpif90");
return 1;
#else
ompi_sv_t compiler;
ompi_sv_t fcppflags;
ompi_sv_t fcflags;
ompi_sv_t ldflags;
ompi_sv_t libs;
string wrapper_extra_fcflags;
compiler.clear();
compiler.push_back("OMPI_MPIF90");
fcppflags.clear();
fcppflags.push_back("OMPI_MPIF90_FCPPFLAGS");
fcppflags.push_back("OMPI_FCPPFLAGS");
fcflags.clear();
fcflags.push_back("OMPI_MPIF90_FCFLAGS");
fcflags.push_back("OMPI_FCFLAGS");
ldflags.clear();
ldflags.push_back("OMPI_MPIF90_LDFLAGS");
ldflags.push_back("OMPI_LDFLAGS");
libs.clear();
libs.push_back("OMPI_MPIF90_LIBS");
libs.push_back("OMPI_LIBS");
wrapper_extra_fcflags = OMPI_FC_MODULE_FLAG;
wrapper_extra_fcflags += " ";
wrapper_extra_fcflags += OMPI_LIBDIR;
wrapper_extra_fcflags += " ";
wrapper_extra_fcflags += WRAPPER_EXTRA_FCFLAGS;
return ompi_wrap_engine(argc, argv, compiler, fcflags, fcflags,
ldflags, libs, OMPI_F90, wrapper_extra_fcflags,
false, true, true);
#endif
}

Просмотреть файл

@ -1,213 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
/// @file
///
/// All of these types, global variables, and functions are internal
/// to the ompi_info program. There is probably noting here of value
/// outside of ompi_info.
///
#ifndef OMPI_WRAP_H
#define OMPI_WRAP_H 1
#include "ompi_config.h"
#include <string>
#include <vector>
///
/// Commonly used type
///
typedef std::vector <std::string> ompi_sv_t;
//
// Global variables
//
/// Whether we're showing the entire command or not
extern bool showme_cmd;
/// Whether we're showing the compile command or not
extern bool showme_compile;
/// Whether we're showing the link command or not
extern bool showme_link;
///
/// Functions in the helper OMPI wrapper compiler library;
/// this is the granddaddy that will invoke the rest
///
/// \param argc argc from main()
/// \param argv argv from main()
/// \param compiler_env_var List of environment variables for the compiler
/// \param xppflags_env_var List of environment variables for
/// preprocessor flags
/// \param xflags_env_var List of environment variables for compiler flags
/// \param ldflags_env_var List of environment variables for linker flags
/// \param libs_env_var List of environment variables for linker flags
/// \param default_compiler The compiler chosen by configure
/// \param default_xflags Flags chosen by configure
/// \param want_cxx_libs Do we want to link in the C++ libraries?
/// \param want_f77_inclues Do we want to force the f77 includes?
///
int ompi_wrap_engine(int argc, char *argv[],
const ompi_sv_t & compiler_env_var,
const ompi_sv_t & xppflags_env_var,
const ompi_sv_t & xflags_env_var,
const ompi_sv_t & ldflags_env_var,
const ompi_sv_t & libs_env_var,
const std::string & default_compiler,
const std::string & default_xflags,
bool want_cxx_libs,
bool want_f90_libs,
bool want_f77_includes);
///
/// Parse the command line arguments of the wrapper compiler
///
/// \param argc Number of command line parameters
/// \param argv Vector containing command line parameters
/// \param want_flags True if extra flags are needed
///
void ompi_wrap_parse_args(int argc, char *argv[], bool & want_flags);
///
/// Figure out what the back-end compiler is (even if it's multiple
/// tokens)
///
/// \param env_list List of environment variables passed by the user
/// \param default_comp Defaultl backend compiler
/// \param out Compiler to use (return value)
///
void ompi_wrap_get_compiler(const ompi_sv_t & env_list,
const std::string & default_comp, ompi_sv_t & out);
///
/// Build up a list of arguments for XPPFLAGS (CPPFLAGS, CXXCPPFLAGS
/// or FPPFFLAGS, depending on what the front-end wrapper compiler
/// is).
///
/// \param want_f77_includes If F77 includes are wanted
/// \param cflags Vector of strings containing the cflags (returned)
///
void ompi_wrap_build_xppflags(const ompi_sv_t & env_list,
bool want_f77_includes, ompi_sv_t & xppflags);
///
/// Build of a list of XFLAGS (CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS) to
/// go to the back-end compiler. These are typically extra flags that
/// come from the configure script.
///
/// \param extra_string Extra flags to be passed to backend compiler
/// \param extra_flags Vector of strings to be pased to backend
/// compiler (return value)
///
void ompi_wrap_build_xflags(const ompi_sv_t & env_list,
const std::string & default_xflags,
ompi_sv_t & xflags);
///
/// Build up a list of user arguments (from argc/argv) that will be
/// plugged into the command line that will invoke the back-end
/// compiler.
///
/// \param argc Number of command line parameters
/// \param argv Vector containing the command line parameters
/// \param user_args List of user arguments that will be passed to
/// the back-end compiler (return value)
///
void ompi_wrap_build_user_args(int argc, char *argv[], ompi_sv_t & user_args);
///
/// Build up a list of LDFLAGS that will be given to the back-end
/// compiler.
///
/// \param ldflags Vector of strings comtaining the LDFLAGS
///
void ompi_wrap_build_ldflags(const ompi_sv_t & env_list, ompi_sv_t & ldflags);
///
/// Build up a list of LIBS that will be given to the back-end
/// compiler.
///
/// \param want_cxx_libs Are we building mpiCC?
/// \param libs Vector of strings containing the libraries to be
/// linked to the backend compiler
///
void ompi_wrap_build_libs(const ompi_sv_t & env_list,
bool want_cxx_libs, bool want_f90_libs,
ompi_sv_t & libs);
///
/// Print out a vector of strings
///
/// \param sv Vector of strings to be printed out
///
void ompi_wrap_print_sv(const ompi_sv_t & sv);
///
/// Execute a vector of strings (ultimately results down to a call to
/// some flavor of exec()).
///
/// \param sv Vector of strings to be exec()'ed
///
int ompi_wrap_exec_sv(const ompi_sv_t & sv);
///
/// Remove leading and trailing white space from a given string.
/// Must be sent a null-terminated string.
///
/// \param str String from which leading and trailing spaces should
/// be removed
///
void ompi_wrap_strip_white(std::string & str);
///
/// Split a string into a vector of strings
//
/// \param str String which has to be split into a vector of strings
/// \param c Charecter which demarkates 2 strings
/// \param out Vector of strings (return value)
///
bool ompi_wrap_split(const std::string & str, char c, ompi_sv_t & out);
///
/// Take a string, split it into tokens, and append it to an existing
/// vector of strings
///
/// \param str String which is to be split into tokens
/// \param out Vector of strings to which the tokens are appended
///
void ompi_wrap_split_append_sv(const std::string & str, ompi_sv_t & out);
///
/// Append one vector of strings onto the end of another.
///
/// \param in Vector of strings to be appended
/// \param out Vector of strings to which "in" will be appended
///
void ompi_wrap_append_sv(const ompi_sv_t & in, ompi_sv_t & out);
///
/// Check for the presence of a file
///
/// \param dir Directory in which the file should be present
/// \param file Name of the file
///
bool ompi_wrap_check_file(const std::string & dir, const std::string & file);
#endif // OMPI_WRAP_H

Просмотреть файл

@ -1,560 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include "ompi_config.h"
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <errno.h>
#include "opal/util/path.h"
#include "opal/util/argv.h"
#include "opal/util/few.h"
#include "opal/util/path.h"
#include "opal/util/show_help.h"
#include "tools/wrappers/ompi_wrap.h"
extern char **environ;
using namespace std;
//
// Global variables
//
bool fl_libs(true);
bool fl_profile(false);
bool fl_cpp(false);
bool fl_want_show_error(false);
bool showme_cmd(false);
bool showme_compile(false);
bool showme_link(false);
//
// Local variables
//
static string cmd_name("<unknown>");
void
ompi_wrap_parse_args(int argc, char *argv[], bool & want_flags)
{
string str;
bool have_arg;
cmd_name = argv[0];
// Note: only add all the compiler/linker flags if there is an
// argv[] that doesn not begin with "-" or some form of "-showme" is
// specified.
want_flags = false;
for (int i = 1; i < argc; ++i) {
str = argv[i];
if ("-showme" == str.substr(0, 7) || "--showme" == str.substr(0, 8)
|| "-show" == str || "--show" == str) {
want_flags = true;
fl_want_show_error = true;
if ("-showme:" == str.substr(0, 8)) {
str = str.substr(8);
have_arg = true;
} else if ("--showme:" == str.substr(0, 9)) {
str = str.substr(9);
have_arg = true;
} else {
showme_cmd = true;
have_arg = false;
}
if (have_arg) {
if ("compile" == str) {
showme_compile = true;
} else if ("link" == str) {
showme_link = true;
} else {
showme_cmd = true;
}
}
} else if ("-c" == str) {
fl_libs = false;
} else if ("-E" == str || "-M" == str) {
fl_libs = false;
fl_cpp = true;
} else if ("-S" == str) {
fl_libs = false;
} else if ("-lpmpi" == str) {
fl_profile = true;
} else if ('-' != str[0]) {
want_flags = true;
fl_want_show_error = true;
}
}
#if !OMPI_ENABLE_MPI_PROFILING
// Sanity check
if (fl_profile) {
opal_show_help("help-wrapper.txt", "no-profiling-support", true,
argv[0], NULL);
fl_profile = false;
}
#endif
}
void
ompi_wrap_get_compiler(const ompi_sv_t & env_list,
const string & default_comp, ompi_sv_t & out)
{
char *env;
string comp;
string temp1, temp2;
string::size_type i, pos;
string compiler0;
out.clear();
// Check for environment variable overrides
for (i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
comp = env;
ompi_wrap_split(comp, ' ', out);
break;
}
}
// If we didn't find any of the environment variables, use the default
if (out.empty()) {
ompi_wrap_split(default_comp, ' ', out);
}
// If we're preprocessing, we need to know the basename of argv0
// (see below).
if (fl_cpp) {
pos = out[0].find_last_of('/');
if (pos != string::npos) {
// JMS There has to be a better way to do this
compiler0 = out[0].substr(pos + 1);
} else {
compiler0 = out[0];
}
}
// Ugh. If we're acting as the preprocessor, ditch any libtool
// arguments.
if (fl_cpp) {
// If we find "libtool", then advance until we find an argument
// that does not begin with "--"; the arguments after that will be
// the compiler (preprocessor) stuff
if ("libtool" == compiler0) {
i = 1;
while (i < out.size() && "--" == out[i].substr(0, 2)) {
++i;
}
out.erase(out.begin(), out.begin() + i);
}
}
}
void
ompi_wrap_build_xppflags(const ompi_sv_t & env_list,
bool want_f77_includes, ompi_sv_t & xppflags)
{
string incdir(OMPI_INCDIR);
char *env;
string temp;
xppflags.clear();
// Check for environment variable overrides. If we find some, use
// them, regardless of the f77_include setting.
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', xppflags);
return;
}
}
// Ensure that we don't -I/usr/include, for the reasons listed
// above. EXCEPTION: If this is fortran, then we add -I regardless
// of what the prefix is, because the fortran compiler will not
// -I/usr/include automatically.
if (want_f77_includes || "/usr/include" != incdir) {
xppflags.push_back("-I" + incdir);
}
#if OMPI_WANT_DEVEL_HEADERS
xppflags.push_back("-I" + incdir + "/openmpi");
xppflags.push_back("-I" + incdir + "/openmpi/opal");
xppflags.push_back("-I" + incdir + "/openmpi/orte");
#endif
#if OMPI_WANT_CXX_BINDINGS || OMPI_WANT_DEVEL_HEADERS
xppflags.push_back("-I" + incdir + "/openmpi/ompi");
#endif
}
void
ompi_wrap_build_xflags(const ompi_sv_t & env_list,
const string & default_xflags, ompi_sv_t & xflags)
{
char *env;
string temp;
// Check for environment variable overrides. If we find some, use
// them, regardless of the f77_include setting.
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', xflags);
return;
}
}
if (!default_xflags.empty()) {
ompi_wrap_split_append_sv(default_xflags, xflags);
}
}
void
ompi_wrap_build_user_args(int argc, char *argv[], ompi_sv_t & user_args)
{
string str;
// Don't copy -showme* or -lpmpi. -lpmpi will be
// insertted elsewhere if necessary.
for (int i = 1; i < argc; ++i) {
str = argv[i];
if ("-showme" != str.substr(0, 7) &&
"--showme" != str.substr(0, 8) &&
"-show" != str && "--show" != str && "-lpmpi" != str) {
user_args.push_back(str);
}
}
}
void
ompi_wrap_build_ldflags(const ompi_sv_t & env_list, ompi_sv_t & ldflags)
{
char *env;
string s;
string temp;
string libdir(OMPI_LIBDIR);
ompi_sv_t sv;
ompi_sv_t::iterator svi;
ldflags.clear();
// If we don't want the libs, then we don't want ldflags, either.
// Hence, return with ldflags empty.
if (!fl_libs) {
return;
}
// Check for environment variable overrides
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', ldflags);
return;
}
}
// Add in the extra flags passed by configure. Do the same kinds of
// checks that we do below -- ensure that we don't add a "-L/usr" to
// the command line.
s = WRAPPER_EXTRA_LDFLAGS;
ompi_wrap_split(s, ' ', sv);
if (!sv.empty()) {
for (svi = sv.begin(); svi != sv.end(); ++svi) {
if ("-L/usr" != *svi) {
ompi_wrap_split_append_sv(*svi, ldflags);
}
}
}
// Form library directory pathname.
//
// Add "-L$prefix/lib".
//
// Apply similar logic here as we did with -I -- if the libdir is
// /usr/lib, there's no need to explicitly add it, because the
// compiler will already be looking there.
if ("/usr/lib" != libdir) {
ldflags.push_back("-L" + libdir);
}
}
void
ompi_wrap_build_libs(const ompi_sv_t & env_list,
bool want_cxx_libs, bool want_f90_libs, ompi_sv_t & libs)
{
char *env;
string temp;
string libdir(OMPI_LIBDIR);
libs.clear();
// If we don't want the libs, then return with libs empty
if (!fl_libs) {
return;
}
// Check for environment variable overrides
for (string::size_type i = 0; i < env_list.size(); ++i) {
env = getenv(env_list[i].c_str());
if (NULL != env) {
temp = env;
ompi_wrap_split(temp, ' ', libs);
return;
}
}
// Now we start adding libraries to libs
#if OMPI_WANT_CXX_BINDINGS
// The C++ bindings come next
if (want_cxx_libs) {
if (
#ifdef WIN32
!ompi_wrap_check_file(libdir, "libmpi_cxx.dll") &&
#endif
!ompi_wrap_check_file(libdir, "libmpi_cxx.a") &&
!ompi_wrap_check_file(libdir, "libmpi_cxx.so") &&
!ompi_wrap_check_file(libdir, "libmpi_cxx.dylib")) {
cerr << "WARNING: " << cmd_name
<< " expected to find libmpi_cxx.* in " << libdir << endl
<< "WARNING: MPI C++ support will be disabled" << endl;
} else {
libs.push_back("-lmpi_cxx");
}
}
#endif
#if OMPI_WANT_F90_BINDINGS
// The F90 bindings come next
if (want_f90_libs) {
if (
#ifdef WIN32
!ompi_wrap_check_file(libdir, "libmpi_f90.dll") &&
#endif
!ompi_wrap_check_file(libdir, "libmpi_f90.a") &&
!ompi_wrap_check_file(libdir, "libmpi_f90.so") &&
!ompi_wrap_check_file(libdir, "libmpi_f90.dylib")) {
cerr << "WARNING: " << cmd_name
<< " expected to find libmpi_f90.* in " << libdir << endl
<< "WARNING: MPI F90 support will be disabled" << endl;
} else {
libs.push_back("-lmpi_f90");
}
}
#endif
// Next comes the MPI library
libs.push_back("-lmpi");
libs.push_back("-lorte");
libs.push_back("-lopal");
ompi_wrap_split_append_sv(WRAPPER_EXTRA_LIBS, libs);
}
void
ompi_wrap_print_sv(const ompi_sv_t & sv)
{
for (string::size_type i = 0; i < sv.size(); ++i) {
cout << sv[i] << " ";
}
}
int
ompi_wrap_exec_sv(const ompi_sv_t & sv)
{
int status;
int ret;
int ac = 0;
char **av = 0;
char *tmp = NULL;
string::size_type i;
// Build up a C array of the args
for (i = 0; i < sv.size(); ++i) {
opal_argv_append(&ac, &av, (char *) sv[i].c_str());
}
// There is no way to tell whether opal_few returned non-zero because
// the called app returned non-zero or if there was a failure in the
// exec (like the file not being found). So we look for the
// compiler first, just to try to eliminate that case.
tmp = opal_path_findv(av[0], 0, environ, NULL);
if (NULL == tmp) {
opal_show_help("help-wrapper.txt", "no-compiler-found", true,
av[0], NULL);
errno = 0;
status = -1;
} else {
free(tmp);
ret = opal_few(av, &status);
status = WIFEXITED(status) ? WEXITSTATUS(status) :
(WIFSIGNALED(status) ? WTERMSIG(status) :
(WIFSTOPPED(status) ? WSTOPSIG(status) : 255));
if (0 != ret && 0 != errno && fl_want_show_error) {
perror(cmd_name.c_str());
}
}
// Free the C array
opal_argv_free(av);
return status;
}
void
ompi_wrap_strip_white(string & str)
{
int start, end, size(str.size());
/* Remove leading whitespace */
for (start = 0; start < size; ++start) {
if (!isspace(str[start])) {
break;
}
}
/* Remove trailing whitespace */
for (end = start; end < size; ++end) {
if (isspace(str[end])) {
break;
}
}
str = str.substr(start, end);
}
bool
ompi_wrap_split(const string & str, char c, ompi_sv_t & out)
{
int start, i(0), size(str.size());
out.clear();
// Strip off the first bunch of c's
while (i < size && str[i] == c) {
++i;
}
if (i >= size) {
return false;
}
// Now start making a vector of the strings
while (i < size) {
start = i;
while (i < size && str[i] != c) {
++i;
}
out.push_back(str.substr(start, i - start));
while (i < size && str[i] == c) {
++i;
}
}
return true;
}
void
ompi_wrap_split_append_sv(const string & str, ompi_sv_t & out)
{
ompi_sv_t temp;
ompi_wrap_split(str, ' ', temp);
for (string::size_type i = 0; i < temp.size(); ++i) {
out.push_back(temp[i]);
}
}
void
ompi_wrap_append_sv(const ompi_sv_t & in, ompi_sv_t & out)
{
// JMS Is there a better way to do this?
for (string::size_type i = 0; i < in.size(); ++i) {
out.push_back(in[i]);
}
}
bool
ompi_wrap_check_file(const string & dir, const string & file)
{
int ret;
struct stat buf;
string name = dir + "/" + file;
ret = stat(name.c_str(), &buf);
return (bool) (0 == ret);
}

Просмотреть файл

@ -1,141 +0,0 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
// of Tennessee Research Foundation. All rights
// reserved.
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
//
#include "ompi_config.h"
#include "tools/wrappers/ompi_wrap.h"
#include <iostream>
using namespace std;
///
/// Back-end entry point for the wrapper compiler functionality. All
/// three wrapper compilers invoke this function.
///
/// \param argc Number of command line arguments
/// \param argv Vector containing command line arguments
/// \param env_vars Environment variables
/// \param default_compiler The default backend compiler
/// \param want_cxx_libs Whether C++ libraries should be linked in
/// \param want_f77_includes Whether F77 include path should be added
/// \param extra_args Extra arguments which need to be added
///
/// At most, we end up with a command line in the following form:
///
/// [compiler(*)] [Xppflags(*)] [Xflags(*)] [user args] [ldflags(*)] [libs(*)]
///
/// Items with (*) can be overridden at run time with environment variables.
///
/// X can be replaced with C, CXX, F, and FC for C, C++, Fortran 77,
/// and Fortran 90, respectively.
///
int
ompi_wrap_engine(int argc, char *argv[],
const ompi_sv_t & compiler_env_var,
const ompi_sv_t & xppflags_env_var,
const ompi_sv_t & xflags_env_var,
const ompi_sv_t & ldflags_env_var,
const ompi_sv_t & libs_env_var,
const std::string & default_compiler,
const std::string & default_xflags,
bool want_cxx_libs,
bool want_f90_libs,
bool want_f77_includes)
{
int ret(0);
bool want_flags;
ompi_sv_t str_vec;
ompi_sv_t compiler;
ompi_sv_t xppflags;
ompi_sv_t xflags;
ompi_sv_t user_args;
ompi_sv_t ldflags;
ompi_sv_t libs;
ompi_sv_t extra_flags;
ompi_sv_t cmd_line;
// Parse command line
ompi_wrap_parse_args(argc, argv, want_flags);
// Get the compiler
ompi_wrap_get_compiler(compiler_env_var, default_compiler, compiler);
// Build the XPPFLAGS (-I stuff only)
ompi_wrap_build_xppflags(xppflags_env_var, want_f77_includes,
xppflags);
// Build any XFLAGS
ompi_wrap_build_xflags(xflags_env_var, default_xflags, xflags);
// Build the user arguments
ompi_wrap_build_user_args(argc, argv, user_args);
// Build the LDFLAGS (-L stuff and WRAPPER_EXTRA_LDFLAGS)
ompi_wrap_build_ldflags(ldflags_env_var, ldflags);
// Build the LIBS (-l stuff and WRAPPER_EXTRA_LIBS)
ompi_wrap_build_libs(libs_env_var, want_cxx_libs, want_f90_libs, libs);
// Now assemble the command line
cmd_line.clear();
ompi_wrap_append_sv(compiler, cmd_line);
if (want_flags) {
ompi_wrap_append_sv(xppflags, cmd_line);
ompi_wrap_append_sv(xflags, cmd_line);
}
ompi_wrap_append_sv(user_args, cmd_line);
if (want_flags) {
ompi_wrap_append_sv(ldflags, cmd_line);
ompi_wrap_append_sv(libs, cmd_line);
}
// Display or execute?
if (showme_cmd) {
ompi_wrap_print_sv(compiler);
}
if (showme_cmd || showme_compile) {
ompi_wrap_print_sv(xppflags);
ompi_wrap_print_sv(xflags);
}
if (showme_cmd || showme_compile || showme_link)
ompi_wrap_print_sv(user_args);
if (showme_cmd || showme_link) {
ompi_wrap_print_sv(ldflags);
ompi_wrap_print_sv(libs);
}
if (showme_cmd || showme_compile || showme_link) {
cout << endl;
} else {
ret = ompi_wrap_exec_sv(cmd_line);
}
// That's all she wrote
return ret;
}