Skip to content

Commit 91bec76

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into custom_op_zyf
2 parents 49d9e87 + 8bc4d85 commit 91bec76

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

paddle/fluid/operators/bce_loss_op_npu.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class BCELossNPUKernel : public framework::OpKernel<T> {
3434
ctx.template device_context<paddle::platform::NPUDeviceContext>()
3535
.stream();
3636

37-
const auto& runner = NpuOpRunner("BinaryCrossEntropy", {*x, *labels},
38-
{*out}, {{"reduction", "none"}});
37+
const auto& runner =
38+
NpuOpRunner("BinaryCrossEntropy", {*x, *labels}, {*out},
39+
{{"reduction", static_cast<std::string>("none")}});
3940
runner.Run(stream);
4041
}
4142
};
@@ -57,7 +58,7 @@ class BCELossGradNPUKernel : public framework::OpKernel<T> {
5758

5859
const auto& runner =
5960
NpuOpRunner("BinaryCrossEntropyGrad", {*x, *labels, *dout}, {*dx},
60-
{{"reduction", "none"}});
61+
{{"reduction", static_cast<std::string>("none")}});
6162
runner.Run(stream);
6263
}
6364
};

paddle/fluid/pybind/pybind.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,6 +2221,7 @@ All parameter, weight, gradient are variables in Paddle.
22212221
auto &pool = platform::DeviceContextPool::Instance();
22222222
auto devices = platform::GetSelectedNPUDevices();
22232223
for (size_t i = 0; i < devices.size(); ++i) {
2224+
platform::NPUDeviceGuard guard(devices[i]);
22242225
pool.Get(platform::NPUPlace(devices[i]))->Wait();
22252226
}
22262227
platform::AclInstance::Instance().Finalize();

paddle/scripts/paddle_build.bat

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,23 @@ if "%WITH_SCCACHE%"=="ON" (
161161
del D:\sccache\sccache_log.txt
162162
cmd /C sccache -V || call :install_sccache
163163
sccache --stop-server 2> NUL
164+
165+
:: Localy storage on windows
164166
if not exist D:\sccache mkdir D:\sccache
165167
set SCCACHE_DIR=D:\sccache\.cache
166-
:: sccache will shut down if a source file takes more than 10 mins to compile
168+
169+
:: Sccache will shut down if a source file takes more than 10 mins to compile
167170
set SCCACHE_IDLE_TIMEOUT=0
168-
set SCCACHE_CACHE_SIZE=30G
171+
set SCCACHE_CACHE_SIZE=100G
169172
set SCCACHE_ERROR_LOG=D:\sccache\sccache_log.txt
170173
set SCCACHE_LOG=quiet
174+
175+
:: Distributed storage on windows
176+
set SCCACHE_ENDPOINT=s3.bj.bcebos.com
177+
set SCCACHE_BUCKET=paddle-windows
178+
set SCCACHE_S3_KEY_PREFIX=sccache/
179+
set SCCACHE_S3_USE_SSL=true
180+
171181
sccache --start-server
172182
sccache -z
173183
goto :CASE_%1

python/paddle/fluid/tests/unittests/npu/test_bce_loss_npu.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_dygraph_layer(place,
9696
label_np,
9797
reduction='mean',
9898
weight_np=None):
99-
paddle.disable_static()
99+
paddle.disable_static(place)
100100
if weight_np is not None:
101101
weight = paddle.to_tensor(weight_np)
102102
bce_loss = paddle.nn.loss.BCELoss(weight=weight, reduction=reduction)
@@ -113,7 +113,7 @@ def test_dygraph_functional(place,
113113
label_np,
114114
reduction='mean',
115115
weight_np=None):
116-
paddle.disable_static()
116+
paddle.disable_static(place)
117117
input = paddle.to_tensor(input_np)
118118
label = paddle.to_tensor(label_np)
119119

0 commit comments

Comments
 (0)