Skip to content

Commit d329830

Browse files
authored
Merge pull request #159 from ali-ramadhan/ali/has-rocm-gpu
Add `has_rocm_gpu` util function
2 parents 5cff0b4 + 897abea commit d329830

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AMDGPU"
22
uuid = "21141c5a-9bdb-4563-92ae-f87d6854732e"
33
authors = ["Julian P Samaroo <jpsamaroo@jpsamaroo.me>"]
4-
version = "0.2.12"
4+
version = "0.2.13"
55

66
[deps]
77
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/AMDGPU.jl

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Core: LLVMPtr
1919
export HSAAgent, HSAQueue, HSAExecutable, HSAKernelInstance, HSASignal
2020
export get_agents, profile, get_first_isa_string, launch!
2121
export get_default_agent, get_default_queue
22+
export has_rocm_gpu
2223

2324
export ROCArray, ROCVector, ROCMatrix, ROCVecOrMat
2425
export roc

src/utils.jl

+8
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ function versioninfo(io::IO=stdout)
2727
end
2828
end
2929
end
30+
31+
function has_rocm_gpu()
32+
if !AMDGPU.hsa_configured
33+
return false
34+
else
35+
return length(AMDGPU.get_agents(:gpu)) > 0
36+
end
37+
end

test/hsa/utils.jl

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@testset "Utils" begin
2+
@testset "versioninfo" begin
3+
AMDGPU.versioninfo()
4+
@test true # Just test that versioninfo() prints something.
5+
end
6+
7+
@testset "has_rocm_gpu" begin
8+
@test AMDGPU.has_rocm_gpu()
9+
end
10+
end

test/runtests.jl

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ if AMDGPU.configured
3737
include("hsa/error.jl")
3838
include("hsa/agent.jl")
3939
include("hsa/memory.jl")
40+
include("hsa/utils.jl")
4041
end
4142
@testset "Codegen" begin
4243
include("codegen/synchronization.jl")

0 commit comments

Comments
 (0)