-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdevice.cpp
More file actions
33 lines (27 loc) · 886 Bytes
/
device.cpp
File metadata and controls
33 lines (27 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-FileCopyrightText: 2020 SeisSol Group
//
// SPDX-License-Identifier: BSD-3-Clause
#include "device.h"
#ifdef DEVICE_LANG_CUDA
#include "interfaces/cuda/CudaWrappedAPI.h"
#elif DEVICE_LANG_HIP
#include "interfaces/hip/HipWrappedAPI.h"
#elif DEVICE_LANG_SYCL
#include "interfaces/sycl/SyclWrappedAPI.h"
#else
#error "Unknown interface for the device wrapper"
#endif
using namespace device;
DeviceInstance::DeviceInstance() {
// NOTE: all headers inside of macros define their unique ConcreteInterface.
// Make sure to not include multiple different interfaces at the same time.
// Only one interface is allowed per program because of issues of unique compilers, etc.
api = new ConcreteAPI;
algorithms.setDeviceApi(api);
}
DeviceInstance::~DeviceInstance() {
this->finalize();
delete api;
api = nullptr;
}
void DeviceInstance::finalize() { api->finalize(); }