Skip to content

Commit eac4dad

Browse files
authored
Merge pull request #12 from sbromberger/v0.3-dev
V0.3 dev
2 parents f2ec2ba + 622b381 commit eac4dad

17 files changed

Lines changed: 1146 additions & 1959 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04
2-
FROM mcr.microsoft.com/devcontainers/go:1-1.24-bookworm
2+
# FROM mcr.microsoft.com/devcontainers/go
3+
FROM golang:tip-trixie
34

45
# ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none"
56

@@ -11,7 +12,7 @@ FROM mcr.microsoft.com/devcontainers/go:1-1.24-bookworm
1112
# [Optional] Uncomment this section to install additional packages.
1213
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1314
# && apt-get -y install --no-install-recommends <your-package-list-here>
14-
RUN apt update && apt -y upgrade && export DEBIAN_FRONTEND=noninteractive && apt -y install openmpi-bin openmpi-doc libopenmpi-dev
15+
RUN apt update && apt -y upgrade && export DEBIAN_FRONTEND=noninteractive && apt -y install openmpi-bin openmpi-doc libopenmpi-dev jq
1516

1617
WORKDIR /tmp
1718
RUN wget https://mvapich.cse.ohio-state.edu/download/mvapich/osu-micro-benchmarks-7.5.1.tar.gz
@@ -20,6 +21,12 @@ WORKDIR /tmp/osu-micro-benchmarks-7.5.1
2021
RUN ./configure CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx
2122
RUN make && make install
2223
RUN go install golang.org/x/tools/cmd/stringer@latest
24+
RUN go install github.com/go-delve/delve/cmd/dlv@latest
25+
26+
RUN useradd -m -s /bin/bash vscode
27+
ENV GOPATH=/home/vscode/go
28+
ENV PATH=$PATH:/home/vscode/go/bin
29+
USER vscode
2330

2431

2532
# RUN update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-19 100

.devcontainer/devcontainer.json

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,14 @@
44
"name": "Go",
55
"build": {
66
"dockerfile": "Dockerfile"
7+
},
8+
"remoteUser": "vscode",
9+
"customizations": {
10+
"vscode": {
11+
"extensions": [
12+
"golang.go",
13+
"anthropic.claude-code"
14+
]
15+
}
716
}
8-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
9-
// "image": "mcr.microsoft.com/devcontainers/go:1-1.24-bookworm"
10-
11-
// Features to add to the dev container. More info: https://containers.dev/features.
12-
// "features": {},
13-
14-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
// "forwardPorts": [],
16-
17-
// Use 'postCreateCommand' to run commands after the container is created.
18-
// "postCreateCommand": "go version",
19-
20-
// Configure tool-specific properties.
21-
// "customizations": {},
22-
23-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
24-
// "remoteUser": "root"
2517
}

.github/workflows/ci.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
on: [push, pull_request]
22
name: Test
3+
34
jobs:
45
test:
5-
strategy:
6-
matrix:
7-
go-version: [1.24.x]
8-
os: [ubuntu-latest]
9-
runs-on: ${{ matrix.os }}
6+
runs-on: ubuntu-latest
107
steps:
11-
- name: Install Go
12-
uses: actions/setup-go@v2
8+
- name: Checkout code
9+
uses: actions/checkout@v4
10+
11+
- name: Install Stable Go for Bootstrap
12+
uses: actions/setup-go@v6
1313
with:
14-
go-version: ${{ matrix.go-version }}
14+
go-version: 'stable'
15+
16+
- name: Download Go Tip
17+
run: |
18+
go install golang.org/dl/gotip@latest
19+
gotip download
20+
echo "$HOME/sdk/gotip/bin" >> $GITHUB_PATH
21+
1522
- name: Install OpenMPI
16-
if: matrix.os == 'ubuntu-latest'
17-
run: sudo apt update && sudo apt install -y --no-install-recommends libopenmpi-dev openmpi-common openmpi-bin
18-
- name: Checkout code
19-
uses: actions/checkout@v2
20-
- name: Install Stringer
21-
run: go install golang.org/x/tools/cmd/stringer@latest
22-
- name: Build and Install
23-
run: make install
23+
run: sudo apt update && sudo apt install -y --no-install-recommends openmpi-bin libopenmpi-dev
24+
25+
- name: Build
26+
run: go build ./...
27+
2428
- name: Test
25-
run: make test
29+
run: mpirun -n 4 --oversubscribe go test .

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
xautogencgoflags.go
22
oldtests/
3-
cmd/latency
3+
cmd/latency/latency

LICENSE.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021, Seth Bromberger All rights reserved.
1+
Copyright (c) 2026, Seth Bromberger All rights reserved.
22

33
Please note the following limitation with respect to redistribution:
44

@@ -13,3 +13,8 @@ Redistribution and use in source and binary forms without modification, and use
1313
1. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
1414

1515
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16+
17+
18+
## Note on the No-Modification Redistribution Clause
19+
The prohibition on redistribution of modified source code is intentional and specific. It is not intended to prevent private modification or internal use: you are free to modify this software for your own purposes. Rather, it is intended to prevent automated or pipeline-driven modification of this source code prior to or during redistribution, such as the insertion of telemetry, tracking, or analytics code by a package registry, build system, or other distribution intermediary, as well as the distribution of modified copies containing malicious code. Any copy of this software that is redistributed must be identical to what was published by the copyright holder.
20+

MIGRATION.md

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# Migration Guide
2+
3+
## Migrating from v0.2 to v0.3
4+
5+
### Initialization and teardown
6+
7+
The package-level `Start`, `Stop`, `WorldRank`, `WorldSize`, and `WorldTime`
8+
functions have been replaced by a session object.
9+
10+
```go
11+
// v0.2
12+
mpi.Start(false)
13+
defer mpi.Stop()
14+
rank := mpi.WorldRank()
15+
size := mpi.WorldSize()
16+
```
17+
18+
```go
19+
// v0.3
20+
m, err := mpi.Start()
21+
if err != nil {
22+
log.Fatal(err)
23+
}
24+
defer m.Stop()
25+
rank := m.WorldRank()
26+
size := m.WorldSize()
27+
```
28+
29+
For threaded initialization:
30+
31+
```go
32+
// v0.2
33+
mpi.Start(true)
34+
35+
// v0.3
36+
m, err := mpi.StartThreaded()
37+
```
38+
39+
### Initialization check
40+
41+
```go
42+
// v0.2
43+
mpi.IsOn()
44+
45+
// v0.3
46+
mpi.IsInitialized()
47+
```
48+
49+
### Communicators
50+
51+
`NewCommunicator` is now a method on `*MPI` rather than a package-level function.
52+
53+
```go
54+
// v0.2
55+
comm := mpi.NewCommunicator(nil)
56+
57+
// v0.3
58+
comm := m.NewCommunicator(nil)
59+
```
60+
61+
### Send and receive
62+
63+
All type-specific send/receive methods (`SendBytes`, `SendInt32s`, `SendFloat64s`,
64+
etc.) have been replaced by generic methods.
65+
66+
```go
67+
// v0.2
68+
comm.SendFloat64s(vals, toID, tag)
69+
vals, status := comm.RecvFloat64s(fromID, tag)
70+
comm.RecvPreallocFloat64s(vals, fromID, tag)
71+
```
72+
73+
```go
74+
// v0.3
75+
comm.Send(vals, toID, tag)
76+
vals, status := comm.Recv[float64](fromID, tag)
77+
comm.RecvPrealloc(vals, fromID, tag)
78+
```
79+
80+
The same pattern applies to all types: `byte`, `int8`, `int16`, `uint16`,
81+
`int32`, `uint32`, `int64`, `uint64`, `float32`, `float64`, `complex64`,
82+
`complex128`.
83+
84+
### Single-value send/receive
85+
86+
```go
87+
// v0.2
88+
comm.SendFloat64(v, toID, tag)
89+
v, status := comm.RecvFloat64(fromID, tag)
90+
```
91+
92+
```go
93+
// v0.3
94+
comm.SendOne(v, toID, tag)
95+
v, status := comm.RecvOne[float64](fromID, tag)
96+
```
97+
98+
### Broadcast
99+
100+
```go
101+
// v0.2
102+
comm.BcastFloat64s(vals, root)
103+
104+
// v0.3
105+
comm.Bcast(vals, root)
106+
```
107+
108+
### Reduce and Allreduce
109+
110+
```go
111+
// v0.2
112+
comm.ReduceFloat64s(dest, orig, mpi.OpSum, root)
113+
comm.AllreduceFloat64s(dest, orig, mpi.OpSum, root)
114+
115+
// v0.3
116+
comm.Reduce(dest, orig, mpi.OpSum, root)
117+
comm.Allreduce(dest, orig, mpi.OpSum)
118+
```
119+
120+
Note that `Allreduce` no longer takes a `root` parameter. The v0.2 parameter
121+
was accepted but never used; v0.3 removes it.
122+
123+
### Status
124+
125+
`Status` is now a value type. Methods that previously returned `*Status` now
126+
return `Status`.
127+
128+
`Count` (formerly `GetCount`) is now generic and no longer takes a `DataType` argument, and has
129+
been renamed along with other `Status` methods.
130+
131+
| v0.2 | v0.3 |
132+
|------|------|
133+
| `Status.GetSource()` | `Status.Source()` |
134+
| `Status.GetTag()` | `Status.Tag()` |
135+
| `Status.GetError()` | `Status.Error()` |
136+
| `Status.GetCount(mpi.Byte)` | `Status.Count[byte]()` |
137+
138+
### Mprobe and Mrecv
139+
140+
The v0.2 API exposed `C.MPI_Message` directly. In v0.3 this is encapsulated
141+
in `MatchedMessage`.
142+
143+
```go
144+
// v0.2
145+
status, msg := comm.Mprobe(fromID, tag)
146+
n := status.GetCount(mpi.Byte)
147+
buf := make([]byte, n)
148+
comm.MrecvPreallocBytes(buf, fromID, tag, msg)
149+
```
150+
151+
```go
152+
// v0.3
153+
m := comm.Mprobe(fromID, tag)
154+
buf, status := m.Recv[byte]()
155+
// or, with a preallocated buffer:
156+
status = m.RecvPrealloc(buf)
157+
```
158+
159+
`Mrecv` is also available as a single call:
160+
161+
```go
162+
buf, status := comm.Mrecv[byte](fromID, tag)
163+
```
164+
165+
`MatchedMessage` methods follow the same naming convention as `Status`:
166+
167+
| v0.2 | v0.3 |
168+
|------|------|
169+
| `MatchedMessage.GetSource()` | `MatchedMessage.Source()` |
170+
| `MatchedMessage.GetTag()` | `MatchedMessage.Tag()` |
171+
| `MatchedMessage.GetError()` | `MatchedMessage.Error()` |
172+
| `MatchedMessage.GetCount[T]()` | `MatchedMessage.Count[T]()` |
173+
174+
### Communicator methods
175+
176+
| v0.2 | v0.3 |
177+
|------|------|
178+
| `Communicator.GetAttr()` | `Communicator.Attr()` |
179+
| `Communicator.GetMaxTag()` | `Communicator.MaxTag()` |
180+
181+
### Communicator.MaxTag field removed
182+
183+
The exported `MaxTag` field on `Communicator` has been unexported. Use
184+
`Communicator.MaxTag()` if you need this value.
185+
186+
### DataType removed
187+
188+
The exported `DataType` constants (`mpi.Byte`, `mpi.Int`, `mpi.Float`,
189+
`mpi.Double`, etc.) have been removed. Type information is now conveyed through
190+
Go generics and is not part of the public API.
191+
192+
### Iprobe
193+
194+
`Iprobe` now returns a value `Status` rather than a pointer.
195+
196+
### String convenience methods
197+
198+
`SendString` and `RecvString` have been removed. Use `Send` and `Recv` with a
199+
`[]byte` conversion:
200+
201+
```go
202+
// v0.2
203+
comm.SendString(s, toID, tag)
204+
s, status := comm.RecvString(fromID, tag)
205+
206+
// v0.3
207+
comm.Send([]byte(s), toID, tag)
208+
b, status := comm.Recv[byte](fromID, tag)
209+
s := string(b)
210+
```

0 commit comments

Comments
 (0)