source: icGREP/icgrep-devel/icgrep/CMakeLists.txt @ 5496

Last change on this file since 5496 was 5496, checked in by cameron, 23 months ago

Increasing timeouts for tests

File size: 12.3 KB
RevLine 
[5179]1cmake_minimum_required (VERSION 2.8)
[3850]2
3project (icgrep)
4
[4096]5enable_testing()
[3850]6# The version number.
[4508]7set (icgrep_VERSION_MAJOR 1)
[5178]8set (icgrep_VERSION_MINOR 6)
[4096]9
[4583]10option(ENABLE_MULTIPLEXING "Compiling the Multiplexing Module")
[5240]11option(DISABLE_DUAL_ABI "Disable GCC Dual ABI support" OFF)
[5178]12find_package(LLVM REQUIRED CONFIG)
[3850]13
[5240]14message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION} in: ${LLVM_DIR}")
[5373]15
[5202]16set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") # ensure custom FindXYZ.cmake files are found
[3850]17
[5373]18set (Parabix_REVISION "svn")
19include(VersionFromVCS)
20add_version_info_from_vcs(Parabix_REVISION)
21message(STATUS "Parabix_REVISION: ${Parabix_REVISION}")
22
23
[3850]24# Now set the header and library paths:
25include_directories( ${LLVM_INCLUDE_DIRS} )
26link_directories( ${LLVM_LIBRARY_DIRS} )
27add_definitions( ${LLVM_DEFINITIONS} )
28
[5486]29# include(FindCUDA) # https://cmake.org/cmake/help/v3.0/module/FindCUDA.html
30
[5151]31option(ENABLE_CUDA_COMPILE "Compiling with CUDA")
32set(CUDA_LIB "")
33if(ENABLE_CUDA_COMPILE)
34  find_package(CUDA)
35  if(CUDA_FOUND)
36    set(CUDA_INCLUDE ${CUDA_INCLUDE} "/usr/local/cuda-7.5/include")
37    include_directories(${CUDA_INCLUDE})
38    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCUDA_ENABLED")
39    SET(CUDA_LIB "cuda")
40  endif(CUDA_FOUND)
41endif()
42
[3850]43# Let's suppose we want to build a JIT compiler with support for
44# binary code (no interpreter):
[5151]45set(LLVM_ALL_TARGETS AArch64 AMDGPU ARM BPF CppBackend Hexagon Mips MSP430 NVPTX PowerPC Sparc SystemZ X86 XCore)
46llvm_map_components_to_libnames(REQ_LLVM_LIBRARIES ${LLVM_ALL_TARGETS} mcjit native IRReader Linker)
[3850]47
[4196]48# Check if boost has been installed on this system.
[4210]49set(Boost_USE_STATIC_LIBS ON)
50set(Boost_USE_MULTITHREADED OFF)
[5234]51set(Boost_USE_STATIC_RUNTIME OFF)
[4991]52find_package(Boost 1.46 REQUIRED COMPONENTS system filesystem iostreams)
[5252]53message(STATUS "Found Boost_LIBRARY_DIR: ${Boost_LIBRARY_DIR}")
[4212]54
[4991]55include_directories("${Boost_INCLUDE_DIRS}")
56link_directories(${Boost_LIBRARY_DIR})
[4974]57
[5429]58SET(OBJECT_CACHE_SRC toolchain/object_cache.cpp)
[5405]59
[5464]60SET(TOOLCHAIN_SRC toolchain/toolchain.cpp toolchain/pipeline.cpp toolchain/driver.cpp)
[5429]61
[5464]62SET(DRIVER_SRC toolchain/cpudriver.cpp toolchain/NVPTXDriver.cpp)
63
[5435]64SET(KERNEL_SRC kernels/kernel.cpp kernels/streamset.cpp kernels/interface.cpp kernels/kernel_builder.cpp)
[5429]65SET(KERNEL_SRC ${KERNEL_SRC} kernels/source_kernel.cpp kernels/s2p_kernel.cpp kernels/deletion.cpp kernels/swizzle.cpp kernels/p2s_kernel.cpp kernels/stdout_kernel.cpp)
[5267]66
[5298]67SET(IDISA_SRC IR_Gen/CBuilder.cpp IR_Gen/idisa_builder.cpp IR_Gen/idisa_avx_builder.cpp IR_Gen/idisa_i64_builder.cpp IR_Gen/idisa_sse_builder.cpp IR_Gen/idisa_nvptx_builder.cpp IR_Gen/idisa_target.cpp)
[5033]68
[5217]69SET(PABLO_SRC pablo/pabloAST.cpp pablo/branch.cpp pablo/codegenstate.cpp pablo/builder.cpp pablo/symbol_generator.cpp pablo/printer_pablos.cpp pablo/pablo_toolchain.cpp)
[5227]70SET(PABLO_SRC ${PABLO_SRC} pablo/pablo_kernel.cpp pablo/pablo_compiler.cpp pablo/carry_manager.cpp)
[4766]71SET(PABLO_SRC ${PABLO_SRC} pablo/analysis/pabloverifier.cpp)
[5371]72SET(PABLO_SRC ${PABLO_SRC} pablo/passes/ssapass.cpp)
[5464]73SET(PABLO_SRC ${PABLO_SRC} pablo/optimizers/pablo_simplifier.cpp pablo/optimizers/codemotionpass.cpp pablo/optimizers/distributivepass.cpp pablo/passes/flattenif.cpp)
[4922]74IF(ENABLE_MULTIPLEXING)
[5160]75SET(PABLO_SRC ${PABLO_SRC} pablo/optimizers/booleanreassociationpass.cpp)
[5156]76SET(PABLO_SRC ${PABLO_SRC} pablo/optimizers/schedulingprepass.cpp pablo/optimizers/pablo_automultiplexing.cpp)
[4583]77ENDIF()
78
[5464]79add_library(CodeGen ${TOOLCHAIN_SRC} ${DRIVER_SRC} ${OBJECT_CACHE_SRC} ${KERNEL_SRC} ${IDISA_SRC})
[4583]80add_library(PabloADT ${PABLO_SRC})
[4684]81add_library(RegExpADT re/re_re.cpp re/re_cc.cpp re/re_rep.cpp re/re_diff.cpp re/re_intersect.cpp re/printer_re.cpp)
[5493]82add_library(RegExpCompiler re/re_parser.cpp re/re_nullable.cpp re/re_simplifier.cpp re/re_star_normal.cpp re/re_compiler.cpp re/re_analysis.cpp re/re_toolchain.cpp re/re_name_resolve.cpp re/re_parser_pcre.cpp re/re_parser_ere.cpp re/re_parser_bre.cpp re/re_parser_prosite.cpp re/re_utility.cpp)
[5369]83add_library(CCADT cc/cc_compiler.cpp utf8_encoder.cpp utf16_encoder.cpp UCD/CaseFolding_txt.cpp cc/alphabet.cpp cc/multiplex_CCs.cpp)
[4949]84add_library(UCDlib UCD/unicode_set.cpp UCD/ucd_compiler.cpp UCD/PropertyObjects.cpp UCD/resolve_properties.cpp UCD/UnicodeNameData.cpp)
[4198]85
[5405]86# force the compiler to compile the object cache to ensure that the versioning information is up to date
87add_custom_target(RecompileObjectCache ALL touch ${CMAKE_CURRENT_SOURCE_DIR}/${OBJECT_CACHE_SRC})
88add_dependencies(CodeGen RecompileObjectCache)
89
[4684]90# add the executable
[5464]91target_link_libraries (CodeGen ${REQ_LLVM_LIBRARIES})
92target_link_libraries (PabloADT CodeGen)
[4684]93target_link_libraries (CCADT PabloADT)
94target_link_libraries (UCDlib RegExpADT PabloADT CCADT)
95target_link_libraries (RegExpADT PabloADT CCADT UCDlib)
96target_link_libraries (RegExpCompiler RegExpADT)
97
[5492]98add_executable(icgrep icgrep.cpp grep_interface.cpp grep_engine.cpp kernels/scanmatchgen.cpp kernels/cc_kernel.cpp kernels/cc_scan_kernel.cpp kernels/linebreak_kernel.cpp kernels/streams_merge.cpp kernels/grep_kernel.cpp kernels/until_n.cpp)
[5402]99add_executable(u8u16 u8u16.cpp)
100add_executable(base64 base64.cpp kernels/radix64.cpp)
[5459]101add_executable(wc wc.cpp)
[5402]102add_executable(editd editd/editd.cpp editd/pattern_compiler.cpp editd/editdscan_kernel.cpp editd/editd_gpu_kernel.cpp editd/editd_cpu_kernel.cpp)
103add_executable(array-test array-test.cpp kernels/alignedprint.cpp)
[5423]104add_executable(lz4d lz4d.cpp lz4FrameDecoder.cpp kernels/cc_kernel.cpp kernels/lz4_index_decoder.cpp kernels/lz4_bytestream_decoder.cpp)
[5172]105
[5217]106target_link_libraries (icgrep UCDlib PabloADT RegExpCompiler CCADT CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
107target_link_libraries (u8u16 UCDlib PabloADT RegExpCompiler CCADT CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
[5232]108target_link_libraries (base64 UCDlib PabloADT RegExpCompiler CCADT CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
[5217]109target_link_libraries (wc UCDlib PabloADT RegExpCompiler CCADT CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
110target_link_libraries (editd UCDlib PabloADT RegExpCompiler CCADT CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
[5227]111target_link_libraries (array-test PabloADT CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
[5423]112target_link_libraries (lz4d PabloADT RegExpCompiler CodeGen ${REQ_LLVM_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIB})
[4919]113
[4922]114IF(ENABLE_MULTIPLEXING)
[5156]115    message(STATUS "Enabling Multiplexing")
116    find_package(Z3 REQUIRED)
117    include_directories(${Z3_INCLUDE_DIRS})
118    target_link_libraries(PabloADT ${Z3_LIBRARIES})
119    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_MULTIPLEXING")
[4583]120ENDIF()
121
[4096]122include_directories("${PROJECT_SOURCE_DIR}")
123
[4152]124#Check compiler support for 0x / 11
125include(CheckCXXCompilerFlag)
126CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
127if(COMPILER_SUPPORTS_CXX11)
128  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
129else()
130  CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
131  if(COMPILER_SUPPORTS_CXX0X)
132    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
133  else()
134    CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_GNU11)
135    if(COMPILER_SUPPORTS_GNU11)
136      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
[5156]137    else()
138      CHECK_CXX_COMPILER_FLAG("-std=gnu++0x" COMPILER_SUPPORTS_GNU0X)
[4152]139      if(COMPILER_SUPPORTS_GNU0X)
140        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
141      endif()
142    endif()
143  endif()
144endif()
[4096]145
[4200]146#Disable RunTime Type Information
[5037]147IF (MSVC) # using Visual Studio C++
[4436]148  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
[4200]149ELSE() # using Clang, GCC, Intel C++, etc
[4436]150  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
[4200]151ENDIF()
152
[5240]153#Disable Dual ABI support
154IF(DISABLE_DUAL_ABI)
155SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
156ENDIF()
157
[4227]158#Enable all warnings
[4356]159SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
[4200]160
[5493]161UNSET(HAS_EXECINFO CACHE)
162UNSET(HAS_MACH_VM_TYPES CACHE)
[5486]163include(CheckIncludeFileCXX)
[5493]164CHECK_INCLUDE_FILE_CXX(mach/vm_types.h HAS_MACH_VM_TYPES)
165IF (HAS_MACH_VM_TYPES)
166  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_MACH_VM_TYPES")
[5489]167ELSE()
[5493]168  UNSET(LIBUNWIND_FOUND CACHE)
169  find_package(Libunwind)
170  IF (LIBUNWIND_FOUND)
171    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_LIBUNWIND")
172    include_directories(${LIBUNWIND_INCLUDE_DIR})
173    target_link_libraries(CodeGen ${LIBUNWIND_LIBRARIES})
174  ELSE()
175    CHECK_INCLUDE_FILE_CXX(execinfo.h HAS_EXECINFO)
176    IF (HAS_EXECINFO)
177       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_EXECINFO")
178    ENDIF()
179  ENDIF()
[5486]180ENDIF()
181
[4480]182SET(CMAKE_REQUIRED_FLAGS)
[4152]183
[4118]184# detect LLVM version and add compiler flags.
[5196]185SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLLVM_VERSION_major=${LLVM_VERSION_MAJOR} -DLLVM_VERSION_MINOR=${LLVM_VERSION_MINOR}")
186IF (${LLVM_VERSION_MAJOR} EQUAL 3)
187  IF (${LLVM_VERSION_MINOR} EQUAL 6)
188    message(STATUS "Found LLVM ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
189    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LLVM_3_6")
190  ELSEIF (${LLVM_VERSION_MINOR} EQUAL 7)
191    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LLVM_3_7")
192  ENDIF()
[4480]193ENDIF()
[4118]194
[5373]195SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPARABIX_VERSION='\"${Parabix_REVISION}\"'")
196
[5486]197SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
198
199SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls")
[5489]200
[5493]201UNSET(HAS_ADDRESS_SANITIZER)
202CHECK_INCLUDE_FILE_CXX("sanitizer/asan_interface.h" HAS_ADDRESS_SANITIZER)
[5486]203IF (HAS_ADDRESS_SANITIZER)
204SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DHAS_ADDRESS_SANITIZER -fsanitize=address")
[4919]205ENDIF()
206
[5495]207
[4096]208add_test(
209  NAME greptest
210  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
[5495]211  COMMAND python greptest.py ${CMAKE_BINARY_DIR}/icgrep)
[4096]212
[4137]213add_test(
[4456]214  NAME proptest
215  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
[5495]216  COMMAND python greptest.py -d ${PROJECT_SOURCE_DIR}/../QA -t ${PROJECT_SOURCE_DIR}/../QA/proptest.xml ${CMAKE_BINARY_DIR}/icgrep)
[4456]217
218add_test(
[4137]219  NAME abc_test
220  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
[5495]221  COMMAND ./run_abc ${CMAKE_BINARY_DIR}/icgrep)
[4137]222
[5208]223add_test(
224  NAME u8u16_test
225  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/u8u16
[5495]226  COMMAND ./run_all "${CMAKE_BINARY_DIR}/u8u16 -segment-size=16 -enable-segment-pipeline-parallel")
[5208]227
[5226]228add_test(
[5423]229  NAME lz4d_test
230  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/lz4d
[5495]231  COMMAND ./run_all ${CMAKE_BINARY_DIR}/lz4d)
[5423]232
233add_test(
[5226]234  NAME editd_test
235  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/editd
[5495]236  COMMAND python run_all.py -e ${CMAKE_BINARY_DIR})
[5226]237
[5288]238add_test(
239  NAME base64_test
240  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/base64
[5495]241  COMMAND python base64test.py ${CMAKE_BINARY_DIR}/base64)
[5288]242
[5496]243SET_PROPERTY(TEST greptest PROPERTY TIMEOUT 400)
244SET_PROPERTY(TEST proptest PROPERTY TIMEOUT 1500)
245SET_PROPERTY(TEST abc_test u8u16_test lz4d_test editd_test base64_test PROPERTY TIMEOUT 40)
[5495]246
247
[5493]248add_custom_target (greptest
249  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
[5495]250  COMMAND python greptest.py "${CMAKE_BINARY_DIR}/icgrep -ea")
[5493]251
252add_custom_target (proptest
253  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
[5495]254  COMMAND python greptest.py -d ${PROJECT_SOURCE_DIR}/../QA -t ${PROJECT_SOURCE_DIR}/../QA/proptest.xml "${CMAKE_BINARY_DIR}/icgrep -ea")
[5493]255
[5211]256add_custom_target (u8u16_test
257  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/u8u16
[5495]258  COMMAND ./run_all "${CMAKE_BINARY_DIR}/u8u16 -ea -segment-size=16 -enable-segment-pipeline-parallel")
[5211]259
[5423]260add_custom_target (lz4d_test
261  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/lz4d
[5495]262  COMMAND ./run_all "${CMAKE_BINARY_DIR}/lz4d -ea")
[5423]263
[5223]264add_custom_target (editd_test
265  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/editd
[5495]266  COMMAND python run_all.py -e ${CMAKE_BINARY_DIR})
[5223]267
[5289]268add_custom_target (base64_test
269  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA/base64
[5495]270  COMMAND python base64test.py "${CMAKE_BINARY_DIR}/base64 -ea")
[5289]271
[5494]272add_custom_target (abc_gen
273  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
274  COMMAND python abc_testgen.py)
275 
[4137]276add_custom_target (abc_test
[5493]277  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../QA
[5495]278  COMMAND ./run_abc "${CMAKE_BINARY_DIR}/icgrep -ea")
[4137]279
[4096]280add_custom_target (check
[4130]281  COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
[5494]282  DEPENDS icgrep abc_gen)
[4128]283
284add_custom_target (perf_icgrep
[4785]285  COMMAND python2 perf.py icgrep
[4128]286  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../performance
287  DEPENDS icgrep)
288
289add_custom_target (viewer
[4785]290  COMMAND python2 viewer.py
[4128]291  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../performance)
292
[4275]293add_custom_target (text_viewer
[4785]294  COMMAND python2 viewer.py -t
[4275]295  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/../performance)
[5469]296
297add_custom_target (clear_cache
298  COMMAND rm ~/.cache/parabix/*)
299
300
Note: See TracBrowser for help on using the repository browser.