mirror of https://github.com/BOINC/boinc.git
- client: add per-project GPU exclusion.
If you put an element of the form <exclude_gpu> <url>http://project_url.com/</url> <device_num>1</device_num> </exclude_gpu> in your cc_config.xml, that GPU won't be used for that project svn path=/trunk/boinc/; revision=23774
This commit is contained in:
parent
322617d616
commit
c177d990ea
|
@ -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
|
||||
<exclude_gpu>
|
||||
<url>http://project_url.com/</url>
|
||||
<device_num>1</device_num>
|
||||
</exclude_gpu>
|
||||
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
|
||||
|
|
|
@ -209,6 +209,14 @@ const char* rsc_name(int i) {
|
|||
return coprocs.coprocs[i].type;
|
||||
}
|
||||
|
||||
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());
|
||||
if (!p) continue;
|
||||
p->exclude_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;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,9 @@ 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;
|
||||
}
|
||||
strcpy(host_venue, "");
|
||||
using_venue_specific_prefs = false;
|
||||
scheduler_urls.clear();
|
||||
|
|
|
@ -222,6 +222,10 @@ struct PROJECT : PROJ_AM {
|
|||
//
|
||||
bool no_rsc_pref[MAX_RSC];
|
||||
|
||||
// if [i] is set, don't use device i for this project
|
||||
//
|
||||
bool exclude_gpu[MAX_COPROC_INSTANCES];
|
||||
|
||||
// the following are from the project itself
|
||||
// (or derived from app version list if anonymous platform)
|
||||
//
|
||||
|
|
|
@ -1110,6 +1110,10 @@ 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 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])
|
||||
) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -127,6 +127,8 @@ 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<std::string> exclusive_apps;
|
||||
std::vector<std::string> exclusive_gpu_apps;
|
||||
bool exit_after_finish;
|
||||
|
|
Loading…
Reference in New Issue