mirror of https://github.com/BOINC/boinc.git
- API: change boinc_get_opencl_ids() to use APP_INIT_DATA
instead of cmdline svn path=/trunk/boinc/; revision=24159
This commit is contained in:
parent
9b7d5702ab
commit
228f626a01
|
@ -112,7 +112,7 @@ using std::vector;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* api_version="API_VERSION_"PACKAGE_VERSION;
|
const char* api_version="API_VERSION_"PACKAGE_VERSION;
|
||||||
static APP_INIT_DATA aid;
|
APP_INIT_DATA aid;
|
||||||
static FILE_LOCK file_lock;
|
static FILE_LOCK file_lock;
|
||||||
APP_CLIENT_SHM* app_client_shm = 0;
|
APP_CLIENT_SHM* app_client_shm = 0;
|
||||||
static volatile int time_until_checkpoint;
|
static volatile int time_until_checkpoint;
|
||||||
|
@ -660,7 +660,7 @@ void boinc_exit(int status) {
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// Halt all the threads and cleans up.
|
// Halt all the threads and clean up.
|
||||||
TerminateProcess(GetCurrentProcess(), status);
|
TerminateProcess(GetCurrentProcess(), status);
|
||||||
// note: the above CAN return!
|
// note: the above CAN return!
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
|
|
|
@ -85,6 +85,7 @@ extern volatile BOINC_STATUS boinc_status;
|
||||||
typedef void (*FUNC_PTR)();
|
typedef void (*FUNC_PTR)();
|
||||||
|
|
||||||
struct APP_INIT_DATA;
|
struct APP_INIT_DATA;
|
||||||
|
extern APP_INIT_DATA aid;
|
||||||
|
|
||||||
extern int boinc_init(void);
|
extern int boinc_init(void);
|
||||||
extern int boinc_finish(int status);
|
extern int boinc_finish(int status);
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "error_numbers.h"
|
#include "error_numbers.h"
|
||||||
|
#include "boinc_api.h"
|
||||||
|
|
||||||
#include "coproc.h"
|
#include "coproc.h"
|
||||||
|
|
||||||
|
@ -101,35 +102,22 @@ int boinc_get_opencl_ids_aux(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int boinc_get_opencl_ids(
|
int boinc_get_opencl_ids(cl_device_id* device, cl_platform_id* platform) {
|
||||||
int argc, char** argv, cl_device_id* device, cl_platform_id* platform
|
int retval=0;
|
||||||
) {
|
|
||||||
char type[256];
|
|
||||||
int device_num, retval=0;
|
|
||||||
|
|
||||||
strcpy(type, "");
|
if (!strlen(aid.gpu_type)) {
|
||||||
device_num = -1;
|
|
||||||
|
|
||||||
for (int i=1; i<argc; i++) {
|
|
||||||
if (!strcmp(argv[i], "--gpu_type")) {
|
|
||||||
strcpy(type, argv[++i]);
|
|
||||||
}
|
|
||||||
if (!strcmp(argv[i], "--device")) {
|
|
||||||
device_num = atoi(argv[++i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strlen(type)) {
|
|
||||||
return CL_INVALID_DEVICE_TYPE;
|
return CL_INVALID_DEVICE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_num < 0) {
|
if (aid.gpu_device_num < 0) {
|
||||||
return CL_INVALID_DEVICE;
|
return CL_INVALID_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
try {
|
try {
|
||||||
retval = boinc_get_opencl_ids_aux(type, device_num, device, platform);
|
retval = boinc_get_opencl_ids_aux(
|
||||||
|
aid.gpu_type, aid.gpu_device_num, device, platform
|
||||||
|
);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
return ERR_SIGNAL_CATCH;
|
return ERR_SIGNAL_CATCH;
|
||||||
|
@ -139,7 +127,9 @@ int boinc_get_opencl_ids(
|
||||||
if (setjmp(resume)) {
|
if (setjmp(resume)) {
|
||||||
return ERR_SIGNAL_CATCH;
|
return ERR_SIGNAL_CATCH;
|
||||||
} else {
|
} else {
|
||||||
retval = boinc_get_opencl_ids_aux(type, device_num, device, platform);
|
retval = boinc_get_opencl_ids_aux(
|
||||||
|
aid.gpu_type, aid.gpu_device_num, device, platform
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGSEGV, old_sig);
|
signal(SIGSEGV, old_sig);
|
||||||
|
|
|
@ -17,17 +17,10 @@
|
||||||
|
|
||||||
// BOINC API for OpenCL apps
|
// BOINC API for OpenCL apps
|
||||||
|
|
||||||
// The BOINC client calls the project application with the arguments:
|
// Get the cl_device_id and cl_platform_id for the OpenCL GPU
|
||||||
// --gpu_type TYPE --device N
|
// assigned to your job.
|
||||||
// where TYPE is ATI or NVIDIA, and N is the GPU number of that type
|
|
||||||
// For example, for ATI GPU number 0, the arguments will be:
|
|
||||||
// --gpu_type ATI --device 0
|
|
||||||
//
|
|
||||||
// To get the cl_device_id and cl_platform_id for the OpenCL GPU
|
|
||||||
// asigned to your application call this function:
|
|
||||||
//
|
|
||||||
// NOTE: You should compile and link this function as part of your
|
|
||||||
// application; it is not included in the standard BOINC libraries.
|
|
||||||
//
|
//
|
||||||
|
// NOTE: Compile and link this function with your application;
|
||||||
|
// it is not included in the standard BOINC libraries.
|
||||||
|
|
||||||
int boinc_get_opencl_ids(int argc, char** argv, cl_device_id*, cl_platform_id*);
|
int boinc_get_opencl_ids(cl_device_id*, cl_platform_id*);
|
||||||
|
|
|
@ -5821,3 +5821,11 @@ David 11 Sept 2011
|
||||||
sg_PanelBase.cpp
|
sg_PanelBase.cpp
|
||||||
sg_ProjectPanel.cpp
|
sg_ProjectPanel.cpp
|
||||||
sg_TaskPanel.cpp
|
sg_TaskPanel.cpp
|
||||||
|
|
||||||
|
David 11 Sept 2011
|
||||||
|
- API: change boinc_get_opencl_ids() to use APP_INIT_DATA
|
||||||
|
instead of cmdline
|
||||||
|
|
||||||
|
api/
|
||||||
|
boinc_api.cpp,h
|
||||||
|
boinc_opencl.cpp,h
|
||||||
|
|
Loading…
Reference in New Issue