sched_customize.cpp: add another example, and remove S@h-specific code

This commit is contained in:
David Anderson 2014-10-31 15:02:13 -07:00
parent f0c39bdf51
commit 2829e7f368
1 changed files with 6 additions and 61 deletions

View File

@ -96,7 +96,7 @@ GPU_REQUIREMENTS gpu_requirements[NPROC_TYPES];
bool wu_is_infeasible_custom(WORKUNIT& wu, APP& app, BEST_APP_VERSION& bav) { bool wu_is_infeasible_custom(WORKUNIT& wu, APP& app, BEST_APP_VERSION& bav) {
#if 0 #if 0
// example: if WU name contains "_v1", don't use GPU apps. // example 1: if WU name contains "_v1", don't use GPU apps.
// Note: this is slightly suboptimal. // Note: this is slightly suboptimal.
// If the host is able to accept both GPU and CPU jobs, // If the host is able to accept both GPU and CPU jobs,
// we'll skip this job rather than send it for the CPU. // we'll skip this job rather than send it for the CPU.
@ -107,7 +107,7 @@ bool wu_is_infeasible_custom(WORKUNIT& wu, APP& app, BEST_APP_VERSION& bav) {
} }
#endif #endif
#if 0 #if 0
// example: for NVIDIA GPU app, // example 2: for NVIDIA GPU app,
// wu.batch is the minimum number of GPU processors. // wu.batch is the minimum number of GPU processors.
// Don't send if #procs is less than this. // Don't send if #procs is less than this.
// //
@ -118,67 +118,12 @@ bool wu_is_infeasible_custom(WORKUNIT& wu, APP& app, BEST_APP_VERSION& bav) {
} }
} }
#endif #endif
#if defined(SETIATHOME) #if 0
bool infeasible=false; // example 3: require that wu.opaque = user.donated
static bool send_vlar_to_gpu=false;
static bool sah_config_checked=false;
// check the projects app config whether to send vlar wus to gpus
if (!sah_config_checked) {
MIOFILE mf;
XML_PARSER xp(&mf);
#ifndef _USING_FCGI_
FILE *f=fopen(config.project_path("sah_config.xml"),"r");
#else
FCGI_FILE *f=FCGI::fopen(config.project_path("sah_config.xml"),"r");
#endif
if (f) {
mf.init_file(f);
if (xp.parse_start("sah") && xp.parse_start("config")) {
while (!xp.get_tag()) {
if (!xp.is_tag) continue;
if (xp.parse_bool("send_vlar_to_gpu",send_vlar_to_gpu)) continue;
if (xp.match_tag("/config")) break;
xp.skip_unexpected(false, "wu_is_infeasible_custom");
}
}
fclose(f);
}
sah_config_checked=true;
}
// example: if CUDA app and WU name contains ".vlar", don't send
// to NVIDIA, INTEL or older ATI cards
// //
if (bav.host_usage.uses_gpu() && strstr(wu.name, ".vlar")) { if (wu.opaque && wu.opaque != g_reply->user.donated) {
if (send_vlar_to_gpu) { return true;
if (bav.host_usage.proc_type == PROC_TYPE_AMD_GPU) {
// ATI GPUs older than HD7870
COPROC_ATI &cp = g_request->coprocs.ati;
if (cp.count && (cp.attribs.target < 15)) {
infeasible=true;
}
} else if (bav.host_usage.proc_type == PROC_TYPE_NVIDIA_GPU) {
COPROC_NVIDIA &cp = g_request->coprocs.nvidia;
if (cp.count) {
int v = (cp.prop.major)*100 + cp.prop.minor;
if (v < 300) {
infeasible=true;
}
}
} else {
// all other GPUS
infeasible=true;
}
} else {
infeasible=true;
}
} }
if (infeasible && config.debug_version_select) {
log_messages.printf(MSG_NORMAL,
"[version] [setiathome] VLAR workunit is infeasible on this GPU\n"
);
}
return infeasible;
#endif #endif
return false; return false;
} }