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.
This commit is contained in:
parent
f3ccaab1e9
commit
9d324e135c
1 changed files with 10 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue