2010-05-18 19:22:34 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2007 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>
|
|
|
|
#endif
|
|
|
|
|
2011-08-31 11:10:22 +00:00
|
|
|
|
2010-05-18 19:22:34 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include "win_util.h"
|
2011-08-31 11:10:22 +00:00
|
|
|
#else
|
|
|
|
#ifdef __APPLE__
|
|
|
|
// Suppress obsolete warning when building for OS 10.3.9
|
|
|
|
#define DLOPEN_NO_WARN
|
|
|
|
#include <mach-o/dyld.h>
|
|
|
|
#endif
|
|
|
|
#include "config.h"
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <signal.h>
|
2010-05-18 19:22:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "error_numbers.h"
|
|
|
|
#include "filesys.h"
|
|
|
|
#include "parse.h"
|
2011-10-04 03:33:04 +00:00
|
|
|
#include "str_replace.h"
|
2010-10-27 22:58:16 +00:00
|
|
|
#include "util.h"
|
2010-05-18 19:22:34 +00:00
|
|
|
|
|
|
|
#include "coproc.h"
|
|
|
|
|
|
|
|
#ifndef _USING_FCGI_
|
|
|
|
using std::perror;
|
|
|
|
#endif
|
|
|
|
|
2011-08-09 21:44:14 +00:00
|
|
|
int COPROC_REQ::parse(XML_PARSER& xp) {
|
2010-05-18 19:22:34 +00:00
|
|
|
strcpy(type, "");
|
|
|
|
count = 0;
|
2011-09-15 04:24:40 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (xp.match_tag("/coproc")) {
|
2010-05-18 19:22:34 +00:00
|
|
|
if (!strlen(type)) return ERR_XML_PARSE;
|
|
|
|
return 0;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_str("type", type, sizeof(type))) continue;
|
|
|
|
if (xp.parse_double("count", count)) continue;
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2010-09-30 22:28:19 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2011-03-31 15:34:05 +00:00
|
|
|
|
|
|
|
void COPROC::write_xml(MIOFILE& f) {
|
|
|
|
f.printf(
|
|
|
|
"<coproc>\n"
|
|
|
|
" <type>%s</type>\n"
|
|
|
|
" <count>%d</count>\n"
|
|
|
|
"</coproc>\n",
|
|
|
|
type, count
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-09-23 20:54:49 +00:00
|
|
|
void COPROC::write_request(MIOFILE& f) {
|
|
|
|
f.printf(
|
|
|
|
" <req_secs>%f</req_secs>\n"
|
|
|
|
" <req_instances>%f</req_instances>\n"
|
|
|
|
" <estimated_delay>%f</estimated_delay>\n",
|
|
|
|
req_secs,
|
|
|
|
req_instances,
|
|
|
|
estimated_delay
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-10-10 07:09:24 +00:00
|
|
|
void OPENCL_DEVICE_PROP::write_xml(MIOFILE& f) {
|
2011-08-23 11:29:11 +00:00
|
|
|
f.printf(
|
|
|
|
" <coproc_opencl>\n"
|
|
|
|
" <name>%s</name>\n"
|
|
|
|
" <vendor>%s</vendor>\n"
|
|
|
|
" <vendor_id>%lu</vendor_id>\n"
|
|
|
|
" <available>%d</available>\n"
|
2011-10-07 18:11:52 +00:00
|
|
|
" <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"
|
2011-08-23 11:29:11 +00:00
|
|
|
" <extensions>%s</extensions>\n"
|
2011-10-07 18:11:52 +00:00
|
|
|
" <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"
|
2011-08-23 11:29:11 +00:00
|
|
|
" </coproc_opencl>\n",
|
2011-10-10 07:09:24 +00:00
|
|
|
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
|
2011-08-23 11:29:11 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-03-25 03:44:09 +00:00
|
|
|
int COPROC::parse(XML_PARSER& xp) {
|
2011-08-10 17:11:08 +00:00
|
|
|
char buf[256];
|
2011-03-25 03:44:09 +00:00
|
|
|
strcpy(type, "");
|
|
|
|
clear();
|
|
|
|
for (int i=0; i<MAX_COPROC_INSTANCES; i++) {
|
|
|
|
device_nums[i] = i;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (!xp.is_tag) continue;
|
|
|
|
if (xp.match_tag("/coproc")) {
|
2011-03-25 03:44:09 +00:00
|
|
|
if (!strlen(type)) return ERR_XML_PARSE;
|
|
|
|
return 0;
|
|
|
|
}
|
2011-08-10 17:11:08 +00:00
|
|
|
if (xp.parse_str("type", type, sizeof(type))) continue;
|
|
|
|
if (xp.parse_int("count", count)) continue;
|
|
|
|
if (xp.parse_double("peak_flops", peak_flops)) continue;
|
|
|
|
if (xp.parse_str("device_nums", buf, sizeof(buf))) {
|
2011-03-25 03:44:09 +00:00
|
|
|
int i=0;
|
|
|
|
char* p = strtok(buf, " ");
|
|
|
|
while (p && i<MAX_COPROC_INSTANCES) {
|
|
|
|
device_nums[i++] = atoi(p);
|
|
|
|
p = strtok(NULL, " ");
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2011-08-25 08:32:56 +00:00
|
|
|
#endif
|
|
|
|
|
2011-10-10 07:09:24 +00:00
|
|
|
int OPENCL_DEVICE_PROP::parse(XML_PARSER& xp) {
|
2011-08-23 11:29:11 +00:00
|
|
|
int n;
|
2011-09-15 04:24:40 +00:00
|
|
|
unsigned long long ull;
|
2011-08-23 11:29:11 +00:00
|
|
|
|
2011-09-15 04:24:40 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (xp.match_tag("/coproc_opencl")) {
|
2011-10-10 07:09:24 +00:00
|
|
|
get_device_version_int();
|
2011-08-23 11:29:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-10-10 07:09:24 +00:00
|
|
|
if (xp.parse_str("name", name, sizeof(name))) continue;
|
|
|
|
if (xp.parse_str("vendor", vendor, sizeof(vendor))) continue;
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("available", n)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
available = n;
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_ulonglong("half_fp_config", ull)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
half_fp_config = ull;
|
2011-09-15 04:24:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_ulonglong("single_fp_config", ull)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
single_fp_config = ull;
|
2011-09-15 04:24:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_ulonglong("double_fp_config", ull)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
double_fp_config = ull;
|
2011-09-15 04:24:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_int("endian_little", n)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
endian_little = n;
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_ulonglong("execution_capabilities", ull)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
execution_capabilities = ull;
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_str("extensions",
|
2011-10-10 07:09:24 +00:00
|
|
|
extensions,
|
|
|
|
sizeof(extensions)
|
2011-09-15 04:24:40 +00:00
|
|
|
)) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_ulonglong("global_mem_size", ull)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
global_mem_size = ull;
|
2011-09-15 04:24:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_ulonglong("local_mem_size", ull)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
local_mem_size = ull;
|
2011-09-15 04:24:40 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_int("max_clock_frequency", n)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
max_clock_frequency = n;
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_int("max_compute_units", n)) {
|
2011-10-10 07:09:24 +00:00
|
|
|
max_compute_units = n;
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_str("opencl_platform_version",
|
2011-10-10 07:09:24 +00:00
|
|
|
opencl_platform_version,
|
|
|
|
sizeof(opencl_platform_version)
|
2011-09-15 04:24:40 +00:00
|
|
|
)) {
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_str("opencl_device_version",
|
2011-10-10 07:09:24 +00:00
|
|
|
opencl_device_version,
|
|
|
|
sizeof(opencl_device_version)
|
2011-09-15 04:24:40 +00:00
|
|
|
)) {
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-10-07 18:11:52 +00:00
|
|
|
if (xp.parse_str("opencl_driver_version",
|
2011-10-10 07:09:24 +00:00
|
|
|
opencl_driver_version,
|
|
|
|
sizeof(opencl_driver_version)
|
2011-09-15 04:24:40 +00:00
|
|
|
)) {
|
2011-08-23 11:29:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2011-10-08 06:33:39 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-10-11 17:41:10 +00:00
|
|
|
void OPENCL_DEVICE_PROP::description(char* buf, const char* type) {
|
2011-10-10 11:50:00 +00:00
|
|
|
char s1[256], s2[256];
|
2011-10-07 11:45:44 +00:00
|
|
|
int n;
|
|
|
|
// openCL_device_version may have a trailing space
|
2011-10-10 11:50:00 +00:00
|
|
|
strlcpy(s1, opencl_device_version, sizeof(s1));
|
2011-10-22 07:02:04 +00:00
|
|
|
n = (int)strlen(s1) - 1;
|
2011-10-10 11:50:00 +00:00
|
|
|
if ((n > 0) && (s1[n] == ' ')) s1[n] = '\0';
|
2012-01-17 02:22:25 +00:00
|
|
|
sprintf(s2, "%s (driver version %s, device version %s, %.0fMB, %.0fMB available)",
|
|
|
|
name, opencl_driver_version, s1, global_mem_size/MEGA, opencl_available_ram/MEGA
|
2011-10-07 11:45:44 +00:00
|
|
|
);
|
2011-10-10 11:50:00 +00:00
|
|
|
|
|
|
|
switch(is_used) {
|
|
|
|
case COPROC_IGNORED:
|
|
|
|
sprintf(buf, "OpenCL: %s GPU %d (ignored by config): %s", type, device_num, s2);
|
|
|
|
break;
|
|
|
|
case COPROC_USED:
|
|
|
|
sprintf(buf, "OpenCL: %s GPU %d: %s", type, device_num, s2);
|
|
|
|
break;
|
|
|
|
case COPROC_UNUSED:
|
|
|
|
default:
|
|
|
|
sprintf(buf, "OpenCL: %s GPU %d (not used): %s", type, device_num, s2);
|
|
|
|
break;
|
|
|
|
}
|
2011-10-07 11:45:44 +00:00
|
|
|
}
|
|
|
|
|
2010-05-18 19:22:34 +00:00
|
|
|
void COPROCS::summary_string(char* buf, int len) {
|
2011-10-04 03:33:04 +00:00
|
|
|
char buf2[1024];
|
2010-05-18 19:22:34 +00:00
|
|
|
|
2011-10-04 03:33:04 +00:00
|
|
|
strcpy(buf, "");
|
2011-03-25 03:44:09 +00:00
|
|
|
if (nvidia.count) {
|
|
|
|
int mem = (int)(nvidia.prop.dtotalGlobalMem/MEGA);
|
2010-05-18 19:22:34 +00:00
|
|
|
sprintf(buf2, "[CUDA|%s|%d|%dMB|%d]",
|
2011-03-25 03:44:09 +00:00
|
|
|
nvidia.prop.name, nvidia.count, mem, nvidia.display_driver_version
|
2010-05-18 19:22:34 +00:00
|
|
|
);
|
2011-10-04 03:33:04 +00:00
|
|
|
strlcat(buf, buf2, len);
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
if (ati.count) {
|
|
|
|
sprintf(buf2,"[CAL|%s|%d|%dMB|%s]",
|
|
|
|
ati.name, ati.count, ati.attribs.localRAM, ati.version
|
|
|
|
);
|
2011-10-04 03:33:04 +00:00
|
|
|
strlcat(buf, buf2, len);
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-09 21:44:14 +00:00
|
|
|
int COPROCS::parse(XML_PARSER& xp) {
|
2010-05-18 19:22:34 +00:00
|
|
|
int retval;
|
|
|
|
|
2011-06-22 11:25:06 +00:00
|
|
|
clear();
|
2011-04-11 03:19:27 +00:00
|
|
|
n_rsc = 1;
|
2011-04-21 17:04:42 +00:00
|
|
|
strcpy(coprocs[0].type, "CPU");
|
2012-01-19 09:38:35 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (xp.match_tag("/coprocs")) {
|
2010-05-18 19:22:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2012-01-19 09:38:35 +00:00
|
|
|
if (xp.match_tag("coproc_cuda")) {
|
2011-08-09 21:44:14 +00:00
|
|
|
retval = nvidia.parse(xp);
|
2010-05-18 19:22:34 +00:00
|
|
|
if (retval) {
|
2011-03-25 03:44:09 +00:00
|
|
|
nvidia.clear();
|
2011-04-11 03:19:27 +00:00
|
|
|
} else {
|
|
|
|
coprocs[n_rsc++] = nvidia;
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
2011-04-11 03:19:27 +00:00
|
|
|
continue;
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
2012-01-19 09:38:35 +00:00
|
|
|
if (xp.match_tag("coproc_ati")) {
|
2011-08-09 21:44:14 +00:00
|
|
|
retval = ati.parse(xp);
|
2010-05-18 19:22:34 +00:00
|
|
|
if (retval) {
|
|
|
|
ati.clear();
|
2011-04-11 03:19:27 +00:00
|
|
|
} else {
|
|
|
|
coprocs[n_rsc++] = ati;
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
2011-04-11 03:19:27 +00:00
|
|
|
continue;
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
2010-09-23 20:54:49 +00:00
|
|
|
void COPROCS::write_xml(MIOFILE& mf, bool include_request) {
|
2010-05-18 19:22:34 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2011-06-22 11:25:06 +00:00
|
|
|
//TODO: Write coprocs[0] through coprocs[n_rsc]
|
2010-05-18 19:22:34 +00:00
|
|
|
mf.printf(" <coprocs>\n");
|
2011-03-25 03:44:09 +00:00
|
|
|
if (nvidia.count) {
|
|
|
|
nvidia.write_xml(mf, include_request);
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
if (ati.count) {
|
2010-09-23 20:54:49 +00:00
|
|
|
ati.write_xml(mf, include_request);
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
mf.printf(" </coprocs>\n");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-03-25 03:44:09 +00:00
|
|
|
void COPROC_NVIDIA::description(char* buf) {
|
2011-10-11 18:57:49 +00:00
|
|
|
char vers[256], cuda_vers[256];
|
2010-05-18 19:22:34 +00:00
|
|
|
if (display_driver_version) {
|
2011-10-12 00:21:04 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
int maj = display_driver_version >> 16;
|
|
|
|
int min = (display_driver_version >> 8) & 0xff;
|
|
|
|
int rev = display_driver_version & 0xff;
|
|
|
|
sprintf(vers, "%d.%d.%d", maj, min, rev);
|
|
|
|
#else
|
2011-10-11 18:57:49 +00:00
|
|
|
int maj = display_driver_version/100;
|
|
|
|
int min = display_driver_version%100;
|
|
|
|
sprintf(vers, "%d.%d", maj, min);
|
2011-10-12 00:21:04 +00:00
|
|
|
#endif
|
2010-05-18 19:22:34 +00:00
|
|
|
} else {
|
|
|
|
strcpy(vers, "unknown");
|
|
|
|
}
|
2011-10-11 18:57:49 +00:00
|
|
|
if (cuda_version) {
|
2011-10-14 20:44:00 +00:00
|
|
|
int maj = cuda_version/1000;
|
|
|
|
int min = cuda_version%1000;
|
2011-10-11 18:57:49 +00:00
|
|
|
sprintf(cuda_vers, "%d.%d", maj, min);
|
|
|
|
} else {
|
|
|
|
strcpy(cuda_vers, "unknown");
|
|
|
|
}
|
|
|
|
sprintf(buf, "%s (driver version %s, CUDA version %s, compute capability %d.%d, %.0fMB, %.0fMB available, %.0f GFLOPS peak)",
|
|
|
|
prop.name, vers, cuda_vers, prop.major, prop.minor,
|
2011-09-14 22:45:26 +00:00
|
|
|
prop.totalGlobalMem/MEGA, available_ram/MEGA, peak_flops/1e9
|
2010-05-18 19:22:34 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef _USING_FCGI_
|
2011-03-25 03:44:09 +00:00
|
|
|
void COPROC_NVIDIA::write_xml(MIOFILE& f, bool include_request) {
|
2010-05-18 19:22:34 +00:00
|
|
|
f.printf(
|
|
|
|
"<coproc_cuda>\n"
|
|
|
|
" <count>%d</count>\n"
|
2011-08-23 11:29:11 +00:00
|
|
|
" <name>%s</name>\n"
|
2011-09-14 23:30:51 +00:00
|
|
|
" <available_ram>%f</available_ram>\n"
|
2011-08-23 11:29:11 +00:00
|
|
|
" <have_cuda>%d</have_cuda>\n"
|
2011-08-23 12:45:07 +00:00
|
|
|
" <have_opencl>%d</have_opencl>\n",
|
|
|
|
count,
|
|
|
|
prop.name,
|
2011-09-14 23:30:51 +00:00
|
|
|
available_ram,
|
2011-08-23 12:45:07 +00:00
|
|
|
have_cuda ? 1 : 0,
|
|
|
|
have_opencl ? 1 : 0
|
|
|
|
);
|
|
|
|
if (include_request) {
|
|
|
|
write_request(f);
|
|
|
|
}
|
|
|
|
f.printf(
|
2011-07-07 22:21:56 +00:00
|
|
|
" <peak_flops>%f</peak_flops>\n"
|
2010-05-18 19:22:34 +00:00
|
|
|
" <cudaVersion>%d</cudaVersion>\n"
|
2011-06-22 11:25:06 +00:00
|
|
|
" <drvVersion>%d</drvVersion>\n"
|
2010-05-18 19:22:34 +00:00
|
|
|
" <totalGlobalMem>%u</totalGlobalMem>\n"
|
|
|
|
" <sharedMemPerBlock>%u</sharedMemPerBlock>\n"
|
|
|
|
" <regsPerBlock>%d</regsPerBlock>\n"
|
|
|
|
" <warpSize>%d</warpSize>\n"
|
|
|
|
" <memPitch>%u</memPitch>\n"
|
|
|
|
" <maxThreadsPerBlock>%d</maxThreadsPerBlock>\n"
|
|
|
|
" <maxThreadsDim>%d %d %d</maxThreadsDim>\n"
|
|
|
|
" <maxGridSize>%d %d %d</maxGridSize>\n"
|
2011-06-22 11:25:06 +00:00
|
|
|
" <clockRate>%d</clockRate>\n"
|
2010-05-18 19:22:34 +00:00
|
|
|
" <totalConstMem>%u</totalConstMem>\n"
|
|
|
|
" <major>%d</major>\n"
|
|
|
|
" <minor>%d</minor>\n"
|
|
|
|
" <textureAlignment>%u</textureAlignment>\n"
|
|
|
|
" <deviceOverlap>%d</deviceOverlap>\n"
|
2011-08-23 11:29:11 +00:00
|
|
|
" <multiProcessorCount>%d</multiProcessorCount>\n",
|
2011-06-22 11:25:06 +00:00
|
|
|
peak_flops,
|
2010-05-18 19:22:34 +00:00
|
|
|
cuda_version,
|
2011-06-22 11:25:06 +00:00
|
|
|
display_driver_version,
|
2010-05-18 19:22:34 +00:00
|
|
|
(unsigned int)prop.totalGlobalMem,
|
|
|
|
(unsigned int)prop.sharedMemPerBlock,
|
|
|
|
prop.regsPerBlock,
|
|
|
|
prop.warpSize,
|
|
|
|
(unsigned int)prop.memPitch,
|
|
|
|
prop.maxThreadsPerBlock,
|
|
|
|
prop.maxThreadsDim[0], prop.maxThreadsDim[1], prop.maxThreadsDim[2],
|
|
|
|
prop.maxGridSize[0], prop.maxGridSize[1], prop.maxGridSize[2],
|
2011-06-22 11:25:06 +00:00
|
|
|
prop.clockRate,
|
2010-05-18 19:22:34 +00:00
|
|
|
(unsigned int)prop.totalConstMem,
|
|
|
|
prop.major,
|
|
|
|
prop.minor,
|
|
|
|
(unsigned int)prop.textureAlignment,
|
|
|
|
prop.deviceOverlap,
|
|
|
|
prop.multiProcessorCount
|
|
|
|
);
|
2011-08-23 11:29:11 +00:00
|
|
|
|
|
|
|
if (have_opencl) {
|
2011-10-10 07:09:24 +00:00
|
|
|
opencl_prop.write_xml(f);
|
2011-08-23 11:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
f.printf("</coproc_cuda>\n");
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-03-25 03:44:09 +00:00
|
|
|
void COPROC_NVIDIA::clear() {
|
2011-06-22 11:25:06 +00:00
|
|
|
COPROC::clear();
|
2011-08-31 11:08:13 +00:00
|
|
|
strcpy(type, GPU_TYPE_NVIDIA);
|
2010-05-18 19:22:34 +00:00
|
|
|
estimated_delay = -1; // mark as absent
|
|
|
|
cuda_version = 0;
|
|
|
|
display_driver_version = 0;
|
|
|
|
strcpy(prop.name, "");
|
2011-06-22 11:25:06 +00:00
|
|
|
prop.deviceHandle = 0;
|
2010-05-18 19:22:34 +00:00
|
|
|
prop.totalGlobalMem = 0;
|
|
|
|
prop.sharedMemPerBlock = 0;
|
|
|
|
prop.regsPerBlock = 0;
|
|
|
|
prop.warpSize = 0;
|
|
|
|
prop.memPitch = 0;
|
|
|
|
prop.maxThreadsPerBlock = 0;
|
|
|
|
prop.maxThreadsDim[0] = 0;
|
|
|
|
prop.maxThreadsDim[1] = 0;
|
|
|
|
prop.maxThreadsDim[2] = 0;
|
|
|
|
prop.maxGridSize[0] = 0;
|
|
|
|
prop.maxGridSize[1] = 0;
|
|
|
|
prop.maxGridSize[2] = 0;
|
|
|
|
prop.clockRate = 0;
|
|
|
|
prop.totalConstMem = 0;
|
|
|
|
prop.major = 0;
|
|
|
|
prop.minor = 0;
|
|
|
|
prop.textureAlignment = 0;
|
|
|
|
prop.deviceOverlap = 0;
|
|
|
|
prop.multiProcessorCount = 0;
|
|
|
|
}
|
|
|
|
|
2011-08-09 21:44:14 +00:00
|
|
|
int COPROC_NVIDIA::parse(XML_PARSER& xp) {
|
2011-09-15 04:24:40 +00:00
|
|
|
char buf2[256];
|
2011-08-23 11:29:11 +00:00
|
|
|
int retval;
|
2010-05-18 19:22:34 +00:00
|
|
|
|
|
|
|
clear();
|
2011-09-15 04:24:40 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (xp.match_tag("/coproc_cuda")) {
|
2011-01-12 01:17:07 +00:00
|
|
|
if (!peak_flops) {
|
2011-01-27 20:00:42 +00:00
|
|
|
set_peak_flops();
|
2011-01-12 01:17:07 +00:00
|
|
|
}
|
2011-10-06 02:56:30 +00:00
|
|
|
if (!available_ram) {
|
|
|
|
available_ram = prop.dtotalGlobalMem;
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("count", count)) continue;
|
|
|
|
if (xp.parse_double("peak_flops", peak_flops)) continue;
|
|
|
|
if (xp.parse_bool("have_cuda", have_cuda)) continue;
|
|
|
|
if (xp.parse_bool("have_opencl", have_opencl)) continue;
|
|
|
|
if (xp.parse_double("available_ram", available_ram)) continue;
|
|
|
|
if (xp.parse_double("req_secs", req_secs)) continue;
|
|
|
|
if (xp.parse_double("req_instances", req_instances)) continue;
|
|
|
|
if (xp.parse_double("estimated_delay", estimated_delay)) continue;
|
|
|
|
if (xp.parse_int("cudaVersion", cuda_version)) continue;
|
|
|
|
if (xp.parse_int("drvVersion", display_driver_version)) continue;
|
|
|
|
if (xp.parse_str("name", prop.name, sizeof(prop.name))) continue;
|
|
|
|
if (xp.parse_int("deviceHandle", prop.deviceHandle)) continue;
|
|
|
|
if (xp.parse_double("totalGlobalMem", prop.dtotalGlobalMem)) {
|
2012-04-02 22:41:28 +00:00
|
|
|
prop.totalGlobalMem = (size_t)prop.dtotalGlobalMem;
|
2010-10-19 15:48:33 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("sharedMemPerBlock", (int&)prop.sharedMemPerBlock)) continue;
|
|
|
|
if (xp.parse_int("regsPerBlock", prop.regsPerBlock)) continue;
|
|
|
|
if (xp.parse_int("warpSize", prop.warpSize)) continue;
|
|
|
|
if (xp.parse_int("memPitch", (int&)prop.memPitch)) continue;
|
|
|
|
if (xp.parse_int("maxThreadsPerBlock", prop.maxThreadsPerBlock)) continue;
|
|
|
|
if (xp.parse_str("maxThreadsDim", buf2, sizeof(buf2))) {
|
2010-05-18 19:22:34 +00:00
|
|
|
// can't use sscanf here (FCGI)
|
|
|
|
//
|
|
|
|
prop.maxThreadsDim[0] = atoi(buf2);
|
|
|
|
char* p = strchr(buf2, ' ');
|
|
|
|
if (p) {
|
|
|
|
p++;
|
|
|
|
prop.maxThreadsDim[1] = atoi(p);
|
|
|
|
p = strchr(p, ' ');
|
|
|
|
if (p) {
|
|
|
|
p++;
|
|
|
|
prop.maxThreadsDim[2] = atoi(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_str("maxGridSize", buf2, sizeof(buf2))) {
|
2010-05-18 19:22:34 +00:00
|
|
|
prop.maxGridSize[0] = atoi(buf2);
|
|
|
|
char* p = strchr(buf2, ' ');
|
|
|
|
if (p) {
|
|
|
|
p++;
|
|
|
|
prop.maxGridSize[1] = atoi(p);
|
|
|
|
p = strchr(p, ' ');
|
|
|
|
if (p) {
|
|
|
|
p++;
|
|
|
|
prop.maxGridSize[2] = atoi(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("clockRate", prop.clockRate)) continue;
|
|
|
|
if (xp.parse_int("totalConstMem", (int&)prop.totalConstMem)) continue;
|
|
|
|
if (xp.parse_int("major", prop.major)) continue;
|
|
|
|
if (xp.parse_int("minor", prop.minor)) continue;
|
|
|
|
if (xp.parse_int("textureAlignment", (int&)prop.textureAlignment)) continue;
|
|
|
|
if (xp.parse_int("deviceOverlap", prop.deviceOverlap)) continue;
|
|
|
|
if (xp.parse_int("multiProcessorCount", prop.multiProcessorCount)) continue;
|
|
|
|
if (xp.match_tag("coproc_opencl")) {
|
2011-10-10 07:09:24 +00:00
|
|
|
retval = opencl_prop.parse(xp);
|
2011-08-23 11:29:11 +00:00
|
|
|
if (retval) return retval;
|
|
|
|
continue;
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
2011-10-08 01:20:44 +00:00
|
|
|
|
2011-10-07 19:47:35 +00:00
|
|
|
void COPROC_NVIDIA::set_peak_flops() {
|
|
|
|
double x=0;
|
2011-10-21 18:08:45 +00:00
|
|
|
if (prop.clockRate) {
|
2011-10-07 19:47:35 +00:00
|
|
|
int flops_per_clock=0, cores_per_proc=0;
|
|
|
|
switch (prop.major) {
|
|
|
|
case 1:
|
|
|
|
flops_per_clock = 3;
|
|
|
|
cores_per_proc = 8;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
flops_per_clock = 2;
|
|
|
|
switch (prop.minor) {
|
|
|
|
case 0:
|
|
|
|
cores_per_proc = 32;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
cores_per_proc = 48;
|
|
|
|
break;
|
|
|
|
}
|
2012-03-28 17:29:48 +00:00
|
|
|
break;
|
2012-03-24 06:31:03 +00:00
|
|
|
case 3:
|
|
|
|
default:
|
|
|
|
flops_per_clock = 2;
|
2012-03-27 03:50:16 +00:00
|
|
|
cores_per_proc = 192;
|
2012-03-28 17:29:48 +00:00
|
|
|
break;
|
2011-10-07 19:47:35 +00:00
|
|
|
}
|
|
|
|
// clock rate is scaled down by 1000
|
|
|
|
//
|
|
|
|
x = (1000.*prop.clockRate) * prop.multiProcessorCount * cores_per_proc * flops_per_clock;
|
2011-10-21 18:08:45 +00:00
|
|
|
} else if (opencl_prop.max_compute_units) {
|
2011-10-07 19:47:35 +00:00
|
|
|
// OpenCL doesn't give us compute capability.
|
|
|
|
// assume cores_per_proc is 8 and flops_per_clock is 2
|
|
|
|
//
|
2011-10-08 06:33:39 +00:00
|
|
|
x = opencl_prop.max_compute_units * 8 * 2 * opencl_prop.max_clock_frequency * 1e6;
|
2011-10-07 19:47:35 +00:00
|
|
|
}
|
|
|
|
peak_flops = (x>0)?x:5e10;
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
|
|
|
|
////////////////// ATI STARTS HERE /////////////////
|
|
|
|
|
|
|
|
#ifndef _USING_FCGI_
|
2010-09-23 20:54:49 +00:00
|
|
|
void COPROC_ATI::write_xml(MIOFILE& f, bool include_request) {
|
2010-05-18 19:22:34 +00:00
|
|
|
f.printf(
|
|
|
|
"<coproc_ati>\n"
|
2010-09-23 20:54:49 +00:00
|
|
|
" <count>%d</count>\n"
|
2011-08-23 11:29:11 +00:00
|
|
|
" <name>%s</name>\n"
|
2011-09-14 23:30:51 +00:00
|
|
|
" <available_ram>%f</available_ram>\n"
|
2011-08-23 11:29:11 +00:00
|
|
|
" <have_cal>%d</have_cal>\n"
|
|
|
|
" <have_opencl>%d</have_opencl>\n",
|
2010-09-23 20:54:49 +00:00
|
|
|
count,
|
2011-08-23 11:29:11 +00:00
|
|
|
name,
|
2011-09-14 23:30:51 +00:00
|
|
|
available_ram,
|
2011-08-23 11:29:11 +00:00
|
|
|
have_cal ? 1 : 0,
|
|
|
|
have_opencl ? 1 : 0
|
2010-05-18 19:22:34 +00:00
|
|
|
);
|
2010-09-23 20:54:49 +00:00
|
|
|
if (include_request) {
|
|
|
|
write_request(f);
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
f.printf(
|
2011-07-07 22:21:56 +00:00
|
|
|
" <peak_flops>%f</peak_flops>\n"
|
2011-06-22 11:25:06 +00:00
|
|
|
" <CALVersion>%s</CALVersion>\n"
|
2010-05-18 19:22:34 +00:00
|
|
|
" <target>%d</target>\n"
|
|
|
|
" <localRAM>%d</localRAM>\n"
|
|
|
|
" <uncachedRemoteRAM>%d</uncachedRemoteRAM>\n"
|
|
|
|
" <cachedRemoteRAM>%d</cachedRemoteRAM>\n"
|
|
|
|
" <engineClock>%u</engineClock>\n"
|
|
|
|
" <memoryClock>%d</memoryClock>\n"
|
|
|
|
" <wavefrontSize>%d</wavefrontSize>\n"
|
|
|
|
" <numberOfSIMD>%d</numberOfSIMD>\n"
|
|
|
|
" <doublePrecision>%d</doublePrecision>\n"
|
|
|
|
" <pitch_alignment>%d</pitch_alignment>\n"
|
|
|
|
" <surface_alignment>%d</surface_alignment>\n"
|
|
|
|
" <maxResource1DWidth>%d</maxResource1DWidth>\n"
|
|
|
|
" <maxResource2DWidth>%d</maxResource2DWidth>\n"
|
2011-06-22 11:25:06 +00:00
|
|
|
" <maxResource2DHeight>%d</maxResource2DHeight>\n",
|
|
|
|
peak_flops,
|
|
|
|
version,
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.target,
|
|
|
|
attribs.localRAM,
|
|
|
|
attribs.uncachedRemoteRAM,
|
|
|
|
attribs.cachedRemoteRAM,
|
|
|
|
attribs.engineClock,
|
|
|
|
attribs.memoryClock,
|
|
|
|
attribs.wavefrontSize,
|
|
|
|
attribs.numberOfSIMD,
|
|
|
|
attribs.doublePrecision,
|
|
|
|
attribs.pitch_alignment,
|
|
|
|
attribs.surface_alignment,
|
|
|
|
info.maxResource1DWidth,
|
|
|
|
info.maxResource2DWidth,
|
2011-06-22 11:25:06 +00:00
|
|
|
info.maxResource2DHeight
|
2010-05-18 19:22:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if (atirt_detected) {
|
|
|
|
f.printf(" <atirt_detected/>\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (amdrt_detected) {
|
|
|
|
f.printf(" <amdrt_detected/>\n");
|
|
|
|
}
|
|
|
|
|
2011-08-23 11:29:11 +00:00
|
|
|
if (have_opencl) {
|
2011-10-10 07:09:24 +00:00
|
|
|
opencl_prop.write_xml(f);
|
2011-08-23 11:29:11 +00:00
|
|
|
}
|
|
|
|
|
2010-05-18 19:22:34 +00:00
|
|
|
f.printf("</coproc_ati>\n");
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void COPROC_ATI::clear() {
|
2011-06-22 11:25:06 +00:00
|
|
|
COPROC::clear();
|
2011-08-31 11:08:13 +00:00
|
|
|
strcpy(type, GPU_TYPE_ATI);
|
2010-05-18 19:22:34 +00:00
|
|
|
estimated_delay = -1;
|
|
|
|
strcpy(name, "");
|
|
|
|
strcpy(version, "");
|
|
|
|
atirt_detected = false;
|
|
|
|
amdrt_detected = false;
|
|
|
|
memset(&attribs, 0, sizeof(attribs));
|
|
|
|
memset(&info, 0, sizeof(info));
|
2012-01-23 21:59:12 +00:00
|
|
|
version_num = 0;
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-09 21:44:14 +00:00
|
|
|
int COPROC_ATI::parse(XML_PARSER& xp) {
|
2011-09-15 04:24:40 +00:00
|
|
|
int n, retval;
|
2010-05-18 19:22:34 +00:00
|
|
|
|
|
|
|
clear();
|
|
|
|
|
2011-09-15 04:24:40 +00:00
|
|
|
while (!xp.get_tag()) {
|
|
|
|
if (xp.match_tag("/coproc_ati")) {
|
2012-01-23 21:59:12 +00:00
|
|
|
if (strlen(version)) {
|
|
|
|
int major, minor, release;
|
|
|
|
n = sscanf(version, "%d.%d.%d", &major, &minor, &release);
|
|
|
|
if (n ==3) {
|
|
|
|
version_num = ati_version_int(major, minor, release);
|
|
|
|
}
|
|
|
|
}
|
2011-01-12 01:17:07 +00:00
|
|
|
|
|
|
|
if (!peak_flops) {
|
2011-01-27 20:00:42 +00:00
|
|
|
set_peak_flops();
|
2011-01-12 01:17:07 +00:00
|
|
|
}
|
2011-10-06 02:56:30 +00:00
|
|
|
if (!available_ram) {
|
|
|
|
available_ram = attribs.localRAM*MEGA;
|
|
|
|
}
|
2010-06-16 22:07:19 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("count", count)) continue;
|
|
|
|
if (xp.parse_double("peak_flops", peak_flops)) continue;
|
|
|
|
if (xp.parse_bool("have_cal", have_cal)) continue;
|
|
|
|
if (xp.parse_bool("have_opencl", have_opencl)) continue;
|
|
|
|
if (xp.parse_double("available_ram", available_ram)) continue;
|
|
|
|
if (xp.parse_double("req_secs", req_secs)) continue;
|
|
|
|
if (xp.parse_double("req_instances", req_instances)) continue;
|
|
|
|
if (xp.parse_double("estimated_delay", estimated_delay)) continue;
|
|
|
|
if (xp.parse_str("name", name, sizeof(name))) continue;
|
|
|
|
if (xp.parse_str("CALVersion", version, sizeof(version))) continue;
|
|
|
|
if (xp.parse_bool("amdrt_detected", amdrt_detected)) continue;
|
|
|
|
if (xp.parse_bool("atirt_detected", atirt_detected)) continue;
|
|
|
|
|
|
|
|
if (xp.parse_int("target", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.target = (CALtarget)n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("localRAM", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.localRAM = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("uncachedRemoteRAM", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.uncachedRemoteRAM = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("cachedRemoteRAM", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.cachedRemoteRAM = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("engineClock", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.engineClock = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("memoryClock", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.memoryClock = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("wavefrontSize", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.wavefrontSize = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("numberOfSIMD" , n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.numberOfSIMD = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("doublePrecision", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.doublePrecision = n?CAL_TRUE:CAL_FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("pitch_alignment", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.pitch_alignment = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("surface_alignment", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
attribs.surface_alignment = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("maxResource1DWidth", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
info.maxResource1DWidth = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("maxResource2DWidth", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
info.maxResource2DWidth = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.parse_int("maxResource2DHeight", n)) {
|
2010-05-18 19:22:34 +00:00
|
|
|
info.maxResource2DHeight = n;
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-15 04:24:40 +00:00
|
|
|
if (xp.match_tag("coproc_opencl")) {
|
2011-10-10 07:09:24 +00:00
|
|
|
retval = opencl_prop.parse(xp);
|
2011-08-23 11:29:11 +00:00
|
|
|
if (retval) return retval;
|
|
|
|
continue;
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
return ERR_XML_PARSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void COPROC_ATI::description(char* buf) {
|
2011-09-21 23:00:45 +00:00
|
|
|
sprintf(buf, "%s (CAL version %s, %dMB, %.0fMB available, %.0f GFLOPS peak)",
|
|
|
|
name, version, attribs.localRAM, available_ram/MEGA, peak_flops/1.e9
|
2010-05-18 19:22:34 +00:00
|
|
|
);
|
|
|
|
}
|
2011-10-07 19:47:35 +00:00
|
|
|
|
|
|
|
void COPROC_ATI::set_peak_flops() {
|
|
|
|
double x = 0;
|
2011-10-21 17:44:18 +00:00
|
|
|
if (attribs.numberOfSIMD) {
|
2011-10-07 21:59:07 +00:00
|
|
|
x = attribs.numberOfSIMD * attribs.wavefrontSize * 5 * attribs.engineClock * 1.e6;
|
2011-10-07 19:47:35 +00:00
|
|
|
// clock is in MHz
|
2011-10-21 17:44:18 +00:00
|
|
|
} else if (opencl_prop.max_compute_units) {
|
2011-10-07 19:47:35 +00:00
|
|
|
// OpenCL gives us only:
|
|
|
|
// - max_compute_units
|
|
|
|
// (which I'll assume is the same as attribs.numberOfSIMD)
|
|
|
|
// - max_clock_frequency (which I'll assume is the same as engineClock)
|
|
|
|
// It doesn't give wavefrontSize, which can be 16/32/64.
|
|
|
|
// So let's be conservative and use 16
|
|
|
|
//
|
2011-10-08 06:33:39 +00:00
|
|
|
x = opencl_prop.max_compute_units * 16 * 5 * opencl_prop.max_clock_frequency * 1e6;
|
2011-10-07 19:47:35 +00:00
|
|
|
}
|
|
|
|
peak_flops = (x>0)?x:5e10;
|
|
|
|
}
|