Skip to content

Commit 5a1993c

Browse files
authored
Merge pull request #6278 from BOINC/dpa_buda14
Various BUDA-related bugs and enhancements
2 parents c930fd1 + 58f7684 commit 5a1993c

File tree

9 files changed

+130
-57
lines changed

9 files changed

+130
-57
lines changed

client/client_types.cpp

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
830869
void 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) {

client/client_types.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ struct RESOURCE_USAGE {
330330
char missing_coproc_name[256];
331331

332332
void clear();
333-
void check_gpu(char* plan_class);
333+
void check_gpu_libs(char* plan_class);
334+
void write(MIOFILE&);
334335
};
335336

336337
// if you add anything, initialize it in init()
@@ -407,10 +408,14 @@ struct WORKUNIT {
407408
int version_num;
408409
// Deprecated, but need to keep around to let people revert
409410
// to versions before multi-platform support
410-
bool has_resource_usage;
411+
412+
// the following for BUDA jobs
413+
char sub_appname[256];
411414
char plan_class[256];
412-
// for BUDA jobs, the BUDA variant
415+
// the BUDA variant
416+
bool has_resource_usage;
413417
RESOURCE_USAGE resource_usage;
418+
414419
std::string command_line;
415420
std::vector<FILE_REF> input_files;
416421
PROJECT* project;
@@ -423,10 +428,11 @@ struct WORKUNIT {
423428
JOB_KEYWORD_IDS job_keyword_ids;
424429

425430
WORKUNIT(){
426-
safe_strcpy(name, "");
427-
safe_strcpy(app_name, "");
431+
name[0] = 0;
432+
app_name[0] = 0;
428433
version_num = 0;
429434
has_resource_usage = false;
435+
sub_appname[0] = 0;
430436
plan_class[0] = 0;
431437
resource_usage.clear();
432438
command_line.clear();

clientgui/ViewWork.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,12 @@ void CViewWork::GetDocApplicationName(wxInt32 item, wxString& strBuffer) const {
12531253
if (!state_result) return;
12541254
WORKUNIT* wup = state_result->wup;
12551255
if (!wup) return;
1256+
1257+
if (strlen(wup->sub_appname)) {
1258+
strBuffer = HtmlEntityDecode(wxString(wup->sub_appname, wxConvUTF8));
1259+
return;
1260+
}
1261+
12561262
APP* app = wup->app;
12571263
if (!app) return;
12581264
APP_VERSION* avp = state_result->avp;

html/user/buda_submit.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
require_once('../inc/util.inc');
2222
require_once('../inc/submit_util.inc');
2323
require_once('../inc/sandbox.inc');
24+
require_once('../inc/buda.inc');
2425

2526
display_errors();
2627

@@ -191,7 +192,7 @@ function stage_input_files($batch_dir, $batch_desc, $batch_id) {
191192
// Use --stdin, where each job is described by a line
192193
//
193194
function create_jobs(
194-
$app, $variant, $variant_desc,
195+
$app, $app_desc, $variant, $variant_desc,
195196
$batch_desc, $batch_id, $batch_dir_name,
196197
$wrapper_verbose, $cmdline
197198
) {
@@ -221,15 +222,17 @@ function create_jobs(
221222
}
222223
$job_cmds .= "$job_cmd\n";
223224
}
224-
$cw_cmdline = sprintf('"--dockerfile %s %s %s"',
225+
$wrapper_cmdline = sprintf('"--dockerfile %s %s %s"',
225226
$variant_desc->dockerfile,
226227
$wrapper_verbose?'--verbose':'',
227228
$cmdline
228229
);
229230
$cmd = sprintf(
230-
'cd ../..; bin/create_work --appname %s --batch %d --stdin --command_line %s --wu_template %s --result_template %s',
231-
$buda_boinc_app->name, $batch_id,
232-
$cw_cmdline,
231+
'cd ../..; bin/create_work --appname %s --sub_appname "%s" --batch %d --stdin --command_line %s --wu_template %s --result_template %s',
232+
$buda_boinc_app->name,
233+
$app_desc->long_name,
234+
$batch_id,
235+
$wrapper_cmdline,
233236
"buda_apps/$app/$variant/template_in",
234237
"buda_apps/$app/$variant/template_out"
235238
);
@@ -250,6 +253,8 @@ function create_jobs(
250253
}
251254

252255
function handle_submit($user) {
256+
global $buda_root;
257+
253258
$app = get_str('app');
254259
if (!is_valid_filename($app)) die('bad arg');
255260
$variant = get_str('variant');
@@ -259,7 +264,9 @@ function handle_submit($user) {
259264
$wrapper_verbose = get_str('wrapper_verbose', true);
260265
$cmdline = get_str('cmdline');
261266

262-
$variant_dir = "../../buda_apps/$app/$variant";
267+
$app_desc = get_buda_desc($app);
268+
269+
$variant_dir = "$buda_root/$app/$variant";
263270
$variant_desc = json_decode(
264271
file_get_contents("$variant_dir/variant.json")
265272
);
@@ -280,7 +287,7 @@ function handle_submit($user) {
280287
stage_input_files($batch_dir, $batch_desc, $batch->id);
281288

282289
create_jobs(
283-
$app, $variant, $variant_desc,
290+
$app, $app_desc, $variant, $variant_desc,
284291
$batch_desc, $batch->id, $batch_dir_name,
285292
$wrapper_verbose, $cmdline
286293
);

lib/gui_rpc_client.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ struct APP_VERSION {
233233
struct WORKUNIT {
234234
char name[256];
235235
char app_name[256];
236+
char sub_appname[256];
236237
int version_num; // backwards compat
237238
double rsc_fpops_est;
238239
double rsc_fpops_bound;

lib/gui_rpc_client_ops.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ int WORKUNIT::parse(XML_PARSER& xp) {
606606
if (xp.match_tag("/workunit")) return 0;
607607
if (xp.parse_str("name", name, sizeof(name))) continue;
608608
if (xp.parse_str("app_name", app_name, sizeof(app_name))) continue;
609+
if (xp.parse_str("sub_appname", sub_appname, sizeof(sub_appname))) continue;
609610
if (xp.parse_int("version_num", version_num)) continue;
610611
if (xp.parse_double("rsc_fpops_est", rsc_fpops_est)) continue;
611612
if (xp.parse_double("rsc_fpops_bound", rsc_fpops_bound)) continue;
@@ -620,8 +621,9 @@ int WORKUNIT::parse(XML_PARSER& xp) {
620621
}
621622

622623
void WORKUNIT::clear() {
623-
safe_strcpy(name, "");
624-
safe_strcpy(app_name, "");
624+
name[0] = 0;
625+
app_name[0] = 0;
626+
sub_appname[0] = 0;
625627
version_num = 0;
626628
rsc_fpops_est = 0;
627629
rsc_fpops_bound = 0;

samples/docker_wrapper/docker_wrapper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,13 @@ int create_container() {
375375
if (retval) return retval;
376376

377377
// on MacOS/podman, you need the full path, not .
378+
// Win: use . since full path has :
378379
//
380+
#ifdef __APPLE__
379381
getcwd(cwd, sizeof(cwd));
382+
#else
383+
strcpy(cwd, ".");
384+
#endif
380385
snprintf(slot_cmd, sizeof(slot_cmd), " -v %s:%s", cwd, config.workdir.c_str());
381386
if (config.project_dir_mount.empty()) {
382387
project_cmd[0] = 0;

tools/backend_lib.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
// You should have received a copy of the GNU Lesser General Public License
1616
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
1717

18+
// functions called from create_work
19+
// and backend programs (scheduler, transitioner etc.)
20+
// to create result records and other utilities
21+
1822
#include "config.h"
1923
#include "boinc_stdio.h"
2024
#include <cstdlib>
@@ -28,7 +32,6 @@
2832
#include <sys/types.h>
2933
#include <sys/stat.h>
3034

31-
3235
#include "boinc_db.h"
3336
#include "common_defs.h"
3437
#include "crypt.h"

0 commit comments

Comments
 (0)