Fix OpenCLVectorAdd example

This commit is contained in:
Dantali0n 2022-01-20 11:09:33 +01:00
parent 7cdf640a82
commit bff83aab4a
2 changed files with 3 additions and 2 deletions

View File

@ -11,4 +11,4 @@ add_library(TracyClient STATIC ../../TracyClient.cpp
target_include_directories(TracyClient PUBLIC ../../) target_include_directories(TracyClient PUBLIC ../../)
target_compile_definitions(TracyClient PUBLIC TRACY_ENABLE=1) target_compile_definitions(TracyClient PUBLIC TRACY_ENABLE=1)
target_link_libraries(OpenCLVectorAdd PUBLIC OpenCL::OpenCL TracyClient) target_link_libraries(OpenCLVectorAdd PUBLIC OpenCL::OpenCL TracyClient dl pthread)

View File

@ -139,13 +139,14 @@ int main()
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
{ {
int n_value = static_cast<int>(N);
ZoneScopedN("VectorAdd Kernel Launch"); ZoneScopedN("VectorAdd Kernel Launch");
TracyCLZoneC(tracyCLCtx, "VectorAdd Kernel", tracy::Color::Blue4); TracyCLZoneC(tracyCLCtx, "VectorAdd Kernel", tracy::Color::Blue4);
CL_ASSERT(clSetKernelArg(vectorAddKernel, 0, sizeof(cl_mem), &bufferC)); CL_ASSERT(clSetKernelArg(vectorAddKernel, 0, sizeof(cl_mem), &bufferC));
CL_ASSERT(clSetKernelArg(vectorAddKernel, 1, sizeof(cl_mem), &bufferA)); CL_ASSERT(clSetKernelArg(vectorAddKernel, 1, sizeof(cl_mem), &bufferA));
CL_ASSERT(clSetKernelArg(vectorAddKernel, 2, sizeof(cl_mem), &bufferB)); CL_ASSERT(clSetKernelArg(vectorAddKernel, 2, sizeof(cl_mem), &bufferB));
CL_ASSERT(clSetKernelArg(vectorAddKernel, 3, sizeof(int), &static_cast<int>(N))); CL_ASSERT(clSetKernelArg(vectorAddKernel, 3, sizeof(int), &n_value));
cl_event vectorAddKernelEvent; cl_event vectorAddKernelEvent;
CL_ASSERT(clEnqueueNDRangeKernel(commandQueue, vectorAddKernel, 1, nullptr, &N, nullptr, 0, nullptr, &vectorAddKernelEvent)); CL_ASSERT(clEnqueueNDRangeKernel(commandQueue, vectorAddKernel, 1, nullptr, &N, nullptr, 0, nullptr, &vectorAddKernelEvent));