Skip to content

Commit

Permalink
Run gcc in parallel by default when using buildModel.
Browse files Browse the repository at this point in the history
- Note 1: OMEdit should be updated with an option to set +numProc (in case the user wants to use number of CPU's - 1)
- Note 2: OMEdit should not use the buildModel command. It should use translateModel and call make itself since this blocks omc for a shorter period of time


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17654 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 11, 2013
1 parent 2f4ed9e commit faf6b13
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Compiler/Script/CevalScript.mo
Expand Up @@ -3912,18 +3912,18 @@ algorithm
end matchcontinue;
end getFileDir;

public function compileModel "author: PA, x02lucpo
Compiles a model given a file-prefix, helper function to buildModel."
public function compileModel "Compiles a model given a file-prefix, helper function to buildModel."
input String inFilePrefix;
input list<String> inLibsList;
input String inFileDir;
input String solverMethod "inline solvers requires setting environment variables";
algorithm
_ := matchcontinue (inFilePrefix,inLibsList,inFileDir,solverMethod)
local
String pd,omhome,omhome_1,cd_path,libsfilename,libs_str,win_call,make_call,s_call,fileprefix,file_dir,filename,str,fileDLL, fileEXE, fileLOG, make,target;
String pd,omhome,omhome_1,cd_path,libsfilename,libs_str,win_call,make_call,s_call,fileprefix,file_dir,filename,str,fileDLL, fileEXE, fileLOG, make,target,numParallelStr;
list<String> libs;
Boolean isWindows;
Integer numParallel;

// If compileCommand not set, use $OPENMODELICAHOME\bin\Compile
// adrpo 2009-11-29: use ALL THE TIME $OPENMODELICAHOME/bin/Compile
Expand All @@ -3948,7 +3948,9 @@ algorithm
omhome = Util.if_(isWindows, "set OPENMODELICAHOME=\"" +& System.stringReplace(omhome_1, "/", "\\") +& "\"&& ", "");
win_call = stringAppendList({omhome,"\"",omhome_1,pd,"share",pd,"omc",pd,"scripts",pd,"Compile","\""," ",fileprefix," ",target});
make = System.getMakeCommand();
make_call = stringAppendList({make," -f ",fileprefix,".makefile > ",fileprefix,".log 2>&1"});
numParallel = Util.if_(Config.getRunningTestsuite(), 1, Config.noProc());
numParallelStr = intString(numParallel);
make_call = stringAppendList({make," -j",numParallelStr," -f ",fileprefix,".makefile > ",fileprefix,".log 2>&1"});
s_call = Util.if_(isWindows, win_call, make_call);
Debug.fprintln(Flags.DYN_LOAD, "compileModel: running " +& s_call);

Expand Down

0 comments on commit faf6b13

Please sign in to comment.