X-Git-Url: https://git.auder.net/images/pieces/%22%20%20V.getPpath%28board%5Bi%5D%5Bj%5D%29%20%20%20%22.svg?a=blobdiff_plain;f=code%2Fstage1%2Fwrapper.R;h=9bbb53b035e27b72f76d1dec1b30d6dda3312ba1;hb=ebf1280e432d51f47238ce8df86750ba3a7d6d1f;hp=2549f1fa3d60fb09cdf68d05a1d011aa1e4e79fb;hpb=aa7daeaacfda268c392adf1c5efbccea77be9fe0;p=epclust.git diff --git a/code/stage1/wrapper.R b/code/stage1/wrapper.R index 2549f1f..9bbb53b 100644 --- a/code/stage1/wrapper.R +++ b/code/stage1/wrapper.R @@ -1,9 +1,15 @@ -ppam_exe = function(pathToExe, nbProcess, ...) +ppam_exe = function(path=".", np=parallel::detectCores(), data=NULL, args="DontLetMeEmpty") { - command_line = paste("mpirun -np ",nbProcess," ",pathToExe,"/ppam.exe",sep="") - args = list(...) - for (i in 1:length(args)) - command_line = paste(command_line, args[[i]]) - print(paste("EXECUTE: '", command_line,"'",sep="")) + command_line = paste("mpirun -np ",np," ",path,"/ppam.exe",sep="") + + #if data provided (as data.frame or matrix...): binarize it, and add it as first argument + if (!is.null(data)) + { + write.csv(data, "/tmp/data_csv") + system(paste(path,"/ppam.exe serialize /tmp/data_csv /tmp/data_bin 0 0",sep="")) + command_line = paste(command_line," ","/tmp/data_bin",sep="") + } + + command_line = paste(command_line," ",args,sep="") system(command_line) }