TorchLean API

NN.Runtime.External.Julia

Julia subprocess integration (optional) #

This module provides a small wrapper around IO.Process for calling out to Julia.

Why this exists:

This mirrors the existing patterns used in TorchLean for:

Optional dependency:

References:

Resolving the Julia executable #

Resolve which Julia executable to use.

If the environment variable TORCHLEAN_JULIA is set, it takes precedence. Otherwise we fall back to juliaCmd (default: "julia"), which is expected to be on PATH.

Instances For

    Availability checks #

    def Runtime.External.Julia.isAvailable (juliaCmd : String := "julia") :

    Check whether Julia is available by running julia --version.

    This is intentionally conservative: any exception (including “executable not found”) is treated as “not available”.

    Instances For

      Require Julia to be available and return the resolved command.

      This is suitable for demo runners that want a friendly error message when Julia is missing.

      Instances For

        Running Julia #

        def Runtime.External.Julia.run (args : Array String) (cwd : Option String := some ".") (juliaCmd : String := "julia") :

        Run Julia with the given CLI arguments and return stdout.

        On nonzero exit code, we raise IO.userError including the captured stderr. The cwd defaults to "." so relative script paths behave like in other TorchLean subprocess integrations.

        Instances For
          def Runtime.External.Julia.runJson (args : Array String) (cwd : Option String := some ".") (juliaCmd : String := "julia") :

          Run Julia and parse stdout as JSON.

          This is a convenience wrapper used by “certificate producer” scripts that print a single JSON payload to stdout.

          Instances For