-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cuda, rocm and oneapi functionality to their own extensions (#24)
- Loading branch information
1 parent
0d604b1
commit 58ec351
Showing
14 changed files
with
138 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module AMDGPUExt | ||
|
||
using GraphComputing, AMDGPU | ||
|
||
# include specialized AMDGPU functions here | ||
include("devices/rocm/impl.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module CUDAExt | ||
|
||
using GraphComputing | ||
using CUDA | ||
using RuntimeGeneratedFunctions | ||
|
||
# include specialized CUDA functions here | ||
include("devices/cuda/impl.jl") | ||
include("devices/cuda/function.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
function GraphComputing.cuda_kernel( | ||
graph::DAG, instance, machine::Machine, context_module::Module | ||
) | ||
tape = GraphComputing.gen_tape(graph, instance, machine, context_module) | ||
|
||
init_caches = Expr(:block, tape.initCachesCode...) | ||
assign_inputs = Expr(:block, GraphComputing.expr_from_fc.(tape.inputAssignCode)...) | ||
code = Expr(:block, GraphComputing.expr_from_fc.(tape.computeCode)...) | ||
|
||
function_id = GraphComputing.to_var_name(UUIDs.uuid1(rng[1])) | ||
res_sym = eval( | ||
GraphComputing.gen_access_expr( | ||
GraphComputing.entry_device(tape.machine), tape.outputSymbol | ||
), | ||
) | ||
expr = Meta.parse( | ||
"function compute_$(function_id)(input_vector, output_vector, n::Int64) | ||
id = (blockIdx().x - 1) * blockDim().x + threadIdx().x | ||
if (id > n) | ||
return | ||
end | ||
@inline data_input = input_vector[id] | ||
$(init_caches) | ||
$(assign_inputs) | ||
$code | ||
@inline output_vector[id] = $res_sym | ||
return nothing | ||
end" | ||
) | ||
|
||
return RuntimeGeneratedFunction(@__MODULE__, context_module, expr) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module oneAPIExt | ||
|
||
using GraphComputing, oneAPI | ||
|
||
# include specialized oneAPI functions here | ||
include("devices/oneapi/impl.jl") | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using SafeTestsets | ||
using CUDA | ||
|
||
@safetestset "Utility Unit Tests " begin | ||
include("unit_tests_utility.jl") | ||
end | ||
# TODO: Make a new simple test model and rewrite tests here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using GraphComputing | ||
import GraphComputing.bytes_to_human_readable | ||
|
||
@test bytes_to_human_readable(0) == "0.0 B" | ||
@test bytes_to_human_readable(1020) == "1020.0 B" | ||
@test bytes_to_human_readable(1025) == "1.001 KiB" | ||
@test bytes_to_human_readable(684235) == "668.2 KiB" | ||
@test bytes_to_human_readable(86214576) == "82.22 MiB" | ||
@test bytes_to_human_readable(9241457698) == "8.607 GiB" | ||
@test bytes_to_human_readable(3218598654367) == "2.927 TiB" |