mirror of https://github.com/BOINC/boinc.git
Merge branch 'master' of ssh://isaac.ssl.berkeley.edu/boinc-v2
This commit is contained in:
commit
112a3f5ae7
|
@ -84,6 +84,7 @@ inline void debug_msg(const char* x) {
|
|||
using std::vector;
|
||||
using std::string;
|
||||
int nthreads = 1;
|
||||
int gpu_device_num = -1;
|
||||
|
||||
struct TASK {
|
||||
string application;
|
||||
|
@ -233,6 +234,7 @@ void str_replace_all(char* buf, const char* s1, const char* s2) {
|
|||
// macro-substitute strings from job.xml
|
||||
// $PROJECT_DIR -> project directory
|
||||
// $NTHREADS --> --nthreads arg if present, else 1
|
||||
// $GPU_DEVICE_NUM --> gpu_device_num from init_data.xml, or --device arg
|
||||
//
|
||||
void macro_substitute(char* buf) {
|
||||
const char* pd = strlen(aid.project_dir)?aid.project_dir:".";
|
||||
|
@ -240,6 +242,14 @@ void macro_substitute(char* buf) {
|
|||
char nt[256];
|
||||
sprintf(nt, "%d", nthreads);
|
||||
str_replace_all(buf, "$NTHREADS", nt);
|
||||
|
||||
if (aid.gpu_device_num >= 0) {
|
||||
gpu_device_num = aid.gpu_device_num;
|
||||
}
|
||||
if (gpu_device_num >= 0) {
|
||||
sprintf(nt, "%d", gpu_device_num);
|
||||
str_replace_all(buf, "$GPU_DEVICE_NUM", nt);
|
||||
}
|
||||
}
|
||||
|
||||
// make a list of files in the slot directory,
|
||||
|
@ -959,6 +969,8 @@ int main(int argc, char** argv) {
|
|||
for (int j=1; j<argc; j++) {
|
||||
if (!strcmp(argv[j], "--nthreads")) {
|
||||
nthreads = atoi(argv[++j]);
|
||||
} else if (!strcmp(argv[j], "--device")) {
|
||||
gpu_device_num = atoi(argv[++j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue