forked from krrishnarraj/clpeak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
98 lines (84 loc) · 2.62 KB
/
CMakeLists.txt
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
cmake_minimum_required(VERSION 2.6)
project(clpeak)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
# Determine machine bitness
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BITNESS 64)
else()
set(BITNESS 32)
endif()
# Find OpenCL include directories
find_path( OPENCL_INCLUDES
NAMES CL/cl.h OpenCL/cl.h
HINTS
$ENV{AMDAPPSDKROOT}/include
$ENV{INTELOCLSDKROOT}/include
$ENV{CUDA_PATH}/include
$ENV{OPENCL_ROOT}/include
PATHS
/usr/include
/usr/local/include
)
# Find OpenCL libraries
if(BITNESS EQUAL 64)
find_library( OPENCL_LIBS
NAMES OpenCL
HINTS
$ENV{AMDAPPSDKROOT}/lib
$ENV{INTELOCLSDKROOT}/lib
$ENV{CUDA_PATH}/lib
$ENV{OPENCL_ROOT}/lib
PATH_SUFFIXES x86_64 x64
PATHS
/usr/lib64
/usr/lib
)
elseif(BITNESS EQUAL 32)
find_library( OPENCL_LIBS
NAMES OpenCL
HINTS
$ENV{AMDAPPSDKROOT}/lib
$ENV{INTELOCLSDKROOT}/lib
$ENV{CUDA_PATH}/lib
$ENV{OPENCL_ROOT}/lib
PATH_SUFFIXES x86 Win32
PATHS
/usr/lib32
/usr/lib
)
endif()
if( (NOT OPENCL_INCLUDES) OR (NOT OPENCL_LIBS) )
message( FATAL_ERROR "Could not find OpenCL include/libs. Set OPENCL_ROOT to your OpenCL SDK. Download AMD APP SDK "
"http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/ for x86/x64 "
"or pocl http://pocl.sourceforge.net/ for ARM systems" )
else()
message(STATUS "Selected OpenCL includes from ${OPENCL_INCLUDES}")
message(STATUS "Selected OpenCL lib ${OPENCL_LIBS}")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)
add_definitions("-std=gnu++11")
elseif(GCC_VERSION VERSION_GREATER 4.3 OR GCC_VERSION VERSION_EQUAL 4.3)
add_definitions("-std=gnu++0x")
else()
message(FATAL_ERROR "C++11 needed. Therefore a gcc compiler with a version higher than 4.3 is needed.")
endif()
endif()
include_directories(${OPENCL_INCLUDES} "src/include" "src/kernels")
set(SOURCE_FILES
src/common.cpp
src/clpeak.cpp
src/global_bandwidth.cpp
src/compute_sp.cpp
src/compute_dp.cpp
src/compute_integer.cpp
src/transfer_bandwidth.cpp
src/kernel_latency.cpp
src/main.cpp
)
add_executable(clpeak ${SOURCE_FILES})
target_link_libraries(clpeak ${OPENCL_LIBS})