diff --git a/src/imgaug/cl/cl_utilities.cpp b/src/imgaug/cl/cl_utilities.cpp index 82772613a..2efecad8b 100644 --- a/src/imgaug/cl/cl_utilities.cpp +++ b/src/imgaug/cl/cl_utilities.cpp @@ -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) { @@ -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) { @@ -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); @@ -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; } diff --git a/src/imgaug/cpu/host_color_model_conversions.hpp b/src/imgaug/cpu/host_color_model_conversions.hpp index 78c779685..d0b2cdfdf 100644 --- a/src/imgaug/cpu/host_color_model_conversions.hpp +++ b/src/imgaug/cpu/host_color_model_conversions.hpp @@ -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; } \ No newline at end of file diff --git a/src/imgaug/cpu/host_image_augmentations.hpp b/src/imgaug/cpu/host_image_augmentations.hpp index 27b12c998..0ad8721c6 100644 --- a/src/imgaug/cpu/host_image_augmentations.hpp +++ b/src/imgaug/cpu/host_image_augmentations.hpp @@ -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; } diff --git a/src/include/cpu/rpp_cpu_common.hpp b/src/include/cpu/rpp_cpu_common.hpp index 2c78904f9..5eb690d5d 100644 --- a/src/include/cpu/rpp_cpu_common.hpp +++ b/src/include/cpu/rpp_cpu_common.hpp @@ -406,23 +406,6 @@ inline RppStatus generate_sobel_kernel_host(Rpp32f* kernel, Rpp32u type) return RPP_SUCCESS; } - - - - - - - - - - - - - - - - - // Kernels for functions template @@ -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; } @@ -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; } @@ -900,26 +884,6 @@ inline RppStatus non_max_suppression_kernel_host(T* srcPtrWindow, T* dstPtrPixel return RPP_SUCCESS; } - - - - - - - - - - - - - - - - - - - - // Convolution Functions template