Code Monkey home page Code Monkey logo

grail's Introduction

Grail

Compilation

$ make

Run

$ ./grail <graph_file> <d> <query_file>

Design

The program is implemented in the UNIX-like POSIX system.

We decided to parallelize the index creation and the query resolution as two different, unrelated parts.

For index creation, we generate d threads, each of which generates one layer of labels with a time complexity O(n + m). We choose the basic Randomized approach described in the GRAIL paper, and no support for exception lists, as this is the same setup used in the experiments in the paper. No synchronization primitives are needed during this phase, as every thread works on different portions of memory.

For query resolution, we generate a number of threads equals to the number of processors/cores of the machine, each of which repeatedly reads a line from the query file in mutual exclusion (with a spinlock, to reduce the number of context switches), runs the algorithm with time complexity between O(d) and O(n + m) (as proved in the GRAIL paper) and saves the result in an array, for later printing. Accessing the array of results is not mandated by any synchronization primitive, as every thread writes in a different portion of the array, and the reading is done by one thread, after all results have been generated.

Experimental results

We conducted experimental runs of the final program and, while our setup is not compatible with the one presented in the GRAIL paper, our results are sometimes faster, sometimes slower, but in the same order of magnitude. The graphs used during this step are the ones provided via the Portale della Didattica. For synthetic graphs, we used the query files generated by running the provided program. For real graphs, we generated 100000 random queries with the scripts random_queries16b.sh and random_queries32b.sh: both scripts accept an integer a, and generate queries, selecting nodes between 0 and a - 1. All experimental runs are reported in the file stats.xslx. In particular:

  • For synthetic graphs, we cannot compare our results with the one in the paper because our graphs have an average degree much larger than the ones used in the GRAIL paper.
  • For small, sparse graphs, some of our results are between 1.5 and 10 times faster, while other are between 2 and 5 times slower. It is worth noting than the slower times are obteined from a different machine than the faster times.
  • For small, dense graphs our results are around 2 times slower (we could only run arXiv with d > 5). Again, this slow results are obtained on the same slow machine mentioned above.
  • For large, real graphs, our code can run up to 2 times faster (we could not test uniprot-100m, because it stopped with a memory allocation error).

We can say that, for all graphs, the time for query resolution greatly drops with the increase of the number of labels (up to 50 times faster in some graphs), with a time for creating the index that rises between 50% and 300%, with a greater increase in smaller graphs.

Conclusion

Our parallel implementation of the GRAIL algorithm shows great improvements in the speed of resolution of queries in large graphs with respect to the sequential implementation; the advantages of our parallel implementation are simple: we can generate each layer of the labels at the same time, and resolve more than one query at a time, which results in a lower execution time overall.

grail's People

Contributors

leax-xiv avatar s267337 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.