QMCPACK
test_PlatformSelector.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2022 QMCPACK developers.
6 //
7 // File developed by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
8 //
9 // File created by: Ye Luo, yeluo@anl.gov, Argonne National Laboratory
10 //////////////////////////////////////////////////////////////////////////////////////
11 
12 #include "catch.hpp"
13 
14 #include "PlatformSelector.hpp"
15 #include <config.h>
16 
17 namespace qmcplusplus
18 {
19 TEST_CASE("PlatformSelector", "[platform]")
20 {
21  SECTION("CPU_OMPTARGET")
22  {
23 #if defined(ENABLE_OFFLOAD)
26 #else
29 #endif
33  }
34 
35  SECTION("CPU_OMPTARGET_CUDA")
36  {
37  using CPUOMPTargetCUDASelector = PlatformSelector<SelectorKind::CPU_OMPTARGET_CUDA>;
38 #if defined(ENABLE_CUDA)
39  CHECK(CPUOMPTargetCUDASelector::selectPlatform("yes") == PlatformKind::CUDA);
40  CHECK(CPUOMPTargetCUDASelector::selectPlatform("") == PlatformKind::CUDA);
41  CHECK(CPUOMPTargetCUDASelector::selectPlatform("cuda") == PlatformKind::CUDA);
42 #elif defined(ENABLE_OFFLOAD)
43  CHECK(CPUOMPTargetCUDASelector::selectPlatform("yes") == PlatformKind::OMPTARGET);
44  CHECK(CPUOMPTargetCUDASelector::selectPlatform("") == PlatformKind::OMPTARGET);
45 #else
46  CHECK(CPUOMPTargetCUDASelector::selectPlatform("yes") == PlatformKind::CPU);
47  CHECK(CPUOMPTargetCUDASelector::selectPlatform("") == PlatformKind::CPU);
48 #endif
49  CHECK(CPUOMPTargetCUDASelector::selectPlatform("omptarget") == PlatformKind::OMPTARGET);
50  CHECK(CPUOMPTargetCUDASelector::selectPlatform("cpu") == PlatformKind::CPU);
51  CHECK(CPUOMPTargetCUDASelector::selectPlatform("no") == PlatformKind::CPU);
52  }
53 
54  SECTION("CPU_OMPTARGET_SYCL")
55  {
56  using CPUOMPTargetSYCLSelector = PlatformSelector<SelectorKind::CPU_OMPTARGET_SYCL>;
57 #if defined(ENABLE_SYCL)
58  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("yes") == PlatformKind::SYCL);
59  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("") == PlatformKind::SYCL);
60  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("sycl") == PlatformKind::SYCL);
61 #elif defined(ENABLE_OFFLOAD)
62  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("yes") == PlatformKind::OMPTARGET);
63  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("") == PlatformKind::OMPTARGET);
64 #else
65  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("yes") == PlatformKind::CPU);
66  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("") == PlatformKind::CPU);
67 #endif
68  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("omptarget") == PlatformKind::OMPTARGET);
69  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("cpu") == PlatformKind::CPU);
70  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("no") == PlatformKind::CPU);
71  }
72 }
73 } // namespace qmcplusplus
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
TEST_CASE("complex_helper", "[type_traits]")
static PlatformKind selectPlatform(std::string_view value)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))