Skip to content

Commit

Permalink
Main release
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej committed May 17, 2021
1 parent 6a44618 commit e42adda
Show file tree
Hide file tree
Showing 524 changed files with 184,028 additions and 0 deletions.
92 changes: 92 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
cmake_minimum_required(VERSION 3.8)
project(gms)

option(PEDANTIC_WARNINGS "if OFF some warnings will be disabled" OFF)
option(DEBUG_WITH_SANITIZERS "whether to build debug builds with sanitizers" OFF)
option(BUILD_TESTS "whether to build tests" ON)
option(BUILD_GAPBS_BENCHMARKS "whether to build GAPBS benchmarks parameterized over compressible graphs" OFF)

# Compile options
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fopenmp -march=native")
if (PEDANTIC_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-sign-compare -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
# TODO
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-shift-negative-value")
# TODO this silences warnings in Roaring library
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy")
endif()

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0 -DMINEBENCH_TEST")
if (DEBUG_WITH_SANITIZERS)
# - Address sanitization to detect many memory bugs at a low cost.
# - UB sanitizer to detect some cases of UB.
# - Note: on clang (when supported) you might also use the memory sanitizer instead of address
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address,undefined")
endif()

# Release flags:
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")

# Collect outputs in a single bin directory.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Enable release mode by default (if nothing else is specified).
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
endif()

# Setup TBB
#include(cmake/tbb/TBBGet.cmake)
#tbb_get(TBB_ROOT tbb_root RELEASE_TAG v2020.2 CONFIG_DIR TBB_DIR)
#find_package(TBB)

# Detect if CPLEX is available.
include(cmake/FindCPLEX.cmake)

# Setup PAPI
include(cmake/FindPAPI.cmake)
if(PAPI_FOUND)
message (STATUS "PAPI was FOUND: Including Papi Directories")
include_directories(${PAPI_INCLUDE_DIRS})
endif(PAPI_FOUND)

# Add a benchmark target
# @param bench_file The .cpp file containing the benchmark runner.
# @param PAPIW Optional flag to enable PAPIW Support (if not set, than false)
function(gms_benchmark bench_file)
cmake_parse_arguments(PARSE_ARGV 1 FLAG "PAPIW" "" "")
get_filename_component(bench_name ${bench_file} NAME_WE) # get filename without extension
add_executable(${bench_name} ${bench_file})
target_link_libraries(${bench_name} roaring)
if(PAPI_FOUND AND FLAG_PAPIW)
message (STATUS "PAPIW ENABLED for ${bench_file}" )
target_link_libraries(${bench_name} ${PAPI_LIBRARIES})
else()
target_compile_definitions(${bench_name} PUBLIC NOPAPIW)
endif()
endfunction()

include_directories(${CMAKE_CURRENT_LIST_DIR}/.)

add_subdirectory(gms)
add_subdirectory(examples)

if (BUILD_TESTS)
include(ExternalProject)
externalproject_add(googletest
SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/testing/googletest"
PREFIX "${CMAKE_BINARY_DIR}/googletest"
INSTALL_COMMAND "")
set(GOOGLETEST_INCLUDE_DIRS
${CMAKE_CURRENT_LIST_DIR}/testing/googletest/googletest/include
${CMAKE_CURRENT_LIST_DIR}/testing/googletest/googlemock/include
)
link_directories(${CMAKE_BINARY_DIR}/googletest/src/googletest-build/lib)
set(TESTING_FLAGS -DTEST_FIXTURES="${CMAKE_CURRENT_LIST_DIR}/testing" -DMINEBENCH_TEST)
add_subdirectory(testing)
endif()
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 SPCL

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
85 changes: 85 additions & 0 deletions cmake/FindCPLEX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# This module finds cplex.
#
# Based on: https://github.com/martinsch/pgmlink/blob/master/cmake_extensions/FindCplex.cmake
#
# User can give CPLEX_ROOT_DIR as a hint stored in the cmake cache.
#
# It sets the following variables:
# CPLEX_FOUND - Set to false, or undefined, if cplex isn't found.
# CPLEX_INCLUDE_DIRS - include directory
# CPLEX_LIBRARIES - library files

set(CPLEX_ROOT_DIR "$ENV{CPLEX_DIR}" CACHE PATH "Root directory of CPLEX if it's not in a standard place")

FIND_PATH(CPLEX_INCLUDE_DIR
ilcplex/cplex.h
HINTS
${CPLEX_ROOT_DIR}/cplex/include
${CPLEX_ROOT_DIR}/include
PATHS
ENV C_INCLUDE_PATH
ENV C_PLUS_INCLUDE_PATH
ENV INCLUDE_PATH
)

FIND_PATH(CPLEX_CONCERT_INCLUDE_DIR
ilconcert/iloenv.h
HINTS
${CPLEX_ROOT_DIR}/concert/include
${CPLEX_ROOT_DIR}/include
PATHS
ENV C_INCLUDE_PATH
ENV C_PLUS_INCLUDE_PATH
ENV INCLUDE_PATH
)

FIND_LIBRARY(CPLEX_LIBRARY
NAMES cplex
HINTS
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux/static_pic
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_darwin/static_pic
PATHS ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)

FIND_LIBRARY(CPLEX_ILOCPLEX_LIBRARY
ilocplex
HINTS
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux/static_pic
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_darwin/static_pic
PATHS ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)

FIND_LIBRARY(CPLEX_CONCERT_LIBRARY
concert
HINTS
${CPLEX_ROOT_DIR}/concert/lib/x86-64_linux/static_pic
${CPLEX_ROOT_DIR}/concert/lib/x86-64_osx/static_pic
${CPLEX_ROOT_DIR}/concert/lib/x86-64_darwin/static_pic
PATHS ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)

FIND_PATH(CPLEX_BIN_DIR
cplex
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux
${CPLEX_ROOT_DIR}/cplex/bin/x86-64_osx
${CPLEX_ROOT_DIR}/cplex/bin/x86-64_darwin
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPLEX DEFAULT_MSG
CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_ILOCPLEX_LIBRARY CPLEX_CONCERT_LIBRARY CPLEX_CONCERT_INCLUDE_DIR)

if(CPLEX_FOUND)
SET(CPLEX_INCLUDE_DIRS ${CPLEX_INCLUDE_DIR} ${CPLEX_CONCERT_INCLUDE_DIR})
SET(CPLEX_LIBRARIES ${CPLEX_CONCERT_LIBRARY} ${CPLEX_ILOCPLEX_LIBRARY} ${CPLEX_LIBRARY} )
SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
endif()

MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_ILOCPLEX_LIBRARY CPLEX_CONCERT_INCLUDE_DIR CPLEX_CONCERT_LIBRARY)
47 changes: 47 additions & 0 deletions cmake/FindPAPI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Try to find PAPI headers and libraries.
#
# from https://stackoverflow.com/questions/28711492/include-these-variables-into-cmake
#
# Usage of this module as follows:
#
# find_package(PAPI)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# PAPI_PREFIX Set this variable to the root installation of
# libpapi if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# PAPI_FOUND System has PAPI libraries and headers
# PAPI_LIBRARIES The PAPI library
# PAPI_INCLUDE_DIRS The location of PAPI headers

find_path(PAPI_PREFIX
NAMES include/papi.h
)

find_library(PAPI_LIBRARIES
# Pick the static library first for easier run-time linking.
NAMES libpapi.a papi
HINTS ${PAPI_PREFIX}/lib ${HILTIDEPS}/lib
)

find_path(PAPI_INCLUDE_DIRS
NAMES papi.h
HINTS ${PAPI_PREFIX}/include ${HILTIDEPS}/include
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PAPI DEFAULT_MSG
PAPI_LIBRARIES
PAPI_INCLUDE_DIRS
)

mark_as_advanced(
PAPI_PREFIX_DIRS
PAPI_LIBRARIES
PAPI_INCLUDE_DIRS
)
Loading

0 comments on commit e42adda

Please sign in to comment.