diff options
author | David Hashe <david.j.hashe@gmail.com> | 2016-08-22 11:41:37 -0400 |
---|---|---|
committer | David Hashe <david.j.hashe@gmail.com> | 2016-08-22 11:41:37 -0400 |
commit | 9d324e135c96ad089b5404a274eff84695f02fd0 (patch) | |
tree | 5b6450066a90789855a5ac4e489d90646b5a896b | |
parent | f3ccaab1e982f4482177aefa95575f7d7dae21f7 (diff) | |
download | gem5-9d324e135c96ad089b5404a274eff84695f02fd0.tar.xz |
tests: Add example of using KVM acceleration with an app
Add #ifdef's to gpu-hello.cpp demonstrating how to annotate an application
for KVM acceleration.
-rwxr-xr-x | tests/test-progs/gpu-hello/src/gpu-hello.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test-progs/gpu-hello/src/gpu-hello.cpp b/tests/test-progs/gpu-hello/src/gpu-hello.cpp index b054558f5..bdff074a8 100755 --- a/tests/test-progs/gpu-hello/src/gpu-hello.cpp +++ b/tests/test-progs/gpu-hello/src/gpu-hello.cpp @@ -41,6 +41,12 @@ #include <fstream> #include <string> +#ifdef KVM_SWITCH +#include "m5op.h" + +void *m5_mem = (void*)0xffffc90000000000; +#endif + #define SUCCESS 0 #define FAILURE 1 @@ -247,6 +253,10 @@ runCLKernel(cl_kernel kernel) return FAILURE; } +#ifdef KVM_SWITCH + m5_switchcpu(); +#endif + // 2. Launch kernel status = clEnqueueNDRangeKernel(commandQueue, kernel, 1, NULL, globalThreads, localThreads, 0, NULL, |