rpms/openmpi/devel mpi_alternatives.in, NONE, 1.1 openmpi.module.in, NONE, 1.1 openmpi.pc.in, NONE, 1.1 openmpi.spec, NONE, 1.1 relpath.sh, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Jason Vas Dias (jvdias) fedora-extras-commits at redhat.com
Thu Feb 23 17:59:37 UTC 2006


Author: jvdias

Update of /cvs/extras/rpms/openmpi/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29654/devel

Modified Files:
	.cvsignore sources 
Added Files:
	mpi_alternatives.in openmpi.module.in openmpi.pc.in 
	openmpi.spec relpath.sh 
Log Message:
auto-import openmpi-1.0.1-1.fe5 on branch devel from openmpi-1.0.1-1.fe5.src.rpm


--- NEW FILE mpi_alternatives.in ---
#!/bin/bash
#
# Script to set up alternatives(8) for MPI files which clash between OpenMPI and LAM
#
# Usage:
#     mpi_alternatives < install | display | remove | set > [ lam | openmpi ]
#
# Based on openmpi.spec file that uses alternatives by 
# Orion Poplawski<orion at cora.nwra.com>
#
# Copyright(C) Jason Vas Dias <jvdias at redhat.com>, Red Hat, Inc. 2006 
# Freely distributable under the terms of the GNU Public License(GPL)
# as published at: http://www.gnu.org/licenses/gpl.html
#
bindir=@BINDIR@;	# RPM _bindir macro during openmpi build
sysconfdir=@SYSCONFDIR@;        # RPM _sysconfdir macro during openmpi build
datadir=@DATADIR@;     # RPM _datadir macro during openmpi build
ompfx=@OMBINPFX@;	        # RPM OpenMPI OMbinpfx macro during openmpi build
lampfx=@LAMBINPFX@;	        # RPM lam LAMbinpfx macro during openmpi build
if [ `whoami` != 'root' ]; then
    echo "You must be root to set the MPI alternatives.";
    exit 1;
fi;
if [ ! -x /usr/sbin/alternatives ]; then
    echo "/usr/sbin/alternatives not installed. Install the chkconfig package.";
    exit 1;
fi;
case $1 in
    install)
	# Install alternative for MPI :

	/usr/sbin/alternatives --display mpi;
	if [ $? -eq 0 ]; then
	    echo "cannot install alternative for ${b##*/}: already exists.";
	    exit 0;
	fi;

	for b in mpirun mpiexec mpicc mpic++ mpif77; do
	    if [ ! -e ${bindir}/${lampfx}$b ]; then
		echo "Error: cannot install mpi alternatives: ${bindir}/${lampfx}$b does not exist.";
		echo "       check that the lam RPM is installed.";
		exit 1;
	    fi;	    
	    if [ ! -e ${bindir}/${ompfx}${b} ]; then
		echo "Error: cannot install mpi alternatives: ${bindir}/${ompfx}$b does not exist.";
		echo "       check that the openmpi RPM is installed.";
		exit 1;
	    fi;
	    if [ -e ${bindir}/$b ]; then
		if [ ! -L ${bindir}/$b ]; then
		    echo "Error: cannot install mpi alternatives: ${bindir}/$b exists and is not a link.";
		    echo "       check that the lam RPM version >= 7.1.1-11 is installed.";
		    exit 1;
		fi;
		rm -f ${bindir}/$b; # alternatives will create the link
	    fi;
	done;
	if [ ! -e ${datadir}/openmpi/ld.conf ]; then
	    echo "Error: cannot install mpi alternatives: ${datadir}/openmpi/ld.conf does not exist.";
	    echo "       check that the openmpi RPM is installed.";
	fi;
	if [ ! -e ${datadir}/lam/ld.conf ]; then
	    echo "Error: cannot install mpi alternatives: ${datadir}/lam/ld.conf does not exist.";
	    echo "       check that the lam RPM version >= 7.1.1-11 is installed.";
	fi;
	if [ -e ${sysconfdir}/ld.so.conf.d/mpi.conf ]; then
	    if [ ! -L ${sysconfdir}/ld.so.conf.d/mpi.conf ]; then
		echo "Error: cannot install mpi alternatives: ${sysconfdir}/ld.so.conf.d/mpi.conf exists and is not a link.";
		exit 1;
	    fi;
	    rm -f ${sysconfdir}/ld.so.conf.d/mpi.conf;
	fi;
	/usr/sbin/alternatives \
	    --install ${sysconfdir}/ld.so.conf.d/mpi.conf mpi ${datadir}/openmpi/ld.conf 50 \
	    --slave   ${bindir}/mpirun  mpirun  ${bindir}/${ompfx}mpirun \
	    --slave   ${bindir}/mpiexec mpiexec ${bindir}/${ompfx}mpiexec \
	    --slave   ${bindir}/mpicc   mpicc   ${bindir}/${ompfx}mpicc \
	    --slave   ${bindir}/mpic++  mpic++  ${bindir}/${ompfx}mpic++ \
	    --slave   ${bindir}/mpiCC   mpiCC   ${bindir}/${ompfx}mpic++ \
	    --slave   ${bindir}/mpif77  mpif77  ${bindir}/${ompfx}mpif77;

	retval=$?;
	if [ $retval -ne 0 ]; then
	    echo "Installation of OpenMPI MPI alternative failed.";
	    exit $retval;
	fi;

	/usr/sbin/alternatives \
	    --install ${sysconfdir}/ld.so.conf.d/mpi.conf mpi ${datadir}/lam/ld.conf 50 \
	    --slave   ${bindir}/mpirun  mpirun  ${bindir}/${lampfx}mpirun \
	    --slave   ${bindir}/mpiexec mpiexec ${bindir}/${lampfx}mpiexec \
	    --slave   ${bindir}/mpicc   mpicc   ${bindir}/${lampfx}mpicc \
	    --slave   ${bindir}/mpic++  mpic++  ${bindir}/${lampfx}mpic++ \
	    --slave   ${bindir}/mpiCC   mpiCC   ${bindir}/${lampfx}mpic++  \
	    --slave   ${bindir}/mpif77  mpif77  ${bindir}/${lampfx}mpif77;

	retval=$?;
	if [ $retval -ne 0 ]; then
	    echo "Installation of LAM MPI alternative failed.";
	    exit $retval;
	fi;

	prefMPI=lam
	if [ -n "$2" ] ; then
	    if [ $2 =~ '[Oo].*[Mm]' ]; then
		prefMPI=openmpi;
	    fi;
	fi;

	/usr/sbin/alternatives --set mpi ${datadir}/$prefMPI/ld.conf;

	retval=$?;
	if [ $retval -ne 0 ]; then
	    echo "Selection of default LAM alternative failed.";
	    exit $retval;
	fi;
	ldconfig;
	exit $retval;
	;;
   display)

	/usr/sbin/alternatives --display mpi;

	if [ $? -ne 0 ]; then
	    echo 'No alternatives set up for mpi - run "mpi_alternatives install".';
	    exit 1;
	fi;
	exit 0;
	;;
   remove)

	/usr/sbin/alternatives --remove mpi ${datadir}/lam/ld.conf

	retval=$?;
	if [ $retval -ne 0 ]; then 
	    echo "Removal of mpi alternative ${datadir}/lam/ld.conf failed.";
	    exit $retval;
	fi;	

	/usr/sbin/alternatives --remove mpi ${datadir}/openmpi/ld.conf

	retval=$?;
	if [ $retval -ne 0 ]; then 
	    echo "Removal of mpi alternative ${datadir}/openmpi/ld.conf failed.";
	    exit $retval;
	fi;	
	
	# set mpi.conf back to default (LAM):
	
	if [ ! -e ${sysconfdir}/ld.so.conf.d/mpi.conf ]; then
	    if [ -e ${datadir}/lam/ld.conf ]; then
		ln -s ${datadir}/lam/ld.conf ${sysconfdir}/ld.so.conf.d/mpi.conf;
	    elif [ -e ${datadir}/openmpi/ld.conf ]; then
		ln -s ${datadir}/openmpi/ld.conf ${sysconfdir}/ld.so.conf.d/mpi.conf;
	    else
		echo "Warning: no ${sysconfdir}/ld.so.conf.d/mpi.conf exists!";	       
            fi;
	fi;
	ldconfig;
	exit $?;
	;;
    set)	
	prefMPI=''
	case "$2" in
	    *[Ll][aA][mM]*)
	        prefMPI=lam
		;;
	    *[Oo]*[Mm]*)
	        prefMPI=openmpi
		;;
	    *)
		echo 'Usage: mpi_alternatives set < lam | openmpi >';
		;;
	esac;

	/usr/sbin/alternatives --set mpi ${datadir}/$prefMPI/ld.conf

	retval=$?;
	if [ $retval -ne 0 ]; then 
	    echo "Setting MPI alternative to ${datadir}/$prefMPI/ld.conf failed.";
	    exit $retval;
	fi;	
	ldconfig;
	exit $?;
	;;
   *)
	echo 'Usage: mpi_alternatives < install | display | remove | set>';
	echo '    Sets up alternatives for MPI (Message Passing Interface) between LAM and OpenMPI implementations.'
	exit 1;
	;;
esac;


--- NEW FILE openmpi.module.in ---
#%Module 1.0
#
#  OpenMPI module for use with 'environment-modules' package:
# 
prepend-path 		PATH 		@DATADIR@/@NAME@/bin
prepend-path 		LD_LIBRARY_PATH @DATADIR@/@NAME@/lib
prepend-path 		MANPATH         @DATADIR@/@NAME@/man
setenv			CFLAGS		-I at DATADIR@/@NAME@/include
setenv			LDFLAGS		-L at DATADIR@/@NAME@/lib


--- NEW FILE openmpi.pc.in ---
# pkg-config file for openmpi
Name: 		openmpi
Description:	Open Message Passing Interface headers and libraries
URL:		http://www.open-mpi.org/
Version:	@VERSION@
Libs:		-L at LIBDIR@ -lmpi
Cflags: 	-I at INCLUDEDIR@


--- NEW FILE openmpi.spec ---
%{?!dist:       %define dist .fe5}
Name:           openmpi
Version:        1.0.1
Release:        1%{dist}
Summary:        Open Message Passing Interface

Group:          Development/Libraries
License:        BSD
URL:            http://www.open-mpi.org/
Source0:       	http://www.open-mpi.org/software/ompi/v1.0/downloads/%{name}-%{version}.tar.bz2
Source1:	relpath.sh
Source2:	openmpi.pc.in
Source3:	mpi_alternatives.in
Source4:	openmpi.module.in
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  gcc-gfortran
Requires(post): /sbin/ldconfig

%package devel
Summary:        Development files for openmpi
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description
Open MPI provides a programming and runtime environment for  
parallel and/or distributed networked multi-computer systems .
MPI stands for the Message Passing Interface. Written by the MPI Forum,
MPI is a standardized API typically used for parallel and/or distributed 
computing - see http://www.mpi-forum.org/ .
Open MPI is an open source, freely available implementation of both the 
MPI-1 and MPI-2 standards, combining technologies and resources from
several other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI) in
order to build the best MPI library available.  A completely new MPI-2
compliant implementation, Open MPI offers advantages for system and
software vendors, application developers, and computer science
researchers. For more information, see http://www.open-mpi.org/ .

%description devel
Contains development headers and libraries for openmpi

%prep
%setup -q

%build
%ifarch x86_64
XCFLAGS="$RPM_OPT_FLAGS -fPIC"
XCXXFLAGS="$RPM_OPT_FLAGS -fPIC"
XFFLAGS="$RPM_OPT_FLAGS -fPIC"
%endif
%configure \
	--includedir=%{_includedir}/%{name} \
	--libdir=%{_libdir}/%{name} \
	--datadir=%{_datadir}/%{name}/help \
	LDFLAGS='-Wl,-z,noexecstack' \
	CFLAGS="$CFLAGS $XCFLAGS" \
	CXXFLAGS="$CFLAGS $XCFLAGS" \
	FFLAGS="$FFLAGS $XFLAGS";
# ${datadir}/openmpi will be used ONLY for the english help*.txt files
make %{?_smp_mflags}

%{?!OMbinpfx: %define OMbinpfx om-}   # prefix for OpenMPI binaries that clash with LAM
%{?!LAMbinpfx: %define LAMbinpfx lam-} # prefix for LAM binaries that clash with OpenMPI

%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=$RPM_BUILD_ROOT 
#
# Resolve LAM clashes and create %{_datadir}/openmpi/{bin,lib,include} :
. %SOURCE1
# ^- provides "relpath" function
rpath=`relpath ${RPM_BUILD_ROOT}/%{_bindir} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin`;
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin;
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/man;
ln -s `relpath ${RPM_BUILD_ROOT}/%{_libdir}/%{name} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}` ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/lib;
ln -s `relpath ${RPM_BUILD_ROOT}/%{_includedir}/%{name} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}` ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/include;
# Links: (mpiCC,mpicxx)->mpicc,  (mpiexec,mpirun)->orterun
# Clashes with LAM: mpic++ mpicc mpif77 mpif90 mpiexec mpirun
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/{mpiCC,mpicxx,mpiexec,mpirun}
(cd ${RPM_BUILD_ROOT}/%{_bindir}; ls) | egrep -v '^(mpic\+\+|mpicc|mpif77|mpif90)$' |
while read b; do
  ln -s ${rpath}/${b} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/${b};
done;
for b in mpic++ mpicc mpif77 mpif90; do 
  mv ${RPM_BUILD_ROOT}/%{_bindir}/$b  ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}$b;
  ln -s ${rpath}/%{OMbinpfx}$b ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/$b;
done
ln -s ./%{OMbinpfx}mpif90 ${RPM_BUILD_ROOT}/%{_bindir}/mpif90
ln -s ${rpath}/%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpiCC
ln -s ./%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpiCC
ln -s ${rpath}/%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpicxx
ln -s ./%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpicxx
ln -s ${rpath}/orterun   ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpirun
ln -s ./orterun ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpirun
ln -s ${rpath}/orterun   ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpiexec
ln -s ./orterun ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpiexec
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d
# Create ld.so config file for selection with mpi_alternatives:
echo %{_libdir}/%{name} > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/ld.conf
# Create ghost mpi.conf ld.so config file:
touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d/mpi.conf
# We don't like .la files
find ${RPM_BUILD_ROOT}%{_libdir} -name \*.la | xargs rm
# Make the pkgconfig files
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig;
sed 's#@VERSION@#'%{version}'#;s#@LIBDIR@#'%{_libdir}/%{name}'#;s#@INCLUDEDIR@#'%{_includedir}/%{name}'#' < %SOURCE2 > ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/%{name}.pc;
# Make the alternatives utility script:
mkdir -p ${RPM_BUILD_ROOT}/%{_sbindir}
sed 's#@BINDIR@#'%{_bindir}'#;s#@OMBINPFX@#'%{OMbinpfx}'#;s#@LAMBINPFX@#'%{LAMbinpfx}'#;s#@DATADIR@#'%{_datadir}'#;s#@SYSCONFDIR@#'%{_sysconfdir}'#'  < %SOURCE3 > ${RPM_BUILD_ROOT}/%{_sbindir}/mpi_alternatives;
chmod +x ${RPM_BUILD_ROOT}/%{_sbindir}/mpi_alternatives;
sed 's#@DATADIR@#'%{_datadir}/%{name}'#;s#@NAME@#'%{name}'#' < %SOURCE4 > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/%{name}.module
:;

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
if [ "$1" -ge 1 ]; then
   if [ ! -e %{_sysconfdir}/ld.so.conf.d/mpi.conf ]; then
   # handle the case where openmpi is installed without lam:
	ln -s %{_datadir}/%{name}/ld.conf %{_sysconfdir}/ld.so.conf.d/mpi.conf;
   fi;
fi;
/sbin/ldconfig

%preun

%postun -p /sbin/ldconfig

%post devel -p /sbin/ldconfig

%preun devel

%postun devel -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc LICENSE README
%ghost  %{_sysconfdir}/ld.so.conf.d/mpi.conf
%config %{_sysconfdir}/openmpi-*
%{_bindir}/orte*
%{_bindir}/*run
%{_bindir}/*exec
%{_bindir}/*info
%{_sbindir}/mpi_alternatives
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{name}
%{_libdir}/%{name}/*.so.*
%{_libdir}/%{name}/%{name}/*.so
%{_libdir}/%{name}/*.mod
%{_datadir}/%{name}/bin
%{_datadir}/%{name}/lib
%{_datadir}/%{name}/man
%{_datadir}/%{name}/help
%{_datadir}/%{name}/%{name}.module
%{_datadir}/%{name}/ld.conf

%files devel
%defattr(-,root,root,-)
%{_bindir}/*
%exclude %{_bindir}/orte*
%exclude %{_bindir}/*run
%exclude %{_bindir}/*exec
%exclude %{_bindir}/*info
%{_includedir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*.so
%{_libdir}/%{name}/*.a
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/%{name}/include


%changelog
* Wed Feb 15 2006 Jason Vas Dias <jvdias at redhat.com> - 1.0.1-1
- Import into Fedora Core
- Resolve LAM clashes 

* Wed Jan 25 2006 Orion Poplawski <orion at cora.nwra.com> - 1.0.1-2
- Use configure options to install includes and libraries
- Add ld.so.conf.d file to find libraries
- Add -fPIC for x86_64

* Tue Jan 24 2006 Orion Poplawski <orion at cora.nwra.com> - 1.0.1-1
- 1.0.1
- Use alternatives

* Sat Nov 19 2005 Ed Hill <ed at eh3.com> - 1.0-2
- fix lam conflicts

* Fri Nov 18 2005 Ed Hill <ed at eh3.com> - 1.0-1
- initial specfile created



--- NEW FILE relpath.sh ---
#!/bin/bash
#
# Function to convert absolute path $2 to a relative path to $1
#
# There should be some builtin / utility which does this, 
# but I can't think of one at the moment...
#
# Copyright(C) Jason Vas Dias <jvdias at redhat.com>, Red Hat, Inc. 2006 
# Freely distributable under the terms of the GNU Public License(GPL)
#
function relpath()
{
    IFS=/;
    a=($1);
    b=($2);
    unset IFS;
    a=(${a[@]});
    b=(${b[@]});
    p='';
    for p in ${a[@]}; do
	[ ${b[0]} != $p ] && break;
	b[0]='';
	b=(${b[@]});
	a[0]='';
	a=(${a[@]});
    done
    r='';
    for p in ${b[@]}; do
	r=../${r};
    done
    r=${r%/};
    for p in ${a[@]}; do
	r=$r/$p;
    done
    echo $r;
 }
 

Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/openmpi/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	23 Feb 2006 17:58:51 -0000	1.1
+++ .cvsignore	23 Feb 2006 17:59:37 -0000	1.2
@@ -0,0 +1 @@
+openmpi-1.0.1.tar.bz2


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/openmpi/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	23 Feb 2006 17:58:51 -0000	1.1
+++ sources	23 Feb 2006 17:59:37 -0000	1.2
@@ -0,0 +1 @@
+8abccca5cdddc81a6d9d9e22b3bb6db9  openmpi-1.0.1.tar.bz2




More information about the scm-commits mailing list