[Trilinos-Users] Workaround for combining trilinos and mpich at franklin.nersc.gov

Ernesto Prudencio prudenci at slac.stanford.edu
Tue Jan 29 16:39:15 MST 2008


Thanks Mike.

Trilinos is working on franklin. I just needed to do the workaround 
explanined below. Whenever trilinos (or any other code) tries to use 
stdio.h and mpi.h at the same time, this problem will happen.

Best,

Ernesto

On Tue, 29 Jan 2008, Heroux, Michael A wrote:

> Ernesto,
>
> We don't do anything that unusual in Trilinos regarding MPI and C++.  I  think the best hope for getting things working on franklin is to contact the NERSC support  staff.  There is surely someone there who can help with this problem, and probably fairly quickly.
>
> Mike
>
>
> On 1/29/08 4:55 PM, "Ernesto Prudencio" <prudenci at slac.stanford.edu> wrote:
>
>
>
> Hi.
>
> Just for the trilinos team to know: while I was compiling trilinos
> packages, the compiler complained about SEEK_SET in mpicxx.h, a include
> file of mpich installation in franklin. In that file I found the following
> comments and code:
>
> // There is a name conflict between stdio.h and the MPI C++ binding
> // with respect to the names SEEK_SET, SEEK_CUR, and SEEK_END.  MPI
> // wants these in the MPI namespace, but stdio.h will #define these
> // to integer values.  #undef'ing these can cause obscure problems
> // with other include files (such as iostream), so we instead use
> // #error to indicate a fatal error.  Users can either #undef
> // the names before including mpi.h or include mpi.h *before* stdio.h
> // or iostream.
>
> #ifndef MPICH_IGNORE_CXX_SEEK
> #ifdef SEEK_SET
> #error "SEEK_SET is #defined but must not be for the C++ binding of MPI"
> //#undef SEEK_SET
> #endif
> #ifdef SEEK_CUR
> #error "SEEK_CUR is #defined but must not be for the C++ binding of MPI"
> //#undef SEEK_CUR
> #endif
> #ifdef SEEK_END
> //#undef SEEK_END
> #error "SEEK_END is #defined but must not be for the C++ binding of MPI"
> #endif
> #endif
>
> In order to contour this problem, I just substitute inclusion of mpi.h in
> trilinos by some mpi_intermediate.h of mine, with the following contents:
>
> #ifdef SEEK_SET
> #define SEEK_SET_2 0
> #undef SEEK_SET
> #endif
>
> #ifdef SEEK_CUR
> #define SEEK_CUR_2 1
> #undef SEEK_CUR
> #endif
>
> #ifdef SEEK_END
> #define SEEK_END_2 2
> #undef SEEK_END
> #endif
>
> #include <mpi.h>
>
> #ifdef SEEK_END_2
> #define SEEK_END SEEK_END_2
> #endif
>
> #ifdef SEEK_CUR_2
> #define SEEK_CUR SEEK_CUR_2
> #endif
>
> #ifdef SEEK_SET_2
> #define SEEK_SET SEEK_SET_2
> #endif
>
> This solution worked for me, but the trilinos team might implement another
> definite solution in the package.
>
> Or, have you seen this problem before? If yes, is there any flag that I
> need to set during compilation?
>
> Thanks,
>
> Ernesto.
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
>



More information about the Trilinos-Users mailing list