heterogeneity (#27)
Prepare things to work with heterogeneity, make things work on GPU Reviewed-on: Rubydragon/MetagraphOptimization.jl#27 Co-authored-by: Anton Reinhard <anton.reinhard@proton.me> Co-committed-by: Anton Reinhard <anton.reinhard@proton.me>
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -31,13 +31,13 @@
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Graph:\n",
|
||||
" Nodes: Total: 131069, DataTask: 65539, ComputeTaskQED_Sum: 1, \n",
|
||||
" ComputeTaskQED_V: 35280, ComputeTaskQED_S2: 5040, ComputeTaskQED_U: 9, \n",
|
||||
" ComputeTaskQED_S1: 25200\n",
|
||||
" Edges: 176419\n",
|
||||
" Total Compute Effort: 549370.0\n",
|
||||
" Total Data Transfer: 1.0645344e7\n",
|
||||
" Total Compute Intensity: 0.05160659909158408\n"
|
||||
" Nodes: Total: 15866, DataTask: 7937, ComputeTaskQED_S2: 720, \n",
|
||||
" ComputeTaskQED_Sum: 1, ComputeTaskQED_V: 4320, ComputeTaskQED_S1: 2880, \n",
|
||||
" ComputeTaskQED_U: 8\n",
|
||||
" Edges: 21617\n",
|
||||
" Total Compute Effort: 66249.0\n",
|
||||
" Total Data Transfer: 1.314048e6\n",
|
||||
" Total Compute Intensity: 0.050415966540035065\n"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -47,7 +47,7 @@
|
||||
"source": [
|
||||
"machine = get_machine_info()\n",
|
||||
"model = QEDModel()\n",
|
||||
"process = parse_process(\"ke->kkkkkke\", model)\n",
|
||||
"process = parse_process(\"ke->kkkkke\", model)\n",
|
||||
"\n",
|
||||
"inputs = [gen_process_input(process) for _ in 1:1e3];\n",
|
||||
"graph = gen_graph(process)"
|
||||
@ -62,13 +62,13 @@
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Graph:\n",
|
||||
" Nodes: Total: 14783, DataTask: 7396, ComputeTaskQED_Sum: 1, \n",
|
||||
" ComputeTaskQED_V: 1819, ComputeTaskQED_S2: 5040, ComputeTaskQED_U: 9, \n",
|
||||
" ComputeTaskQED_S1: 518\n",
|
||||
" Edges: 26672\n",
|
||||
" Total Compute Effort: 77102.0\n",
|
||||
" Total Data Transfer: 5.063616e6\n",
|
||||
" Total Compute Intensity: 0.015226668056977465\n"
|
||||
" Nodes: Total: 2234, DataTask: 1121, ComputeTaskQED_S2: 720, \n",
|
||||
" ComputeTaskQED_Sum: 1, ComputeTaskQED_V: 312, ComputeTaskQED_S1: 72, \n",
|
||||
" ComputeTaskQED_U: 8\n",
|
||||
" Edges: 3977\n",
|
||||
" Total Compute Effort: 11313.0\n",
|
||||
" Total Data Transfer: 659712.0\n",
|
||||
" Total Compute Intensity: 0.017148392025611175\n"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -78,6 +78,7 @@
|
||||
"source": [
|
||||
"optimizer = ReductionOptimizer()\n",
|
||||
"\n",
|
||||
"compute_compton = get_compute_function(graph, process, machine)\n",
|
||||
"optimize_to_fixpoint!(optimizer, graph)\n",
|
||||
"graph"
|
||||
]
|
||||
@ -91,7 +92,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Calculated 15537.0 results/s, 1295.0 results/s per thread for QED Process: 'ke->kkkkkke' (12 threads)\n"
|
||||
"Calculated 133942.0 results/s, 11162.0 results/s per thread for QED Process: 'ke->kkkkke' (12 threads)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -109,6 +110,31 @@
|
||||
"rate_per_thread = rate / Threads.nthreads()\n",
|
||||
"println(\"Calculated $(round(rate)) results/s, $(round(rate_per_thread)) results/s per thread for $(process) ($(Threads.nthreads()) threads)\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Calculated 17124.0 results/s, 1427.0 results/s per thread for QED Process: 'ke->kkkkke' (12 threads)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"bench_result = @benchmark begin\n",
|
||||
" Threads.@threads :static for i in eachindex(inputs)\n",
|
||||
" outputs[i] = compute_compton(inputs[i])\n",
|
||||
" end\n",
|
||||
"end\n",
|
||||
"\n",
|
||||
"rate = length(inputs) / (mean(bench_result.times) / 1.0e9)\n",
|
||||
"rate_per_thread = rate / Threads.nthreads()\n",
|
||||
"println(\"Calculated $(round(rate)) results/s, $(round(rate_per_thread)) results/s per thread for $(process) ($(Threads.nthreads()) threads)\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
Reference in New Issue
Block a user