From 794e4393c3c51671f3a39ea44ff75957754c9ec4 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 11:33:15 +0200 Subject: [PATCH 01/33] Added a new function for the legacy Astaroth layer: acGetNode(). This functions returns a Node, which can be used to access acNode layer functions --- include/astaroth.h | 2 ++ src/core/astaroth.cc | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/astaroth.h b/include/astaroth.h index b2b3fa2..9ccdf85 100644 --- a/include/astaroth.h +++ b/include/astaroth.h @@ -99,6 +99,8 @@ AcResult acLoadWithOffset(const AcMesh host_mesh, const int3 src, const int num_ /** */ int acGetNumDevicesPerNode(void); +Node acGetNode(void); + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/core/astaroth.cc b/src/core/astaroth.cc index 75cd57d..659a9e0 100644 --- a/src/core/astaroth.cc +++ b/src/core/astaroth.cc @@ -34,8 +34,10 @@ const char* scalararray_names[] = {AC_FOR_SCALARARRAY_HANDLES(AC_GEN_STR)}; const char* vtxbuf_names[] = {AC_FOR_VTXBUF_HANDLES(AC_GEN_STR)}; #undef AC_GEN_STR -static const int num_nodes = 1; -static Node nodes[num_nodes]; +static const int max_num_nodes = 1; +static Node nodes[max_num_nodes] = {0}; + +static int num_nodes = 0; void acPrintMeshInfo(const AcMeshInfo config) @@ -55,12 +57,14 @@ acPrintMeshInfo(const AcMeshInfo config) AcResult acInit(const AcMeshInfo mesh_info) { + num_nodes = 1; return acNodeCreate(0, mesh_info, &nodes[0]); } AcResult acQuit(void) { + num_nodes = 0; return acNodeDestroy(nodes[0]); } @@ -176,3 +180,10 @@ acGetNumDevicesPerNode(void) ERRCHK_CUDA_ALWAYS(cudaGetDeviceCount(&num_devices)); return num_devices; } + +Node +acGetNode(void) +{ + ERRCHK_ALWAYS(num_nodes > 0); + return nodes[0]; +} From 92a6a1bdecb39bda7f0ffd2e1e2d984d30a67ed6 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 15:35:01 +0200 Subject: [PATCH 02/33] Added more professional run flags to ./ac_run --- src/standalone/main.cc | 165 ++++++++++++++++++++++++++++++++++------- 1 file changed, 139 insertions(+), 26 deletions(-) diff --git a/src/standalone/main.cc b/src/standalone/main.cc index b29db31..11bb455 100644 --- a/src/standalone/main.cc +++ b/src/standalone/main.cc @@ -61,6 +61,79 @@ errorlog_quit(void) } } +typedef struct { + char* key[2]; + char* description; +} Option; + +static Option +createOption(const char* key, const char* key_short, const char* description) +{ + Option option; + + option.key[0] = strdup(key); + option.key[1] = strdup(key_short); + option.description = strdup(description); + + return option; +} + +static void +destroyOption(Option* option) +{ + free(option->key[0]); + free(option->key[1]); + free(option->description); +} + +typedef enum { + HELP, + TEST, + BENCHMARK, + SIMULATE, + RENDER, + CONFIG, + NUM_OPTIONS, +} OptionType; + +static int +findOption(const char* str, const Option options[NUM_OPTIONS]) +{ + for (int i = 0; i < NUM_OPTIONS; ++i) + if (!strcmp(options[i].key[0], str) || !strcmp(options[i].key[1], str)) + return i; + + return -1; +} + +static void +print_options(const Option options[NUM_OPTIONS]) +{ + // Formatting + int keylen[2] = {0}; + for (int i = 0; i < NUM_OPTIONS; ++i) { + int len0 = strlen(options[i].key[0]); + int len1 = strlen(options[i].key[1]); + if (keylen[0] < len0) + keylen[0] = len0; + if (keylen[1] < len1) + keylen[1] = len1; + } + + for (int i = 0; i < NUM_OPTIONS; ++i) + printf("\t%*s | %*s: %s\n", keylen[0], options[i].key[0], keylen[1], options[i].key[1], + options[i].description); +} + +static void +print_help(const Option options[NUM_OPTIONS]) +{ + puts("Usage: ./ac_run [options]"); + print_options(options); + printf("\n"); + puts("For bug reporting, see README.md"); +} + int main(int argc, char* argv[]) { @@ -69,36 +142,76 @@ main(int argc, char* argv[]) atexit(errorlog_quit); } - printf("Args: \n"); - for (int i = 0; i < argc; ++i) - printf("%d: %s\n", i, argv[i]); - - char* config_path; - (argc == 3) ? config_path = strdup(argv[2]) - : config_path = strdup(AC_DEFAULT_CONFIG); - - printf("Config path: %s\n", config_path); - ERRCHK(config_path); + // Create options + // clang-format off + Option options[NUM_OPTIONS]; + options[HELP] = createOption("--help", "-h", "Prints this help."); + options[TEST] = createOption("--test", "-t", "Runs autotests."); + options[BENCHMARK] = createOption("--benchmark", "-b", "Runs benchmarks."); + options[SIMULATE] = createOption("--simulate", "-s", "Runs the simulation."); + options[RENDER] = createOption("--render", "-r", "Runs the real-time renderer."); + options[CONFIG] = createOption("--config", "-c", "Uses the config file given after this flag instead of the default."); + // clang-format on if (argc == 1) { - return run_renderer(config_path); - } - else if (argc == 2 || argc == 3) { - if (strcmp(argv[1], "-t") == 0) - return run_autotest(config_path); - else if (strcmp(argv[1], "-b") == 0) - return run_benchmark(config_path); - else if (strcmp(argv[1], "-s") == 0) - return run_simulation(config_path); - else if (strcmp(argv[1], "-r") == 0) - return run_renderer(config_path); - else - WARNING("Unrecognized option"); + print_help(options); } else { - WARNING("Too many options given"); + char* config_path = NULL; + for (int i = 1; i < argc; ++i) { + const int option = findOption(argv[i], options); + switch (option) { + case CONFIG: + if (i + 1 < argc) { + config_path = strdup(argv[i + 1]); + } + else { + printf("Syntax error. Usage: --config .\n"); + return EXIT_FAILURE; + } + break; + default: + break; // Do nothing + } + } + if (!config_path) + config_path = strdup(AC_DEFAULT_CONFIG); + + printf("Config path: %s\n", config_path); + ERRCHK_ALWAYS(config_path); + + for (int i = 1; i < argc; ++i) { + const int option = findOption(argv[i], options); + switch (option) { + case HELP: + print_help(options); + break; + case TEST: + run_autotest(config_path); + break; + case BENCHMARK: + run_benchmark(config_path); + break; + case SIMULATE: + run_simulation(config_path); + break; + case RENDER: + run_renderer(config_path); + break; + case CONFIG: + ++i; + break; + default: + printf("Invalid option %s\n", argv[i]); + break; // Do nothing + } + } + + free(config_path); } - free(config_path); - return EXIT_FAILURE; + for (int i = 0; i < NUM_OPTIONS; ++i) + destroyOption(&options[i]); + + return EXIT_SUCCESS; } From 785230053d4b9825d89ec3a4c09660b25e1c2b04 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 15:27:24 +0000 Subject: [PATCH 03/33] Rewrote README.md --- README.md | 226 +++++++++++++++++++----------------------------------- 1 file changed, 77 insertions(+), 149 deletions(-) diff --git a/README.md b/README.md index 023b55d..c94d3c1 100644 --- a/README.md +++ b/README.md @@ -2,169 +2,97 @@ # Astaroth - A Multi-GPU library for generic stencil computations -Astaroth is a single-node multi-GPU library for multiphysics and other problems, which involve stencil computations in a discrete mesh. It's licenced under the terms of the GNU General Public Licence, version 3, or later (see [LICENCE.txt](https://bitbucket.org/miikkavaisala/astaroth-code/src/master/astaroth_2.0/LICENCE.txt)). Astaroth ships with a domain-specific language that can be used to translate high-level representations of various stencil operations into efficient CUDA kernels. +[Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) -## System requirements +Astaroth is a multi-GPU library for three-dimensional stencil computations. It is designed especially for performing high-order stencil +computations in structured grids, where several coupled fields are updated each time step. Astaroth consists of a multi-GPU and single-GPU +APIs and provides a domain-specific language for translating high-level descriptions of stencil computations into efficient GPU code. This +makes Astaroth especially suitable for multiphysics simulations. -NVIDIA GPU with >= 3.0 compute capability. See https://en.wikipedia.org/wiki/CUDA#GPUs_supported. - -## Building (3rd party libraries for real-time visualization) - -1. `cd 3rdparty` -1. `./setup_dependencies.sh` Note: this may take some time. - -## Building - -There are two ways to build the code as instructed below. - -If you encounter issues, recheck that the 3rd party libraries were successfully built during the previous step. +Astaroth is licenced under the terms of the GNU General Public Licence, version 3, or later +(see [LICENCE.txt](https://bitbucket.org/miikkavaisala/astaroth-code/src/master/astaroth_2.0/LICENCE.txt)). For contributing guidelines, +see [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md). -### New approach +## System Requirements +* An NVIDIA GPU with support for compute capability 3.0 or higher (Kepler architecture or newer) + +## Dependencies +Relative recent versions of + +`gcc cmake cuda flex bison`. + +## Building + +In the base astaroth directory, run + +0. `mkdir build` +0. `cd build` +0. `cmake ..` +0. `make -j` + +> **Optional:** Documentation can be generated with `doxygen doxyfile` (requires Doxygen). The +generated documentation can be found in `doc/doxygen`. + +> **Tip:** The library is configured by passing [options](## CMake options) to CMake with `-D[option]=[ON|OFF]`. +For example, double precision can be enabled by calling `cmake -DBUILD_DOUBLE_PRECISION=ON ..`. +See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLists.txt) for an up-to-date list of options. + +> **Note:** CMake will inform you if there are missing dependencies. + +## CMake options + +| Option | Description | Default | +|--------|-------------|---------| +| BUILD_DEBUG | Builds Astaroth with extensive error checking | OFF | +| BUILD_STANDALONE | Builds a standalone library for testing, benchmarking and simulation | ON | +| BUILD_UTILS | Builds a generic utility library (WIP replacement for BUILD_STANDALONE) | ON | +| BUILD_RT_VISUALIZATION | Builds the real-time visualization module | OFF | +| BUILD_DOUBLE_PRECISION | Generates double precision code | OFF | +| MULTIGPU_ENABLED | Enables Astaroth to use multiple GPUs on a single node | ON | +| MPI_ENABLED | Enables additional functions for MPI communciation | OFF | +| DSL_MODULE_DIR | Defines the directory to be scanned when looking for DSL files | `astaroth/acc/mhd_solver` | -1. `mkdir whatever && cd whatever # Sourcing not required anymore` - -1. `cmake -DDSL_MODULE_DIR=acc/mhd_solver .. && make -j` - -1. `./ac_run -t ../config/astaroth.conf` +## Standalone module -### Method I: In the code directory (DEPRECATED. REVISE.) - -1. `cd build/` -1. `cmake -DDOUBLE_PRECISION=OFF -DBUILD_DEBUG=OFF ..` (Use `cmake -D CMAKE_C_COMPILER=icc -D CMAKE_CXX_COMPILER=icpc -DDOUBLE_PRECISION=OFF -DBUILD_DEBUG=OFF ..` if compiling on TIARA) -1. `../scripts/compile_acc.sh && make -j` -1. `./ac_run ` - -Edit `config/astaroth.conf` to change the numerical setup. - -### Method II: With a script in a custom build directory (DEPRECATED. REVISE.) - -1. `source sourceme.sh` to add relevant directories to the `PATH` -1. `ac_mkbuilddir.sh -b my_build_dir/` to set up a custom build directory. There are also other options available. See `ac_mkbuilddir.sh -h` for more. -1. `compile_acc.sh` to generate kernels from the Domain Specific Language -1. `cd my_build_dir/` -1. `make -j` -1. `./ac_run ` - -Edit `my_build_dir/astaroth.conf` to change the numerical setup. - -### Available options - -- `-s` simulation -- `-b` benchmark -- `-t` automated test - -By default, the program does a real-time visualization of the simulation domain. The camera and the initial conditions can be controller by `arrow keys`, `pgup`, `pgdown` and `spacebar`. - -## Visualization - -See `analysis/python/` directory of existing data visualization and analysis scripts. - -## Generating documentation - -Run `doxygen doxyfile` in astaroth_2.0 directory. The generated files can be found in `doc/doxygen`. The main page of the documentation will be at `dox/doxygen/astaroth_doc_html/index.html`. - -## Formatting - -If you have clang-format, you may run `scripts/fix_style.sh`. This script will recursively fix style of all the source files down from the current working directory. The script will ask for a confirmation before making any changes. - -## Directory structure -TODO - -## Contributing - -0. **Do not break existing functionality.** Do not modify the interface functions declared in astaroth.h and device.cuh in any way. Bug fixes are exceptions. If you need new functionality, create a new function. - -0. **Do not rename or redefine variables or constants declared in astaroth.h** without consulting everyone involved with the project. - -0. **Ensure that the code compiles and the automated tests pass** by running `./ac_run -t` before pushing changes to master. If you want to implement a feature that consists of multiple commits, see Managing feature branches below. - -### Managing feature branches - -0. Ensure that you're on the latest version of master. `git checkout master && git pull` - -0. Create a feature branch with `git checkout -b `, f.ex. `git checkout -b forcingtests_2019-01-01` - -0. Do your commits in that branch until your new feature works - -0. Merge master with your feature branch `git merge master` - -0. Resolve the conflicts and test that the code compiles and still works by running `./ac_run -t` - -0. If everything is OK, commit your final changes to the feature branch and merge it to master `git commit && git checkout master && git merge && git push` - -0. Unless you really have to keep your feature branch around for historical/other reasons, remove it from remote by calling `git push origin --delete ` - -A flowchart is available at [doc/commitflowchart.png](https://bitbucket.org/jpekkila/astaroth/src/2d91df19dcb3/doc/commitflowchart.png?at=master). - -### About branches in general - -* Unused branches should not kept around after merging them into master in order to avoid cluttering the repository. - -* `git branch -a --merged` shows a list of branches that have been merged to master and are likely not needed any more. - -* `git push origin --delete ` deletes a remote branch while `git branch -d ` deletes a local branch - -* If you think that you have messed up and lost work, run `git reflog` which lists the latests commits. All work that has been committed should be accessible with the hashes listed by this command with `git checkout `. - -## Coding style. - -### In a nutshell -- Use [K&R indentation style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style) and 4 space tabs. -- Line width is 100 characters -- Start function names after a linebreak in source files. -- [Be generous with `const` type qualifiers](https://isocpp.org/wiki/faq/const-correctness). -- When in doubt, see [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). - -### Header example: -```cpp -// Licence notice and doxygen description here -#pragma once -#include "avoid_including_headers_here.h" - -/** Doxygen comments */ -void globalFunction(void); +```Bash +Usage: ./ac_run [options] + --help | -h: Prints this help. + --test | -t: Runs autotests. + --benchmark | -b: Runs benchmarks. + --simulate | -s: Runs the simulation. + --render | -r: Runs the real-time renderer. + --config | -c: Uses the config file given after this flag instead of the default. ``` +See `analysis/python/` directory of existing data visualization and analysis scripts. -### Source example: -```cpp -#include "parent_header.h" +## Interface -#include +* `astaroth/include/astaroth.h`: Legacy interface for backwards compatibility and quick testing. +* `astaroth/include/astaroth_node.h`: Multi-GPU interface (single node). +* `astaroth/include/astaroth_device.h`: Single-GPU interface. +* `astaroth/src/utils`: Utility library for host-side memory allocations, verification and other tasks. -#include "other_headers.h" -#include "more_headers.h" +## FAQ -typedef struct { - int data; -} SomeStruct; +Can I use the code even if I don't make my changes public? -static inline int small_function(const SomeStruct& stuff) { return stuff.data; } - -// Pass constant structs always by reference (&) and use const type qualifier. -// Modified structs are always passed as pointers (*), never as references. -// Constant parameters should be on the left-hand side, while non-consts go to the right. -static void -local_function(const SomeStruct& constant_struct, SomeStruct* modified_struct) -{ - modified_struct->data = constant_struct.data; -} - -void -globalFunction(void) -{ - return; -} -``` -## TIARA cluster compilation notes - -Modules used when compiling the code on TIARA cluster. - - * cmake/3.9.5 - * gcc/8.3.0 - * cuda/10.1 +> [GPL](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) requires only that if you release a binary based on Astaroth to the +public, then you should also release the source code for it. In private you can do whatever you want (secret forks, secret collaborations, +etc). +How do I compile with MPI support? + +> MPI implementation for Astaroth is still work in progress, these commands are for testing only. +Invoke CMake with `cmake -DMPI_ENABLED=ON -DBUILD_MPI_TEST=ON -DCMAKE_CXX_COMPILER=$(which mpicxx) ..`. +Otherwise the build steps are the same. Run with `mpirun -np 4 ./mpitest`. + + +How do I contribute? + +> See [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md). + From bd640a8ff5d50a5f8d953d00b1f38f70af43bbb2 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 15:31:05 +0000 Subject: [PATCH 04/33] Removed unnecessary linebreaks from README.md. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c94d3c1..d0d0dde 100644 --- a/README.md +++ b/README.md @@ -84,14 +84,12 @@ Can I use the code even if I don't make my changes public? public, then you should also release the source code for it. In private you can do whatever you want (secret forks, secret collaborations, etc). - How do I compile with MPI support? > MPI implementation for Astaroth is still work in progress, these commands are for testing only. Invoke CMake with `cmake -DMPI_ENABLED=ON -DBUILD_MPI_TEST=ON -DCMAKE_CXX_COMPILER=$(which mpicxx) ..`. Otherwise the build steps are the same. Run with `mpirun -np 4 ./mpitest`. - How do I contribute? > See [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md). From 74f68d437108a5d10d9095a5df6b02244568c910 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 16:16:55 +0000 Subject: [PATCH 05/33] CONTRIBUTING.md created online with Bitbucket --- CONTRIBUTING.md | 127 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..aff9d2d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,127 @@ +# Contributing + +Contributions to Astaroth are very welcome! + +This document details how to create good contributions. There are two primary concerns: + +0. The codebase should stay maintainable and commits should adhere to a consistent style. +0. New additions should not disrupt the work of others. + +## Basic workflow + +*"There is something that needs fixing"* + +0. Create your work. See [Programming](## Programming) and [Committing](#Committing) . +0. When done, check that autotests still pass by running `./ac_run -t`. +0. **[Recommended]:** Autoformat your code. See [Formatting](#Formatting). +0. Create a pull request. + +## Programming +* **Strive for code clarity over micro-optimizations.** + * Readability and simplicity should always be preferred over anything else outside of performance-critical parts. + * Give variables meaningful names and add comments to parts that are not immediately clear from context. +* **Avoid breaking existing functionality.** + * Do not modify existing interface functions in any way. Bugfixes are exceptions. If you need new functionality, create a new function. + * Do not rename or redefine global variables or constants. + +## Committing +* Prefer multiple small commits over few large ones. +* Provide meaningful commit messages. +* If a feature consists of multiple commits, consider creating a new branch. See [Managing feature branches](## Managing feature branches) and [About branches in general](## About branches in general) for more details. When done, issue the pull request to the new branch. + +## Formatting + +If you have `clang-format`, you may run `scripts/fix_style.sh`. This script will recursively fix style of all the source files down from the current working directory. The script will ask for a confirmation before making any changes. + +> **WARNING** The script will replace old source files with new formatted versions. Ensure that you have committed your changes before running `fix_style.sh` to be safe. + +Basic rules: + +- Use [K&R indentation style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style) and 4 space tabs. +- Line width is 100 characters. +- Start function names after a linebreak in source files. +- [Be generous with `const` type qualifiers](https://isocpp.org/wiki/faq/const-correctness). +- When in doubt, see [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). + +## Header example: +```cpp +// Licence notice and doxygen description here +#pragma once +#include "avoid_including_headers_here.h" + +/** Doxygen comments */ +void globalFunction(void); +``` + + +## Source example: +```cpp +#include "parent_header.h" + +#include + +#include "other_headers.h" +#include "more_headers.h" + +typedef struct { + int data; +} SomeStruct; + +static inline int small_function(const SomeStruct& stuff) { return stuff.data; } + +// Pass constant structs always by reference (&) and use const type qualifier. +// Modified structs are always passed as pointers (*), never as references. +// Constant parameters should be on the left-hand side, while non-consts go to the right. +static void +local_function(const SomeStruct& constant_struct, SomeStruct* modified_struct) +{ + modified_struct->data = constant_struct.data; +} + +void +globalFunction(void) +{ + return; +} +``` + +## Managing feature branches + +0. Ensure that you're on the latest version of master. `git checkout master && git pull` + +0. Create a feature branch with `git checkout -b `, f.ex. `git checkout -b forcingtests_2019-01-01` + +0. Do your commits in that branch until your new feature works + +0. Merge master with your feature branch `git merge master` + +0. Resolve the conflicts and test that the code compiles and still works by running `./ac_run -t` + +0. If everything is OK, commit your final changes to the feature branch and merge it to master `git commit && git checkout master && git merge && git push` + +0. Unless you really have to keep your feature branch around for historical/other reasons, remove it from remote by calling `git push origin --delete ` + +A flowchart is available at [doc/commitflowchart.png](https://bitbucket.org/jpekkila/astaroth/src/2d91df19dcb3/doc/commitflowchart.png?at=master). + +## About branches in general + +* Unused branches should not kept around after merging them into master in order to avoid cluttering the repository. + +* `git branch -a --merged` shows a list of branches that have been merged to master and are likely not needed any more. + +* `git push origin --delete ` deletes a remote branch while `git branch -d ` deletes a local branch + +* If you think that you have messed up and lost work, run `git reflog` which lists the latests commits. All work that has been committed should be accessible with the hashes listed by this command with `git checkout `. + + + + + + + + + + + + + From b6451c4b82bca82ea5592461ebad5f582e56785f Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 16:22:22 +0000 Subject: [PATCH 06/33] Fixed hyperlinks in README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d0d0dde..5cd5471 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Astaroth - A Multi-GPU library for generic stencil computations -[Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) +[Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) Astaroth is a multi-GPU library for three-dimensional stencil computations. It is designed especially for performing high-order stencil computations in structured grids, where several coupled fields are updated each time step. Astaroth consists of a multi-GPU and single-GPU @@ -11,7 +11,7 @@ makes Astaroth especially suitable for multiphysics simulations. Astaroth is licenced under the terms of the GNU General Public Licence, version 3, or later (see [LICENCE.txt](https://bitbucket.org/miikkavaisala/astaroth-code/src/master/astaroth_2.0/LICENCE.txt)). For contributing guidelines, -see [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md). +see [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md). ## System Requirements @@ -34,13 +34,13 @@ In the base astaroth directory, run > **Optional:** Documentation can be generated with `doxygen doxyfile` (requires Doxygen). The generated documentation can be found in `doc/doxygen`. -> **Tip:** The library is configured by passing [options](## CMake options) to CMake with `-D[option]=[ON|OFF]`. +> **Tip:** The library is configured by passing [options](#cmake-options) to CMake with `-D[option]=[ON|OFF]`. For example, double precision can be enabled by calling `cmake -DBUILD_DOUBLE_PRECISION=ON ..`. See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLists.txt) for an up-to-date list of options. > **Note:** CMake will inform you if there are missing dependencies. -## CMake options +## [CMake options](#cmake-options) | Option | Description | Default | |--------|-------------|---------| @@ -92,5 +92,5 @@ Otherwise the build steps are the same. Run with `mpirun -np 4 ./mpitest`. How do I contribute? -> See [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/Contributing.md). +> See [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md). From cc933a09498b607afd262e091b9f0f80119f6944 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 16:26:06 +0000 Subject: [PATCH 07/33] README.md edited online with Bitbucket. Consistent headings and another attempt and linking. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5cd5471..fe6a11f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![astaroth_logo](./doc/astaroth_logo.svg "Astaroth Sigil") -# Astaroth - A Multi-GPU library for generic stencil computations +# Astaroth - A Multi-GPU Library for Generic Stencil Computations [Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) @@ -40,7 +40,7 @@ See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLis > **Note:** CMake will inform you if there are missing dependencies. -## [CMake options](#cmake-options) +## CMake Options {: #cmake-options} | Option | Description | Default | |--------|-------------|---------| @@ -54,7 +54,7 @@ See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLis | DSL_MODULE_DIR | Defines the directory to be scanned when looking for DSL files | `astaroth/acc/mhd_solver` | -## Standalone module +## Standalone Module ```Bash From a85a9614e69d246cd83288d2ab29bb3b3d4bfda3 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 16:30:47 +0000 Subject: [PATCH 08/33] README.md edited online with Bitbucket. Now it's gotta work. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe6a11f..950bb49 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLis > **Note:** CMake will inform you if there are missing dependencies. -## CMake Options {: #cmake-options} +## CMake Options | Option | Description | Default | |--------|-------------|---------| From d01e20a3d99a6f84ffc4b866d1bc67bee5778fdc Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 16:34:57 +0000 Subject: [PATCH 09/33] README.md edited online with Bitbucket. Now the links work (had to append markdown-header-* to the link) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 950bb49..9f5227a 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ In the base astaroth directory, run > **Optional:** Documentation can be generated with `doxygen doxyfile` (requires Doxygen). The generated documentation can be found in `doc/doxygen`. -> **Tip:** The library is configured by passing [options](#cmake-options) to CMake with `-D[option]=[ON|OFF]`. +> **Tip:** The library is configured by passing [options](#markdown-header-cmake-options) to CMake with `-D[option]=[ON|OFF]`. For example, double precision can be enabled by calling `cmake -DBUILD_DOUBLE_PRECISION=ON ..`. See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLists.txt) for an up-to-date list of options. > **Note:** CMake will inform you if there are missing dependencies. -## CMake Options +## CMake Options | Option | Description | Default | |--------|-------------|---------| From a6cf5a8b792a6400c551f400f5dab4b582cdda5f Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 16:39:26 +0000 Subject: [PATCH 10/33] CONTRIBUTING.md edited online with Bitbucket --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aff9d2d..6bff505 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,9 +11,9 @@ This document details how to create good contributions. There are two primary co *"There is something that needs fixing"* -0. Create your work. See [Programming](## Programming) and [Committing](#Committing) . +0. Create your work. See [Programming](#markdown-header-programming) and [Committing](#markdown-header-committing) . 0. When done, check that autotests still pass by running `./ac_run -t`. -0. **[Recommended]:** Autoformat your code. See [Formatting](#Formatting). +0. **[Recommended]:** Autoformat your code. See [Formatting](#markdown-header-formatting). 0. Create a pull request. ## Programming @@ -27,7 +27,7 @@ This document details how to create good contributions. There are two primary co ## Committing * Prefer multiple small commits over few large ones. * Provide meaningful commit messages. -* If a feature consists of multiple commits, consider creating a new branch. See [Managing feature branches](## Managing feature branches) and [About branches in general](## About branches in general) for more details. When done, issue the pull request to the new branch. +* If a feature consists of multiple commits, consider creating a new branch. See [Managing feature branches](#markdown-header-managing-feature-branches) and [About branches in general](#markdown-header-about-branches-in-general) for more details. When done, issue the pull request to the new branch. ## Formatting From d51d48071f1db21389b9da5d4b870f26981779d5 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 21:11:04 +0200 Subject: [PATCH 11/33] Updated documentation and made it work with Doxygen. Now the doc/doxygen/index.html generated with it looks quite good and contains lots of useful and up-to-date information about Astaroth --- CONTRIBUTING.md | 17 ++-- README.md | 25 +++--- acc/README.md | 3 + .../API_specification_and_user_manual.md | 85 ++++++++++--------- doxyfile | 10 +-- include/astaroth_node.h | 40 ++++++++- 6 files changed, 112 insertions(+), 68 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6bff505..24cae80 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,20 +1,23 @@ +Contributing +============ + # Contributing Contributions to Astaroth are very welcome! This document details how to create good contributions. There are two primary concerns: -0. The codebase should stay maintainable and commits should adhere to a consistent style. -0. New additions should not disrupt the work of others. +1. The codebase should stay maintainable and commits should adhere to a consistent style. +2. New additions should not disrupt the work of others. ## Basic workflow -*"There is something that needs fixing"* +> "There is something that needs fixing" -0. Create your work. See [Programming](#markdown-header-programming) and [Committing](#markdown-header-committing) . -0. When done, check that autotests still pass by running `./ac_run -t`. -0. **[Recommended]:** Autoformat your code. See [Formatting](#markdown-header-formatting). -0. Create a pull request. +1. Create your work. See [Programming](#markdown-header-programming) and [Committing](#markdown-header-committing) . +2. When done, check that autotests still pass by running `./ac_run -t`. +3. **[Recommended]:** Autoformat your code. See [Formatting](#markdown-header-formatting). +4. Create a pull request. ## Programming * **Strive for code clarity over micro-optimizations.** diff --git a/README.md b/README.md index 9f5227a..7b31d29 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ -![astaroth_logo](./doc/astaroth_logo.svg "Astaroth Sigil") +Astaroth Documentation {#mainpage} +============ + +![Astaroth Sigil](doc/astaroth_logo.svg) # Astaroth - A Multi-GPU Library for Generic Stencil Computations -[Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) +[Specification](doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md) | [Contributing](CONTRIBUTING.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) Astaroth is a multi-GPU library for three-dimensional stencil computations. It is designed especially for performing high-order stencil computations in structured grids, where several coupled fields are updated each time step. Astaroth consists of a multi-GPU and single-GPU @@ -11,7 +14,7 @@ makes Astaroth especially suitable for multiphysics simulations. Astaroth is licenced under the terms of the GNU General Public Licence, version 3, or later (see [LICENCE.txt](https://bitbucket.org/miikkavaisala/astaroth-code/src/master/astaroth_2.0/LICENCE.txt)). For contributing guidelines, -see [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md). +see [Contributing](CONTRIBUTING.md). ## System Requirements @@ -24,14 +27,14 @@ Relative recent versions of ## Building -In the base astaroth directory, run +In the base directory, run -0. `mkdir build` -0. `cd build` -0. `cmake ..` -0. `make -j` +1. `mkdir build` +2. `cd build` +3. `cmake ..` +4. `make -j` -> **Optional:** Documentation can be generated with `doxygen doxyfile` (requires Doxygen). The +> **Optional:** Documentation can be generated by running `doxygen` in the base directory. The generated documentation can be found in `doc/doxygen`. > **Tip:** The library is configured by passing [options](#markdown-header-cmake-options) to CMake with `-D[option]=[ON|OFF]`. @@ -74,7 +77,7 @@ See `analysis/python/` directory of existing data visualization and analysis scr * `astaroth/include/astaroth.h`: Legacy interface for backwards compatibility and quick testing. * `astaroth/include/astaroth_node.h`: Multi-GPU interface (single node). * `astaroth/include/astaroth_device.h`: Single-GPU interface. -* `astaroth/src/utils`: Utility library for host-side memory allocations, verification and other tasks. +* `astaroth/src/utils/`: Utility library for host-side memory allocations, verification and other tasks. ## FAQ @@ -92,5 +95,5 @@ Otherwise the build steps are the same. Run with `mpirun -np 4 ./mpitest`. How do I contribute? -> See [Contributing](https://bitbucket.org/jpekkila/astaroth/src/master/CONTRIBUTING.md). +> See [Contributing](CONTRIBUTING.md). diff --git a/acc/README.md b/acc/README.md index 6197fed..467b63b 100644 --- a/acc/README.md +++ b/acc/README.md @@ -1,3 +1,6 @@ +Astaroth DSL compiler +============ + # Dependencies ## Debian/Ubuntu `apt install flex bison build-essential` diff --git a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md index 717df22..6f03032 100644 --- a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md +++ b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md @@ -1,4 +1,7 @@ -# Astaroth specification and user manual +Astaroth Specification and User Manual +============ + +# Astaroth Specification and User Manual Copyright (C) 2014-2019, Johannes Pekkila, Miikka Vaisala. @@ -20,7 +23,7 @@ Copyright (C) 2014-2019, Johannes Pekkila, Miikka Vaisala. along with Astaroth. If not, see . -# Introduction and background +# Introduction and Background Astaroth is a collection of tools for utilizing multiple graphics processing units (GPUs) efficiently in three-dimensional stencil computations. This document specifies the Astaroth @@ -67,8 +70,8 @@ to these publications in their work. The Astroth application-programming interface (API) provides the means for controlling execution of user-defined and built-in functions on multiple graphics processing units. Functions in the API are -prefixed with lower case ```ac```, while structures and data types are prefixed with capitalized -```Ac```. Compile-time constants, such as definitions and enumerations, have the prefix ```AC_```. +prefixed with lower case `ac`, while structures and data types are prefixed with capitalized +`Ac`. Compile-time constants, such as definitions and enumerations, have the prefix `AC_`. All of the API functions return an AcResult value indicating either success or failure. The return codes are ```C @@ -103,13 +106,13 @@ Finally, a third layer is provided for convenience and backwards compatibility. There are also several helper functions defined in `include/astaroth_defines.h`, which can be used for, say, determining the size or performing index calculations within the simulation domain. -## List of Astaroth API functions +## List of Astaroth API Functions Here's a non-exhaustive list of astaroth API functions. For more info and an up-to-date list, see the corresponding header files in `include/astaroth_defines.h`, `include/astaroth.h`, `include/ astaroth_node.h`, `include/astaroth_device.h`. -### Initialization, quitting and helper functions +### Initialization, Quitting and Helper Functions Device layer. ```C @@ -137,7 +140,7 @@ size_t acVertexBufferCompdomainSizeBytes(const AcMeshInfo info); size_t acVertexBufferIdx(const int i, const int j, const int k, const AcMeshInfo info); ``` -### Loading and storing +### Loading and Storing Loading meshes and vertex buffers to device memory. ```C @@ -245,7 +248,7 @@ AcResult acNodeReduceVec(const Node node, const Stream stream_type, const Reduct const VertexBufferHandle vtxbuf2, AcReal* result); ``` -### Stream synchronization +### Stream Synchronization All library functions that take a `Stream` as a parameter are asynchronous. When calling these functions, control returns immediately back to the host even if the called device function has not @@ -273,7 +276,7 @@ barrierSynchronizeStream(STREAM_ALL); // Blocks until functions in all streams h funcD(STREAM_2); // Is started when command returns from synchronizeStream() ``` -### Data synchronization +### Data Synchronization Stream synchronization works in the same fashion on node and device layers. However on the node layer, one has to take in account that a portion of the mesh is shared between devices and that the @@ -291,14 +294,9 @@ AcResult acNodeSynchronizeVertexBuffer(const Node node, const Stream stream, ``` -> **NOTE**: Local halos must be up to date before synchronizing the data. Local halos are the grid -points outside the computational domain which are used only by a single device. The mesh is -distributed to multiple devices by blocking along the z axis. If there are *n* devices and the z- -dimension of the computational domain is *nz*, then each device is assigned *nz / n* two- -dimensional planes. For example with two devices, the data block that has to be up to date ranges -from *(0, 0, nz)* to *(mx, my, nz + 2 * NGHOST)* +> **NOTE**: Local halos must be up to date before synchronizing the data. Local halos are the grid points outside the computational domain which are used only by a single device. The mesh is distributed to multiple devices by blocking along the z axis. If there are *n* devices and the z-dimension of the computational domain is *nz*, then each device is assigned *nz / n* two-dimensional planes. For example with two devices, the data block that has to be up to date ranges from *(0, 0, nz)* to *(mx, my, nz + 2 * NGHOST)*. -### Input and output buffers +### Input and Output Buffers The mesh is duplicated to input and output buffers for performance reasons. The input buffers are read-only in user-specified compute kernels, which allows us to read them via the texture cache @@ -313,10 +311,7 @@ is done via the API calls AcResult acDeviceSwapBuffers(const Device device); AcResult acNodeSwapBuffers(const Node node); ``` -> **NOTE**: All functions provided with the API operate on input buffers and ensure that the -complete result is available in the input buffer when the function has completed. User-specified -kernels are exceptions and write the result to output buffers. Therefore buffers have to be swapped -only after calling user-specified kernels. +> **NOTE**: All functions provided with the API operate on input buffers and ensure that the complete result is available in the input buffer when the function has completed. User-specified kernels are exceptions and write the result to output buffers. Therefore buffers have to be swapped only after calling user-specified kernels. ## Devices @@ -420,7 +415,7 @@ Let *i* be the device id. The portion of the halos shared by neighboring devices `acNodeSynchronizeVertexBuffer` and `acNodeSynchronizeMesh` communicate these shared areas among the devices in the node. -## Integration, reductions and boundary conditions +## Integration, Reductions and Boundary Conditions The library provides the following functions for integration, reductions and computing periodic boundary conditions. @@ -487,18 +482,18 @@ pipeline shown in the following figure. | Stage | File ending | Description | |--------------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Stencil assembly | .sas | Defines the shape of the stencils and functions to be preprocessed before entering the stencil processing stage. Reading from input arrays is only possible during this stage. | -| Stencil process | .sps | The functions executed on streams of data are defined here. Contains kernels, which are essentially main functions of GPU programs. | -| Stencil definition | .sdh | All field identifiers and constant memory symbols are defined in this file. | -| Any | .h | Optional header files which can be included in any other file. +| Stencil assembly | .ac | Defines the shape of the stencils and functions to be preprocessed before entering the stencil processing stage. Reading from input arrays is only possible during this stage. | +| Stencil process | .ac | The functions executed on streams of data are defined here. Contains kernels, which are essentially main functions of GPU programs. | +| Stencil definition | .ac | All field identifiers and constant memory symbols are defined in this file. | +| Any | .h | Optional header files which can be included in any file. Compilation of the DSL files is integrated into `CMakelists.txt` provided with the library and dependencies are recompiled if needed when calling `make`. All DSL files should reside in the same -directory and there should be only one `.sas`, `.sps` and `.sdh` file. There may be any number of +directory and there should be only one `.ac` file. There may be any number of optional `.h` files. When configuring the project, the user should pass the path to the DSL directory as a cmake option like so: ```cmake -DDSL_MODULE_DIR="some/user/dir" ..```. -## Data types +## Data Types In addition to basic datatypes in C/C++/CUDA, such as int and int3, we provide the following datatypes with the DSL. @@ -517,13 +512,13 @@ In addition to basic datatypes in C/C++/CUDA, such as int and int3, we provide t `Scalars` are 32-bit floating-point numbers by default. Double precision can be turned on by setting cmake option `DOUBLE_PRECISION=ON`. All real number literals are converted automatically to the correct precision. In cases where , the precision can be declared explicitly by appending `f` or `d` postfix to the real number. For example, ```C -1.0 // The same precision as Scalar/AcReal -1.0f // Explicit float -1.0d // Explicit double +1.0 // The same precision as Scalar/AcReal +1.0f // Explicit float +1.0d // Explicit double (1.0f * 1.0d) // 1.0f is implicitly cast to double and the multiplication is done in double precision. ``` -## Control flow +## Control Flow Conditional statements are expressed with the `if-else` construct. Unlike in C and C++, we require that the scope of the `if-else` statement is explicitly declared using braces `{` and `}` in order @@ -566,19 +561,21 @@ The following built-in variables are available in `Kernel`s. | globalVertexIdx | Holds the global index of the currently processed vertex. If there is only single device, then vertexIdx is the same as globalVertexIdx. Otherwise globalVertexIdx is offset accordingly. | | globalGridN | Holds the dimensions of the computational domain. | -## Preprocessed functions +## Preprocessed Functions The type qualifier `Preprocessed` indicates which functions should be evaluated immediately when entering a `Kernel` function. The return values of `Preprocessed` functions are cached and calling these functions during the stencil processing stage is essentially free. As main memory bandwidth is significantly slower than on-chip memories and registers, declaring reading-heavy functions as -`Preprocessed` is critical for obtaining good performance in stencil codes. - -`Preprocessed` functions may only be defined in stencil assembly files. +`Preprocessed` is critical for obtaining good performance in stencil codes. The built-in variables `vertexIdx`, `globalVertexidx` and `globalGridN` are available in all `Preprocessed` functions. +## Device Functions + +The type qualifier `Device` indicates which functions can be called from `Kernel` functions or other `Device` functions. + ## Uniforms `Uniform`s are global device variables which stay constant for the duration of a kernel launch. @@ -603,17 +600,23 @@ Instead, one should load the appropriate values during runtime using the `acLoad related functions. -## Standard libraries +## Standard Libraries -> Not implemented +The following table lists the standard libraries currently available. -## Performance considerations +| Built-in variable | Description | +|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| stdderiv.h | Contains functions for computing 2nd, 4th, 6th and 8th order derivatives (configured by defining the STENCIL_ORDER before including stdderiv.h) | + +Astaroth DSL libraries can be included in the same way as C/C++ headers. For example, `#include `. + +## Performance Considerations Uniforms are as fast as compile-time constants as long as -0. The halting condition of a tight loop does not depend on an uniform or a variable, as this would prevent unrolling of the loop during compile-time. -0. Uniforms are not multiplied with each other. The result should be stored in an auxiliary uniform instead. For example, the result of `nx * ny` should be stored in a new `uniform nxy` -0. At least 32 neighboring streams in the x-axis access the same `uniform`. That is, the vertices at vertexIdx.x = i... i + 32 should access the same `uniform` where i is a multiple of 32. +1. The halting condition of a tight loop does not depend on an uniform or a variable, as this would prevent unrolling of the loop during compile-time. +2. Uniforms are not multiplied with each other. The result should be stored in an auxiliary uniform instead. For example, the result of `nx * ny` should be stored in a new `uniform nxy` +3. At least 32 neighboring streams in the x-axis access the same `uniform`. That is, the vertices at vertexIdx.x = i... i + 32 should access the same `uniform` where i is a multiple of 32. diff --git a/doxyfile b/doxyfile index 7bab478..5f89d90 100644 --- a/doxyfile +++ b/doxyfile @@ -771,7 +771,7 @@ WARN_LOGFILE = doc/doxygen/doxygen_warnings.log # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = src include +INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -796,7 +796,7 @@ INPUT_ENCODING = UTF-8 # *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, # *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. -FILE_PATTERNS = *.cc *.h *.cu *.cuh +FILE_PATTERNS = *.c *.cc *.h *.cu *.cuh *.md # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. @@ -920,7 +920,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -2314,7 +2314,7 @@ DIRECTORY_GRAPH = YES # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_IMAGE_FORMAT = png +DOT_IMAGE_FORMAT = svg # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. @@ -2326,7 +2326,7 @@ DOT_IMAGE_FORMAT = png # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -INTERACTIVE_SVG = NO +INTERACTIVE_SVG = YES # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. diff --git a/include/astaroth_node.h b/include/astaroth_node.h index 61438f3..d1cb131 100644 --- a/include/astaroth_node.h +++ b/include/astaroth_node.h @@ -41,16 +41,48 @@ typedef struct { Grid subgrid; } DeviceConfiguration; -/** */ +/** +Initializes all devices on the current node. + +Devices on the node are configured based on the contents of AcMesh. + +@return Exit status. Places the newly created handle in the output parameter. +@see AcMeshInfo + + +Usage example: +@code +AcMeshInfo info; +acLoadConfig(AC_DEFAULT_CONFIG, &info); + +Node node; +acNodeCreate(0, info, &node); +acNodeDestroy(node); +@endcode + */ AcResult acNodeCreate(const int id, const AcMeshInfo node_config, Node* node); -/** */ +/** +Resets all devices on the current node. + +@see acNodeCreate() + */ AcResult acNodeDestroy(Node node); -/** */ +/** +Prints information about the devices available on the current node. + +Requires that Node has been initialized with +@See acNodeCreate(). +*/ AcResult acNodePrintInfo(const Node node); -/** */ +/** + + + +@see DeviceConfiguration +*/ AcResult acNodeQueryDeviceConfiguration(const Node node, DeviceConfiguration* config); /** */ From 81aeff8b7802f6c1c70a83c86d5bf98c52fddd0a Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 21:35:14 +0200 Subject: [PATCH 12/33] Updated the licence and made it .md --- CONTRIBUTING.md | 14 +- LICENCE.md | 675 ++++++++++++++++++++++++++++++++++++++++++++++++ LICENCE.txt | 18 -- README.md | 12 +- 4 files changed, 686 insertions(+), 33 deletions(-) create mode 100644 LICENCE.md delete mode 100644 LICENCE.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 24cae80..411f8c8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,19 +90,19 @@ globalFunction(void) ## Managing feature branches -0. Ensure that you're on the latest version of master. `git checkout master && git pull` +1. Ensure that you're on the latest version of master. `git checkout master && git pull` -0. Create a feature branch with `git checkout -b `, f.ex. `git checkout -b forcingtests_2019-01-01` +2. Create a feature branch with `git checkout -b `, f.ex. `git checkout -b forcingtests_2019-01-01` -0. Do your commits in that branch until your new feature works +3. Do your commits in that branch until your new feature works -0. Merge master with your feature branch `git merge master` +4. Merge master with your feature branch `git merge master` -0. Resolve the conflicts and test that the code compiles and still works by running `./ac_run -t` +5. Resolve the conflicts and test that the code compiles and still works by running `./ac_run -t` -0. If everything is OK, commit your final changes to the feature branch and merge it to master `git commit && git checkout master && git merge && git push` +6. If everything is OK, commit your final changes to the feature branch and merge it to master `git commit && git checkout master && git merge && git push` -0. Unless you really have to keep your feature branch around for historical/other reasons, remove it from remote by calling `git push origin --delete ` +7. Unless you really have to keep your feature branch around for historical/other reasons, remove it from remote by calling `git push origin --delete ` A flowchart is available at [doc/commitflowchart.png](https://bitbucket.org/jpekkila/astaroth/src/2d91df19dcb3/doc/commitflowchart.png?at=master). diff --git a/LICENCE.md b/LICENCE.md new file mode 100644 index 0000000..2fb2e74 --- /dev/null +++ b/LICENCE.md @@ -0,0 +1,675 @@ +### GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +### Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom +to share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the +software, or if you modify it: responsibilities to respect the freedom +of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those +domains in future versions of the GPL, as needed to protect the +freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish +to avoid the special danger that patents applied to a free program +could make it effectively proprietary. To prevent this, the GPL +assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS + +#### 0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +#### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +#### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +#### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +#### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". +- c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +#### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +- d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +#### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or +- e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +#### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +#### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +#### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +#### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +#### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +#### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +#### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that numbered version or +of any later version published by the Free Software Foundation. If the +Program does not specify a version number of the GNU General Public +License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU General Public License can be used, that proxy's public +statement of acceptance of a version permanently authorizes you to +choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +#### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +#### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +#### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper +mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + +The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . diff --git a/LICENCE.txt b/LICENCE.txt deleted file mode 100644 index 71eb26e..0000000 --- a/LICENCE.txt +++ /dev/null @@ -1,18 +0,0 @@ -/* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. - - This file is part of Astaroth. - - Astaroth is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Astaroth is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Astaroth. If not, see . -*/ diff --git a/README.md b/README.md index 7b31d29..1d4fe76 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Astaroth Documentation {#mainpage} # Astaroth - A Multi-GPU Library for Generic Stencil Computations -[Specification](doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md) | [Contributing](CONTRIBUTING.md) | [Licence](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) +[Specification](doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md) | [Contributing](CONTRIBUTING.md) | [Licence](LICENCE.md) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) Astaroth is a multi-GPU library for three-dimensional stencil computations. It is designed especially for performing high-order stencil computations in structured grids, where several coupled fields are updated each time step. Astaroth consists of a multi-GPU and single-GPU @@ -13,7 +13,7 @@ APIs and provides a domain-specific language for translating high-level descript makes Astaroth especially suitable for multiphysics simulations. Astaroth is licenced under the terms of the GNU General Public Licence, version 3, or later -(see [LICENCE.txt](https://bitbucket.org/miikkavaisala/astaroth-code/src/master/astaroth_2.0/LICENCE.txt)). For contributing guidelines, +(see [LICENCE.txt](LICENCE.md)). For contributing guidelines, see [Contributing](CONTRIBUTING.md). @@ -83,15 +83,11 @@ See `analysis/python/` directory of existing data visualization and analysis scr Can I use the code even if I don't make my changes public? -> [GPL](https://bitbucket.org/jpekkila/astaroth/src/master/LICENCE.txt) requires only that if you release a binary based on Astaroth to the -public, then you should also release the source code for it. In private you can do whatever you want (secret forks, secret collaborations, -etc). +> [GPL](LICENCE.md) requires only that if you release a binary based on Astaroth to the public, then you should also release the source code for it. In private you can do whatever you want (secret forks, secret collaborations, etc). How do I compile with MPI support? -> MPI implementation for Astaroth is still work in progress, these commands are for testing only. -Invoke CMake with `cmake -DMPI_ENABLED=ON -DBUILD_MPI_TEST=ON -DCMAKE_CXX_COMPILER=$(which mpicxx) ..`. -Otherwise the build steps are the same. Run with `mpirun -np 4 ./mpitest`. +> MPI implementation for Astaroth is still work in progress, these commands are for testing only. Invoke CMake with `cmake -DMPI_ENABLED=ON -DBUILD_MPI_TEST=ON -DCMAKE_CXX_COMPILER=$(which mpicxx) ..`. Otherwise the build steps are the same. Run with `mpirun -np 4 ./mpitest`. How do I contribute? From 5e1500fe9715669b7648bc49bcc090fe047f8815 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 21:38:07 +0200 Subject: [PATCH 13/33] Happy new year! :) --- acc/hydro_solver/stencil_defines.h | 2 +- acc/magnetic_solver/stencil_defines.h | 2 +- acc/src/code_generator.c | 2 +- acc/src/code_generator0.c | 2 +- analysis/python/astar/__init__.py | 2 +- analysis/python/astar/data/__init__.py | 2 +- analysis/python/astar/data/read.py | 2 +- analysis/python/astar/visual/__init__.py | 2 +- analysis/python/astar/visual/lineplot.py | 2 +- analysis/python/astar/visual/slices.py | 2 +- analysis/python/samples/readtest.py | 2 +- include/astaroth.h | 2 +- include/astaroth_defines.h | 2 +- include/astaroth_device.h | 2 +- include/astaroth_grid.h | 2 +- include/astaroth_node.h | 2 +- src/core/astaroth.cc | 2 +- src/core/device.cc | 2 +- src/core/errchk.h | 2 +- src/core/grid.cc | 2 +- src/core/kernels/boundconds.cu | 2 +- src/core/kernels/boundconds.cuh | 2 +- src/core/kernels/common.cuh | 2 +- src/core/kernels/deprecated/boundconds_PLACEHOLDER.cuh | 2 +- src/core/kernels/deprecated/reduce_PLACEHOLDER.cuh | 2 +- src/core/kernels/deprecated/rk3_PLACEHOLDER.cuh | 2 +- src/core/kernels/integration.cu | 2 +- src/core/kernels/integration.cuh | 2 +- src/core/kernels/reductions.cu | 2 +- src/core/kernels/reductions.cuh | 2 +- src/core/math_utils.h | 2 +- src/core/node.cc | 2 +- src/ctest/main.c | 2 +- src/exampleproject/simulation.cc | 2 +- src/mpitest/main.cc | 2 +- src/mpitest/main0.c | 2 +- src/mpitest/main1.c | 2 +- src/standalone/autotest.cc | 2 +- src/standalone/benchmark.cc | 2 +- src/standalone/config_loader.cc | 2 +- src/standalone/config_loader.h | 2 +- src/standalone/main.cc | 2 +- src/standalone/model/host_forcing.cc | 2 +- src/standalone/model/host_forcing.h | 2 +- src/standalone/model/host_memory.cc | 2 +- src/standalone/model/host_memory.h | 2 +- src/standalone/model/host_timestep.cc | 2 +- src/standalone/model/host_timestep.h | 2 +- src/standalone/model/model_boundconds.cc | 2 +- src/standalone/model/model_boundconds.h | 2 +- src/standalone/model/model_diff.h | 2 +- src/standalone/model/model_reduce.cc | 2 +- src/standalone/model/model_reduce.h | 2 +- src/standalone/model/model_rk3.cc | 2 +- src/standalone/model/model_rk3.h | 2 +- src/standalone/model/modelmesh.h | 2 +- src/standalone/renderer.cc | 2 +- src/standalone/run.h | 2 +- src/standalone/simulation.cc | 2 +- src/standalone/timer_hires.h | 2 +- src/utils/config_loader.c | 2 +- src/utils/config_loader.h | 2 +- src/utils/memory.c | 2 +- src/utils/memory.h | 2 +- src/utils/modelsolver.c | 2 +- src/utils/modelsolver.h | 2 +- src/utils/timer_hires.h | 2 +- 67 files changed, 67 insertions(+), 67 deletions(-) diff --git a/acc/hydro_solver/stencil_defines.h b/acc/hydro_solver/stencil_defines.h index 666bd10..3f1a58b 100644 --- a/acc/hydro_solver/stencil_defines.h +++ b/acc/hydro_solver/stencil_defines.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/acc/magnetic_solver/stencil_defines.h b/acc/magnetic_solver/stencil_defines.h index 48f4f3d..1b0a7cb 100644 --- a/acc/magnetic_solver/stencil_defines.h +++ b/acc/magnetic_solver/stencil_defines.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/acc/src/code_generator.c b/acc/src/code_generator.c index d327253..e49d37f 100644 --- a/acc/src/code_generator.c +++ b/acc/src/code_generator.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/acc/src/code_generator0.c b/acc/src/code_generator0.c index 6b48f1b..4df0516 100644 --- a/acc/src/code_generator0.c +++ b/acc/src/code_generator0.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/astar/__init__.py b/analysis/python/astar/__init__.py index 42c4a5b..5c8f549 100644 --- a/analysis/python/astar/__init__.py +++ b/analysis/python/astar/__init__.py @@ -1,5 +1,5 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/astar/data/__init__.py b/analysis/python/astar/data/__init__.py index 0d767d2..d25307c 100644 --- a/analysis/python/astar/data/__init__.py +++ b/analysis/python/astar/data/__init__.py @@ -1,5 +1,5 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/astar/data/read.py b/analysis/python/astar/data/read.py index 1d58545..d97d449 100644 --- a/analysis/python/astar/data/read.py +++ b/analysis/python/astar/data/read.py @@ -1,5 +1,5 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/astar/visual/__init__.py b/analysis/python/astar/visual/__init__.py index e48bf3a..4998799 100644 --- a/analysis/python/astar/visual/__init__.py +++ b/analysis/python/astar/visual/__init__.py @@ -1,5 +1,5 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/astar/visual/lineplot.py b/analysis/python/astar/visual/lineplot.py index 15afe84..d70acf4 100644 --- a/analysis/python/astar/visual/lineplot.py +++ b/analysis/python/astar/visual/lineplot.py @@ -1,5 +1,5 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/astar/visual/slices.py b/analysis/python/astar/visual/slices.py index c45fb4b..5b0aadc 100644 --- a/analysis/python/astar/visual/slices.py +++ b/analysis/python/astar/visual/slices.py @@ -1,6 +1,6 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/analysis/python/samples/readtest.py b/analysis/python/samples/readtest.py index e554207..72e5107 100644 --- a/analysis/python/samples/readtest.py +++ b/analysis/python/samples/readtest.py @@ -1,5 +1,5 @@ ''' - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/include/astaroth.h b/include/astaroth.h index 9ccdf85..fc104ae 100644 --- a/include/astaroth.h +++ b/include/astaroth.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/include/astaroth_defines.h b/include/astaroth_defines.h index f48e079..4f010db 100644 --- a/include/astaroth_defines.h +++ b/include/astaroth_defines.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/include/astaroth_device.h b/include/astaroth_device.h index c654bb8..bb9d182 100644 --- a/include/astaroth_device.h +++ b/include/astaroth_device.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/include/astaroth_grid.h b/include/astaroth_grid.h index 3fb5f8f..e41f56b 100644 --- a/include/astaroth_grid.h +++ b/include/astaroth_grid.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/include/astaroth_node.h b/include/astaroth_node.h index d1cb131..d582192 100644 --- a/include/astaroth_node.h +++ b/include/astaroth_node.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/astaroth.cc b/src/core/astaroth.cc index 659a9e0..b152f5d 100644 --- a/src/core/astaroth.cc +++ b/src/core/astaroth.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/device.cc b/src/core/device.cc index 39e6c36..a890c92 100644 --- a/src/core/device.cc +++ b/src/core/device.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/errchk.h b/src/core/errchk.h index 592289a..85106a9 100644 --- a/src/core/errchk.h +++ b/src/core/errchk.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/grid.cc b/src/core/grid.cc index 04aedfb..3e06aa9 100644 --- a/src/core/grid.cc +++ b/src/core/grid.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/boundconds.cu b/src/core/kernels/boundconds.cu index d82b38d..1bb8c91 100644 --- a/src/core/kernels/boundconds.cu +++ b/src/core/kernels/boundconds.cu @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/boundconds.cuh b/src/core/kernels/boundconds.cuh index 737c582..f4f1670 100644 --- a/src/core/kernels/boundconds.cuh +++ b/src/core/kernels/boundconds.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/common.cuh b/src/core/kernels/common.cuh index 6d23ee0..11f8649 100644 --- a/src/core/kernels/common.cuh +++ b/src/core/kernels/common.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/deprecated/boundconds_PLACEHOLDER.cuh b/src/core/kernels/deprecated/boundconds_PLACEHOLDER.cuh index 78bb873..3a93db5 100644 --- a/src/core/kernels/deprecated/boundconds_PLACEHOLDER.cuh +++ b/src/core/kernels/deprecated/boundconds_PLACEHOLDER.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/deprecated/reduce_PLACEHOLDER.cuh b/src/core/kernels/deprecated/reduce_PLACEHOLDER.cuh index c086777..a7d40e2 100644 --- a/src/core/kernels/deprecated/reduce_PLACEHOLDER.cuh +++ b/src/core/kernels/deprecated/reduce_PLACEHOLDER.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/deprecated/rk3_PLACEHOLDER.cuh b/src/core/kernels/deprecated/rk3_PLACEHOLDER.cuh index 5034fcf..94524be 100644 --- a/src/core/kernels/deprecated/rk3_PLACEHOLDER.cuh +++ b/src/core/kernels/deprecated/rk3_PLACEHOLDER.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/integration.cu b/src/core/kernels/integration.cu index e9afb58..a2377da 100644 --- a/src/core/kernels/integration.cu +++ b/src/core/kernels/integration.cu @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/integration.cuh b/src/core/kernels/integration.cuh index 8f86db7..9fb5095 100644 --- a/src/core/kernels/integration.cuh +++ b/src/core/kernels/integration.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/reductions.cu b/src/core/kernels/reductions.cu index b06dbf4..3723425 100644 --- a/src/core/kernels/reductions.cu +++ b/src/core/kernels/reductions.cu @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/kernels/reductions.cuh b/src/core/kernels/reductions.cuh index 191a1b6..7f5cf4f 100644 --- a/src/core/kernels/reductions.cuh +++ b/src/core/kernels/reductions.cuh @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/math_utils.h b/src/core/math_utils.h index 942a520..0259547 100644 --- a/src/core/math_utils.h +++ b/src/core/math_utils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/core/node.cc b/src/core/node.cc index 39c9afa..d703afe 100644 --- a/src/core/node.cc +++ b/src/core/node.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/ctest/main.c b/src/ctest/main.c index 44d3c12..5ff3fe3 100644 --- a/src/ctest/main.c +++ b/src/ctest/main.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/exampleproject/simulation.cc b/src/exampleproject/simulation.cc index 2297710..90b0230 100644 --- a/src/exampleproject/simulation.cc +++ b/src/exampleproject/simulation.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/mpitest/main.cc b/src/mpitest/main.cc index 508daca..abc0303 100644 --- a/src/mpitest/main.cc +++ b/src/mpitest/main.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/mpitest/main0.c b/src/mpitest/main0.c index 2106e16..b5487a2 100644 --- a/src/mpitest/main0.c +++ b/src/mpitest/main0.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/mpitest/main1.c b/src/mpitest/main1.c index 1c82247..7322fcd 100644 --- a/src/mpitest/main1.c +++ b/src/mpitest/main1.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/autotest.cc b/src/standalone/autotest.cc index 57ef696..7510dd4 100644 --- a/src/standalone/autotest.cc +++ b/src/standalone/autotest.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/benchmark.cc b/src/standalone/benchmark.cc index 1a44512..4e82301 100644 --- a/src/standalone/benchmark.cc +++ b/src/standalone/benchmark.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/config_loader.cc b/src/standalone/config_loader.cc index e06e2e3..4e4e5e9 100644 --- a/src/standalone/config_loader.cc +++ b/src/standalone/config_loader.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/config_loader.h b/src/standalone/config_loader.h index 5753197..5dae73f 100644 --- a/src/standalone/config_loader.h +++ b/src/standalone/config_loader.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/main.cc b/src/standalone/main.cc index 11bb455..cfaa830 100644 --- a/src/standalone/main.cc +++ b/src/standalone/main.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/host_forcing.cc b/src/standalone/model/host_forcing.cc index 1f39296..e7fe0a3 100644 --- a/src/standalone/model/host_forcing.cc +++ b/src/standalone/model/host_forcing.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/host_forcing.h b/src/standalone/model/host_forcing.h index 519c2f0..6591f52 100644 --- a/src/standalone/model/host_forcing.h +++ b/src/standalone/model/host_forcing.h @@ -1,6 +1,6 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/host_memory.cc b/src/standalone/model/host_memory.cc index f6a54cb..7377492 100644 --- a/src/standalone/model/host_memory.cc +++ b/src/standalone/model/host_memory.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/host_memory.h b/src/standalone/model/host_memory.h index b4f1a77..48b95a9 100644 --- a/src/standalone/model/host_memory.h +++ b/src/standalone/model/host_memory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/host_timestep.cc b/src/standalone/model/host_timestep.cc index fd8d0ce..671f36e 100644 --- a/src/standalone/model/host_timestep.cc +++ b/src/standalone/model/host_timestep.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/host_timestep.h b/src/standalone/model/host_timestep.h index 2e52688..dd5cdf7 100644 --- a/src/standalone/model/host_timestep.h +++ b/src/standalone/model/host_timestep.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_boundconds.cc b/src/standalone/model/model_boundconds.cc index 9490be1..03e5b88 100644 --- a/src/standalone/model/model_boundconds.cc +++ b/src/standalone/model/model_boundconds.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_boundconds.h b/src/standalone/model/model_boundconds.h index 2860b74..86ac4d1 100644 --- a/src/standalone/model/model_boundconds.h +++ b/src/standalone/model/model_boundconds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_diff.h b/src/standalone/model/model_diff.h index 303181d..eb6a31a 100644 --- a/src/standalone/model/model_diff.h +++ b/src/standalone/model/model_diff.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_reduce.cc b/src/standalone/model/model_reduce.cc index bbcfb32..78c64b8 100644 --- a/src/standalone/model/model_reduce.cc +++ b/src/standalone/model/model_reduce.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_reduce.h b/src/standalone/model/model_reduce.h index ac07d0e..acf7e11 100644 --- a/src/standalone/model/model_reduce.h +++ b/src/standalone/model/model_reduce.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_rk3.cc b/src/standalone/model/model_rk3.cc index 5fab4b4..6b38e9e 100644 --- a/src/standalone/model/model_rk3.cc +++ b/src/standalone/model/model_rk3.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/model_rk3.h b/src/standalone/model/model_rk3.h index c8036fd..1c37dc2 100644 --- a/src/standalone/model/model_rk3.h +++ b/src/standalone/model/model_rk3.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/model/modelmesh.h b/src/standalone/model/modelmesh.h index 370e7a0..6630b85 100644 --- a/src/standalone/model/modelmesh.h +++ b/src/standalone/model/modelmesh.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/renderer.cc b/src/standalone/renderer.cc index 8edefd8..c0825d8 100644 --- a/src/standalone/renderer.cc +++ b/src/standalone/renderer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/run.h b/src/standalone/run.h index 6f1b325..4b99f18 100644 --- a/src/standalone/run.h +++ b/src/standalone/run.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/simulation.cc b/src/standalone/simulation.cc index f1644da..df1b1a4 100644 --- a/src/standalone/simulation.cc +++ b/src/standalone/simulation.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/standalone/timer_hires.h b/src/standalone/timer_hires.h index 52b5633..6d475eb 100644 --- a/src/standalone/timer_hires.h +++ b/src/standalone/timer_hires.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/config_loader.c b/src/utils/config_loader.c index 39f7b62..6c6340c 100644 --- a/src/utils/config_loader.c +++ b/src/utils/config_loader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/config_loader.h b/src/utils/config_loader.h index e12f13a..4757d2c 100644 --- a/src/utils/config_loader.h +++ b/src/utils/config_loader.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/memory.c b/src/utils/memory.c index be22775..530b0c0 100644 --- a/src/utils/memory.c +++ b/src/utils/memory.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/memory.h b/src/utils/memory.h index 6c3409d..73a3317 100644 --- a/src/utils/memory.h +++ b/src/utils/memory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/modelsolver.c b/src/utils/modelsolver.c index 4e6f0d1..eb0db56 100644 --- a/src/utils/modelsolver.c +++ b/src/utils/modelsolver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/modelsolver.h b/src/utils/modelsolver.h index fbb1142..66847a2 100644 --- a/src/utils/modelsolver.h +++ b/src/utils/modelsolver.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. diff --git a/src/utils/timer_hires.h b/src/utils/timer_hires.h index 52b5633..6d475eb 100644 --- a/src/utils/timer_hires.h +++ b/src/utils/timer_hires.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. This file is part of Astaroth. From ae0163b0e57f27e120fd8c2f7cd74a5e79570916 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Mon, 13 Jan 2020 21:52:58 +0200 Subject: [PATCH 14/33] Missed one --- .../API_specification_and_user_manual.md | 139 +----------------- 1 file changed, 8 insertions(+), 131 deletions(-) diff --git a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md index 6f03032..fe77ce9 100644 --- a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md +++ b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md @@ -3,7 +3,7 @@ Astaroth Specification and User Manual # Astaroth Specification and User Manual -Copyright (C) 2014-2019, Johannes Pekkila, Miikka Vaisala. +Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. Astaroth is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -509,7 +509,7 @@ In addition to basic datatypes in C/C++/CUDA, such as int and int3, we provide t ## Precision -`Scalars` are 32-bit floating-point numbers by default. Double precision can be turned on by setting cmake option `DOUBLE_PRECISION=ON`. +`Scalars` are 32-bit floating-point numbers by default. Double precision can be turned on by setting cmake option `DOUBLE_PRECISION=ON`. All real number literals are converted automatically to the correct precision. In cases where , the precision can be declared explicitly by appending `f` or `d` postfix to the real number. For example, ```C 1.0 // The same precision as Scalar/AcReal @@ -544,7 +544,7 @@ if (a) { Kernels are small programs executed on the device. Each kernel comprises of all the pipeline stages discussed in previous sections. Functions qualified with the type qualifier `Kernel` are analogous -to `main` functions of host code. +to `main` functions of host code. Kernels must be declared in stencil processing files. DSL kernels can be called from host code using the API function @@ -580,22 +580,22 @@ The type qualifier `Device` indicates which functions can be called from `Kernel `Uniform`s are global device variables which stay constant for the duration of a kernel launch. `Uniform`s can be updated between kernel launches using the `acLoadScalarUniform` and related functions -discussed in Section 'Loading and storing'. +discussed in Section 'Loading and storing'. `Uniform`s are declared in stencil definition headers. The header must be included in all files -which use those uniforms. +which use those uniforms. `Uniform`s can be of type `Scalar`, `Vector`, `int`, `int3`, `ScalarField` and `ScalarArray`. > Note: As of 2019-10-01, the types `ScalarField` (DSL) and `VertexBuffer` (CUDA) are aliases of the -same type. This naming may be changed in the future. +same type. This naming may be changed in the future. > Note: As of 2019-10-01, ScalarFields cannot be declared as uniforms. Instead, one should declare each component as a `ScalarField` and use them to construct a `VectorField` during the stencil processing stage. For example, `in VectorField(A, B, C);`, where `A`, `B` and `C` are `uniform ScalarField`s. -> Note: As of 2019-10-01, `uniform`s cannot be assigned values in the stencil definition headers. +> Note: As of 2019-10-01, `uniform`s cannot be assigned values in the stencil definition headers. Instead, one should load the appropriate values during runtime using the `acLoadScalarUniform` and related functions. @@ -614,129 +614,6 @@ Astaroth DSL libraries can be included in the same way as C/C++ headers. For exa Uniforms are as fast as compile-time constants as long as -1. The halting condition of a tight loop does not depend on an uniform or a variable, as this would prevent unrolling of the loop during compile-time. +1. The halting condition of a tight loop does not depend on an uniform or a variable, as this would prevent unrolling of the loop during compile-time. 2. Uniforms are not multiplied with each other. The result should be stored in an auxiliary uniform instead. For example, the result of `nx * ny` should be stored in a new `uniform nxy` 3. At least 32 neighboring streams in the x-axis access the same `uniform`. That is, the vertices at vertexIdx.x = i... i + 32 should access the same `uniform` where i is a multiple of 32. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 185b33980f91938812ebdf6a551ea97143fd4917 Mon Sep 17 00:00:00 2001 From: Miikka Vaisala Date: Tue, 14 Jan 2020 13:58:11 +0800 Subject: [PATCH 15/33] Forcing function bug correction. --- acc/mhd_solver/stencil_kernel.ac | 2 +- config/astaroth.conf | 3 ++- src/standalone/model/host_forcing.cc | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/acc/mhd_solver/stencil_kernel.ac b/acc/mhd_solver/stencil_kernel.ac index 1fe57a9..f1c5cf4 100644 --- a/acc/mhd_solver/stencil_kernel.ac +++ b/acc/mhd_solver/stencil_kernel.ac @@ -607,7 +607,7 @@ forcing(int3 globalVertexIdx, Scalar dt) Vector force = helical_forcing(magnitude, k_force, xx, ff_re, ff_im, phase); // Scaling N = magnitude*cs*sqrt(k*cs/dt) * dt - const Scalar NN = cs * sqrt(AC_kaver * cs); + const Scalar NN = cs * magnitude * sqrt(AC_kaver * cs); // MV: Like in the Pencil Code. I don't understandf the logic here. force.x = sqrt(dt) * NN * force.x; force.y = sqrt(dt) * NN * force.y; diff --git a/config/astaroth.conf b/config/astaroth.conf index 8da72e0..abc1613 100644 --- a/config/astaroth.conf +++ b/config/astaroth.conf @@ -48,7 +48,8 @@ AC_relhel = 0.0 AC_forcing_magnitude = 1e-5 AC_kmin = 0.8 AC_kmax = 1.2 - +// Switches forcing off and accretion on +AC_switch_accretion = 0 // Entropy AC_cp_sound = 1.0 diff --git a/src/standalone/model/host_forcing.cc b/src/standalone/model/host_forcing.cc index e7fe0a3..7b4458e 100644 --- a/src/standalone/model/host_forcing.cc +++ b/src/standalone/model/host_forcing.cc @@ -171,11 +171,14 @@ helical_forcing_special_vector(AcReal3* ff_hel_re, AcReal3* ff_hel_im, const AcR // k_cross_k_cross_e.z/denominator}; // See PC forcing.f90 forcing_hel_both() - *ff_hel_re = (AcReal3){kabs * k_cross_e.x / denominator, kabs * k_cross_e.y, - kabs * k_cross_e.z}; + *ff_hel_im = (AcReal3){kabs * k_cross_e.x / denominator, + kabs * k_cross_e.y / denominator, + kabs * k_cross_e.z / denominator}; + + *ff_hel_re = (AcReal3){relhel * k_cross_k_cross_e.x / denominator, + relhel * k_cross_k_cross_e.y / denominator, + relhel * k_cross_k_cross_e.z / denominator}; - *ff_hel_im = (AcReal3){relhel * k_cross_k_cross_e.x / denominator, relhel * k_cross_k_cross_e.y, - relhel * k_cross_k_cross_e.z}; } // Tool for loading forcing vector information into the device memory From d947bdccb8b83256e9d651c32bf7c7c8b571285d Mon Sep 17 00:00:00 2001 From: Miikka Vaisala Date: Tue, 14 Jan 2020 14:23:24 +0800 Subject: [PATCH 16/33] General purpose Python tool improvements. --- analysis/python/astar/data/read.py | 115 ++++++++++++++++++++--- analysis/python/astar/visual/lineplot.py | 28 +++++- analysis/python/astar/visual/slices.py | 55 ++++++----- 3 files changed, 162 insertions(+), 36 deletions(-) diff --git a/analysis/python/astar/data/read.py b/analysis/python/astar/data/read.py index d97d449..9b2b820 100644 --- a/analysis/python/astar/data/read.py +++ b/analysis/python/astar/data/read.py @@ -21,6 +21,12 @@ import numpy as np +#Optional YT interface +try: + import yt + yt_present = True +except ImportError: + yt_present = False def set_dtype(endian, AcRealSize): if endian == 0: @@ -55,7 +61,8 @@ def read_bin(fname, fdir, fnum, minfo, numtype=np.longdouble): return array, timestamp, read_ok -def read_meshtxt(fdir, fname): +def read_meshtxt(fdir, fname, dbg_output): + with open(fdir+fname) as f: filetext = f.read().splitlines() @@ -65,30 +72,33 @@ def read_meshtxt(fdir, fname): line = line.split() if line[0] == 'int': contents[line[1]] = np.int(line[2]) - print(line[1], contents[line[1]]) + if dbg_output: + print(line[1], contents[line[1]]) elif line[0] == 'size_t': contents[line[1]] = np.int(line[2]) - print(line[1], contents[line[1]]) + if dbg_output: + print(line[1], contents[line[1]]) elif line[0] == 'int3': contents[line[1]] = [np.int(line[2]), np.int(line[3]), np.int(line[4])] - print(line[1], contents[line[1]]) + if dbg_output: + print(line[1], contents[line[1]]) elif line[0] == 'real': contents[line[1]] = np.float(line[2]) - print(line[1], contents[line[1]]) + if dbg_output: + print(line[1], contents[line[1]]) elif line[0] == 'real3': contents[line[1]] = [np.float(line[2]), np.float(line[3]), np.float(line[4])] - print(line[1], contents[line[1]]) + if dbg_output: + print(line[1], contents[line[1]]) else: print(line) print('ERROR: ' + line[0] +' not recognized!') return contents -#Now just 2nd order def DERX(array, dx): output = np.zeros_like(array) for i in range(3, array.shape[0]-3): #Keep boundary poits as 0 - #output[i,:,:] = (- array[i-1,:,:] + array[i+1,:,:])/(2.0*dx) output[i,:,:] =( -45.0*array[i-1,:,:] + 45.0*array[i+1,:,:] + 9.0*array[i-2,:,:] - 9.0*array[i+2,:,:] - array[i-3,:,:] + array[i+3,:,:] )/(60.0*dx) @@ -97,7 +107,6 @@ def DERX(array, dx): def DERY(array, dy): output = np.zeros_like(array) for i in range(3,array.shape[1]-3): - #output[:,i,:] = (- array[:,i-1,:] + array[:,i+1,:])/(2.0*dy) output[:,i,:] =( -45.0*array[:,i-1,:] + 45.0*array[:,i+1,:] + 9.0*array[:,i-2,:] - 9.0*array[:,i+2,:] - array[:,i-3,:] + array[:,i+3,:] )/(60.0*dy) @@ -106,7 +115,6 @@ def DERY(array, dy): def DERZ(array, dz): output = np.zeros_like(array) for i in range(3, array.shape[2]-3): - #output[:,:,i] = (- array[:,:,i-1] + array[:,:,i+1])/(2.0*dz) output[:,:,i] =( -45.0*array[:,:,i-1] + 45.0*array[:,:,i+1] + 9.0*array[:,:,i-2] - 9.0*array[:,:,i+2] - array[:,:,i-3] + array[:,:,i+3] )/(60.0*dz) @@ -124,8 +132,8 @@ def curl(aa, minfo): class MeshInfo(): '''Object that contains all mesh info''' - def __init__(self, fdir): - self.contents = read_meshtxt(fdir, 'mesh_info.list') + def __init__(self, fdir, dbg_output=False): + self.contents = read_meshtxt(fdir, 'mesh_info.list', dbg_output) class Mesh: '''Class tha contains all 3d mesh data''' @@ -176,9 +184,88 @@ class Mesh: self.xmid = int(self.minfo.contents['AC_mx']/2) self.ymid = int(self.minfo.contents['AC_my']/2) self.zmid = int(self.minfo.contents['AC_mz']/2) - def Bfield(self): + def Bfield(self, get_jj = False): self.bb = curl(self.aa, self.minfo) - print(self.bb[2]) + if get_jj: + self.jj = curl(self.bb, self.minfo) + + def yt_conversion(self): + if yt_present: + self.ytdict = dict(density = (np.exp(self.lnrho)*self.minfo.contents['AC_unit_density'], "g/cm**3"), + uux = (self.uu[0]*self.minfo.contents['AC_unit_velocity'], "cm/s"), + uuy = (self.uu[1]*self.minfo.contents['AC_unit_velocity'], "cm/s"), + uuz = (self.uu[2]*self.minfo.contents['AC_unit_velocity'], "cm/s"), + bbx = (self.bb[0]*self.minfo.contents['AC_unit_magnetic'], "gauss"), + bby = (self.bb[1]*self.minfo.contents['AC_unit_magnetic'], "gauss"), + bbz = (self.bb[2]*self.minfo.contents['AC_unit_magnetic'], "gauss"), + ) + bbox = self.minfo.contents['AC_unit_length'] \ + *np.array([[self.xx.min(), self.xx.max()], [self.yy.min(), self.yy.max()], [self.zz.min(), self.zz.max()]]) + self.ytdata = yt.load_uniform_grid(self.ytdict, self.lnrho.shape, length_unit="cm", bbox=bbox) + else: + print("ERROR. No YT support found!") + + def export_csv(self): + csvfile = open("grid.csv.%s" % self.framenum, "w") + csvfile.write("xx, yy, zz, rho, uux, uuy, uuz, bbx, bby, bbz\n") + ul = self.minfo.contents['AC_unit_length'] + uv = self.minfo.contents['AC_unit_velocity'] + ud = self.minfo.contents['AC_unit_density'] + um = self.minfo.contents['AC_unit_magnetic'] + for kk in np.arange(3, self.zz.size-3): + for jj in np.arange(3, self.yy.size-3): + for ii in np.arange(3, self.xx.size-3): + #print(self.xx.size, self.yy.size, self.zz.size) + linestring = "%e, %e, %e, %e, %e, %e, %e, %e, %e, %e\n"% (self.xx[ii]*ul, self.yy[jj]*ul, self.zz[kk]*ul, + np.exp(self.lnrho[ii, jj, kk])*ud, + self.uu[0][ii, jj, kk]*uv, self.uu[1][ii, jj, kk]*uv, + self.uu[2][ii, jj, kk]*uv, + self.bb[0][ii, jj, kk]*um, self.bb[1][ii, jj, kk]*um, + self.bb[2][ii, jj, kk]*um) + csvfile.write(linestring) + csvfile.close() + + def export_raw(self): + uv = self.minfo.contents['AC_unit_velocity'] + ud = self.minfo.contents['AC_unit_density'] + um = self.minfo.contents['AC_unit_magnetic'] + print(self.lnrho.shape, set_dtype(self.minfo.contents['endian'], self.minfo.contents['AcRealSize'])) + + f = open("rho%s.raw" % self.framenum, 'w+b') + binary_format =(np.exp(self.lnrho)*ud).tobytes() + f.write(binary_format) + f.close() + + f = open("uux%s.raw" % self.framenum, 'w+b') + binary_format =(self.uu[0]*uv).tobytes() + f.write(binary_format) + f.close() + + f = open("uuy%s.raw" % self.framenum, 'w+b') + binary_format =(self.uu[1]*uv).tobytes() + f.write(binary_format) + f.close() + + f = open("uuz%s.raw" % self.framenum, 'w+b') + binary_format =(self.uu[2]*uv).tobytes() + f.write(binary_format) + f.close() + + f = open("bbx%s.raw" % self.framenum, 'w+b') + binary_format =(self.bb[0]*um).tobytes() + f.write(binary_format) + f.close() + + f = open("bby%s.raw" % self.framenum, 'w+b') + binary_format =(self.bb[1]*um).tobytes() + f.write(binary_format) + f.close() + + f = open("bbz%s.raw" % self.framenum, 'w+b') + binary_format =(self.bb[2]*um).tobytes() + f.write(binary_format) + f.close() + def parse_ts(fdir, fname): diff --git a/analysis/python/astar/visual/lineplot.py b/analysis/python/astar/visual/lineplot.py index d70acf4..e793a6f 100644 --- a/analysis/python/astar/visual/lineplot.py +++ b/analysis/python/astar/visual/lineplot.py @@ -37,7 +37,9 @@ def plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3): plt.close() def plot_ts(ts, isotherm=False, show_all=False, lnrho=False, uutot=False, - uux=False, uuy=False, uuz=False, ss=False, acc=False, sink=False): + uux=False, uuy=False, uuz=False, + aax=False, aay=False, aaz=False, + ss=False, acc=False, sink=False, rho=False): if show_all: lnrho=True @@ -108,6 +110,30 @@ def plot_ts(ts, isotherm=False, show_all=False, lnrho=False, uutot=False, yaxis2 = 'uuz_min' yaxis3 = 'uuz_max' plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3) + + if aax: + plt.figure() + xaxis = 't_step' + yaxis1 = 'aax_rms' + yaxis2 = 'aax_min' + yaxis3 = 'aax_max' + plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3) + + if aay: + plt.figure() + xaxis = 't_step' + yaxis1 = 'aay_rms' + yaxis2 = 'aay_min' + yaxis3 = 'aay_max' + plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3) + + if aaz: + plt.figure() + xaxis = 't_step' + yaxis1 = 'aaz_rms' + yaxis2 = 'aaz_min' + yaxis3 = 'aaz_max' + plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3) if ss: plt.figure() diff --git a/analysis/python/astar/visual/slices.py b/analysis/python/astar/visual/slices.py index 5b0aadc..4d95ce8 100644 --- a/analysis/python/astar/visual/slices.py +++ b/analysis/python/astar/visual/slices.py @@ -26,7 +26,8 @@ CM_INFERNO = plt.get_cmap('inferno') def plot_3(mesh, input_grid, title = '', fname = 'default', bitmap=False, slicetype = 'middle', colrange=None, colormap=CM_INFERNO , - contourplot=False, points_from_centre = -1, bfieldlines=False, velfieldlines=False): + contourplot=False, points_from_centre = -1, bfieldlines=False, velfieldlines=False, trimghost = 0): + fig = plt.figure(figsize=(8, 8)) grid = gridspec.GridSpec(2, 3, wspace=0.4, hspace=0.4, width_ratios=[1,1, 0.15]) ax00 = fig.add_subplot( grid[0,0] ) @@ -40,21 +41,30 @@ def plot_3(mesh, input_grid, title = '', fname = 'default', bitmap=False, yz_slice = input_grid[mesh.xmid, :, :] xz_slice = input_grid[:, mesh.ymid, :] xy_slice = input_grid[:, :, mesh.zmid] - if colrange==None: - plotnorm = colors.Normalize(vmin=input_grid.min(),vmax=input_grid.max()) - else: - plotnorm = colors.Normalize(vmin=colrange[0],vmax=colrange[1]) elif slicetype == 'sum': yz_slice = np.sum(input_grid, axis=0) xz_slice = np.sum(input_grid, axis=1) xy_slice = np.sum(input_grid, axis=2) - cmin = np.amin([yz_slice.min(), xz_slice.min(), xy_slice.min()]) - cmax = np.amax([yz_slice.max(), xz_slice.max(), xy_slice.max()]) - if colrange==None: - plotnorm = colors.Normalize(vmin=cmin,vmax=cmax) - else: - plotnorm = colors.Normalize(vmin=colrange[0],vmax=colrange[1]) - + + yz_slice = yz_slice[trimghost : yz_slice.shape[0]-trimghost, + trimghost : yz_slice.shape[1]-trimghost] + xz_slice = xz_slice[trimghost : xz_slice.shape[0]-trimghost, + trimghost : xz_slice.shape[1]-trimghost] + xy_slice = xy_slice[trimghost : xy_slice.shape[0]-trimghost, + trimghost : xy_slice.shape[1]-trimghost] + mesh_xx_tmp = mesh.xx[trimghost : mesh.xx.shape[0]-trimghost] + mesh_yy_tmp = mesh.yy[trimghost : mesh.yy.shape[0]-trimghost] + mesh_zz_tmp = mesh.zz[trimghost : mesh.zz.shape[0]-trimghost] + + #Set the coulourscale + cmin = np.amin([yz_slice.min(), xz_slice.min(), xy_slice.min()]) + cmax = np.amax([yz_slice.max(), xz_slice.max(), xy_slice.max()]) + if colrange==None: + plotnorm = colors.Normalize(vmin=cmin,vmax=cmax) + else: + plotnorm = colors.Normalize(vmin=colrange[0],vmax=colrange[1]) + + if points_from_centre > 0: yz_slice = yz_slice[int(yz_slice.shape[0]/2)-points_from_centre : int(yz_slice.shape[0]/2)+points_from_centre, int(yz_slice.shape[1]/2)-points_from_centre : int(yz_slice.shape[1]/2)+points_from_centre] @@ -62,11 +72,11 @@ def plot_3(mesh, input_grid, title = '', fname = 'default', bitmap=False, int(xz_slice.shape[1]/2)-points_from_centre : int(xz_slice.shape[1]/2)+points_from_centre] xy_slice = xy_slice[int(xy_slice.shape[0]/2)-points_from_centre : int(xy_slice.shape[0]/2)+points_from_centre, int(xy_slice.shape[1]/2)-points_from_centre : int(xy_slice.shape[1]/2)+points_from_centre] - mesh.xx = mesh.xx[int(mesh.xx.shape[0]/2)-points_from_centre : int(mesh.xx.shape[0]/2)+points_from_centre] - mesh.yy = mesh.yy[int(mesh.yy.shape[0]/2)-points_from_centre : int(mesh.yy.shape[0]/2)+points_from_centre] - mesh.zz = mesh.zz[int(mesh.zz.shape[0]/2)-points_from_centre : int(mesh.zz.shape[0]/2)+points_from_centre] + mesh_xx_tmp = mesh.xx[int(mesh.xx.shape[0]/2)-points_from_centre : int(mesh.xx.shape[0]/2)+points_from_centre] + mesh_yy_tmp = mesh.yy[int(mesh.yy.shape[0]/2)-points_from_centre : int(mesh.yy.shape[0]/2)+points_from_centre] + mesh_zz_tmp = mesh.zz[int(mesh.zz.shape[0]/2)-points_from_centre : int(mesh.zz.shape[0]/2)+points_from_centre] - yy, zz = np.meshgrid(mesh.yy, mesh.zz, indexing='ij') + yy, zz = np.meshgrid(mesh_xx_tmp, mesh_xx_tmp, indexing='ij') if contourplot: map1 = ax00.contourf(yy, zz, yz_slice, norm=plotnorm, cmap=colormap, nlev=10) else: @@ -76,9 +86,10 @@ def plot_3(mesh, input_grid, title = '', fname = 'default', bitmap=False, ax00.set_title('%s t = %.4e' % (title, mesh.timestamp) ) ax00.set_aspect('equal') - ax00.contour(yy, zz, np.sqrt((yy-yy.max()/2.0)**2.0 + (zz-zz.max()/2.0)**2.0), [mesh.minfo.contents["AC_accretion_range"]]) + if mesh.minfo.contents["AC_accretion_range"] > 0.0: + ax00.contour(yy, zz, np.sqrt((yy-yy.max()/2.0)**2.0 + (zz-zz.max()/2.0)**2.0), [mesh.minfo.contents["AC_accretion_range"]]) - xx, zz = np.meshgrid(mesh.xx, mesh.zz, indexing='ij') + xx, zz = np.meshgrid(mesh_xx_tmp, mesh_zz_tmp, indexing='ij') if contourplot: ax10.contourf(xx, zz, xz_slice, norm=plotnorm, cmap=colormap, nlev=10) else: @@ -87,9 +98,10 @@ def plot_3(mesh, input_grid, title = '', fname = 'default', bitmap=False, ax10.set_ylabel('z') ax10.set_aspect('equal') - ax10.contour(xx, zz, np.sqrt((xx-xx.max()/2.0)**2.0 + (zz-zz.max()/2.0)**2.0), [mesh.minfo.contents["AC_accretion_range"]]) + if mesh.minfo.contents["AC_accretion_range"] > 0.0: + ax10.contour(xx, zz, np.sqrt((xx-xx.max()/2.0)**2.0 + (zz-zz.max()/2.0)**2.0), [mesh.minfo.contents["AC_accretion_range"]]) - xx, yy = np.meshgrid(mesh.xx, mesh.yy, indexing='ij') + xx, yy = np.meshgrid(mesh_xx_tmp, mesh_yy_tmp, indexing='ij') if contourplot: ax11.contourf(xx, yy, xy_slice, norm=plotnorm, cmap=colormap, nlev=10) else: @@ -98,7 +110,8 @@ def plot_3(mesh, input_grid, title = '', fname = 'default', bitmap=False, ax11.set_ylabel('y') ax11.set_aspect('equal') - ax11.contour(xx, yy, np.sqrt((xx-xx.max()/2.0)**2.0 + (yy-yy.max()/2.0)**2.0), [mesh.minfo.contents["AC_accretion_range"]]) + if mesh.minfo.contents["AC_accretion_range"] > 0.0: + ax11.contour(xx, yy, np.sqrt((xx-xx.max()/2.0)**2.0 + (yy-yy.max()/2.0)**2.0), [mesh.minfo.contents["AC_accretion_range"]]) if bfieldlines: ax00.streamplot(mesh.yy, mesh.zz, np.mean(mesh.bb[1], axis=0), np.mean(mesh.bb[2], axis=0)) From 37cafd26aa767929a4c6d2ab3076ceb9ad0be80a Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 14:44:06 +0200 Subject: [PATCH 17/33] Various small improvements to the website (navigation panel, better headings, formatting, etc) --- CONTRIBUTING.md | 3 - README.md | 7 +- .../API_specification_and_user_manual.md | 92 +++++++----------- doc/astaroth_logo_small.png | Bin 0 -> 1565 bytes doxyfile | 10 +- include/astaroth_device.h | 7 ++ 6 files changed, 47 insertions(+), 72 deletions(-) create mode 100644 doc/astaroth_logo_small.png diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 411f8c8..7b7f524 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,3 @@ -Contributing -============ - # Contributing Contributions to Astaroth are very welcome! diff --git a/README.md b/README.md index 1d4fe76..827882e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,4 @@ -Astaroth Documentation {#mainpage} -============ - -![Astaroth Sigil](doc/astaroth_logo.svg) - -# Astaroth - A Multi-GPU Library for Generic Stencil Computations +# Astaroth - A Multi-GPU Library for Generic Stencil Computations {#mainpage} [Specification](doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md) | [Contributing](CONTRIBUTING.md) | [Licence](LICENCE.md) | [Issue Tracker](https://bitbucket.org/jpekkila/astaroth/issues?status=new&status=open) | [Wiki](https://bitbucket.org/jpekkila/astaroth/wiki/Home) diff --git a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md index fe77ce9..eb955d0 100644 --- a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md +++ b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md @@ -1,6 +1,3 @@ -Astaroth Specification and User Manual -============ - # Astaroth Specification and User Manual Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. @@ -52,17 +49,17 @@ usable via the Astaroth API. While the Astaroth library is written in C++/CUDA, the C99 standard. -# Publications +## Publications The foundational work was done in (Väisälä, Pekkilä, 2017) and the library, API and DSL described in this document were introduced in (Pekkilä, 2019). We kindly wish the users of Astaroth to cite to these publications in their work. -> J. Pekkilä, Astaroth: A Library for Stencil Computations on Graphics Processing Units. Master's thesis, Aalto University School of Science, Espoo, Finland, 2019. +> [J. Pekkilä, Astaroth: A Library for Stencil Computations on Graphics Processing Units. Master's thesis, Aalto University School of Science, Espoo, Finland, 2019.](http://urn.fi/URN:NBN:fi:aalto-201906233993) -> M. S. Väisälä, Magnetic Phenomena of the Interstellar Medium in Theory and Observation. PhD thesis, University of Helsinki, Finland, 2017. +> [M. S. Väisälä, Magnetic Phenomena of the Interstellar Medium in Theory and Observation. PhD thesis, University of Helsinki, Finland, 2017.](http://urn.fi/URN:ISBN:978-951-51-2778-5) -> J. Pekkilä, M. S. Väisälä, M. Käpylä, P. J. Käpylä, and O. Anjum, “Methods for compressible fluid simulation on GPUs using high-order finite differences, ”Computer Physics Communications, vol. 217, pp. 11–22, Aug. 2017. +> [J. Pekkilä, M. S. Väisälä, M. Käpylä, P. J. Käpylä, and O. Anjum, “Methods for compressible fluid simulation on GPUs using high-order finite differences, ”Computer Physics Communications, vol. 217, pp. 11–22, Aug. 2017.](https://doi.org/10.1016/j.cpc.2017.03.011) @@ -218,9 +215,10 @@ AcResult acDeviceLoadMeshInfo(const Device device, const Stream stream, const AcMeshInfo device_config); ``` +### Integration, Reductions and Boundary Conditions -### Computation - +The library provides the following functions for integration, reductions and computing periodic +boundary conditions. ```C AcResult acDeviceIntegrateSubstep(const Device device, const Stream stream, const int step_number, const int3 start, const int3 end, const AcReal dt); @@ -248,7 +246,16 @@ AcResult acNodeReduceVec(const Node node, const Stream stream_type, const Reduct const VertexBufferHandle vtxbuf2, AcReal* result); ``` -### Stream Synchronization +Finally, there's a library function that is automatically generated for all user-specified `Kernel` +functions written with the Astaroth DSL, +```C +AcResult acDeviceKernel_##identifier(const Device device, const Stream stream, + const int3 start, const int3 end); +``` +Where `##identifier` is replaced with the name of the user-specified kernel. For example, a device +function `Kernel solve()` can be called with `acDeviceKernel_solve()` via the API. + +## Stream Synchronization All library functions that take a `Stream` as a parameter are asynchronous. When calling these functions, control returns immediately back to the host even if the called device function has not @@ -270,13 +277,20 @@ synchronized at once by passing the alias `STREAM_ALL` to the synchronization fu Usage of streams is demonstrated with the following example. ```C funcA(STREAM_0); -funcB(STREAM_0); // Blocks until funcA has completed -funcC(STREAM_1); // May execute in parallel with funcB +funcB(STREAM_0); // Blocks until funcA has completed +funcC(STREAM_1); // May execute in parallel with funcB barrierSynchronizeStream(STREAM_ALL); // Blocks until functions in all streams have completed -funcD(STREAM_2); // Is started when command returns from synchronizeStream() +funcD(STREAM_2); // Is started when command returns from synchronizeStream() ``` -### Data Synchronization +Astaroth API provides the following functions for barrier synchronization. +```C +AcResult acSynchronize(void); +AcResult acNodeSynchronizeStream(const Node node, const Stream stream); +AcResult acDeviceSynchronizeStream(const Device device, const Stream stream); +``` + +## Data Synchronization Stream synchronization works in the same fashion on node and device layers. However on the node layer, one has to take in account that a portion of the mesh is shared between devices and that the @@ -296,7 +310,7 @@ AcResult acNodeSynchronizeVertexBuffer(const Node node, const Stream stream, > **NOTE**: Local halos must be up to date before synchronizing the data. Local halos are the grid points outside the computational domain which are used only by a single device. The mesh is distributed to multiple devices by blocking along the z axis. If there are *n* devices and the z-dimension of the computational domain is *nz*, then each device is assigned *nz / n* two-dimensional planes. For example with two devices, the data block that has to be up to date ranges from *(0, 0, nz)* to *(mx, my, nz + 2 * NGHOST)*. -### Input and Output Buffers +## Input and Output Buffers The mesh is duplicated to input and output buffers for performance reasons. The input buffers are read-only in user-specified compute kernels, which allows us to read them via the texture cache @@ -357,14 +371,14 @@ Meshes are the primary structures for passing information to the library and ker of a `Mesh` is declared as ```C typedef struct { - int int_params[NUM_INT_PARAMS]; - int3 int3_params[NUM_INT3_PARAMS]; - AcReal real_params[NUM_REAL_PARAMS]; + int int_params[NUM_INT_PARAMS]; + int3 int3_params[NUM_INT3_PARAMS]; + AcReal real_params[NUM_REAL_PARAMS]; AcReal3 real3_params[NUM_REAL3_PARAMS]; } AcMeshInfo; typedef struct { - AcReal* vertex_buffer[NUM_VTXBUF_HANDLES]; + AcReal* vertex_buffer[NUM_VTXBUF_HANDLES]; AcMeshInfo info; } AcMesh; ``` @@ -415,45 +429,7 @@ Let *i* be the device id. The portion of the halos shared by neighboring devices `acNodeSynchronizeVertexBuffer` and `acNodeSynchronizeMesh` communicate these shared areas among the devices in the node. -## Integration, Reductions and Boundary Conditions - -The library provides the following functions for integration, reductions and computing periodic -boundary conditions. -```C -AcResult acDeviceIntegrateSubstep(const Device device, const Stream stream, const int step_number, - const int3 start, const int3 end, const AcReal dt); -AcResult acDevicePeriodicBoundcondStep(const Device device, const Stream stream, - const VertexBufferHandle vtxbuf_handle, const int3 start, - const int3 end); -AcResult acDevicePeriodicBoundconds(const Device device, const Stream stream, const int3 start, - const int3 end); -AcResult acDeviceReduceScal(const Device device, const Stream stream, const ReductionType rtype, - const VertexBufferHandle vtxbuf_handle, AcReal* result); -AcResult acDeviceReduceVec(const Device device, const Stream stream_type, const ReductionType rtype, - const VertexBufferHandle vtxbuf0, const VertexBufferHandle vtxbuf1, - const VertexBufferHandle vtxbuf2, AcReal* result); - -AcResult acNodeIntegrateSubstep(const Node node, const Stream stream, const int step_number, - const int3 start, const int3 end, const AcReal dt); -AcResult acNodeIntegrate(const Node node, const AcReal dt); -AcResult acNodePeriodicBoundcondStep(const Node node, const Stream stream, - const VertexBufferHandle vtxbuf_handle); -AcResult acNodePeriodicBoundconds(const Node node, const Stream stream); -AcResult acNodeReduceScal(const Node node, const Stream stream, const ReductionType rtype, - const VertexBufferHandle vtxbuf_handle, AcReal* result); -AcResult acNodeReduceVec(const Node node, const Stream stream_type, const ReductionType rtype, - const VertexBufferHandle vtxbuf0, const VertexBufferHandle vtxbuf1, - const VertexBufferHandle vtxbuf2, AcReal* result); -``` - -Finally, there's a library function that is automatically generated for all user-specified `Kernel` -functions written with the Astaroth DSL, -```C -AcResult acDeviceKernel_##identifier(const Device device, const Stream stream, - const int3 start, const int3 end); -``` -Where `##identifier` is replaced with the name of the user-specified kernel. For example, a device -function `Kernel solve()` can be called with `acDeviceKernel_solve()` via the API. +> **NOTE:** The decomposition scheme is subject to change. # Astaroth Domain-Specific Language diff --git a/doc/astaroth_logo_small.png b/doc/astaroth_logo_small.png new file mode 100644 index 0000000000000000000000000000000000000000..8bd3616dfb381d1bceccdcd2bd8e00e4ac94d6dd GIT binary patch literal 1565 zcmV+&2IBdNP)EX>4Tx04R}tkv&MmP!xqvQ>CI+2Rn#3WT;Lph!%0wDionYs1;guFnQ@8G-*gu zTpR`0f`dPcRR6lU)@9ukc|2eTX3z=x)?xH-)yYJ8HS92Bvd?N8IGfbO!gLrz= zHaPDShgeZoiO-26CS8#Dk?V@fZ=4HF7Intq8~3b{&P zw!>l~*KK$>Qiya5gl zf$;)muY0_^r*m%q_O#~r1Dc_7w`(JC-T(jq24YJ`L;(K){{a7>y{D4^000SaNLh0L z01ejw01ejxLMWSf00007bV*G`2jl?`3pF$oZgf=u00bFHL_t(&-tC%CY*a-Y$3L^| zQi`<=hayD|Rpd|h9rV%=Pb5a-!K8@?51x!3)OeA`DoEPxYaxLqB&8e(9zZcMO*CGN zCpmF68x1CIW57U-SpK|_X8+g*7T+y-D= zO`;6kuq5|WU^5_q7l1e7cJ4Y*RPT$bZ3EYUF(vOg;B8BC-&gXIz&*8d4h{~F31X!K z#$@^@V7n$@+847YV+Z-12M%aoF5>fU>=2nAmhh4GX?|SH?pw)RldD*e?ZA#oLn3?t8x=0j@AAv^N(CP(|Kg1H!6@5n)0^+Q@MU5`?Yp)xe3Wb5}wh%WX45q)S0C_ zbE`v1nPSB-@A%T&rgxZ_$SsAEpt_=hrHs)BxFe9-v843al~c}Rsup~`Z4!A?@6*+t z$`1ozejXz16SMOSyKUmx<| z#lc{4i&q`9c_9}hfBn8LzbqBXbD^ZOnOq=fkZk+F^JeV|Ae z69?*&V8JClK!=h*cOC$2@v^)$I8bRWUM5TayMbkaUSBjrZWG?+0`QbJ-(sA%{8K$Q z0lz%~mUlgFzRk|u(i3*PmR1ty;#j1Mb>lt3P;&+bK^ z;Ve$;0l8Et&k4k!A?in8rnlBAaWUDTqW|AZo-VzD7D$$5_dcDvhYcm2rt|P+dTV_p zUZWhGS-LaVGLEH(P4){CnHCjvOZF>7OzNg635#RWJF1y`z9qB$u*yXgcZ~^7kT})` zOVyJ7GMz`Hm>kjmdjmM>%+j5?#+a|q3EN_V1EU@bT369BFYCw5mfcp3P% zRVdg1+ys8NST$7Q>8MJtZUKXq$)13T0t?uemZ5y~x#4An$pQyGC zl+~hDNZG&RcJ8V&pAMo+Zno}HT~Ybuo4`@vV~cV>Q%dc`xY*|4um. */ +/** + * @file Single-Device Interface + * \brief Provides functions for controlling a single device. + * + * Detailed info. + * + */ #pragma once #ifdef __cplusplus From 25180c00b3f1d878965b9bd743a8411545b481bc Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 15:25:50 +0200 Subject: [PATCH 18/33] Formatting fixes --- .../API_specification_and_user_manual.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md index eb955d0..c2037e5 100644 --- a/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md +++ b/doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md @@ -563,17 +563,11 @@ which use those uniforms. `Uniform`s can be of type `Scalar`, `Vector`, `int`, `int3`, `ScalarField` and `ScalarArray`. -> Note: As of 2019-10-01, the types `ScalarField` (DSL) and `VertexBuffer` (CUDA) are aliases of the -same type. This naming may be changed in the future. +> Note: As of 2019-10-01, the types `ScalarField` (DSL) and `VertexBuffer` (CUDA) are aliases of the same type. This naming may be changed in the future. -> Note: As of 2019-10-01, ScalarFields cannot be declared as uniforms. Instead, one should declare -each component as a `ScalarField` and use them to construct a `VectorField` during the stencil -processing stage. For example, `in VectorField(A, B, C);`, where `A`, `B` and `C` are -`uniform ScalarField`s. +> Note: As of 2019-10-01, `VectorField`s cannot be declared as uniforms. Instead, one should declare each component as a `ScalarField` and use them to construct a `VectorField` during the stencil processing stage. For example, `in VectorField(A, B, C);`, where `A`, `B` and `C` are `uniform ScalarField`s. -> Note: As of 2019-10-01, `uniform`s cannot be assigned values in the stencil definition headers. -Instead, one should load the appropriate values during runtime using the `acLoadScalarUniform` and -related functions. +> Note: As of 2019-10-01, `uniform`s cannot be assigned values in the stencil definition headers. Instead, one should load the appropriate values during runtime using the `acLoadScalarUniform` and related functions. ## Standard Libraries From 8dbeb9b654f67836502c5b32c82576ffe368ad66 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 21:37:56 +0200 Subject: [PATCH 19/33] Rewrote acc/README.md --- acc/README.md | 57 ++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/acc/README.md b/acc/README.md index 467b63b..8d2f587 100644 --- a/acc/README.md +++ b/acc/README.md @@ -1,45 +1,36 @@ -Astaroth DSL compiler -============ +# ACC - Astaroth Code Compiler -# Dependencies -## Debian/Ubuntu -`apt install flex bison build-essential` +ACC is a source-to-source compiler for generating CUDA kernels from programs written in Astaroth Code (AC). This document focuses on how to build and run the compiler. For detailed description of code generation and compilation phases, we refer the reader to [J. Pekkilä, Astaroth: A Library for Stencil Computations on Graphics Processing Units. 2019.](http://urn.fi/URN:NBN:fi:aalto-201906233993), Section 4.3. We refer the reader to [Specification](doc/Astaroth_API_specification_and_user_manual/API_specification_and_user_manual.md) for a detailed description of AC syntax. -# Usage -* `./build_acc.sh # Builds the ASPL compiler (acc)` -* `./compile.sh <.sps or .sas source> # Compiles the given stage into CUDA` -* `./test.sh # Tries to compile the sample stages` -* `./clean.sh # Removed directories generated by build_acc.sh and test.sh` +ACC is automatically compiled and invoked when compiling the Astaroth Library, user intervention is not needed. The instructions presented in this file are only for developers looking to debug the AC compiler. -## Example +## Dependencies -- `./compile.sh src/stencil_assembly.sas # Generates stencil_assembly.cuh` -- `./compile.sh src/stencil_process.sps # Generates stencil_process.cuh` +`gcc flex bison` -# What happens under the hood +## Building -The compiler is made of a scanner (flex), parser (bison), implementation of the abstract syntax tree (AST) and a code generator. -The language is defined by tokens and grammars found in acc.l and acc.y. These files are given as input to flex and bison, which generate the scanning and parsing stages for the compiler. The resulting AST is defined in ast.h. Finally, we traverse the generated AST with our code generator, generating CUDA code. +1. `mkdir build` +2. `cd build` +3. `cmake ..` +4. `make -j` -## ACC compilation stages +## Usage -### In short: -* Preprocess .ac -* Compile preprocessed .ac to .cuh -* Compile .cuh +Script `compile_acc_module.sh` executes all compilation stages from preprocessing to linking AC standard libraries. The resulting cuda headers are placed in the current working directory. The script should be invoked as follows. -### More detailed: -0. A Parser is generated: bison --verbose -d acc.y -0. A Scanner is generated: flex acc.l -0. The compiler is built: gcc -std=gnu11 code_generator.c acc.tab.c lex.yy.c -lfl -0. Source files (.sps and .sas) are preprocessed using the GCC preprocessor and cleaned from any residual directives which would be useful when compiling the code further with GCC. We do not need those when compiling with ACC and are not recognized by our grammar. -0. Either the stencil processing stage (.sps) or the stencil assembly stage (.sas) are generated by passing the preprocessed file to acc. This emits the final CUDA code. -0. Compilation is continued with the NVIDIA CUDA compiler +> `./compile_acc_module ` -### Even more detailed: -The NVIDIA CUDA compiler compiles .cuh to .fatbin, which is embedded into a C++ binary containig host code of the program. A fatbin contains .cubin files, which contain the configuration of the GPU and the kernels in a streaming assembly code (.sass). We could also compile for a virtual architecture (.ptx) instead of the actual hardware-specific machine code (.cubin) by passing -code=compute_XX flag to nvcc, which would compile cuda sources at runtime (just-in-time compilation, JIT) when creating the CUDA context. However, we alway know which architecture we want to run the code on and JIT compilation would just increase the time to takes to launch the program. +For preprocessing only, see `preprocess.sh`. The first parameter is regarded as the AC source file, while rest of the parameters are passed to gcc. For example: -nvcc -DAC_DOUBLE_PRECISION=1 -ptx --relocatable-device-code true -O3 -std=c++11 --maxrregcount=255 -ftz=true -gencode arch=compute_60,code=sm_60 device.cu -I ../../include -I ../../ -nvcc -DAC_DOUBLE_PRECISION=1 -cubin --relocatable-device-code true -O3 -std=c++11 --maxrregcount=255 -ftz=true -gencode arch=compute_60,code=sm_60 device.cu -I ../../include -I ../../ -cuobjdump --dump-sass device.cubin > device.sass +> `./preprocess.sh file.ac -I dir` + +Preprocesses `file.ac` and searches `dir` for files to be included. + +For invoking the code generator, pass preprocessed files that respect AC syntax to `acc`. + +For example: +> `acc < file.ac.preprocessed` + +See [Building](#markdown-header-building) on how to obtain `acc`. From 0676d277611920daa8a800e462cc5042984a91ec Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 21:44:27 +0200 Subject: [PATCH 20/33] Moved compile_acc_module.sh from scripts to the acc directory --- {scripts => acc}/compile_acc_module.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {scripts => acc}/compile_acc_module.sh (100%) diff --git a/scripts/compile_acc_module.sh b/acc/compile_acc_module.sh similarity index 100% rename from scripts/compile_acc_module.sh rename to acc/compile_acc_module.sh From 74cbcf390e1e4c4d9dab85ac6d0924ce95139955 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 21:56:00 +0200 Subject: [PATCH 21/33] Removed deprecated unused files --- acc/build_acc.sh | 25 - acc/clean.sh | 5 - acc/compile.sh | 28 - acc/hydro_solver/stencil_defines.h | 163 ---- acc/magnetic_solver/stencil_defines.h | 163 ---- .../stencil_assembly.sas | 75 -- .../stencil_definition.sdh | 137 ---- acc/mhd_solver_DEPRECATED/stencil_process.sps | 504 ------------- acc/src/code_generator0.c | 705 ------------------ acc/test_grammar.sh | 48 -- acc/test_solver/stencil_assembly.sas | 36 - acc/test_solver/stencil_definition.sdh | 18 - acc/test_solver/stencil_process.sps | 18 - scripts/compile_acc.sh | 82 -- scripts/preprocess_device_files.sh | 1 - 15 files changed, 2008 deletions(-) delete mode 100755 acc/build_acc.sh delete mode 100755 acc/clean.sh delete mode 100755 acc/compile.sh delete mode 100644 acc/hydro_solver/stencil_defines.h delete mode 100644 acc/magnetic_solver/stencil_defines.h delete mode 100644 acc/mhd_solver_DEPRECATED/stencil_assembly.sas delete mode 100644 acc/mhd_solver_DEPRECATED/stencil_definition.sdh delete mode 100644 acc/mhd_solver_DEPRECATED/stencil_process.sps delete mode 100644 acc/src/code_generator0.c delete mode 100755 acc/test_grammar.sh delete mode 100644 acc/test_solver/stencil_assembly.sas delete mode 100644 acc/test_solver/stencil_definition.sdh delete mode 100644 acc/test_solver/stencil_process.sps delete mode 100755 scripts/compile_acc.sh delete mode 100755 scripts/preprocess_device_files.sh diff --git a/acc/build_acc.sh b/acc/build_acc.sh deleted file mode 100755 index 6bcab28..0000000 --- a/acc/build_acc.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -cd `dirname $0` # Only operate in the same directory with this script - -COMPILER_NAME="acc" - -SRC_DIR=${PWD}/src -BUILD_DIR=${PWD}/build - -echo "-- Compiling acc:" ${BUILD_DIR} - -mkdir -p ${BUILD_DIR} -cd ${BUILD_DIR} - -#echo ${BASE_DIR} -#echo ${SRC_DIR} -#echo ${BUILD_DIR} - -# Generate Bison headers -bison --verbose -d ${SRC_DIR}/${COMPILER_NAME}.y - -## Generate Flex sources and headers -flex ${SRC_DIR}/${COMPILER_NAME}.l - -## Compile the ASPL compiler -gcc -std=gnu11 ${SRC_DIR}/code_generator.c ${COMPILER_NAME}.tab.c lex.yy.c -lfl -I ${BUILD_DIR} -I ${SRC_DIR} -o ${COMPILER_NAME} diff --git a/acc/clean.sh b/acc/clean.sh deleted file mode 100755 index ad012c4..0000000 --- a/acc/clean.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cd `dirname $0` # Only operate in the same directory with this script - -rm -rf build testbin - diff --git a/acc/compile.sh b/acc/compile.sh deleted file mode 100755 index 9f93b93..0000000 --- a/acc/compile.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# Usage ./compile -ACC_DIR=`dirname $0` -ACC_BINARY=$1 - -FULL_NAME=$(basename -- $2) -FILENAME="${FULL_NAME%.*}" -EXTENSION="${FULL_NAME##*.}" - -if [ "${EXTENSION}" = "sas" ]; then - COMPILE_FLAGS="-sas" # Generate stencil assembly stage - CUH_FILENAME="stencil_assembly.cuh" - echo "-- Generating stencil assembly stage: ${FILENAME}.sas -> ${CUH_FILENAME}" -elif [ "${EXTENSION}" = "sps" ]; then - COMPILE_FLAGS="-sps" # Generate stencil processing stage - CUH_FILENAME="stencil_process.cuh" - echo "-- Generating stencil processing stage: ${FILENAME}.sps -> ${CUH_FILENAME}" -elif [ "${EXTENSION}" = "sdh" ]; then - COMPILE_FLAGS="-sdh" # Generate stencil definition header - CUH_FILENAME="stencil_defines.h" - echo "-- Generating stencil definition header: ${FILENAME}.sdh -> ${CUH_FILENAME}" -else - echo "-- Error: unknown extension" ${EXTENSION} "of file" ${FULL_NAME} - echo "-- Extension should be either .sas, .sps or .sdh" - exit -fi - -${ACC_DIR}/preprocess.sh ${@:2} | ${ACC_BINARY} ${COMPILE_FLAGS} > ${CUH_FILENAME} diff --git a/acc/hydro_solver/stencil_defines.h b/acc/hydro_solver/stencil_defines.h deleted file mode 100644 index 3f1a58b..0000000 --- a/acc/hydro_solver/stencil_defines.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. - - This file is part of Astaroth. - - Astaroth is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Astaroth is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Astaroth. If not, see . -*/ -#pragma once - -/* - * ============================================================================= - * Logical switches - * ============================================================================= - */ -#define STENCIL_ORDER (6) -#define NGHOST (STENCIL_ORDER / 2) -#define LDENSITY (1) -#define LHYDRO (1) -#define LMAGNETIC (0) -#define LENTROPY (0) -#define LTEMPERATURE (0) -#define LFORCING (0) -#define LUPWD (0) - -#define AC_THERMAL_CONDUCTIVITY (AcReal(0.001)) // TODO: make an actual config parameter - -/* - * ============================================================================= - * User-defined parameters - * ============================================================================= - */ -// clang-format off -#define AC_FOR_USER_INT_PARAM_TYPES(FUNC)\ - /* Other */\ - FUNC(AC_max_steps), \ - FUNC(AC_save_steps), \ - FUNC(AC_bin_steps), \ - FUNC(AC_bc_type), - -#define AC_FOR_USER_INT3_PARAM_TYPES(FUNC) - -#define AC_FOR_USER_REAL_PARAM_TYPES(FUNC)\ - /* cparams */\ - FUNC(AC_dsx), \ - FUNC(AC_dsy), \ - FUNC(AC_dsz), \ - FUNC(AC_dsmin), \ - /* physical grid*/\ - FUNC(AC_xlen), \ - FUNC(AC_ylen), \ - FUNC(AC_zlen), \ - FUNC(AC_xorig), \ - FUNC(AC_yorig), \ - FUNC(AC_zorig), \ - /*Physical units*/\ - FUNC(AC_unit_density),\ - FUNC(AC_unit_velocity),\ - FUNC(AC_unit_length),\ - /* properties of gravitating star*/\ - FUNC(AC_star_pos_x),\ - FUNC(AC_star_pos_y),\ - FUNC(AC_star_pos_z),\ - FUNC(AC_M_star),\ - /* Run params */\ - FUNC(AC_cdt), \ - FUNC(AC_cdtv), \ - FUNC(AC_cdts), \ - FUNC(AC_nu_visc), \ - FUNC(AC_cs_sound), \ - FUNC(AC_eta), \ - FUNC(AC_mu0), \ - FUNC(AC_cp_sound), \ - FUNC(AC_gamma), \ - FUNC(AC_cv_sound), \ - FUNC(AC_lnT0), \ - FUNC(AC_lnrho0), \ - FUNC(AC_zeta), \ - FUNC(AC_trans),\ - /* Other */\ - FUNC(AC_bin_save_t), \ - /* Initial condition params */\ - FUNC(AC_ampl_lnrho), \ - FUNC(AC_ampl_uu), \ - FUNC(AC_angl_uu), \ - FUNC(AC_lnrho_edge),\ - FUNC(AC_lnrho_out),\ - /* Forcing parameters. User configured. */\ - FUNC(AC_forcing_magnitude),\ - FUNC(AC_relhel), \ - FUNC(AC_kmin), \ - FUNC(AC_kmax), \ - /* Forcing parameters. Set by the generator. */\ - FUNC(AC_forcing_phase),\ - FUNC(AC_k_forcex),\ - FUNC(AC_k_forcey),\ - FUNC(AC_k_forcez),\ - FUNC(AC_kaver),\ - FUNC(AC_ff_hel_rex),\ - FUNC(AC_ff_hel_rey),\ - FUNC(AC_ff_hel_rez),\ - FUNC(AC_ff_hel_imx),\ - FUNC(AC_ff_hel_imy),\ - FUNC(AC_ff_hel_imz),\ - /* Additional helper params */\ - /* (deduced from other params do not set these directly!) */\ - FUNC(AC_G_CONST),\ - FUNC(AC_GM_star),\ - FUNC(AC_sq2GM_star),\ - FUNC(AC_cs2_sound), \ - FUNC(AC_inv_dsx), \ - FUNC(AC_inv_dsy), \ - FUNC(AC_inv_dsz), - -#define AC_FOR_USER_REAL3_PARAM_TYPES(FUNC) -// clang-format on - -/* - * ============================================================================= - * User-defined vertex buffers - * ============================================================================= - */ -// clang-format off -#if LENTROPY -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), \ - FUNC(VTXBUF_UUX), \ - FUNC(VTXBUF_UUY), \ - FUNC(VTXBUF_UUZ), \ - FUNC(VTXBUF_AX), \ - FUNC(VTXBUF_AY), \ - FUNC(VTXBUF_AZ), \ - FUNC(VTXBUF_ENTROPY), -#elif LMAGNETIC -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), \ - FUNC(VTXBUF_UUX), \ - FUNC(VTXBUF_UUY), \ - FUNC(VTXBUF_UUZ), \ - FUNC(VTXBUF_AX), \ - FUNC(VTXBUF_AY), \ - FUNC(VTXBUF_AZ), -#elif LHYDRO -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), \ - FUNC(VTXBUF_UUX), \ - FUNC(VTXBUF_UUY), \ - FUNC(VTXBUF_UUZ), -#else -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), -#endif -// clang-format on diff --git a/acc/magnetic_solver/stencil_defines.h b/acc/magnetic_solver/stencil_defines.h deleted file mode 100644 index 1b0a7cb..0000000 --- a/acc/magnetic_solver/stencil_defines.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. - - This file is part of Astaroth. - - Astaroth is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Astaroth is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Astaroth. If not, see . -*/ -#pragma once - -/* - * ============================================================================= - * Logical switches - * ============================================================================= - */ -#define STENCIL_ORDER (6) -#define NGHOST (STENCIL_ORDER / 2) -#define LDENSITY (1) -#define LHYDRO (1) -#define LMAGNETIC (1) -#define LENTROPY (0) -#define LTEMPERATURE (0) -#define LFORCING (0) -#define LUPWD (0) - -#define AC_THERMAL_CONDUCTIVITY (AcReal(0.001)) // TODO: make an actual config parameter - -/* - * ============================================================================= - * User-defined parameters - * ============================================================================= - */ -// clang-format off -#define AC_FOR_USER_INT_PARAM_TYPES(FUNC)\ - /* Other */\ - FUNC(AC_max_steps), \ - FUNC(AC_save_steps), \ - FUNC(AC_bin_steps), \ - FUNC(AC_bc_type), - -#define AC_FOR_USER_INT3_PARAM_TYPES(FUNC) - -#define AC_FOR_USER_REAL_PARAM_TYPES(FUNC)\ - /* cparams */\ - FUNC(AC_dsx), \ - FUNC(AC_dsy), \ - FUNC(AC_dsz), \ - FUNC(AC_dsmin), \ - /* physical grid*/\ - FUNC(AC_xlen), \ - FUNC(AC_ylen), \ - FUNC(AC_zlen), \ - FUNC(AC_xorig), \ - FUNC(AC_yorig), \ - FUNC(AC_zorig), \ - /*Physical units*/\ - FUNC(AC_unit_density),\ - FUNC(AC_unit_velocity),\ - FUNC(AC_unit_length),\ - /* properties of gravitating star*/\ - FUNC(AC_star_pos_x),\ - FUNC(AC_star_pos_y),\ - FUNC(AC_star_pos_z),\ - FUNC(AC_M_star),\ - /* Run params */\ - FUNC(AC_cdt), \ - FUNC(AC_cdtv), \ - FUNC(AC_cdts), \ - FUNC(AC_nu_visc), \ - FUNC(AC_cs_sound), \ - FUNC(AC_eta), \ - FUNC(AC_mu0), \ - FUNC(AC_cp_sound), \ - FUNC(AC_gamma), \ - FUNC(AC_cv_sound), \ - FUNC(AC_lnT0), \ - FUNC(AC_lnrho0), \ - FUNC(AC_zeta), \ - FUNC(AC_trans),\ - /* Other */\ - FUNC(AC_bin_save_t), \ - /* Initial condition params */\ - FUNC(AC_ampl_lnrho), \ - FUNC(AC_ampl_uu), \ - FUNC(AC_angl_uu), \ - FUNC(AC_lnrho_edge),\ - FUNC(AC_lnrho_out),\ - /* Forcing parameters. User configured. */\ - FUNC(AC_forcing_magnitude),\ - FUNC(AC_relhel), \ - FUNC(AC_kmin), \ - FUNC(AC_kmax), \ - /* Forcing parameters. Set by the generator. */\ - FUNC(AC_forcing_phase),\ - FUNC(AC_k_forcex),\ - FUNC(AC_k_forcey),\ - FUNC(AC_k_forcez),\ - FUNC(AC_kaver),\ - FUNC(AC_ff_hel_rex),\ - FUNC(AC_ff_hel_rey),\ - FUNC(AC_ff_hel_rez),\ - FUNC(AC_ff_hel_imx),\ - FUNC(AC_ff_hel_imy),\ - FUNC(AC_ff_hel_imz),\ - /* Additional helper params */\ - /* (deduced from other params do not set these directly!) */\ - FUNC(AC_G_CONST),\ - FUNC(AC_GM_star),\ - FUNC(AC_sq2GM_star),\ - FUNC(AC_cs2_sound), \ - FUNC(AC_inv_dsx), \ - FUNC(AC_inv_dsy), \ - FUNC(AC_inv_dsz), - -#define AC_FOR_USER_REAL3_PARAM_TYPES(FUNC) -// clang-format on - -/* - * ============================================================================= - * User-defined vertex buffers - * ============================================================================= - */ -// clang-format off -#if LENTROPY -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), \ - FUNC(VTXBUF_UUX), \ - FUNC(VTXBUF_UUY), \ - FUNC(VTXBUF_UUZ), \ - FUNC(VTXBUF_AX), \ - FUNC(VTXBUF_AY), \ - FUNC(VTXBUF_AZ), \ - FUNC(VTXBUF_ENTROPY), -#elif LMAGNETIC -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), \ - FUNC(VTXBUF_UUX), \ - FUNC(VTXBUF_UUY), \ - FUNC(VTXBUF_UUZ), \ - FUNC(VTXBUF_AX), \ - FUNC(VTXBUF_AY), \ - FUNC(VTXBUF_AZ), -#elif LHYDRO -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), \ - FUNC(VTXBUF_UUX), \ - FUNC(VTXBUF_UUY), \ - FUNC(VTXBUF_UUZ), -#else -#define AC_FOR_VTXBUF_HANDLES(FUNC) \ - FUNC(VTXBUF_LNRHO), -#endif -// clang-format on diff --git a/acc/mhd_solver_DEPRECATED/stencil_assembly.sas b/acc/mhd_solver_DEPRECATED/stencil_assembly.sas deleted file mode 100644 index 85886e6..0000000 --- a/acc/mhd_solver_DEPRECATED/stencil_assembly.sas +++ /dev/null @@ -1,75 +0,0 @@ -#include "stencil_definition.sdh" - -Preprocessed Scalar -value(in ScalarField vertex) -{ - return vertex[vertexIdx]; -} - -Preprocessed Vector -gradient(in ScalarField vertex) -{ - return (Vector){derx(vertexIdx, vertex), dery(vertexIdx, vertex), derz(vertexIdx, vertex)}; -} - -#if LUPWD - -Preprocessed Scalar -der6x_upwd(in ScalarField vertex) -{ - Scalar inv_ds = AC_inv_dsx; - - return (Scalar){Scalar(1.0 / 60.0) * inv_ds * - (-Scalar(20.0) * vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z] + - Scalar(15.0) * (vertex[vertexIdx.x + 1, vertexIdx.y, vertexIdx.z] + - vertex[vertexIdx.x - 1, vertexIdx.y, vertexIdx.z]) - - Scalar(6.0) * (vertex[vertexIdx.x + 2, vertexIdx.y, vertexIdx.z] + - vertex[vertexIdx.x - 2, vertexIdx.y, vertexIdx.z]) + - vertex[vertexIdx.x + 3, vertexIdx.y, vertexIdx.z] + - vertex[vertexIdx.x - 3, vertexIdx.y, vertexIdx.z])}; -} - -Preprocessed Scalar -der6y_upwd(in ScalarField vertex) -{ - Scalar inv_ds = AC_inv_dsy; - - return (Scalar){Scalar(1.0 / 60.0) * inv_ds * - (-Scalar(20.0) * vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z] + - Scalar(15.0) * (vertex[vertexIdx.x, vertexIdx.y + 1, vertexIdx.z] + - vertex[vertexIdx.x, vertexIdx.y - 1, vertexIdx.z]) - - Scalar(6.0) * (vertex[vertexIdx.x, vertexIdx.y + 2, vertexIdx.z] + - vertex[vertexIdx.x, vertexIdx.y - 2, vertexIdx.z]) + - vertex[vertexIdx.x, vertexIdx.y + 3, vertexIdx.z] + - vertex[vertexIdx.x, vertexIdx.y - 3, vertexIdx.z])}; -} - -Preprocessed Scalar -der6z_upwd(in ScalarField vertex) -{ - Scalar inv_ds = AC_inv_dsz; - - return (Scalar){Scalar(1.0 / 60.0) * inv_ds * - (-Scalar(20.0) * vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z] + - Scalar(15.0) * (vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z + 1] + - vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z - 1]) - - Scalar(6.0) * (vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z + 2] + - vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z - 2]) + - vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z + 3] + - vertex[vertexIdx.x, vertexIdx.y, vertexIdx.z - 3])}; -} - -#endif - -Preprocessed Matrix -hessian(in ScalarField vertex) -{ - Matrix hessian; - - hessian.row[0] = (Vector){derxx(vertexIdx, vertex), derxy(vertexIdx, vertex), - derxz(vertexIdx, vertex)}; - hessian.row[1] = (Vector){hessian.row[0].y, deryy(vertexIdx, vertex), deryz(vertexIdx, vertex)}; - hessian.row[2] = (Vector){hessian.row[0].z, hessian.row[1].z, derzz(vertexIdx, vertex)}; - - return hessian; -} diff --git a/acc/mhd_solver_DEPRECATED/stencil_definition.sdh b/acc/mhd_solver_DEPRECATED/stencil_definition.sdh deleted file mode 100644 index 47ea8ab..0000000 --- a/acc/mhd_solver_DEPRECATED/stencil_definition.sdh +++ /dev/null @@ -1,137 +0,0 @@ -#define LDENSITY (1) -#define LHYDRO (1) -#define LMAGNETIC (1) -#define LENTROPY (1) -#define LTEMPERATURE (0) -#define LFORCING (1) -#define LUPWD (1) -#define LSINK (0) - -#define AC_THERMAL_CONDUCTIVITY (AcReal(0.001)) // TODO: make an actual config parameter - -// Int params -uniform int AC_max_steps; -uniform int AC_save_steps; -uniform int AC_bin_steps; -uniform int AC_bc_type; -uniform int AC_start_step; - -// Real params -uniform Scalar AC_dt; -uniform Scalar AC_max_time; -// Spacing -uniform Scalar AC_dsx; -uniform Scalar AC_dsy; -uniform Scalar AC_dsz; -uniform Scalar AC_dsmin; -// physical grid -uniform Scalar AC_xlen; -uniform Scalar AC_ylen; -uniform Scalar AC_zlen; -uniform Scalar AC_xorig; -uniform Scalar AC_yorig; -uniform Scalar AC_zorig; -// Physical units -uniform Scalar AC_unit_density; -uniform Scalar AC_unit_velocity; -uniform Scalar AC_unit_length; -// properties of gravitating star -uniform Scalar AC_star_pos_x; -uniform Scalar AC_star_pos_y; -uniform Scalar AC_star_pos_z; -uniform Scalar AC_M_star; -// properties of sink particle -uniform Scalar AC_sink_pos_x; -uniform Scalar AC_sink_pos_y; -uniform Scalar AC_sink_pos_z; -uniform Scalar AC_M_sink; -uniform Scalar AC_M_sink_init; -uniform Scalar AC_M_sink_Msun; -uniform Scalar AC_soft; -uniform Scalar AC_accretion_range; -uniform Scalar AC_switch_accretion; -// Run params -uniform Scalar AC_cdt; -uniform Scalar AC_cdtv; -uniform Scalar AC_cdts; -uniform Scalar AC_nu_visc; -uniform Scalar AC_cs_sound; -uniform Scalar AC_eta; -uniform Scalar AC_mu0; -uniform Scalar AC_cp_sound; -uniform Scalar AC_gamma; -uniform Scalar AC_cv_sound; -uniform Scalar AC_lnT0; -uniform Scalar AC_lnrho0; -uniform Scalar AC_zeta; -uniform Scalar AC_trans; -// Other -uniform Scalar AC_bin_save_t; -// Initial condition params -uniform Scalar AC_ampl_lnrho; -uniform Scalar AC_ampl_uu; -uniform Scalar AC_angl_uu; -uniform Scalar AC_lnrho_edge; -uniform Scalar AC_lnrho_out; -// Forcing parameters. User configured. -uniform Scalar AC_forcing_magnitude; -uniform Scalar AC_relhel; -uniform Scalar AC_kmin; -uniform Scalar AC_kmax; -// Forcing parameters. Set by the generator. -uniform Scalar AC_forcing_phase; -uniform Scalar AC_k_forcex; -uniform Scalar AC_k_forcey; -uniform Scalar AC_k_forcez; -uniform Scalar AC_kaver; -uniform Scalar AC_ff_hel_rex; -uniform Scalar AC_ff_hel_rey; -uniform Scalar AC_ff_hel_rez; -uniform Scalar AC_ff_hel_imx; -uniform Scalar AC_ff_hel_imy; -uniform Scalar AC_ff_hel_imz; -// Additional helper params // (deduced from other params do not set these directly!) -uniform Scalar AC_G_const; -uniform Scalar AC_GM_star; -uniform Scalar AC_unit_mass; -uniform Scalar AC_sq2GM_star; -uniform Scalar AC_cs2_sound; -uniform Scalar AC_inv_dsx; -uniform Scalar AC_inv_dsy; -uniform Scalar AC_inv_dsz; - -/* - * ============================================================================= - * User-defined vertex buffers - * ============================================================================= - */ -#if LENTROPY -uniform ScalarField VTXBUF_LNRHO; -uniform ScalarField VTXBUF_UUX; -uniform ScalarField VTXBUF_UUY; -uniform ScalarField VTXBUF_UUZ; -uniform ScalarField VTXBUF_AX; -uniform ScalarField VTXBUF_AY; -uniform ScalarField VTXBUF_AZ; -uniform ScalarField VTXBUF_ENTROPY; -#elif LMAGNETIC -uniform ScalarField VTXBUF_LNRHO; -uniform ScalarField VTXBUF_UUX; -uniform ScalarField VTXBUF_UUY; -uniform ScalarField VTXBUF_UUZ; -uniform ScalarField VTXBUF_AX; -uniform ScalarField VTXBUF_AY; -uniform ScalarField VTXBUF_AZ; -#elif LHYDRO -uniform ScalarField VTXBUF_LNRHO; -uniform ScalarField VTXBUF_UUX; -uniform ScalarField VTXBUF_UUY; -uniform ScalarField VTXBUF_UUZ; -#else -uniform ScalarField VTXBUF_LNRHO; -#endif - -#if LSINK -uniform ScalarField VTXBUF_ACCRETION; -#endif - diff --git a/acc/mhd_solver_DEPRECATED/stencil_process.sps b/acc/mhd_solver_DEPRECATED/stencil_process.sps deleted file mode 100644 index 417c85d..0000000 --- a/acc/mhd_solver_DEPRECATED/stencil_process.sps +++ /dev/null @@ -1,504 +0,0 @@ -#include "stencil_definition.sdh" - -Vector -value(in VectorField uu) -{ - return (Vector){value(uu.x), value(uu.y), value(uu.z)}; -} - -#if LUPWD -Scalar -upwd_der6(in VectorField uu, in ScalarField lnrho) -{ - Scalar uux = fabs(value(uu).x); - Scalar uuy = fabs(value(uu).y); - Scalar uuz = fabs(value(uu).z); - return (Scalar){uux * der6x_upwd(lnrho) + uuy * der6y_upwd(lnrho) + uuz * der6z_upwd(lnrho)}; -} -#endif - -Matrix -gradients(in VectorField uu) -{ - return (Matrix){gradient(uu.x), gradient(uu.y), gradient(uu.z)}; -} - -#if LSINK -Vector -sink_gravity(int3 globalVertexIdx){ - int accretion_switch = int(AC_switch_accretion); - if (accretion_switch == 1){ - Vector force_gravity; - const Vector grid_pos = (Vector){(globalVertexIdx.x - DCONST(AC_nx_min)) * AC_dsx, - (globalVertexIdx.y - DCONST(AC_ny_min)) * AC_dsy, - (globalVertexIdx.z - DCONST(AC_nz_min)) * AC_dsz}; - const Scalar sink_mass = AC_M_sink; - const Vector sink_pos = (Vector){AC_sink_pos_x, - AC_sink_pos_y, - AC_sink_pos_z}; - const Scalar distance = length(grid_pos - sink_pos); - const Scalar soft = AC_soft; - //MV: The commit 083ff59 had AC_G_const defined wrong here in DSL making it exxessively strong. - //MV: Scalar gravity_magnitude = ... below is correct! - const Scalar gravity_magnitude = (AC_G_const * sink_mass) / pow(((distance * distance) + soft*soft), 1.5); - const Vector direction = (Vector){(sink_pos.x - grid_pos.x) / distance, - (sink_pos.y - grid_pos.y) / distance, - (sink_pos.z - grid_pos.z) / distance}; - force_gravity = gravity_magnitude * direction; - return force_gravity; - } else { - return (Vector){0.0, 0.0, 0.0}; - } -} -#endif - - -#if LSINK -// Give Truelove density -Scalar -truelove_density(in ScalarField lnrho){ - const Scalar rho = exp(value(lnrho)); - const Scalar Jeans_length_squared = (M_PI * AC_cs2_sound) / (AC_G_const * rho); - const Scalar TJ_rho = ((M_PI) * ((AC_dsx * AC_dsx) / Jeans_length_squared) * AC_cs2_sound) / (AC_G_const * AC_dsx * AC_dsx); - //TODO: AC_dsx will cancel out, deal with it later for optimization. - - Scalar accretion_rho = TJ_rho; - - return accretion_rho; -} - -// This controls accretion of density/mass to the sink particle. -Scalar -sink_accretion(int3 globalVertexIdx, in ScalarField lnrho, Scalar dt){ - const Vector grid_pos = (Vector){(globalVertexIdx.x - DCONST(AC_nx_min)) * AC_dsx, - (globalVertexIdx.y - DCONST(AC_ny_min)) * AC_dsy, - (globalVertexIdx.z - DCONST(AC_nz_min)) * AC_dsz}; - const Vector sink_pos = (Vector){AC_sink_pos_x, - AC_sink_pos_y, - AC_sink_pos_z}; - const Scalar profile_range = AC_accretion_range; - const Scalar accretion_distance = length(grid_pos - sink_pos); - int accretion_switch = AC_switch_accretion; - Scalar accretion_density; - Scalar weight; - - if (accretion_switch == 1){ - if ((accretion_distance) <= profile_range){ - //weight = Scalar(1.0); - //Hann window function - Scalar window_ratio = accretion_distance/profile_range; - weight = Scalar(0.5)*(Scalar(1.0) - cos(Scalar(2.0)*M_PI*window_ratio)); - } else { - weight = Scalar(0.0); - } - - //Truelove criterion is used as a kind of arbitrary density floor. - const Scalar lnrho_min = log(truelove_density(lnrho)); - Scalar rate; - if (value(lnrho) > lnrho_min) { - rate = (exp(value(lnrho)) - exp(lnrho_min)) / dt; - } else { - rate = Scalar(0.0); - } - accretion_density = weight * rate ; - } else { - accretion_density = Scalar(0.0); - } - return accretion_density; -} - -// This controls accretion of velocity to the sink particle. -Vector -sink_accretion_velocity(int3 globalVertexIdx, in VectorField uu, Scalar dt) { - const Vector grid_pos = (Vector){(globalVertexIdx.x - DCONST(AC_nx_min)) * AC_dsx, - (globalVertexIdx.y - DCONST(AC_ny_min)) * AC_dsy, - (globalVertexIdx.z - DCONST(AC_nz_min)) * AC_dsz}; - const Vector sink_pos = (Vector){AC_sink_pos_x, - AC_sink_pos_y, - AC_sink_pos_z}; - const Scalar profile_range = AC_accretion_range; - const Scalar accretion_distance = length(grid_pos - sink_pos); - int accretion_switch = AC_switch_accretion; - Vector accretion_velocity; - - if (accretion_switch == 1){ - Scalar weight; - // Step function weighting - // Arch of a cosine function? - // Cubic spline x^3 - x in range [-0.5 , 0.5] - if ((accretion_distance) <= profile_range){ - //weight = Scalar(1.0); - //Hann window function - Scalar window_ratio = accretion_distance/profile_range; - weight = Scalar(0.5)*(Scalar(1.0) - cos(Scalar(2.0)*M_PI*window_ratio)); - } else { - weight = Scalar(0.0); - } - - - Vector rate; - // MV: Could we use divergence here ephasize velocitie which are compressive and - // MV: not absorbins stuff that would not be accreted anyway? - if (length(value(uu)) > Scalar(0.0)) { - rate = (Scalar(1.0)/dt) * value(uu); - } else { - rate = (Vector){0.0, 0.0, 0.0}; - } - accretion_velocity = weight * rate ; - } else { - accretion_velocity = (Vector){0.0, 0.0, 0.0}; - } - return accretion_velocity; -} -#endif - - -Scalar -continuity(int3 globalVertexIdx, in VectorField uu, in ScalarField lnrho, Scalar dt) -{ - return -dot(value(uu), gradient(lnrho)) -#if LUPWD - // This is a corrective hyperdiffusion term for upwinding. - + upwd_der6(uu, lnrho) -#endif -#if LSINK - - sink_accretion(globalVertexIdx, lnrho, dt) / exp(value(lnrho)) -#endif - - divergence(uu); -} - - - -#if LENTROPY -Vector -momentum(int3 globalVertexIdx, in VectorField uu, in ScalarField lnrho, in ScalarField ss, in VectorField aa, Scalar dt) -{ - const Matrix S = stress_tensor(uu); - const Scalar cs2 = AC_cs2_sound * exp(AC_gamma * value(ss) / AC_cp_sound + - (AC_gamma - 1) * (value(lnrho) - AC_lnrho0)); - const Vector j = (Scalar(1.0) / AC_mu0) * - (gradient_of_divergence(aa) - laplace_vec(aa)); // Current density - const Vector B = curl(aa); - // TODO: DOES INTHERMAL VERSTION INCLUDE THE MAGNETIC FIELD? - const Scalar inv_rho = Scalar(1.0) / exp(value(lnrho)); - - // Regex replace CPU constants with get\(AC_([a-zA-Z_0-9]*)\) - // \1 - const Vector mom = -mul(gradients(uu), value(uu)) - - cs2 * ((Scalar(1.0) / AC_cp_sound) * gradient(ss) + gradient(lnrho)) + - inv_rho * cross(j, B) + - AC_nu_visc * - (laplace_vec(uu) + Scalar(1.0 / 3.0) * gradient_of_divergence(uu) + - Scalar(2.0) * mul(S, gradient(lnrho))) + - AC_zeta * gradient_of_divergence(uu) - #if LSINK - //Gravity term - + sink_gravity(globalVertexIdx) - //Corresponding loss of momentum - - //(Scalar(1.0) / Scalar( (AC_dsx*AC_dsy*AC_dsz) * exp(value(lnrho)))) * // Correction factor by unit mass - sink_accretion_velocity(globalVertexIdx, uu, dt) // As in Lee et al.(2014) - ; - #else - ; - #endif - return mom; -} -#elif LTEMPERATURE -Vector -momentum(int3 globalVertexIdx, in VectorField uu, in ScalarField lnrho, in ScalarField tt) -{ - Vector mom; - - const Matrix S = stress_tensor(uu); - - const Vector pressure_term = (AC_cp_sound - AC_cv_sound) * - (gradient(tt) + value(tt) * gradient(lnrho)); - - mom = -mul(gradients(uu), value(uu)) - pressure_term + - AC_nu_visc * (laplace_vec(uu) + Scalar(1.0 / 3.0) * gradient_of_divergence(uu) + - Scalar(2.0) * mul(S, gradient(lnrho))) + - AC_zeta * gradient_of_divergence(uu) - #if LSINK - + sink_gravity(globalVertexIdx); - #else - ; - #endif - -#if LGRAVITY - mom = mom - (Vector){0, 0, -10.0}; -#endif - return mom; -} -#else -Vector -momentum(int3 globalVertexIdx, in VectorField uu, in ScalarField lnrho, Scalar dt) -{ - Vector mom; - - const Matrix S = stress_tensor(uu); - - // Isothermal: we have constant speed of sound - - mom = -mul(gradients(uu), value(uu)) - AC_cs2_sound * gradient(lnrho) + - AC_nu_visc * (laplace_vec(uu) + Scalar(1.0 / 3.0) * gradient_of_divergence(uu) + - Scalar(2.0) * mul(S, gradient(lnrho))) + - AC_zeta * gradient_of_divergence(uu) - #if LSINK - + sink_gravity(globalVertexIdx) - //Corresponding loss of momentum - - //(Scalar(1.0) / Scalar( (AC_dsx*AC_dsy*AC_dsz) * exp(value(lnrho)))) * // Correction factor by unit mass - sink_accretion_velocity(globalVertexIdx, uu, dt) // As in Lee et al.(2014) - ; - #else - ; - #endif - -#if LGRAVITY - mom = mom - (Vector){0, 0, -10.0}; -#endif - - return mom; -} -#endif - -Vector -induction(in VectorField uu, in VectorField aa) -{ - // Note: We do (-nabla^2 A + nabla(nabla dot A)) instead of (nabla x (nabla - // x A)) in order to avoid taking the first derivative twice (did the math, - // yes this actually works. See pg.28 in arXiv:astro-ph/0109497) - // u cross B - AC_eta * AC_mu0 * (AC_mu0^-1 * [- laplace A + grad div A ]) - const Vector B = curl(aa); - const Vector grad_div = gradient_of_divergence(aa); - const Vector lap = laplace_vec(aa); - - // Note, AC_mu0 is cancelled out - const Vector ind = cross(value(uu), B) - AC_eta * (grad_div - lap); - - return ind; -} - -#if LENTROPY -Scalar -lnT(in ScalarField ss, in ScalarField lnrho) -{ - const Scalar lnT = AC_lnT0 + AC_gamma * value(ss) / AC_cp_sound + - (AC_gamma - Scalar(1.0)) * (value(lnrho) - AC_lnrho0); - return lnT; -} - -// Nabla dot (K nabla T) / (rho T) -Scalar -heat_conduction(in ScalarField ss, in ScalarField lnrho) -{ - const Scalar inv_AC_cp_sound = AcReal(1.0) / AC_cp_sound; - - const Vector grad_ln_chi = -gradient(lnrho); - - const Scalar first_term = AC_gamma * inv_AC_cp_sound * laplace(ss) + - (AC_gamma - AcReal(1.0)) * laplace(lnrho); - const Vector second_term = AC_gamma * inv_AC_cp_sound * gradient(ss) + - (AC_gamma - AcReal(1.0)) * gradient(lnrho); - const Vector third_term = AC_gamma * (inv_AC_cp_sound * gradient(ss) + gradient(lnrho)) + - grad_ln_chi; - - const Scalar chi = AC_THERMAL_CONDUCTIVITY / (exp(value(lnrho)) * AC_cp_sound); - return AC_cp_sound * chi * (first_term + dot(second_term, third_term)); -} - -Scalar -heating(const int i, const int j, const int k) -{ - return 1; -} - -Scalar -entropy(in ScalarField ss, in VectorField uu, in ScalarField lnrho, in VectorField aa) -{ - const Matrix S = stress_tensor(uu); - const Scalar inv_pT = Scalar(1.0) / (exp(value(lnrho)) * exp(lnT(ss, lnrho))); - const Vector j = (Scalar(1.0) / AC_mu0) * - (gradient_of_divergence(aa) - laplace_vec(aa)); // Current density - const Scalar RHS = H_CONST - C_CONST + AC_eta * (AC_mu0)*dot(j, j) + - Scalar(2.0) * exp(value(lnrho)) * AC_nu_visc * contract(S) + - AC_zeta * exp(value(lnrho)) * divergence(uu) * divergence(uu); - - return -dot(value(uu), gradient(ss)) + inv_pT * RHS + heat_conduction(ss, lnrho); -} -#endif - -#if LTEMPERATURE -Scalar -heat_transfer(in VectorField uu, in ScalarField lnrho, in ScalarField tt) -{ - const Matrix S = stress_tensor(uu); - const Scalar heat_diffusivity_k = 0.0008; // 8e-4; - return -dot(value(uu), gradient(tt)) + heat_diffusivity_k * laplace(tt) + - heat_diffusivity_k * dot(gradient(lnrho), gradient(tt)) + - AC_nu_visc * contract(S) * (Scalar(1.0) / AC_cv_sound) - - (AC_gamma - 1) * value(tt) * divergence(uu); -} -#endif - -#if LFORCING -Vector - simple_vortex_forcing(Vector a, Vector b, Scalar magnitude){ - int accretion_switch = AC_switch_accretion; - - if (accretion_switch == 0){ - return magnitude * cross(normalized(b - a), (Vector){ 0, 0, 1}); // Vortex - } else { - return (Vector){0,0,0}; - } -} -Vector - simple_outward_flow_forcing(Vector a, Vector b, Scalar magnitude){ - int accretion_switch = AC_switch_accretion; - if (accretion_switch == 0){ - return magnitude * (1 / length(b - a)) * normalized(b - a); // Outward flow - } else { - return (Vector){0,0,0}; - } -} - -// The Pencil Code forcing_hel_noshear(), manual Eq. 222, inspired forcing function with adjustable -// helicity -Vector -helical_forcing(Scalar magnitude, Vector k_force, Vector xx, Vector ff_re, Vector ff_im, Scalar phi) -{ - // JP: This looks wrong: - // 1) Should it be AC_dsx * AC_nx instead of AC_dsx * AC_ny? - // 2) Should you also use globalGrid.n instead of the local n? - // MV: You are rigth. Made a quickfix. I did not see the error because multigpu is split - // in z direction not y direction. - // 3) Also final point: can we do this with vectors/quaternions instead? - // Tringonometric functions are much more expensive and inaccurate/ - // MV: Good idea. No an immediate priority. - // Fun related article: - // https://randomascii.wordpress.com/2014/10/09/intel-underestimates-error-bounds-by-1-3-quintillion/ - xx.x = xx.x * (2.0 * M_PI / (AC_dsx * globalGridN.x)); - xx.y = xx.y * (2.0 * M_PI / (AC_dsy * globalGridN.y)); - xx.z = xx.z * (2.0 * M_PI / (AC_dsz * globalGridN.z)); - - Scalar cos_phi = cos(phi); - Scalar sin_phi = sin(phi); - Scalar cos_k_dot_x = cos(dot(k_force, xx)); - Scalar sin_k_dot_x = sin(dot(k_force, xx)); - // Phase affect only the x-component - // Scalar real_comp = cos_k_dot_x; - // Scalar imag_comp = sin_k_dot_x; - Scalar real_comp_phase = cos_k_dot_x * cos_phi - sin_k_dot_x * sin_phi; - Scalar imag_comp_phase = cos_k_dot_x * sin_phi + sin_k_dot_x * cos_phi; - - Vector force = (Vector){ff_re.x * real_comp_phase - ff_im.x * imag_comp_phase, - ff_re.y * real_comp_phase - ff_im.y * imag_comp_phase, - ff_re.z * real_comp_phase - ff_im.z * imag_comp_phase}; - - return force; -} - -Vector -forcing(int3 globalVertexIdx, Scalar dt) -{ - int accretion_switch = AC_switch_accretion; - if (accretion_switch == 0){ - - Vector a = Scalar(0.5) * (Vector){globalGridN.x * AC_dsx, - globalGridN.y * AC_dsy, - globalGridN.z * AC_dsz}; // source (origin) - Vector xx = (Vector){(globalVertexIdx.x - DCONST(AC_nx_min)) * AC_dsx, - (globalVertexIdx.y - DCONST(AC_ny_min)) * AC_dsy, - (globalVertexIdx.z - DCONST(AC_nz_min)) * AC_dsz}; // sink (current index) - const Scalar cs2 = AC_cs2_sound; - const Scalar cs = sqrt(cs2); - - //Placeholders until determined properly - Scalar magnitude = AC_forcing_magnitude; - Scalar phase = AC_forcing_phase; - Vector k_force = (Vector){AC_k_forcex, AC_k_forcey, AC_k_forcez}; - Vector ff_re = (Vector){AC_ff_hel_rex, AC_ff_hel_rey, AC_ff_hel_rez}; - Vector ff_im = (Vector){AC_ff_hel_imx, AC_ff_hel_imy, AC_ff_hel_imz}; - - - //Determine that forcing funtion type at this point. - //Vector force = simple_vortex_forcing(a, xx, magnitude); - //Vector force = simple_outward_flow_forcing(a, xx, magnitude); - Vector force = helical_forcing(magnitude, k_force, xx, ff_re,ff_im, phase); - - //Scaling N = magnitude*cs*sqrt(k*cs/dt) * dt - const Scalar NN = cs*sqrt(AC_kaver*cs); - //MV: Like in the Pencil Code. I don't understandf the logic here. - force.x = sqrt(dt)*NN*force.x; - force.y = sqrt(dt)*NN*force.y; - force.z = sqrt(dt)*NN*force.z; - - if (is_valid(force)) { return force; } - else { return (Vector){0, 0, 0}; } - } else { - return (Vector){0,0,0}; - } -} -#endif // LFORCING - -// Declare input and output arrays using locations specified in the -// array enum in astaroth.h -in ScalarField lnrho(VTXBUF_LNRHO); -out ScalarField out_lnrho(VTXBUF_LNRHO); - -in VectorField uu(VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ); -out VectorField out_uu(VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ); - -#if LMAGNETIC -in VectorField aa(VTXBUF_AX, VTXBUF_AY, VTXBUF_AZ); -out VectorField out_aa(VTXBUF_AX, VTXBUF_AY, VTXBUF_AZ); -#endif - -#if LENTROPY -in ScalarField ss(VTXBUF_ENTROPY); -out ScalarField out_ss(VTXBUF_ENTROPY); -#endif - -#if LTEMPERATURE -in ScalarField tt(VTXBUF_TEMPERATURE); -out ScalarField out_tt(VTXBUF_TEMPERATURE); -#endif - -#if LSINK -in ScalarField accretion(VTXBUF_ACCRETION); -out ScalarField out_accretion(VTXBUF_ACCRETION); -#endif - -Kernel void -solve() -{ - Scalar dt = AC_dt; - out_lnrho = rk3(out_lnrho, lnrho, continuity(globalVertexIdx, uu, lnrho, dt), dt); - -#if LMAGNETIC - out_aa = rk3(out_aa, aa, induction(uu, aa), dt); -#endif - -#if LENTROPY - out_uu = rk3(out_uu, uu, momentum(globalVertexIdx, uu, lnrho, ss, aa, dt), dt); - out_ss = rk3(out_ss, ss, entropy(ss, uu, lnrho, aa), dt); -#elif LTEMPERATURE - out_uu = rk3(out_uu, uu, momentum(globalVertexIdx, uu, lnrho, tt, dt), dt); - out_tt = rk3(out_tt, tt, heat_transfer(uu, lnrho, tt), dt); -#else - out_uu = rk3(out_uu, uu, momentum(globalVertexIdx, uu, lnrho, dt), dt); -#endif - -#if LFORCING - if (step_number == 2) { - out_uu = out_uu + forcing(globalVertexIdx, dt); - } -#endif - -#if LSINK - out_accretion = rk3(out_accretion, accretion, sink_accretion(globalVertexIdx, lnrho, dt), dt);// unit now is rho! - - if (step_number == 2) { - out_accretion = out_accretion * AC_dsx * AC_dsy * AC_dsz;// unit is now mass! - } -#endif -} diff --git a/acc/src/code_generator0.c b/acc/src/code_generator0.c deleted file mode 100644 index 4df0516..0000000 --- a/acc/src/code_generator0.c +++ /dev/null @@ -1,705 +0,0 @@ -/* - Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. - - This file is part of Astaroth. - - Astaroth is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Astaroth is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Astaroth. If not, see . -*/ - -/** - * @file - * \brief Brief info. - * - * Detailed info. - * - */ - -#include -#include -#include -#include - -#include "acc.tab.h" -#include "ast.h" - -ASTNode* root = NULL; - -static const char inout_name_prefix[] = "handle_"; -typedef enum { STENCIL_ASSEMBLY, STENCIL_PROCESS, STENCIL_HEADER } CompilationType; -static CompilationType compilation_type; - -/* - * ============================================================================= - * Translation - * ============================================================================= - */ -#define TRANSLATION_TABLE_SIZE (1024) -static const char* translation_table[TRANSLATION_TABLE_SIZE] = { - [0] = NULL, - // Control flow - [IF] = "if", - [ELSE] = "else", - [ELIF] = "else if", - [WHILE] = "while", - [FOR] = "for", - // Type specifiers - [VOID] = "void", - [INT] = "int", - [INT3] = "int3", - [SCALAR] = "AcReal", - [VECTOR] = "AcReal3", - [MATRIX] = "AcMatrix", - [SCALARFIELD] = "AcReal", - [SCALARARRAY] = "const AcReal* __restrict__", - [COMPLEX] = "acComplex", - // Type qualifiers - [KERNEL] = "template static __global__", - //__launch_bounds__(RK_THREADBLOCK_SIZE, - // RK_LAUNCH_BOUND_MIN_BLOCKS), - [PREPROCESSED] = "static __device__ " - "__forceinline__", - [CONSTANT] = "const", - [IN] = "in", - [OUT] = "out", - [UNIFORM] = "uniform", - // ETC - [INPLACE_INC] = "++", - [INPLACE_DEC] = "--", - // Unary - [','] = ",", - [';'] = ";\n", - ['('] = "(", - [')'] = ")", - ['['] = "[", - [']'] = "]", - ['{'] = "{\n", - ['}'] = "}\n", - ['='] = "=", - ['+'] = "+", - ['-'] = "-", - ['/'] = "/", - ['*'] = "*", - ['<'] = "<", - ['>'] = ">", - ['!'] = "!", - ['.'] = "."}; - -static const char* -translate(const int token) -{ - assert(token >= 0); - assert(token < TRANSLATION_TABLE_SIZE); - if (token > 0) { - if (!translation_table[token]) - printf("ERROR: unidentified token %d\n", token); - assert(translation_table[token]); - } - - return translation_table[token]; -} - -/* - * ============================================================================= - * Symbols - * ============================================================================= - */ -typedef enum { - SYMBOLTYPE_FUNCTION, - SYMBOLTYPE_FUNCTION_PARAMETER, - SYMBOLTYPE_OTHER, - NUM_SYMBOLTYPES -} SymbolType; - -#define MAX_ID_LEN (128) -typedef struct { - SymbolType type; - int type_qualifier; - int type_specifier; - char identifier[MAX_ID_LEN]; -} Symbol; - -#define SYMBOL_TABLE_SIZE (4096) -static Symbol symbol_table[SYMBOL_TABLE_SIZE] = {}; -static int num_symbols = 0; - -static int -symboltable_lookup(const char* identifier) -{ - if (!identifier) - return -1; - - for (int i = 0; i < num_symbols; ++i) - if (strcmp(identifier, symbol_table[i].identifier) == 0) - return i; - - return -1; -} - -static void -add_symbol(const SymbolType type, const int tqualifier, const int tspecifier, const char* id) -{ - assert(num_symbols < SYMBOL_TABLE_SIZE); - - symbol_table[num_symbols].type = type; - symbol_table[num_symbols].type_qualifier = tqualifier; - symbol_table[num_symbols].type_specifier = tspecifier; - strcpy(symbol_table[num_symbols].identifier, id); - - ++num_symbols; -} - -static void -rm_symbol(const int handle) -{ - assert(handle >= 0 && handle < num_symbols); - assert(num_symbols > 0); - - if (&symbol_table[handle] != &symbol_table[num_symbols - 1]) - memcpy(&symbol_table[handle], &symbol_table[num_symbols - 1], sizeof(Symbol)); - --num_symbols; -} - -static void -print_symbol(const int handle) -{ - assert(handle < SYMBOL_TABLE_SIZE); - - const char* fields[] = {translate(symbol_table[handle].type_qualifier), - translate(symbol_table[handle].type_specifier), - symbol_table[handle].identifier}; - const size_t num_fields = sizeof(fields) / sizeof(fields[0]); - - for (size_t i = 0; i < num_fields; ++i) - if (fields[i]) - printf("%s ", fields[i]); -} - -static void -translate_latest_symbol(void) -{ - const int handle = num_symbols - 1; - assert(handle < SYMBOL_TABLE_SIZE); - - Symbol* symbol = &symbol_table[handle]; - - // FUNCTION - if (symbol->type == SYMBOLTYPE_FUNCTION) { - // KERNEL FUNCTION - if (symbol->type_qualifier == KERNEL) { - printf("%s %s\n%s", translate(symbol->type_qualifier), - translate(symbol->type_specifier), symbol->identifier); - } - // PREPROCESSED FUNCTION - else if (symbol->type_qualifier == PREPROCESSED) { - printf("%s %s\npreprocessed_%s", translate(symbol->type_qualifier), - translate(symbol->type_specifier), symbol->identifier); - } - // OTHER FUNCTION - else { - const char* regular_function_decorator = "static __device__ " - "__forceinline__"; - printf("%s %s %s\n%s", regular_function_decorator, - translate(symbol->type_qualifier) ? translate(symbol->type_qualifier) : "", - translate(symbol->type_specifier), symbol->identifier); - } - } - // FUNCTION PARAMETER - else if (symbol->type == SYMBOLTYPE_FUNCTION_PARAMETER) { - if (symbol->type_qualifier == IN || symbol->type_qualifier == OUT) { - if (compilation_type == STENCIL_ASSEMBLY) - printf("const __restrict__ %s* %s", translate(symbol->type_specifier), - symbol->identifier); - else if (compilation_type == STENCIL_PROCESS) - printf("const %sData& %s", translate(symbol->type_specifier), symbol->identifier); - else - printf("Invalid compilation type %d, IN and OUT qualifiers not supported\n", - compilation_type); - } - else { - print_symbol(handle); - } - } - // UNIFORM - else if (symbol->type_qualifier == UNIFORM) { - // if (compilation_type != STENCIL_HEADER) { - // printf("ERROR: %s can only be used in stencil headers\n", translation_table[UNIFORM]); - //} - /* Do nothing */ - } - // IN / OUT - else if (symbol->type != SYMBOLTYPE_FUNCTION_PARAMETER && - (symbol->type_qualifier == IN || symbol->type_qualifier == OUT)) { - - printf("static __device__ const %s %s%s", - symbol->type_specifier == SCALARFIELD ? "int" : "int3", inout_name_prefix, - symbol_table[handle].identifier); - if (symbol->type_specifier == VECTOR) - printf(" = make_int3"); - } - // OTHER - else { - print_symbol(handle); - } -} - -static inline void -print_symbol_table(void) -{ - for (int i = 0; i < num_symbols; ++i) { - printf("%d: ", i); - const char* fields[] = {translate(symbol_table[i].type_qualifier), - translate(symbol_table[i].type_specifier), - symbol_table[i].identifier}; - - const size_t num_fields = sizeof(fields) / sizeof(fields[0]); - for (size_t j = 0; j < num_fields; ++j) - if (fields[j]) - printf("%s ", fields[j]); - - if (symbol_table[i].type == SYMBOLTYPE_FUNCTION) - printf("(function)"); - else if (symbol_table[i].type == SYMBOLTYPE_FUNCTION_PARAMETER) - printf("(function parameter)"); - else - printf("(other)"); - printf("\n"); - } -} - -/* - * ============================================================================= - * State - * ============================================================================= - */ -static bool inside_declaration = false; -static bool inside_function_declaration = false; -static bool inside_function_parameter_declaration = false; - -static bool inside_kernel = false; -static bool inside_preprocessed = false; - -static int scope_start = 0; - -/* - * ============================================================================= - * AST traversal - * ============================================================================= - */ - -static int compound_statement_nests = 0; - -static void -traverse(const ASTNode* node) -{ - // Prefix logic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (node->type == NODE_FUNCTION_DECLARATION) - inside_function_declaration = true; - if (node->type == NODE_FUNCTION_PARAMETER_DECLARATION) - inside_function_parameter_declaration = true; - if (node->type == NODE_DECLARATION) - inside_declaration = true; - - if (!inside_declaration && translate(node->prefix)) - printf("%s", translate(node->prefix)); - - if (node->type == NODE_COMPOUND_STATEMENT) - ++compound_statement_nests; - - // BOILERPLATE START//////////////////////////////////////////////////////// - if (node->type == NODE_TYPE_QUALIFIER && node->token == KERNEL) - inside_kernel = true; - - // Kernel parameter boilerplate - const char* kernel_parameter_boilerplate = "GEN_KERNEL_PARAM_BOILERPLATE"; - if (inside_kernel && node->type == NODE_FUNCTION_PARAMETER_DECLARATION) { - printf("%s", kernel_parameter_boilerplate); - - if (node->lhs != NULL) { - printf("Compilation error: function parameters for Kernel functions not allowed!\n"); - exit(EXIT_FAILURE); - } - } - - // Kernel builtin variables boilerplate (read input/output arrays and setup - // indices) - const char* kernel_builtin_variables_boilerplate = "GEN_KERNEL_BUILTIN_VARIABLES_" - "BOILERPLATE();"; - if (inside_kernel && node->type == NODE_COMPOUND_STATEMENT && compound_statement_nests == 1) { - printf("%s ", kernel_builtin_variables_boilerplate); - - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == IN) { - printf("const %sData %s = READ(%s%s);\n", translate(symbol_table[i].type_specifier), - symbol_table[i].identifier, inout_name_prefix, symbol_table[i].identifier); - } - else if (symbol_table[i].type_qualifier == OUT) { - printf("%s %s = READ_OUT(%s%s);", translate(symbol_table[i].type_specifier), - symbol_table[i].identifier, inout_name_prefix, symbol_table[i].identifier); - // printf("%s %s = buffer.out[%s%s][IDX(vertexIdx.x, vertexIdx.y, vertexIdx.z)];\n", - // translate(symbol_table[i].type_specifier), symbol_table[i].identifier, - // inout_name_prefix, symbol_table[i].identifier); - } - } - } - - // Preprocessed parameter boilerplate - if (node->type == NODE_TYPE_QUALIFIER && node->token == PREPROCESSED) - inside_preprocessed = true; - static const char preprocessed_parameter_boilerplate - [] = "const int3& vertexIdx, const int3& globalVertexIdx, "; - if (inside_preprocessed && node->type == NODE_FUNCTION_PARAMETER_DECLARATION) - printf("%s ", preprocessed_parameter_boilerplate); - // BOILERPLATE END//////////////////////////////////////////////////////// - - // Enter LHS - if (node->lhs) - traverse(node->lhs); - - // Infix logic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if (!inside_declaration && translate(node->infix)) - printf("%s ", translate(node->infix)); - - if (node->type == NODE_FUNCTION_DECLARATION) - inside_function_declaration = false; - - // If the node is a subscript expression and the expression list inside it is not empty - if (node->type == NODE_MULTIDIM_SUBSCRIPT_EXPRESSION && node->rhs) - printf("IDX("); - - // Do a regular translation - if (!inside_declaration) { - const int handle = symboltable_lookup(node->buffer); - if (handle >= 0) { // The variable exists in the symbol table - const Symbol* symbol = &symbol_table[handle]; - - if (symbol->type_qualifier == UNIFORM) { - if (inside_kernel && symbol->type_specifier == SCALARARRAY) { - printf("buffer.profiles[%s] ", symbol->identifier); - } - else { - printf("DCONST(%s) ", symbol->identifier); - } - } - else { - // Do a regular translation - if (translate(node->token)) - printf("%s ", translate(node->token)); - if (node->buffer) { - if (node->type == NODE_REAL_NUMBER) { - printf("%s(%s) ", translate(SCALAR), - node->buffer); // Cast to correct precision - } - else { - printf("%s ", node->buffer); - } - } - } - } - else { - // Do a regular translation - if (translate(node->token)) - printf("%s ", translate(node->token)); - if (node->buffer) { - if (node->type == NODE_REAL_NUMBER) { - printf("%s(%s) ", translate(SCALAR), node->buffer); // Cast to correct precision - } - else { - printf("%s ", node->buffer); - } - } - } - } - - if (node->type == NODE_FUNCTION_DECLARATION) { - scope_start = num_symbols; - } - - // Enter RHS - if (node->rhs) - traverse(node->rhs); - - // Postfix logic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - // If the node is a subscript expression and the expression list inside it is not empty - if (node->type == NODE_MULTIDIM_SUBSCRIPT_EXPRESSION && node->rhs) - printf(")"); // Closing bracket of IDX() - - // Generate writeback boilerplate for OUT fields - if (inside_kernel && node->type == NODE_COMPOUND_STATEMENT && compound_statement_nests == 1) { - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == OUT) { - printf("WRITE_OUT(%s%s, %s);\n", inout_name_prefix, symbol_table[i].identifier, - symbol_table[i].identifier); - // printf("buffer.out[%s%s][IDX(vertexIdx.x, vertexIdx.y, vertexIdx.z)] = %s;\n", - // inout_name_prefix, symbol_table[i].identifier, symbol_table[i].identifier); - } - } - } - - if (!inside_declaration && translate(node->postfix)) - printf("%s", translate(node->postfix)); - - if (node->type == NODE_DECLARATION) { - inside_declaration = false; - - int tqual = 0; - int tspec = 0; - if (node->lhs && node->lhs->lhs) { - if (node->lhs->lhs->type == NODE_TYPE_QUALIFIER) - tqual = node->lhs->lhs->token; - else if (node->lhs->lhs->type == NODE_TYPE_SPECIFIER) - tspec = node->lhs->lhs->token; - } - if (node->lhs && node->lhs->rhs) { - if (node->lhs->rhs->type == NODE_TYPE_SPECIFIER) - tspec = node->lhs->rhs->token; - } - - // Determine symbol type - SymbolType symboltype = SYMBOLTYPE_OTHER; - if (inside_function_declaration) - symboltype = SYMBOLTYPE_FUNCTION; - else if (inside_function_parameter_declaration) - symboltype = SYMBOLTYPE_FUNCTION_PARAMETER; - - // Determine identifier - if (node->rhs->type == NODE_IDENTIFIER) { - add_symbol(symboltype, tqual, tspec, node->rhs->buffer); // Ordinary - translate_latest_symbol(); - } - else { - add_symbol(symboltype, tqual, tspec, - node->rhs->lhs->buffer); // Array - translate_latest_symbol(); - // Traverse the expression once again, this time with - // "inside_declaration" flag off - printf("%s ", translate(node->rhs->infix)); - if (node->rhs->rhs) - traverse(node->rhs->rhs); - printf("%s ", translate(node->rhs->postfix)); - } - } - - if (node->type == NODE_COMPOUND_STATEMENT) - --compound_statement_nests; - - if (node->type == NODE_FUNCTION_PARAMETER_DECLARATION) - inside_function_parameter_declaration = false; - - if (node->type == NODE_FUNCTION_DEFINITION) { - while (num_symbols > scope_start) - rm_symbol(num_symbols - 1); - - inside_kernel = false; - inside_preprocessed = false; - } -} - -// TODO: these should use the generic type names SCALAR and VECTOR -static void -generate_preprocessed_structures(void) -{ - // PREPROCESSED DATA STRUCT - printf("\n"); - printf("typedef struct {\n"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == PREPROCESSED) - printf("%s %s;\n", translate(symbol_table[i].type_specifier), - symbol_table[i].identifier); - } - printf("} %sData;\n", translate(SCALAR)); - - // FILLING THE DATA STRUCT - printf("static __device__ __forceinline__ AcRealData\ - read_data(const int3& vertexIdx,\ - const int3& globalVertexIdx,\ - AcReal* __restrict__ buf[], const int handle)\ - {\n\ - %sData data;\n", - translate(SCALAR)); - - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == PREPROCESSED) - printf("data.%s = preprocessed_%s(vertexIdx, globalVertexIdx, buf[handle]);\n", - symbol_table[i].identifier, symbol_table[i].identifier); - } - printf("return data;\n"); - printf("}\n"); - - // FUNCTIONS FOR ACCESSING MEMBERS OF THE PREPROCESSED STRUCT - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == PREPROCESSED) - printf("static __device__ __forceinline__ %s\ - %s(const AcRealData& data)\ - {\n\ - return data.%s;\ - }\n", - translate(symbol_table[i].type_specifier), symbol_table[i].identifier, - symbol_table[i].identifier); - } - - // Syntactic sugar: generate also a Vector data struct - printf("\ - typedef struct {\ - AcRealData x;\ - AcRealData y;\ - AcRealData z;\ - } AcReal3Data;\ - \ - static __device__ __forceinline__ AcReal3Data\ - read_data(const int3& vertexIdx,\ - const int3& globalVertexIdx,\ - AcReal* __restrict__ buf[], const int3& handle)\ - {\ - AcReal3Data data;\ - \ - data.x = read_data(vertexIdx, globalVertexIdx, buf, handle.x);\ - data.y = read_data(vertexIdx, globalVertexIdx, buf, handle.y);\ - data.z = read_data(vertexIdx, globalVertexIdx, buf, handle.z);\ - \ - return data;\ - }\ - "); -} - -static void -generate_header(void) -{ - printf("\n#pragma once\n"); - - // Int params - printf("#define AC_FOR_USER_INT_PARAM_TYPES(FUNC)"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_specifier == INT) { - printf("\\\nFUNC(%s),", symbol_table[i].identifier); - } - } - printf("\n\n"); - - // Int3 params - printf("#define AC_FOR_USER_INT3_PARAM_TYPES(FUNC)"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_specifier == INT3) { - printf("\\\nFUNC(%s),", symbol_table[i].identifier); - } - } - printf("\n\n"); - - // Scalar params - printf("#define AC_FOR_USER_REAL_PARAM_TYPES(FUNC)"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_specifier == SCALAR) { - printf("\\\nFUNC(%s),", symbol_table[i].identifier); - } - } - printf("\n\n"); - - // Vector params - printf("#define AC_FOR_USER_REAL3_PARAM_TYPES(FUNC)"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_specifier == VECTOR) { - printf("\\\nFUNC(%s),", symbol_table[i].identifier); - } - } - printf("\n\n"); - - // Scalar fields - printf("#define AC_FOR_VTXBUF_HANDLES(FUNC)"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_specifier == SCALARFIELD) { - printf("\\\nFUNC(%s),", symbol_table[i].identifier); - } - } - printf("\n\n"); - - // Scalar arrays - printf("#define AC_FOR_SCALARARRAY_HANDLES(FUNC)"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_specifier == SCALARARRAY) { - printf("\\\nFUNC(%s),", symbol_table[i].identifier); - } - } - printf("\n\n"); - - /* - printf("\n"); - printf("typedef struct {\n"); - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == PREPROCESSED) - printf("%s %s;\n", translate(symbol_table[i].type_specifier), - symbol_table[i].identifier); - } - printf("} %sData;\n", translate(SCALAR)); - */ -} - -static void -generate_library_hooks(void) -{ - for (int i = 0; i < num_symbols; ++i) { - if (symbol_table[i].type_qualifier == KERNEL) { - printf("GEN_DEVICE_FUNC_HOOK(%s)\n", symbol_table[i].identifier); - // printf("GEN_NODE_FUNC_HOOK(%s)\n", symbol_table[i].identifier); - } - } -} - -int -main(int argc, char** argv) -{ - if (argc == 2) { - if (!strcmp(argv[1], "-sas")) - compilation_type = STENCIL_ASSEMBLY; - else if (!strcmp(argv[1], "-sps")) - compilation_type = STENCIL_PROCESS; - else if (!strcmp(argv[1], "-sdh")) - compilation_type = STENCIL_HEADER; - else { - printf("Unknown flag %s. Generating stencil assembly.\n", argv[1]); - return EXIT_FAILURE; - } - } - else { - printf("Usage: ./acc [flags]\n" - "Flags:\n" - "\t-sas - Generates code for the stencil assembly stage\n" - "\t-sps - Generates code for the stencil processing stage\n" - "\t-hh - Generates stencil definitions from a header file\n"); - printf("\n"); - return EXIT_FAILURE; - } - - root = astnode_create(NODE_UNKNOWN, NULL, NULL); - - const int retval = yyparse(); - if (retval) { - printf("COMPILATION FAILED\n"); - return EXIT_FAILURE; - } - - // Traverse - traverse(root); - if (compilation_type == STENCIL_ASSEMBLY) - generate_preprocessed_structures(); - else if (compilation_type == STENCIL_HEADER) - generate_header(); - else if (compilation_type == STENCIL_PROCESS) - generate_library_hooks(); - - // print_symbol_table(); - - // Cleanup - astnode_destroy(root); - // printf("COMPILATION SUCCESS\n"); - return EXIT_SUCCESS; -} diff --git a/acc/test_grammar.sh b/acc/test_grammar.sh deleted file mode 100755 index b9e4a6a..0000000 --- a/acc/test_grammar.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -cd `dirname $0` # Only operate in the same directory with this script - -./build_acc.sh - -mkdir -p testbin -./compile.sh samples/sample_stencil_process.sps -./compile.sh samples/sample_stencil_assembly.sas - -mv stencil_process.cuh testbin/ -mv stencil_assembly.cuh testbin/ - -printf " -#include -#include -#include \"%s\" // i.e. astaroth.h - -__constant__ AcMeshInfo d_mesh_info; -#define DCONST(X) (d_mesh_info.int_params[X]) -#define DCONST_REAL(X) (d_mesh_info.real_params[X]) -#define DEVICE_VTXBUF_IDX(i, j, k) ((i) + (j)*DCONST(AC_mx) + (k)*DCONST(AC_mxy)) - - -static __device__ __forceinline__ int -IDX(const int i) -{ - return i; -} - -static __device__ __forceinline__ int -IDX(const int i, const int j, const int k) -{ - return DEVICE_VTXBUF_IDX(i, j, k); -} - -static __device__ __forceinline__ int -IDX(const int3 idx) -{ - return DEVICE_VTXBUF_IDX(idx.x, idx.y, idx.z); -} - -#include \"%s\" -#include \"%s\" -int main(void) { printf(\"Grammar check complete.\\\nAll tests passed.\\\n\"); return EXIT_SUCCESS; } -" common_header.h stencil_assembly.cuh stencil_process.cuh >testbin/test.cu - -cd testbin -nvcc -std=c++11 test.cu -I ../samples -o test && ./test diff --git a/acc/test_solver/stencil_assembly.sas b/acc/test_solver/stencil_assembly.sas deleted file mode 100644 index c817772..0000000 --- a/acc/test_solver/stencil_assembly.sas +++ /dev/null @@ -1,36 +0,0 @@ -#include "stencil_definition.sdh" - - -//JP NOTE IMPORTANT///////////////////////////////////////////////////////////////////////////////// -// These functions are defined here temporarily. -// -// Currently the built-in functions (derx, derxx etc) are defined in CUDA in integrate.cuh. -// This is bad. Instead the built-in functions should be defined in the DSL, and be "includable" -// as a standard DSL library, analogous to f.ex. stdlib.h in C. -//////////////////////////////////////////////////////////////////////////////////////////////////// - - -Preprocessed Scalar -value(in ScalarField vertex) -{ - return vertex[vertexIdx]; -} - -Preprocessed Vector -gradient(in ScalarField vertex) -{ - return (Vector){derx(vertexIdx, vertex), dery(vertexIdx, vertex), derz(vertexIdx, vertex)}; -} - -Preprocessed Matrix -hessian(in ScalarField vertex) -{ - Matrix hessian; - - hessian.row[0] = (Vector){derxx(vertexIdx, vertex), derxy(vertexIdx, vertex), - derxz(vertexIdx, vertex)}; - hessian.row[1] = (Vector){hessian.row[0].y, deryy(vertexIdx, vertex), deryz(vertexIdx, vertex)}; - hessian.row[2] = (Vector){hessian.row[0].z, hessian.row[1].z, derzz(vertexIdx, vertex)}; - - return hessian; -} diff --git a/acc/test_solver/stencil_definition.sdh b/acc/test_solver/stencil_definition.sdh deleted file mode 100644 index 345ed8f..0000000 --- a/acc/test_solver/stencil_definition.sdh +++ /dev/null @@ -1,18 +0,0 @@ -//JP NOTE IMPORTANT///////////////////////////////////////////////////////////////////////////////// -// AC_dsx etc are defined here temporarily (otherwise does not compile). -// -// These should ultimately be defined in the standard DSL libraries. -// See test_solver/stencil_assembly.sas for more info. -//////////////////////////////////////////////////////////////////////////////////////////////////// - -uniform Scalar AC_dsx;// TODO include these from the std lib -uniform Scalar AC_dsy; -uniform Scalar AC_dsz; -uniform Scalar AC_inv_dsx; -uniform Scalar AC_inv_dsy; -uniform Scalar AC_inv_dsz; -uniform Scalar AC_dt; - -uniform ScalarField VTXBUF_A; -uniform ScalarField VTXBUF_B; -uniform ScalarField VTXBUF_C; diff --git a/acc/test_solver/stencil_process.sps b/acc/test_solver/stencil_process.sps deleted file mode 100644 index b682685..0000000 --- a/acc/test_solver/stencil_process.sps +++ /dev/null @@ -1,18 +0,0 @@ -#include "stencil_definition.sdh" - -Vector -value(in VectorField uu) -{ - return (Vector){value(uu.x), value(uu.y), value(uu.z)}; -} - -in VectorField uu(VTXBUF_A, VTXBUF_B, VTXBUF_C); -out VectorField out_uu(VTXBUF_A, VTXBUF_B, VTXBUF_C); - -Kernel void -solve() -{ - Scalar dt = AC_dt; - Vector rate_of_change = (Vector){1, 2, 3}; - out_uu = rk3(out_uu, uu, rate_of_change, dt); -} diff --git a/scripts/compile_acc.sh b/scripts/compile_acc.sh deleted file mode 100755 index efbcc71..0000000 --- a/scripts/compile_acc.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -#!/bin/bash -if [ -z $AC_HOME ] -then - echo "ASTAROTH_HOME environment variable not set, run \"source ./sourceme.sh\" in Astaroth home directory" - exit 1 -fi -OUTPUT_DIR=${PWD} - -KERNEL_DIR=${AC_HOME}"/src/core/kernels" -ACC_DIR=${AC_HOME}"/acc" -ACC_DEFAULT_SAS="mhd_solver/stencil_assembly.sas" -ACC_DEFAULT_SPS="mhd_solver/stencil_process.sps" -ACC_DEFAULT_HEADER="mhd_solver/stencil_definition.sdh" -ACC_DEFAULT_INCLUDE_DIR="mhd_solver" - -${ACC_DIR}/clean.sh -${ACC_DIR}/build_acc.sh - -ACC_SAS=${ACC_DEFAULT_SAS} -ACC_SPS=${ACC_DEFAULT_SPS} -ACC_HEADER=${ACC_DEFAULT_HEADER} -ACC_INCLUDE_DIR=${ACC_DEFAULT_INCLUDE_DIR} - -while [ "$#" -gt 0 ] -do - case $1 in - -h|--help) - echo "This script will help to compile DSL to CUDA code." - echo "The resulting kernels will be stored to $OUTPUT_DIR." - echo "You can set a custom files for DSL under the path $AC_DIR/" - echo "Example:" - echo "compile_acc.sh -a custom_setup/custom_assembly.sas -p custom_setup/custom_process.sps --header custom_setup/custom_header.h" - exit 0 - ;; - -I|--include) - shift - ACC_INCLUDE_DIR=${1} - shift - echo "CUSTOM include dir!" - ;; - --header) - shift - ACC_HEADER=${1} - shift - echo "CUSTOM Header file!" - ;; - -a|--assembly) - shift - ACC_SAS=${1} - shift - echo "CUSTOM Assembly file!" - ;; - -p|--process) - shift - ACC_SPS=${1} - shift - echo "CUSTOM Process file!" - ;; - *) - break - esac -done - -echo "Header file:" ${ACC_DIR}/${ACC_HEADER} -echo "Assembly file: ${ACC_DIR}/${ACC_SAS}" -echo "Process file: ${ACC_DIR}/${ACC_SPS}" - -cd ${ACC_DIR}/${ACC_INCLUDE_DIR} -echo ${PWD} -${ACC_DIR}/compile.sh ${ACC_DIR}/${ACC_SAS} -${ACC_DIR}/compile.sh ${ACC_DIR}/${ACC_SPS} -${ACC_DIR}/compile.sh ${ACC_DIR}/${ACC_HEADER} - -echo "Moving stencil_assembly.cuh -> ${OUTPUT_DIR}" -mv stencil_assembly.cuh ${OUTPUT_DIR} - -echo "Moving stencil_process.cuh -> ${OUTPUT_DIR}" -mv stencil_process.cuh ${OUTPUT_DIR} - -echo "Moving stencil_defines.cuh -> ${OUTPUT_DIR}" -mv stencil_defines.h ${OUTPUT_DIR} diff --git a/scripts/preprocess_device_files.sh b/scripts/preprocess_device_files.sh deleted file mode 100755 index 0ef61f9..0000000 --- a/scripts/preprocess_device_files.sh +++ /dev/null @@ -1 +0,0 @@ -nvcc -E ../src/core/device.cu -I ../include -I ../ > preprocessed_device_files.pp From 20ab7b7c36d3299236ba75d62efc7b1543752e0b Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 22:09:43 +0200 Subject: [PATCH 22/33] Readded scripts/fix_style.sh. It seems to have disappeared at some point, have no idea. Use with care. --- scripts/fix_style.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 scripts/fix_style.sh diff --git a/scripts/fix_style.sh b/scripts/fix_style.sh new file mode 100755 index 0000000..1131b81 --- /dev/null +++ b/scripts/fix_style.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [[ $1 == "DO" && $2 == "IT!" ]]; then + find -name \*.h -o -name \*.cc -o -name \*.c | xargs clang-format -i -style=file + echo "It is done." +else + find -name \*.h -o -name \*.cc -o -name \*.c + echo "I'm going to try to fix the style of these files." + echo "If you're absolutely sure, give \"DO IT!\" as a parameter." +fi From c3727e2183e4c6932df87c7b2bbd09051c6ca119 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Tue, 14 Jan 2020 22:13:53 +0200 Subject: [PATCH 23/33] Autoformatting --- include/astaroth_node.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/astaroth_node.h b/include/astaroth_node.h index d582192..87551a5 100644 --- a/include/astaroth_node.h +++ b/include/astaroth_node.h @@ -69,7 +69,7 @@ Resets all devices on the current node. */ AcResult acNodeDestroy(Node node); -/** +/** Prints information about the devices available on the current node. Requires that Node has been initialized with @@ -77,7 +77,7 @@ Requires that Node has been initialized with */ AcResult acNodePrintInfo(const Node node); -/** +/** From 604005ed3721d2ea93380da4e45488241a044cd2 Mon Sep 17 00:00:00 2001 From: Miikka Vaisala Date: Wed, 15 Jan 2020 13:58:19 +0800 Subject: [PATCH 24/33] Now compiles after compile_acc_module.sh moved to other place. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1e859c..60b2098 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ set(DSL_HEADERS "${PROJECT_BINARY_DIR}/user_kernels.h" "${PROJECT_BINARY_DIR}/user_defines.h") add_custom_command ( COMMENT "Building ACC objects ${DSL_MODULE_DIR}" - COMMAND ${CMAKE_SOURCE_DIR}/scripts/compile_acc_module.sh ${DSL_MODULE_DIR} + COMMAND ${CMAKE_SOURCE_DIR}/acc/compile_acc_module.sh ${DSL_MODULE_DIR} DEPENDS ${DSL_SOURCES} OUTPUT ${DSL_HEADERS} ) From a937546ffb0587ccb36ef5c96148417ec0767f38 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 16:19:39 +0200 Subject: [PATCH 25/33] Added a new CMake option: BUILD_SAMPLES. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60b2098..b7c0a99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ option(BUILD_UTILS "Builds the utility library" option(BUILD_RT_VISUALIZATION "Builds the module for real-time visualization using SDL2" OFF) option(BUILD_C_API_TEST "Builds a C program to test whether the API is conformant" OFF) option(BUILD_MPI_TEST "Builds a C program to test whether MPI works" OFF) +option(BUILD_SAMPLES "Builds samples" OFF) option(DOUBLE_PRECISION "Generates double precision code" OFF) option(MULTIGPU_ENABLED "If enabled, uses all the available GPUs" ON) option(MPI_ENABLED "Enables additional functions for MPI communciation" OFF) From 23efcb413f46d13fa25997a72e989d9c859d7dd9 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 16:24:38 +0200 Subject: [PATCH 26/33] Introduced a sample directory and moved all non-library-components from src to there --- {src => samples}/ctest/CMakeLists.txt | 0 {src => samples}/ctest/README.txt | 0 {src => samples}/ctest/main.c | 0 {src => samples}/exampleproject/CMakeLists.txt | 0 {src => samples}/exampleproject/simulation.cc | 0 {src => samples}/mpitest/CMakeLists.txt | 0 {src => samples}/mpitest/README.txt | 0 {src => samples}/mpitest/main.cc | 0 {src => samples}/mpitest/main0.c | 0 {src => samples}/mpitest/main1.c | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename {src => samples}/ctest/CMakeLists.txt (100%) rename {src => samples}/ctest/README.txt (100%) rename {src => samples}/ctest/main.c (100%) rename {src => samples}/exampleproject/CMakeLists.txt (100%) rename {src => samples}/exampleproject/simulation.cc (100%) rename {src => samples}/mpitest/CMakeLists.txt (100%) rename {src => samples}/mpitest/README.txt (100%) rename {src => samples}/mpitest/main.cc (100%) rename {src => samples}/mpitest/main0.c (100%) rename {src => samples}/mpitest/main1.c (100%) diff --git a/src/ctest/CMakeLists.txt b/samples/ctest/CMakeLists.txt similarity index 100% rename from src/ctest/CMakeLists.txt rename to samples/ctest/CMakeLists.txt diff --git a/src/ctest/README.txt b/samples/ctest/README.txt similarity index 100% rename from src/ctest/README.txt rename to samples/ctest/README.txt diff --git a/src/ctest/main.c b/samples/ctest/main.c similarity index 100% rename from src/ctest/main.c rename to samples/ctest/main.c diff --git a/src/exampleproject/CMakeLists.txt b/samples/exampleproject/CMakeLists.txt similarity index 100% rename from src/exampleproject/CMakeLists.txt rename to samples/exampleproject/CMakeLists.txt diff --git a/src/exampleproject/simulation.cc b/samples/exampleproject/simulation.cc similarity index 100% rename from src/exampleproject/simulation.cc rename to samples/exampleproject/simulation.cc diff --git a/src/mpitest/CMakeLists.txt b/samples/mpitest/CMakeLists.txt similarity index 100% rename from src/mpitest/CMakeLists.txt rename to samples/mpitest/CMakeLists.txt diff --git a/src/mpitest/README.txt b/samples/mpitest/README.txt similarity index 100% rename from src/mpitest/README.txt rename to samples/mpitest/README.txt diff --git a/src/mpitest/main.cc b/samples/mpitest/main.cc similarity index 100% rename from src/mpitest/main.cc rename to samples/mpitest/main.cc diff --git a/src/mpitest/main0.c b/samples/mpitest/main0.c similarity index 100% rename from src/mpitest/main0.c rename to samples/mpitest/main0.c diff --git a/src/mpitest/main1.c b/samples/mpitest/main1.c similarity index 100% rename from src/mpitest/main1.c rename to samples/mpitest/main1.c From efa95147f363617d9b0996fed53ef03f806fa540 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 16:25:27 +0200 Subject: [PATCH 27/33] Renamed exampleproject -> cpptest --- samples/{exampleproject => cpptest}/CMakeLists.txt | 0 samples/{exampleproject => cpptest}/simulation.cc | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename samples/{exampleproject => cpptest}/CMakeLists.txt (100%) rename samples/{exampleproject => cpptest}/simulation.cc (100%) diff --git a/samples/exampleproject/CMakeLists.txt b/samples/cpptest/CMakeLists.txt similarity index 100% rename from samples/exampleproject/CMakeLists.txt rename to samples/cpptest/CMakeLists.txt diff --git a/samples/exampleproject/simulation.cc b/samples/cpptest/simulation.cc similarity index 100% rename from samples/exampleproject/simulation.cc rename to samples/cpptest/simulation.cc From 65d9274eaa8b639963bd330819562f0acf09591b Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 16:56:02 +0200 Subject: [PATCH 28/33] Updated samples to have consistent naming --- samples/CMakeLists.txt | 3 ++ samples/cpptest/CMakeLists.txt | 5 +-- samples/cpptest/main.cc | 58 +++++++++++++++++++++++++ samples/cpptest/simulation.cc | 77 ---------------------------------- samples/ctest/main.c | 1 - samples/mpitest/CMakeLists.txt | 2 +- samples/mpitest/README.txt | 10 +++++ 7 files changed, 74 insertions(+), 82 deletions(-) create mode 100644 samples/CMakeLists.txt create mode 100644 samples/cpptest/main.cc delete mode 100644 samples/cpptest/simulation.cc diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt new file mode 100644 index 0000000..ee3d39c --- /dev/null +++ b/samples/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(ctest) +add_subdirectory(cpptest) +add_subdirectory(mpitest) diff --git a/samples/cpptest/CMakeLists.txt b/samples/cpptest/CMakeLists.txt index ac2395c..4782bda 100644 --- a/samples/cpptest/CMakeLists.txt +++ b/samples/cpptest/CMakeLists.txt @@ -6,6 +6,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) add_compile_options(-Wall -Wextra -Werror -Wdouble-promotion -Wfloat-conversion -Wshadow) ## Compile and link -add_executable(ac_simulate simulation.cc) -target_link_libraries(ac_simulate PRIVATE astaroth_core astaroth_utils) -add_definitions(-DAC_DEFAULT_CONFIG="${CMAKE_SOURCE_DIR}/config/astaroth.conf") +add_executable(cpptest main.cc) +target_link_libraries(cpptest PRIVATE astaroth_core astaroth_utils) diff --git a/samples/cpptest/main.cc b/samples/cpptest/main.cc new file mode 100644 index 0000000..e5387fd --- /dev/null +++ b/samples/cpptest/main.cc @@ -0,0 +1,58 @@ +/* + Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. + + This file is part of Astaroth. + + Astaroth is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Astaroth is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Astaroth. If not, see . +*/ +#include +#include +#include + +#include "astaroth.h" + +// From Astaroth Utils +#include "src/utils/config_loader.h" +#include "src/utils/memory.h" +#include "src/utils/verification.h" + +int +main(void) +{ + AcMeshInfo info; + acLoadConfig(AC_DEFAULT_CONFIG, &info); + + // Alloc + AcMesh model, candidate; + acMeshCreate(info, &model); + acMeshCreate(info, &candidate); + + // Init + acMeshRandomize(&model); + acMeshApplyPeriodicBounds(&model); + + //////////////////////////////////////////////////////////////////////////////////////////////// + acInit(info); + acLoad(model); + acStore(&candidate); + acQuit(); + //////////////////////////////////////////////////////////////////////////////////////////////// + + // Verify and destroy + acVerifyMesh(model, candidate); + acMeshDestroy(&model); + acMeshDestroy(&candidate); + + return EXIT_SUCCESS; +} diff --git a/samples/cpptest/simulation.cc b/samples/cpptest/simulation.cc deleted file mode 100644 index 90b0230..0000000 --- a/samples/cpptest/simulation.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2014-2020, Johannes Pekkila, Miikka Vaisala. - - This file is part of Astaroth. - - Astaroth is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Astaroth is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Astaroth. If not, see . -*/ -#include "src/utils/config_loader.h" -#include "src/utils/memory.h" - -#include -#include -#include - -int -run_simulation(const char* config_path) -{ - AcMeshInfo info; - acLoadConfig(config_path, &info); - - AcMesh mesh; - acMeshCreate(info, &mesh); - acMeshClear(&mesh); - - acInit(info); - acLoad(mesh); - - const size_t num_steps = 10; - for (size_t i = 0; i < num_steps; ++i) { - const AcReal dt = 1; // JP: TODO! Set timestep here! - - // JP: TODO! Make sure that AcMeshInfo parameters are properly initialized before calling - // acIntegrate() - // NANs indicate that either dt is too large or something was uninitalized - acIntegrate(dt); - } - for (int i = 0; i < NUM_VTXBUF_HANDLES; ++i) { - printf("%s:\n", vtxbuf_names[i]); - printf("\tmax: %g\n", (double)acReduceScal(RTYPE_MAX, VertexBufferHandle(i))); - printf("\tmin: %g\n", (double)acReduceScal(RTYPE_MIN, VertexBufferHandle(i))); - printf("\trms: %g\n", (double)acReduceScal(RTYPE_RMS, VertexBufferHandle(i))); - printf("\texp rms: %g\n", (double)acReduceScal(RTYPE_RMS_EXP, VertexBufferHandle(i))); - } - acStore(&mesh); - acQuit(); - - acMeshDestroy(&mesh); - return EXIT_SUCCESS; -} - -int -main(int argc, char* argv[]) -{ - printf("Args: \n"); - for (int i = 0; i < argc; ++i) - printf("%d: %s\n", i, argv[i]); - - char* config_path; - (argc == 3) ? config_path = strdup(argv[2]) : config_path = strdup(AC_DEFAULT_CONFIG); - - printf("Config path: %s\n", config_path); - assert(config_path); - run_simulation(config_path); - free(config_path); - return EXIT_SUCCESS; -} diff --git a/samples/ctest/main.c b/samples/ctest/main.c index 5ff3fe3..4b6bfc9 100644 --- a/samples/ctest/main.c +++ b/samples/ctest/main.c @@ -41,7 +41,6 @@ main(void) acMeshRandomize(&model); acMeshApplyPeriodicBounds(&model); - // TODO load to candidate //////////////////////////////////////////////////////////////////////////////////////////////// acInit(info); acLoad(model); diff --git a/samples/mpitest/CMakeLists.txt b/samples/mpitest/CMakeLists.txt index d5f4f68..3a606db 100644 --- a/samples/mpitest/CMakeLists.txt +++ b/samples/mpitest/CMakeLists.txt @@ -6,4 +6,4 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(mpitest main.cc) -target_link_libraries(mpitest astaroth_core) +target_link_libraries(mpitest astaroth_core astaroth_utils) diff --git a/samples/mpitest/README.txt b/samples/mpitest/README.txt index 1547b08..cb6a21b 100644 --- a/samples/mpitest/README.txt +++ b/samples/mpitest/README.txt @@ -1 +1,11 @@ This directory is used to test MPI with Astaroth. + +Building (in the base astaroth directory): +cmake -DBUILD_SAMPLES=ON -DMPI_ENABLED=ON -DCMAKE_CXX_COMPILER=$(which mpicxx) .. && make -j + +Running: +mpirun -np ./mpitest +or +srun ./mpitest # With slurm +or +a batch script of your choice From 7a099a008e3a775a23dce4d7b3ca2e67514edc60 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 16:56:58 +0200 Subject: [PATCH 29/33] Removed build flags for old samples, replaced with BUILD_SAMPLES --- CMakeLists.txt | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7c0a99..d010e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,6 @@ option(BUILD_DEBUG "Builds the program with extensive error checkin option(BUILD_STANDALONE "Builds the standalone Astaroth" ON) option(BUILD_UTILS "Builds the utility library" ON) option(BUILD_RT_VISUALIZATION "Builds the module for real-time visualization using SDL2" OFF) -option(BUILD_C_API_TEST "Builds a C program to test whether the API is conformant" OFF) -option(BUILD_MPI_TEST "Builds a C program to test whether MPI works" OFF) option(BUILD_SAMPLES "Builds samples" OFF) option(DOUBLE_PRECISION "Generates double precision code" OFF) option(MULTIGPU_ENABLED "If enabled, uses all the available GPUs" ON) @@ -94,20 +92,16 @@ include_directories(include) include_directories(${CMAKE_BINARY_DIR}) ## Subdirectories -add_subdirectory(src/core) # The core library +add_subdirectory(src/core) # The core library + +if (BUILD_UTILS) + add_subdirectory(src/utils) # The utility library +endif () if (BUILD_STANDALONE) add_subdirectory(src/standalone) endif () -if (BUILD_C_API_TEST) - add_subdirectory(src/ctest) -endif () - -if (BUILD_MPI_TEST) - add_subdirectory(src/mpitest) -endif () - -if (BUILD_UTILS) - add_subdirectory(src/utils) +if (BUILD_SAMPLES) + add_subdirectory(samples) endif () From 8f646e700e1b7e34b2987b2e05a5e9f22e33100b Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 17:02:47 +0200 Subject: [PATCH 30/33] Updated README.md with the new BUILD_SAMPLES option --- CMakeLists.txt | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d010e52..2879a88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ option(BUILD_DEBUG "Builds the program with extensive error checkin option(BUILD_STANDALONE "Builds the standalone Astaroth" ON) option(BUILD_UTILS "Builds the utility library" ON) option(BUILD_RT_VISUALIZATION "Builds the module for real-time visualization using SDL2" OFF) -option(BUILD_SAMPLES "Builds samples" OFF) +option(BUILD_SAMPLES "Builds projects in samples subdirectory" OFF) option(DOUBLE_PRECISION "Generates double precision code" OFF) option(MULTIGPU_ENABLED "If enabled, uses all the available GPUs" ON) option(MPI_ENABLED "Enables additional functions for MPI communciation" OFF) diff --git a/README.md b/README.md index 827882e..0ed93dc 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ APIs and provides a domain-specific language for translating high-level descript makes Astaroth especially suitable for multiphysics simulations. Astaroth is licenced under the terms of the GNU General Public Licence, version 3, or later -(see [LICENCE.txt](LICENCE.md)). For contributing guidelines, +(see [LICENCE.txt](LICENCE.md)). For contributing guidelines, see [Contributing](CONTRIBUTING.md). @@ -46,7 +46,8 @@ See [CMakeLists.txt](https://bitbucket.org/jpekkila/astaroth/src/master/CMakeLis | BUILD_STANDALONE | Builds a standalone library for testing, benchmarking and simulation | ON | | BUILD_UTILS | Builds a generic utility library (WIP replacement for BUILD_STANDALONE) | ON | | BUILD_RT_VISUALIZATION | Builds the real-time visualization module | OFF | -| BUILD_DOUBLE_PRECISION | Generates double precision code | OFF | +| BUILD_SAMPLES | Builds projects in samples subdirectory | OFF | +| DOUBLE_PRECISION | Generates double precision code | OFF | | MULTIGPU_ENABLED | Enables Astaroth to use multiple GPUs on a single node | ON | | MPI_ENABLED | Enables additional functions for MPI communciation | OFF | | DSL_MODULE_DIR | Defines the directory to be scanned when looking for DSL files | `astaroth/acc/mhd_solver` | @@ -87,4 +88,3 @@ How do I compile with MPI support? How do I contribute? > See [Contributing](CONTRIBUTING.md). - From e3f645d49659f97e5db5d703cb19a8586acb526f Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 15:12:11 +0000 Subject: [PATCH 31/33] bitbucket-pipelines.yml edited online with Bitbucket. Now builds all modules with single and double precision. --- bitbucket-pipelines.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 7d99799..9698aac 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -21,6 +21,9 @@ pipelines: - mkdir -p build && cd build - apt-get update - apt-get install -y cmake flex bison - - cmake -DDSL_MODULE_DIR="acc/mhd_solver" .. + - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=ON -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=OFF -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Single precision + - make -j + - rm -rf * + - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=ON -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=ON -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Double precision - make -j # - ./ac_run -t From 5d412dd6711b4165577906308de18ee82468377e Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 15:17:21 +0000 Subject: [PATCH 32/33] bitbucket-pipelines.yml: better to build without real-time visualization, since that depends on SDL2 building correctly which is not in our hands. --- bitbucket-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 9698aac..f4b0dc3 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -21,9 +21,9 @@ pipelines: - mkdir -p build && cd build - apt-get update - apt-get install -y cmake flex bison - - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=ON -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=OFF -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Single precision + - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=OFF -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=OFF -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Single precision - make -j - rm -rf * - - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=ON -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=ON -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Double precision + - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=OFF -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=ON -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Double precision - make -j # - ./ac_run -t From bb70c660bb1775ea52694f16dc869d2c3e6af00f Mon Sep 17 00:00:00 2001 From: jpekkila Date: Wed, 15 Jan 2020 15:20:12 +0000 Subject: [PATCH 33/33] bitbucket-pipelines.yml edited online with Bitbucket --- bitbucket-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index f4b0dc3..4dac262 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -21,9 +21,9 @@ pipelines: - mkdir -p build && cd build - apt-get update - apt-get install -y cmake flex bison - - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=OFF -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=OFF -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Single precision + - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=OFF -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=OFF -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=OFF .. # Single precision - make -j - rm -rf * - - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=OFF -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=ON -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=ON .. # Double precision + - cmake -DDSL_MODULE_DIR="acc/mhd_solver" -DBUILD_STANDALONE=ON -DBUILD_UTILS=ON -DBUILD_RT_VISUALIZATION=OFF -DBUILD_SAMPLES=ON -DDOUBLE_PRECISION=ON -DMULTIGPU_ENABLED=ON -DMPI_ENABLED=OFF .. # Double precision - make -j # - ./ac_run -t