Are you using std::cout to print a message out? libMesh (by default) eats all std::cout output on all processors other than processor zero. You can use the command-line option of "--keep-cout" to keep that from happening... or you can print to std::err (which is normally what I do in these cases).
Derek On Fri, Aug 28, 2015 at 12:50 PM Andrew Donaldson Davis <davi...@mit.edu> wrote: > Hello all, > > You might have to forgive me if this is a silly question but I'm having > some trouble understanding how LibMesh initializes MPI. > > I have the code: > > using namespace std; > namespace mpi = boost::mpi; > > int main(int argc, char **argv) { > mpi::environment env(argc, argv); > > unique_ptr<mpi::communicator> worldComm = > unique_ptr<mpi::communicator>(new mpi::communicator); > > auto libmeshInit = make_shared<libMesh::LibMeshInit>(argc, argv, > MPI_Comm(*worldComm)); > > cout << " size: " << worldComm->size() << " rank: " << worldComm->rank() > << endl; > > return 0; > } > > which I expect to have an output like: > > size: 4 rank: 0 > size: 4 rank: 1 > size: 4 rank: 2 > size: 4 rank: 3 > > However, I am instead seeing the output: > > size: 4 rank: 0 > > If I comment out the line auto libmeshInit = > make_shared<libMesh::LibMeshInit>(argc, argv, MPI_Comm(*worldComm)); (i.e., > I do not initalize LibMesh) then I get the output I expected. > > Is this behavior expected? or what I am doing wrong? > > The problem I am running into is that the mesh is distributed over all four > processes but when I loop over the elements: > > // first element > libMesh::MeshBase::const_element_iterator el = > mesh.active_local_elements_begin(); > > // last element > const libMesh::MeshBase::const_element_iterator elEnd = > mesh.active_local_elements_end(); > > // loop through the elements > for( ; el!=elEnd; ++el ) { /* DO SOME STUFF */ } > > I only "touch" the elements on the rank 0 process. > > Thanks for your help, > Andy > > ------------------------------------------------------------------------------ > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libmesh-users > ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users