mirror of https://github.com/BOINC/boinc.git
Condor: add variant of uppercase that processes multiple files
This commit is contained in:
parent
9acf242f93
commit
98123560e2
|
@ -1,20 +0,0 @@
|
|||
|
||||
// CMC here
|
||||
// separate different compilations of whetstone.cpp which will utilize
|
||||
// various ARM fp features ie neon, vfp, or "normal"
|
||||
#ifdef ANDROID
|
||||
#ifdef ANDROID_NEON
|
||||
// add CXXFLAGS/CFLAGS for gcc: -DANDROID_NEON -mfloat-abi=softfp -mfpu=neon
|
||||
#include <arm_neon.h>
|
||||
#endif // ANDROID_NEON
|
||||
|
||||
namespace android_neon {
|
||||
int whetstone(double& flops, double& cpu_time, double min_cpu_time);
|
||||
}
|
||||
|
||||
namespace android_vfp {
|
||||
int whetstone(double& flops, double& cpu_time, double min_cpu_time);
|
||||
}
|
||||
|
||||
#endif // ANDROID
|
||||
|
|
@ -15,7 +15,7 @@ $batch_name = "batch_$t";
|
|||
$job_name_1 = "job1_$t";
|
||||
$job_name_2 = "job2_$t";
|
||||
echo "
|
||||
BOINC_SUBMIT 1 $batch_name uppercase 2 $job_name_1 0 1 /mydisks/b/users/boincadm/a/in in $job_name_2 0 1 /mydisks/b/users/boincadm/b/in in 1
|
||||
BOINC_SUBMIT 1 $batch_name uppercase 2 $job_name_1 0 1 in1 in $job_name_2 0 1 in2 in 1
|
||||
BOINC_QUERY_BATCHES 2 1 $batch_name
|
||||
BOINC_ABORT_JOBS 6 $job_name_1 $job_name_2
|
||||
BOINC_FETCH_OUTPUT 3 $job_name_1 . stderr_out1 ALL 1 out out1
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/env php
|
||||
<?php
|
||||
|
||||
// Generate GAHP commands for submitting/querying/fetching a batch.
|
||||
// Copy and paste these into a running BOINC GAHP
|
||||
//
|
||||
// Files in1 and in2 must exist already (these are input files)
|
||||
//
|
||||
// After fetching outputs, the following should exist:
|
||||
// out1, out2: output files (upper-case versions of in1 and in2)
|
||||
// stderr_out1, stderr_out2: stderr output of the 2 jobs
|
||||
|
||||
$t = time();
|
||||
$batch_name = "batch_$t";
|
||||
$job_name_1 = "job1_$t";
|
||||
$job_name_2 = "job2_$t";
|
||||
echo "
|
||||
BOINC_SUBMIT 1 $batch_name uppercase_n 2 $job_name_1 0 1 in1 in $job_name_2 0 1 in2 in 1
|
||||
BOINC_QUERY_BATCHES 2 1 $batch_name
|
||||
BOINC_ABORT_JOBS 6 $job_name_1 $job_name_2
|
||||
BOINC_FETCH_OUTPUT 3 $job_name_1 . stderr_out1 ALL 1 out out1
|
||||
BOINC_FETCH_OUTPUT 4 $job_name_2 . stderr_out2 ALL 1 out out2
|
||||
BOINC_RETIRE_BATCH 5 $batch_name
|
||||
";
|
||||
?>
|
|
@ -38,7 +38,7 @@ else
|
|||
LIBJPEG = -ljpeg
|
||||
endif
|
||||
|
||||
PROGS = uc2 \
|
||||
PROGS = uc2 ucn \
|
||||
# uc2_graphics
|
||||
# make this optional so compile doesn't break on systems without OpenGL
|
||||
|
||||
|
@ -65,6 +65,11 @@ uc2: uc2.o libstdc++.a $(BOINC_API_DIR)/libboinc_api.a $(BOINC_LIB_DIR)/libboinc
|
|||
$(BOINC_API_DIR)/libboinc_api.a \
|
||||
$(BOINC_LIB_DIR)/libboinc.a
|
||||
|
||||
ucn: ucn.o libstdc++.a $(BOINC_API_DIR)/libboinc_api.a $(BOINC_LIB_DIR)/libboinc.a
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o ucn ucn.o libstdc++.a -pthread \
|
||||
$(BOINC_API_DIR)/libboinc_api.a \
|
||||
$(BOINC_LIB_DIR)/libboinc.a
|
||||
|
||||
uc2_graphics: uc2_graphics.o ttfont.o libstdc++.a $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_graphics2.a
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o uc2_graphics uc2_graphics.o ttfont.o libstdc++.a -pthread \
|
||||
$(BOINC_API_DIR)/libboinc_graphics2.a \
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2013 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// another BOINC test application;
|
||||
// converts one or more files to uppercase,
|
||||
// then uses some CPU time
|
||||
//
|
||||
// cmdline: in1 out1 ... inn outn
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "boinc_api.h"
|
||||
#include "filesys.h"
|
||||
#include "util.h"
|
||||
|
||||
double cpu_time = 20, comp_result;
|
||||
|
||||
// do about .5 seconds of computing
|
||||
// (note: I needed to add an arg to this;
|
||||
// otherwise the MS C++ compiler optimizes away
|
||||
// all but the first call to it!)
|
||||
//
|
||||
static double do_some_computing(int foo) {
|
||||
double x = 3.14159*foo;
|
||||
int i;
|
||||
for (i=0; i<50000000; i++) {
|
||||
x += 5.12313123;
|
||||
x *= 0.5398394834;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int convert_file(char* in, char* out) {
|
||||
char input_path[1024], output_path[1024];
|
||||
char buf[256];
|
||||
|
||||
boinc_resolve_filename(in, input_path, sizeof(input_path));
|
||||
FILE* infile = boinc_fopen(input_path, "r");
|
||||
if (!infile) {
|
||||
fprintf(stderr,
|
||||
"%s Couldn't find input file, resolved name %s.\n",
|
||||
boinc_msg_prefix(buf, sizeof(buf)), input_path
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
||||
boinc_resolve_filename(out, output_path, sizeof(output_path));
|
||||
FILE* outfile = boinc_fopen(output_path, "w");
|
||||
if (!outfile) {
|
||||
fprintf(stderr,
|
||||
"%s Couldn't find output file, resolved name %s.\n",
|
||||
boinc_msg_prefix(buf, sizeof(buf)), output_path
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
char c = fgetc(infile);
|
||||
if (c == EOF) break;
|
||||
c = toupper(c);
|
||||
fputc(c, outfile);
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
fclose(outfile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char buf[256];
|
||||
int retval = boinc_init();
|
||||
if (retval) {
|
||||
fprintf(stderr, "%s boinc_init returned %d\n",
|
||||
boinc_msg_prefix(buf, sizeof(buf)), retval
|
||||
);
|
||||
exit(retval);
|
||||
}
|
||||
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "--cpu_time")) {
|
||||
cpu_time = atof(argv[++i]);
|
||||
} else {
|
||||
retval = convert_file(argv[i], argv[i+1]);
|
||||
if (retval) exit(-1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// burn up some CPU time if needed
|
||||
//
|
||||
if (cpu_time) {
|
||||
double start = dtime();
|
||||
for (int i=0; ; i++) {
|
||||
double e = dtime()-start;
|
||||
if (e > cpu_time) break;
|
||||
comp_result = do_some_computing(i);
|
||||
}
|
||||
}
|
||||
boinc_finish(0);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int WINAPI WinMain(
|
||||
HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode
|
||||
) {
|
||||
LPSTR command_line;
|
||||
char* argv[100];
|
||||
int argc;
|
||||
|
||||
command_line = GetCommandLine();
|
||||
argc = parse_command_line(command_line, argv);
|
||||
return main(argc, argv);
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue