Building and running
Having written the code for your simulation, you need to be able to build it into an executable format to be deployed onto the Hadean platform, and be able to start your simulation running. When building a Simulate simulation, you use the same executable for running on your locally installed WSL and on remote cloud based clusters. There's no need to recompile with specific flags or configuration - the exact same executable will work both locally and remotely.
Simulate simulations build using CMake running clang. When you invoke CMake you should be targeting Linux, if building on Windows then you can install the Hadean Simulate SDK Build Tools which provides a copy of CMake and clang capable of cross compiling to linux. The Hadean Simulate SDK includes a CMake toolchain file that you can use in order to ensure the Aether libraries are discovered by CMake properly, this is available in your Build Tools installation directory at
<path to build tools>/lib/cmake/aether-toolchain.cmake.
When building you must install the simulation executable to
build/simulationand the Connect executable to
build/muxer/muxerin order for the Aether CLI to find them to deploy.
To build a simulation, run the commands listed bellow in your simulation directory. You can run each command separately, as shown below, which will be equal for any terminal.
$ cmake -B build -G Ninja
$ ninja -C ./build
Or you can run both commands at the same time considering that it differs depending on the terminal in use:
cmd & bash
$ cmake -B build -G Ninja & ninja -C ./build
$ cmake -B build -G Ninja; ninja -C ./build
ninja: Entering directory `build'
ninja: error: 'C:/Program', needed by 'simulation', missing and no known rule to make it
The issue is caused by the command
cmake -B build -G Ninjabecause it's not using the cmake version bundled in Simulate BuildTools.
There are two ways to solve the problem:
1 - We can change the order of our environment variables, in order to use the CMake that comes with our Simulate BuildTools, instead of another one that may already be installed in the system.
2 - We can indicate the path to our Simulate BuildTool's CMake in the command directly.
$ 'C:\Program Files\Hadean\Aether Engine SDK\BuildTools\bin\Cmake.exe' -B build -G Ninja
By default the build tools is installed in 'C:\Program Files\Hadean\Aether Engine SDK\BuildTools' as such the path of the Cmake executable bundled with Aether's Buildtools may vary if the user chose a custom installation directory.
Once you have a simulation ready to run, you can run it with the Aether Engine SDK CLI. When running, you can choose to run your simulation either on the local WSL or on a cloud cluster.
When developing, you will likely want to use the local WSL to quickly run and tests changes to your simulation code. To do this, use
When running a simulation locally, the simulation will be started on the WSL and the logs streamed back to the console. The local WSL will also host a Muxer that you can connect clients to through
localhost(127.0.0.1) or WSL container IP.
In order to stop a simulation when it has been started, press
CTRL+c. You will be asked if you wish to let the simulation continue running, and stop streaming the logs back to the console. If you do, reply
yto the prompt, any other response will stop the simulation. If you find you want to start simulations but do not wish to have the logs streamed back, consider using the
If you have detached from a simulation and so are no longer streaming logs, but it is still running, you can later stop it by running
When running, before starting the simulation, the WSL container IP will be printed out. Press to start the simulation.
It is sometimes necessary to make compiled libraries available on your cluster or local VM in order to dynamically link your code. In order to support this the aether run command supports the ability to pass in a list of semi-colon separated folder locations whose content will be made available to the simulation.
aether run --library-folders <your_folder_name1;your_folder_name2>
LD_LIBRARY_PATHis updated to include the location of the folders after they have been copied to the simulation machines which should allow the libraries to be automatically located. You can inspect with variable from within your simulation to discover the provided files, remember that
LD_LIBRARY_PATHmay contain multiple directories.
Running on a cloud cluster works in the same way as running locally, with the addition of a
--clusterflag that lets you specify which cluster you would like to run on. In order to run on a cloud cluster, you will need to have provisioned the servers and set up the Hadean Platform on them, for details on how to do this see Managing clusters. Once you have set up a cloud cluster to run on, you can get the cluster key, which is used to identify the cluster. This is available at http://portal.hadean.com, underneath the name of each cluster. Copy this and provide it as the value of the
aether run --cluster <cluster key>.
When running on a cluster, before starting the simulation, the list of all muxers available on that cluster will be printed out. Press
<ENTER>to start the simulation.