Giter Site home page Giter Site logo

xiw193 / csap-graphpartitioning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cmmin/csap-graphpartitioning

0.0 1.0 0.0 4.48 MB

SCOTCH Graph Partitioning algorithm wrappers in C++/Python

HTML 0.88% Shell 1.55% C 22.36% C++ 16.76% Python 30.48% Makefile 27.98%

csap-graphpartitioning's Introduction

SCOTCH Partitioning Algorithms

This document contains a brief guide to the repository and code within. It will be updated as the project progresses.

Some basic documentation is presented here. More detailed documentation can be found within the source files in the repository.

Project Aims

  • Implement fennel graph partitioning algorithms with SCOTCH or PaToH.

Objectives

  • Implement SCOTCH_graphMap() algorithm in C++
  • Implement SCOTCH_graphMapFixed() algorithm in C++
  • Port the algorithms to Python
  • [] Fully working alternative to fennel algorithm
  • [] Integrate algorithms with the larger partitioning algorithm

Structure of Repository

data Folder

Contains all the input and output files that are required to test the code to read/generate graphs or publish the outputs of graphs.

docs Folder

Contains project documentation and third-party library documentation.

src Folder

Contains cpp and python subfolders.

The cpp folder contains the graph partitioning algorithms implemented using C++ and SCOTCH shared object.

The python folder contains utilities to visualize graphs and the code for running SCOTCH algorithms from python.

test Folder

Currently contains basic unit tests for the Python implementation of the SCOTCH wrapper.

tools Folder

Contains the binaries of the shared libraries for various operating systems, to avoid having to re-build them for each machine.

Currently holds libscotch.dylib for macOS 64bit scotch v6.0.4 and for linux 64 bit scotch v5.1 (incorrectly linked).

C++ Graph Partitioner using SCOTCH

The implementation of a graph partitioning algorithm using SCOTCH is first written in C++ to ensure that the right calls and datastructures are implemented. The algorithm will be ported into python subsequently.

The source for the graph partitioner is in src/cpp/CAlgPrototypes.

The current implementation is in the method gpart() in src/CAlgPrototypes/main.cpp.

Default partitioning parameters were chosen.

Building the source creates a program called scotch that takes an input METIS graph file and runs graphMap to obtain the partitions for the vertices in the graph.

Building on Linux

This requires libscotch-5.1.so to be installed on the system. For later versions, amend the build.sh script found in the folder, to point to the other version of libscotch.

$ sudo apt-get install scotch

Building the graph partitioner:

$ ./build.sh -linux

Build options: -r runs the program after building. -c removes the program before re-building.

Building on macOS

This requires libscotch.dylib found in tools folder.

Building the graph partitioner:

$ ./build.sh -osx

Build options: -r runs the program after building. -c removes the program before re-building.

Running the Graph Partitioner

The build script creates a program called scotch in the same folder. The program is currently hard-coded to read the METIS graph data/oneshot_fennel_weights.txt and upon successful partitioning, generates data/oneshot_fennel_partitions.txt

$ cd src/cpp/CAlgPrototypes
$ ./scotch

Visualising the Partions

To visualise the partitions and graph, there is a d3js html visualisation found at data/socialNetwork.html.

Requires graphviz package.

$ pip3 install graphviz

To update the visualisation to the latest data in data/oneshot_fennel_partitions.txt:

$ cd src/python
$ python3 run_metis_graph.py
... generates .json file read
by socialNetwork.html ...

Basic Python Interface to SCOTCH

The basic code to interface Python with SCOTCH has been implemented, including some unit tests in src/python.

The python modules include some code to read METIS graphs and populate the arrays required by SCOTCH.

This code will be updated once the C++ implementaiton of the partitioning algorithms is completed.

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.