wiki:OptionsApi

Version 10 (modified by davea, 10 years ago) (diff)

--

Runtime system options

You can customize the behavior of the BOINC runtime system by using boinc_init_options() instead of boinc_init(). For example:

BOINC_OPTIONS options;

boinc_options_defaults(options);
options.multi_thread = true;    // include this if your app's main process uses multiple threads
options.multi_process = true;   // include this if your app uses multiple processes

boinc_init_options(&options);

Do not create any threads or store the current PID before calling boinc_init_options(). The following options are available:

struct BOINC_OPTIONS {
    int normal_thread_priority;
    int main_program;
    int check_heartbeat;
    int handle_process_control;
    int handle send_status_msgs;
    int direct_process_action;
    int multi_thread;
    int multi_process;
};

The options are:

normal_thread_priority
If set, the application will run at normal thread priority (Windows). This is recommended for CUDA applications, so that the GPU will run at full speed even if the CPUs are loaded. Default is false.
multi_thread
Set this if your application uses multiple threads (e.g., OpenMP or pthreads).
multi_process
Set this if your application creates sub-processes (e.g., MPI).

The remaining options determine what runtime system functions will be performed by this program. This is primarily for the use of compound applications. In developing a compound application you must decide whether these functions are to be performed by the main or worker program. Each flag must be set in either the main or worker programs, but not both.

main_program
Set this in the main program.
check_heartbeat
If set, the program monitors 'heartbeat' messages from the core client. If the heartbeat stops, the result depends on the direct_process_action flag (see below).
handle_process_control
If set, the program will handle 'suspend', 'resume', and 'quit' messages from the client. The action depends on the direct_process_action flag.
send_status_msgs
If set, the program will report its CPU time and fraction done to the client. Set in worker programs.
direct_process_action
If set, the program will respond to quit messages and heartbeat failures by exiting, and will respond to suspend and resume messages by suspending and resuming. Otherwise, these events will result in changes to the BOINC_STATUS structure, which can be polled using boinc_get_status().