(git:374b731)
Loading...
Searching...
No Matches
opencl_utils.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* CP2K: A general program to perform molecular dynamics simulations */
3/* Copyright 2000-2024 CP2K developers group <https://cp2k.org> */
4/* */
5/* SPDX-License-Identifier: GPL-2.0-or-later */
6/*----------------------------------------------------------------------------*/
7
8/*******************************************************************************
9 * \author Arjun Ramaswami
10 ******************************************************************************/
11
12#ifndef OPENCL_UTILS_H
13#define OPENCL_UTILS_H
14
15#if defined(__PW_FPGA)
16
17extern void queue_cleanup();
18extern void cleanup();
19// Search for a platform that contains the search string
20// Returns platform id if found
21// Return NULL if none found
22cl_platform_id findPlatform(char *platform_name);
23
24// Search for a device based on the platform
25// Return array of device ids
26cl_device_id *getDevices(cl_platform_id pid, cl_device_type device_type,
27 cl_uint *num_devices);
28
29// OpenCL program created for all devices of the context with the same binary
30cl_program getProgramWithBinary(cl_context context, const cl_device_id *devices,
31 unsigned num_devices, int N[3],
32 char *data_path);
33
34void openCLContextCallBackFxn(const char *errinfo, const void *private_info,
35 size_t cb, void *user_data);
36
37void *alignedMalloc(size_t size);
38
39void printError(cl_int error);
40
41void _checkError(const char *file, int line, const char *func, cl_int err,
42 const char *msg, ...);
43
44#define checkError(status, ...) \
45 _checkError(__FILE__, __LINE__, __FUNCTION__, status, __VA_ARGS__)
46
47#endif
48
49#endif // OPENCL_UTILS_H