Repository: systemml Updated Branches: refs/heads/master 3d5dbe429 -> 5e3fed25b
[MINOR] Extended JMLC API (pass global dml config before prepareScript) Project: http://git-wip-us.apache.org/repos/asf/systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/5e3fed25 Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/5e3fed25 Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/5e3fed25 Branch: refs/heads/master Commit: 5e3fed25b55e60a017597fc2c8c6721e2096f056 Parents: 3d5dbe4 Author: Matthias Boehm <[email protected]> Authored: Fri Feb 16 21:32:22 2018 -0800 Committer: Matthias Boehm <[email protected]> Committed: Fri Feb 16 21:32:22 2018 -0800 ---------------------------------------------------------------------- .../org/apache/sysml/api/jmlc/Connection.java | 68 ++++++++++++++------ 1 file changed, 48 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/systemml/blob/5e3fed25/src/main/java/org/apache/sysml/api/jmlc/Connection.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/api/jmlc/Connection.java b/src/main/java/org/apache/sysml/api/jmlc/Connection.java index be75a95..7940bc5 100644 --- a/src/main/java/org/apache/sysml/api/jmlc/Connection.java +++ b/src/main/java/org/apache/sysml/api/jmlc/Connection.java @@ -103,8 +103,52 @@ public class Connection implements Closeable * Connection constructor, the starting point for any other JMLC API calls. * */ - public Connection() - { + public Connection() { + //with default dml configuration + this(new DMLConfig()); + } + + /** + * Connection constructor, the starting point for any other JMLC API calls. + * This variant allows to enable a set of boolean compiler configurations. + * + * @param cconfigs one or many boolean compiler configurations to enable. + */ + public Connection(CompilerConfig.ConfigType... cconfigs) { + //basic constructor, which also constructs the compiler config + this(new DMLConfig()); //with default dml configuration + + //set optional compiler configurations in current config + for( ConfigType configType : cconfigs ) + _cconf.set(configType, true); + setLocalConfigs(); + } + + /** + * Connection constructor, the starting point for any other JMLC API calls. + * This variant allows to pass a global dml configuration and enable a set + * of boolean compiler configurations. + * + * @param dmlconfig a dml configuration. + * @param cconfigs one or many boolean compiler configurations to enable. + */ + public Connection(DMLConfig dmlconfig, CompilerConfig.ConfigType... cconfigs) { + //basic constructor, which also constructs the compiler config + this(dmlconfig); + + //set optional compiler configurations in current config + for( ConfigType configType : cconfigs ) + _cconf.set(configType, true); + setLocalConfigs(); + } + + /** + * Connection constructor, the starting point for any other JMLC API calls. + * This variant allows to pass a global dml configuration. + * + * @param dmlconfig a dml configuration. + */ + public Connection(DMLConfig dmlconfig) { DMLScript.rtplatform = RUNTIME_PLATFORM.SINGLE_NODE; //setup basic parameters for embedded execution @@ -129,29 +173,13 @@ public class Connection implements Closeable //disable caching globally CacheableData.disableCaching(); - //create default configuration - _dmlconf = new DMLConfig(); + //assign the given configuration + _dmlconf = dmlconfig; setLocalConfigs(); } /** - * Connection constructor, the starting point for any other JMLC API calls. - * This variant allows to enable a set of boolean compiler configurations. - * - * @param configs one or many boolean compiler configurations to enable. - */ - public Connection(CompilerConfig.ConfigType... configs) { - //basic constructor, which also constructs the compiler config - this(); - - //set optional compiler configurations in current config - for( ConfigType configType : configs ) - _cconf.set(configType, true); - setLocalConfigs(); - } - - /** * Prepares (precompiles) a script and registers input and output variables. * * @param script string representing the DML or PyDML script
