Search for VexCL and create an imported target.

Unfortunately, we cannot us the imported targets. They add some compile
parameters using generator expressions based on the CXX_COMPILER_ID.
While we are using the system CXX compiler for most of the stuff, some
cuda code is compiled with nvcc which at least for some versions does
not support -Wno-catch-value (which gets passed as normal compiler
option).
This commit is contained in:
Markus Blatt
2021-06-30 16:03:14 +02:00
committed by Tong Dong Qiu
parent d45f9d08f7
commit adc2bf46b9
3 changed files with 26 additions and 0 deletions

View File

@@ -226,6 +226,25 @@ if(amgcl_FOUND)
endif() endif()
endif() endif()
if(OpenCL_FOUND)
find_package(VexCL)
if(VexCL_FOUND)
set(HAVE_VEXCL 1)
# generator expressions in vexcl do not seem to work and therefore
# we cannot use the imported target. Hence we exract the needed info
# from the targets
get_property(VEXCL_INCLUDE_DIRS TARGET VexCL::Common PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(VEXCL_LINK_LIBRARIES TARGET VexCL::Common PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(VEXCL_COMPILE_DEFINITIONS TARGET VexCL::OpenCL PROPERTY INTERFACE_COMPILE_DEFINITIONS)
set(VEXCL_LINK_LIBRARIES "${VEXCL_LINK_LIBRARIES};OpenCL::OpenCL")
add_library(OPM::VexCL::OpenCL INTERFACE IMPORTED)
set_target_properties(OPM::VexCL::OpenCL PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "${VEXCL_COMPILE_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${VEXCL_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${VEXCL_LINK_LIBRARIES}")
endif()
endif()
# read the list of components from this file (in the project directory); # read the list of components from this file (in the project directory);
# it should set various lists with the names of the files to include # it should set various lists with the names of the files to include
include (CMakeLists_files.cmake) include (CMakeLists_files.cmake)
@@ -541,6 +560,9 @@ if(OpenCL_FOUND)
target_link_libraries( opmsimulators PUBLIC ${OpenCL_LIBRARIES} ) target_link_libraries( opmsimulators PUBLIC ${OpenCL_LIBRARIES} )
endif() endif()
if(VexCL_FOUND)
target_link_libraries( opmsimulators PUBLIC OPM::VexCL::OpenCL )
endif()
if(HAVE_FPGA) if(HAVE_FPGA)
add_dependencies(opmsimulators FPGA_library) add_dependencies(opmsimulators FPGA_library)
ExternalProject_Get_Property(FPGA_library binary_dir) ExternalProject_Get_Property(FPGA_library binary_dir)

View File

@@ -9,6 +9,7 @@ set (opm-simulators_CONFIG_VAR
HAVE_OPENCL HAVE_OPENCL
HAVE_FPGA HAVE_FPGA
HAVE_AMGCL HAVE_AMGCL
HAVE_VEXCL
HAVE_SUITESPARSE_UMFPACK_H HAVE_SUITESPARSE_UMFPACK_H
HAVE_DUNE_ISTL HAVE_DUNE_ISTL
DUNE_ISTL_VERSION_MAJOR DUNE_ISTL_VERSION_MAJOR

View File

@@ -43,6 +43,9 @@
#include <amgcl/relaxation/cusparse_ilu0.hpp> #include <amgcl/relaxation/cusparse_ilu0.hpp>
#endif #endif
#if HAVE_VEXCL
#include <amgcl/backend/vexcl.hpp>
#endif
namespace bda namespace bda
{ {