Topic: OOFEM with PETSc compiled with intel compilers

I am currently trying to compile and link a parallel version of OOFEM on a computer cluster  where PETSc is already built. To build PETSc, the intel compiler suite of version 11.1 has been used so I am trying to use the same compilers and openmpi environment that has been used to build petsc (v 3.2).

The problem I am facing is that when compiling OOFEM, I get the following error message:

[ 11%] Building CXX object src/oofemlib/CMakeFiles/core.dir/petscsparsemtrx.C.o
/beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C(114): error: argument of type "int" is incompatible with parameter of type "const PetscScalar={double} *"
          VecCreateSeqWithArray(PETSC_COMM_SELF, 1, x.giveSize(), x.givePointer(), & globX);
                                                    ^

/beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C(114): error: argument of type "double *" is incompatible with parameter of type "Vec *"
          VecCreateSeqWithArray(PETSC_COMM_SELF, 1, x.giveSize(), x.givePointer(), & globX);
                                                                  ^

/beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C(114): error #140: too many arguments in function call
          VecCreateSeqWithArray(PETSC_COMM_SELF, 1, x.giveSize(), x.givePointer(), & globX);
                                                                                   ^

/beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C(148): error: argument of type "int" is incompatible with parameter of type "const PetscScalar={double} *"
      VecCreateSeqWithArray(PETSC_COMM_SELF, 1, x.giveSize(), x.givePointer(), & globX);
                                                ^

/beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C(148): error: argument of type "double *" is incompatible with parameter of type "Vec *"
      VecCreateSeqWithArray(PETSC_COMM_SELF, 1, x.giveSize(), x.givePointer(), & globX);
                                                              ^

/beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C(148): error #140: too many arguments in function call
      VecCreateSeqWithArray(PETSC_COMM_SELF, 1, x.giveSize(), x.givePointer(), & globX);
                                                                               ^

compilation aborted for /beda/users/home/fagmar/OOFEM_Jim/src/oofemlib/petscsparsemtrx.C (code 2)
make[2]: *** [src/oofemlib/CMakeFiles/core.dir/petscsparsemtrx.C.o] Error 2
make[1]: *** [src/oofemlib/CMakeFiles/core.dir/all] Error 2
make: *** [all] Error 2

Does that imply that there is some non-standard coding in petscsparsemtrx.C or that I have set up my cluster environment in the wrong way?

2

Re: OOFEM with PETSc compiled with intel compilers

Hi Martin,

I think your problem is related to the PETSc version you are using. The arguments of VecCreateSeqWithArray have been changed in PETSc ver. 3.3 (see http://www.mcs.anl.gov/petsc/documentat … es/33.html for reference).
You basically have two options:
1) either upgrade to PETSc 3.3 (sure that this version works, but also 3.4 should work)
2) if you are not able to upgrade or install new PETSc version then you should downgrade to 3.2 (see following commit: http://www.oofem.org/gitweb/?p=oofem.gi … d809f6fee)

Borek

Re: OOFEM with PETSc compiled with intel compilers

I can confirm that the problem was the version.

I'm not surprised if there is documentation that still says "3.2" out there somewhere, if so, let us now so we can remove it (lest it be outdated again eventually).

I'm going to see to the CMake script to see if I can fix it so that it checks for a specific version.

Re: OOFEM with PETSc compiled with intel compilers

The CMake files produced by PETSc aren't very well made (the automatically produced "conf/PETScConfig.cmake" file).
It doesn't add any versioning information at all, so there is nothing (simple) i can do to check the versions.

5

Re: OOFEM with PETSc compiled with intel compilers

It seems there is  include/petscversion.h containing (among others) the following variables, that can be used to check PETSc version:

#define PETSC_VERSION_RELEASE    1
#define PETSC_VERSION_MAJOR      3
#define PETSC_VERSION_MINOR      4
#define PETSC_VERSION_SUBMINOR   2

Re: OOFEM with PETSc compiled with intel compilers

I didn't want to dig into parsing files as it would make the cmake script rather complex.

I've emailed the petsc maintainers. They told me I shouldn't be using the config file (though I can't say I agree). They suggested in either using the pkgconfig file or using FindPETSc.cmake
I'm reluctant to use either. With pkgconfig I couldn't even seem to specify a custom path so I couldn't get it to work at all. FindPETSc.cmake is not distributed so we would have to manually copy and distribute those files (and I'm opposed to copying other code and keeping that up-to-date).

The absolutely nicest solution would be if the PETSc maintainers just shipped a complete PETScConfig.cmake file, which would sort out everything. It would be trivial to support since they already write a pkgconfig file (and its basically the same information presented in a different syntax).

I think I'll leave things as they are for now, and simply request a proper Config.cmake file in future versions of PETSc.

Re: OOFEM with PETSc compiled with intel compilers

It's been some time since my previous question. Now I want to update the PETSc installation but I cant figure out which versions of PETSc that are supported by OOFEM. Above it appears as if at least 3.4.2 should work. Somewhere else I saw a note that 3.5 might work (but that was in a thread related to Windows). Could someone please help me?

8

Re: OOFEM with PETSc compiled with intel compilers

Right now, the nightly builds are done using PETSc 3.4.2, so this version works for sure.

Re: OOFEM with PETSc compiled with intel compilers

Version 3.5 should also work (Erik Svenning added some code to check for this version as well).