mirror of https://github.com/BOINC/boinc.git
- client: get GPU available RAM at startup (only)
- client: fix compile warning svn path=/trunk/boinc/; revision=24188
This commit is contained in:
parent
c2f1855be3
commit
7f2a3c0ce1
|
@ -5957,3 +5957,15 @@ Rom 13 Sept 2011
|
|||
|
||||
samples/vboxwrapper/
|
||||
vbox.cpp
|
||||
|
||||
David 13 Sept 2011
|
||||
- client: get GPU available RAM at startup (only)
|
||||
- client: fix compile warning
|
||||
|
||||
lib/
|
||||
coproc.cpp
|
||||
client/
|
||||
work_fetch.cpp,h
|
||||
client_state.cpp
|
||||
coproc_detect.cpp
|
||||
cpu_sched.cpp
|
||||
|
|
|
@ -386,6 +386,7 @@ int CLIENT_STATE::init() {
|
|||
msg_printf(NULL, MSG_INFO, "NVIDIA GPU info taken from cc_config.xml");
|
||||
} else {
|
||||
coprocs.add(coprocs.nvidia);
|
||||
coprocs.nvidia.print_available_ram();
|
||||
}
|
||||
}
|
||||
if (coprocs.have_ati()) {
|
||||
|
@ -393,6 +394,7 @@ int CLIENT_STATE::init() {
|
|||
msg_printf(NULL, MSG_INFO, "ATI GPU info taken from cc_config.xml");
|
||||
} else {
|
||||
coprocs.add(coprocs.ati);
|
||||
coprocs.ati.print_available_ram();
|
||||
}
|
||||
}
|
||||
host_info._coprocs = coprocs;
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
//#define MEASURE_AVAILABLE_RAM
|
||||
|
||||
static bool in_vector(int n, vector<int>& v) {
|
||||
for (unsigned int i=0; i<v.size(); i++) {
|
||||
if (v[i] == n) return true;
|
||||
|
@ -104,10 +102,6 @@ cl_int (*__clGetDeviceInfo)(cl_device_id /* device */,
|
|||
#endif
|
||||
|
||||
void COPROC::print_available_ram() {
|
||||
#ifdef MEASURE_AVAILABLE_RAM
|
||||
if (gstate.now - last_print_time < 60) return;
|
||||
last_print_time = gstate.now;
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
if (available_ram_unknown[i]) {
|
||||
if (log_flags.coproc_debug) {
|
||||
|
@ -126,7 +120,6 @@ void COPROC::print_available_ram() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -919,6 +912,8 @@ void COPROC_NVIDIA::get(
|
|||
return;
|
||||
}
|
||||
|
||||
get_available_ram();
|
||||
|
||||
// identify the most capable non-ignored instance
|
||||
//
|
||||
bool first = true;
|
||||
|
@ -988,7 +983,6 @@ void COPROC_NVIDIA::fake(int driver_version, double ram, int n) {
|
|||
// If this fails, set "available_ram_unknown"
|
||||
//
|
||||
void COPROC_NVIDIA::get_available_ram() {
|
||||
#ifdef MEASURE_AVAILABLE_RAM
|
||||
int device, i, retval;
|
||||
unsigned int memfree, memtotal;
|
||||
unsigned int ctx;
|
||||
|
@ -1038,12 +1032,6 @@ void COPROC_NVIDIA::get_available_ram() {
|
|||
available_ram[i] = (double) memfree;
|
||||
available_ram_unknown[i] = false;
|
||||
}
|
||||
#else
|
||||
for (int i=0; i<count; i++) {
|
||||
available_ram_unknown[i] = false;
|
||||
available_ram[i] = prop.totalGlobalMem;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// check whether each GPU is running a graphics app (assume yes)
|
||||
|
@ -1417,6 +1405,8 @@ void COPROC_ATI::get(
|
|||
gpus.push_back(cc);
|
||||
}
|
||||
|
||||
get_available_ram();
|
||||
|
||||
// shut down, otherwise Lenovo won't be able to switch to low-power GPU
|
||||
//
|
||||
retval = (*__calShutdown)();
|
||||
|
@ -1472,8 +1462,10 @@ void COPROC_ATI::fake(double ram, int n) {
|
|||
set_peak_flops();
|
||||
}
|
||||
|
||||
// get available RAM of ATI GPUs
|
||||
// NOTE: last time we checked, repeated calls to this crash the driver
|
||||
//
|
||||
void COPROC_ATI::get_available_ram() {
|
||||
#ifdef MEASURE_AVAILABLE_RAM
|
||||
CALdevicestatus st;
|
||||
CALdevice dev;
|
||||
int i, retval;
|
||||
|
@ -1491,18 +1483,6 @@ void COPROC_ATI::get_available_ram() {
|
|||
for (i=0; i<count; i++) {
|
||||
available_ram[i] = 0;
|
||||
available_ram_unknown[i] = true;
|
||||
}
|
||||
retval = (*__calInit)();
|
||||
if (retval) {
|
||||
if (log_flags.coproc_debug) {
|
||||
msg_printf(0, MSG_INFO,
|
||||
"[coproc] calInit() returned %d", retval
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
int devnum = device_nums[i];
|
||||
retval = (*__calDeviceOpen)(&dev, devnum);
|
||||
if (retval) {
|
||||
|
@ -1528,13 +1508,6 @@ void COPROC_ATI::get_available_ram() {
|
|||
available_ram_unknown[i] = false;
|
||||
(*__calDeviceClose)(dev);
|
||||
}
|
||||
(*__calShutdown)();
|
||||
#else
|
||||
for (int i=0; i<count; i++) {
|
||||
available_ram_unknown[i] = false;
|
||||
available_ram[i] = attribs.localRAM*MEGA;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool COPROC_ATI::matches(OPENCL_DEVICE_PROP& OpenCLprop) {
|
||||
|
|
|
@ -1357,17 +1357,9 @@ static inline void assign_coprocs(vector<RESULT*>& jobs) {
|
|||
|
||||
coprocs.clear_usage();
|
||||
if (coprocs.have_nvidia()) {
|
||||
coprocs.nvidia.get_available_ram();
|
||||
if (log_flags.coproc_debug) {
|
||||
coprocs.nvidia.print_available_ram();
|
||||
}
|
||||
copy_available_ram(coprocs.nvidia, GPU_TYPE_NVIDIA);
|
||||
}
|
||||
if (coprocs.have_ati()) {
|
||||
coprocs.ati.get_available_ram();
|
||||
if (log_flags.coproc_debug) {
|
||||
coprocs.ati.print_available_ram();
|
||||
}
|
||||
copy_available_ram(coprocs.ati, GPU_TYPE_ATI);
|
||||
}
|
||||
|
||||
|
|
|
@ -298,16 +298,16 @@ PROJECT* RSC_WORK_FETCH::choose_project(int criterion) {
|
|||
switch (criterion) {
|
||||
case FETCH_IF_IDLE_INSTANCE:
|
||||
case FETCH_IF_MAJOR_SHORTFALL:
|
||||
set_request(pbest, true);
|
||||
set_request(pbest);
|
||||
break;
|
||||
case FETCH_IF_PROJECT_STARVED:
|
||||
set_request(pbest, false);
|
||||
set_request(pbest);
|
||||
break;
|
||||
case FETCH_IF_MINOR_SHORTFALL:
|
||||
// in this case, potentially request work for all resources
|
||||
//
|
||||
if (project_priority(pbest) < 0) {
|
||||
set_request(pbest, true);
|
||||
set_request(pbest);
|
||||
} else {
|
||||
work_fetch.set_all_requests(pbest);
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ PROJECT* RSC_WORK_FETCH::choose_project(int criterion) {
|
|||
// request this project's share of shortfall and instances.
|
||||
// don't request anything if project is overworked or backed off.
|
||||
//
|
||||
void RSC_WORK_FETCH::set_request(PROJECT* p, bool allow_overworked) {
|
||||
void RSC_WORK_FETCH::set_request(PROJECT* p) {
|
||||
if (dont_fetch(p, rsc_type)) return;
|
||||
|
||||
// if backup project, fetch 1 job per idle instance
|
||||
|
@ -474,13 +474,13 @@ void RSC_WORK_FETCH::supplement(PROJECT* pp) {
|
|||
}
|
||||
}
|
||||
// didn't find a better project; ask for work
|
||||
set_request(pp, true);
|
||||
set_request(pp);
|
||||
}
|
||||
|
||||
void WORK_FETCH::set_all_requests_hyst(PROJECT* p, int rsc_type) {
|
||||
for (int i=0; i<coprocs.n_rsc; i++) {
|
||||
if (i == rsc_type) {
|
||||
rsc_work_fetch[i].set_request(p, true);
|
||||
rsc_work_fetch[i].set_request(p);
|
||||
} else {
|
||||
if (i==0 || gpus_usable) {
|
||||
rsc_work_fetch[i].supplement(p);
|
||||
|
@ -492,7 +492,7 @@ void WORK_FETCH::set_all_requests_hyst(PROJECT* p, int rsc_type) {
|
|||
void WORK_FETCH::set_all_requests(PROJECT* p) {
|
||||
for (int i=0; i<coprocs.n_rsc; i++) {
|
||||
if (i==0 || gpus_usable) {
|
||||
rsc_work_fetch[i].set_request(p, false);
|
||||
rsc_work_fetch[i].set_request(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ struct RSC_WORK_FETCH {
|
|||
RSC_PROJECT_WORK_FETCH& project_state(PROJECT*);
|
||||
void print_state(const char*);
|
||||
void clear_request();
|
||||
void set_request(PROJECT*, bool allow_overworked);
|
||||
void set_request(PROJECT*);
|
||||
bool may_have_work(PROJECT*);
|
||||
RSC_WORK_FETCH() {
|
||||
rsc_type = 0;
|
||||
|
|
|
@ -365,7 +365,6 @@ void COPROC_NVIDIA::write_xml(MIOFILE& f, bool include_request) {
|
|||
prop.multiProcessorCount
|
||||
);
|
||||
|
||||
|
||||
if (have_opencl) {
|
||||
opencl_write_xml(f);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue