From c5406ef7896d27f64a98c9bb7d0a550949d84d38 Mon Sep 17 00:00:00 2001 From: Moritz Lehmann Date: Sun, 30 Apr 2023 23:59:12 +0200 Subject: [PATCH] Fixed several issues with macOS --- make.sh | 6 +++--- src/kernel.cpp | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/make.sh b/make.sh index 1bb03fb..22bb9dd 100644 --- a/make.sh +++ b/make.sh @@ -3,8 +3,8 @@ mkdir -p bin # create directory for executable rm -f ./bin/OpenCL-Benchmark # prevent execution of old version if compiling fails -g++ ./src/*.cpp -o ./bin/OpenCL-Benchmark -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL # compile on Linux -#g++ ./src/*.cpp -o ./bin/OpenCL-Benchmark -pthread -I./src/OpenCL/include -framework OpenCL # compile on macOS -#g++ ./src/*.cpp -o ./bin/OpenCL-Benchmark -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL # compile on Android +g++ ./src/*.cpp -o ./bin/OpenCL-Benchmark -std=c++17 -pthread -I./src/OpenCL/include -L./src/OpenCL/lib -lOpenCL # compile on Linux +#g++ ./src/*.cpp -o ./bin/OpenCL-Benchmark -std=c++17 -pthread -I./src/OpenCL/include -framework OpenCL # compile on macOS +#g++ ./src/*.cpp -o ./bin/OpenCL-Benchmark -std=c++17 -pthread -I./src/OpenCL/include -L/system/vendor/lib64 -lOpenCL # compile on Android ./bin/OpenCL-Benchmark "$@" # run OpenCL-Benchmark diff --git a/src/kernel.cpp b/src/kernel.cpp index c2f5211..f89b819 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -7,7 +7,6 @@ string opencl_c_container() { return R( // ########################## begin of O kernel void kernel_double(global float* data) { double x = (double)get_global_id(0); double y = (double)get_local_id(0); - #pragma unroll for(uint i=0u; i<128u; i++) { x = fma(y, x, y); y = fma(x, y, x); @@ -19,7 +18,6 @@ kernel void kernel_double(global float* data) { kernel void kernel_float(global float* data) { float x = (float)get_global_id(0); float y = (float)get_local_id(0); - #pragma unroll for(uint i=0u; i<512u; i++) { x = fma(y, x, y); y = fma(x, y, x); @@ -31,7 +29,6 @@ kernel void kernel_float(global float* data) { kernel void kernel_half(global float* data) { half2 x = (half2)((float)get_global_id(0), (float)get_local_id(0)); half2 y = (half2)((float)get_local_id(0), (float)get_global_id(0)); - #pragma unroll for(uint i=0u; i<512u; i++) { x = fma(y, x, y); y = fma(x, y, x); @@ -43,7 +40,6 @@ kernel void kernel_half(global float* data) { kernel void kernel_long(global float* data) { long x = (long)get_global_id(0); long y = (long)get_local_id(0); - #pragma unroll for(uint i=0u; i<8u; i++) { x = (y*x)+y; y = (x*y)+x; @@ -54,7 +50,6 @@ kernel void kernel_long(global float* data) { kernel void kernel_int(global float* data) { int x = get_global_id(0); int y = get_local_id(0); - #pragma unroll for(uint i=0u; i<512u; i++) { x = (y*x)+y; y = (x*y)+x; @@ -65,7 +60,6 @@ kernel void kernel_int(global float* data) { kernel void kernel_short(global float* data) { short2 x = as_short2((int)get_global_id(0)); short2 y = as_short2((int)get_local_id(0)); - #pragma unroll for(uint i=0u; i<128u; i++) { x = (y*x)+y; y = (x*y)+x; @@ -76,7 +70,6 @@ kernel void kernel_short(global float* data) { kernel void kernel_char(global float* data) { char4 x = as_char4((int)get_global_id(0)); char4 y = as_char4((int)get_local_id(0)); - #pragma unroll for(uint i=0u; i<64u; i++) { x = (y*x)+y; y = (x*y)+x; @@ -88,25 +81,21 @@ kernel void kernel_char(global float* data) { kernel void kernel_coalesced_write(global float* data) { const uint n = get_global_id(0); - #pragma unroll for(uint i=0u; i