Last change
on this file since 1933 was 1933, checked in by Eric.Larour, 16 years ago |
Parallel nightly run: run.sh
Cannot run in cron mode, but can be used anywhere to quickly run nightlys.
|
File size:
692 bytes
|
Line | |
---|
1 | function [i1,i2]=parallelrange(rank,numprocs,globalsize)
|
---|
2 | %PARALLELRANGE from a rank, and a number of processors, figure out a range, for parallel tasks.
|
---|
3 | %
|
---|
4 | % usage: [i1,i1]=parallelrange(rank,numprocs,globalsize)
|
---|
5 | %
|
---|
6 |
|
---|
7 |
|
---|
8 | num_local_rows=zeros(numprocs,1);
|
---|
9 |
|
---|
10 | for i=1:numprocs,
|
---|
11 |
|
---|
12 | %we use floor. we under distribute rows. The rows left are then redistributed, therefore resulting in a more even distribution.
|
---|
13 | num_local_rows(i)=floor(globalsize/numprocs);
|
---|
14 |
|
---|
15 | end
|
---|
16 |
|
---|
17 |
|
---|
18 | %There may be some rows left. Distribute evenly.
|
---|
19 | row_rest=globalsize - numprocs*floor(globalsize/numprocs);
|
---|
20 |
|
---|
21 | for i=1:row_rest,
|
---|
22 | num_local_rows(i)=num_local_rows(i)+1;
|
---|
23 | end
|
---|
24 |
|
---|
25 | i1=sum(num_local_rows(1:rank-1))+1;
|
---|
26 | i2=i1+num_local_rows(rank)-1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.