Skip to content

Commit be04d99

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into revert_vlog
test=develop
2 parents 53433d7 + 05b7ee7 commit be04d99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+157
-139
lines changed

cmake/cuda.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,11 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
199199
list(APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_RELEASE})
200200
endif()
201201
else(NOT WIN32)
202+
list(APPEND CUDA_NVCC_FLAGS "--compiler-options;/bigobj")
202203
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
203-
list(APPEND CUDA_NVCC_FLAGS "-g -G")
204+
list(APPEND CUDA_NVCC_FLAGS "-g -G")
205+
# match the cl's _ITERATOR_DEBUG_LEVEL
206+
list(APPEND CUDA_NVCC_FLAGS "-D_DEBUG")
204207
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
205208
list(APPEND CUDA_NVCC_FLAGS "-O3 -DNDEBUG")
206209
else()

cmake/external/pybind11.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ExternalProject_Add(
2626
extern_pybind
2727
${EXTERNAL_PROJECT_LOG_ARGS}
2828
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
29-
GIT_TAG "v2.1.1"
29+
GIT_TAG "v2.2.4"
3030
PREFIX ${PYBIND_SOURCE_DIR}
3131
UPDATE_COMMAND ""
3232
CONFIGURE_COMMAND ""

cmake/generic.cmake

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,17 @@ function(cc_test TARGET_NAME)
349349
set(oneValueArgs "")
350350
set(multiValueArgs SRCS DEPS ARGS)
351351
cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
352+
if(WIN32)
353+
list(APPEND win32_deps shlwapi)
354+
if("${cc_test_DEPS};" MATCHES "python;")
355+
list(REMOVE_ITEM cc_test_DEPS python)
356+
list(APPEND win32_deps ${PYTHON_LIBRARIES})
357+
endif()
358+
endif(WIN32)
352359
add_executable(${TARGET_NAME} ${cc_test_SRCS})
353360
target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
354361
if(WIN32)
355-
target_link_libraries(${TARGET_NAME} shlwapi)
362+
target_link_libraries(${TARGET_NAME} ${win32_deps})
356363
endif(WIN32)
357364
add_dependencies(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
358365
add_test(NAME ${TARGET_NAME}
@@ -683,7 +690,7 @@ function(py_test TARGET_NAME)
683690
set(multiValueArgs SRCS DEPS ARGS ENVS)
684691
cmake_parse_arguments(py_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
685692
add_test(NAME ${TARGET_NAME}
686-
COMMAND env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true
693+
COMMAND ${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true FLAGS_cudnn_deterministic=true
687694
FLAGS_cpu_deterministic=true
688695
PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS}
689696
${PYTHON_EXECUTABLE} -u ${py_test_SRCS} ${py_test_ARGS}

paddle/fluid/API.spec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ paddle.fluid.release_memory ArgSpec(args=['input_program', 'skip_opt_set'], vara
2626
paddle.fluid.DistributeTranspilerConfig.__init__
2727
paddle.fluid.ParallelExecutor.__init__ ArgSpec(args=['self', 'use_cuda', 'loss_name', 'main_program', 'share_vars_from', 'exec_strategy', 'build_strategy', 'num_trainers', 'trainer_id', 'scope'], varargs=None, keywords=None, defaults=(None, None, None, None, None, 1, 0, None))
2828
paddle.fluid.ParallelExecutor.run ArgSpec(args=['self', 'fetch_list', 'feed', 'feed_dict', 'return_numpy'], varargs=None, keywords=None, defaults=(None, None, True))
29-
paddle.fluid.ExecutionStrategy.__init__ __init__(self: paddle.fluid.core.ExecutionStrategy) -> None
30-
paddle.fluid.BuildStrategy.GradientScaleStrategy.__init__ __init__(self: paddle.fluid.core.GradientScaleStrategy, arg0: int) -> None
31-
paddle.fluid.BuildStrategy.ReduceStrategy.__init__ __init__(self: paddle.fluid.core.ReduceStrategy, arg0: int) -> None
32-
paddle.fluid.BuildStrategy.__init__ __init__(self: paddle.fluid.core.BuildStrategy) -> None
29+
paddle.fluid.ExecutionStrategy.__init__ __init__(self: paddle.fluid.core.ParallelExecutor.ExecutionStrategy) -> None
30+
paddle.fluid.BuildStrategy.GradientScaleStrategy.__init__ __init__(self: paddle.fluid.core.ParallelExecutor.BuildStrategy.GradientScaleStrategy, arg0: int) -> None
31+
paddle.fluid.BuildStrategy.ReduceStrategy.__init__ __init__(self: paddle.fluid.core.ParallelExecutor.BuildStrategy.ReduceStrategy, arg0: int) -> None
32+
paddle.fluid.BuildStrategy.__init__ __init__(self: paddle.fluid.core.ParallelExecutor.BuildStrategy) -> None
3333
paddle.fluid.create_lod_tensor ArgSpec(args=['data', 'recursive_seq_lens', 'place'], varargs=None, keywords=None, defaults=None)
3434
paddle.fluid.create_random_int_lodtensor ArgSpec(args=['recursive_seq_lens', 'base_shape', 'place', 'low', 'high'], varargs=None, keywords=None, defaults=None)
3535
paddle.fluid.io.save_vars ArgSpec(args=['executor', 'dirname', 'main_program', 'vars', 'predicate', 'filename'], varargs=None, keywords=None, defaults=(None, None, None, None))

paddle/fluid/framework/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,9 @@ cc_test(op_proto_maker_test SRCS op_proto_maker_test.cc DEPS op_proto_maker)
116116
cc_library(op_info SRCS op_info.cc DEPS attribute framework_proto)
117117
cc_library(shape_inference SRCS shape_inference.cc DEPS ddim attribute device_context)
118118

119-
if (NOT WIN32)
120119
cc_library(transfer_scope_cache SRCS transfer_scope_cache.cc DEPS scope framework_proto device_context)
121120
cc_library(operator SRCS operator.cc DEPS op_info device_context tensor scope glog
122121
shape_inference data_transform lod_tensor profiler transfer_scope_cache)
123-
else()
124-
cc_library(operator SRCS operator.cc DEPS op_info device_context tensor scope glog
125-
shape_inference data_transform lod_tensor)
126-
endif(NOT WIN32)
127122

128123
cc_test(operator_test SRCS operator_test.cc DEPS operator op_registry device_context)
129124

paddle/fluid/framework/details/all_reduce_op_handle.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace paddle {
2323
namespace framework {
2424
namespace details {
2525

26-
#ifdef PADDLE_WITH_CUDA
26+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
2727
AllReduceOpHandle::AllReduceOpHandle(ir::Node *node,
2828
const std::vector<Scope *> &local_scopes,
2929
const std::vector<platform::Place> &places,
@@ -74,7 +74,7 @@ void AllReduceOpHandle::RunImpl() {
7474
}
7575

7676
if (platform::is_gpu_place(lod_tensors[0]->place())) {
77-
#ifdef PADDLE_WITH_CUDA
77+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
7878
PADDLE_ENFORCE(nccl_ctxs_, "nccl_ctxs should not be nullptr.");
7979
int dtype = -1;
8080
size_t numel = 0;

paddle/fluid/framework/details/all_reduce_op_handle.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "paddle/fluid/framework/details/op_handle_base.h"
2121
#include "paddle/fluid/framework/lod_tensor.h"
2222
#include "paddle/fluid/framework/scope.h"
23-
#ifdef PADDLE_WITH_CUDA
23+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
2424
#include "paddle/fluid/platform/nccl_helper.h"
2525
#endif
2626

@@ -29,7 +29,7 @@ namespace framework {
2929
namespace details {
3030

3131
struct AllReduceOpHandle : public OpHandleBase {
32-
#ifdef PADDLE_WITH_CUDA
32+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
3333
AllReduceOpHandle(ir::Node *node, const std::vector<Scope *> &local_scopes,
3434
const std::vector<platform::Place> &places,
3535
const platform::NCCLContextMap *ctxs);
@@ -49,7 +49,7 @@ struct AllReduceOpHandle : public OpHandleBase {
4949
private:
5050
std::vector<Scope *> local_scopes_;
5151
std::vector<platform::Place> places_;
52-
#ifdef PADDLE_WITH_CUDA
52+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
5353
const platform::NCCLContextMap *nccl_ctxs_;
5454
#endif
5555
};

paddle/fluid/framework/details/broadcast_op_handle.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void BroadcastOpHandle::BroadcastOneVar(
8282
});
8383
}
8484
} else {
85-
#ifdef PADDLE_WITH_CUDA
85+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
8686
VarHandle *out_handle = nullptr;
8787
int root_id = boost::get<platform::CUDAPlace>(in_tensor.place()).device;
8888
std::vector<std::function<void()>> broadcast_calls;

paddle/fluid/framework/details/broadcast_op_handle.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "paddle/fluid/framework/selected_rows.h"
2525
#include "paddle/fluid/platform/device_context.h"
2626

27-
#ifdef PADDLE_WITH_CUDA
27+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
2828
#include "paddle/fluid/platform/nccl_helper.h"
2929
#endif
3030

@@ -34,7 +34,7 @@ namespace details {
3434

3535
struct BroadcastOpHandle : public OpHandleBase {
3636
public:
37-
#ifdef PADDLE_WITH_CUDA
37+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
3838
BroadcastOpHandle(ir::Node *node, const std::vector<Scope *> &local_scopes,
3939
const std::vector<platform::Place> &places,
4040
const platform::NCCLContextMap *nccl_ctxs)
@@ -68,7 +68,7 @@ struct BroadcastOpHandle : public OpHandleBase {
6868

6969
std::vector<Scope *> local_scopes_;
7070
std::vector<platform::Place> places_;
71-
#ifdef PADDLE_WITH_CUDA
71+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
7272
const platform::NCCLContextMap *nccl_ctxs_;
7373
#endif
7474

paddle/fluid/framework/details/broadcast_op_handle_test.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ struct TestBroadcastOpHandle {
4242
std::vector<std::unique_ptr<ir::Node>> nodes_;
4343
std::vector<p::Place> place_list_;
4444
bool use_gpu_;
45-
#ifdef PADDLE_WITH_CUDA
45+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
4646
std::unique_ptr<platform::NCCLContextMap> nccl_ctxs_;
4747
#endif
4848

4949
void WaitAll() {
5050
for (size_t j = 0; j < ctxs_.size(); ++j) {
5151
ctxs_[j]->Wait();
5252
}
53-
#ifdef PADDLE_WITH_CUDA
53+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
5454
if (nccl_ctxs_) {
5555
nccl_ctxs_->WaitAll();
5656
}
@@ -60,7 +60,7 @@ struct TestBroadcastOpHandle {
6060
void InitCtxOnGpu(bool use_gpu) {
6161
use_gpu_ = use_gpu;
6262
if (use_gpu_) {
63-
#ifdef PADDLE_WITH_CUDA
63+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
6464
int count = p::GetCUDADeviceCount();
6565
if (count <= 1) {
6666
LOG(WARNING) << "Cannot test multi-gpu Broadcast, because the CUDA "
@@ -84,7 +84,7 @@ struct TestBroadcastOpHandle {
8484
place_list_.push_back(p);
8585
ctxs_.emplace_back(new p::CPUDeviceContext(p));
8686
}
87-
#ifdef PADDLE_WITH_CUDA
87+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
8888
nccl_ctxs_.reset(nullptr);
8989
#endif
9090
}
@@ -106,14 +106,14 @@ struct TestBroadcastOpHandle {
106106
nodes_.emplace_back(
107107
ir::CreateNodeForTest("node0", ir::Node::Type::kOperation));
108108
if (use_gpu_) {
109-
#ifdef PADDLE_WITH_CUDA
109+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
110110
op_handle_ = new BroadcastOpHandle(nodes_.back().get(), local_scopes_,
111111
place_list_, nccl_ctxs_.get());
112112
#else
113113
PADDLE_THROW("CUDA is not support.");
114114
#endif
115115
} else {
116-
#ifdef PADDLE_WITH_CUDA
116+
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
117117
op_handle_ = new BroadcastOpHandle(nodes_.back().get(), local_scopes_,
118118
place_list_, nccl_ctxs_.get());
119119
#else

0 commit comments

Comments
 (0)