diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 168 |
1 files changed, 112 insertions, 56 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 02ffba1d..6deee35d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,21 +18,19 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_fla # CMake project details project("clblast" C CXX) set(clblast_VERSION_MAJOR 0) -set(clblast_VERSION_MINOR 7) -set(clblast_VERSION_PATCH 1) +set(clblast_VERSION_MINOR 8) +set(clblast_VERSION_PATCH 0) # Options and their default values option(SAMPLES "Enable compilation of the examples" OFF) option(TUNERS "Enable compilation of the tuners" OFF) -option(TESTS "Enable compilation of the performance and correctness tests" OFF) +option(CLIENTS "Enable compilation of the clients to test and compare performance" OFF) +option(TESTS "Enable compilation of the correctness tests" OFF) # ================================================================================================== # RPATH settings -set(CMAKE_SKIP_BUILD_RPATH false) # Use, i.e. don't skip the full RPATH for the build tree -set(CMAKE_BUILD_WITH_INSTALL_RPATH false) # When building, don't use the install RPATH already -set(CMAKE_INSTALL_RPATH "") # The RPATH to be used when installing -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH false) # Don't add the automatically determined parts +set(CMAKE_MACOSX_RPATH 1) # ================================================================================================== @@ -106,46 +104,62 @@ endif() # Locates the reference BLAS libraries in case the tests need to be compiled. The "FindclBLAS.cmake" # and "FindCBLAS.cmake" are included. -if(TESTS) +if(CLIENTS OR TESTS) find_package(clBLAS) find_package(CBLAS) if(NOT CLBLAS_FOUND AND NOT CBLAS_FOUND) - message(STATUS "Could NOT find clBLAS nor a CPU BLAS, disabling the compilation of the tests") - set(TESTS OFF) + if(TESTS) + message(STATUS "Could NOT find clBLAS nor a CPU BLAS, disabling the compilation of the tests") + set(TESTS OFF) + endif() + if(CLIENTS) + message(STATUS "Could NOT find clBLAS nor a CPU BLAS, head-to-head performance comparison not supported in the clients") + endif() endif() endif() # ================================================================================================== # Includes directories: CLBlast and OpenCL -include_directories(${clblast_SOURCE_DIR}/include ${OPENCL_INCLUDE_DIRS}) +include_directories(${clblast_SOURCE_DIR}/include ${clblast_SOURCE_DIR}/src ${OPENCL_INCLUDE_DIRS}) # ================================================================================================== # Sets the supported routines and the used kernels. New routines and kernels should be added here. -set(KERNELS copy pad transpose padtranspose xaxpy xdot xger xgemm xgemv) +set(KERNELS copy_fast copy_pad transpose_fast transpose_pad xaxpy xdot xger xgemm xgemv) set(SAMPLE_PROGRAMS_CPP sgemm) -set(SAMPLE_PROGRAMS_C sasum dgemv sgemm cache) +set(SAMPLE_PROGRAMS_C sasum dgemv sgemm haxpy cache) set(LEVEL1_ROUTINES xswap xscal xcopy xaxpy xdot xdotu xdotc xnrm2 xasum xamax) set(LEVEL2_ROUTINES xgemv xgbmv xhemv xhbmv xhpmv xsymv xsbmv xspmv xtrmv xtbmv xtpmv xger xgeru xgerc xher xhpr xher2 xhpr2 xsyr xspr xsyr2 xspr2) set(LEVEL3_ROUTINES xgemm xsymm xhemm xsyrk xherk xsyr2k xher2k xtrmm) -set(ROUTINES ${LEVEL1_ROUTINES} ${LEVEL2_ROUTINES} ${LEVEL3_ROUTINES}) -set(PRECISIONS 32 64 3232 6464) +set(LEVELX_ROUTINES xomatcopy) +set(ROUTINES ${LEVEL1_ROUTINES} ${LEVEL2_ROUTINES} ${LEVEL3_ROUTINES} ${LEVELX_ROUTINES}) +set(PRECISIONS 32 64 3232 6464 16) # ================================================================================================== # Gathers all source-files -set(SOURCES src/clblast.cc src/database.cc src/routine.cc src/cache.cc - src/utilities.cc src/clblast_c.cc) +set(SOURCES + src/database/database.cpp + src/routines/common.cpp + src/cache.cpp + src/clblast.cpp + src/clblast_c.cpp + src/routine.cpp + src/utilities.cpp +) foreach(ROUTINE ${LEVEL1_ROUTINES}) - set(SOURCES ${SOURCES} src/routines/level1/${ROUTINE}.cc) + set(SOURCES ${SOURCES} src/routines/level1/${ROUTINE}.cpp) endforeach() foreach(ROUTINE ${LEVEL2_ROUTINES}) - set(SOURCES ${SOURCES} src/routines/level2/${ROUTINE}.cc) + set(SOURCES ${SOURCES} src/routines/level2/${ROUTINE}.cpp) endforeach() foreach(ROUTINE ${LEVEL3_ROUTINES}) - set(SOURCES ${SOURCES} src/routines/level3/${ROUTINE}.cc) + set(SOURCES ${SOURCES} src/routines/level3/${ROUTINE}.cpp) +endforeach() +foreach(ROUTINE ${LEVELX_ROUTINES}) + set(SOURCES ${SOURCES} src/routines/levelx/${ROUTINE}.cpp) endforeach() # Creates and links the library @@ -156,6 +170,7 @@ target_link_libraries(clblast ${OPENCL_LIBRARIES}) install(TARGETS clblast DESTINATION lib) install(FILES include/clblast.h DESTINATION include) install(FILES include/clblast_c.h DESTINATION include) +install(FILES include/clblast_half.h DESTINATION include) # ================================================================================================== @@ -178,7 +193,7 @@ if(SAMPLES) # Adds sample programs (C++) foreach(SAMPLE ${SAMPLE_PROGRAMS_CPP}) - add_executable(clblast_sample_${SAMPLE} samples/${SAMPLE}.cc) + add_executable(clblast_sample_${SAMPLE} samples/${SAMPLE}.cpp) target_link_libraries(clblast_sample_${SAMPLE} clblast ${OPENCL_LIBRARIES}) install(TARGETS clblast_sample_${SAMPLE} DESTINATION bin) endforeach() @@ -203,7 +218,7 @@ if(TUNERS) # Adds tuning executables foreach(KERNEL ${KERNELS}) - add_executable(clblast_tuner_${KERNEL} src/tuning/${KERNEL}.cc) + add_executable(clblast_tuner_${KERNEL} src/tuning/kernels/${KERNEL}.cpp) target_link_libraries(clblast_tuner_${KERNEL} clblast ${CLTUNE_LIBRARIES} ${OPENCL_LIBRARIES}) install(TARGETS clblast_tuner_${KERNEL} DESTINATION bin) endforeach() @@ -223,9 +238,8 @@ endif() # ================================================================================================== -# Down from here is all test (performance and correctness) related. Note that these tests require -# the presence of clBLAS and/or a BLAS library to act as a reference. -if(TESTS) +# Section for the tests: common part for both performance ('CLIENTS') and correctness ('TESTS') +if(CLIENTS OR TESTS) # Sets the specifics for the reference BLAS libraries set(REF_INCLUDES ) @@ -250,28 +264,90 @@ if(TESTS) endif() # Sets the include directories - include_directories(${clblast_SOURCE_DIR}/test ${REF_INCLUDES}) + include_directories(${clblast_SOURCE_DIR} ${REF_INCLUDES}) + +endif() + +# ================================================================================================== - # Creates the common correctness-tests objects (requires CMake 2.8.8) - add_library(test_correctness_common OBJECT - test/correctness/tester.cc test/correctness/testblas.cc) +# Section for the performance tests (i.e. the client). These compare against optionally a reference +# library, either clBLAS or a CPU BLAS. +if(CLIENTS) + + # Visual Studio requires the sources of non-exported objects/libraries + set(CLIENTS_COMMON ) + if(MSVC) + set(CLIENTS_COMMON ${CLIENTS_COMMON} src/utilities.cpp test/performance/client.cpp) + else() + # Creates the common performance-tests objects (requires CMake 2.8.8) + add_library(test_performance_common OBJECT test/performance/client.cpp) + set(CLIENTS_COMMON ${CLIENTS_COMMON} $<TARGET_OBJECTS:test_performance_common>) + endif() + + # Compiles the performance-tests + foreach(ROUTINE ${LEVEL1_ROUTINES}) + add_executable(clblast_client_${ROUTINE} ${CLIENTS_COMMON} + test/performance/routines/level1/${ROUTINE}.cpp) + endforeach() + foreach(ROUTINE ${LEVEL2_ROUTINES}) + add_executable(clblast_client_${ROUTINE} ${CLIENTS_COMMON} + test/performance/routines/level2/${ROUTINE}.cpp) + endforeach() + foreach(ROUTINE ${LEVEL3_ROUTINES}) + add_executable(clblast_client_${ROUTINE} ${CLIENTS_COMMON} + test/performance/routines/level3/${ROUTINE}.cpp) + endforeach() + foreach(ROUTINE ${LEVELX_ROUTINES}) + add_executable(clblast_client_${ROUTINE} ${CLIENTS_COMMON} + test/performance/routines/levelx/${ROUTINE}.cpp) + endforeach() + foreach(ROUTINE ${ROUTINES}) + target_link_libraries(clblast_client_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES}) + install(TARGETS clblast_client_${ROUTINE} DESTINATION bin) + endforeach() + +endif() + +# ================================================================================================== + +# Section for the correctness tests. Note that these tests require the presence of clBLAS and/or a +# CPU BLAS library to act as a reference. +if(TESTS) + enable_testing() + + # Visual Studio requires the sources of non-exported objects/libraries + set(TESTS_COMMON ) + if(MSVC) + set(TESTS_COMMON ${TESTS_COMMON} src/utilities.cpp + test/correctness/tester.cpp test/correctness/testblas.cpp) + else() + # Creates the common correctness-tests objects (requires CMake 2.8.8) + add_library(test_correctness_common OBJECT + test/correctness/tester.cpp test/correctness/testblas.cpp) + set(TESTS_COMMON ${TESTS_COMMON} $<TARGET_OBJECTS:test_correctness_common>) + endif() # Compiles the correctness-tests foreach(ROUTINE ${LEVEL1_ROUTINES}) - add_executable(clblast_test_${ROUTINE} $<TARGET_OBJECTS:test_correctness_common> - test/correctness/routines/level1/${ROUTINE}.cc) + add_executable(clblast_test_${ROUTINE} ${TESTS_COMMON} + test/correctness/routines/level1/${ROUTINE}.cpp) endforeach() foreach(ROUTINE ${LEVEL2_ROUTINES}) - add_executable(clblast_test_${ROUTINE} $<TARGET_OBJECTS:test_correctness_common> - test/correctness/routines/level2/${ROUTINE}.cc) + add_executable(clblast_test_${ROUTINE} ${TESTS_COMMON} + test/correctness/routines/level2/${ROUTINE}.cpp) endforeach() foreach(ROUTINE ${LEVEL3_ROUTINES}) - add_executable(clblast_test_${ROUTINE} $<TARGET_OBJECTS:test_correctness_common> - test/correctness/routines/level3/${ROUTINE}.cc) + add_executable(clblast_test_${ROUTINE} ${TESTS_COMMON} + test/correctness/routines/level3/${ROUTINE}.cpp) + endforeach() + foreach(ROUTINE ${LEVELX_ROUTINES}) + add_executable(clblast_test_${ROUTINE} ${TESTS_COMMON} + test/correctness/routines/levelx/${ROUTINE}.cpp) endforeach() foreach(ROUTINE ${ROUTINES}) target_link_libraries(clblast_test_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES}) install(TARGETS clblast_test_${ROUTINE} DESTINATION bin) + add_test(clblast_test_${ROUTINE} clblast_test_${ROUTINE} ${DEVICEPLATFORM}) endforeach() # Adds 'alltests' target: runs all tests @@ -283,26 +359,6 @@ if(TESTS) endforeach() add_custom_target(alltests ${ALLTESTS} DEPENDS ${ALLTESTSDEPENDS}) - # Creates the common performance-tests objects (requires CMake 2.8.8) - add_library(test_performance_common OBJECT test/performance/client.cc) - - # Compiles the performance-tests - foreach(ROUTINE ${LEVEL1_ROUTINES}) - add_executable(clblast_client_${ROUTINE} $<TARGET_OBJECTS:test_performance_common> - test/performance/routines/level1/${ROUTINE}.cc) - endforeach() - foreach(ROUTINE ${LEVEL2_ROUTINES}) - add_executable(clblast_client_${ROUTINE} $<TARGET_OBJECTS:test_performance_common> - test/performance/routines/level2/${ROUTINE}.cc) - endforeach() - foreach(ROUTINE ${LEVEL3_ROUTINES}) - add_executable(clblast_client_${ROUTINE} $<TARGET_OBJECTS:test_performance_common> - test/performance/routines/level3/${ROUTINE}.cc) - endforeach() - foreach(ROUTINE ${ROUTINES}) - target_link_libraries(clblast_client_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES}) - install(TARGETS clblast_client_${ROUTINE} DESTINATION bin) - endforeach() - endif() + # ================================================================================================== |