Unverified Commit 0e188b61 authored by czkkkkkk's avatar czkkkkkk Committed by GitHub
Browse files

[Sparse] Fix Windows.h dependency issue (#6741)

parent 643a42fe
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define SPARSE_SDDMM_H_ #define SPARSE_SDDMM_H_
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
namespace dgl { namespace dgl {
namespace sparse { namespace sparse {
......
...@@ -8,11 +8,9 @@ ...@@ -8,11 +8,9 @@
// clang-format off // clang-format off
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
#include <sparse/torch_headers.h>
// clang-format on // clang-format on
#include <torch/custom_class.h>
#include <torch/script.h>
#include <memory> #include <memory>
#include <utility> #include <utility>
......
...@@ -8,11 +8,10 @@ ...@@ -8,11 +8,10 @@
// clang-format off // clang-format off
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
#include <sparse/torch_headers.h>
// clang-format on // clang-format on
#include <sparse/sparse_format.h> #include <sparse/sparse_format.h>
#include <torch/custom_class.h>
#include <torch/script.h>
#include <memory> #include <memory>
#include <tuple> #include <tuple>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define SPARSE_SPMM_H_ #define SPARSE_SPMM_H_
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
namespace dgl { namespace dgl {
namespace sparse { namespace sparse {
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define SPARSE_SPSPMM_H_ #define SPARSE_SPSPMM_H_
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
namespace dgl { namespace dgl {
namespace sparse { namespace sparse {
......
/**
* Copyright (c) 2022 by Contributors
* @file sparse/torch_headers.h
* @brief Pytorch headers used in the sparse library. Since Pytorch 2.1.0
* introduced a dependency on <windows.h>, we need to define NOMINMAX to avoid
* the conflict with std::min/std::max macros before including Pytorch headers.
* See more in
* https://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c.
*/
#ifndef SPARSE_TORCH_HEADERS_H_
#define SPARSE_TORCH_HEADERS_H_
#ifdef _WIN32
#ifndef NOMINMAX
#define SPARSE_TORCH_HEADERS_H_NOMINMAX
#define NOMINMAX
#endif // NOMINMAX
#endif // _WIN32
#include <ATen/DLConvertor.h>
#include <c10/util/Logging.h>
#include <torch/custom_class.h>
#include <torch/script.h>
#ifdef SPARSE_TORCH_HEADERS_H_NOMINMAX
#undef NOMINMAX
#endif // SPARSE_TORCH_HEADERS_H_NOMINMAX
#endif // SPARSE_TORCH_HEADERS_H_
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sparse/elementwise_op.h> #include <sparse/elementwise_op.h>
#include <sparse/matrix_ops.h> #include <sparse/matrix_ops.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include <memory> #include <memory>
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
// clang-format off // clang-format off
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
#include <sparse/torch_headers.h>
// clang-format on // clang-format on
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include "./utils.h" #include "./utils.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#define DGL_SPARSE_MATMUL_H_ #define DGL_SPARSE_MATMUL_H_
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include <string> #include <string>
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
* @brief DGL C++ matrix operators. * @brief DGL C++ matrix operators.
*/ */
#include <sparse/matrix_ops.h> #include <sparse/matrix_ops.h>
#include <torch/script.h>
namespace dgl { namespace dgl {
namespace sparse { namespace sparse {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
// clang-format off // clang-format off
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
#include <sparse/torch_headers.h>
// clang-format on // clang-format on
#include <sparse/elementwise_op.h> #include <sparse/elementwise_op.h>
...@@ -15,8 +16,6 @@ ...@@ -15,8 +16,6 @@
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <sparse/spmm.h> #include <sparse/spmm.h>
#include <sparse/spspmm.h> #include <sparse/spspmm.h>
#include <torch/custom_class.h>
#include <torch/script.h>
namespace dgl { namespace dgl {
namespace sparse { namespace sparse {
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
*/ */
// clang-format off // clang-format off
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
#include <sparse/torch_headers.h>
// clang-format on // clang-format on
#include <sparse/elementwise_op.h> #include <sparse/elementwise_op.h>
#include <sparse/reduction.h> #include <sparse/reduction.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include <string> #include <string>
#include <vector> #include <vector>
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <sparse/spmm.h> #include <sparse/spmm.h>
#include <torch/script.h>
#include <sstream> #include <sstream>
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <sparse/reduction.h> #include <sparse/reduction.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include "./matmul.h" #include "./matmul.h"
#include "./utils.h" #include "./utils.h"
......
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
// clang-format on // clang-format on
#include <c10/util/Logging.h>
#include <sparse/elementwise_op.h> #include <sparse/elementwise_op.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/script.h>
#include "./utils.h" #include "./utils.h"
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sparse/sddmm.h> #include <sparse/sddmm.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <sparse/spmm.h> #include <sparse/spmm.h>
#include <torch/script.h>
#include <sstream> #include <sstream>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <sparse/sddmm.h> #include <sparse/sddmm.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <sparse/spspmm.h> #include <sparse/spspmm.h>
#include <torch/script.h>
#include "./matmul.h" #include "./matmul.h"
#include "./utils.h" #include "./utils.h"
......
...@@ -8,12 +8,10 @@ ...@@ -8,12 +8,10 @@
// clang-format off // clang-format off
#include <sparse/dgl_headers.h> #include <sparse/dgl_headers.h>
#include <sparse/torch_headers.h>
// clang-format on // clang-format on
#include <ATen/DLConvertor.h>
#include <sparse/sparse_matrix.h> #include <sparse/sparse_matrix.h>
#include <torch/custom_class.h>
#include <torch/script.h>
namespace dgl { namespace dgl {
namespace sparse { namespace sparse {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment