@@ -797,7 +797,11 @@ void RESOURCE_USAGE::clear() {
797797 missing_coproc_name[0 ] = 0 ;
798798}
799799
800- void RESOURCE_USAGE::check_gpu (char * plan_class) {
800+ // see if we have the GPU libraries (OpenCL/CUDA/CAL)
801+ // required by the plan class.
802+ // If not, set missing_coproc
803+ //
804+ void RESOURCE_USAGE::check_gpu_libs (char * plan_class) {
801805 int rt = rsc_type;
802806 if (!rt) return ;
803807 if (strstr (plan_class, " opencl" )) {
@@ -827,6 +831,41 @@ void RESOURCE_USAGE::check_gpu(char* plan_class) {
827831 }
828832}
829833
834+ void RESOURCE_USAGE::write (MIOFILE& out) {
835+ out.printf (
836+ " <avg_ncpus>%f</avg_ncpus>\n "
837+ " <flops>%f</flops>\n " ,
838+ avg_ncpus,
839+ flops
840+ );
841+ if (rsc_type) {
842+ out.printf (
843+ " <coproc>\n "
844+ " <type>%s</type>\n "
845+ " <count>%f</count>\n "
846+ " </coproc>\n " ,
847+ rsc_name (rsc_type),
848+ coproc_usage
849+ );
850+ }
851+ if (missing_coproc && strlen (missing_coproc_name)) {
852+ out.printf (
853+ " <coproc>\n "
854+ " <type>%s</type>\n "
855+ " <count>%f</count>\n "
856+ " </coproc>\n " ,
857+ missing_coproc_name,
858+ coproc_usage
859+ );
860+ }
861+ if (gpu_ram) {
862+ out.printf (
863+ " <gpu_ram>%f</gpu_ram>\n " ,
864+ gpu_ram
865+ );
866+ }
867+ }
868+
830869void APP_VERSION::init () {
831870 safe_strcpy (app_name, " " );
832871 version_num = 0 ;
@@ -858,7 +897,7 @@ int APP_VERSION::parse(XML_PARSER& xp) {
858897 init ();
859898 while (!xp.get_tag ()) {
860899 if (xp.match_tag (" /app_version" )) {
861- resource_usage.check_gpu (plan_class);
900+ resource_usage.check_gpu_libs (plan_class);
862901 if (resource_usage.rsc_type || is_wrapper) {
863902 dont_throttle = true ;
864903 }
@@ -944,14 +983,10 @@ int APP_VERSION::write(MIOFILE& out, bool write_file_info) {
944983 " <app_version>\n "
945984 " <app_name>%s</app_name>\n "
946985 " <version_num>%d</version_num>\n "
947- " <platform>%s</platform>\n "
948- " <avg_ncpus>%f</avg_ncpus>\n "
949- " <flops>%f</flops>\n " ,
986+ " <platform>%s</platform>\n " ,
950987 app_name,
951988 version_num,
952- platform,
953- resource_usage.avg_ncpus ,
954- resource_usage.flops
989+ platform
955990 );
956991 if (strlen (plan_class)) {
957992 out.printf (" <plan_class>%s</plan_class>\n " , plan_class);
@@ -971,32 +1006,7 @@ int APP_VERSION::write(MIOFILE& out, bool write_file_info) {
9711006 if (retval) return retval;
9721007 }
9731008 }
974- if (resource_usage.rsc_type ) {
975- out.printf (
976- " <coproc>\n "
977- " <type>%s</type>\n "
978- " <count>%f</count>\n "
979- " </coproc>\n " ,
980- rsc_name (resource_usage.rsc_type ),
981- resource_usage.coproc_usage
982- );
983- }
984- if (resource_usage.missing_coproc && strlen (resource_usage.missing_coproc_name )) {
985- out.printf (
986- " <coproc>\n "
987- " <type>%s</type>\n "
988- " <count>%f</count>\n "
989- " </coproc>\n " ,
990- resource_usage.missing_coproc_name ,
991- resource_usage.coproc_usage
992- );
993- }
994- if (resource_usage.gpu_ram ) {
995- out.printf (
996- " <gpu_ram>%f</gpu_ram>\n " ,
997- resource_usage.gpu_ram
998- );
999- }
1009+ resource_usage.write (out);
10001010 if (dont_throttle) {
10011011 out.printf (
10021012 " <dont_throttle/>\n "
@@ -1172,7 +1182,7 @@ int WORKUNIT::parse(XML_PARSER& xp) {
11721182 || resource_usage.rsc_type !=0
11731183 || resource_usage.missing_coproc ;
11741184 if (has_resource_usage) {
1175- resource_usage.check_gpu (plan_class);
1185+ resource_usage.check_gpu_libs (plan_class);
11761186 }
11771187 return 0 ;
11781188 }
@@ -1203,6 +1213,7 @@ int WORKUNIT::parse(XML_PARSER& xp) {
12031213 continue ;
12041214 }
12051215 if (xp.parse_str (" plan_class" , plan_class, sizeof (plan_class))) continue ;
1216+ if (xp.parse_str (" sub_appname" , sub_appname, sizeof (sub_appname))) continue ;
12061217 if (xp.parse_double (" avg_ncpus" , resource_usage.avg_ncpus )) continue ;
12071218 if (xp.parse_double (" flops" , dtemp)) {
12081219 if (dtemp <= 0 ) {
@@ -1286,6 +1297,13 @@ int WORKUNIT::write(MIOFILE& out, bool gui) {
12861297 for (i=0 ; i<input_files.size (); i++) {
12871298 input_files[i].write (out);
12881299 }
1300+ if (strlen (sub_appname)) {
1301+ out.printf (
1302+ " <sub_appname>%s</sub_appname>\n " ,
1303+ sub_appname
1304+ );
1305+ }
1306+ resource_usage.write (out);
12891307
12901308 if (!job_keyword_ids.empty ()) {
12911309 if (gui) {
0 commit comments