<commit_before>CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)

#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# provide only Debug and Release configurations
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "build config types" FORCE)
IF(NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Debug CACHE STRING "build type: Debug or Release" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

IF(NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})
    MESSAGE(FATAL_ERROR "CMAKE_INSTALL_PREFIX has to be an absolute path!")
ENDIF(NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})


PROJECT(HIPACC)
SET(HIPACC_MAJOR_VERSION 0)
SET(HIPACC_MINOR_VERSION 8)
SET(HIPACC_PATCH_VERSION 1)
SET(HIPACC_VERSION ${HIPACC_MAJOR_VERSION}.${HIPACC_MINOR_VERSION}.${HIPACC_PATCH_VERSION})
SET(HIPACC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(HIPACC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

OPTION(USE_POLLY "Use Polly for analysis" OFF)
INCLUDE(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(USE_JIT_ESTIMATE "Compile kernels JIT to estimate resource usage" ON "NOT APPLE" OFF)


# get repository and revision
EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/get_repository_path.sh
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    TIMEOUT 5
    RESULT_VARIABLE git_result
    OUTPUT_VARIABLE HIPACC_GIT_REPOSITORY)
STRING(STRIP ${HIPACC_GIT_REPOSITORY} HIPACC_GIT_REPOSITORY)

EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/get_source_version.sh
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    TIMEOUT 5
    RESULT_VARIABLE git_result
    OUTPUT_VARIABLE HIPACC_GIT_VERSION)
STRING(STRIP ${HIPACC_GIT_VERSION} HIPACC_GIT_VERSION)


# add path for custom modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
FIND_LIBRARY(RT_LIBRARIES rt)
IF(NOT RT_LIBRARIES)
    SET(RT_LIBRARIES "")
ENDIF()
FIND_PACKAGE(Clang REQUIRED)
FIND_PACKAGE(CUDA)
FIND_PACKAGE(NVML)
FIND_PACKAGE(OpenCL)
FIND_PACKAGE(RenderScript)
FIND_PACKAGE(OpenCV)
FIND_PACKAGE(Threads)
IF(THREADS_HAVE_PTHREAD_ARG)
    SET(THREADS_ARG "-pthread")
ENDIF()
IF(CMAKE_THREAD_LIBS_INIT)
    SET(THREADS_LINK "${CMAKE_THREAD_LIBS_INIT}")
ENDIF()

IF(NOT CUDA_FOUND AND NOT OPENCL_FOUND AND NOT RENDERSCRIPT_FOUND)
    MESSAGE(FATAL_ERROR "Neither CUDA, OpenCL nor RenderScript found. At least one of them is required to use HIPACC properly.")
ENDIF(NOT CUDA_FOUND AND NOT OPENCL_FOUND AND NOT RENDERSCRIPT_FOUND)

IF(CUDA_FOUND AND CUDA_VERSION VERSION_LESS "6.5")
    MESSAGE(WARNING "At least CUDA version 6.5 required, but found CUDA version ${CUDA_VERSION}.")
    SET(CUDA_FOUND FALSE)
ENDIF(CUDA_FOUND AND CUDA_VERSION VERSION_LESS "6.5")

IF(CUDA_FOUND)
    SET(NVCC "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc")
    INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})
    SET(NVCC_CPP_STD "-std=c++11")
    MARK_AS_ADVANCED(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_HOST_COMPILER
        CUDA_SDK_ROOT_DIR CUDA_SEPARABLE_COMPILATION CUDA_TOOLKIT_ROOT_DIR
        CUDA_VERBOSE_BUILD)
ELSE(CUDA_FOUND)
    SET(USE_JIT_ESTIMATE OFF)
ENDIF(CUDA_FOUND)

IF(OPENCL_FOUND)
    SET(CL_COMPILER "${CMAKE_INSTALL_PREFIX}/bin/cl_compile")
ENDIF(OPENCL_FOUND)

MESSAGE(STATUS "Configuration summary:")
MESSAGE(STATUS "===")
MESSAGE(STATUS "CUDA support: ${CUDA_FOUND}")
MESSAGE(STATUS "OpenCL support: ${OPENCL_FOUND}")
MESSAGE(STATUS "Renderscript support: ${RENDERSCRIPT_FOUND}")
MESSAGE(STATUS "OpenCV support: ${OPENCV_FOUND}")
MESSAGE(STATUS "Polly support: ${USE_POLLY}")
MESSAGE(STATUS "JIT estimates: ${USE_JIT_ESTIMATE}")
MESSAGE(STATUS "===")


# platform specific fixes
IF(APPLE)
    SET(CUDA_LINK "-Xlinker -framework,CUDA")
    IF(NOT (CUDA_VERSION VERSION_LESS "7.0"))
        SET(NVCC_COMP "${NVCC_CPP_STD} -ccbin ${CLANG_EXECUTABLE} -Xcompiler -arch -Xcompiler x86_64")
    ELSE()
        SET(NVCC_COMP "${NVCC_CPP_STD} -ccbin ${CLANG_EXECUTABLE} -Xcompiler -arch -Xcompiler x86_64 -Xcompiler -stdlib=libstdc++")
    ENDIF()
    SET(TIME_LINK "")
ELSE(APPLE)
    SET(CUDA_LINK "${CUDA_CUDART_LIBRARY} ${CUDA_CUDA_LIBRARY} ${NVML_LIBRARIES}")
    IF(NOT (CUDA_VERSION VERSION_LESS "7.0"))
        FIND_LIBRARY(CUDA_NVRTC_LIBRARY nvrtc HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib ${CUDA_TOOLKIT_ROOT_DIR}/lib64)
        SET(CUDA_LINK "${CUDA_LINK} ${CUDA_NVRTC_LIBRARY}")
    ENDIF()
    SET(NVCC_COMP "${NVCC_CPP_STD} -I${NVML_INCLUDE_DIRS}")
ENDIF(APPLE)


# debug and release builds
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" build)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti")
IF(build STREQUAL "RELEASE")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
ELSE()
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wunused")
ENDIF()
<commit_msg>Remove unused variable.<commit_after>CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)

#SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# provide only Debug and Release configurations
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "build config types" FORCE)
IF(NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Debug CACHE STRING "build type: Debug or Release" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)

IF(NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})
    MESSAGE(FATAL_ERROR "CMAKE_INSTALL_PREFIX has to be an absolute path!")
ENDIF(NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})


PROJECT(HIPACC)
SET(HIPACC_MAJOR_VERSION 0)
SET(HIPACC_MINOR_VERSION 8)
SET(HIPACC_PATCH_VERSION 1)
SET(HIPACC_VERSION ${HIPACC_MAJOR_VERSION}.${HIPACC_MINOR_VERSION}.${HIPACC_PATCH_VERSION})
SET(HIPACC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(HIPACC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

OPTION(USE_POLLY "Use Polly for analysis" OFF)
INCLUDE(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(USE_JIT_ESTIMATE "Compile kernels JIT to estimate resource usage" ON "NOT APPLE" OFF)


# get repository and revision
EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/get_repository_path.sh
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    TIMEOUT 5
    RESULT_VARIABLE git_result
    OUTPUT_VARIABLE HIPACC_GIT_REPOSITORY)
STRING(STRIP ${HIPACC_GIT_REPOSITORY} HIPACC_GIT_REPOSITORY)

EXECUTE_PROCESS(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/get_source_version.sh
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    TIMEOUT 5
    RESULT_VARIABLE git_result
    OUTPUT_VARIABLE HIPACC_GIT_VERSION)
STRING(STRIP ${HIPACC_GIT_VERSION} HIPACC_GIT_VERSION)


# add path for custom modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
FIND_LIBRARY(RT_LIBRARIES rt)
IF(NOT RT_LIBRARIES)
    SET(RT_LIBRARIES "")
ENDIF()
FIND_PACKAGE(Clang REQUIRED)
FIND_PACKAGE(CUDA)
FIND_PACKAGE(NVML)
FIND_PACKAGE(OpenCL)
FIND_PACKAGE(RenderScript)
FIND_PACKAGE(OpenCV)
FIND_PACKAGE(Threads)
IF(THREADS_HAVE_PTHREAD_ARG)
    SET(THREADS_ARG "-pthread")
ENDIF()
IF(CMAKE_THREAD_LIBS_INIT)
    SET(THREADS_LINK "${CMAKE_THREAD_LIBS_INIT}")
ENDIF()

IF(NOT CUDA_FOUND AND NOT OPENCL_FOUND AND NOT RENDERSCRIPT_FOUND)
    MESSAGE(FATAL_ERROR "Neither CUDA, OpenCL nor RenderScript found. At least one of them is required to use HIPACC properly.")
ENDIF(NOT CUDA_FOUND AND NOT OPENCL_FOUND AND NOT RENDERSCRIPT_FOUND)

IF(CUDA_FOUND AND CUDA_VERSION VERSION_LESS "6.5")
    MESSAGE(WARNING "At least CUDA version 6.5 required, but found CUDA version ${CUDA_VERSION}.")
    SET(CUDA_FOUND FALSE)
ENDIF(CUDA_FOUND AND CUDA_VERSION VERSION_LESS "6.5")

IF(CUDA_FOUND)
    SET(NVCC "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc")
    INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})
    SET(NVCC_CPP_STD "-std=c++11")
    MARK_AS_ADVANCED(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_HOST_COMPILER
        CUDA_SDK_ROOT_DIR CUDA_SEPARABLE_COMPILATION CUDA_TOOLKIT_ROOT_DIR
        CUDA_VERBOSE_BUILD)
ELSE(CUDA_FOUND)
    SET(USE_JIT_ESTIMATE OFF)
ENDIF(CUDA_FOUND)

IF(OPENCL_FOUND)
    SET(CL_COMPILER "${CMAKE_INSTALL_PREFIX}/bin/cl_compile")
ENDIF(OPENCL_FOUND)

MESSAGE(STATUS "Configuration summary:")
MESSAGE(STATUS "===")
MESSAGE(STATUS "CUDA support: ${CUDA_FOUND}")
MESSAGE(STATUS "OpenCL support: ${OPENCL_FOUND}")
MESSAGE(STATUS "Renderscript support: ${RENDERSCRIPT_FOUND}")
MESSAGE(STATUS "OpenCV support: ${OPENCV_FOUND}")
MESSAGE(STATUS "Polly support: ${USE_POLLY}")
MESSAGE(STATUS "JIT estimates: ${USE_JIT_ESTIMATE}")
MESSAGE(STATUS "===")


# platform specific fixes
IF(APPLE)
    SET(CUDA_LINK "-Xlinker -framework,CUDA")
    IF(NOT (CUDA_VERSION VERSION_LESS "7.0"))
        SET(NVCC_COMP "${NVCC_CPP_STD} -ccbin ${CLANG_EXECUTABLE} -Xcompiler -arch -Xcompiler x86_64")
    ELSE()
        SET(NVCC_COMP "${NVCC_CPP_STD} -ccbin ${CLANG_EXECUTABLE} -Xcompiler -arch -Xcompiler x86_64 -Xcompiler -stdlib=libstdc++")
    ENDIF()
ELSE(APPLE)
    SET(CUDA_LINK "${CUDA_CUDART_LIBRARY} ${CUDA_CUDA_LIBRARY} ${NVML_LIBRARIES}")
    IF(NOT (CUDA_VERSION VERSION_LESS "7.0"))
        FIND_LIBRARY(CUDA_NVRTC_LIBRARY nvrtc HINTS ${CUDA_TOOLKIT_ROOT_DIR}/lib ${CUDA_TOOLKIT_ROOT_DIR}/lib64)
        SET(CUDA_LINK "${CUDA_LINK} ${CUDA_NVRTC_LIBRARY}")
    ENDIF()
    SET(NVCC_COMP "${NVCC_CPP_STD} -I${NVML_INCLUDE_DIRS}")
ENDIF(APPLE)


# debug and release builds
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" build)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti")
IF(build STREQUAL "RELEASE")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
ELSE()
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wunused")
ENDIF()

{'fraction_non_alphanumeric': 0.10264402407566638, 'fraction_numerical': 0.007093723129836629, 'mean_word_length': 7.035405872193437, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4574480', 'n_tokens_mistral': 3909, 'n_tokens_neox': 3644, 'n_words': 647}