// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// 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.
//
// BOINC is distributed in the hope that it will be useful,
// 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see .
// If you change anything, make sure you also change:
// client_types.C (to write and parse it)
// client_state.C (to cross-link objects)
//
#ifndef _CLIENT_TYPES_
#define _CLIENT_TYPES_
#include "cpp.h"
#if !defined(_WIN32) || defined(__CYGWIN32__)
#include
#include
#include
#endif
#include "cc_config.h"
#include "common_defs.h"
#include "coproc.h"
#include "cert_sig.h"
#include "filesys.h"
#include "hostinfo.h"
#include "md5_file.h"
#include "miofile.h"
#include "cs_notice.h"
#include "cs_trickle.h"
#include "rr_sim.h"
#include "work_fetch.h"
#ifdef SIM
#include "sim.h"
#endif
#define MAX_FILE_INFO_LEN 4096
#define MAX_SIGNATURE_LEN 4096
#define MAX_KEY_LEN 4096
#define MAX_COPROCS_PER_JOB 8
// max # of instances of a GPU that a job can use
extern int rsc_index(const char*);
extern const char* rsc_name(int);
extern COPROCS coprocs;
struct FILE_INFO;
struct ASYNC_VERIFY;
// represents a list of URLs (e.g. to download a file)
// and a current position in that list
//
struct URL_LIST {
std::vector urls;
int start_index;
int current_index;
URL_LIST(){};
void clear() {
urls.clear();
start_index = -1;
current_index = -1;
}
bool empty() {return urls.empty();}
const char* get_init_url();
const char* get_next_url();
const char* get_current_url(FILE_INFO&);
inline void add(std::string url) {
urls.push_back(url);
}
void replace(URL_LIST& ul) {
clear();
for (unsigned int i=0; i proj_feeds;
inline char *get_project_name() {
if (strlen(project_name)) {
return project_name;
} else {
return master_url;
}
}
};
struct APP {
char name[256];
char user_friendly_name[256];
bool non_cpu_intensive;
PROJECT* project;
int max_concurrent;
// Limit on # of concurrent jobs of this app; 0 if none
// Specified in app_config.xml
int n_concurrent;
// temp during job scheduling, to enforce max_concurrent
#ifdef SIM
double latency_bound;
double fpops_est;
NORMAL_DIST fpops;
NORMAL_DIST checkpoint_period;
double working_set;
double weight;
bool ignore;
#endif
APP() {memset(this, 0, sizeof(APP));}
int parse(XML_PARSER&);
int write(MIOFILE&);
};
struct GPU_USAGE {
int rsc_type;
double usage;
};
struct APP_VERSION {
char app_name[256];
int version_num;
char platform[256];
char plan_class[64];
char api_version[16];
double avg_ncpus;
double max_ncpus;
GPU_USAGE gpu_usage; // can only use 1 GPUtype
double gpu_ram;
double flops;
char cmdline[256];
// additional cmdline args
char file_prefix[256];
// prepend this to input/output file logical names
// (e.g. "share" for VM apps)
bool needs_network;
APP* app;
PROJECT* project;
std::vector app_files;
int ref_cnt;
char graphics_exec_path[MAXPATHLEN];
char graphics_exec_file[256];
double max_working_set_size;
// max working set of tasks using this app version.
// unstarted jobs using this app version are assumed
// to use this much RAM,
// so that we don't run a long sequence of jobs,
// each of which turns out not to fit in available RAM
bool missing_coproc;
double missing_coproc_usage;
char missing_coproc_name[256];
bool dont_throttle;
int index; // temp var for make_scheduler_request()
#ifdef SIM
bool dont_use;
#endif
APP_VERSION(){}
~APP_VERSION(){}
int parse(XML_PARSER&);
int write(MIOFILE&, bool write_file_info = true);
bool had_download_failure(int& failnum);
void get_file_errors(std::string&);
void clear_errors();
int api_major_version();
inline bool uses_coproc(int rt) {
return (gpu_usage.rsc_type == rt);
}
inline int rsc_type() {
return gpu_usage.rsc_type;
}
};
struct WORKUNIT {
char name[256];
char app_name[256];
int version_num;
// Deprecated, but need to keep around to let people revert
// to versions before multi-platform support
std::string command_line;
std::vector input_files;
PROJECT* project;
APP* app;
int ref_cnt;
double rsc_fpops_est;
double rsc_fpops_bound;
double rsc_memory_bound;
double rsc_disk_bound;
WORKUNIT(){}
~WORKUNIT(){}
int parse(XML_PARSER&);
int write(MIOFILE&);
bool had_download_failure(int& failnum);
void get_file_errors(std::string&);
void clear_errors();
};
// represents an always/auto/never value, possibly temporarily overridden
struct RUN_MODE {
int perm_mode;
int temp_mode;
int prev_mode;
double temp_timeout;
RUN_MODE();
void set(int mode, double duration);
void set_prev(int mode);
int get_perm();
int get_prev();
int get_current();
double delay();
};
// a platform supported by the client.
struct PLATFORM {
std::string name;
};
extern int parse_project_files(XML_PARSER&, std::vector&);
#endif