main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
491 bytes
|
| Rev | Line | |
|---|
| [eb17c2b] | 1 | #include <mpi.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <civl-mpi.cvh>
|
|---|
| 4 |
|
|---|
| 5 | int size, rank;
|
|---|
| 6 | int root = 0;
|
|---|
| 7 |
|
|---|
| 8 | int main(int argc, char * argv[]) {
|
|---|
| [bff96cf] | 9 | int sum = 0;
|
|---|
| [eb17c2b] | 10 |
|
|---|
| 11 | MPI_Init(&argc, &argv);
|
|---|
| 12 | MPI_Comm_rank(MPI_COMM_WORLD, &rank);
|
|---|
| 13 | MPI_Comm_size(MPI_COMM_WORLD, &size);
|
|---|
| 14 | for(int i = 0; i < 4; i++) {
|
|---|
| 15 | MPI_Reduce(&i, &sum, 1, MPI_INT, MPI_SUM, root, MPI_COMM_WORLD);
|
|---|
| 16 | if(!rank)printf("sum=%d\n", sum);
|
|---|
| [bff96cf] | 17 | $mpi_coassert(MPI_COMM_WORLD, sum@(root + 1 - 1) == (i*size));
|
|---|
| [eb17c2b] | 18 | }
|
|---|
| 19 | MPI_Finalize();
|
|---|
| 20 | return 0;
|
|---|
| 21 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.