client: don't pass --device to GPU apps w/ API version >= 7.5

This addresses a problem w/ Bitcoin Utopia,
whose coprocessor app (run via the wrapper) doesn't expect a --device arg,
and fails if it gets one.
The --device mechanism has been superceded by APP_INIT_DATA.gpu_device_num.
GPU apps built with the current API and later should not expect a --device arg.
This commit is contained in:
David Anderson 2014-07-30 13:16:42 -07:00
parent 6ba233e230
commit befb90f0d4
4 changed files with 23 additions and 17 deletions

View File

@ -229,7 +229,7 @@ void ACTIVE_TASK::cleanup_task() {
if (app_client_shm.shm) {
#ifndef __EMX__
if (app_version->api_major_version() >= 6) {
if (app_version->api_version_at_least(6, 0)) {
retval = detach_shmem_mmap(app_client_shm.shm, sizeof(SHARED_MEM));
} else
#endif

View File

@ -163,7 +163,7 @@ int ACTIVE_TASK::get_shmem_seg_name() {
char init_data_path[MAXPATHLEN];
#ifndef __EMX__
// shmem_seg_name is not used with mmap() shared memory
if (app_version->api_major_version() >= 6) {
if (app_version->api_version_at_least(6, 0)) {
shmem_seg_name = -1;
return 0;
}
@ -512,7 +512,7 @@ int ACTIVE_TASK::start(bool test) {
unsigned int i;
FILE_REF fref;
FILE_INFO* fip;
int retval, rt;
int retval;
APP_INIT_DATA aid;
#ifdef _WIN32
bool success = false;
@ -693,9 +693,11 @@ int ACTIVE_TASK::start(bool test) {
sprintf(cmdline, "%s %s %s",
exec_path, wup->command_line.c_str(), app_version->cmdline
);
rt = app_version->gpu_usage.rsc_type;
if (rt) {
coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline);
if (!app_version->api_version_at_least(7, 5)) {
rt = app_version->gpu_usage.rsc_type;
if (rt) {
coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline);
}
}
relative_to_absolute(slot_dir, slotdirpath);
@ -884,9 +886,11 @@ int ACTIVE_TASK::start(bool test) {
wup->command_line.c_str(), app_version->cmdline
);
rt = app_version->gpu_usage.rsc_type;
if (rt) {
coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline);
if (!app_version->api_version_at_least(7, 5)) {
int rt = app_version->gpu_usage.rsc_type;
if (rt) {
coproc_cmdline(rt, result, app_version->gpu_usage.usage, cmdline);
}
}
// Set up client/app shared memory seg if needed
@ -895,7 +899,7 @@ int ACTIVE_TASK::start(bool test) {
#ifdef ANDROID
if (true) {
#else
if (app_version->api_major_version() >= 6) {
if (app_version->api_version_at_least(6, 0)) {
#endif
// Use mmap() shared memory
sprintf(buf, "%s/%s", slot_dir, MMAPPED_FILE_NAME);

View File

@ -983,11 +983,13 @@ void APP_VERSION::clear_errors() {
}
}
int APP_VERSION::api_major_version() {
int v, n;
n = sscanf(api_version, "%d", &v);
if (n != 1) return 0;
return v;
bool APP_VERSION::api_version_at_least(int major, int minor) {
int maj, min, n;
n = sscanf(api_version, "%d.%d", &maj, &min);
if (n != 2) return false;
if (maj < major) return false;
if (maj > major) return true;
return min >= minor;
}
int FILE_REF::parse(XML_PARSER& xp) {

View File

@ -282,7 +282,7 @@ struct APP_VERSION {
char api_version[16];
double avg_ncpus;
double max_ncpus;
GPU_USAGE gpu_usage; // can only use 1 GPUtype
GPU_USAGE gpu_usage; // can only use 1 GPU type
double gpu_ram;
double flops;
char cmdline[256];
@ -326,7 +326,7 @@ struct APP_VERSION {
bool had_download_failure(int& failnum);
void get_file_errors(std::string&);
void clear_errors();
int api_major_version();
bool api_version_at_least(int major, int minor);
inline bool uses_coproc(int rt) {
return (gpu_usage.rsc_type == rt);
}