Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/jpsamaroo/DaggerGPU.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsamaroo committed Apr 6, 2020
2 parents 11873cd + fede992 commit b1ca6d9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: TagBot
on:
schedule:
- cron: 0 * * * *
jobs:
TagBot:
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Dagger]]
deps = ["Distributed", "LinearAlgebra", "MemPool", "Profile", "Random", "Serialization", "SharedArrays", "SparseArrays", "Statistics", "StatsBase"]
git-tree-sha1 = "e77f451e4c1f9acbf794cb6377ec42130ff10f56"
git-tree-sha1 = "8262f275c3acf3787fc70d1bd99aec011a02ddb8"
repo-rev = "jps/compute-resource"
repo-url = "https://github.com/JuliaParallel/Dagger.jl.git"
uuid = "d58978e5-989f-55fb-8d15-ea34adc7bf54"
Expand Down
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Dagger = "d58978e5-989f-55fb-8d15-ea34adc7bf54"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]
julia = "1.0"
Dagger = "0.8"
Requires = "1.0"
julia = "1"

[extras]
CuArrays = "3a865a2d-5b23-5a0f-bc46-62713ec82fae"
Expand Down
2 changes: 2 additions & 0 deletions src/DaggerGPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ end

processor(kind::Symbol) = processor(Val(kind))
processor(::Val) = Dagger.ThreadProc
cancompute(kind::Symbol) = cancompute(Val(kind))
cancompute(::Val) = false

function __init__()
@require CuArrays="3a865a2d-5b23-5a0f-bc46-62713ec82fae" begin
Expand Down
5 changes: 3 additions & 2 deletions src/cuarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ end

@gpuproc(CuArrayProc, CuArray)

processor(::Val{:CUDA}) = CuArrayProc
cancompute(::Val{:CUDA}) = CUDAapi.has_cuda()

push!(Dagger.PROCESSOR_CALLBACKS, proc -> begin
if CUDAapi.has_cuda()
@eval processor(::Val{:CUDA}) = CuArrayProc
return CuArrayProc(first(devices()))
return CuArrayProc(first(CUDAdrv.devices()))
end
end)
3 changes: 2 additions & 1 deletion src/rocarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ end

@gpuproc(ROCArrayProc, ROCArray)

processor(::Val{:ROC}) = ROCArrayProc
cancompute(::Val{:ROC}) = ROCArrays.configured

push!(Dagger.PROCESSOR_CALLBACKS, proc -> begin
if ROCArrays.configured
@eval processor(::Val{:ROC}) = ROCArrayProc
return ROCArrayProc(HSARuntime.get_default_agent())
end
end)
10 changes: 8 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ end
cuproc = DaggerGPU.processor(:CUDA)
rocproc = DaggerGPU.processor(:ROC)

cuproc === Dagger.ThreadProc && @warn "No CUDA devices available"
rocproc === Dagger.ThreadProc && @warn "No ROCm devices available"
if !DaggerGPU.cancompute(:CUDA)
@warn "No CUDA devices available, falling back to ThreadProc"
cuproc = Dagger.ThreadProc
end
if !DaggerGPU.cancompute(:ROC)
@warn "No ROCm devices available, falling back to ThreadProc"
rocproc = Dagger.ThreadProc
end

as = [delayed(x->x+1)(1) for i in 1:10]
b = delayed((xs...)->[sum(xs)])(as...)
Expand Down

2 comments on commit b1ca6d9

@jpsamaroo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/12404

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" b1ca6d9e3316636953af436dcea711b6e36a7312
git push origin v0.1.0

Please sign in to comment.