Bug 504357

Summary: Add a RPM macro to make building against openmpi easier
Product: [Fedora] Fedora Reporter: Susi Lehtola <susi.lehtola>
Component: openmpiAssignee: Jay Fenlason <fenlason>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: dledford, jfeeney
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-15 21:06:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Susi Lehtola 2009-06-05 19:06:26 UTC
AFAIK at the moment when building RPMs against openmpi, one has to load the MPI environment by

(in Fedora)
. /etc/profile.d/modules.sh
module load %{_libdir}/openmpi/*/openmpi.module

(in RHEL)
mpi-selector --set `mpi-selector --list | grep openmpi`
source /etc/profile.d/mpi-selector.sh


before running %configure. It would be nice if the necessary commands were in a macro, say %{openmpi_load}, that was provided by the openmpi-devel package.

Comment 1 Bug Zapper 2009-06-09 17:10:53 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Doug Ledford 2009-07-21 15:18:37 UTC
Although I didn't make a macro, I did make the process easier.  The module file is now in the module path.  I've also shortened the name of the module file and reduced what has to be known to load it.  The following snippet should work for you now:

. /etc/profile.d/modules.sh
module load openmpi-%{_arch}

Comment 3 Fedora Update System 2009-07-21 15:52:12 UTC
openmpi-1.3.3-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/openmpi-1.3.3-1.fc11

Comment 4 Susi Lehtola 2009-07-22 08:01:03 UTC
I still think setting CFLAGS in the module is a bad idea, since it overrides the build system environment variables. The mpi compiler commands mpi{cc,cxx,f77,f90} already have the include and library paths set and thus there is no need for setting CFLAGS:

$ mpicc --showme
gcc -I/usr/lib/openmpi/1.3.3-gcc/include -pthread -m32 -L/usr/lib/openmpi/1.3.3-gcc/lib -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl

Comment 5 Susi Lehtola 2009-07-22 08:07:02 UTC
.. and, obviously, the same thing with LDFLAGS.

Comment 6 Susi Lehtola 2009-07-22 08:08:52 UTC
In the least I suggest placing CFLAGS and LDFLAGS in another module file such as openmpi-[arch]-flags (that requires openmpi-[arch]).

Comment 7 Susi Lehtola 2009-07-22 08:13:31 UTC
And the module file should IMHO be put in /etc/modulefiles, that way it's distinguished from the internal environment-modules modules.

Comment 8 Susi Lehtola 2009-07-22 20:56:52 UTC
The macro thingy really wouldn't be much of a hassle:

$ cat /etc/rpm/macros.openmpi 
%_openmpi_load \
 . /etc/profile.d/modules.sh; \
 module load openmpi-%{_arch}; \
 export CFLAGS="$CFLAGS %{optflags}"
%_openmpi_unload \
 . /etc/profile.d/modules.sh; \
 module unload openmpi-%{_arch};

And /etc/rpm is owned by rpm, so there's no extra dependencies (rpm should be installed on every system, right?). 

The same thing works for lam too, if you s|openmpi|lam|g.

Comment 9 Fedora Update System 2009-07-23 19:06:22 UTC
openmpi-1.3.3-2.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update openmpi'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-7951

Comment 10 Jay Fenlason 2009-09-15 20:09:07 UTC
Is this adequately fixed in openmpi-1.3.3-4 ?  If so, I'd like to close this, if not, what do I need to do to fix it?

Comment 11 Susi Lehtola 2009-09-15 21:06:27 UTC
The MPI guidelines actually have the existence of the RPM macros baked within them, so this is really a duplicate of 521334.

*** This bug has been marked as a duplicate of bug 521334 ***