Giter Club home page Giter Club logo

map-sort's Introduction

概要

並列ソートである Map Sort の OpenMP を用いた実装です. テンプレートで書かれており,比較できる任意の型の配列をソートできます.

整数や浮動小数点数の普通のソートなら, 並列 Radix Sort の方が遥かに高速です.

tbb::parallel_sort を使えばいいのではと言われれば大体そうで, 一応すこし速いのと,tbb を入れるのが面倒なときに役に立つかもしれません.

使い方

sample.cc や measure.cc を見ると大体分かると思います.

コンパイル時に -fopenmp を付けないと並列化されないので注意してください.

性能

measure.cc で 2 千万要素の int 配列のソートの時間を測ります.

実行例:

% g++ -O3 -fopenmp measure.cc
% ./a.out
N = 20000000
map_sort::Sort(0): 0.435177 sec
map_sort::Sort(1): 0.400754 sec
map_sort::Sort(2): 0.418151 sec
std::sort(0): 1.728168 sec
std::sort(1): 1.736658 sec
std::sort(2): 1.734755 sec

課題

  • 比較オブジェクトをとれるようにする
  • Software Managed Buffer を並列 Radix Sort と同様に導入すれば性能は上がる?

参考文献

  • M.Edahiro and Y.Yamashita, "Map Sort: A Scalable Sorting Algorithm for Multi-Core Processors," IPSJ Report (SLDM), No. 27 (Mar., 2007), pp. 19--24, 2007.

map-sort's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.