ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
gtest.h
Go to the documentation of this file.
1#ifndef BASE_UTILS_GTEST_H_
2#define BASE_UTILS_GTEST_H_
3#include <gtest/gtest.h>
4#include <ATen/kernels/blas.h>
6
7namespace base {
8namespace utils {
9
10#if __CUDA || __ROCM
11using ComplexTypes = ::testing::Types<
12 std::tuple<std::complex<float>, ct::DEVICE_CPU>, std::tuple<std::complex<float>, ct::DEVICE_GPU>,
13 std::tuple<std::complex<double>, ct::DEVICE_CPU>, std::tuple<std::complex<double>, ct::DEVICE_GPU>>;
14using Types = ::testing::Types<
15 std::tuple<float, ct::DEVICE_CPU>, std::tuple<float, ct::DEVICE_GPU>,
16 std::tuple<double, ct::DEVICE_CPU>, std::tuple<double, ct::DEVICE_GPU>,
17 std::tuple<std::complex<float>, ct::DEVICE_CPU>, std::tuple<std::complex<float>, ct::DEVICE_GPU>,
18 std::tuple<std::complex<double>, ct::DEVICE_CPU>, std::tuple<std::complex<double>, ct::DEVICE_GPU>>;
19#else
20using ComplexTypes = ::testing::Types<
21 std::tuple<std::complex<float>, ct::DEVICE_CPU>,
22 std::tuple<std::complex<double>, ct::DEVICE_CPU>>;
23using Types = ::testing::Types<
24 std::tuple<float, ct::DEVICE_CPU>,
25 std::tuple<double, ct::DEVICE_CPU>,
26 std::tuple<std::complex<float>, ct::DEVICE_CPU>,
27 std::tuple<std::complex<double>, ct::DEVICE_CPU>>;
28#endif
29
30static inline void init_blas_handle() {
31 #if __CUDA || __ROCM
32 ct::kernels::createGpuBlasHandle();
33 #endif
34}
35
36static inline void delete_blas_handle() {
37 #if __CUDA || __ROCM
38 ct::kernels::destroyGpuBlasHandle();
39 #endif
40}
41
42static inline void init_cusolver_handle() {
43 #if __CUDA || __ROCM
44 ct::kernels::createGpuSolverHandle();
45 #endif
46}
47
48static inline void delete_cusolver_handle() {
49 #if __CUDA || __ROCM
50 ct::kernels::destroyGpuSolverHandle();
51 #endif
52}
53
54} // namespace utils
55} // namespace base
56
57#endif // BASE_UTILS_GTEST_H_
::testing::Types< std::tuple< float, ct::DEVICE_CPU >, std::tuple< double, ct::DEVICE_CPU >, std::tuple< std::complex< float >, ct::DEVICE_CPU >, std::tuple< std::complex< double >, ct::DEVICE_CPU > > Types
Definition gtest.h:27
::testing::Types< std::tuple< std::complex< float >, ct::DEVICE_CPU >, std::tuple< std::complex< double >, ct::DEVICE_CPU > > ComplexTypes
Definition gtest.h:22
Definition allocator.h:6
A tag type for identifying CPU and GPU devices.
Definition tensor_types.h:68
Definition tensor_types.h:69