提交 07f30241 编写于 作者: H hedaoyuan

fixed some nvcc compilation related

上级 e63f1e69
......@@ -98,6 +98,8 @@ else()
add_definitions(-DPADDLE_USE_DSO)
endif(WITH_DSO)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-g -O3 --use_fast_math")
# Include cuda and cudnn
include_directories(${CUDNN_INCLUDE_DIR})
include_directories(${CUDA_TOOLKIT_INCLUDE})
......@@ -117,6 +119,9 @@ endif(NOT WITH_TIMER)
if(WITH_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${AVX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AVX_FLAGS}")
if(AVX_FOUND)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler -mavx")
endif(AVX_FOUND)
else(WITH_AVX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3")
......
......@@ -178,13 +178,6 @@ macro(add_simple_unittest TARGET_NAME)
add_unittest(${TARGET_NAME} ${TARGET_NAME}.cpp)
endmacro()
macro(add_paddle_culib TARGET_NAME)
set(NVCC_FLAG ${CUDA_NVCC_FLAGS})
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--use_fast_math)
cuda_add_library(${TARGET_NAME} STATIC ${ARGN})
set(CUDA_NVCC_FLAGS ${NVCC_FLAG})
endmacro()
# Creates C resources file from files in given resource file
function(create_resources res_file output)
......
......@@ -50,7 +50,7 @@ if(NOT WITH_PYTHON)
endif()
if(WITH_GPU)
add_paddle_culib(paddle_gserver ${GSERVER_SOURCES})
cuda_add_library(paddle_gserver ${GSERVER_SOURCES})
else()
add_library(paddle_gserver STATIC
${GSERVER_SOURCES})
......
......@@ -25,7 +25,7 @@ if(NOT WITH_GPU)
add_library(paddle_math STATIC
${MATH_SOURCES})
else()
add_paddle_culib(paddle_math ${MATH_SOURCES})
cuda_add_library(paddle_math ${MATH_SOURCES})
endif()
......
......@@ -15,7 +15,7 @@ add_simple_unittest(test_perturbation)
add_simple_unittest(test_CpuGpuVector)
add_simple_unittest(test_Allocator)
if(COMPILER_SUPPORT_CXX11)
LIST(APPEND CUDA_NVCC_FLAGS -std=c++11 -Xcompiler -fPIC --use_fast_math)
LIST(APPEND CUDA_NVCC_FLAGS -std=c++11)
CUDA_ADD_EXECUTABLE(test_Tensor test_Tensor.cu)
link_paddle_test(test_Tensor)
endif()
......@@ -81,7 +81,7 @@ int VectorCheckErr(const VectorPtr& vector1, const VectorPtr& vector2) {
#else
#include "paddle/common/Stat.h"
#include "paddle/utils/Stat.h"
#define CHECK_VECTORPTR(vector1, vector2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册