提交 7f6e513b 编写于 作者: S sneaxiy

fix mac ci bug

make forward declaration
test=develop
上级 c1f7e54f
...@@ -13,7 +13,20 @@ ...@@ -13,7 +13,20 @@
// limitations under the License. // limitations under the License.
#include "paddle/fluid/framework/var_type_traits.h" #include "paddle/fluid/framework/var_type_traits.h"
#include "paddle/fluid/framework/lod_rank_table.h"
#include "paddle/fluid/framework/reader.h"
#include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/framework/selected_rows.h"
#include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h"
#include "paddle/fluid/platform/macros.h" #include "paddle/fluid/platform/macros.h"
#ifdef PADDLE_WITH_CUDA
#ifndef _WIN32
#include "paddle/fluid/operators/nccl/nccl_gpu_common.h"
#endif
#include <cudnn.h>
#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/operators/cudnn_rnn_cache.h"
#endif
namespace paddle { namespace paddle {
namespace framework { namespace framework {
......
...@@ -20,23 +20,48 @@ ...@@ -20,23 +20,48 @@
#include <typeinfo> #include <typeinfo>
#include <vector> #include <vector>
#include "paddle/fluid/framework/framework.pb.h" #include "paddle/fluid/framework/framework.pb.h"
#include "paddle/fluid/framework/lod_rank_table.h"
#include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/lod_tensor_array.h"
#include "paddle/fluid/framework/reader.h"
#include "paddle/fluid/framework/selected_rows.h"
#include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h"
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/place.h" #include "paddle/fluid/platform/place.h"
#ifdef PADDLE_WITH_CUDA #ifdef PADDLE_WITH_CUDA
#include <cudnn.h>
#ifndef _WIN32 #ifndef _WIN32
#include <nccl.h> #include <nccl.h>
#include "paddle/fluid/operators/nccl/nccl_gpu_common.h"
#endif #endif
#include <cudnn.h>
#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/operators/cudnn_rnn_cache.h"
#endif #endif
// Users should add forward declarations here
namespace paddle {
namespace platform {
#ifdef PADDLE_WITH_CUDA
#ifndef _WIN32
class Communicator;
#endif
#endif
} // namespace platform
namespace framework {
class Tensor;
class LoDTensor;
class SelectedRows;
class LoDRankTable;
class ReaderHolder;
class Scope;
} // namespace framework
namespace operators {
template <typename T>
class AlgorithmsCache;
class CudnnRNNCache;
namespace reader {
class LoDTensorBlockingQueueHolder;
} // namespace reader
} // namespace operators
} // namespace paddle
namespace paddle { namespace paddle {
namespace framework { namespace framework {
......
...@@ -12,12 +12,25 @@ ...@@ -12,12 +12,25 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "paddle/fluid/framework/var_type_traits.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>
#include <unordered_set> #include <unordered_set>
#include "paddle/fluid/framework/lod_rank_table.h"
#include "paddle/fluid/framework/reader.h"
#include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/framework/selected_rows.h"
#include "paddle/fluid/framework/var_type_traits.h"
#include "paddle/fluid/operators/reader/lod_tensor_blocking_queue.h"
#ifdef PADDLE_WITH_CUDA
#ifndef _WIN32
#include "paddle/fluid/operators/nccl/nccl_gpu_common.h"
#endif
#include "paddle/fluid/operators/conv_cudnn_op_cache.h"
#include "paddle/fluid/operators/cudnn_rnn_cache.h"
#endif
namespace paddle { namespace paddle {
namespace framework { namespace framework {
...@@ -32,19 +45,9 @@ struct TypeIndexChecker { ...@@ -32,19 +45,9 @@ struct TypeIndexChecker {
constexpr auto kId = VarTypeTrait<Type>::kId; constexpr auto kId = VarTypeTrait<Type>::kId;
std::type_index actual_type(typeid(Type)); std::type_index actual_type(typeid(Type));
EXPECT_EQ(std::string(ToTypeName(kId)), std::string(actual_type.name())); EXPECT_EQ(std::string(ToTypeName(kId)), std::string(actual_type.name()));
// For some reasons, comparing std::type_index using EXPECT_EQ would fail EXPECT_EQ(ToTypeIndex(kId), actual_type);
// in MAC CI EXPECT_EQ(ToTypeId(actual_type), kId);
bool is_same_type_index = (ToTypeIndex(kId) == actual_type); EXPECT_EQ(ToTypeIndex(ToTypeId(actual_type)), actual_type);
if (!is_same_type_index) {
std::string s1 = ToTypeName(kId);
std::string s2 = actual_type.name();
PADDLE_THROW("Step %d: type %s is not the same as %s, var_id %d", kPos,
s1.c_str(), s2.c_str(), kId);
}
EXPECT_TRUE(is_same_type_index);
EXPECT_TRUE(ToTypeId(actual_type) == kId); // NOLINT
is_same_type_index = (ToTypeIndex(ToTypeId(actual_type)) == actual_type);
EXPECT_TRUE(is_same_type_index);
EXPECT_EQ(ToTypeId(ToTypeIndex(kId)), kId); EXPECT_EQ(ToTypeId(ToTypeIndex(kId)), kId);
EXPECT_TRUE(var_id_set->count(kId) == 0); // NOLINT EXPECT_TRUE(var_id_set->count(kId) == 0); // NOLINT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册