2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2008-03-10 20:40:35 +00:00
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// 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.
|
2008-03-10 20:40:35 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2008-03-10 20:40:35 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2008-03-10 20:40:35 +00:00
|
|
|
|
2009-04-21 08:11:28 +00:00
|
|
|
// Structures representing coprocessors (e.g. GPUs);
|
|
|
|
// used in both client and server.
|
|
|
|
//
|
|
|
|
// Notes:
|
|
|
|
//
|
|
|
|
// 1) The use of "CUDA" is misleading; it really means "NVIDIA GPU".
|
|
|
|
// 2) The design treats each resource type as a pool of identical devices;
|
2013-03-24 18:22:01 +00:00
|
|
|
// for example, a scheduler request contains a request
|
|
|
|
// (#instances, instance-seconds) for CUDA jobs.
|
2009-04-21 08:11:28 +00:00
|
|
|
// In reality, the instances of a resource type can have different properties:
|
|
|
|
// In the case of CUDA, "compute capability", driver version, RAM, speed, etc.
|
|
|
|
// How to resolve this discrepancy?
|
|
|
|
//
|
|
|
|
// Prior to 21 Apr 09 we identified the fastest instance
|
|
|
|
// and pretended that the others were identical to it.
|
|
|
|
// This approach has a serious flaw:
|
|
|
|
// suppose that the fastest instance has characteristics
|
|
|
|
// (version, RAM etc.) that satisfy the project's requirements,
|
|
|
|
// but other instances to not.
|
|
|
|
// Then BOINC executes jobs on GPUs that can't handle them,
|
|
|
|
// the jobs fail, the host is punished, etc.
|
|
|
|
//
|
|
|
|
// We could treat each GPU has a separate resource,
|
2013-03-24 18:22:01 +00:00
|
|
|
// with its own backoffs, etc.
|
2009-04-21 08:11:28 +00:00
|
|
|
// However, this would imply tying jobs to instances,
|
|
|
|
// which is undesirable from a scheduling viewpoint.
|
|
|
|
// It would also be a big code change in both client and server.
|
|
|
|
//
|
|
|
|
// Instead, (as of 21 Apr 09) our approach is to identify a
|
|
|
|
// "most capable" instance, which in the case of CUDA is based on
|
|
|
|
// a) compute capability
|
|
|
|
// b) driver version
|
|
|
|
// c) RAM size
|
|
|
|
// d) est. FLOPS
|
|
|
|
// (in decreasing priority).
|
|
|
|
// We ignore and don't use any instances that are less capable
|
|
|
|
// on any of these axes.
|
|
|
|
//
|
|
|
|
// This design avoids running coprocessor apps on instances
|
|
|
|
// that are incapable of handling them, and it involves no server changes.
|
|
|
|
// Its drawback is that, on systems with multiple and differing GPUs,
|
|
|
|
// it may not use some GPUs that actually could be used.
|
|
|
|
|
2008-03-10 20:40:35 +00:00
|
|
|
#ifndef _COPROC_
|
|
|
|
#define _COPROC_
|
|
|
|
|
|
|
|
#include <vector>
|
2008-07-10 21:57:18 +00:00
|
|
|
#include <string>
|
2008-03-10 20:40:35 +00:00
|
|
|
|
2012-08-01 21:02:54 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include "boinc_win.h"
|
|
|
|
#endif
|
|
|
|
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifdef _USING_FCGI_
|
2008-09-09 19:10:42 +00:00
|
|
|
#include "boinc_fcgi.h"
|
2008-04-17 15:43:51 +00:00
|
|
|
#endif
|
|
|
|
|
2013-06-25 11:31:34 +00:00
|
|
|
//#include "client_types.h"
|
2008-04-01 15:08:47 +00:00
|
|
|
#include "miofile.h"
|
2011-09-08 18:55:55 +00:00
|
|
|
#include "error_numbers.h"
|
2011-03-25 03:44:09 +00:00
|
|
|
#include "parse.h"
|
2010-07-22 20:08:33 +00:00
|
|
|
#include "cal_boinc.h"
|
2011-04-01 19:39:58 +00:00
|
|
|
#include "cl_boinc.h"
|
2013-08-25 21:13:14 +00:00
|
|
|
#include "opencl_boinc.h"
|
2008-04-01 15:08:47 +00:00
|
|
|
|
2012-01-30 10:09:44 +00:00
|
|
|
#define DEFER_ON_GPU_AVAIL_RAM 0
|
|
|
|
|
2009-03-06 23:10:45 +00:00
|
|
|
#define MAX_COPROC_INSTANCES 64
|
2011-03-25 03:44:09 +00:00
|
|
|
#define MAX_RSC 8
|
|
|
|
// max # of processing resources types
|
2009-03-06 23:10:45 +00:00
|
|
|
|
2013-05-17 17:25:03 +00:00
|
|
|
// arguments to proc_type_name() and proc_type_name_xml().
|
|
|
|
//
|
2012-06-25 23:09:45 +00:00
|
|
|
#define PROC_TYPE_CPU 0
|
|
|
|
#define PROC_TYPE_NVIDIA_GPU 1
|
|
|
|
#define PROC_TYPE_AMD_GPU 2
|
|
|
|
#define PROC_TYPE_INTEL_GPU 3
|
|
|
|
#define NPROC_TYPES 4
|
|
|
|
|
|
|
|
extern const char* proc_type_name(int);
|
2012-08-08 23:09:43 +00:00
|
|
|
// user-readable name
|
2012-06-25 23:09:45 +00:00
|
|
|
extern const char* proc_type_name_xml(int);
|
2012-08-08 23:09:43 +00:00
|
|
|
// name used in XML and COPROC::type
|
2012-06-25 23:09:45 +00:00
|
|
|
|
2012-08-08 23:09:43 +00:00
|
|
|
// deprecated, but keep for simplicity
|
|
|
|
#define GPU_TYPE_NVIDIA proc_type_name_xml(PROC_TYPE_NVIDIA_GPU)
|
|
|
|
#define GPU_TYPE_ATI proc_type_name_xml(PROC_TYPE_AMD_GPU)
|
2012-12-05 09:42:16 +00:00
|
|
|
#define GPU_TYPE_INTEL proc_type_name_xml(PROC_TYPE_INTEL_GPU)
|
2011-08-31 11:10:22 +00:00
|
|
|
|
2009-08-24 23:16:17 +00:00
|
|
|
// represents a requirement for a coproc.
|
|
|
|
// This is a parsed version of the <coproc> elements in an <app_version>
|
2009-10-14 18:07:49 +00:00
|
|
|
// (used in client only)
|
2009-08-24 23:16:17 +00:00
|
|
|
//
|
|
|
|
struct COPROC_REQ {
|
|
|
|
char type[256]; // must be unique
|
|
|
|
double count;
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2009-08-24 23:16:17 +00:00
|
|
|
};
|
|
|
|
|
2012-06-18 20:12:30 +00:00
|
|
|
struct PCI_INFO {
|
2012-06-18 20:41:37 +00:00
|
|
|
bool present;
|
2012-06-18 20:12:30 +00:00
|
|
|
int bus_id;
|
|
|
|
int device_id;
|
|
|
|
int domain_id;
|
2012-06-18 20:41:37 +00:00
|
|
|
|
|
|
|
void write(MIOFILE&);
|
|
|
|
int parse(XML_PARSER&);
|
2012-06-18 20:12:30 +00:00
|
|
|
};
|
|
|
|
|
2011-03-24 12:16:54 +00:00
|
|
|
|
2011-01-12 01:17:07 +00:00
|
|
|
// represents a set of identical coprocessors on a particular computer.
|
2009-10-14 18:07:49 +00:00
|
|
|
// Abstract class;
|
|
|
|
// objects will always be a derived class (COPROC_CUDA, COPROC_ATI)
|
2009-08-19 18:41:47 +00:00
|
|
|
// Used in both client and server.
|
2009-04-22 02:09:53 +00:00
|
|
|
//
|
2008-03-10 20:40:35 +00:00
|
|
|
struct COPROC {
|
2008-05-09 20:54:52 +00:00
|
|
|
char type[256]; // must be unique
|
2008-03-10 20:40:35 +00:00
|
|
|
int count; // how many are present
|
2011-01-12 01:17:07 +00:00
|
|
|
double peak_flops;
|
2011-03-29 11:46:11 +00:00
|
|
|
double used; // how many are in use (used by client)
|
|
|
|
bool have_cuda; // True if this GPU supports CUDA on this computer
|
|
|
|
bool have_cal; // True if this GPU supports CAL on this computer
|
|
|
|
bool have_opencl; // True if this GPU supports openCL on this computer
|
2011-09-15 04:24:40 +00:00
|
|
|
double available_ram;
|
2011-11-03 19:19:36 +00:00
|
|
|
bool specified_in_config;
|
|
|
|
// If true, this coproc was listed in cc_config.xml
|
|
|
|
// rather than being detected by the client.
|
2013-05-17 17:25:03 +00:00
|
|
|
|
2009-01-30 21:25:24 +00:00
|
|
|
// the following are used in both client and server for work-fetch info
|
|
|
|
//
|
2009-08-19 18:41:47 +00:00
|
|
|
double req_secs;
|
|
|
|
// how many instance-seconds of work requested
|
|
|
|
double req_instances;
|
|
|
|
// client is requesting enough jobs to use this many instances
|
|
|
|
double estimated_delay;
|
|
|
|
// resource will be saturated for this long
|
2009-01-03 06:01:17 +00:00
|
|
|
|
2009-08-19 23:21:55 +00:00
|
|
|
// temps used in client (enforce_schedule())
|
|
|
|
// to keep track of what fraction of each instance is in use
|
|
|
|
// during instance assignment
|
2009-03-06 23:10:45 +00:00
|
|
|
//
|
2009-08-19 23:21:55 +00:00
|
|
|
double usage[MAX_COPROC_INSTANCES];
|
|
|
|
double pending_usage[MAX_COPROC_INSTANCES];
|
2009-03-06 23:10:45 +00:00
|
|
|
|
2009-04-21 08:11:28 +00:00
|
|
|
// the device number of each instance
|
|
|
|
// These are not sequential if we omit instances (see above)
|
|
|
|
//
|
2009-04-22 02:09:53 +00:00
|
|
|
int device_nums[MAX_COPROC_INSTANCES];
|
|
|
|
int device_num; // temp used in scan process
|
2011-03-25 14:08:50 +00:00
|
|
|
cl_device_id opencl_device_ids[MAX_COPROC_INSTANCES];
|
2011-03-29 11:46:11 +00:00
|
|
|
int opencl_device_count;
|
2012-01-20 13:30:47 +00:00
|
|
|
int opencl_device_indexes[MAX_COPROC_INSTANCES];
|
2012-06-18 20:12:30 +00:00
|
|
|
PCI_INFO pci_info;
|
|
|
|
PCI_INFO pci_infos[MAX_COPROC_INSTANCES];
|
2012-01-20 13:30:47 +00:00
|
|
|
|
2009-08-28 22:55:04 +00:00
|
|
|
bool running_graphics_app[MAX_COPROC_INSTANCES];
|
|
|
|
// is this GPU running a graphics app (NVIDIA only)
|
2012-01-30 10:09:44 +00:00
|
|
|
#if DEFER_ON_GPU_AVAIL_RAM
|
2013-05-17 17:25:03 +00:00
|
|
|
double available_ram_temp[MAX_COPROC_INSTANCES];
|
2011-09-14 22:45:26 +00:00
|
|
|
// used during job scheduling
|
2012-01-30 10:09:44 +00:00
|
|
|
#endif
|
2009-04-21 08:11:28 +00:00
|
|
|
|
2010-05-13 03:07:33 +00:00
|
|
|
double last_print_time;
|
2013-05-17 17:25:03 +00:00
|
|
|
|
2011-03-24 12:16:54 +00:00
|
|
|
OPENCL_DEVICE_PROP opencl_prop;
|
2010-05-13 03:07:33 +00:00
|
|
|
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2011-04-01 22:45:02 +00:00
|
|
|
void write_xml(MIOFILE&);
|
2010-09-23 20:54:49 +00:00
|
|
|
void write_request(MIOFILE&);
|
2008-04-17 15:43:51 +00:00
|
|
|
#endif
|
2011-10-08 08:16:24 +00:00
|
|
|
int parse(XML_PARSER&);
|
2011-03-31 15:34:05 +00:00
|
|
|
|
2009-03-06 23:27:19 +00:00
|
|
|
inline void clear() {
|
|
|
|
// can't just memcpy() - trashes vtable
|
|
|
|
type[0] = 0;
|
|
|
|
count = 0;
|
2011-06-22 11:25:06 +00:00
|
|
|
peak_flops = 0;
|
2009-03-06 23:27:19 +00:00
|
|
|
used = 0;
|
2011-03-29 11:46:11 +00:00
|
|
|
have_cuda = false;
|
|
|
|
have_cal = false;
|
|
|
|
have_opencl = false;
|
2011-11-03 19:19:36 +00:00
|
|
|
specified_in_config = false;
|
2009-03-06 23:27:19 +00:00
|
|
|
req_secs = 0;
|
|
|
|
req_instances = 0;
|
2011-03-29 11:46:11 +00:00
|
|
|
opencl_device_count = 0;
|
2009-03-06 23:27:19 +00:00
|
|
|
estimated_delay = 0;
|
2011-09-14 22:45:26 +00:00
|
|
|
available_ram = 0;
|
2009-08-28 22:55:04 +00:00
|
|
|
for (int i=0; i<MAX_COPROC_INSTANCES; i++) {
|
|
|
|
device_nums[i] = 0;
|
2011-03-25 14:08:50 +00:00
|
|
|
opencl_device_ids[i] = 0;
|
2009-08-28 22:55:04 +00:00
|
|
|
running_graphics_app[i] = true;
|
|
|
|
}
|
2011-03-25 12:30:49 +00:00
|
|
|
memset(&opencl_prop, 0, sizeof(opencl_prop));
|
2012-06-18 20:41:37 +00:00
|
|
|
memset(&pci_info, 0, sizeof(pci_info));
|
2009-03-06 23:27:19 +00:00
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
inline void clear_usage() {
|
|
|
|
for (int i=0; i<count; i++) {
|
|
|
|
usage[i] = 0;
|
|
|
|
pending_usage[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-03-06 22:21:47 +00:00
|
|
|
COPROC() {
|
2009-03-06 23:27:19 +00:00
|
|
|
clear();
|
2008-04-01 20:46:41 +00:00
|
|
|
}
|
2012-10-20 07:43:44 +00:00
|
|
|
int device_num_index(int n) {
|
2011-10-03 03:29:58 +00:00
|
|
|
for (int i=0; i<count; i++) {
|
2012-10-20 07:43:44 +00:00
|
|
|
if (device_nums[i] == n) return i;
|
2011-10-03 03:29:58 +00:00
|
|
|
}
|
2012-10-20 07:43:44 +00:00
|
|
|
return -1;
|
2011-10-03 03:29:58 +00:00
|
|
|
}
|
2011-10-10 12:36:26 +00:00
|
|
|
void merge_opencl(
|
2013-05-17 17:25:03 +00:00
|
|
|
std::vector<OPENCL_DEVICE_PROP> &opencls,
|
2011-10-10 12:36:26 +00:00
|
|
|
std::vector<int>& ignore_dev
|
|
|
|
);
|
|
|
|
void find_best_opencls(
|
|
|
|
bool use_all,
|
2013-05-17 17:25:03 +00:00
|
|
|
std::vector<OPENCL_DEVICE_PROP> &opencls,
|
2011-10-10 12:36:26 +00:00
|
|
|
std::vector<int>& ignore_dev
|
|
|
|
);
|
2008-03-10 20:40:35 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 20:49:11 +00:00
|
|
|
// Based on cudaDeviceProp from /usr/local/cuda/include/driver_types.h
|
2010-06-01 18:36:11 +00:00
|
|
|
// doesn't have to match exactly since we get the attributes one at a time.
|
2008-03-10 20:40:35 +00:00
|
|
|
//
|
2012-06-15 20:49:11 +00:00
|
|
|
// This is used for 2 purposes:
|
|
|
|
// - it's exported via GUI RPC for GUIs or other tools
|
|
|
|
// - it's sent from client to scheduler, for use by app plan functions
|
|
|
|
// Properties not relevant to either of these can be omitted.
|
|
|
|
//
|
2010-06-01 18:36:11 +00:00
|
|
|
struct CUDA_DEVICE_PROP {
|
2012-06-15 20:49:11 +00:00
|
|
|
char name[256];
|
|
|
|
double totalGlobalMem;
|
2012-07-05 20:24:17 +00:00
|
|
|
double sharedMemPerBlock;
|
2012-06-15 20:49:11 +00:00
|
|
|
int regsPerBlock;
|
|
|
|
int warpSize;
|
2012-07-05 20:24:17 +00:00
|
|
|
double memPitch;
|
2012-06-15 20:49:11 +00:00
|
|
|
int maxThreadsPerBlock;
|
|
|
|
int maxThreadsDim[3];
|
2013-05-17 17:25:03 +00:00
|
|
|
int maxGridSize[3];
|
2012-06-15 20:49:11 +00:00
|
|
|
int clockRate;
|
2013-05-17 17:25:03 +00:00
|
|
|
double totalConstMem;
|
2012-06-15 20:49:11 +00:00
|
|
|
int major; // compute capability
|
|
|
|
int minor;
|
2012-07-05 20:24:17 +00:00
|
|
|
double textureAlignment;
|
2012-06-15 20:49:11 +00:00
|
|
|
int deviceOverlap;
|
|
|
|
int multiProcessorCount;
|
2008-03-10 20:40:35 +00:00
|
|
|
};
|
|
|
|
|
2012-07-05 20:24:17 +00:00
|
|
|
typedef int CUdevice;
|
|
|
|
|
2011-03-25 03:44:09 +00:00
|
|
|
struct COPROC_NVIDIA : public COPROC {
|
2009-07-29 21:21:52 +00:00
|
|
|
int cuda_version; // CUDA runtime version
|
|
|
|
int display_driver_version;
|
2010-06-01 18:36:11 +00:00
|
|
|
CUDA_DEVICE_PROP prop;
|
2012-02-17 00:10:36 +00:00
|
|
|
COPROC_USAGE is_used; // temp used in scan process
|
2008-03-10 20:40:35 +00:00
|
|
|
|
2008-04-17 15:43:51 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2012-06-18 20:41:37 +00:00
|
|
|
void write_xml(MIOFILE&, bool scheduler_rpc);
|
2008-04-17 15:43:51 +00:00
|
|
|
#endif
|
2012-08-08 23:09:43 +00:00
|
|
|
COPROC_NVIDIA(): COPROC() {
|
2012-12-10 15:29:33 +00:00
|
|
|
clear();
|
2012-08-08 23:09:43 +00:00
|
|
|
}
|
2013-06-25 11:31:34 +00:00
|
|
|
void get(std::vector<std::string>& warnings);
|
|
|
|
void correlate(
|
2010-05-18 19:22:34 +00:00
|
|
|
bool use_all,
|
2009-11-12 23:44:49 +00:00
|
|
|
std::vector<int>& ignore_devs
|
2009-09-24 17:23:33 +00:00
|
|
|
);
|
2013-06-26 09:24:36 +00:00
|
|
|
void description(char* buf, int buflen);
|
2008-03-10 21:59:27 +00:00
|
|
|
void clear();
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2011-10-08 06:33:39 +00:00
|
|
|
void set_peak_flops();
|
2011-09-14 22:45:26 +00:00
|
|
|
void fake(int driver_version, double ram, double avail_ram, int count);
|
2010-05-18 19:22:34 +00:00
|
|
|
|
2008-03-10 20:40:35 +00:00
|
|
|
};
|
|
|
|
|
2011-12-06 19:41:14 +00:00
|
|
|
// encode a 3-part version as // 10000000*major + 10000*minor + release
|
|
|
|
// Note: ATI release #s can exceed 1000
|
|
|
|
//
|
|
|
|
inline int ati_version_int(int major, int minor, int release) {
|
|
|
|
return major*10000000 + minor*10000 + release;
|
|
|
|
}
|
|
|
|
|
2009-08-17 16:50:40 +00:00
|
|
|
struct COPROC_ATI : public COPROC {
|
2009-08-15 00:00:57 +00:00
|
|
|
char name[256];
|
|
|
|
char version[50];
|
2010-06-16 22:07:19 +00:00
|
|
|
int version_num;
|
2011-12-06 19:41:14 +00:00
|
|
|
// CAL version (not driver version) encoded as an int
|
2009-09-25 15:40:16 +00:00
|
|
|
bool atirt_detected;
|
|
|
|
bool amdrt_detected;
|
2013-05-17 17:25:03 +00:00
|
|
|
CALdeviceattribs attribs;
|
2009-10-02 22:58:03 +00:00
|
|
|
CALdeviceinfo info;
|
2012-02-17 00:10:36 +00:00
|
|
|
COPROC_USAGE is_used; // temp used in scan process
|
|
|
|
|
2009-08-15 00:00:57 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2012-06-18 20:41:37 +00:00
|
|
|
void write_xml(MIOFILE&, bool scheduler_rpc);
|
2009-08-15 00:00:57 +00:00
|
|
|
#endif
|
2012-08-08 23:09:43 +00:00
|
|
|
COPROC_ATI(): COPROC() {
|
2012-12-10 15:29:33 +00:00
|
|
|
clear();
|
2012-08-08 23:09:43 +00:00
|
|
|
}
|
2013-06-25 11:31:34 +00:00
|
|
|
void get(std::vector<std::string>& warnings);
|
|
|
|
void correlate(
|
2010-06-23 18:16:19 +00:00
|
|
|
bool use_all,
|
2009-11-12 23:44:49 +00:00
|
|
|
std::vector<int>& ignore_devs
|
2009-09-24 17:23:33 +00:00
|
|
|
);
|
2013-06-26 09:24:36 +00:00
|
|
|
void description(char* buf, int buflen);
|
2009-08-15 00:00:57 +00:00
|
|
|
void clear();
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2011-10-08 06:33:39 +00:00
|
|
|
void set_peak_flops();
|
2011-09-14 22:45:26 +00:00
|
|
|
void fake(double ram, double avail_ram, int);
|
2009-07-29 21:21:52 +00:00
|
|
|
};
|
|
|
|
|
2012-12-05 13:11:20 +00:00
|
|
|
struct COPROC_INTEL : public COPROC {
|
|
|
|
char name[256];
|
|
|
|
char version[50];
|
2012-12-08 08:27:09 +00:00
|
|
|
double global_mem_size;
|
2012-12-05 13:11:20 +00:00
|
|
|
COPROC_USAGE is_used; // temp used in scan process
|
|
|
|
|
|
|
|
#ifndef _USING_FCGI_
|
|
|
|
void write_xml(MIOFILE&, bool scheduler_rpc);
|
|
|
|
#endif
|
|
|
|
COPROC_INTEL(): COPROC() {
|
2012-12-10 15:29:33 +00:00
|
|
|
clear();
|
2012-12-05 13:11:20 +00:00
|
|
|
}
|
2013-06-25 11:31:34 +00:00
|
|
|
void get(std::vector<std::string>& warnings);
|
|
|
|
void correlate(
|
2012-12-08 08:27:09 +00:00
|
|
|
bool use_all,
|
|
|
|
std::vector<int>& ignore_devs
|
|
|
|
);
|
2012-12-05 13:11:20 +00:00
|
|
|
void clear();
|
|
|
|
int parse(XML_PARSER&);
|
|
|
|
void set_peak_flops();
|
|
|
|
void fake(double ram, double avail_ram, int);
|
|
|
|
};
|
|
|
|
|
2012-12-10 12:59:06 +00:00
|
|
|
typedef std::vector<int> IGNORE_GPU_INSTANCE[NPROC_TYPES];
|
|
|
|
|
2010-05-18 19:22:34 +00:00
|
|
|
struct COPROCS {
|
2011-03-25 03:44:09 +00:00
|
|
|
int n_rsc;
|
|
|
|
COPROC coprocs[MAX_RSC];
|
2013-05-17 17:25:03 +00:00
|
|
|
// array of processor types on this host.
|
|
|
|
// element 0 always represents the CPU.
|
|
|
|
// The remaining elements, if any, are GPUs or other coprocessors
|
|
|
|
|
|
|
|
// The following contain vendor-specific info about GPUs.
|
|
|
|
// (These GPUs are also represented by elements in the coprocs array)
|
|
|
|
//
|
2011-03-25 03:44:09 +00:00
|
|
|
COPROC_NVIDIA nvidia;
|
2010-05-18 19:22:34 +00:00
|
|
|
COPROC_ATI ati;
|
2012-12-05 13:11:20 +00:00
|
|
|
COPROC_INTEL intel_gpu;
|
2010-05-18 19:22:34 +00:00
|
|
|
|
2012-06-18 20:41:37 +00:00
|
|
|
void write_xml(MIOFILE& out, bool scheduler_rpc);
|
2010-05-18 19:22:34 +00:00
|
|
|
void get(
|
2013-05-17 17:25:03 +00:00
|
|
|
bool use_all,
|
2011-10-10 11:50:00 +00:00
|
|
|
std::vector<std::string> &descs,
|
2010-05-18 19:22:34 +00:00
|
|
|
std::vector<std::string> &warnings,
|
2012-12-10 12:59:06 +00:00
|
|
|
IGNORE_GPU_INSTANCE &ignore_gpu_instance
|
2010-05-18 19:22:34 +00:00
|
|
|
);
|
2013-06-25 11:31:34 +00:00
|
|
|
void detect_gpus(std::vector<std::string> &warnings);
|
|
|
|
int launch_child_process_to_detect_gpus();
|
|
|
|
void correlate_gpus(
|
2013-05-17 17:25:03 +00:00
|
|
|
bool use_all,
|
2013-06-25 11:31:34 +00:00
|
|
|
std::vector<std::string> &descs,
|
2012-12-10 12:59:06 +00:00
|
|
|
IGNORE_GPU_INSTANCE &ignore_gpu_instance
|
2011-08-22 08:25:32 +00:00
|
|
|
);
|
2013-06-25 11:31:34 +00:00
|
|
|
void get_opencl(
|
|
|
|
std::vector<std::string> &warnings
|
|
|
|
);
|
|
|
|
void correlate_opencl(
|
|
|
|
bool use_all,
|
|
|
|
IGNORE_GPU_INSTANCE& ignore_gpu_instance
|
|
|
|
);
|
2011-03-25 12:30:49 +00:00
|
|
|
cl_int get_opencl_info(
|
2013-05-17 17:25:03 +00:00
|
|
|
OPENCL_DEVICE_PROP& prop,
|
|
|
|
cl_uint device_index,
|
2011-10-07 11:45:44 +00:00
|
|
|
std::vector<std::string>& warnings
|
2011-03-25 12:30:49 +00:00
|
|
|
);
|
2011-08-09 21:44:14 +00:00
|
|
|
int parse(XML_PARSER&);
|
2013-06-25 11:31:34 +00:00
|
|
|
void set_path_to_client(char *path);
|
|
|
|
int write_coproc_info_file(std::vector<std::string> &warnings);
|
|
|
|
int read_coproc_info_file(std::vector<std::string> &warnings);
|
|
|
|
|
2012-03-01 02:35:45 +00:00
|
|
|
#ifdef __APPLE__
|
2013-06-26 09:24:36 +00:00
|
|
|
void opencl_get_ati_mem_size_from_opengl(std::vector<std::string> &warnings);
|
2012-03-01 02:35:45 +00:00
|
|
|
#endif
|
2011-10-04 03:33:04 +00:00
|
|
|
void summary_string(char* buf, int len);
|
2010-05-18 19:22:34 +00:00
|
|
|
|
|
|
|
// Copy a coproc set, possibly setting usage to zero.
|
|
|
|
// used in round-robin simulator and CPU scheduler,
|
|
|
|
// to avoid messing w/ master copy
|
|
|
|
//
|
|
|
|
void clone(COPROCS& c, bool copy_used) {
|
2011-03-25 03:44:09 +00:00
|
|
|
n_rsc = c.n_rsc;
|
|
|
|
for (int i=0; i<n_rsc; i++) {
|
|
|
|
coprocs[i] = c.coprocs[i];
|
|
|
|
if (!copy_used) {
|
|
|
|
coprocs[i].used = 0;
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
}
|
2011-06-23 20:44:25 +00:00
|
|
|
void clear() {
|
2011-06-22 11:25:06 +00:00
|
|
|
n_rsc = 0;
|
|
|
|
for (int i=0; i<MAX_RSC; i++) {
|
|
|
|
coprocs[i].clear();
|
|
|
|
}
|
|
|
|
nvidia.clear();
|
|
|
|
ati.clear();
|
2013-03-04 14:32:16 +00:00
|
|
|
intel_gpu.clear();
|
2011-06-22 11:25:06 +00:00
|
|
|
COPROC c;
|
|
|
|
strcpy(c.type, "CPU");
|
|
|
|
add(c);
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
inline void clear_usage() {
|
2011-03-25 03:44:09 +00:00
|
|
|
for (int i=0; i<n_rsc; i++) {
|
|
|
|
coprocs[i].clear_usage();
|
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
|
|
|
inline bool none() {
|
2011-03-25 03:44:09 +00:00
|
|
|
return (n_rsc == 1);
|
2010-05-18 19:22:34 +00:00
|
|
|
}
|
2010-05-24 23:14:48 +00:00
|
|
|
inline int ndevs() {
|
2011-03-25 03:44:09 +00:00
|
|
|
int n=0;
|
|
|
|
for (int i=1; i<n_rsc; i++) {
|
|
|
|
n += coprocs[i].count;
|
|
|
|
}
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
inline bool have_nvidia() {
|
|
|
|
return (nvidia.count > 0);
|
|
|
|
}
|
|
|
|
inline bool have_ati() {
|
|
|
|
return (ati.count > 0);
|
|
|
|
}
|
2012-12-05 13:11:20 +00:00
|
|
|
inline bool have_intel_gpu() {
|
|
|
|
return (intel_gpu.count > 0);
|
|
|
|
}
|
2011-03-25 03:44:09 +00:00
|
|
|
int add(COPROC& c) {
|
2011-09-08 18:55:55 +00:00
|
|
|
if (n_rsc >= MAX_RSC) return ERR_BUFFER_OVERFLOW;
|
2011-11-03 19:19:36 +00:00
|
|
|
for (int i=1; i<n_rsc; i++) {
|
|
|
|
if (!strcmp(c.type, coprocs[i].type)) {
|
|
|
|
return ERR_DUP_NAME;
|
|
|
|
}
|
|
|
|
}
|
2011-03-25 03:44:09 +00:00
|
|
|
coprocs[n_rsc++] = c;
|
|
|
|
return 0;
|
|
|
|
}
|
2012-06-25 23:09:45 +00:00
|
|
|
COPROC* type_to_coproc(int t) {
|
|
|
|
switch(t) {
|
|
|
|
case PROC_TYPE_NVIDIA_GPU: return &nvidia;
|
|
|
|
case PROC_TYPE_AMD_GPU: return &ati;
|
|
|
|
case PROC_TYPE_INTEL_GPU: return &intel_gpu;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-04-28 21:54:42 +00:00
|
|
|
COPROCS() {
|
|
|
|
n_rsc = 0;
|
|
|
|
nvidia.count = 0;
|
|
|
|
ati.count = 0;
|
2012-06-25 23:09:45 +00:00
|
|
|
intel_gpu.count = 0;
|
2011-03-25 03:44:09 +00:00
|
|
|
COPROC c;
|
|
|
|
strcpy(c.type, "CPU");
|
|
|
|
add(c);
|
2010-05-24 23:14:48 +00:00
|
|
|
}
|
2010-05-18 19:22:34 +00:00
|
|
|
};
|
2010-04-18 05:29:29 +00:00
|
|
|
|
2008-03-10 20:40:35 +00:00
|
|
|
#endif
|