Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/main/java/org/apache/sysds/api/DMLScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
import org.apache.commons.cli.AlreadySelectedException;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sysds.utils.ParameterizedLogger;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.sysds.common.Types.ExecMode;
Expand Down Expand Up @@ -178,7 +177,7 @@ public class DMLScript
public static boolean VALIDATOR_IGNORE_ISSUES = false;

public static String _uuid = IDHandler.createDistributedUniqueID();
private static final Log LOG = LogFactory.getLog(DMLScript.class.getName());
private static final ParameterizedLogger LOG = ParameterizedLogger.getLogger(DMLScript.class);

///////////////////////////////
// public external interface
Expand Down Expand Up @@ -621,14 +620,9 @@ private static void printInvocationInfo(String fnameScript, String fnameOptConfi
}

private static void printStartExecInfo(String dmlScriptString) {
boolean info = LOG.isInfoEnabled();
boolean debug = LOG.isDebugEnabled();
if(info)
LOG.info("BEGIN DML run " + getDateTime());
if(debug)
LOG.debug("DML script: \n" + dmlScriptString);
if(info)
LOG.info("Process id: " + IDHandler.getProcessID());
LOG.info("BEGIN DML run {}", getDateTime());
LOG.debug("DML script: \n{}", dmlScriptString);
LOG.info("Process id: {}", IDHandler.getProcessID());
}

private static void registerForMonitoring() {
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/org/apache/sysds/hops/DataOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

package org.apache.sysds.hops;

import static org.apache.sysds.parser.DataExpression.FED_RANGES;

import java.util.HashMap;
import java.util.Map.Entry;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sysds.api.DMLScript;
import org.apache.sysds.common.Types.DataType;
import org.apache.sysds.common.Types.ExecType;
import org.apache.sysds.common.Types.FileFormat;
import org.apache.sysds.common.Types.OpOpData;
import org.apache.sysds.common.Types.ValueType;
Expand All @@ -35,22 +36,21 @@
import org.apache.sysds.lops.Data;
import org.apache.sysds.lops.Federated;
import org.apache.sysds.lops.Lop;
import org.apache.sysds.common.Types.ExecType;
import org.apache.sysds.lops.LopsException;
import org.apache.sysds.lops.Sql;
import org.apache.sysds.lops.Tee;
import org.apache.sysds.parser.DataExpression;
import static org.apache.sysds.parser.DataExpression.FED_RANGES;
import org.apache.sysds.runtime.controlprogram.caching.MatrixObject.UpdateType;
import org.apache.sysds.runtime.meta.DataCharacteristics;
import org.apache.sysds.runtime.util.LocalFileUtils;
import org.apache.sysds.utils.ParameterizedLogger;

/**
* A DataOp can be either a persistent read/write or transient read/write - writes will always have at least one input,
* but all types can have parameters (e.g., for csv literals of delimiter, header, etc).
*/
public class DataOp extends Hop {
private static final Log LOG = LogFactory.getLog(DataOp.class.getName());
private static final ParameterizedLogger LOG = ParameterizedLogger.getLogger(DataOp.class);
private OpOpData _op;
private String _fileName = null;

Expand Down Expand Up @@ -130,9 +130,7 @@ public DataOp(String l, DataType dt, ValueType vt,
String s = e.getKey();
Hop input = e.getValue();
getInput().add(input);
if (LOG.isDebugEnabled()){
LOG.debug(String.format("%15s - %s",s,input));
}
LOG.debug("{%15s} - {%s}", s, input);
input.getParent().add(this);

_paramIndexMap.put(s, index);
Expand Down
52 changes: 25 additions & 27 deletions src/main/java/org/apache/sysds/hops/codegen/SpoofCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,23 @@

package org.apache.sysds.hops.codegen;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sysds.api.DMLScript;
import org.apache.sysds.common.Types.AggOp;
import org.apache.sysds.common.Types.DataType;
Expand Down Expand Up @@ -97,24 +109,11 @@
import org.apache.sysds.runtime.matrix.data.Pair;
import org.apache.sysds.utils.Explain;
import org.apache.sysds.utils.NativeHelper;
import org.apache.sysds.utils.ParameterizedLogger;
import org.apache.sysds.utils.stats.CodegenStatistics;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;

public class SpoofCompiler {
private static final Log LOG = LogFactory.getLog(SpoofCompiler.class.getName());
private static final ParameterizedLogger LOG = ParameterizedLogger.getLogger(SpoofCompiler.class);

//internal configuration flags
public static CompilerType JAVA_COMPILER = CompilerType.JANINO;
Expand Down Expand Up @@ -539,21 +538,20 @@ public static ArrayList<Hop> optimize(ArrayList<Hop> roots, boolean recompile)
}

//explain debug output cplans or generated source code
if( LOG.isInfoEnabled() || DMLScript.EXPLAIN.isHopsType(recompile) ) {
LOG.info("Codegen EXPLAIN (generated cplan for HopID: " + cplan.getKey() +
", line "+tmp.getValue().getBeginLine() + ", hash="+tmp.getValue().hashCode()+"):");
if( DMLScript.EXPLAIN.isHopsType(recompile) ) {
LOG.info("Codegen EXPLAIN (generated cplan for HopID: {}, line {}, hash={}):",
cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode());
LOG.info(tmp.getValue().getClassname()
+ Explain.explainCPlan(cplan.getValue().getValue()));
}
if( LOG.isInfoEnabled() || DMLScript.EXPLAIN.isRuntimeType(recompile) ) {
LOG.info("JAVA Codegen EXPLAIN (generated code for HopID: " + cplan.getKey() +
", line "+tmp.getValue().getBeginLine() + ", hash="+tmp.getValue().hashCode()+"):");
if( DMLScript.EXPLAIN.isRuntimeType(recompile) ) {
LOG.info("JAVA Codegen EXPLAIN (generated code for HopID: {}, line {}, hash={}):",
cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode());
LOG.info(CodegenUtils.printWithLineNumber(src));

if(API == GeneratorAPI.CUDA) {
LOG.info("CUDA Codegen EXPLAIN (generated code for HopID: " + cplan.getKey() +
", line " + tmp.getValue().getBeginLine() + ", hash=" + tmp.getValue().hashCode() + "):");

if(API == GeneratorAPI.CUDA) {
LOG.info("CUDA Codegen EXPLAIN (generated code for HopID: {}, line {}, hash={}):",
cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode());
LOG.info(CodegenUtils.printWithLineNumber(src_cuda));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.sysds.hops.Hop;
import org.apache.sysds.hops.ReorgOp;
import org.apache.sysds.parser.StatementBlock;
import org.apache.sysds.utils.ParameterizedLogger;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -51,6 +52,7 @@
* {@code TeeOp}, and safely rewire the graph.
*/
public class RewriteInjectOOCTee extends StatementBlockRewriteRule {
private static final ParameterizedLogger LOG = ParameterizedLogger.getLogger(RewriteInjectOOCTee.class);

public static boolean APPLY_ONLY_XtX_PATTERN = false;

Expand Down Expand Up @@ -138,10 +140,7 @@ private void applyTopDownTeeRewrite(Hop sharedInput) {
}

int consumerCount = sharedInput.getParent().size();
if (LOG.isDebugEnabled()) {
LOG.debug("Inject tee for hop " + sharedInput.getHopID() + " ("
+ sharedInput.getName() + "), consumers=" + consumerCount);
}
LOG.debug("Inject tee for hop {} ({}), consumers={}", sharedInput.getHopID(), sharedInput.getName(), consumerCount);

// Take a defensive copy of consumers before modifying the graph
ArrayList<Hop> consumers = new ArrayList<>(sharedInput.getParent());
Expand All @@ -161,10 +160,7 @@ private void applyTopDownTeeRewrite(Hop sharedInput) {
handledHop.put(sharedInput.getHopID(), teeOp);
rewrittenHops.add(sharedInput.getHopID());

if (LOG.isDebugEnabled()) {
LOG.debug("Created tee hop " + teeOp.getHopID() + " -> "
+ teeOp.getName());
}
LOG.debug("Created tee hop {} -> {}", teeOp.getHopID(), teeOp.getName());
}

@SuppressWarnings("unused")
Expand Down Expand Up @@ -276,11 +272,8 @@ private void removeRedundantTeeChains(Hop hop) {
if (HopRewriteUtils.isData(hop, OpOpData.TEE) && hop.getInput().size() == 1) {
Hop teeInput = hop.getInput().get(0);
if (HopRewriteUtils.isData(teeInput, OpOpData.TEE)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Remove redundant tee hop " + hop.getHopID()
+ " (" + hop.getName() + ") -> " + teeInput.getHopID()
+ " (" + teeInput.getName() + ")");
}
LOG.debug("Remove redundant tee hop {} ({}) -> {} ({})",
hop.getHopID(), hop.getName(), teeInput.getHopID(), teeInput.getName());
HopRewriteUtils.rewireAllParentChildReferences(hop, teeInput);
HopRewriteUtils.removeAllChildReferences(hop);
}
Expand Down
Loading
Loading