-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved empi into emergent -- no point in keeping separate, avoid circu…
…lar dependency issues.
- Loading branch information
Showing
27 changed files
with
2,791 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# eMPI: Message Passing Interface | ||
|
||
eMPI contains Go wrappers around the MPI message passing interface for distributed memory computation, in the `empi/mpi` package. This has no other dependencies and uses code generation to provide support for all Go types. | ||
|
||
You must set the `mpi` build tag to actually have it build using the mpi library -- the default is to build a dummy version that has 1 proc of rank 0 always, and nop versions of all the methods. | ||
|
||
```bash | ||
$ go build -tags mpi | ||
``` | ||
|
||
The `empi/empi` package has methods to support use of MPI in emergent simulations: | ||
|
||
* Gathering `etable.Table` and `etensor.Tensor` data across processors. | ||
|
||
* `AllocN` allocates n items to process across mpi processors. | ||
|
||
## Development | ||
|
||
After updating any of the template files, you need to update the generated go files like so: | ||
```bash | ||
cd mpi | ||
go install github.com/apache/arrow/go/arrow/_tools/tmpl | ||
make generate | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2020, The Emergent Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package empi | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/emer/emergent/v2/empi/mpi" | ||
) | ||
|
||
// Alloc allocates n items to current mpi proc based on WorldSize and WorldRank. | ||
// Returns start and end (exclusive) range for current proc. | ||
func AllocN(n int) (st, end int, err error) { | ||
nproc := mpi.WorldSize() | ||
if n%nproc != 0 { | ||
err = fmt.Errorf("empi.AllocN: number: %d is not an even multiple of number of MPI procs: %d -- must be!", n, nproc) | ||
log.Println(err) | ||
} | ||
pt := n / nproc | ||
st = pt * mpi.WorldRank() | ||
end = st + pt | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2020, The Emergent Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
/* | ||
Package empi wraps the Message Passing Interface for distributed memory | ||
data sharing across a collection of processors (procs). | ||
It also contains some useful abstractions and error logging support in Go. | ||
The wrapping code was initially copied from https://github.com/cpmech/gosl/mpi | ||
and significantly modified. | ||
All standard Go types are supported using the apache arrow tmpl generation tool. | ||
Int is assumed to be 64bit and is defined as a []int because that is typically | ||
more convenient. | ||
*/ | ||
package empi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2020, The Emergent Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
/* | ||
Package mpi wraps the Message Passing Interface for distributed memory | ||
data sharing across a collection of processors (procs). | ||
The wrapping code was initially copied from https://github.com/cpmech/gosl/mpi | ||
and significantly modified. | ||
All standard Go types are supported using the apache arrow tmpl generation tool. | ||
Int is assumed to be 64bit and is defined as a []int because that is typically | ||
more convenient. | ||
*/ | ||
package mpi |
Oops, something went wrong.