A Hands-on Introduction to MPI Python Programming
[Pages:17]A Hands-on Introduction to MPI Python Programming
Sung Bae, Ph.D New Zealand eScience Infrastructure
1 INTRODUCTION: PYTHON IS SLOW
1.1.1 For
Example: Computing the value of =3.14159... 4.0
() = (1 + 2)
it is known that the value of can be computed by the numerical integration
1
() =
0
This can be approximated by
()
=0
By increasing the number of steps (ie. smaller x), the approximation gets more precise. 1
We can design the following C and Python programs.
EXAMPLE
import time
def Pi(num_steps):
start = time.time() step = 1.0/num_steps sum = 0 for i in xrange(num_steps):
x= (i+0.5)*step sum = sum + 4.0/(1.0+x*x)
pi = step * sum end = time.time() print "Pi with %d steps is %f in %f secs" %(num_steps, pi, end-start)
#include #include void Pi(int num_steps) {
double start, end, pi, step, x, sum; int i; start = clock(); step = 1.0/(double)num_steps; sum = 0; for (i=0;i ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- a hands on introduction to mpi python programming
- cmsc 451 lecture 7 greedy algorithms for scheduling
- time series tutorial rxjs ggplot2 python data
- algorithms flowcharts and pseudocodes
- python overiew department of computer science
- speed up your data processing parallel and asynchronous
- beginner programming lesson
Related searches
- introduction to java programming pdf
- introduction to java programming and data structures
- introduction to java programming 10th
- introduction to java programming liang
- introduction to java programming ppt
- introduction to python pdf
- python programming on win32 download
- introduction to java programming liang pdf
- introduction to r programming pdf
- hands on programming with r pdf
- introduction to python programming pdf
- introduction to java programming 10th edition pdf