diff --git a/checkin_notes b/checkin_notes
index 66e9051738..85803d3894 100644
--- a/checkin_notes
+++ b/checkin_notes
@@ -3749,3 +3749,19 @@ David 23 Jun 2011
lib/
coproc.h
+
+David 23 Jun 2011
+ - client: add per-project GPU exclusion.
+ If you put an element of the form
+
+ http://project_url.com/
+ 1
+
+ in your cc_config.xml, that GPU won't be used for that project
+
+ lib/
+ cc_config.cpp,h
+ client/
+ client_types.cpp,h
+ client_state.cpp
+ cpu_sched.cpp
diff --git a/client/client_state.cpp b/client/client_state.cpp
index e494931c66..144bc69e25 100644
--- a/client/client_state.cpp
+++ b/client/client_state.cpp
@@ -209,6 +209,14 @@ const char* rsc_name(int i) {
return coprocs.coprocs[i].type;
}
+void init_exclude_gpu() {
+ for (int i=0; iexclude_gpu[config.exclude_gpu_devnum[i]] = true;
+ }
+}
+
// set no_X_apps for anonymous platform project
//
static void check_no_apps(PROJECT* p) {
@@ -586,6 +594,10 @@ int CLIENT_STATE::init() {
//
check_too_large_jobs();
+ // fill in exclude-GPU flags
+ //
+ init_exclude_gpu();
+
initialized = true;
return 0;
}
diff --git a/client/client_types.cpp b/client/client_types.cpp
index 67b5dc5cfd..de4f3141e7 100644
--- a/client/client_types.cpp
+++ b/client/client_types.cpp
@@ -71,6 +71,9 @@ void PROJECT::init() {
no_rsc_ams[i] = false;
rsc_defer_sched[i] = false;
}
+ for (int i=0; i &run_list) {
// else
// prune J
+static inline bool excluded(RESULT* rp, int devnum) {
+ return rp->project->exclude_gpu[devnum];
+}
+
static inline void increment_pending_usage(
RESULT* rp, double usage, COPROC* cp
) {
@@ -1183,6 +1187,9 @@ static inline bool get_fractional_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
+ if (excluded(rp, cp->device_nums[i])) {
+ continue;
+ }
if ((cp->usage[i] || cp->pending_usage[i])
&& (cp->usage[i] + cp->pending_usage[i] + usage <= 1)
) {
@@ -1209,6 +1216,9 @@ static inline bool get_fractional_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
+ if (excluded(rp, cp->device_nums[i])) {
+ continue;
+ }
if (!cp->usage[i]) {
if (rp->avp->gpu_ram > cp->available_ram[i]) {
defer_sched = true;
@@ -1249,6 +1259,9 @@ static inline bool get_integer_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
+ if (excluded(rp, cp->device_nums[i])) {
+ continue;
+ }
if (!cp->usage[i]) {
if (rp->avp->gpu_ram > cp->available_ram[i]) {
defer_sched = true;
@@ -1280,6 +1293,9 @@ static inline bool get_integer_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
+ if (excluded(rp, cp->device_nums[i])) {
+ continue;
+ }
if (!cp->usage[i]
&& !cp->pending_usage[i]
&& (rp->avp->gpu_ram <= cp->available_ram[i])
@@ -1303,6 +1319,9 @@ static inline bool get_integer_assignment(
if (cp->available_ram_unknown[i]) {
continue;
}
+ if (excluded(rp, cp->device_nums[i])) {
+ continue;
+ }
if (!cp->usage[i]
&& (rp->avp->gpu_ram <= cp->available_ram[i])
) {
diff --git a/lib/cc_config.cpp b/lib/cc_config.cpp
index 38183396be..b4c82a2ff1 100644
--- a/lib/cc_config.cpp
+++ b/lib/cc_config.cpp
@@ -30,6 +30,7 @@
#include "filesys.h"
#include "parse.h"
#include "str_util.h"
+#include "url.h"
#include "cc_config.h"
@@ -192,6 +193,8 @@ void CONFIG::defaults() {
disallow_attach = false;
dont_check_file_sizes = false;
dont_contact_ref_site = false;
+ exclude_gpu_devnum.clear();
+ exclude_gpu_url.clear();
exclusive_apps.clear();
exclusive_gpu_apps.clear();
exit_after_finish = false;
@@ -231,6 +234,27 @@ void CONFIG::defaults() {
zero_debts = false;
}
+static bool parse_exclude_gpu(XML_PARSER& xp, int& devnum, string& url) {
+ char tag[1024];
+ bool is_tag;
+ bool found_devnum = false;
+ bool found_url = false;
+ 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)) {
+ found_devnum = true;
+ continue;
+ }
+ if (xp.parse_string(tag, "url", url)) {
+ found_url = true;
+ continue;
+ }
+ }
+ return false;
+}
int CONFIG::parse_options(XML_PARSER& xp) {
char tag[1024];
@@ -284,6 +308,16 @@ int CONFIG::parse_options(XML_PARSER& xp) {
if (xp.parse_bool(tag, "disallow_attach", disallow_attach)) continue;
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);
+ }
+ continue;
+ }
if (xp.parse_string(tag, "exclusive_app", s)) {
if (!strstr(s.c_str(), "boinc")) {
exclusive_apps.push_back(s);
diff --git a/lib/cc_config.h b/lib/cc_config.h
index 4fa310d75b..48b09e862c 100644
--- a/lib/cc_config.h
+++ b/lib/cc_config.h
@@ -127,6 +127,8 @@ struct CONFIG {
bool disallow_attach;
bool dont_check_file_sizes;
bool dont_contact_ref_site;
+ std::vector exclude_gpu_devnum;
+ std::vector exclude_gpu_url;
std::vector exclusive_apps;
std::vector exclusive_gpu_apps;
bool exit_after_finish;