Commit 2dd2b14f authored by Jens Korinth's avatar Jens Korinth

Add trace output of Vivado and Vivado HLS

* external Vivado/Vivado HLS processes only log to files
* for debugging it would be helpful to have the stdout and stderr of the
  processes log directly in the console
* added ProcessLogger for the outputs; trace level, should only be
  activated selectively
parent 9b59398d
......@@ -31,7 +31,7 @@ import de.tu_darmstadt.cs.esa.tapasco.reports._
import de.tu_darmstadt.cs.esa.tapasco.dse.Heuristics
import de.tu_darmstadt.cs.esa.tapasco.filemgmt.FileAssetManager
import java.nio.file._
import scala.sys.process.{Process, ProcessIO}
import scala.sys.process.{Process, ProcessLogger}
import scala.util.Properties.{lineSeparator => NL}
import ComposeResult._
import LogFormatter._
......@@ -72,7 +72,10 @@ class VivadoComposer()(implicit cfg: Configuration) extends Composer {
// execute Vivado (max runtime: 1 day)
val r = InterruptibleProcess(Process(vivadoCmd, files.outdir.toFile),
waitMillis = Some(24 * 60 * 60 * 1000)).!(io)
waitMillis = Some(24 * 60 * 60 * 1000)).!(ProcessLogger(
stdoutString => logger.trace("Vivado: {}", stdoutString),
stderrString => logger.trace("Vivado ERR: {}", stderrString)
))
// check retcode
if (r == InterruptibleProcess.TIMEOUT_RETCODE) {
......@@ -218,11 +221,4 @@ object VivadoComposer {
lazy val tim = TimingReport(timFile)
lazy val util = UtilizationReport(utilFile)
}
/** custom ProcessIO: ignore everything. */
private final val io = new ProcessIO(
stdin => {stdin.close()},
stdout => {stdout.close()},
stderr => {stderr.close()}
)
}
......@@ -40,7 +40,8 @@ private object VivadoHighLevelSynthesis extends HighLevelSynthesizer {
"-f", script.toString,
"-l", logfile.toString
), script.getParent.toFile), waitMillis = Some(24 * 60 * 60 * 1000))
.!(ProcessLogger(line => logger.error(line), line => logger.warn(line)))
.!(ProcessLogger(line => logger.trace("Vivado HLS: {}", line),
line => logger.trace("Vivado HLS ERR: {}", line)))
logger.debug("Vivado HLS finished with exit code %d".format(vivadoRet))
vivadoRet match {
case 0 =>
......
......@@ -38,7 +38,7 @@ private[tapasco] final case class InterruptibleProcess(p: ProcessBuilder, waitMi
})
def !(plogger: ProcessLogger = plog): Int = {
val t = mkThread(plog)
val t = mkThread(plogger)
t.start()
if (waitMillis.isEmpty) t.join() else t.join(waitMillis.get)
if (t.isAlive()) t.interrupt()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment