Commit 007f4469 authored by MIJIEUX Thomas's avatar MIJIEUX Thomas

pkg-config generation for library use

parent 5a452179
......@@ -4,6 +4,9 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(fabulous C CXX Fortran)
set(FABULOUS_VERSION_MAJOR 0)
set(FABULOUS_VERSION_MINOR 4)
set(FABULOUS_VERSION_MICRO 1)
##### RPATH HANDLING ####
STRING(REPLACE ":" ";" _ld_lib_path_env "$ENV{LD_LIBRARY_PATH}")
......@@ -23,6 +26,7 @@ SET(MORSE_CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modul
LIST(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/")
INCLUDE(MorseInit)
INCLUDE(GenPkgConfig)
FIND_PACKAGE(CBLAS REQUIRED COMPONENTS BLASEXT)
FIND_PACKAGE(LAPACKE REQUIRED COMPONENTS LAPACKEXT)
......@@ -35,9 +39,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -fmax-errors=2"
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -fmax-errors=2")
IF(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF()
INCLUDE_DIRECTORIES(
......@@ -49,8 +52,10 @@ ADD_DEFINITIONS(
-DLAPACK_COMPLEX_CPP
)
OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF)
OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON)
OPTION(FABULOUS_BUILD_DOC "Set to ON to build the Doxygen documentation " OFF)
OPTION(FABULOUS_BUILD_EXAMPLES "Set to OFF to disable examples builds" ON)
IF(CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE MATCHES "Debug" )
OPTION(FABULOUS_LAPACKE_NANCHECK "Set to ON to use top level LAPACKE interface " ON)
OPTION(FABULOUS_DEBUG_MODE "Set to On to compile with debug info" ON)
......@@ -72,6 +77,12 @@ INCLUDE_DIRECTORIES(src/api/include)
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
GENERATE_PKGCONFIG_FILE()
INSTALL(
FILES fabulous-config.cmake
DESTINATION lib/cmake/fabulous/
)
IF(FABULOUS_BUILD_DOC)
ADD_SUBDIRECTORY(doc)
ENDIF()
......@@ -72,7 +72,7 @@ echo ${HOME}/fabulous/
You can perform these actions either manually, by evaluating the code blocks
directly inside emacs if your org-mode support it, or by tangling this org
document to produce [[./install-fabulous.sh][install-fabulous.sh]] and execute it:
document to produce file:./install-fabulous.sh execute it:
#+begin_src emacs-lisp :results silent
(org-babel-tangle)
......@@ -96,7 +96,7 @@ source /opt/intel/mkl/bin/mklvars.sh intel64
You may also want to reset the build system
(in order to flush cmake cache for instance)
#+BEGIN_SRC shell
rm -rf ${WORKDIR}/build/*
rm -rf ${WORKDIR}/build/*
#+END_SRC
Setup the build system:
......@@ -122,7 +122,7 @@ make -j4
You may want to reset the build system (in order to flush cmake cache)
#+BEGIN_SRC shell
rm -rf ${WORKDIR}/build/*
rm -rf ${WORKDIR}/build/*
#+END_SRC
Setup the build system with cc_args as a compiler:
......@@ -138,10 +138,10 @@ CC="${WORKDIR}/scripts/cc_args.py gcc" CXX="${WORKDIR}/scripts/cc_args.py g++" \
Carry out the compilation
#+BEGIN_SRC shell
make -j4
make -j4
#+END_SRC
cc_args have generated .clang_complete files.
cc_args have generated many .clang_complete files.
We gather them into one file. Notice that the line with -std=c99 is removed
because fabulous source have both c++11 and c99 files but passing both option to clang
would be an error so we prefer c++11 which is the dominant language of the the project.
......@@ -149,3 +149,6 @@ CC="${WORKDIR}/scripts/cc_args.py gcc" CXX="${WORKDIR}/scripts/cc_args.py g++" \
find ${WORKDIR}/build -name '.clang_complete' | xargs cat | sort | uniq \
| grep -v c99 > ${WORKDIR}/.clang_complete
#+END_SRC
Eventually you can check the content of the file:
file:~/fabulous/.clang_complete
......@@ -292,9 +292,9 @@ ggplot(df, aes(x=nb_mvp)) +
cd ${WORKDIR}/build/src/test_basic/
mkdir -p ../data/res
#nbRHS=6; maxSpace=90
./testMatrixMarketChoice -n 100 -t BLOCK -s MGS -m 700 -e 1e-4 -A IBDR \
./testMatrixMarketChoice -n 100 -t BLOCK -s CGS -m 700 -e 1e-4 -A IBDR \
-r DEFLATED -p 5 -u -o "IB-BGMRES-DR"
./testMatrixMarketChoice -n 100 -t BLOCK -s MGS -m 700 -e 1e-4 -A QRIBDR \
./testMatrixMarketChoice -n 100 -t BLOCK -s CGS -m 700 -e 1e-4 -A QRIBDR \
-r DEFLATED -p 5 -u -o "QR-IB-BGMRES-DR"
#+END_SRC
**** plot
......@@ -309,6 +309,17 @@ ggplot(df, aes(x=nb_mvp)) +
ggtitle("young1c (nrhs=100, m=500 k=5, max_mvp=10000)") +
ylab("time (s)")
#+END_SRC
#+BEGIN_SRC R
library(ggplot2)
df <- read.csv("./build/src/data/res/IB-BGMRES-DR.res")
df <- rbind(df, read.csv("./build/src/data/res/QR-IB-BGMRES-DR.res"))
ggplot(df, aes(x=nb_mvp)) +
geom_line(aes(y=ortho_flops/(ortho_time*1000000000.0), color="f/s")) +
ggtitle("young1c (nrhs=100, m=500 k=5, max_mvp=10000)") +
ylab("time (s)")
#+END_SRC
*** with chameleon
**** run test
#+BEGIN_SRC shell
......@@ -365,6 +376,6 @@ ggplot(df, aes(x=nb_mvp)) +
#+END_SRC
** Cleanup results directory
#+BEGIN_SRC shell
mkdir -p ${WORKDIR}/build/src/data/res
rm ${WORKDIR}/build/src/data/res/* -rf
mkdir -p ${WORKDIR}/build/src/data/res
rm ${WORKDIR}/build/src/data/res/* -rf
#+END_SRC
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file GenPkgConfig.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 0.9.1
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @date 10-11-2014
#
###
###
#
# CONVERT_LIBSTYLE_TO_PKGCONFIG: convert a libraries list to follow the pkg-config style
# used in CLEAN_LIB_LIST
#
###
MACRO(CONVERT_LIBSTYLE_TO_PKGCONFIG _liblist)
set(${_liblist}_CPY "${${_liblist}}")
set(${_liblist} "")
foreach(_dep ${${_liblist}_CPY})
if (${_dep} MATCHES "^/")
get_filename_component(dep_libname ${_dep} NAME)
get_filename_component(dep_libdir ${_dep} DIRECTORY)
STRING(REPLACE "lib" "" dep_libname "${dep_libname}")
STRING(REPLACE ".so" "" dep_libname "${dep_libname}")
STRING(REPLACE ".a" "" dep_libname "${dep_libname}")
STRING(REPLACE ".dylib" "" dep_libname "${dep_libname}")
STRING(REPLACE ".dll" "" dep_libname "${dep_libname}")
list(APPEND ${_liblist} -L${dep_libdir} -l${dep_libname})
elseif(NOT ${_dep} MATCHES "^-")
list(APPEND ${_liblist} "-l${_dep}")
else()
list(APPEND ${_liblist} ${_dep})
endif()
endforeach()
ENDMACRO(CONVERT_LIBSTYLE_TO_PKGCONFIG)
###
#
# CLEAN_LIB_LIST: clean libraries lists to follow the pkg-config style
# used in GENERATE_PKGCONFIG_FILE
#
###
MACRO(CLEAN_LIB_LIST _package)
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS)
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_LIBS_PRIVATE)
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED)
list(REMOVE_DUPLICATES ${_package}_PKGCONFIG_REQUIRED_PRIVATE)
CONVERT_LIBSTYLE_TO_PKGCONFIG(${_package}_PKGCONFIG_LIBS)
CONVERT_LIBSTYLE_TO_PKGCONFIG(${_package}_PKGCONFIG_LIBS_PRIVATE)
STRING(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS "${${_package}_PKGCONFIG_LIBS}")
STRING(REPLACE ";" " " ${_package}_PKGCONFIG_LIBS_PRIVATE "${${_package}_PKGCONFIG_LIBS_PRIVATE}")
STRING(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED "${${_package}_PKGCONFIG_REQUIRED}")
STRING(REPLACE ";" " " ${_package}_PKGCONFIG_REQUIRED_PRIVATE "${${_package}_PKGCONFIG_REQUIRED_PRIVATE}")
ENDMACRO(CLEAN_LIB_LIST)
###
#
# GENERATE_PKGCONFIG_FILE: generate file fabulous.pc
#
###
MACRO(GENERATE_PKGCONFIG_FILE)
set(FABULOUS_PKGCONFIG_LIBS "-lfabulous")
set(FABULOUS_PKGCONFIG_REQUIRED "") # <-- DO NOT USE THIS ONE
set(FABULOUS_PKGCONFIG_LIBS_PRIVATE "") # <-- fabulous dependencies (not handled by pkgconfig)
set(FABULOUS_PKGCONFIG_REQUIRED_PRIVATE "") # <-- fabulous dependencies (handled by pkgconfig)
list(APPEND FABULOUS_PKGCONFIG_LIBS_PRIVATE
${LAPACKE_LIBRARIES}
${CBLAS_LIBRARIES}
)
if(CHAMELEON_FOUND)
# we use required field because chameleon have pkgconfig (.pc) files
list(APPEND FABULOUS_PKGCONFIG_REQUIRED_PRIVATE chameleon)
endif()
CLEAN_LIB_LIST(FABULOUS)
SET(_output_fabulous_file "${CMAKE_BINARY_DIR}/fabulous.pc")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/lib/pkgconfig/fabulous.pc.in" "${_output_fabulous_file}" @ONLY)
INSTALL(FILES ${_output_fabulous_file} DESTINATION lib/pkgconfig)
ENDMACRO(GENERATE_PKGCONFIG_FILE)
##
## @end file GenPkgConfig.cmake
##
# It is possible to rename this script to FindFABULOUS.cmake and
# include it directly into your project in a directory referenced by
# the CMAKE_MODULE_PATH variable if you think this is more convenient
# - Try to find fabulous
#
# If this script have difficulties to find fabulous, you can try to help
# it by setting the variable FABULOUS_DIR to the prefix path where fabulous
# was installed
#
# Once done this will define
# FABULOUS_FOUND - System has fabulous
# FABULOUS_INCLUDE_DIRS - The fabulous include directories
# FABULOUS_LIBRARIES - The libraries needed to use fabulous
# FABULOUS_DEFINITIONS - Compiler switches required for using fabulous
find_package(PkgConfig)
pkg_check_modules(PC_FABULOUS QUIET fabulous)
set(FABULOUS_DEFINITIONS ${PC_FABULOUS_CFLAGS_OTHER})
find_path(FABULOUS_INCLUDE_DIR NAMES fabulous.h fabulous.hpp
HINTS "${FABULOUS_DIR}/include" ${PC_FABULOUS_INCLUDEDIR} ${PC_FABULOUS_INCLUDE_DIRS} )
find_library(FABULOUS_LIBRARY NAMES fabulous libfabulous
HINTS "${FABULOUS_DIR}/lib" ${PC_FABULOUS_LIBDIR} ${PC_FABULOUS_LIBRARY_DIRS} )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set FABULOUS_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(fabulous DEFAULT_MSG
FABULOUS_LIBRARY FABULOUS_INCLUDE_DIR)
mark_as_advanced(FABULOUS_INCLUDE_DIR FABULOUS_LIBRARY)
set(FABULOUS_LIBRARIES ${FABULOUS_LIBRARY} )
set(FABULOUS_INCLUDE_DIRS ${FABULOUS_INCLUDE_DIR} )
......@@ -3,3 +3,8 @@ INSTALL(
DIRECTORY fabulous
DESTINATION include
)
INSTALL(
FILES fabulous.hpp
DESTINATION include
)
......@@ -20,7 +20,7 @@ namespace fabulous {
/**
* \brief %Block General Minimum Residual (%BGMRes) algorithm
*/
template< class S >
template<class S>
class BGMRes
{
public:
......@@ -67,7 +67,7 @@ private:
o <<"######################################################\n";
}
template< class Matrix, class RestartParam, class Algo >
template<class Matrix, class RestartParam, class Algo>
void print_start_info(
int dim, int nbRHS, int maxMVP, int max_krylov_space_size,
const OrthoParam &ortho, const RestartParam &restart_param,
......
......@@ -28,7 +28,7 @@ public:
* \param max_mvp maximum number of matrix vector product
* \param max_space maximum size of krylov search space
*/
Parameters parameters(int max_mvp, int max_space)
inline Parameters parameters(int max_mvp, int max_space)
{
return Parameters{max_mvp, max_space};
}
......
......@@ -28,7 +28,9 @@ namespace fabulous {
/**
* \brief Template class in order to have static color variables in headers
*/
template<class> struct ColorT {
template<class>
struct ColorT
{
FABULOUS_COLOR_LIST(FABULOUS_COLOR_TO_STRING);
FABULOUS_COLOR_LIST(FABULOUS_COLOR_TO_PTR_DECLARE);
};
......@@ -41,7 +43,9 @@ FABULOUS_COLOR_LIST(FABULOUS_COLOR_TO_PTR_DEFINE);
/**
* \brief Helper class to print colored ouput
*/
struct Color : public ColorT<void> {};
struct Color : public ColorT<void>
{
};
/* ******************* TOGGLE COLOR OUTPUT ********************* */
......
......@@ -40,7 +40,6 @@ public:
double mvp_time; /*!< time for this iteration in mvp */
double ortho_time; /*!< time for this iteration in orthogonalization */
double ib_time; /*!< time for this iteration in R-criterion and IB update */
int64_t ortho_flops; /*!< number of flops of orthogonalization */
static void print_header(std::ostream &o = std::cout)
......@@ -48,7 +47,7 @@ public:
o <<"global_iteration,local_iteration,krylov_space_size,nb_mvp,"
"current_block_size,minRes,maxRes,minRealRes,maxRealRes,time,"
"least_square_time,facto_time,mvp_time,ortho_time,ib_time,"
" ortho_flops,name\n";
"ortho_flops,name\n";
}
void print(std::string name, std::ostream &o = std::cout)
......@@ -93,6 +92,7 @@ private:
Timer _mvp_timer;
Timer _ortho_timer;
Timer _ib_timer;
int64_t _last_ortho_flops;
bool _log_real_residual; /*!< always compute real residual (debug purpose) */
......@@ -246,7 +246,7 @@ public:
_total_mvp, mvp_diff, min, max, 0, 0,
elapsed, least_square_elapsed, facto_elapsed,
mvp_elapsed, ortho_elapsed, ib_elapsed,
_last_ortho_flops }
_last_ortho_flops }
);
FABULOUS_NOTE(
"\t\t "<<Color::red<<"MIN="<<Color::reset<<std::scientific<<min
......
prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include
Name: fabulous
Description: Fast Accurate Block Linear krylOv Solver
Version: @FABULOUS_VERSION_MAJOR@.@FABULOUS_VERSION_MINOR@.@FABULOUS_VERSION_MICRO@
Cflags: -I${includedir}
Libs: -L${libdir} @FABULOUS_PKGCONFIG_LIBS@
Libs.private: @FABULOUS_PKGCONFIG_LIBS_PRIVATE@
Requires: @FABULOUS_PKGCONFIG_REQUIRED@
Requires.private: @FABULOUS_PKGCONFIG_REQUIRED_PRIVATE@
......@@ -3,7 +3,6 @@ IF(LAPACK_PAR_LIBRARIES AND BLAS_PAR_LIBRARIES)
SET(FABULOUS_BASIC_LIBRARIES
# ${LAPACKE_PAR_LIBRARIES}
# ${CBLAS_PAR_LIBRARIES}
${LAPACK_PAR_LIBRARIES}
${BLAS_PAR_LIBRARIES}
)
......@@ -19,30 +18,33 @@ IF(BLA_VENDOR MATCHES "Intel*")
ENDIF(BLA_VENDOR MATCHES "Intel*")
ADD_SUBDIRECTORY(api)
ADD_SUBDIRECTORY(test_basic)
ADD_SUBDIRECTORY(test_api)
ADD_SUBDIRECTORY(examples)
# You can use CHAMELEON_DIR to specify the prefix where chameleon was installed.
# You can use STARPU_DIR to specify the prefix where starpu was installed.
FIND_PACKAGE(CHAMELEON COMPONENTS STARPU MPI)
IF(CHAMELEON_FOUND)
IF(FABULOUS_BUILD_EXAMPLES)
ADD_SUBDIRECTORY(test_basic)
ADD_SUBDIRECTORY(test_api)
ADD_SUBDIRECTORY(examples)
SET(FABULOUS_CHAM_LIBRARIES
${LAPACKE_LIBRARIES}
${CBLAS_LIBRARIES}
${CHAMELEON_LIBRARIES_DEP}
)
ADD_DEFINITIONS(
-DMORSE_COMPLEX_CPP
-DFABULOUS_USE_CHAMELEON
)
INCLUDE_DIRECTORIES(
${CHAMELEON_INCLUDE_DIRS_DEP}
)
# You can use CHAMELEON_DIR to specify the prefix where chameleon was installed.
# You can use STARPU_DIR to specify the prefix where starpu was installed.
FIND_PACKAGE(CHAMELEON COMPONENTS STARPU MPI)
IF(CHAMELEON_FOUND)
SET(FABULOUS_CHAM_LIBRARIES
${LAPACKE_LIBRARIES}
${CBLAS_LIBRARIES}
${CHAMELEON_LIBRARIES_DEP}
)
ADD_DEFINITIONS(
-DMORSE_COMPLEX_CPP
-DFABULOUS_USE_CHAMELEON
)
INCLUDE_DIRECTORIES(
${CHAMELEON_INCLUDE_DIRS_DEP}
)
MESSAGE(STATUS "CHAMELEON found")
ADD_SUBDIRECTORY(test_cham)
ELSE(CHAMELEON_FOUND)
MESSAGE(STATUS "CHAMELEON not found; extensions using chameleon will not be built")
ENDIF(CHAMELEON_FOUND)
MESSAGE(STATUS "CHAMELEON found")
ADD_SUBDIRECTORY(test_cham)
ELSE(CHAMELEON_FOUND)
MESSAGE(STATUS "CHAMELEON not found; extensions using chameleon will not be built")
ENDIF(CHAMELEON_FOUND)
ENDIF(FABULOUS_BUILD_EXAMPLES)
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