Skip to content

Commit

Permalink
Merge branch 'release/0.23.0'
Browse files Browse the repository at this point in the history
* release/0.23.0: (44 commits)
  Update CHANGELOG.md
  Fixes for Cray 8.5
  Version 0.23.0
  clang-format
  ATLAS-301 [sandbox] atlas-parallel-interpolation: add 'fixup' option
  ATLAS-301 [sandbox] atlas-parallel-interpolation: Use default meshgenerator specified by grid
  ATLAS-301 atlas-meshgen: --fixup option e.g for ORCA grid custom fixes
  ATLAS-301 Gmsh output only non-missing values
  ATLAS-301 Do not add INVALID elements to kdtree
  ATLAS-301 Add INVALID topology flag
  ATLAS-301 Use new eckit Plugin system, requires eckit 1.15.0
  ATLAS-315 Normalise target grid longitudes to source grid in StructuredInterpolation2D
  ATLAS-318 cleanup
  ATLAS-318 Example use of sparse_matrix_multiply in test_interpolation_finite_element_cached to do the interpolation manually
  ATLAS-318 atlas::linalg::sparse_matrix_multiply to abstract different implementations
  ATLAS-321 Implement eckit::KDTree::size() useful to compute KDTree memory footprint()
  ATLAS-321 Interpolation IndexKDTreeCache and use it within GridBoxAverage
  ATLAS-321 Interpolation MatrixCache and use it with FiniteElement
  Avoid costly polygon tests in case mpi::size() == 1
  ATLAS_TRACE_MEMORY=1 to enable logging of some memory usage, also requires ATLAS_TRACE=1
  ...
  • Loading branch information
wdeconinck committed Jan 19, 2021
2 parents e55e9c7 + 31a3b26 commit 7e0a125
Show file tree
Hide file tree
Showing 116 changed files with 4,174 additions and 591 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

## [Unreleased]

## [0.23.0] - 2021-01-19
### Fixed
- Structured interpolation method interpolating to area straddling Greenwich.
- Fixes when compiling with ATLAS_BITS_LOCAL=64

### Changed
- Possibility to link to alternative open-source version of IFS trans library.

### Added
- Caching mechanism for interpolation

## [0.22.1] - 2020-10-22
### Fixed
- Installation of PGI compilers via tools/install-pgi.sh
Expand Down Expand Up @@ -250,6 +261,7 @@ 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.23.0]: https://github.com/ecmwf/atlas/compare/0.22.1...0.23.0
[0.22.1]: https://github.com/ecmwf/atlas/compare/0.22.0...0.22.1
[0.22.0]: https://github.com/ecmwf/atlas/compare/0.21.0...0.22.0
[0.21.0]: https://github.com/ecmwf/atlas/compare/0.20.2...0.21.0
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set( ATLAS_BITS_LOCAL 32 CACHE STRING "bits used to define a local index (atlas
################################################################################
# Required packages

ecbuild_find_package( NAME eckit VERSION 1.4.0 REQUIRED )
ecbuild_find_package( NAME eckit VERSION 1.15.0 REQUIRED )
ecbuild_debug( " eckit_FEATURES : [${eckit_FEATURES}]" )

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.22.1
0.23.0
36 changes: 27 additions & 9 deletions cmake/atlas-import.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ endif()

## transi
if( atlas_HAVE_TRANS AND atlas_REQUIRES_PRIVATE_DEPENDENCIES )
find_dependency( transi HINTS ${CMAKE_CURRENT_LIST_DIR}/../transi @transi_DIR@ @transi_BINARY_DIR@ )
set( transi_DIR @transi_DIR@ )
if( transi_DIR )
find_dependency( transi HINTS ${CMAKE_CURRENT_LIST_DIR}/../transi @transi_DIR@ )
else()
find_dependency( trans COMPONENTS transi double HINTS ${CMAKE_CURRENT_LIST_DIR}/../trans @trans_DIR@ )
endif()
endif()

## CGAL
Expand All @@ -86,11 +91,11 @@ set( @PROJECT_NAME@_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE STRING "" )
function( atlas_create_plugin name )

set( options )
set( single_value_args VERSION )
set( multi_value_args LIBRARY )
set( single_value_args VERSION LIBRARY URL NAMESPACE)
set( multi_value_args )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )

set( _plugin_file share/atlas/plugins/${name}.yml )
set( _plugin_file share/plugins/${name}.yml )

if( NOT DEFINED _PAR_VERSION )
set( _version ${${PROJECT_NAME}_VERSION} )
Expand All @@ -102,10 +107,23 @@ function( atlas_create_plugin name )
else()
set( _library "${_PAR_LIBRARY}" )
endif()
file( WRITE ${CMAKE_BINARY_DIR}/${_plugin_file} "name: ${name}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} "version: ${_version}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} "library: ${_library}" )
install( FILES ${CMAKE_BINARY_DIR}/${_plugin_file} DESTINATION share/atlas/plugins )
if( NOT DEFINED _PAR_URL )
set( _url "http://www.ecmwf.int" )
else()
set( _url ${_PAR_URL} )
endif()
if( NOT DEFINED _PAR_NAMESPACE )
set( _namespace "int.ecmwf" )
else()
set( _namespace ${_PAR_NAMESPACE} )
endif()

endfunction()
file( WRITE ${CMAKE_BINARY_DIR}/${_plugin_file} "plugin:\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} " name: ${name}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} " namespace: ${_namespace}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} " url: ${_url}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} " version: ${_version}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${_plugin_file} " library: ${_library}\n" )

install( FILES ${CMAKE_BINARY_DIR}/${_plugin_file} DESTINATION share/plugins )
endfunction()
10 changes: 2 additions & 8 deletions cmake/features/OMP.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
### OMP ...
if( "${CMAKE_VERSION}" VERSION_LESS "3.11" )
if( ENABLE_OMP )
ecbuild_warn( "OpenMP only supported with CMake 3.11 onwards" )
endif()
else()
find_package( OpenMP COMPONENTS CXX ${Fortran} )
endif()
find_package( OpenMP COMPONENTS CXX ${Fortran} )
ecbuild_add_option( FEATURE OMP
DESCRIPTION "support for OpenMP shared memory parallelism"
CONDITION OpenMP_Fortran_FOUND OR OpenMP_CXX_FOUND )
Expand Down Expand Up @@ -56,4 +50,4 @@ if( HAVE_OMP_CXX )
endif()
endif()

endif()
endif()
19 changes: 17 additions & 2 deletions cmake/features/TRANS.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
### trans ...

ecbuild_find_package( NAME transi VERSION 0.4.4 QUIET )
if( ENABLE_TRANS OR NOT DEFINED ENABLE_TRANS )
find_package( trans 47.2 COMPONENTS transi double QUIET )
if( TARGET transi_dp )
set( transi_FOUND TRUE )
if( NOT TARGET transi )
get_target_property( transi_dp_IMPORTED transi_dp IMPORTED )
if( transi_dp_IMPORTED )
set_target_properties( transi_dp PROPERTIES IMPORTED_GLOBAL TRUE) # required for aliasing imports
endif()
add_library( transi ALIAS transi_dp )
endif()
else()
find_package( transi 0.8 QUIET )
endif()
endif()

ecbuild_add_option( FEATURE TRANS
DESCRIPTION "Support for spectral transforms"
DESCRIPTION "Support for IFS spectral transforms"
CONDITION transi_FOUND )
2 changes: 1 addition & 1 deletion doc/example-projects/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Usage:

atlas_DIR=<path-to-install-or-build-tree> ./build_hello_world.sh
atlas_ROOT=<path-to-install-or-build-tree> ./build_hello_world.sh

2 changes: 1 addition & 1 deletion doc/example-projects/project_hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project( hello_world VERSION 0.0.0 LANGUAGES CXX )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

project( hello_world VERSION 0.0.0 LANGUAGES Fortran )

Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ if( CMAKE_BUILD_TYPE MATCHES "Debug" )
set( atlas_BUILD_TYPE_DEBUG 1 )
endif()

ecbuild_parse_version( ${eckit_VERSION} PREFIX ATLAS_ECKIT )
math( EXPR ATLAS_ECKIT_VERSION_INT "( 10000 * ${ATLAS_ECKIT_VERSION_MAJOR} ) + ( 100 * ${ATLAS_ECKIT_VERSION_MINOR} ) + ${ATLAS_ECKIT_VERSION_PATCH}" )

add_subdirectory( atlas_acc_support )

add_subdirectory( atlas )
Expand Down
11 changes: 8 additions & 3 deletions src/apps/atlas-meshgen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ MeshGenerator make_meshgenerator( const Grid& grid, const AtlasTool::Args& args
config.set( "3d", false );
}

config.set( "patch_pole", args.getBool( "patch_pole", false ) );
config.set( "include_pole", args.getBool( "include-pole", false ) );
config.set( "patch_pole", args.getBool( "patch-pole", false ) );
if ( args.has( "fixup" ) ) {
config.set( "fixup", args.getBool( "fixup" ) );
}

return MeshGenerator{config};
}
Expand Down Expand Up @@ -131,8 +135,8 @@ Meshgen2Gmsh::Meshgen2Gmsh( int argc, char** argv ) : AtlasTool( argc, argv ) {
"partitioner", "Mesh partitioner [equal_regions,checkerboard,equal_bands,regular_bands" ) );

add_option( new Separator( "Options for `--generator=structured`" ) );
add_option( new SimpleOption<bool>( "include_pole", "Include pole point" ) );
add_option( new SimpleOption<bool>( "patch_pole", "Patch poles with elements." ) );
add_option( new SimpleOption<bool>( "include-pole", "Include pole point" ) );
add_option( new SimpleOption<bool>( "patch-pole", "Patch poles with elements." ) );
add_option( new SimpleOption<double>(
"angle", "Maximum element-edge slant deviation from meridian in degrees. \n" + indent() +
" Value range between 0 and 30\n" + indent() +
Expand All @@ -156,6 +160,7 @@ Meshgen2Gmsh::Meshgen2Gmsh( int argc, char** argv ) : AtlasTool( argc, argv ) {
"water", "Output elements containing water points (not specifying --water or --land enables both)" ) );
add_option( new SimpleOption<bool>(
"land", "Output elements containing land points (not specifying --water or --land enables both)" ) );
add_option( new SimpleOption<bool>( "fixup", "Apply custom fixes to the mesh where it applies" ) );
}

//-----------------------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions src/atlas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ grid/detail/grid/LonLat.h
grid/detail/grid/LonLat.cc
grid/detail/grid/Regional.h
grid/detail/grid/Regional.cc
grid/detail/grid/Healpix.h
grid/detail/grid/Healpix.cc

grid/detail/distribution/DistributionImpl.h
grid/detail/distribution/DistributionImpl.cc
Expand Down Expand Up @@ -350,6 +352,8 @@ meshgenerator/detail/MeshGeneratorImpl.cc
meshgenerator/detail/MeshGeneratorImpl.h
meshgenerator/detail/MeshGeneratorInterface.cc
meshgenerator/detail/MeshGeneratorInterface.h
meshgenerator/detail/HealpixMeshGenerator.h
meshgenerator/detail/HealpixMeshGenerator.cc
)

list( APPEND atlas_output_srcs
Expand Down Expand Up @@ -477,6 +481,8 @@ endif()

list( APPEND atlas_interpolation_srcs
interpolation.h
interpolation/Cache.cc
interpolation/Cache.h
interpolation/Interpolation.cc
interpolation/Interpolation.h
interpolation/NonLinear.cc
Expand Down Expand Up @@ -546,6 +552,18 @@ interpolation/nonlinear/Missing.cc
interpolation/nonlinear/Missing.h
interpolation/nonlinear/NonLinear.cc
interpolation/nonlinear/NonLinear.h

linalg/Indexing.h
linalg/Introspection.h
linalg/View.h
linalg/sparse.h
linalg/sparse/Backend.h
linalg/sparse/Backend.cc
linalg/sparse/SparseMatrixMultiply.h
linalg/sparse/SparseMatrixMultiply_EckitLinalg.h
linalg/sparse/SparseMatrixMultiply_EckitLinalg.cc
linalg/sparse/SparseMatrixMultiply_OpenMP.h
linalg/sparse/SparseMatrixMultiply_OpenMP.cc
)


Expand Down
22 changes: 12 additions & 10 deletions src/atlas/array/helpers/ArraySlicer.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,37 +149,39 @@ class ArraySlicer {
};

template <typename Int>
static int offset_part( View& view, int& i_view, Int idx ) {
static idx_t offset_part( View& view, int& i_view, Int idx ) {
return idx * view.stride( i_view++ );
}

static int offset_part( View& view, int& i_view, Range range ) { return range.start() * view.stride( i_view++ ); }
static idx_t offset_part( View& view, int& i_view, Range range ) { return range.start() * view.stride( i_view++ ); }

static int offset_part( View& view, int& i_view, RangeAll range ) {
static idx_t offset_part( View& view, int& i_view, RangeAll range ) {
return range.start() * view.stride( i_view++ );
}

static int offset_part( View& view, int& i_view, RangeTo range ) { return range.start() * view.stride( i_view++ ); }
static idx_t offset_part( View& view, int& i_view, RangeTo range ) {
return range.start() * view.stride( i_view++ );
}

static int offset_part( View& view, int& i_view, RangeFrom range ) {
static idx_t offset_part( View& view, int& i_view, RangeFrom range ) {
return range.start() * view.stride( i_view++ );
}

static int offset_part( View&, int& /*i_view*/, RangeDummy ) { return 0; }
static idx_t offset_part( View&, int& /*i_view*/, RangeDummy ) { return 0; }

template <int Dim, typename Int, typename... Ints>
static int offset_remaining( View& view, int& i_view, const Int idx, const Ints... next_idx ) {
const int p = offset_part( view, i_view, idx );
static idx_t offset_remaining( View& view, int& i_view, const Int idx, const Ints... next_idx ) {
const idx_t p = offset_part( view, i_view, idx );
return p + offset_remaining<Dim + 1>( view, i_view, next_idx... );
}

template <int Dim, typename Int>
static int offset_remaining( View& view, int& i_view, const Int last_idx ) {
static idx_t offset_remaining( View& view, int& i_view, const Int last_idx ) {
return offset_part( view, i_view, last_idx );
}

template <typename... Args>
static int offset( View& view, const Args... args ) {
static idx_t offset( View& view, const Args... args ) {
int i_view( 0 );
return offset_remaining<0>( view, i_view, args... );
}
Expand Down
40 changes: 26 additions & 14 deletions src/atlas/array/native/NativeDataStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <sstream>

#include "atlas/array/ArrayUtil.h"
#include "atlas/library/Library.h"
#include "atlas/library/config.h"
#include "atlas/runtime/Exception.h"
#include "atlas/runtime/Log.h"
Expand All @@ -39,14 +40,18 @@ struct MemoryHighWatermark {
MemoryHighWatermark& operator+=( const size_t& bytes ) {
bytes_ += bytes;
update_maximum();
Log::trace() << "Memory: " << eckit::Bytes( double( bytes_ ) ) << "\t( +" << eckit::Bytes( double( bytes ) )
<< " \t| high watermark " << eckit::Bytes( double( high_ ) ) << "\t)" << std::endl;
if ( atlas::Library::instance().traceMemory() ) {
Log::trace() << "Memory: " << eckit::Bytes( double( bytes_ ) ) << "\t( +" << eckit::Bytes( double( bytes ) )
<< " \t| high watermark " << eckit::Bytes( double( high_ ) ) << "\t)" << std::endl;
}
return *this;
}
MemoryHighWatermark& operator-=( const size_t& bytes ) {
bytes_ -= bytes;
Log::trace() << "Memory: " << eckit::Bytes( double( bytes_ ) ) << "\t( -" << eckit::Bytes( double( bytes ) )
<< " \t| high watermark " << eckit::Bytes( double( high_ ) ) << "\t)" << std::endl;
if ( atlas::Library::instance().traceMemory() ) {
Log::trace() << "Memory: " << eckit::Bytes( double( bytes_ ) ) << "\t( -" << eckit::Bytes( double( bytes ) )
<< " \t| high watermark " << eckit::Bytes( double( high_ ) ) << "\t)" << std::endl;
}
return *this;
}

Expand Down Expand Up @@ -125,20 +130,27 @@ class DataStore : public ArrayDataStore {
}

void alloc_aligned( Value*& ptr, size_t n ) {
const size_t alignment = 64 * sizeof( Value );
size_t bytes = sizeof( Value ) * n;
MemoryHighWatermark::instance() += bytes;

int err = posix_memalign( (void**)&ptr, alignment, bytes );
if ( err ) {
throw_AllocationFailed( bytes, Here() );
if ( n > 0 ) {
const size_t alignment = 64 * sizeof( Value );
size_t bytes = sizeof( Value ) * n;
MemoryHighWatermark::instance() += bytes;

int err = posix_memalign( (void**)&ptr, alignment, bytes );
if ( err ) {
throw_AllocationFailed( bytes, Here() );
}
}
else {
ptr = nullptr;
}
}

void free_aligned( Value*& ptr ) {
free( ptr );
ptr = nullptr;
MemoryHighWatermark::instance() -= footprint();
if ( size_ ) {
free( ptr );
ptr = nullptr;
MemoryHighWatermark::instance() -= footprint();
}
}

size_t footprint() const { return sizeof( Value ) * size_; }
Expand Down
9 changes: 6 additions & 3 deletions src/atlas/functionspace/detail/StructuredColumns_setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,12 @@ void StructuredColumns::setup( const grid::Distribution& distribution, const eck
compute_j = [this, &compute_j, &periodic_y]( idx_t j ) -> idx_t {
if ( periodic_y ) {
const idx_t ny = grid_->ny();
while ( j < 0 )
while ( j < 0 ) {
j += ny;
while ( j >= ny )
}
while ( j >= ny ) {
j -= ny;
}
}
else {
if ( j < 0 ) {
Expand Down Expand Up @@ -319,12 +321,13 @@ void StructuredColumns::setup( const grid::Distribution& distribution, const eck
gidx_t g;
jj = compute_j( j );
ii = compute_i( i, jj );
if ( !periodic_y )
if ( !periodic_y ) {
if ( jj != j ) {
ATLAS_ASSERT( grid_->nx( jj ) % 2 == 0 ); // assert even number of points
ii = ( ii < grid_->nx( jj ) / 2 ) ? ii + grid_->nx( jj ) / 2
: ( ii >= grid_->nx( jj ) / 2 ) ? ii - grid_->nx( jj ) / 2 : ii;
}
}
g = global_offsets[jj] + ii + 1;
return g;
};
Expand Down
Loading

0 comments on commit 7e0a125

Please sign in to comment.