Return-Path: X-Original-To: apmail-giraph-user-archive@www.apache.org Delivered-To: apmail-giraph-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C7659D7EE for ; Wed, 5 Sep 2012 21:02:10 +0000 (UTC) Received: (qmail 61507 invoked by uid 500); 5 Sep 2012 21:02:10 -0000 Delivered-To: apmail-giraph-user-archive@giraph.apache.org Received: (qmail 61428 invoked by uid 500); 5 Sep 2012 21:02:10 -0000 Mailing-List: contact user-help@giraph.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@giraph.apache.org Delivered-To: mailing list user@giraph.apache.org Received: (qmail 61418 invoked by uid 99); 5 Sep 2012 21:02:09 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 21:02:09 +0000 Received: from localhost (HELO achingmbp15.local) (127.0.0.1) (smtp-auth username aching, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 21:02:09 +0000 Message-ID: <5047BDD7.60005@apache.org> Date: Wed, 05 Sep 2012 14:02:15 -0700 From: Avery Ching User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: user@giraph.apache.org, Eli Reisman Subject: Re: Divide by zero error trying to specify input format References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for the report. This is a bug I think when there are no paths. Eli? Avery On 9/4/12 10:46 PM, Vernon Thommeret wrote: > Just want to follow up on this. I was running on the latest version of > Giraph on Github when I was running into this issue. When I switched > back to the Giraph 0.2-SNAPSHOT release, my program was able to run. > > Thanks, > Vernon > > On Mon, Sep 3, 2012 at 12:44 AM, Vernon Thommeret wrote: >> I'm getting started with Giraph and I have a basic program running >> using the PseudoRandomVertexInputFormat. However, when I switch it to >> the IntIntNullIntTextInputFormat and specify an input file, I get a >> divide by zero error. I'm assuming that (1) I'm not setting this up >> properly and (2) there should probably be a length check before the >> division happens. >> >> This is the error I'm getting: >> >> java.lang.ArithmeticException: / by zero >> at org.apache.giraph.graph.LocalityInfoSorter.prioritizeLocalInputSplits(LocalityInfoSorter.java:107) >> at org.apache.giraph.graph.LocalityInfoSorter.(LocalityInfoSorter.java:71) >> at org.apache.giraph.graph.BspServiceWorker.reserveInputSplit(BspServiceWorker.java:228) >> at org.apache.giraph.graph.BspServiceWorker.loadVertices(BspServiceWorker.java:317) >> at org.apache.giraph.graph.BspServiceWorker.setup(BspServiceWorker.java:604) >> at org.apache.giraph.graph.GraphMapper.setup(GraphMapper.java:368) >> at org.apache.giraph.graph.GraphMapper.run(GraphMapper.java:569) >> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647) >> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323) >> at org.apache.hadoop.mapred.Child$4.run(Child.java:270) >> at java.security.AccessController.doPrivileged(Native Method) >> at javax.security.auth.Subject.doAs(Subject.java:396) >> at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1157) >> at org.apache.hadoop.mapred.Child.main(Child.java:264) >> >> This is the change that causes the program to no longer work: >> >> ------------------------------------ >> >> import org.apache.hadoop.io.LongWritable; >> >> import org.apache.giraph.graph.Edge; >> -import org.apache.giraph.graph.EdgeListVertex; >> +import org.apache.giraph.graph.IntIntNullIntVertex; >> import org.apache.giraph.graph.GiraphJob; >> -import org.apache.giraph.io.PseudoRandomVertexInputFormat; >> +import org.apache.giraph.io.IntIntNullIntTextInputFormat; >> import org.apache.giraph.io.AdjacencyListTextVertexOutputFormat; >> >> /** >> * Simple function to return the in degree for each vertex. >> */ >> -public class SimpleInDegreeCountVertex extends EdgeListVertex< >> - LongWritable, DoubleWritable, DoubleWritable, DoubleWritable> >> - implements Tool { >> +public class SimpleInDegreeCountVertex extends IntIntNullIntVertex >> implements Tool { >> >> private Configuration conf; >> >> @Override >> - public void compute(Iterable messages) { >> + public void compute(Iterable messages) { >> voteToHalt(); >> } >> >> @@ -80,15 +78,11 @@ public class SimpleInDegreeCountVertex extends >> EdgeListVertex< >> GiraphJob job = new GiraphJob(getConf(), getClass().getName()); >> >> job.setVertexClass(SimpleInDegreeCountVertex.class); >> - job.setVertexInputFormatClass(PseudoRandomVertexInputFormat.class); >> + job.setVertexInputFormatClass(IntIntNullIntTextInputFormat.class); >> job.setVertexOutputFormatClass(AdjacencyListTextVertexOutputFormat.class); >> job.setWorkerConfiguration(10, 10, 100.0f); >> >> - job.getConfiguration().setLong( >> - PseudoRandomVertexInputFormat.AGGREGATE_VERTICES, 100l); >> - job.getConfiguration().setLong( >> - PseudoRandomVertexInputFormat.EDGES_PER_VERTEX, 2l); >> - >> + FileInputFormat.addInputPath(job.getInternalJob(), new >> Path("connections/1.txt")); >> FileOutputFormat.setOutputPath(job.getInternalJob(), new >> Path("in_degree_output")); >> >> boolean isVerbose = cmd.hasOption('v'); >> >> ------------------------------------ >> >> "connections/1.txt" and "in_degree_output" are both in my home >> directory. /connections/1.txt has the following content: >> >> 1 5 >> 2 5 6 >> 3 5 6 >> 4 1 2 3 >> >> I've spent some time digging through the source and comparing to some >> of the example classes, but I'm having trouble working this out. Any >> thoughts? >> >> Thanks! >> Vernon