Commit 41832b5b authored by dino's avatar dino
Browse files

generate fake lost revision 1268

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1268 170316e4-aea8-4b27-aad4-0380ec0519c9
parent 36514ffe
...@@ -86,9 +86,9 @@ find_package(ADF REQUIRED) ...@@ -86,9 +86,9 @@ find_package(ADF REQUIRED)
# Find module using simple test # Find module using simple test
include(AGAPROMacroUtilities) include(AGAPROMacroUtilities)
include(AGAPROSearchInstalledSoftware) include(AGAPROSearchInstalledSoftware)
# #
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# #
MESSAGE("[AGAPRO]") MESSAGE("[AGAPRO]")
...@@ -122,6 +122,11 @@ endif() ...@@ -122,6 +122,11 @@ endif()
# Add modules # Add modules
# #
ADD_DEFINITIONS(-DHAS_AGAPROCONFIG) ADD_DEFINITIONS(-DHAS_AGAPROCONFIG)
if ( HAS_C11 )
MESSAGE("[AGAPRO] C++11 FOUND ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
# #
add_subdirectory(common) add_subdirectory(common)
add_subdirectory(builders) add_subdirectory(builders)
...@@ -134,10 +139,14 @@ TODAY(CDATE) ...@@ -134,10 +139,14 @@ TODAY(CDATE)
file(APPEND ${AGATASOFTWARE_TOP_DIR}/CMAKE_LOG_FILE "CMAKE has been called: ${CDATE}") file(APPEND ${AGATASOFTWARE_TOP_DIR}/CMAKE_LOG_FILE "CMAKE has been called: ${CDATE}")
# #
if ( UNIX ) if ( UNIX )
if( HAS_BOOST ) if( HAS_C11 )
SET(BOOST_MESSAGE "Compiled with BOOST") SET(THREAD_MESSAGE "Compiled with C++11 thread" )
else() else()
SET(BOOST_MESSAGE "Compiled without BOOST") if ( HAS_BOOST )
SET(THREAD_MESSAGE "Compiled with BOOST thread")
else()
SET(THREAD_MESSAGE "Compiled without thread")
endif()
endif() endif()
find_package(Subversion) find_package(Subversion)
IF(SUBVERSION_FOUND) IF(SUBVERSION_FOUND)
...@@ -150,7 +159,7 @@ if ( UNIX ) ...@@ -150,7 +159,7 @@ if ( UNIX )
COMMAND ${CMAKE_COMMAND} -E echo "at " >> LAST_AGAPRO_MAKE_LOG COMMAND ${CMAKE_COMMAND} -E echo "at " >> LAST_AGAPRO_MAKE_LOG
COMMAND date >> LAST_AGAPRO_MAKE_LOG COMMAND date >> LAST_AGAPRO_MAKE_LOG
COMMAND ${CMAKE_COMMAND} -E echo ${SUBVERSION_LOG} >> LAST_AGAPRO_MAKE_LOG COMMAND ${CMAKE_COMMAND} -E echo ${SUBVERSION_LOG} >> LAST_AGAPRO_MAKE_LOG
COMMAND ${CMAKE_COMMAND} -E echo ${BOOST_MESSAGE} >> LAST_AGAPRO_MAKE_LOG COMMAND ${CMAKE_COMMAND} -E echo ${THREAD_MESSAGE} >> LAST_AGAPRO_MAKE_LOG
COMMENT " Call log target to trackback last building " COMMENT " Call log target to trackback last building "
) )
endif() endif()
......
...@@ -5,6 +5,7 @@ PROJECT(femul) ...@@ -5,6 +5,7 @@ PROJECT(femul)
################################################################ ################################################################
# Type of build # Type of build
set( CMAKE_BUILD_TYPE "Release" ) set( CMAKE_BUILD_TYPE "Release" )
#set( CMAKE_BUILD_TYPE "Debug" )
################################################################ ################################################################
# Where FIND_PACKAGE should search "non-distribution" FindXxxx.cmake # Where FIND_PACKAGE should search "non-distribution" FindXxxx.cmake
...@@ -17,13 +18,15 @@ ADD_DEFINITIONS( -DNRV_TYPE=NRV_OFFLINE ) ...@@ -17,13 +18,15 @@ ADD_DEFINITIONS( -DNRV_TYPE=NRV_OFFLINE )
################################################################ ################################################################
# Select the threads library as THR_NONE, THR_BOOST or THR_STD # Select the threads library as THR_NONE, THR_BOOST or THR_STD
if( 1 ) # 0 to select from command line ( e.g. cmake . -DTHR_TYPE=THR_STD ) if( 1 ) # 0 to select from command line ( e.g. cmake . -DTHR_TYPE=THR_STD )
set( THR_TYPE THR_STD ) # default set( THR_TYPE THR_BOOST ) # default
endif() endif()
if( NOT DEFINED THR_TYPE ) # in case default not set and nothing given from command line if( NOT DEFINED THR_TYPE ) # in case default not set and nothing given from command line
set( THR_TYPE THR_NONE ) set( THR_TYPE THR_NONE )
endif() endif()
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
if( THR_TYPE STREQUAL THR_NONE) if( THR_TYPE STREQUAL THR_NONE)
message( "Not Using threads ==> ${THR_TYPE}" ) message( "Not Using threads ==> ${THR_TYPE}" )
elseif(THR_TYPE STREQUAL THR_BOOST) elseif(THR_TYPE STREQUAL THR_BOOST)
...@@ -35,7 +38,7 @@ elseif(THR_TYPE STREQUAL THR_BOOST) ...@@ -35,7 +38,7 @@ elseif(THR_TYPE STREQUAL THR_BOOST)
elseif(THR_TYPE STREQUAL THR_STD) elseif(THR_TYPE STREQUAL THR_STD)
message("Using std::thread ==> ${THR_TYPE}" ) message("Using std::thread ==> ${THR_TYPE}" )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # should check if compiler supports SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # should check if compiler supports
SET(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -std=c++11") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
if( 0 ) if( 0 )
# these 3 lines needed if building on anodes at ganil using THR_STD # these 3 lines needed if building on anodes at ganil using THR_STD
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++") # because after updating to gcc 4.7.4 they have not updated libstdc SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++") # because after updating to gcc 4.7.4 they have not updated libstdc
......
...@@ -737,7 +737,8 @@ bool topologyRead(string topo) ...@@ -737,7 +737,8 @@ bool topologyRead(string topo)
ChainOfActors * pChain = theChains[nc]; ChainOfActors * pChain = theChains[nc];
for(int na = 0; na < pChain->numActors; na++) { for(int na = 0; na < pChain->numActors; na++) {
actor *pActor = &pChain->theActors[na]; actor *pActor = &pChain->theActors[na];
pActor->sizeOut = pChain->ioBuffsSize; if(na)
pActor->sizeOut = pChain->ioBuffsSize; // in this way it is possible to have a smaller size for producer
#if 0 #if 0
// Tests on the size of the ioBuffers, done in the attempt to avoid buffer overflow in the filters // Tests on the size of the ioBuffers, done in the attempt to avoid buffer overflow in the filters
// No more needed because ChainOfActors::Run() gives only 3/4 of the actual size to PRODUCERs and BUILDERs // No more needed because ChainOfActors::Run() gives only 3/4 of the actual size to PRODUCERs and BUILDERs
......
...@@ -19,42 +19,60 @@ endif() ...@@ -19,42 +19,60 @@ endif()
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# THREAD SUPPORT.
# #
if ( NOT WITHOUT_BOOST ) # TRY FIRST Cxx11. IF NOT, try boost.
# find_package(Boost QUIET COMPONENTS thread) include(CheckCXXCompilerFlag)
find_package(Boost QUIET COMPONENTS system thread) CHECK_CXX_COMPILER_FLAG("-std=c++11" CHECK_CXX_FLAG_C11)
# find_package(Boost COMPONENTS system filesystem thread REQUIRED) IF(CHECK_CXX_FLAG_C11)
endif() SET(IS_C11_OK ON)
MESSAGE("[AGAPRO] Compilation with c++11 thread support possible ...")
ENDIF()
# # check boost
# if WITHOUT_BOOST is given explicitely, it means even if boost installed, it is not used ==> HAS_BOOST find_package(Boost QUIET COMPONENTS system thread)
# Otherwise HAS_BOOST set to ON if ( Boost_FOUND )
# MESSAGE("[AGAPRO] Compilation with boost [thread], found on your system, possible ...")
if ( NOT WITHOUT_BOOST ) # to not use Boost even if installed SET(IS_BOOST_OK ON)
if ( Boost_FOUND ) else(Boost_FOUND)
MESSAGE("[AGAPRO] Compilation with boost found on your system") # not found traditionally, just check if boost is in AGATASOFTWARE_TOP_DIR, if defined
SET(HAS_BOOST ON) if ( AGATASOFTWARE_TOP_DIR )
else() if ( EXISTS ${AGATASOFTWARE_TOP_DIR}/include/boost )
# not found traditionally, just check if boost is in AGATASOFTWARE_TOP_DIR, if defined MESSAGE("[AGAPRO] Compilation with boost [thread], installed in agapro, possible ...")
if ( AGATASOFTWARE_TOP_DIR ) SET(IS_BOOST_OK ON)
if (EXISTS ${AGATASOFTWARE_TOP_DIR}/include/boost ) endif()
MESSAGE("[AGAPRO] Compilation with boost installed in agapro") endif()
SET(HAS_BOOST ON) endif(Boost_FOUND)
else()
MESSAGE("[AGAPRO] Compilation without boost") if ( GUESS_THREAD )
SET(HAS_BOOST OFF) if (IS_C11_OK)
endif() MESSAGE("[AGAPRO] Compilation with c++11 thread support")
endif () SET(HAS_C11 ON)
endif() else()
else() if (IS_BOOST_OK)
MESSAGE("[AGAPRO] Compilation without boost") MESSAGE("[AGAPRO] Compilation with boost thread support")
SET(HAS_BOOST OFF) SET(HAS_BOOST ON)
endif() else ()
if ( HAS_BOOST ) MESSAGE("[AGAPRO] Compilation with thread support not possible !")
MESSAGE("[AGAPRO] Boost in ${Boost_LIBRARY_DIRS} ") endif ()
endif() endif()
# else(GUESS_THREAD)
#---------------------------------------------------------------------------- if ( IS_C11_OK )
if ( WITH_CPP_THREAD )
MESSAGE("[AGAPRO] Compilation with c++11 thread support")
SET(HAS_C11 ON)
endif ()
else()
if ( IS_BOOST_OK )
if ( WITH_BOOST_THREAD )
MESSAGE("[AGAPRO] Compilation with boost thread support")
SET(HAS_BOOST ON)
endif()
else ()
MESSAGE("[AGAPRO] Compilation with thread support not possible !")
endif ()
endif()
endif(GUESS_THREAD)
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Search skstream-0.3 : Not mandatory # Search skstream-0.3 : Not mandatory
...@@ -104,7 +122,6 @@ IF(CHECK_CXX_FLAG_msse4) ...@@ -104,7 +122,6 @@ IF(CHECK_CXX_FLAG_msse4)
ELSE() ELSE()
MESSAGE("[AGAPRO] Compilation without msse4") MESSAGE("[AGAPRO] Compilation without msse4")
ENDIF() ENDIF()
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#cmakedefine HAS_BOOST #cmakedefine HAS_BOOST
#cmakedefine HAS_SKSTREAM #cmakedefine HAS_SKSTREAM
#cmakedefine HAS_SSE #cmakedefine HAS_SSE
#cmakedefine HAS_C11
////////////////////////////// //////////////////////////////
////// Define OS_TYPE //////// ////// Define OS_TYPE ////////
...@@ -36,4 +37,35 @@ ...@@ -36,4 +37,35 @@
#endif #endif
#endif #endif
#endif //////////////////////////////////////////////
\ No newline at end of file //////// Choose your version of threads //////
//////////////////////////////////////////////
#define THR_NONE 0 // no threads
#define THR_BOOST 1 // using boost c++ libraries
#define THR_STD 2 // using std in c++11 (if supported by compiler)
// THR_TYPE should be defined in the project
#define THR_TYPE @CMAKE_THR_TYPE@
#if THR_TYPE == THR_BOOST
#define thrLib boost
#define thrYield() ( thrLib::this_thread::yield() )
#define thrSleep(msecs) ( thrLib::this_thread::sleep(thrLib::posix_time::milliseconds(msecs)) )
#define thrLock thrLib::mutex::scoped_lock
#elif THR_TYPE == THR_STD
#define thrLib std
#define thrYield() ( thrLib::this_thread::yield() )
#define thrSleep(msecs) ( thrLib::this_thread::sleep_for(thrLib::chrono::milliseconds(msecs)) )
#define thrLock thrLib::unique_lock<std::mutex>
#elif THR_TYPE == THR_NONE
#define thrLib
#define thrYield()
#define thrSleep(msecs)
#define thrLock
#else
#error THR_TYPE should be either THR_BOOST, THR_STD or THR_NONE
#endif
#endif
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