Code Monkey home page Code Monkey logo

parallel-find-prime's Introduction

Parallel-Find-Prime

利用MPI实现并行的线性筛数法

编译

  • 串行

    mpic++ normal_find_prime.cpp -o normal_find_prime
  • 并行

    mpic++ parallel_find_prime.cpp -o parallel_find_prime

运行

  • 串行

    mpirun -n 1 normal_find_prime 0 [i]
  • 并行

    mpirun -n [进程数] --oversubscribe parallel_find_prime [i]
    • 进程数 :新建的进程数
    • i : ��筛选小于等于 2^i*1000 的素数

测试结果

计时方法

统计rank为0的进程所花的时间,使用MPI_WTime()获取时间,再做差

Pipeline VS Sequential

i n=2^i*1000 素数个数 进程数目 Paraleel Time Sequential Time
0 1000 168 16 0.00392103 0.000045061
1 2000 303 23 0.00455213 0.000077009
2 4000 550 32 0.00591898 0.000188828
3 8000 1007 32 0.00641418 0.000288963
4 16000 1862 32 0.00623393 0.000584841
5 32000 3432 32 0.00634909 0.001288890
6 64000 6413 32 0.00835586 0.002485040
7 128000 11987 32 0.00759101 0.004801030
8 256000 22525 32 0.01062920 0.011015900
9 512000 42445 32 0.01356720 0.020990800

parallel-find-prime's People

Contributors

bowenwu1 avatar

Watchers

 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.