meteoswiss-apn / gtclang Goto Github PK
View Code? Open in Web Editor NEWDSL frontend for geophysical applications based on clang
License: MIT License
DSL frontend for geophysical applications based on clang
License: MIT License
The GridTools generated code is enclosed in namespace gridtools
, but since this is user code it should not. Also, I am not sure about including the license/copyright header in the generated code. I would put a "provided with no warranty" disclaimer in it...
We should have a stable release of GT that we're linking against. Currently it is either Carlos' branch or mine. Can we settle on a release and link to that?
as is allowed in gtclang-all:
cmake .. -DDAWN_GIT_URL=https://github.com/<username>/dawn.git
should be possible
In case we define some temporary storages, that are written into, but never read back,
it can happen that the generator generates GT stages with no output field (since the temporary is promoted as a local variable)
We need to add a protection for this
// Temporary fields
temporary_storage lgsA, lgsB, lgsC, lgsRHS;
Do {
// This is just the first step!
// 1. Computation of explicit part of the divergence
if(first_small_step) {
// For a_rk() == 1.0 && b_rk() == 0.0 the dycore takes the shortcut of setting pos to nnow,
// Here we only support the most general version where u,v are pointing to a time interpolated value
fast_waves_vertical_divergence_helper(divTildeVerticUV, lgsRHS, u, v, acrlat0, crlat1, wgtfacU,
wgtfacV, wgtfacqU, wgtfacqV, dz_dlam, dz_dphi, dz_dlam4,
dz_dphi4);
}
}
generated stage
struct stage_0_1 {
using acrlat0 = gridtools::accessor<0, gridtools::enumtype::in, gridtools::extent<0, 0, 0, 0, 0, 0>>;
using dz_dlam4 = gridtools::accessor<1, gridtools::enumtype::in, gridtools::extent<0, 0, 0, 0, 0, 0>>;
using dz_dphi4 = gridtools::accessor<2, gridtools::enumtype::in, gridtools::extent<0, 0, 0, 0, 0, 0>>;
using __tmp_u_sfc_66 = gridtools::accessor<3, gridtools::enumtype::in, gridtools::extent<-1, 0, 0, 0, 0, 0>>;
using __tmp_v_sfc_67 = gridtools::accessor<4, gridtools::enumtype::in, gridtools::extent<0, 0, -1, 0, 0, 0>>;
using arg_list = boost::mpl::vector<acrlat0, dz_dlam4, dz_dphi4, __tmp_u_sfc_66, __tmp_v_sfc_67>;
template <typename Evaluation>
GT_FUNCTION static void Do(Evaluation& eval, interval_end_plus_1_end_plus_1) {
gridtools::clang::float_type __local_lgsRHS_64 =
(((eval(dz_dlam4(0, 0, 0)) *
gridtools::call<avg_i_minus_1_interval_end_plus_1_end_plus_1,
interval_end_plus_1_end_plus_1>::with_offsets(eval, __tmp_u_sfc_66(0, 0, 0))) *
eval(acrlat0(0, 0, 0))) +
((eval(dz_dphi4(0, 0, 0)) *
gridtools::call<avg_j_minus_1_interval_end_plus_1_end_plus_1,
interval_end_plus_1_end_plus_1>::with_offsets(eval, __tmp_v_sfc_67(0, 0, 0))) *
((gridtools::clang::float_type)1 / (gridtools::clang::float_type)6371229)));
}
template <typename Evaluation>
GT_FUNCTION static void Do(Evaluation& eval, interval_start_0_end_0) {}
};
After the discussion with Oli, we concluded that a statement that allows to explicitly disallow parallelism in the ij plane would be interesting as the user might write
u[i+1] += u[i]
and want a reduction but would (due to field versioning) only get a pair-wise addition.
To avoid confusion, one might implement a
#pragma noparallel {i,j,k}
and save this information as an additional field in the SIR.
A final decision on what exactly to do has not been made yet.
Currently we only support storage
and temporary_storage
as arguments to stencils. It would be less error-prone to force the user the provide the dimensionality of the storage (e.g storage1d
, storage2d
or storage3d
). Further it should be possible to have scalars as arguments.
For example, instead of
stencil foo {
storage s1, s2, s3, scalar;
}
it seems cleaner to write
stencil foo {
storage3d s1;
storage2d s2;
storage1d s3;
var scalar;
}
given that s1
is a 3D storage, s2
a 2D and s1
a 1D.
Add a couple of tests that do split stencils vs not splitting them and check if correct BC's are applied
the following would be syntactically correct but is probably unintended:
globals {
double foo;
};
stencil Test{
var foo;
void Do(){
vertical_region(k_start, k_end){
foo += 10;
}
}
};
The code below should not be legal,
there is one error printed, but a bit confusing
note: candidate stencil function not viable: requires 2 arguments, but 1 was provided
stencil_function TestFun {
storage in;
storage out;
Do() {
out = in;
}
};
stencil Test {
storage field_a, field_b;
Do {
vertical_region(k_start, k_end) {
field_a = field_b;
TestFun(field_a, field_b) = field_b;
}
}
};
Unfortunately gtclang does not support newer versions of clang. Maybe we can add a check in CMake that checks if the clang version can be used or not.
Same as MeteoSwiss-APN/dawn#253.
If you build with Gridtools disabled, cmake still tires to build the codegen examples.
Insert make_independent
when applicable in the code generation for gridtools
Those two classes share a reasonable amount of functionality and it would be cleaner to have a common base class. This would also simplify code in Accesses
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.