Browse Source

Added cudaForStorm as a dynamic library extension

Former-commit-id: 31c6be4c1c
tempestpy_adaptions
PBerger 11 years ago
parent
commit
8781aa27b6
  1. 24
      CMakeLists.txt
  2. 15
      resources/cudaForStorm/CMakeLists.txt
  3. 15
      resources/cudaForStorm/src/cudaForStorm.h
  4. 9
      resources/cudaForStorm/src/main.cpp
  5. 3
      storm-config.h.in

24
CMakeLists.txt

@ -33,6 +33,7 @@ option(STORM_USE_COTIRE "Sets whether Cotire should be used (for building precom
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)
option(ENABLE_CUDAFORSTORM "Sets whether StoRM is built with its CUDA extension." 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.")
@ -183,6 +184,13 @@ else()
set(STORM_CPP_GLPK_DEF "undef")
endif()
# CUDA Defines
if (ENABLE_CUDAFORSTORM)
set(STORM_CPP_CUDAFORSTORM_DEF "define")
else()
set(STORM_CPP_CUDAFORSTORM_DEF "undef")
endif()
# Z3 Defines
if (ENABLE_Z3)
set(STORM_CPP_Z3_DEF "define")
@ -286,6 +294,9 @@ endif()
if (ENABLE_Z3)
link_directories("${Z3_ROOT}/bin")
endif()
if (ENABLE_CUDAFORSTORM)
link_directories("${PROJECT_SOURCE_DIR}/build/cudaForStorm/lib")
endif()
if ((NOT Boost_LIBRARY_DIRS) OR ("${Boost_LIBRARY_DIRS}" STREQUAL ""))
set(Boost_LIBRARY_DIRS "${Boost_INCLUDE_DIRS}/stage/lib")
endif ()
@ -317,6 +328,19 @@ target_link_libraries(storm-performance-tests ${Boost_LIBRARIES})
#message(STATUS "BOOST_INCLUDE_DIRS is ${Boost_INCLUDE_DIRS}")
#message(STATUS "BOOST_LIBRARY_DIRS is ${Boost_LIBRARY_DIRS}")
#############################################################
##
## CUDA For Storm
##
#############################################################
if (ENABLE_CUDAFORSTORM)
message (STATUS "StoRM - Linking with CudaForStorm")
include_directories("${PROJECT_SOURCE_DIR}/build/cudaForStorm/include")
target_link_libraries(storm cudaForStorm)
target_link_libraries(storm-functional-tests cudaForStorm)
target_link_libraries(storm-performance-tests cudaForStorm)
endif(ENABLE_CUDAFORSTORM)
#############################################################
##
## CUDD

15
resources/cudaForStorm/CMakeLists.txt

@ -27,6 +27,7 @@ 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).")
#############################################################
##
@ -258,11 +259,11 @@ endif()
# Since this will be a library
include (GenerateExportHeader)
add_library(cudaForStorm STATIC ${CUDAFORSTORM_HEADERS} ${CUDAFORSTORM_SOURCES})
add_library(cudaForStorm SHARED ${CUDAFORSTORM_HEADERS} ${CUDAFORSTORM_SOURCES})
GENERATE_EXPORT_HEADER( cudaForStorm
BASE_NAME cudaForStorm
EXPORT_MACRO_NAME cudaForStorm_EXPORT
EXPORT_FILE_NAME cudaForStorm_Export.h
EXPORT_FILE_NAME include/cudaForStorm_Export.h
STATIC_DEFINE cudaForStorm_BUILT_AS_STATIC
)
@ -333,7 +334,9 @@ endif(MSVC)
# Link against libc++abi if requested. May be needed to build on Linux systems using clang.
if (LINK_LIBCXXABI)
message (STATUS "StoRM - Linking against libc++abi.")
target_link_libraries(storm "c++abi")
target_link_libraries(storm-functional-tests "c++abi")
target_link_libraries(storm-performance-tests "c++abi")
endif(LINK_LIBCXXABI)
target_link_libraries(cudaForStorm "c++abi")
endif(LINK_LIBCXXABI)
# Install Directive
install(TARGETS cudaForStorm DESTINATION "${STORM_LIB_INSTALL_DIR}/lib")
install(FILES "${PROJECT_SOURCE_DIR}/src/cudaForStorm.h" "${PROJECT_BINARY_DIR}/cudaForStorm_Export.h" DESTINATION "${STORM_LIB_INSTALL_DIR}/include")

15
resources/cudaForStorm/src/cudaForStorm.h

@ -0,0 +1,15 @@
#ifndef STORM_CUDAFORSTORM_CUDAFORSTORM_H_
#define STORM_CUDAFORSTORM_CUDAFORSTORM_H_
// Library exports
#include "cudaForStorm_Export.h"
/*
* List of exported functions in this library
*/
cudaForStorm_EXPORT int cudaForStormTest(int value);
#endif // STORM_CUDAFORSTORM_CUDAFORSTORM_H_

9
resources/cudaForStorm/src/main.cpp

@ -1,3 +1,5 @@
#include "cudaForStorm.h"
#include <stdio.h>
#include <stdlib.h>
@ -7,7 +9,12 @@
#include "cudaTests.h"
int main(int argc, char **argv){
int cudaForStormTest(int value) {
return value + 42;
}
int main_Test12345(int argc, char **argv){
resetCudaDevice();
int testNumber = 0;

3
storm-config.h.in

@ -22,6 +22,9 @@
// Whether GLPK is available and to be used (define/undef)
#@STORM_CPP_GLPK_DEF@ STORM_HAVE_GLPK
// Whether CudaForStorm is available and to be used (define/undef)
#@STORM_CPP_CUDAFORSTORM_DEF@ STORM_HAVE_CUDAFORSTORM
// Whether Z3 is available and to be used (define/undef)
#@STORM_CPP_Z3_DEF@ STORM_HAVE_Z3

Loading…
Cancel
Save