Skip to content

Commit

Permalink
Merge #1505
Browse files Browse the repository at this point in the history
1505: use blocking synchronize to reduce poll waiting r=simonbyrne a=simonbyrne

Uses a blocking synchronize to synchronize GPU stream with CUDA. This appears to reduce time spent in `poll_wait` between threads (see https://buildkite.com/clima/climaatmos-target-gpu-simulations/builds/114)

- [ ] Code follows the [style guidelines](https://clima.github.io/ClimateMachine.jl/latest/DevDocs/CodeStyle/) OR N/A.
- [ ] Unit tests are included OR N/A.
- [ ] Code is exercised in an integration test OR N/A.
- [ ] Documentation has been added/updated OR N/A.


Co-authored-by: Simon Byrne <[email protected]>
  • Loading branch information
bors[bot] and simonbyrne authored Oct 20, 2023
2 parents 9c22047 + 5c7da33 commit 99db99c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Spaces/dss_cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,12 @@ function fill_send_buffer!(::ClimaComms.CUDADevice, dss_buffer::DSSBuffer)
if nsend > 0
nitems = nsend * nlevels * nfid
nthreads, nblocks = _configure_threadblock(nitems)
CUDA.synchronize() # CUDA MPI uses a separate stream. This will synchronize across streams
@cuda threads = (nthreads) blocks = (nblocks) fill_send_buffer_kernel!(
send_data,
send_buf_idx,
pperimeter_data,
)
CUDA.synchronize() # CUDA MPI uses a separate stream. This will synchronize across streams
CUDA.synchronize(; blocking = true) # CUDA MPI uses a separate stream. This will synchronize across streams
end
return nothing
end
Expand Down Expand Up @@ -468,13 +467,11 @@ function load_from_recv_buffer!(::ClimaComms.CUDADevice, dss_buffer::DSSBuffer)
if nrecv > 0
nitems = nrecv * nlevels * nfid
nthreads, nblocks = _configure_threadblock(nitems)
CUDA.synchronize()
@cuda threads = (nthreads) blocks = (nblocks) load_from_recv_buffer_kernel!(
pperimeter_data,
recv_data,
recv_buf_idx,
)
CUDA.synchronize()
end
return nothing
end
Expand Down

0 comments on commit 99db99c

Please sign in to comment.