root / synthbench / euroben-dm / mod2as / .svn / text-base / part.f.svn-base @ 0:839f52ef7657
History | View | Annotate | Download (858 Bytes)
1 |
Integer Function part( n ) |
---|---|
2 |
! --------------------------------------------------------------------- |
3 |
! --- Routine 'part' partitions 'n' elements as evenly as possible |
4 |
! over 'nodes' processors. |
5 |
! --------------------------------------------------------------------- |
6 |
! --- Input: - Integer n |
7 |
! - Integer nodes (via Module dist_module). |
8 |
! --------------------------------------------------------------------- |
9 |
Use dist_module |
10 |
Implicit None |
11 |
Integer :: n |
12 |
|
13 |
Integer :: i, non, nrest, rest |
14 |
! --------------------------------------------------------------------- |
15 |
non = n/nodes |
16 |
rest = Mod( n, nodes ) |
17 |
nrest = nodes - rest - 1 |
18 |
part = non |
19 |
If ( me > nrest ) part = part + 1 |
20 |
! --------------------------------------------------------------------- |
21 |
End Function part |