Skip to content

Commit

Permalink
[MINOR] Extended JMLC API (pass global dml config before prepareScript)
Browse files Browse the repository at this point in the history
  • Loading branch information
mboehm7 committed Feb 17, 2018
1 parent 3d5dbe4 commit 5e3fed2
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions src/main/java/org/apache/sysml/api/jmlc/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -129,28 +173,12 @@ public Connection()
//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.
*
Expand Down

0 comments on commit 5e3fed2

Please sign in to comment.