@@ -870,8 +870,23 @@ bool PLAN_CLASS_SPEC::check(
870870 }
871871 }
872872
873- // custom GPU type
873+ // other (OpenCL) GPU type
874874 //
875+ } else if (have_gpu_type_regex) {
876+ for (int i=1 ; i<sreq.coprocs .n_rsc ; i++) {
877+ if (!regexec (&(gpu_type_regex), sreq.coprocs .coprocs [i].type , 0 , NULL , 0 )) {
878+ cpp = &sreq.coprocs .coprocs [i];
879+ break ;
880+ }
881+ }
882+ if (!cpp) {
883+ if (config.debug_version_select ) {
884+ log_messages.printf (MSG_NORMAL ,
885+ " [version] plan_class_spec: No gpu_type match found\n "
886+ );
887+ }
888+ return false ;
889+ }
875890 } else if (strlen (gpu_type)) {
876891 cpp = sreq.coprocs .lookup_type (gpu_type);
877892 if (!cpp) {
@@ -882,12 +897,14 @@ bool PLAN_CLASS_SPEC::check(
882897 }
883898 return false ;
884899 }
900+ }
901+ if (cpp) {
885902 if (config.debug_version_select ) {
886903 log_messages.printf (MSG_NORMAL ,
887- " [version] plan_class_spec: Custom coproc %s found\n " , gpu_type
904+ " [version] plan_class_spec: OpenCL coproc %s found\n " , cpp-> type
888905 );
889906 }
890- if (cpp->bad_gpu_peak_flops (" Custom GPU " , msg)) {
907+ if (cpp->bad_gpu_peak_flops (" OpenCL coproc " , msg)) {
891908 log_messages.printf (MSG_NORMAL , " %s\n " , msg.c_str ());
892909 }
893910 }
@@ -934,7 +951,7 @@ bool PLAN_CLASS_SPEC::check(
934951
935952 // general GPU
936953 //
937- if (strlen (gpu_type) ) {
954+ if (cpp ) {
938955
939956 // GPU RAM
940957 //
@@ -1028,10 +1045,10 @@ bool PLAN_CLASS_SPEC::check(
10281045 } else if (!strcmp (gpu_type, " nvidia" )) {
10291046 hu.proc_type = PROC_TYPE_NVIDIA_GPU ;
10301047 hu.gpu_usage = gpu_usage;
1031- } else if (strstr (gpu_type, " intel" )== gpu_type) {
1048+ } else if (strstr (gpu_type, " intel" ) == gpu_type) {
10321049 hu.proc_type = PROC_TYPE_INTEL_GPU ;
10331050 hu.gpu_usage = gpu_usage;
1034- } else if (strstr (gpu_type, " apple_gpu" )== gpu_type) {
1051+ } else if (strstr (gpu_type, " apple_gpu" ) == gpu_type) {
10351052 hu.proc_type = PROC_TYPE_APPLE_GPU ;
10361053 hu.gpu_usage = gpu_usage;
10371054 } else {
@@ -1221,6 +1238,8 @@ int PLAN_CLASS_SPEC::parse(XML_PARSER& xp) {
12211238 if (xp.parse_bool (" project_prefs_default_true" , project_prefs_default_true)) continue ;
12221239 if (xp.parse_double (" avg_ncpus" , avg_ncpus)) continue ;
12231240
1241+ // GPU info
1242+ //
12241243 if (xp.parse_double (" cpu_frac" , cpu_frac)) continue ;
12251244 if (xp.parse_double (" min_gpu_ram_mb" , min_gpu_ram_mb)) continue ;
12261245 if (xp.parse_double (" gpu_ram_used_mb" , gpu_ram_used_mb)) continue ;
@@ -1231,10 +1250,6 @@ int PLAN_CLASS_SPEC::parse(XML_PARSER& xp) {
12311250 if (xp.parse_int (" min_driver_version" , min_driver_version)) continue ;
12321251 if (xp.parse_int (" max_driver_version" , max_driver_version)) continue ;
12331252 if (xp.parse_str (" gpu_utilization_tag" , gpu_utilization_tag, sizeof (gpu_utilization_tag))) continue ;
1234- if (xp.parse_long (" min_wu_id" , min_wu_id)) {wu_restricted_plan_class = true ; continue ;}
1235- if (xp.parse_long (" max_wu_id" , max_wu_id)) {wu_restricted_plan_class = true ; continue ;}
1236- if (xp.parse_long (" min_batch" , min_batch)) {wu_restricted_plan_class = true ; continue ;}
1237- if (xp.parse_long (" max_batch" , max_batch)) {wu_restricted_plan_class = true ; continue ;}
12381253
12391254 if (xp.parse_bool (" need_ati_libs" , need_ati_libs)) continue ;
12401255 if (xp.parse_bool (" need_amd_libs" , need_amd_libs)) continue ;
@@ -1256,14 +1271,31 @@ int PLAN_CLASS_SPEC::parse(XML_PARSER& xp) {
12561271 if (xp.parse_bool (" double_precision_fp" , double_precision_fp)) continue ;
12571272
12581273 if (xp.parse_int (" min_metal_support" , min_metal_support)) continue ;
1274+ if (xp.parse_str (" gpu_type_regex" , buf, sizeof (buf))) {
1275+ if (regcomp (&(gpu_type_regex), buf, REG_EXTENDED |REG_NOSUB ) ) {
1276+ log_messages.printf (MSG_CRITICAL ,
1277+ " BAD GPU TYPE REGEXP: %s\n " , buf
1278+ );
1279+ return ERR_XML_PARSE ;
1280+ }
1281+ have_gpu_type_regex = true ;
1282+ continue ;
1283+ }
12591284
1285+ // Virtualbox
1286+ //
12601287 if (xp.parse_int (" min_vbox_version" , min_vbox_version)) continue ;
12611288 if (xp.parse_int (" max_vbox_version" , max_vbox_version)) continue ;
12621289 if (xp.parse_int (" exclude_vbox_version" , i)) {
12631290 exclude_vbox_version.push_back (i);
12641291 continue ;
12651292 }
12661293 if (xp.parse_bool (" vm_accel_required" , vm_accel_required)) continue ;
1294+
1295+ if (xp.parse_long (" min_wu_id" , min_wu_id)) {wu_restricted_plan_class = true ; continue ;}
1296+ if (xp.parse_long (" max_wu_id" , max_wu_id)) {wu_restricted_plan_class = true ; continue ;}
1297+ if (xp.parse_long (" min_batch" , min_batch)) {wu_restricted_plan_class = true ; continue ;}
1298+ if (xp.parse_long (" max_batch" , max_batch)) {wu_restricted_plan_class = true ; continue ;}
12671299 }
12681300 return ERR_XML_PARSE ;
12691301}
@@ -1338,6 +1370,7 @@ PLAN_CLASS_SPEC::PLAN_CLASS_SPEC() {
13381370 min_driver_version = 0 ;
13391371 max_driver_version = 0 ;
13401372 strcpy (gpu_utilization_tag, " " );
1373+ have_gpu_type_regex = false ;
13411374
13421375 need_ati_libs = false ;
13431376 need_amd_libs = false ;
0 commit comments