int main(int argc, char** argv) { int retval = 0; #if BOINC_APP_GRAPHICS #if defined(_WIN32) || defined(__APPLE__) retval = boinc_init_graphics(worker); #else retval = boinc_init_graphics_lib(worker, argv[0]); #endif /* defined(_WIN32) || defined(__APPLE__) */ if (retval) exit(retval); #endif /* BOINC_APP_GRAPHICS */ #if defined(_WIN32) && COMPUTE_ON_GPU //make the windows GPU app have a higher priority BOINC_OPTIONS options; boinc_options_defaults(options); options.normal_thread_priority = 1; // higher priority (normal instead of idle) retval = boinc_init_options(&options); #else /* TODO: for release build, use the boinc defaults*/ //retval = boinc_init(); retval = boinc_init_diagnostics( BOINC_DIAG_DUMPCALLSTACKENABLED | BOINC_DIAG_HEAPCHECKENABLED | BOINC_DIAG_MEMORYLEAKCHECKENABLED); #endif /* defined(_WIN32) && COMPUTE_ON_GPU */ if (retval) exit(retval); #if COMPUTE_ON_GPU //Choose the GPU to execute on, first look //at the command line argument for a //--device 0..n string, then enumerate all CUDA //devices on the system and choose the one //with double precision support and the most //GFLOPS //APP_INIT_DATA init_data; //boinc_get_init_data_p(&init_data); char* project_prefs = NULL; //init_data.project_preferences; if (choose_gpu(argc, argv) == -1) { fprintf(stderr, "Unable to find a capable GPU\n"); mw_finish(EXIT_FAILURE); } MW_DEBUGMSG("got here\n"); parse_prefs(project_prefs); #endif /* COMPUTE_ON_GPU */ worker(argc, (const char**) argv); return retval; }
// the following function can be in a shared library, // so it calls boinc_init_options_general() via a pointer instead of directly // int boinc_init_graphics_impl(WORKER_FUNC_PTR worker, BOINC_MAIN_STATE* bmsp) { BOINC_OPTIONS opt; boinc_options_defaults(opt); return boinc_init_options_graphics_impl(opt, worker, bmsp); }