Skip to content
Snippets Groups Projects
Commit 8439016e authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Fixing new device test

parent 2f254618
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(openfpm_devices LANGUAGES CXX)
set(BOOST_INCLUDE ${Boost_INCLUDE_DIR} CACHE PATH "Include directory for BOOST")
find_package(Boost 1.52.0 REQUIRED unit_test_framework iostreams program_options)
if(ENABLE_GPU)
enable_language(CUDA)
find_package(CUDA)
endif()
###### CONFIG.h FILE ######
if(CUDA_FOUND)
set(DEFINE_CUDA_GPU "#define CUDA_GPU")
set(CUDA_SOURCES memory/CudaMemory.cu)
endif()
if (BOOST_FOUND)
set(DEFINE_HAVE_BOOST "#define HAVE_BOOST")
set(DEFINE_HAVE_BOOST_IOSTREAMS "#define HAVE_BOOST_IOSTREAMS")
set(DEFINE_HAVE_BOOST_PROGRAM_OPTIONS "#define HAVE_BOOST_PROGRAM_OPTIONS")
set(DEFINE_HAVE_BOOST_UNIT_TEST_FRAMEWORK "#define HAVE_BOOST_UNIT_TEST_FRAMEWORK")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config/config_cmake.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config/config.h)
add_subdirectory (src)
if(CUDA_FOUND)
set(CUDA_SOURCES memory/CudaMemory.cu)
else()
set(CUDA_SOURCES )
endif()
add_executable(mem main.cpp memory/HeapMemory.cpp ${CUDA_SOURCES} Memleak_check.cpp)
add_library(ofpmmemory STATIC memory/HeapMemory.cpp memory/PtrMemory.cpp Memleak_check.cpp ${CUDA_SOURCES})
add_library(ofpmmemory_se2 STATIC memory/HeapMemory.cpp memory/PtrMemory.cpp Memleak_check.cpp ${CUDA_SOURCES})
target_compile_definitions(ofpmmemory_se2 PUBLIC SE_CLASS2)
target_compile_options(mem PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe "--display_error_number --diag_suppress=2885 --diag_suppress=2887 --diag_suppress=2888 --diag_suppress=186 --diag_suppress=111" --expt-extended-lambda>)
target_include_directories (mem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (mem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (ofpmmemory PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (ofpmmemory PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_include_directories (ofpmmemory_se2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories (ofpmmemory_se2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config)
target_link_libraries(mem ${Boost_LIBRARIES})
install(TARGETS ofpmmemory ofpmmemory_se2
DESTINATION openfpm_devices/lib )
install(FILES memory/ExtPreAlloc.hpp
memory/BHeapMemory.hpp
memory/HeapMemory.hpp
memory/memory.hpp
memory/PtrMemory.hpp
memory/CudaMemory.cuh
DESTINATION openfpm_devices/include/memory)
install(FILES util/print_stack.hpp
DESTINATION openfpm_devices/include/util)
install(FILES Memleak_check.hpp
DESTINATION openfpm_devices/include/ )
install(FILES util/se_util.hpp
DESTINATION openfpm_devices/include/util)
install(FILES ptr_info.hpp
DESTINATION openfpm_devices/include)
# Request that particles be built with -std=c++11
# As this is a public compile feature anything that links to particles
# will also build with -std=c++11
target_compile_features(mem PUBLIC cxx_std_11)
#if(BUILD_TESTING)
# add_executable(particle_test test.cu)
# set_target_properties(particle_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# target_link_libraries(particle_test PRIVATE particles)
# add_test(NAME particles_10k COMMAND particle_test 10000 )
# add_test(NAME particles_256k COMMAND particle_test 256000 )
# if(APPLE)
# We need to add the default path to the driver (libcuda.dylib) as an rpath,
# so that the static cuda runtime can find it at runtime.
# set_property(TARGET particle_test PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
# endif()
#endif()
...@@ -104,6 +104,9 @@ ${DEFINE_HAVE_SYS_TYPES_H} ...@@ -104,6 +104,9 @@ ${DEFINE_HAVE_SYS_TYPES_H}
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
${DEFINE_HAVE_UNISTD_H} ${DEFINE_HAVE_UNISTD_H}
/* Test TinyObjLoader */
${DEFINE_HAVE_TINYOBJLOADER}
/* Define to the sub-directory where libtool stores uninstalled libraries. */ /* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/" #define LT_OBJDIR ".libs/"
......
...@@ -283,7 +283,9 @@ BOOST_AUTO_TEST_CASE( use_bheap_memory ) ...@@ -283,7 +283,9 @@ BOOST_AUTO_TEST_CASE( use_bheap_memory )
BOOST_AUTO_TEST_CASE( use_bcuda_memory ) BOOST_AUTO_TEST_CASE( use_bcuda_memory )
{ {
#ifdef CUDA_GPU
Btest<BMemory<CudaMemory>>(); Btest<BMemory<CudaMemory>>();
#endif
} }
BOOST_AUTO_TEST_CASE( swap_heap_memory ) BOOST_AUTO_TEST_CASE( swap_heap_memory )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment