Skip to content

Commit

Permalink
Merge branch 'release/0.32.0'
Browse files Browse the repository at this point in the history
* release/0.32.0: (25 commits)
  Version 0.32.0
  Fix compilation with ATLAS_BITS_LOCAL=64
  Add function SolidBodyRotation
  Serial distribution to use entire mesh on every partition (#114)
  Adapt StructuredMeshGenerator to allow creation of meshes where some mpi tasks have no elements or nodes
  Allow interpolation to partitions without points or elements
  Remove assertion checking for empty mesh partition in NodeColumns (see #108)
  Wrap-around the longitudes in the polygon locator (#108)
  Github Actions: Prevent homebrew from auto-updating
  Github Actions: Prevent homebrew from auto-updating
  Github Actions: Update macos-11 to macos-12 (latest available)
  ATLAS-373 Enable gaussian latitudes computation for very high resolution, improving memory requirement with orders of magnitude
  Cosmetic change
  Add Fortran constructors for ShiftedLonLat, ShiftedLon, ShiftedLat  grids
  ATLAS-372: Add missing header file
  Fixup previous commit, fixing segmentation fault
  Support more functionspaces for interpolation with FiniteElement, UnstructuredBilinearLonLat, GridBoxMethod, (K)NearestNeighbour
  Rename StructuredMeshGenerator option 3d -> three_dimensional, but still backward compatible
  Fix interpolation method UnstructuredBilinearLonLat for failing triangular elements
  Add missing CellColumns::halo() function
  ...
  • Loading branch information
wdeconinck committed Jan 23, 2023
2 parents 214ff20 + df95b8e commit 60b00c0
Show file tree
Hide file tree
Showing 53 changed files with 2,836 additions and 285 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ jobs:

- name: macos
# Xcode compiler requires empty environment variables, so we pass null (~) here
os: macos-11
compiler: clang-12
os: macos-12
compiler: clang-14
compiler_cc: ~
compiler_cxx: ~
compiler_fc: gfortran-11
Expand All @@ -110,6 +110,12 @@ jobs:
echo "FC=${{ matrix.compiler_fc }}" >> $GITHUB_ENV
if [[ "${{ matrix.os }}" =~ macos ]]; then
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
echo "HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1" >> $GITHUB_ENV
echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $GITHUB_ENV
echo "HOMEBREW_NO_INSTALL_CLEANUP=1" >> $GITHUB_ENV
brew install ninja
brew install libomp
else
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

## [Unreleased]

## [0.32.0] - 2023-01-23
### Added
- Added BlockStructuredColumns FunctionSpace
- Added function SolidBodyRotation
- Added convenience Fortran constructors for ShiftedLonLat, SHiftedLon, ShiftedLat
- Support for more FunctionSpaces in various interpolation methods

### Changed
- PolygonLocator now wraps around longitudes for non-matching domains
- StructuredMeshGenerator can generate meshes with partitions without elements
- SerialDistribution makes every MPI task have the entire mesh

### Fixed
- Remove assertion for checking of empty mesh in NodeColumns FunctionSpace
- Gaussian latitudes can now be computed for very high resolution, without running out of memory.
- Interpolation to functionspaces with empty partitions

## [0.31.1] - 2022-11-11
### Fixed
- Fix bug introduced in StructuredMeshGenerator global numbering with release 0.31.0 in commit a63fc62a2
Expand Down Expand Up @@ -411,6 +428,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.32.0]: https://github.com/ecmwf/atlas/compare/0.31.1...0.32.0
[0.31.1]: https://github.com/ecmwf/atlas/compare/0.31.0...0.31.1
[0.31.0]: https://github.com/ecmwf/atlas/compare/0.30.0...0.31.0
[0.30.0]: https://github.com/ecmwf/atlas/compare/0.29.0...0.30.0
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.31.1
0.32.0
3 changes: 3 additions & 0 deletions src/apps/atlas-gaussian-latitudes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class AtlasGaussianLatitudes : public eckit::Tool {

public:
AtlasGaussianLatitudes(int argc, char** argv): eckit::Tool(argc, argv) {
atlas::initialise(argc,argv);

do_run = false;

bool help = Resource<bool>("--help", false);
Expand Down Expand Up @@ -132,6 +134,7 @@ void AtlasGaussianLatitudes::run() {
}
std::cout << "};" << std::endl;
}
atlas::finalise();
}

//------------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions src/atlas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ field/detail/MissingValue.h

list( APPEND atlas_functionspace_srcs
functionspace.h
functionspace/BlockStructuredColumns.h
functionspace/BlockStructuredColumns.cc
functionspace/CellColumns.h
functionspace/CellColumns.cc
functionspace/EdgeColumns.h
Expand All @@ -454,6 +456,10 @@ functionspace/PointCloud.h
functionspace/PointCloud.cc
functionspace/CubedSphereColumns.h
functionspace/CubedSphereColumns.cc
functionspace/detail/BlockStructuredColumns.h
functionspace/detail/BlockStructuredColumns.cc
functionspace/detail/BlockStructuredColumnsInterface.h
functionspace/detail/BlockStructuredColumnsInterface.cc
functionspace/detail/FunctionSpaceImpl.h
functionspace/detail/FunctionSpaceImpl.cc
functionspace/detail/FunctionSpaceInterface.h
Expand Down Expand Up @@ -751,6 +757,8 @@ util/detail/BlackMagic.h
util/detail/Cache.h
util/detail/Debug.h
util/detail/KDTree.h
util/function/SolidBodyRotation.h
util/function/SolidBodyRotation.cc
util/function/SphericalHarmonic.h
util/function/SphericalHarmonic.cc
util/function/VortexRollup.h
Expand Down
63 changes: 63 additions & 0 deletions src/atlas/functionspace/BlockStructuredColumns.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* (C) Copyright 2013 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/

#include "atlas/functionspace/BlockStructuredColumns.h"

namespace atlas {
namespace functionspace {

// ----------------------------------------------------------------------------

BlockStructuredColumns::BlockStructuredColumns(): FunctionSpace(), functionspace_(nullptr) {}

BlockStructuredColumns::BlockStructuredColumns(const FunctionSpace& functionspace):
FunctionSpace(functionspace),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

BlockStructuredColumns::BlockStructuredColumns(const Grid& grid, const eckit::Configuration& config):
FunctionSpace(new detail::BlockStructuredColumns(grid, config)),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

BlockStructuredColumns::BlockStructuredColumns(const Grid& grid, const grid::Partitioner& partitioner,
const eckit::Configuration& config):
FunctionSpace(new detail::BlockStructuredColumns(grid, partitioner, config)),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

BlockStructuredColumns::BlockStructuredColumns(const Grid& grid, const grid::Distribution& distribution,
const eckit::Configuration& config):
FunctionSpace(new detail::BlockStructuredColumns(grid, distribution, config)),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

BlockStructuredColumns::BlockStructuredColumns(const Grid& grid, const Vertical& vertical, const eckit::Configuration& config):
FunctionSpace(new detail::BlockStructuredColumns(grid, vertical, config)),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

BlockStructuredColumns::BlockStructuredColumns(const Grid& grid, const Vertical& vertical, const grid::Partitioner& partitioner,
const eckit::Configuration& config):
FunctionSpace(new detail::BlockStructuredColumns(grid, vertical, partitioner, config)),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

BlockStructuredColumns::BlockStructuredColumns(const Grid& grid, const grid::Distribution& distribution, const Vertical& vertical,
const eckit::Configuration& config):
FunctionSpace(new detail::BlockStructuredColumns(grid, distribution, vertical, config)),
functionspace_(dynamic_cast<const detail::BlockStructuredColumns*>(get())) {}

std::string BlockStructuredColumns::checksum(const FieldSet& fieldset) const {
return functionspace_->checksum(fieldset);
}

std::string BlockStructuredColumns::checksum(const Field& field) const {
return functionspace_->checksum(field);
}

// ----------------------------------------------------------------------------

} // namespace functionspace
} // namespace atlas
100 changes: 100 additions & 0 deletions src/atlas/functionspace/BlockStructuredColumns.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* (C) Copyright 2013 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/
#pragma once

#include <functional>
#include <type_traits>

#include "atlas/functionspace/FunctionSpace.h"
#include "atlas/functionspace/StructuredColumns.h"
#include "atlas/functionspace/detail/BlockStructuredColumns.h"

namespace atlas {
namespace functionspace {

// -------------------------------------------------------------------

class BlockStructuredColumns : public FunctionSpace {
public:
class Block;
public:
BlockStructuredColumns();
BlockStructuredColumns(const FunctionSpace&);
BlockStructuredColumns(const Grid&, const eckit::Configuration& = util::NoConfig());
BlockStructuredColumns(const Grid&, const grid::Partitioner&, const eckit::Configuration& = util::NoConfig());
BlockStructuredColumns(const Grid&, const grid::Distribution&, const eckit::Configuration& = util::NoConfig());
BlockStructuredColumns(const Grid&, const Vertical&, const eckit::Configuration& = util::NoConfig());
BlockStructuredColumns(const Grid&, const Vertical&, const grid::Partitioner&,
const eckit::Configuration& = util::NoConfig());
BlockStructuredColumns(const Grid&, const grid::Distribution&, const Vertical&,
const eckit::Configuration& = util::NoConfig());

static std::string type() { return detail::BlockStructuredColumns::static_type(); }

operator bool() const { return valid(); }
bool valid() const { return functionspace_; }

idx_t size() const { return functionspace_->size(); }
// idx_t sizeOwned() const { return functionspace_->sizeOwned(); }
// idx_t sizeHalo() const { return functionspace_->sizeHalo(); }
idx_t levels() const { return functionspace_->levels(); }

const Vertical& vertical() const { return functionspace_->vertical(); }

const StructuredGrid& grid() const { return functionspace_->grid(); }

std::string checksum(const FieldSet&) const;
std::string checksum(const Field&) const;

idx_t index(idx_t blk, idx_t rof) const { return functionspace_->index(blk, rof); }
// idx_t i_begin(idx_t j) const { return functionspace_->i_begin(j); }
// idx_t i_end(idx_t j) const { return functionspace_->i_end(j); }
// idx_t j_begin() const { return functionspace_->j_begin(); }
// idx_t j_end() const { return functionspace_->j_end(); }
idx_t k_begin() const { return functionspace_->k_begin(); }
idx_t k_end() const { return functionspace_->k_end(); }
idx_t nproma() const { return functionspace_->nproma(); }
idx_t nblks() const { return functionspace_->nblks(); }

Field xy() const { return functionspace_->xy(); }
Field partition() const { return functionspace_->partition(); }
Field global_index() const { return functionspace_->global_index(); }
Field remote_index() const { return functionspace_->remote_index(); }
Field index_i() const { return functionspace_->index_i(); }
Field index_j() const { return functionspace_->index_j(); }
Field ghost() const { return functionspace_->ghost(); }

const Block block(idx_t jblk) const {
return Block(functionspace_->block_begin(jblk), functionspace_->block_size(jblk));
}

size_t footprint() const { return functionspace_->footprint(); }

class Block {
public:
Block(idx_t begin, idx_t size) : begin_(begin), size_(size) {}
idx_t index(idx_t j) const { return begin_ + j; };
idx_t size() const { return size_; }
private:
idx_t begin_;
idx_t size_;
};

private:
const detail::BlockStructuredColumns* functionspace_;
void setup(const Grid& grid, const Vertical& vertical, const grid::Distribution& distribution,
const eckit::Configuration& config);
};

// -------------------------------------------------------------------


} // namespace functionspace
} // namespace atlas
10 changes: 9 additions & 1 deletion src/atlas/functionspace/CellColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ Field CellColumns::createField(const eckit::Configuration& options) const {
}

Field CellColumns::createField(const Field& other, const eckit::Configuration& config) const {
return createField(option::datatype(other.datatype()) | option::levels(other.levels()) |
return createField(option::name(other.name()) | option::datatype(other.datatype()) | option::levels(other.levels()) |
option::variables(other.variables()) | config);
}

Expand Down Expand Up @@ -472,8 +472,12 @@ void CellColumns::scatter(const FieldSet& global_fieldset, FieldSet& local_field
throw_Exception("datatype not supported", Here());
}

auto name = loc.name();
glb.metadata().broadcast(loc.metadata(), root);
loc.metadata().set("global", false);
if( !name.empty() ) {
loc.metadata().set("name", name);
}
}
}
void CellColumns::scatter(const Field& global, Field& local) const {
Expand Down Expand Up @@ -835,5 +839,9 @@ const parallel::Checksum& CellColumns::checksum() const {
return functionspace_->checksum();
}

const mesh::Halo& CellColumns::halo() const {
return functionspace_->halo();
}

} // namespace functionspace
} // namespace atlas
4 changes: 4 additions & 0 deletions src/atlas/functionspace/CellColumns.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class CellColumns : public functionspace::FunctionSpaceImpl {

// -- Parallelisation aware methods

const mesh::Halo& halo() const { return halo_; }

void haloExchange(const FieldSet&, bool on_device = false) const override;
void haloExchange(const Field&, bool on_device = false) const override;
const parallel::HaloExchange& halo_exchange() const;
Expand Down Expand Up @@ -181,6 +183,8 @@ class CellColumns : public FunctionSpace {
const mesh::HybridElements& cells() const;

// -- Parallelisation aware methods
const mesh::Halo& halo() const;

const parallel::HaloExchange& halo_exchange() const;

std::string checksum(const FieldSet&) const;
Expand Down
7 changes: 4 additions & 3 deletions src/atlas/functionspace/NodeColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ NodeColumns::NodeColumns(Mesh mesh, const eckit::Configuration& config):
else {
halo_ = mesh::Halo(mesh);
}
ATLAS_ASSERT(mesh_);
mesh::actions::build_nodes_parallel_fields(mesh_.nodes());
mesh::actions::build_periodic_boundaries(mesh_);

Expand Down Expand Up @@ -333,7 +332,7 @@ Field NodeColumns::createField(const eckit::Configuration& config) const {
}

Field NodeColumns::createField(const Field& other, const eckit::Configuration& config) const {
return createField(option::datatype(other.datatype()) | option::levels(other.levels()) |
return createField(option::name(other.name()) | option::datatype(other.datatype()) | option::levels(other.levels()) |
option::variables(other.variables()) | config);
}

Expand Down Expand Up @@ -540,7 +539,9 @@ void NodeColumns::scatter(const FieldSet& global_fieldset, FieldSet& local_field
auto name = loc.name();
glb.metadata().broadcast(loc.metadata(), root);
loc.metadata().set("global", false);
loc.metadata().set("name", name);
if( !name.empty() ) {
loc.metadata().set("name", name);
}
}
}

Expand Down
Loading

0 comments on commit 60b00c0

Please sign in to comment.