Commit a2ffa29f authored by Raphael Defosseux's avatar Raphael Defosseux

Making CUDA additions conditional on CUDA installation

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 79899c8a
...@@ -45,20 +45,26 @@ project (OpenAirInterface) ...@@ -45,20 +45,26 @@ project (OpenAirInterface)
# Base CUDA setting # Base CUDA setting
############################################## ##############################################
find_package(CUDA) find_package(CUDA)
message ("cuda include ${CUDA_INCLUDE_DIRS}") if (CUDA_FOUND)
message ("cuda library ${CUDA_LIBRARY_DIRS}") message ("cuda include ${CUDA_INCLUDE_DIRS}")
message ("cuda library ${CUDA_LIBRARY_DIRS}")
add_definitions("-L/usr/local/cuda/lib64") add_definitions("-L/usr/local/cuda/lib64")
SET(CUDA_NVCC_FLAGS SET(CUDA_NVCC_FLAGS
"${CUDA_NVCC_FLAGS};-arch=sm_60;") "${CUDA_NVCC_FLAGS};-arch=sm_60;")
# Disable warnings for CUDA # Disable warnings for CUDA
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lpthread;-w;-O3;--default-stream;per-thread;-I/usr/local/cuda/inc;-L/usr/local/cuda/lib -lcutil;-rdc=true;-lcudadevrt") SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-lpthread;-w;-O3;--default-stream;per-thread;-I/usr/local/cuda/inc;-L/usr/local/cuda/lib -lcutil;-rdc=true;-lcudadevrt")
SET(CUDA_VERBOSE_BUILD ON) SET(CUDA_VERBOSE_BUILD ON)
SET(CUDA_HOST_COMPILER "/usr/bin/g++") SET(CUDA_HOST_COMPILER "/usr/bin/g++")
SET(CUDA_SEPARABLE_COMPILATION ON)
else (CUDA_FOUND)
message ("No CUDA tool installed")
endif ()
SET(CUDA_SEPARABLE_COMPILATION ON)
########################################### ###########################################
# macros to define options as there is numerous options in oai # macros to define options as there is numerous options in oai
...@@ -190,13 +196,22 @@ endif() ...@@ -190,13 +196,22 @@ endif()
set(CMAKE_C_FLAGS set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -pipe -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC") "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -pipe -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC")
# add autotools definitions that were maybe used! # add autotools definitions that were maybe used!
# set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'") if (CUDA_FOUND)
set(CMAKE_C_FLAGS set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP " "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP "
) )
set(CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 " "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 "
) )
else (CUDA_FOUND)
set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER}"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}"
)
endif ()
add_definitions("-DASN_DISABLE_OER_SUPPORT") add_definitions("-DASN_DISABLE_OER_SUPPORT")
...@@ -2821,26 +2836,36 @@ target_link_libraries(smallblocktest ...@@ -2821,26 +2836,36 @@ target_link_libraries(smallblocktest
m pthread ${ATLAS_LIBRARIES} dl m pthread ${ATLAS_LIBRARIES} dl
) )
if (CUDA_FOUND)
################################################### ###################################################
# For CUDA library # For CUDA library
################################################### ###################################################
CUDA_ADD_LIBRARY(LDPC_CU CUDA_ADD_LIBRARY(LDPC_CU
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.cu
) )
CUDA_ADD_CUFFT_TO_TARGET(LDPC_CU) CUDA_ADD_CUFFT_TO_TARGET(LDPC_CU)
cuda_add_executable(ldpctest cuda_add_executable(ldpctest
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
${T_SOURCE} ${T_SOURCE}
${SHLIB_LOADER_SOURCES} ${SHLIB_LOADER_SOURCES}
) )
target_link_libraries(ldpctest -ldl
target_link_libraries(ldpctest -ldl
-Wl,--start-group -Wl,--start-group
LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB LDPC_CU UTIL SIMU PHY_NR CONFIG_LIB
-Wl,--end-group -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} dl m pthread ${ATLAS_LIBRARIES} dl
) )
else (CUDA_FOUND)
add_executable(ldpctest
${PHY_NR_CODINGIF}
${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
endif ()
# add_executable(ldpctest # add_executable(ldpctest
# ${PHY_NR_CODINGIF} # ${PHY_NR_CODINGIF}
# ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c # ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/ldpctest.c
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment