Commit 2f8d21f6 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

Move to CMake. Incidentally, closes #26

parent 570be61a
cmake_minimum_required(VERSION 3.0.2)
project(pmtool)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})
add_definitions("--std=c++11")
include_directories("include")
find_package(LibRec REQUIRED)
include_directories(${LIBREC_INCLUDE_DIRS})
add_subdirectory("core")
add_subdirectory("schedulers")
find_package(CPLEX)
if(CPLEX_FOUND)
include_directories(${CPLEX_INCLUDE_DIRS})
# target_link_libraries(${CPLEX_LIBRARIES})
add_definitions("-DWITH_CPLEX")
add_definitions("-DIL_STD")
add_subdirectory("bounds")
endif()
set(PROG_SRC
pmtool.cpp
ProgramOptions.cpp
)
add_executable(pmtool ${PROG_SRC})
target_link_libraries(pmtool core)
target_link_libraries(pmtool schedulers)
target_link_libraries(pmtool ${LIBREC_LIBRARIES})
if(CPLEX_FOUND)
target_link_libraries(pmtool bounds)
target_link_libraries(pmtool ${CPLEX_LIBRARIES})
endif()
# Copyright 2012 HHMI. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of HHMI nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Author: katzw@janelia.hhmi.org (Bill Katz)
# Written as part of the FlyEM Project at Janelia Farm Research Center.
# This module finds cplex.
#
# 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
if(WIN32)
execute_process(COMMAND cmd /C set CPLEX_STUDIO_DIR OUTPUT_VARIABLE CPLEX_STUDIO_DIR_VAR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT CPLEX_STUDIO_DIR_VAR)
MESSAGE(FATAL_ERROR "Unable to find CPLEX: environment variable CPLEX_STUDIO_DIR<VERSION> not set.")
endif()
STRING(REGEX REPLACE "^CPLEX_STUDIO_DIR" "" CPLEX_STUDIO_DIR_VAR ${CPLEX_STUDIO_DIR_VAR})
STRING(REGEX MATCH "^[0-9]+" CPLEX_WIN_VERSION ${CPLEX_STUDIO_DIR_VAR})
STRING(REGEX REPLACE "^[0-9]+=" "" CPLEX_STUDIO_DIR_VAR ${CPLEX_STUDIO_DIR_VAR})
file(TO_CMAKE_PATH "${CPLEX_STUDIO_DIR_VAR}" CPLEX_ROOT_DIR_GUESS)
set(CPLEX_WIN_VERSION ${CPLEX_WIN_VERSION} CACHE STRING "CPLEX version to be used.")
set(CPLEX_ROOT_DIR "${CPLEX_ROOT_DIR_GUESS}" CACHE PATH "CPLEX root directory.")
MESSAGE(STATUS "Found CLPEX version ${CPLEX_WIN_VERSION} at '${CPLEX_ROOT_DIR}'")
STRING(REGEX REPLACE "/VC/bin/.*" "" VISUAL_STUDIO_PATH ${CMAKE_C_COMPILER})
STRING(REGEX MATCH "Studio [0-9]+" CPLEX_WIN_VS_VERSION ${VISUAL_STUDIO_PATH})
STRING(REGEX REPLACE "Studio " "" CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION})
if(${CPLEX_WIN_VS_VERSION} STREQUAL "9")
set(CPLEX_WIN_VS_VERSION 2008)
elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "10")
set(CPLEX_WIN_VS_VERSION 2010)
elseif(${CPLEX_WIN_VS_VERSION} STREQUAL "11")
set(CPLEX_WIN_VS_VERSION 2012)
else()
MESSAGE(FATAL_ERROR "CPLEX: unknown Visual Studio version at '${VISUAL_STUDIO_PATH}'.")
endif()
set(CPLEX_WIN_VS_VERSION ${CPLEX_WIN_VS_VERSION} CACHE STRING "Visual Studio Version")
if("${CMAKE_C_COMPILER}" MATCHES "amd64")
set(CPLEX_WIN_BITNESS x64)
else()
set(CPLEX_WIN_BITNESS x86)
endif()
set(CPLEX_WIN_BITNESS ${CPLEX_WIN_BITNESS} CACHE STRING "On Windows: x86 or x64 (32bit resp. 64bit)")
MESSAGE(STATUS "CPLEX: using Visual Studio ${CPLEX_WIN_VS_VERSION} ${CPLEX_WIN_BITNESS} at '${VISUAL_STUDIO_PATH}'")
if(NOT CPLEX_WIN_LINKAGE)
set(CPLEX_WIN_LINKAGE mda CACHE STRING "CPLEX linkage variant on Windows. One of these: mda (dll, release), mdd (dll, debug), mta (static, release), mtd (static, debug)")
endif(NOT CPLEX_WIN_LINKAGE)
# now, generate platform string
set(CPLEX_WIN_PLATFORM "${CPLEX_WIN_BITNESS}_windows_vs${CPLEX_WIN_VS_VERSION}/stat_${CPLEX_WIN_LINKAGE}")
else()
set(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory.")
set(CPLEX_WIN_PLATFORM "")
endif()
message(STATUS "cplex root dir: ${CPLEX_ROOT_DIR}")
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${CPLEX_WIN_VERSION} cplex
HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_debian4.0_4.1/static_pic #unix
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic #unix
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux/static_pic #linux (ubuntu)
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic #osx
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_darwin/static_pic #osx
PATHS ENV LIBRARY_PATH #unix
ENV LD_LIBRARY_PATH #unix
)
message(STATUS "CPLEX Library: ${CPLEX_LIBRARY}")
FIND_LIBRARY(CPLEX_ILOCPLEX_LIBRARY
ilocplex
HINTS ${CPLEX_ROOT_DIR}/cplex/lib/${CPLEX_WIN_PLATFORM} #windows
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_debian4.0_4.1/static_pic #unix
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_sles10_4.1/static_pic #unix
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_osx/static_pic #osx
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_darwin/static_pic #osx
${CPLEX_ROOT_DIR}/cplex/lib/x86-64_linux/static_pic #linux (ubuntu)
PATHS ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)
message(STATUS "ILOCPLEX Library: ${CPLEX_ILOCPLEX_LIBRARY}")
FIND_LIBRARY(CPLEX_CONCERT_LIBRARY
concert
HINTS ${CPLEX_ROOT_DIR}/concert/lib/${CPLEX_WIN_PLATFORM} #windows
${CPLEX_ROOT_DIR}/concert/lib/x86-64_debian4.0_4.1/static_pic #unix
${CPLEX_ROOT_DIR}/concert/lib/x86-64_sles10_4.1/static_pic #unix
${CPLEX_ROOT_DIR}/concert/lib/x86-64_osx/static_pic #osx
${CPLEX_ROOT_DIR}/concert/lib/x86-64_darwin/static_pic #osx
${CPLEX_ROOT_DIR}/concert/lib/x86-64_linux/static_pic #linux (ubuntu)
PATHS ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)
message(STATUS "CONCERT Library: ${CPLEX_CONCERT_LIBRARY}")
if(WIN32)
FIND_PATH(CPLEX_BIN_DIR
cplex${CPLEX_WIN_VERSION}.dll
HINTS ${CPLEX_ROOT_DIR}/cplex/bin/${CPLEX_WIN_PLATFORM} #windows
)
else()
FIND_PATH(CPLEX_BIN_DIR
cplex
HINTS ${CPLEX_ROOT_DIR}/cplex/bin/x86-64_sles10_4.1 #unix
${CPLEX_ROOT_DIR}/cplex/bin/x86-64_debian4.0_4.1 #unix
${CPLEX_ROOT_DIR}/cplex/bin/x86-64_osx #osx
${CPLEX_ROOT_DIR}/cplex/bin/x86-64_darwin #osx
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)
endif()
message(STATUS "CPLEX Bin Dir: ${CPLEX_BIN_DIR}")
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} )
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
ENDIF(CPLEX_FOUND)
MARK_AS_ADVANCED(CPLEX_LIBRARY CPLEX_INCLUDE_DIR CPLEX_ILOCPLEX_LIBRARY CPLEX_CONCERT_INCLUDE_DIR CPLEX_CONCERT_LIBRARY CPLEX_BIN_DIR)
# This module finds librec.
#
# User can give LIBREC_ROOT_DIR as a hint stored in the cmake cache.
#
# It sets the following variables:
# LIBREC_FOUND - Set to false, or undefined, if librec isn't found.
# LIBREC_INCLUDE_DIRS - include directory
# LIBREC_LIBRARIES - library files
# include(LibFindMacros)
# Dependencies
# libfind_package(Magick++ Magick)
# Use pkg-config to get hints about paths
# libfind_pkg_check_modules(librec_PKGCONF ImageMagick++)
set(LIBREC_INSTALL_DIR "" CACHE PATH "Librec install directory")
# Include dir
find_path(LIBREC_INCLUDE_DIR
NAMES rec.h
HINTS ${LIBREC_INSTALL_DIR}/include
PATHS ENV C_INCLUDE_PATH
ENV C_PLUS_INCLUDE_PATH
ENV INCLUDE_PATH
)
# Finally the library itself
find_library(LIBREC_LIBRARY
NAMES rec librec
HINTS ${LIBREC_INSTALL_DIR}/lib
PATHS ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH
)
message(STATUS "librec library: ${LIBREC_LIBRARY}")
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LIBREC DEFAULT_MSG
LIBREC_LIBRARY LIBREC_INCLUDE_DIR)
mark_as_advanced(LIBREC_INCLUDE_DIR LIBREC_LIBRARY )
if(LIBREC_FOUND)
set(LIBREC_LIBRARIES ${LIBREC_LIBRARY} )
set(LIBREC_INCLUDE_DIRS ${LIBREC_INCLUDE_DIR} )
endif()
# ---------------------------------------------------------------------
# Compiler selection
# ---------------------------------------------------------------------
CC = g++ -std=c++11
#CCC = g++ -O3
CCOPT = -DIL_STD
CCFLAGS = -Wall -g $(CCOPT)
LNFLAGS=-lrec -lgcrypt -lgpg-error
ALGS=listAlgorithm.o HeftAlgorithm.o HeteroPrio.o Dmdas.o GreedyAlgorithm.o IndepBased.o GreedyFile.o ReproduceAlgorithm.o
INDEPALGS = IndepDP2.o IndepAccel.o IndepDualHP.o IndepImreh.o IndepBalanced.o IndepZhang.o
OBJS = ProgramOptions.o pmtool.o algoptions.o algorithm.o schedAction.o instance.o util.o availSequence.o HybridBound.o RecFileReader.o ${ALGS} ${INDEPALGS}
CPLEX_OBJS = AreaBound.o DepBound.o IterDepBound.o AreaStart.o IntervalBound.o
VAR_CP_DIR = $(shell echo $(CPLEX_DIR))
ifneq ($(VAR_CP_DIR),)
SYSTEM = x86-64_linux
LIBFORMAT = static_pic
CPLEXDIR = $(VAR_CP_DIR)/cplex
CPOPTDIR = $(VAR_CP_DIR)/cpoptimizer
CONCERTDIR = $(VAR_CP_DIR)/concert
CPLEXBINDIR = $(CPLEXDIR)/bin/$(BINDIST)
CPLEXJARDIR = $(CPLEXDIR)/lib/cplex.jar
CPLEXLIBDIR = $(CPLEXDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CPOPTLIBDIR = $(CPOPTDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CONCERTLIBDIR = $(CONCERTDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CONCERTINCDIR = $(CONCERTDIR)/include
CPOPTINCDIR = $(CPOPTDIR)/include
CPLEXINCDIR = $(CPLEXDIR)/include
OBJS += $(CPLEX_OBJS)
CCFLAGS += -I$(CPLEXINCDIR) -I$(CONCERTINCDIR) -DWITH_CPLEX
LNFLAGS += -L$(CPLEXLIBDIR) -lilocplex -lcplex -L$(CONCERTLIBDIR) -lconcert -lm -pthread
endif
SRCS = $(OBJS:.o=.cpp)
DEP = $(OBJS:.o=.d)
pmtool: $(OBJS)
$(CC) $^ -o $@ $(CCFLAGS) $(LNFLAGS)
-include $(DEP)
%.o: %.cpp
$(CC) -c $< -o $@ $(CCFLAGS) -MMD
clean:
rm -f *.o *~ *.d
set(BOUNDS_SRC
AreaBound.cpp
AreaStart.cpp
DepBound.cpp
HybridBound.cpp
IntervalBound.cpp
IterDepBound.cpp
)
add_library(bounds ${BOUNDS_SRC})
set(CORE_SRC
algoptions.cpp
instance.cpp
RecFileReader.cpp
schedAction.cpp
util.cpp)
add_library(core ${CORE_SRC})
12 Hybrid.depbound: 145920
12 indep:rank=fifo 202754
12 heft: 179923
12 HetPrio: 174862
12 HetPrio:combFactor=0.25 176125
16 Hybrid.depbound: 284824
16 indep:rank=fifo 393364
16 heft: 357540
16 HetPrio: 336054
16 HetPrio:combFactor=0.25 330535
20 Hybrid.depbound: 510955
20 indep:rank=fifo 654007
20 heft: 633424
20 HetPrio: 579873
20 HetPrio:combFactor=0.25 575062
24 Hybrid.depbound: 862701
24 indep:rank=fifo 1.01544e+06
24 heft: 1.03472e+06
24 HetPrio: 942074
24 HetPrio:combFactor=0.25 929082
28 Hybrid.depbound: 1.35743e+06
28 indep:rank=fifo 1.55822e+06
28 heft: 1.58825e+06
28 HetPrio: 1.43466e+06
28 HetPrio:combFactor=0.25 1.41967e+06
32 Hybrid.depbound: 2.01502e+06
32 indep:rank=fifo 2.23186e+06
32 heft: 2.27366e+06
32 HetPrio: 2.09165e+06
32 HetPrio:combFactor=0.25 2.05926e+06
8 Hybrid.depbound: 75488.1
8 indep:rank=fifo 91941.4
8 heft: 78542.6
8 HetPrio: 78348.6
8 HetPrio:combFactor=0.25 78790.8
12 indep:rank=min 188307
12 indep:rank=heft 204619
16 indep:rank=min 387967
16 indep:rank=heft 395223
20 indep:rank=min 676350
20 indep:rank=heft 689791
24 indep:rank=min 1.03877e+06
24 indep:rank=heft 1.07783e+06
28 indep:rank=min 1.53864e+06
28 indep:rank=heft 1.59681e+06
32 indep:rank=min 2.19838e+06
32 indep:rank=heft 2.27485e+06
4 indep:rank=min 36055
4 indep:rank=heft 36055
8 indep:rank=min 83246.7
8 indep:rank=heft 95713.6
12 HetPrio:combFactor=0.5 176125
12 HetPrio:combFactor=1.0 176744
16 HetPrio:combFactor=0.5 330535
16 HetPrio:combFactor=1.0 340213
20 HetPrio:combFactor=0.5 575062
20 HetPrio:combFactor=1.0 588373
24 HetPrio:combFactor=0.5 929082
24 HetPrio:combFactor=1.0 940339
28 HetPrio:combFactor=0.5 1.41967e+06
28 HetPrio:combFactor=1.0 1.43306e+06
32 HetPrio:combFactor=0.5 2.05926e+06
32 HetPrio:combFactor=1.0 2.09299e+06
4 HetPrio:combFactor=0.5 35596.7
4 HetPrio:combFactor=1.0 35596.7
8 HetPrio:combFactor=0.5 78790.8
8 HetPrio:combFactor=1.0 78790.8
set(SCHED_SRC
algorithm.cpp
Dmdas.cpp
GreedyFile.cpp
HeteroPrio.cpp
IndepBalanced.cpp
IndepDP2.cpp
IndepImreh.cpp
IndepAccel.cpp
IndepBased.cpp
IndepDualHP.cpp
IndepZhang.cpp
ReproduceAlgorithm.cpp
listAlgorithm.cpp
availSequence.cpp
GreedyAlgorithm.cpp
HeftAlgorithm.cpp
)
add_library(schedulers ${SCHED_SRC})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment