Skip to content

Commit

Permalink
fixing build - to be verified on a GPU machine
Browse files Browse the repository at this point in the history
  • Loading branch information
Yangqing committed Sep 7, 2016
1 parent b23e51d commit 50274cf
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 29 deletions.
9 changes: 7 additions & 2 deletions caffe2/BREW
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cc_library(
cc_test(
name = "core_test",
srcs = Glob(["core/*_test.cc", "utils/*_test.cc"],
excludes=["*gpu_test*"]),
excludes=["*gpu_test*", "*cudnn_test*"]),
deps = [
":core",
"//caffe2/operators:core_ops",
Expand All @@ -58,9 +58,14 @@ cc_test(

cc_test(
name = "core_gpu_test",
srcs = Glob(["core/*_gpu_test.cc", "utils/*_gpu_test.cc"]),
srcs = Glob([
"core/*_gpu_test.cc",
"core/*_cudnn_test.cc",
"utils/*_gpu_test.cc",
]),
deps = [
":core_gpu",
":core_cudnn",
"//third_party:gtest",
"//caffe2/test:caffe2_gtest_main",
],
Expand Down
2 changes: 1 addition & 1 deletion caffe2/core/predictor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const char* initSpec = R"DOC(
std::unique_ptr<Blob> randomTensor(
const std::vector<TIndex>& dims,
CPUContext* ctx) {
auto blob = std::make_unique<Blob>();
auto blob = make_unique<Blob>();
auto* t = blob->GetMutable<TensorCPU>();
t->Resize(dims);
math::RandUniform<float, CPUContext>(
Expand Down
1 change: 1 addition & 0 deletions caffe2/operators/BREW
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ cc_test(
deps = [
":core_ops",
":core_ops_gpu",
":core_ops_cudnn",
"//caffe2/test:caffe2_gtest_main",
]
)
File renamed without changes.
File renamed without changes.
14 changes: 10 additions & 4 deletions caffe2/operators/operator_fallback_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace caffe2 {
template <int... values>
class SkipIndices {
private:
template <int... V>
template <int V>
static inline bool ContainsInternal(const int i) {
return false;
return (i == V);
}
template <int First, int... Rest>
template <int First, int Second, int... Rest>
static inline bool ContainsInternal(const int i) {
return (i == First) && ContainsInternal<Rest...>(i);
return (i == First) && ContainsInternal<Second, Rest...>(i);
}

public:
Expand All @@ -27,6 +27,12 @@ class SkipIndices {
}
};

template <>
class SkipIndices<> {
public:
static inline bool Contains(const int i) { return false; }
};

/**
* @brief A templated class to allow one to wrap a CPU operator as a CUDA
* operator.
Expand Down
30 changes: 8 additions & 22 deletions caffe2/python/BREW
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python_cc_extension(
name="caffe2_python_cpu",
srcs=["caffe2_python.cc"],
hdrs=["caffe2_python.h"],
name="caffe2_pybind11_state",
srcs=["pybind_state.cc"],
hdrs=Glob(["*.h"]),
deps = [
"//caffe2:all_available_ops",
"//caffe2:core",
Expand All @@ -10,41 +10,27 @@ python_cc_extension(
)

python_cc_extension(
name="caffe2_python_gpu",
srcs=[
"caffe2_python.cc",
"caffe2_python_gpu.cc",
],
hdrs=["caffe2_python.h"],
name="caffe2_pybind11_state_gpu",
srcs=["pybind_state.cc", "pybind_state_gpu.cc"],
hdrs=Glob(["*.h"]),
deps = [
"//caffe2:all_available_ops",
"//caffe2:core",
"//caffe2/db:db",
],
)

python_cc_extension(
name="caffe2_pybind11",
srcs=[
"pybind.cc",
],
deps=[
"//caffe2:core",
"//third_party:pybind11",
]
)

py_library(
name="pycaffe2",
srcs=Glob(["*.py"], excludes=["*_test.py"]),
deps=[
":caffe2_python_cpu",
":caffe2_pybind11_state",
"//caffe/proto:caffe_proto",
"//caffe2/proto:caffe2_proto",
"//caffe2/python/mint:mint",
],
optional_deps=[
":caffe2_python_gpu",
":caffe2_pybind11_state_gpu",
],
)

Expand Down

0 comments on commit 50274cf

Please sign in to comment.