| 1 |
/* |
| 2 |
* (C) Copyright 2024- ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
#include <cstdlib> |
| 13 |
|
| 14 |
namespace atlas::acc { |
| 15 |
|
| 16 |
enum class CompilerId { |
| 17 |
unknown, |
| 18 |
nvidia, |
| 19 |
cray, |
| 20 |
}; |
| 21 |
|
| 22 |
int devices(); |
| 23 |
void map(void* host_data, void* device_data, std::size_t bytes); |
| 24 |
void unmap(void* host_data); |
| 25 |
bool is_present(void* host_data, std::size_t bytes); |
| 26 |
void* deviceptr(void* host_data); |
| 27 |
CompilerId compiler_id(); |
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
#if _OPENACC |
| 32 |
#define ATLAS_ACC_STR(x) #x |
| 33 |
#define ATLAS_ACC_STRINGIFY(x) ATLAS_ACC_STR(x) |
| 34 |
#define atlas_acc_pragma(x) _Pragma(ATLAS_ACC_STRINGIFY(x)) |
| 35 |
#else |
| 36 |
#define atlas_acc_pragma(x) |
| 37 |
#endif |