Skip to content

Commit

Permalink
Don't unconditionally compile runJITCPPTests (#31236)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #31236

It is not compiled on Windows

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Differential Revision: D19262581

Pulled By: ezyang

fbshipit-source-id: 80bfa553333a946f00291aaca6ad26313caaa9e6
  • Loading branch information
ezyang authored and facebook-github-bot committed Jan 7, 2020
1 parent 809ee9d commit 3c7db5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions torch/CMakeLists.txt
Expand Up @@ -109,10 +109,17 @@ set(TORCH_PYTHON_SRCS
${TORCH_SRC_DIR}/csrc/utils/tensor_new.cpp
${TORCH_SRC_DIR}/csrc/utils/tensor_numpy.cpp
${TORCH_SRC_DIR}/csrc/utils/tensor_types.cpp
${TORCH_ROOT}/test/cpp/jit/torch_python_test.cpp
${JIT_TEST_SRCS}
)

# NB: This has to match the condition under which the JIT test directory
# is included (at the time of writing that's in caffe2/CMakeLists.txt).
if (BUILD_TEST AND NOT MSVC AND NOT USE_ROCM)
list(APPEND TORCH_PYTHON_SRCS
${TORCH_ROOT}/test/cpp/jit/torch_python_test.cpp
${JIT_TEST_SRCS}
)
endif()

set(TORCH_PYTHON_INCLUDE_DIRECTORIES
${PYTHON_INCLUDE_DIR}

Expand Down
4 changes: 4 additions & 0 deletions torch/csrc/jit/init.cpp
Expand Up @@ -93,7 +93,9 @@ bool loadPythonClasses() {
}
} // anonymous namespace

#if !defined(_WIN32) && !defined(__HIP_PLATFORM_HCC__)
TORCH_API void runJITCPPTests(bool runCuda);
#endif

void initJITBindings(PyObject* module) {
auto m = py::handle(module).cast<py::module>();
Expand Down Expand Up @@ -280,6 +282,7 @@ void initJITBindings(PyObject* module) {
.def(
"_jit_pass_create_autodiff_subgraphs",
[](std::shared_ptr<Graph> graph) { CreateAutodiffSubgraphs(graph); })
#if !defined(_WIN32) && !defined(__HIP_PLATFORM_HCC__)
.def(
"_jit_run_cpp_tests",
[](bool runCuda) {
Expand All @@ -291,6 +294,7 @@ void initJITBindings(PyObject* module) {
return runJITCPPTests(runCuda);
},
py::arg("run_cuda"))
#endif
.def(
"_jit_flatten",
[](py::handle& obj) {
Expand Down

0 comments on commit 3c7db5c

Please sign in to comment.