Skip to content

Commit c321078

Browse files
committed
Merge branch 'hotfix/0.15.1'
* 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
2 parents 6a53e43 + c7fb665 commit c321078

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+213
-191
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
77

88
## [Unreleased]
99

10+
## [0.15.1] - 2018-07-17
11+
### Fixed
12+
- Compilation for Intel 18 debug
13+
- Memory bug for spherical harmonics
14+
- Compatibility with fckit 0.5.1
15+
1016
## [0.15.0] - 2018-06-19
1117
### Changed
1218
- Native Array data storage uses now a raw C pointer instead of std::vector
@@ -39,6 +45,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
3945
## 0.13.0 - 2018-02-16
4046

4147
[Unreleased]: https://github.com/ecmwf/atlas/compare/master...develop
48+
[0.15.1]: https://github.com/ecmwf/atlas/compare/0.15.0...0.15.1
4249
[0.15.0]: https://github.com/ecmwf/atlas/compare/0.14.0...0.15.0
4350
[0.14.0]: https://github.com/ecmwf/atlas/compare/0.13.2...0.14.0
4451
[0.13.2]: https://github.com/ecmwf/atlas/compare/0.13.1...0.13.2

VERSION.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
# granted to it by virtue of its status as an intergovernmental organisation nor
77
# does it submit to any jurisdiction.
88

9-
set ( ${PROJECT_NAME}_VERSION_STR "0.15.0" )
9+
set ( ${PROJECT_NAME}_VERSION_STR "0.15.1" )
1010

src/atlas/numerics/fvm/Method.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "atlas/numerics/fvm/Method.h"
2626
#include "atlas/parallel/omp/omp.h"
2727
#include "atlas/runtime/ErrorHandling.h"
28+
#include "atlas/runtime/Trace.h"
2829
#include "atlas/util/CoordinateEnums.h"
2930
#include "atlas/util/Earth.h"
3031

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

5960
} // namespace
6061

61-
Method::Method( Mesh& mesh ) : Method::Method( mesh, util::NoConfig() ) {
62-
setup();
63-
}
62+
Method::Method( Mesh& mesh ) : Method::Method( mesh, util::NoConfig() ) {}
6463

65-
Method::Method( Mesh& mesh, const mesh::Halo& halo ) : Method::Method( mesh, util::Config( "halo", halo.size() ) ) {
66-
setup();
67-
}
64+
Method::Method( Mesh& mesh, const mesh::Halo& halo ) : Method::Method( mesh, util::Config( "halo", halo.size() ) ) {}
6865

6966
Method::Method( Mesh& mesh, const eckit::Configuration& params ) :
7067
mesh_( mesh ),
@@ -77,16 +74,17 @@ Method::Method( Mesh& mesh, const eckit::Configuration& params ) :
7774
}
7875

7976
void Method::setup() {
77+
ATLAS_TRACE( "fvm::Method::setup " );
8078
util::Config node_columns_config;
8179
node_columns_config.set( "halo", halo_.size() );
8280
if ( levels_ ) node_columns_config.set( "levels", levels_ );
8381
node_columns_ = functionspace::NodeColumns( mesh(), node_columns_config );
8482
if ( edges_.size() == 0 ) {
85-
build_edges( mesh() );
86-
build_pole_edges( mesh() );
87-
build_edges_parallel_fields( mesh() );
88-
build_median_dual_mesh( mesh() );
89-
build_node_to_edge_connectivity( mesh() );
83+
ATLAS_TRACE_SCOPE( "build_edges" ) build_edges( mesh() );
84+
ATLAS_TRACE_SCOPE( "build_pole_edges" ) build_pole_edges( mesh() );
85+
ATLAS_TRACE_SCOPE( "build_edges_parallel_fields" ) build_edges_parallel_fields( mesh() );
86+
ATLAS_TRACE_SCOPE( "build_median_dual_mesh" ) build_median_dual_mesh( mesh() );
87+
ATLAS_TRACE_SCOPE( "build_node_to_edge_connectivity" ) build_node_to_edge_connectivity( mesh() );
9088

9189
const size_t nnodes = nodes_.size();
9290

src/atlas/trans/Trans.cc

Lines changed: 69 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919
#include "atlas/runtime/Log.h"
2020
#include "atlas/trans/Trans.h"
2121

22-
// For factory registration only:
23-
#if ATLAS_HAVE_TRANS
24-
#include "atlas/trans/ifs/TransIFSNodeColumns.h"
25-
#include "atlas/trans/ifs/TransIFSStructuredColumns.h"
26-
#endif
27-
#include "atlas/trans/local/TransLocal.h" // --> recommended "local"
28-
2922
namespace {
3023
struct default_backend {
3124
#if ATLAS_HAVE_TRANS
@@ -46,41 +39,37 @@ struct default_backend {
4639
namespace atlas {
4740
namespace trans {
4841

49-
util::Config TransFactory::default_options_ = util::Config( "type", default_backend::instance().value );
42+
43+
class TransBackend {
44+
public:
45+
static void list( std::ostream& );
46+
static bool has( const std::string& name );
47+
static void backend( const std::string& );
48+
static std::string backend();
49+
static void config( const eckit::Configuration& );
50+
static const eckit::Configuration& config();
51+
52+
private:
53+
static util::Config default_options_;
54+
};
55+
56+
util::Config TransBackend::default_options_ = util::Config( "type", default_backend::instance().value );
5057

5158
TransImpl::~TransImpl() {}
5259

5360
namespace {
5461

5562
static eckit::Mutex* local_mutex = 0;
63+
static std::map<std::string, int>* b = 0;
5664
static std::map<std::string, TransFactory*>* m = 0;
5765
static pthread_once_t once = PTHREAD_ONCE_INIT;
5866

5967
static void init() {
6068
local_mutex = new eckit::Mutex();
69+
b = new std::map<std::string, int>();
6170
m = new std::map<std::string, TransFactory*>();
6271
}
6372

64-
template <typename T>
65-
void load_builder_functionspace() {
66-
TransBuilderFunctionSpace<T>( "tmp" );
67-
}
68-
template <typename T>
69-
void load_builder_grid() {
70-
TransBuilderGrid<T>( "tmp" );
71-
}
72-
73-
struct force_link {
74-
force_link() {
75-
#if ATLAS_HAVE_TRANS
76-
load_builder_functionspace<TransIFSNodeColumns>();
77-
load_builder_functionspace<TransIFSStructuredColumns>();
78-
load_builder_grid<TransIFS>();
79-
#endif
80-
load_builder_grid<TransLocal>();
81-
}
82-
};
83-
8473
TransFactory& factory( const std::string& name ) {
8574
std::map<std::string, TransFactory*>::const_iterator j = m->find( name );
8675
if ( j == m->end() ) {
@@ -95,64 +84,71 @@ TransFactory& factory( const std::string& name ) {
9584

9685
} // namespace
9786

98-
TransFactory::TransFactory( const std::string& name ) : name_( name ) {
87+
TransFactory::TransFactory( const std::string& name, const std::string& backend ) : name_( name ), backend_( backend ) {
9988
pthread_once( &once, init );
10089

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

10392
ASSERT( m->find( name ) == m->end() );
10493
( *m )[name] = this;
94+
95+
if ( b->find( backend ) == b->end() ) ( *b )[backend] = 0;
96+
( *b )[backend]++;
10597
}
10698

10799
TransFactory::~TransFactory() {
108100
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
109101
m->erase( name_ );
102+
( *b )[backend_]--;
103+
if ( ( *b )[backend_] == 0 ) b->erase( backend_ );
110104
}
111105

112106
bool TransFactory::has( const std::string& name ) {
113107
pthread_once( &once, init );
114-
115108
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
116-
117-
static force_link static_linking;
118-
119109
return ( m->find( name ) != m->end() );
120110
}
121111

122-
void TransFactory::backend( const std::string& backend ) {
112+
bool TransBackend::has( const std::string& name ) {
113+
pthread_once( &once, init );
114+
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
115+
return ( b->find( name ) != b->end() );
116+
}
117+
118+
void TransBackend::backend( const std::string& backend ) {
123119
pthread_once( &once, init );
124120
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
125121
default_options_.set( "type", backend );
126122
}
127123

128-
std::string TransFactory::backend() {
124+
std::string TransBackend::backend() {
129125
return default_options_.getString( "type" );
130126
}
131127

132-
const eckit::Configuration& TransFactory::config() {
128+
const eckit::Configuration& TransBackend::config() {
133129
return default_options_;
134130
}
135131

136-
void TransFactory::config( const eckit::Configuration& config ) {
132+
void TransBackend::config( const eckit::Configuration& config ) {
137133
std::string type = default_options_.getString( "type" );
138134
default_options_ = config;
139135
if ( not config.has( "type" ) ) { default_options_.set( "type", type ); }
140136
}
141137

142-
void TransFactory::list( std::ostream& out ) {
138+
void TransBackend::list( std::ostream& out ) {
143139
pthread_once( &once, init );
144-
145140
eckit::AutoLock<eckit::Mutex> lock( local_mutex );
146-
147-
static force_link static_linking;
148-
149141
const char* sep = "";
150-
for ( std::map<std::string, TransFactory*>::const_iterator j = m->begin(); j != m->end(); ++j ) {
142+
for ( std::map<std::string, int>::const_iterator j = b->begin(); j != b->end(); ++j ) {
151143
out << sep << ( *j ).first;
152144
sep = ", ";
153145
}
154146
}
155147

148+
void TransFactory::list( std::ostream& out ) {
149+
TransBackend::list( out );
150+
}
151+
156152
Trans::Implementation* TransFactory::build( const FunctionSpace& gp, const FunctionSpace& sp,
157153
const eckit::Configuration& config ) {
158154
return build( Cache(), gp, sp, config );
@@ -169,13 +165,22 @@ Trans::Implementation* TransFactory::build( const Cache& cache, const FunctionSp
169165

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

172-
static force_link static_linking;
173-
174-
util::Config options = default_options_;
168+
util::Config options = TransBackend::config();
175169
options.set( config );
176170

171+
std::string backend = options.getString( "type" );
172+
173+
Log::debug() << "Looking for TransFactory [" << backend << "]" << std::endl;
174+
if ( !TransBackend::has( backend ) ) {
175+
Log::error() << "No TransFactory for [" << backend << "]" << std::endl;
176+
Log::error() << "TransFactories are :" << std::endl;
177+
TransBackend::list( Log::error() );
178+
Log::error() << std::endl;
179+
throw eckit::SeriousBug( std::string( "No TransFactory called " ) + backend );
180+
}
181+
177182
std::string suffix( "(" + gp.type() + "," + sp.type() + ")" );
178-
std::string name = options.getString( "type" ) + suffix;
183+
std::string name = backend + suffix;
179184

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

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

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

210-
static force_link static_linking;
211-
212-
util::Config options = default_options_;
215+
util::Config options = TransBackend::config();
213216
options.set( config );
214217

215-
std::string name = options.getString( "type" );
218+
std::string backend = options.getString( "type" );
216219

217-
Log::debug() << "Looking for TransFactory [" << name << "]" << std::endl;
220+
Log::debug() << "Looking for TransFactory [" << backend << "]" << std::endl;
221+
if ( !TransBackend::has( backend ) ) {
222+
Log::error() << "No TransFactory for [" << backend << "]" << std::endl;
223+
Log::error() << "TransFactories are :" << std::endl;
224+
TransBackend::list( Log::error() );
225+
Log::error() << std::endl;
226+
throw eckit::SeriousBug( std::string( "No TransFactory called " ) + backend );
227+
}
228+
229+
std::string name = backend;
218230

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

222234
bool Trans::hasBackend( const std::string& backend ) {
223-
return TransFactory::has( backend );
235+
return TransBackend::has( backend );
224236
}
225237

226238
void Trans::backend( const std::string& backend ) {
227239
ASSERT( hasBackend( backend ) );
228-
TransFactory::backend( backend );
240+
TransBackend::backend( backend );
229241
}
230242

231243
std::string Trans::backend() {
232-
return TransFactory::backend();
244+
return TransBackend::backend();
233245
}
234246

235247
const eckit::Configuration& Trans::config() {
236-
return TransFactory::config();
248+
return TransBackend::config();
237249
}
238250

239251
void Trans::config( const eckit::Configuration& options ) {
240-
TransFactory::config( options );
252+
TransBackend::config( options );
241253
}
242254

243255
namespace {

src/atlas/trans/Trans.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,9 @@ class TransFactory {
151151

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

154-
static void backend( const std::string& );
155-
156-
static std::string backend();
157-
158-
static void config( const eckit::Configuration& );
159-
160-
static const eckit::Configuration& config();
161-
162154
private:
163155
std::string name_;
164-
static util::Config default_options_;
156+
std::string backend_;
165157
virtual Trans_t* make( const Cache&, const FunctionSpace& gp, const FunctionSpace& sp,
166158
const eckit::Configuration& ) {
167159
return nullptr;
@@ -171,7 +163,8 @@ class TransFactory {
171163
}
172164

173165
protected:
174-
TransFactory( const std::string& );
166+
TransFactory();
167+
TransFactory( const std::string& name, const std::string& backend );
175168
virtual ~TransFactory();
176169
};
177170

@@ -188,7 +181,7 @@ class TransBuilderFunctionSpace : public TransFactory {
188181
}
189182

190183
public:
191-
TransBuilderFunctionSpace( const std::string& name ) : TransFactory( name ) {}
184+
TransBuilderFunctionSpace( const std::string& name, const std::string& backend ) : TransFactory( name, backend ) {}
192185
};
193186

194187
template <class T>
@@ -202,7 +195,7 @@ class TransBuilderGrid : public TransFactory {
202195
}
203196

204197
public:
205-
TransBuilderGrid( const std::string& name ) : TransFactory( name ) {}
198+
TransBuilderGrid( const std::string& name, const std::string& backend ) : TransFactory( name, backend ) {}
206199
};
207200

208201
//----------------------------------------------------------------------------------------------------------------------

src/atlas/trans/ifs/TransIFS.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace atlas {
3535
namespace trans {
3636

3737
namespace {
38-
static TransBuilderGrid<TransIFS> builder( "ifs" );
38+
static TransBuilderGrid<TransIFS> builder( "ifs", "ifs" );
3939
}
4040

4141
class TransParameters {

src/atlas/trans/ifs/TransIFSNodeColumns.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TransIFSNodeColumns::TransIFSNodeColumns( const Cache& cache, const functionspac
2828
TransIFSNodeColumns::~TransIFSNodeColumns() {}
2929

3030
namespace {
31-
static TransBuilderFunctionSpace<TransIFSNodeColumns> builder( "ifs(NodeColumns,Spectral)" );
31+
static TransBuilderFunctionSpace<TransIFSNodeColumns> builder( "ifs(NodeColumns,Spectral)", "ifs" );
3232
}
3333

3434
} // namespace trans

src/atlas/trans/ifs/TransIFSStructuredColumns.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TransIFSStructuredColumns::TransIFSStructuredColumns( const Cache& cache, const
3030
TransIFSStructuredColumns::~TransIFSStructuredColumns() {}
3131

3232
namespace {
33-
static TransBuilderFunctionSpace<TransIFSStructuredColumns> builder( "ifs(StructuredColumns,Spectral)" );
33+
static TransBuilderFunctionSpace<TransIFSStructuredColumns> builder( "ifs(StructuredColumns,Spectral)", "ifs" );
3434
}
3535

3636
} // namespace trans

0 commit comments

Comments
 (0)