Commit 02d9302e authored by COULAUD Olivier's avatar COULAUD Olivier

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/scalfmm/scalfmm

# By Florent Pruvost (2) and Samuel Pitoiset (2)
# Via Samuel Pitoiset
* 'master' of git+ssh://scm.gforge.inria.fr//gitroot/scalfmm/scalfmm:
  GroupTree: fix start/stop profiling with KStar
  GroupTree: allow to start/stop StarPU profiling
  add the possibility to build scalfmm as a dynamic lib (static by default)
  sync with https://scm.gforge.inria.fr/anonscm/svn/morse/trunk/morse_distrib/cmake_modules/morse/find
parents f3a02033 1389e572
......@@ -22,7 +22,7 @@ if(SCALFMM_ADDON_CKERNELAPI)
file( GLOB_RECURSE source_lib_files Src/*.cpp )
# Adding cpp files to project
add_library( scalfmmckernelapi STATIC ${source_lib_files} )
add_library( scalfmmckernelapi ${source_lib_files} )
# Add blas library (even if it is set to off)
target_link_libraries( scalfmmckernelapi scalfmm)
......
......@@ -24,7 +24,7 @@ if(SCALFMM_ADDON_FMMAPI)
file( GLOB_RECURSE source_lib_files Src/*.cpp )
# Adding cpp files to project
add_library( scalfmmapi STATIC ${source_lib_files} )
add_library( scalfmmapi ${source_lib_files} )
# Add blas library (even if it is set to off)
target_link_libraries( scalfmmapi scalfmm)
......
......@@ -36,7 +36,7 @@ if(SCALFMM_ADDON_HMAT)
file( GLOB_RECURSE source_lib_files Src/*.cpp )
# Adding cpp files to project
add_library( scalfmmhmat STATIC ${source_lib_files} )
add_library( scalfmmhmat ${source_lib_files} )
# Add blas library (even if it is set to off)
target_link_libraries( scalfmmhmat scalfmm)
......@@ -64,7 +64,7 @@ if(SCALFMM_ADDON_HMAT)
# Add C Clustering Library
file( GLOB_RECURSE ccl_lib_files CClusteringLibrary/*.c )
add_library( cclusteringlib STATIC ${ccl_lib_files} )
add_library( cclusteringlib ${ccl_lib_files} )
INCLUDE_DIRECTORIES(CClusteringLibrary/)
target_link_libraries( cclusteringlib scalfmm)
install( TARGETS cclusteringlib ARCHIVE DESTINATION lib )
......
......@@ -63,6 +63,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# Build ScalFmm as static or dynamic lib
# --------------------------------------
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
#
# Options
#
......
......@@ -47,7 +47,6 @@
include(CheckStructHasMember)
include(CheckCSourceCompiles)
include(CheckLibraryExists)
if (NOT HWLOC_FOUND)
set(HWLOC_DIR "" CACHE PATH "Installation directory of HWLOC library")
......@@ -323,6 +322,7 @@ if (HWLOC_FOUND)
check_struct_has_member( "struct hwloc_cache_attr_s" size hwloc.h HAVE_HWLOC_CACHE_ATTR )
check_c_source_compiles( "#include <hwloc.h>
int main(void) { hwloc_obj_t o; o->type = HWLOC_OBJ_PU; return 0;}" HAVE_HWLOC_OBJ_PU)
include(CheckLibraryExists)
check_library_exists(${HWLOC_LIBRARIES} hwloc_bitmap_free "" HAVE_HWLOC_BITMAP)
set(CMAKE_REQUIRED_INCLUDES ${HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES})
......
......@@ -38,6 +38,7 @@
# PARSEC_LIBRARY_DIRS_DEP - parsec + dependencies link directories
# PARSEC_LIBRARIES_DEP - parsec libraries + dependencies
# PARSEC_daguepp_BIN_DIR - path to parsec driver daguepp
# PARSEC_DAGUEPP - parsec jdf compiler
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DPARSEC=path/to/parsec):
# PARSEC_DIR - Where to find the base directory of parsec
......@@ -151,6 +152,21 @@ if(UNIX AND NOT APPLE)
endif()
endif()
# Try to find libdl
if (NOT PARSEC_FIND_QUIETLY)
message(STATUS "Looking for PARSEC - Try to detect libdl")
endif()
set(PARSEC_DL_LIBRARIES "")
find_library(
PARSEC_DL_LIBRARY
NAMES dl
)
mark_as_advanced(PARSEC_DL_LIBRARY)
if (PARSEC_DL_LIBRARY)
list(APPEND PARSEC_DL_LIBRARIES "${PARSEC_DL_LIBRARY}")
list(APPEND PARSEC_EXTRA_LIBRARIES "${PARSEC_DL_LIBRARY}")
endif()
# PARSEC may depend on HWLOC, try to find it
if (NOT HWLOC_FOUND AND PARSEC_LOOK_FOR_HWLOC)
if (PARSEC_FIND_REQUIRED)
......@@ -549,7 +565,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT PARSEC_FOUND)
list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
endif()
endif()
# EXTRA LIBS such that pthread, m, rt
# EXTRA LIBS such that pthread, m, rt, dl
list(APPEND REQUIRED_LIBS ${PARSEC_EXTRA_LIBRARIES})
# set required libraries for link
......@@ -632,3 +648,11 @@ else()
PARSEC_daguepp_BIN_DIR
PARSEC_WORKS)
endif()
if ( PARSEC_daguepp_BIN_DIR )
find_program(PARSEC_DAGUEPP
NAMES daguepp
HINTS ${PARSEC_daguepp_BIN_DIR})
else()
set(PARSEC_DAGUEPP "PARSEC_DAGUEPP-NOTFOUND")
endif()
This diff is collapsed.
......@@ -3,8 +3,8 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# @copyright (c) 2012-2015 Inria. All rights reserved.
# @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
......@@ -25,6 +25,7 @@
# - BLAS: to activate the detection of StarPU linked with BLAS
# - MAGMA: to activate the detection of StarPU linked with MAGMA
# - FXT: to activate the detection of StarPU linked with FxT
# - SIMGRID: to activate the detection of StarPU linked with SimGrid
#
# Results are reported in variables:
# STARPU_FOUND - True if headers and requested libraries were found
......@@ -81,6 +82,7 @@ set(STARPU_LOOK_FOR_MPI FALSE)
set(STARPU_LOOK_FOR_BLAS FALSE)
set(STARPU_LOOK_FOR_MAGMA FALSE)
set(STARPU_LOOK_FOR_FXT FALSE)
set(STARPU_LOOK_FOR_SIMGRID FALSE)
if( STARPU_FIND_COMPONENTS )
foreach( component ${STARPU_FIND_COMPONENTS} )
......@@ -96,10 +98,30 @@ if( STARPU_FIND_COMPONENTS )
set(STARPU_LOOK_FOR_MAGMA TRUE)
elseif(${component} STREQUAL "FXT")
set(STARPU_LOOK_FOR_FXT TRUE)
elseif(${component} STREQUAL "SIMGRID")
set(STARPU_LOOK_FOR_SIMGRID TRUE)
endif()
endforeach()
endif()
# STARPU may depend on pthread, try to find it
find_package(Threads)
if( THREADS_FOUND )
list(APPEND STARPU_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
# STARPU may depend on libm, try to find it
find_library(M_m_LIBRARY NAMES m)
mark_as_advanced(M_m_LIBRARY)
if( M_m_LIBRARY )
list(APPEND STARPU_EXTRA_LIBRARIES ${M_m_LIBRARY})
endif ()
# STARPU may depend on librt, try to find it
find_library(RT_rt_LIBRARY NAMES m)
mark_as_advanced(RT_rt_LIBRARY)
if( RT_rt_LIBRARY )
list(APPEND STARPU_EXTRA_LIBRARIES ${RT_rt_LIBRARY})
endif ()
# STARPU may depend on HWLOC, try to find it
if (NOT HWLOC_FOUND AND STARPU_LOOK_FOR_HWLOC)
if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_HWLOC)
......@@ -165,6 +187,15 @@ if (NOT FXT_FOUND AND STARPU_LOOK_FOR_FXT)
endif()
endif()
# STARPU may depend on SIMGRID, try to find it
if (NOT SIMGRID_FOUND AND STARPU_LOOK_FOR_SIMGRID)
if (STARPU_FIND_REQUIRED AND STARPU_FIND_REQUIRED_SIMGRID)
find_package(SIMGRID REQUIRED)
else()
find_package(SIMGRID)
endif()
endif()
set(ENV_STARPU_DIR "$ENV{STARPU_DIR}")
set(ENV_STARPU_INCDIR "$ENV{STARPU_INCDIR}")
set(ENV_STARPU_LIBDIR "$ENV{STARPU_LIBDIR}")
......@@ -232,9 +263,17 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
endif()
if(STARPU_MPI_LIBRARIES)
if (STARPU_LOOK_FOR_SIMGRID)
# Cmake does not fetch explicit libfxt.a static paths from pkg-config...
find_package(FXT)
string(REGEX MATCH "[^;]*/libfxt.a" FXT_STATIC_LIB "${STARPU_MPI_LDFLAGS_OTHER}")
list(APPEND STARPU_MPI_LIBRARIES "${FXT_STATIC_LIB}")
endif()
set(STARPU_LIBRARIES "${STARPU_MPI_LIBRARIES}")
set(STARPU_LINKER_FLAGS "${STARPU_MPI_LDFLAGS_OTHER}")
elseif(STARPU_SHM_LIBRARIES)
set(STARPU_LIBRARIES "${STARPU_SHM_LIBRARIES}")
set(STARPU_LINKER_FLAGS "${STARPU_SHM_LDFLAGS_OTHER}")
else()
set(STARPU_LIBRARIES "STARPU_LIBRARIES-NOTFOUND")
endif()
......@@ -735,6 +774,23 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
endif()
endforeach()
endif()
# SIMGRID
if (SIMGRID_FOUND AND STARPU_LOOK_FOR_SIMGRID)
if (SIMGRID_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${SIMGRID_INCLUDE_DIRS}")
endif()
if (SIMGRID_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${SIMGRID_LIBRARY_DIRS}")
endif()
foreach(lib ${SIMGRID_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
list(APPEND REQUIRED_FLAGS "-include starpu_simgrid_wrap.h")
endif()
# BLAS
if (BLAS_FOUND AND STARPU_LOOK_FOR_BLAS)
if (BLAS_INCLUDE_DIRS)
......@@ -770,6 +826,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
endif()
endif()
# EXTRA LIBS such that pthread, m, rt
list(APPEND REQUIRED_LIBS ${STARPU_EXTRA_LIBRARIES})
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
......@@ -808,7 +866,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND)
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Maybe STARPU is linked with specific libraries. "
"Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT)? "
"Have you tried with COMPONENTS (HWLOC, CUDA, MPI, BLAS, MAGMA, FXT, SIMGRID)? "
"See the explanation in FindSTARPU.cmake.")
endif()
endif()
......@@ -843,7 +901,7 @@ endif()
include(FindPackageHandleStandardArgs)
if(NOT STARPU_FIND_QUIETLY)
if(STARPU_SHM_FOUND)
message(STATUS "StarPU has been found.")
message(STATUS "StarPU library has been found.")
if(STARPU_MPI_LIBRARIES)
message(STATUS "The mpi version of StarPU has been found so that we manage"
"two lists of libs, one sequential and one parallel (see"
......@@ -852,7 +910,7 @@ if(NOT STARPU_FIND_QUIETLY)
message(STATUS "StarPU shared memory libraries stored in STARPU_SHM_LIBRARIES")
endif()
endif()
if (PKG_CONFIG_EXECUTABLE AND STARPU_SHM_FOUND)
if (PKG_CONFIG_EXECUTABLE AND STARPU_SHM_FOUND AND NOT STARPU_GIVEN_BY_USER)
find_package_handle_standard_args(STARPU DEFAULT_MSG
STARPU_SHM_LIBRARIES)
else()
......@@ -864,7 +922,7 @@ if(STARPU_LOOK_FOR_MPI)
if(STARPU_MPI_LIBRARIES AND NOT STARPU_FIND_QUIETLY)
message(STATUS "StarPU mpi libraries stored in STARPU_MPI_LIBRARIES")
endif()
if (PKG_CONFIG_EXECUTABLE AND STARPU_MPI_FOUND)
if (PKG_CONFIG_EXECUTABLE AND STARPU_MPI_FOUND AND NOT STARPU_GIVEN_BY_USER)
find_package_handle_standard_args(STARPU DEFAULT_MSG
STARPU_MPI_LIBRARIES)
else()
......
......@@ -158,19 +158,19 @@ if (LAPACK_FOUND)
if(TMG_LIBDIR)
set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND")
find_library(TMG_tmg_LIBRARY
NAMES tmglib
NAMES tmglib tmg
HINTS ${TMG_LIBDIR} )
else()
if(TMG_DIR)
set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND")
find_library(TMG_tmg_LIBRARY
NAMES tmglib
NAMES tmglib tmg
HINTS ${TMG_DIR}
PATH_SUFFIXES lib lib32 lib64 )
else()
set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND")
find_library(TMG_tmg_LIBRARY
NAMES tmglib
NAMES tmglib tmg
HINTS ${_lib_env} )
endif()
endif()
......
......@@ -11,35 +11,40 @@ macro(jdf_rules jdf_rules_OUTPUTLIST jdf_rules_SOURCES)
foreach(jdf_rules_SOURCE ${jdf_rules_SOURCES})
# Remove .jdf if present
string(REGEX REPLACE ".jdf" "" jdf_rules_SRC ${jdf_rules_SOURCE})
string(REGEX REPLACE ".jdf" "" jdf_rules_SRC ${jdf_rules_SOURCE})
string(REGEX REPLACE "^(.*/)*(.+)\\.*.*" "\\2" jdf_rules_BSRC ${jdf_rules_SRC})
set(jdf_rules_OSRC "${jdf_rules_BSRC}")
GET_PROPERTY(ADDITIONAL_DAGUEPP_CFLAGS SOURCE ${jdf_rules_SOURCE} PROPERTY ADDITIONAL_DAGUEPP_CFLAGS)
get_source_file_property(jdf_rules_IsInBinaryDir ${jdf_rules_SOURCE} IS_IN_BINARY_DIR )
# If the file is generated in a different binary dir,
# If the file is generated in a different binary dir,
# we force the dependency on the generated file
# otherwise we let cmake choose the correct file, it is so good for that.
if( jdf_rules_IsInBinaryDir )
add_custom_command(
OUTPUT ${jdf_rules_OSRC}.h ${jdf_rules_OSRC}.c
COMMAND ${daguepp_EXE} ${DAGUEPP_CFLAGS} ${ADDITIONAL_DAGUEPP_CFLAGS} -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC}
COMMAND ${PARSEC_DAGUEPP} ${DAGUEPP_CFLAGS} ${ADDITIONAL_DAGUEPP_CFLAGS} -E -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC}
MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf ${daguepp_EXE})
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_SRC}.jdf ${PARSEC_DAGUEPP})
else( jdf_rules_IsInBinaryDir )
add_custom_command(
OUTPUT ${jdf_rules_OSRC}.h ${jdf_rules_OSRC}.c
COMMAND ${daguepp_EXE} ${DAGUEPP_CFLAGS} ${ADDITIONAL_DAGUEPP_CFLAGS} -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC}
COMMAND ${PARSEC_DAGUEPP} ${DAGUEPP_CFLAGS} ${ADDITIONAL_DAGUEPP_CFLAGS} -E -i ${jdf_rules_SRC}.jdf -o ${jdf_rules_OSRC} -f ${jdf_rules_BSRC}
MAIN_DEPENDENCY ${jdf_rules_SRC}.jdf
DEPENDS ${jdf_rules_SRC}.jdf ${daguepp_EXE})
DEPENDS ${jdf_rules_SRC}.jdf ${PARSEC_DAGUEPP})
endif( jdf_rules_IsInBinaryDir )
set_source_files_properties(${jdf_rules_OSRC}.c PROPERTIES COMPILE_FLAGS "-I${PARSEC_DIR_FOUND}/include/daguepp")
list(APPEND ${jdf_rules_OUTPUTLIST} "${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.h;${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.c")
get_source_file_property(jdf_rules_CompileFlags ${jdf_rules_SOURCE} COMPILE_FLAGS )
if( jdf_rules_CompileFlags )
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${jdf_rules_OSRC}.c PROPERTIES COMPILE_FLAGS ${jdf_rules_CompileFlags} )
endif()
endforeach()
#
......@@ -47,4 +52,3 @@ macro(jdf_rules jdf_rules_OUTPUTLIST jdf_rules_SOURCES)
#
set_source_files_properties(${jdf_rules_OUTPUTLIST} PROPERTIES GENERATED 1)
endmacro(jdf_rules)
......@@ -64,7 +64,6 @@ endif()
# Adding cpp files to project
add_library(
scalfmm
STATIC
${source_lib_files_enabled}
${SCALFMM_CUDA_SOURCES}
)
......@@ -81,12 +80,11 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${SCALFMM_INCLUDES}
)
# Install lib
install( TARGETS scalfmm ARCHIVE DESTINATION lib )
install( TARGETS scalfmm DESTINATION lib )
# Install header
SET(my_include_dirs "."
......
......@@ -668,9 +668,18 @@ struct RunContainer{
FBinding::BindThreadToAnyProcs();
std::cout << "And now I am bind to " << (FBinding::GetThreadBinding()) << std::endl;
#if defined(SCALFMM_USE_STARPU) || defined(OPENMP_SUPPORT_TASK_NAME)
// The taskname() clause is only supported by KSTAR. Make sure
// to set it from CMake to enable tracing.
starpu_fxt_start_profiling();
#endif
timer.tic();
groupalgo.execute();
std::cout << "Done " << "(@Algorithm = " << timer.tacAndElapsed() << "s)." << std::endl;
timer.tac();
#if defined(SCALFMM_USE_STARPU) || defined(OPENMP_SUPPORT_TASK_NAME)
starpu_fxt_stop_profiling();
#endif
std::cout << "Done " << "(@Algorithm = " << timer.elapsed() << "s)." << std::endl;
}
#ifdef MEMORY_USAGE
// Get the maximum resident set size (RSS) in kilobytes
......
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