<commit_before>cmake_minimum_required(VERSION 3.10)
project(DMRG++)


set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake-modules)


################################################################
### Set options for compilation                              ###
################################################################
option(USE_OpenMP    "Use OpenMP"                       ON)
option(USE_MKL       "Use Intel MKL libraries"          ON)
option(STATIC_BUILD  "Static linking"                   OFF)
cmake_policy(SET CMP0074 NEW)
cmake_policy(SET CMP0075 NEW)

if(USE_MKL AND NOT DEFINED ENV{MKLROOT})
    set(ENV{MKLROOT}  "/opt/intel/mkl")
    message(STATUS "MKLROOT is not defined. Setting default: $ENV{MKLROOT}")
endif()


################################################################
### Get git version number                                   ###
### Generates a header gitversion/gitversion.h               ###
### Include it using #include <gitversion.h>                 ###
### Gives a namespace GIT:: with several git version numbers.###
################################################################
include(cmake-modules/gitversion.cmake)


##################################################################
### Define variables for directory paths accessible at runtime ###
##################################################################
#include(cmake-modules/directory.cmake)


##################################################################
### Add a debugging type message, only active in Debug-mode   ###
##################################################################
#include(cmake-modules/debug_msg.cmake)




##################################################################
### Get operating system properties into a variable            ###
##################################################################
set(GET_OS_INFO_CMD lsb_release -a)
if(${CMAKE_HOST_APPLE})
    set(GET_OS_INFO_CMD "sw_vers")
endif()
execute_process(COMMAND ${GET_OS_INFO_CMD}
        OUTPUT_VARIABLE OS_PROPERTIES
        OUTPUT_STRIP_TRAILING_WHITESPACE)
message("========= DETECTED OS =========")
message("${OS_PROPERTIES}")
message("===============================")


###################
### Setup flags ###
###################
message("Compiling with: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")

if(NOT MARCH)
    set(MARCH "haswell")
endif()

if(MARCH)
    if (${MARCH} STREQUAL "zen")
        string(TOUPPER ZEN OPENBLAS_MARCH)
        string(TOLOWER znver1 CXX_MARCH)
    else()
        string(TOUPPER ${MARCH} OPENBLAS_MARCH)
        string(TOLOWER ${MARCH} CXX_MARCH)
    endif()
endif()

message("Using microarchitechture: ${CXX_MARCH}")
set(COMMON_OPTIONS -g -Wall -march=${CXX_MARCH} -mtune=${CXX_MARCH})
set(DEBUG_OPTIONS       -Wpedantic -Wextra -O0)
set(RELEASE_OPTIONS     -DNDEBUG -O3)
set(PROFILE_OPTIONS     -DNDEBUG -O3 -lprofiler -g)

#################################
### Microarch dependent flags ###
#################################
# Check supported options here http://man7.org/linux/man-pages/man1/gcc.1.html
if (${MARCH} STREQUAL "sandybridge")
    list(APPEND RELEASE_OPTIONS  -mmmx -msse -msse2 -msse3 -mssse3 -msse4.2 -msse4.1  -mpopcnt  -maes -mpclmul -mavx -fstack-protector-strong -Wformat -Wformat-security)
elseif(${MARCH} STREQUAL "haswell" OR ${MARCH} STREQUAL "skylake" OR ${MARCH} STREQUAL "zen" )
    list(APPEND RELEASE_OPTIONS -mmmx -msse -msse2 -msse3 -mssse3 -msse4.2 -msse4.1 -mpopcnt -maes -mpclmul -mavx -mavx2 -mmovbe -mrdrnd -mf16c -mfsgsbase -mfma  -mbmi -mbmi2 -fstack-protector-strong -Wformat -Wformat-security)
else()
    # Set default to whatever nehalem can manage
    list(APPEND RELEASE_OPTIONS  -mmmx -msse -msse2 -msse3 -mssse3 -msse4.2 -msse4.1 -mpopcnt -fstack-protector-strong -Wformat -Wformat-security)
endif()


##########################<commit_msg>Adapting CMakeLists to fit tetralith<commit_after>cmake_minimum_required(VERSION 3.10)
project(DMRG++)


set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake-modules)


################################################################
### Set options for compilation                              ###
################################################################
option(USE_OpenMP    "Use OpenMP"                       ON)
option(USE_MKL       "Use Intel MKL libraries"          ON)
option(STATIC_BUILD  "Static linking"                   OFF)
cmake_policy(SET CMP0074 NEW)
cmake_policy(SET CMP0075 NEW)

if(USE_MKL AND NOT DEFINED ENV{MKLROOT})
    set(ENV{MKLROOT}  "/opt/intel/mkl")
    message(STATUS "MKLROOT is not defined. Setting default: $ENV{MKLROOT}")
endif()


################################################################
### Get git version number                                   ###
### Generates a header gitversion/gitversion.h               ###
### Include it using #include <gitversion.h>                 ###
### Gives a namespace GIT:: with several git version numbers.###
################################################################
include(cmake-modules/gitversion.cmake)


##################################################################
### Define variables for directory paths accessible at runtime ###
##################################################################
#include(cmake-modules/directory.cmake)


##################################################################
### Add a debugging type message, only active in Debug-mode   ###
##################################################################
#include(cmake-modules/debug_msg.cmake)




##################################################################
### Get operating system properties into a variable            ###
##################################################################
set(GET_OS_INFO_CMD lsb_release -a)
if(${CMAKE_HOST_APPLE})
    set(GET_OS_INFO_CMD "sw_vers")
endif()
execute_process(COMMAND ${GET_OS_INFO_CMD}
        OUTPUT_VARIABLE OS_PROPERTIES
        OUTPUT_STRIP_TRAILING_WHITESPACE)
message("========= DETECTED OS =========")
message("${OS_PROPERTIES}")
message("===============================")


###################
### Setup flags ###
###################
message("Compiling with: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")

if(NOT MARCH)
    set(MARCH "haswell")
endif()

if(MARCH)
    if (${MARCH} STREQUAL "zen")
        string(TOUPPER ZEN OPENBLAS_MARCH)
        string(TOLOWER znver1 CXX_MARCH)
    elseif (${MARCH} STREQUAL "native")
        set(OPENBLAS_MARCH "haswell")
        string(TOLOWER ${MARCH} CXX_MARCH)
    else()
        string(TOUPPER ${MARCH} OPENBLAS_MARCH)
        string(TOLOWER ${MARCH} CXX_MARCH)
    endif()
endif()

message("Using microarchitechture: ${CXX_MARCH}")
set(COMMON_OPTIONS -g -Wall -march=${CXX_MARCH} -mtune=${CXX_MARCH})
set(DEBUG_OPTIONS       -Wpedantic -Wextra -O0)
set(RELEASE_OPTIONS     -DNDEBUG -O3)
set(PROFILE_OPTIONS     -DNDEBUG -O3 -lprofiler -g)

#################################
### Microarch dependent flags ###
#################################
# Check supported options here http://man7.org/linux/man-pages/man1/gcc.1.html
if (${MARCH} STREQUAL "sandybridge")
    list(APPEND RELEASE_OPTIONS  -mmmx -msse -msse2 -msse3 -mssse3 -msse4.2 -msse4.1  -mpopcnt  -maes -mpclmul -mavx -fstack-protector-strong -Wformat -Wformat-security)
elseif(${MARCH} STREQUAL "haswell" OR ${MARCH} STREQUAL "skylake" OR ${MARCH} STREQUAL "zen" )
    list(APPEND RELEASE_OPTIONS -mmmx -msse -msse2 -msse3 -mssse3 -msse4.2 -msse4.1 -mpopcnt -maes -mpclmul -mavx -mavx2 -mmovbe -mrdrnd -mf16c -mfsgsbase -mfma  -mbmi -mbmi2 -fstack-protector-strong -Wformat -Wformat-security)
else()
    # Set default to whatever nehalem can manage
    list(APPEND RELEASE_OPTIONS  -mmmx -msse -msse2 -msse3 -mssse3 -msse4.2 -msse4.1 -mpopcnt -fstack-protector-strong -Wformat -Wformat-security)
endif()


##########################
{'fraction_non_alphanumeric': 0.3054718875502008, 'fraction_numerical': 0.010793172690763053, 'mean_word_length': 4.60407876230661, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '293568', 'n_tokens_mistral': 2519, 'n_tokens_neox': 2412, 'n_words': 513}