GPU: bring back CUDPP_OPT

This commit is contained in:
Christoph Junghans 2017-07-20 14:30:52 -06:00
parent f037f89f5f
commit 1749d643c7
1 changed files with 10 additions and 4 deletions

View File

@ -445,6 +445,7 @@ if(ENABLE_GPU)
set_property(CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE)
add_definitions(-D_${GPU_PREC})
add_definitions(-DNV_KERNEL -DUCL_CUDADR)
option(CUDPP_OPT "Enable CUDPP_OPT" ON)
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h)
@ -460,9 +461,14 @@ if(ENABLE_GPU)
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu)
file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU})
include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu
${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini ${LAMMPS_LIB_BINARY_DIR}/gpu)
cuda_compile(GPU_OBJS ${GPU_LIB_CU} OPTIONS $<$<BOOL:${BUILD_SHARED_LIBS}>:-Xcompiler=-fPIC>)
include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)
if(CUDPP_OPT)
include_directories(${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini)
add_definitions(-DCUDPP_OPT)
file(GLOB GPU_LIB_CUDPP_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/*.cpp)
file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/*.cu)
endif()
cuda_compile(GPU_OBJS ${GPU_LIB_CU} ${GPU_LIB_CUDPP_CU} OPTIONS $<$<BOOL:${BUILD_SHARED_LIBS}>:-Xcompiler=-fPIC>)
file(MAKE_DIRECTORY ${LAMMPS_LIB_BINARY_DIR}/gpu)
foreach(CU_OBJ ${GPU_OBJS})
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
@ -477,7 +483,7 @@ if(ENABLE_GPU)
endif()
endforeach()
list(REMOVE_ITEM GPU_OBJS "${CU_FORBIDDEN_OBJ}")
list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_OBJS})
list(APPEND LIB_SOURCES ${GPU_SOURCES} ${GPU_LIB_SOURCES} ${GPU_LIB_CUDPP_SOURCES} ${GPU_OBJS})
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h")
endif()