Skip to content

Commit db77006

Browse files
authored
Merge pull request #8657 from reyoung/feature/fix_compile
Fix the compilation on CUDA 9.1/GCC 5.3
2 parents 5388375 + 22b5c07 commit db77006

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

cmake/configure.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ endif(NOT WITH_GOLANG)
5959

6060
if(NOT WITH_GPU)
6161
add_definitions(-DHPPL_STUB_FUNC)
62-
add_definitions("-DCUPTI_LIB_PATH=\"\"")
6362

6463
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
6564
else()
@@ -77,9 +76,7 @@ else()
7776
if(CUPTI_FOUND)
7877
include_directories(${CUPTI_INCLUDE_DIR})
7978
add_definitions(-DPADDLE_WITH_CUPTI)
80-
add_definitions("-DCUPTI_LIB_PATH=\"${CUPTI_LIBRARY_PATH}\"")
8179
else()
82-
add_definitions("-DCUPTI_LIB_PATH=\"\"")
8380
message(STATUS "Cannot find CUPTI, GPU Profiling is incorrect.")
8481
endif()
8582
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler ${SIMD_FLAG}")

paddle/fluid/platform/device_tracer.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License. */
1515
#include "paddle/fluid/platform/device_tracer.h"
1616
#include <map>
1717
#include <mutex>
18+
#include <numeric>
1819
#include "glog/logging.h"
1920
#include "paddle/fluid/framework/block_desc.h"
2021
#include "paddle/fluid/string/printf.h"

paddle/fluid/platform/dynload/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cc_library(dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags enforce)
22

33
list(APPEND CUDA_SRCS cublas.cc cudnn.cc curand.cc nccl.cc)
4+
configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h)
45
if (CUPTI_FOUND)
56
list(APPEND CUDA_SRCS cupti.cc)
67
endif(CUPTI_FOUND)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
15+
#pragma once
16+
17+
#define CUPTI_LIB_PATH "@CUPTI_LIBRARY_PATH@"

paddle/fluid/platform/dynload/dynamic_loader.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License. */
1919
#include <string>
2020
#include "gflags/gflags.h"
2121
#include "glog/logging.h"
22+
#include "paddle/fluid/platform/dynload/cupti_lib_path.h"
2223
#include "paddle/fluid/platform/enforce.h"
2324

2425
DEFINE_string(cudnn_dir, "",
@@ -45,8 +46,7 @@ DEFINE_string(cupti_dir, "", "Specify path for loading cupti.so.");
4546
namespace paddle {
4647
namespace platform {
4748
namespace dynload {
48-
49-
static const char* cupti_lib_path = CUPTI_LIB_PATH;
49+
static constexpr char cupti_lib_path[] = CUPTI_LIB_PATH;
5050

5151
static inline std::string join(const std::string& part1,
5252
const std::string& part2) {

0 commit comments

Comments
 (0)