Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added per architecture binary file storage, #4

Merged
merged 2 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/imgaug/cl/cl_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ cl_kernel_initializer ( cl_command_queue theQueue,
// File Handling
char *sourceStr;
size_t sourceSize;

std::string kernelFile_cl = MOD_CL_PATH + kernelFile;
FILE *filePtr = fopen( kernelFile_cl.c_str(), "rb");
if (!filePtr) {
Expand Down Expand Up @@ -218,13 +219,15 @@ cl_int CreateProgramFromBinary(cl_command_queue theQueue, const std::string kern
cl_device_id theDevice;
clGetCommandQueueInfo( theQueue,
CL_QUEUE_DEVICE, sizeof(cl_device_id), &theDevice, NULL);

theKernel = CLKernelManager::obj()->find(kernelName);
char deviceName[100] = "\0";
clGetDeviceInfo(theDevice, CL_DEVICE_NAME, sizeof(deviceName), deviceName, nullptr);
std::string device_name(deviceName);
theKernel = CLKernelManager::obj()->find(device_name+kernelName);

if( theKernel != nullptr)
return status;

FILE *fp = fopen(binaryFile.c_str(), "rb");
FILE *fp = fopen((device_name+binaryFile).c_str(), "rb");

if (fp == NULL)
{
Expand Down Expand Up @@ -289,7 +292,7 @@ cl_int CreateProgramFromBinary(cl_command_queue theQueue, const std::string kern
theProgram, theKernel);

//std::cout << "Save program binary for future run..." << std::endl;
if (SaveProgramBinary(theProgram, theDevice, binaryFile) == false)
if (SaveProgramBinary(theProgram, theDevice, device_name+binaryFile) == false)
{
std::cerr << "Failed to write program binary" << std::endl;
clFinish(theQueue);
Expand All @@ -306,6 +309,6 @@ cl_int CreateProgramFromBinary(cl_command_queue theQueue, const std::string kern

theKernel = clCreateKernel(theProgram, kernelName.c_str(), &err);
clReleaseProgram(theProgram);
CLKernelManager::obj()->set( theKernel, kernelName);
CLKernelManager::obj()->set( theKernel, device_name+kernelName);
return err;
}
7 changes: 6 additions & 1 deletion src/imgaug/cpu/host_color_model_conversions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ RppStatus vignette_host(T* srcPtr, RppiSize srcSize, T* dstPtr,
}

compute_multiply_host(srcPtr, maskFinal, srcSize, dstPtr, channel);


free(maskFinal);
free(kernelRows);
free(kernelColumns);
free(mask);

return RPP_SUCCESS;
}
3 changes: 2 additions & 1 deletion src/imgaug/cpu/host_image_augmentations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ RppStatus blur_host(T* srcPtr, RppiSize srcSize, T* dstPtr,
rppiKernelSize.height = kernelSize;
rppiKernelSize.width = kernelSize;
convolve_image_host(srcPtrMod, srcSizeMod, dstPtr, srcSize, kernel, rppiKernelSize, chnFormat, channel);

free(kernel);
free(srcPtrMod);
return RPP_SUCCESS;
}

Expand Down
40 changes: 2 additions & 38 deletions src/include/cpu/rpp_cpu_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,23 +406,6 @@ inline RppStatus generate_sobel_kernel_host(Rpp32f* kernel, Rpp32u type)
return RPP_SUCCESS;
}


















// Kernels for functions

template<typename T, typename U>
Expand Down Expand Up @@ -589,6 +572,7 @@ inline RppStatus resize_crop_kernel_host(T* srcPtr, RppiSize srcSize, T* dstPtr,

resize_kernel_host(srcPtrResize, srcSizeSubImage, dstPtr, dstSize, chnFormat, channel);

free(srcPtrResize);
return RPP_SUCCESS;

}
Expand Down Expand Up @@ -727,7 +711,7 @@ inline RppStatus median_filter_kernel_host(T* srcPtrWindow, T* dstPtrPixel, Rppi
std::sort(kernel, kernel + (kernelSize * kernelSize));

*dstPtrPixel = *(kernel + (((kernelSize * kernelSize) - 1) / 2));

free(kernel);
return RPP_SUCCESS;
}

Expand Down Expand Up @@ -900,26 +884,6 @@ inline RppStatus non_max_suppression_kernel_host(T* srcPtrWindow, T* dstPtrPixel

return RPP_SUCCESS;
}




















// Convolution Functions

template<typename T, typename U>
Expand Down