Skip to content

Commit 1fd7c09

Browse files
authored
update to CUDA v1.0+ (#401)
1 parent 393543b commit 1fd7c09

28 files changed

+62
-69
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ Requires = "~0.5, 1.0"
2222
julia = "1"
2323

2424
[extras]
25-
CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
25+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
2626
DoubleFloats = "497a8b3b-efae-58df-a0af-a86822472b78"
2727
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2828
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2929

3030
[targets]
31-
test = ["CuArrays", "DoubleFloats", "Pkg", "Test"]
31+
test = ["CUDA", "DoubleFloats", "Pkg", "Test"]

docs/src/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The test suite can also be modified by the following variables:
7777

7878
- `JULIA_MPIEXEC_TEST_ARGS`: Additional arguments to be passed to the MPI launcher for the tests only.
7979
- `JULIA_MPI_TEST_ARRAYTYPE`: Set to `CuArray` to test the CUDA-aware interface with
80-
[`CuArray`s](https://github.com/JuliaGPU/CuArrays.jl) buffers.
80+
[`CUDA.CuArray](https://github.com/JuliaGPU/CUDA.jl) buffers.
8181

8282
## Julia wrapper for `mpiexec`
8383

docs/src/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ The [`mpiexec`](@ref) function is provided for launching MPI programs from Julia
3030

3131
## CUDA-aware MPI support
3232

33-
If your MPI implementation has been compiled with CUDA support, then `CuArray`s (from the
34-
[CuArrays.jl](https://github.com/JuliaGPU/CuArrays.jl) package) can be passed directly as
33+
If your MPI implementation has been compiled with CUDA support, then `CUDA.CuArray`s (from the
34+
[CUDA.jl](https://github.com/JuliaGPU/CUDA.jl) package) can be passed directly as
3535
send and receive buffers for point-to-point and collective operations (they may also work
3636
with one-sided operations, but these are not often supported).
3737

src/MPI.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function __init__()
8080
ENV["UCX_ERROR_SIGNALS"] = "SIGILL,SIGBUS,SIGFPE"
8181
end
8282

83-
@require CuArrays="3a865a2d-5b23-5a0f-bc46-62713ec82fae" include("cuda.jl")
83+
@require CUDA="052768ef-5323-5732-b1bb-66c8b64840ba" include("cuda.jl")
8484
end
8585

8686
end

src/buffers.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Currently supported are:
5151
- `Ref`
5252
- `Array`
5353
- `SubArray`
54-
- `CuArray` if CuArrays.jl is loaded.
54+
- `CUDA.CuArray` if CUDA.jl is loaded.
5555
5656
Additionally, certain sentinel values can be used, e.g. `MPI_IN_PLACE` or `MPI_BOTTOM`.
5757
"""
@@ -79,8 +79,8 @@ and `datatype`. Methods are provided for
7979
8080
- `Ref`
8181
- `Array`
82-
- `CuArray` if CuArrays.jl is loaded
83-
- `SubArray`s of an `Array` or `CuArray` where the layout is contiguous, sequential or
82+
- `CUDA.CuArray` if CUDA.jl is loaded
83+
- `SubArray`s of an `Array` or `CUDA.CuArray` where the layout is contiguous, sequential or
8484
blocked.
8585
8686
"""

src/cuda.jl

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1-
import .CuArrays: CuArray
2-
import .CuArrays.CUDAdrv: CuPtr, synchronize
3-
import .CuArrays.CUDAdrv.Mem: DeviceBuffer
1+
import .CUDA
42

5-
6-
function Base.cconvert(::Type{MPIPtr}, buf::CuArray{T}) where T
7-
Base.cconvert(CuPtr{T}, buf) # returns DeviceBuffer
3+
function Base.cconvert(::Type{MPIPtr}, buf::CUDA.CuArray{T}) where T
4+
Base.cconvert(CUDA.CuPtr{T}, buf) # returns DeviceBuffer
85
end
96

10-
# CuArrays <= v1.3
11-
function Base.unsafe_convert(::Type{MPIPtr}, buf::DeviceBuffer)
12-
reinterpret(MPIPtr, buf.ptr)
13-
end
14-
# CuArrays > v1.3
15-
function Base.unsafe_convert(::Type{MPIPtr}, X::CuArray{T}) where T
16-
reinterpret(MPIPtr, Base.unsafe_convert(CuPtr{T}, X))
7+
function Base.unsafe_convert(::Type{MPIPtr}, X::CUDA.CuArray{T}) where T
8+
reinterpret(MPIPtr, Base.unsafe_convert(CUDA.CuPtr{T}, X))
179
end
10+
1811
# only need to define this for strided arrays: all others can be handled by generic machinery
19-
function Base.unsafe_convert(::Type{MPIPtr}, V::SubArray{T,N,P,I,true}) where {T,N,P<:CuArray,I}
12+
function Base.unsafe_convert(::Type{MPIPtr}, V::SubArray{T,N,P,I,true}) where {T,N,P<:CUDA.CuArray,I}
2013
X = parent(V)
21-
pX = Base.unsafe_convert(CuPtr{T}, X)
14+
pX = Base.unsafe_convert(CUDA.CuPtr{T}, X)
2215
pV = pX + ((V.offset1 + V.stride1) - first(LinearIndices(X)))*sizeof(T)
2316
return reinterpret(MPIPtr, pV)
2417
end
2518

26-
function Buffer(arr::CuArray)
19+
function Buffer(arr::CUDA.CuArray)
2720
Buffer(arr, Cint(length(arr)), Datatype(eltype(arr)))
2821
end

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ using Test, MPI
33
# load test packages to trigger precompilation
44
using DoubleFloats
55
if get(ENV,"JULIA_MPI_TEST_ARRAYTYPE","") == "CuArray"
6-
using CuArrays
7-
ArrayType = CuArray
6+
import CUDA
7+
ArrayType = CUDA.CuArray
88
else
99
ArrayType = Array
1010
end

test/test_allgather.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ using Test
22
using MPI
33

44
if get(ENV,"JULIA_MPI_TEST_ARRAYTYPE","") == "CuArray"
5-
using CuArrays
6-
ArrayType = CuArray
5+
import CUDA
6+
ArrayType = CUDA.CuArray
77
else
88
ArrayType = Array
99
end

test/test_allgatherv.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ using Test
22
using MPI
33

44
if get(ENV,"JULIA_MPI_TEST_ARRAYTYPE","") == "CuArray"
5-
using CuArrays
6-
ArrayType = CuArray
5+
import CUDA
6+
ArrayType = CUDA.CuArray
77
else
88
ArrayType = Array
99
end

test/test_allreduce.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ using Test
22
using MPI
33

44
if get(ENV,"JULIA_MPI_TEST_ARRAYTYPE","") == "CuArray"
5-
using CuArrays
6-
ArrayType = CuArray
5+
import CUDA
6+
ArrayType = CUDA.CuArray
77
else
88
ArrayType = Array
99
end

0 commit comments

Comments
 (0)