OpenMP compilation issue

The latest develop does not compile with and without KaHIP (-DNO_KAHIP=True ..). This is the branch with this latest commit.

The error message with KaHIP:

ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ cmake -DCMAKE_CXX_COMPILER=g++  .. && make -j4
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   system
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Could NOT find MKL (missing:  MKL_INCLUDE_DIR MKL_LIBRARIES) 
-- Checking for package 'KaHIP'
-- KaHIP could not be found/configured. (missing:  KAHIP_LIBRARIES KAHIP_INCLUDE_DIRS KAHIP_TEST_RUNS) 
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "pvtk" references the file
   "/usr/bin/pvtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- Checking for package 'Partio'
-- Partio could not be found/configured. (missing:  PARTIO_LIBRARIES PARTIO_INCLUDE_DIRS) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ezrayst/Documents/cb-geo/mpm/build
[  1%] Building CXX object CMakeFiles/mpm.dir/src/element.cc.o
[  2%] Building CXX object CMakeFiles/mpm.dir/src/main.cc.o
[  3%] Building CXX object CMakeFiles/mpm.dir/src/cell.cc.o
[  4%] Building CXX object CMakeFiles/mpmtest.dir/src/cell.cc.o
In file included from /home/ezrayst/Documents/cb-geo/mpm/include/mesh.h:521:0,
                 from /home/ezrayst/Documents/cb-geo/mpm/include/solvers/mpm.h:16,
                 from /home/ezrayst/Documents/cb-geo/mpm/src/main.cc:10:
/home/ezrayst/Documents/cb-geo/mpm/include/mesh.tcc: In member function ‘void mpm::Mesh<Tdim>::iterate_over_particle_set(int, Toper)’:
/home/ezrayst/Documents/cb-geo/mpm/include/mesh.tcc:1031:5: error: invalid controlling predicate
     for (auto sitr = set.begin(); sitr != set.cend(); ++sitr) {
     ^~~
CMakeFiles/mpm.dir/build.make:62: recipe for target 'CMakeFiles/mpm.dir/src/main.cc.o' failed
make[2]: *** [CMakeFiles/mpm.dir/src/main.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....

The error message without KaHIP:

ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DNO_KAHIP=True .. && make -j4
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   filesystem
--   system
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found OpenMP_C: -fopenmp  
-- Found OpenMP_CXX: -fopenmp  
-- Found OpenMP: TRUE   
-- Could NOT find MKL (missing:  MKL_INCLUDE_DIR MKL_LIBRARIES) 
-- Checking for package 'KaHIP'
-- KaHIP could not be found/configured. (missing:  KAHIP_LIBRARIES KAHIP_INCLUDE_DIRS KAHIP_TEST_RUNS) 
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "pvtk" references the file
   "/usr/bin/pvtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- Checking for package 'Partio'
-- Partio could not be found/configured. (missing:  PARTIO_LIBRARIES PARTIO_INCLUDE_DIRS) 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ezrayst/Documents/cb-geo/mpm/build
[  1%] Building CXX object CMakeFiles/mpm.dir/src/cell.cc.o
[  2%] Building CXX object CMakeFiles/mpm.dir/src/main.cc.o
[  3%] Building CXX object CMakeFiles/mpm.dir/src/element.cc.o
[  4%] Building CXX object CMakeFiles/mpmtest.dir/src/cell.cc.o
In file included from /home/ezrayst/Documents/cb-geo/mpm/include/mesh.h:521:0,
                 from /home/ezrayst/Documents/cb-geo/mpm/include/solvers/mpm.h:16,
                 from /home/ezrayst/Documents/cb-geo/mpm/src/main.cc:10:
/home/ezrayst/Documents/cb-geo/mpm/include/mesh.tcc: In member function ‘void mpm::Mesh<Tdim>::iterate_over_particle_set(int, Toper)’:
/home/ezrayst/Documents/cb-geo/mpm/include/mesh.tcc:1031:5: error: invalid controlling predicate
     for (auto sitr = set.begin(); sitr != set.cend(); ++sitr) {
     ^~~
^CCMakeFiles/mpmtest.dir/build.make:75: recipe for target 'CMakeFiles/mpmtest.dir/src/cell.cc.o' failed
make[2]: *** [CMakeFiles/mpmtest.dir/src/cell.cc.o] Interrupt
CMakeFiles/mpm.dir/build.make:88: recipe for target 'CMakeFiles/mpm.dir/src/cell.cc.o' failed
make[2]: *** [CMakeFiles/mpm.dir/src/cell.cc.o] Interrupt
CMakeFiles/mpm.dir/build.make:101: recipe for target 'CMakeFiles/mpm.dir/src/element.cc.o' failed
make[2]: *** [CMakeFiles/mpm.dir/src/element.cc.o] Interrupt
CMakeFiles/mpm.dir/build.make:62: recipe for target 'CMakeFiles/mpm.dir/src/main.cc.o' failed
make[2]: *** [CMakeFiles/mpm.dir/src/main.cc.o] Interrupt
CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/mpmtest.dir/all' failed
make[1]: *** [CMakeFiles/mpmtest.dir/all] Interrupt
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/mpm.dir/all' failed
make[1]: *** [CMakeFiles/mpm.dir/all] Interrupt
Makefile:94: recipe for target 'all' failed
make: *** [all] Interrupt

Details on dependencies:

ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ cmake --version
cmake version 3.12.3
ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ cmake --version
cmake version 3.12.3
ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ echo |cpp -fopenmp -dM |grep -i open
#define _OPENMP 201511

Checking the date of OpenMP here, version is 4.5

ezrayst@ezrayst-acer:~/Documents/cb-geo/mpm/build$ h5cc -showconfig
	    SUMMARY OF THE HDF5 CONFIGURATION
	    =================================

General Information:
-------------------
                   HDF5 Version: 1.10.0-patch1

The error seems to be from OpenMP not KaHIP, will look into it.

Could you please check your OpenMP version, we need version 5.0

echo |cpp -fopenmp -dM |grep -i open

Please upgrade your GCC to version 9 using the following commands

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9