Skip to content

Commit

Permalink
- client: add <type> element to <exclude_gpu> config option,
Browse files Browse the repository at this point in the history
    in case of multiple GPU types


svn path=/trunk/boinc/; revision=23777
  • Loading branch information
davidpanderson committed Jun 25, 2011
1 parent 51867b9 commit 4403df4
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 28 deletions.
11 changes: 11 additions & 0 deletions checkin_notes
Original file line number Diff line number Diff line change
Expand Up @@ -3784,3 +3784,14 @@ Charlie 24 Jun 2011
mac_build/
boinc.xcodeproj/
project.pbxproj

David 24 Jun 2011
- client: add <type> element to <exclude_gpu> config option,
in case of multiple GPU types

lib/
cc_config.cpp,h
client/
client_types.cpp,h
client_state.cpp
cpu_sched.cpp
7 changes: 4 additions & 3 deletions client/client_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ const char* rsc_name(int i) {
}

void init_exclude_gpu() {
for (int i=0; i<config.exclude_gpu_url.size(); i++) {
PROJECT* p = gstate.lookup_project(config.exclude_gpu_url[i].c_str());
for (unsigned int i=0; i<config.exclude_gpus.size(); i++) {
EXCLUDE_GPU& eg = config.exclude_gpus[i];
PROJECT* p = gstate.lookup_project(eg.url.c_str());
if (!p) continue;
p->exclude_gpu[config.exclude_gpu_devnum[i]] = true;
p->exclude_gpus.push_back(eg);
}
}

Expand Down
4 changes: 1 addition & 3 deletions client/client_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ void PROJECT::init() {
no_rsc_ams[i] = false;
rsc_defer_sched[i] = false;
}
for (int i=0; i<MAX_COPROC_INSTANCES; i++) {
exclude_gpu[i] = false;
}
exclude_gpus.clear();
strcpy(host_venue, "");
using_venue_specific_prefs = false;
scheduler_urls.clear();
Expand Down
5 changes: 3 additions & 2 deletions client/client_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "coproc.h"
#include "miofile.h"
#include "common_defs.h"
#include "cc_config.h"

#include "rr_sim.h"
#include "work_fetch.h"
Expand Down Expand Up @@ -222,9 +223,9 @@ struct PROJECT : PROJ_AM {
//
bool no_rsc_pref[MAX_RSC];

// if [i] is set, don't use device i for this project
// list of GPUs not to use for this project
//
bool exclude_gpu[MAX_COPROC_INSTANCES];
std::vector<EXCLUDE_GPU> exclude_gpus;

// the following are from the project itself
// (or derived from app version list if anonymous platform)
Expand Down
21 changes: 14 additions & 7 deletions client/cpu_sched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1110,8 +1110,15 @@ void CLIENT_STATE::append_unfinished_time_slice(vector<RESULT*> &run_list) {
// else
// prune J

static inline bool excluded(RESULT* rp, int devnum) {
return rp->project->exclude_gpu[devnum];
static inline bool excluded(RESULT* rp, COPROC* cp, int ind) {
PROJECT* p = rp->project;
for (unsigned int i=0; i<p->exclude_gpus.size(); i++) {
EXCLUDE_GPU& eg = p->exclude_gpus[i];
if (!eg.type.empty() && (eg.type != cp->type)) continue;
if (eg.devnum != cp->device_nums[ind]) continue;
return true;
}
return false;
}

static inline void increment_pending_usage(
Expand Down Expand Up @@ -1187,7 +1194,7 @@ static inline bool get_fractional_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
if (excluded(rp, cp->device_nums[i])) {
if (excluded(rp, cp, i)) {
continue;
}
if ((cp->usage[i] || cp->pending_usage[i])
Expand Down Expand Up @@ -1216,7 +1223,7 @@ static inline bool get_fractional_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
if (excluded(rp, cp->device_nums[i])) {
if (excluded(rp, cp, i)) {
continue;
}
if (!cp->usage[i]) {
Expand Down Expand Up @@ -1259,7 +1266,7 @@ static inline bool get_integer_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
if (excluded(rp, cp->device_nums[i])) {
if (excluded(rp, cp, i)) {
continue;
}
if (!cp->usage[i]) {
Expand Down Expand Up @@ -1293,7 +1300,7 @@ static inline bool get_integer_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
if (excluded(rp, cp->device_nums[i])) {
if (excluded(rp, cp, i)) {
continue;
}
if (!cp->usage[i]
Expand All @@ -1319,7 +1326,7 @@ static inline bool get_integer_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
if (excluded(rp, cp->device_nums[i])) {
if (excluded(rp, cp, i)) {
continue;
}
if (!cp->usage[i]
Expand Down
1 change: 1 addition & 0 deletions db/boinc_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ struct RESULT {
double opaque; // project-specific; usually external ID
int random; // determines send order
int app_version_num; // version# of app (not core client)
// DEPRECATED - THIS DOESN'T DETERMINE VERSION ANY MORE
int appid; // copy of WU's appid
int exit_status; // application exit status, if any
int teamid;
Expand Down
21 changes: 10 additions & 11 deletions lib/cc_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ void CONFIG::defaults() {
disallow_attach = false;
dont_check_file_sizes = false;
dont_contact_ref_site = false;
exclude_gpu_devnum.clear();
exclude_gpu_url.clear();
exclude_gpus.clear();
exclusive_apps.clear();
exclusive_gpu_apps.clear();
exit_after_finish = false;
Expand Down Expand Up @@ -234,24 +233,27 @@ void CONFIG::defaults() {
zero_debts = false;
}

static bool parse_exclude_gpu(XML_PARSER& xp, int& devnum, string& url) {
static bool parse_exclude_gpu(XML_PARSER& xp, EXCLUDE_GPU& eg) {
char tag[1024];
bool is_tag;
bool found_devnum = false;
bool found_url = false;
eg.type = "";
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) continue;
if (!strcmp(tag, "/exclude_gpu")) {
return (found_devnum && found_url);
}
if (xp.parse_int(tag, "devnum", devnum)) {
if (xp.parse_int(tag, "devnum", eg.devnum)) {
found_devnum = true;
continue;
}
if (xp.parse_string(tag, "url", url)) {
if (xp.parse_string(tag, "url", eg.url)) {
canonicalize_master_url(eg.url);
found_url = true;
continue;
}
if (xp.parse_string(tag, "type", eg.type)) continue;
}
return false;
}
Expand Down Expand Up @@ -309,12 +311,9 @@ int CONFIG::parse_options(XML_PARSER& xp) {
if (xp.parse_bool(tag, "dont_check_file_sizes", dont_check_file_sizes)) continue;
if (xp.parse_bool(tag, "dont_contact_ref_site", dont_contact_ref_site)) continue;
if (!strcmp(tag, "exclude_gpu")) {
int devnum;
string url;
if (parse_exclude_gpu(xp, devnum, url)) {
exclude_gpu_devnum.push_back(devnum);
canonicalize_master_url(url);
exclude_gpu_url.push_back(url);
EXCLUDE_GPU eg;
if (parse_exclude_gpu(xp, eg)) {
exclude_gpus.push_back(eg);
}
continue;
}
Expand Down
9 changes: 7 additions & 2 deletions lib/cc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ struct LOG_FLAGS {
int write(MIOFILE& out);
};

struct EXCLUDE_GPU {
std::string url;
std::string type;
int devnum;
};

// if you add anything, you must add it to
// defaults(), parse_options(), and write()
//
Expand All @@ -127,8 +133,7 @@ struct CONFIG {
bool disallow_attach;
bool dont_check_file_sizes;
bool dont_contact_ref_site;
std::vector<int> exclude_gpu_devnum;
std::vector<std::string> exclude_gpu_url;
std::vector<EXCLUDE_GPU> exclude_gpus;
std::vector<std::string> exclusive_apps;
std::vector<std::string> exclusive_gpu_apps;
bool exit_after_finish;
Expand Down

0 comments on commit 4403df4

Please sign in to comment.