Skip to content

Commit

Permalink
Merge branch 'hotfix/0.15.1'
Browse files Browse the repository at this point in the history
* hotfix/0.15.1:
  Update changelog
  VERSION 0.15.1
  fix compilation of combination ENABLE_FORTRAN=OFF and ENABLE_SANDBOX=ON
  repurpose atlas-benchmark-build-halo to atlas-benchmark-ifs-setup
  ATLAS-170 Workaround intel compiler bug by disabling '-g' flag
  Revert "ATLAS-170 Workaround intel compiler bug"
  ATLAS-170 Workaround intel compiler bug
  Fix multiple setup call (no effect)
  FCKIT-4 final subroutines must be 'impure elemental' for it to work for arrays automatically
  Fix memory leak
  Apply clang-format
  ATLAS-168 Split Trans backend from builders
  • Loading branch information
wdeconinck committed Jul 17, 2018
2 parents 6a53e43 + c7fb665 commit c321078
Show file tree
Hide file tree
Showing 48 changed files with 213 additions and 191 deletions.
7 changes: 7 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.15.1] - 2018-07-17
### Fixed
- Compilation for Intel 18 debug
- Memory bug for spherical harmonics
- Compatibility with fckit 0.5.1

## [0.15.0] - 2018-06-19
### Changed
- Native Array data storage uses now a raw C pointer instead of std::vector
Expand Down Expand Up @@ -39,6 +45,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.15.1]: https://github.com/ecmwf/atlas/compare/0.15.0...0.15.1
[0.15.0]: https://github.com/ecmwf/atlas/compare/0.14.0...0.15.0
[0.14.0]: https://github.com/ecmwf/atlas/compare/0.13.2...0.14.0
[0.13.2]: https://github.com/ecmwf/atlas/compare/0.13.1...0.13.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.15.0" )
set ( ${PROJECT_NAME}_VERSION_STR "0.15.1" )

20 changes: 9 additions & 11 deletions src/atlas/numerics/fvm/Method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "atlas/numerics/fvm/Method.h"
#include "atlas/parallel/omp/omp.h"
#include "atlas/runtime/ErrorHandling.h"
#include "atlas/runtime/Trace.h"
#include "atlas/util/CoordinateEnums.h"
#include "atlas/util/Earth.h"

Expand Down Expand Up @@ -58,13 +59,9 @@ double get_radius( const eckit::Parametrisation& params ) {

} // namespace

Method::Method( Mesh& mesh ) : Method::Method( mesh, util::NoConfig() ) {
setup();
}
Method::Method( Mesh& mesh ) : Method::Method( mesh, util::NoConfig() ) {}

Method::Method( Mesh& mesh, const mesh::Halo& halo ) : Method::Method( mesh, util::Config( "halo", halo.size() ) ) {
setup();
}
Method::Method( Mesh& mesh, const mesh::Halo& halo ) : Method::Method( mesh, util::Config( "halo", halo.size() ) ) {}

Method::Method( Mesh& mesh, const eckit::Configuration& params ) :
mesh_( mesh ),
Expand All @@ -77,16 +74,17 @@ Method::Method( Mesh& mesh, const eckit::Configuration& params ) :
}

void Method::setup() {
ATLAS_TRACE( "fvm::Method::setup " );
util::Config node_columns_config;
node_columns_config.set( "halo", halo_.size() );
if ( levels_ ) node_columns_config.set( "levels", levels_ );
node_columns_ = functionspace::NodeColumns( mesh(), node_columns_config );
if ( edges_.size() == 0 ) {
build_edges( mesh() );
build_pole_edges( mesh() );
build_edges_parallel_fields( mesh() );
build_median_dual_mesh( mesh() );
build_node_to_edge_connectivity( mesh() );
ATLAS_TRACE_SCOPE( "build_edges" ) build_edges( mesh() );
ATLAS_TRACE_SCOPE( "build_pole_edges" ) build_pole_edges( mesh() );
ATLAS_TRACE_SCOPE( "build_edges_parallel_fields" ) build_edges_parallel_fields( mesh() );
ATLAS_TRACE_SCOPE( "build_median_dual_mesh" ) build_median_dual_mesh( mesh() );
ATLAS_TRACE_SCOPE( "build_node_to_edge_connectivity" ) build_node_to_edge_connectivity( mesh() );

const size_t nnodes = nodes_.size();

Expand Down
126 changes: 69 additions & 57 deletions src/atlas/trans/Trans.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
#include "atlas/runtime/Log.h"
#include "atlas/trans/Trans.h"

// For factory registration only:
#if ATLAS_HAVE_TRANS
#include "atlas/trans/ifs/TransIFSNodeColumns.h"
#include "atlas/trans/ifs/TransIFSStructuredColumns.h"
#endif
#include "atlas/trans/local/TransLocal.h" // --> recommended "local"

namespace {
struct default_backend {
#if ATLAS_HAVE_TRANS
Expand All @@ -46,41 +39,37 @@ struct default_backend {
namespace atlas {
namespace trans {

util::Config TransFactory::default_options_ = util::Config( "type", default_backend::instance().value );

class TransBackend {
public:
static void list( std::ostream& );
static bool has( const std::string& name );
static void backend( const std::string& );
static std::string backend();
static void config( const eckit::Configuration& );
static const eckit::Configuration& config();

private:
static util::Config default_options_;
};

util::Config TransBackend::default_options_ = util::Config( "type", default_backend::instance().value );

TransImpl::~TransImpl() {}

namespace {

static eckit::Mutex* local_mutex = 0;
static std::map<std::string, int>* b = 0;
static std::map<std::string, TransFactory*>* m = 0;
static pthread_once_t once = PTHREAD_ONCE_INIT;

static void init() {
local_mutex = new eckit::Mutex();
b = new std::map<std::string, int>();
m = new std::map<std::string, TransFactory*>();
}

template <typename T>
void load_builder_functionspace() {
TransBuilderFunctionSpace<T>( "tmp" );
}
template <typename T>
void load_builder_grid() {
TransBuilderGrid<T>( "tmp" );
}

struct force_link {
force_link() {
#if ATLAS_HAVE_TRANS
load_builder_functionspace<TransIFSNodeColumns>();
load_builder_functionspace<TransIFSStructuredColumns>();
load_builder_grid<TransIFS>();
#endif
load_builder_grid<TransLocal>();
}
};

TransFactory& factory( const std::string& name ) {
std::map<std::string, TransFactory*>::const_iterator j = m->find( name );
if ( j == m->end() ) {
Expand All @@ -95,64 +84,71 @@ TransFactory& factory( const std::string& name ) {

} // namespace

TransFactory::TransFactory( const std::string& name ) : name_( name ) {
TransFactory::TransFactory( const std::string& name, const std::string& backend ) : name_( name ), backend_( backend ) {
pthread_once( &once, init );

eckit::AutoLock<eckit::Mutex> lock( local_mutex );

ASSERT( m->find( name ) == m->end() );
( *m )[name] = this;

if ( b->find( backend ) == b->end() ) ( *b )[backend] = 0;
( *b )[backend]++;
}

TransFactory::~TransFactory() {
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
m->erase( name_ );
( *b )[backend_]--;
if ( ( *b )[backend_] == 0 ) b->erase( backend_ );
}

bool TransFactory::has( const std::string& name ) {
pthread_once( &once, init );

eckit::AutoLock<eckit::Mutex> lock( local_mutex );

static force_link static_linking;

return ( m->find( name ) != m->end() );
}

void TransFactory::backend( const std::string& backend ) {
bool TransBackend::has( const std::string& name ) {
pthread_once( &once, init );
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
return ( b->find( name ) != b->end() );
}

void TransBackend::backend( const std::string& backend ) {
pthread_once( &once, init );
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
default_options_.set( "type", backend );
}

std::string TransFactory::backend() {
std::string TransBackend::backend() {
return default_options_.getString( "type" );
}

const eckit::Configuration& TransFactory::config() {
const eckit::Configuration& TransBackend::config() {
return default_options_;
}

void TransFactory::config( const eckit::Configuration& config ) {
void TransBackend::config( const eckit::Configuration& config ) {
std::string type = default_options_.getString( "type" );
default_options_ = config;
if ( not config.has( "type" ) ) { default_options_.set( "type", type ); }
}

void TransFactory::list( std::ostream& out ) {
void TransBackend::list( std::ostream& out ) {
pthread_once( &once, init );

eckit::AutoLock<eckit::Mutex> lock( local_mutex );

static force_link static_linking;

const char* sep = "";
for ( std::map<std::string, TransFactory*>::const_iterator j = m->begin(); j != m->end(); ++j ) {
for ( std::map<std::string, int>::const_iterator j = b->begin(); j != b->end(); ++j ) {
out << sep << ( *j ).first;
sep = ", ";
}
}

void TransFactory::list( std::ostream& out ) {
TransBackend::list( out );
}

Trans::Implementation* TransFactory::build( const FunctionSpace& gp, const FunctionSpace& sp,
const eckit::Configuration& config ) {
return build( Cache(), gp, sp, config );
Expand All @@ -169,13 +165,22 @@ Trans::Implementation* TransFactory::build( const Cache& cache, const FunctionSp

eckit::AutoLock<eckit::Mutex> lock( local_mutex );

static force_link static_linking;

util::Config options = default_options_;
util::Config options = TransBackend::config();
options.set( config );

std::string backend = options.getString( "type" );

Log::debug() << "Looking for TransFactory [" << backend << "]" << std::endl;
if ( !TransBackend::has( backend ) ) {
Log::error() << "No TransFactory for [" << backend << "]" << std::endl;
Log::error() << "TransFactories are :" << std::endl;
TransBackend::list( Log::error() );
Log::error() << std::endl;
throw eckit::SeriousBug( std::string( "No TransFactory called " ) + backend );
}

std::string suffix( "(" + gp.type() + "," + sp.type() + ")" );
std::string name = options.getString( "type" ) + suffix;
std::string name = backend + suffix;

Log::debug() << "Looking for TransFactory [" << name << "]" << std::endl;

Expand Down Expand Up @@ -207,37 +212,44 @@ Trans::Implementation* TransFactory::build( const Cache& cache, const Grid& grid

eckit::AutoLock<eckit::Mutex> lock( local_mutex );

static force_link static_linking;

util::Config options = default_options_;
util::Config options = TransBackend::config();
options.set( config );

std::string name = options.getString( "type" );
std::string backend = options.getString( "type" );

Log::debug() << "Looking for TransFactory [" << name << "]" << std::endl;
Log::debug() << "Looking for TransFactory [" << backend << "]" << std::endl;
if ( !TransBackend::has( backend ) ) {
Log::error() << "No TransFactory for [" << backend << "]" << std::endl;
Log::error() << "TransFactories are :" << std::endl;
TransBackend::list( Log::error() );
Log::error() << std::endl;
throw eckit::SeriousBug( std::string( "No TransFactory called " ) + backend );
}

std::string name = backend;

return factory( name ).make( cache, grid, domain, truncation, options );
}

bool Trans::hasBackend( const std::string& backend ) {
return TransFactory::has( backend );
return TransBackend::has( backend );
}

void Trans::backend( const std::string& backend ) {
ASSERT( hasBackend( backend ) );
TransFactory::backend( backend );
TransBackend::backend( backend );
}

std::string Trans::backend() {
return TransFactory::backend();
return TransBackend::backend();
}

const eckit::Configuration& Trans::config() {
return TransFactory::config();
return TransBackend::config();
}

void Trans::config( const eckit::Configuration& options ) {
TransFactory::config( options );
TransBackend::config( options );
}

namespace {
Expand Down
17 changes: 5 additions & 12 deletions src/atlas/trans/Trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,9 @@ class TransFactory {

static bool has( const std::string& name );

static void backend( const std::string& );

static std::string backend();

static void config( const eckit::Configuration& );

static const eckit::Configuration& config();

private:
std::string name_;
static util::Config default_options_;
std::string backend_;
virtual Trans_t* make( const Cache&, const FunctionSpace& gp, const FunctionSpace& sp,
const eckit::Configuration& ) {
return nullptr;
Expand All @@ -171,7 +163,8 @@ class TransFactory {
}

protected:
TransFactory( const std::string& );
TransFactory();
TransFactory( const std::string& name, const std::string& backend );
virtual ~TransFactory();
};

Expand All @@ -188,7 +181,7 @@ class TransBuilderFunctionSpace : public TransFactory {
}

public:
TransBuilderFunctionSpace( const std::string& name ) : TransFactory( name ) {}
TransBuilderFunctionSpace( const std::string& name, const std::string& backend ) : TransFactory( name, backend ) {}
};

template <class T>
Expand All @@ -202,7 +195,7 @@ class TransBuilderGrid : public TransFactory {
}

public:
TransBuilderGrid( const std::string& name ) : TransFactory( name ) {}
TransBuilderGrid( const std::string& name, const std::string& backend ) : TransFactory( name, backend ) {}
};

//----------------------------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/trans/ifs/TransIFS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace atlas {
namespace trans {

namespace {
static TransBuilderGrid<TransIFS> builder( "ifs" );
static TransBuilderGrid<TransIFS> builder( "ifs", "ifs" );
}

class TransParameters {
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/trans/ifs/TransIFSNodeColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TransIFSNodeColumns::TransIFSNodeColumns( const Cache& cache, const functionspac
TransIFSNodeColumns::~TransIFSNodeColumns() {}

namespace {
static TransBuilderFunctionSpace<TransIFSNodeColumns> builder( "ifs(NodeColumns,Spectral)" );
static TransBuilderFunctionSpace<TransIFSNodeColumns> builder( "ifs(NodeColumns,Spectral)", "ifs" );
}

} // namespace trans
Expand Down
2 changes: 1 addition & 1 deletion src/atlas/trans/ifs/TransIFSStructuredColumns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TransIFSStructuredColumns::TransIFSStructuredColumns( const Cache& cache, const
TransIFSStructuredColumns::~TransIFSStructuredColumns() {}

namespace {
static TransBuilderFunctionSpace<TransIFSStructuredColumns> builder( "ifs(StructuredColumns,Spectral)" );
static TransBuilderFunctionSpace<TransIFSStructuredColumns> builder( "ifs(StructuredColumns,Spectral)", "ifs" );
}

} // namespace trans
Expand Down
Loading

0 comments on commit c321078

Please sign in to comment.