Commit 50dd5970 authored by Romain Reuillon's avatar Romain Reuillon
Browse files

[Doc] enh: add Julia

parent 71af9f41
Pipeline #1207 passed with stages
in 53 minutes and 12 seconds
......@@ -201,7 +201,7 @@ object DocumentationPages {
val faq = DocumentationPage.fromScalatex(name = "FAQ", content = scalatex.FAQ, title = Some("Frequently Asked Questions"))
// Plug
def plugPages = pageNode(plug, Vector(scala, java, container, python, r, netLogo, gama, scilab))
def plugPages = pageNode(plug, Vector(scala, java, container, python, r, netLogo, gama, scilab, julia))
lazy val plug = DocumentationPage.fromScalatex(name = "Plug", content = scalatex.documentation.plug.Plug, title = Some("Plug Your Model"))
lazy val scala = DocumentationPage.fromScalatex(name = "Scala", content = scalatex.documentation.plug.Scala)
......@@ -211,6 +211,7 @@ object DocumentationPages {
lazy val r = DocumentationPage.fromScalatex(name = "R", content = scalatex.documentation.plug.R)
lazy val scilab = DocumentationPage.fromScalatex(name = "Scilab", content = scalatex.documentation.plug.Scilab)
lazy val gama = DocumentationPage.fromScalatex(name = "GAMA", content = scalatex.documentation.plug.GAMA)
lazy val julia = DocumentationPage.fromScalatex(name = "Julia", content = scalatex.documentation.plug.Julia)
lazy val container = DocumentationPage.fromScalatex(name = "Executable", content = scalatex.documentation.plug.Container)
// Explore
......
@import org.openmole.site.tools._
@import org.openmole.site._
@import org.openmole.site.content.Native._
@import DocumentationPages._
@h2{JuliaTask syntax}
@h3{Preliminary remark}
@usesSingularity("JuliaTask")
The @code{JuliaTask} relies on an underlying @code{ContainerTask}.
@h3{Arguments of the JuliaTask}
It takes the following arguments :
@ul
@li{@code{script} String or File, mandatory. The Python script to be executed.}
@li{@code{version} String, optional. The version of Julia to run.}
@li{@code{install} Sequence of strings, optional (default = empty). The commands to be executed prior to any Julia packages installation and script execution (to install libraries on the system).}
@li{@code{libraries} Sequence of strings, optional (default = empty). The name of Julia libraries that need to be installed before the script execution (note: as detailed below, installations are only achieved during the first execution of the script, and then stored in a docker image in cache. To force an update, use the @i{forceUpdate} argument).}
@li{@code{forceUpdate} Boolean, optional (default = false). Should the libraries installation be forced (to ensure an update for example). If true, the task will perform the installation (and thus the update) even if the library was already installed.}
@h2{Embedding a Julia script}
The toy Julia script for this test case is:
@code("""
numericaloutput = arg * 2
write(open("output.txt","w"),string("Hello world from Julia #",arg))
""")
@br
We save this to @i{hello.jl} and upload it in your OpenMOLE workspace.
You can then use the following script:
@br@br
@hl.openmole("""
// Declare the variable
val arg = Val[Int]
val arg2 = Val[Double]
val numericaloutput = Val[Int]
val fileoutput = Val[File]
// julia task
val juliaTask =
JuliaTask(workDirectory / "hello.jl") set (
inputs += arg.mapped,
inputs += arg2.mapped,
outputs += arg,
outputs += numericaloutput.mapped,
outputs += fileoutput mapped "output.txt"
)
val copy = CopyFileHook(fileoutput, workDirectory / "result/hello${arg}.txt")
val env = LocalEnvironment(2)
DirectSampling(
evaluation = juliaTask,
sampling = (arg in (0 to 10)) x (arg2 is 2.0)
) hook copy on env
""")
@br
Notions from OpenMOLE are reused in this example.
If you're not too familiar with @a("Environments", href := scale.file), @a("Groupings", href := scale.file + "#Grouping"), @a("Hooks", href := hook.file) or @a("Samplings", href := samplings.file), check the relevant sections of the documentation.
......@@ -19,7 +19,7 @@ It takes the following arguments :
@ul
@li{@code{script} String or file, mandatory. The Python script to be executed.}
@li{@code{major} Int, optional (default = 3). Major version of Python to run - MUST be either 2 or 3.}
@li{@code{version} String, optional. The version of Python to run.}
@li{@code{install} Sequence of strings, optional (default = empty). The commands to be executed prior to any Python packages installation and script execution (to install libraries on the system).}
@li{@code{libraries} Sequence of strings, optional (default = empty). The name of Python libraries (through pip) that will be used by the script and need to be installed before (note: as detailed below, installations are only achieved during the first execution of the script, and then stored in a docker image in cache. To force an update, use the @i{forceUpdate} argument).}
@li{@code{forceUpdate} Boolean, optional (default = false). Should the libraries installation be forced (to ensure an update for example). If true, the task will perform the installation (and thus the update) even if the library was already installed.}
......
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