-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from CNugteren/development
Added machine learning, new CLCudaAPI, CUDA, Catch, and MSVC support
- Loading branch information
Showing
208 changed files
with
12,046 additions
and
141,617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
# ================================================================================================== | ||
# This file is part of the CLTune project. | ||
# | ||
# Author: [email protected] (Cedric Nugteren) | ||
# Author(s): | ||
# Cedric Nugteren <www.cedricnugteren.nl> | ||
# | ||
# ------------------------------------------------------------------------------------------------- | ||
# | ||
|
@@ -25,14 +26,23 @@ | |
# CMake project | ||
cmake_minimum_required(VERSION 2.8.10) | ||
project("cltune" CXX) | ||
set(cltune_VERSION_MAJOR 1) | ||
set(cltune_VERSION_MINOR 7) | ||
set(cltune_VERSION_PATCH 1) | ||
set(cltune_VERSION_MAJOR 2) | ||
set(cltune_VERSION_MINOR 0) | ||
set(cltune_VERSION_PATCH 0) | ||
|
||
# Options | ||
option(SAMPLES "Enable compilation of sample programs" ON) | ||
option(TESTS "Enable compilation of the Google tests" OFF) | ||
|
||
# Select between OpenCL and CUDA back-end | ||
option(USE_OPENCL "Use OpenCL instead of CUDA" ON) | ||
if(USE_OPENCL) | ||
message("-- Building with OpenCL") | ||
add_definitions(-DUSE_OPENCL) | ||
else() | ||
message("-- Building with CUDA") | ||
endif() | ||
|
||
# ================================================================================================== | ||
|
||
# RPATH settings | ||
|
@@ -67,17 +77,18 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | |
endif() | ||
|
||
# C++ compiler settings | ||
set(FLAGS "-O3 -std=c++11") | ||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
set(FLAGS "${FLAGS} -Wall -Wno-comment") | ||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.4) | ||
set(FLAGS "${FLAGS} -Wno-attributes") | ||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") | ||
set(FLAGS "/Ox") | ||
else () | ||
set(FLAGS "-O3 -std=c++11") | ||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") | ||
set(FLAGS "${FLAGS} -Wall -Wno-comment") | ||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.4) | ||
set(FLAGS "${FLAGS} -Wno-attributes") | ||
endif() | ||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||
set(FLAGS "${FLAGS} -Wextra") | ||
endif() | ||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") | ||
set(FLAGS "${FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded") | ||
set(FLAGS "${FLAGS} -Wno-missing-prototypes -Wno-float-equal -Wno-weak-vtables") | ||
set(FLAGS "${FLAGS} -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes") | ||
set(FLAGS "${FLAGS} -Wno-missing-noreturn -Wno-covered-switch-default") | ||
endif() | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | ||
|
||
|
@@ -86,13 +97,26 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}") | |
# Package scripts location | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") | ||
|
||
# Requires OpenCL (FindOpenCL is included as part of this project) | ||
find_package(OpenCL REQUIRED) | ||
# Requires CUDA or OpenCL. The latter is found through the included "FindOpenCL.cmake". | ||
if(USE_OPENCL) | ||
find_package(OpenCL REQUIRED) | ||
set(FRAMEWORK_INCLUDE_DIRS ${OPENCL_INCLUDE_DIRS}) | ||
set(FRAMEWORK_LIBRARY_DIRS ) | ||
set(FRAMEWORK_LIBRARIES ${OPENCL_LIBRARIES}) | ||
else() | ||
find_package(CUDA REQUIRED) | ||
set(FRAMEWORK_INCLUDE_DIRS ${CUDA_INCLUDE_DIRS}) | ||
set(FRAMEWORK_LIBRARY_DIRS ${CUDA_TOOLKIT_ROOT_DIR}/lib64) | ||
set(FRAMEWORK_LIBRARIES cuda nvrtc) | ||
endif() | ||
|
||
# ================================================================================================== | ||
|
||
# The includes | ||
include_directories(${cltune_SOURCE_DIR}/include ${OPENCL_INCLUDE_DIRS}) | ||
# Include directories: CLTune headers and OpenCL/CUDA includes | ||
include_directories(${cltune_SOURCE_DIR}/include ${FRAMEWORK_INCLUDE_DIRS}) | ||
|
||
# Link directories: CUDA toolkit | ||
link_directories(${FRAMEWORK_LIBRARY_DIRS}) | ||
|
||
# Gathers all source-files | ||
set(TUNER | ||
|
@@ -103,48 +127,48 @@ set(TUNER | |
src/searchers/full_search.cc | ||
src/searchers/random_search.cc | ||
src/searchers/annealing.cc | ||
src/searchers/pso.cc) | ||
src/searchers/pso.cc | ||
src/ml_model.cc | ||
src/ml_models/linear_regression.cc | ||
src/ml_models/neural_network.cc) | ||
|
||
# Creates and links the library | ||
add_library(cltune SHARED ${TUNER}) | ||
target_link_libraries(cltune ${OPENCL_LIBRARIES}) | ||
target_link_libraries(cltune ${FRAMEWORK_LIBRARIES}) | ||
|
||
# Installs the library | ||
install(TARGETS cltune DESTINATION lib) | ||
install(FILES include/cltune.h DESTINATION include) | ||
|
||
# ================================================================================================== | ||
|
||
# Optional: Enables compilation of sample programs | ||
if (SAMPLES) | ||
|
||
# Adds sample programs | ||
add_executable(sample_simple samples/simple/simple.cc) | ||
add_executable(sample_gemm samples/gemm/gemm.cc) | ||
add_executable(sample_conv samples/conv/conv.cc) | ||
target_link_libraries(sample_simple cltune ${OPENCL_LIBRARIES} ${OpenMP_LIBRARY}) | ||
target_link_libraries(sample_gemm cltune ${OPENCL_LIBRARIES} ${OpenMP_LIBRARY}) | ||
target_link_libraries(sample_conv cltune ${OPENCL_LIBRARIES} ${OpenMP_LIBRARY}) | ||
target_link_libraries(sample_simple cltune ${FRAMEWORK_LIBRARIES} ${OpenMP_LIBRARY}) | ||
target_link_libraries(sample_gemm cltune ${FRAMEWORK_LIBRARIES} ${OpenMP_LIBRARY}) | ||
target_link_libraries(sample_conv cltune ${FRAMEWORK_LIBRARIES} ${OpenMP_LIBRARY}) | ||
|
||
# Note: these are not installed because they depend on their separate OpenCL kernel files | ||
|
||
endif() | ||
# ================================================================================================== | ||
# Optional: Enables compilation of the Google tests | ||
if (TESTS) | ||
|
||
# The tests use specific flags to reduce the amount of warnings from GTest. | ||
set(CMAKE_CXX_FLAGS "-O3 -std=c++11") | ||
# ================================================================================================== | ||
|
||
# Enables Google Test tests (source-code is shipped with the project) | ||
add_subdirectory(external/gtest-1.7.0) | ||
# Optional: Enable inclusion of the test-suite | ||
if (TESTS) | ||
enable_testing() | ||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) | ||
|
||
# Compiles the tests | ||
add_executable(unit_tests test/tuner.cc test/kernel_info.cc) | ||
target_link_libraries(unit_tests gtest gtest_main cltune ${OPENCL_LIBRARIES}) | ||
|
||
# Adds the tests | ||
add_test(name unit_tests command unit_tests) | ||
include_directories(${cltune_SOURCE_DIR}/test ${cltune_SOURCE_DIR}/include ${FRAMEWORK_INCLUDE_DIRS}) | ||
add_executable(unit_tests | ||
test/main.cc | ||
test/clcudaapi.cc | ||
test/tuner.cc | ||
test/kernel_info.cc) | ||
target_link_libraries(unit_tests cltune ${FRAMEWORK_LIBRARIES}) | ||
add_test(unit_tests unit_tests) | ||
endif() | ||
|
||
# ================================================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.