API

Deployment Recipe

Deployment.deployFMUFunction
deployFMU(trained::Surrogatize.Layer.ContinuousTimeSurrogate{<:Layer.DigitalEchoProblem{<:Surrogatize.DigitalEcho}}, ed::ExperimentData; fmu_name="digitalecho")

Deploy a DigitalEcho FMU from a trained digital echo surrogate model.

Arguments

  • trained: A trained digital echo surrogate model.
  • ed: An ExperimentData object.
  • fmu_name: The name of the FMU to be generated.
  • fmu_out_path : The directory path where the FMU needs to be stored. If not provided, it will be stored in a scratchspace.

Advanced keyword arguments

  • base_sysimage=nothing: Provide a base sysimage to build the FMU incrementally over it.
  • generate_basesysimage = false: generate a fresh base sysimage for the FMU.
  • cpu_target: The value to use for JULIA_CPU_TARGET when building the system image

Returns

A tuple of the path to the generated FMU and FMU Julia package.

Example

digitalecho = DigitalEcho(ed; ground_truth_port=:observables)
fmu_path, pkg_path = deployFMU(digitalecho, ed; fmu_name="digitalecho")
source

API for deploying job on JuliaHub

JuliaSimSurrogates.@generate_fmuMacro
@generate_fmu script

Macro for capturing the code which would be submitted for running a deployment job on JuliaHub. The variables JSS_DATASET_PATH and JSS_MODEL_PATH hold the paths to the serialized dataset and model respectively.

Arguments

script: Code block enclosed in a begin..end which would be cached and submitted for running a deployment job on JuliaHub

Example

@generate_fmu begin
    using Deployment

    ed_dataset = JLSO.load(JSS_DATASET_PATH)[:result]
    ed = ExperimentData(ed_dataset)

    model = JLSO.load(JSS_MODEL_PATH)[:result]

    deployFMU(model, ed; JSS_DEPLOYMENT_KWARGS...)
end

Note that the JSS_DATASET_PATH and JSS_MODEL_PATH are used to retrive the ExperimentData and trained DigitalEcho respectively.

source
JuliaSimSurrogates.run_fmu_generationFunction
run_fmu_generation(
    directory,
    batch_image::JuliaHub.BatchImage,
    model_dataset::String,
    ed_dataset::String;
    model_dataset_version,
    ed_dataset_version,
    fmu_name,
    auth,
    specs,
    kwargs...
)

Runs a FMU generation job on JuliaHub. This function should called after calling @generate_fmu to cache in the code which needs to be run on the job. It modifies the cached code such that the ed_dataset and the model_dataset passed are downloaded and the path for them is stored in JSS_DATASET_PATH and JSS_MODEL_PATH respectively. The expectation is the script ends with a call to the deploy_fmu function.

The function then orchestrates a batch job on JuliaHub with the given batch image which executes the code and stores the generated FMU as a JuliaHub.Dataset.

Arguments

directory: Path to the directory that would be used to upload as an appbundle. batch_image: Job image to be used for the batch job. This is of type JuliaHub.BatchImagemodel_dataset: Name of the JuliaHub dataset that contains the trained DigitalEcho. ed_dataset: Name of the JuliaHub dataset for the ExperimentData which was used to train the model. model_dataset_version: Version of model_dataset. Defaults to the latest version ed_dataset_version: Version of ed_dataset. Defaults to the latest version fmu_name: Name of the dataset in which the generated FMU is uploaded. auth: Authentication object of type JuliaHub.Authentication for verification while performing various operations on Juliahub specs: Named Tuple giving the specifications of compute for the batch job, i.e, ncpu, ngpu, memory etc.

Returns

Named tuple of job object of type JuliaHub.Job and the generated FMU as a dataset object of type JuliaHub.Dataset

source