ccubes-cl/cl_setup.h

52 lines
1.7 KiB
C
Raw Normal View History

2025-03-26 11:50:07 +02:00
/*
* Copyright (c) 2011-2016, 2025 Paul Irofti <paul@irofti.net>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
2025-03-20 19:32:25 +02:00
#ifndef SETUP_H__
#define SETUP_H__
#define CL_TARGET_OPENCL_VERSION 220 /* For Sinaia cluster */
#include <CL/cl.h>
/*
* OpenCL user context.
*/
struct cl_uctx {
cl_context ctx; /* internal context */
cl_device_id *devices; /* device in use */
cl_command_queue gpu_queue; /* command queue */
cl_command_queue cpu_queue; /* command queue */
cl_device_type device_type; /* desired device type */
char platform_name[100]; /* desired platform */
size_t reduce_gws, reduce_lws; /* norm global and local workspace */
/* BLAS kernels */
cl_kernel gemm_NN_kernel, gemm_TN_kernel;
cl_kernel frob_stage1_kernel, frob_stage2_kernel;
};
cl_int cl_init(struct cl_uctx *uctx);
void cl_clean_up(struct cl_uctx uctx);
cl_int cl_build(struct cl_uctx uctx, cl_device_type dev, char *kern_name,
cl_program *pprogram);
cl_int cl_get_kern(cl_program program, char *kname, cl_kernel *pkern);
#endif