diff options
author | Pankaj Kukreja <cs15btech11029@iith.ac.in> | 2018-08-07 17:21:25 +0000 |
---|---|---|
committer | Pankaj Kukreja <cs15btech11029@iith.ac.in> | 2018-08-07 17:21:25 +0000 |
commit | 09307525e8eb2a03a04f0d9ecffee644b03d6504 (patch) | |
tree | c240d239d025899c276e4788ea14bd633d82ef91 /MicroBenchmarks | |
parent | 9ad270d323a08de54ac21c7668f1d5813625e8c2 (diff) |
Fixed build error caused by MicroBenchmarks/ImageProcessing with clang
clang gives error
Changes:
Removed -std=c++11 flag from cmake files of ImageProcessing kernels
Used c++03 version of benchmark library instead of c++11
In main.cpp changed Args({a, b}) to ArgPair(a,b)
In main.cpp changed for(auto _ : state) to while(state.KeepRunning())
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@339154 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'MicroBenchmarks')
9 files changed, 32 insertions, 27 deletions
diff --git a/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt b/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt index 8e0c8850..ace592c6 100644 --- a/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt +++ b/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt @@ -1,12 +1,12 @@ set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils) -list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11) +list(APPEND CXXFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS}) +list(APPEND LDFLAGS -lm) llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/anisotropicDiffusionOutput.txt") llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/anisotropicDiffusionOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/anisotropicDiffusion.reference_output") llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}) - llvm_test_executable(AnisotropicDiffusion ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp anisotropicDiffusionKernel.c) target_link_libraries(AnisotropicDiffusion benchmark) diff --git a/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp b/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp index 515b52a0..831bffbf 100644 --- a/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp +++ b/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/main.cpp @@ -6,6 +6,7 @@ #include "ImageHelper.h" #include "diffusion.h" +#include <cstdlib> #include <iostream> // std::cerr #define BENCHMARK_LIB @@ -82,7 +83,7 @@ void BENCHMARK_ANISTROPIC_DIFFUSION(benchmark::State &state) { /* first call made to warm up cache */ anisotropicDiffusionKernel(height, width, inputImage, outputImage, ITERATION); - for (auto _ : state) { + while (state.KeepRunning()) { anisotropicDiffusionKernel(height, width, inputImage, outputImage, ITERATION); } diff --git a/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt b/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt index 551e6ed6..18f66840 100644 --- a/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt +++ b/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt @@ -1,6 +1,7 @@ set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils) list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11) +list(APPEND LDFLAGS -lm) llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/boxBlurOutput.txt") llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/boxBlurOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/boxBlur.reference_output") @@ -9,7 +10,6 @@ llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINAR llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/gaussianBlurOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/gaussianBlur.reference_output") llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}) - llvm_test_executable(blur ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp boxBlurKernel.c gaussianBlurKernel.c) target_link_libraries(blur benchmark) diff --git a/MicroBenchmarks/ImageProcessing/Blur/main.cpp b/MicroBenchmarks/ImageProcessing/Blur/main.cpp index 9d35c21a..028e007d 100644 --- a/MicroBenchmarks/ImageProcessing/Blur/main.cpp +++ b/MicroBenchmarks/ImageProcessing/Blur/main.cpp @@ -6,6 +6,7 @@ Indian Institute of Technology Hyderabad #include "ImageHelper.h" #include "blur.h" +#include <cstdlib> #include <iostream> #define BENCHMARK_LIB @@ -126,7 +127,7 @@ int main(int argc, char *argv[]) { void BENCHMARK_boxBlurKernel(benchmark::State &state) { int height = state.range(0); - int width = state.range(1); + int width = state.range(0); int *outputImage = (int *)malloc(sizeof(int) * (height) * (width)); @@ -137,7 +138,7 @@ void BENCHMARK_boxBlurKernel(benchmark::State &state) { /* This call is to warm up the cache */ boxBlurKernel(height, width, inputImage, outputImage); - for (auto _ : state) { + while (state.KeepRunning()) { boxBlurKernel(height, width, inputImage, outputImage); } /* Since we are not passing state.range as 20 this if case will always be @@ -150,16 +151,16 @@ void BENCHMARK_boxBlurKernel(benchmark::State &state) { free(outputImage); } BENCHMARK(BENCHMARK_boxBlurKernel) - ->Args({128, 128}) - ->Args({256, 256}) - ->Args({512, 512}) - ->Args({1024, 1024}) + ->Arg(128) + ->Arg(256) + ->Arg(512) + ->Arg(1024) ->Unit(benchmark::kMicrosecond); void BENCHMARK_GAUSSIAN_BLUR(benchmark::State &state) { int height = state.range(0); - int width = state.range(1); + int width = state.range(0); int *outputImage = (int *)malloc(sizeof(int) * (height) * (width)); @@ -169,8 +170,7 @@ void BENCHMARK_GAUSSIAN_BLUR(benchmark::State &state) { } /* This call is to warm up the cache */ gaussianBlurKernel(height, width, inputImage, outputImage); - - for (auto _ : state) { + while (state.KeepRunning()) { gaussianBlurKernel(height, width, inputImage, outputImage); } /* Since we are not passing state.range as 20 this if case will always be @@ -184,9 +184,9 @@ void BENCHMARK_GAUSSIAN_BLUR(benchmark::State &state) { } BENCHMARK(BENCHMARK_GAUSSIAN_BLUR) - ->Args({128, 128}) - ->Args({256, 256}) - ->Args({512, 512}) - ->Args({1024, 1024}) + ->Arg(128) + ->Arg(256) + ->Arg(512) + ->Arg(1024) ->Unit(benchmark::kMicrosecond); #endif diff --git a/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt b/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt index 28d57115..b89b7d85 100644 --- a/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt +++ b/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt @@ -1,5 +1,6 @@ set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils) -list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11) +list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS}) +list(APPEND LDFLAGS -lm) llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/orderedOutput.txt") llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/orderedOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/orderedDither.reference_output") diff --git a/MicroBenchmarks/ImageProcessing/Dither/main.cpp b/MicroBenchmarks/ImageProcessing/Dither/main.cpp index b6ab1d36..21faf73d 100644 --- a/MicroBenchmarks/ImageProcessing/Dither/main.cpp +++ b/MicroBenchmarks/ImageProcessing/Dither/main.cpp @@ -6,6 +6,7 @@ #include "ImageHelper.h" #include "dither.h" #include <cmath> +#include <cstdlib> #include <iostream> // std::cerr #define BENCHMARK_LIB @@ -79,7 +80,7 @@ void BENCHMARK_ORDERED_DITHER(benchmark::State &state) { /* This call is to warm up the cache */ orderedDitherKernel(height, width, inputImage, outputImage, temp, n, m); - for (auto _ : state) { + while (state.KeepRunning()) { orderedDitherKernel(height, width, inputImage, outputImage, temp, n, m); } /* Since we are not passing state.range as 20 this if case will always be @@ -105,10 +106,10 @@ static void CustomArguments(benchmark::internal::Benchmark *b) { start = 128; } for (int i = start; i <= limit; i <<= 1) { - b->Args({i, 2}); - b->Args({i, 3}); - b->Args({i, 4}); - b->Args({i, 8}); + b->ArgPair(i, 2); + b->ArgPair(i, 3); + b->ArgPair(i, 4); + b->ArgPair(i, 8); } } BENCHMARK(BENCHMARK_ORDERED_DITHER) @@ -128,7 +129,7 @@ void BENCHMARK_FLOYD_DITHER(benchmark::State &state) { } /* This call is to warm up the cache */ floydDitherKernel(height, width, inputImage, outputImage); - for (auto _ : state) { + while (state.KeepRunning()) { floydDitherKernel(height, width, inputImage, outputImage); } /* Since we are not passing state.range as 20 this if case will always be diff --git a/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt b/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt index f0cec8df..8e393cec 100644 --- a/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt +++ b/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt @@ -1,5 +1,5 @@ set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils) -list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS} -std=c++11) +list(APPEND CXXFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS}) llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/bicubicOutput.txt") llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/bicubicOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/bicubic.reference_output") diff --git a/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp b/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp index 4561bb2d..d95ba294 100644 --- a/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp +++ b/MicroBenchmarks/ImageProcessing/Interpolation/main.cpp @@ -5,6 +5,7 @@ */ #include "ImageHelper.h" #include "interpolation.h" +#include <cstdlib> #include <iostream> // std::cerr #define BENCHMARK_LIB @@ -89,7 +90,7 @@ void BENCHMARK_BICUBIC_INTERPOLATION(benchmark::State &state) { /* This call is to warm up the cache */ bicubicKernel(inputHeight, inputWidth, inputImage, outputImage); - for (auto _ : state) { + while (state.KeepRunning()) { bicubicKernel(inputHeight, inputWidth, inputImage, outputImage); } @@ -126,7 +127,7 @@ void BENCHMARK_BILINEAR_INTERPOLATION(benchmark::State &state) { /* This call is to warm up the cache */ bilinearKernel(inputHeight, inputWidth, inputImage, outputImage); - for (auto _ : state) { + while (state.KeepRunning()) { bilinearKernel(inputHeight, inputWidth, inputImage, outputImage); } diff --git a/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp b/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp index ce06e5c3..fea92a71 100644 --- a/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp +++ b/MicroBenchmarks/ImageProcessing/utils/ImageHelper.cpp @@ -7,6 +7,7 @@ Indian Institute of Technology Hyderabad #include "ImageHelper.h" #include "glibc_compat_rand.h" +#include <cstdlib> #include <fstream> // For reading and saving Image #include <iostream> // For std::cerr |