Skip to content

Commit

Permalink
move CMP0104 to the top, fix issue in win cuda11
Browse files Browse the repository at this point in the history
* otherwise, windows cmake still gives CMP0104 warning
* generic api is available from cuda10.1 (expect for win), cuda11 (all)
  • Loading branch information
yhmtsai committed Aug 7, 2020
1 parent c7d32a6 commit 880e1d1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
cmake_policy(SET CMP0074 NEW)
endif()

# Let CAS handle the CUDA architecture flags (for now)
# Windows still gives CMP0104 warning if putting it in cuda.
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
cmake_policy(SET CMP0104 OLD)
endif()

project(Ginkgo LANGUAGES C CXX VERSION 1.2.0 DESCRIPTION "A numerical linear algebra library targeting many-core architectures")
set(Ginkgo_VERSION_TAG "develop")
set(PROJECT_VERSION_TAG ${Ginkgo_VERSION_TAG})
Expand Down
18 changes: 10 additions & 8 deletions benchmark/utils/cuda_linops.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,9 @@ class CuspHybrid
#endif


#if defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) && \
!(defined(_WIN32) || defined(__CYGWIN__))
#if defined(CUDA_VERSION) && \
(CUDA_VERSION >= 11000 || \
((CUDA_VERSION >= 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


template <typename ValueType>
Expand Down Expand Up @@ -690,8 +691,8 @@ class CuspGenericCoo
};


#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) &&
// !(defined(_WIN32) || defined(__CYGWIN__))
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 11000 || ((CUDA_VERSION >=
// 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


} // namespace detail
Expand All @@ -706,8 +707,9 @@ using cusp_csrmm = detail::CuspCsrmm<>;
#endif


#if defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) && \
!(defined(_WIN32) || defined(__CYGWIN__))
#if defined(CUDA_VERSION) && \
(CUDA_VERSION >= 11000 || \
((CUDA_VERSION >= 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


using cusp_gcsr = detail::CuspGenericCsr<>;
Expand All @@ -716,8 +718,8 @@ using cusp_gcsr2 =
using cusp_gcoo = detail::CuspGenericCoo<>;


#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) &&
// !(defined(_WIN32) || defined(__CYGWIN__))
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 11000 || ((CUDA_VERSION >=
// 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


#if defined(CUDA_VERSION) && (CUDA_VERSION < 11000)
Expand Down
18 changes: 10 additions & 8 deletions benchmark/utils/formats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ std::string format_description =
"cusp_coo: is an alias of cusp_gcoo.\n"
#endif
"cusp_csrex: benchmark CuSPARSE with the cusparseXcsrmvEx function."
#if defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) && \
!(defined(_WIN32) || defined(__CYGWIN__))
#if defined(CUDA_VERSION) && \
(CUDA_VERSION >= 11000 || \
((CUDA_VERSION >= 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))
"\n"
"cusp_gcsr: benchmark CuSPARSE with the generic csr with default "
"algorithm.\n"
"cusp_gcsr2: benchmark CuSPARSE with the generic csr with "
"CUSPARSE_CSRMV_ALG2.\n"
"cusp_gcoo: benchmark CuSPARSE with the generic coo with default "
"algorithm.\n"
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) &&
// !(defined(_WIN32) || defined(__CYGWIN__))
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 11000 || ((CUDA_VERSION >=
// 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))
#endif // HAS_CUDA
#ifdef HAS_HIP
"\n"
Expand Down Expand Up @@ -212,13 +213,14 @@ const std::map<std::string, std::function<std::unique_ptr<gko::LinOp>(
{"cusp_coo", read_matrix_from_data<cusp_gcoo>},
#endif
{"cusp_csrex", read_matrix_from_data<cusp_csrex>},
#if defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) && \
!(defined(_WIN32) || defined(__CYGWIN__))
#if defined(CUDA_VERSION) && \
(CUDA_VERSION >= 11000 || \
((CUDA_VERSION >= 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))
{"cusp_gcsr", read_matrix_from_data<cusp_gcsr>},
{"cusp_gcsr2", read_matrix_from_data<cusp_gcsr2>},
{"cusp_gcoo", read_matrix_from_data<cusp_gcoo>},
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) &&
// !(defined(_WIN32) || defined(__CYGWIN__))
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 11000 || ((CUDA_VERSION >=
// 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))
#endif // HAS_CUDA
#ifdef HAS_HIP
{"hipsp_csr", read_matrix_from_data<hipsp_csr>},
Expand Down
5 changes: 0 additions & 5 deletions cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ target_link_libraries(ginkgo_cuda PRIVATE ${CUDA_RUNTIME_LIBS} ${CUBLAS} ${CUSPA
# Need to link against ginkgo_hip for the `raw_copy_to(HipExecutor ...)` method
target_link_libraries(ginkgo_cuda PUBLIC ginkgo_hip)

# Let CAS handle the CUDA architecture flags (for now)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
cmake_policy(SET CMP0104 OLD)
endif()

cas_target_cuda_architectures(ginkgo_cuda
ARCHITECTURES ${GINKGO_CUDA_ARCHITECTURES}
UNSUPPORTED "20" "21")
Expand Down
18 changes: 10 additions & 8 deletions cuda/base/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ constexpr cudaDataType_t cuda_data_type_impl<uint8>()
}


#if defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) && \
!(defined(_WIN32) || defined(__CYGWIN__))
#if defined(CUDA_VERSION) && \
(CUDA_VERSION >= 11000 || \
((CUDA_VERSION >= 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


template <typename T>
Expand All @@ -221,8 +222,8 @@ constexpr cusparseIndexType_t cusparse_index_type_impl<int64>()
}


#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) &&
// !(defined(_WIN32) || defined(__CYGWIN__))
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 11000 || ((CUDA_VERSION >=
// 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


} // namespace detail
Expand All @@ -243,8 +244,9 @@ constexpr cudaDataType_t cuda_data_type()
}


#if defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) && \
!(defined(_WIN32) || defined(__CYGWIN__))
#if defined(CUDA_VERSION) && \
(CUDA_VERSION >= 11000 || \
((CUDA_VERSION >= 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


/**
Expand All @@ -262,8 +264,8 @@ constexpr cusparseIndexType_t cusparse_index_type()
}


#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 10010) &&
// !(defined(_WIN32) || defined(__CYGWIN__))
#endif // defined(CUDA_VERSION) && (CUDA_VERSION >= 11000 || ((CUDA_VERSION >=
// 10010) && !(defined(_WIN32) || defined(__CYGWIN__))))


/**
Expand Down

0 comments on commit 880e1d1

Please sign in to comment.