@ -11,20 +11,17 @@ set (STORM_CPP_VERSION_MINOR 0)
include_directories ( "${PROJECT_SOURCE_DIR}" )
include_directories ( "${PROJECT_SOURCE_DIR}/src" )
message ( STATUS "CUDA_PATH is ${CUDA_PATH} or $ENV{CUDA_PATH}" )
message ( STATUS "StoRM (CudaPlugin) - CUDA_PATH is ${CUDA_PATH} or $ENV{CUDA_PATH}" )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# # C M a k e o p t i o n s o f S t o R M
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
option ( DEBUG "Sets whether the DEBUG mode is used" ON )
option ( USE_POPCNT "Sets whether the popcnt instruction is going to be used." ON )
option ( CUDAFORSTORM_DEBUG "Sets whether the DEBUG mode is used" ON )
option ( LINK_LIBCXXABI "Sets whether libc++abi should be linked." OFF )
option ( USE_LIBCXX "Sets whether the standard library is libc++." OFF )
option ( ENABLE_GLPK "Sets whether StoRM is built with support for glpk." OFF )
set ( GUROBI_ROOT "" CACHE STRING "The root directory of Gurobi (if available)." )
set ( Z3_ROOT "" CACHE STRING "The root directory of Z3 (if available)." )
set ( ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories." )
set ( ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories." )
set ( STORM_LIB_INSTALL_DIR "${PROJECT_SOURCE_DIR}/../../build/cudaForStorm" CACHE STRING "The Build directory of storm, where the library files should be installed to (if available)." )
@ -43,28 +40,15 @@ find_package(Doxygen REQUIRED)
find_package ( Threads REQUIRED )
# I f t h e D E B U G o p t i o n w a s t u r n e d o n , w e w i l l t a r g e t a d e b u g v e r s i o n a n d a r e l e a s e v e r s i o n o t h e r w i s e
if ( DEBUG )
if ( CUDAFORSTORM_ DEBUG)
set ( CMAKE_BUILD_TYPE "DEBUG" )
else ( )
set ( CMAKE_BUILD_TYPE "RELEASE" )
endif ( )
message ( STATUS "StoRM - Building ${CMAKE_BUILD_TYPE} version." )
if ( "${GUROBI_ROOT}" STREQUAL "" )
set ( ENABLE_GUROBI OFF )
else ( )
set ( ENABLE_GUROBI ON )
endif ( )
if ( "${Z3_ROOT}" STREQUAL "" )
set ( ENABLE_Z3 OFF )
else ( )
set ( ENABLE_Z3 ON )
set ( Z3_LIB_NAME "z3" )
endif ( )
message ( STATUS "StoRM (CudaPlugin) - Building ${CMAKE_BUILD_TYPE} version." )
message ( STATUS "StoRM - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
message ( STATUS "StoRM - CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}" )
message ( STATUS "StoRM (CudaPlugin) - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
message ( STATUS "StoRM (CudaPlugin) - CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}" )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
@ -78,8 +62,8 @@ set(CUDA_SEPARABLE_COMPILATION ON)
# set ( CUDA_NVCC_FLAGS "-arch=sm_30" )
# B e c a u s e t h e F i n d C U D A . c m a k e f i l e h a s a p a t h r e l a t e d b u g , t w o f o l d e r s h a v e t o b e p r e s e n t
file ( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/cudaLibrary .dir/Debug" )
file ( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/cudaLibrary .dir/Release" )
file ( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/cudaForStorm .dir/Debug" )
file ( MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/cudaForStorm .dir/Release" )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@ -87,28 +71,13 @@ file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/cudaLibrary.dir/Release")
# # C o m p i l e r s p e c i f i c s e t t i n g s a n d d e f i n i t i o n s
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# P a t h t o t h e n o - s t r i c t - a l i a s i n g t a r g e t
set ( CONVERSIONHELPER_TARGET "${PROJECT_SOURCE_DIR}/src/utility/ConversionHelper.cpp" )
if ( CMAKE_COMPILER_IS_GNUCC )
message ( STATUS "StoRM - Using Compiler Configuration: GCC" )
message ( STATUS "StoRM (CudaPlugin) - Using Compiler Configuration: GCC" )
# S e t s t a n d a r d f l a g s f o r G C C
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic" )
# - W e r r o r i s a t m r e m o v e d a s t h i s g a v e s o m e p r o b l e m s w i t h e x i s t i n g c o d e
# M a y b e r e - s e t l a t e r
# ( T h o m a s H e i n e m a n n , 2 0 1 2 - 1 2 - 2 1 )
# T u r n o n p o p c n t i n s t r u c t i o n i f desired ( yes by default )
if ( USE_POPCNT )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt" )
endif ( USE_POPCNT )
# S e t t h e n o - s t r i c t - a l i a s i n g t a r g e t f o r G C C
set_source_files_properties ( ${ CONVERSIONHELPER_TARGET } PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing " )
elseif ( MSVC )
message ( STATUS "StoRM - Using Compiler Configuration: MSVC" )
message ( STATUS "StoRM (CudaPlugin) - Using Compiler Configuration: MSVC" )
# r e q u i r e d f o r G M M t o c o m p i l e , u g l y e r r o r d i r e c t i v e i n t h e i r c o d e
add_definitions ( /D_SCL_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS )
# r e q u i r e d a s t h e P R C T L P a r s e r b l o a t s o b j e c t files ( COFF ) b e y o n d t h e i r m a x i m u m size ( see http://msdn.microsoft.com/en-us/library/8578y171(v=vs.110 ) . a s p x )
@ -117,26 +86,18 @@ elseif(MSVC)
add_definitions ( /D_VARIADIC_MAX=10 )
# W i n d o w s . h b r e a k s G M M i n g m m _ e x c e p t . h b e c a u s e o f i t s m a c r o d e f i n i t i o n f o r m i n a n d m a x
add_definitions ( /DNOMINMAX )
if ( ENABLE_Z3 )
set ( Z3_LIB_NAME "libz3" )
endif ( )
# MSVC d o e s n o t d o s t r i c t - a l i a s i n g , s o n o o p t i o n n e e d e d
else ( CLANG )
message ( STATUS "StoRM - Using Compiler Configuration: Clang (LLVM)" )
message ( STATUS "StoRM (CudaPlugin) - Using Compiler Configuration: Clang (LLVM)" )
# A s C L A N G i s n o t s e t a s a v a r i a b l e , w e n e e d t o s e t i t i n c a s e w e h a v e n o t m a t c h e d a n o t h e r c o m p i l e r .
set ( CLANG ON )
# S e t s t a n d a r d f l a g s f o r c l a n g
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops -O3" )
if ( UNIX AND NOT APPLE AND NOT USE_LIBCXX )
set ( CLANG_STDLIB libstdc++ )
message ( STATUS "StoRM - Linking against libstdc++" )
message ( STATUS "StoRM (CudaPlugin) - Linking against libstdc++" )
else ( )
set ( CLANG_STDLIB libc++ )
message ( STATUS "StoRM - Linking against libc++" )
# D i s a b l e C o t i r e
set ( STORM_USE_COTIRE OFF )
message ( STATUS "StoRM (CudaPlugin) - Linking against libc++" )
# S e t u p s o m e X c o d e s p e c i f i c s e t t i n g s
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
@ -145,14 +106,6 @@ else(CLANG)
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=${CLANG_STDLIB} -Wall -pedantic -Wno-unused-variable -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -ftemplate-depth=1024" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g" )
# T u r n o n p o p c n t i n s t r u c t i o n i f desired ( yes by default )
if ( USE_POPCNT )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mpopcnt" )
endif ( USE_POPCNT )
# S e t t h e n o - s t r i c t - a l i a s i n g t a r g e t f o r C l a n g
set_source_files_properties ( ${ CONVERSIONHELPER_TARGET } PROPERTIES COMPILE_FLAGS " -fno-strict-aliasing " )
endif ( )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@ -160,35 +113,6 @@ endif()
# # C M a k e - g e n e r a t e d C o n f i g F i l e f o r S t o R M
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# B a s e p a t h f o r t e s t f i l e s
set ( STORM_CPP_TESTS_BASE_PATH "${PROJECT_SOURCE_DIR}/test" )
# G u r o b i D e f i n e s
if ( ENABLE_GUROBI )
set ( STORM_CPP_GUROBI_DEF "define" )
else ( )
set ( STORM_CPP_GUROBI_DEF "undef" )
endif ( )
# g l p k d e f i n e s
if ( ENABLE_GLPK )
set ( STORM_CPP_GLPK_DEF "define" )
else ( )
set ( STORM_CPP_GLPK_DEF "undef" )
endif ( )
# Z 3 D e f i n e s
if ( ENABLE_Z3 )
set ( STORM_CPP_Z3_DEF "define" )
else ( )
set ( STORM_CPP_Z3_DEF "undef" )
endif ( )
# I n t e l T B B D e f i n e s
if ( TBB_FOUND AND ENABLE_INTELTBB )
set ( STORM_CPP_INTELTBB_DEF "define" )
else ( )
set ( STORM_CPP_INTELTBB_DEF "undef" )
endif ( )
# C o n f i g u r e a h e a d e r f i l e t o p a s s s o m e o f t h e C M a k e s e t t i n g s t o t h e s o u r c e c o d e
configure_file (
@ -213,7 +137,7 @@ file(GLOB_RECURSE CUDAFORSTORM_CUDA_SOURCES "${PROJECT_SOURCE_DIR}/srcCuda/*.cu"
file ( GLOB_RECURSE CUDAFORSTORM_CUDA_HEADERS "${PROJECT_SOURCE_DIR}/srcCuda/*.h" )
# A d d i t i o n a l i n c l u d e f i l e s l i k e t h e s t o r m - c o n f i g . h
file ( GLOB_RECURSE STORM_BUILD_HEADERS ${ PROJECT_BINARY_DIR } /include/*.h )
file ( GLOB_RECURSE CUDAFOR STORM_BUILD_HEADERS ${ PROJECT_BINARY_DIR } /include/*.h )
# G r o u p t h e h e a d e r s a n d s o u r c e s
source_group ( main FILES ${ CUDAFORSTORM_HEADERS } ${ CUDAFORSTORM_SOURCES } )
@ -221,11 +145,11 @@ source_group(cuda FILES ${CUDAFORSTORM_CUDA_SOURCES} ${CUDAFORSTORM_CUDA_HEADERS
# A d d c u s t o m a d d i t i o n a l i n c l u d e o r l i n k d i r e c t o r i e s
if ( ADDITIONAL_INCLUDE_DIRS )
message ( STATUS "StoRM - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}" )
message ( STATUS "StoRM (CudaPlugin) - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}" )
include_directories ( ${ ADDITIONAL_INCLUDE_DIRS } )
endif ( ADDITIONAL_INCLUDE_DIRS )
if ( ADDITIONAL_LINK_DIRS )
message ( STATUS "StoRM - Using additional link directories ${ADDITIONAL_LINK_DIRS}" )
message ( STATUS "StoRM (CudaPlugin) - Using additional link directories ${ADDITIONAL_LINK_DIRS}" )
link_directories ( ${ ADDITIONAL_LINK_DIRS } )
endif ( ADDITIONAL_LINK_DIRS )
@ -234,19 +158,7 @@ endif(ADDITIONAL_LINK_DIRS)
# # P r e e x e c u t a b l e - c r e a t i o n l i n k _ d i r e c t o r i e s s e t u p
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if ( ENABLE_GUROBI )
link_directories ( "${GUROBI_ROOT}/lib" )
endif ( )
if ( ENABLE_Z3 )
link_directories ( "${Z3_ROOT}/bin" )
endif ( )
if ( ( NOT Boost_LIBRARY_DIRS ) OR ( "${Boost_LIBRARY_DIRS}" STREQUAL "" ) )
set ( Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib" )
endif ( )
link_directories ( ${ Boost_LIBRARY_DIRS } )
if ( TBB_FOUND AND ENABLE_INTELTBB )
link_directories ( ${ TBB_LIBRARY_DIRS } )
endif ( )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # #
@ -255,17 +167,15 @@ endif()
# # A l l link_directories ( ) c a l l s M U S T b e m a d e b e f o r e t h i s p o i n t #
# # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# S i n c e t h i s w i l l b e a l i b r a r y
include ( GenerateExportHeader )
add_library ( cudaForStorm SHARED ${ CUDAFORSTORM_HEADERS } ${ CUDAFORSTORM_SOURCES } )
GENERATE_EXPORT_HEADER ( cudaForStorm
B A S E _ N A M E c u d a F o r S t o r m
E X P O R T _ M A C R O _ N A M E c u d a F o r S t o r m _ E X P O R T
E X P O R T _ F I L E _ N A M E i n c l u d e / c u d a F o r S t o r m _ E x p o r t . h
S T A T I C _ D E F I N E c u d a F o r S t o r m _ B U I L T _ A S _ S T A T I C
)
# add_library ( cudaForStorm SHARED ${ CUDAFORSTORM_HEADERS } ${ CUDAFORSTORM_SOURCES } )
# GENERATE_EXPORT_HEADER ( cudaForStorm
# B A S E _ N A M E c u d a F o r S t o r m
# E X P O R T _ M A C R O _ N A M E c u d a F o r S t o r m _ E X P O R T
# E X P O R T _ F I L E _ N A M E i n c l u d e / c u d a F o r S t o r m _ E x p o r t . h
# S T A T I C _ D E F I N E c u d a F o r S t o r m _ B U I L T _ A S _ S T A T I C
# )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
@ -273,50 +183,24 @@ GENERATE_EXPORT_HEADER( cudaForStorm
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# set ( CUDA_NVCC_FLAGS ${ CUDA_NVCC_FLAGS } --gpu-architecture sm_30 )
cuda_add_library ( cudaLibrary
cuda_add_library ( cudaForStorm
$ { C U D A F O R S T O R M _ C U D A _ S O U R C E S } $ { C U D A F O R S T O R M _ C U D A _ H E A D E R S }
O P T I O N S - D S T U F F = " " - a r c h = s m _ 3 0
R E L E A S E - D N D E B U G
D E B U G - g - D D E B U G
)
target_link_libraries ( cudaLibrary ${ CUDA_cusparse_LIBRARY } )
ADD_DEPENDENCIES ( cudaForStorm cudaLibrary )
target_link_libraries ( cudaForStorm cudaLibrary )
message ( STATUS "Found CUDA SDK in Version ${CUDA_VERSION_STRING}, sparse lib is ${CUDA_cusparse_LIBRARY}" )
GENERATE_EXPORT_HEADER ( cudaForStorm
B A S E _ N A M E c u d a F o r S t o r m
E X P O R T _ M A C R O _ N A M E c u d a F o r S t o r m _ E X P O R T
E X P O R T _ F I L E _ N A M E i n c l u d e / c u d a F o r S t o r m _ E x p o r t . h
S T A T I C _ D E F I N E c u d a F o r S t o r m _ B U I L T _ A S _ S T A T I C
)
# target_link_libraries ( cudaLibrary ${ CUDA_cusparse_LIBRARY } )
# ADD_DEPENDENCIES ( cudaForStorm cudaLibrary )
# target_link_libraries ( cudaForStorm cudaLibrary )
message ( STATUS "StoRM (CudaPlugin) - Found CUDA SDK in Version ${CUDA_VERSION_STRING}, sparse lib is ${CUDA_cusparse_LIBRARY}" )
include_directories ( ${ CUDA_INCLUDE_DIRS } )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# # Gurobi ( optional )
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if ( ENABLE_GUROBI )
message ( STATUS "StoRM - Linking with Gurobi" )
include_directories ( "${GUROBI_ROOT}/include" )
target_link_libraries ( cudaForStorm "gurobi56" )
endif ( ENABLE_GUROBI )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# # glpk ( optional )
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if ( ENABLE_GLPK )
message ( STATUS "StoRM - Linking with glpk" )
target_link_libraries ( cudaForStorm "glpk" )
endif ( ENABLE_GLPK )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# # Z3 ( optional )
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if ( ENABLE_Z3 )
message ( STATUS "StoRM - Linking with Z3" )
include_directories ( "${Z3_ROOT}/include" )
target_link_libraries ( cudaForStorm ${ Z3_LIB_NAME } )
endif ( ENABLE_Z3 )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# # T h r e a d s
@ -333,7 +217,7 @@ endif(MSVC)
# L i n k a g a i n s t l i b c + + a b i i f r e q u e s t e d . M a y b e n e e d e d t o b u i l d o n L i n u x s y s t e m s u s i n g c l a n g .
if ( LINK_LIBCXXABI )
message ( STATUS "StoRM - Linking against libc++abi." )
message ( STATUS "StoRM (CudaPlugin) - Linking against libc++abi." )
target_link_libraries ( cudaForStorm "c++abi" )
endif ( LINK_LIBCXXABI )