Skip to content

Commit

Permalink
Merge branch 'release/0.17.2'
Browse files Browse the repository at this point in the history
* release/0.17.2:
  Version 0.17.2
  ATLAS-232 Add unit-tests, adapted from MIR (issue MIR-374)
  Apply clang-format
  ATLAS-232 Fixes to Structured grid creation
  Nicer error message for unsupported TransLocal grids
  ATLAS-232 Global grids cropped with zonal or global domains with non-zero west are now respected
  ATLAS-232 Add knowledge of 'west' to ZonalBandDomain and GlobalDomain
  Fix multiple defined symbol
  Fix static linking for LAEA projection
  ATLAS-230 Fix PGI-19.4 compilation of GridTools array (internal compiler bugs)
  Fix bamboo
  • Loading branch information
wdeconinck committed Jun 4, 2019
2 parents b037ec8 + 8fdef00 commit 5064d1e
Show file tree
Hide file tree
Showing 28 changed files with 529 additions and 240 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

## [Unreleased]

## [0.17.2] - 2019-06-04
### Fixed
- Compilation with PGI 19.4
- Structured Grid creation for periodic domains that do not start at 0 degrees longitude (Greenwich)


## [0.17.1] - 2019-04-22
### Added
- Option to declaration of field type (vector/scalar) when creating field in FunctionSpace
Expand Down Expand Up @@ -107,6 +113,8 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
## 0.13.0 - 2018-02-16

[Unreleased]: https://github.com/ecmwf/atlas/compare/master...develop
[0.17.2]: https://github.com/ecmwf/atlas/compare/0.17.1...0.17.2
[0.17.1]: https://github.com/ecmwf/atlas/compare/0.17.0...0.17.1
[0.17.0]: https://github.com/ecmwf/atlas/compare/0.16.0...0.17.0
[0.16.0]: https://github.com/ecmwf/atlas/compare/0.15.2...0.16.0
[0.15.2]: https://github.com/ecmwf/atlas/compare/0.15.1...0.15.2
Expand Down
2 changes: 1 addition & 1 deletion VERSION.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

set ( ${PROJECT_NAME}_VERSION_STR "0.17.1" )
set ( ${PROJECT_NAME}_VERSION_STR "0.17.2" )

1 change: 1 addition & 0 deletions bamboo/CLANG-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module unload emos
module unload fftw
module unload libemos
module unload metview
module unload netcdf4

module load cmake/3.10.2

Expand Down
3 changes: 2 additions & 1 deletion bamboo/GCC-env.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

[[ $(uname) == "Darwin" ]] && return
[[ $(uname) == "Darwin" ]] && return # no module environment on the Mac

# initialise module environment if it is not
if [[ ! $(command -v module > /dev/null 2>&1) ]]; then
Expand All @@ -13,5 +13,6 @@ module unload emos
module unload fftw
module unload libemos
module unload metview
module unload netcdf4

module load cmake/3.10.2
2 changes: 2 additions & 0 deletions bamboo/INTEL-env.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

[[ $(uname) == "Darwin" ]] && return # no module environment on the Mac

# initialise module environment if it is not
if [[ ! $(command -v module > /dev/null 2>&1) ]]; then
. /usr/local/apps/module/init/bash
Expand Down
2 changes: 2 additions & 0 deletions src/atlas/array/gridtools/GridToolsArray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ArrayT_impl {

template <typename... UInts, typename = ::gridtools::is_all_integral<UInts...>>
void construct( UInts... dims ) {
static_assert( sizeof...( UInts ) > 0, "1" );
auto gt_storage = create_gt_storage<Value, typename default_layout_t<sizeof...( dims )>::type>( dims... );
using data_store_t = typename std::remove_pointer<decltype( gt_storage )>::type;
array_.data_store_ = std::unique_ptr<ArrayDataStore>( new GridToolsDataStore<data_store_t>( gt_storage ) );
Expand Down Expand Up @@ -464,6 +465,7 @@ template <typename Value>
ArrayT<Value>::ArrayT( idx_t dim0 ) {
ArrayT_impl<Value>( *this ).construct( dim0 );
}

template <typename Value>
ArrayT<Value>::ArrayT( idx_t dim0, idx_t dim1 ) {
ArrayT_impl<Value>( *this ).construct( dim0, dim1 );
Expand Down
21 changes: 15 additions & 6 deletions src/atlas/array/gridtools/GridToolsArrayHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,15 @@ struct get_pack_size {
using type = ::gridtools::static_uint<sizeof...( T )>;
};

template <typename Value, typename LayoutMap, size_t Rank>
struct gt_storage_t {
using type = gridtools::storage_traits::data_store_t<
Value, gridtools::storage_traits::custom_layout_storage_info_t<0, LayoutMap, ::gridtools::zero_halo<Rank>>>;
};

template <typename Value, typename LayoutMap, typename... UInts>
static gridtools::storage_traits::data_store_t<
Value, gridtools::storage_traits::custom_layout_storage_info_t<
0, LayoutMap, ::gridtools::zero_halo<get_pack_size<UInts...>::type::value>>>*
create_gt_storage( UInts... dims ) {
typename gt_storage_t<Value, LayoutMap, get_pack_size<UInts...>::type::value>::type* create_gt_storage(
UInts... dims ) {
static_assert( ( sizeof...( dims ) > 0 ), "Error: can not create storages without any dimension" );

constexpr static unsigned int rank = get_pack_size<UInts...>::type::value;
Expand All @@ -169,9 +173,14 @@ create_gt_storage( UInts... dims ) {
return ds;
}

template <typename Value, size_t Rank>
struct gt_wrap_storage_t {
using type = gridtools::storage_traits::data_store_t<Value, gridtools::storage_traits::storage_info_t<0, Rank>>;
};

template <typename Value, unsigned int Rank>
static gridtools::storage_traits::data_store_t<Value, gridtools::storage_traits::storage_info_t<0, Rank>>*
wrap_gt_storage( Value* data, std::array<idx_t, Rank>&& shape, std::array<idx_t, Rank>&& strides ) {
static typename gt_wrap_storage_t<Value, Rank>::type* wrap_gt_storage( Value* data, std::array<idx_t, Rank>&& shape,
std::array<idx_t, Rank>&& strides ) {
static_assert( ( Rank > 0 ), "Error: can not create storages without any dimension" );
typedef gridtools::storage_traits::storage_info_t<0, Rank, ::gridtools::zero_halo<Rank>> storage_info_ty;
typedef gridtools::storage_traits::data_store_t<Value, storage_info_ty> data_store_t;
Expand Down
4 changes: 3 additions & 1 deletion src/atlas/array/gridtools/GridToolsArrayView.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include <cstddef>
#include <cstring>

#include "atlas/array/Array.h"
#include "atlas/array/ArrayUtil.h"
#include "atlas/array/ArrayViewDefs.h"
#include "atlas/array/LocalView.h"
#include "atlas/array/gridtools/GridToolsMakeView.h"
#include "atlas/array/gridtools/GridToolsTraits.h"
#include "atlas/library/config.h"

Expand All @@ -26,6 +26,7 @@
namespace atlas {
namespace array {


template <typename Value, int Rank, Intent AccessMode = Intent::ReadWrite>
class ArrayView {
public:
Expand Down Expand Up @@ -57,6 +58,7 @@ class ArrayView {
ATLAS_HOST_DEVICE
ArrayView( const ArrayView& other );
ArrayView( data_view_t data_view, const Array& array );

value_type* data() { return gt_data_view_.data(); }
value_type const* data() const { return gt_data_view_.data(); }

Expand Down
87 changes: 44 additions & 43 deletions src/atlas/array/gridtools/GridToolsMakeView.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
#include <sstream>
#include <vector>

#include "atlas/array.h"
#include "atlas/array/Array.h"
#include "atlas/array/ArrayView.h"
#include "atlas/array/ArrayViewDefs.h"
#include "atlas/array/IndexView.h"
#include "atlas/array/gridtools/GridToolsTraits.h"
#include "atlas/library/config.h"
#include "atlas/runtime/Exception.h"

#include "atlas/library/config.h"
#if ATLAS_HAVE_GRIDTOOLS_STORAGE
#include "atlas/array/gridtools/GridToolsTraits.h"
#endif
//------------------------------------------------------------------------------

namespace atlas {
Expand All @@ -45,20 +44,20 @@ static void check_metadata( const Array& array ) {

namespace gridtools {


template <typename Value, unsigned int Rank, Intent AccessMode>
data_view_tt<Value, Rank, get_access_mode( AccessMode )> make_gt_host_view( const Array& array ) {
typename gt_view<Value, Rank, AccessMode>::type make_gt_host_view( const Array& array ) {
using storage_info_ty = storage_traits::storage_info_t<0, Rank>;
using data_store_t = storage_traits::data_store_t<Value, storage_info_ty>;

data_store_t* ds = reinterpret_cast<data_store_t*>( const_cast<void*>( array.storage() ) );

return ::gridtools::make_host_view<get_access_mode( AccessMode )>( *ds );
}

template <typename Value, unsigned int Rank, Intent AccessMode>
data_view_tt<Value, Rank, get_access_mode( AccessMode )> make_gt_device_view( const Array& array ) {
typedef storage_traits::storage_info_t<0, Rank> storage_info_ty;
typedef storage_traits::data_store_t<Value, storage_info_ty> data_store_t;
typename gt_view<Value, Rank, AccessMode>::type make_gt_device_view( const Array& array ) {
using storage_info_ty = storage_traits::storage_info_t<0, Rank>;
using data_store_t = storage_traits::data_store_t<Value, storage_info_ty>;

data_store_t* ds = reinterpret_cast<data_store_t*>( const_cast<void*>( array.storage() ) );
#if ATLAS_GRIDTOOLS_STORAGE_BACKEND_CUDA
Expand All @@ -67,6 +66,7 @@ data_view_tt<Value, Rank, get_access_mode( AccessMode )> make_gt_device_view( co
return ::gridtools::make_host_view<get_access_mode( AccessMode )>( *ds );
#endif
}

} // namespace gridtools

template <typename Value, unsigned int Rank, Intent AccessMode>
Expand Down Expand Up @@ -114,6 +114,7 @@ ArrayView<Value, Rank, AccessMode> make_view( const Array& array ) {
// Explicit instantiation
namespace atlas {
namespace array {

#define EXPLICIT_TEMPLATE_INSTANTIATION( RANK ) \
template ArrayView<int, RANK, Intent::ReadOnly> make_view<int, RANK, Intent::ReadOnly>( const Array& ); \
template ArrayView<int, RANK, Intent::ReadWrite> make_view<int, RANK, Intent::ReadWrite>( const Array& ); \
Expand Down Expand Up @@ -169,48 +170,47 @@ namespace array {
\
template IndexView<long, RANK> make_host_indexview<long, RANK, Intent::ReadOnly>( const Array& ); \
template IndexView<long, RANK> make_host_indexview<long, RANK, Intent::ReadWrite>( const Array& ); \
\
namespace gridtools { \
template data_view_tt<int, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_host_view<int, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<int, RANK, ::gridtools::access_mode::ReadWrite> \
make_gt_host_view<int, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<long, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_host_view<long, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<long, RANK, ::gridtools::access_mode::ReadWrite> \
make_gt_host_view<long, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<long unsigned, RANK, ::gridtools::access_mode::ReadOnly> \
template typename gt_view<int, RANK, Intent::ReadOnly>::type make_gt_host_view<int, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<int, RANK, Intent::ReadWrite>::type make_gt_host_view<int, RANK, Intent::ReadWrite>( \
const Array& array ); \
template typename gt_view<long, RANK, Intent::ReadOnly>::type make_gt_host_view<long, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<long, RANK, Intent::ReadWrite>::type make_gt_host_view<long, RANK, Intent::ReadWrite>( \
const Array& array ); \
template typename gt_view<long unsigned, RANK, Intent::ReadOnly>::type \
make_gt_host_view<long unsigned, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<long unsigned, RANK, ::gridtools::access_mode::ReadWrite> \
template typename gt_view<long unsigned, RANK, Intent::ReadWrite>::type \
make_gt_host_view<long unsigned, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<float, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_host_view<float, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<float, RANK, ::gridtools::access_mode::ReadWrite> \
make_gt_host_view<float, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<double, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_host_view<double, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<double, RANK, ::gridtools::access_mode::ReadWrite> \
template typename gt_view<float, RANK, Intent::ReadOnly>::type make_gt_host_view<float, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<float, RANK, Intent::ReadWrite>::type make_gt_host_view<float, RANK, Intent::ReadWrite>( \
const Array& array ); \
template typename gt_view<double, RANK, Intent::ReadOnly>::type make_gt_host_view<double, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<double, RANK, Intent::ReadWrite>::type \
make_gt_host_view<double, RANK, Intent::ReadWrite>( const Array& array ); \
\
template data_view_tt<int, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_device_view<int, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<int, RANK, ::gridtools::access_mode::ReadWrite> \
make_gt_device_view<int, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<long, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_device_view<long, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<long, RANK, ::gridtools::access_mode::ReadWrite> \
make_gt_device_view<long, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<long unsigned, RANK, ::gridtools::access_mode::ReadOnly> \
template typename gt_view<int, RANK, Intent::ReadOnly>::type make_gt_device_view<int, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<int, RANK, Intent::ReadWrite>::type make_gt_device_view<int, RANK, Intent::ReadWrite>( \
const Array& array ); \
template typename gt_view<long, RANK, Intent::ReadOnly>::type make_gt_device_view<long, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<long, RANK, Intent::ReadWrite>::type make_gt_device_view<long, RANK, Intent::ReadWrite>( \
const Array& array ); \
template typename gt_view<long unsigned, RANK, Intent::ReadOnly>::type \
make_gt_device_view<long unsigned, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<long unsigned, RANK, ::gridtools::access_mode::ReadWrite> \
template typename gt_view<long unsigned, RANK, Intent::ReadWrite>::type \
make_gt_device_view<long unsigned, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<float, RANK, ::gridtools::access_mode::ReadOnly> \
make_gt_device_view<float, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<float, RANK, ::gridtools::access_mode::ReadWrite> \
template typename gt_view<float, RANK, Intent::ReadOnly>::type make_gt_device_view<float, RANK, Intent::ReadOnly>( \
const Array& array ); \
template typename gt_view<float, RANK, Intent::ReadWrite>::type \
make_gt_device_view<float, RANK, Intent::ReadWrite>( const Array& array ); \
template data_view_tt<double, RANK, ::gridtools::access_mode::ReadOnly> \
template typename gt_view<double, RANK, Intent::ReadOnly>::type \
make_gt_device_view<double, RANK, Intent::ReadOnly>( const Array& array ); \
template data_view_tt<double, RANK, ::gridtools::access_mode::ReadWrite> \
template typename gt_view<double, RANK, Intent::ReadWrite>::type \
make_gt_device_view<double, RANK, Intent::ReadWrite>( const Array& array ); \
}

Expand All @@ -226,5 +226,6 @@ EXPLICIT_TEMPLATE_INSTANTIATION( 8 )
EXPLICIT_TEMPLATE_INSTANTIATION( 9 )

#undef EXPLICIT_TEMPLATE_INSTANTIATION

} // namespace array
} // namespace atlas
11 changes: 9 additions & 2 deletions src/atlas/array/gridtools/GridToolsMakeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ namespace atlas {
namespace array {
namespace gridtools {

template <typename Value, unsigned int Rank, Intent AccessMode>
struct gt_view {
using type = ::gridtools::data_view<
gridtools::storage_traits::data_store_t<Value, gridtools::storage_traits::storage_info_t<0, Rank>>,
gridtools::get_access_mode( AccessMode )>;
};

template <typename Value, unsigned int Rank, Intent AccessMode = Intent::ReadWrite>
data_view_tt<Value, Rank, get_access_mode( AccessMode )> make_gt_host_view( const Array& array );
typename gt_view<Value, Rank, AccessMode>::type make_gt_host_view( const Array& array );

template <typename Value, unsigned int Rank, Intent AccessMode = Intent::ReadWrite>
data_view_tt<Value, Rank, get_access_mode( AccessMode )> make_gt_device_view( const Array& array );
typename gt_view<Value, Rank, AccessMode>::type make_gt_device_view( const Array& array );

} // namespace gridtools
} // namespace array
Expand Down
10 changes: 7 additions & 3 deletions src/atlas/domain/Domain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ bool RectangularDomain::contains_y( double y ) const {
return domain_->contains_y( y );
}

bool RectangularDomain::zonal_band() const {
return domain_->zonal_band();
}

double RectangularDomain::xmin() const {
return domain_->xmin();
}
Expand All @@ -56,9 +60,9 @@ double RectangularDomain::ymax() const {
return domain_->ymax();
}

ZonalBandDomain::ZonalBandDomain( const Interval& y ) :
RectangularDomain( ( ZD::is_global( y ) ) ? new atlas::domain::GlobalDomain()
: new atlas::domain::ZonalBandDomain( y ) ) {}
ZonalBandDomain::ZonalBandDomain( const Interval& y, const double& west ) :
RectangularDomain( ( ZD::is_global( y ) ) ? new atlas::domain::GlobalDomain( west )
: new atlas::domain::ZonalBandDomain( y, west ) ) {}

ZonalBandDomain::ZonalBandDomain( const Domain& domain ) :
RectangularDomain( domain ),
Expand Down
Loading

0 comments on commit 5064d1e

Please sign in to comment.