Copying this to the mailing lists in case someone else ever runs into the same problems.
Short version: before you use any other libMesh objects, you need to construct a libMeshInit object. Perhaps some subsets of some versions of the library under some runtime conditions let you get away without it, but that's not worth trying to rely on. --- Roy ---------- Forwarded message ---------- Date: Wed, 25 Aug 2010 14:55:25 -0400 From: Sebastian Steiger <stei...@purdue.edu> To: Roy Stogner <royst...@ices.utexas.edu> Subject: Re: problem in allgather (parallel.h)? Victory! Indeed the LibMeshInit object was constructed at a later stage (I didn't show you the entire code). The code was written by somebody else and according to that person he was able to use the integration methods even without calling LibMeshInit. Moving LibMeshInit to the top of our code solved the problem. I apologize for not spotting this earlier... it seems though as if that initialization is now madatory and hasn't been before. I'm also not sure why that assert in the Mesh constructor was passed... Thank you for your support and sorry for taking away so much of your time Sebastian On 08/25/2010 02:40 PM, Roy Stogner wrote: > > On Wed, 25 Aug 2010, Sebastian Steiger wrote: > >> I recompiled everything using METHOD=dbg. The problem looks the same. >> When I check Communicator_World.size() it seems to be 0 right at the >> start of the program already. >> >> BTW, my program testboost.cpp uses libmesh as a library: > > Except you don't seem to be creating a LibMeshInit object (or doing > the deprecated equivalent, calling libMesh::init()). > > That would certainly explain why Communicator_World hadn't been > initialized. I'm not sure how the program even got to print_info with > METHOD=dbg on, though; the Mesh constructor should have failed at a > libmesh_assert(libMesh::initialized()); test. > --- > Roy > >> int main() >> { >> msg.add_outstream(&std::cout); >> >> msg << "test 1D integration...\n"; >> msg << "Communicator_World.size()=" << >> Parallel::Communicator_World.size() << "\n"; >> >> Integrator integrator; >> >> Mesh mesh(1); >> >> MeshTools::Generation::build_line(mesh, 10, 0., 1.0, EDGE2); >> >> mesh.print_info(); >> >> integrator.set_mesh(&mesh); >> integrator.set_order(2); >> integrator.build_integral_sum(); >> >> const std::vector<std::vector<double> >& x = integrator.get_points(); >> const std::vector<double> & w = integrator.get_weights(); >> >> double s = 0; >> int n = x.size(); >> >> for (int i = 0; i < n; i++) >> { >> s += w[i] * f(x[i][0], x[i][1], x[i][2]); >> } >> >> //BOOST_CHECK_CLOSE(s, 1.0/3.0, 1e-10); >> cout << "Integral sum = " << s << "\n"; >> return 0; >> } >> >> >> >> >> On 08/25/2010 02:06 PM, Roy Stogner wrote: >>> >>> On Wed, 25 Aug 2010, Sebastian Steiger wrote: >>> >>>> <ss parallel.h:1772> set_union. comm.size()=0, >>>> Communicator_World.size()=0 >>>> >>>> i.e., Communicator_World also has size 0. What can I do against that? >>> >>> You don't happen to have an MPI stack that requires you to use mpirun >>> or mpiexec even for 1-processor cases, do you? >>> >>> Are you running in debug mode? (you should be - there's a bug) If >>> you are then your code made it past >>> libmesh_assert (libMeshPrivateData::_n_processors > 0); >>> in libMesh.C. It might be interesting to start polling >>> Communicator_World after that point and see when it's size() changes >>> and why. >>> --- >>> Roy >> >> ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Libmesh-devel mailing list Libmesh-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-devel