commit
6f748a035d
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,70 +0,0 @@
|
||||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. */
|
||||
|
||||
#include "paddle/fluid/framework/channel.h"
|
||||
#include "paddle/fluid/framework/op_registry.h"
|
||||
|
||||
namespace pf = paddle::framework;
|
||||
static constexpr char kChannel[] = "Channel";
|
||||
|
||||
namespace paddle {
|
||||
namespace operators {
|
||||
|
||||
class ChannelCloseOp : public framework::OperatorBase {
|
||||
public:
|
||||
ChannelCloseOp(const std::string &type,
|
||||
const framework::VariableNameMap &inputs,
|
||||
const framework::VariableNameMap &outputs,
|
||||
const framework::AttributeMap &attrs)
|
||||
: framework::OperatorBase(type, inputs, outputs, attrs) {}
|
||||
|
||||
private:
|
||||
void RunImpl(const framework::Scope &scope,
|
||||
const platform::Place &dev_place) const override {
|
||||
auto &inp = *scope.FindVar(Input(kChannel));
|
||||
|
||||
// Get the mutable version of the channel variable and closes it.
|
||||
pf::ChannelHolder *ch = inp.GetMutable<framework::ChannelHolder>();
|
||||
ch->close();
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelCloseOpOpInferShape : public framework::InferShapeBase {
|
||||
public:
|
||||
void operator()(framework::InferShapeContext *context) const override {
|
||||
PADDLE_ENFORCE(context->HasInput("Channel"),
|
||||
"The input of ChannelClose op must be set");
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelCloseOpMaker : public framework::OpProtoAndCheckerMaker {
|
||||
public:
|
||||
void Make() override {
|
||||
AddInput(kChannel,
|
||||
"The Channel Variable that should be closed by"
|
||||
" the ChannelClose Op.");
|
||||
AddComment(R"DOC(
|
||||
Channel Close Operator.
|
||||
|
||||
This operator closes an open channel.
|
||||
)DOC");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace operators
|
||||
} // namespace paddle
|
||||
|
||||
REGISTER_OPERATOR(channel_close, paddle::operators::ChannelCloseOp,
|
||||
paddle::framework::EmptyGradOpMaker,
|
||||
paddle::operators::ChannelCloseOpMaker);
|
@ -1,113 +0,0 @@
|
||||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. */
|
||||
|
||||
#include "paddle/fluid/framework/channel.h"
|
||||
#include "paddle/fluid/framework/lod_rank_table.h"
|
||||
#include "paddle/fluid/framework/lod_tensor_array.h"
|
||||
#include "paddle/fluid/framework/op_registry.h"
|
||||
#include "paddle/fluid/framework/reader.h"
|
||||
|
||||
namespace pf = paddle::framework;
|
||||
|
||||
static constexpr char kOutput[] = "Out";
|
||||
|
||||
namespace paddle {
|
||||
namespace operators {
|
||||
|
||||
class ChannelCreateOp : public framework::OperatorBase {
|
||||
public:
|
||||
ChannelCreateOp(const std::string &type,
|
||||
const framework::VariableNameMap &inputs,
|
||||
const framework::VariableNameMap &outputs,
|
||||
const framework::AttributeMap &attrs)
|
||||
: framework::OperatorBase(type, inputs, outputs, attrs) {}
|
||||
|
||||
private:
|
||||
void RunImpl(const framework::Scope &scope,
|
||||
const platform::Place &dev_place) const override {
|
||||
auto &out = *scope.FindVar(Output(kOutput));
|
||||
|
||||
// Determine the datatype and capacity of the channel to be created
|
||||
// from the attributes provided.
|
||||
auto dtype =
|
||||
static_cast<framework::proto::VarType::Type>(Attr<int>("data_type"));
|
||||
auto capacity = Attr<int>("capacity");
|
||||
|
||||
// Based on the datatype, create a new channel holder initialized with
|
||||
// the given capacity. When capacity is 0, an unbuffered channel is
|
||||
// created.
|
||||
pf::ChannelHolder *ch = out.GetMutable<framework::ChannelHolder>();
|
||||
if (dtype == framework::proto::VarType::LOD_TENSOR) {
|
||||
ch->Reset<pf::LoDTensor>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::SELECTED_ROWS) {
|
||||
ch->Reset<pf::SelectedRows>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::LOD_RANK_TABLE) {
|
||||
ch->Reset<pf::LoDRankTable>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::LOD_TENSOR_ARRAY) {
|
||||
ch->Reset<pf::LoDTensorArray>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::READER) {
|
||||
ch->Reset<pf::ReaderHolder>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::CHANNEL) {
|
||||
ch->Reset<pf::ChannelHolder>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::BOOL) {
|
||||
ch->Reset<bool>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::INT32) {
|
||||
ch->Reset<int>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::INT64) {
|
||||
ch->Reset<int64_t>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::FP32) {
|
||||
ch->Reset<float>(capacity);
|
||||
} else if (dtype == framework::proto::VarType::FP64) {
|
||||
ch->Reset<double>(capacity);
|
||||
} else {
|
||||
PADDLE_THROW(
|
||||
"Data type %d is not in "
|
||||
"[LOD_TENSOR, SELECTED_ROWS, LOD_RANK_TABLE, LOD_TENSOR_ARRAY, "
|
||||
"READER, CHANNEL, BOOL, INT32, INT64, FP32, FP64]",
|
||||
dtype);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelCreateOpOpInferShape : public framework::InferShapeBase {
|
||||
public:
|
||||
void operator()(framework::InferShapeContext *context) const override {
|
||||
PADDLE_ENFORCE(context->HasOutput(kOutput),
|
||||
"The output of ChannelCreate op must be set");
|
||||
context->SetOutputDim(kOutput, {1});
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelCreateOpMaker : public framework::OpProtoAndCheckerMaker {
|
||||
public:
|
||||
void Make() override {
|
||||
AddOutput(kOutput,
|
||||
"The object of a Channel type created by ChannelCreate Op.");
|
||||
AddAttr<int>("capacity", "The size of the buffer of Channel.")
|
||||
.SetDefault(0);
|
||||
AddAttr<int>("data_type", "The data type of elements inside the Channel.");
|
||||
AddComment(R"DOC(
|
||||
Channel Create Operator.
|
||||
|
||||
This operator creates an object of the VarType Channel and returns it.
|
||||
)DOC");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace operators
|
||||
} // namespace paddle
|
||||
|
||||
REGISTER_OPERATOR(channel_create, paddle::operators::ChannelCreateOp,
|
||||
paddle::framework::EmptyGradOpMaker,
|
||||
paddle::operators::ChannelCreateOpMaker);
|
@ -1,98 +0,0 @@
|
||||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. */
|
||||
|
||||
#include "paddle/fluid/framework/channel.h"
|
||||
#include <paddle/fluid/framework/lod_rank_table.h>
|
||||
#include <paddle/fluid/framework/lod_tensor_array.h>
|
||||
#include <paddle/fluid/framework/reader.h>
|
||||
#include "paddle/fluid/framework/op_registry.h"
|
||||
#include "paddle/fluid/framework/var_type.h"
|
||||
#include "paddle/fluid/operators/concurrency/channel_util.h"
|
||||
#include "paddle/fluid/operators/math/math_function.h"
|
||||
|
||||
static constexpr char Channel[] = "Channel";
|
||||
static constexpr char Status[] = "Status";
|
||||
static constexpr char Out[] = "Out";
|
||||
|
||||
namespace paddle {
|
||||
namespace operators {
|
||||
|
||||
void SetReceiveStatus(const platform::Place &dev_place,
|
||||
framework::Variable *status_var, bool status) {
|
||||
auto cpu = platform::CPUPlace();
|
||||
auto status_tensor =
|
||||
status_var->GetMutable<framework::LoDTensor>()->mutable_data<bool>({1},
|
||||
cpu);
|
||||
status_tensor[0] = status;
|
||||
}
|
||||
|
||||
class ChannelRecvOp : public framework::OperatorBase {
|
||||
public:
|
||||
ChannelRecvOp(const std::string &type,
|
||||
const framework::VariableNameMap &inputs,
|
||||
const framework::VariableNameMap &outputs,
|
||||
const framework::AttributeMap &attrs)
|
||||
: framework::OperatorBase(type, inputs, outputs, attrs) {}
|
||||
|
||||
void InferShape(framework::InferShapeContext *ctx) const {
|
||||
PADDLE_ENFORCE(ctx->HasInput(Channel),
|
||||
"Input(Channel) of ChannelRecvOp should not be null.");
|
||||
PADDLE_ENFORCE(ctx->HasOutput(Out),
|
||||
"Input(Channel) of ChannelRecvOp should not be null.");
|
||||
PADDLE_ENFORCE(ctx->HasOutput(Status),
|
||||
"Output(Status) of ChannelRecvOp should not be null.");
|
||||
ctx->SetOutputDim("Status", {1});
|
||||
}
|
||||
|
||||
private:
|
||||
void RunImpl(const framework::Scope &scope,
|
||||
const platform::Place &dev_place) const override {
|
||||
// Get the channel holder created by channel_create op, passed as input.
|
||||
framework::ChannelHolder *ch =
|
||||
scope.FindVar(Input(Channel))->GetMutable<framework::ChannelHolder>();
|
||||
auto output_var = scope.FindVar(Output(Out));
|
||||
// Receive the data from the channel.
|
||||
bool ok = concurrency::ChannelReceive(ch, output_var);
|
||||
|
||||
// Set the status output of the `ChannelReceive` call.
|
||||
SetReceiveStatus(dev_place, scope.FindVar(Output(Status)), ok);
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelRecvOpMaker : public framework::OpProtoAndCheckerMaker {
|
||||
public:
|
||||
void Make() override {
|
||||
AddInput(Channel,
|
||||
"(Channel) A variable which \"receives\" the a value sent"
|
||||
"to it by a channel_send op.")
|
||||
.AsDuplicable();
|
||||
AddOutput(Out,
|
||||
"(Variable) Output Variable that will hold the data received"
|
||||
" from the Channel")
|
||||
.AsDuplicable();
|
||||
AddOutput(Status,
|
||||
"(Tensor) An LoD Tensor that returns a boolean status of the"
|
||||
"result of the receive operation.")
|
||||
.AsDuplicable();
|
||||
AddComment(R"DOC(
|
||||
)DOC");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace operators
|
||||
} // namespace paddle
|
||||
|
||||
REGISTER_OPERATOR(channel_recv, paddle::operators::ChannelRecvOp,
|
||||
paddle::framework::EmptyGradOpMaker,
|
||||
paddle::operators::ChannelRecvOpMaker);
|
@ -1,76 +0,0 @@
|
||||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. */
|
||||
|
||||
#include "paddle/fluid/framework/channel.h"
|
||||
#include <paddle/fluid/framework/lod_rank_table.h>
|
||||
#include <paddle/fluid/framework/lod_tensor_array.h>
|
||||
#include <paddle/fluid/framework/reader.h>
|
||||
#include "paddle/fluid/framework/op_registry.h"
|
||||
#include "paddle/fluid/framework/var_type.h"
|
||||
#include "paddle/fluid/operators/concurrency/channel_util.h"
|
||||
#include "paddle/fluid/operators/math/math_function.h"
|
||||
|
||||
static constexpr char Channel[] = "Channel";
|
||||
static constexpr char X[] = "X";
|
||||
|
||||
namespace paddle {
|
||||
namespace operators {
|
||||
|
||||
class ChannelSendOp : public framework::OperatorBase {
|
||||
public:
|
||||
ChannelSendOp(const std::string &type,
|
||||
const framework::VariableNameMap &inputs,
|
||||
const framework::VariableNameMap &outputs,
|
||||
const framework::AttributeMap &attrs)
|
||||
: framework::OperatorBase(type, inputs, outputs, attrs) {}
|
||||
|
||||
void InferShape(framework::InferShapeContext *ctx) const {
|
||||
PADDLE_ENFORCE(ctx->HasInput(Channel),
|
||||
"Input(Channel) of ChannelSendOp should not be null.");
|
||||
PADDLE_ENFORCE(ctx->HasInput(X),
|
||||
"Input(X) of ChannelSendOp should not be null.");
|
||||
}
|
||||
|
||||
private:
|
||||
void RunImpl(const framework::Scope &scope,
|
||||
const platform::Place &dev_place) const override {
|
||||
// Get the channel holder created by channel_create op, passed as input.
|
||||
framework::ChannelHolder *ch =
|
||||
scope.FindVar(Input(Channel))->GetMutable<framework::ChannelHolder>();
|
||||
auto input_var = scope.FindVar(Input(X));
|
||||
|
||||
// Send the input data through the channel.
|
||||
concurrency::ChannelSend(ch, input_var);
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelSendOpMaker : public framework::OpProtoAndCheckerMaker {
|
||||
public:
|
||||
void Make() override {
|
||||
AddInput(Channel,
|
||||
"(Channel) A variable which \"sends\" the passed in value to "
|
||||
"a listening receiver.")
|
||||
.AsDuplicable();
|
||||
AddInput(X, "(Variable) The value which gets sent by the channel.")
|
||||
.AsDuplicable();
|
||||
AddComment(R"DOC(
|
||||
)DOC");
|
||||
}
|
||||
};
|
||||
} // namespace operators
|
||||
} // namespace paddle
|
||||
|
||||
REGISTER_OPERATOR(channel_send, paddle::operators::ChannelSendOp,
|
||||
paddle::framework::EmptyGradOpMaker,
|
||||
paddle::operators::ChannelSendOpMaker);
|
@ -1 +0,0 @@
|
||||
cc_library(concurrency SRCS channel_util.cc DEPS device_context framework_proto boost eigen3)
|
@ -1,111 +0,0 @@
|
||||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. */
|
||||
|
||||
#include "paddle/fluid/operators/concurrency/channel_util.h"
|
||||
#include "paddle/fluid/framework/var_type.h"
|
||||
|
||||
namespace poc = paddle::operators::concurrency;
|
||||
|
||||
void poc::ChannelSend(framework::ChannelHolder *ch, framework::Variable *var) {
|
||||
auto type = framework::ToVarType(var->Type());
|
||||
if (type == framework::proto::VarType_Type_LOD_TENSOR)
|
||||
ch->Send(var->GetMutable<framework::LoDTensor>());
|
||||
else if (type == framework::proto::VarType_Type_LOD_RANK_TABLE)
|
||||
ch->Send(var->GetMutable<framework::LoDRankTable>());
|
||||
else if (type == framework::proto::VarType_Type_LOD_TENSOR_ARRAY)
|
||||
ch->Send(var->GetMutable<framework::LoDTensorArray>());
|
||||
else if (type == framework::proto::VarType_Type_SELECTED_ROWS)
|
||||
ch->Send(var->GetMutable<framework::SelectedRows>());
|
||||
else if (type == framework::proto::VarType_Type_READER)
|
||||
ch->Send(var->GetMutable<framework::ReaderHolder>());
|
||||
else if (type == framework::proto::VarType_Type_CHANNEL)
|
||||
ch->Send(var->GetMutable<framework::ChannelHolder>());
|
||||
else
|
||||
PADDLE_THROW("ChannelSend:Unsupported type");
|
||||
}
|
||||
|
||||
bool poc::ChannelReceive(framework::ChannelHolder *ch,
|
||||
framework::Variable *var) {
|
||||
// Get type of channel and use that to call mutable data for Variable
|
||||
auto type = framework::ToVarType(ch->Type());
|
||||
if (type == framework::proto::VarType_Type_LOD_TENSOR)
|
||||
return ch->Receive(var->GetMutable<framework::LoDTensor>());
|
||||
else if (type == framework::proto::VarType_Type_LOD_RANK_TABLE)
|
||||
return ch->Receive(var->GetMutable<framework::LoDRankTable>());
|
||||
else if (type == framework::proto::VarType_Type_LOD_TENSOR_ARRAY)
|
||||
return ch->Receive(var->GetMutable<framework::LoDTensorArray>());
|
||||
else if (type == framework::proto::VarType_Type_SELECTED_ROWS)
|
||||
return ch->Receive(var->GetMutable<framework::SelectedRows>());
|
||||
else if (type == framework::proto::VarType_Type_READER)
|
||||
return ch->Receive(var->GetMutable<framework::ReaderHolder>());
|
||||
else if (type == framework::proto::VarType_Type_CHANNEL)
|
||||
return ch->Receive(var->GetMutable<framework::ChannelHolder>());
|
||||
else
|
||||
PADDLE_THROW("ChannelReceive:Unsupported type");
|
||||
}
|
||||
|
||||
void poc::ChannelAddToSendQ(framework::ChannelHolder *ch, const void *referrer,
|
||||
framework::Variable *var,
|
||||
std::shared_ptr<std::condition_variable_any> cond,
|
||||
std::function<bool(framework::ChannelAction)> cb) {
|
||||
auto type = framework::ToVarType(var->Type());
|
||||
if (type == framework::proto::VarType_Type_LOD_TENSOR) {
|
||||
ch->AddToSendQ(referrer, var->GetMutable<framework::LoDTensor>(), cond, cb);
|
||||
} else if (type == framework::proto::VarType_Type_LOD_RANK_TABLE) {
|
||||
ch->AddToSendQ(referrer, var->GetMutable<framework::LoDRankTable>(), cond,
|
||||
cb);
|
||||
} else if (type == framework::proto::VarType_Type_LOD_TENSOR_ARRAY) {
|
||||
ch->AddToSendQ(referrer, var->GetMutable<framework::LoDTensorArray>(), cond,
|
||||
cb);
|
||||
} else if (type == framework::proto::VarType_Type_SELECTED_ROWS) {
|
||||
ch->AddToSendQ(referrer, var->GetMutable<framework::SelectedRows>(), cond,
|
||||
cb);
|
||||
} else if (type == framework::proto::VarType_Type_READER) {
|
||||
ch->AddToSendQ(referrer, var->GetMutable<framework::ReaderHolder>(), cond,
|
||||
cb);
|
||||
} else if (type == framework::proto::VarType_Type_CHANNEL) {
|
||||
ch->AddToSendQ(referrer, var->GetMutable<framework::ChannelHolder>(), cond,
|
||||
cb);
|
||||
} else {
|
||||
PADDLE_THROW("ChannelAddToSendQ:Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
void poc::ChannelAddToReceiveQ(
|
||||
framework::ChannelHolder *ch, const void *referrer,
|
||||
framework::Variable *var, std::shared_ptr<std::condition_variable_any> cond,
|
||||
std::function<bool(framework::ChannelAction)> cb) {
|
||||
auto type = framework::ToVarType(var->Type());
|
||||
if (type == framework::proto::VarType_Type_LOD_TENSOR) {
|
||||
ch->AddToReceiveQ(referrer, var->GetMutable<framework::LoDTensor>(), cond,
|
||||
cb);
|
||||
} else if (type == framework::proto::VarType_Type_LOD_RANK_TABLE) {
|
||||
ch->AddToReceiveQ(referrer, var->GetMutable<framework::LoDRankTable>(),
|
||||
cond, cb);
|
||||
} else if (type == framework::proto::VarType_Type_LOD_TENSOR_ARRAY) {
|
||||
ch->AddToReceiveQ(referrer, var->GetMutable<framework::LoDTensorArray>(),
|
||||
cond, cb);
|
||||
} else if (type == framework::proto::VarType_Type_SELECTED_ROWS) {
|
||||
ch->AddToReceiveQ(referrer, var->GetMutable<framework::SelectedRows>(),
|
||||
cond, cb);
|
||||
} else if (type == framework::proto::VarType_Type_READER) {
|
||||
ch->AddToReceiveQ(referrer, var->GetMutable<framework::ReaderHolder>(),
|
||||
cond, cb);
|
||||
} else if (type == framework::proto::VarType_Type_CHANNEL) {
|
||||
ch->AddToReceiveQ(referrer, var->GetMutable<framework::ChannelHolder>(),
|
||||
cond, cb);
|
||||
} else {
|
||||
PADDLE_THROW("ChannelAddToReceiveQ:Unsupported type");
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "paddle/fluid/framework/channel.h"
|
||||
#include "paddle/fluid/framework/variable.h"
|
||||
|
||||
namespace paddle {
|
||||
namespace operators {
|
||||
namespace concurrency {
|
||||
|
||||
void ChannelSend(framework::ChannelHolder *ch, framework::Variable *var);
|
||||
bool ChannelReceive(framework::ChannelHolder *ch, framework::Variable *var);
|
||||
|
||||
void ChannelAddToSendQ(framework::ChannelHolder *ch, const void *referrer,
|
||||
framework::Variable *var,
|
||||
std::shared_ptr<std::condition_variable_any> cond,
|
||||
std::function<bool(framework::ChannelAction)> cb);
|
||||
void ChannelAddToReceiveQ(framework::ChannelHolder *ch, const void *referrer,
|
||||
framework::Variable *var,
|
||||
std::shared_ptr<std::condition_variable_any> cond,
|
||||
std::function<bool(framework::ChannelAction)> cb);
|
||||
|
||||
} // namespace concurrency
|
||||
} // namespace operators
|
||||
} // namespace paddle
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue