mirror of https://github.com/BOINC/boinc.git
Merge branch 'master' of ssh://boinc.berkeley.edu/boinc-v2
This commit is contained in:
commit
bf0087bda2
|
@ -10,4 +10,6 @@ endif
|
|||
|
||||
## other stuff to go into the distribution
|
||||
extradir = $(prefix)/share/boinc-server-maker/db
|
||||
dist_extra_DATA = constraints.sql schema.sql init_db
|
||||
dist_extra_DATA = constraints.sql schema.sql
|
||||
|
||||
dist_extra_SCRIPTS = init_db
|
||||
|
|
|
@ -26,6 +26,7 @@ libfcgi_sources = \
|
|||
md5_file.cpp \
|
||||
miofile.cpp \
|
||||
msg_log.cpp \
|
||||
opencl_boinc.cpp \
|
||||
parse.cpp \
|
||||
shmem.cpp \
|
||||
str_util.cpp \
|
||||
|
@ -53,6 +54,7 @@ generic_sources = \
|
|||
msg_log.cpp \
|
||||
network.cpp \
|
||||
notice.cpp \
|
||||
opencl_boinc.cpp \
|
||||
parse.cpp \
|
||||
prefs.cpp \
|
||||
procinfo.cpp \
|
||||
|
@ -120,6 +122,7 @@ pkginclude_HEADERS = \
|
|||
msg_log.h \
|
||||
network.h \
|
||||
notice.h \
|
||||
opencl_boinc.h \
|
||||
parse.h \
|
||||
prefs.h \
|
||||
procinfo.h \
|
||||
|
|
269
lib/coproc.cpp
269
lib/coproc.cpp
|
@ -123,62 +123,6 @@ void COPROC::write_request(MIOFILE& f) {
|
|||
);
|
||||
}
|
||||
|
||||
void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f, const char* tag, bool temp_file) {
|
||||
f.printf(
|
||||
" <%s>\n"
|
||||
" <name>%s</name>\n"
|
||||
" <vendor>%s</vendor>\n"
|
||||
" <vendor_id>%lu</vendor_id>\n"
|
||||
" <available>%d</available>\n"
|
||||
" <half_fp_config>%llu</half_fp_config>\n"
|
||||
" <single_fp_config>%llu</single_fp_config>\n"
|
||||
" <double_fp_config>%llu</double_fp_config>\n"
|
||||
" <endian_little>%d</endian_little>\n"
|
||||
" <execution_capabilities>%llu</execution_capabilities>\n"
|
||||
" <extensions>%s</extensions>\n"
|
||||
" <global_mem_size>%llu</global_mem_size>\n"
|
||||
" <local_mem_size>%llu</local_mem_size>\n"
|
||||
" <max_clock_frequency>%lu</max_clock_frequency>\n"
|
||||
" <max_compute_units>%lu</max_compute_units>\n"
|
||||
" <opencl_platform_version>%s</opencl_platform_version>\n"
|
||||
" <opencl_device_version>%s</opencl_device_version>\n"
|
||||
" <opencl_driver_version>%s</opencl_driver_version>\n",
|
||||
tag,
|
||||
name,
|
||||
vendor,
|
||||
vendor_id,
|
||||
available ? 1 : 0,
|
||||
half_fp_config,
|
||||
single_fp_config,
|
||||
double_fp_config,
|
||||
endian_little ? 1 : 0,
|
||||
execution_capabilities,
|
||||
extensions,
|
||||
global_mem_size,
|
||||
local_mem_size,
|
||||
max_clock_frequency,
|
||||
max_compute_units,
|
||||
opencl_platform_version,
|
||||
opencl_device_version,
|
||||
opencl_driver_version
|
||||
);
|
||||
if (temp_file) {
|
||||
f.printf(
|
||||
" <is_used>%d</is_used>\n"
|
||||
" <device_num>%d</device_num>\n"
|
||||
" <peak_flops>%f</peak_flops>\n"
|
||||
" <opencl_available_ram>%f</opencl_available_ram>\n"
|
||||
" <opencl_device_index>%d</opencl_device_index>\n",
|
||||
is_used,
|
||||
device_num,
|
||||
peak_flops,
|
||||
opencl_available_ram,
|
||||
opencl_device_index
|
||||
);
|
||||
}
|
||||
f.printf(" </%s>\n", tag);
|
||||
}
|
||||
|
||||
int COPROC::parse(XML_PARSER& xp) {
|
||||
char buf[256];
|
||||
strcpy(type, "");
|
||||
|
@ -210,179 +154,6 @@ int COPROC::parse(XML_PARSER& xp) {
|
|||
|
||||
#endif
|
||||
|
||||
int OPENCL_DEVICE_PROP::parse(XML_PARSER& xp, const char* end_tag) {
|
||||
int n;
|
||||
unsigned long long ull;
|
||||
|
||||
while (!xp.get_tag()) {
|
||||
if (xp.match_tag(end_tag)) {
|
||||
get_device_version_int();
|
||||
get_opencl_driver_revision();
|
||||
return 0;
|
||||
}
|
||||
if (xp.parse_str("name", name, sizeof(name))) continue;
|
||||
if (xp.parse_str("vendor", vendor, sizeof(vendor))) continue;
|
||||
if (xp.parse_ulonglong("vendor_id", ull)) {
|
||||
vendor_id = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("available", n)) {
|
||||
available = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("half_fp_config", ull)) {
|
||||
half_fp_config = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("single_fp_config", ull)) {
|
||||
single_fp_config = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("double_fp_config", ull)) {
|
||||
double_fp_config = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("endian_little", n)) {
|
||||
endian_little = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("execution_capabilities", ull)) {
|
||||
execution_capabilities = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("extensions",
|
||||
extensions,
|
||||
sizeof(extensions)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("global_mem_size", ull)) {
|
||||
global_mem_size = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("local_mem_size", ull)) {
|
||||
local_mem_size = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("max_clock_frequency", n)) {
|
||||
max_clock_frequency = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("max_compute_units", n)) {
|
||||
max_compute_units = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("opencl_platform_version",
|
||||
opencl_platform_version,
|
||||
sizeof(opencl_platform_version)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("opencl_device_version",
|
||||
opencl_device_version,
|
||||
sizeof(opencl_device_version)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("opencl_driver_version",
|
||||
opencl_driver_version,
|
||||
sizeof(opencl_driver_version)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The following are used only in the
|
||||
// COPROC_INFO_FILENAME temporary file
|
||||
if (xp.parse_int("is_used", n)) {
|
||||
is_used = (COPROC_USAGE)n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("device_num", n)) {
|
||||
device_num = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_double("peak_flops", peak_flops)) continue;
|
||||
if (xp.parse_double("opencl_available_ram", opencl_available_ram)) continue;
|
||||
if (xp.parse_int("opencl_device_index", n)) {
|
||||
opencl_device_index = n;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
int OPENCL_DEVICE_PROP::get_device_version_int() {
|
||||
int maj, min;
|
||||
int n = sscanf(
|
||||
opencl_device_version, "OpenCL %d.%d", &maj, &min
|
||||
);
|
||||
if (n != 2) {
|
||||
return ERR_NOT_FOUND;
|
||||
}
|
||||
opencl_device_version_int = 100*maj + min;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OPENCL_DEVICE_PROP::get_opencl_driver_revision() {
|
||||
// gets the OpenCL runtime revision
|
||||
// Thus far this is only necessary for ATI/AMD because there are bad
|
||||
// driver sets only distinguisable by the runtime library version.
|
||||
// Fortunately this info is in the opencl_device_version string.
|
||||
float rev=0;
|
||||
char *p=opencl_device_version+sizeof(opencl_device_version)-1;
|
||||
// find the last opening bracket
|
||||
while ((p > opencl_device_version) && (*p!='(')) p--;
|
||||
if (p!=opencl_device_version) {
|
||||
int n=sscanf(
|
||||
p, "(%f", &rev
|
||||
);
|
||||
// I don't care about errors because for non-ATI GPUs this should
|
||||
// be zero.
|
||||
if (n!=1) {
|
||||
rev=0;
|
||||
}
|
||||
}
|
||||
opencl_driver_revision=floor(rev*100+0.5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OPENCL_DEVICE_PROP::description(char* buf, int buflen, const char* type) {
|
||||
char s1[256], s2[256];
|
||||
int n;
|
||||
// openCL_device_version may have a trailing space
|
||||
strlcpy(s1, opencl_device_version, sizeof(s1));
|
||||
n = (int)strlen(s1) - 1;
|
||||
if ((n > 0) && (s1[n] == ' ')) s1[n] = '\0';
|
||||
snprintf(s2, sizeof(s2),
|
||||
"%s (driver version %s, device version %s, %.0fMB, %.0fMB available, %.0f GFLOPS peak)",
|
||||
name, opencl_driver_version,
|
||||
s1, global_mem_size/MEGA,
|
||||
opencl_available_ram/MEGA, peak_flops/1.e9
|
||||
);
|
||||
|
||||
switch(is_used) {
|
||||
case COPROC_IGNORED:
|
||||
snprintf(buf, buflen,
|
||||
"OpenCL: %s %d (ignored by config): %s",
|
||||
type, device_num, s2
|
||||
);
|
||||
break;
|
||||
case COPROC_USED:
|
||||
snprintf(buf, buflen,
|
||||
"OpenCL: %s %d: %s",
|
||||
type, device_num, s2
|
||||
);
|
||||
break;
|
||||
case COPROC_UNUSED:
|
||||
default:
|
||||
snprintf(buf, buflen,
|
||||
"OpenCL: %s %d (not used): %s",
|
||||
type, device_num, s2
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void COPROCS::summary_string(char* buf, int len) {
|
||||
char buf2[1024];
|
||||
|
||||
|
@ -1104,46 +875,6 @@ void COPROC_INTEL::fake(double ram, double avail_ram, int n) {
|
|||
opencl_prop.global_mem_size = (cl_ulong)ram;
|
||||
}
|
||||
|
||||
////////////////// OPENCL CPU STARTS HERE /////////////////
|
||||
|
||||
|
||||
// CPU OpenCL does not really describe a coprocessor but
|
||||
// this is here to take advantage of the other OpenCL code.
|
||||
void OPENCL_CPU_PROP::clear() {
|
||||
platform_vendor[0] = 0;
|
||||
memset(&opencl_prop, 0, sizeof(opencl_prop));
|
||||
}
|
||||
|
||||
void OPENCL_CPU_PROP::write_xml(MIOFILE& f) {
|
||||
f.printf(
|
||||
"<opencl_cpu_prop>\n"
|
||||
" <platform_vendor>%s</platform_vendor>\n",
|
||||
platform_vendor
|
||||
);
|
||||
opencl_prop.write_xml(f, "opencl_cpu_info");
|
||||
f.printf("</opencl_cpu_prop>\n");
|
||||
}
|
||||
|
||||
int OPENCL_CPU_PROP::parse(XML_PARSER& xp) {
|
||||
int retval;
|
||||
|
||||
clear();
|
||||
|
||||
while (!xp.get_tag()) {
|
||||
if (xp.match_tag("/opencl_cpu_prop")) {
|
||||
if (!strlen(platform_vendor)) return ERR_XML_PARSE;
|
||||
return 0;
|
||||
}
|
||||
if (xp.parse_str("platform_vendor", platform_vendor, sizeof(platform_vendor))) continue;
|
||||
if (xp.match_tag("opencl_cpu_info")) {
|
||||
retval = opencl_prop.parse(xp, "/opencl_cpu_info");
|
||||
if (retval) return retval;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
// used wherever a processor type is specified in XML, e.g.
|
||||
// <coproc>
|
||||
// <type>xxx</type>
|
||||
|
|
66
lib/coproc.h
66
lib/coproc.h
|
@ -78,6 +78,7 @@
|
|||
#include "parse.h"
|
||||
#include "cal_boinc.h"
|
||||
#include "cl_boinc.h"
|
||||
#include "opencl_boinc.h"
|
||||
|
||||
#define DEFER_ON_GPU_AVAIL_RAM 0
|
||||
|
||||
|
@ -85,9 +86,6 @@
|
|||
#define MAX_RSC 8
|
||||
// max # of processing resources types
|
||||
|
||||
#define MAX_OPENCL_PLATFORMS 16
|
||||
#define MAX_OPENCL_CPU_PLATFORMS 4
|
||||
|
||||
// arguments to proc_type_name() and proc_type_name_xml().
|
||||
//
|
||||
#define PROC_TYPE_CPU 0
|
||||
|
@ -106,13 +104,6 @@ extern const char* proc_type_name_xml(int);
|
|||
#define GPU_TYPE_ATI proc_type_name_xml(PROC_TYPE_AMD_GPU)
|
||||
#define GPU_TYPE_INTEL proc_type_name_xml(PROC_TYPE_INTEL_GPU)
|
||||
|
||||
enum COPROC_USAGE {
|
||||
COPROC_IGNORED,
|
||||
COPROC_UNUSED,
|
||||
COPROC_USED
|
||||
};
|
||||
|
||||
|
||||
// represents a requirement for a coproc.
|
||||
// This is a parsed version of the <coproc> elements in an <app_version>
|
||||
// (used in client only)
|
||||
|
@ -133,45 +124,6 @@ struct PCI_INFO {
|
|||
int parse(XML_PARSER&);
|
||||
};
|
||||
|
||||
// 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.)
|
||||
cl_uint vendor_id; // OpenCL ID of device vendor
|
||||
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;
|
||||
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
|
||||
int opencl_device_index; // temp used in scan process
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
// represents a set of identical coprocessors on a particular computer.
|
||||
// Abstract class;
|
||||
|
@ -527,20 +479,4 @@ struct COPROCS {
|
|||
}
|
||||
};
|
||||
|
||||
// NOTE: OpenCL has only 64 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&);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,314 @@
|
|||
// 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/>.
|
||||
|
||||
#if defined(_WIN32) && !defined(__STDWX_H__)
|
||||
#include "boinc_win.h"
|
||||
#elif defined(_WIN32) && defined(__STDWX_H__)
|
||||
#include "stdwx.h"
|
||||
#else
|
||||
#ifdef _USING_FCGI_
|
||||
#include "boinc_fcgi.h"
|
||||
#else
|
||||
#include <cstdio>
|
||||
#endif
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "win_util.h"
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#endif
|
||||
#include "miofile.h"
|
||||
#include "parse.h"
|
||||
#include "str_replace.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "opencl_boinc.h"
|
||||
|
||||
void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f, const char* tag, bool temp_file) {
|
||||
f.printf(
|
||||
" <%s>\n"
|
||||
" <name>%s</name>\n"
|
||||
" <vendor>%s</vendor>\n"
|
||||
" <vendor_id>%lu</vendor_id>\n"
|
||||
" <available>%d</available>\n"
|
||||
" <half_fp_config>%llu</half_fp_config>\n"
|
||||
" <single_fp_config>%llu</single_fp_config>\n"
|
||||
" <double_fp_config>%llu</double_fp_config>\n"
|
||||
" <endian_little>%d</endian_little>\n"
|
||||
" <execution_capabilities>%llu</execution_capabilities>\n"
|
||||
" <extensions>%s</extensions>\n"
|
||||
" <global_mem_size>%llu</global_mem_size>\n"
|
||||
" <local_mem_size>%llu</local_mem_size>\n"
|
||||
" <max_clock_frequency>%lu</max_clock_frequency>\n"
|
||||
" <max_compute_units>%lu</max_compute_units>\n"
|
||||
" <opencl_platform_version>%s</opencl_platform_version>\n"
|
||||
" <opencl_device_version>%s</opencl_device_version>\n"
|
||||
" <opencl_driver_version>%s</opencl_driver_version>\n",
|
||||
tag,
|
||||
name,
|
||||
vendor,
|
||||
vendor_id,
|
||||
available ? 1 : 0,
|
||||
half_fp_config,
|
||||
single_fp_config,
|
||||
double_fp_config,
|
||||
endian_little ? 1 : 0,
|
||||
execution_capabilities,
|
||||
extensions,
|
||||
global_mem_size,
|
||||
local_mem_size,
|
||||
max_clock_frequency,
|
||||
max_compute_units,
|
||||
opencl_platform_version,
|
||||
opencl_device_version,
|
||||
opencl_driver_version
|
||||
);
|
||||
if (temp_file) {
|
||||
f.printf(
|
||||
" <is_used>%d</is_used>\n"
|
||||
" <device_num>%d</device_num>\n"
|
||||
" <peak_flops>%f</peak_flops>\n"
|
||||
" <opencl_available_ram>%f</opencl_available_ram>\n"
|
||||
" <opencl_device_index>%d</opencl_device_index>\n",
|
||||
is_used,
|
||||
device_num,
|
||||
peak_flops,
|
||||
opencl_available_ram,
|
||||
opencl_device_index
|
||||
);
|
||||
}
|
||||
f.printf(" </%s>\n", tag);
|
||||
}
|
||||
|
||||
int OPENCL_DEVICE_PROP::parse(XML_PARSER& xp, const char* end_tag) {
|
||||
int n;
|
||||
unsigned long long ull;
|
||||
|
||||
while (!xp.get_tag()) {
|
||||
if (xp.match_tag(end_tag)) {
|
||||
get_device_version_int();
|
||||
get_opencl_driver_revision();
|
||||
return 0;
|
||||
}
|
||||
if (xp.parse_str("name", name, sizeof(name))) continue;
|
||||
if (xp.parse_str("vendor", vendor, sizeof(vendor))) continue;
|
||||
if (xp.parse_ulonglong("vendor_id", ull)) {
|
||||
vendor_id = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("available", n)) {
|
||||
available = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("half_fp_config", ull)) {
|
||||
half_fp_config = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("single_fp_config", ull)) {
|
||||
single_fp_config = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("double_fp_config", ull)) {
|
||||
double_fp_config = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("endian_little", n)) {
|
||||
endian_little = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("execution_capabilities", ull)) {
|
||||
execution_capabilities = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("extensions",
|
||||
extensions,
|
||||
sizeof(extensions)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("global_mem_size", ull)) {
|
||||
global_mem_size = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_ulonglong("local_mem_size", ull)) {
|
||||
local_mem_size = ull;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("max_clock_frequency", n)) {
|
||||
max_clock_frequency = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("max_compute_units", n)) {
|
||||
max_compute_units = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("opencl_platform_version",
|
||||
opencl_platform_version,
|
||||
sizeof(opencl_platform_version)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("opencl_device_version",
|
||||
opencl_device_version,
|
||||
sizeof(opencl_device_version)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_str("opencl_driver_version",
|
||||
opencl_driver_version,
|
||||
sizeof(opencl_driver_version)
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The following are used only in the
|
||||
// COPROC_INFO_FILENAME temporary file
|
||||
if (xp.parse_int("is_used", n)) {
|
||||
is_used = (COPROC_USAGE)n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_int("device_num", n)) {
|
||||
device_num = n;
|
||||
continue;
|
||||
}
|
||||
if (xp.parse_double("peak_flops", peak_flops)) continue;
|
||||
if (xp.parse_double("opencl_available_ram", opencl_available_ram)) continue;
|
||||
if (xp.parse_int("opencl_device_index", n)) {
|
||||
opencl_device_index = n;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
||||
int OPENCL_DEVICE_PROP::get_device_version_int() {
|
||||
int maj, min;
|
||||
int n = sscanf(
|
||||
opencl_device_version, "OpenCL %d.%d", &maj, &min
|
||||
);
|
||||
if (n != 2) {
|
||||
return ERR_NOT_FOUND;
|
||||
}
|
||||
opencl_device_version_int = 100*maj + min;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OPENCL_DEVICE_PROP::get_opencl_driver_revision() {
|
||||
// gets the OpenCL runtime revision
|
||||
// Thus far this is only necessary for ATI/AMD because there are bad
|
||||
// driver sets only distinguisable by the runtime library version.
|
||||
// Fortunately this info is in the opencl_device_version string.
|
||||
float rev=0;
|
||||
char *p=opencl_device_version+sizeof(opencl_device_version)-1;
|
||||
// find the last opening bracket
|
||||
while ((p > opencl_device_version) && (*p!='(')) p--;
|
||||
if (p!=opencl_device_version) {
|
||||
int n=sscanf(
|
||||
p, "(%f", &rev
|
||||
);
|
||||
// I don't care about errors because for non-ATI GPUs this should
|
||||
// be zero.
|
||||
if (n!=1) {
|
||||
rev=0;
|
||||
}
|
||||
}
|
||||
opencl_driver_revision=floor(rev*100+0.5);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OPENCL_DEVICE_PROP::description(char* buf, int buflen, const char* type) {
|
||||
char s1[256], s2[256];
|
||||
int n;
|
||||
// openCL_device_version may have a trailing space
|
||||
strlcpy(s1, opencl_device_version, sizeof(s1));
|
||||
n = (int)strlen(s1) - 1;
|
||||
if ((n > 0) && (s1[n] == ' ')) s1[n] = '\0';
|
||||
snprintf(s2, sizeof(s2),
|
||||
"%s (driver version %s, device version %s, %.0fMB, %.0fMB available, %.0f GFLOPS peak)",
|
||||
name, opencl_driver_version,
|
||||
s1, global_mem_size/MEGA,
|
||||
opencl_available_ram/MEGA, peak_flops/1.e9
|
||||
);
|
||||
|
||||
switch(is_used) {
|
||||
case COPROC_IGNORED:
|
||||
snprintf(buf, buflen,
|
||||
"OpenCL: %s %d (ignored by config): %s",
|
||||
type, device_num, s2
|
||||
);
|
||||
break;
|
||||
case COPROC_USED:
|
||||
snprintf(buf, buflen,
|
||||
"OpenCL: %s %d: %s",
|
||||
type, device_num, s2
|
||||
);
|
||||
break;
|
||||
case COPROC_UNUSED:
|
||||
default:
|
||||
snprintf(buf, buflen,
|
||||
"OpenCL: %s %d (not used): %s",
|
||||
type, device_num, s2
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////// OPENCL CPU STARTS HERE /////////////////
|
||||
|
||||
|
||||
// CPU OpenCL does not really describe a coprocessor but
|
||||
// this is here to take advantage of the other OpenCL code.
|
||||
void OPENCL_CPU_PROP::clear() {
|
||||
platform_vendor[0] = 0;
|
||||
memset(&opencl_prop, 0, sizeof(opencl_prop));
|
||||
}
|
||||
|
||||
void OPENCL_CPU_PROP::write_xml(MIOFILE& f) {
|
||||
f.printf(
|
||||
"<opencl_cpu_prop>\n"
|
||||
" <platform_vendor>%s</platform_vendor>\n",
|
||||
platform_vendor
|
||||
);
|
||||
opencl_prop.write_xml(f, "opencl_cpu_info");
|
||||
f.printf("</opencl_cpu_prop>\n");
|
||||
}
|
||||
|
||||
int OPENCL_CPU_PROP::parse(XML_PARSER& xp) {
|
||||
int retval;
|
||||
|
||||
clear();
|
||||
|
||||
while (!xp.get_tag()) {
|
||||
if (xp.match_tag("/opencl_cpu_prop")) {
|
||||
if (!strlen(platform_vendor)) return ERR_XML_PARSE;
|
||||
return 0;
|
||||
}
|
||||
if (xp.parse_str("platform_vendor", platform_vendor, sizeof(platform_vendor))) continue;
|
||||
if (xp.match_tag("opencl_cpu_info")) {
|
||||
retval = opencl_prop.parse(xp, "/opencl_cpu_info");
|
||||
if (retval) return retval;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
// 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/>.
|
||||
|
||||
|
||||
#include "cl_boinc.h"
|
||||
|
||||
#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.)
|
||||
cl_uint vendor_id; // OpenCL ID of device vendor
|
||||
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;
|
||||
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
|
||||
int opencl_device_index; // temp used in scan process
|
||||
|
||||
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&);
|
||||
|
||||
};
|
|
@ -21,7 +21,7 @@ locale_dirs = \
|
|||
gl \
|
||||
hr \
|
||||
hu \
|
||||
it \
|
||||
it_IT \
|
||||
ja \
|
||||
ko \
|
||||
lt \
|
||||
|
|
|
@ -116,7 +116,7 @@ schedshare_PROGRAMS = \
|
|||
sample_trivial_validator \
|
||||
sample_work_generator \
|
||||
single_job_assimilator \
|
||||
size_regulator \
|
||||
size_regulator \
|
||||
transitioner \
|
||||
trickle_credit \
|
||||
trickle_deadline \
|
||||
|
@ -130,11 +130,10 @@ schedcgi_PROGRAMS= \
|
|||
schedshare_DATA = \
|
||||
db_dump_spec.xml \
|
||||
assimilator.py \
|
||||
pymw_assimilator.py \
|
||||
transitioner_catchup.php
|
||||
pymw_assimilator.py
|
||||
|
||||
# scripts that 'make install' should put in bindir
|
||||
schedshare_SCRIPTS = start stop status
|
||||
schedshare_SCRIPTS = start stop status transitioner_catchup.php
|
||||
|
||||
noinst_HEADERS = \
|
||||
assimilate_handler.h \
|
||||
|
|
|
@ -168,7 +168,7 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
argv[j] = 0;
|
||||
retval = handle_trickle_init(argc, argv);
|
||||
retval = handle_trickle_init(j, argv);
|
||||
if (retval) exit(1);
|
||||
|
||||
log_messages.printf(MSG_NORMAL, "Starting trickle handler\n");
|
||||
|
|
|
@ -31,7 +31,9 @@ dist_tools_SCRIPTS = \
|
|||
manage_privileges \
|
||||
run_in_ops \
|
||||
stage_file \
|
||||
watch_tcp \
|
||||
watch_tcp
|
||||
|
||||
dist_tools_DATA = \
|
||||
project.xml
|
||||
|
||||
AM_CXXFLAGS += $(MYSQL_CFLAGS)
|
||||
|
|
|
@ -622,6 +622,10 @@
|
|||
RelativePath="..\lib\notice.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.cpp"
|
||||
>
|
||||
|
@ -683,6 +687,10 @@
|
|||
RelativePath="..\lib\cc_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\coproc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\diagnostics.h"
|
||||
>
|
||||
|
@ -723,6 +731,10 @@
|
|||
RelativePath="..\lib\notice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.h"
|
||||
>
|
||||
|
|
|
@ -973,6 +973,10 @@
|
|||
RelativePath="..\lib\notice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.cpp"
|
||||
>
|
||||
|
|
|
@ -416,6 +416,10 @@
|
|||
RelativePath="..\lib\notice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.h"
|
||||
>
|
||||
|
@ -904,6 +908,10 @@
|
|||
RelativePath="..\lib\notice.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.cpp"
|
||||
>
|
||||
|
|
|
@ -720,6 +720,10 @@
|
|||
RelativePath="..\lib\notice.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.cpp"
|
||||
>
|
||||
|
@ -1078,6 +1082,10 @@
|
|||
RelativePath="..\lib\notice.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\opencl_boinc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\lib\parse.h"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue