From 63aa751d2b0a6dd69cb6d8114a1f74dae41dc595 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Mon, 18 Sep 2023 15:11:43 -0400 Subject: [PATCH 1/3] Add query function for if we are executing on a GPU --- Project.toml | 2 +- src/KernelAbstractions.jl | 8 ++++++++ src/cpu.jl | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 42949387..4f061e10 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "KernelAbstractions" uuid = "63c18a36-062a-441e-b654-da1e3ab1ce7c" authors = ["Valentin Churavy and contributors"] -version = "0.9.8" +version = "0.10.0" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index 335d2cd9..4102dc5c 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -535,6 +535,14 @@ function priority!(::Backend, prio::Symbol) return nothing end + +""" + ongpu() + +Returns if this kernel is currently executing on a GPU. +""" +function ongpu end + include("nditeration.jl") using .NDIteration import .NDIteration: get diff --git a/src/cpu.jl b/src/cpu.jl index 8c3e8afd..99caa823 100644 --- a/src/cpu.jl +++ b/src/cpu.jl @@ -158,6 +158,8 @@ end end end +ongpu() = false + ### # CPU implementation of shared memory ### From afb065c55b53d1a62c447ccf7fbd0fd55cdf9160 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Mon, 18 Sep 2023 15:22:11 -0400 Subject: [PATCH 2/3] Update src/KernelAbstractions.jl Co-authored-by: Simon Byrne --- src/KernelAbstractions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index 4102dc5c..b7bdff86 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -541,7 +541,7 @@ end Returns if this kernel is currently executing on a GPU. """ -function ongpu end +function isongpu end include("nditeration.jl") using .NDIteration From 852508b01ca256183db35845498bbcb7a3c7b800 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Tue, 19 Sep 2023 10:22:23 -0400 Subject: [PATCH 3/3] fixup: rename --- src/KernelAbstractions.jl | 15 +++++++-------- src/cpu.jl | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index a2a51f4f..026fb2bc 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -372,6 +372,13 @@ macro index(locale, args...) Expr(:call, GlobalRef(KernelAbstractions, index_function), esc(:__ctx__), map(esc, args)...) end +""" + isongpu() + +Returns if this kernel is currently executing on a GPU. +""" +function isongpu end + ### # Internal kernel functions ### @@ -535,14 +542,6 @@ function priority!(::Backend, prio::Symbol) return nothing end - -""" - ongpu() - -Returns if this kernel is currently executing on a GPU. -""" -function isongpu end - include("nditeration.jl") using .NDIteration import .NDIteration: get diff --git a/src/cpu.jl b/src/cpu.jl index 99caa823..7ccc4cd5 100644 --- a/src/cpu.jl +++ b/src/cpu.jl @@ -158,7 +158,7 @@ end end end -ongpu() = false +isongpu() = false ### # CPU implementation of shared memory