From 312c49a7478d4c1d890b7c652aa9fa264fb15b55 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 18 Apr 2024 01:34:49 +0000 Subject: [PATCH] build based on 9deb262 --- dev/.documenter-siteinfo.json | 2 +- dev/generated/polynomial_inversion/index.html | 2 +- dev/generated/sine/index.html | 2 +- dev/index.html | 2 +- dev/search_index.js | 2 +- dev/tutorials/making-a-new-release-of-dace_jll/index.html | 4 ++-- .../modifying-the-cxx-side-of-the-interface/index.html | 2 +- .../setting-up-your-development-environment/index.html | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 8ca6346..426f65c 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-18T01:32:06","documenter_version":"1.4.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-18T01:34:46","documenter_version":"1.4.0"}} \ No newline at end of file diff --git a/dev/generated/polynomial_inversion/index.html b/dev/generated/polynomial_inversion/index.html index ce9bc66..fe2749e 100644 --- a/dev/generated/polynomial_inversion/index.html +++ b/dev/generated/polynomial_inversion/index.html @@ -45,4 +45,4 @@ 5 3.0381944444444586e-02 9 9 ------------------------------------------------ -

This page was generated using Literate.jl.

+

This page was generated using Literate.jl.

diff --git a/dev/generated/sine/index.html b/dev/generated/sine/index.html index 6c3e797..3c4492f 100644 --- a/dev/generated/sine/index.html +++ b/dev/generated/sine/index.html @@ -38,4 +38,4 @@

Evaluate y at 1.0 and compare with the builtin sin function.

println("  y(1.0) = $(DACE.evalScalar(y, 1.0))")
 println("sin(1.0) = $(sin(1.0))")
  y(1.0) = 0.8414709848078965
 sin(1.0) = 0.8414709848078965
-

This page was generated using Literate.jl.

+

This page was generated using Literate.jl.

diff --git a/dev/index.html b/dev/index.html index d832658..1960da7 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · DACE.jl

DACE.jl

Warning

This package is still in development, is not complete and instructions may change significantly

This is the documentation page for DACE.jl, a Julia interface to the DACE library.

Getting started

DACE.jl can be installed using the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run

pkg> add https://github.com/a-ev/DACE.jl.git

Note: the add command above may not be needed if you are running from main directory of the repository.

Notes about the interface

  • The Julia interface is built using CxxWrap.jl
  • The C++ source for the interface is currently in this fork of the DACE library
  • The C++ code gets built by BinaryBuilder and released into the Julia registry
    • the build recipe is located here
  • The Julia component of the interface is currently here

The above may change, in particular we hope to:

  • merge the forked DACE library back to upstream, if possible
  • move the DACE.jl package under the dacelib organisation on GitHub, if possible

Differences compared to the C++ interface

DA constructor

The DA constructor is different in the Julia interface compared to C++. In C++ if you create a DA object with a single argument the behaviour is different depending on whether the argument is an integer or double. For example, in C++:

  • DA(1) creates a DA object representing 1.0 times the independent variable number 1
  • DA(1.0) creates a DA object with the constant part equal to 1.0
  • DA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1 (same as first bullet point above)

In Julia with CxxWrap, there is an issue detecting the difference between integer and double when passing a single value on Windows, resulting in huge numbers of warnings being printed to screen. Therefore, in the Julia interface we have:

  • DA(1) and DA(1.0) both create a DA object with the constant part equal to 1.0
  • DA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1
+Home · DACE.jl

DACE.jl

Warning

This package is still in development, is not complete and instructions may change significantly

This is the documentation page for DACE.jl, a Julia interface to the DACE library.

Getting started

DACE.jl can be installed using the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run

pkg> add https://github.com/a-ev/DACE.jl.git

Note: the add command above may not be needed if you are running from main directory of the repository.

Notes about the interface

  • The Julia interface is built using CxxWrap.jl
  • The C++ source for the interface is currently in this fork of the DACE library
  • The C++ code gets built by BinaryBuilder and released into the Julia registry
    • the build recipe is located here
  • The Julia component of the interface is currently here

The above may change, in particular we hope to:

  • merge the forked DACE library back to upstream, if possible
  • move the DACE.jl package under the dacelib organisation on GitHub, if possible

Differences compared to the C++ interface

DA constructor

The DA constructor is different in the Julia interface compared to C++. In C++ if you create a DA object with a single argument the behaviour is different depending on whether the argument is an integer or double. For example, in C++:

  • DA(1) creates a DA object representing 1.0 times the independent variable number 1
  • DA(1.0) creates a DA object with the constant part equal to 1.0
  • DA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1 (same as first bullet point above)

In Julia with CxxWrap, there is an issue detecting the difference between integer and double when passing a single value on Windows, resulting in huge numbers of warnings being printed to screen. Therefore, in the Julia interface we have:

  • DA(1) and DA(1.0) both create a DA object with the constant part equal to 1.0
  • DA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1
diff --git a/dev/search_index.js b/dev/search_index.js index 93b2325..ee30b65 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"EditURL = \"../../../examples/polynomial_inversion.jl\"","category":"page"},{"location":"generated/polynomial_inversion/#Polynomial-inversion","page":"Polynomial inversion","title":"Polynomial inversion","text":"","category":"section"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"This is a DACE example showing polynomial inversion, demonstrating:","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"How to load DACE.jl\nHow to initialise the DACE library\nHow to create a DA object\nHow to create an AlgebraicVector\nHow to invert a Taylor polynomial","category":"page"},{"location":"generated/polynomial_inversion/#Install-dependencies","page":"Polynomial inversion","title":"Install dependencies","text":"","category":"section"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Make sure the required packages are installed","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"using Pkg\nPkg.add(\"https://github.com/a-ev/DACE.jl.git\")","category":"page"},{"location":"generated/polynomial_inversion/#Using-DACE","page":"Polynomial inversion","title":"Using DACE","text":"","category":"section"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Write","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"using DACE","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"to load DACE functions and objects into our script.","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Initialise DACE for 10th-order computations in 1 variable","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"DACE.init(10, 1)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Initialise x as a DA object","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"x = DACE.DA(1, 1)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Create y as AlgebraicVector of type DA and size 1","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"y = AlgebraicVector{DA}(1)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"1-element DACE.AlgebraicVectorAllocated{DA}:\n ALL COEFFICIENTS ZERO\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Store the Taylor expansion of sin(x) in the first element of y","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"y[1] = sin(x)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 -1.6666666666666666e-01 3 3\n 3 8.3333333333333332e-03 5 5\n 4 -1.9841269841269841e-04 7 7\n 5 2.7557319223985893e-06 9 9\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Invert the Taylor polynomial","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"inv_y = DACE.invert(y)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"1-element DACE.AlgebraicVectorAllocated{DA}:\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 1.6666666666666666e-01 3 3\n 3 7.4999999999999997e-02 5 5\n 4 4.4642857142857137e-02 7 7\n 5 3.0381944444444437e-02 9 9\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Finally compare the polynomial inversion of sin(x)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"println(\"polynomial inversion of sin(x)\")\nprintln(inv_y)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"polynomial inversion of sin(x)\n[[[ 1 vector\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 1.6666666666666666e-01 3 3\n 3 7.4999999999999997e-02 5 5\n 4 4.4642857142857137e-02 7 7\n 5 3.0381944444444437e-02 9 9\n------------------------------------------------\n\n]]]\n\n\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"with asin(x)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"println(\"asin(x)\")\nprintln(asin(x))","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"asin(x)\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 1.6666666666666669e-01 3 3\n 3 7.5000000000000067e-02 5 5\n 4 4.4642857142857206e-02 7 7\n 5 3.0381944444444586e-02 9 9\n------------------------------------------------\n\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Modifying-the-C-side-of-the-interface","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"This tutorial will give a brief explanation of the C++ side of the DACE Julia interface, which will hopefully allow you to make changes and add new functionality to the interface.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Note that there are two sides to the interface:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"the C++ side of the interface, which exists in the DACE C++ source code\nthe Julia side of the interface, which exists in the DACE.jl Julia package","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"The Julia interface on the C++ side is created using CxxWrap.jl, which is documented in the README.md file in their git repo.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"note: Note\nIt is assumed that you have successfully followed the tutorial to set up your development environment. It is also assumed that you will refer to the CxxWrap.jl documentation.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Switch-to-your-dace-directory","page":"Modifying the C++ side of the interface","title":"Switch to your dace directory","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Switch to your dace directory that you set up during the setting up your development environment tutorial","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"cd /path/to/dace","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Inside that directory you should see a sub-directory called build which is where we have compiled the DACE C++ library. You should also see an interfaces directory. Switch into the interfaces/julia directory","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"cd interfaces/julia","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Inside this directory you will see the file dace_julia.cxx, which contains the source code for the Julia interface.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Defining-the-Julia-module","page":"Modifying the C++ side of the interface","title":"Defining the Julia module","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"In dace_julia.cxx you will see","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"JLCXX_MODULE define_julia_module(jlcxx::module& mod) {\n // code omitted here\n}","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"All the methods and types defined within the define_julia_module function using mod will belong to the generated Julia module when we load it in the DACE.jl package.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Refer also to the CxxWrap.jl module entry point documentation.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-DA-static-methods","page":"Modifying the C++ side of the interface","title":"Adding DA static methods","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"In the first section of the define_julia_module function we add some DA static methods:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"// add DA static methods separately\nmod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) {\n DA::init(ord, nvar);\n });\nmod.method(\"getMaxOrder\", []()->int64_t { return DA::getMaxOrder(); });\nmod.method(\"getMaxVariables\", []()->int64_t { return DA::getMaxVariables(); });\nmod.method(\"getMaxMonomials\", []()->int64_t { return DA::getMaxMonomials(); });\nmod.method(\"setEps\", [](const double eps) { return DA::setEps(eps); });\nmod.method(\"getEps\", []() { return DA::getEps(); });\nmod.method(\"getEpsMac\", []() { return DA::getEpsMac(); });\nmod.method(\"setTO\", [](const unsigned int ot) { return DA::setTO(ot); });\nmod.method(\"getTO\", []() { return DA::getTO(); });\nmod.method(\"pushTO\", [](const unsigned int ot) { DA::pushTO(ot); });\nmod.method(\"popTO\", []() { DA::popTO(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Here mod is the Julia module and when we call mod.method we are adding a new method (function) to the Julia module.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Take the init function for example:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) { DA::init(ord, nvar); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"The first argument to mod.method is the name of the function as it should appear in the Julia module that we are creating, in this case the new function will be named init.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"The second argument to mod.method is the C++ function that should be called when some calls the init function in the Julia module that we are creating. In this case we are using a C++ lambda function but you could pass a normal C++ function also. The lambda function, denoted by the [], takes two arguments, ord and nvar (the order and number of variables) and runs the code within the curly braces, DA::init(ord, nvar);, i.e. it calls the DA static method init with the two arguments that were passed in from Julia.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"You can return values back to Julia and CxxWrap.jl can automatically infer the type of the return value, such as:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"getEps\", []() { return DA::getEps(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"is a lambda function ([]) that takes no arguments (()) and returns the epsilon value return DA::getEps(); and automatically converts the C++ return type to a Julia type.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"It is also possible to specify the return type, which we have done in some cases to avoid compiler warnings, e.g. we specify the return type of getMaxOrder to be of type int64_t here:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"getMaxOrder\", []()->int64_t { return DA::getMaxOrder(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-the-DA-type","page":"Modifying the C++ side of the interface","title":"Adding the DA type","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Refer to the CxxWrap.jl documentation about exposing C++ classes.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"C++ classes are exposed to Julia using mod.add_type<>(), for example we expose the DA class with:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"// add the DA object\nmod.add_type(\"DA\", jlcxx::julia_type(\"Real\", \"Base\"))","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Here the template parameter, , is the C++ class to expose, the first argument \"DA\" is the name of corresponding type to create in Julia and the optional second argument can be used to specify which type the new type should inherit from. In this case the Julia DA type will inherit from the Julia Real type (jlcxx::julia_type(\"Real\", \"Base\")).","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Different constructors for the new type can be added, here we define three constructors:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.add_type(\"DA\", jlcxx::julia_type(\"Real\", \"Base\"))\n .constructor<>()\n .constructor()\n .constructor()","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":".constructor<>(): the default constructor that takes no arguments\n.constructor(): the DA constructor that takes and integer and double","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"CxxWrap will automatically call the correct C++ constructor that matches the arguments in the template parameters.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-methods-to-the-DA-type","page":"Modifying the C++ side of the interface","title":"Adding methods to the DA type","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Methods can be chained onto the mod.add_type or defined separately. An example of chaining a method is:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.add_type(\"DA\", jlcxx::julia_type(\"Real\", \"Base\"))\n .constructor<>()\n .constructor()\n .constructor()\n .method(\"toString\", &DA::toString);","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"After the three constructors we also add DA::toString as a method in the Julia module named toString. CxxWrap will automatically make the first argument of the method a DA type because we have chained it onto the mod.add_type().","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"We can also directly add DA methods using:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"gamma\", [](const DA& da) { return da.GammaFunction(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"which creates a \"gamma\" Julia method that is called with a DA as the first argument and returns the result of calling the C++ DA member function da.GammaFunction().","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-methods-to-another-module","page":"Modifying the C++ side of the interface","title":"Adding methods to another module","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"So far, whenever we use mod.method or mod.add_type it adds the methods and types to our new Julia module. We can add methods to another module, such as the Julia Base module, using","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.set_override_module(jl_base_module);\n\n// all methods here are added to the base module\nmod.method(\"+\", [](const DA& da1, const DA& da2) { return da1 + da2; });\nmod.method(\"+\", [](const DA& da, const double c) { return da + c; });\nmod.method(\"+\", [](const double c, const DA& da) { return c + da; });\n\n// until we call this, then subsequent calls to mod.method will add methods to our module again\nmod.unset_override_module();","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Setting-up-your-development-environment","page":"Setting up your development environment","title":"Setting up your development environment","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"warning: Warning\nThese instructions will change when DACE_jll is released as a package.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"This tutorial will run through setting up DACE_jll.jl, DACE.jl and the DACE C++ library for development locally. It has been tested on Linux.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"After running this tutorial, you should be able to make changes to the C++ code that defines the DACE Julia interface, compile those changes and test them via the DACE.jl Julia package locally.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"This is based on the upstream binary builder documention for how to develop locally:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"https://docs.binarybuilder.org/stable/building/#Building-and-testing-JLL-packages-locally\nhttps://docs.binarybuilder.org/stable/jll/#Overriding-the-artifacts-in-JLL-packages","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"and also CxxWrap documentation:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"https://github.com/JuliaInterop/CxxWrap.jl\nhttps://github.com/JuliaInterop/libcxxwrap-julia","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Clone-repos","page":"Setting up your development environment","title":"Clone repos","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Create and change to a new directory that we can clone the DACE code into. Then run the following:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"DACE.jl Julia package\ngit clone https://github.com/a-ev/DACE.jl.git\nDACE C++ library (note specific branch required)\ngit clone --branch julia-interface https://github.com/a-ev/dace.git","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Switch to the DACE.jl directory you just cloned:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd DACE.jl","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Setup-DACE_jll.jl-for-development","page":"Setting up your development environment","title":"Setup DACE_jll.jl for development","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Run julia --project to enter the Julia REPL and enter ] to enter the Pkg REPL mode, then","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"(DACE) pkg> add DACE_jll\n(DACE) pkg> develop DACE_jll","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"After running the above, press backspace to return to the Julia REPL and run","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using DACE_jll\njulia> DACE_jll.dev_jll()","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"At the end of the above command it will print a location of the override directory, e.g.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"...\n[ Info: DACE_jll dev'ed out to /home//.julia/dev/DACE_jll with pre-populated override directory","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"The directory /home//.julia/dev/DACE_jll/override contains the dace shared libraries and headers in lib and includes directories. We can delete the contents of this directory and replace it with our own version that we build locally.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Don't just copy this command, make sure the path corresponds to the path in your output above.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"rm -rf /home//.julia/dev/DACE_jll/override/*","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Build-the-DACE-C-library","page":"Setting up your development environment","title":"Build the DACE C++ library","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"We should still be in the DACE.jl directory from above. Now find the CxxWrap prefix path by entering the Julia REPL (julia --project) and running","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using CxxWrap\njulia> CxxWrap.prefix_path()","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"which should return a path like","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"\"/home//.julia/artifacts/fb412eee87eae845b84a799f0cabf241142406d7\"","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"with a different ID at the end. We will use this path in the CMake command later.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now switch to the dace directory we cloned earlier (it should be alongside the DACE.jl directory we are currently working in):","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../dace","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Make a build directory and switch to it:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mkdir build\ncd build","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now run the cmake command to configure DACE (make sure to replace the first two paths with the paths you found above):","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cmake .. \\\n -DCMAKE_INSTALL_PREFIX=/home//.julia/dev/DACE_jll/override \\\n -DCMAKE_PREFIX_PATH=/home//.julia/artifacts/fb412eee87eae845b84a799f0cabf241142406d7 \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DWITH_PTHREAD=ON \\\n -DWITH_ALGEBRAICMATRIX=ON \\\n -DCMAKE_CXX_STANDARD=17 \\\n -DWITH_JULIA=ON","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"and then build and install DACE with:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"VERBOSE=ON cmake --build . --config Release --target install -- -j${nproc}","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Verify-the-DACE-module-is-working","page":"Setting up your development environment","title":"Verify the DACE module is working","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Switch back to the DACE.jl directory. If you are still in the build directory from above run:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../../DACE.jl","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Enter the Julia REPL with julia --project and run","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using DACE\njulia> DACE.init(10, 1)\njulia> ?DACE.DA","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"which should show some help about the DACE.DA type.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Make-a-change-to-the-local-DACE-library","page":"Setting up your development environment","title":"Make a change to the local DACE library","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now we will make a change to the local C++ source code and verify that the change is loaded in the Julia library.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Switch back to the dace/build directory","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../dace/build","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Edit the interface file ../interfaces/julia/dace_julia.cxx using an editor such as vim or nano.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Locate the DACE.init function, it should be near the top and look like","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) {\n DA::init(ord, nvar);\n });","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"For reference,","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mod.method adds a function to the Julia module\n\"init\" is the name of the function that is being added\n[](const unsigned int ord, const unsigned int nvar) denotes a C++ lambda function that runs when the function is called from Julia and takes two unsigned integer arguments\nthe lambda function body passes those two arguments to the DA::init routine, which is defined in the DACE C++ library","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"We will modify this method to add a print statement, such as","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) {\n std::cout << \"initialising local version of DACE library...\" << std::endl;\n DA::init(ord, nvar);\n });","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"so that we can tell the local version has been loaded. Make the above change then save the file.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"We should be in the build directory still. Execute the following command to build and install your change:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"VERBOSE=ON cmake --build . --config Release --target install -- -j${nproc}","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now change back to the DACE.jl directory","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../../DACE.jl","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Once again, enter the Julia REPL with julia --project and run the DACE.init function we ran above:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using DACE\njulia> DACE.init(10, 1)","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"This time it should print out the string we just added (initialising local version of DACE library...).","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"EditURL = \"../../../examples/sine.jl\"","category":"page"},{"location":"generated/sine/#Sine-example","page":"Sine function","title":"Sine example","text":"","category":"section"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"This is a simple DACE example using the sine function, which demonstrates:","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"How to load DACE.jl\nHow to initialise the DACE library\nHow to create a DA object\nHow to compute the sine of a DA object\nHow to print a DA object to screen\nHow to evaluate a DA object","category":"page"},{"location":"generated/sine/#Install-dependencies","page":"Sine function","title":"Install dependencies","text":"","category":"section"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Make sure the required packages are installed","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"using Pkg\nPkg.add(\"https://github.com/a-ev/DACE.jl.git\")","category":"page"},{"location":"generated/sine/#Using-DACE","page":"Sine function","title":"Using DACE","text":"","category":"section"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Write","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"using DACE","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"to load DACE functions and objects into our script.","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Initialise DACE for 20th-order computations in 1 variable","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"DACE.init(20, 1)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Initialise x as a DA object","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"x = DACE.DA(1, 1)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n------------------------------------------------\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Initialise y as the Taylor expansion of sin(x)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"y = sin(x)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 -1.6666666666666666e-01 3 3\n 3 8.3333333333333332e-03 5 5\n 4 -1.9841269841269841e-04 7 7\n 5 2.7557319223985893e-06 9 9\n 6 -2.5052108385441720e-08 11 11\n 7 1.6059043836821616e-10 13 13\n 8 -7.6471637318198174e-13 15 15\n 9 2.8114572543455210e-15 17 17\n 10 -8.2206352466243310e-18 19 19\n------------------------------------------------\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Print x and y to screen","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"println(\"x\")\nprint(x)\nprintln(\"y = sin(x)\")\nprint(y)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"x\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n------------------------------------------------\ny = sin(x)\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 -1.6666666666666666e-01 3 3\n 3 8.3333333333333332e-03 5 5\n 4 -1.9841269841269841e-04 7 7\n 5 2.7557319223985893e-06 9 9\n 6 -2.5052108385441720e-08 11 11\n 7 1.6059043836821616e-10 13 13\n 8 -7.6471637318198174e-13 15 15\n 9 2.8114572543455210e-15 17 17\n 10 -8.2206352466243310e-18 19 19\n------------------------------------------------\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Evaluate y at 1.0 and compare with the builtin sin function.","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"println(\" y(1.0) = $(DACE.evalScalar(y, 1.0))\")\nprintln(\"sin(1.0) = $(sin(1.0))\")","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":" y(1.0) = 0.8414709848078965\nsin(1.0) = 0.8414709848078965\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/#Making-a-new-release-of-DACE_jll","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"","category":"section"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"The DACE_jll Julia package contains the prebuilt DACE library (prebuilt for all combinations of platforms, Julia versions, etc. that Julia is supported on). BinaryBuilder.jl is used to build the libraries and publish them to the Julia registry.","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"The recipe for building the DACE library can be found on Yggdrasil in the D/DACE directory.","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"To make a new release of the DACE_jll package you can follow these steps:","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"Make your changes in the dace repo and test them (see setting up your development environment for help getting started with this step)\nCommit your changes into the dace repo and make a note of the unique commit hash that identifies the commit you want to release (this can be found using git log or via the commits view in the GitHub interface)\nOn GitHub, make a fork of the Yggdrasil repository, clone that locally and create a branch for your changes\n# fork in the github web interface, then...\n\n# clone the repo (replace with the correct URL for your fork)\ngit clone git@github.com:/Yggdrasil.git\n\n# change directory into the repo\ncd Yggdrasil\n\n# switch to a new branch\ngit checkout -b update-dace\n\n# switch to the D/DACE directory\ncd D/DACE\nEdit the build_tarballs.jl file:\nbump the version of the release on or around line 11:\nversion = v\"0.1.0\"\nnote: Note\nIt is highly recommended to follow semantic versioning\nchange the commit hash (on or around line 15) that the new version will be based of to the hash of the commit you identified in step 2\nGitSource(\"https://github.com/a-ev/dace.git\", \"9fe534f9b27c147a171bce1ad7dc8b4706a9457e\"),\nwhere 9fe534f9b27c147a171bce1ad7dc8b4706a9457e is the commit hash\nCheck the version of libcxxwrapjuliajll which is linked to the version of CxxWrap.jl. When bumping the version of the CxxWrap dependency in the DACE.jl package you may also need to bump the version of libcxxwrapjuliajll on or around line 55:\nDependency(\"libcxxwrap_julia_jll\"; compat = \"~0.12.2\"),\nimportant: Important\nMake sure the version of libcxxwrapjuliajll is compatible with the version of CxxWrap,jl in your Project.toml for DACE.jl\nCommit and push your changes into your fork of Yggdrasil:\ngit add build_tarballs.jl\ngit commit -m \"[DACE] bump version\"\ngit push\nYou may need to set the upstream of your repo for git push to work. The above commands are just examples and may need tweaking.\nCreate a pull request back to the main Yggdrasil repo. The builds will run automatically and you can view their status in the pull request. If they all succeed someone will merge them automatically (you don't need to do anything else)","category":"page"},{"location":"#DACE.jl","page":"Home","title":"DACE.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"warning: Warning\nThis package is still in development, is not complete and instructions may change significantly","category":"page"},{"location":"","page":"Home","title":"Home","text":"This is the documentation page for DACE.jl, a Julia interface to the DACE library.","category":"page"},{"location":"#Getting-started","page":"Home","title":"Getting started","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"DACE.jl can be installed using the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run","category":"page"},{"location":"","page":"Home","title":"Home","text":"pkg> add https://github.com/a-ev/DACE.jl.git","category":"page"},{"location":"","page":"Home","title":"Home","text":"Note: the add command above may not be needed if you are running from main directory of the repository.","category":"page"},{"location":"#Notes-about-the-interface","page":"Home","title":"Notes about the interface","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The Julia interface is built using CxxWrap.jl\nThe C++ source for the interface is currently in this fork of the DACE library\nThe C++ code gets built by BinaryBuilder and released into the Julia registry\nthe build recipe is located here\nThe Julia component of the interface is currently here","category":"page"},{"location":"","page":"Home","title":"Home","text":"The above may change, in particular we hope to:","category":"page"},{"location":"","page":"Home","title":"Home","text":"merge the forked DACE library back to upstream, if possible\nmove the DACE.jl package under the dacelib organisation on GitHub, if possible","category":"page"},{"location":"#Differences-compared-to-the-C-interface","page":"Home","title":"Differences compared to the C++ interface","text":"","category":"section"},{"location":"#DA-constructor","page":"Home","title":"DA constructor","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The DA constructor is different in the Julia interface compared to C++. In C++ if you create a DA object with a single argument the behaviour is different depending on whether the argument is an integer or double. For example, in C++:","category":"page"},{"location":"","page":"Home","title":"Home","text":"DA(1) creates a DA object representing 1.0 times the independent variable number 1\nDA(1.0) creates a DA object with the constant part equal to 1.0\nDA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1 (same as first bullet point above)","category":"page"},{"location":"","page":"Home","title":"Home","text":"In Julia with CxxWrap, there is an issue detecting the difference between integer and double when passing a single value on Windows, resulting in huge numbers of warnings being printed to screen. Therefore, in the Julia interface we have:","category":"page"},{"location":"","page":"Home","title":"Home","text":"DA(1) and DA(1.0) both create a DA object with the constant part equal to 1.0\nDA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1","category":"page"}] +[{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"EditURL = \"../../../examples/polynomial_inversion.jl\"","category":"page"},{"location":"generated/polynomial_inversion/#Polynomial-inversion","page":"Polynomial inversion","title":"Polynomial inversion","text":"","category":"section"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"This is a DACE example showing polynomial inversion, demonstrating:","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"How to load DACE.jl\nHow to initialise the DACE library\nHow to create a DA object\nHow to create an AlgebraicVector\nHow to invert a Taylor polynomial","category":"page"},{"location":"generated/polynomial_inversion/#Install-dependencies","page":"Polynomial inversion","title":"Install dependencies","text":"","category":"section"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Make sure the required packages are installed","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"using Pkg\nPkg.add(\"https://github.com/a-ev/DACE.jl.git\")","category":"page"},{"location":"generated/polynomial_inversion/#Using-DACE","page":"Polynomial inversion","title":"Using DACE","text":"","category":"section"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Write","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"using DACE","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"to load DACE functions and objects into our script.","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Initialise DACE for 10th-order computations in 1 variable","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"DACE.init(10, 1)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Initialise x as a DA object","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"x = DACE.DA(1, 1)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Create y as AlgebraicVector of type DA and size 1","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"y = AlgebraicVector{DA}(1)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"1-element DACE.AlgebraicVectorAllocated{DA}:\n ALL COEFFICIENTS ZERO\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Store the Taylor expansion of sin(x) in the first element of y","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"y[1] = sin(x)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 -1.6666666666666666e-01 3 3\n 3 8.3333333333333332e-03 5 5\n 4 -1.9841269841269841e-04 7 7\n 5 2.7557319223985893e-06 9 9\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Invert the Taylor polynomial","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"inv_y = DACE.invert(y)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"1-element DACE.AlgebraicVectorAllocated{DA}:\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 1.6666666666666666e-01 3 3\n 3 7.4999999999999997e-02 5 5\n 4 4.4642857142857137e-02 7 7\n 5 3.0381944444444437e-02 9 9\n------------------------------------------------\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"Finally compare the polynomial inversion of sin(x)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"println(\"polynomial inversion of sin(x)\")\nprintln(inv_y)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"polynomial inversion of sin(x)\n[[[ 1 vector\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 1.6666666666666666e-01 3 3\n 3 7.4999999999999997e-02 5 5\n 4 4.4642857142857137e-02 7 7\n 5 3.0381944444444437e-02 9 9\n------------------------------------------------\n\n]]]\n\n\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"with asin(x)","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"println(\"asin(x)\")\nprintln(asin(x))","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"asin(x)\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 1.6666666666666669e-01 3 3\n 3 7.5000000000000067e-02 5 5\n 4 4.4642857142857206e-02 7 7\n 5 3.0381944444444586e-02 9 9\n------------------------------------------------\n\n","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"","category":"page"},{"location":"generated/polynomial_inversion/","page":"Polynomial inversion","title":"Polynomial inversion","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Modifying-the-C-side-of-the-interface","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"This tutorial will give a brief explanation of the C++ side of the DACE Julia interface, which will hopefully allow you to make changes and add new functionality to the interface.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Note that there are two sides to the interface:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"the C++ side of the interface, which exists in the DACE C++ source code\nthe Julia side of the interface, which exists in the DACE.jl Julia package","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"The Julia interface on the C++ side is created using CxxWrap.jl, which is documented in the README.md file in their git repo.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"note: Note\nIt is assumed that you have successfully followed the tutorial to set up your development environment. It is also assumed that you will refer to the CxxWrap.jl documentation.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Switch-to-your-dace-directory","page":"Modifying the C++ side of the interface","title":"Switch to your dace directory","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Switch to your dace directory that you set up during the setting up your development environment tutorial","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"cd /path/to/dace","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Inside that directory you should see a sub-directory called build which is where we have compiled the DACE C++ library. You should also see an interfaces directory. Switch into the interfaces/julia directory","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"cd interfaces/julia","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Inside this directory you will see the file dace_julia.cxx, which contains the source code for the Julia interface.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Defining-the-Julia-module","page":"Modifying the C++ side of the interface","title":"Defining the Julia module","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"In dace_julia.cxx you will see","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"JLCXX_MODULE define_julia_module(jlcxx::module& mod) {\n // code omitted here\n}","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"All the methods and types defined within the define_julia_module function using mod will belong to the generated Julia module when we load it in the DACE.jl package.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Refer also to the CxxWrap.jl module entry point documentation.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-DA-static-methods","page":"Modifying the C++ side of the interface","title":"Adding DA static methods","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"In the first section of the define_julia_module function we add some DA static methods:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"// add DA static methods separately\nmod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) {\n DA::init(ord, nvar);\n });\nmod.method(\"getMaxOrder\", []()->int64_t { return DA::getMaxOrder(); });\nmod.method(\"getMaxVariables\", []()->int64_t { return DA::getMaxVariables(); });\nmod.method(\"getMaxMonomials\", []()->int64_t { return DA::getMaxMonomials(); });\nmod.method(\"setEps\", [](const double eps) { return DA::setEps(eps); });\nmod.method(\"getEps\", []() { return DA::getEps(); });\nmod.method(\"getEpsMac\", []() { return DA::getEpsMac(); });\nmod.method(\"setTO\", [](const unsigned int ot) { return DA::setTO(ot); });\nmod.method(\"getTO\", []() { return DA::getTO(); });\nmod.method(\"pushTO\", [](const unsigned int ot) { DA::pushTO(ot); });\nmod.method(\"popTO\", []() { DA::popTO(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Here mod is the Julia module and when we call mod.method we are adding a new method (function) to the Julia module.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Take the init function for example:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) { DA::init(ord, nvar); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"The first argument to mod.method is the name of the function as it should appear in the Julia module that we are creating, in this case the new function will be named init.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"The second argument to mod.method is the C++ function that should be called when some calls the init function in the Julia module that we are creating. In this case we are using a C++ lambda function but you could pass a normal C++ function also. The lambda function, denoted by the [], takes two arguments, ord and nvar (the order and number of variables) and runs the code within the curly braces, DA::init(ord, nvar);, i.e. it calls the DA static method init with the two arguments that were passed in from Julia.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"You can return values back to Julia and CxxWrap.jl can automatically infer the type of the return value, such as:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"getEps\", []() { return DA::getEps(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"is a lambda function ([]) that takes no arguments (()) and returns the epsilon value return DA::getEps(); and automatically converts the C++ return type to a Julia type.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"It is also possible to specify the return type, which we have done in some cases to avoid compiler warnings, e.g. we specify the return type of getMaxOrder to be of type int64_t here:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"getMaxOrder\", []()->int64_t { return DA::getMaxOrder(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-the-DA-type","page":"Modifying the C++ side of the interface","title":"Adding the DA type","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Refer to the CxxWrap.jl documentation about exposing C++ classes.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"C++ classes are exposed to Julia using mod.add_type<>(), for example we expose the DA class with:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"// add the DA object\nmod.add_type(\"DA\", jlcxx::julia_type(\"Real\", \"Base\"))","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Here the template parameter, , is the C++ class to expose, the first argument \"DA\" is the name of corresponding type to create in Julia and the optional second argument can be used to specify which type the new type should inherit from. In this case the Julia DA type will inherit from the Julia Real type (jlcxx::julia_type(\"Real\", \"Base\")).","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Different constructors for the new type can be added, here we define three constructors:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.add_type(\"DA\", jlcxx::julia_type(\"Real\", \"Base\"))\n .constructor<>()\n .constructor()\n .constructor()","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":".constructor<>(): the default constructor that takes no arguments\n.constructor(): the DA constructor that takes and integer and double","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"CxxWrap will automatically call the correct C++ constructor that matches the arguments in the template parameters.","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-methods-to-the-DA-type","page":"Modifying the C++ side of the interface","title":"Adding methods to the DA type","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"Methods can be chained onto the mod.add_type or defined separately. An example of chaining a method is:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.add_type(\"DA\", jlcxx::julia_type(\"Real\", \"Base\"))\n .constructor<>()\n .constructor()\n .constructor()\n .method(\"toString\", &DA::toString);","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"After the three constructors we also add DA::toString as a method in the Julia module named toString. CxxWrap will automatically make the first argument of the method a DA type because we have chained it onto the mod.add_type().","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"We can also directly add DA methods using:","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.method(\"gamma\", [](const DA& da) { return da.GammaFunction(); });","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"which creates a \"gamma\" Julia method that is called with a DA as the first argument and returns the result of calling the C++ DA member function da.GammaFunction().","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/#Adding-methods-to-another-module","page":"Modifying the C++ side of the interface","title":"Adding methods to another module","text":"","category":"section"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"So far, whenever we use mod.method or mod.add_type it adds the methods and types to our new Julia module. We can add methods to another module, such as the Julia Base module, using","category":"page"},{"location":"tutorials/modifying-the-cxx-side-of-the-interface/","page":"Modifying the C++ side of the interface","title":"Modifying the C++ side of the interface","text":"mod.set_override_module(jl_base_module);\n\n// all methods here are added to the base module\nmod.method(\"+\", [](const DA& da1, const DA& da2) { return da1 + da2; });\nmod.method(\"+\", [](const DA& da, const double c) { return da + c; });\nmod.method(\"+\", [](const double c, const DA& da) { return c + da; });\n\n// until we call this, then subsequent calls to mod.method will add methods to our module again\nmod.unset_override_module();","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Setting-up-your-development-environment","page":"Setting up your development environment","title":"Setting up your development environment","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"warning: Warning\nThese instructions will change when DACE_jll is released as a package.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"This tutorial will run through setting up DACE_jll.jl, DACE.jl and the DACE C++ library for development locally. It has been tested on Linux.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"After running this tutorial, you should be able to make changes to the C++ code that defines the DACE Julia interface, compile those changes and test them via the DACE.jl Julia package locally.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"This is based on the upstream binary builder documention for how to develop locally:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"https://docs.binarybuilder.org/stable/building/#Building-and-testing-JLL-packages-locally\nhttps://docs.binarybuilder.org/stable/jll/#Overriding-the-artifacts-in-JLL-packages","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"and also CxxWrap documentation:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"https://github.com/JuliaInterop/CxxWrap.jl\nhttps://github.com/JuliaInterop/libcxxwrap-julia","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Clone-repos","page":"Setting up your development environment","title":"Clone repos","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Create and change to a new directory that we can clone the DACE code into. Then run the following:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"DACE.jl Julia package\ngit clone https://github.com/a-ev/DACE.jl.git\nDACE C++ library (note specific branch required)\ngit clone --branch julia-interface https://github.com/a-ev/dace.git","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Switch to the DACE.jl directory you just cloned:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd DACE.jl","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Setup-DACE_jll.jl-for-development","page":"Setting up your development environment","title":"Setup DACE_jll.jl for development","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Run julia --project to enter the Julia REPL and enter ] to enter the Pkg REPL mode, then","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"(DACE) pkg> add DACE_jll\n(DACE) pkg> develop DACE_jll","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"After running the above, press backspace to return to the Julia REPL and run","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using DACE_jll\njulia> DACE_jll.dev_jll()","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"At the end of the above command it will print a location of the override directory, e.g.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"...\n[ Info: DACE_jll dev'ed out to /home//.julia/dev/DACE_jll with pre-populated override directory","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"The directory /home//.julia/dev/DACE_jll/override contains the dace shared libraries and headers in lib and includes directories. We can delete the contents of this directory and replace it with our own version that we build locally.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Don't just copy this command, make sure the path corresponds to the path in your output above.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"rm -rf /home//.julia/dev/DACE_jll/override/*","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Build-the-DACE-C-library","page":"Setting up your development environment","title":"Build the DACE C++ library","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"We should still be in the DACE.jl directory from above. Now find the CxxWrap prefix path by entering the Julia REPL (julia --project) and running","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using CxxWrap\njulia> CxxWrap.prefix_path()","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"which should return a path like","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"\"/home//.julia/artifacts/fb412eee87eae845b84a799f0cabf241142406d7\"","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"with a different ID at the end. We will use this path in the CMake command later.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now switch to the dace directory we cloned earlier (it should be alongside the DACE.jl directory we are currently working in):","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../dace","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Make a build directory and switch to it:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mkdir build\ncd build","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now run the cmake command to configure DACE (make sure to replace the first two paths with the paths you found above):","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cmake .. \\\n -DCMAKE_INSTALL_PREFIX=/home//.julia/dev/DACE_jll/override \\\n -DCMAKE_PREFIX_PATH=/home//.julia/artifacts/fb412eee87eae845b84a799f0cabf241142406d7 \\\n -DCMAKE_BUILD_TYPE=Release \\\n -DWITH_PTHREAD=ON \\\n -DWITH_ALGEBRAICMATRIX=ON \\\n -DCMAKE_CXX_STANDARD=17 \\\n -DWITH_JULIA=ON","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"and then build and install DACE with:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"VERBOSE=ON cmake --build . --config Release --target install -- -j${nproc}","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Verify-the-DACE-module-is-working","page":"Setting up your development environment","title":"Verify the DACE module is working","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Switch back to the DACE.jl directory. If you are still in the build directory from above run:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../../DACE.jl","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Enter the Julia REPL with julia --project and run","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using DACE\njulia> DACE.init(10, 1)\njulia> ?DACE.DA","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"which should show some help about the DACE.DA type.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/#Make-a-change-to-the-local-DACE-library","page":"Setting up your development environment","title":"Make a change to the local DACE library","text":"","category":"section"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now we will make a change to the local C++ source code and verify that the change is loaded in the Julia library.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Switch back to the dace/build directory","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../dace/build","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Edit the interface file ../interfaces/julia/dace_julia.cxx using an editor such as vim or nano.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Locate the DACE.init function, it should be near the top and look like","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) {\n DA::init(ord, nvar);\n });","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"For reference,","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mod.method adds a function to the Julia module\n\"init\" is the name of the function that is being added\n[](const unsigned int ord, const unsigned int nvar) denotes a C++ lambda function that runs when the function is called from Julia and takes two unsigned integer arguments\nthe lambda function body passes those two arguments to the DA::init routine, which is defined in the DACE C++ library","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"We will modify this method to add a print statement, such as","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"mod.method(\"init\", [](const unsigned int ord, const unsigned int nvar) {\n std::cout << \"initialising local version of DACE library...\" << std::endl;\n DA::init(ord, nvar);\n });","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"so that we can tell the local version has been loaded. Make the above change then save the file.","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"We should be in the build directory still. Execute the following command to build and install your change:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"VERBOSE=ON cmake --build . --config Release --target install -- -j${nproc}","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Now change back to the DACE.jl directory","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"cd ../../DACE.jl","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"Once again, enter the Julia REPL with julia --project and run the DACE.init function we ran above:","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"julia> using DACE\njulia> DACE.init(10, 1)","category":"page"},{"location":"tutorials/setting-up-your-development-environment/","page":"Setting up your development environment","title":"Setting up your development environment","text":"This time it should print out the string we just added (initialising local version of DACE library...).","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"EditURL = \"../../../examples/sine.jl\"","category":"page"},{"location":"generated/sine/#Sine-example","page":"Sine function","title":"Sine example","text":"","category":"section"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"This is a simple DACE example using the sine function, which demonstrates:","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"How to load DACE.jl\nHow to initialise the DACE library\nHow to create a DA object\nHow to compute the sine of a DA object\nHow to print a DA object to screen\nHow to evaluate a DA object","category":"page"},{"location":"generated/sine/#Install-dependencies","page":"Sine function","title":"Install dependencies","text":"","category":"section"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Make sure the required packages are installed","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"using Pkg\nPkg.add(\"https://github.com/a-ev/DACE.jl.git\")","category":"page"},{"location":"generated/sine/#Using-DACE","page":"Sine function","title":"Using DACE","text":"","category":"section"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Write","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"using DACE","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"to load DACE functions and objects into our script.","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Initialise DACE for 20th-order computations in 1 variable","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"DACE.init(20, 1)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Initialise x as a DA object","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"x = DACE.DA(1, 1)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n------------------------------------------------\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Initialise y as the Taylor expansion of sin(x)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"y = sin(x)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":" I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 -1.6666666666666666e-01 3 3\n 3 8.3333333333333332e-03 5 5\n 4 -1.9841269841269841e-04 7 7\n 5 2.7557319223985893e-06 9 9\n 6 -2.5052108385441720e-08 11 11\n 7 1.6059043836821616e-10 13 13\n 8 -7.6471637318198174e-13 15 15\n 9 2.8114572543455210e-15 17 17\n 10 -8.2206352466243310e-18 19 19\n------------------------------------------------\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Print x and y to screen","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"println(\"x\")\nprint(x)\nprintln(\"y = sin(x)\")\nprint(y)","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"x\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n------------------------------------------------\ny = sin(x)\n I COEFFICIENT ORDER EXPONENTS\n 1 1.0000000000000000e+00 1 1\n 2 -1.6666666666666666e-01 3 3\n 3 8.3333333333333332e-03 5 5\n 4 -1.9841269841269841e-04 7 7\n 5 2.7557319223985893e-06 9 9\n 6 -2.5052108385441720e-08 11 11\n 7 1.6059043836821616e-10 13 13\n 8 -7.6471637318198174e-13 15 15\n 9 2.8114572543455210e-15 17 17\n 10 -8.2206352466243310e-18 19 19\n------------------------------------------------\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"Evaluate y at 1.0 and compare with the builtin sin function.","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"println(\" y(1.0) = $(DACE.evalScalar(y, 1.0))\")\nprintln(\"sin(1.0) = $(sin(1.0))\")","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":" y(1.0) = 0.8414709848078965\nsin(1.0) = 0.8414709848078965\n","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"","category":"page"},{"location":"generated/sine/","page":"Sine function","title":"Sine function","text":"This page was generated using Literate.jl.","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/#Making-a-new-release-of-DACE_jll","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"","category":"section"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"The DACE_jll Julia package contains the prebuilt DACE library (prebuilt for all combinations of platforms, Julia versions, etc. that Julia is supported on). BinaryBuilder.jl is used to build the libraries and publish them to the Julia registry.","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"The recipe for building the DACE library can be found on Yggdrasil in the D/DACE directory.","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"To make a new release of the DACE_jll package you can follow these steps:","category":"page"},{"location":"tutorials/making-a-new-release-of-dace_jll/","page":"Making a new release of DACE_jll","title":"Making a new release of DACE_jll","text":"Make your changes in the dace repo and test them (see setting up your development environment for help getting started with this step)\nCommit your changes into the dace repo and make a note of the unique commit hash that identifies the commit you want to release (this can be found using git log or via the commits view in the GitHub interface)\nOn GitHub, make a fork of the Yggdrasil repository, clone that locally and create a branch for your changes\n# fork in the github web interface, then...\n\n# clone the repo (replace with the correct URL for your fork)\ngit clone git@github.com:/Yggdrasil.git\n\n# change directory into the repo\ncd Yggdrasil\n\n# switch to a new branch\ngit checkout -b update-dace\n\n# switch to the D/DACE directory\ncd D/DACE\nEdit the build_tarballs.jl file:\nbump the version of the release on or around line 11:\nversion = v\"0.1.0\"\nnote: Note\nIt is highly recommended to follow semantic versioning\nchange the commit hash (on or around line 15) that the new version will be based of to the hash of the commit you identified in step 2\nGitSource(\"https://github.com/a-ev/dace.git\", \"9fe534f9b27c147a171bce1ad7dc8b4706a9457e\"),\nwhere 9fe534f9b27c147a171bce1ad7dc8b4706a9457e is the commit hash\nCheck the version of libcxxwrap_julia_jll which is linked to the version of CxxWrap.jl. When bumping the version of the CxxWrap dependency in the DACE.jl package you may also need to bump the version of libcxxwrap_julia_jll on or around line 55:\nDependency(\"libcxxwrap_julia_jll\"; compat = \"~0.12.2\"),\nimportant: Important\nMake sure the version of libcxxwrap_julia_jll is compatible with the version of CxxWrap,jl in your Project.toml for DACE.jl\nCommit and push your changes into your fork of Yggdrasil:\ngit add build_tarballs.jl\ngit commit -m \"[DACE] bump version\"\ngit push\nYou may need to set the upstream of your repo for git push to work. The above commands are just examples and may need tweaking.\nCreate a pull request back to the main Yggdrasil repo. The builds will run automatically and you can view their status in the pull request. If they all succeed someone will merge them automatically (you don't need to do anything else).","category":"page"},{"location":"#DACE.jl","page":"Home","title":"DACE.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"warning: Warning\nThis package is still in development, is not complete and instructions may change significantly","category":"page"},{"location":"","page":"Home","title":"Home","text":"This is the documentation page for DACE.jl, a Julia interface to the DACE library.","category":"page"},{"location":"#Getting-started","page":"Home","title":"Getting started","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"DACE.jl can be installed using the Julia package manager. From the Julia REPL, type ] to enter the Pkg REPL mode and run","category":"page"},{"location":"","page":"Home","title":"Home","text":"pkg> add https://github.com/a-ev/DACE.jl.git","category":"page"},{"location":"","page":"Home","title":"Home","text":"Note: the add command above may not be needed if you are running from main directory of the repository.","category":"page"},{"location":"#Notes-about-the-interface","page":"Home","title":"Notes about the interface","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The Julia interface is built using CxxWrap.jl\nThe C++ source for the interface is currently in this fork of the DACE library\nThe C++ code gets built by BinaryBuilder and released into the Julia registry\nthe build recipe is located here\nThe Julia component of the interface is currently here","category":"page"},{"location":"","page":"Home","title":"Home","text":"The above may change, in particular we hope to:","category":"page"},{"location":"","page":"Home","title":"Home","text":"merge the forked DACE library back to upstream, if possible\nmove the DACE.jl package under the dacelib organisation on GitHub, if possible","category":"page"},{"location":"#Differences-compared-to-the-C-interface","page":"Home","title":"Differences compared to the C++ interface","text":"","category":"section"},{"location":"#DA-constructor","page":"Home","title":"DA constructor","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The DA constructor is different in the Julia interface compared to C++. In C++ if you create a DA object with a single argument the behaviour is different depending on whether the argument is an integer or double. For example, in C++:","category":"page"},{"location":"","page":"Home","title":"Home","text":"DA(1) creates a DA object representing 1.0 times the independent variable number 1\nDA(1.0) creates a DA object with the constant part equal to 1.0\nDA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1 (same as first bullet point above)","category":"page"},{"location":"","page":"Home","title":"Home","text":"In Julia with CxxWrap, there is an issue detecting the difference between integer and double when passing a single value on Windows, resulting in huge numbers of warnings being printed to screen. Therefore, in the Julia interface we have:","category":"page"},{"location":"","page":"Home","title":"Home","text":"DA(1) and DA(1.0) both create a DA object with the constant part equal to 1.0\nDA(1, 1.0) or DA(1, 1) both create a DA representing 1.0 times the independent variable number 1","category":"page"}] } diff --git a/dev/tutorials/making-a-new-release-of-dace_jll/index.html b/dev/tutorials/making-a-new-release-of-dace_jll/index.html index 8227a65..7ea6e9d 100644 --- a/dev/tutorials/making-a-new-release-of-dace_jll/index.html +++ b/dev/tutorials/making-a-new-release-of-dace_jll/index.html @@ -11,6 +11,6 @@ git checkout -b update-dace # switch to the D/DACE directory -cd D/DACE
  • Edit the build_tarballs.jl file:

    • bump the version of the release on or around line 11:

      version = v"0.1.0"
      Note

      It is highly recommended to follow semantic versioning

    • change the commit hash (on or around line 15) that the new version will be based of to the hash of the commit you identified in step 2

      GitSource("https://github.com/a-ev/dace.git", "9fe534f9b27c147a171bce1ad7dc8b4706a9457e"),

      where 9fe534f9b27c147a171bce1ad7dc8b4706a9457e is the commit hash

  • Check the version of libcxxwrapjuliajll which is linked to the version of CxxWrap.jl. When bumping the version of the CxxWrap dependency in the DACE.jl package you may also need to bump the version of libcxxwrapjuliajll on or around line 55:

    Dependency("libcxxwrap_julia_jll"; compat = "~0.12.2"),
    Important

    Make sure the version of libcxxwrapjuliajll is compatible with the version of CxxWrap,jl in your Project.toml for DACE.jl

  • Commit and push your changes into your fork of Yggdrasil:

    git add build_tarballs.jl
    +cd D/DACE
  • Edit the build_tarballs.jl file:

    • bump the version of the release on or around line 11:

      version = v"0.1.0"
      Note

      It is highly recommended to follow semantic versioning

    • change the commit hash (on or around line 15) that the new version will be based of to the hash of the commit you identified in step 2

      GitSource("https://github.com/a-ev/dace.git", "9fe534f9b27c147a171bce1ad7dc8b4706a9457e"),

      where 9fe534f9b27c147a171bce1ad7dc8b4706a9457e is the commit hash

  • Check the version of libcxxwrap_julia_jll which is linked to the version of CxxWrap.jl. When bumping the version of the CxxWrap dependency in the DACE.jl package you may also need to bump the version of libcxxwrap_julia_jll on or around line 55:

    Dependency("libcxxwrap_julia_jll"; compat = "~0.12.2"),
    Important

    Make sure the version of libcxxwrap_julia_jll is compatible with the version of CxxWrap,jl in your Project.toml for DACE.jl

  • Commit and push your changes into your fork of Yggdrasil:

    git add build_tarballs.jl
     git commit -m "[DACE] bump version"
    -git push

    You may need to set the upstream of your repo for git push to work. The above commands are just examples and may need tweaking.

  • Create a pull request back to the main Yggdrasil repo. The builds will run automatically and you can view their status in the pull request. If they all succeed someone will merge them automatically (you don't need to do anything else)

  • +git push

    You may need to set the upstream of your repo for git push to work. The above commands are just examples and may need tweaking.

  • Create a pull request back to the main Yggdrasil repo. The builds will run automatically and you can view their status in the pull request. If they all succeed someone will merge them automatically (you don't need to do anything else).

  • diff --git a/dev/tutorials/modifying-the-cxx-side-of-the-interface/index.html b/dev/tutorials/modifying-the-cxx-side-of-the-interface/index.html index 70fac90..2cd3444 100644 --- a/dev/tutorials/modifying-the-cxx-side-of-the-interface/index.html +++ b/dev/tutorials/modifying-the-cxx-side-of-the-interface/index.html @@ -30,4 +30,4 @@ mod.method("+", [](const double c, const DA& da) { return c + da; }); // until we call this, then subsequent calls to mod.method will add methods to our module again -mod.unset_override_module(); +mod.unset_override_module(); diff --git a/dev/tutorials/setting-up-your-development-environment/index.html b/dev/tutorials/setting-up-your-development-environment/index.html index f9cc527..e1c12da 100644 --- a/dev/tutorials/setting-up-your-development-environment/index.html +++ b/dev/tutorials/setting-up-your-development-environment/index.html @@ -19,4 +19,4 @@ std::cout << "initialising local version of DACE library..." << std::endl; DA::init(ord, nvar); });

    so that we can tell the local version has been loaded. Make the above change then save the file.

    We should be in the build directory still. Execute the following command to build and install your change:

    VERBOSE=ON cmake --build . --config Release --target install -- -j${nproc}

    Now change back to the DACE.jl directory

    cd ../../DACE.jl

    Once again, enter the Julia REPL with julia --project and run the DACE.init function we ran above:

    julia> using DACE
    -julia> DACE.init(10, 1)

    This time it should print out the string we just added (initialising local version of DACE library...).

    +julia> DACE.init(10, 1)

    This time it should print out the string we just added (initialising local version of DACE library...).