Code Monkey home page Code Monkey logo

paralg's Introduction

ParAlg19

Build Status

Assignments for the Parallel Algorithms course, taken in Fall 2019. This repository consists of two parts,

  1. An initial assignment primes where we develop a parallel prime number sieve.
  2. A final assignment ccl, where we develop a parallel algorithm for connected components labelling (CCL) in a binary, sparse 3D image.

Primes

In /primes, we provide a sequential and parallel implementation of the sieve of Eratosthenes. Several branches relate to this, as follows,

  • baseline contains the initial implementation of our sequential and parallel sieves, without any further enhancements.

  • odd-k2 contains an initial search-space reduction, by considering only odd primes (and two, the only even prime).

  • six-k contains an optimisation where we limit the search space even further.

  • twin-primes contains code for generating only twin primes, that is, primes that surround an even number k as (k - 1, k + 1).

  • goldbach contains code for verifying the Goldbach conjecture in parallel.

Finally, we refer the reader to the paper in primes/report.pdf, which explains the various algorithms in considerably more detail.

CCL

In /ccl, we provide a sequential and parallel implementation of a connected component labelling (CCL) algorithm. All relevant code is in the master branch. We refer the reader to the paper in ccl/report.pdf, which explains the various algorithms in considerably more detail.

Developing

Regarding development,

  • For primes, there was not really any one code style, though an attempt was certainly made to be reasonable. For ccl, the style is enforced by clang-format - and a Travis check.

  • CMake is used as a build tool.

  • Unity is our testing framework.

Finally, you will also need on your machine,

How to use

Primes

First run e.g. cmake primes and make. This produces an executable, which must be called with positive integer argument: the upper bound for the sieve (exclusive). Additionally, several optional arguments are available:

  • l, a value for the lower bound. When specified, the sieve operates over the interval [lower bound, upper bound), rather than [0, upper bound).
  • p, a value for the number of processors to use. When left unspecified, this defaults to the maximal number available.

Thus, bin/primes 100 -l 20 -p 3 would run the parallel sieve over the interval [20, 100), dividing the work between three processors.

CCL

First run e.g. cmake ccl and make. This produces an executable, which must be called with two file arguments: the input and output files. Some example input files are given in /ccl/examples, with the .mat extension. The first line indicates the number of non-zeroes, each subsequent line a tuple of x y z indices. Several optional arguments are available:

  • p, a value for the number of processors to use. When left unspecified, this defaults to the maximal number available.

  • s, run the sequential algorithm, rather than the parallel one. If both p and s are passed, s takes precedence.

Thus, bin/ccl ccl/examples/hilbert2.mat hilbert2.ccl -p 4 would run the parallel algorithm with four processes on ccl/examples/hilbert2.mat, and output the result to hilbert2.ccl.

paralg's People

Contributors

n-wouda avatar

Watchers

 avatar  avatar

Forkers

marenan

paralg's Issues

Code coverage and style

Now that we have a build tool, we might just as well add checks on coverage (do the tests hit everything?) and style (is everything written in the same fashion?).

I'll maybe have a look at this in the coming weekend.

Travis cache MulticoreBSP

Travis might need to cache the MulticoreBSP download file, as the website it is downloaded from is not too reliable.

Add more tests

The code as-is has quite a few tests already, but the /ccl code could do with a few more.

Select a test framework

Probably not gTest, as that is written in C++ and we intend to use (only) C. Alternatives include,

  • Check. Looks simple, and fairly straightforward.
  • Unity. Has a nice interface, but doesn't look too different from Check.

Both should be fine to run on a CI platform.

Maybe do this, somewhat depends on time/effort.

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.