2013-08-25 21:13:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2013 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2013-08-27 06:32:32 +00:00
|
|
|
#ifndef OPENCL_BOINC_H
|
|
|
|
#define OPENCL_BOINC_H
|
2013-08-25 21:13:14 +00:00
|
|
|
|
|
|
|
#include "cl_boinc.h"
|
2013-08-27 06:32:32 +00:00
|
|
|
#include "miofile.h"
|
|
|
|
#include "parse.h"
|
2013-08-25 21:13:14 +00:00
|
|
|
|
|
|
|
#define MAX_OPENCL_PLATFORMS 16
|
|
|
|
#define MAX_OPENCL_CPU_PLATFORMS 4
|
|
|
|
|
|
|
|
enum COPROC_USAGE {
|
|
|
|
COPROC_IGNORED,
|
|
|
|
COPROC_UNUSED,
|
|
|
|
COPROC_USED
|
|
|
|
};
|
|
|
|
|
|
|
|
// there's some duplication between the values in
|
|
|
|
// the OPENCL_DEVICE_PROP struct and the NVIDIA/ATI structs
|
|
|
|
//
|
|
|
|
struct OPENCL_DEVICE_PROP {
|
|
|
|
cl_device_id device_id;
|
|
|
|
char name[256]; // Device name
|
|
|
|
char vendor[256]; // Device vendor (NVIDIA, ATI, AMD, etc.)
|
2014-07-23 12:18:51 +00:00
|
|
|
cl_uint vendor_id; // Vendor's unique ID for this device on this host
|
2013-08-25 21:13:14 +00:00
|
|
|
cl_bool available; // Is this device available?
|
|
|
|
cl_device_fp_config half_fp_config; // Half precision capabilities
|
|
|
|
cl_device_fp_config single_fp_config; // Single precision
|
|
|
|
cl_device_fp_config double_fp_config; // Double precision
|
|
|
|
cl_bool endian_little; // TRUE if little-endian
|
|
|
|
cl_device_exec_capabilities execution_capabilities;
|
|
|
|
char extensions[1024]; // List of device extensions
|
|
|
|
cl_ulong global_mem_size; // in bytes (OpenCL can report 4GB Max)
|
|
|
|
cl_ulong local_mem_size;
|
|
|
|
cl_uint max_clock_frequency; // in MHz
|
|
|
|
cl_uint max_compute_units;
|
2016-01-07 06:01:51 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// cl_nv_device_attribute_query
|
|
|
|
//
|
2016-01-08 00:33:28 +00:00
|
|
|
cl_uint nv_compute_capability_major;
|
|
|
|
cl_uint nv_compute_capability_minor;
|
2016-01-07 06:01:51 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// cl_amd_device_attribute_query
|
|
|
|
//
|
|
|
|
cl_uint amd_simd_per_compute_unit;
|
|
|
|
cl_uint amd_simd_width;
|
|
|
|
cl_uint amd_simd_instruction_width;
|
|
|
|
|
2013-08-25 21:13:14 +00:00
|
|
|
char opencl_platform_version[64]; // Version of OpenCL supported
|
|
|
|
// the device's platform
|
|
|
|
char opencl_device_version[64]; // OpenCL version supported by device;
|
|
|
|
// example: "OpenCL 1.1 beta"
|
|
|
|
int opencl_device_version_int; // same, encoded as e.g. 101
|
|
|
|
int get_device_version_int(); // call this to encode
|
|
|
|
int opencl_driver_revision; // OpenCL runtime revision is available
|
|
|
|
int get_opencl_driver_revision(); // call this to encode
|
|
|
|
char opencl_driver_version[32]; // For example: "CLH 1.0"
|
|
|
|
int device_num; // temp used in scan process
|
|
|
|
double peak_flops; // temp used in scan process
|
|
|
|
COPROC_USAGE is_used; // temp used in scan process
|
|
|
|
double opencl_available_ram; // temp used in scan process
|
2014-09-22 11:57:23 +00:00
|
|
|
int opencl_device_index; // zero-based device number within this OpenCL platform
|
2014-10-26 11:12:01 +00:00
|
|
|
bool warn_bad_cuda; // If true, warn we can't use GPU due to CUDA version
|
2013-08-25 21:13:14 +00:00
|
|
|
|
|
|
|
void write_xml(MIOFILE&, const char* tag, bool temp_file=false);
|
|
|
|
int parse(XML_PARSER&, const char* end_tag);
|
|
|
|
void description(char* buf, int buflen, const char* type);
|
|
|
|
};
|
|
|
|
|
|
|
|
// NOTE: OpenCL has only 32 bits for global_mem_size, so
|
|
|
|
// it can report a max of only 4GB.
|
|
|
|
// Get the CPU RAM size from gstate.hostinfo.m_nbytes.
|
|
|
|
//
|
|
|
|
struct OPENCL_CPU_PROP {
|
|
|
|
char platform_vendor[256];
|
|
|
|
OPENCL_DEVICE_PROP opencl_prop;
|
|
|
|
|
|
|
|
OPENCL_CPU_PROP() {
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
void clear();
|
|
|
|
void write_xml(MIOFILE&);
|
|
|
|
int parse(XML_PARSER&);
|
2013-10-11 10:47:56 +00:00
|
|
|
void description(char* buf, int buflen);
|
2013-08-25 21:13:14 +00:00
|
|
|
};
|
2013-08-27 06:32:32 +00:00
|
|
|
|
|
|
|
#endif
|