Skip to content

Commit

Permalink
- client: Hook up the XML portion of the Intel GPU detection code so
Browse files Browse the repository at this point in the history
        the server scheduler knows about it.
    - client: Print out the peak flops for the Intel GPU, the regular
        OpenCL descriptions do not show peak flops.
  • Loading branch information
romw authored and Oliver Bock committed Mar 4, 2013
1 parent 6d0e60a commit 516eff6
Show file tree
Hide file tree
Showing 14 changed files with 190 additions and 41 deletions.
24 changes: 24 additions & 0 deletions checkin_notes
Expand Up @@ -7385,3 +7385,27 @@ Rom 7 Dec 2012

client/
gpu_detect.cpp

Rom 8 Dec 2012
- client: Hook up the XML portion of the Intel GPU detection code so
the server scheduler knows about it.
- client: Print out the peak flops for the Intel GPU, the regular
OpenCL descriptions do not show peak flops.

NOTE: At this point we should be supporting Intel GPUs as far as
detection and reporting its presence to the server goes. I don't
know about scheduling though.

Thanks Tank Master for the interactive debug session in IRC.

client\
gpu_intel.cpp (Added)
client_state.cpp
cs_scheduler.cpp
cs_statefile.cpp
gpu_detect.cpp, .h
gpu_opencl.cpp
log_flags.cpp
lib\
cc_config.cpp, .h
coproc.cpp, .h
6 changes: 3 additions & 3 deletions client/client_state.cpp
Expand Up @@ -372,7 +372,7 @@ int CLIENT_STATE::init() {
vector<string> warnings;
coprocs.get(
config.use_all_gpus, descs, warnings,
config.ignore_nvidia_dev, config.ignore_ati_dev, config.ignore_intel_gpu_dev
config.ignore_nvidia_dev, config.ignore_ati_dev, config.ignore_intel_dev
);
for (i=0; i<descs.size(); i++) {
msg_printf(NULL, MSG_INFO, "%s", descs[i].c_str());
Expand Down Expand Up @@ -406,11 +406,11 @@ int CLIENT_STATE::init() {
coprocs.add(coprocs.ati);
}
}
if (coprocs.have_intel_gpu()) {
if (coprocs.have_intel()) {
if (rsc_index(GPU_TYPE_INTEL)>0) {
msg_printf(NULL, MSG_INFO, "INTEL GPU info taken from cc_config.xml");
} else {
coprocs.add(coprocs.intel_gpu);
coprocs.add(coprocs.intel);
}
}
host_info._coprocs = coprocs;
Expand Down
6 changes: 3 additions & 3 deletions client/cs_scheduler.cpp
Expand Up @@ -237,9 +237,9 @@ int CLIENT_STATE::make_scheduler_request(PROJECT* p) {
}
j = rsc_index(GPU_TYPE_INTEL);
if (j > 0) {
coprocs.intel_gpu.req_secs = rsc_work_fetch[j].req_secs;
coprocs.intel_gpu.req_instances = rsc_work_fetch[j].req_instances;
coprocs.intel_gpu.estimated_delay = rsc_work_fetch[j].req_secs?rsc_work_fetch[j].busy_time_estimator.get_busy_time():0;
coprocs.intel.req_secs = rsc_work_fetch[j].req_secs;
coprocs.intel.req_instances = rsc_work_fetch[j].req_instances;
coprocs.intel.estimated_delay = rsc_work_fetch[j].req_secs?rsc_work_fetch[j].busy_time_estimator.get_busy_time():0;
}

if (coprocs.n_rsc > 1) {
Expand Down
4 changes: 2 additions & 2 deletions client/cs_statefile.cpp
Expand Up @@ -937,8 +937,8 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) {
if (coprocs.have_ati()) {
f.printf("<have_ati/>\n");
}
if (coprocs.have_intel_gpu()) {
f.printf("<have_intel_gpu/>\n");
if (coprocs.have_intel()) {
f.printf("<have_intel/>\n");
}

#if 1
Expand Down
42 changes: 36 additions & 6 deletions client/gpu_detect.cpp
Expand Up @@ -64,15 +64,16 @@ void segv_handler(int) {

vector<COPROC_ATI> ati_gpus;
vector<COPROC_NVIDIA> nvidia_gpus;
vector<COPROC_INTEL> intel_gpus;
vector<OPENCL_DEVICE_PROP> ati_opencls;
vector<OPENCL_DEVICE_PROP> nvidia_opencls;
vector<OPENCL_DEVICE_PROP> intel_gpu_opencls;
vector<OPENCL_DEVICE_PROP> intel_opencls;

void COPROCS::get(
bool use_all, vector<string>&descs, vector<string>&warnings,
vector<int>& ignore_nvidia_dev,
vector<int>& ignore_ati_dev,
vector<int>& ignore_intel_gpu_dev
vector<int>& ignore_intel_dev
) {
unsigned int i;
char buf[256], buf2[256];
Expand All @@ -91,7 +92,13 @@ void COPROCS::get(
warnings.push_back("Caught SIGSEGV in ATI GPU detection");
}
try {
get_opencl(use_all, warnings, ignore_ati_dev, ignore_nvidia_dev, ignore_intel_gpu_dev);
intel.get(use_all, warnings, ignore_intel_dev);
}
catch (...) {
warnings.push_back("Caught SIGSEGV in INTEL GPU detection");
}
try {
get_opencl(use_all, warnings, ignore_ati_dev, ignore_nvidia_dev, ignore_intel_dev);
}
catch (...) {
warnings.push_back("Caught SIGSEGV in OpenCL detection");
Expand All @@ -110,6 +117,11 @@ void COPROCS::get(
ati.get(use_all, warnings, ignore_ati_dev);
}
#endif
if (setjmp(resume)) {
warnings.push_back("Caught SIGSEGV in INTEL GPU detection");
} else {
intel.get(use_all, warnings, ignore_intel_dev);
}
if (setjmp(resume)) {
warnings.push_back("Caught SIGSEGV in OpenCL detection");
} else {
Expand Down Expand Up @@ -152,6 +164,23 @@ void COPROCS::get(
descs.push_back(string(buf2));
}

for (i=0; i<intel_gpus.size(); i++) {
intel_gpus[i].description(buf);
switch(intel_gpus[i].is_used) {
case COPROC_IGNORED:
sprintf(buf2, "INTEL GPU %d (ignored by config): %s", intel_gpus[i].device_num, buf);
break;
case COPROC_USED:
sprintf(buf2, "INTEL GPU %d: %s", intel_gpus[i].device_num, buf);
break;
case COPROC_UNUSED:
default:
sprintf(buf2, "INTEL GPU %d: (not used) %s", intel_gpus[i].device_num, buf);
break;
}
descs.push_back(string(buf2));
}

// Create descriptions for OpenCL NVIDIA GPUs
//
for (i=0; i<nvidia_opencls.size(); i++) {
Expand All @@ -168,14 +197,15 @@ void COPROCS::get(

// Create descriptions for OpenCL Intel GPUs
//
for (i=0; i<intel_gpu_opencls.size(); i++) {
intel_gpu_opencls[i].description(buf, GPU_TYPE_INTEL);
for (i=0; i<intel_opencls.size(); i++) {
intel_opencls[i].description(buf, GPU_TYPE_INTEL);
descs.push_back(string(buf));
}

ati_gpus.clear();
nvidia_gpus.clear();
intel_gpus.clear();
ati_opencls.clear();
nvidia_opencls.clear();
intel_gpu_opencls.clear();
intel_opencls.clear();
}
3 changes: 2 additions & 1 deletion client/gpu_detect.h
Expand Up @@ -17,7 +17,8 @@

extern vector<COPROC_ATI> ati_gpus;
extern vector<COPROC_NVIDIA> nvidia_gpus;
extern vector<COPROC_INTEL> intel_gpus;
extern vector<OPENCL_DEVICE_PROP> nvidia_opencls;
extern vector<OPENCL_DEVICE_PROP> ati_opencls;
extern vector<OPENCL_DEVICE_PROP> intel_gpu_opencls;
extern vector<OPENCL_DEVICE_PROP> intel_opencls;
extern bool in_vector(int n, vector<int>& v);
50 changes: 50 additions & 0 deletions client/gpu_intel.cpp
@@ -0,0 +1,50 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2012 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/>.

// Detection of Intel GPUs
//

#ifdef _WIN32
#include "boinc_win.h"
#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>
#endif

#include <vector>
#include <string>

using std::vector;
using std::string;

#include "coproc.h"
#include "util.h"

#include "client_msgs.h"
#include "gpu_detect.h"

void COPROC_INTEL::get(
bool,
vector<string>&,
vector<int>&
) {
}
26 changes: 18 additions & 8 deletions client/gpu_opencl.cpp
Expand Up @@ -115,7 +115,7 @@ void COPROCS::get_opencl(
vector<string>& warnings,
vector<int>& ignore_ati_dev,
vector<int>& ignore_nvidia_dev,
vector<int>& ignore_intel_gpu_dev
vector<int>& ignore_intel_dev
) {
cl_int ciErrNum;
cl_platform_id platforms[MAX_OPENCL_PLATFORMS];
Expand Down Expand Up @@ -330,16 +330,26 @@ void COPROCS::get_opencl(
}
if (device_type == CL_DEVICE_TYPE_CPU) continue;

prop.device_num = (int)(intel_gpu_opencls.size());
prop.device_num = (int)(intel_opencls.size());
prop.opencl_device_index = device_index;

COPROC_INTEL c;
c.opencl_prop = prop;
c.is_used = COPROC_UNUSED;
c.available_ram = prop.global_mem_size;
strcpy(c.name, prop.name);
strcpy(c.version, prop.opencl_driver_version);

c.set_peak_flops();
prop.peak_flops = c.peak_flops;

prop.opencl_available_ram = prop.global_mem_size;
intel_gpu_opencls.push_back(prop);

intel_opencls.push_back(prop);

// At present Intel GPUs only support OpenCL and do not have a native
// GPGPU framework, so treat each detected Intel OpenCL GPU device as
// a native device.
intel_gpus.push_back(c);
}
}
}
Expand All @@ -358,7 +368,7 @@ void COPROCS::get_opencl(

if ((nvidia_opencls.size() == 0) &&
(ati_opencls.size() == 0) &&
(intel_gpu_opencls.size() == 0)
(intel_opencls.size() == 0)
) {
warnings.push_back(
"OpenCL library present but no OpenCL-capable GPUs found"
Expand Down Expand Up @@ -386,9 +396,9 @@ void COPROCS::get_opencl(
strcpy(ati.name, ati.opencl_prop.name);
}

intel_gpu.find_best_opencls(use_all, intel_gpu_opencls, ignore_intel_gpu_dev);
intel_gpu.available_ram = intel_gpu.opencl_prop.global_mem_size;
strcpy(intel_gpu.name, intel_gpu.opencl_prop.name);
intel.find_best_opencls(use_all, intel_opencls, ignore_intel_dev);
intel.available_ram = intel.opencl_prop.global_mem_size;
strcpy(intel.name, intel.opencl_prop.name);

// TODO: Add code to allow adding other GPU vendors
}
Expand Down
8 changes: 4 additions & 4 deletions client/log_flags.cpp
Expand Up @@ -191,7 +191,7 @@ void CONFIG::show() {
}
show_gpu_ignore(ignore_nvidia_dev, GPU_TYPE_NVIDIA);
show_gpu_ignore(ignore_ati_dev, GPU_TYPE_ATI);
show_gpu_ignore(ignore_intel_gpu_dev, GPU_TYPE_ATI);
show_gpu_ignore(ignore_intel_dev, GPU_TYPE_ATI);
for (i=0; i<exclude_gpus.size(); i++) {
show_exclude_gpu(exclude_gpus[i]);
}
Expand Down Expand Up @@ -261,7 +261,7 @@ int CONFIG::parse_options_client(XML_PARSER& xp) {
exclusive_gpu_apps.clear();
ignore_nvidia_dev.clear();
ignore_ati_dev.clear();
ignore_intel_gpu_dev.clear();
ignore_intel_dev.clear();

while (!xp.get_tag()) {
if (!xp.is_tag) {
Expand Down Expand Up @@ -365,8 +365,8 @@ int CONFIG::parse_options_client(XML_PARSER& xp) {
ignore_ati_dev.push_back(n);
continue;
}
if (xp.parse_int("ignore_intel_gpu_dev", n)) {
ignore_intel_gpu_dev.push_back(n);
if (xp.parse_int("ignore_intel_dev", n)) {
ignore_intel_dev.push_back(n);
continue;
}
if (xp.parse_int("max_file_xfers", max_file_xfers)) continue;
Expand Down
10 changes: 5 additions & 5 deletions lib/cc_config.cpp
Expand Up @@ -218,7 +218,7 @@ void CONFIG::defaults() {
http_transfer_timeout_bps = 10;
ignore_nvidia_dev.clear();
ignore_ati_dev.clear();
ignore_intel_gpu_dev.clear();
ignore_intel_dev.clear();
max_file_xfers = 8;
max_file_xfers_per_project = 2;
max_stderr_file_size = 0;
Expand Down Expand Up @@ -288,7 +288,7 @@ int CONFIG::parse_options(XML_PARSER& xp) {
exclusive_gpu_apps.clear();
ignore_nvidia_dev.clear();
ignore_ati_dev.clear();
ignore_intel_gpu_dev.clear();
ignore_intel_dev.clear();
exclude_gpus.clear();

while (!xp.get_tag()) {
Expand Down Expand Up @@ -372,7 +372,7 @@ int CONFIG::parse_options(XML_PARSER& xp) {
continue;
}
if (xp.parse_int("ignore_intel_gpu_dev", n)) {
ignore_intel_gpu_dev.push_back(n);
ignore_intel_dev.push_back(n);
continue;
}
if (xp.parse_int("max_file_xfers", max_file_xfers)) continue;
Expand Down Expand Up @@ -558,10 +558,10 @@ int CONFIG::write(MIOFILE& out, LOG_FLAGS& log_flags) {
);
}

for (i=0; i<ignore_intel_gpu_dev.size(); ++i) {
for (i=0; i<ignore_intel_dev.size(); ++i) {
out.printf(
" <ignore_intel_gpu_dev>%d</ignore_intel_gpu_dev>\n",
ignore_intel_gpu_dev[i]
ignore_intel_dev[i]
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cc_config.h
Expand Up @@ -157,7 +157,7 @@ struct CONFIG {
int http_transfer_timeout;
std::vector<int> ignore_ati_dev;
std::vector<int> ignore_nvidia_dev;
std::vector<int> ignore_intel_gpu_dev;
std::vector<int> ignore_intel_dev;
int max_file_xfers;
int max_file_xfers_per_project;
int max_stderr_file_size;
Expand Down

0 comments on commit 516eff6

Please sign in to comment.