[Dune] dune 2.4.1 and parallelism

Marco Cisternino marco.cisternino at optimad.it
Mon Jun 13 11:14:29 CEST 2016


Hi duners,
I have a problem with dune modules common, geometry, grid, subgrid, alugrid building
Everything works fine, apparently, but making a new default module I cannot get the helper working in parallel

My file opts
CMAKE_FLAGS="CMAKE_CXX_COMPILER=mpicxx CMAKE_C_COMPILER=mpicc --enable-parallel --disable-documentation --with-metis --with-parmetis -enable-experimental-grid-extensions --with-lapack --with-blas"

The default code enriched by some calls to MPI routines:
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <iostream>
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/exceptions.hh> // We use exceptions
#include <mpi.h>

int main(int argc, char** argv)
{
  try{
    MPI_Init(&argc,&argv);
    // Maybe initialize MPI
    Dune::MPIHelper& helper = Dune::MPIHelper::instance(argc, argv);
    std::cout << "Hello World! This is intersectionBug." << std::endl;
    int rank;
    MPI_Comm_rank(MPI_COMM_WORLD,&rank);
    std::cout << "I'm" << rank << " " << helper.rank()<< std::endl;
    if(Dune::MPIHelper::isFake)
      std::cout<< "This is a sequential program." << std::endl;
    else
      std::cout<<"I am rank "<<helper.rank()<<" of "<<helper.size()
        <<" processes!"<<std::endl;
    MPI_Finalize();
  }
  catch (Dune::Exception &e){
    std::cerr << "Dune reported error: " << e << std::endl;
  }
  catch (...){
    std::cerr << "Unknown exception thrown!" << std::endl;
  }
}

Direct calls to MPI routines work fine giving parallel outputs. I had to add explicit call to MPI_Init because MPI is not initialize by the helper instance method.
Instead, helper methods answer like the code is sequential.
Probably my opts file is wrong... I'm using a very old one adapted for cmake

If you need more information about modules building, just ask, please.
Thanks for you help.

Marco




More information about the Dune mailing list