From ad455ab09d9cec4a4949581ed2d3e7dddccb31bc Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 25 Sep 2009 15:40:16 +0000 Subject: [PATCH] - client: Add support for checking for both amd* prefixed CAL libraries and ati* prefixed CAL libraries. - scheduler: redefine ati class plans again. ati: CAL 1.0+, amd* prefixed libraries ati13amd: CAL 1.3+, amd* prefixed libraries ati13ati: CAL 1.3+, ati* prefixed libraries ati14: CAL 1.4+, ati* prefixed libraries sched/ sched_customize.cpp lib/ coproc.cpp, .h svn path=/trunk/boinc/; revision=19162 --- checkin_notes | 14 ++++++ lib/coproc.cpp | 71 +++++++++++++++++++++++++---- lib/coproc.h | 2 + sched/sched_customize.cpp | 95 +++++++++++++++++++++++++++++++++++---- 4 files changed, 166 insertions(+), 16 deletions(-) diff --git a/checkin_notes b/checkin_notes index 9d377b5b3c..73315f3fe5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8073,3 +8073,17 @@ Oliver 25 Sept 2009 lib/ app_ipc.cpp + +Rom 25 Sept 2009 + - client: Add support for checking for both amd* prefixed CAL libraries + and ati* prefixed CAL libraries. + - scheduler: redefine ati class plans again. + ati: CAL 1.0+, amd* prefixed libraries + ati13amd: CAL 1.3+, amd* prefixed libraries + ati13ati: CAL 1.3+, ati* prefixed libraries + ati14: CAL 1.4+, ati* prefixed libraries + + sched/ + sched_customize.cpp + lib/ + coproc.cpp, .h diff --git a/lib/coproc.cpp b/lib/coproc.cpp index 70756f76f4..5c4672f4b1 100644 --- a/lib/coproc.cpp +++ b/lib/coproc.cpp @@ -650,9 +650,9 @@ typedef int (__stdcall *ATI_VER) (CALuint *cal_major, CALuint *cal_minor, CALuin typedef int (__stdcall *ATI_GDI)(void); typedef int (__stdcall *ATI_CLOSE)(void); -ATI_GDI __calInit = NULL; +ATI_GDI __calInit = NULL; ATI_VER __calGetVersion = NULL; -ATI_GDC __calDeviceGetCount = NULL; +ATI_GDC __calDeviceGetCount = NULL; ATI_ATTRIBS __calDeviceGetAttribs = NULL; ATI_INFO __calDeviceGetInfo = NULL; ATI_CLOSE __calShutdown = NULL; @@ -673,29 +673,60 @@ void COPROC_ATI::get(COPROCS& coprocs, CALdeviceinfo info; CALdeviceattribs attribs; char buf[256]; + char* desired_atilib; + char* desired_amdlib; int retval; attribs.struct_size = sizeof(CALdeviceattribs); device = 0; numDevices =0; - + #ifdef _WIN32 + #if defined _M_X64 - HINSTANCE callib = LoadLibrary("aticalrt64.dll"); + desired_atilib = "aticalrt64.dll"; + desired_amdlib = "amdcalrt64.dll"; #else - HINSTANCE callib = LoadLibrary("aticalrt.dll"); + desired_atilib = "aticalrt.dll"; + desired_amdlib = "amdcalrt.dll"; #endif + + // Detect which runtime libraries we can use + HINSTANCE amdlib = LoadLibrary(desired_amdlib); + if (amdlib) { + amdrt_detected = true; + FreeLibrary(amdlib); + } + + HINSTANCE atilib = LoadLibrary(desired_atilib); + if (atilib) { + atirt_detected = true; + FreeLibrary(atilib); + } + + // Detect capabilities, give preference to the ati runtime + // since it is newer. + HINSTANCE callib = NULL; + if (atirt_detected) { + callib = LoadLibrary(desired_atilib); + } else { + callib = LoadLibrary(desired_amdlib); + } + if (!callib) { warnings.push_back("No ATI library found."); return; } + __calInit = (ATI_GDI)GetProcAddress(callib, "calInit" ); __calDeviceGetCount = (ATI_GDC)GetProcAddress(callib, "calDeviceGetCount" ); __calGetVersion = (ATI_VER)GetProcAddress(callib, "calGetVersion" ); __calDeviceGetInfo = (ATI_INFO)GetProcAddress(callib, "calDeviceGetInfo" ); __calDeviceGetAttribs =(ATI_ATTRIBS)GetProcAddress(callib, "calDeviceGetAttribs" ); __calShutdown = (ATI_CLOSE)GetProcAddress(callib, "calShutdown" ); + #else + void* callib; callib = dlopen("libaticalrt.so", RTLD_NOW); @@ -703,12 +734,16 @@ void COPROC_ATI::get(COPROCS& coprocs, warnings.push_back("No ATI library found"); return; } + + atirt_detected = true; + __calInit = (int(*)()) dlsym(callib, "calInit"); __calGetVersion = (int(*)(CALuint*, CALuint*, CALuint*)) dlsym(callib, "calGetVersion"); __calDeviceGetCount = (int(*)(CALuint*)) dlsym(callib, "calDeviceGetCount"); __calDeviceGetAttribs = (int(*)(CALdeviceattribs*, CALuint)) dlsym(callib, "calDeviceGetAttribs"); __calDeviceGetInfo = (int(*)(CALdeviceinfo*, CALuint)) dlsym(callib, "calDeviceGetInfo"); __calShutdown = (int(*)()) dlsym(callib, "calShutdown"); + #endif if (!__calInit) { @@ -818,6 +853,9 @@ void COPROC_ATI::get(COPROCS& coprocs, void COPROC_ATI::write_xml(MIOFILE& f) { f.printf( "\n" + ); + + f.printf( " %d\n" " %s\n" " %f\n" @@ -833,8 +871,7 @@ void COPROC_ATI::write_xml(MIOFILE& f) { " %d\n" " %d\n" " %d\n" - " %s\n" - "\n", + " %s\n", count, name, req_secs, @@ -852,6 +889,22 @@ void COPROC_ATI::write_xml(MIOFILE& f) { attribs.surface_alignment, version ); + + if (atirt_detected) { + f.printf( + " \n" + ); + } + + if (amdrt_detected) { + f.printf( + " \n" + ); + } + + f.printf( + "\n" + ); }; #endif @@ -863,6 +916,8 @@ void COPROC_ATI::clear() { estimated_delay = -1; strcpy(name, ""); strcpy(version, ""); + atirt_detected = false; + amdrt_detected = false; attribs.localRAM = 0; attribs.uncachedRemoteRAM = 0; attribs.cachedRemoteRAM = 0; @@ -880,6 +935,7 @@ int COPROC_ATI::parse(FILE* fin) { int n; clear(); + while (fgets(buf, sizeof(buf), fin)) { if (strstr(buf, "")) return 0; if (parse_int(buf, "", count)) continue; @@ -929,7 +985,6 @@ int COPROC_ATI::parse(FILE* fin) { continue; } if (parse_str(buf, "", version, sizeof(version))) continue; - } return ERR_XML_PARSE; } diff --git a/lib/coproc.h b/lib/coproc.h index 3175009682..d0c7736141 100644 --- a/lib/coproc.h +++ b/lib/coproc.h @@ -287,6 +287,8 @@ enum CUdevice_attribute_enum { struct COPROC_ATI : public COPROC { char name[256]; char version[50]; + bool atirt_detected; + bool amdrt_detected; CALdeviceattribs attribs; #ifndef _USING_FCGI_ virtual void write_xml(MIOFILE&); diff --git a/sched/sched_customize.cpp b/sched/sched_customize.cpp index b714a418ea..330ecdc8ee 100644 --- a/sched/sched_customize.cpp +++ b/sched/sched_customize.cpp @@ -122,18 +122,97 @@ bool app_plan(SCHEDULER_REQUEST& sreq, char* plan_class, HOST_USAGE& hu) { add_no_work_message("Your computer has no ATI GPU"); return false; } + int major, minor, release; sscanf(cp->version, "%d.%d.%d", &major, &minor, &release); int vers = major*1000000 + minor*1000 + release; - if (vers < 1004000) { - if (config.debug_version_select) { - log_messages.printf(MSG_NORMAL, - "[version] host has CAL version %s, need 1.4+\n", - cp->version - ); + + if (!strcmp(plan_class, "ati")) { + if (!cp->amdrt_detected) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[runtime] No usable CAL Runtime found\n", + ); + } + add_no_work_message("ATI Catalyst 8.12+ or better needed to use GPU (no runtime found)"); + return false; + } + if (vers < 1000000) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[version] host has CAL version %s, need 1.0+\n", + cp->version + ); + } + add_no_work_message("ATI Catalyst 8.12+ or better needed to use GPU (version out of date)"); + return false; + } + } + + if (!strcmp(plan_class, "ati13amd")) { + if (!cp->amdrt_detected) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[runtime] No usable CAL Runtime found\n", + ); + } + add_no_work_message("ATI Catalyst 9.1+ or better needed to use GPU (no runtime found)"); + return false; + } + if (vers < 1003000) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[version] host has CAL version %s, need 1.3.0 to 1.3.186\n", + cp->version + ); + } + add_no_work_message("ATI Catalyst 9.1+ or better needed to use GPU (version out of date)"); + return false; + } + } + + if (!strcmp(plan_class, "ati13ati")) { + if (!cp->atirt_detected) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[runtime] No usable CAL Runtime found\n", + ); + } + add_no_work_message("ATI Catalyst 9.2+ or better needed to use GPU (no runtime found)"); + return false; + } + if (vers < 1003186) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[version] host has CAL version %s, need 1.3.186+\n", + cp->version + ); + } + add_no_work_message("ATI Catalyst 9.2+ or better needed to use GPU"); + return false; + } + } + + if (!strcmp(plan_class, "ati14")) { + if (!cp->atirt_detected) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[runtime] No usable CAL Runtime found\n", + ); + } + add_no_work_message("ATI Catalyst 9.7+ or better needed to use GPU (no runtime found)"); + return false; + } + if (vers < 1004000) { + if (config.debug_version_select) { + log_messages.printf(MSG_NORMAL, + "[version] host has CAL version %s, need 1.4+\n", + cp->version + ); + } + add_no_work_message("ATI Catalyst 9.7+ or better needed to use GPU"); + return false; } - add_no_work_message("ATI Catalyst 9.2 or better needed to use GPU"); - return false; } hu.flops = cp->flops_estimate();