2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2008-03-20 03:13:30 +00:00
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
2008-03-20 03:13:30 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2008-03-20 03:13:30 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2008-03-20 03:13:30 +00:00
|
|
|
|
|
|
|
#include "boinc_db.h"
|
2009-08-10 04:56:46 +00:00
|
|
|
#include "sched_types.h"
|
2008-03-20 03:13:30 +00:00
|
|
|
|
2011-10-07 18:11:52 +00:00
|
|
|
// this keeps track of the project's lowest and highest requirements
|
|
|
|
// for a GPU type, so that we can send users an appropriate message
|
|
|
|
//
|
2010-06-16 22:07:19 +00:00
|
|
|
struct GPU_REQUIREMENTS {
|
|
|
|
double min_ram;
|
|
|
|
double opt_ram;
|
|
|
|
int min_driver_version;
|
|
|
|
int opt_driver_version;
|
|
|
|
|
|
|
|
void clear() {
|
|
|
|
min_ram = opt_ram = 0;
|
|
|
|
min_driver_version = opt_driver_version = 0;
|
|
|
|
}
|
|
|
|
void update(int version, double ram) {
|
|
|
|
if (min_driver_version) {
|
|
|
|
if (version < min_driver_version) {
|
|
|
|
min_driver_version = version;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
min_driver_version = version;
|
|
|
|
}
|
|
|
|
if (version > opt_driver_version) {
|
|
|
|
opt_driver_version = version;
|
|
|
|
}
|
|
|
|
if (min_ram) {
|
|
|
|
if (ram < min_ram) {
|
|
|
|
min_ram = ram;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
min_ram = ram;
|
|
|
|
}
|
|
|
|
if (ram > opt_ram) {
|
|
|
|
opt_ram = ram;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-06-25 23:09:45 +00:00
|
|
|
extern GPU_REQUIREMENTS gpu_requirements[NPROC_TYPES];
|
2010-06-16 22:07:19 +00:00
|
|
|
|
2009-07-29 18:55:50 +00:00
|
|
|
extern bool wu_is_infeasible_custom(WORKUNIT&, APP&, BEST_APP_VERSION&);
|
2009-08-21 20:38:39 +00:00
|
|
|
extern bool app_plan(SCHEDULER_REQUEST&, char* plan_class, HOST_USAGE&);
|
2011-07-19 20:52:41 +00:00
|
|
|
extern void handle_file_xfer_results();
|
2012-03-21 12:40:18 +00:00
|
|
|
|
|
|
|
// Suppose we have a computation that uses two devices alternately.
|
|
|
|
// The devices have speeds s1 and s2.
|
|
|
|
// The fraction of work done on device 1 is frac.
|
|
|
|
//
|
|
|
|
// This function returns:
|
|
|
|
// 1) the overall speed
|
|
|
|
// 2) the utilization of device 1, which is always in (0, 1).
|
|
|
|
//
|
|
|
|
static inline void coproc_perf(
|
|
|
|
double s1, double s2, double frac,
|
|
|
|
double& speed, double& u1
|
|
|
|
) {
|
|
|
|
double y = (frac*s2 + (1-frac)*s1);
|
|
|
|
speed = s1*s2/y;
|
|
|
|
// do the math
|
|
|
|
u1 = frac*s2/y;
|
|
|
|
}
|