CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Error during compilation with Icc (http://www.cfd-online.com/Forums/openfoam-installation/70434-error-during-compilation-icc.html)

fs82 November 24, 2009 11:09

Error during compilation with Icc
 
Hello,

I have to compile OpenFoam 1.6.x with the Intel C++ Compiler on our SGI Altix System. This is the only available choice, gcc is not allowed on this maschine. I also have to switch the MPI coming with OpenFoam to a system own one. So I changed in $WM_PROJECT_DIR/etc/bashrc:

: ${WM_COMPILER:=Icc}; export WM_COMPILER

ia64)
WM_ARCH=linuxIA64
export WM_COMPILER=Icc
export WM_MPLIB=SGIMPT
;;

And in $WM_PROJECT_DIR/etc/settings.sh:

compilerInstall=System

case "$WM_MPLIB" in
SGIMPT)
mpi_version=mpt-1.22
export MPI_HOME=/opt/sgi/mpt/$mpi_version
export MPI_ARCH_PATH=$MPI_HOME

_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib

export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
;;

So this works so far, I have to add a $WM_PROJECT_DIR/wmake/rules/linuxIA64Icc/mplibSGIMPT and I tried to compile $WM_PROJECT_DIR/src/Pstream/mpi which works perfect. I noticed that I have to add *MPT* to the Allwmake file in the $WM_PROJECT_DIR/src/Pstream/ directory but this is easy. After executing Allwmake in $WM_PROJECT_DIR it takes a while until a serious error occurs:

/work/home6/fschleg/Source/OpenFoam/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/HashTable.C(459): error: argument list for class template "Foam::Hash" is missing
const HashTable<AnyType, Key, Hash>& rhs
^

/work/home6/fschleg/Source/OpenFoam/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/HashTable.C(457): error: no instance of overloaded function "Foam::HashTable<T, Key, Hash>::erase" matches the specified type
Foam::label Foam::HashTable<T, Key, Hash>::erase

So I am not able to figure out what the problem is. So may be anyone of the more advanced users could help me. I need the possibility to run my cases on this HPC and the usage of gcc and other mpi's is forbidden by the admins :-/

kind regards,
fabian

fs82 November 25, 2009 08:46

Nobody have an idea? I tested it with the intel 11.0 and 10.1 but the result is quite the same. The maschine provides an older gcc-4.1.1. but using this compiler leads to another serious error concerning some private variables. But the gcc-4.1.1. is able to compile the fileStat.C which causes the error. This problem sucks really.

7islands November 26, 2009 19:47

Hi Fabian,
I have posted a hint (a hint, not a solution) in another thread about the same issue. You might be able to try searching for that.

Takuya

fs82 November 27, 2009 02:38

Yes I know you mean this post:

Code:

namespace X {
  template<class T1, class T2> class A
  { template<class T3> void func(const A<T3, T2>&); };

  template<class T4> class T2 {};
}

// error - current OF code
template<class T1, class T2> template<class T3>
void X::A<T1, T2>::func(const A<T3, T2>&) {}

// ok - suggested fix
template<class T1, class T5> template<class T3>
void X::A<T1, T5>::func(const A<T3, T5>&) {}

But there are two problems with your hint. First one is my very less knowledge about C++and second I am not able to figure pout where the code lines are located you mentioned. So the hint wasn't really helpful for me up to now. May be you could explain it a little bit more?

Fabian

7islands November 27, 2009 03:36

Hi Fabian,

Yup that's the one. First try compiling the following with icc 11
Code:

namespace X {
  template<class T1, class T2> class A
  { template<class T3> void func(const A<T3, T2>&); };

  template<class T4> class T2 {};
}

// error - current OF code
template<class T1, class T2> template<class T3>
void X::A<T1, T2>::func(const A<T3, T2>&) {}

and you'll see the same error as you've got when compiling HashTable.C. Next try compiling
Code:

namespace X {
  template<class T1, class T2> class A
  { template<class T3> void func(const A<T3, T2>&); };

  template<class T4> class T2 {};
}

// ok - suggested fix
template<class T1, class T5> template<class T3>
void X::A<T1, T5>::func(const A<T3, T5>&) {}

which should go without any errors. Carefully compare and see the difference between the two pieces of codes. Do the same for HashTable.C.

I didn't try myself but my coworker, who asked for help about the problem, reported this worked for the particular error. But he also reported he had some other problems further on before finally getting everything compiled.

Takuya

fs82 November 27, 2009 10:33

I tried to compile the code example 1 and the code example 2 with icc. And you are right, version 1 do not compile and version 2 do compile. But I am sorry I do not get the difference. I am not a programmer at all, I am used to fortran and while working with OpenFoam I lerned a little bit of C++ but this is not enough to understand whats going on in your example, especially when using templates and how to apply this to the HashTable.C. So please help me :/

Fabian

Don456 November 28, 2009 06:43

Hi,

I'm stuck with the same problem.
I see the difference in the two examples but I'm not able to apply the changes.

Is it possible to get a fixed file from someone?

Greetings Felix

fs82 December 1, 2009 04:05

Allright, here is the fix for HashTable.C This is done by a collegue who has more experience with C++ but this works and the icc shoudn't complain about the HashTable.C any more. The same fix has to be applied to the HashSet.C.
Fix for HashTable.C, line 455:
Code:

template<class T, class KeyXXX, class HashXXX>
template<class AnyType>
Foam::label Foam::HashTable<T, KeyXXX, HashXXX>::erase
(
    const HashTable<AnyType, KeyXXX,HashXXX>& rhs
)

Fix for HashSet.C, line 34:
Code:

template<class KeyXX, class HashXX>
template<class AnyType>
Foam::HashSet<KeyXX, HashXX>::HashSet(const HashTable<AnyType, KeyXX, HashXX>& h)
:
    HashTable<nil, KeyXX, HashXX>(h.size())

But now the next error appears in src/OpenFOAM/primitives/hashes/SHA1/SHA1.C:

primitives/hashes/SHA1/SHA1.C(137): error: type definition is not allowed
if (UNALIGNED_P (data))

So may be anybody has an idea?

kind regards,
Fabian

olesen December 1, 2009 12:48

Would the following fixes also work?

Code:

template<class T, class Key, class Hash>
template<class AnyType, class AnyHash>
Foam::label Foam::HashTable<T, Key, Hash>::erase
(
    const HashTable<AnyType, Key, AnyHash>& rhs
)

and

Code:

template<class Key, class Hash>
template<class AnyType, class AnyHash>
Foam::HashSet<Key, Hash>::HashSet
(
  const HashTable<AnyType, Key, AnyHash>& h
)

Mattijs?

fs82 December 2, 2009 09:17

Allright for anybody else who try to compile OpenFoam 1.6 with Intels C++ Compiler the solution is posted here:
http://www.cfd-online.com/Forums/ope...1-6-x-icc.html

Fabian


All times are GMT -4. The time now is 05:07.