diff --git a/CMakeLists.txt b/CMakeLists.txt index e84889ec5fefe49a54148d1b5a0b9e8a1ba3eb74..d07d16a89ca313cddd3d4558f065495b24970385 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -370,141 +370,98 @@ if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_c list(APPEND SCALFMM_CXX_FLAGS -Wcast-qual -Wconversion -Wcast-align -Woverloaded-virtual) endif() -# ################################################################## -# # STARPU Section -# ################################################################## -# # -# message( STATUS "SCALFMM_USE_STARPU = ${SCALFMM_USE_STARPU}" ) -# if( SCALFMM_USE_STARPU ) -# # CUDA could be used with StarPU enabled -# option( SCALFMM_USE_CUDA "Set to ON to use CUDA with StarPU" OFF ) -# if(SCALFMM_USE_CUDA) -# execute_process(COMMAND nvcc --version ERROR_VARIABLE cuda_error_output OUTPUT_QUIET) -# if(cuda_error_output) -# message( FATAL_ERROR "nvcc is needed with CUDA." ) -# endif() -# if(NOT DEFINED CUSTOM_CUDA_FLAGS) -# set( CUSTOM_CUDA_FLAGS "-std=c++11;-arch=sm_20;--ptxas-options=-v;-use_fast_math" CACHE -# STRING "Set your CUDA flags, for example : -arch=sm_20;--ptxas-options=-v;-use_fast_math") -# endif() -# # This is needed to remove backslash after space in ADD_CUSTOM_COMMAND -# separate_arguments(CUSTOM_CUDA_FLAGS) -# message( STATUS "CUSTOM_CUDA_FLAGS = ${CUSTOM_CUDA_FLAGS}" ) -# find_package(CUDA REQUIRED) -# -# if (CUDA_INCLUDE_DIRS) -# include_directories(${CUDA_INCLUDE_DIRS}) -# endif() -# if (CUDA_LIBRARIES) -# set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${CUDA_LIBRARIES}") -# endif() -# -# set(CUDA_NEEDED_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/Src) -# endif() -# -# # Find StarPU with a list of optional components -# set(SCALFMM_STARPU_VERSION "1.2" CACHE STRING " STARPU version desired") -# # create list of components in order to make a single call to find_package(starpu...) -# set(STARPU_COMPONENT_LIST "HWLOC") -# -# -# if(SCALFMM_USE_CUDA) -# list(APPEND STARPU_COMPONENT_LIST "CUDA") -# endif() -# list(APPEND FUSE_LIST "CUDA") -# -# if(SCALFMM_USE_MPI) -# list(APPEND STARPU_COMPONENT_LIST "MPI") -# endif() -# # TODO: replace this by a component of find starpu -# OPTION( SCALFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF ) -# -# if(SCALFMM_USE_OPENCL) -# list(APPEND STARPU_COMPONENT_LIST "OPENCL") -## include_directories($ENV{OPENCL_INC}) -## SET(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};-L$ENV{OPENCL_LIB};-lOpenCL") -# endif() -# list(APPEND FUSE_LIST "OPENCL") -# -# -# find_package(STARPU ${SCALFMM_STARPU_VERSION} REQUIRED -# COMPONENTS ${STARPU_COMPONENT_LIST}) -# -# if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS) -# # the RPATH to be used when installing -# list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}") -# endif() -# -# if(FXT_FOUND AND FXT_LIBRARY_DIRS) -# # the RPATH to be used when installing -# list(APPEND CMAKE_INSTALL_RPATH "${FXT_LIBRARY_DIRS}") -# endif() -# if(STARPU_FOUND AND STARPU_LIBRARY_DIRS) -# # the RPATH to be used when installing -# list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS}") -# # Append list of libraries and include dirs -# include_directories(${STARPU_INCLUDE_DIRS_DEP}) -# foreach (starpu_libdir ${STARPU_LIBRARY_DIRS_DEP}) -# if (${starpu_libdir} MATCHES "^ *-L") -# set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${starpu_libdir}") -# else() -# set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};-L${starpu_libdir}") -# endif() -# endforeach() -# foreach (starpu_lib ${STARPU_LIBRARIES_DEP}) -# if (EXISTS ${starpu_lib} OR ${starpu_lib} MATCHES "^ *-") -# set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${starpu_lib}") -# else() -# set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};-l${starpu_lib}") -# endif() -# endforeach() -# else() -# # StarPU not found -# -# endif() -# -# # TODO: is this very useful? CUDA is already a component of find starpu -# if (CUDA_LIBRARIES) -# set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${CUDA_LIBRARIES}") -# endif() -# -# # Message -# if (STARPU_INCLUDE_DIRS) -# message(STATUS " STARPU_INCLUDES = ${STARPU_INCLUDE_DIRS}") -# LIST(APPEND SCALFMM_INCLUDES "${STARPU_INCLUDE_DIRS}") -# endif() -# -# # Adding SimGrid includes -# LIST(APPEND SCALFMM_INCLUDES "$ENV{SIMGRID_INCLUDE}") -# message(STATUS " Adding SIMGRID = $ENV{SIMGRID_INCLUDE}") -# endif(SCALFMM_USE_STARPU) -# list(APPEND FUSE_LIST "STARPU") - -# # Additional options for developers -# if( SCALFMM_ONLY_DEVEL ) -# if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") -# option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" OFF ) -# else() -# option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" ON ) -# endif() -# option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF ) -# # SIMGRID and peformance models options -# option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF ) -# option( STARPU_SIMGRID_MLR_MODELS "Set to ON to enable MLR models need for calibration and simulation" OFF ) -# # OPENMP 4/5 support -# message(WARNING "OpenMP_VERSION: ${OpenMP_VERSION}") -# option( OPENMP_SUPPORT_PRIORITY "Set to ON to enable tasks priority (OMP4.x/KSTAR/StarPU compiler only)" OFF ) -# # STARPU options -# cmake_dependent_option(OPENMP_SUPPORT_COMMUTE "Set to ON to let tasks commute (KSTAR/StarPU compiler only)" OFF -# "SCALFMM_USE_STARPU" OFF) -# cmake_dependent_option(OPENMP_SUPPORT_TASK_NAME "Set to ON to enable a taskname clause for tasks (KSTAR/StarPU compiler only)" OFF -# "SCALFMM_USE_STARPU" OFF) -# cmake_dependent_option(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF) -# cmake_dependent_option(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF) -# cmake_dependent_option(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF) -# cmake_dependent_option(SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "SCALFMM_USE_STARPU" OFF) -# cmake_dependent_option(SCALFMM_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "SCALFMM_USE_STARPU" OFF) -# endif() + # + # STARPU Section + # -------------- + message( STATUS "SCALFMM_USE_STARPU = ${SCALFMM_USE_STARPU}" ) + CMAKE_DEPENDENT_OPTION( SCALFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF "SCALFMM_USE_STARPU" OFF) + CMAKE_DEPENDENT_OPTION( SCALFMM_USE_CUDA "Set to ON to use OPENCL with StarPU" OFF "SCALFMM_USE_STARPU" OFF) + if( SCALFMM_USE_STARPU ) + enable_language(C) + # CUDA could be used with StarPU enabled + option( SCALFMM_USE_CUDA "Set to ON to use CUDA with StarPU" OFF ) + #if(SCALFMM_USE_CUDA) + # execute_process(COMMAND nvcc --version ERROR_VARIABLE cuda_error_output OUTPUT_QUIET) + # if(cuda_error_output) + # message( FATAL_ERROR "nvcc is needed with CUDA." ) + # endif() + # if(NOT DEFINED CUSTOM_CUDA_FLAGS) + # set( CUSTOM_CUDA_FLAGS "-std=c++11;-arch=sm_20;--ptxas-options=-v;-use_fast_math" CACHE + # STRING "Set your CUDA flags, for example : -arch=sm_20;--ptxas-options=-v;-use_fast_math") + # endif() + # # This is needed to remove backslash after space in ADD_CUSTOM_COMMAND + # separate_arguments(CUSTOM_CUDA_FLAGS) + # message( STATUS "CUSTOM_CUDA_FLAGS = ${CUSTOM_CUDA_FLAGS}" ) + # find_package(CUDA REQUIRED) + + # if (CUDA_INCLUDE_DIRS) + # include_directories(${CUDA_INCLUDE_DIRS}) + # endif() + # if (CUDA_LIBRARIES) + # set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${CUDA_LIBRARIES}") + # endif() + + # set(CUDA_NEEDED_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/Src) + #endif() + + # Find StarPU with a list of optional components + set(SCALFMM_STARPU_VERSION "1.2.8" CACHE STRING " STARPU version desired") + # create list of components in order to make a single call to find_package(starpu...) + set(STARPU_COMPONENT_LIST "HWLOC") + if(SCALFMM_USE_CUDA) + list(APPEND STARPU_COMPONENT_LIST "CUDA") + endif() + list(APPEND FUSE_LIST "CUDA") + if(SCALFMM_USE_MPI) + list(APPEND STARPU_COMPONENT_LIST "MPI") + endif() + if(SCALFMM_USE_OPENCL) + list(APPEND STARPU_COMPONENT_LIST "OPENCL") + endif() + list(APPEND FUSE_LIST "OPENCL") + + find_package(STARPU ${SCALFMM_STARPU_VERSION} REQUIRED + COMPONENTS ${STARPU_COMPONENT_LIST}) + + if(STARPU_FOUND) + target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC starpu::starpu_dep) + list(APPEND FUSE_LIST "STARPU") + if(SCALFMM_USE_CUDA) + list(APPEND FUSE_LIST "CUDA") + endif() + if(SCALFMM_USE_OPENCL) + list(APPEND FUSE_LIST "OPENCL") + endif() + else(STARPU_FOUND) + message(FATAL_ERROR "StarPU not found.") + endif(STARPU_FOUND) + endif(SCALFMM_USE_STARPU) + + # Additional options for developers + if( SCALFMM_ONLY_DEVEL ) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" OFF ) + else() + option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" ON ) + endif() + option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF ) + # SIMGRID and peformance models options + option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF ) + option( STARPU_SIMGRID_MLR_MODELS "Set to ON to enable MLR models need for calibration and simulation" OFF ) + # OPENMP 4/5 support + message(WARNING "OpenMP_VERSION: ${OpenMP_VERSION}") + option( OPENMP_SUPPORT_PRIORITY "Set to ON to enable tasks priority (OMP4.x/KSTAR/StarPU compiler only)" OFF ) + # STARPU options + cmake_dependent_option(OPENMP_SUPPORT_COMMUTE "Set to ON to let tasks commute (KSTAR/StarPU compiler only)" OFF + "SCALFMM_USE_STARPU" OFF) + cmake_dependent_option(OPENMP_SUPPORT_TASK_NAME "Set to ON to enable a taskname clause for tasks (KSTAR/StarPU compiler only)" OFF + "SCALFMM_USE_STARPU" OFF) + cmake_dependent_option(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF) + cmake_dependent_option(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF) + cmake_dependent_option(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF) + cmake_dependent_option(SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "SCALFMM_USE_STARPU" OFF) + cmake_dependent_option(SCALFMM_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "SCALFMM_USE_STARPU" OFF) + endif() # # Set ScalFMM compile flags