Problems on PowerPC platform

Hello,
I’m trying to compile palabos on a Mac Mini G4.
While version 1.5 works, I am unable to compile version 2.0.
I got the following output:

mini:~ utente$ cd /Users/utente/Desktop/palabos-v2.0r0/examples/showCases/cylinder2d 
mini:cylinder2d utente$ make
python ../../../scons/scons.py -j 6 -f ../../../SConstruct palabosRoot=../../.. projectFiles="cylinder2d.cpp" optimize=true debug=false profile=false MPIparallel=false SMPparallel=false usePOSIX=true serialCXX=g++ parallelCXX=mpicxx compileFlags="-Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X" linkFlags="" optimFlags="-O3" debugFlags="-g" profileFlags="-pg" srcPaths="" libraryPaths="" includePaths="" libraries=""
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o cylinder2d.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries cylinder2d.cpp
g++ -o /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper2D.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper2D.cpp
In file included from /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/dataInitializerFunctional2D.h:34,
                 from /Users/utente/Desktop/palabos-v2.0r0/src/boundaryCondition/bounceBackModels2D.h:33,
                 from /Users/utente/Desktop/palabos-v2.0r0/src/boundaryCondition/headers2D.h:43,
                 from /Users/utente/Desktop/palabos-v2.0r0/src/palabos2D.h:30,
                 from cylinder2d.cpp:32:
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:161: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:162: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:163: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:164: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:318: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:364: error: integer constant is too large for ‘long’ type
In file included from /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/dataInitializerFunctional2D.h:34,
                 from /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper2D.cpp:27:
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:161: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:162: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:163: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:164: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:318: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:364: error: integer constant is too large for ‘long’ type
g++ -o /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper3D.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper3D.cpp
In file included from /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/dataInitializerFunctional3D.h:34,
                 from /Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper3D.cpp:27:
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:161: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:162: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:163: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:164: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:318: error: integer constant is too large for ‘long’ type
/Users/utente/Desktop/palabos-v2.0r0/externalLibraries/sitmo/prng_engine.hpp:364: error: integer constant is too large for ‘long’ type
g++ -o /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/boxLogic3D.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/boxLogic3D.cpp
g++ -o /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/couplingInterfaceGenerator3D.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/couplingInterfaceGenerator3D.cpp
g++ -o /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octree.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octree.cpp
g++ -o /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.o -c -Wall -Wnon-virtual-dtor -Wno-deprecated-declarations -DPLB_MAC_OS_X -O3 -DPLB_USE_POSIX -I/Users/utente/Desktop/palabos-v2.0r0/src -I/Users/utente/Desktop/palabos-v2.0r0/externalLibraries /Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.cpp
scons: *** [/Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper2D.o] Error 1
scons: *** [/Users/utente/Desktop/palabos-v2.0r0/src/dataProcessors/metaStuffWrapper3D.o] Error 1
/Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.hh: In member function ‘plb::OctreeGridStructure plb::OctreeGridGenerator<T>::generateOctreeGridStructure()’:
/Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.hh:1660: error: call of overloaded ‘pow(int, int&)’ is ambiguous
/usr/include/architecture/ppc/math.h:467: note: candidates are: double pow(double, double)
/usr/include/c++/4.0.0/cmath:344: note:                 float std::pow(float, float)
/usr/include/c++/4.0.0/cmath:348: note:                 long double std::pow(long double, long double)
/usr/include/c++/4.0.0/cmath:352: note:                 double std::pow(double, int)
/usr/include/c++/4.0.0/cmath:356: note:                 float std::pow(float, int)
/usr/include/c++/4.0.0/cmath:360: note:                 long double std::pow(long double, int)
/Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.hh:1693: error: call of overloaded ‘pow(int, int&)’ is ambiguous
/usr/include/architecture/ppc/math.h:467: note: candidates are: double pow(double, double)
/usr/include/c++/4.0.0/cmath:344: note:                 float std::pow(float, float)
/usr/include/c++/4.0.0/cmath:348: note:                 long double std::pow(long double, long double)
/usr/include/c++/4.0.0/cmath:352: note:                 double std::pow(double, int)
/usr/include/c++/4.0.0/cmath:356: note:                 float std::pow(float, int)
/usr/include/c++/4.0.0/cmath:360: note:                 long double std::pow(long double, int)
scons: *** [/Users/utente/Desktop/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.o] Error 1
scons: *** [cylinder2d.o] Error 1
scons: building terminated because of errors.
make: *** [compile] Error 2

Any idea to solve this problem will be greatly appreciated!

Thank you very much in advance,

Davide

Hello and welcome to the forum,

which version of g++ are you using? what mac os x version?

Thank you very much!

I have Xcode 3.1.4 installed, which is the last version available for PowerPC processors; g++ version is 4.0.1:

mini:~ utente$ g++ --version
powerpc-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

10.5.8 (Leopard), the last PowerPC version

It’s very old…

Could you try to add the -std=c++11 flag for compilation?

I added in the makefile the line:

CXXFLAGS= -std=c++11

but I still have almost the same errors

I am unable to reproduce the bug since I don’t have a mac but maybe you could try a hack and explicitly cast the values at those lines, like

int a = util::roundToInt(std::pow((double)a, (double)b));

I solved installing gcc version 7 with Tigerbrew and changing “g++” in “g++-7” in the makefile.
Palabos 1.5 works fine with g++ version 4 instead

So, it seems that now Mac OSX is working.

The second problem, now: Lubuntu 16.04.6

Here everything works, apparently, but I have strange results when running the cavity3d benchmark.
Palabos version 2 gives me an extremely high (and impossible) number of Mega site updates per second:

davide@davide-desktop:~/Scaricati/palabos-v2.0r0/examples/benchmarks/cavity3d$ time ./cavity3d 50
Starting benchmark with 51x51x51 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 2262 iterations: 1267.94 Mega site updates per second.


real	18m46.610s
user	18m12.132s
sys	0m2.408s


davide@davide-desktop:~/Scaricati/palabos-v2.0r0/examples/benchmarks/cavity3d$ time ./cavity3d 100
Starting benchmark with 101x101x101 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 291 iterations: 632.494 Mega site updates per second.


real	14m47.763s
user	14m20.040s
sys	0m2.724s

Palabos version 1.5, on the other hand, gives me even negative values:

davide@davide-desktop:~/Scaricati/palabos-v1.5r1/examples/benchmarks/cavity3d$ time ./cavity3d 50
Starting benchmark with 51x51x51 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 2262 iterations: -749.434 Mega site updates per second.

timer -0.399787 seconds.


real	18m42.957s
user	18m8.008s
sys	0m2.272s
davide@davide-desktop:~/Scaricati/palabos-v1.5r1/examples/benchmarks/cavity3d$ time ./cavity3d 100
Starting benchmark with 101x101x101 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 291 iterations: 781.397 Mega site updates per second.

timer 0.384239 seconds.


real	14m41.168s
user	14m12.792s
sys	0m2.420s

Where’s the problem here?

Thank you again,

Davide

that’s great that you managed to get rid of the errors by upgrading the compiler.

the results are indeed very strange. an again I’m unable to reproduce them…

what architecture are you running them on? what compiler? etc…

Oh, I’m sorry, I thought it was clear that it’s the same machine.
It’s dual boot, since Mac OS X 10.5.8 is not updated since 2009: for this reason I installed the last PowerPC version of Ubuntu available, which is 16.04.6, and gcc is version 5.3.1.

The machine is this one (with 1GB RAM):

https://everymac.com/systems/apple/mac_mini/specs/mac_mini_g4_1.5.html

The strange thing is that the PowerPC architecture is the same of the Blue-Gene/P that was used for the benchmarks described in the website (despite of course the fact that my Mac Mini is infinitely less powerful :joy:).

Oh I just managed to reproduce the bug!

I actually did not notice that you used g++and not mpicxx as a compiler.

I will have a look and keep you posted.

I don’t use mpicxx since the G4 processor is single core, with just 1GB of RAM.
I was curious about the possibility of running palabos on platforms with very different architectures, and I wanted to do some tests and benchmarks.
Currently, I am mainly working on this PowerPC, ARM (a Raspberry Pi 3B running Raspbian Buster) and a small cluster made of 12 Intel Xeon Phi 7210 (3072 cores in total) running CentOS.

OK looks great. All the powerpc/arm arch are single threaded?

There is indeed a bug with the Palabos timer in the case of the g++ compilation. I am correctingit now.

No, just the PowerPC is, the Raspberry Pi has a Quad Core 1.2GHz Broadcom BCM2837 64bit CPU.

That’s great, thanks!

I think I fixed it. Try cloning the palabos repo: https://gitlab.com/unigespc/palabos and trying again.

Yes, it is fixed for Lubuntu 16.04.6 PowerPC:

davide@davide-desktop:~/Scaricati/palabos/examples/benchmarks/cavity3d$ time ./cavity3d 50
Starting benchmark with 51x51x51 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 2262 iterations: 0.494306 Mega site updates per second.


real	20m10.533s
user	18m19.268s
sys	0m4.048s


davide@davide-desktop:~/Scaricati/palabos/examples/benchmarks/cavity3d$ time ./cavity3d 100
Starting benchmark with 101x101x101 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 291 iterations: 0.634202 Mega site updates per second.


real	15m38.623s
user	14m17.188s
sys	0m3.340s

The Mega sites updates per second seem reasonable now.
Thank you, I’ll check this new version on Mac OS X, too.

Thanks for the bug report!

It works on Mac OS X 10.5.8, too:

mini:cavity3d utente$ time ./cavity3d 50
Starting benchmark with 51x51x51 grid points (approx. 2 minutes on modern processors).
Number of MPI threads: 1
After 2262 iterations: 0.528182 Mega site updates per second.


real	19m12.207s
user	18m50.430s
sys	0m5.986s

You are welcome, I hope it’ll help others who want to use Palabos on a PowerPC architecture!

Hi again, I’m trying to compile with Open Watcom 2.0 C++ compiler (https://github.com/open-watcom/open-watcom-v2/releases/tag/Current-build), but it doesn’t work.

I see from wikipedia that " The compiler currently doesn’t support any new major C11 features, though the C library does include “Safe C” functions."

Could this be the reason?

Probably. There definitely is some c11 syntax in palabos.