Commit 0ca7afc1 authored by PRUVOST Florent's avatar PRUVOST Florent
parent 0dde3826
......@@ -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)
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