Donwloading kokkos and installing tbb is now automatic
This commit is contained in:
parent
2a8146c43f
commit
ed4fe6f2f5
|
@ -3,30 +3,17 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||||
# set the project name and version
|
# set the project name and version
|
||||||
project(phasicFlow VERSION 1.0 )
|
project(phasicFlow VERSION 1.0 )
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
|
set(CMAKE_CXX_STANDARD 20 CACHE STRING "" FORCE)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
set(CMAKE_INSTALL_PREFIX ${phasicFlow_SOURCE_DIR} CACHE PATH "Install path of phasicFlow" FORCE)
|
set(CMAKE_INSTALL_PREFIX ${phasicFlow_SOURCE_DIR} CACHE PATH "Install path of phasicFlow" FORCE)
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type" FORCE)
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "build type")
|
||||||
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build using shared libraries" FORCE)
|
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build using shared libraries" FORCE)
|
||||||
mark_as_advanced(FORCE var BUILD_SHARED_LIBS)
|
mark_as_advanced(FORCE var BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
message(STATUS ${CMAKE_INSTALL_PREFIX})
|
message(STATUS "Install prefix is:" ${CMAKE_INSTALL_PREFIX})
|
||||||
|
|
||||||
include(cmake/globals.cmake)
|
include(cmake/globals.cmake)
|
||||||
|
|
||||||
#Kokkos directory to be included
|
|
||||||
set(Kokkos_Source_DIR)
|
|
||||||
|
|
||||||
if(DEFINED ENV{Kokkos_DIR})
|
|
||||||
set(Kokkos_Source_DIR $ENV{Kokkos_DIR})
|
|
||||||
else()
|
|
||||||
set(Kokkos_Source_DIR $ENV{HOME}/Kokkos/kokkos)
|
|
||||||
endif()
|
|
||||||
message(STATUS "Kokkos source directory is ${Kokkos_Source_DIR}")
|
|
||||||
add_subdirectory(${Kokkos_Source_DIR} ./kokkos)
|
|
||||||
Kokkos_cmake_settings()
|
|
||||||
|
|
||||||
|
|
||||||
option(pFlow_STD_Parallel_Alg "Use TTB std parallel algorithms" ON)
|
option(pFlow_STD_Parallel_Alg "Use TTB std parallel algorithms" ON)
|
||||||
option(pFlow_Build_Serial "Build phasicFlow and backends for serial execution" OFF)
|
option(pFlow_Build_Serial "Build phasicFlow and backends for serial execution" OFF)
|
||||||
option(pFlow_Build_OpenMP "Build phasicFlow and backends for OpenMP execution" OFF)
|
option(pFlow_Build_OpenMP "Build phasicFlow and backends for OpenMP execution" OFF)
|
||||||
|
@ -34,6 +21,8 @@ option(pFlow_Build_Cuda "Build phasicFlow and backends for Cuda execution" OFF
|
||||||
option(pFlow_Build_Double "Build phasicFlow with double precision floating-oint variables" ON)
|
option(pFlow_Build_Double "Build phasicFlow with double precision floating-oint variables" ON)
|
||||||
option(pFlow_Build_MPI "Build for MPI parallelization. This will enable multi-gpu run, CPU run on clusters (distributed memory machine). Use this combination Cuda+MPI, OpenMP + MPI or Serial+MPI " OFF)
|
option(pFlow_Build_MPI "Build for MPI parallelization. This will enable multi-gpu run, CPU run on clusters (distributed memory machine). Use this combination Cuda+MPI, OpenMP + MPI or Serial+MPI " OFF)
|
||||||
|
|
||||||
|
#for installing the required packages
|
||||||
|
include(cmake/preReq.cmake)
|
||||||
|
|
||||||
if(pFlow_Build_Serial)
|
if(pFlow_Build_Serial)
|
||||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
|
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
|
||||||
|
@ -46,7 +35,8 @@ elseif(pFlow_Build_OpenMP )
|
||||||
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "OpenMP execution" FORCE)
|
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "OpenMP execution" FORCE)
|
||||||
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "Cuda execution" FORCE)
|
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "Cuda execution" FORCE)
|
||||||
set(Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Cuda execution" FORCE)
|
set(Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Cuda execution" FORCE)
|
||||||
set(Kokkos_DEFAULT_HOST_PARALLEL_EXECUTION_SPACE SERIAL CACHE STRING "" FORCE)
|
set(Kokkos_DEFAULT_HOST_PARALLEL_EXECUTION_SPACE Serial CACHE STRING "" FORCE)
|
||||||
|
set(Kokkos_DEFAULT_DEVICE_PARALLEL_EXECUTION_SPACE OpenMP CACHE STRING "" FORCE)
|
||||||
set(Kokkos_ENABLE_CUDA_CONSTEXPR OFF CACHE BOOL "Enable constexpr on cuda code" FORCE)
|
set(Kokkos_ENABLE_CUDA_CONSTEXPR OFF CACHE BOOL "Enable constexpr on cuda code" FORCE)
|
||||||
elseif(pFlow_Build_Cuda)
|
elseif(pFlow_Build_Cuda)
|
||||||
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
|
set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE)
|
||||||
|
@ -65,6 +55,7 @@ include(cmake/makeExecutableGlobals.cmake)
|
||||||
|
|
||||||
configure_file(phasicFlowConfig.H.in phasicFlowConfig.H)
|
configure_file(phasicFlowConfig.H.in phasicFlowConfig.H)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
#add a global include directory
|
#add a global include directory
|
||||||
include_directories(src/setHelpers src/demComponent "${PROJECT_BINARY_DIR}")
|
include_directories(src/setHelpers src/demComponent "${PROJECT_BINARY_DIR}")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
if(pFlow_STD_Parallel_Alg)
|
||||||
|
# Check if libtbb-dev is installed
|
||||||
|
execute_process(
|
||||||
|
COMMAND dpkg -s libtbb-dev
|
||||||
|
RESULT_VARIABLE TBB_IS_INSTALLED
|
||||||
|
OUTPUT_QUIET
|
||||||
|
ERROR_QUIET)
|
||||||
|
|
||||||
|
if(NOT TBB_IS_INSTALLED EQUAL 0)
|
||||||
|
message(STATUS "libtbb-dev not found. Installing libtbb-dev...")
|
||||||
|
execute_process(
|
||||||
|
COMMAND sudo apt-get update
|
||||||
|
COMMAND sudo apt-get install -y libtbb-dev
|
||||||
|
RESULT_VARIABLE TBB_INSTALL_RESULT)
|
||||||
|
|
||||||
|
if(NOT TBB_INSTALL_RESULT EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed to install libtbb-dev")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(STATUS "libtbb-dev is already installed.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0169 OLD)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
kokkos
|
||||||
|
GIT_REPOSITORY https://github.com/kokkos/kokkos.git
|
||||||
|
GIT_TAG 4.3.01
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(kokkos)
|
||||||
|
if(NOT kokkos_POPULATED)
|
||||||
|
message(STATUS "Kokkos source directory not found. Downloading Kokkos version 4.3.01 ...")
|
||||||
|
FetchContent_Populate(kokkos)
|
||||||
|
set(Kokkos_Source_DIR ${kokkos_SOURCE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Kokkos source directory is ${Kokkos_Source_DIR}")
|
||||||
|
add_subdirectory(${Kokkos_Source_DIR} ./kokkos)
|
||||||
|
#Kokkos_cmake_settings()
|
||||||
|
|
Loading…
Reference in New Issue