Skip to content

Commit

Permalink
- fixed ScoreP-Handling in Cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Walther authored and OpenModelica-Hudson committed Jun 17, 2015
1 parent 1a632d2 commit 0c25b66
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 18 deletions.
2 changes: 1 addition & 1 deletion SimulationRuntime/cpp/CMake/FindPugiXML.cmake
Expand Up @@ -21,4 +21,4 @@ else (PUGIXML_FOUND)
message (STATUS "No PugiXML found")
endif(PUGIXML_FOUND)

mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
mark_as_advanced (PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)
22 changes: 22 additions & 0 deletions SimulationRuntime/cpp/CMake/FindScoreP.cmake
@@ -0,0 +1,22 @@
# Find the header files of the scorep compiler wrapper.
#
# Sets the usual variables expected for find_package scripts:
#
# SCOREP_INCLUDE_DIR - header location
# SCOREP_FOUND - true if pugixml was found.
#
# To influence the behaviour, you can use the following variable:
# SCOREP_HOME - the folder that contains the scorep include folder

find_path (SCOREP_INCLUDE_DIR NAMES scorep/SCOREP_User.h PATHS ${SCOREP_HOME}/include)

include (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (SCOREP DEFAULT_MSG SCOREP_INCLUDE_DIR)

if (NOT SCOREP_FOUND)
message (FATAL_ERROR "ScoreP includes not found")
endif(NOT SCOREP_FOUND)

message(STATUS "ScoreP includes ${SCOREP_INCLUDE_DIR}")

mark_as_advanced (SCOREP_INCLUDE_DIR)
2 changes: 2 additions & 0 deletions SimulationRuntime/cpp/CMakeLists.txt
Expand Up @@ -120,7 +120,9 @@ ENDIF(USE_PARALLEL_OUTPUT)
# Handle ScoreP
IF(USE_SCOREP)
ADD_DEFINITIONS(-DUSE_SCOREP)
FIND_PACKAGE(ScoreP)
MESSAGE(STATUS "ScoreP enabled")
include_directories(${SCOREP_INCLUDE_DIR})
ELSE(USE_SCOREP)
MESSAGE(STATUS "ScoreP disabled")
ENDIF(USE_SCOREP)
Expand Down
23 changes: 12 additions & 11 deletions SimulationRuntime/cpp/Core/Math/CMakeLists.txt
Expand Up @@ -4,22 +4,23 @@ project(${MathName})
# add the solver default implementation library

add_library(${MathName}_static STATIC ArrayOperations.cpp Functions.cpp FactoryExport.cpp)
add_library(${MathName} SHARED ArrayOperations.cpp Functions.cpp FactoryExport.cpp)

IF(UNIX)
set_target_properties(${MathName}_static PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)

install (TARGETS ${MathName}_static DESTINATION ${LIBINSTALLEXT})

IF(RUNTIME_STATIC_LINKING)
ELSE(RUNTIME_STATIC_LINKING)
add_library(${MathName} SHARED ArrayOperations.cpp Functions.cpp FactoryExport.cpp)
target_link_libraries (${MathName} ${Boost_LIBRARIES} ${UMFPACK_LIB} ${LAPACK_LIBRARIES})
set_target_properties(${MathName}_static PROPERTIES COMPILE_DEFINITIONS "DRUNTIME_STATIC_LINKING")
IF(UNIX)
set_target_properties(${MathName} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)
install (TARGETS ${MathName} DESTINATION ${LIBINSTALLEXT})
add_precompiled_header(${MathName} Include/Core/Modelica.h )
ENDIF(RUNTIME_STATIC_LINKING)
target_link_libraries (${MathName} ${Boost_LIBRARIES} ${UMFPACK_LIB} ${LAPACK_LIBRARIES})
set_target_properties(${MathName}_static PROPERTIES COMPILE_DEFINITIONS "DRUNTIME_STATIC_LINKING")

IF(UNIX)
set_target_properties(${MathName} PROPERTIES COMPILE_FLAGS -fPIC)
ENDIF(UNIX)

install (TARGETS ${MathName} DESTINATION ${LIBINSTALLEXT})
add_precompiled_header(${MathName} Include/Core/Modelica.h )

install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/Math/Functions.h
${CMAKE_SOURCE_DIR}/Include/Core/Math/ArrayOperations.h
Expand Down
5 changes: 3 additions & 2 deletions SimulationRuntime/cpp/Makefile.in
Expand Up @@ -18,6 +18,7 @@ BOOST_REALPATHS_COMMAND="-DUSE_BOOST_REALPATHS=ON"
PARALLEL_OUTPUT_COMMAND="-DUSE_PARALLEL_OUTPUT=ON"
RUNTIME_PROFILING_COMMAND="-DRUNTIME_PROFILING=ON"
SCOREP_COMMAND="-DUSE_SCOREP=ON"
SCOREP_HOME=""
SUNDIALS_LAPACK_COMMAND="-DSUNDIALS_LAPACK=ON"
CMAKE_COMMANDS=CC="scorep --user --nocompiler --thread=pthread gcc" CXX="scorep --user --nocompiler --thread=pthread g++"
CMAKE_ARGS=$(patsubst CMAKE_%, -D%, $(filter CMAKE_%, $(MAKEFLAGS)))
Expand All @@ -38,7 +39,7 @@ endif
ifneq ("$(RUNTIME_PROFILING)","true")
$(eval RUNTIME_PROFILING_COMMAND=)
endif
ifneq ("$(USE_SCOREP)","true") #If ScoreP ist used, the analyzation mode is automatically turned on
ifneq ("$(USE_SCOREP)","true")
$(eval CMAKE_COMMANDS=CC="@CC@" CXX="@CXX@" CFLAGS="@CFLAGS@" CXXFLAGS="@CXXFLAGS@")
$(eval SCOREP_COMMAND=)
else
Expand All @@ -48,7 +49,7 @@ ifneq ("$(USE_SUNDIALS_LAPACK)","true")
$(eval SUNDIALS_LAPACK_COMMAND=)
endif
mkdir -p Build
cd ./Build && echo "change to Build" && $(CMAKE_COMMANDS) cmake $(RUNTIME_STATIC_LINKING_COMMAND) $(BOOST_STATIC_LINKING_COMMAND) $(BOOST_REALPATHS_COMMAND) $(PARALLEL_OUTPUT_COMMAND) $(RUNTIME_PROFILING_COMMAND) $(SCOREP_COMMAND) $(SUNDIALS_LAPACK_COMMAND) -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH="$(OMBUILDDIR)" -DLIBINSTALLEXT=lib/@host_short@/omc/cpp $(CMAKE_ARGS) ../
cd ./Build && echo "change to Build" && $(CMAKE_COMMANDS) cmake $(RUNTIME_STATIC_LINKING_COMMAND) $(BOOST_STATIC_LINKING_COMMAND) $(BOOST_REALPATHS_COMMAND) $(PARALLEL_OUTPUT_COMMAND) $(RUNTIME_PROFILING_COMMAND) $(SCOREP_COMMAND) $(SUNDIALS_LAPACK_COMMAND) -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX:PATH="$(OMBUILDDIR)" -DLIBINSTALLEXT=lib/@host_short@/omc/cpp -DSCOREP_HOME:STRING="$(SCOREP_HOME)" $(CMAKE_ARGS) ../
$(MAKE) -C Build VERBOSE=1

install: runtimeCpp
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/Solver/CVode/CVode.cpp
Expand Up @@ -432,7 +432,7 @@ void Cvode::solve(const SOLVERCALL action)
flag = CVodeGetNonlinSolvStats(_cvodeMem, &nni, &ncfn);

MeasureTimeValuesSolver solverVals = MeasureTimeValuesSolver(nfe, netf);
measureTimeFunctionsArray[6].numCalcs += nst;
measureTimeFunctionsArray[6].sumMeasuredValues->_numCalcs += nst;
measureTimeFunctionsArray[6].sumMeasuredValues->add(&solverVals);
}
#endif
Expand Down Expand Up @@ -659,7 +659,7 @@ void Cvode::writeCVodeOutput(const double &time, const double &h, const int &stp
MEASURETIME_REGION_DEFINE(cvodeWriteOutputHandler, "CVodeWriteOutput");
if(MeasureTime::getInstance() != NULL)
{
measureTimeFunctionsArray[2].numCalcs--;
measureTimeFunctionsArray[2].sumMeasuredValues->_numCalcs--;
MEASURETIME_START(measuredFunctionStartValues, cvodeWriteOutputHandler, "CVodeWriteOutput");
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/Solver/IDA/IDA.cpp
Expand Up @@ -397,7 +397,7 @@ void Ida::solve(const SOLVERCALL action)
flag = IDAGetNonlinSolvStats(_idaMem, &nni, &ncfn);

MeasureTimeValuesSolver solverVals = MeasureTimeValuesSolver(nfe, netf);
measureTimeFunctionsArray[6].numCalcs += nst;
measureTimeFunctionsArray[6].sumMeasuredValues->_numCalcs += nst;
measureTimeFunctionsArray[6].sumMeasuredValues->add(&solverVals);
}
#endif
Expand Down Expand Up @@ -625,7 +625,7 @@ void Ida::writeIDAOutput(const double &time, const double &h, const int &stp)
MEASURETIME_REGION_DEFINE(idaWriteOutputHandler, "IDAWriteOutput");
if(MeasureTime::getInstance() != NULL)
{
measureTimeFunctionsArray[2].numCalcs--;
measureTimeFunctionsArray[2].sumMeasuredValues->_numCalcs--;
MEASURETIME_START(measuredFunctionStartValues, idaWriteOutputHandler, "IDAWriteOutput");
}
#endif
Expand Down

0 comments on commit 0c25b66

Please sign in to comment.