DFT-EFE
 
Loading...
Searching...
No Matches
DeviceExceptions.sycl.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2022 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16//
17#ifndef dftefeDeviceExceptions_syclh
18#define dftefeDeviceExceptions_syclh
19
20#include <iostream>
21#include <system_error>
22
23namespace dftefe
24{
25 namespace utils
26 {
27 // deviceError_t (std::error_code) is what every device API call site in
28 // this codebase passes here -- just check the code, nothing to wait on.
29 inline void
30 deviceApiCheck(const std::error_code &errorCode,
31 const char * func,
32 const char * file,
33 int line)
34 {
35 if (errorCode)
36 {
37 std::cerr << "SYCL error in " << func << " at " << file << ":" << line
38 << ". Error code: " << errorCode.message() << ".\n";
39 }
40 }
41 } // namespace utils
42} // namespace dftefe
43
44#define DEVICE_API_CHECK(x) \
45 dftefe::utils::deviceApiCheck(x, __func__, __FILE__, __LINE__)
46
47#define DEVICEBLAS_API_CHECK(expr) \
48 do \
49 { \
50 try \
51 { \
52 (void)(expr); \
53 } \
54 catch (sycl::exception const &__sycl_err) \
55 { \
56 std::printf("oneMKL enqueue error in %s at %s:%d: %s\n", \
57 __func__, \
58 __FILE__, \
59 __LINE__, \
60 __sycl_err.what()); \
61 } \
62 } \
63 while (0)
64
65#endif // dftefeDeviceExceptions_syclh
void deviceApiCheck(const std::error_code &errorCode, const char *func, const char *file, int line)
Definition: DeviceExceptions.sycl.h:30
dealii includes
Definition: AtomFieldDataSpherical.cpp:31