DFT-FE 1.3.0-pre
Density Functional Theory With Finite-Elements
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 dftfeDeviceExceptions_syclh
18#define dftfeDeviceExceptions_syclh
19
20#define DEVICE_API_CHECK(event) \
21 { \
22 try \
23 { \
24 event.wait(); \
25 } \
26 catch (const sycl::exception &e) \
27 { \
28 std::cerr << "SYCL error on or before line number" << __LINE__ \
29 << " in file: " << __FILE__ << ". Error code: " << e.what() \
30 << ".\n"; \
31 } \
32 }
33
34#define DEVICEBLAS_API_CHECK(expr) \
35 do \
36 { \
37 try \
38 { \
39 (void)(expr); \
40 } \
41 catch (sycl::exception const &__sycl_err) \
42 { \
43 std::printf("oneMKL enqueue error at %s:%d: %s\n", \
44 __FILE__, \
45 __LINE__, \
46 __sycl_err.what()); \
47 } \
48 } while (0)
49
50#endif // dftfeDeviceExceptions_syclh