Commit Graph

29 Commits

Author SHA1 Message Date
jpekkila
44a86f5e80 acc: Removed debug prints, old code. Also the scope of the declarations made inside a for statement is now properly tracked 2019-10-08 00:20:57 +03:00
jpekkila
0cc5bdaa08 Added support for ScalarArrays back 2019-10-07 19:42:24 +03:00
jpekkila
ff12332f06 Clarified the syntax for real number literals. 1.0 is the same precision as AcReal, 1.0f is an explicit float and 1.0d is an explicit double. 2019-10-07 18:24:32 +03:00
jpekkila
aa6c2b23d9 Built-in parameters are now added during compilation instead of defining them in CUDA sources. IMPORTANT: DCONST macro should no longer be used when accessing built-in variables. Now all uniforms are consistently accessed with the handle only 2019-10-07 17:39:27 +03:00
jpekkila
0e1d1b9fb4 Some optimizations for DSL compilation. Also a new feature: Inplace addition and subtraction += and -= are now allowed 2019-10-07 16:33:24 +03:00
jpekkila
d97f5b59ba Rewrote the Astaroth DSL compiler. More information and cleanup in the next commits. 2019-10-07 15:43:20 +03:00
jpekkila
a651420e8d WIP changes 2019-10-03 02:35:48 +03:00
jpekkila
a02fa349ce Commented out a grammar rule that was ambiguous 2019-10-03 01:52:56 +03:00
jpekkila
cc3c2eb926 Added WIP stuff for the Astaroth DSL compiler rewrite. Once this branch is finished only a single source file will be needed (file ending .ac). This revision is needed to decouple absolutely all implementation-specific stuff (f.ex. AC_dsx) from the core library and make life easier for everyone. The plan is to provide a standard library header written in the DSL containing the derivative operations instead of hardcoding them in the CUDA implementation. 2019-10-02 21:03:59 +03:00
jpekkila
a0037d1a44 Modified the syntax of writing real-valued literals with the DSL. Casts are not needed any more: f.ex. 1.0 is implicitly cast to AcReal. The syntax is now more consistent: reals must be explicitly written as a.b, where a and b are some integers. IMPORTANT: Previously the shorthands a. and .b were allowed, not anymore. Using those shorthands will result in a compilation error 2019-10-01 21:14:33 +03:00
jpekkila
62fa95ca0d The issue on Puhti was that it was missing a static flex library which would have provided the function yywrap. Fixed by removing the static library dependency and adding option noyywrap to the lexer generator file 2019-09-24 17:19:19 +03:00
jpekkila
72af2cf31d acc is now built with cmake instead of the old build script. This was mainly done to fix compilation on Puhti where I had problems linking flex even though it is available. As an added bonus the code is now safer to build since all dependencies are now rigorously tracked by cmake and make, and f.ex. change in the compiler now forces also the whole library to be rebuilt (which is the behaviour we want) 2019-09-24 16:57:19 +03:00
jpekkila
a91da8388c Better code style in some of the acc source files 2019-09-24 15:50:20 +03:00
jpekkila
3bb6ca1712 The Astaroth Code Compiler (acc) is now built with cmake. Additionally, make is now used to generate the CUDA headers from DSL sources. The headers are also properly regenerated whenever a DSL file has been changed. With this commit, the DSL is now seamlessly integrated to the library and we no longer need complicated scripts to figure out the correct files. The current workflow for using custom DSL sources is to pass the DSL module directory to cmake, f.ex. cmake -DDSL_MODULE_DIR=/acc/mhd_solver. Note that the path must be absolute or then given relative to the CMakeLists.txt directory. f.ex cd build && cmake -DDSL_MODULE_DIR=../acc/mhd_solver does not work. CMake then takes all DSL files in that directory and handles the rest. 2019-09-18 17:28:29 +03:00
jpekkila
9e57aba9b7 New feature: ScalarArray. ScalarArrays are read-only 1D arrays containing max(mx, max(my, mz)) elements. ScalarArray is a new type of uniform and can be used for storing f.ex. forcing profiles. The DSL now also supports complex numbers and some basic arithmetic (exp, multiplication) 2019-09-02 21:26:57 +03:00
jpekkila
6ea02fa28e DSL now 'feature complete' with respect to what I had in mind before the summer. Users can now create multiple kernels and the library functions are generated automatically for them. The generated library functions are of the form acDeviceKernel_<name> and acNodeKernel_<name>. More features are needed though. The next features to be added at some point are 1D and 2D device constant arrays in order to support profiles for f.ex. forcing. 2019-08-27 18:19:20 +03:00
jpekkila
20138263f4 The previous attempt (dsl_feature_completeness_2019-08-23) to enable arbitrary kernel functions was a failure: we get significant performance loss (25-100%) if step_number is not passed as a template parameter to the integration kernel. Apparently the CUDA compiler cannot perform some optimizations if there is a if/else construct in a performance-critical part which cannot be evaluated at compile time. This branch keeps step_number as a template parameter but takes rest of the user parameters as uniforms (dt is no longer passed as a function parameter but as an uniform with the DSL instead). 2019-08-27 17:36:33 +03:00
jpekkila
5b7408eb55 User config param overhaul complete, works. If I haven't missed anything, all fields and user parameters, and everything related to simulation can now be declared with the DSL. The only thing that you need to do is to fill the declared symbols with data, like with OpenGL and GLSL. 2019-08-19 18:43:16 +03:00
jpekkila
51cf1f1068 The C header is now generated from the DSL, stashing the changes just to be sure since I might overwrite something when updating the compilation scripts to work with this new scheme 2019-08-19 18:19:28 +03:00
jpekkila
0208d55e4e Moved STENCIL_ORDER and NGHOST out of user-defined parameter as these are actually internal defines used to configure the built-in functions. Additionally, renamed all explicitly declared uniforms from dsx -> AC_dsx in the DSL in preparation for having clear connection between DSL uniforms and the library parameter handles created by the user (AcRealParam etc) 2019-08-19 16:40:47 +03:00
jpekkila
c98b74563c Added a comment 2019-08-19 16:18:24 +03:00
jpekkila
b316e51267 Added preliminary code for generating C headers with the DSL 2019-08-19 16:16:26 +03:00
jpekkila
a7a7b535d6 The code generator now generates more efficient CUDA: built-in parameters are passed as const references without copying 2019-08-08 21:35:07 +03:00
jpekkila
b53cabbc44 Made the DSL syntax less confusing: Input and output arrays are now ScalarField and VectorFields instead of scalars and vectors. C++ initializers are now also possible, removing the need to declare Fields as int or int3 which was very confusing, like "what, you assing an int value to a real, what the &^%@?" 2019-08-08 21:07:36 +03:00
jpekkila
f3de2fa03c Made globalVertexIdx available during preprocessing. NOTE: potentially dangerous. globalVertexIdx should never be used for reading data from the vertex buffers. 2019-08-05 15:03:02 +03:00
jpekkila
78aba6428e Updated the copyright years throughout the project 2019-07-16 14:28:32 +03:00
jpekkila
6da061b854 Fixed a bug in the Astaroth compiler: the boilerplate code for kernels was generated for all nested compound statements instead of just the top-level one 2019-06-19 16:10:29 +03:00
jpekkila
8864266042 Autoformatted all CUDA/C/C++ code 2019-06-18 16:42:56 +03:00
jpekkila
0e48766a68 Added Astaroth 2.0 2019-06-14 14:19:07 +03:00