2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2003-08-01 23:40:16 +00:00
|
|
|
//
|
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.
|
2003-08-01 23:40:16 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +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.
|
2002-12-03 18:57:40 +00:00
|
|
|
//
|
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/>.
|
2002-12-03 18:57:40 +00:00
|
|
|
|
2004-08-21 19:03:12 +00:00
|
|
|
// The structure of the memory segment shared between
|
|
|
|
// the feeder and schedulers
|
|
|
|
// This is essentially a cache of DB contents:
|
|
|
|
// small static tables like app_version,
|
|
|
|
// and a queue of results waiting to be sent.
|
|
|
|
|
2007-05-02 23:14:00 +00:00
|
|
|
#ifndef _SCHED_SHMEM_H_
|
|
|
|
#define _SCHED_SHMEM_H_
|
|
|
|
|
2003-04-07 19:06:00 +00:00
|
|
|
#include "boinc_db.h"
|
2012-01-09 17:35:48 +00:00
|
|
|
#include "sched_util.h"
|
2012-06-22 07:35:54 +00:00
|
|
|
#include "sched_types.h"
|
2008-05-06 19:53:49 +00:00
|
|
|
#include "hr_info.h"
|
2002-05-30 07:14:21 +00:00
|
|
|
|
2002-12-03 18:57:40 +00:00
|
|
|
// the following must be at least as large as DB tables
|
2004-09-24 20:17:52 +00:00
|
|
|
// (counting only non-deprecated entries for the current major version)
|
2002-12-03 18:57:40 +00:00
|
|
|
// Increase as needed
|
|
|
|
//
|
2002-05-30 07:14:21 +00:00
|
|
|
#define MAX_PLATFORMS 50
|
|
|
|
#define MAX_APPS 10
|
2004-09-24 20:17:52 +00:00
|
|
|
#define MAX_APP_VERSIONS 50
|
2008-02-21 00:47:50 +00:00
|
|
|
#define MAX_ASSIGNMENTS 10
|
2004-09-02 17:14:03 +00:00
|
|
|
|
2007-05-29 21:45:01 +00:00
|
|
|
// Default number of work items in shared mem.
|
|
|
|
// You can configure this in config.xml (<shmem_work_items>)
|
2004-09-02 17:14:03 +00:00
|
|
|
// If you increase this above 100,
|
|
|
|
// you may exceed the max shared-memory segment size
|
|
|
|
// on some operating systems.
|
2007-05-29 21:45:01 +00:00
|
|
|
//
|
2004-09-02 17:14:03 +00:00
|
|
|
#define MAX_WU_RESULTS 100
|
2004-02-05 21:35:48 +00:00
|
|
|
|
2006-01-19 21:46:25 +00:00
|
|
|
// values of WU_RESULT.state
|
2004-04-04 01:59:47 +00:00
|
|
|
#define WR_STATE_EMPTY 0
|
|
|
|
#define WR_STATE_PRESENT 1
|
2006-01-19 21:46:25 +00:00
|
|
|
// If neither of the above, the value is the PID of a scheduler process
|
2004-08-31 23:08:28 +00:00
|
|
|
// that has this item reserved
|
2004-04-04 01:59:47 +00:00
|
|
|
|
2002-05-30 07:14:21 +00:00
|
|
|
// a workunit/result pair
|
|
|
|
struct WU_RESULT {
|
2004-04-04 01:59:47 +00:00
|
|
|
int state;
|
2009-08-31 19:35:46 +00:00
|
|
|
// EMPTY, PRESENT, or PID of locking process
|
2003-09-21 21:00:25 +00:00
|
|
|
int infeasible_count;
|
2011-01-07 20:23:22 +00:00
|
|
|
bool need_reliable; // try to send to a reliable host
|
2002-05-30 07:14:21 +00:00
|
|
|
WORKUNIT workunit;
|
2004-05-17 17:24:14 +00:00
|
|
|
int resultid;
|
2006-05-02 22:17:09 +00:00
|
|
|
int time_added_to_shared_memory;
|
2009-08-31 19:35:46 +00:00
|
|
|
int res_priority;
|
|
|
|
int res_server_state;
|
|
|
|
double res_report_deadline;
|
2008-05-06 19:53:49 +00:00
|
|
|
double fpops_size; // measured in stdevs
|
2002-05-30 07:14:21 +00:00
|
|
|
};
|
|
|
|
|
2007-05-29 21:45:01 +00:00
|
|
|
// this struct is followed in memory by an array of WU_RESULTS
|
|
|
|
//
|
2002-05-30 07:14:21 +00:00
|
|
|
struct SCHED_SHMEM {
|
2002-06-01 20:26:21 +00:00
|
|
|
bool ready; // feeder sets to true when init done
|
2002-05-30 07:14:21 +00:00
|
|
|
// the following fields let the scheduler make sure
|
|
|
|
// that the shared mem has the right format
|
2008-05-06 19:53:49 +00:00
|
|
|
int ss_size; // size of this struct, including WU_RESULT array
|
2002-05-30 07:14:21 +00:00
|
|
|
int platform_size; // sizeof(PLATFORM)
|
|
|
|
int app_size; // sizeof(APP)
|
|
|
|
int app_version_size; // sizeof(APP_VERSION)
|
2008-02-21 00:47:50 +00:00
|
|
|
int assignment_size; // sizeof(ASSIGNMENT))
|
2002-05-30 07:14:21 +00:00
|
|
|
int wu_result_size; // sizeof(WU_RESULT)
|
|
|
|
int nplatforms;
|
|
|
|
int napps;
|
2010-03-22 20:12:24 +00:00
|
|
|
double app_weight_sum;
|
2002-05-30 07:14:21 +00:00
|
|
|
int napp_versions;
|
2008-02-21 00:47:50 +00:00
|
|
|
int nassignments;
|
2002-05-30 07:14:21 +00:00
|
|
|
int max_platforms;
|
|
|
|
int max_apps;
|
|
|
|
int max_app_versions;
|
2008-02-21 00:47:50 +00:00
|
|
|
int max_assignments;
|
2002-05-30 07:14:21 +00:00
|
|
|
int max_wu_results;
|
2012-08-29 03:09:10 +00:00
|
|
|
bool locality_sched_lite; // some app uses locality sched Lite
|
2012-09-01 04:58:12 +00:00
|
|
|
bool have_nci_app;
|
2012-06-22 07:35:54 +00:00
|
|
|
bool have_apps_for_proc_type[NPROC_TYPES];
|
2008-05-06 19:53:49 +00:00
|
|
|
PERF_INFO perf_info;
|
2002-05-30 07:14:21 +00:00
|
|
|
PLATFORM platforms[MAX_PLATFORMS];
|
|
|
|
APP apps[MAX_APPS];
|
|
|
|
APP_VERSION app_versions[MAX_APP_VERSIONS];
|
2008-02-21 00:47:50 +00:00
|
|
|
ASSIGNMENT assignments[MAX_ASSIGNMENTS];
|
2007-05-29 21:45:01 +00:00
|
|
|
WU_RESULT wu_results[0];
|
2002-05-30 07:14:21 +00:00
|
|
|
|
2007-05-29 21:45:01 +00:00
|
|
|
void init(int nwu_results);
|
2002-05-30 07:14:21 +00:00
|
|
|
int verify();
|
|
|
|
int scan_tables();
|
2004-07-24 00:09:28 +00:00
|
|
|
bool no_work(int pid);
|
|
|
|
void restore_work(int pid);
|
2009-01-13 23:06:02 +00:00
|
|
|
#ifndef _USING_FCGI_
|
2007-07-05 23:06:18 +00:00
|
|
|
void show(FILE*);
|
2009-01-13 23:06:02 +00:00
|
|
|
#else
|
|
|
|
void show(FCGI_FILE*);
|
|
|
|
#endif
|
2002-05-30 07:14:21 +00:00
|
|
|
|
|
|
|
APP* lookup_app(int);
|
2010-04-08 23:14:47 +00:00
|
|
|
APP* lookup_app_name(char*);
|
2010-04-21 19:33:20 +00:00
|
|
|
APP_VERSION* lookup_app_version(int);
|
2011-12-12 22:57:58 +00:00
|
|
|
APP_VERSION* lookup_app_version_platform_plan_class(
|
|
|
|
int platform, char* plan_class
|
|
|
|
);
|
2012-12-06 07:09:22 +00:00
|
|
|
double total_expavg_credit() {
|
|
|
|
double x = 0;
|
|
|
|
for (int i=0; i<napp_versions; i++) {
|
|
|
|
x += app_versions[i].expavg_credit;
|
|
|
|
}
|
|
|
|
return x;
|
|
|
|
}
|
2007-05-02 23:14:00 +00:00
|
|
|
PLATFORM* lookup_platform_id(int);
|
2002-05-30 07:14:21 +00:00
|
|
|
PLATFORM* lookup_platform(char*);
|
|
|
|
};
|
|
|
|
|
2007-05-02 23:14:00 +00:00
|
|
|
#endif
|