On Sep 22, 2008, at 8:48 AM, Robert Kubrick wrote:
Recompile your own version of openmpi in a local directory, set your
PATH to your local openmpi install.
export PATH=/my/openmpi/install/include:/usr/local/include
mpicxx -show
mpicxx --showme should show you the exact command that Open MPI's
wrapper compiler is using to compile your application. There should
already be an explicit -I there for where OMPI's mpi.h resides. If
that's the case, the compiler should look there *first* for mpi.h,
not /usr/local/include. Consider following example:
- I created include-test.c which just does an "#include <stdio.h>".
- If I run this through the preprocessor, you can see that it's
getting /usr/include/stdio.h:
[6:09] svbu-mpi:~/tmp % cat include-test.c
#include <stdio.h>
[6:09] svbu-mpi:~/tmp % gcc -E include-test.c | head
# 1 "include-test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "include-test.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 28 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 319 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 320 "/usr/include/features.h" 2 3 4
- But now I make my-include-dir/stdio.h with a single line in it
- Then I recompile with an explicit -I for that directory and you can
see that the compiler picks up that stdio.h, not /usr/include/stdio.h
[6:09] svbu-mpi:~/tmp % cat my-include-dir/stdio.h
typedef int foo;
[6:09] svbu-mpi:~/tmp % gcc -E -Imy-include-dir include-test.c | head
# 1 "include-test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "include-test.c"
# 1 "my-include-dir/stdio.h" 1
typedef int foo;
# 2 "include-test.c" 2
[6:10] svbu-mpi:~/tmp %
Are you sure that OMPI's mpicxx.h is picking up MPICH's mpi.h? If so,
how? Did you run it through the preprocessor (perhaps similar to
above), or step through a debugger or something?
--
Jeff Squyres
Cisco Systems