[petsc-users] Compilation error

Daniel Pino Munoz daniel.pino_munoz at mines-paristech.fr
Sat Oct 12 09:31:43 CDT 2024


Thank you Satish and Junchao,

Actually following Satish's instructions I found that I am indeed using 
the same compiler but for some reason my command does not include the 
mpi include path.

I am going to check now my cmake files because it was initially found so 
I should be doing something wrong somewhere else.

Thank you and I think the problem is solved now.

Best,

   Daniel

On 12/10/2024 01:17, Satish Balay wrote:
> Here is one way to check.
>
> -  check make.log for the build - it might have something like:
>
> -----------------------------------------
> Using system modules:
> Using mpi.h: # 1 "/home/balay/soft/mpich-4.0.1/include/mpi.h" 1
> -----------------------------------------
>
> - now check your application build where you are getting the error - compile that source code with the additional option "-E" to see which mpi.h is getting used.
>
> balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (main =)
> $ make ex1.o CPPFLAGS=-E
> mpicc -o ex1.o -c -fPIC -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -g3 -O0  -I/home/balay/petsc/include -I/home/balay/petsc/arch-linux-c-debug/include   -E ex1.c
> balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (main =)
> $ grep 'mpi\.h' ex1.o |head
> # 1 "/home/balay/soft/mpich-4.0.1/include/mpi.h" 1
> # 40 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 66 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 84 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 144 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 156 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 198 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 244 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 262 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> # 333 "/home/balay/soft/mpich-4.0.1/include/mpi.h"
> balay at p1 /home/balay/petsc/src/ksp/ksp/tutorials (main =)
> $
>
> Ok here they match.
>
> If the same mpi.h is used for your usecase in both PETSc build - and
> in your application code - but you are still getting the error - send
> us the build logs - configure.log, make.log [you can use petsc-maint at mcs.anl.gov]
>
> Satish
>
> On Sat, 12 Oct 2024, Daniel Pino Munoz wrote:
>
>> I did that too, and I am using the same compiler.
>>
>> In fact I also checked the compilation of my code by setting VERBOSE=1 and
>> looking at the compilation command. It is indeed the same compiler... It's
>> pretty odd...
>>
>> Thanks anyway,
>>
>>    D.
>>
>> On 12/10/2024 00:04, Junchao Zhang wrote:
>>> Check they are the same MPI wrappers(if you use them), for example with
>>> "which mpicc" or "make V=1" to compare the exact executable path
>>>
>>> --Junchao Zhang
>>>
>>>
>>> On Fri, Oct 11, 2024 at 4:10 PM Daniel Pino Munoz
>>> <daniel.pino_munoz at mines-paristech.fr> wrote:
>>>
>>>      Dear all,
>>>
>>>      I am currently trying to compile my code but the compilation fails
>>>      with
>>>      the following error:
>>>
>>>      error "PETSc was configured with OpenMPI but now appears to be
>>>      compiling
>>>      using a non-OpenMPI mpi.h
>>>
>>>      I have obviously checked and I am compiling my sources using the same
>>>      compiler used to compile Petsc. To check this, I  looked into the
>>>      configure.log file generated by petsc and verified that the compiler
>>>      listed was indeed the one currently been used to compile my sources.
>>>
>>>      Does anyone have any idea of where the problem might be coming from?
>>>
>>>      Thank you,
>>>
>>>         D.
>>>


More information about the petsc-users mailing list