|
22 | 22 | import org.apache.commons.io.FileUtils; |
23 | 23 | import org.apache.commons.io.IOUtils; |
24 | 24 | import org.apache.commons.lang3.SystemUtils; |
25 | | -import org.apache.commons.logging.Log; |
26 | | -import org.apache.commons.logging.LogFactory; |
| 25 | +import org.apache.sysds.utils.ParameterizedLogger; |
27 | 26 | import org.apache.sysds.api.DMLScript; |
28 | 27 | import org.apache.sysds.common.Types.AggOp; |
29 | 28 | import org.apache.sysds.common.Types.DataType; |
|
114 | 113 | import java.util.jar.JarFile; |
115 | 114 |
|
116 | 115 | public class SpoofCompiler { |
117 | | - private static final Log LOG = LogFactory.getLog(SpoofCompiler.class.getName()); |
| 116 | + private static final ParameterizedLogger LOG = ParameterizedLogger.getLogger(SpoofCompiler.class); |
118 | 117 |
|
119 | 118 | //internal configuration flags |
120 | 119 | public static CompilerType JAVA_COMPILER = CompilerType.JANINO; |
@@ -539,21 +538,39 @@ public static ArrayList<Hop> optimize(ArrayList<Hop> roots, boolean recompile) |
539 | 538 | } |
540 | 539 |
|
541 | 540 | //explain debug output cplans or generated source code |
542 | | - if( LOG.isInfoEnabled() || DMLScript.EXPLAIN.isHopsType(recompile) ) { |
543 | | - LOG.info("Codegen EXPLAIN (generated cplan for HopID: " + cplan.getKey() + |
544 | | - ", line "+tmp.getValue().getBeginLine() + ", hash="+tmp.getValue().hashCode()+"):"); |
| 541 | + boolean explainHops = DMLScript.EXPLAIN.isHopsType(recompile); |
| 542 | + boolean explainRuntime = DMLScript.EXPLAIN.isRuntimeType(recompile); |
| 543 | + if( explainHops ) { |
| 544 | + LOG.infoUnconditional("Codegen EXPLAIN (generated cplan for HopID: {}, line {}, hash={}):", |
| 545 | + cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode()); |
545 | 546 | LOG.info(tmp.getValue().getClassname() |
546 | 547 | + Explain.explainCPlan(cplan.getValue().getValue())); |
547 | 548 | } |
548 | | - if( LOG.isInfoEnabled() || DMLScript.EXPLAIN.isRuntimeType(recompile) ) { |
549 | | - LOG.info("JAVA Codegen EXPLAIN (generated code for HopID: " + cplan.getKey() + |
550 | | - ", line "+tmp.getValue().getBeginLine() + ", hash="+tmp.getValue().hashCode()+"):"); |
| 549 | + else { |
| 550 | + LOG.info("Codegen EXPLAIN (generated cplan for HopID: {}, line {}, hash={}):", |
| 551 | + cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode()); |
| 552 | + LOG.info(tmp.getValue().getClassname() |
| 553 | + + Explain.explainCPlan(cplan.getValue().getValue())); |
| 554 | + } |
| 555 | + if( explainRuntime ) { |
| 556 | + LOG.infoUnconditional("JAVA Codegen EXPLAIN (generated code for HopID: {}, line {}, hash={}):", |
| 557 | + cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode()); |
551 | 558 | LOG.info(CodegenUtils.printWithLineNumber(src)); |
552 | | - |
| 559 | + |
553 | 560 | if(API == GeneratorAPI.CUDA) { |
554 | | - LOG.info("CUDA Codegen EXPLAIN (generated code for HopID: " + cplan.getKey() + |
555 | | - ", line " + tmp.getValue().getBeginLine() + ", hash=" + tmp.getValue().hashCode() + "):"); |
| 561 | + LOG.infoUnconditional("CUDA Codegen EXPLAIN (generated code for HopID: {}, line {}, hash={}):", |
| 562 | + cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode()); |
| 563 | + LOG.info(CodegenUtils.printWithLineNumber(src_cuda)); |
| 564 | + } |
| 565 | + } |
| 566 | + else { |
| 567 | + LOG.info("JAVA Codegen EXPLAIN (generated code for HopID: {}, line {}, hash={}):", |
| 568 | + cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode()); |
| 569 | + LOG.info(CodegenUtils.printWithLineNumber(src)); |
556 | 570 |
|
| 571 | + if(API == GeneratorAPI.CUDA) { |
| 572 | + LOG.info("CUDA Codegen EXPLAIN (generated code for HopID: {}, line {}, hash={}):", |
| 573 | + cplan.getKey(), tmp.getValue().getBeginLine(), tmp.getValue().hashCode()); |
557 | 574 | LOG.info(CodegenUtils.printWithLineNumber(src_cuda)); |
558 | 575 | } |
559 | 576 | } |
|
0 commit comments