├── MTF_lab_Report_with_RMSE_results.pdf ├── OpenCLExercise3_Sobel ├── .cproject ├── .project ├── Debug │ ├── OpenCLExercise3_Sobel │ ├── makefile │ ├── objects.mk │ └── sources.mk ├── OpenCLExercise3_Sobel Debug.launch ├── OpenCLExercise3_Sobel Release.launch ├── Release │ ├── lib │ │ ├── Core │ │ │ ├── Assert.d │ │ │ ├── Assert.o │ │ │ ├── CheckedCast.d │ │ │ ├── CheckedCast.o │ │ │ ├── Error.d │ │ │ ├── Error.o │ │ │ ├── Exception.d │ │ │ ├── Exception.o │ │ │ ├── Image.d │ │ │ ├── Image.o │ │ │ ├── Memory.d │ │ │ ├── Memory.o │ │ │ ├── NumericException.d │ │ │ ├── NumericException.o │ │ │ ├── StrError.d │ │ │ ├── StrError.o │ │ │ ├── Time.d │ │ │ ├── Time.o │ │ │ ├── TimeSpan.d │ │ │ ├── TimeSpan.o │ │ │ ├── Type.d │ │ │ ├── Type.o │ │ │ ├── WindowsError.d │ │ │ ├── WindowsError.o │ │ │ └── subdir.mk │ │ └── OpenCL │ │ │ ├── Device.d │ │ │ ├── Device.o │ │ │ ├── Error.d │ │ │ ├── Error.o │ │ │ ├── Event.d │ │ │ ├── Event.o │ │ │ ├── GetError.d │ │ │ ├── GetError.o │ │ │ ├── Program.d │ │ │ ├── Program.o │ │ │ └── subdir.mk │ ├── makefile │ ├── objects.mk │ ├── sources.mk │ └── src │ │ ├── OpenCLExercise3_Sobel.d │ │ ├── OpenCLExercise3_Sobel.o │ │ └── subdir.mk ├── ValuesESF.csv ├── ValuesMTF.csv ├── ValuesPSF.csv ├── h_edge.tif ├── h_edge_mono.tif ├── lib │ ├── Core │ │ ├── Assert.cpp │ │ ├── Assert.hpp │ │ ├── CheckedCast.cpp │ │ ├── CheckedCast.hpp │ │ ├── Error.cpp │ │ ├── Error.hpp │ │ ├── Exception.cpp │ │ ├── Exception.hpp │ │ ├── Image.cpp │ │ ├── Image.hpp │ │ ├── Memory.cpp │ │ ├── Memory.hpp │ │ ├── NumericException.cpp │ │ ├── NumericException.hpp │ │ ├── StrError.c │ │ ├── StrError.h │ │ ├── Time.cpp │ │ ├── Time.hpp │ │ ├── TimeSpan.cpp │ │ ├── TimeSpan.hpp │ │ ├── Type.cpp │ │ ├── Type.hpp │ │ ├── Util.h │ │ ├── Util.hpp │ │ ├── WindowsError.cpp │ │ └── WindowsError.hpp │ └── OpenCL │ │ ├── Device.cpp │ │ ├── Device.hpp │ │ ├── Error.cpp │ │ ├── Error.hpp │ │ ├── Event.cpp │ │ ├── Event.hpp │ │ ├── GetError.cpp │ │ ├── GetError.hpp │ │ ├── OpenCLKernel.hpp │ │ ├── OpenCLKernel.hpp.url │ │ ├── Program.cpp │ │ ├── Program.hpp │ │ ├── README-MacOS.txt │ │ ├── cl-patched.hpp │ │ ├── cl.hpp.orig │ │ └── cl.hpp.orig.url ├── plot.py ├── src │ ├── OpenCLExercise3_Sobel.cl │ └── OpenCLExercise3_Sobel.cpp ├── v_edge.tif └── v_edge_mono.tif └── README.md /MTF_lab_Report_with_RMSE_results.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/MTF_lab_Report_with_RMSE_results.pdf -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 34 | 35 | 36 | 37 | 41 | 47 | 48 | 49 | 50 | 51 | 62 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 106 | 112 | 113 | 114 | 115 | 119 | 125 | 126 | 127 | 128 | 129 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenCLExercise3_Sobel 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?name? 14 | 15 | 16 | 17 | org.eclipse.cdt.make.core.append_environment 18 | true 19 | 20 | 21 | org.eclipse.cdt.make.core.autoBuildTarget 22 | all 23 | 24 | 25 | org.eclipse.cdt.make.core.buildArguments 26 | 27 | 28 | 29 | org.eclipse.cdt.make.core.buildCommand 30 | make 31 | 32 | 33 | org.eclipse.cdt.make.core.buildLocation 34 | ${workspace_loc:/OpenCLExercise3_Sobel/Debug} 35 | 36 | 37 | org.eclipse.cdt.make.core.cleanBuildTarget 38 | clean 39 | 40 | 41 | org.eclipse.cdt.make.core.contents 42 | org.eclipse.cdt.make.core.activeConfigSettings 43 | 44 | 45 | org.eclipse.cdt.make.core.enableAutoBuild 46 | false 47 | 48 | 49 | org.eclipse.cdt.make.core.enableCleanBuild 50 | true 51 | 52 | 53 | org.eclipse.cdt.make.core.enableFullBuild 54 | true 55 | 56 | 57 | org.eclipse.cdt.make.core.fullBuildTarget 58 | all 59 | 60 | 61 | org.eclipse.cdt.make.core.stopOnError 62 | true 63 | 64 | 65 | org.eclipse.cdt.make.core.useDefaultBuildCmd 66 | true 67 | 68 | 69 | 70 | 71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 72 | full,incremental, 73 | 74 | 75 | 76 | 77 | 78 | org.eclipse.cdt.core.cnature 79 | org.eclipse.cdt.core.ccnature 80 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 81 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 82 | 83 | 84 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Debug/OpenCLExercise3_Sobel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Debug/OpenCLExercise3_Sobel -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Debug/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm -rf 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include src/subdir.mk 12 | -include lib/OpenCL/subdir.mk 13 | -include lib/Core/subdir.mk 14 | -include subdir.mk 15 | -include objects.mk 16 | 17 | ifneq ($(MAKECMDGOALS),clean) 18 | ifneq ($(strip $(CC_DEPS)),) 19 | -include $(CC_DEPS) 20 | endif 21 | ifneq ($(strip $(C++_DEPS)),) 22 | -include $(C++_DEPS) 23 | endif 24 | ifneq ($(strip $(CL_DEPS)),) 25 | -include $(CL_DEPS) 26 | endif 27 | ifneq ($(strip $(C_UPPER_DEPS)),) 28 | -include $(C_UPPER_DEPS) 29 | endif 30 | ifneq ($(strip $(CXX_DEPS)),) 31 | -include $(CXX_DEPS) 32 | endif 33 | ifneq ($(strip $(CPP_DEPS)),) 34 | -include $(CPP_DEPS) 35 | endif 36 | ifneq ($(strip $(C_DEPS)),) 37 | -include $(C_DEPS) 38 | endif 39 | endif 40 | 41 | -include ../makefile.defs 42 | 43 | # Add inputs and outputs from these tool invocations to the build variables 44 | 45 | # All Target 46 | all: OpenCLExercise3_Sobel 47 | 48 | # Tool invocations 49 | OpenCLExercise3_Sobel: $(OBJS) $(USER_OBJS) 50 | @echo 'Building target: $@' 51 | @echo 'Invoking: GCC C++ Linker' 52 | g++ -L/usr/lib/x86_64-linux-gnu -o "OpenCLExercise3_Sobel" $(OBJS) $(USER_OBJS) $(LIBS) 53 | @echo 'Finished building target: $@' 54 | @echo ' ' 55 | 56 | # Other Targets 57 | clean: 58 | -$(RM) $(CC_DEPS)$(C++_DEPS)$(CL_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) OpenCLExercise3_Sobel 59 | -@echo ' ' 60 | 61 | .PHONY: all clean dependents 62 | 63 | -include ../makefile.targets 64 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Debug/objects.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | USER_OBJS := 6 | 7 | LIBS := -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui -lopencv_ml -ldl -lboost_system -lboost_filesystem -lOpenCL 8 | 9 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Debug/sources.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | C_UPPER_SRCS := 6 | CXX_SRCS := 7 | CL_SRCS := 8 | C++_SRCS := 9 | OBJ_SRCS := 10 | CC_SRCS := 11 | ASM_SRCS := 12 | CPP_SRCS := 13 | C_SRCS := 14 | O_SRCS := 15 | S_UPPER_SRCS := 16 | CC_DEPS := 17 | C++_DEPS := 18 | CL_DEPS := 19 | EXECUTABLES := 20 | C_UPPER_DEPS := 21 | CXX_DEPS := 22 | OBJS := 23 | CPP_DEPS := 24 | C_DEPS := 25 | 26 | # Every subdirectory with source files must be described here 27 | SUBDIRS := \ 28 | lib/Core \ 29 | lib/OpenCL \ 30 | src \ 31 | 32 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/OpenCLExercise3_Sobel Debug.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/OpenCLExercise3_Sobel Release.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Assert.d: -------------------------------------------------------------------------------- 1 | lib/Core/Assert.o: ../lib/Core/Assert.cpp ../lib/Core/Assert.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp 5 | 6 | ../lib/Core/Assert.hpp: 7 | 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 9 | 10 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 11 | 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 13 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Assert.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Assert.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/CheckedCast.d: -------------------------------------------------------------------------------- 1 | lib/Core/CheckedCast.o: ../lib/Core/CheckedCast.cpp \ 2 | ../lib/Core/CheckedCast.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/NumericException.hpp \ 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Type.hpp 9 | 10 | ../lib/Core/CheckedCast.hpp: 11 | 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 13 | 14 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 15 | 16 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 17 | 18 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 19 | 20 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/NumericException.hpp: 21 | 22 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Type.hpp: 23 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/CheckedCast.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/CheckedCast.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Error.d: -------------------------------------------------------------------------------- 1 | lib/Core/Error.o: ../lib/Core/Error.cpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 4 | ../lib/Core/Error.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/StrError.h 8 | 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 10 | 11 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 12 | 13 | ../lib/Core/Error.hpp: 14 | 15 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 16 | 17 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 18 | 19 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/StrError.h: 20 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Error.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Error.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Exception.d: -------------------------------------------------------------------------------- 1 | lib/Core/Exception.o: ../lib/Core/Exception.cpp ../lib/Core/Exception.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Memory.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/StrError.h 6 | 7 | ../lib/Core/Exception.hpp: 8 | 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 10 | 11 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 12 | 13 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Memory.hpp: 14 | 15 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/StrError.h: 16 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Exception.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Exception.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Image.d: -------------------------------------------------------------------------------- 1 | lib/Core/Image.o: ../lib/Core/Image.cpp ../lib/Core/Image.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Error.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h 7 | 8 | ../lib/Core/Image.hpp: 9 | 10 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Error.hpp: 11 | 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 13 | 14 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 15 | 16 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 17 | 18 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 19 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Image.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Image.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Memory.d: -------------------------------------------------------------------------------- 1 | lib/Core/Memory.o: ../lib/Core/Memory.cpp ../lib/Core/Memory.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h 4 | 5 | ../lib/Core/Memory.hpp: 6 | 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 8 | 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 10 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Memory.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Memory.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/NumericException.d: -------------------------------------------------------------------------------- 1 | lib/Core/NumericException.o: ../lib/Core/NumericException.cpp \ 2 | ../lib/Core/NumericException.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Type.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp 8 | 9 | ../lib/Core/NumericException.hpp: 10 | 11 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Type.hpp: 12 | 13 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 14 | 15 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 16 | 17 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 18 | 19 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 20 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/NumericException.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/NumericException.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/StrError.d: -------------------------------------------------------------------------------- 1 | lib/Core/StrError.o: ../lib/Core/StrError.c ../lib/Core/StrError.h \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h 3 | 4 | ../lib/Core/StrError.h: 5 | 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 7 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/StrError.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/StrError.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Time.d: -------------------------------------------------------------------------------- 1 | lib/Core/Time.o: ../lib/Core/Time.cpp ../lib/Core/Time.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Error.hpp \ 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/WindowsError.hpp 9 | 10 | ../lib/Core/Time.hpp: 11 | 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp: 13 | 14 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 15 | 16 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 17 | 18 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 19 | 20 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 21 | 22 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Error.hpp: 23 | 24 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/WindowsError.hpp: 25 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Time.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Time.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/TimeSpan.d: -------------------------------------------------------------------------------- 1 | lib/Core/TimeSpan.o: ../lib/Core/TimeSpan.cpp ../lib/Core/TimeSpan.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h 5 | 6 | ../lib/Core/TimeSpan.hpp: 7 | 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 9 | 10 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 11 | 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 13 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/TimeSpan.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/TimeSpan.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Type.d: -------------------------------------------------------------------------------- 1 | lib/Core/Type.o: ../lib/Core/Type.cpp ../lib/Core/Type.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Memory.hpp 6 | 7 | ../lib/Core/Type.hpp: 8 | 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 10 | 11 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 12 | 13 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 14 | 15 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Memory.hpp: 16 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/Type.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/Type.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/WindowsError.d: -------------------------------------------------------------------------------- 1 | lib/Core/WindowsError.o: ../lib/Core/WindowsError.cpp \ 2 | ../lib/Core/WindowsError.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h 5 | 6 | ../lib/Core/WindowsError.hpp: 7 | 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 9 | 10 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 11 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/WindowsError.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/Core/WindowsError.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/Core/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | CPP_SRCS += \ 7 | ../lib/Core/Assert.cpp \ 8 | ../lib/Core/CheckedCast.cpp \ 9 | ../lib/Core/Error.cpp \ 10 | ../lib/Core/Exception.cpp \ 11 | ../lib/Core/Image.cpp \ 12 | ../lib/Core/Memory.cpp \ 13 | ../lib/Core/NumericException.cpp \ 14 | ../lib/Core/Time.cpp \ 15 | ../lib/Core/TimeSpan.cpp \ 16 | ../lib/Core/Type.cpp \ 17 | ../lib/Core/WindowsError.cpp 18 | 19 | C_SRCS += \ 20 | ../lib/Core/StrError.c 21 | 22 | OBJS += \ 23 | ./lib/Core/Assert.o \ 24 | ./lib/Core/CheckedCast.o \ 25 | ./lib/Core/Error.o \ 26 | ./lib/Core/Exception.o \ 27 | ./lib/Core/Image.o \ 28 | ./lib/Core/Memory.o \ 29 | ./lib/Core/NumericException.o \ 30 | ./lib/Core/StrError.o \ 31 | ./lib/Core/Time.o \ 32 | ./lib/Core/TimeSpan.o \ 33 | ./lib/Core/Type.o \ 34 | ./lib/Core/WindowsError.o 35 | 36 | CPP_DEPS += \ 37 | ./lib/Core/Assert.d \ 38 | ./lib/Core/CheckedCast.d \ 39 | ./lib/Core/Error.d \ 40 | ./lib/Core/Exception.d \ 41 | ./lib/Core/Image.d \ 42 | ./lib/Core/Memory.d \ 43 | ./lib/Core/NumericException.d \ 44 | ./lib/Core/Time.d \ 45 | ./lib/Core/TimeSpan.d \ 46 | ./lib/Core/Type.d \ 47 | ./lib/Core/WindowsError.d 48 | 49 | C_DEPS += \ 50 | ./lib/Core/StrError.d 51 | 52 | 53 | # Each subdirectory must supply rules for building sources it contributes 54 | lib/Core/%.o: ../lib/Core/%.cpp 55 | @echo 'Building file: $<' 56 | @echo 'Invoking: GCC C++ Compiler' 57 | g++ -DOMPI_SKIP_MPICXX -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -I"/home/vayalala/workspace2/OpenCLExercise3_Sobel/lib" -I/usr/include/mpi -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 58 | @echo 'Finished building: $<' 59 | @echo ' ' 60 | 61 | lib/Core/%.o: ../lib/Core/%.c 62 | @echo 'Building file: $<' 63 | @echo 'Invoking: GCC C Compiler' 64 | gcc -I"/home/vayalala/workspace2/OpenCLExercise3_Sobel/lib" -I/usr/include/mpi -O3 -Wall -c -fmessage-length=0 -DOMPI_SKIP_MPICXX -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 65 | @echo 'Finished building: $<' 66 | @echo ' ' 67 | 68 | 69 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Device.d: -------------------------------------------------------------------------------- 1 | lib/OpenCL/Device.o: ../lib/OpenCL/Device.cpp ../lib/OpenCL/Device.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp 3 | 4 | ../lib/OpenCL/Device.hpp: 5 | 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp: 7 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Device.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/OpenCL/Device.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Error.d: -------------------------------------------------------------------------------- 1 | lib/OpenCL/Error.o: ../lib/OpenCL/Error.cpp ../lib/OpenCL/Error.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/GetError.hpp 7 | 8 | ../lib/OpenCL/Error.hpp: 9 | 10 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 11 | 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 13 | 14 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 15 | 16 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp: 17 | 18 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/GetError.hpp: 19 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Error.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/OpenCL/Error.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Event.d: -------------------------------------------------------------------------------- 1 | lib/OpenCL/Event.o: ../lib/OpenCL/Event.cpp ../lib/OpenCL/Event.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp 4 | 5 | ../lib/OpenCL/Event.hpp: 6 | 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp: 8 | 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp: 10 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Event.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/OpenCL/Event.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/GetError.d: -------------------------------------------------------------------------------- 1 | lib/OpenCL/GetError.o: ../lib/OpenCL/GetError.cpp \ 2 | ../lib/OpenCL/GetError.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp 4 | 5 | ../lib/OpenCL/GetError.hpp: 6 | 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp: 8 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/GetError.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/OpenCL/GetError.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Program.d: -------------------------------------------------------------------------------- 1 | lib/OpenCL/Program.o: ../lib/OpenCL/Program.cpp ../lib/OpenCL/Program.hpp \ 2 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Error.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp \ 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Error.hpp \ 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/GetError.hpp 10 | 11 | ../lib/OpenCL/Program.hpp: 12 | 13 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 14 | 15 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 16 | 17 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Error.hpp: 18 | 19 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 20 | 21 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp: 22 | 23 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Error.hpp: 24 | 25 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 26 | 27 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/GetError.hpp: 28 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/Program.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/lib/OpenCL/Program.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/lib/OpenCL/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | CPP_SRCS += \ 7 | ../lib/OpenCL/Device.cpp \ 8 | ../lib/OpenCL/Error.cpp \ 9 | ../lib/OpenCL/Event.cpp \ 10 | ../lib/OpenCL/GetError.cpp \ 11 | ../lib/OpenCL/Program.cpp 12 | 13 | OBJS += \ 14 | ./lib/OpenCL/Device.o \ 15 | ./lib/OpenCL/Error.o \ 16 | ./lib/OpenCL/Event.o \ 17 | ./lib/OpenCL/GetError.o \ 18 | ./lib/OpenCL/Program.o 19 | 20 | CPP_DEPS += \ 21 | ./lib/OpenCL/Device.d \ 22 | ./lib/OpenCL/Error.d \ 23 | ./lib/OpenCL/Event.d \ 24 | ./lib/OpenCL/GetError.d \ 25 | ./lib/OpenCL/Program.d 26 | 27 | 28 | # Each subdirectory must supply rules for building sources it contributes 29 | lib/OpenCL/%.o: ../lib/OpenCL/%.cpp 30 | @echo 'Building file: $<' 31 | @echo 'Invoking: GCC C++ Compiler' 32 | g++ -DOMPI_SKIP_MPICXX -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -I"/home/vayalala/workspace2/OpenCLExercise3_Sobel/lib" -I/usr/include/mpi -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 33 | @echo 'Finished building: $<' 34 | @echo ' ' 35 | 36 | 37 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm -rf 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include src/subdir.mk 12 | -include lib/OpenCL/subdir.mk 13 | -include lib/Core/subdir.mk 14 | -include subdir.mk 15 | -include objects.mk 16 | 17 | ifneq ($(MAKECMDGOALS),clean) 18 | ifneq ($(strip $(CC_DEPS)),) 19 | -include $(CC_DEPS) 20 | endif 21 | ifneq ($(strip $(C++_DEPS)),) 22 | -include $(C++_DEPS) 23 | endif 24 | ifneq ($(strip $(CL_DEPS)),) 25 | -include $(CL_DEPS) 26 | endif 27 | ifneq ($(strip $(C_UPPER_DEPS)),) 28 | -include $(C_UPPER_DEPS) 29 | endif 30 | ifneq ($(strip $(CXX_DEPS)),) 31 | -include $(CXX_DEPS) 32 | endif 33 | ifneq ($(strip $(CPP_DEPS)),) 34 | -include $(CPP_DEPS) 35 | endif 36 | ifneq ($(strip $(C_DEPS)),) 37 | -include $(C_DEPS) 38 | endif 39 | endif 40 | 41 | -include ../makefile.defs 42 | 43 | # Add inputs and outputs from these tool invocations to the build variables 44 | 45 | # All Target 46 | all: OpenCLExercise3_Sobel 47 | 48 | # Tool invocations 49 | OpenCLExercise3_Sobel: $(OBJS) $(USER_OBJS) 50 | @echo 'Building target: $@' 51 | @echo 'Invoking: GCC C++ Linker' 52 | g++ -o "OpenCLExercise3_Sobel" $(OBJS) $(USER_OBJS) $(LIBS) 53 | @echo 'Finished building target: $@' 54 | @echo ' ' 55 | 56 | # Other Targets 57 | clean: 58 | -$(RM) $(CC_DEPS)$(C++_DEPS)$(CL_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) OpenCLExercise3_Sobel 59 | -@echo ' ' 60 | 61 | .PHONY: all clean dependents 62 | 63 | -include ../makefile.targets 64 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/objects.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | USER_OBJS := 6 | 7 | LIBS := -ldl -lboost_system -lboost_filesystem -lOpenCL 8 | 9 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/sources.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | C_UPPER_SRCS := 6 | CXX_SRCS := 7 | CL_SRCS := 8 | C++_SRCS := 9 | OBJ_SRCS := 10 | CC_SRCS := 11 | ASM_SRCS := 12 | CPP_SRCS := 13 | C_SRCS := 14 | O_SRCS := 15 | S_UPPER_SRCS := 16 | CC_DEPS := 17 | C++_DEPS := 18 | CL_DEPS := 19 | EXECUTABLES := 20 | C_UPPER_DEPS := 21 | CXX_DEPS := 22 | OBJS := 23 | CPP_DEPS := 24 | C_DEPS := 25 | 26 | # Every subdirectory with source files must be described here 27 | SUBDIRS := \ 28 | lib/Core \ 29 | lib/OpenCL \ 30 | src \ 31 | 32 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/src/OpenCLExercise3_Sobel.d: -------------------------------------------------------------------------------- 1 | src/OpenCLExercise3_Sobel.o: ../src/OpenCLExercise3_Sobel.cpp \ 2 | /usr/include/opencv2/opencv.hpp \ 3 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp \ 4 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp \ 5 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h \ 6 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Time.hpp \ 7 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp \ 8 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Image.hpp \ 9 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp \ 10 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Program.hpp \ 11 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Error.hpp \ 12 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp \ 13 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Event.hpp \ 14 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Device.hpp 15 | 16 | /usr/include/opencv2/opencv.hpp: 17 | 18 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Assert.hpp: 19 | 20 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.hpp: 21 | 22 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Util.h: 23 | 24 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Time.hpp: 25 | 26 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp: 27 | 28 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Image.hpp: 29 | 30 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/cl-patched.hpp: 31 | 32 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Program.hpp: 33 | 34 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Error.hpp: 35 | 36 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/Core/Exception.hpp: 37 | 38 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Event.hpp: 39 | 40 | /home/vayalala/workspace2/OpenCLExercise3_Sobel/lib/OpenCL/Device.hpp: 41 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/src/OpenCLExercise3_Sobel.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/Release/src/OpenCLExercise3_Sobel.o -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/Release/src/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | CPP_SRCS += \ 7 | ../src/OpenCLExercise3_Sobel.cpp 8 | 9 | OBJS += \ 10 | ./src/OpenCLExercise3_Sobel.o 11 | 12 | CPP_DEPS += \ 13 | ./src/OpenCLExercise3_Sobel.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | src/%.o: ../src/%.cpp 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: GCC C++ Compiler' 20 | g++ -DOMPI_SKIP_MPICXX -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -I"/home/vayalala/workspace2/OpenCLExercise3_Sobel/lib" -I/usr/include/mpi -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/ValuesESF.csv: -------------------------------------------------------------------------------- 1 | -40.7811,169.44 2 | -39.6188,169.28 3 | -38.8527,169.44 4 | -38.2443,169.72 5 | -37.6967,169.64 6 | -37.2308,168.72 7 | -36.7807,169.52 8 | -36.3893,169.52 9 | -36.0073,169 10 | -35.6456,169.56 11 | -35.3182,169.84 12 | -34.9907,169 13 | -34.6773,169.12 14 | -34.3906,169.56 15 | -34.104,169.52 16 | -33.8195,169.48 17 | -33.558,169.56 18 | -33.3033,169.96 19 | -33.0492,169.16 20 | -32.7971,169.28 21 | -32.5629,169.68 22 | -32.3354,169.64 23 | -32.1044,169.92 24 | -31.8769,169.2 25 | -31.6589,169.48 26 | -31.4509,169.32 27 | -31.2434,169.24 28 | -31.0343,168.96 29 | -30.8262,169 30 | -30.6318,169.68 31 | -30.441,169.44 32 | -30.2499,169.28 33 | -30.0591,168.96 34 | -29.868,168.76 35 | -29.6859,169.6 36 | -29.5094,169.2 37 | -29.3333,169.28 38 | -29.1568,169.4 39 | -28.9807,169.32 40 | -28.8056,169.36 41 | -28.6401,169.12 42 | -28.4766,169.12 43 | -28.3125,169.32 44 | -28.149,169.24 45 | -27.9851,169.8 46 | -27.8221,169.6 47 | -27.6674,169.08 48 | -27.5148,169.16 49 | -27.3616,169.44 50 | -27.209,169.44 51 | -27.0564,169.6 52 | -26.9031,169.72 53 | -26.754,169.4 54 | -26.611,168.8 55 | -26.467,169.04 56 | -26.3248,169.2 57 | -26.1804,168.92 58 | -26.0382,168.92 59 | -25.8943,169 60 | -25.7547,169.64 61 | -25.6196,169.36 62 | -25.4854,169.2 63 | -25.3498,169.36 64 | -25.216,168.84 65 | -25.0799,169.32 66 | -24.9463,169.4 67 | -24.8111,169.36 68 | -24.6846,169.8 69 | -24.5558,169.12 70 | -24.4291,169.44 71 | -24.3022,169.24 72 | -24.1737,169.32 73 | -24.0477,168.92 74 | -23.9192,169.32 75 | -23.7939,168.8 76 | -23.6738,169.2 77 | -23.5518,169.32 78 | -23.4318,169.4 79 | -23.3112,168.8 80 | -23.1828,168.84 81 | -23.057,169.08 82 | -22.9287,169.4 83 | -22.8028,169.16 84 | -22.6828,169.32 85 | -22.5611,169.04 86 | -22.4407,169.44 87 | -22.3203,168.88 88 | -22.1922,168.8 89 | -22.066,169.04 90 | -21.9386,169.12 91 | -21.8117,169.12 92 | -21.6918,168.84 93 | -21.5702,168.48 94 | -21.4496,168.92 95 | -21.3296,169.44 96 | -21.2016,169.28 97 | -21.075,169.16 98 | -20.9481,169.04 99 | -20.8206,169.08 100 | -20.7007,169.04 101 | -20.5796,168.96 102 | -20.4585,168.84 103 | -20.3386,169.28 104 | -20.2111,169.2 105 | -20.0842,169.04 106 | -19.9576,169.12 107 | -19.8296,169.68 108 | -19.7096,169.16 109 | -19.589,169.12 110 | -19.4674,168.88 111 | -19.3476,169.48 112 | -19.2206,169.16 113 | -19.0932,169.04 114 | -18.967,169 115 | -18.839,169.04 116 | -18.7185,168.92 117 | -18.5981,169.12 118 | -18.4764,168.84 119 | -18.3565,169.08 120 | -18.2305,169.04 121 | -18.1022,168.76 122 | -17.9764,169.12 123 | -17.848,168.88 124 | -17.7274,168.44 125 | -17.6074,169.08 126 | -17.4854,168.6 127 | -17.3654,168.28 128 | -17.24,168.44 129 | -17.1115,168.6 130 | -16.9855,168.84 131 | -16.8575,168.68 132 | -16.7363,168.04 133 | -16.6164,168.8 134 | -16.4947,168.72 135 | -16.3743,169.16 136 | -16.2495,168.84 137 | -16.1206,168.76 138 | -15.9948,168.96 139 | -15.8669,168.76 140 | -15.7452,168.44 141 | -15.6254,168.52 142 | -15.5038,168.88 143 | -15.3832,169 144 | -15.2589,168.48 145 | -15.13,168.6 146 | -15.0038,169.28 147 | -14.8764,169 148 | -14.7542,168.6 149 | -14.6343,168.6 150 | -14.5132,169.28 151 | -14.3921,168.8 152 | -14.2683,168.68 153 | -14.1394,168.6 154 | -14.0128,169.08 155 | -13.8859,169.24 156 | -13.7631,168.52 157 | -13.6432,168.8 158 | -13.5226,168.72 159 | -13.401,168.92 160 | -13.2774,168.44 161 | -13.1489,168.56 162 | -13.022,168.52 163 | -12.8954,168.6 164 | -12.772,168.84 165 | -12.6521,168.52 166 | -12.5317,168.48 167 | -12.41,168.64 168 | -12.2867,168.68 169 | -12.1584,168.84 170 | -12.031,168.44 171 | -11.9048,168.24 172 | -11.7809,168.44 173 | -11.661,168.08 174 | -11.541,168.6 175 | -11.419,168.48 176 | -11.2957,168.52 177 | -11.1683,168.4 178 | -11.04,168.72 179 | -10.9142,168.56 180 | -10.7899,168.48 181 | -10.6699,168.2 182 | -10.55,168.36 183 | -10.4283,168.72 184 | -10.3047,168.48 185 | -10.1778,168.12 186 | -10.0493,168.32 187 | -9.92327,168.44 188 | -9.79926,169 189 | -9.67883,168.36 190 | -9.55899,168.12 191 | -9.43736,168.72 192 | -9.31395,168.68 193 | -9.18729,168.36 194 | -9.05841,168.36 195 | -8.93261,168.32 196 | -8.80834,168.72 197 | -8.68773,168.56 198 | -8.56789,168.36 199 | -8.44678,168.2 200 | -8.32294,168.64 201 | -8.1967,168.08 202 | -8.06783,168.28 203 | -7.94159,168.2 204 | -7.81775,168.36 205 | -7.69664,168.68 206 | -7.5768,168 207 | -7.4562,167.92 208 | -7.33193,167.96 209 | -7.20612,168.64 210 | -7.07724,168.64 211 | -6.95058,168.56 212 | -6.82717,168.4 213 | -6.70554,168.32 214 | -6.5857,168.24 215 | -6.46527,167.92 216 | -6.34126,168.2 217 | -6.21519,168 218 | -6.08674,168.12 219 | -5.95983,168.28 220 | -5.83624,168.12 221 | -5.71453,167.96 222 | -5.59461,168.08 223 | -5.4746,168.04 224 | -5.35033,168.24 225 | -5.22452,167.72 226 | -5.09624,168.04 227 | -4.96882,168.12 228 | -4.84557,168.16 229 | -4.72352,168.04 230 | -4.60351,168.12 231 | -4.48359,168.4 232 | -4.35975,167.88 233 | -4.23351,167.48 234 | -4.10609,168.28 235 | -3.9778,167.8 236 | -3.85456,168.32 237 | -3.73285,167.64 238 | -3.61241,168 239 | -3.49257,167.88 240 | -3.36916,167.8 241 | -3.2425,167.4 242 | -3.11559,167.92 243 | -2.98714,167.76 244 | -2.86355,168 245 | -2.74192,167.52 246 | -2.62132,168 247 | -2.50148,167.88 248 | -2.37866,167.64 249 | -2.25175,167.6 250 | -2.12509,167.68 251 | -1.99621,167.96 252 | -1.87245,168.52 253 | -1.75134,168.28 254 | -1.63022,168.2 255 | -1.51038,168.6 256 | -1.38816,168.12 257 | -1.26074,167.72 258 | -1.1345,167.48 259 | -1.00562,167.88 260 | -0.881354,167.2 261 | -0.760752,166.32 262 | -0.639126,165.84 263 | -0.519286,165.56 264 | -0.39766,164.12 265 | -0.269723,161.84 266 | -0.143917,160.92 267 | -0.0245062,147.64 268 | 0,127.08 269 | 0,124.12 270 | 0,127.04 271 | 0,126.48 272 | 0,124.52 273 | 0,126.48 274 | 0,123.52 275 | 0.00762127,138.6 276 | 0.10505,157.12 277 | 0.225057,154.12 278 | 0.347112,151.8 279 | 0.470524,149.56 280 | 0.62361,147.04 281 | 1.16011,128.36 282 | 1.79906,105.48 283 | 1.9594,102.6 284 | 2.09193,101.28 285 | 2.21186,97.72 286 | 2.33357,95.72 287 | 2.454,94 288 | 2.57444,91.8 289 | 2.70246,90.28 290 | 2.82869,88.96 291 | 2.95612,88.56 292 | 3.08303,88.32 293 | 3.20287,87.48 294 | 3.3245,87.2 295 | 3.4451,87.4 296 | 3.5651,86.84 297 | 3.69304,86.08 298 | 3.81971,86.6 299 | 3.94662,87.08 300 | 4.07404,87.52 301 | 4.19397,87.32 302 | 4.31508,87.12 303 | 4.43619,87.32 304 | 4.55612,87.24 305 | 4.68354,87.08 306 | 4.81045,87.24 307 | 4.93712,88.08 308 | 5.06505,88.4 309 | 5.18506,87.96 310 | 5.30566,87.88 311 | 5.42729,87.92 312 | 5.54713,88.32 313 | 5.67404,87.92 314 | 5.80147,87.44 315 | 5.9277,87.44 316 | 6.05572,87.64 317 | 6.17616,87.72 318 | 6.29659,87.68 319 | 6.4183,87.76 320 | 6.53822,87.92 321 | 6.6642,87.48 322 | 6.79248,87.84 323 | 6.91829,87.44 324 | 7.04665,87.2 325 | 7.16725,87.36 326 | 7.28726,87.32 327 | 7.40932,86.64 328 | 7.52932,87.28 329 | 7.6547,87.36 330 | 7.78315,87.6 331 | 7.90921,87.04 332 | 8.03723,87 333 | 8.15835,87 334 | 8.27827,86.8 335 | 8.39998,86.92 336 | 8.52042,87.16 337 | 8.6452,86.96 338 | 8.77408,87.36 339 | 8.89988,86.96 340 | 9.02782,87.28 341 | 9.14944,87.32 342 | 9.26929,86.76 343 | 9.39091,87.04 344 | 9.51151,87.16 345 | 9.63578,87 346 | 9.76466,87.12 347 | 9.89089,87.4 348 | 10.0183,86.88 349 | 10.1405,87.24 350 | 10.2604,86.88 351 | 10.3815,86.4 352 | 10.5026,87.2 353 | 10.6264,86.92 354 | 10.7552,86.72 355 | 10.8819,86.84 356 | 11.0088,86.6 357 | 11.1316,87.36 358 | 11.2515,87.2 359 | 11.3721,86.44 360 | 11.4937,86.88 361 | 11.6173,86.72 362 | 11.7457,86.84 363 | 11.8727,87.12 364 | 11.9993,86.48 365 | 12.1227,87.12 366 | 12.2426,87.08 367 | 12.363,86.6 368 | 12.4847,86.96 369 | 12.608,86.84 370 | 12.7362,86.48 371 | 12.8637,87 372 | 12.9899,86.32 373 | 13.1137,86.68 374 | 13.2337,86.84 375 | 13.3537,86.84 376 | 13.4757,86.88 377 | 13.599,86.8 378 | 13.7264,86.28 379 | 13.8547,86.64 380 | 13.9805,86.6 381 | 14.1048,86.44 382 | 14.2248,86.84 383 | 14.3447,86.84 384 | 14.4664,86.52 385 | 14.59,86.6 386 | 14.7169,86.68 387 | 14.8454,86.96 388 | 14.9714,86.84 389 | 15.0954,86.68 390 | 15.2159,86.76 391 | 15.3357,86.4 392 | 15.4573,86.8 393 | 15.5807,85.96 394 | 15.7074,86.8 395 | 15.8363,86.64 396 | 15.9621,86.68 397 | 16.0864,86.6 398 | 16.207,86.68 399 | 16.3268,86.92 400 | 16.4479,87.04 401 | 16.5718,86.28 402 | 16.698,86.72 403 | 16.8269,86.84 404 | 16.9531,86.56 405 | 17.0769,86.6 406 | 17.1981,86.2 407 | 17.3179,86.64 408 | 17.4385,86.76 409 | 17.5628,86.56 410 | 17.6886,86.4 411 | 17.8174,86.32 412 | 17.9441,86.72 413 | 18.0675,86.56 414 | 18.1891,86.6 415 | 18.309,86.36 416 | 18.4294,86.36 417 | 18.5534,86.76 418 | 18.6795,86.68 419 | 18.8079,86.68 420 | 18.9349,86.28 421 | 19.0585,86.6 422 | 19.1802,86.48 423 | 19.3001,86.8 424 | 19.4201,86.2 425 | 19.5444,86.44 426 | 19.6702,86.52 427 | 19.7984,86.76 428 | 19.9259,86 429 | 20.0491,86.64 430 | 20.1712,86.6 431 | 20.2912,87 432 | 20.4111,86.48 433 | 20.5349,86.64 434 | 20.6612,86.44 435 | 20.7886,86.64 436 | 20.9169,86.6 437 | 21.0401,86.76 438 | 21.1618,86.92 439 | 21.2823,86.68 440 | 21.4021,86.96 441 | 21.5255,86.76 442 | 21.6522,86.32 443 | 21.7791,86.44 444 | 21.9076,87.16 445 | 22.0311,87 446 | 22.1528,86.6 447 | 22.2734,87 448 | 22.3932,86.84 449 | 22.516,86.84 450 | 22.6429,86.64 451 | 22.7696,86.64 452 | 22.8985,86.68 453 | 23.0222,86.88 454 | 23.1434,87.04 455 | 23.2645,86.96 456 | 23.3843,86.64 457 | 23.5065,86.92 458 | 23.634,87.28 459 | 23.7602,86.52 460 | 23.8891,87.04 461 | 24.0133,86.72 462 | 24.1339,86.8 463 | 24.2556,86.52 464 | 24.3754,86.32 465 | 24.497,86.72 466 | 24.625,86.72 467 | 24.7508,86.16 468 | 24.8797,86.36 469 | 25.0044,86.44 470 | 25.1249,86.6 471 | 25.2466,86.96 472 | 25.3665,86.12 473 | 25.4876,86.2 474 | 25.6156,86.36 475 | 25.7417,86.92 476 | 25.8702,86.6 477 | 25.9955,86.56 478 | 26.1155,86.68 479 | 26.2376,86.92 480 | 26.3576,86.12 481 | 26.4782,86.64 482 | 26.6066,86.64 483 | 26.7324,86.76 484 | 26.8607,86.64 485 | 26.9866,86.64 486 | 27.1065,86.64 487 | 27.2283,86.52 488 | 27.3487,86.16 489 | 27.4691,86.6 490 | 27.5972,86.28 491 | 27.7234,86.44 492 | 27.8508,86.56 493 | 27.9777,86.76 494 | 28.0976,86.48 495 | 28.2192,86.2 496 | 28.3398,86.6 497 | 28.4598,86.24 498 | 28.5877,86.48 499 | 28.7144,86.6 500 | 28.8413,86.92 501 | 28.9687,86.56 502 | 29.0887,86 503 | 29.2098,86.28 504 | 29.3309,86.68 505 | 29.4508,86.52 506 | 29.5782,86.8 507 | 29.7051,86.12 508 | 29.8318,86.48 509 | 29.9597,86.92 510 | 30.0798,86.32 511 | 30.2004,86 512 | 30.322,86.36 513 | 30.4418,86.16 514 | 30.5687,85.92 515 | 30.6962,86.12 516 | 30.8224,86.4 517 | 30.9504,86.6 518 | 31.0709,86.68 519 | 31.1913,86.24 520 | 31.313,85.72 521 | 31.4329,85.8 522 | 31.5589,86 523 | 31.6872,85.76 524 | 31.813,86.04 525 | 31.9413,87 526 | 32.0619,86.76 527 | 32.1819,86.76 528 | 32.304,85.96 529 | 32.424,86.24 530 | 32.5494,86.36 531 | 32.6778,86 532 | 32.8039,86 533 | 32.9319,86.72 534 | 33.053,86.36 535 | 33.173,86.68 536 | 33.2947,86.24 537 | 33.4151,86.4 538 | 33.5399,86.32 539 | 33.6688,85.8 540 | 33.7946,86.04 541 | 33.9225,86.32 542 | 34.0441,86.28 543 | 34.164,86.28 544 | 34.2856,86.4 545 | 34.4062,86.24 546 | 34.5305,86.04 547 | 34.6594,85.92 548 | 34.7856,86.2 549 | 34.913,86.12 550 | 35.0352,86.24 551 | 35.1551,86.24 552 | 35.2762,86.28 553 | 35.3973,85.84 554 | 35.5211,86.48 555 | 35.6499,86.24 556 | 35.7766,86.16 557 | 35.9035,86.12 558 | 36.032,86.08 559 | 36.158,86 560 | 36.2865,85.72 561 | 36.4134,85.96 562 | 36.547,86.2 563 | 36.6821,86.2 564 | 36.8164,85.8 565 | 36.952,86.16 566 | 37.0858,86.4 567 | 37.2219,86.2 568 | 37.3554,86.24 569 | 37.495,86.44 570 | 37.638,86.36 571 | 37.7811,86.4 572 | 37.925,86.68 573 | 38.0673,86.36 574 | 38.2117,86.96 575 | 38.3538,86.68 576 | 38.5026,86.4 577 | 38.6556,85.64 578 | 38.8078,86.52 579 | 38.9611,86.92 580 | 39.114,87.24 581 | 39.2663,86.56 582 | 39.4207,86.32 583 | 39.5831,85.52 584 | 39.7466,85.6 585 | 39.9107,86.72 586 | 40.0742,87.04 587 | 40.2381,86.44 588 | 40.4027,85.96 589 | 40.5768,86.12 590 | 40.7533,85.88 591 | 40.9294,86.4 592 | 41.1059,87.32 593 | 41.2825,85.88 594 | 41.4624,86.52 595 | 41.6536,86.56 596 | 41.8448,86 597 | 42.0356,86.28 598 | 42.2268,86.8 599 | 42.4202,86.08 600 | 42.6262,86.32 601 | 42.8352,86.56 602 | 43.0443,86.28 603 | 43.2518,86.08 604 | 43.4661,85.8 605 | 43.6957,85.96 606 | 43.9242,86.32 607 | 44.1541,85.72 608 | 44.3853,85.88 609 | 44.6353,85.96 610 | 44.8905,85.92 611 | 45.1456,85.8 612 | 45.404,86 613 | 45.687,85.76 614 | 45.9736,85.8 615 | 46.2602,86 616 | 46.5689,85.6 617 | 46.8964,86.44 618 | 47.2239,85.84 619 | 47.5787,85.92 620 | 47.9606,85.76 621 | 48.349,85.84 622 | 48.7934,85.2 623 | 49.2544,85.4 624 | 49.7926,86 625 | 50.3895,85.8 626 | 51.1341,85.76 627 | 52.2089,85.36 628 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/ValuesMTF.csv: -------------------------------------------------------------------------------- 1 | 0,1 2 | 0.1,0.601265 3 | 0.2,0.601264 4 | 0.3,0.568438 5 | 0.4,0.568434 6 | 0.5,0.56007 7 | 0.6,0.56007 8 | 0.7,0.55576 9 | 0.8,0.555758 10 | 0.9,0.548648 11 | 1,0.548647 12 | 1.1,0.547538 13 | 1.2,0.547534 14 | 1.3,0.520117 15 | 1.4,0.520113 16 | 1.5,0.49945 17 | 1.6,0.499448 18 | 1.7,0.479786 19 | 1.8,0.479781 20 | 1.9,0.451931 21 | 2,0.451926 22 | 2.1,0.39096 23 | 2.2,0.390951 24 | 2.3,0.3868 25 | 2.4,0.386795 26 | 2.5,0.363145 27 | 2.6,0.363141 28 | 2.7,0.35645 29 | 2.8,0.35644 30 | 2.9,0.310208 31 | 3,0.310196 32 | 3.1,0.301607 33 | 3.2,0.301601 34 | 3.3,0.301505 35 | 3.4,0.301503 36 | 3.5,0.301347 37 | 3.6,0.301343 38 | 3.7,0.300879 39 | 3.8,0.300879 40 | 3.9,0.299628 41 | 4,0.299622 42 | 4.1,0.299448 43 | 4.2,0.299442 44 | 4.3,0.29788 45 | 4.4,0.297878 46 | 4.5,0.292939 47 | 4.6,0.292937 48 | 4.7,0.281841 49 | 4.8,0.281838 50 | 4.9,0.2798 51 | 5,0.279799 52 | 5.1,0.276714 53 | 5.2,0.276712 54 | 5.3,0.276611 55 | 5.4,0.276608 56 | 5.5,0.276539 57 | 5.6,0.276539 58 | 5.7,0.275668 59 | 5.8,0.275666 60 | 5.9,0.273867 61 | 6,0.273861 62 | 6.1,0.272648 63 | 6.2,0.272641 64 | 6.3,0.265784 65 | 6.4,0.265775 66 | 6.5,0.261425 67 | 6.6,0.261424 68 | 6.7,0.261237 69 | 6.8,0.261235 70 | 6.9,0.256234 71 | 7,0.256232 72 | 7.1,0.249982 73 | 7.2,0.249969 74 | 7.3,0.24602 75 | 7.4,0.246016 76 | 7.5,0.244819 77 | 7.6,0.244817 78 | 7.7,0.237882 79 | 7.79999,0.237878 80 | 7.89999,0.236665 81 | 7.99999,0.23666 82 | 8.09999,0.227598 83 | 8.2,0.227594 84 | 8.3,0.222973 85 | 8.4,0.222968 86 | 8.5,0.222123 87 | 8.6,0.222118 88 | 8.7,0.217232 89 | 8.8,0.217227 90 | 8.9,0.214732 91 | 9,0.21473 92 | 9.1,0.21134 93 | 9.2,0.211336 94 | 9.3,0.211238 95 | 9.4,0.211235 96 | 9.5,0.210071 97 | 9.6,0.210071 98 | 9.7,0.20888 99 | 9.8,0.208878 100 | 9.9,0.206521 101 | 10,0.206516 102 | 10.1,0.203957 103 | 10.2,0.203957 104 | 10.3,0.201214 105 | 10.4,0.201205 106 | 10.5,0.200953 107 | 10.6,0.200948 108 | 10.7,0.198867 109 | 10.8,0.198861 110 | 10.9,0.198466 111 | 11,0.19846 112 | 11.1,0.197225 113 | 11.2,0.197224 114 | 11.3,0.192917 115 | 11.4,0.192908 116 | 11.5,0.190058 117 | 11.6,0.190058 118 | 11.7,0.188042 119 | 11.8,0.188038 120 | 11.9,0.18456 121 | 12,0.184556 122 | 12.1,0.182793 123 | 12.2,0.182792 124 | 12.3,0.181975 125 | 12.4,0.181971 126 | 12.5,0.181182 127 | 12.6,0.181182 128 | 12.7,0.181129 129 | 12.8,0.181128 130 | 12.9,0.178992 131 | 13,0.17899 132 | 13.1,0.176982 133 | 13.2,0.176979 134 | 13.3,0.175927 135 | 13.4,0.175924 136 | 13.5,0.173534 137 | 13.6,0.17353 138 | 13.7,0.169409 139 | 13.8,0.169405 140 | 13.9,0.167782 141 | 14,0.167776 142 | 14.1,0.164547 143 | 14.2,0.164546 144 | 14.3,0.16454 145 | 14.4,0.164537 146 | 14.5,0.163503 147 | 14.6,0.163499 148 | 14.7,0.163441 149 | 14.8,0.163435 150 | 14.9,0.163108 151 | 15,0.163105 152 | 15.1,0.160958 153 | 15.2,0.160955 154 | 15.3,0.160725 155 | 15.4,0.160709 156 | 15.5,0.160505 157 | 15.6,0.160498 158 | 15.7,0.16036 159 | 15.8,0.160359 160 | 15.9,0.157842 161 | 16,0.157838 162 | 16.1,0.154349 163 | 16.2,0.154343 164 | 16.3,0.153579 165 | 16.4,0.153578 166 | 16.5,0.153458 167 | 16.6,0.153456 168 | 16.7,0.153239 169 | 16.8,0.153225 170 | 16.9,0.152693 171 | 17,0.15269 172 | 17.1,0.152251 173 | 17.2,0.152249 174 | 17.3,0.152047 175 | 17.4,0.152038 176 | 17.5,0.151779 177 | 17.6,0.151779 178 | 17.7,0.151709 179 | 17.8,0.1517 180 | 17.9,0.150944 181 | 18,0.150941 182 | 18.1,0.150534 183 | 18.2,0.150527 184 | 18.3,0.149713 185 | 18.4,0.149701 186 | 18.5,0.148579 187 | 18.6,0.148568 188 | 18.7,0.147362 189 | 18.8,0.147358 190 | 18.9,0.147339 191 | 19,0.147338 192 | 19.1,0.147305 193 | 19.2,0.147303 194 | 19.3,0.146528 195 | 19.4,0.146525 196 | 19.5,0.146074 197 | 19.6,0.146072 198 | 19.7,0.146019 199 | 19.8,0.146013 200 | 19.9,0.145217 201 | 20,0.145211 202 | 20.1,0.144929 203 | 20.2,0.144927 204 | 20.3,0.144303 205 | 20.4,0.144301 206 | 20.5,0.144255 207 | 20.6,0.144253 208 | 20.7,0.141091 209 | 20.8,0.14109 210 | 20.9,0.140808 211 | 21,0.140804 212 | 21.1,0.140755 213 | 21.2,0.140754 214 | 21.3,0.140496 215 | 21.4,0.140485 216 | 21.5,0.137474 217 | 21.6,0.137461 218 | 21.7,0.137346 219 | 21.8,0.137341 220 | 21.9,0.134959 221 | 22,0.134957 222 | 22.1,0.133991 223 | 22.2,0.133977 224 | 22.3,0.133142 225 | 22.4,0.133134 226 | 22.5,0.132774 227 | 22.6,0.132771 228 | 22.7001,0.131719 229 | 22.8001,0.131712 230 | 22.9001,0.131556 231 | 23.0001,0.131543 232 | 23.1001,0.130159 233 | 23.2001,0.130152 234 | 23.3001,0.130003 235 | 23.4001,0.129994 236 | 23.5001,0.129991 237 | 23.6001,0.129983 238 | 23.7001,0.127873 239 | 23.8001,0.127866 240 | 23.9001,0.126246 241 | 24.0001,0.126237 242 | 24.1001,0.125898 243 | 24.2001,0.125895 244 | 24.3001,0.12585 245 | 24.4001,0.125849 246 | 24.5001,0.125532 247 | 24.6001,0.125524 248 | 24.7001,0.124884 249 | 24.8001,0.124878 250 | 24.9001,0.12354 251 | 25.0001,0.12354 252 | 25.1001,0.122318 253 | 25.2001,0.122318 254 | 25.3001,0.122051 255 | 25.4001,0.122049 256 | 25.5001,0.122017 257 | 25.6001,0.122015 258 | 25.7001,0.117554 259 | 25.8001,0.117549 260 | 25.9001,0.117329 261 | 26.0001,0.117323 262 | 26.1001,0.116566 263 | 26.2001,0.116559 264 | 26.3001,0.115383 265 | 26.4001,0.115372 266 | 26.5001,0.114652 267 | 26.6001,0.114639 268 | 26.7001,0.114451 269 | 26.8001,0.114448 270 | 26.9001,0.109572 271 | 27.0001,0.109564 272 | 27.1001,0.109559 273 | 27.2001,0.109557 274 | 27.3001,0.109338 275 | 27.4001,0.109332 276 | 27.5001,0.109256 277 | 27.6001,0.109249 278 | 27.7001,0.109016 279 | 27.8001,0.10901 280 | 27.9001,0.108081 281 | 28.0001,0.108079 282 | 28.1001,0.10651 283 | 28.2001,0.106509 284 | 28.3001,0.10622 285 | 28.4001,0.10621 286 | 28.5001,0.105975 287 | 28.6001,0.105975 288 | 28.7001,0.104468 289 | 28.8001,0.104461 290 | 28.9001,0.103125 291 | 29.0001,0.103124 292 | 29.1001,0.102582 293 | 29.2001,0.102579 294 | 29.3001,0.102283 295 | 29.4001,0.102281 296 | 29.5001,0.102136 297 | 29.6001,0.102135 298 | 29.7001,0.102022 299 | 29.8001,0.102021 300 | 29.9001,0.100457 301 | 30.0001,0.100448 302 | 30.1001,0.100296 303 | 30.2001,0.100295 304 | 30.3001,0.098767 305 | 30.4001,0.0987664 306 | 30.5001,0.0985834 307 | 30.6001,0.0985814 308 | 30.7001,0.0984359 309 | 30.8001,0.0984301 310 | 30.9001,0.097752 311 | 31.0001,0.0977443 312 | 31.1001,0.0976843 313 | 31.2001,0.0976727 314 | 31.3001,0.0967201 315 | 31.4001,0.0967188 316 | 31.5001,0.0960487 317 | 31.6001,0.0960451 318 | 31.7001,0.0919074 319 | 31.8001,0.0919017 320 | 31.9001,0.0913001 321 | 32.0001,0.0912956 322 | 32.1001,0.0883188 323 | 32.2001,0.0883131 324 | 32.3001,0.0879256 325 | 32.4001,0.0879197 326 | 32.5001,0.0876911 327 | 32.6001,0.087683 328 | 32.7001,0.087242 329 | 32.8001,0.0872335 330 | 32.9001,0.0871797 331 | 33.0001,0.0871723 332 | 33.1001,0.0868632 333 | 33.2001,0.0868622 334 | 33.3001,0.0867202 335 | 33.4001,0.0867186 336 | 33.5001,0.0855669 337 | 33.6001,0.0855558 338 | 33.7001,0.0849117 339 | 33.8001,0.0849084 340 | 33.9001,0.0844994 341 | 34.0001,0.0844948 342 | 34.1001,0.0842472 343 | 34.2001,0.0842283 344 | 34.3,0.0840842 345 | 34.4,0.084061 346 | 34.5,0.0836749 347 | 34.6,0.0836743 348 | 34.7,0.0835375 349 | 34.8,0.0835349 350 | 34.9,0.0828055 351 | 35,0.0828005 352 | 35.1,0.0823252 353 | 35.2,0.0823247 354 | 35.3,0.0801381 355 | 35.4,0.0801318 356 | 35.5,0.079535 357 | 35.6,0.0795335 358 | 35.7,0.0791937 359 | 35.8,0.0791907 360 | 35.9,0.0786233 361 | 36,0.0786131 362 | 36.1,0.0763938 363 | 36.2,0.076388 364 | 36.3,0.0761327 365 | 36.4,0.0761205 366 | 36.5,0.0754232 367 | 36.6,0.0754187 368 | 36.7,0.0745199 369 | 36.8,0.0745117 370 | 36.9,0.0744136 371 | 37,0.0744033 372 | 37.1,0.0738104 373 | 37.2,0.0738013 374 | 37.3,0.0733833 375 | 37.4,0.0733786 376 | 37.5,0.0731549 377 | 37.6,0.0731549 378 | 37.7,0.073109 379 | 37.8,0.0730958 380 | 37.9,0.0706824 381 | 38,0.0706793 382 | 38.1,0.0703692 383 | 38.2,0.0703576 384 | 38.3,0.0694767 385 | 38.4,0.0694729 386 | 38.5,0.068995 387 | 38.6,0.0689816 388 | 38.7,0.0688656 389 | 38.8,0.0688528 390 | 38.9,0.0687312 391 | 39,0.0687293 392 | 39.1,0.0687125 393 | 39.2,0.06871 394 | 39.3,0.0685615 395 | 39.4,0.0685545 396 | 39.5,0.0683139 397 | 39.6,0.0682856 398 | 39.7,0.0678626 399 | 39.8,0.0678575 400 | 39.9,0.0660036 401 | 40,0.0660006 402 | 40.1,0.0657516 403 | 40.2,0.0657393 404 | 40.3,0.0645107 405 | 40.4,0.0644994 406 | 40.5,0.0640643 407 | 40.6,0.0640628 408 | 40.7,0.0632148 409 | 40.7999,0.0632128 410 | 40.8999,0.0622993 411 | 40.9999,0.0622989 412 | 41.0999,0.0622262 413 | 41.1999,0.0622249 414 | 41.2999,0.0620521 415 | 41.3999,0.0620499 416 | 41.4999,0.0617689 417 | 41.5999,0.0617668 418 | 41.6999,0.0611442 419 | 41.7999,0.0611421 420 | 41.8999,0.0604058 421 | 41.9999,0.0603948 422 | 42.0999,0.0600466 423 | 42.1999,0.0600338 424 | 42.2999,0.0598332 425 | 42.3999,0.0598173 426 | 42.4999,0.05884 427 | 42.5999,0.0588374 428 | 42.6999,0.0586943 429 | 42.7999,0.0586865 430 | 42.8999,0.0581281 431 | 42.9999,0.0581071 432 | 43.0999,0.0544522 433 | 43.1999,0.0544451 434 | 43.2999,0.0543765 435 | 43.3999,0.054376 436 | 43.4999,0.053581 437 | 43.5999,0.0535737 438 | 43.6999,0.0533384 439 | 43.7999,0.0533342 440 | 43.8999,0.0520436 441 | 43.9999,0.0520317 442 | 44.0999,0.0520096 443 | 44.1999,0.0520052 444 | 44.2999,0.0511105 445 | 44.3999,0.0510997 446 | 44.4999,0.0497504 447 | 44.5999,0.0497497 448 | 44.6999,0.049461 449 | 44.7999,0.0494479 450 | 44.8999,0.0492063 451 | 44.9999,0.0491984 452 | 45.0999,0.0484681 453 | 45.1999,0.0484679 454 | 45.2999,0.0475386 455 | 45.3999,0.0475346 456 | 45.4999,0.0473134 457 | 45.5999,0.0473047 458 | 45.6999,0.0470057 459 | 45.7999,0.0470051 460 | 45.8999,0.0468772 461 | 45.9999,0.0468658 462 | 46.0999,0.0463621 463 | 46.1999,0.0463559 464 | 46.2999,0.0454407 465 | 46.3999,0.0454181 466 | 46.4999,0.0446578 467 | 46.5999,0.0446468 468 | 46.6999,0.0438307 469 | 46.7999,0.04383 470 | 46.8999,0.0426226 471 | 46.9999,0.0426146 472 | 47.0999,0.0425475 473 | 47.1999,0.0425466 474 | 47.2999,0.0423288 475 | 47.3998,0.0423235 476 | 47.4998,0.0422754 477 | 47.5998,0.0422719 478 | 47.6998,0.0421121 479 | 47.7998,0.0421107 480 | 47.8998,0.0420978 481 | 47.9998,0.0420857 482 | 48.0998,0.0420523 483 | 48.1998,0.0420364 484 | 48.2998,0.0418107 485 | 48.3998,0.0418096 486 | 48.4998,0.0408038 487 | 48.5998,0.0407988 488 | 48.6998,0.0406367 489 | 48.7998,0.040628 490 | 48.8998,0.0401933 491 | 48.9998,0.04019 492 | 49.0998,0.0395709 493 | 49.1998,0.0395627 494 | 49.2998,0.0385177 495 | 49.3998,0.0385158 496 | 49.4998,0.0382837 497 | 49.5998,0.0382767 498 | 49.6998,0.0382742 499 | 49.7998,0.0382723 500 | 49.8998,0.0378935 501 | 49.9998,0.0378927 502 | 50.0998,0.0373203 503 | 50.1998,0.0373178 504 | 50.2998,0.0369136 505 | 50.3998,0.0369114 506 | 50.4998,0.0368132 507 | 50.5998,0.0368117 508 | 50.6998,0.0366582 509 | 50.7998,0.0366494 510 | 50.8998,0.0358207 511 | 50.9998,0.035816 512 | 51.0998,0.0357776 513 | 51.1998,0.0357774 514 | 51.2998,0.035358 515 | 51.3998,0.0353543 516 | 51.4998,0.0352977 517 | 51.5998,0.0352949 518 | 51.6998,0.0350069 519 | 51.7998,0.0350023 520 | 51.8998,0.0341074 521 | 51.9998,0.0341067 522 | 52.0998,0.0336385 523 | 52.1998,0.0336377 524 | 52.2998,0.0336298 525 | 52.3998,0.033617 526 | 52.4998,0.0334539 527 | 52.5998,0.0334528 528 | 52.6998,0.0332087 529 | 52.7998,0.0331991 530 | 52.8998,0.033 531 | 52.9998,0.0329951 532 | 53.0998,0.0327934 533 | 53.1998,0.0327878 534 | 53.2998,0.0326956 535 | 53.3998,0.0326909 536 | 53.4998,0.0320656 537 | 53.5998,0.0320601 538 | 53.6998,0.031617 539 | 53.7998,0.031615 540 | 53.8997,0.030978 541 | 53.9997,0.0309769 542 | 54.0997,0.0303577 543 | 54.1997,0.0303558 544 | 54.2997,0.0303496 545 | 54.3997,0.030343 546 | 54.4997,0.0302306 547 | 54.5997,0.030226 548 | 54.6997,0.0301209 549 | 54.7997,0.0301179 550 | 54.8997,0.0294189 551 | 54.9997,0.029418 552 | 55.0997,0.029204 553 | 55.1997,0.0291961 554 | 55.2997,0.0290369 555 | 55.3997,0.0290262 556 | 55.4997,0.0280206 557 | 55.5997,0.0280106 558 | 55.6997,0.0279326 559 | 55.7997,0.0279247 560 | 55.8997,0.0275781 561 | 55.9997,0.0275746 562 | 56.0997,0.0271925 563 | 56.1997,0.027186 564 | 56.2997,0.0270927 565 | 56.3997,0.027091 566 | 56.4997,0.0257535 567 | 56.5997,0.0257469 568 | 56.6997,0.0257435 569 | 56.7997,0.025738 570 | 56.8997,0.0242947 571 | 56.9997,0.0242856 572 | 57.0997,0.0234776 573 | 57.1997,0.0234774 574 | 57.2997,0.0227107 575 | 57.3997,0.0227085 576 | 57.4997,0.0219745 577 | 57.5997,0.0219738 578 | 57.6997,0.0212577 579 | 57.7997,0.0212531 580 | 57.8997,0.0198378 581 | 57.9997,0.0198333 582 | 58.0997,0.0195565 583 | 58.1997,0.0195463 584 | 58.2997,0.0189516 585 | 58.3997,0.0189455 586 | 58.4997,0.0184107 587 | 58.5997,0.0184069 588 | 58.6997,0.0179094 589 | 58.7997,0.017904 590 | 58.8997,0.0177536 591 | 58.9997,0.0177497 592 | 59.0997,0.0171924 593 | 59.1997,0.0171894 594 | 59.2997,0.0169758 595 | 59.3997,0.0169675 596 | 59.4997,0.0167435 597 | 59.5997,0.016739 598 | 59.6997,0.0159868 599 | 59.7997,0.0159808 600 | 59.8997,0.0158162 601 | 59.9997,0.0158148 602 | 60.0997,0.0152879 603 | 60.1997,0.0152791 604 | 60.2997,0.0146769 605 | 60.3997,0.0146755 606 | 60.4996,0.013744 607 | 60.5996,0.013741 608 | 60.6996,0.0137401 609 | 60.7996,0.0137383 610 | 60.8996,0.0122809 611 | 60.9996,0.0122726 612 | 61.0996,0.0121265 613 | 61.1996,0.0121232 614 | 61.2996,0.0120231 615 | 61.3996,0.0120208 616 | 61.4996,0.011866 617 | 61.5996,0.0118637 618 | 61.6996,0.0116243 619 | 61.7996,0.0116201 620 | 61.8996,0.00976367 621 | 61.9996,0.00976249 622 | 62.0996,0.0086318 623 | 62.1996,0.00862756 624 | 62.2996,0.00541889 625 | 62.3996,0.00541752 626 | 62.4996,0.00150267 627 | 62.5996,0.00149874 628 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/ValuesPSF.csv: -------------------------------------------------------------------------------- 1 | -40.7811,0 2 | -39.6188,0 3 | -38.8527,0.0105872 4 | -38.2443,0.00481225 5 | -37.6967,0.0240616 6 | -37.2308,0.00288727 7 | -36.7807,0.0192494 8 | -36.3893,0.0125121 9 | -36.0073,0.000962303 10 | -35.6456,0.0202117 11 | -35.3182,0.0134744 12 | -34.9907,0.0173244 13 | -34.6773,0.0134744 14 | -34.3906,0.00962486 15 | -34.104,0.00192497 16 | -33.8195,0.000962303 17 | -33.558,0.0115498 18 | -33.3033,0.00962449 19 | -33.0492,0.0163621 20 | -32.7971,0.0125118 21 | -32.5629,0.00866219 22 | -32.3354,0.00577492 23 | -32.1044,0.0105872 24 | -31.8769,0.0105872 25 | -31.6589,0.00288764 26 | -31.4509,0.00577455 27 | -31.2434,0.00866219 28 | -31.0343,0.00577492 29 | -30.8262,0.017324 30 | -30.6318,0.0105872 31 | -30.441,0.00962449 32 | -30.2499,0.0115495 33 | -30.0591,0.0125121 34 | -29.868,0.0153994 35 | -29.6859,0.0105872 36 | -29.5094,0.00769989 37 | -29.3333,0.00481225 38 | -29.1568,0.00096267 39 | -28.9807,0.000962303 40 | -28.8056,0.00481261 41 | -28.6401,0.00577492 42 | -28.4766,0.00481261 43 | -28.3125,0.00288764 44 | -28.149,0.0115495 45 | -27.9851,0.00866219 46 | -27.8221,0.0173244 47 | -27.6674,0.0105872 48 | -27.5148,0.00866219 49 | -27.3616,0.00673722 50 | -27.209,0.00384994 51 | -27.0564,0.00673722 52 | -26.9031,0.00481261 53 | -26.754,0.0221366 54 | -26.611,0.00866219 55 | -26.467,0.00962449 56 | -26.3248,0.00288727 57 | -26.1804,0.00673722 58 | -26.0382,0.00192497 59 | -25.8943,0.0173244 60 | -25.7547,0.00866219 61 | -25.6196,0.0105872 62 | -25.4854,0 63 | -25.3498,0.00866219 64 | -25.216,0.000962303 65 | -25.0799,0.0134744 66 | -24.9463,0.000962303 67 | -24.8111,0.00962486 68 | -24.6846,0.00577492 69 | -24.5558,0.00866219 70 | -24.4291,0.00288764 71 | -24.3022,0.00288727 72 | -24.1737,0.00769989 73 | -24.0477,0 74 | -23.9192,0.00288727 75 | -23.7939,0.00288764 76 | -23.6738,0.0125121 77 | -23.5518,0.00481225 78 | -23.4318,0.0125121 79 | -23.3112,0.0134744 80 | -23.1828,0.00673722 81 | -23.057,0.0134744 82 | -22.9287,0.00192497 83 | -22.8028,0.00192461 84 | -22.6828,0.00288764 85 | -22.5611,0.00288727 86 | -22.4407,0.00384958 87 | -22.3203,0.0153994 88 | -22.1922,0.00384958 89 | -22.066,0.00769952 90 | -21.9386,0.00192497 91 | -21.8117,0.00673722 92 | -21.6918,0.0153994 93 | -21.5702,0.00192497 94 | -21.4496,0.0230993 95 | -21.3296,0.00866219 96 | -21.2016,0.00673722 97 | -21.075,0.00577492 98 | -20.9481,0.00192497 99 | -20.8206,0 100 | -20.7007,0.00288727 101 | -20.5796,0.00481225 102 | -20.4585,0.00769952 103 | -20.3386,0.00866219 104 | -20.2111,0.00577492 105 | -20.0842,0.00192497 106 | -19.9576,0.0153994 107 | -19.8296,0.00096267 108 | -19.7096,0.0134744 109 | -19.589,0.00673722 110 | -19.4674,0.00866219 111 | -19.3476,0.00673722 112 | -19.2206,0.0105872 113 | -19.0932,0.00384994 114 | -18.967,0 115 | -18.839,0.00192497 116 | -18.7185,0.00192497 117 | -18.5981,0.00192497 118 | -18.4764,0.000962303 119 | -18.3565,0.00481225 120 | -18.2305,0.00769989 121 | -18.1022,0.00192497 122 | -17.9764,0.00288764 123 | -17.848,0.0163617 124 | -17.7274,0.00481225 125 | -17.6074,0.00384994 126 | -17.4854,0.0192494 127 | -17.3654,0.00384994 128 | -17.24,0.00769989 129 | -17.1115,0.00962449 130 | -16.9855,0.00192461 131 | -16.8575,0.0192494 132 | -16.7363,0.00288764 133 | -16.6164,0.0163621 134 | -16.4947,0.00866219 135 | -16.3743,0.00288727 136 | -16.2495,0.00962486 137 | -16.1206,0.00288764 138 | -15.9948,0 139 | -15.8669,0.0125121 140 | -15.7452,0.00577455 141 | -15.6254,0.0105872 142 | -15.5038,0.0115495 143 | -15.3832,0.00962486 144 | -15.2589,0.00962449 145 | -15.13,0.0192494 146 | -15.0038,0.00962449 147 | -14.8764,0.0163617 148 | -14.7542,0.00962449 149 | -14.6343,0.0163617 150 | -14.5132,0.00481225 151 | -14.3921,0.0144371 152 | -14.2683,0.00481225 153 | -14.1394,0.00962486 154 | -14.0128,0.0153994 155 | -13.8859,0.0134744 156 | -13.7631,0.0105872 157 | -13.6432,0.00481225 158 | -13.5226,0.00288727 159 | -13.401,0.00673722 160 | -13.2774,0.00866219 161 | -13.1489,0.00192497 162 | -13.022,0.00096267 163 | -12.8954,0.00769952 164 | -12.772,0.00192497 165 | -12.6521,0.00866219 166 | -12.5317,0.00288727 167 | -12.41,0.00481225 168 | -12.2867,0.00481225 169 | -12.1584,0.00577455 170 | -12.031,0.0144367 171 | -11.9048,0 172 | -11.7809,0.00384994 173 | -11.661,0.00384994 174 | -11.541,0.00962449 175 | -11.419,0.00192497 176 | -11.2957,0.00192497 177 | -11.1683,0.00481225 178 | -11.04,0.00384994 179 | -10.9142,0.00577492 180 | -10.7899,0.00866219 181 | -10.6699,0.00288727 182 | -10.55,0.0125121 183 | -10.4283,0.00288727 184 | -10.3047,0.0144371 185 | -10.1778,0.00384958 186 | -10.0493,0.00769989 187 | -9.92327,0.0163617 188 | -9.79926,0.00192497 189 | -9.67883,0.0211743 190 | -9.55899,0.00866219 191 | -9.43736,0.0134744 192 | -9.31395,0.00866219 193 | -9.18729,0.00769952 194 | -9.05841,0.000962303 195 | -8.93261,0.00866219 196 | -8.80834,0.00577455 197 | -8.68773,0.00866219 198 | -8.56789,0.00866219 199 | -8.44678,0.00673722 200 | -8.32294,0.00288727 201 | -8.1967,0.00866219 202 | -8.06783,0.00288727 203 | -7.94159,0.00192497 204 | -7.81775,0.0115495 205 | -7.69664,0.00866219 206 | -7.5768,0.0182867 207 | -7.4562,0.000962303 208 | -7.33193,0.0173244 209 | -7.20612,0.0163617 210 | -7.07724,0.00192497 211 | -6.95058,0.00577492 212 | -6.82717,0.00577455 213 | -6.70554,0.00384958 214 | -6.5857,0.00962486 215 | -6.46527,0.00096267 216 | -6.34126,0.00192497 217 | -6.21519,0.00192497 218 | -6.08674,0.00673722 219 | -5.95983,0 220 | -5.83624,0.00769952 221 | -5.71453,0.000962303 222 | -5.59461,0.00192461 223 | -5.4746,0.00384994 224 | -5.35033,0.00769952 225 | -5.22452,0.00481261 226 | -5.09624,0.00962449 227 | -4.96882,0.00288764 228 | -4.84557,0.00192497 229 | -4.72352,0.00096267 230 | -4.60351,0.00866219 231 | -4.48359,0.00577455 232 | -4.35975,0.0221366 233 | -4.23351,0.00962449 234 | -4.10609,0.00769989 235 | -3.9778,0.00096267 236 | -3.85456,0.00384994 237 | -3.73285,0.00769989 238 | -3.61241,0.00577492 239 | -3.49257,0.00481225 240 | -3.36916,0.0115498 241 | -3.2425,0.00288727 242 | -3.11559,0.00866219 243 | -2.98714,0.00192497 244 | -2.86355,0.00577455 245 | -2.74192,0 246 | -2.62132,0.00866219 247 | -2.50148,0.00866219 248 | -2.37866,0.00673722 249 | -2.25175,0.000962303 250 | -2.12509,0.00866219 251 | -1.99621,0.020212 252 | -1.87245,0.00769952 253 | -1.75134,0.00769989 254 | -1.63022,0.00769989 255 | -1.51038,0.00192497 256 | -1.38816,0.0211743 257 | -1.26074,0.0153994 258 | -1.1345,0.00384994 259 | -1.00562,0.00673722 260 | -0.881354,0.037536 261 | -0.760752,0.0327238 262 | -0.639126,0.0182871 263 | -0.519286,0.041386 264 | -0.39766,0.0895092 265 | -0.269723,0.0769971 266 | -0.143917,0.341675 267 | -0.0245062,0.814245 268 | 0,0.565929 269 | 0,0.000962486 270 | 0,0.0567854 271 | 0,0.0606353 272 | 0,0 273 | 0,0.0240616 274 | 0,0.291627 275 | 0.00762127,0.80847 276 | 0.10505,0.373436 277 | 0.225057,0.128008 278 | 0.347112,0.109721 279 | 0.470524,0.114533 280 | 0.62361,0.510106 281 | 1.16011,1 282 | 1.79906,0.619827 283 | 1.9594,0.101059 284 | 2.09193,0.117421 285 | 2.21186,0.133782 286 | 2.33357,0.0895092 287 | 2.454,0.0943214 288 | 2.57444,0.0895092 289 | 2.70246,0.068335 290 | 2.82869,0.041386 291 | 2.95612,0.0153994 292 | 3.08303,0.0259864 293 | 3.20287,0.0269491 294 | 3.3245,0.00192497 295 | 3.4451,0.00866219 296 | 3.5651,0.0317613 297 | 3.69304,0.00577473 298 | 3.81971,0.0240616 299 | 3.94662,0.0221366 300 | 4.07404,0.00577473 301 | 4.19397,0.00962449 302 | 4.31508,0 303 | 4.43619,0.00288727 304 | 4.55612,0.00577473 305 | 4.68354,0 306 | 4.81045,0.0240616 307 | 4.93712,0.0279115 308 | 5.06505,0.00288746 309 | 5.18506,0.0125121 310 | 5.30566,0.000962486 311 | 5.42729,0.0105872 312 | 5.54713,0 313 | 5.67404,0.0211741 314 | 5.80147,0.0115495 315 | 5.9277,0.00481225 316 | 6.05572,0.00673722 317 | 6.17616,0.000962486 318 | 6.29659,0.000962486 319 | 6.4183,0.00577473 320 | 6.53822,0.00673722 321 | 6.6642,0.00192497 322 | 6.79248,0.000962486 323 | 6.91829,0.0153994 324 | 7.04665,0.00192497 325 | 7.16725,0.00288746 326 | 7.28726,0.0173244 327 | 7.40932,0.000962486 328 | 7.52932,0.0173244 329 | 7.6547,0.00769971 330 | 7.78315,0.00769971 331 | 7.90921,0.0144369 332 | 8.03723,0.000962486 333 | 8.15835,0.00481225 334 | 8.27827,0.00192497 335 | 8.39998,0.00866219 336 | 8.52042,0.000962486 337 | 8.6452,0.00481225 338 | 8.77408,0 339 | 8.89988,0.00192497 340 | 9.02782,0.00866219 341 | 9.14944,0.012512 342 | 9.26929,0.00673722 343 | 9.39091,0.00962468 344 | 9.51151,0.000962486 345 | 9.63578,0.000962486 346 | 9.76466,0.00962468 347 | 9.89089,0.00577492 348 | 10.0183,0.00384994 349 | 10.1405,0 350 | 10.2604,0.0202117 351 | 10.3815,0.00769971 352 | 10.5026,0.012512 353 | 10.6264,0.0115495 354 | 10.7552,0.00192497 355 | 10.8819,0.00288746 356 | 11.0088,0.0125121 357 | 11.1316,0.0144369 358 | 11.2515,0.0221366 359 | 11.3721,0.00769971 360 | 11.4937,0.00673722 361 | 11.6173,0.000962486 362 | 11.7457,0.00962468 363 | 11.8727,0.00866201 364 | 11.9993,0 365 | 12.1227,0.0144369 366 | 12.2426,0.0125121 367 | 12.363,0.00288746 368 | 12.4847,0.00577473 369 | 12.608,0.0115495 370 | 12.7362,0.00384994 371 | 12.8637,0.00384994 372 | 12.9899,0.00769971 373 | 13.1137,0.012512 374 | 13.2337,0.00384976 375 | 13.3537,0.000962486 376 | 13.4757,0.000962303 377 | 13.599,0.0144369 378 | 13.7264,0.00384994 379 | 13.8547,0.00769971 380 | 13.9805,0.00481225 381 | 14.1048,0.00577473 382 | 14.2248,0.00962449 383 | 14.3447,0.00769971 384 | 14.4664,0.00577473 385 | 14.59,0.00384994 386 | 14.7169,0.00866219 387 | 14.8454,0.00384976 388 | 14.9714,0.00673722 389 | 15.0954,0.00192479 390 | 15.2159,0.00673722 391 | 15.3357,0.000962486 392 | 15.4573,0.0105872 393 | 15.5807,0 394 | 15.7074,0.0163619 395 | 15.8363,0.00288746 396 | 15.9621,0.000962486 397 | 16.0864,0 398 | 16.207,0.00769971 399 | 16.3268,0.00866219 400 | 16.4479,0.0153994 401 | 16.5718,0.00769971 402 | 16.698,0.0134744 403 | 16.8269,0.00384994 404 | 16.9531,0.00577473 405 | 17.0769,0.00866219 406 | 17.1981,0.000962486 407 | 17.3179,0.0134746 408 | 17.4385,0.00192497 409 | 17.5628,0.00866219 410 | 17.6886,0.00577473 411 | 17.8174,0.00769971 412 | 17.9441,0.00577473 413 | 18.0675,0.00288746 414 | 18.1891,0.00481225 415 | 18.309,0.00577473 416 | 18.4294,0.00962468 417 | 18.5534,0.00769971 418 | 18.6795,0.00192497 419 | 18.8079,0.00962468 420 | 18.9349,0.00192497 421 | 19.0585,0.00481243 422 | 19.1802,0.00481243 423 | 19.3001,0.0067374 424 | 19.4201,0.00866219 425 | 19.5444,0.00769971 426 | 19.6702,0.00769971 427 | 19.7984,0.012512 428 | 19.9259,0.00288746 429 | 20.0491,0.0144369 430 | 20.1712,0.00866219 431 | 20.2912,0.00288727 432 | 20.4111,0.00866219 433 | 20.5349,0.000962486 434 | 20.6612,0 435 | 20.7886,0.00384976 436 | 20.9169,0.00288746 437 | 21.0401,0.00769971 438 | 21.1618,0.00192497 439 | 21.2823,0.000962486 440 | 21.4021,0.00192497 441 | 21.5255,0.0153994 442 | 21.6522,0.00769971 443 | 21.7791,0.0202118 444 | 21.9076,0.0134744 445 | 22.0311,0.0134746 446 | 22.1528,0 447 | 22.2734,0.00577473 448 | 22.3932,0.00384994 449 | 22.516,0.00481225 450 | 22.6429,0.00481225 451 | 22.7696,0.000962486 452 | 22.8985,0.00577473 453 | 23.0222,0.00866219 454 | 23.1434,0.00192497 455 | 23.2645,0.00962468 456 | 23.3843,0.000962486 457 | 23.5065,0.0153994 458 | 23.634,0.00962468 459 | 23.7602,0.00577473 460 | 23.8891,0.00481243 461 | 24.0133,0.00577473 462 | 24.1339,0.00481243 463 | 24.2556,0.0115497 464 | 24.3754,0.00481243 465 | 24.497,0.00962468 466 | 24.625,0.0134744 467 | 24.7508,0.00866219 468 | 24.8797,0.00673722 469 | 25.0044,0.00577473 470 | 25.1249,0.012512 471 | 25.2466,0.0115495 472 | 25.3665,0.0182869 473 | 25.4876,0.00577473 474 | 25.6156,0.0173244 475 | 25.7417,0.00577473 476 | 25.8702,0.00866219 477 | 25.9955,0.00192497 478 | 26.1155,0.00866219 479 | 26.2376,0.0134744 480 | 26.3576,0.00673722 481 | 26.4782,0.012512 482 | 26.6066,0.00288746 483 | 26.7324,0 484 | 26.8607,0.00288746 485 | 26.9866,0 486 | 27.1065,0.00288746 487 | 27.2283,0.0115495 488 | 27.3487,0.00192497 489 | 27.4691,0.00288727 490 | 27.5972,0.00384976 491 | 27.7234,0.00673722 492 | 27.8508,0.00769971 493 | 27.9777,0.00192479 494 | 28.0976,0.0134746 495 | 28.2192,0.00288727 496 | 28.3398,0.000962486 497 | 28.4598,0.00288727 498 | 28.5877,0.00866219 499 | 28.7144,0.010587 500 | 28.8413,0.000962486 501 | 28.9687,0.0221366 502 | 29.0887,0.00673722 503 | 29.2098,0.0163619 504 | 29.3309,0.00577473 505 | 29.4508,0.00288746 506 | 29.5782,0.00962449 507 | 29.7051,0.00769971 508 | 29.8318,0.0192492 509 | 29.9597,0.00384994 510 | 30.0798,0.0221366 511 | 30.2004,0.000962486 512 | 30.322,0.00384994 513 | 30.4418,0.0105872 514 | 30.5687,0.000962486 515 | 30.6962,0.0115497 516 | 30.8224,0.0115495 517 | 30.9504,0.00673722 518 | 31.0709,0.00866219 519 | 31.1913,0.0230991 520 | 31.313,0.010587 521 | 31.4329,0.00673722 522 | 31.5589,0.000962486 523 | 31.6872,0.000962486 524 | 31.813,0.0298363 525 | 31.9413,0.0173244 526 | 32.0619,0.00577473 527 | 32.1819,0.0192494 528 | 32.304,0.0125121 529 | 32.424,0.00962468 530 | 32.5494,0.00577473 531 | 32.6778,0.00866219 532 | 32.8039,0.0173244 533 | 32.9319,0.00866219 534 | 33.053,0.000962486 535 | 33.173,0.00288746 536 | 33.2947,0.00673722 537 | 33.4151,0.00192497 538 | 33.5399,0.0144369 539 | 33.6688,0.00673722 540 | 33.7946,0.012512 541 | 33.9225,0.00577473 542 | 34.0441,0.000962486 543 | 34.164,0.00288746 544 | 34.2856,0.000962486 545 | 34.4062,0.00866219 546 | 34.5305,0.00769971 547 | 34.6594,0.00384976 548 | 34.7856,0.00481243 549 | 34.913,0.000962486 550 | 35.0352,0.00288727 551 | 35.1551,0.000962486 552 | 35.2762,0.00962468 553 | 35.3973,0.00481243 554 | 35.5211,0.00962468 555 | 35.6499,0.00769971 556 | 35.7766,0.00288727 557 | 35.9035,0.00192497 558 | 36.032,0.00288746 559 | 36.158,0.00866219 560 | 36.2865,0.000962486 561 | 36.4134,0.0115495 562 | 36.547,0.00577473 563 | 36.6821,0.00962449 564 | 36.8164,0.000962303 565 | 36.952,0.0144369 566 | 37.0858,0.000962303 567 | 37.2219,0.00384994 568 | 37.3554,0.00577492 569 | 37.495,0.00288746 570 | 37.638,0.000962486 571 | 37.7811,0.00769971 572 | 37.925,0.000962486 573 | 38.0673,0.00673722 574 | 38.2117,0.00769971 575 | 38.3538,0.0134744 576 | 38.5026,0.0250241 577 | 38.6556,0.00288727 578 | 38.8078,0.0307988 579 | 38.9611,0.0173244 580 | 39.114,0.00866219 581 | 39.2663,0.0221366 582 | 39.4207,0.0250241 583 | 39.5831,0.0173244 584 | 39.7466,0.028874 585 | 39.9107,0.0346488 586 | 40.0742,0.00673722 587 | 40.2381,0.0259866 588 | 40.4027,0.00769971 589 | 40.5768,0.00192497 590 | 40.7533,0.00673722 591 | 40.9294,0.0346488 592 | 41.1059,0.0125121 593 | 41.2825,0.0192494 594 | 41.4624,0.0163619 595 | 41.6536,0.012512 596 | 41.8448,0.00673722 597 | 42.0356,0.0192494 598 | 42.2268,0.00481225 599 | 42.4202,0.0115497 600 | 42.6262,0.0115495 601 | 42.8352,0.000962486 602 | 43.0443,0.0115495 603 | 43.2518,0.0115495 604 | 43.4661,0.00288746 605 | 43.6957,0.012512 606 | 43.9242,0.00577473 607 | 44.1541,0.0105872 608 | 44.3853,0.00577473 609 | 44.6353,0.000962486 610 | 44.8905,0.00384976 611 | 45.1456,0.00192497 612 | 45.404,0.000962486 613 | 45.687,0.00481225 614 | 45.9736,0.00577473 615 | 46.2602,0.00481243 616 | 46.5689,0.0105872 617 | 46.8964,0.00577473 618 | 47.2239,0.0125121 619 | 47.5787,0.00192479 620 | 47.9606,0.00192497 621 | 48.349,0.0134746 622 | 48.7934,0.010587 623 | 49.2544,0.0192494 624 | 49.7926,0.00962468 625 | 50.3895,0.00577473 626 | 51.1341,0.0105872 627 | 52.2089,0 628 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/h_edge.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/h_edge.tif -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/h_edge_mono.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/h_edge_mono.tif -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Assert.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Assert.hpp" 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | namespace Core { 31 | namespace Intern { 32 | class AssertionFailureBase : public Exception { 33 | std::string _file; 34 | int _line; 35 | std::string _additionalMessage; 36 | 37 | public: 38 | AssertionFailureBase (std::string file, int line, std::string additionalMessage) : _file (file), _line (line), _additionalMessage (additionalMessage) {} 39 | ~AssertionFailureBase () throw () {} 40 | 41 | const std::string& file () const { 42 | return _file; 43 | } 44 | 45 | int line () const { 46 | return _line; 47 | } 48 | 49 | const std::string& additionalMessage () const { 50 | return _additionalMessage; 51 | } 52 | }; 53 | 54 | class AssertionFailure : public AssertionFailureBase { 55 | std::string _condition; 56 | 57 | public: 58 | AssertionFailure (std::string file, int line, std::string condition, std::string additionalMessage) : AssertionFailureBase (file, line, additionalMessage), _condition (condition) {} 59 | ~AssertionFailure () throw () {} 60 | 61 | const std::string& condition () const { 62 | return _condition; 63 | } 64 | 65 | virtual std::string message () const { 66 | std::stringstream str; 67 | str << "Assertion `" << condition () << "' failed in " << file () << ":" << line (); 68 | if (additionalMessage () != "") 69 | str << ": `" << additionalMessage () << "'"; 70 | return str.str (); 71 | } 72 | }; 73 | 74 | class AbortCalled : public AssertionFailureBase { 75 | public: 76 | AbortCalled (std::string file, int line, std::string additionalMessage) : AssertionFailureBase (file, line, additionalMessage) {} 77 | ~AbortCalled () throw () {} 78 | 79 | virtual std::string message () const { 80 | std::stringstream str; 81 | str << "Abort called in " << file () << ":" << line (); 82 | if (additionalMessage () != "") 83 | str << ": `" << additionalMessage () << "'"; 84 | return str.str (); 85 | } 86 | }; 87 | 88 | void assertionFailure (const char* file, int line, const char* condition, const std::string& additionalMessage) { 89 | if (condition) 90 | throw AssertionFailure (file, line, condition, additionalMessage); 91 | else 92 | throw AbortCalled (file, line, additionalMessage); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Assert.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_ASSERT_HPP_INCLUDED 24 | #define CORE_ASSERT_HPP_INCLUDED 25 | 26 | // ASSERT(x) and ABORT() macro 27 | // 28 | // These assertions are always enabled. 29 | // 30 | // The versions with _MSG accept a string as second argument. This argument 31 | // will only be evaluated if the assertion fails. 32 | 33 | #include 34 | 35 | #include 36 | 37 | namespace Core { 38 | namespace Intern { 39 | NORETURN assertionFailure (const char* file, int line, const char* condition, const std::string& additionalMessage = ""); 40 | } 41 | 42 | #define ASSERT_STR(condition, conditionStr) do { \ 43 | if (!(condition)) { \ 44 | ::Core::Intern::assertionFailure (__FILE__, __LINE__, conditionStr); \ 45 | } \ 46 | } while (0) 47 | #define ASSERT(condition) ASSERT_STR (condition, #condition) 48 | 49 | #define ASSERT_STR_MSG(condition, conditionStr, additionalMessage) do { \ 50 | if (!(condition)) { \ 51 | ::Core::Intern::assertionFailure (__FILE__, __LINE__, conditionStr, additionalMessage); \ 52 | } \ 53 | } while (0) 54 | #define ASSERT_MSG(condition, additionalMessage) ASSERT_STR_MSG (condition, #condition, additionalMessage) 55 | 56 | #define ABORT() do { \ 57 | ::Core::Intern::assertionFailure (__FILE__, __LINE__, NULL); \ 58 | } while (0) 59 | 60 | #define ABORT_MSG(additionalMessage) do { \ 61 | ::Core::Intern::assertionFailure (__FILE__, __LINE__, NULL, additionalMessage); \ 62 | } while (0) 63 | 64 | } 65 | 66 | #endif // !CORE_ASSERT_HPP_INCLUDED 67 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/CheckedCast.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "CheckedCast.hpp" 24 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/CheckedCast.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_CHECKEDCAST_HPP_INCLUDED 24 | #define CORE_CHECKEDCAST_HPP_INCLUDED 25 | 26 | // Core::checked_cast (value) can be used to cast one integer type (builtin 27 | // or Core::CheckedInteger) to another (builtin or Core::CheckedInteger) 28 | // with a range check. 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | namespace Core { 41 | namespace Intern { 42 | template struct ConversionInfo { 43 | static const bool sourceInt = std::numeric_limits::is_integer; 44 | static const bool sourceSigned = std::numeric_limits::is_signed; 45 | static const U sourceMin = boost::integer_traits::const_min; 46 | static const U sourceMax = boost::integer_traits::const_max; 47 | static const int sourceDigits = std::numeric_limits::digits; 48 | 49 | static const bool targetSigned = std::numeric_limits::is_signed; 50 | static const T targetMin = boost::integer_traits::const_min; 51 | static const T targetMax = boost::integer_traits::const_max; 52 | static const int targetDigits = std::numeric_limits::digits; 53 | 54 | static const bool signedEqual = (sourceSigned && targetSigned) || (!sourceSigned && !targetSigned); 55 | 56 | static const bool isWidening = sourceInt 57 | && ( 58 | // (signedEqual && (targetMin <= sourceMin) && (targetMax >= sourceMax) && ((targetMin < sourceMin) || (targetMax > sourceMax))) 59 | (signedEqual && targetDigits > sourceDigits) 60 | || (targetSigned && !sourceSigned && (targetDigits >= sourceDigits + 1)) 61 | ); 62 | 63 | static const bool isWideningOrEqual = sourceInt 64 | && ( 65 | // (signedEqual && (targetMin <= sourceMin) && (targetMax >= sourceMax) && ((targetMin < sourceMin) || (targetMax > sourceMax))) 66 | (signedEqual && targetDigits >= sourceDigits) 67 | || (targetSigned && !sourceSigned && (targetDigits >= sourceDigits + 1)) 68 | ); 69 | }; 70 | 71 | template NORETURN overflow (From value) { 72 | throw TypedConversionOverflowException (value); 73 | } 74 | 75 | template struct ConverterSameSign { 76 | static inline T convert (U v) { 77 | typedef std::numeric_limits target; 78 | 79 | if (v < target::min () || v > target::max ()) { 80 | overflow (v); 81 | } 82 | return (T) v; 83 | } 84 | }; 85 | 86 | template struct ConverterSU { 87 | static inline T convert (U v) { 88 | typedef std::numeric_limits target; 89 | 90 | if (v < 0 || (typename boost::make_unsigned::type) v > target::max ()) { 91 | overflow (v); 92 | } 93 | 94 | return (T) v; 95 | } 96 | }; 97 | 98 | template struct ConverterUS { 99 | static inline T convert (U v) { 100 | typedef std::numeric_limits target; 101 | 102 | if (v > (typename boost::make_unsigned::type) target::max ()) { 103 | overflow (v); 104 | } 105 | 106 | return (T) v; 107 | } 108 | }; 109 | 110 | // checked_cast int => cint 111 | template struct CheckedConverter { 112 | BOOST_STATIC_ASSERT (std::numeric_limits::is_integer); 113 | BOOST_STATIC_ASSERT (std::numeric_limits::is_integer); 114 | 115 | typedef ConversionInfo Info; 116 | typedef typename boost::mpl::if_c, typename boost::mpl::if_c , ConverterUS >::type >::type Conv; 117 | 118 | static inline To convert (From value) { 119 | return Conv::convert (value); 120 | } 121 | }; 122 | } 123 | 124 | template 125 | inline To checked_cast (From value) { 126 | return Intern::CheckedConverter::convert (value); 127 | } 128 | } 129 | 130 | #endif // !CORE_CHECKEDCAST_HPP_INCLUDED 131 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #if OS_WIN 25 | #define __STDC_WANT_LIB_EXT1__ 1 26 | #include 27 | #endif 28 | 29 | #include "Error.hpp" 30 | 31 | #include 32 | 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | namespace Core { 41 | Error::~Error () throw () { 42 | } 43 | 44 | std::string Error::message () const { 45 | std::stringstream str; 46 | str << function () << ": " << errstr (); 47 | return str.str (); 48 | } 49 | 50 | std::string Error::errnumToString (int errnum) { 51 | std::vector str (8); 52 | 53 | int retval; 54 | #if OS_UNIX 55 | do { 56 | errno = 0; 57 | // http://www.opengroup.org/onlinepubs/9699919799/functions/strerror.html 58 | retval = MY_XSI_strerror_r (errnum, str.data (), str.size ()); 59 | 60 | // linux returns -1 and sets errno 61 | int err2 = errno; 62 | if (retval == -1 && err2 != 0) 63 | retval = err2; 64 | 65 | if (retval == ERANGE) 66 | str.resize (str.size () * 2); 67 | } while (retval == ERANGE); 68 | #elif OS_WIN 69 | //return strerror (errnum); // Not thread safe 70 | for (;;) { 71 | str[str.size () - 1] = 0; 72 | retval = MY_strerror_s (str.data (), str.size () - 1, errnum); 73 | if (strlen (str.data ()) < str.size () - 2) 74 | break; 75 | str.resize (str.size () * 2); 76 | } 77 | #else 78 | #error 79 | #endif 80 | 81 | if (retval == EINVAL) { 82 | std::stringstream s; 83 | s << "Unknown error number " << errnum; 84 | return s.str (); 85 | } else if (retval != 0) { 86 | std::stringstream s; 87 | s << "strerror_r for " << errnum << " returned " << retval; 88 | ABORT_MSG (s.str ()); 89 | } else { 90 | return str.data (); 91 | } 92 | } 93 | 94 | Error::IosStreamFail::~IosStreamFail () throw () { 95 | } 96 | 97 | std::string Error::IosStreamFail::message () const { 98 | std::stringstream str; 99 | str << function () << ": Stream operation failed"; 100 | return str.str (); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Error.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_ERROR_HPP_INCLUDED 24 | #define CORE_ERROR_HPP_INCLUDED 25 | 26 | // A class "Error" which can be thrown on C runtime errors 27 | // 28 | // Can be used like this: (will throw an Error if symlink() fails) 29 | // Core::Exception::check ("symlink", symlink ("a", "b")); 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | namespace Core { 43 | class Error : public Exception { 44 | std::string function_; 45 | int errnum_; 46 | 47 | class PrivateType { 48 | friend class Error; 49 | PrivateType () {} 50 | }; 51 | 52 | public: 53 | Error (std::string function, int errnum) : function_ (function), errnum_ (errnum) { 54 | } 55 | 56 | virtual ~Error () throw (); 57 | 58 | virtual std::string message () const; 59 | 60 | const std::string& function () const { 61 | return function_; 62 | } 63 | 64 | int errnum () const { 65 | return errnum_; 66 | } 67 | 68 | static std::string errnumToString (int errnum); 69 | 70 | std::string errstr () const { 71 | return errnumToString (errnum ()); 72 | } 73 | 74 | static inline NORETURN error (const char* function) { 75 | throw Error (function, errno); 76 | } 77 | static inline NORETURN error (const std::string& function) { 78 | throw Error (function, errno); 79 | } 80 | static inline void errorIgnore (const char* function, int ignore) { 81 | int errnum = errno; 82 | if (errnum != ignore) 83 | throw Error (function, errnum); 84 | } 85 | 86 | static inline void check (const char* function) { 87 | int errnum = errno; 88 | if (errnum != 0) 89 | throw Error (function, errnum); 90 | } 91 | static inline void checkIgnore (const char* function, int ignore) { 92 | int errnum = errno; 93 | if (errnum != 0 && errnum != ignore) 94 | throw Error (function, errnum); 95 | } 96 | 97 | template 98 | static inline T check (const char* function, T value, UNUSED typename boost::enable_if_c::is_integer && std::numeric_limits::is_signed, PrivateType>::type dummy = PrivateType ()) { 99 | if (value == -1) 100 | throw Error (function, errno); 101 | return value; 102 | } 103 | template 104 | static inline T checkIgnore (const char* function, T value, int ignore, UNUSED typename boost::enable_if_c::is_integer && std::numeric_limits::is_signed, PrivateType>::type dummy = PrivateType ()) { 105 | if (value == -1) { 106 | int errnum = errno; 107 | if (errnum != ignore) 108 | throw Error (function, errnum); 109 | } 110 | return value; 111 | } 112 | 113 | template 114 | static inline T* check (const char* function, T* value) { 115 | if (!value) 116 | throw Error (function, errno); 117 | return value; 118 | } 119 | template 120 | static inline T* checkIgnore (const char* function, T* value, int ignore) { 121 | if (!value) { 122 | int errnum = errno; 123 | if (errnum != ignore) 124 | throw Error (function, errnum); 125 | } 126 | return value; 127 | } 128 | 129 | class IosStreamFail : public Exception { 130 | std::string function_; 131 | 132 | public: 133 | IosStreamFail (std::string function) : function_ (function) { 134 | } 135 | 136 | virtual ~IosStreamFail () throw (); 137 | 138 | virtual std::string message () const; 139 | 140 | const std::string& function () const { 141 | return function_; 142 | } 143 | }; 144 | // There is no guarantee that std::*stream sets errno, but it has no other 145 | // way to show it's error... 146 | template 147 | static inline const std::basic_ios& check (const char* function, const std::basic_ios& value) { 148 | if (value.bad ()) { 149 | int errnum = errno; 150 | ASSERT_MSG (errnum != 0, "errno is 0"); 151 | throw Error (function, errnum); 152 | } 153 | if (value.fail ()) { 154 | // Assume that errno doesn't get set when failbit ist set but not badbit 155 | throw IosStreamFail (function); 156 | } 157 | return value; 158 | } 159 | template 160 | static inline const std::basic_ios& checkIgnore (const char* function, const std::basic_ios& value, int ignore) { 161 | if (value.bad ()) { 162 | int errnum = errno; 163 | if (errnum != ignore) { 164 | ASSERT_MSG (errnum != 0, "errno is 0"); 165 | throw Error (function, errnum); 166 | } 167 | } 168 | if (value.fail ()) { 169 | // Assume that errno doesn't get set when failbit ist set but not badbit 170 | throw IosStreamFail (function); 171 | } 172 | return value; 173 | } 174 | }; 175 | } 176 | 177 | #endif // !CORE_ERROR_HPP_INCLUDED 178 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_EXCEPTION_HPP_INCLUDED 24 | #define CORE_EXCEPTION_HPP_INCLUDED 25 | 26 | // Core::Exception is a base class for exceptions 27 | // 28 | // When a Core::Exception instance is created a stacktrace is generated. This 29 | // stacktrace will be shown by .toString() or .what(). 30 | // 31 | // Subclasses have to overwrite the message() method. 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | namespace Core { 41 | // Used for exceptions in the exception handling code 42 | class SimpleStdException : public std::exception { 43 | std::string descr_; 44 | 45 | public: 46 | SimpleStdException (std::string descr); 47 | ~SimpleStdException () throw (); 48 | 49 | virtual const char* what () const throw (); 50 | }; 51 | 52 | class StackFrame; 53 | 54 | class InlineStackFrame { 55 | friend class StackFrame; 56 | 57 | std::string _method; 58 | std::string _sourceFile; 59 | uint64_t _lineNumber; 60 | 61 | InlineStackFrame (const std::string& method, const std::string& sourceFile, uint64_t lineNumber); 62 | 63 | public: 64 | const std::string& method () const { 65 | return _method; 66 | } 67 | 68 | const std::string& sourceFile () const { 69 | return _sourceFile; 70 | } 71 | 72 | uint64_t lineNumber () const { 73 | return _lineNumber; 74 | } 75 | 76 | std::string toString () const; 77 | }; 78 | 79 | class StackFrame { 80 | friend class InlineStackFrame; 81 | 82 | void* _ptr; 83 | 84 | mutable bool _isResolved; 85 | mutable bool _hasSharedObject; 86 | mutable std::string _sharedObjectName; 87 | mutable void* _sharedObjectBase; 88 | mutable bool _hasSymbol; 89 | mutable std::string _symbolName; 90 | mutable void* _symbolAddr; 91 | void doResolve () const; 92 | 93 | mutable bool _hasAddr2line; 94 | mutable std::vector _inlineStackFrames; 95 | void doAddr2line () const; 96 | 97 | public: 98 | StackFrame (void* ptr); 99 | 100 | void* ptr () const { 101 | return _ptr; 102 | } 103 | 104 | void resolve () const { 105 | if (!_isResolved) 106 | doResolve (); 107 | } 108 | 109 | bool hasSharedObject () const { 110 | resolve (); 111 | return _hasSharedObject; 112 | } 113 | 114 | const std::string& sharedObjectName () const { 115 | resolve (); 116 | if (!_hasSharedObject) 117 | throw "!_hasSharedObject"; 118 | return _sharedObjectName; 119 | } 120 | 121 | void* sharedObjectBase () const { 122 | resolve (); 123 | if (!_hasSharedObject) 124 | throw "!_hasSharedObject"; 125 | return _sharedObjectBase; 126 | } 127 | 128 | size_t sharedObjectOffset () const { 129 | return (char*) ptr () - (char*) sharedObjectBase (); 130 | } 131 | 132 | bool hasSymbol () const { 133 | resolve (); 134 | return _hasSymbol; 135 | } 136 | 137 | const std::string& symbolName () const { 138 | resolve (); 139 | if (!_hasSymbol) 140 | throw "!_hasSymbol"; 141 | return _symbolName; 142 | } 143 | 144 | void* symbolAddr () const { 145 | resolve (); 146 | if (!_hasSymbol) 147 | throw "!_hasSymbol"; 148 | return _symbolAddr; 149 | } 150 | 151 | size_t symbolOffset () const { 152 | return (char*) ptr () - (char*) symbolAddr (); 153 | } 154 | 155 | const std::vector& inlineStackFrames () const { 156 | if (!_hasAddr2line) 157 | doAddr2line (); 158 | return _inlineStackFrames; 159 | } 160 | 161 | std::string toString (int* i = NULL, size_t* addrSize = NULL, size_t* symbSize = NULL, size_t* locSize = NULL) const; 162 | }; 163 | 164 | class StackTrace { 165 | std::vector _frames; 166 | public: 167 | StackTrace () {} 168 | 169 | StackTrace (const std::vector& frames) : _frames (frames) {} 170 | 171 | struct CreateFromCurrentThread_t { }; 172 | static const CreateFromCurrentThread_t createFromCurrentThread; 173 | StackTrace (CreateFromCurrentThread_t ignore); 174 | 175 | const std::vector& frames () const { 176 | return _frames; 177 | } 178 | 179 | std::string toString () const; 180 | }; 181 | 182 | class Exception : public std::exception { 183 | StackTrace _stackTrace; 184 | 185 | mutable std::string whatValue; 186 | mutable bool whatValueComputed; 187 | 188 | public: 189 | Exception () : _stackTrace (StackTrace::createFromCurrentThread), whatValueComputed (false) {} 190 | 191 | const StackTrace& stackTrace () const { 192 | return _stackTrace; 193 | } 194 | 195 | virtual ~Exception () throw (); 196 | 197 | virtual std::string message () const = 0; 198 | 199 | void writeTo (std::ostream& stream) const throw (); 200 | std::string toString () const throw (); 201 | virtual const char* what () const throw (); 202 | }; 203 | 204 | } 205 | 206 | #endif // !CORE_EXCEPTION_HPP_INCLUDED 207 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Image.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Image.hpp" 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | namespace Core { 31 | void writeImagePGM (std::ostream& stream, const uint8_t* data, size_t width, size_t height) { 32 | stream << "P5\n" << width << " " << height << "\n255\n"; 33 | stream.write ((const char*) data, width * height); 34 | } 35 | void writeImagePGM (const boost::filesystem::path& filename, const uint8_t* data, size_t width, size_t height) { 36 | errno = 0; 37 | std::ofstream stream (filename.string ().c_str (), std::ios_base::binary); 38 | Core::Error::check ("open", stream); 39 | errno = 0; 40 | writeImagePGM (stream, data, width, height); 41 | Core::Error::check ("write", stream); 42 | } 43 | void writeImagePGM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height) { 44 | ASSERT (data.size () == width * height); 45 | writeImagePGM (filename, data.data (), width, height); 46 | } 47 | void imageFloatToByte (const std::vector& input, std::vector& output) { 48 | output.resize (input.size ()); 49 | for (size_t i = 0; i < input.size (); i++) { 50 | float val = std::max (0.0f, std::min (1.0f, input[i])); 51 | int32_t vali = (int32_t) (val * 255 + 0.5); 52 | if (vali < 0) 53 | vali = 0; 54 | else if (vali > 255) 55 | vali = 255; 56 | output[i] = (uint8_t) vali; 57 | } 58 | } 59 | void writeImagePGM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height) { 60 | std::vector buf; 61 | imageFloatToByte (data, buf); 62 | writeImagePGM (filename, buf, width, height); 63 | } 64 | 65 | void writeImagePPM (std::ostream& stream, const uint8_t* data, size_t width, size_t height) { 66 | stream << "P6\n" << width << " " << height << "\n255\n"; 67 | stream.write ((const char*) data, width * height * 3); 68 | } 69 | void writeImagePPM (const boost::filesystem::path& filename, const uint8_t* data, size_t width, size_t height) { 70 | std::ofstream stream (filename.string ().c_str (), std::ios_base::binary); 71 | Core::Error::check ("open", stream); 72 | writeImagePPM (stream, data, width, height); 73 | Core::Error::check ("write", stream); 74 | } 75 | void writeImagePPM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height) { 76 | ASSERT (data.size () == width * height * 3); 77 | writeImagePPM (filename, data.data (), width, height); 78 | } 79 | void imageFloatToByteCol (const std::vector& input, std::vector& output) { 80 | output.resize (input.size () * 3); 81 | for (size_t i = 0; i < input.size (); i++) { 82 | float val = std::max (0.0f, std::min (1.0f, input[i])); 83 | int32_t vali = (int32_t) (val * 767 + 0.5); 84 | //int32_t vali = (int32_t) (val * 511 + 255.5); 85 | if (vali < 0) 86 | vali = 0; 87 | else if (vali > 767) 88 | vali = 767; 89 | uint8_t r, g, b; 90 | if (vali < 256) { 91 | r = (uint8_t) vali; 92 | g = b = 0; 93 | } else if (vali < 512) { 94 | r = (uint8_t) (255 - (vali - 256)); 95 | g = (uint8_t) (vali - 256); 96 | b = 0; 97 | } else { 98 | r = 0; 99 | g = (uint8_t) (255 - (vali - 512)); 100 | b = (uint8_t) (vali - 512); 101 | } 102 | output[3 * i + 0] = r; 103 | output[3 * i + 1] = g; 104 | output[3 * i + 2] = b; 105 | } 106 | } 107 | void writeImagePPM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height) { 108 | std::vector buf; 109 | imageFloatToByteCol (data, buf); 110 | writeImagePPM (filename, buf, width, height); 111 | } 112 | 113 | void readImagePGM (std::istream& stream, std::vector& data, size_t& width, size_t& height) { 114 | std::string line; 115 | std::getline (stream, line); 116 | Core::Error::check ("read", stream); 117 | ASSERT_MSG (line == "P5", "Not a binary pgm image"); 118 | 119 | std::size_t val[3]; 120 | int i = 0; 121 | while (i < 3) { 122 | std::getline (stream, line); 123 | Core::Error::check ("read", stream); 124 | if (line.size () > 0 && line[0] == '#') 125 | continue; 126 | std::stringstream str (line); 127 | while (i < 3) { 128 | val[i] = 42; 129 | str >> val[i]; 130 | if (str.eof () && str.fail ()) 131 | break; 132 | i++; 133 | Core::Error::check ("read", str); 134 | } 135 | } 136 | 137 | width = val[0]; 138 | height = val[1]; 139 | std::size_t count = val[0] * val[1]; 140 | if (val[0]) 141 | ASSERT (count / val[0] == val[1]); 142 | 143 | std::vector bytes (count); 144 | stream.read ((char*) bytes.data (), count); 145 | Core::Error::check ("read", stream); 146 | int chr = stream.peek (); 147 | Core::Error::check ("peek", stream); 148 | ASSERT_MSG (chr == -1, "Expected EOF"); 149 | 150 | data.resize (count); 151 | for (std::size_t i = 0; i < count; i++) 152 | data[i] = bytes[i] / (float) val[2]; 153 | } 154 | void readImagePGM (const boost::filesystem::path& filename, std::vector& data, size_t& width, size_t& height) { 155 | errno = 0; 156 | std::ifstream stream (filename.string ().c_str (), std::ios_base::binary); 157 | Core::Error::check ("open", stream); 158 | errno = 0; 159 | readImagePGM (stream, data, width, height); 160 | Core::Error::check ("read", stream); 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Image.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_IMAGE_HPP_INCLUDED 24 | #define CORE_IMAGE_HPP_INCLUDED 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace Core { 31 | void writeImagePGM (std::ostream& stream, const uint8_t* data, size_t width, size_t height); 32 | void writeImagePGM (const boost::filesystem::path& filename, const uint8_t* data, size_t width, size_t height); 33 | void writeImagePGM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height); 34 | void imageFloatToByte (const std::vector& input, std::vector& output); 35 | void writeImagePGM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height); 36 | static inline void writeImagePGM (const char* filename, const std::vector& data, size_t width, size_t height) { writeImagePGM ((boost::filesystem::path) filename, data, width, height); } // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 37 | static inline void writeImagePGM (const std::string& filename, const std::vector& data, size_t width, size_t height) { writeImagePGM ((boost::filesystem::path) filename, data, width, height); } // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 38 | 39 | void writeImagePPM (std::ostream& stream, const uint8_t* data, size_t width, size_t height); 40 | void writeImagePPM (const boost::filesystem::path& filename, const uint8_t* data, size_t width, size_t height); 41 | void writeImagePPM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height); 42 | void imageFloatToByteCol (const std::vector& input, std::vector& output); 43 | void writeImagePPM (const boost::filesystem::path& filename, const std::vector& data, size_t width, size_t height); 44 | static inline void writeImagePPM (const char* filename, const std::vector& data, size_t width, size_t height) { writeImagePPM ((boost::filesystem::path) filename, data, width, height); } // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 45 | static inline void writeImagePPM (const std::string& filename, const std::vector& data, size_t width, size_t height) { writeImagePPM ((boost::filesystem::path) filename, data, width, height); } // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 46 | 47 | void readImagePGM (std::istream& stream, std::vector& data, size_t& width, size_t& height); 48 | void readImagePGM (const boost::filesystem::path& filename, std::vector& data, size_t& width, size_t& height); 49 | static inline void readImagePGM (const char* filename, std::vector& data, size_t& width, size_t& height) { readImagePGM ((boost::filesystem::path) filename, data, width, height); } // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 50 | static inline void readImagePGM (const std::string& filename, std::vector& data, size_t& width, size_t& height) { readImagePGM ((boost::filesystem::path) filename, data, width, height); } // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 51 | } 52 | 53 | #endif // !CORE_IMAGE_HPP_INCLUDED 54 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Memory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Memory.hpp" 24 | 25 | #if OS_WIN 26 | #include 27 | #endif // OS_WIN 28 | 29 | namespace Core { 30 | #if OS_WIN 31 | namespace Intern { 32 | void windowsLocalFree (void* v) { 33 | LocalFree (v); 34 | } 35 | } 36 | #endif // OS_WIN 37 | } 38 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Memory.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_MEMORY_HPP_INCLUDED 24 | #define CORE_MEMORY_HPP_INCLUDED 25 | 26 | // Helper classes which will free() / LocalFree() a pointer on destruction 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace Core { 33 | // Holds a pointer and calls free() on destruction 34 | template class MallocRefHolder { 35 | public: 36 | T* p; 37 | MallocRefHolder (T* p) : p (p) {} 38 | ~MallocRefHolder () { 39 | free (p); 40 | } 41 | }; 42 | 43 | #if OS_WIN 44 | namespace Intern { 45 | // Moved to Memory.cpp to avoid having to include windows.h here 46 | void windowsLocalFree (void* v); 47 | } 48 | 49 | // Holds a pointer and calls LocalFree() on destruction 50 | template class WindowsLocalRefHolder { 51 | public: 52 | T* p; 53 | WindowsLocalRefHolder (T* p) : p (p) {} 54 | ~WindowsLocalRefHolder () { 55 | Intern::windowsLocalFree (p); 56 | } 57 | }; 58 | #endif // OS_WIN 59 | } 60 | 61 | #endif // !CORE_MEMORY_HPP_INCLUDED 62 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/NumericException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "NumericException.hpp" 24 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/NumericException.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_NUMERICEXCEPTION_HPP_INCLUDED 24 | #define CORE_NUMERICEXCEPTION_HPP_INCLUDED 25 | 26 | // Exceptions thrown by Core::CheckedInteger on overflow 27 | // 28 | // All Exceptions inherit from Core::NumericException 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | namespace Core { 43 | namespace Intern { 44 | template inline std::string intToString (T a) { 45 | std::stringstream str; 46 | if (std::numeric_limits::is_signed) 47 | str << (int64_t) a; 48 | else 49 | str << (uint64_t) a; 50 | return str.str (); 51 | } 52 | } 53 | 54 | class NumericException : public Exception { 55 | }; 56 | 57 | class ConversionOverflowException : public virtual NumericException { 58 | }; 59 | 60 | template class TargetTypedNumericException : public virtual NumericException { 61 | public: 62 | static bool isSigned () { 63 | return std::numeric_limits::is_signed; 64 | } 65 | 66 | static TargetType typeMin () { 67 | return std::numeric_limits::min (); 68 | } 69 | 70 | static TargetType typeMax () { 71 | return std::numeric_limits::max (); 72 | } 73 | 74 | static std::string targetTypeInfo () { 75 | std::stringstream str; 76 | 77 | str << "Type `" << Type::getName () << "' is " << (isSigned () ? "signed" : "unsigned") << ", min is " << Intern::intToString (typeMin ()) << ", max is " << Intern::intToString (typeMax ()); 78 | 79 | return str.str (); 80 | } 81 | }; 82 | 83 | template 84 | class TypedConversionOverflowException : public virtual TargetTypedNumericException, public virtual ConversionOverflowException { 85 | From _value; 86 | 87 | public: 88 | TypedConversionOverflowException (From value) : _value (value) { 89 | } 90 | 91 | From value () const { 92 | return _value; 93 | } 94 | 95 | virtual std::string message () const { 96 | std::stringstream str; 97 | typedef std::numeric_limits target; 98 | str << "Error converting from " << Type::getName () << " to " << Type::getName () << ": " << Intern::intToString (value ()) << " is not in [" << Intern::intToString (target::min ()) << ";" << Intern::intToString (target::max ()) << "]"; 99 | return str.str (); 100 | } 101 | }; 102 | } 103 | 104 | #endif // !CORE_NUMERICEXCEPTION_HPP_INCLUDED 105 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/StrError.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #undef _GNU_SOURCE 24 | #define _XOPEN_SOURCE 600 25 | 26 | #include "StrError.h" 27 | 28 | #include 29 | 30 | #if OS_UNIX 31 | int MY_XSI_strerror_r (int errnum, char *buf, size_t buflen) { 32 | return strerror_r (errnum, buf, buflen); 33 | } 34 | #endif 35 | 36 | #if OS_WIN 37 | // MinGW lacks a prototype for strerror_s 38 | int strerror_s (char *buffer, size_t sizeInBytes, int errnum); 39 | int MY_strerror_s (char *buf, size_t size, int errnum) { 40 | return strerror_s (buf, size, errnum); 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/StrError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_STRERROR_H_INCLUDED 24 | #define CORE_STRERROR_H_INCLUDED 25 | 26 | // Wrapper for strerror_r / strerror_s 27 | 28 | #include 29 | 30 | #include 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #if OS_UNIX 37 | // Under linux/g++ the XSI strerror_r cannot be used from C++ 38 | 39 | // Call the XSI strerror_r 40 | int MY_XSI_strerror_r (int errnum, char *buf, size_t buflen); 41 | #endif 42 | 43 | #if OS_WIN 44 | int MY_strerror_s (char *buf, size_t size, int errnum); 45 | #endif 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif // !CORE_STRERROR_H_INCLUDED 52 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Time.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Time.hpp" 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #if OS_UNIX 35 | #include 36 | #include 37 | #include 38 | #elif OS_WIN 39 | #define _WIN32_LEAN_AND_MEAN 40 | #include 41 | #undef min 42 | #undef max 43 | #else 44 | #error "Not implemented for this OS" 45 | #endif 46 | 47 | namespace Core { 48 | #if OS_UNIX 49 | static inline TimeSpan toTimeSpan (struct timeval time) { 50 | return TimeSpan (int64_t (time.tv_sec) * 1000000 + int64_t (time.tv_usec)); 51 | } 52 | #endif 53 | #if OS_WIN 54 | static inline TimeSpan toTimeSpan (FILETIME time) { 55 | uint64_t high = (uint32_t) time.dwHighDateTime; 56 | uint64_t low = (uint64_t) time.dwLowDateTime; 57 | uint64_t value = (high << 32) | low; 58 | if (value + 5 > value) 59 | value += 5; 60 | value /= 10; 61 | return TimeSpan (value); 62 | } 63 | #endif 64 | 65 | TimeSpan getCurrentTime () { 66 | #if OS_UNIX 67 | struct timeval time; 68 | gettimeofday(&time, NULL); 69 | return toTimeSpan (time); 70 | #elif OS_WIN 71 | LARGE_INTEGER freq; 72 | Core::WindowsError::check ("QueryPerformanceFrequency", QueryPerformanceFrequency (&freq)); 73 | 74 | LARGE_INTEGER time; 75 | Core::WindowsError::check ("QueryPerformanceCounter", QueryPerformanceCounter (&time)); 76 | 77 | return TimeSpan::fromSeconds (double (time.QuadPart) / double (freq.QuadPart)); 78 | #else 79 | #error "Not implemented for this OS" 80 | #endif 81 | } 82 | 83 | TimeSpan getCpuTime () { 84 | #if OS_UNIX 85 | struct rusage usage; 86 | Core::Error::check ("getrusage", getrusage (RUSAGE_SELF, &usage)); 87 | return toTimeSpan (usage.ru_utime) + toTimeSpan (usage.ru_stime); 88 | #elif OS_WIN 89 | FILETIME creation, exit, kernel, user; 90 | Core::WindowsError::check ("GetThreadTimes", GetThreadTimes (GetCurrentThread (), &creation, &exit, &kernel, &user)); 91 | return toTimeSpan (kernel) + toTimeSpan (user); 92 | #else 93 | #error "Not implemented for this OS" 94 | #endif 95 | } 96 | 97 | TimeSpan getCpuSystemTime () { 98 | #if OS_UNIX 99 | struct rusage usage; 100 | Core::Error::check ("getrusage", getrusage (RUSAGE_SELF, &usage)); 101 | return toTimeSpan (usage.ru_stime); 102 | #elif OS_WIN 103 | FILETIME creation, exit, kernel, user; 104 | Core::WindowsError::check ("GetThreadTimes", GetThreadTimes (GetCurrentThread (), &creation, &exit, &kernel, &user)); 105 | return toTimeSpan (kernel); 106 | #else 107 | #error "Not implemented for this OS" 108 | #endif 109 | } 110 | 111 | TimeSpan getCpuUserTime () { 112 | #if OS_UNIX 113 | struct rusage usage; 114 | Core::Error::check ("getrusage", getrusage (RUSAGE_SELF, &usage)); 115 | return toTimeSpan (usage.ru_utime); 116 | #elif OS_WIN 117 | FILETIME creation, exit, kernel, user; 118 | Core::WindowsError::check ("GetThreadTimes", GetThreadTimes (GetCurrentThread (), &creation, &exit, &kernel, &user)); 119 | return toTimeSpan (user); 120 | #else 121 | #error "Not implemented for this OS" 122 | #endif 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Time.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_TIME_HPP_INCLUDED 24 | #define CORE_TIME_HPP_INCLUDED 25 | 26 | // Get current time / cpu time 27 | 28 | #include 29 | 30 | namespace Core { 31 | TimeSpan getCurrentTime (); 32 | TimeSpan getCpuTime (); 33 | TimeSpan getCpuSystemTime (); 34 | TimeSpan getCpuUserTime (); 35 | } 36 | 37 | #endif // !CORE_TIME_HPP_INCLUDED 38 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/TimeSpan.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "TimeSpan.hpp" 24 | 25 | #include 26 | 27 | #include 28 | 29 | namespace Core { 30 | std::string TimeSpan::toString (bool appendUnit) const { 31 | std::stringstream str; 32 | 33 | str.setf (std::ios_base::internal, std::ios_base::adjustfield); 34 | str.setf (std::ios_base::fixed, std::ios_base::floatfield); 35 | str.setf (std::ios_base::showpoint); 36 | //str.width (10); 37 | str.precision (6); 38 | str << getSeconds (); 39 | if (appendUnit) 40 | str << "s"; 41 | 42 | return str.str (); 43 | } 44 | 45 | TimeSpan TimeSpan::parse (const std::string& str, bool appendUnit) { 46 | std::string s = str; 47 | 48 | if (appendUnit) { 49 | ASSERT (str.length () > 0 && str[str.length () - 1] == 's'); 50 | s = s.substr (0, str.length () - 1); 51 | } 52 | 53 | std::stringstream stream (s); 54 | double seconds; 55 | stream >> seconds; 56 | ASSERT (!stream.bad ()); 57 | ASSERT (stream.eof ()); 58 | 59 | return TimeSpan::fromSeconds (seconds); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/TimeSpan.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_TIMESPAN_HPP_INCLUDED 24 | #define CORE_TIMESPAN_HPP_INCLUDED 25 | 26 | // Core::TimeSpan represents the length of an interval of time. 27 | // 28 | // The length is stored as a signed 64-bit integer in microseconds. 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace Core { 35 | class TimeSpan { 36 | int64_t value; 37 | 38 | public: 39 | explicit TimeSpan (int64_t value) : value (value) { 40 | } 41 | 42 | static TimeSpan fromSeconds (double value) { 43 | return TimeSpan (static_cast (value * 1000000.0)); 44 | } 45 | 46 | int64_t getMicroseconds () const { 47 | return value; 48 | } 49 | 50 | double getSeconds () const { 51 | return double (getMicroseconds ()) / 1000000.0; 52 | } 53 | 54 | double getMilliseconds () const { 55 | return double (getMicroseconds ()) / 1000.0; 56 | } 57 | 58 | std::string toString (bool appendUnit = true) const; 59 | static TimeSpan parse (const std::string& str, bool appendUnit = true); 60 | 61 | TimeSpan operator +(TimeSpan o) { 62 | return TimeSpan (getMicroseconds () + o.getMicroseconds ()); 63 | } 64 | 65 | TimeSpan operator -(TimeSpan o) { 66 | return TimeSpan (getMicroseconds () - o.getMicroseconds ()); 67 | } 68 | 69 | #define FORWARD_BOOL_OP(op) \ 70 | bool operator op (TimeSpan o) const { \ 71 | return getMicroseconds () op o.getMicroseconds (); \ 72 | } 73 | FORWARD_BOOL_OP (<) FORWARD_BOOL_OP (<=) 74 | FORWARD_BOOL_OP (>) FORWARD_BOOL_OP (>=) 75 | FORWARD_BOOL_OP (==) FORWARD_BOOL_OP (!=) 76 | #undef FORWARD_BOOL_OP 77 | }; 78 | 79 | static inline TimeSpan operator *(TimeSpan t1, int s) { 80 | return TimeSpan (t1.getMicroseconds () * s); 81 | } 82 | 83 | static inline TimeSpan operator *(TimeSpan t1, double s) { 84 | return TimeSpan (static_cast (static_cast (t1.getMicroseconds ()) * s)); 85 | } 86 | 87 | static inline TimeSpan operator *(TimeSpan t1, float s) { 88 | return TimeSpan (static_cast (static_cast (t1.getMicroseconds ()) * s)); 89 | } 90 | 91 | static inline TimeSpan operator *(int s, TimeSpan t1) { 92 | return TimeSpan (t1.getMicroseconds () * s); 93 | } 94 | 95 | static inline TimeSpan operator *(double s, TimeSpan t1) { 96 | return TimeSpan (static_cast (static_cast (t1.getMicroseconds ()) * s)); 97 | } 98 | 99 | static inline TimeSpan operator *(float s, TimeSpan t1) { 100 | return TimeSpan (static_cast (static_cast (t1.getMicroseconds ()) * s)); 101 | } 102 | 103 | static inline TimeSpan operator /(TimeSpan t1, int s) { 104 | return TimeSpan (t1.getMicroseconds () / s); 105 | } 106 | 107 | static inline TimeSpan operator /(TimeSpan t1, double s) { 108 | return TimeSpan (static_cast (static_cast (t1.getMicroseconds ()) / s)); 109 | } 110 | 111 | static inline TimeSpan operator /(TimeSpan t1, float s) { 112 | return TimeSpan (static_cast (static_cast (t1.getMicroseconds ()) / s)); 113 | } 114 | 115 | static inline std::ostream& operator<< (std::ostream& stream, TimeSpan t) { 116 | stream << t.toString (); 117 | return stream; 118 | } 119 | } 120 | 121 | #endif // !CORE_TIMESPAN_HPP_INCLUDED 122 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Type.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Type.hpp" 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #ifndef _MSC_VER 31 | #include 32 | #endif 33 | 34 | namespace Core { 35 | namespace Type { 36 | std::string getName (const std::type_info& info) { 37 | #ifndef _MSC_VER 38 | size_t len; 39 | int status; 40 | MallocRefHolder demangled = abi::__cxa_demangle (info.name (), NULL, &len, &status); 41 | ASSERT_MSG (status == 0 || status == -2, std::string () + "abi::__cxa_demangle failed for `" + info.name () + "'"); 42 | ASSERT_MSG (status == 0, std::string () + "abi::__cxa_demangle failed for `" + info.name () + "'"); 43 | return demangled.p; 44 | #else 45 | return info.name (); 46 | #endif 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Type.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_TYPE_HPP_INCLUDED 24 | #define CORE_TYPE_HPP_INCLUDED 25 | 26 | // Methods to get a typename or to get the offset of a field in a type 27 | 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | namespace Core { 40 | namespace Type { 41 | std::string getName (const std::type_info& info); 42 | 43 | template inline std::string getName () { 44 | std::string result = getName (typeid (T)); 45 | if (boost::is_const::value) 46 | result += " const"; 47 | if (boost::is_volatile::value) 48 | result += " volatile"; 49 | return result; 50 | } 51 | 52 | // Return the offset of a pointer-to-member 53 | // Might cause problems for types with a vtable pointer (in particular for 54 | // types with virtual inheritance) 55 | template 56 | NVCC_HOST_DEVICE static inline size_t getOffset (V C::* ptr) { 57 | #if HAVE_CXX11 58 | static_assert (std::is_standard_layout::value, "C is not a standard layout type"); 59 | #endif 60 | // This works, but is not portable 61 | // return ((char*) &(((C*) 0)->*ptr)) - ((char*) 0); 62 | 63 | // This should be more or less portable. The compiler should optimize this 64 | // to the above form 65 | typename boost::aligned_storage::value>::type val; 66 | return ((char*) &(((C*) &val)->*ptr)) - ((char*) &val); 67 | } 68 | } 69 | } 70 | 71 | #endif // !CORE_TYPE_HPP_INCLUDED 72 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_UTIL_H_INCLUDED 24 | #define CORE_UTIL_H_INCLUDED 25 | 26 | // Various preprocessor macros for C/C++ 27 | 28 | // clang feature check macros (for non-clang compilers) 29 | #ifndef __has_builtin 30 | # define __has_builtin(x) 0 31 | #endif 32 | #ifndef __has_feature 33 | # define __has_feature(x) 0 34 | #endif 35 | #ifndef __has_extension 36 | # define __has_extension __has_feature 37 | #endif 38 | #ifndef __has_attribute 39 | # define __has_attribute(x) 0 40 | #endif 41 | #ifndef __has_warning 42 | # define __has_warning(x) 0 43 | #endif 44 | 45 | // Evaluates to true iff __GNUC__ is defined and (__GNUC__, __GNUC_MINOR__) is at least (major, minor) 46 | #define GCC_VERSION_IS_ATLEAST(major, minor) (defined (__GNUC__) && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) 47 | 48 | // For methods which should never be called 49 | #if __has_attribute(error) || GCC_VERSION_IS_ATLEAST(4, 3) 50 | #define ERROR_ATTRIBUTE(text) __attribute__ ((__error__ (text))) 51 | #else 52 | #define ERROR_ATTRIBUTE(text) 53 | #endif 54 | 55 | // "unused" attribute to disable warnings 56 | #if __has_attribute(unused) || defined (__GNUC__) 57 | #define UNUSED __attribute__ ((unused)) 58 | #else 59 | #define UNUSED 60 | #endif 61 | 62 | // For methods which never return 63 | #if __has_attribute(noreturn) || defined (__GNUC__) 64 | #define NORETURN_ATTRIBUTE __attribute__ ((noreturn)) 65 | #else 66 | #define NORETURN_ATTRIBUTE 67 | #endif 68 | 69 | #define NORETURN NORETURN_ATTRIBUTE void 70 | 71 | #if defined(__POSIX__) || defined (__unix) || defined (__unix__) 72 | #define OS_UNIX 1 73 | #define OS_WIN 0 74 | #elif defined(__APPLE__) 75 | #define OS_UNIX 1 76 | #define OS_WIN 0 77 | #elif defined(_WIN32) 78 | #define OS_UNIX 0 79 | #define OS_WIN 1 80 | #else 81 | #error "None of __POSIX__, __unix, __unix__, __APPLE__ and _WIN32 is defined." 82 | #endif 83 | 84 | #endif // !CORE_UTIL_H_INCLUDED 85 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/Util.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_UTIL_HPP_INCLUDED 24 | #define CORE_UTIL_HPP_INCLUDED 25 | 26 | // Various preprocessor macros for C++ 27 | 28 | #include 29 | 30 | // HAVE_CXX11 is true iff there is (at least some) support for C++11 31 | #if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L 32 | #define HAVE_CXX11 1 33 | #else 34 | #define HAVE_CXX11 0 35 | #endif 36 | 37 | #if !HAVE_CXX11 38 | 39 | // Can be used to disable the copy constructor and assignment operator of a 40 | // class 41 | #define NO_COPY_CLASS(n) \ 42 | private: \ 43 | ERROR_ATTRIBUTE ("Class " #n " has no assignment operator") \ 44 | n& operator= (const n &x); \ 45 | ERROR_ATTRIBUTE ("Class " #n " has no copy constructor") \ 46 | n (const n &x) 47 | 48 | // Can be used to disable the default constructor and destructor of a class 49 | #define STATIC_CLASS(n) \ 50 | NO_COPY_CLASS (n); \ 51 | private: \ 52 | ERROR_ATTRIBUTE ("Class " #n " cannot be constructed") \ 53 | n (); \ 54 | ERROR_ATTRIBUTE ("Class " #n " cannot be constructed") \ 55 | ~n () 56 | 57 | #else // HAVE_CXX11 58 | 59 | // Versions for C++11 60 | 61 | #define NO_COPY_CLASS(n) \ 62 | private: \ 63 | n& operator= (const n &x) = delete; \ 64 | n (const n &x) = delete 65 | 66 | #define STATIC_CLASS(n) \ 67 | NO_COPY_CLASS (n); \ 68 | private: \ 69 | n () = delete; \ 70 | ~n () = delete 71 | 72 | #endif // HAVE_CXX11 73 | 74 | #ifdef __CUDACC__ 75 | #define NVCC_HOST_DEVICE __host__ __device__ 76 | #else 77 | #define NVCC_HOST_DEVICE 78 | #endif 79 | 80 | #if defined (__CUDACC__) && defined (CUDART_VERSION) && CUDART_VERSION < 5000 81 | #define DECLTYPE(t) typeof (t) 82 | #else 83 | #define DECLTYPE(t) __decltype (t) 84 | #endif 85 | 86 | #endif // !CORE_UTIL_HPP_INCLUDED 87 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/WindowsError.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "WindowsError.hpp" 24 | 25 | #if OS_WIN 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | 34 | namespace Core { 35 | WindowsError::~WindowsError () throw () { 36 | } 37 | 38 | std::string WindowsError::message () const { 39 | std::stringstream str; 40 | str << function () << ": " << errstr (); 41 | return str.str (); 42 | } 43 | 44 | WindowsError::ErrorNumType WindowsError::getLastError () { 45 | return GetLastError (); 46 | } 47 | 48 | std::string WindowsError::errnumToString (ErrorNumType errnum) { 49 | std::stringstream str; 50 | char* lpMsgBuf; 51 | if (!FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errnum, MAKELANGID (LANG_NEUTRAL, SUBLANG_NEUTRAL), (char*) &lpMsgBuf, 0, NULL)) { 52 | DWORD err2 = GetLastError (); 53 | str << "FormatMessage () for " << errnum << " returned " << err2; 54 | ABORT_MSG (str.str ()); 55 | } 56 | Core::WindowsLocalRefHolder refHolder (lpMsgBuf); 57 | size_t len = strlen (lpMsgBuf); 58 | if (len && lpMsgBuf[len - 1] == '\n') { 59 | lpMsgBuf[len - 1] = 0; 60 | if ((len > 1) && lpMsgBuf[len - 2] == '\r') 61 | lpMsgBuf[len - 2] = 0; 62 | } 63 | str << lpMsgBuf << " (" << errnum << ")"; 64 | return str.str (); 65 | } 66 | } 67 | 68 | #endif // OS_WIN 69 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/Core/WindowsError.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2012 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef CORE_WINDOWSERROR_HPP_INCLUDED 24 | #define CORE_WINDOWSERROR_HPP_INCLUDED 25 | 26 | // A class "WindowsError" which can be thrown on windows errors 27 | // 28 | // Can be used like this: (will throw a WindowsError if QueryPerformanceCounter() fails) 29 | // Core::Exception::check ("QueryPerformanceCounter", QueryPerformanceCounter (&time)); 30 | 31 | #include 32 | 33 | #if OS_WIN 34 | 35 | #include 36 | 37 | #include 38 | 39 | namespace Core { 40 | class WindowsError : public Exception { 41 | public: 42 | typedef uint32_t ErrorNumType; // uint32_t = DWORD 43 | 44 | private: 45 | std::string function_; 46 | ErrorNumType errnum_; 47 | 48 | public: 49 | WindowsError (std::string function, ErrorNumType errnum) : function_ (function), errnum_ (errnum) { 50 | } 51 | 52 | virtual ~WindowsError () throw (); 53 | 54 | virtual std::string message () const; 55 | 56 | const std::string& function () const { 57 | return function_; 58 | } 59 | 60 | ErrorNumType errnum () const { 61 | return errnum_; 62 | } 63 | 64 | static std::string errnumToString (ErrorNumType errnum); 65 | 66 | std::string errstr () const { 67 | return errnumToString (errnum ()); 68 | } 69 | 70 | static ErrorNumType getLastError (); 71 | 72 | static inline NORETURN error (const std::string& function) { 73 | throw WindowsError (function, getLastError ()); 74 | } 75 | static inline void errorIgnore (const char* function, ErrorNumType ignore) { 76 | ErrorNumType errnum = getLastError (); 77 | if (errnum != ignore) 78 | throw WindowsError (function, errnum); 79 | } 80 | 81 | static inline void check (const char* function) { 82 | ErrorNumType errnum = getLastError (); 83 | if (errnum != 0) 84 | throw WindowsError (function, errnum); 85 | } 86 | static inline void checkIgnore (const char* function, ErrorNumType ignore) { 87 | ErrorNumType errnum = getLastError (); 88 | if (errnum != 0 && errnum != ignore) 89 | throw WindowsError (function, errnum); 90 | } 91 | 92 | static inline uint32_t check (const char* function, uint32_t value) { 93 | if (value == 0) 94 | throw WindowsError (function, getLastError ()); 95 | return value; 96 | } 97 | static inline uint32_t checkIgnore (const char* function, uint32_t value, ErrorNumType ignore) { 98 | if (value == 0) { 99 | ErrorNumType errnum = getLastError (); 100 | if (errnum != ignore) 101 | throw WindowsError (function, errnum); 102 | } 103 | return value; 104 | } 105 | 106 | template 107 | static inline T* check (const char* function, T* value) { 108 | if (!value) 109 | throw WindowsError (function, getLastError ()); 110 | return value; 111 | } 112 | template 113 | static inline T* checkIgnore (const char* function, T* value, ErrorNumType ignore) { 114 | if (!value) { 115 | ErrorNumType errnum = getLastError (); 116 | if (errnum != ignore) 117 | throw WindowsError (function, errnum); 118 | } 119 | return value; 120 | } 121 | }; 122 | } 123 | 124 | #endif // OS_WIN 125 | 126 | #endif // !CORE_WINDOWSERROR_HPP_INCLUDED 127 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Device.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Device.hpp" 24 | 25 | #ifndef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 26 | #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 27 | #endif 28 | #ifndef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 29 | #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 30 | #endif 31 | 32 | namespace OpenCL { 33 | void printDeviceInfo(std::ostream& stream, const cl::Device& device) { 34 | stream << "Running on " << device.getInfo (); 35 | if ((" " + device.getInfo () + " ").find (" cl_nv_device_attribute_query ") != std::string::npos) { 36 | cl_uint major = -1; 37 | cl_uint minor = -1; 38 | device.getInfo (CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, &major); 39 | device.getInfo (CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, &minor); 40 | stream << " (" << major << "." << minor << ")"; 41 | } 42 | stream << std::endl; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Device.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPENCL_DEVICE_HPP_INCLUDED 24 | #define OPENCL_DEVICE_HPP_INCLUDED 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace OpenCL { 31 | void printDeviceInfo(std::ostream& stream, const cl::Device& device); 32 | } 33 | 34 | #endif // !OPENCL_DEVICE_HPP_INCLUDED 35 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Error.hpp" 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | namespace OpenCL { 33 | Error::Error (cl_int err, const char * errStr) : err_(err), errStr_(errStr) {} 34 | Error::~Error () throw() {} 35 | 36 | std::string Error::message () const { 37 | std::stringstream str; 38 | str << "OpenCL Error: " << (errStr_ ? errStr_ : "empty") << ": " << getErrorString (err ()); 39 | return str.str (); 40 | } 41 | } 42 | 43 | namespace cl { 44 | NORETURN errorHandler (cl_int err, const char * errStr) { 45 | throw OpenCL::Error (err, errStr); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Error.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPENCL_ERROR_HPP_INCLUDED 24 | #define OPENCL_ERROR_HPP_INCLUDED 25 | 26 | // Provide an error class for OpenCL 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | namespace OpenCL { 34 | class Error : public Core::Exception { 35 | private: 36 | cl_int err_; 37 | const char * errStr_; 38 | 39 | public: 40 | Error (cl_int err, const char * errStr = NULL); 41 | ~Error () throw (); 42 | 43 | cl_int err () const { return err_; } 44 | const char* errStr () const { return errStr_; } 45 | 46 | virtual std::string message () const; 47 | }; 48 | } 49 | 50 | #endif // !OPENCL_ERROR_HPP_INCLUDED 51 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Event.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Event.hpp" 24 | 25 | namespace OpenCL { 26 | Core::TimeSpan getElapsedTime (const cl::Event& event) { 27 | cl_ulong nanoseconds = event.getProfilingInfo () - event.getProfilingInfo (); 28 | return Core::TimeSpan ((nanoseconds + 500) / 1000); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Event.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPENCL_EVENT_HPP_INCLUDED 24 | #define OPENCL_EVENT_HPP_INCLUDED 25 | 26 | #include 27 | 28 | #include 29 | 30 | namespace OpenCL { 31 | Core::TimeSpan getElapsedTime (const cl::Event& event); 32 | } 33 | 34 | #endif // !OPENCL_EVENT_HPP_INCLUDED 35 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/GetError.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "GetError.hpp" 24 | 25 | #include 26 | 27 | namespace OpenCL { 28 | std::string getErrorString (cl_int i) { 29 | switch (i) { 30 | // cat /usr/include/CL/cl.h | sed -n '/Error Codes/,$p' | sed -n '1d;/\/\*/q;p' | while read a b c; do if [ "$a" = "#define" ]; then echo " case $b: return \"$b\";"; else echo; fi; done 31 | 32 | case CL_SUCCESS: return "CL_SUCCESS"; 33 | case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; 34 | case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE"; 35 | case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILABLE"; 36 | case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "CL_MEM_OBJECT_ALLOCATION_FAILURE"; 37 | case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES"; 38 | case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY"; 39 | case CL_PROFILING_INFO_NOT_AVAILABLE: return "CL_PROFILING_INFO_NOT_AVAILABLE"; 40 | case CL_MEM_COPY_OVERLAP: return "CL_MEM_COPY_OVERLAP"; 41 | case CL_IMAGE_FORMAT_MISMATCH: return "CL_IMAGE_FORMAT_MISMATCH"; 42 | case CL_IMAGE_FORMAT_NOT_SUPPORTED: return "CL_IMAGE_FORMAT_NOT_SUPPORTED"; 43 | case CL_BUILD_PROGRAM_FAILURE: return "CL_BUILD_PROGRAM_FAILURE"; 44 | case CL_MAP_FAILURE: return "CL_MAP_FAILURE"; 45 | case CL_MISALIGNED_SUB_BUFFER_OFFSET: return "CL_MISALIGNED_SUB_BUFFER_OFFSET"; 46 | case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST"; 47 | 48 | case CL_INVALID_VALUE: return "CL_INVALID_VALUE"; 49 | case CL_INVALID_DEVICE_TYPE: return "CL_INVALID_DEVICE_TYPE"; 50 | case CL_INVALID_PLATFORM: return "CL_INVALID_PLATFORM"; 51 | case CL_INVALID_DEVICE: return "CL_INVALID_DEVICE"; 52 | case CL_INVALID_CONTEXT: return "CL_INVALID_CONTEXT"; 53 | case CL_INVALID_QUEUE_PROPERTIES: return "CL_INVALID_QUEUE_PROPERTIES"; 54 | case CL_INVALID_COMMAND_QUEUE: return "CL_INVALID_COMMAND_QUEUE"; 55 | case CL_INVALID_HOST_PTR: return "CL_INVALID_HOST_PTR"; 56 | case CL_INVALID_MEM_OBJECT: return "CL_INVALID_MEM_OBJECT"; 57 | case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: return "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"; 58 | case CL_INVALID_IMAGE_SIZE: return "CL_INVALID_IMAGE_SIZE"; 59 | case CL_INVALID_SAMPLER: return "CL_INVALID_SAMPLER"; 60 | case CL_INVALID_BINARY: return "CL_INVALID_BINARY"; 61 | case CL_INVALID_BUILD_OPTIONS: return "CL_INVALID_BUILD_OPTIONS"; 62 | case CL_INVALID_PROGRAM: return "CL_INVALID_PROGRAM"; 63 | case CL_INVALID_PROGRAM_EXECUTABLE: return "CL_INVALID_PROGRAM_EXECUTABLE"; 64 | case CL_INVALID_KERNEL_NAME: return "CL_INVALID_KERNEL_NAME"; 65 | case CL_INVALID_KERNEL_DEFINITION: return "CL_INVALID_KERNEL_DEFINITION"; 66 | case CL_INVALID_KERNEL: return "CL_INVALID_KERNEL"; 67 | case CL_INVALID_ARG_INDEX: return "CL_INVALID_ARG_INDEX"; 68 | case CL_INVALID_ARG_VALUE: return "CL_INVALID_ARG_VALUE"; 69 | case CL_INVALID_ARG_SIZE: return "CL_INVALID_ARG_SIZE"; 70 | case CL_INVALID_KERNEL_ARGS: return "CL_INVALID_KERNEL_ARGS"; 71 | case CL_INVALID_WORK_DIMENSION: return "CL_INVALID_WORK_DIMENSION"; 72 | case CL_INVALID_WORK_GROUP_SIZE: return "CL_INVALID_WORK_GROUP_SIZE"; 73 | case CL_INVALID_WORK_ITEM_SIZE: return "CL_INVALID_WORK_ITEM_SIZE"; 74 | case CL_INVALID_GLOBAL_OFFSET: return "CL_INVALID_GLOBAL_OFFSET"; 75 | case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_LIST"; 76 | case CL_INVALID_EVENT: return "CL_INVALID_EVENT"; 77 | case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION"; 78 | case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT"; 79 | case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE"; 80 | case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL"; 81 | case CL_INVALID_GLOBAL_WORK_SIZE: return "CL_INVALID_GLOBAL_WORK_SIZE"; 82 | case CL_INVALID_PROPERTY: return "CL_INVALID_PROPERTY"; 83 | 84 | default: 85 | std::stringstream str; 86 | str << i; 87 | return str.str (); 88 | } 89 | } 90 | } 91 | 92 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/GetError.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPENCL_GETERROR_HPP_INCLUDED 24 | #define OPENCL_GETERROR_HPP_INCLUDED 25 | 26 | // Code to get a string for a opencl error number 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace OpenCL { 33 | std::string getErrorString (cl_int i); 34 | } 35 | 36 | #endif // !OPENCL_GETERROR_HPP_INCLUDED 37 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/OpenCLKernel.hpp.url: -------------------------------------------------------------------------------- 1 | https://gist.github.com/rjeschke/5701109/raw/0a3f9aa07a45859864d49b6bced7916fa9b10d5b/OpenCLKernel.hpp 2 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Program.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #include "Program.hpp" 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | namespace OpenCL { 35 | static std::string logsToString (const std::vector& logs) { 36 | std::stringstream str; 37 | for (size_t i = 0; i < logs.size (); i++) { 38 | str << "Build log for device " << i << ":"; 39 | std::string log = logs[i]; 40 | log = "\n" + log; 41 | if (log.length () > 0 && log[log.length () - 1] == '\n') 42 | log = log.substr (0, log.length () - 1); 43 | boost::replace_all (log, "\n", "\n> "); 44 | str << log << std::endl << std::endl; 45 | } 46 | return str.str (); 47 | } 48 | 49 | BuildError::BuildError (cl_int err, const char* errStr, const std::vector& logs) : 50 | Error (err, errStr), logs_ (logs) { 51 | } 52 | 53 | BuildError::~BuildError () throw () {} 54 | 55 | std::string BuildError::message () const { 56 | std::stringstream str; 57 | str << "OpenCL Build Error: " << (errStr () ? errStr () : "empty") << ": " << getErrorString (err ()); 58 | str << std::endl << logsToString (logs ()); 59 | return str.str (); 60 | } 61 | 62 | cl::Program loadProgramSource (const cl::Context& context, const boost::filesystem::path& filename) { 63 | std::string source; 64 | { 65 | std::ifstream in (filename.string ().c_str ()); 66 | Core::Error::check ("open", in); 67 | std::stringstream sstr; 68 | sstr << in.rdbuf (); 69 | Core::Error::check ("read", in); 70 | source = sstr.str (); 71 | } 72 | 73 | std::vector > sources; 74 | sources.push_back (std::make_pair (source.data (), source.length ())); 75 | cl::Program program (context, sources); 76 | return program; 77 | } 78 | 79 | std::vector buildProgramGetMsgs (const cl::Program& program, const std::vector& devices, const std::string& options) { 80 | std::vector devices2 (devices.size ()); 81 | for (size_t i = 0; i < devices2.size (); i++) 82 | devices2[i] = devices[i] (); 83 | cl_int ret = clBuildProgram (program (), (cl_uint) devices2.size (), devices2.data (), options.c_str (), NULL, NULL); 84 | 85 | std::vector logs; 86 | for (std::vector::const_iterator it = devices.begin (); it != devices.end (); it++) 87 | logs.push_back (program.getBuildInfo (*it)); 88 | 89 | if (ret != CL_SUCCESS) 90 | throw BuildError (ret, "clBuildProgram", logs); 91 | 92 | return logs; 93 | } 94 | 95 | void buildProgram (const cl::Program& program, const std::vector& devices, const std::string& options, std::ostream& out) { 96 | std::vector logs = buildProgramGetMsgs (program, devices, options); 97 | bool foundWarning = false; 98 | for (size_t i = 0; i < logs.size () && !foundWarning; i++) 99 | if (boost::trim_copy (logs[i]) != "") 100 | foundWarning = true; 101 | if (foundWarning) 102 | out << "Got warnings while compiling OpenCL code:" << std::endl << logsToString (logs) << std::flush; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/Program.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2014 Steffen Kieß 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | #ifndef OPENCL_PROGRAM_HPP_INCLUDED 24 | #define OPENCL_PROGRAM_HPP_INCLUDED 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include 34 | 35 | namespace OpenCL { 36 | class BuildError : public Error { 37 | private: 38 | std::vector logs_; 39 | 40 | public: 41 | BuildError (cl_int err, const char* errStr, const std::vector& logs); 42 | ~BuildError () throw (); 43 | 44 | const std::vector& logs () const { return logs_; } 45 | 46 | virtual std::string message () const; 47 | }; 48 | 49 | cl::Program loadProgramSource (const cl::Context& context, const boost::filesystem::path& filename); 50 | // Workaround eclipse 3.7.2-1 (eclipse-cdt 8.0.2-1) bug (without this eclipse shows an error "Invalid arguments ..." 51 | static inline cl::Program loadProgramSource (const cl::Context& context, const char* filename) { 52 | return loadProgramSource (context, (boost::filesystem::path) filename); 53 | } 54 | 55 | std::vector buildProgramGetMsgs (const cl::Program& program, const std::vector& devices, const std::string& options = ""); 56 | void buildProgram (const cl::Program& program, const std::vector& devices, const std::string& options = "", std::ostream& out = std::cerr); 57 | } 58 | 59 | #endif // !OPENCL_PROGRAM_HPP_INCLUDED 60 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/README-MacOS.txt: -------------------------------------------------------------------------------- 1 | How to make this code run in Eclipse under MacOS: 2 | - Install boost using MacPorts http://www.macports.org/ (http://stackoverflow.com/questions/104322/how-do-you-install-boost-on-macos) 3 | - Update the project properties (Properties => C/C++ Build => Settings): 4 | - Add include path (GCC C++ Compiler => Includes): /opt/local/include 5 | - Add library path (GCC C++ Linker => Libraries): /opt/local/lib 6 | - Remove library (GCC C++ Linker => Libraries): OpenCL 7 | - Add other linker option (GCC C++ Linker => Miscellaneous): -framework OpenCL 8 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/lib/OpenCL/cl.hpp.orig.url: -------------------------------------------------------------------------------- 1 | http://www.khronos.org/registry/cl/api/1.2/cl.hpp 2 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/plot.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import csv 3 | """ 4 | Plot ESF, PSF, MTF 5 | """ 6 | x = [] 7 | y = [] 8 | a = [] 9 | b = [] 10 | m = [] 11 | n = [] 12 | 13 | with open('/home/vayalala/workspace2/OpenCLExercise3_Sobel/ValuesESF.csv','r') as csvfile: 14 | plots = csv.reader(csvfile, delimiter=',') 15 | for row in plots: 16 | x.append(float(row[0])) 17 | y.append(float(row[1])) 18 | 19 | plt.plot(x, y, label='ESF') 20 | plt.legend() 21 | plt.show() 22 | 23 | with open('/home/vayalala/workspace2/OpenCLExercise3_Sobel/ValuesPSF.csv','r') as csvfile: 24 | plots = csv.reader(csvfile, delimiter=',') 25 | for row in plots: 26 | a.append(float(row[0])) 27 | b.append(float(row[1])) 28 | 29 | plt.plot(a, b, label='PSF') 30 | plt.legend() 31 | plt.show() 32 | 33 | with open('/home/vayalala/workspace2/OpenCLExercise3_Sobel/ValuesMTF.csv','r') as csvfile: 34 | plots = csv.reader(csvfile, delimiter=',') 35 | for row in plots: 36 | m.append(float(row[0])) 37 | n.append(float(row[1])) 38 | 39 | plt.plot(m, n, label='MTF') 40 | plt.legend() 41 | plt.show() -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/src/OpenCLExercise3_Sobel.cl: -------------------------------------------------------------------------------- 1 | #ifndef __OPENCL_VERSION__ 2 | #include // Hack to make syntax highlighting in Eclipse work 3 | #endif 4 | 5 | #define TWOPI 6.28318530718 6 | 7 | ////////////////////////////////////////////////////////////////////////////// 8 | // Projection of Pixels onto Edge 9 | ////////////////////////////////////////////////////////////////////////////// 10 | __kernel void sobelKernel(global const float* d_input, global const float* d_inputEdge, global float* d_distance, global float* d_intensity, 11 | float A, float B, float C) { 12 | 13 | size_t i = get_global_id(0); 14 | size_t j = get_global_id(1); 15 | size_t countX = get_global_size(0); 16 | size_t countY = get_global_size(1); 17 | 18 | float temp; 19 | 20 | if(d_inputEdge[i + countX * j] == 255){ 21 | temp = 0; 22 | } 23 | else{ 24 | temp = ((A*i)+(B*j)+C); 25 | } 26 | d_distance[i + countX * j] = (temp/sqrt((A*A) + (B*B))); 27 | d_intensity[i + countX * j] = d_input[i + countX * j]; 28 | } 29 | 30 | ////////////////////////////////////////////////////////////////////////////// 31 | // FFT Implementation 32 | ////////////////////////////////////////////////////////////////////////////// 33 | __kernel void naivefft2( __global const float* srcx, __global const float* srcy, __global float* dstx, __global float* dsty, 34 | const unsigned int n) { 35 | const float ph = -TWOPI / n; 36 | const int gid = get_global_id(0); 37 | 38 | float resx = 0.0f; 39 | float resy = 0.0f; 40 | 41 | for (int k = 0; k < n; k++) { 42 | const float tx = srcx[k]; 43 | const float ty = srcy[k]; 44 | 45 | const float val = ph * k * gid; 46 | float cs; 47 | float sn = sincos(val, &cs); 48 | resx += tx * cs - ty * sn; 49 | resy += ty * cs + tx * sn; 50 | } 51 | 52 | dstx[gid] = resx; 53 | dsty[gid] = resy; 54 | } 55 | 56 | ////////////////////////////////////////////////////////////////////////////// 57 | // Differentiation 58 | ////////////////////////////////////////////////////////////////////////////// 59 | __kernel void differ(global const float* d_inputDiffInten, global const float* d_inputDiffDist, global float* d_outputDiffInten, 60 | global float* d_outputDiffDist) { 61 | 62 | size_t i = get_global_id(0); 63 | size_t countX = get_global_size(0); 64 | 65 | float prev_intensity = 0; 66 | float next_intensity = 0; 67 | 68 | if(i==0 || i==(countX - 1)){ 69 | d_outputDiffInten[i] = 0; 70 | d_outputDiffDist[i] = d_inputDiffDist[i]; 71 | }else{ 72 | prev_intensity = d_inputDiffInten[i-1]; 73 | next_intensity = d_inputDiffInten[i+1]; 74 | d_outputDiffInten[i] = fabs((next_intensity - prev_intensity)/2); 75 | d_outputDiffDist[i] = d_inputDiffDist[i]; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/v_edge.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/v_edge.tif -------------------------------------------------------------------------------- /OpenCLExercise3_Sobel/v_edge_mono.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gunjan1917/GPU-Programming/436789c459e0d25decf271983bef000f3921a8a8/OpenCLExercise3_Sobel/v_edge_mono.tif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GPU Programming 2 | Implementation of MTF measurement on Slanted Edge: ISO 12233:2017 3 | 4 | # Project Description 5 | Modulation transfer function (MTF) is a commonly used measure to compare the performance of optical systems. While multiple techniques can be employed to estimate MTF, the preferred routine for computing the spatial resolution performance of photographic equipment and X-ray CT systems is the slanted edge method. As specified in ISO standard 12233, this method calculates MTF as a function of the vertical spatial frequencies by analyzing a user-defined rectangular region of interest (ROI) in an image of an extracted slanted-edge target. Next, pixelbinning technique is applied to plot the Edge Spread Function (ESF). Lastly, this ESF is differentiated and Fourier-transformed to estimate MTF. To achieve such high data parallelism in CPU, the speedup factor gets limited to the number of cores. With a motive to accelerate execution time, this project outlines the performance of slanted-edge method to estimate MTF between GPU and CPU. 6 | 7 | # Instructions for Implementation 8 | - The MTF Implementation code is present in "OpenCLExercise3_Sobel/src". 9 | - Run "OpenCLExercise3_Sobel.cpp". Additional libraries required would be opencv_core, opencv_imgproc, opencv_highgui, opencv_ml availabe at "/usr/lib/x86_64-linux-gnu". 10 | - Excel files would haven been generated in the project folder after successful execution. 11 | - use "plot.py" python script to plot the ESF, PSF, MTF curve respectively. 12 | - Documentation of the project including results and runtimes of GPU, CPU can be found in MTF_lab_Report_with_RMSE_results.pdf 13 | 14 | NOTE - Since the creation of new project for openCL implementation is creating many errors, an existing project template "OpenCLExercise3_Sobel" is used for implementation of MTF. 15 | --------------------------------------------------------------------------------