From 4f7b4a375adbae94539daf14b2d327b8e3dfee6b Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Wed, 31 Jul 2019 22:19:52 -0700 Subject: [PATCH 001/632] Update fortran_generic clauses Shroud now allow multiple arguments to be part of fortran generic. --- src/axom/sidre/interface/sidre_shroud.yaml | 196 ++++++++++++--------- 1 file changed, 112 insertions(+), 84 deletions(-) diff --git a/src/axom/sidre/interface/sidre_shroud.yaml b/src/axom/sidre/interface/sidre_shroud.yaml index f6a0b51375..a8f3ceb3d8 100644 --- a/src/axom/sidre/interface/sidre_shroud.yaml +++ b/src/axom/sidre/interface/sidre_shroud.yaml @@ -76,9 +76,10 @@ declarations: # - decl: bool hasBuffer( IndexType idx ) const - decl: Buffer * getBuffer( IndexType idx ) fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none - decl: Buffer * createBuffer() @@ -88,16 +89,18 @@ declarations: format: function_suffix: _from_type fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none - decl: void destroyBuffer( IndexType id ) fortran_generic: - id: - - int32_t - - int64_t + - decl: (int32_t id) + function_suffix: _int32_t + - decl: (int64_t id) + function_suffix: _int64_t # Method for generateing Blueprint - decl: bool generateBlueprintIndex( const std::string& domain_path, @@ -109,9 +112,10 @@ declarations: # - decl: IndexType getFirstValidBufferIndex() const # - decl: IndexType getNextValidBufferIndex(IndexType idx) const; # fortran_generic: -# idx: -# - int32_t -# - int64_t +# - decl: (int32_t idx) +# function_suffix: _int32_t +# - decl: (int64_t idx) +# function_suffix: _int64_t - decl: void print() const # - decl: void print(std::ostream& os) const @@ -139,15 +143,17 @@ declarations: - decl: bool hasChildView( const string& name ) const # - decl: bool hasView( IndexType idx ) const # fortran_generic: -# idx: -# - int32_t -# - int64_t +# - decl: (int32_t idx) +# function_suffix: _int32_t +# - decl: (int64_t idx) +# function_suffix: _int64_t - decl: IndexType getViewIndex(const std::string &name) const - decl: const std::string& getViewName(IndexType idx) const +len(MAXNAMESIZE) fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t C_error_pattern: C_invalid_name PY_error_pattern: PY_invalid_name_idx @@ -162,22 +168,25 @@ declarations: format: function_suffix: _from_index fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none # - decl: View const *getView( const IndexType idx ) const # fortran_generic: -# idx: -# - int32_t -# - int64_t +# - decl: (int32_t idx) +# function_suffix: _int32_t +# - decl: (int64_t idx) +# function_suffix: _int64_t - decl: IndexType getFirstValidViewIndex() const - decl: IndexType getNextValidViewIndex(IndexType idx) const fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t # Methods to create a View that has no associated data. - decl: View *createView( const string& path ) @@ -192,9 +201,10 @@ declarations: format: function_suffix: _from_type fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none @@ -224,9 +234,10 @@ declarations: format: function_suffix: _from_type_and_buffer fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none @@ -255,9 +266,10 @@ declarations: format: function_suffix: _from_type_external fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none @@ -278,9 +290,10 @@ declarations: format: function_suffix: _nelems fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none @@ -315,9 +328,10 @@ declarations: - decl: void destroyView( const std::string &path ) # - decl: void destroyView( IndexType idx ) # fortran_generic: -# idx: -# - int32_t -# - int64_t +# - decl: (int32_t idx) +# function_suffix: _int32_t +# - decl: (int64_t idx) +# function_suffix: _int64_t # - decl: void destroyViews() - decl: void destroyViewAndData(const std::string &path) format: @@ -326,9 +340,10 @@ declarations: format: function_suffix: _index fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t # - decl: void destroyViewsAndData() # View move and copy methods. @@ -340,15 +355,17 @@ declarations: - decl: bool hasChildGroup( const string& name ) # - decl: bool hasGroup( IndexType idx ) # fortran_generic: -# idx: -# - int32_t -# - int64_t +# - decl: (int32_t idx) +# function_suffix: _int32_t +# - decl: (int64_t idx) +# function_suffix: _int64_t - decl: IndexType getGroupIndex(const std::string &name) const - decl: const std::string& getGroupName(IndexType idx) const +len(MAXNAMESIZE) fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t C_error_pattern: C_invalid_name PY_error_pattern: PY_invalid_name_idx @@ -363,22 +380,25 @@ declarations: format: function_suffix: _from_index fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t C_error_pattern: C_null_to_error_capsule PY_error_pattern: PY_null_to_none # - decl: Group const * getGroup(IndexType idx) const # fortran_generic: -# idx: -# - int32_t -# - int64_t +# - decl: (int32_t idx) +# function_suffix: _int32_t +# - decl: (int64_t idx) +# function_suffix: _int64_t - decl: IndexType getFirstValidGroupIndex() const - decl: IndexType getNextValidGroupIndex(IndexType idx) const fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t # Child Group creation and destruction methods. - decl: Group *createGroup( const string& path ) @@ -391,9 +411,10 @@ declarations: format: function_suffix: _index fortran_generic: - idx: - - int32_t - - int64_t + - decl: (int32_t idx) + function_suffix: _int32_t + - decl: (int64_t idx) + function_suffix: _int64_t # - decl: void destroyGroups() # Group move and copy methods @@ -444,9 +465,10 @@ declarations: - decl: Buffer* describe(TypeID type, IndexType num_elems) return_this: True fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t # - decl: Buffer* describe(const DataType& dtype) @@ -460,16 +482,18 @@ declarations: function_suffix: _from_type return_this: True fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t - decl: Buffer* reallocate(IndexType num_elems) return_this: True fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t - decl: void print() const @@ -521,18 +545,20 @@ declarations: function_suffix: _from_type return_this: True fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t # - decl: View* allocate(const DataType& dtype) - decl: View * reallocate(IndexType num_elems) return_this: True fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t # - decl: View* reallocate(const DataType& dtype) @@ -549,9 +575,10 @@ declarations: format: function_suffix: _type fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t - decl: View* attachBuffer(TypeID type, int ndims, @@ -616,9 +643,10 @@ declarations: format: function_suffix: _type fortran_generic: - num_elems: - - int32_t - - int64_t + - decl: (int32_t num_elems) + function_suffix: _int32_t + - decl: (int64_t num_elems) + function_suffix: _int64_t - decl: View * setExternalDataPtr(TypeID type, int ndims, From c96ea730e795d50b9c8e4e4037dae621e4c332c5 Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Mon, 6 Jan 2020 20:11:46 -0800 Subject: [PATCH 002/632] Update for Shroud changes Better support for namespaces i.e. {class_prefix} => {C_name_scope} Preserves class name case buffer => Buffer Add splicer directly after decl. Replaces C_code and F_code --- src/axom/quest/interface/quest_shroud.yaml | 2 +- .../sidre/interface/old/sidre_shroud.yaml | 739 +++++++++++++++++ src/axom/sidre/interface/sidre_shroud.yaml | 11 +- .../sidre/spio/interface/spio_shroud.yaml | 12 +- src/axom/sidre/tests/sidre_buffer_C.cpp | 118 +-- src/axom/sidre/tests/sidre_external_C.cpp | 86 +- src/axom/sidre/tests/sidre_group_C.cpp | 752 +++++++++--------- src/axom/sidre/tests/sidre_opaque_C.cpp | 118 +-- src/axom/sidre/tests/sidre_smoke_C.cpp | 20 +- src/axom/sidre/tests/sidre_view_C.cpp | 418 +++++----- src/axom/slic/interface/slic_shroud.yaml | 9 +- 11 files changed, 1512 insertions(+), 773 deletions(-) create mode 100644 src/axom/sidre/interface/old/sidre_shroud.yaml diff --git a/src/axom/quest/interface/quest_shroud.yaml b/src/axom/quest/interface/quest_shroud.yaml index 07a406ff2c..529113e3e6 100644 --- a/src/axom/quest/interface/quest_shroud.yaml +++ b/src/axom/quest/interface/quest_shroud.yaml @@ -18,7 +18,7 @@ options: F_module_name_library_template: axom_{library_lower} # F_module_per_class: False # Change the default template for Fortran functions to include the library name. - F_name_impl_template: "{library_lower}_{class_prefix}{underscore_name}{function_suffix}" + F_name_impl_template: "{library_lower}_{C_name_scope}{underscore_name}{function_suffix}" F_name_generic_template: "{library_lower}_{underscore_name}" wrap_python: True diff --git a/src/axom/sidre/interface/old/sidre_shroud.yaml b/src/axom/sidre/interface/old/sidre_shroud.yaml new file mode 100644 index 0000000000..9faf223cc5 --- /dev/null +++ b/src/axom/sidre/interface/old/sidre_shroud.yaml @@ -0,0 +1,739 @@ +# +# API for Sidre +# +copyright: + - + - Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and + - other Axom Project Developers. See the top-level COPYRIGHT file for details. + - + - "SPDX-License-Identifier: (BSD-3-Clause)" + +library: Sidre +# cxx_header: each class has its own header file +namespace: axom sidre + +options: + C_line_length: 1000 + F_module_per_class: False + F_module_name_library_template: axom_{library_lower} +# wrap_python: True + +format: + C_prefix: SIDRE_ + # Any C++ function which returns a string will be wrapped in + # Fortran as a subroutine with an additional character argument + # for the result. +# F_string_result_as_arg: name + F_filename_suffix: F + +declarations: +- decl: typedef int64_t IndexType + fields: + # defined in SidreTypes.hpp + c_header : axom/sidre/interface/SidreTypes.h + c_type : SIDRE_IndexType + +- decl: typedef int TypeID + fields: + # enum for types + c_header : axom/sidre/interface/SidreTypes.h + cxx_header : axom/sidre/core/SidreTypes.hpp + c_to_cxx : axom::sidre::getTypeID({c_var}) + cxx_to_c : static_cast({cxx_var}) + +# XXX +# parameters: +# InvalidID: IDTYPE -1 + +- decl: class Buffer + cxx_header: axom/sidre/core/Buffer.hpp + format: + F_derived_name: SidreBuffer + +- decl: class Group + cxx_header: axom/sidre/core/Group.hpp + format: + F_derived_name: SidreGroup + +- decl: class View + cxx_header: axom/sidre/core/View.hpp + format: + F_derived_name: SidreView + + #################################################################### +- decl: class DataStore + cxx_header: axom/sidre/core/DataStore.hpp + format: + F_derived_name: SidreDataStore + + declarations: + - decl: DataStore() +name(new) + - decl: ~DataStore() +name(delete) + - decl: Group * getRoot() + + # Methods to query, access, create and destroy Buffers. + - decl: size_t getNumBuffers() const +# - decl: bool hasBuffer( IndexType idx ) const + - decl: Buffer * getBuffer( IndexType idx ) + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + - decl: Buffer * createBuffer() + format: + function_suffix: _empty + - decl: Buffer * createBuffer( TypeID type, IndexType num_elems ) + format: + function_suffix: _from_type + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + - decl: void destroyBuffer( IndexType id ) + fortran_generic: + - decl: (int32_t id) + fortran_suffix: int32_t + - decl: (int64_t id) + fortran_suffix: int64_t + + # Method for generateing Blueprint + - decl: bool generateBlueprintIndex( const std::string& domain_path, + const std::string& mesh_name, + const std::string& index_path, + int num_domains ) + + # Methods for iterating over Buffers in DataStore +# - decl: IndexType getFirstValidBufferIndex() const +# - decl: IndexType getNextValidBufferIndex(IndexType idx) const; +# fortran_generic: +# - decl: (int32_t idx) +# fortran_suffix: int32_t +# - decl: (int64_t idx) +# fortran_suffix: int64_t + + - decl: void print() const +# - decl: void print(std::ostream& os) const + + python: + type: [ init, richcompare ] + +#################################################################### +- decl: class Group + declarations: + # Basic query and accessor methods. + - decl: IndexType getIndex() + - decl: const std::string& getName() const +len(MAXNAMESIZE) + - decl: std::string getPath() const +len(MAXNAMESIZE) + - decl: std::string getPathName() const +len(MAXNAMESIZE) +# - decl: Group* getParent() + - decl: const Group* getParent() const + - decl: size_t getNumGroups() const + - decl: size_t getNumViews() const +# - decl: DataStore* getDataStore() const + - decl: const DataStore* getDataStore() const + + # View query methods. + - decl: bool hasView( const string& path ) const + - decl: bool hasChildView( const string& name ) const +# - decl: bool hasView( IndexType idx ) const +# fortran_generic: +# - decl: (int32_t idx) +# fortran_suffix: int32_t +# - decl: (int64_t idx) +# fortran_suffix: int64_t + - decl: IndexType getViewIndex(const std::string &name) const + - decl: const std::string& getViewName(IndexType idx) const +len(MAXNAMESIZE) + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t + C_error_pattern: C_invalid_name + PY_error_pattern: PY_invalid_name_idx + + # View access and iteration methods. + - decl: View *getView( const std::string& path ) + format: + function_suffix: _from_name + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none +# - decl: View const * getView( const std::string& path ) const + - decl: View *getView( const IndexType idx ) + format: + function_suffix: _from_index + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none +# - decl: View const *getView( const IndexType idx ) const +# fortran_generic: +# - decl: (int32_t idx) +# fortran_suffix: int32_t +# - decl: (int64_t idx) +# fortran_suffix: int64_t + - decl: IndexType getFirstValidViewIndex() const + - decl: IndexType getNextValidViewIndex(IndexType idx) const + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t + + # Methods to create a View that has no associated data. + - decl: View *createView( const string& path ) + format: + function_suffix: _empty + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createView( const std::string& path, + TypeID type, + IndexType num_elems ) + format: + function_suffix: _from_type + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createView( const std::string& path, + TypeID type, + int ndims, + IndexType * shape+dimension) + format: + function_suffix: _from_shape + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + +# - decl: View *createView( const std::string& path, const DataType& dtype) + + # Methods to create a View with a Buffer attached. + - decl: View *createView( const std::string& path, + Buffer *buff) + format: + function_suffix: _into_buffer + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createView( const std::string& path, + TypeID type, + IndexType num_elems, + Buffer *buff) + format: + function_suffix: _from_type_and_buffer + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createView( const std::string& path, + TypeID type, + int ndims, + IndexType * shape+dimension, + Buffer * buff) + format: + function_suffix: _from_shape_and_buffer + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + # Methods to create a View with externally-owned data attached. + - decl: View * createView( const std::string& path, + void * external_ptr) + format: + function_suffix: _external + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createView( const std::string& path, + TypeID type, + IndexType num_elems, + void * external_ptr) + format: + function_suffix: _from_type_external + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createView( const std::string& path, + TypeID type, + int ndims, + IndexType * shape+dimension, + void * external_ptr) + format: + function_suffix: _from_shape_external + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + # Methods to create a View and allocate data for it. + - decl: View *createViewAndAllocate( const std::string& path, + TypeID type, + IndexType num_elems) + format: + function_suffix: _nelems + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createViewAndAllocate( const std::string& path, + TypeID type, + int ndims, + IndexType *shape+dimension) + format: + function_suffix: _shape + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + +# - decl: View *createViewAndAllocate( const std::string& path, const DataType& dtype) + + - decl: | + template + View *createViewScalar( const std::string& path, ScalarType value) + cxx_template: + - instantiation: + - instantiation: + - instantiation: + - instantiation: + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + - decl: View *createViewString( const std::string& path, + const std::string& value) + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + + # View destruction methods. + - decl: void destroyView( const std::string &path ) +# - decl: void destroyView( IndexType idx ) +# fortran_generic: +# - decl: (int32_t idx) +# fortran_suffix: int32_t +# - decl: (int64_t idx) +# fortran_suffix: int64_t +# - decl: void destroyViews() + - decl: void destroyViewAndData(const std::string &path) + format: + function_suffix: _name + - decl: void destroyViewAndData(IndexType idx) + format: + function_suffix: _index + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t +# - decl: void destroyViewsAndData() + + # View move and copy methods. + - decl: View *moveView(View *view) + - decl: View *copyView(View *view) + + # Child Group query methods. + - decl: bool hasGroup( const string& path ) + - decl: bool hasChildGroup( const string& name ) +# - decl: bool hasGroup( IndexType idx ) +# fortran_generic: +# - decl: (int32_t idx) +# fortran_suffix: int32_t +# - decl: (int64_t idx) +# fortran_suffix: int64_t + - decl: IndexType getGroupIndex(const std::string &name) const + - decl: const std::string& getGroupName(IndexType idx) const +len(MAXNAMESIZE) + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t + C_error_pattern: C_invalid_name + PY_error_pattern: PY_invalid_name_idx + + # Group access and iteration methods. + - decl: Group * getGroup( const std::string& path ) + format: + function_suffix: _from_name + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none +# - decl: Group const * getGroup( const std::string& path ) const + - decl: Group * getGroup( IndexType idx) + format: + function_suffix: _from_index + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none +# - decl: Group const * getGroup(IndexType idx) const +# fortran_generic: +# - decl: (int32_t idx) +# fortran_suffix: int32_t +# - decl: (int64_t idx) +# fortran_suffix: int64_t + - decl: IndexType getFirstValidGroupIndex() const + - decl: IndexType getNextValidGroupIndex(IndexType idx) const + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t + + # Child Group creation and destruction methods. + - decl: Group *createGroup( const string& path ) + C_error_pattern: C_null_to_error_capsule + PY_error_pattern: PY_null_to_none + - decl: void destroyGroup(const std::string &path) + format: + function_suffix: _name + - decl: void destroyGroup(IndexType idx) + format: + function_suffix: _index + fortran_generic: + - decl: (int32_t idx) + fortran_suffix: int32_t + - decl: (int64_t idx) + fortran_suffix: int64_t +# - decl: void destroyGroups() + + # Group move and copy methods + - decl: Group *moveGroup(Group *grp) +# - decl: Group *copyGroup(Group *grp) + + # Group print methods. + - decl: void print() const +# - decl: void printTree( const int level ) const + +# - decl: void createNativeLayout(Node &) const + - decl: bool isEquivalentTo(const Group * other) const + + # Group I/O methods + - decl: void save(const std::string& file_path, + const std::string& protocol) const + - decl: void load(const std::string& file_path, + const std::string& protocol, + bool preserve_contents = false) + - decl: void loadExternalData(const std::string& file_path) +# - decl: void save(const hid_t& h5_id) const +# format: +# function_suffix: _hdf +# - decl: void load(const hid_t& h5_id) +# format: +# function_suffix: _hdf + + - decl: bool rename( const string& new_name ) + + python: + type: [ init, richcompare ] + +#################################################################### +- decl: class Buffer + declarations: + # Basic query and accessor methods + - decl: IndexType getIndex() const + - decl: size_t getNumViews() const + + # Methods to query and access Buffer data + - decl: void* getVoidPtr() + - decl: TypeID getTypeID() const + - decl: size_t getNumElements() const + - decl: size_t getTotalBytes() const + - decl: size_t getBytesPerElement() const + + # Data description and allocation methods + - decl: Buffer* describe(TypeID type, IndexType num_elems) + return_this: True + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + +# - decl: Buffer* describe(const DataType& dtype) + + - decl: Buffer* allocate() + format: + function_suffix: _existing + return_this: True + + - decl: Buffer* allocate(TypeID type, IndexType num_elems) + format: + function_suffix: _from_type + return_this: True + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + + - decl: Buffer* reallocate(IndexType num_elems) + return_this: True + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + + - decl: void print() const + + python: + type: [ init, richcompare ] + +#################################################################### +- decl: class View + declarations: + + # View query and accessor methods + - decl: IndexType getIndex() + - decl: const std::string& getName() const +len(MAXNAMESIZE) + - decl: std::string getPath() const +len(MAXNAMESIZE) + - decl: std::string getPathName() const +len(MAXNAMESIZE) + - decl: Group* getOwningGroup() +# - decl: Group const* getOwningGroup() const + - decl: bool hasBuffer() const + - decl: Buffer* getBuffer() +# - decl: Buffer const* getBuffer() const + - decl: bool isExternal() const + - decl: bool isAllocated() + - decl: bool isApplied() const + - decl: bool isDescribed() const + - decl: bool isEmpty() const + - decl: bool isOpaque() const + - decl: bool isScalar() const + - decl: bool isString() const + - decl: TypeID getTypeID() const + - decl: size_t getTotalBytes() const + - decl: size_t getNumElements() const + - decl: size_t getBytesPerElement() const + - decl: size_t getOffset() const + - decl: size_t getStride() const + - decl: int getNumDimensions() const + - decl: int getShape(int ndims, IndexType * shape+dimension+intent(OUT) ) const +# - decl: const Schema& getSchema() const +# - decl: Node& getNode() +# - decl: const Node& getNode() const + + # View allocation methods + - decl: View* allocate() + format: + function_suffix: _simple + return_this: True + + - decl: View* allocate(TypeID type, IndexType num_elems) + format: + function_suffix: _from_type + return_this: True + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + +# - decl: View* allocate(const DataType& dtype) + + - decl: View * reallocate(IndexType num_elems) + return_this: True + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + +# - decl: View* reallocate(const DataType& dtype) + + # Attach Buffer object to data view. + - decl: View* attachBuffer(Buffer * buff) + return_this: True + format: + function_suffix: _only + + - decl: View* attachBuffer(TypeID type, + IndexType num_elems, + Buffer * buff) + return_this: True + format: + function_suffix: _type + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + + - decl: View* attachBuffer(TypeID type, + int ndims, + IndexType * shape+dimension, + Buffer * buff) + return_this: True + format: + function_suffix: _shape + +# - decl: Buffer * detachBuffer() + + - decl: View* apply() + return_this: True + + - decl: View* apply(IndexType num_elems, + IndexType offset = 0, + IndexType stride = 1) + default_arg_suffix: + - _nelems + - _nelems_offset + - _nelems_offset_stride + return_this: True + + - decl: View* apply(TypeID type, + IndexType num_elems, + IndexType offset = 0, + IndexType stride = 1) + default_arg_suffix: + - _type_nelems + - _type_nelems_offset + - _type_nelems_offset_stride + return_this: True + + - decl: View * apply( TypeID type, int ndims, IndexType * shape+dimension ) + format: + function_suffix: _type_shape + return_this: True +# - decl: View* apply(const DataType& dtype) + + # Methods to set data in a view (scalar, string, or external data). + - decl: | + template + void setScalar(ScalarType value) + cxx_template: + - instantiation: + - instantiation: + - instantiation: + - instantiation: + + - decl: View * setString(const std::string& value) + return_this: True + + - decl: View * setExternalDataPtr(void * external_ptr) + return_this: True + format: + function_suffix: _only + + - decl: View * setExternalDataPtr(TypeID type, + IndexType num_elems, + void * external_ptr) + return_this: True + format: + function_suffix: _type + fortran_generic: + - decl: (int32_t num_elems) + fortran_suffix: int32_t + - decl: (int64_t num_elems) + fortran_suffix: int64_t + + - decl: View * setExternalDataPtr(TypeID type, + int ndims, + IndexType * shape+dimension, + void * external_ptr) + return_this: True + format: + function_suffix: _shape + + # Methods to retrieve data in a view. + - decl: const char * getString() +len(MAXNAMESIZE) + format: + F_string_result_as_arg: name + + - decl: | + template + DataType getData() + cxx_template: + - instantiation: + - instantiation: + - instantiation: + - instantiation: + + - decl: void * getVoidPtr() const + + # print methods + - decl: void print() const +# - decl: void createNativeLayout(Node &) const + - decl: bool rename( const string& new_name ) + + python: + type: [ init, richcompare ] + + +###################################################################### + +- decl: bool nameIsValid(const std::string& name) + # The concept of a valid name is different for C++, C and Fortran + options: + F_string_len_trim: false + format: + C_code: return name != NULL; + F_code: '{F_result} = name .ne. " "' + + +###################################################################### +patterns: + C_invalid_name: | + if (! axom::sidre::nameIsValid({cxx_var})) {{ + return SIDRE_InvalidName; + }} + # return a blank field string if an error occurs + C_invalid_name_buf: | + if (! axom::sidre::nameIsValid({cxx_var})) {{ + std::memset({c_var}, ' ', {c_var_len}); + return; + }} + # Fill in capsule then return NULL instead of pointer to capsule. + C_null_to_error_capsule: | + if ({cxx_var} == nullptr) {{ + {c_var}->addr = NULL; + {c_var}->idtor = 0; + return NULL; + }} + PY_invalid_name: | + if (! axom::sidre::nameIsValid({cxx_var})) {{ + PyErr_SetString(PyExc_KeyError, "XXX - need name"); + return NULL; + }} + # report the invalid index, assume local variable idx + PY_invalid_name_idx: | + if (! axom::sidre::nameIsValid({cxx_var})) {{ + Py_RETURN_NONE; + }} +# PyErr_SetObject(PyExc_KeyError, PyInt_FromLong(idx)); +# return NULL; + # Convert NULL to None + PY_null_to_none: | + if ({cxx_var} == nullptr) {{ + Py_RETURN_NONE; + }} + + + +# Files which contain code to be inserted into generated code +splicer: + c: + - c_fortran/csidresplicer.c + f: + - c_fortran/fsidresplicer.f + - genfsidresplicer.f diff --git a/src/axom/sidre/interface/sidre_shroud.yaml b/src/axom/sidre/interface/sidre_shroud.yaml index a8f3ceb3d8..a901bc1c40 100644 --- a/src/axom/sidre/interface/sidre_shroud.yaml +++ b/src/axom/sidre/interface/sidre_shroud.yaml @@ -51,7 +51,8 @@ declarations: F_derived_name: SidreBuffer - decl: class Group - cxx_header: axom/sidre/core/Group.hpp + # SidreTypes.h is required for C_invalid_name pattern. + cxx_header: axom/sidre/core/Group.hpp axom/sidre/interface/SidreTypes.h format: F_derived_name: SidreGroup @@ -687,9 +688,11 @@ declarations: # The concept of a valid name is different for C++, C and Fortran options: F_string_len_trim: false - format: - C_code: return name != NULL; - F_code: '{F_result} = name .ne. " "' + splicer: + c: + - "return name != NULL;" + f: + - 'SHT_rv = name .ne. " "' ###################################################################### diff --git a/src/axom/sidre/spio/interface/spio_shroud.yaml b/src/axom/sidre/spio/interface/spio_shroud.yaml index 7457cff25b..86f2436256 100644 --- a/src/axom/sidre/spio/interface/spio_shroud.yaml +++ b/src/axom/sidre/spio/interface/spio_shroud.yaml @@ -27,25 +27,21 @@ typemap: - type: axom::sidre::DataStore fields: base: shadow - cxx_header: axom/sidre/core/DataStore.hpp -# cxx_type: DataStore + wrap_header: axom/sidre/interface/c_fortran/wrapDataStore.h + c_type: SIDRE_DataStore f_module_name: axom_sidre f_derived_type: SidreDataStore f_capsule_data_type: SHROUD_datastore_capsule - c_type: SIDRE_datastore - c_header: axom/sidre/interface/c_fortran/wrapDataStore.h f_to_c: '{f_var}%cxxmem' - type: axom::sidre::Group fields: base: shadow - cxx_header: axom/sidre/core/Group.hpp -# cxx_type: Group + wrap_header: axom/sidre/interface/c_fortran/wrapGroup.h + c_type: SIDRE_Group f_module_name: axom_sidre f_derived_type: SidreGroup f_capsule_data_type: SHROUD_group_capsule - c_type: SIDRE_group - c_header: axom/sidre/interface/c_fortran/wrapGroup.h f_to_c: '{f_var}%cxxmem' declarations: diff --git a/src/axom/sidre/tests/sidre_buffer_C.cpp b/src/axom/sidre/tests/sidre_buffer_C.cpp index 5712a9c9a0..ffc9e990fe 100644 --- a/src/axom/sidre/tests/sidre_buffer_C.cpp +++ b/src/axom/sidre/tests/sidre_buffer_C.cpp @@ -13,122 +13,122 @@ TEST(C_sidre_buffer,create_buffers) { - SIDRE_datastore ds_buf; - SIDRE_buffer dbuff_0_buf, dbuff_1_buf, dbuff_3_buf; + SIDRE_DataStore ds_buf; + SIDRE_Buffer dbuff_0_buf, dbuff_1_buf, dbuff_3_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_buffer* dbuff_0 = SIDRE_datastore_create_buffer_empty(ds, &dbuff_0_buf); - SIDRE_buffer* dbuff_1 = SIDRE_datastore_create_buffer_empty(ds, &dbuff_1_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Buffer* dbuff_0 = SIDRE_DataStore_create_buffer_empty(ds, &dbuff_0_buf); + SIDRE_Buffer* dbuff_1 = SIDRE_DataStore_create_buffer_empty(ds, &dbuff_1_buf); - EXPECT_EQ(SIDRE_buffer_get_index(dbuff_0), 0); - EXPECT_EQ(SIDRE_buffer_get_index(dbuff_1), 1); - SIDRE_datastore_destroy_buffer(ds, 0); + EXPECT_EQ(SIDRE_Buffer_get_index(dbuff_0), 0); + EXPECT_EQ(SIDRE_Buffer_get_index(dbuff_1), 1); + SIDRE_DataStore_destroy_buffer(ds, 0); - SIDRE_buffer* dbuff_3 = SIDRE_datastore_create_buffer_empty(ds, &dbuff_3_buf); - EXPECT_EQ(SIDRE_buffer_get_index(dbuff_3), 0); + SIDRE_Buffer* dbuff_3 = SIDRE_DataStore_create_buffer_empty(ds, &dbuff_3_buf); + EXPECT_EQ(SIDRE_Buffer_get_index(dbuff_3), 0); - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_buffer,alloc_buffer_for_int_array) { - SIDRE_datastore ds_buf; - SIDRE_buffer dbuff_buf; + SIDRE_DataStore ds_buf; + SIDRE_Buffer dbuff_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_buffer* dbuff = SIDRE_datastore_create_buffer_from_type(ds, + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Buffer* dbuff = SIDRE_DataStore_create_buffer_from_type(ds, SIDRE_INT_ID, 10, &dbuff_buf); -// SIDRE_buffer_declare(dbuff, SIDRE_INT_ID, 10); - SIDRE_buffer_allocate_existing(dbuff); +// SIDRE_Buffer_declare(dbuff, SIDRE_INT_ID, 10); + SIDRE_Buffer_allocate_existing(dbuff); - EXPECT_EQ(SIDRE_buffer_get_type_id(dbuff), SIDRE_INT_ID); - EXPECT_EQ(SIDRE_buffer_get_num_elements(dbuff), 10u); - EXPECT_EQ(SIDRE_buffer_get_bytes_per_element(dbuff), sizeof(int)); - EXPECT_EQ(SIDRE_buffer_get_total_bytes(dbuff), sizeof(int) * 10); + EXPECT_EQ(SIDRE_Buffer_get_type_id(dbuff), SIDRE_INT_ID); + EXPECT_EQ(SIDRE_Buffer_get_num_elements(dbuff), 10u); + EXPECT_EQ(SIDRE_Buffer_get_bytes_per_element(dbuff), sizeof(int)); + EXPECT_EQ(SIDRE_Buffer_get_total_bytes(dbuff), sizeof(int) * 10); - int* data_ptr = (int*) SIDRE_buffer_get_void_ptr(dbuff); + int* data_ptr = (int*) SIDRE_Buffer_get_void_ptr(dbuff); for(int i=0 ; i<10 ; i++) { data_ptr[i] = i*i; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_buffer,init_buffer_for_int_array) { - SIDRE_datastore ds_buf; - SIDRE_buffer dbuff_buf; + SIDRE_DataStore ds_buf; + SIDRE_Buffer dbuff_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_buffer* dbuff = SIDRE_datastore_create_buffer_empty(ds, &dbuff_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Buffer* dbuff = SIDRE_DataStore_create_buffer_empty(ds, &dbuff_buf); - SIDRE_buffer_allocate_from_type(dbuff, SIDRE_INT_ID, 10); + SIDRE_Buffer_allocate_from_type(dbuff, SIDRE_INT_ID, 10); - EXPECT_EQ(SIDRE_buffer_get_type_id(dbuff), SIDRE_INT_ID); - EXPECT_EQ(SIDRE_buffer_get_num_elements(dbuff), 10u); - EXPECT_EQ(SIDRE_buffer_get_bytes_per_element(dbuff), sizeof(int)); - EXPECT_EQ(SIDRE_buffer_get_total_bytes(dbuff), sizeof(int) * 10); + EXPECT_EQ(SIDRE_Buffer_get_type_id(dbuff), SIDRE_INT_ID); + EXPECT_EQ(SIDRE_Buffer_get_num_elements(dbuff), 10u); + EXPECT_EQ(SIDRE_Buffer_get_bytes_per_element(dbuff), sizeof(int)); + EXPECT_EQ(SIDRE_Buffer_get_total_bytes(dbuff), sizeof(int) * 10); - int* data_ptr = (int*) SIDRE_buffer_get_void_ptr(dbuff); + int* data_ptr = (int*) SIDRE_Buffer_get_void_ptr(dbuff); for(int i=0 ; i<10 ; i++) { data_ptr[i] = i*i; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_buffer,realloc_buffer) { - SIDRE_datastore ds_buf; - SIDRE_buffer dbuff_buf; + SIDRE_DataStore ds_buf; + SIDRE_Buffer dbuff_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_buffer* dbuff = SIDRE_datastore_create_buffer_from_type(ds, + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Buffer* dbuff = SIDRE_DataStore_create_buffer_from_type(ds, SIDRE_LONG_ID, 5, &dbuff_buf); - SIDRE_buffer_allocate_existing(dbuff); + SIDRE_Buffer_allocate_existing(dbuff); - EXPECT_EQ(SIDRE_buffer_get_type_id(dbuff), SIDRE_LONG_ID); - EXPECT_EQ(SIDRE_buffer_get_num_elements(dbuff), 5u); - EXPECT_EQ(SIDRE_buffer_get_bytes_per_element(dbuff), sizeof(long)); - EXPECT_EQ(SIDRE_buffer_get_total_bytes(dbuff), sizeof(long) * 5); + EXPECT_EQ(SIDRE_Buffer_get_type_id(dbuff), SIDRE_LONG_ID); + EXPECT_EQ(SIDRE_Buffer_get_num_elements(dbuff), 5u); + EXPECT_EQ(SIDRE_Buffer_get_bytes_per_element(dbuff), sizeof(long)); + EXPECT_EQ(SIDRE_Buffer_get_total_bytes(dbuff), sizeof(long) * 5); - long* data_ptr = (long*) SIDRE_buffer_get_void_ptr(dbuff); + long* data_ptr = (long*) SIDRE_Buffer_get_void_ptr(dbuff); for(int i=0 ; i<5 ; i++) { data_ptr[i] = 5; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); - SIDRE_buffer_reallocate(dbuff, 10); + SIDRE_Buffer_reallocate(dbuff, 10); - EXPECT_EQ(SIDRE_buffer_get_type_id(dbuff), SIDRE_LONG_ID); - EXPECT_EQ(SIDRE_buffer_get_num_elements(dbuff), 10u); - EXPECT_EQ(SIDRE_buffer_get_bytes_per_element(dbuff), sizeof(long)); - EXPECT_EQ(SIDRE_buffer_get_total_bytes(dbuff), sizeof(long) * 10); + EXPECT_EQ(SIDRE_Buffer_get_type_id(dbuff), SIDRE_LONG_ID); + EXPECT_EQ(SIDRE_Buffer_get_num_elements(dbuff), 10u); + EXPECT_EQ(SIDRE_Buffer_get_bytes_per_element(dbuff), sizeof(long)); + EXPECT_EQ(SIDRE_Buffer_get_total_bytes(dbuff), sizeof(long) * 10); // data buffer changes - data_ptr = (long*) SIDRE_buffer_get_void_ptr(dbuff); + data_ptr = (long*) SIDRE_Buffer_get_void_ptr(dbuff); for(int i=0 ; i<5 ; i++) { @@ -140,8 +140,8 @@ TEST(C_sidre_buffer,realloc_buffer) data_ptr[i] = 10; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } diff --git a/src/axom/sidre/tests/sidre_external_C.cpp b/src/axom/sidre/tests/sidre_external_C.cpp index b4664ee5a9..2ae4934880 100644 --- a/src/axom/sidre/tests/sidre_external_C.cpp +++ b/src/axom/sidre/tests/sidre_external_C.cpp @@ -14,12 +14,12 @@ //------------------------------------------------------------------------------ TEST(C_sidre_external, create_external_view) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view iview_buf, dview_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View iview_buf, dview_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); const int len = 11; @@ -32,30 +32,30 @@ TEST(C_sidre_external, create_external_view) ddata[ii] = idata[ii] * 2.0; } - SIDRE_view* iview = - SIDRE_group_create_view_external(root, "idata", idata, &iview_buf); - SIDRE_view_apply_type_nelems(iview, SIDRE_INT_ID, len); - SIDRE_view* dview = - SIDRE_group_create_view_external(root, "ddata", ddata, &dview_buf); - SIDRE_view_apply_type_nelems(dview, SIDRE_DOUBLE_ID, len); - EXPECT_EQ(SIDRE_group_get_num_views(root), 2u); + SIDRE_View* iview = + SIDRE_Group_create_view_external(root, "idata", idata, &iview_buf); + SIDRE_View_apply_type_nelems(iview, SIDRE_INT_ID, len); + SIDRE_View* dview = + SIDRE_Group_create_view_external(root, "ddata", ddata, &dview_buf); + SIDRE_View_apply_type_nelems(dview, SIDRE_DOUBLE_ID, len); + EXPECT_EQ(SIDRE_Group_get_num_views(root), 2u); - SIDRE_view_print(iview); - SIDRE_view_print(dview); + SIDRE_View_print(iview); + SIDRE_View_print(dview); - int* idata_chk = (int*) SIDRE_view_get_void_ptr(iview); + int* idata_chk = (int*) SIDRE_View_get_void_ptr(iview); for (int ii = 0 ; ii < len ; ++ii) { EXPECT_EQ(idata_chk[ii], idata[ii]); } - double* ddata_chk = (double*) SIDRE_view_get_void_ptr(dview); + double* ddata_chk = (double*) SIDRE_View_get_void_ptr(dview); for (int ii = 0 ; ii < len ; ++ii) { EXPECT_EQ(ddata_chk[ii], ddata[ii]); } - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); free(idata); free(ddata); } @@ -66,11 +66,11 @@ TEST(C_sidre_external, create_external_view) //------------------------------------------------------------------------------ TEST(C_sidre_external, save_load_external_view) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); const int len = 11; @@ -83,51 +83,51 @@ TEST(C_sidre_external, save_load_external_view) ddata[ii] = idata[ii] * 2.0; } - SIDRE_view* iview = - SIDRE_group_create_view_external(root, "idata", idata); - SIDRE_view_apply_type_nelems(iview, SIDRE_INT_ID, len); - SIDRE_view* dview = - SIDRE_group_create_view_external(root, "ddata", ddata); - SIDRE_view_apply_type_nelems(dview, SIDRE_DOUBLE_ID, len); + SIDRE_View* iview = + SIDRE_Group_create_view_external(root, "idata", idata); + SIDRE_View_apply_type_nelems(iview, SIDRE_INT_ID, len); + SIDRE_View* dview = + SIDRE_Group_create_view_external(root, "ddata", ddata); + SIDRE_View_apply_type_nelems(dview, SIDRE_DOUBLE_ID, len); - EXPECT_EQ(SIDRE_group_get_num_views(root), 2u); + EXPECT_EQ(SIDRE_Group_get_num_views(root), 2u); - SIDRE_view_print(iview); - SIDRE_view_print(dview); + SIDRE_View_print(iview); + SIDRE_View_print(dview); - SIDRE_group_save(root, "out_sidre_external_save_restore_external_view", + SIDRE_Group_save(root, "out_sidre_external_save_restore_external_view", "conduit"); - SIDRE_datastore_print(ds); + SIDRE_DataStore_print(ds); - SIDRE_datastore* ds2 = SIDRE_datastore_new(); - SIDRE_group* root2 = SIDRE_datastore_get_root(ds); + SIDRE_DataStore* ds2 = SIDRE_DataStore_new(); + SIDRE_Group* root2 = SIDRE_DataStore_get_root(ds); - SIDRE_group_load(root, "out_sidre_external_save_restore_external_view", + SIDRE_Group_load(root, "out_sidre_external_save_restore_external_view", "conduit"); - SIDRE_datastore_print(ds2); + SIDRE_DataStore_print(ds2); - SIDRE_view* iview2 = SIDRE_group_get_view_from_name(root2, "idata"); - SIDRE_view* dview2 = SIDRE_group_get_view_from_name(root2, "ddata"); + SIDRE_View* iview2 = SIDRE_Group_get_view_from_name(root2, "idata"); + SIDRE_View* dview2 = SIDRE_Group_get_view_from_name(root2, "ddata"); - EXPECT_EQ(SIDRE_group_get_num_views(root2), 2u); + EXPECT_EQ(SIDRE_Group_get_num_views(root2), 2u); - int* idata_chk = (int*) SIDRE_view_get_void_ptr(iview2); + int* idata_chk = (int*) SIDRE_View_get_void_ptr(iview2); for (int ii = 0 ; ii < len ; ++ii) { EXPECT_EQ(idata_chk[ii], idata[ii]); } - double* ddata_chk = (double*) SIDRE_view_get_void_ptr(dview2); + double* ddata_chk = (double*) SIDRE_View_get_void_ptr(dview2); for (int ii = 0 ; ii < len ; ++ii) { EXPECT_EQ(ddata_chk[ii], ddata[ii]); } - SIDRE_datastore_delete(ds); - SIDRE_datastore_delete(ds2); + SIDRE_DataStore_delete(ds); + SIDRE_DataStore_delete(ds2); free(idata); free(ddata); } diff --git a/src/axom/sidre/tests/sidre_group_C.cpp b/src/axom/sidre/tests/sidre_group_C.cpp index fd6baf482d..03b869bdd6 100644 --- a/src/axom/sidre/tests/sidre_group_C.cpp +++ b/src/axom/sidre/tests/sidre_group_C.cpp @@ -16,21 +16,21 @@ //------------------------------------------------------------------------------ TEST(C_sidre_group,get_name) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, group_buf, group2_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, group_buf, group2_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* group = SIDRE_group_create_group(root, "test", &group_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* group = SIDRE_Group_create_group(root, "test", &group_buf); // EXPECT_TRUE(group->getName() == std::string("test") ); - EXPECT_TRUE(strcmp(SIDRE_group_get_name(group), "test") == 0); + EXPECT_TRUE(strcmp(SIDRE_Group_get_name(group), "test") == 0); - SIDRE_group* group2 = - SIDRE_group_get_group_from_name(root, "foo", &group2_buf); + SIDRE_Group* group2 = + SIDRE_Group_get_group_from_name(root, "foo", &group2_buf); EXPECT_TRUE(group2 == NULL); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -38,19 +38,19 @@ TEST(C_sidre_group,get_name) //------------------------------------------------------------------------------ TEST(C_sidre_group,get_parent) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf, child_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf, child_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); - SIDRE_group* child = SIDRE_group_create_group(parent, "child", &child_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); + SIDRE_Group* child = SIDRE_Group_create_group(parent, "child", &child_buf); - SIDRE_group tmp_buf; - SIDRE_group* tmp = SIDRE_group_get_parent(child, &tmp_buf); + SIDRE_Group tmp_buf; + SIDRE_Group* tmp = SIDRE_Group_get_parent(child, &tmp_buf); EXPECT_TRUE( tmp->addr == parent->addr ); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -58,20 +58,20 @@ TEST(C_sidre_group,get_parent) //------------------------------------------------------------------------------ TEST(C_sidre_group,get_datastore) { - SIDRE_datastore ds_buf, const_ds_buf; - SIDRE_group root_buf, group_buf; + SIDRE_DataStore ds_buf, const_ds_buf; + SIDRE_Group root_buf, group_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* group = SIDRE_group_create_group(root, "parent", &group_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* group = SIDRE_Group_create_group(root, "parent", &group_buf); - EXPECT_TRUE( SIDRE_group_get_data_store(group, &ds_buf) == ds ); + EXPECT_TRUE( SIDRE_Group_get_data_store(group, &ds_buf) == ds ); - SIDRE_datastore const* const_ds = SIDRE_group_get_data_store(group, + SIDRE_DataStore const* const_ds = SIDRE_Group_get_data_store(group, &const_ds_buf); EXPECT_TRUE( const_ds->addr == ds->addr ); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -79,28 +79,28 @@ TEST(C_sidre_group,get_datastore) //------------------------------------------------------------------------------ TEST(C_sidre_group,get_group) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf, child_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf, child_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); - SIDRE_group* child = SIDRE_group_create_group(parent, "child", &child_buf); - EXPECT_TRUE( SIDRE_group_get_parent(child, &parent_buf) == parent ); + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); + SIDRE_Group* child = SIDRE_Group_create_group(parent, "child", &child_buf); + EXPECT_TRUE( SIDRE_Group_get_parent(child, &parent_buf) == parent ); - SIDRE_group tmp_buf; - SIDRE_group* tmp = SIDRE_group_get_group_from_name(parent, "child", &tmp_buf); + SIDRE_Group tmp_buf; + SIDRE_Group* tmp = SIDRE_Group_get_group_from_name(parent, "child", &tmp_buf); EXPECT_TRUE(tmp->addr = child->addr); - tmp = SIDRE_group_get_group_from_index(parent, 0, &tmp_buf); + tmp = SIDRE_Group_get_group_from_index(parent, 0, &tmp_buf); EXPECT_TRUE(tmp->addr = child->addr); // check error condition - EXPECT_TRUE( SIDRE_group_get_group_from_name(parent, + EXPECT_TRUE( SIDRE_Group_get_group_from_name(parent, "non-existant group", &parent_buf) == NULL ); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -108,29 +108,29 @@ TEST(C_sidre_group,get_group) //------------------------------------------------------------------------------ TEST(C_sidre_group,get_view) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf; - SIDRE_view view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf; + SIDRE_View view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); - SIDRE_view* view = SIDRE_group_create_view_empty(parent, "view", &view_buf); + SIDRE_View* view = SIDRE_Group_create_view_empty(parent, "view", &view_buf); - SIDRE_view tmp_buf; - SIDRE_view* tmp = SIDRE_group_get_view_from_name(parent, "view", &tmp_buf); + SIDRE_View tmp_buf; + SIDRE_View* tmp = SIDRE_Group_get_view_from_name(parent, "view", &tmp_buf); EXPECT_TRUE(tmp->addr == view->addr); - tmp = SIDRE_group_get_view_from_index(parent, 0, &tmp_buf); + tmp = SIDRE_Group_get_view_from_index(parent, 0, &tmp_buf); EXPECT_TRUE(tmp->addr == view->addr); // check error condition - EXPECT_TRUE( SIDRE_group_get_view_from_name(parent, + EXPECT_TRUE( SIDRE_Group_get_view_from_name(parent, "non-existant view", &view_buf) == NULL ); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -138,42 +138,42 @@ TEST(C_sidre_group,get_view) //------------------------------------------------------------------------------ TEST(C_sidre_group,get_view_names_and_indicies) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf; - SIDRE_view view1_buf, view2_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf; + SIDRE_View view1_buf, view2_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); - SIDRE_view* view1 = - SIDRE_group_create_view_empty(parent, "view1", &view1_buf); - SIDRE_view* view2 = - SIDRE_group_create_view_empty(parent, "view2", &view2_buf); + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); + SIDRE_View* view1 = + SIDRE_Group_create_view_empty(parent, "view1", &view1_buf); + SIDRE_View* view2 = + SIDRE_Group_create_view_empty(parent, "view2", &view2_buf); - EXPECT_EQ(SIDRE_group_get_num_views(parent), 2u); + EXPECT_EQ(SIDRE_Group_get_num_views(parent), 2u); - SIDRE_IndexType idx1 = SIDRE_group_get_view_index(parent, "view1"); - SIDRE_IndexType idx2 = SIDRE_group_get_view_index(parent, "view2"); + SIDRE_IndexType idx1 = SIDRE_Group_get_view_index(parent, "view1"); + SIDRE_IndexType idx2 = SIDRE_Group_get_view_index(parent, "view2"); - const char* name1 = SIDRE_group_get_view_name(parent, idx1); - const char* name2 = SIDRE_group_get_view_name(parent, idx2); + const char* name1 = SIDRE_Group_get_view_name(parent, idx1); + const char* name2 = SIDRE_Group_get_view_name(parent, idx2); EXPECT_TRUE(strcmp(name1, "view1") == 0); - EXPECT_TRUE(strcmp(SIDRE_view_get_name(view1), name1) == 0); + EXPECT_TRUE(strcmp(SIDRE_View_get_name(view1), name1) == 0); EXPECT_TRUE(strcmp(name2, "view2") == 0); - EXPECT_TRUE(strcmp(SIDRE_view_get_name(view2), name2) == 0); + EXPECT_TRUE(strcmp(SIDRE_View_get_name(view2), name2) == 0); // check error conditions - SIDRE_IndexType idx3 = SIDRE_group_get_view_index(parent, "view3"); + SIDRE_IndexType idx3 = SIDRE_Group_get_view_index(parent, "view3"); EXPECT_TRUE(idx3 == SIDRE_InvalidIndex); - const char* name3 = SIDRE_group_get_view_name(parent, idx3); + const char* name3 = SIDRE_Group_get_view_name(parent, idx3); EXPECT_TRUE(name3 == NULL); EXPECT_FALSE(SIDRE_name_is_valid(name3)); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -181,45 +181,45 @@ TEST(C_sidre_group,get_view_names_and_indicies) //------------------------------------------------------------------------------ TEST(sidre_group,get_first_and_next_group_index) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf, group1_buf, group2_buf; - SIDRE_group group1out_buf, group2out_buf, emptyGroup_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf, group1_buf, group2_buf; + SIDRE_Group group1out_buf, group2out_buf, emptyGroup_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); - SIDRE_group* group1 = SIDRE_group_create_group(parent, "group1", &group1_buf); - SIDRE_group* group2 = SIDRE_group_create_group(parent, "group2", &group2_buf); - EXPECT_EQ(SIDRE_group_get_num_groups(parent), 2u); + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); + SIDRE_Group* group1 = SIDRE_Group_create_group(parent, "group1", &group1_buf); + SIDRE_Group* group2 = SIDRE_Group_create_group(parent, "group2", &group2_buf); + EXPECT_EQ(SIDRE_Group_get_num_groups(parent), 2u); - SIDRE_IndexType idx1 = SIDRE_group_get_first_valid_group_index(parent); - SIDRE_IndexType idx2 = SIDRE_group_get_next_valid_group_index(parent, idx1); - SIDRE_IndexType idx3 = SIDRE_group_get_next_valid_group_index(parent, idx2); + SIDRE_IndexType idx1 = SIDRE_Group_get_first_valid_group_index(parent); + SIDRE_IndexType idx2 = SIDRE_Group_get_next_valid_group_index(parent, idx1); + SIDRE_IndexType idx3 = SIDRE_Group_get_next_valid_group_index(parent, idx2); EXPECT_EQ(0, idx1); EXPECT_EQ(1, idx2); EXPECT_EQ(SIDRE_InvalidIndex, idx3); - SIDRE_group* group1out = SIDRE_group_get_group_from_index(parent, idx1, + SIDRE_Group* group1out = SIDRE_Group_get_group_from_index(parent, idx1, &group1out_buf); - SIDRE_group* group2out = SIDRE_group_get_group_from_index(parent, idx2, + SIDRE_Group* group2out = SIDRE_Group_get_group_from_index(parent, idx2, &group2out_buf); EXPECT_EQ(group1->addr, group1out->addr); EXPECT_EQ(group2->addr, group2out->addr); // check error conditions - SIDRE_group* emptyGroup = - SIDRE_group_create_group(root, "emptyGroup", &emptyGroup_buf); + SIDRE_Group* emptyGroup = + SIDRE_Group_create_group(root, "emptyGroup", &emptyGroup_buf); - SIDRE_IndexType badidx1 = SIDRE_group_get_first_valid_group_index( + SIDRE_IndexType badidx1 = SIDRE_Group_get_first_valid_group_index( emptyGroup); - SIDRE_IndexType badidx2 = SIDRE_group_get_next_valid_group_index( + SIDRE_IndexType badidx2 = SIDRE_Group_get_next_valid_group_index( emptyGroup, badidx1); EXPECT_EQ(SIDRE_InvalidIndex, badidx1); EXPECT_EQ(SIDRE_InvalidIndex, badidx2); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -227,48 +227,48 @@ TEST(sidre_group,get_first_and_next_group_index) //------------------------------------------------------------------------------ TEST(sidre_group,get_first_and_next_view_index) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf, emptyGroup_buf; - SIDRE_view view1_buf, view2_buf; - SIDRE_view view1out_buf, view2out_buf; - - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); - SIDRE_view* view1 = - SIDRE_group_create_view_empty(parent, "view1", &view1_buf); - SIDRE_view* view2 = - SIDRE_group_create_view_empty(parent, "view2", &view2_buf); - EXPECT_EQ(SIDRE_group_get_num_views(parent), 2u); - - SIDRE_IndexType idx1 = SIDRE_group_get_first_valid_view_index(parent); - SIDRE_IndexType idx2 = SIDRE_group_get_next_valid_view_index(parent, idx1); - SIDRE_IndexType idx3 = SIDRE_group_get_next_valid_view_index(parent, idx2); + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf, emptyGroup_buf; + SIDRE_View view1_buf, view2_buf; + SIDRE_View view1out_buf, view2out_buf; + + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); + SIDRE_View* view1 = + SIDRE_Group_create_view_empty(parent, "view1", &view1_buf); + SIDRE_View* view2 = + SIDRE_Group_create_view_empty(parent, "view2", &view2_buf); + EXPECT_EQ(SIDRE_Group_get_num_views(parent), 2u); + + SIDRE_IndexType idx1 = SIDRE_Group_get_first_valid_view_index(parent); + SIDRE_IndexType idx2 = SIDRE_Group_get_next_valid_view_index(parent, idx1); + SIDRE_IndexType idx3 = SIDRE_Group_get_next_valid_view_index(parent, idx2); EXPECT_EQ(0, idx1); EXPECT_EQ(1, idx2); EXPECT_EQ(SIDRE_InvalidIndex, idx3); - SIDRE_view* view1out = SIDRE_group_get_view_from_index(parent, idx1, + SIDRE_View* view1out = SIDRE_Group_get_view_from_index(parent, idx1, &view1out_buf); - SIDRE_view* view2out = SIDRE_group_get_view_from_index(parent, idx2, + SIDRE_View* view2out = SIDRE_Group_get_view_from_index(parent, idx2, &view2out_buf); EXPECT_EQ(view1->addr, view1out->addr); EXPECT_EQ(view2->addr, view2out->addr); // check error conditions - SIDRE_group* emptyGroup = - SIDRE_group_create_group(root, "emptyGroup", &emptyGroup_buf); + SIDRE_Group* emptyGroup = + SIDRE_Group_create_group(root, "emptyGroup", &emptyGroup_buf); - SIDRE_IndexType badidx1 = SIDRE_group_get_first_valid_view_index( + SIDRE_IndexType badidx1 = SIDRE_Group_get_first_valid_view_index( emptyGroup); - SIDRE_IndexType badidx2 = SIDRE_group_get_next_valid_view_index( + SIDRE_IndexType badidx2 = SIDRE_Group_get_next_valid_view_index( emptyGroup, badidx1); EXPECT_EQ(SIDRE_InvalidIndex, badidx1); EXPECT_EQ(SIDRE_InvalidIndex, badidx2); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -276,39 +276,39 @@ TEST(sidre_group,get_first_and_next_view_index) //------------------------------------------------------------------------------ TEST(C_sidre_group,get_group_name_index) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, parent_buf, group1_buf, group2_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, parent_buf, group1_buf, group2_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* parent = SIDRE_group_create_group(root, "parent", &parent_buf); - SIDRE_group* group1 = SIDRE_group_create_group(parent, "group1", &group1_buf); - SIDRE_group* group2 = SIDRE_group_create_group(parent, "group2", &group2_buf); + SIDRE_Group* parent = SIDRE_Group_create_group(root, "parent", &parent_buf); + SIDRE_Group* group1 = SIDRE_Group_create_group(parent, "group1", &group1_buf); + SIDRE_Group* group2 = SIDRE_Group_create_group(parent, "group2", &group2_buf); - EXPECT_EQ(SIDRE_group_get_num_groups(parent), 2u); + EXPECT_EQ(SIDRE_Group_get_num_groups(parent), 2u); - SIDRE_IndexType idx1 = SIDRE_group_get_group_index(parent, "group1"); - SIDRE_IndexType idx2 = SIDRE_group_get_group_index(parent, "group2"); + SIDRE_IndexType idx1 = SIDRE_Group_get_group_index(parent, "group1"); + SIDRE_IndexType idx2 = SIDRE_Group_get_group_index(parent, "group2"); - const char* name1 = SIDRE_group_get_group_name(parent, idx1); - const char* name2 = SIDRE_group_get_group_name(parent, idx2); + const char* name1 = SIDRE_Group_get_group_name(parent, idx1); + const char* name2 = SIDRE_Group_get_group_name(parent, idx2); EXPECT_TRUE(strcmp(name1, "group1") == 0); - EXPECT_TRUE(strcmp(SIDRE_group_get_name(group1), name1) == 0); + EXPECT_TRUE(strcmp(SIDRE_Group_get_name(group1), name1) == 0); EXPECT_TRUE(strcmp(name2, "group2") == 0); - EXPECT_TRUE(strcmp(SIDRE_group_get_name(group2), name2) == 0); + EXPECT_TRUE(strcmp(SIDRE_Group_get_name(group2), name2) == 0); // check error conditions - SIDRE_IndexType idx3 = SIDRE_group_get_group_index(parent, "group3"); + SIDRE_IndexType idx3 = SIDRE_Group_get_group_index(parent, "group3"); EXPECT_TRUE(idx3 == SIDRE_InvalidIndex); - const char* name3 = SIDRE_group_get_group_name(parent, idx3); + const char* name3 = SIDRE_Group_get_group_name(parent, idx3); EXPECT_TRUE(name3 == NULL); EXPECT_TRUE(SIDRE_name_is_valid(name3) == 0); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -320,42 +320,42 @@ TEST(C_sidre_group,get_group_name_index) //------------------------------------------------------------------------------ TEST(C_sidre_group,create_destroy_has_view) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, group_buf; - SIDRE_view view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, group_buf; + SIDRE_View view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* group = SIDRE_group_create_group(root, "parent", &group_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* group = SIDRE_Group_create_group(root, "parent", &group_buf); - SIDRE_view* view = SIDRE_group_create_view_empty(group, "view", &view_buf); - EXPECT_TRUE( SIDRE_group_get_parent(group, &root_buf) == root ); - EXPECT_FALSE( SIDRE_view_has_buffer(view) ); + SIDRE_View* view = SIDRE_Group_create_view_empty(group, "view", &view_buf); + EXPECT_TRUE( SIDRE_Group_get_parent(group, &root_buf) == root ); + EXPECT_FALSE( SIDRE_View_has_buffer(view) ); - EXPECT_TRUE( SIDRE_group_has_view(group, "view") ); + EXPECT_TRUE( SIDRE_Group_has_view(group, "view") ); // try creating view again, should be a no-op. - EXPECT_TRUE( SIDRE_group_create_view_empty(group, "view", + EXPECT_TRUE( SIDRE_Group_create_view_empty(group, "view", &view_buf) == NULL ); - SIDRE_group_destroy_view(group, "view"); + SIDRE_Group_destroy_view(group, "view"); // destroy already destroyed group. Should be a no-op, not a failure - SIDRE_group_destroy_view(group, "view"); + SIDRE_Group_destroy_view(group, "view"); - EXPECT_FALSE( SIDRE_group_has_view(group, "view") ); + EXPECT_FALSE( SIDRE_Group_has_view(group, "view") ); // try api call that specifies specific type and length - SIDRE_group_create_view_and_allocate_nelems( group, + SIDRE_Group_create_view_and_allocate_nelems( group, "viewWithLength1", SIDRE_FLOAT_ID, 50, &view_buf); // error condition check - try again with duplicate name, should be a no-op - //XXX EXPECT_TRUE( SIDRE_group_create_view_and_allocate( group, + //XXX EXPECT_TRUE( SIDRE_Group_create_view_and_allocate( group, // "viewWithLength1", SIDRE_FLOAT64_ID, 50) ); - SIDRE_group_destroy_view_and_data_name( group, "viewWithLength1"); - EXPECT_FALSE( SIDRE_group_has_view( group, "viewWithLength1") ); + SIDRE_Group_destroy_view_and_data_name( group, "viewWithLength1"); + EXPECT_FALSE( SIDRE_Group_has_view( group, "viewWithLength1") ); - EXPECT_TRUE( SIDRE_group_create_view_and_allocate_nelems( group, + EXPECT_TRUE( SIDRE_Group_create_view_and_allocate_nelems( group, "viewWithLengthBadLen", SIDRE_FLOAT64_ID, -1, @@ -363,20 +363,20 @@ TEST(C_sidre_group,create_destroy_has_view) NULL ); // try api call that specifies data type in another way - SIDRE_group_create_view_and_allocate_nelems( group, "viewWithLength2", + SIDRE_Group_create_view_and_allocate_nelems( group, "viewWithLength2", SIDRE_FLOAT64_ID, 50, &view_buf ); - EXPECT_TRUE( SIDRE_group_create_view_and_allocate_nelems( group, + EXPECT_TRUE( SIDRE_Group_create_view_and_allocate_nelems( group, "viewWithLength2", SIDRE_FLOAT64_ID, 50, &view_buf ) == NULL ); // destroy this view using index - SIDRE_group_destroy_view_and_data_index( group, SIDRE_group_get_first_valid_view_index( + SIDRE_Group_destroy_view_and_data_index( group, SIDRE_Group_get_first_valid_view_index( group) ); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -386,53 +386,53 @@ TEST(C_sidre_group,create_destroy_has_view) //------------------------------------------------------------------------------ TEST(C_sidre_group,create_destroy_has_group) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, group_buf, group2_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, group_buf, group2_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* group = SIDRE_group_create_group(root, "group", &group_buf); - EXPECT_TRUE( SIDRE_group_get_parent(group, &root_buf) == root ); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* group = SIDRE_Group_create_group(root, "group", &group_buf); + EXPECT_TRUE( SIDRE_Group_get_parent(group, &root_buf) == root ); - EXPECT_TRUE( SIDRE_group_has_group(root, "group") ); + EXPECT_TRUE( SIDRE_Group_has_group(root, "group") ); - SIDRE_group_destroy_group_name(root, "group"); - EXPECT_FALSE( SIDRE_group_has_group(root, "group") ); + SIDRE_Group_destroy_group_name(root, "group"); + EXPECT_FALSE( SIDRE_Group_has_group(root, "group") ); - SIDRE_group* group2 = SIDRE_group_create_group(root, "group2", &group2_buf); + SIDRE_Group* group2 = SIDRE_Group_create_group(root, "group2", &group2_buf); // shut up compiler about unused variable (void)group2; - SIDRE_group_destroy_group_index( root, SIDRE_group_get_first_valid_group_index( + SIDRE_Group_destroy_group_index( root, SIDRE_Group_get_first_valid_group_index( root) ); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_group,group_name_collisions) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, flds_buf, badGroup_buf; - SIDRE_view view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, flds_buf, badGroup_buf; + SIDRE_View view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* flds = SIDRE_group_create_group(root, "fields", &flds_buf); - SIDRE_group_create_view_empty(flds, "a", &view_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* flds = SIDRE_Group_create_group(root, "fields", &flds_buf); + SIDRE_Group_create_view_empty(flds, "a", &view_buf); - EXPECT_TRUE(SIDRE_group_has_view(flds, "a")); + EXPECT_TRUE(SIDRE_Group_has_view(flds, "a")); // attempt to create duplicate group name - SIDRE_group* badGroup = - SIDRE_group_create_group(root, "fields", &badGroup_buf); + SIDRE_Group* badGroup = + SIDRE_Group_create_group(root, "fields", &badGroup_buf); EXPECT_TRUE( badGroup == NULL ); // check error condition // attempt to create duplicate view name. - EXPECT_TRUE(SIDRE_group_create_view_empty(flds, "a", &view_buf) == NULL); + EXPECT_TRUE(SIDRE_Group_create_view_empty(flds, "a", &view_buf) == NULL); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -440,31 +440,31 @@ TEST(C_sidre_group,view_copy_move) { // Restore this after copy_move is working. ATK-667 #if 0 - SIDRE_datastore ds_buf; - SIDRE_group root_buf, sub_buf; - SIDRE_view view_buf + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, sub_buf; + SIDRE_View view_buf - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* flds = SIDRE_group_create_group(root, "fields"); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* flds = SIDRE_Group_create_group(root, "fields"); - SIDRE_group_create_view_scalar_int(flds, "i0", 1, &view_buf); - SIDRE_group_create_view_scalar_float(flds, "f0", 100.0, &view_buf); - SIDRE_group_create_view_scalar_double(flds, "d0", 3000.0, &view_buf); + SIDRE_Group_create_view_scalar_int(flds, "i0", 1, &view_buf); + SIDRE_Group_create_view_scalar_float(flds, "f0", 100.0, &view_buf); + SIDRE_Group_create_view_scalar_double(flds, "d0", 3000.0, &view_buf); - EXPECT_TRUE(SIDRE_group_has_view(flds, "i0")); - EXPECT_TRUE(SIDRE_group_has_view(flds, "f0")); - EXPECT_TRUE(SIDRE_group_has_view(flds, "d0")); + EXPECT_TRUE(SIDRE_Group_has_view(flds, "i0")); + EXPECT_TRUE(SIDRE_Group_has_view(flds, "f0")); + EXPECT_TRUE(SIDRE_Group_has_view(flds, "d0")); // test moving a view form feds7 to sub // flds->createGroup("sub")->moveView(flds->getView("d0")); - SIDRE_group* sub = SIDRE_group_create_group(flds, "sub", &sub_buf); - SIDRE_group_move_view(sub, - SIDRE_group_get_view_from_name(flds, "d0")); - SIDRE_group_print(flds); - EXPECT_FALSE(SIDRE_group_has_view(flds, "d0")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "sub")); - EXPECT_TRUE(SIDRE_group_has_view(sub, "d0")); + SIDRE_Group* sub = SIDRE_Group_create_group(flds, "sub", &sub_buf); + SIDRE_Group_move_view(sub, + SIDRE_Group_get_view_from_name(flds, "d0")); + SIDRE_Group_print(flds); + EXPECT_FALSE(SIDRE_Group_has_view(flds, "d0")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "sub")); + EXPECT_TRUE(SIDRE_Group_has_view(sub, "d0")); // check the data value // double *d0_data = flds->getGroup("sub") @@ -472,135 +472,135 @@ TEST(C_sidre_group,view_copy_move) // ->getNode().as_double_ptr(); double* d0_data; { - SIDRE_view tmpview_buf; - SIDRE_buffer tmpbuf_buf; - SIDRE_view* tmpview = - SIDRE_group_get_view_from_name(sub, "d0", &tmpview_buf); - SIDRE_buffer* tmpbuf = SIDRE_view_get_buffer(tmpview, &tmpbuf_buf); - d0_data = (double*) SIDRE_buffer_get_void_ptr(tmpbuf); + SIDRE_View tmpview_buf; + SIDRE_Buffer tmpbuf_buf; + SIDRE_View* tmpview = + SIDRE_Group_get_view_from_name(sub, "d0", &tmpview_buf); + SIDRE_Buffer* tmpbuf = SIDRE_View_get_buffer(tmpview, &tmpbuf_buf); + d0_data = (double*) SIDRE_Buffer_get_void_ptr(tmpbuf); } EXPECT_NEAR(d0_data[0],3000.0,1e-12); // test copying a view from flds top sub - SIDRE_group_copy_view(sub, - SIDRE_group_get_view_from_name(flds, "i0", &view_buf)); + SIDRE_Group_copy_view(sub, + SIDRE_Group_get_view_from_name(flds, "i0", &view_buf)); - SIDRE_group_print(flds); + SIDRE_Group_print(flds); - EXPECT_TRUE(SIDRE_group_has_view(flds, "i0")); - EXPECT_TRUE(SIDRE_group_has_view(sub, "i0")); + EXPECT_TRUE(SIDRE_Group_has_view(flds, "i0")); + EXPECT_TRUE(SIDRE_Group_has_view(sub, "i0")); #endif #ifdef XXX // we expect the actual data pointers to be the same - EXPECT_EQ(SIDRE_group_get_view(flds, "i0")->getNode().data_pointer(), - SIDRE_group_get_group_from_name("sub")->get_view( + EXPECT_EQ(SIDRE_Group_get_view(flds, "i0")->getNode().data_pointer(), + SIDRE_Group_get_group_from_name("sub")->get_view( "i0")->getNode().data_pointer()); #endif -// SIDRE_datastore_delete(ds); +// SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_group,groups_move_copy) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, flds_buf, sub_buf; - SIDRE_group ga_buf, gb_buf, gc_buf; - SIDRE_view i0_view_buf, f0_view_buf, d0_view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, flds_buf, sub_buf; + SIDRE_Group ga_buf, gb_buf, gc_buf; + SIDRE_View i0_view_buf, f0_view_buf, d0_view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* flds = SIDRE_group_create_group(root, "fields", &flds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* flds = SIDRE_Group_create_group(root, "fields", &flds_buf); - SIDRE_group* ga = SIDRE_group_create_group(flds, "a", &ga_buf); - SIDRE_group* gb = SIDRE_group_create_group(flds, "b", &gb_buf); - SIDRE_group* gc = SIDRE_group_create_group(flds, "c", &gc_buf); + SIDRE_Group* ga = SIDRE_Group_create_group(flds, "a", &ga_buf); + SIDRE_Group* gb = SIDRE_Group_create_group(flds, "b", &gb_buf); + SIDRE_Group* gc = SIDRE_Group_create_group(flds, "c", &gc_buf); - SIDRE_view* i0_view = - SIDRE_group_create_view_and_allocate_nelems(ga, "i0", + SIDRE_View* i0_view = + SIDRE_Group_create_view_and_allocate_nelems(ga, "i0", SIDRE_INT_ID, 1, &i0_view_buf); - SIDRE_view* f0_view = - SIDRE_group_create_view_and_allocate_nelems(gb, "f0", + SIDRE_View* f0_view = + SIDRE_Group_create_view_and_allocate_nelems(gb, "f0", SIDRE_FLOAT_ID, 1, &f0_view_buf); - SIDRE_view* d0_view = - SIDRE_group_create_view_and_allocate_nelems(gc, "d0", + SIDRE_View* d0_view = + SIDRE_Group_create_view_and_allocate_nelems(gc, "d0", SIDRE_DOUBLE_ID, 1, &d0_view_buf); - SIDRE_view_set_scalar_int(i0_view, 1); - SIDRE_view_set_scalar_float(f0_view, 100.0); - SIDRE_view_set_scalar_double(d0_view, 3000.0); + SIDRE_View_set_scalar_int(i0_view, 1); + SIDRE_View_set_scalar_float(f0_view, 100.0); + SIDRE_View_set_scalar_double(d0_view, 3000.0); // check that all sub groups exist - EXPECT_TRUE(SIDRE_group_has_group(flds, "a")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "b")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "c")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "a")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "b")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "c")); // move "b" to a child of "sub" - SIDRE_group* sub = SIDRE_group_create_group(flds, "sub", &sub_buf); - SIDRE_group_move_group(sub, gb, &gb_buf); + SIDRE_Group* sub = SIDRE_Group_create_group(flds, "sub", &sub_buf); + SIDRE_Group_move_group(sub, gb, &gb_buf); - SIDRE_group_print(flds); + SIDRE_Group_print(flds); - EXPECT_TRUE(SIDRE_group_has_group(flds, "a")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "sub")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "c")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "a")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "sub")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "c")); - SIDRE_group tmpgrp_buf, tmpgrp2_buf; - SIDRE_group* tmpgrp = - SIDRE_group_get_group_from_name(flds, "sub", &tmpgrp_buf); - SIDRE_group* tmpgrp2 = - SIDRE_group_get_group_from_name(tmpgrp, "b", &tmpgrp2_buf); + SIDRE_Group tmpgrp_buf, tmpgrp2_buf; + SIDRE_Group* tmpgrp = + SIDRE_Group_get_group_from_name(flds, "sub", &tmpgrp_buf); + SIDRE_Group* tmpgrp2 = + SIDRE_Group_get_group_from_name(tmpgrp, "b", &tmpgrp2_buf); EXPECT_EQ(tmpgrp2->addr, gb->addr); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_group,create_destroy_view_and_buffer) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, grp_buf; - SIDRE_view view_buf, view1_buf, view2_buf; - SIDRE_buffer buffer1_buf, tmpbuf_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, grp_buf; + SIDRE_View view_buf, view1_buf, view2_buf; + SIDRE_Buffer buffer1_buf, tmpbuf_buf; - SIDRE_datastore* const ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* const grp = SIDRE_group_create_group(root, "grp", &grp_buf); + SIDRE_DataStore* const ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* const grp = SIDRE_Group_create_group(root, "grp", &grp_buf); const char* viewName1 = "viewBuffer1"; const char* viewName2 = "viewBuffer2"; // XXX const - SIDRE_view* view1 = - SIDRE_group_create_view_and_allocate_nelems(grp, viewName1, + SIDRE_View* view1 = + SIDRE_Group_create_view_and_allocate_nelems(grp, viewName1, SIDRE_INT_ID, 1, &view1_buf); - SIDRE_view* view2 = - SIDRE_group_create_view_and_allocate_nelems(grp, viewName2, + SIDRE_View* view2 = + SIDRE_Group_create_view_and_allocate_nelems(grp, viewName2, SIDRE_FLOAT_ID, 1, &view2_buf); - EXPECT_TRUE(SIDRE_group_has_view(grp, viewName1)); - SIDRE_view* view = SIDRE_group_get_view_from_name(grp, viewName1, &view_buf); + EXPECT_TRUE(SIDRE_Group_has_view(grp, viewName1)); + SIDRE_View* view = SIDRE_Group_get_view_from_name(grp, viewName1, &view_buf); EXPECT_EQ(view->addr, view1->addr); - EXPECT_TRUE(SIDRE_group_has_view(grp, viewName2)); - view = SIDRE_group_get_view_from_name(grp, viewName2, &view_buf); + EXPECT_TRUE(SIDRE_Group_has_view(grp, viewName2)); + view = SIDRE_Group_get_view_from_name(grp, viewName2, &view_buf); EXPECT_EQ(view->addr, view2->addr); - SIDRE_buffer* tmpbuf = SIDRE_view_get_buffer(view1, &tmpbuf_buf); - SIDRE_IndexType bufferId1 = SIDRE_buffer_get_index(tmpbuf); + SIDRE_Buffer* tmpbuf = SIDRE_View_get_buffer(view1, &tmpbuf_buf); + SIDRE_IndexType bufferId1 = SIDRE_Buffer_get_index(tmpbuf); - SIDRE_group_destroy_view_and_data_name(grp, viewName1); + SIDRE_Group_destroy_view_and_data_name(grp, viewName1); - EXPECT_FALSE(SIDRE_group_has_view(grp, viewName1)); - EXPECT_EQ(SIDRE_datastore_get_num_buffers(ds), 1u); + EXPECT_FALSE(SIDRE_Group_has_view(grp, viewName1)); + EXPECT_EQ(SIDRE_DataStore_get_num_buffers(ds), 1u); - SIDRE_buffer* buffer1 = - SIDRE_datastore_get_buffer(ds, bufferId1, &buffer1_buf); + SIDRE_Buffer* buffer1 = + SIDRE_DataStore_get_buffer(ds, bufferId1, &buffer1_buf); bool buffValid = true; if( buffer1 == NULL ) { @@ -609,38 +609,38 @@ TEST(C_sidre_group,create_destroy_view_and_buffer) EXPECT_FALSE(buffValid); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_group,create_destroy_alloc_view_and_buffer) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, grp_buf; - SIDRE_view view1_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, grp_buf; + SIDRE_View view1_buf; - SIDRE_datastore* const ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* const grp = SIDRE_group_create_group(root, "grp", &grp_buf); + SIDRE_DataStore* const ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* const grp = SIDRE_Group_create_group(root, "grp", &grp_buf); const char* viewName1 = "viewBuffer1"; // use create + alloc convenience methods // this one is the DataType & method - SIDRE_view* const view1 = - SIDRE_group_create_view_and_allocate_nelems(grp, viewName1, + SIDRE_View* const view1 = + SIDRE_Group_create_view_and_allocate_nelems(grp, viewName1, SIDRE_INT_ID, 10, &view1_buf); - EXPECT_TRUE(SIDRE_group_has_view(grp, viewName1)); - SIDRE_view viewtmp_buf; - SIDRE_view* viewtmp = SIDRE_group_get_view_from_name(grp, viewName1, + EXPECT_TRUE(SIDRE_Group_has_view(grp, viewName1)); + SIDRE_View viewtmp_buf; + SIDRE_View* viewtmp = SIDRE_Group_get_view_from_name(grp, viewName1, &viewtmp_buf); EXPECT_EQ(viewtmp->addr, view1->addr); #ifdef XXX - int* v1_vals = (int*) SIDRE_view_get_void_ptr(view1); - double* v2_vals = (double*) SIDRE_view_get_void_ptr(view1); + int* v1_vals = (int*) SIDRE_View_get_void_ptr(view1); + double* v2_vals = (double*) SIDRE_View_get_void_ptr(view1); for(int i=0 ; i<10 ; i++) { @@ -649,30 +649,30 @@ TEST(C_sidre_group,create_destroy_alloc_view_and_buffer) } #endif - EXPECT_EQ(SIDRE_view_get_num_elements(view1), 10u); - EXPECT_EQ(SIDRE_view_get_total_bytes(view1), 10 * sizeof(int)); + EXPECT_EQ(SIDRE_View_get_num_elements(view1), 10u); + EXPECT_EQ(SIDRE_View_get_total_bytes(view1), 10 * sizeof(int)); - SIDRE_group_destroy_view_and_data_name(grp, viewName1); + SIDRE_Group_destroy_view_and_data_name(grp, viewName1); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } #ifdef XXX //------------------------------------------------------------------------------ TEST(C_sidre_group,create_view_of_buffer_with_datatype) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); // use create + alloc convenience methods // this one is the DataType & method - SIDRE_view* base = - SIDRE_group_create_view_and_allocate_nelems(root, "base", + SIDRE_View* base = + SIDRE_Group_create_view_and_allocate_nelems(root, "base", SIDRE_INT_ID, 10); #ifdef XXX - int* base_vals = (int*) SIDRE_view_get_void_ptr(base); + int* base_vals = (int*) SIDRE_View_get_void_ptr(base); for(int i=0 ; i<10 ; i++) { if(i < 5) @@ -686,13 +686,13 @@ TEST(C_sidre_group,create_view_of_buffer_with_datatype) } #endif - SIDRE_buffer* base_buff = SIDRE_view_get_buffer(base); + SIDRE_Buffer* base_buff = SIDRE_View_get_buffer(base); // create two views into this buffer // view for the first 5 values - SIDRE_group_create_view(root, "sub_a", base_buff, SIDRE_C_INT_T, 5); + SIDRE_Group_create_view(root, "sub_a", base_buff, SIDRE_C_INT_T, 5); // view for the second 5 values - int* sub_a_vals = (int*) SIDRE_view_get_void_ptr(SIDRE_group_get_view_from_name( + int* sub_a_vals = (int*) SIDRE_View_get_void_ptr(SIDRE_Group_get_view_from_name( root, "sub_a")); @@ -701,156 +701,156 @@ TEST(C_sidre_group,create_view_of_buffer_with_datatype) EXPECT_EQ(sub_a_vals[i], 10); } - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } #endif //------------------------------------------------------------------------------ TEST(C_sidre_group,save_restore_simple) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf, grp_buf; - SIDRE_group flds_buf, ga_buf; - SIDRE_view view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, grp_buf; + SIDRE_Group flds_buf, ga_buf; + SIDRE_View view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* flds = SIDRE_group_create_group(root, "fields", &flds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* flds = SIDRE_Group_create_group(root, "fields", &flds_buf); - SIDRE_group* ga = SIDRE_group_create_group(flds, "a", &ga_buf); + SIDRE_Group* ga = SIDRE_Group_create_group(flds, "a", &ga_buf); - SIDRE_group_create_view_scalar_int(ga, "i0", 1, &view_buf); + SIDRE_Group_create_view_scalar_int(ga, "i0", 1, &view_buf); - EXPECT_TRUE(SIDRE_group_has_group(root, "fields")); - EXPECT_TRUE(SIDRE_group_has_group(SIDRE_group_get_group_from_name(root, + EXPECT_TRUE(SIDRE_Group_has_group(root, "fields")); + EXPECT_TRUE(SIDRE_Group_has_group(SIDRE_Group_get_group_from_name(root, "fields", &grp_buf), "a")); - EXPECT_TRUE(SIDRE_group_has_view(SIDRE_group_get_group_from_name( - SIDRE_group_get_group_from_name(root, + EXPECT_TRUE(SIDRE_Group_has_view(SIDRE_Group_get_group_from_name( + SIDRE_Group_get_group_from_name(root, "fields", &grp_buf), "a", &grp_buf), "i0")); // TODO - fix wrapping, change to datastore save call. -// SIDRE_group_save(root, "C_out_sidre_group_save_restore_simple","conduit"); +// SIDRE_Group_save(root, "C_out_sidre_group_save_restore_simple","conduit"); - SIDRE_datastore_print(ds); + SIDRE_DataStore_print(ds); // Doesn't work yet. #if 0 - SIDRE_datastore* ds2 = SIDRE_datastore_new(ds2_buf); + SIDRE_DataStore* ds2 = SIDRE_DataStore_new(ds2_buf); - SIDRE_group_load(SIDRE_datastore_get_root( + SIDRE_Group_load(SIDRE_DataStore_get_root( ds2, &root_buf), "C_out_sidre_group_save_restore_simple", "conduit"); - SIDRE_datastore_print(ds2); + SIDRE_DataStore_print(ds2); - root = SIDRE_datastore_get_root(ds2, &root_buf); - flds = SIDRE_group_get_group_from_name(root, "fields", &flds_buf); + root = SIDRE_DataStore_get_root(ds2, &root_buf); + flds = SIDRE_Group_get_group_from_name(root, "fields", &flds_buf); // check that all sub groups exist - EXPECT_TRUE(SIDRE_group_has_group(flds, "a")); - ga = SIDRE_group_get_group_from_name(flds, "a"); - i0_view = SIDRE_group_get_view_from_name(ga, "i0"); - EXPECT_EQ(SIDRE_view_get_data_int(i0_view), 1); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "a")); + ga = SIDRE_Group_get_group_from_name(flds, "a"); + i0_view = SIDRE_Group_get_view_from_name(ga, "i0"); + EXPECT_EQ(SIDRE_View_get_data_int(i0_view), 1); - SIDRE_datastore_print(ds2); + SIDRE_DataStore_print(ds2); - SIDRE_datastore_delete(ds); - SIDRE_datastore_delete(ds2); + SIDRE_DataStore_delete(ds); + SIDRE_DataStore_delete(ds2); #endif } //------------------------------------------------------------------------------ TEST(C_sidre_group,rename_group) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_group child1_buf, child2_buf, child3_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_Group child1_buf, child2_buf, child3_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* child1 = SIDRE_group_create_group(root, "g_a", &child1_buf); - SIDRE_group* child2 = SIDRE_group_create_group(root, "g_b", &child2_buf); - SIDRE_group* child3 = SIDRE_group_create_group(root, "g_c", &child3_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* child1 = SIDRE_Group_create_group(root, "g_a", &child1_buf); + SIDRE_Group* child2 = SIDRE_Group_create_group(root, "g_b", &child2_buf); + SIDRE_Group* child3 = SIDRE_Group_create_group(root, "g_c", &child3_buf); - bool success = SIDRE_group_rename(child1, "g_r"); + bool success = SIDRE_Group_rename(child1, "g_r"); EXPECT_TRUE( success ); - EXPECT_TRUE( strcmp(SIDRE_group_get_name(child1), "g_r") == 0 ); - EXPECT_TRUE( SIDRE_group_has_group(root, "g_r") ); - EXPECT_FALSE( SIDRE_group_has_group(root, "g_a") ); + EXPECT_TRUE( strcmp(SIDRE_Group_get_name(child1), "g_r") == 0 ); + EXPECT_TRUE( SIDRE_Group_has_group(root, "g_r") ); + EXPECT_FALSE( SIDRE_Group_has_group(root, "g_a") ); - success = SIDRE_group_rename(child2, "fields/g_s"); + success = SIDRE_Group_rename(child2, "fields/g_s"); EXPECT_FALSE( success ); - EXPECT_TRUE( strcmp(SIDRE_group_get_name(child2), "g_b") == 0 ); + EXPECT_TRUE( strcmp(SIDRE_Group_get_name(child2), "g_b") == 0 ); - success = SIDRE_group_rename(child3, "g_b"); + success = SIDRE_Group_rename(child3, "g_b"); EXPECT_FALSE( success ); - EXPECT_TRUE( strcmp(SIDRE_group_get_name(child3), "g_c") == 0 ); + EXPECT_TRUE( strcmp(SIDRE_Group_get_name(child3), "g_c") == 0 ); } //------------------------------------------------------------------------------ TEST(C_sidre_group,save_restore_complex) { - SIDRE_datastore ds_buf, ds2_buf; - SIDRE_group root_buf, flds_buf; - SIDRE_group ga_buf, gb_buf, gc_buf; - SIDRE_view view_buf; + SIDRE_DataStore ds_buf, ds2_buf; + SIDRE_Group root_buf, flds_buf; + SIDRE_Group ga_buf, gb_buf, gc_buf; + SIDRE_View view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_group* flds = SIDRE_group_create_group(root, "fields", &flds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Group* flds = SIDRE_Group_create_group(root, "fields", &flds_buf); - SIDRE_group* ga = SIDRE_group_create_group(flds, "a", &ga_buf); - SIDRE_group* gb = SIDRE_group_create_group(flds, "b", &gb_buf); - SIDRE_group* gc = SIDRE_group_create_group(flds, "c", &gc_buf); + SIDRE_Group* ga = SIDRE_Group_create_group(flds, "a", &ga_buf); + SIDRE_Group* gb = SIDRE_Group_create_group(flds, "b", &gb_buf); + SIDRE_Group* gc = SIDRE_Group_create_group(flds, "c", &gc_buf); - SIDRE_group_create_view_scalar_int(ga, "i0", 1, &view_buf); - SIDRE_group_create_view_scalar_float(gb, "f0", 100.0, &view_buf); - SIDRE_group_create_view_scalar_double(gc, "d0", 3000.0, &view_buf); + SIDRE_Group_create_view_scalar_int(ga, "i0", 1, &view_buf); + SIDRE_Group_create_view_scalar_float(gb, "f0", 100.0, &view_buf); + SIDRE_Group_create_view_scalar_double(gc, "d0", 3000.0, &view_buf); // check that all sub groups exist - EXPECT_TRUE(SIDRE_group_has_group(flds, "a")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "b")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "c")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "a")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "b")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "c")); // TODO - Fix wrapping, change save call to use datastore class -// SIDRE_group_save(root, "C_out_sidre_group_save_restore_complex", +// SIDRE_Group_save(root, "C_out_sidre_group_save_restore_complex", // "conduit"); - SIDRE_datastore_print(ds); + SIDRE_DataStore_print(ds); - SIDRE_datastore* ds2 = SIDRE_datastore_new(&ds2_buf); - root = SIDRE_datastore_get_root(ds2, &root_buf); + SIDRE_DataStore* ds2 = SIDRE_DataStore_new(&ds2_buf); + root = SIDRE_DataStore_get_root(ds2, &root_buf); #if 0 - SIDRE_group_load(root, "C_out_sidre_group_save_restore_complex", + SIDRE_Group_load(root, "C_out_sidre_group_save_restore_complex", "conduit"); - flds = SIDRE_group_get_group_from_name(root, "fields"); + flds = SIDRE_Group_get_group_from_name(root, "fields"); // check that all sub groups exist - EXPECT_TRUE(SIDRE_group_has_group(flds, "a")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "b")); - EXPECT_TRUE(SIDRE_group_has_group(flds, "c")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "a")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "b")); + EXPECT_TRUE(SIDRE_Group_has_group(flds, "c")); - ga = SIDRE_group_get_group_from_name(flds, "a"); - gb = SIDRE_group_get_group_from_name(flds, "b"); - gc = SIDRE_group_get_group_from_name(flds, "c"); + ga = SIDRE_Group_get_group_from_name(flds, "a"); + gb = SIDRE_Group_get_group_from_name(flds, "b"); + gc = SIDRE_Group_get_group_from_name(flds, "c"); - i0_view = SIDRE_group_get_view_from_name(ga, "i0"); - f0_view = SIDRE_group_get_view_from_name(gb, "f0"); - d0_view = SIDRE_group_get_view_from_name(gc, "d0"); + i0_view = SIDRE_Group_get_view_from_name(ga, "i0"); + f0_view = SIDRE_Group_get_view_from_name(gb, "f0"); + d0_view = SIDRE_Group_get_view_from_name(gc, "d0"); - EXPECT_EQ(SIDRE_view_get_data_int(i0_view), 1); - EXPECT_NEAR(SIDRE_view_get_data_float(f0_view), 100.0, 1e-12); - EXPECT_NEAR(SIDRE_view_get_data_double(d0_view), 3000.0, 1e-12); + EXPECT_EQ(SIDRE_View_get_data_int(i0_view), 1); + EXPECT_NEAR(SIDRE_View_get_data_float(f0_view), 100.0, 1e-12); + EXPECT_NEAR(SIDRE_View_get_data_double(d0_view), 3000.0, 1e-12); - SIDRE_datastore_print(ds2); + SIDRE_DataStore_print(ds2); - SIDRE_datastore_delete(ds); - SIDRE_datastore_delete(ds2); + SIDRE_DataStore_delete(ds); + SIDRE_DataStore_delete(ds2); #endif } diff --git a/src/axom/sidre/tests/sidre_opaque_C.cpp b/src/axom/sidre/tests/sidre_opaque_C.cpp index dfa0e07596..23bad76025 100644 --- a/src/axom/sidre/tests/sidre_opaque_C.cpp +++ b/src/axom/sidre/tests/sidre_opaque_C.cpp @@ -93,31 +93,31 @@ TEST(C_sidre_opaque,basic_inout) { const int ihi_val = 9; - SIDRE_datastore ds_buf; - SIDRE_group root_buf, problem_gp_buf; - SIDRE_view ext_view_buf, ext2_view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, problem_gp_buf; + SIDRE_View ext_view_buf, ext2_view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* problem_gp = SIDRE_group_create_group + SIDRE_Group* problem_gp = SIDRE_Group_create_group (root, "problem", &problem_gp_buf); AA_extent* ext = AA_extent_new(0, ihi_val); - SIDRE_view* ext_view = SIDRE_group_create_view_external + SIDRE_View* ext_view = SIDRE_Group_create_view_external (problem_gp, "ext", ext, &ext_view_buf); - bool test_external = SIDRE_view_is_external(ext_view); + bool test_external = SIDRE_View_is_external(ext_view); EXPECT_EQ(test_external, true); - bool test_applied = SIDRE_view_is_applied(ext_view); + bool test_applied = SIDRE_View_is_applied(ext_view); EXPECT_EQ(test_applied, false); - bool test_opaque = SIDRE_view_is_opaque(ext_view); + bool test_opaque = SIDRE_View_is_opaque(ext_view); EXPECT_EQ(test_opaque, true); - AA_extent* test_extent = (AA_extent*) SIDRE_view_get_void_ptr(ext_view); + AA_extent* test_extent = (AA_extent*) SIDRE_View_get_void_ptr(ext_view); int test_ihi = test_extent->ihi; EXPECT_EQ(test_ihi, ihi_val); @@ -127,15 +127,15 @@ TEST(C_sidre_opaque,basic_inout) AA_extent* ext2 = AA_extent_new(0, 2 * ihi_val); - SIDRE_view* ext2_view = SIDRE_group_create_view_empty + SIDRE_View* ext2_view = SIDRE_Group_create_view_empty (problem_gp, "ext2", &ext2_view_buf); - SIDRE_view_set_external_data_ptr_only(ext2_view, ext2); + SIDRE_View_set_external_data_ptr_only(ext2_view, ext2); - bool test_opaque2 = SIDRE_view_is_opaque(ext2_view); + bool test_opaque2 = SIDRE_View_is_opaque(ext2_view); EXPECT_EQ(test_opaque2, true); AA_extent* test_extent2 = - (AA_extent*) SIDRE_view_get_void_ptr(ext2_view); + (AA_extent*) SIDRE_View_get_void_ptr(ext2_view); int test_ihi2 = test_extent2->ihi; EXPECT_EQ(test_ihi2, 2 * ihi_val); @@ -143,7 +143,7 @@ TEST(C_sidre_opaque,basic_inout) // clean up... AA_extent_delete(ext); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -163,28 +163,28 @@ TEST(C_sidre_opaque,meshvar) const int zone_var_depth = 1; const int node_var_depth = 2; - SIDRE_datastore ds_buf; - SIDRE_group root_buf, problem_gp_buf, meshvar_gp_buf; - SIDRE_view node_mv_view_buf, zone_mv_view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf, problem_gp_buf, meshvar_gp_buf; + SIDRE_View node_mv_view_buf, zone_mv_view_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_group* problem_gp = SIDRE_group_create_group(root, "problem", + SIDRE_Group* problem_gp = SIDRE_Group_create_group(root, "problem", &problem_gp_buf); // Add two different mesh vars to mesh var group - SIDRE_group* meshvar_gp = - SIDRE_group_create_group(problem_gp, "mesh_var", &meshvar_gp_buf); + SIDRE_Group* meshvar_gp = + SIDRE_Group_create_group(problem_gp, "mesh_var", &meshvar_gp_buf); AA_meshvar* zone_mv = AA_meshvar_new(_Zone_, _Int_, zone_var_depth); - SIDRE_view* zone_mv_view = - SIDRE_group_create_view_external(meshvar_gp, "zone_mv", zone_mv, + SIDRE_View* zone_mv_view = + SIDRE_Group_create_view_external(meshvar_gp, "zone_mv", zone_mv, &zone_mv_view_buf); AA_meshvar* node_mv = AA_meshvar_new(_Node_, _Double_, node_var_depth); - SIDRE_view* node_mv_view = - SIDRE_group_create_view_external(meshvar_gp, "node_mv", node_mv, + SIDRE_View* node_mv_view = + SIDRE_Group_create_view_external(meshvar_gp, "node_mv", node_mv, &node_mv_view_buf); // @@ -193,26 +193,26 @@ TEST(C_sidre_opaque,meshvar) // for (int idom = 0 ; idom < 2 ; ++idom) { - SIDRE_group dom_gp_buf; - SIDRE_view view_buf; + SIDRE_Group dom_gp_buf; + SIDRE_View view_buf; - SIDRE_group* dom_gp = - SIDRE_group_create_group(problem_gp, dom_name[idom].c_str(), &dom_gp_buf); + SIDRE_Group* dom_gp = + SIDRE_Group_create_group(problem_gp, dom_name[idom].c_str(), &dom_gp_buf); AA_extent* dom_ext = AA_extent_new(ilo_val[idom], ihi_val[idom]); - SIDRE_group_create_view_external(dom_gp, "ext", dom_ext, &view_buf); + SIDRE_Group_create_view_external(dom_gp, "ext", dom_ext, &view_buf); AA_meshvar* zonemv = - (AA_meshvar*) SIDRE_view_get_void_ptr(zone_mv_view); - (void) SIDRE_group_create_view_and_allocate_nelems(dom_gp, "zone_data", + (AA_meshvar*) SIDRE_View_get_void_ptr(zone_mv_view); + (void) SIDRE_Group_create_view_and_allocate_nelems(dom_gp, "zone_data", SIDRE_INT_ID, AA_get_num_vals( zonemv, dom_ext), &view_buf); AA_meshvar* nodemv = - (AA_meshvar*) SIDRE_view_get_void_ptr(node_mv_view); - (void) SIDRE_group_create_view_and_allocate_nelems(dom_gp, "node_data", + (AA_meshvar*) SIDRE_View_get_void_ptr(node_mv_view); + (void) SIDRE_Group_create_view_and_allocate_nelems(dom_gp, "node_data", SIDRE_DOUBLE_ID, AA_get_num_vals( nodemv, dom_ext), &view_buf); @@ -222,7 +222,7 @@ TEST(C_sidre_opaque,meshvar) // // Print datastore contents to see what's going on. // -// SIDRE_datastore_print(ds); +// SIDRE_DataStore_print(ds); // @@ -230,33 +230,33 @@ TEST(C_sidre_opaque,meshvar) // for (int idom = 0 ; idom < 2 ; ++idom) { - SIDRE_group dom_gp_buf; - SIDRE_view ext_view_buf, dom_zone_data_view_buf, dom_node_data_view_buf; + SIDRE_Group dom_gp_buf; + SIDRE_View ext_view_buf, dom_zone_data_view_buf, dom_node_data_view_buf; - SIDRE_group* dom_gp = - SIDRE_group_get_group_from_name(problem_gp, + SIDRE_Group* dom_gp = + SIDRE_Group_get_group_from_name(problem_gp, dom_name[idom].c_str(), &dom_gp_buf); - SIDRE_view* ext_view = - SIDRE_group_get_view_from_name(dom_gp, "ext", &ext_view_buf); - AA_extent* dom_ext = (AA_extent*) SIDRE_view_get_void_ptr(ext_view); + SIDRE_View* ext_view = + SIDRE_Group_get_view_from_name(dom_gp, "ext", &ext_view_buf); + AA_extent* dom_ext = (AA_extent*) SIDRE_View_get_void_ptr(ext_view); - AA_meshvar* zonemv = (AA_meshvar*) SIDRE_view_get_void_ptr( + AA_meshvar* zonemv = (AA_meshvar*) SIDRE_View_get_void_ptr( zone_mv_view); - AA_meshvar* nodemv = (AA_meshvar*) SIDRE_view_get_void_ptr( + AA_meshvar* nodemv = (AA_meshvar*) SIDRE_View_get_void_ptr( node_mv_view); int num_zone_vals = AA_get_num_vals(zonemv, dom_ext); - SIDRE_view* dom_zone_data_view = SIDRE_group_get_view_from_name( + SIDRE_View* dom_zone_data_view = SIDRE_Group_get_view_from_name( dom_gp, "zone_data", &dom_zone_data_view_buf); int test_num_zone_vals = - SIDRE_view_get_num_elements(dom_zone_data_view); + SIDRE_View_get_num_elements(dom_zone_data_view); EXPECT_EQ(num_zone_vals, test_num_zone_vals); int num_node_vals = AA_get_num_vals(nodemv, dom_ext); - SIDRE_view* dom_node_data_view = SIDRE_group_get_view_from_name( + SIDRE_View* dom_node_data_view = SIDRE_Group_get_view_from_name( dom_gp, "node_data", &dom_node_data_view_buf); int test_num_node_vals = - SIDRE_view_get_num_elements(dom_node_data_view); + SIDRE_View_get_num_elements(dom_node_data_view); EXPECT_EQ(num_node_vals, test_num_node_vals); } @@ -266,16 +266,16 @@ TEST(C_sidre_opaque,meshvar) AA_meshvar_delete(node_mv); for (int idom = 0 ; idom < 2 ; ++idom) { - SIDRE_group dom_gp_buf; - SIDRE_view ext_view_buf; + SIDRE_Group dom_gp_buf; + SIDRE_View ext_view_buf; - SIDRE_group* dom_gp = - SIDRE_group_get_group_from_name(problem_gp, + SIDRE_Group* dom_gp = + SIDRE_Group_get_group_from_name(problem_gp, dom_name[idom].c_str(), &dom_gp_buf); - SIDRE_view* ext_view = - SIDRE_group_get_view_from_name(dom_gp, "ext", &ext_view_buf); - AA_extent* dom_ext = (AA_extent*) SIDRE_view_get_void_ptr(ext_view); + SIDRE_View* ext_view = + SIDRE_Group_get_view_from_name(dom_gp, "ext", &ext_view_buf); + AA_extent* dom_ext = (AA_extent*) SIDRE_View_get_void_ptr(ext_view); AA_extent_delete(dom_ext); } - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } diff --git a/src/axom/sidre/tests/sidre_smoke_C.cpp b/src/axom/sidre/tests/sidre_smoke_C.cpp index 931763500c..e0e833c461 100644 --- a/src/axom/sidre/tests/sidre_smoke_C.cpp +++ b/src/axom/sidre/tests/sidre_smoke_C.cpp @@ -11,10 +11,10 @@ TEST(C_sidre_smoke,create_datastore) { - SIDRE_datastore ds_buf; + SIDRE_DataStore ds_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_datastore_delete(ds); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_DataStore_delete(ds); EXPECT_TRUE( true ); } @@ -22,10 +22,10 @@ TEST(C_sidre_smoke,create_datastore) TEST(sidre_smoke,valid_invalid) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); SIDRE_IndexType idx = 3; EXPECT_TRUE(idx != SIDRE_InvalidIndex); @@ -33,14 +33,14 @@ TEST(sidre_smoke,valid_invalid) const char* name = "foo"; EXPECT_TRUE(SIDRE_name_is_valid(name)); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - const char* gp_name = SIDRE_group_get_group_name(root, idx); + const char* gp_name = SIDRE_Group_get_group_name(root, idx); EXPECT_TRUE(gp_name == NULL); EXPECT_TRUE(gp_name == SIDRE_InvalidName); EXPECT_FALSE(SIDRE_name_is_valid(gp_name)); - EXPECT_TRUE(SIDRE_group_get_group_index(root, + EXPECT_TRUE(SIDRE_Group_get_group_index(root, name) == SIDRE_InvalidIndex); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_delete(ds); } diff --git a/src/axom/sidre/tests/sidre_view_C.cpp b/src/axom/sidre/tests/sidre_view_C.cpp index 3ecd7526d0..58ddc77c64 100644 --- a/src/axom/sidre/tests/sidre_view_C.cpp +++ b/src/axom/sidre/tests/sidre_view_C.cpp @@ -11,57 +11,57 @@ TEST(C_sidre_view,create_views) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view dv_0_buf, dv_1_buf; - SIDRE_buffer db_0_buf, db_1_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View dv_0_buf, dv_1_buf; + SIDRE_Buffer db_0_buf, db_1_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_view* dv_0 = - SIDRE_group_create_view_and_allocate_nelems(root, "field0", + SIDRE_View* dv_0 = + SIDRE_Group_create_view_and_allocate_nelems(root, "field0", SIDRE_INT_ID, 1, &dv_0_buf); - SIDRE_view* dv_1 = - SIDRE_group_create_view_and_allocate_nelems(root, "field1", + SIDRE_View* dv_1 = + SIDRE_Group_create_view_and_allocate_nelems(root, "field1", SIDRE_INT_ID, 1, &dv_1_buf); - SIDRE_buffer* db_0 = SIDRE_view_get_buffer(dv_0, &db_0_buf); - SIDRE_buffer* db_1 = SIDRE_view_get_buffer(dv_1, &db_1_buf); + SIDRE_Buffer* db_0 = SIDRE_View_get_buffer(dv_0, &db_0_buf); + SIDRE_Buffer* db_1 = SIDRE_View_get_buffer(dv_1, &db_1_buf); - EXPECT_EQ(SIDRE_buffer_get_index(db_0), 0); - EXPECT_EQ(SIDRE_buffer_get_index(db_1), 1); - SIDRE_datastore_delete(ds); + EXPECT_EQ(SIDRE_Buffer_get_index(db_0), 0); + EXPECT_EQ(SIDRE_Buffer_get_index(db_1), 1); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_view,int_buffer_from_view) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view dv_view; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View dv_view; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_view* dv = - SIDRE_group_create_view_and_allocate_nelems(root, "u0", SIDRE_INT_ID, + SIDRE_View* dv = + SIDRE_Group_create_view_and_allocate_nelems(root, "u0", SIDRE_INT_ID, 10, &dv_view); - EXPECT_EQ(SIDRE_view_get_type_id(dv), SIDRE_INT_ID); - int* data_ptr = (int*) SIDRE_view_get_void_ptr(dv); + EXPECT_EQ(SIDRE_View_get_type_id(dv), SIDRE_INT_ID); + int* data_ptr = (int*) SIDRE_View_get_void_ptr(dv); for(int i=0 ; i<10 ; i++) { data_ptr[i] = i*i; } - SIDRE_view_print(dv); + SIDRE_View_print(dv); - EXPECT_EQ(SIDRE_view_get_bytes_per_element(dv), sizeof(int) ); - EXPECT_EQ(SIDRE_view_get_total_bytes(dv), sizeof(int) * 10); - SIDRE_datastore_delete(ds); + EXPECT_EQ(SIDRE_View_get_bytes_per_element(dv), sizeof(int) ); + EXPECT_EQ(SIDRE_View_get_total_bytes(dv), sizeof(int) * 10); + SIDRE_DataStore_delete(ds); } @@ -69,28 +69,28 @@ TEST(C_sidre_view,int_buffer_from_view) TEST(C_sidre_view,int_buffer_from_view_conduit_value) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view dv_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View dv_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); - SIDRE_view* dv = - SIDRE_group_create_view_and_allocate_nelems(root, "u0", SIDRE_INT_ID, + SIDRE_View* dv = + SIDRE_Group_create_view_and_allocate_nelems(root, "u0", SIDRE_INT_ID, 10, &dv_buf); - int* data_ptr = (int*) SIDRE_view_get_void_ptr(dv); + int* data_ptr = (int*) SIDRE_View_get_void_ptr(dv); for(int i=0 ; i<10 ; i++) { data_ptr[i] = i*i; } - SIDRE_view_print(dv); + SIDRE_View_print(dv); - EXPECT_EQ(SIDRE_view_get_bytes_per_element(dv), sizeof(int) ); - EXPECT_EQ(SIDRE_view_get_total_bytes(dv), sizeof(int) * 10); - SIDRE_datastore_delete(ds); + EXPECT_EQ(SIDRE_View_get_bytes_per_element(dv), sizeof(int) ); + EXPECT_EQ(SIDRE_View_get_total_bytes(dv), sizeof(int) * 10); + SIDRE_DataStore_delete(ds); } @@ -104,65 +104,65 @@ TEST(C_sidre_view,int_array_strided_views) const unsigned int stride = 2; const unsigned int elt_bytes = sizeof(int); - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_buffer dbuff_buf; - SIDRE_view dv_e_buf, dv_o_buf; - SIDRE_view dv_e1_buf, dv_o1_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_Buffer dbuff_buf; + SIDRE_View dv_e_buf, dv_o_buf; + SIDRE_View dv_e1_buf, dv_o1_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); - SIDRE_buffer* dbuff = SIDRE_datastore_create_buffer_from_type(ds, + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); + SIDRE_Buffer* dbuff = SIDRE_DataStore_create_buffer_from_type(ds, SIDRE_INT_ID, num_elts, &dbuff_buf); - SIDRE_buffer_allocate_existing(dbuff); - int* data_ptr = (int*) SIDRE_buffer_get_void_ptr(dbuff); + SIDRE_Buffer_allocate_existing(dbuff); + int* data_ptr = (int*) SIDRE_Buffer_get_void_ptr(dbuff); for(int i=0 ; i< (int)num_elts ; i++) { data_ptr[i] = i; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); - EXPECT_EQ(num_elts * elt_bytes, SIDRE_buffer_get_total_bytes(dbuff)); + EXPECT_EQ(num_elts * elt_bytes, SIDRE_Buffer_get_total_bytes(dbuff)); - SIDRE_view* dv_e = SIDRE_group_create_view_into_buffer(root, "even", + SIDRE_View* dv_e = SIDRE_Group_create_view_into_buffer(root, "even", dbuff, &dv_e_buf); - SIDRE_view* dv_o = SIDRE_group_create_view_into_buffer(root, "odd", + SIDRE_View* dv_o = SIDRE_Group_create_view_into_buffer(root, "odd", dbuff, &dv_o_buf); EXPECT_TRUE(dv_e != NULL); EXPECT_TRUE(dv_o != NULL); - EXPECT_EQ(SIDRE_buffer_get_num_views(dbuff), 2u); + EXPECT_EQ(SIDRE_Buffer_get_num_views(dbuff), 2u); - SIDRE_view_apply_nelems_offset_stride(dv_e, num_view_elts, offset_even, + SIDRE_View_apply_nelems_offset_stride(dv_e, num_view_elts, offset_even, stride); - SIDRE_view_apply_nelems_offset_stride(dv_o, num_view_elts, offset_odd, + SIDRE_View_apply_nelems_offset_stride(dv_o, num_view_elts, offset_odd, stride); // Test that the void_ptr matches the buffer's pointer - EXPECT_EQ(data_ptr, SIDRE_view_get_void_ptr(dv_e)); - EXPECT_EQ(data_ptr, SIDRE_view_get_void_ptr(dv_o)); + EXPECT_EQ(data_ptr, SIDRE_View_get_void_ptr(dv_e)); + EXPECT_EQ(data_ptr, SIDRE_View_get_void_ptr(dv_o)); // Test offsets and strides for dv_e and dv_o - EXPECT_EQ(num_view_elts, SIDRE_view_get_num_elements(dv_e)); - EXPECT_EQ(offset_even, SIDRE_view_get_offset(dv_e)); - EXPECT_EQ(stride, SIDRE_view_get_stride(dv_e)); + EXPECT_EQ(num_view_elts, SIDRE_View_get_num_elements(dv_e)); + EXPECT_EQ(offset_even, SIDRE_View_get_offset(dv_e)); + EXPECT_EQ(stride, SIDRE_View_get_stride(dv_e)); - EXPECT_EQ(num_view_elts, SIDRE_view_get_num_elements(dv_o)); - EXPECT_EQ(offset_odd, SIDRE_view_get_offset(dv_o)); - EXPECT_EQ(stride, SIDRE_view_get_stride(dv_o)); + EXPECT_EQ(num_view_elts, SIDRE_View_get_num_elements(dv_o)); + EXPECT_EQ(offset_odd, SIDRE_View_get_offset(dv_o)); + EXPECT_EQ(stride, SIDRE_View_get_stride(dv_o)); - SIDRE_view_print(dv_e); - SIDRE_view_print(dv_o); + SIDRE_View_print(dv_e); + SIDRE_View_print(dv_o); // Note: Must manually take care of offsets (and strides) since templated // function View::getData() is not exposed to C API for arrays - int* dv_e_ptr = (int*)SIDRE_view_get_void_ptr(dv_e) + offset_even; - int* dv_o_ptr = (int*)SIDRE_view_get_void_ptr(dv_o) + offset_odd; + int* dv_e_ptr = (int*)SIDRE_View_get_void_ptr(dv_e) + offset_even; + int* dv_o_ptr = (int*)SIDRE_View_get_void_ptr(dv_o) + offset_odd; for(int i=0 ; i< (int)num_elts ; i+=2) { @@ -171,200 +171,200 @@ TEST(C_sidre_view,int_array_strided_views) } // Run similar test to above with different view apply method - SIDRE_view* dv_e1 = - SIDRE_group_create_view_into_buffer(root, "even1", dbuff, &dv_e1_buf); - SIDRE_view* dv_o1 = - SIDRE_group_create_view_into_buffer(root, "odd1", dbuff, &dv_o1_buf); + SIDRE_View* dv_e1 = + SIDRE_Group_create_view_into_buffer(root, "even1", dbuff, &dv_e1_buf); + SIDRE_View* dv_o1 = + SIDRE_Group_create_view_into_buffer(root, "odd1", dbuff, &dv_o1_buf); EXPECT_TRUE(dv_e1 != NULL); EXPECT_TRUE(dv_o1 != NULL); - EXPECT_EQ(SIDRE_buffer_get_num_views(dbuff), 4u); + EXPECT_EQ(SIDRE_Buffer_get_num_views(dbuff), 4u); - SIDRE_view_apply_type_nelems_offset_stride(dv_e1, SIDRE_INT_ID, + SIDRE_View_apply_type_nelems_offset_stride(dv_e1, SIDRE_INT_ID, num_view_elts, offset_even, stride); - SIDRE_view_apply_type_nelems_offset_stride(dv_o1, SIDRE_INT_ID, + SIDRE_View_apply_type_nelems_offset_stride(dv_o1, SIDRE_INT_ID, num_view_elts, offset_odd, stride); // Test that the void_ptr matches the buffer's pointer - EXPECT_EQ(data_ptr, SIDRE_view_get_void_ptr(dv_e1)); - EXPECT_EQ(data_ptr, SIDRE_view_get_void_ptr(dv_o1)); + EXPECT_EQ(data_ptr, SIDRE_View_get_void_ptr(dv_e1)); + EXPECT_EQ(data_ptr, SIDRE_View_get_void_ptr(dv_o1)); // Test offsets and strides for dv_e and dv_o - EXPECT_EQ(num_view_elts, SIDRE_view_get_num_elements(dv_e1)); - EXPECT_EQ(offset_even, SIDRE_view_get_offset(dv_e1)); - EXPECT_EQ(stride, SIDRE_view_get_stride(dv_e1)); + EXPECT_EQ(num_view_elts, SIDRE_View_get_num_elements(dv_e1)); + EXPECT_EQ(offset_even, SIDRE_View_get_offset(dv_e1)); + EXPECT_EQ(stride, SIDRE_View_get_stride(dv_e1)); - EXPECT_EQ(num_view_elts, SIDRE_view_get_num_elements(dv_o1)); - EXPECT_EQ(offset_odd, SIDRE_view_get_offset(dv_o1)); - EXPECT_EQ(stride, SIDRE_view_get_stride(dv_o1)); + EXPECT_EQ(num_view_elts, SIDRE_View_get_num_elements(dv_o1)); + EXPECT_EQ(offset_odd, SIDRE_View_get_offset(dv_o1)); + EXPECT_EQ(stride, SIDRE_View_get_stride(dv_o1)); - SIDRE_view_print(dv_e1); - SIDRE_view_print(dv_o1); + SIDRE_View_print(dv_e1); + SIDRE_View_print(dv_o1); // Note: Must manually take care of offsets (and strides). - int* dv_e1_ptr = (int*)SIDRE_view_get_void_ptr(dv_e1) + offset_even; - int* dv_o1_ptr = (int*)SIDRE_view_get_void_ptr(dv_o1) + offset_odd; + int* dv_e1_ptr = (int*)SIDRE_View_get_void_ptr(dv_e1) + offset_even; + int* dv_o1_ptr = (int*)SIDRE_View_get_void_ptr(dv_o1) + offset_odd; for(int i=0 ; i< (int)num_elts ; i+=2) { EXPECT_EQ(dv_e1_ptr[i], i); EXPECT_EQ(dv_o1_ptr[i], i+1); } - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(C_sidre_view,int_array_depth_view) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_buffer dbuff_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_Buffer dbuff_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); const size_t depth_nelems = 10; - SIDRE_buffer* dbuff = SIDRE_datastore_create_buffer_from_type(ds, + SIDRE_Buffer* dbuff = SIDRE_DataStore_create_buffer_from_type(ds, SIDRE_INT_ID, 4 * depth_nelems, &dbuff_buf); - SIDRE_buffer_allocate_existing(dbuff); - int* data_ptr = (int*) SIDRE_buffer_get_void_ptr(dbuff); + SIDRE_Buffer_allocate_existing(dbuff); + int* data_ptr = (int*) SIDRE_Buffer_get_void_ptr(dbuff); for(size_t i=0 ; i < 4 * depth_nelems ; i++) { data_ptr[i] = i / depth_nelems; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); - EXPECT_EQ(SIDRE_buffer_get_num_elements(dbuff), 4 * depth_nelems); + EXPECT_EQ(SIDRE_Buffer_get_num_elements(dbuff), 4 * depth_nelems); // create 4 "depth" views and apply offsets into buffer - SIDRE_view views_buf[4]; - SIDRE_view* views[4]; + SIDRE_View views_buf[4]; + SIDRE_View* views[4]; const char* view_names[4] = { "depth_0", "depth_1", "depth_2", "depth_3" }; unsigned int view_offsets[4]; for (int id = 0 ; id < 4 ; ++id) { - views[id] = SIDRE_group_create_view_into_buffer(root, view_names[id], + views[id] = SIDRE_Group_create_view_into_buffer(root, view_names[id], dbuff, views_buf+id); view_offsets[id] = id*depth_nelems; - SIDRE_view_apply_nelems_offset(views[id], depth_nelems, + SIDRE_View_apply_nelems_offset(views[id], depth_nelems, view_offsets[id]); } - EXPECT_EQ(SIDRE_buffer_get_num_views(dbuff), 4u); + EXPECT_EQ(SIDRE_Buffer_get_num_views(dbuff), 4u); // print depth views... for (int id = 0 ; id < 4 ; ++id) { - SIDRE_view_print(views[id]); + SIDRE_View_print(views[id]); } // check values in depth views... for (int id = 0 ; id < 4 ; ++id) { - EXPECT_EQ(data_ptr, SIDRE_view_get_void_ptr(views[id])); + EXPECT_EQ(data_ptr, SIDRE_View_get_void_ptr(views[id])); // Note: offsets and striding must be handled manually when // accessing the data with the get_void_ptr() function. // This is the only array access function exposed by the Sidre C API - unsigned int offset = SIDRE_view_get_offset(views[id]); + unsigned int offset = SIDRE_View_get_offset(views[id]); EXPECT_EQ(view_offsets[id], offset); - int* dv_ptr = (int*)SIDRE_view_get_void_ptr(views[id]) + offset; + int* dv_ptr = (int*)SIDRE_View_get_void_ptr(views[id]) + offset; for (size_t i = 0 ; i < depth_nelems ; ++i) { EXPECT_EQ(dv_ptr[i], id); } } - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ TEST(sidre_view,int_array_view_attach_buffer) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view field0_buf, field1_buf; - SIDRE_buffer dbuff_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View field0_buf, field1_buf; + SIDRE_Buffer dbuff_buf; - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); const size_t field_nelems = 10; // create 2 "field" views with type and # elems size_t elem_count = 0; - SIDRE_view* field0 = - SIDRE_group_create_view_from_type(root,"field0", + SIDRE_View* field0 = + SIDRE_Group_create_view_from_type(root,"field0", SIDRE_INT_ID, field_nelems, &field0_buf); - elem_count += SIDRE_view_get_num_elements(field0); - SIDRE_view* field1 = - SIDRE_group_create_view_from_type(root, "field1", + elem_count += SIDRE_View_get_num_elements(field0); + SIDRE_View* field1 = + SIDRE_Group_create_view_from_type(root, "field1", SIDRE_INT_ID, field_nelems, &field1_buf); - elem_count += SIDRE_view_get_num_elements(field1); + elem_count += SIDRE_View_get_num_elements(field1); EXPECT_EQ(elem_count, 2 * field_nelems); // create buffer to hold data for all fields and allocate - SIDRE_buffer* dbuff = SIDRE_datastore_create_buffer_from_type(ds, + SIDRE_Buffer* dbuff = SIDRE_DataStore_create_buffer_from_type(ds, SIDRE_INT_ID, 2 * field_nelems, &dbuff_buf); - SIDRE_buffer_allocate_existing(dbuff); - EXPECT_EQ(SIDRE_buffer_get_num_elements(dbuff), elem_count); + SIDRE_Buffer_allocate_existing(dbuff); + EXPECT_EQ(SIDRE_Buffer_get_num_elements(dbuff), elem_count); // Initilize buffer data for testing below. - int* b_ptr = (int*) SIDRE_buffer_get_void_ptr(dbuff); + int* b_ptr = (int*) SIDRE_Buffer_get_void_ptr(dbuff); for(size_t i = 0 ; i < elem_count ; ++i) { b_ptr[i] = i / field_nelems; } - SIDRE_buffer_print(dbuff); + SIDRE_Buffer_print(dbuff); const int offset0 = 0 * field_nelems; const int offset1 = 1 * field_nelems; // attach field views to buffer and apply offsets into buffer - SIDRE_view_attach_buffer_only(field0, dbuff); - SIDRE_view_apply_nelems_offset(field0, field_nelems, offset0); - SIDRE_view_attach_buffer_only(field1, dbuff); - SIDRE_view_apply_nelems_offset(field1, field_nelems, offset1); + SIDRE_View_attach_buffer_only(field0, dbuff); + SIDRE_View_apply_nelems_offset(field0, field_nelems, offset0); + SIDRE_View_attach_buffer_only(field1, dbuff); + SIDRE_View_apply_nelems_offset(field1, field_nelems, offset1); - EXPECT_EQ(SIDRE_buffer_get_num_views(dbuff), 2u); - EXPECT_EQ(b_ptr, SIDRE_view_get_void_ptr(field0)); - EXPECT_EQ(b_ptr, SIDRE_view_get_void_ptr(field1)); + EXPECT_EQ(SIDRE_Buffer_get_num_views(dbuff), 2u); + EXPECT_EQ(b_ptr, SIDRE_View_get_void_ptr(field0)); + EXPECT_EQ(b_ptr, SIDRE_View_get_void_ptr(field1)); // print field views... - SIDRE_view_print(field0); - SIDRE_view_print(field1); + SIDRE_View_print(field0); + SIDRE_View_print(field1); // check values in field views... - int* f0_ptr = (int*)SIDRE_view_get_void_ptr(field0) + offset0; + int* f0_ptr = (int*)SIDRE_View_get_void_ptr(field0) + offset0; for (size_t i = 0 ; i < field_nelems ; ++i) { EXPECT_EQ(f0_ptr[i], 0); } - int* f1_ptr = (int*)SIDRE_view_get_void_ptr(field1) + offset1; + int* f1_ptr = (int*)SIDRE_View_get_void_ptr(field1) + offset1; for (size_t i = 0 ; i < field_nelems ; ++i) { EXPECT_EQ(f1_ptr[i], 1); } - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } //------------------------------------------------------------------------------ @@ -381,25 +381,25 @@ TEST(C_sidre_view,int_array_multi_view_resize) /// after this we use the old buffers to copy the values /// into the new views /// - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_group r_old_buf; - SIDRE_view base_old_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_Group r_old_buf; + SIDRE_View base_old_buf; // create our main data store - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); // get access to our root data Group - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); // create a group to hold the "old" or data we want to copy - SIDRE_group* r_old = SIDRE_group_create_group(root, "r_old", &r_old_buf); + SIDRE_Group* r_old = SIDRE_Group_create_group(root, "r_old", &r_old_buf); // create a view to hold the base buffer - SIDRE_view* base_old = - SIDRE_group_create_view_and_allocate_nelems(r_old, "base_data", + SIDRE_View* base_old = + SIDRE_Group_create_view_and_allocate_nelems(r_old, "base_data", SIDRE_INT_ID, 40, &base_old_buf); - int* data_ptr = (int*) SIDRE_view_get_void_ptr(base_old); + int* data_ptr = (int*) SIDRE_View_get_void_ptr(base_old); // init the buff with values that align with the @@ -423,12 +423,12 @@ TEST(C_sidre_view,int_array_multi_view_resize) #ifdef XXX /// setup our 4 views - SIDRE_buffer* buff_old = SIDRE_view_get_buffer(base_old); + SIDRE_Buffer* buff_old = SIDRE_View_get_buffer(base_old); buff_old->getNode().print(); - SIDRE_view* r0_old = SIDRE_view_create_view(r_old, "r0",buff_old); - SIDRE_view* r1_old = SIDRE_view_create_view(r_old, "r1",buff_old); - SIDRE_view* r2_old = SIDRE_view_create_view(r_old, "r2",buff_old); - SIDRE_view* r3_old = SIDRE_view_create_view(r_old, "r3",buff_old); + SIDRE_View* r0_old = SIDRE_View_create_view(r_old, "r0",buff_old); + SIDRE_View* r1_old = SIDRE_View_create_view(r_old, "r1",buff_old); + SIDRE_View* r2_old = SIDRE_View_create_view(r_old, "r2",buff_old); + SIDRE_View* r3_old = SIDRE_View_create_view(r_old, "r3",buff_old); // each view is offset by 10 * the # of bytes in a uint32 // uint32(num_elems, offset) @@ -463,28 +463,28 @@ TEST(C_sidre_view,int_array_multi_view_resize) } // create a group to hold the "old" or data we want to copy into - SIDRE_group* r_new = SIDRE_group_create_group(root, "r_new"); + SIDRE_Group* r_new = SIDRE_Group_create_group(root, "r_new"); // create a view to hold the base buffer - SIDRE_view* base_new = SIDRE_group_create_view_and_buffer_simple( + SIDRE_View* base_new = SIDRE_Group_create_view_and_buffer_simple( r_new, "base_data"); // alloc our buffer // create a buffer to hold larger subarrays base_new->allocate_from_type(base_new, DataType::uint32(4 * 12)); - int* base_new_data = (int*) SIDRE_buffer_det_data(base_new); + int* base_new_data = (int*) SIDRE_Buffer_det_data(base_new); for (int i = 0 ; i < 4 * 12 ; ++i) { base_new_data[i] = 0; } - SIDRE_buffer* buff_new = SIDRE_view_get_buffer(base_new); + SIDRE_Buffer* buff_new = SIDRE_View_get_buffer(base_new); buff_new->getNode().print(); // create the 4 sub views of this array - SIDRE_view* r0_new = SIDRE_group_create_view(r_new, "r0",buff_new); - SIDRE_view* r1_new = SIDRE_group_create_view(r_new, "r1",buff_new); - SIDRE_view* r2_new = SIDRE_group_create_view(r_new, "r2",buff_new); - SIDRE_view* r3_new = SIDRE_group_create_view(r_new, "r3",buff_new); + SIDRE_View* r0_new = SIDRE_Group_create_view(r_new, "r0",buff_new); + SIDRE_View* r1_new = SIDRE_Group_create_view(r_new, "r1",buff_new); + SIDRE_View* r2_new = SIDRE_Group_create_view(r_new, "r2",buff_new); + SIDRE_View* r3_new = SIDRE_Group_create_view(r_new, "r3",buff_new); // apply views to r0,r1,r2,r3 // each view is offset by 12 * the # of bytes in a uint32 @@ -513,7 +513,7 @@ TEST(C_sidre_view,int_array_multi_view_resize) /// check pointer values - int* r2_new_ptr = (int*) SIDRE_view_get_void_ptr(r2_new); + int* r2_new_ptr = (int*) SIDRE_View_get_void_ptr(r2_new); for(int i=0 ; i<10 ; i++) { @@ -534,8 +534,8 @@ TEST(C_sidre_view,int_array_multi_view_resize) buff_new->getNode().print(); #endif - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } @@ -546,43 +546,43 @@ TEST(C_sidre_view,int_array_realloc) /// /// info /// - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view a1_buf, a2_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View a1_buf, a2_buf; // create our main data store - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); // get access to our root data Group - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); // create a view to hold the base buffer - SIDRE_view* a1 = - SIDRE_group_create_view_and_allocate_nelems(root, "a1", + SIDRE_View* a1 = + SIDRE_Group_create_view_and_allocate_nelems(root, "a1", SIDRE_FLOAT_ID, 5, &a1_buf); - SIDRE_view* a2 = - SIDRE_group_create_view_and_allocate_nelems(root, "a2", + SIDRE_View* a2 = + SIDRE_Group_create_view_and_allocate_nelems(root, "a2", SIDRE_INT_ID, 5, &a2_buf); - float* a1_ptr = (float*)SIDRE_view_get_void_ptr(a1); - int* a2_ptr = (int*)SIDRE_view_get_void_ptr(a2); + float* a1_ptr = (float*)SIDRE_View_get_void_ptr(a1); + int* a2_ptr = (int*)SIDRE_View_get_void_ptr(a2); for(int i=0 ; i<5 ; i++) { a1_ptr[i] = 5.0; a2_ptr[i] = -5; } - EXPECT_EQ(SIDRE_view_get_bytes_per_element(a1), sizeof(float)); - EXPECT_EQ(SIDRE_view_get_total_bytes(a1), sizeof(float)*5); + EXPECT_EQ(SIDRE_View_get_bytes_per_element(a1), sizeof(float)); + EXPECT_EQ(SIDRE_View_get_total_bytes(a1), sizeof(float)*5); - EXPECT_EQ(SIDRE_view_get_bytes_per_element(a2), sizeof(int)); - EXPECT_EQ(SIDRE_view_get_total_bytes(a2), sizeof(int)*5); + EXPECT_EQ(SIDRE_View_get_bytes_per_element(a2), sizeof(int)); + EXPECT_EQ(SIDRE_View_get_total_bytes(a2), sizeof(int)*5); - SIDRE_view_reallocate(a1, 10); - SIDRE_view_reallocate(a2, 15); + SIDRE_View_reallocate(a1, 10); + SIDRE_View_reallocate(a2, 15); - a1_ptr = (float*)SIDRE_view_get_void_ptr(a1); - a2_ptr = (int*)SIDRE_view_get_void_ptr(a2); + a1_ptr = (float*)SIDRE_View_get_void_ptr(a1); + a2_ptr = (int*)SIDRE_View_get_void_ptr(a2); for(int i=0 ; i<5 ; i++) { @@ -601,15 +601,15 @@ TEST(C_sidre_view,int_array_realloc) a2_ptr[i] = -15; } - EXPECT_EQ(SIDRE_view_get_bytes_per_element(a1), sizeof(float)); - EXPECT_EQ(SIDRE_view_get_total_bytes(a1), sizeof(float)*10); + EXPECT_EQ(SIDRE_View_get_bytes_per_element(a1), sizeof(float)); + EXPECT_EQ(SIDRE_View_get_total_bytes(a1), sizeof(float)*10); - EXPECT_EQ(SIDRE_view_get_bytes_per_element(a2), sizeof(int)); - EXPECT_EQ(SIDRE_view_get_total_bytes(a2), sizeof(int)*15); + EXPECT_EQ(SIDRE_View_get_bytes_per_element(a2), sizeof(int)); + EXPECT_EQ(SIDRE_View_get_total_bytes(a2), sizeof(int)*15); - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); } @@ -617,45 +617,45 @@ TEST(C_sidre_view,int_array_realloc) TEST(C_sidre_view,simple_opaque) { - SIDRE_datastore ds_buf; - SIDRE_group root_buf; - SIDRE_view opq_view_buf; + SIDRE_DataStore ds_buf; + SIDRE_Group root_buf; + SIDRE_View opq_view_buf; // create our main data store - SIDRE_datastore* ds = SIDRE_datastore_new(&ds_buf); + SIDRE_DataStore* ds = SIDRE_DataStore_new(&ds_buf); // get access to our root data Group - SIDRE_group* root = SIDRE_datastore_get_root(ds, &root_buf); + SIDRE_Group* root = SIDRE_DataStore_get_root(ds, &root_buf); int* src_data = (int*) malloc(sizeof(int)); src_data[0] = 42; void* src_ptr = (void*)src_data; - SIDRE_view* opq_view = SIDRE_group_create_view_external(root, + SIDRE_View* opq_view = SIDRE_Group_create_view_external(root, "my_opaque", src_ptr, &opq_view_buf); // External pointers are held in the view, no buffer should be present. - EXPECT_EQ(SIDRE_datastore_get_num_buffers(ds), 0u); + EXPECT_EQ(SIDRE_DataStore_get_num_buffers(ds), 0u); - EXPECT_TRUE(SIDRE_view_is_external(opq_view)); - EXPECT_TRUE(!SIDRE_view_is_applied(opq_view)); - EXPECT_TRUE(SIDRE_view_is_opaque(opq_view)); + EXPECT_TRUE(SIDRE_View_is_external(opq_view)); + EXPECT_TRUE(!SIDRE_View_is_applied(opq_view)); + EXPECT_TRUE(SIDRE_View_is_opaque(opq_view)); // Opaque views do not know their sizes - EXPECT_EQ(0u, SIDRE_view_get_bytes_per_element(opq_view)); - EXPECT_EQ(0u, SIDRE_view_get_total_bytes(opq_view)); - EXPECT_EQ(0u, SIDRE_view_get_offset(opq_view)); - EXPECT_EQ(1u, SIDRE_view_get_stride(opq_view)); + EXPECT_EQ(0u, SIDRE_View_get_bytes_per_element(opq_view)); + EXPECT_EQ(0u, SIDRE_View_get_total_bytes(opq_view)); + EXPECT_EQ(0u, SIDRE_View_get_offset(opq_view)); + EXPECT_EQ(1u, SIDRE_View_get_stride(opq_view)); - void* opq_ptr = SIDRE_view_get_void_ptr(opq_view); + void* opq_ptr = SIDRE_View_get_void_ptr(opq_view); int* out_data = (int*)opq_ptr; EXPECT_EQ(src_ptr, opq_ptr); EXPECT_EQ(42, out_data[0]); - SIDRE_datastore_print(ds); - SIDRE_datastore_delete(ds); + SIDRE_DataStore_print(ds); + SIDRE_DataStore_delete(ds); free(src_data); } diff --git a/src/axom/slic/interface/slic_shroud.yaml b/src/axom/slic/interface/slic_shroud.yaml index 722737f0a9..c6838945a8 100644 --- a/src/axom/slic/interface/slic_shroud.yaml +++ b/src/axom/slic/interface/slic_shroud.yaml @@ -15,11 +15,10 @@ namespace: axom slic options: C_line_length: 1000 F_module_name_library_template: axom_{library_lower} -# F_module_per_class: False # Change the default template for Fortran functions to include the library name. - F_name_impl_template: "{library_lower}_{class_prefix}{underscore_name}{function_suffix}" - # XXX - This will eventually become the default in Shroud - C_enum_member_template: "{C_prefix}{enum_member_name}" + F_name_impl_template: "{library_lower}_{F_name_scope}{underscore_name}{function_suffix}" +# C_enum_member_template: "{C_prefix}{enum_member_name}" +# F_enum_member_template: "{enum_name}_{enum_member_name}" format: C_prefix: SLIC_ @@ -33,6 +32,8 @@ format: declarations: - decl: namespace message # MessageLevel.h + options: + flatten_namespace: True declarations: - decl: | enum Level From 29417b761f9a9e193dac33408c9ebf93ed2cb42f Mon Sep 17 00:00:00 2001 From: Keith Edward Healy Date: Mon, 23 Sep 2019 16:49:52 -0700 Subject: [PATCH 003/632] Enable Azure Pipeline CI for Axom --- azure-pipelines.yml | 70 +++++++++----- ...linux-ubuntu16.04-x86_64-clang@4.0.0.cmake | 90 ++++++++++++++++++ ...linux-ubuntu16.04-x86_64-clang@5.0.0.cmake | 90 ++++++++++++++++++ ...linux-ubuntu16.04-x86_64-clang@6.0.0.cmake | 90 ++++++++++++++++++ ...r-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake | 94 +++++++++++++++++++ ...r-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake | 94 +++++++++++++++++++ ...r-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake | 94 +++++++++++++++++++ .../azure-pipelines/linux-build_and_test.sh | 24 +++-- scripts/docker/README.md | 89 ++++++++++++++++++ scripts/docker/dockerfile_clang-4 | 30 ++++++ scripts/docker/dockerfile_clang-5 | 28 ++++++ scripts/docker/dockerfile_clang-6 | 28 ++++++ scripts/docker/dockerfile_gcc-6 | 24 +++++ scripts/docker/dockerfile_gcc-7 | 26 +++++ scripts/docker/dockerfile_gcc-8 | 25 +++++ .../spack_configs/docker/compilers.yaml | 80 ++++++++++++++++ .../spack_configs/docker/packages.yaml | 79 ++++++++++++++++ 17 files changed, 1025 insertions(+), 30 deletions(-) create mode 100644 host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake create mode 100644 host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake create mode 100644 host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake create mode 100644 host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake create mode 100644 host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake create mode 100644 host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake create mode 100644 scripts/docker/README.md create mode 100644 scripts/docker/dockerfile_clang-4 create mode 100644 scripts/docker/dockerfile_clang-5 create mode 100644 scripts/docker/dockerfile_clang-6 create mode 100644 scripts/docker/dockerfile_gcc-6 create mode 100644 scripts/docker/dockerfile_gcc-7 create mode 100644 scripts/docker/dockerfile_gcc-8 create mode 100644 scripts/uberenv/spack_configs/docker/compilers.yaml create mode 100644 scripts/uberenv/spack_configs/docker/packages.yaml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 913be16446..9dd66635a5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,38 +13,54 @@ strategy: matrix: linux_gcc6: VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/compilers:gcc-6' - CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' + Compiler_ImageName: 'axom/tpls:gcc-6' + CMAKE_EXTRA_FLAGS: '' COMPILER: 'g++' TEST_TARGET: 'linux_gcc6' - linux_gcc7: - VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/compilers:gcc-7' - CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' - COMPILER: 'g++' - TEST_TARGET: 'linux_gcc7' + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@6.1.0' linux_gcc8: VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/compilers:gcc-8' - CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' + Compiler_ImageName: 'axom/tpls:gcc-8' + CMAKE_EXTRA_FLAGS: '' COMPILER: 'g++' TEST_TARGET: 'linux_gcc8' - linux_clang4: + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@8.1.0' + linux_gcc7: VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/compilers:clang-4' - CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' - COMPILER: 'clang++' - TEST_TARGET: 'linux_clang4' + Compiler_ImageName: 'axom/tpls:gcc-7' + CMAKE_EXTRA_FLAGS: '' + COMPILER: 'g++' + TEST_TARGET: 'linux_gcc7' + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@7.3.0' + linux_clang4: + VM_ImageName: 'ubuntu-16.04' + Compiler_ImageName: 'axom/tpls:clang-4' + CMAKE_EXTRA_FLAGS: '' + COMPILER: 'clang++' + TEST_TARGET: 'linux_clang4' + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-clang@4.0.0' + linux_clang5: + VM_ImageName: 'ubuntu-16.04' + Compiler_ImageName: 'axom/tpls:clang-5' + CMAKE_EXTRA_FLAGS: '' + COMPILER: 'clang++' + TEST_TARGET: 'linux_clang5' + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-clang@5.0.0' linux_clang6: - VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/compilers:clang-6' - CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' - COMPILER: 'clang++' - TEST_TARGET: 'linux_clang6' + VM_ImageName: 'ubuntu-16.04' + Compiler_ImageName: 'axom/tpls:clang-6' + CMAKE_EXTRA_FLAGS: '' + COMPILER: 'clang++' + TEST_TARGET: 'linux_clang6' + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-clang@6.0.0' osx_gcc: VM_ImageName: 'macos-10.13' CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' TEST_TARGET: 'osx_gcc' + windows: + VM_ImageName: 'windows-2019' + CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' + TEST_TARGET: 'win_vs' pool: vmImage: $(VM_ImageName) @@ -57,7 +73,13 @@ steps: inputs: workingDir: 'build' cmakeArgs: '$(CMAKE_EXTRA_FLAGS) ../src' - condition: eq( variables['Agent.OS'], 'Darwin') + condition: or( eq( variables['Agent.OS'], 'Windows_NT'), eq( variables['Agent.OS'], 'Darwin')) +- task: VSBuild@1 + inputs: + solution: 'build/*.sln' + vsVersion: 'latest' + condition: eq( variables['Agent.OS'], 'Windows_NT') + displayName: 'Visual Studio Build' - script: | cd build make @@ -69,8 +91,10 @@ steps: displayName: '$(TEST_TARGET) Test' condition: eq( variables['Agent.OS'], 'Darwin') - script: | - docker run --rm --user='root' -v `pwd`:/home/axom $(Compiler_ImageName) chown -R axom /home/axom - docker run --rm -v `pwd`:/home/axom -e TEST_TARGET -e COMPILER -e DO_BUILD -e DO_TEST -e CMAKE_EXTRA_FLAGS $(Compiler_ImageName) ./scripts/azure-pipelines/linux-build_and_test.sh + echo " -e $TEST_TARGET -e $COMPILER -e $DO_BUILD -e $DO_TEST -e $CMAKE_EXTRA_FLAGS $(Compiler_ImageName) ./scripts/azure-pipelines/linux-build_and_test.sh" + docker run --rm --user='root' -v `pwd`:/home/axom/axom $(Compiler_ImageName) chown -R axom /home/axom + docker run --rm -v `pwd`:/home/axom/axom -e TEST_TARGET -e COMPILER -e DO_BUILD -e DO_TEST -e HOST_CONFIG -e CMAKE_EXTRA_FLAGS $(Compiler_ImageName) ./axom/scripts/azure-pipelines/linux-build_and_test.sh + condition: eq( variables['Agent.OS'], 'Linux') displayName: '$(TEST_TARGET) Build & Test' - task: PublishTestResults@2 diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake new file mode 100644 index 0000000000..663648063a --- /dev/null +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake @@ -0,0 +1,90 @@ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# SYS_TYPE: linux-ubuntu16.04-x86_64 +# Compiler Spec: clang@4.0.0 +#------------------------------------------------------------------------------ +# CMake executable path: /home/axom/axom_tpls/clang-4.0.0/cmake-3.10.1/bin/cmake +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Compilers +#------------------------------------------------------------------------------ + +# C compiler used by spack +set(CMAKE_C_COMPILER "/usr/bin/clang" CACHE PATH "") + +# C++ compiler used by spack +set(CMAKE_CXX_COMPILER "/usr/bin/clang++" CACHE PATH "") + +# Fortran compiler used by spack +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +#------------------------------------------------------------------------------ +# TPLs +#------------------------------------------------------------------------------ + +# Root directory for generated TPLs +set(TPL_ROOT "/home/axom/axom_tpls/clang-4.0.0" CACHE PATH "") + +# conduit from uberenv +set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") + +# mfem from uberenv +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +# hdf5 from uberenv +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") + +# scr not built by uberenv + +# raja from uberenv +set(RAJA_DIR "/usr/local/share/raja/cmake/share/raja/cmake" CACHE PATH "") + +# umpire from uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") + +# python not built by uberenv + +set(ENABLE_DOCS OFF CACHE BOOL "") + +# shroud not built by uberenv + +# uncrustify not built by uberenv + +# lcov and genhtml not built by uberenv + +# cppcheck not built by uberenv + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/home/axom/axom_tpls/clang-4.0.0/mpich-3.0.4/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/clang-4.0.0/mpich-3.0.4/bin/mpic++" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/clang-4.0.0/mpich-3.0.4/bin/mpif90" CACHE PATH "") + +set(MPIEXEC_EXECUTABLE "/home/axom/axom_tpls/clang-4.0.0/mpich-3.0.4/bin/mpiexec" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(ENABLE_OPENMP ON CACHE BOOL "") + + diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake new file mode 100644 index 0000000000..f3784cf67c --- /dev/null +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake @@ -0,0 +1,90 @@ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# SYS_TYPE: linux-ubuntu16.04-x86_64 +# Compiler Spec: clang@5.0.0 +#------------------------------------------------------------------------------ +# CMake executable path: /home/axom/axom_tpls/clang-5.0.0/cmake-3.10.1/bin/cmake +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Compilers +#------------------------------------------------------------------------------ + +# C compiler used by spack +set(CMAKE_C_COMPILER "/usr/bin/clang" CACHE PATH "") + +# C++ compiler used by spack +set(CMAKE_CXX_COMPILER "/usr/bin/clang++" CACHE PATH "") + +# Fortran compiler used by spack +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +#------------------------------------------------------------------------------ +# TPLs +#------------------------------------------------------------------------------ + +# Root directory for generated TPLs +set(TPL_ROOT "/home/axom/axom_tpls/clang-5.0.0" CACHE PATH "") + +# conduit from uberenv +set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") + +# mfem from uberenv +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +# hdf5 from uberenv +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") + +# scr not built by uberenv + +# raja from uberenv +set(RAJA_DIR "/usr/local/share/raja/cmake/share/raja/cmake" CACHE PATH "") + +# umpire from uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") + +# python not built by uberenv + +set(ENABLE_DOCS OFF CACHE BOOL "") + +# shroud not built by uberenv + +# uncrustify not built by uberenv + +# lcov and genhtml not built by uberenv + +# cppcheck not built by uberenv + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/home/axom/axom_tpls/clang-5.0.0/mpich-3.0.4/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/clang-5.0.0/mpich-3.0.4/bin/mpic++" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/clang-5.0.0/mpich-3.0.4/bin/mpif90" CACHE PATH "") + +set(MPIEXEC_EXECUTABLE "/home/axom/axom_tpls/clang-5.0.0/mpich-3.0.4/bin/mpiexec" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(ENABLE_OPENMP ON CACHE BOOL "") + + diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake new file mode 100644 index 0000000000..41474f8158 --- /dev/null +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake @@ -0,0 +1,90 @@ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# SYS_TYPE: linux-ubuntu16.04-x86_64 +# Compiler Spec: clang@6.0.0 +#------------------------------------------------------------------------------ +# CMake executable path: /home/axom/axom_tpls/clang-6.0.0/cmake-3.10.1/bin/cmake +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Compilers +#------------------------------------------------------------------------------ + +# C compiler used by spack +set(CMAKE_C_COMPILER "/usr/bin/clang" CACHE PATH "") + +# C++ compiler used by spack +set(CMAKE_CXX_COMPILER "/usr/bin/clang++" CACHE PATH "") + +# Fortran compiler used by spack +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +#------------------------------------------------------------------------------ +# TPLs +#------------------------------------------------------------------------------ + +# Root directory for generated TPLs +set(TPL_ROOT "/home/axom/axom_tpls/clang-6.0.0" CACHE PATH "") + +# conduit from uberenv +set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") + +# mfem from uberenv +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +# hdf5 from uberenv +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") + +# scr not built by uberenv + +# raja from uberenv +set(RAJA_DIR "/usr/local/share/raja/cmake/share/raja/cmake" CACHE PATH "") + +# umpire from uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") + +# python not built by uberenv + +set(ENABLE_DOCS OFF CACHE BOOL "") + +# shroud not built by uberenv + +# uncrustify not built by uberenv + +# lcov and genhtml not built by uberenv + +# cppcheck not built by uberenv + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/home/axom/axom_tpls/clang-6.0.0/mpich-3.0.4/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/clang-6.0.0/mpich-3.0.4/bin/mpic++" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/clang-6.0.0/mpich-3.0.4/bin/mpif90" CACHE PATH "") + +set(MPIEXEC_EXECUTABLE "/home/axom/axom_tpls/clang-6.0.0/mpich-3.0.4/bin/mpiexec" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(ENABLE_OPENMP ON CACHE BOOL "") + + diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake new file mode 100644 index 0000000000..36190b3be8 --- /dev/null +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake @@ -0,0 +1,94 @@ +################################## +# !!!! This is a generated file, edit at own risk !!!! +################################## + +# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +################################## + +################################## + +# SYS_TYPE: linux-ubuntu16.04-x86_64 +# Compiler Spec: gcc@6.1.0 +################################## + +# CMake executable path: /home/axom/axom_tpls/gcc-6.1.0/cmake-3.9.6/bin/cmake + +############## +# Compilers +############## + +# C compiler used by spack +set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE PATH "") + +# C++ compiler used by spack +set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE PATH "") + +# Fortran compiler used by spack +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +############## +# TPLs +############## + +# Root directory for generated TPLs +set(TPL_ROOT "/home/axom/axom_tpls/gcc-6.1.0" CACHE PATH "") + +# conduit from uberenv +set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") + +# mfem from uberenv +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +# hdf5 from uberenv +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") + +# scr not built by uberenv + +# raja from uberenv +set(RAJA_DIR "/usr/local/share/raja/cmake" CACHE PATH "") + +# umpire from uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") + +# python not built by uberenv + +set(ENABLE_DOCS OFF CACHE BOOL "") + +# shroud not built by uberenv + +# uncrustify not built by uberenv + +# lcov and genhtml not built by uberenv + +# cppcheck not built by uberenv + +############## +# MPI +############## + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/home/axom/axom_tpls/gcc-6.1.0/mpich-3.2.1/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/gcc-6.1.0/mpich-3.2.1/bin/mpic++" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/gcc-6.1.0/mpich-3.2.1/bin/mpif90" CACHE PATH "") + +set(MPIEXEC "/home/axom/axom_tpls/gcc-6.1.0/mpich-3.2.1/bin/mpiexec" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") + +############## +# Other machine specifics +############## + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(ENABLE_OPENMP ON CACHE BOOL "") + + diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake new file mode 100644 index 0000000000..030f88c317 --- /dev/null +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake @@ -0,0 +1,94 @@ +################################## +# !!!! This is a generated file, edit at own risk !!!! +################################## + +# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +################################## + +################################## + +# SYS_TYPE: linux-ubuntu16.04-x86_64 +# Compiler Spec: gcc@7.3.0 +################################## + +# CMake executable path: /home/axom/axom_tpls/gcc-7.3.0/cmake-3.9.6/bin/cmake + +############## +# Compilers +############## + +# C compiler used by spack +set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE PATH "") + +# C++ compiler used by spack +set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE PATH "") + +# Fortran compiler used by spack +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +############## +# TPLs +############## + +# Root directory for generated TPLs +set(TPL_ROOT "/home/axom/axom_tpls/gcc-7.3.0" CACHE PATH "") + +# conduit from uberenv +set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") + +# mfem from uberenv +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +# hdf5 from uberenv +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") + +# scr not built by uberenv + +# raja from uberenv +set(RAJA_DIR "/usr/local/share/raja/cmake" CACHE PATH "") + +# umpire from uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") + +# python not built by uberenv + +set(ENABLE_DOCS OFF CACHE BOOL "") + +# shroud not built by uberenv + +# uncrustify not built by uberenv + +# lcov and genhtml not built by uberenv + +# cppcheck not built by uberenv + +############## +# MPI +############## + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/home/axom/axom_tpls/gcc-7.3.0/mpich-3.2.1/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/gcc-7.3.0/mpich-3.2.1/bin/mpic++" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/gcc-7.3.0/mpich-3.2.1/bin/mpif90" CACHE PATH "") + +set(MPIEXEC "/home/axom/axom_tpls/gcc-7.3.0/mpich-3.2.1/bin/mpiexec" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") + +############## +# Other machine specifics +############## + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(ENABLE_OPENMP ON CACHE BOOL "") + + diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake new file mode 100644 index 0000000000..4a9f752ad6 --- /dev/null +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake @@ -0,0 +1,94 @@ +################################## +# !!!! This is a generated file, edit at own risk !!!! +################################## + +# Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +################################## + +################################## + +# SYS_TYPE: linux-ubuntu16.04-x86_64 +# Compiler Spec: gcc@8.1.0 +################################## + +# CMake executable path: /home/axom/axom_tpls/gcc-8.1.0/cmake-3.9.6/bin/cmake + +############## +# Compilers +############## + +# C compiler used by spack +set(CMAKE_C_COMPILER "/usr/bin/gcc" CACHE PATH "") + +# C++ compiler used by spack +set(CMAKE_CXX_COMPILER "/usr/bin/g++" CACHE PATH "") + +# Fortran compiler used by spack +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/bin/gfortran" CACHE PATH "") + +############## +# TPLs +############## + +# Root directory for generated TPLs +set(TPL_ROOT "/home/axom/axom_tpls/gcc-8.1.0" CACHE PATH "") + +# conduit from uberenv +set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") + +# mfem from uberenv +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +# hdf5 from uberenv +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") + +# scr not built by uberenv + +# raja from uberenv +set(RAJA_DIR "/usr/local/share/raja/cmake" CACHE PATH "") + +# umpire from uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") + +# python not built by uberenv + +set(ENABLE_DOCS OFF CACHE BOOL "") + +# shroud not built by uberenv + +# uncrustify not built by uberenv + +# lcov and genhtml not built by uberenv + +# cppcheck not built by uberenv + +############## +# MPI +############## + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpic++" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpif90" CACHE PATH "") + +set(MPIEXEC "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpiexec" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") + +############## +# Other machine specifics +############## + +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(ENABLE_OPENMP ON CACHE BOOL "") + + diff --git a/scripts/azure-pipelines/linux-build_and_test.sh b/scripts/azure-pipelines/linux-build_and_test.sh index 40037f9c09..f791f08d61 100755 --- a/scripts/azure-pipelines/linux-build_and_test.sh +++ b/scripts/azure-pipelines/linux-build_and_test.sh @@ -6,7 +6,8 @@ # SPDX-License-Identifier: (BSD-3-Clause) ############################################################################## -env +set -x + function or_die () { "$@" local status=$? @@ -16,21 +17,30 @@ function or_die () { fi } -or_die mkdir azure-${TEST_TARGET}-build -cd azure-${TEST_TARGET}-build +or_die cd axom +git submodule init +git submodule update + +echo HOST_CONFIG +echo $HOST_CONFIG + if [[ "$DO_BUILD" == "yes" ]] ; then - or_die cmake -DCMAKE_CXX_COMPILER="${COMPILER}" ${CMAKE_EXTRA_FLAGS} ../src + or_die ./config-build.py -hc /home/axom/axom/host-configs/docker/${HOST_CONFIG}.cmake -DENABLE_GTEST_DEATH_TESTS=ON + or_die cd build-$HOST_CONFIG-debug if [[ ${CMAKE_EXTRA_FLAGS} == *COVERAGE* ]] ; then - or_die make -j 3 + or_die make -j 10 else - or_die make -j 3 VERBOSE=1 + or_die make -j 10 VERBOSE=1 fi if [[ "${DO_TEST}" == "yes" ]] ; then - or_die ctest -T test --output-on-failure -V + make CTEST_OUTPUT_ON_FAILURE=1 test ARGS='-T Test -VV -j8' fi if [[ "${DO_MEMCHECK}" == "yes" ]] ; then or_die ctest -T memcheck fi fi +find ./axom/sidre -type d -exec chmod 755 {} \; +find ./axom/sidre -type f -exec chmod 644 {} \; + exit 0 diff --git a/scripts/docker/README.md b/scripts/docker/README.md new file mode 100644 index 0000000000..c4d04ad1d1 --- /dev/null +++ b/scripts/docker/README.md @@ -0,0 +1,89 @@ +**WHAT IS A DOCKERFILE?** +Dockerfiles are used to create Docker images. Docker images are the 'recipes' used to build virtual environments called containers. These dockerfiles all use a base Linux image that has a particular compiler installed. These base images were created by David Beckinsale and are located on Docker Hub at this location: +https://hub.docker.com/r/axom/compilers/tags + +**EXPLANATION OF DOCKERFILE CONTENTS** +The base images are accessed in these dockerfiles by the use of the 'FROM' command: +>FROM axom/compilers:<compiler> + +The remaining dockerfile commands attempt to build the Axom third party libraries using the specified compiler. The following commands update the compiler and add Fortran compiler support: + +>RUN sudo apt-get update -y + +>RUN sudo apt-get install curl -fy +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +>#(For Clang Builds - Need to restore stdc++ lib) + +>RUN sudo apt-get install libstdc++-7-dev + +Then the Axom and RAJA source is retrieved and RAJA is built and installed: (WORKDIR functions as a 'cd' command) +>RUN git clone --recursive https://github.com/LLNL/axom.git + +>RUN git clone --recursive https://github.com/LLNL/RAJA.git + +>WORKDIR "/home/axom/RAJA" + +>RUN mkdir build + +>WORKDIR "/home/axom/RAJA/build" + +>RUN cmake ../. -DENABLE_TESTS=OFF + +>RUN make + +>RUN sudo make install + +Finally, the uberenv script is invoked to build the libraries and store them in the axom_tpls directory. (The host config files produced during this process had been added to the Axom repo under "axom/host-configs/docker") + +>sudo apt-get update -y + +>WORKDIR "/home/axom/axom" + +>RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%<compiler>^mpich@3.0.4 --prefix=/home/axom/axom_tpls -k + +Note: The mpich specification (^mpich@3.0.4) is necessary for clang builds. Not specifying it currently results in the system attempting to use and patch version 3.2.1 of mpich, which fails. See https://github.com/spack/spack/pull/8320 and https://github.com/spack/spack/issues/8432 +Also, mpich itself is used because openmpi's mpiexec will not run for the root user and causes multiple test failures. + +Once completed, this container can be used to build and test the Axom application on a Docker-using CI web tool such as Azure Pipelines. + +Already built Docker images containing these third party libraries can be accessed on Docker Hub at this location: +https://hub.docker.com/r/axom/tpls/tags + +**BUILDING THE IMAGE** +Using a dockerfile to create an image requires a Docker client called Docker Desktop that provides a command line interface for Docker commands. Once this client has been installed the image can be built in two ways. + +1. BUILD INTERACTIVELY + + The first way is to run an interactive session of the base image followed by running the individual commands at the session prompt. + + Running the interactive session is accomplished with the "docker run -it " command. For example: + + >docker run -it axom/compilers:<compiler> + + This should start a container that provides a linux prompt. The remaining commands can be entered in order (without the Docker 'RUN' command): + + >sudo apt-get update -y + + >sudo apt-get install curl -fy + + etc... + + Once all the commands have been completed the container can be exited and then converted into an image using the "docker commit" command. + + >docker commit <container id> <image repository:tag> + + The container id can be found with "docker container ls -a". + The <image repository:tag> is chosen by the user to identify this image. + +2. BUILD WITH DOCKERFILE + + The second way is to have the Docker engine build the image directly from the dockerfile. This is done by placing the dockerfile in an empty directory and using the "docker build" command. + + >docker build -t <image repository:tag> <dir with dockerfile> + + The -t <image repositag> opt sets the repository:tag identifier of the image. + +**PUSHING THE IMAGE TO DOCKER HUB** +Once created the image can be uploaded to Docker Hub with the "docker push" command. +>docker push <image repository:tag> diff --git a/scripts/docker/dockerfile_clang-4 b/scripts/docker/dockerfile_clang-4 new file mode 100644 index 0000000000..b6d31285ca --- /dev/null +++ b/scripts/docker/dockerfile_clang-4 @@ -0,0 +1,30 @@ +FROM axom/compilers:clang-4 + +RUN sudo apt-get update -y +RUN sudo apt-get install curl -fy + +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +#(For Clang Builds - Need to restore stdc++ lib) +RUN sudo apt-get install libstdc++-7-dev + +RUN git clone --recursive https://github.com/LLNL/axom.git + +RUN git clone --recursive https://github.com/LLNL/RAJA.git + +WORKDIR "/home/axom/RAJA" +RUN mkdir build + +WORKDIR "/home/axom/RAJA/build" + +RUN cmake ../. -DENABLE_TESTS=OFF +RUN make +RUN sudo make install + +WORKDIR "/home/axom/axom" + +RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%clang@4.0.0^mpich@3.0.4 --prefix=/home/axom/axom_tpls -k + +WORKDIR "/home/axom" + +RUN rm -rf axom diff --git a/scripts/docker/dockerfile_clang-5 b/scripts/docker/dockerfile_clang-5 new file mode 100644 index 0000000000..b39be2998d --- /dev/null +++ b/scripts/docker/dockerfile_clang-5 @@ -0,0 +1,28 @@ +FROM axom/compilers:clang-5 + +RUN sudo apt-get update -y +RUN sudo apt-get install curl -fy + +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +#(For Clang Builds - Need to restore stdc++ lib) +RUN sudo apt-get install libstdc++-7-dev + +RUN git clone --recursive https://github.com/LLNL/axom.git + +RUN git clone --recursive https://github.com/LLNL/RAJA.git + +WORKDIR "/home/axom/RAJA" +RUN mkdir build + +WORKDIR "/home/axom/RAJA/build" +RUN cmake ../. -DENABLE_TESTS=OFF +RUN make +RUN sudo make install + +WORKDIR "/home/axom/axom" +RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%clang@5.0.0^mpich@3.0.4 --prefix=/home/axom/axom_tpls -k + +WORKDIR "/home/axom" + +RUN rm -rf axom diff --git a/scripts/docker/dockerfile_clang-6 b/scripts/docker/dockerfile_clang-6 new file mode 100644 index 0000000000..a04f09b6db --- /dev/null +++ b/scripts/docker/dockerfile_clang-6 @@ -0,0 +1,28 @@ +FROM axom/compilers:clang-6 +RUN sudo apt-get update -y +RUN sudo apt-get install curl -fy + +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +#(For Clang Builds - Need to restore stdc++ lib) +RUN sudo apt-get install libstdc++-7-dev + +RUN git clone --recursive https://github.com/LLNL/axom.git + +RUN git clone --recursive https://github.com/LLNL/RAJA.git + +WORKDIR "/home/axom/RAJA" +RUN mkdir build + +WORKDIR "/home/axom/RAJA/build" +RUN cmake ../. -DENABLE_TESTS=OFF +RUN make +RUN sudo make install + +WORKDIR "/home/axom/axom" + +RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%clang@6.0.0^mpich@3.0.4 --prefix=/home/axom/axom_tpls -k + +WORKDIR "/home/axom" + +RUN rm -rf axom diff --git a/scripts/docker/dockerfile_gcc-6 b/scripts/docker/dockerfile_gcc-6 new file mode 100644 index 0000000000..2ff22f900b --- /dev/null +++ b/scripts/docker/dockerfile_gcc-6 @@ -0,0 +1,24 @@ +FROM axom/compilers:gcc-6 + +RUN sudo apt-get update -y +RUN sudo apt-get install curl -fy + +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +RUN git clone --recursive https://github.com/LLNL/axom.git + +RUN git clone --recursive https://github.com/LLNL/RAJA.git + +WORKDIR "/home/axom/RAJA" +RUN mkdir build + +WORKDIR "/home/axom/RAJA/build" +RUN cmake ../. -DENABLE_TESTS=OFF +RUN make +RUN sudo make install + +WORKDIR "/home/axom/axom" +RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%gcc@6.1.0 --prefix=/home/axom/axom_tpls -k + +WORKDIR "/home/axom" +RUN rm -rf axom diff --git a/scripts/docker/dockerfile_gcc-7 b/scripts/docker/dockerfile_gcc-7 new file mode 100644 index 0000000000..255a164f1b --- /dev/null +++ b/scripts/docker/dockerfile_gcc-7 @@ -0,0 +1,26 @@ +FROM axom/compilers:gcc-7 + +RUN sudo apt-get update -y +RUN sudo apt-get install curl -fy + +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +RUN git clone --recursive https://github.com/LLNL/axom.git + +RUN git clone --recursive https://github.com/LLNL/RAJA.git + +WORKDIR "/home/axom/RAJA" +RUN mkdir build + +WORKDIR "/home/axom/RAJA/build" +RUN cmake ../. -DENABLE_TESTS=OFF +RUN make +RUN sudo make install + +WORKDIR "/home/axom/axom" + +RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%gcc@7.3.0 --prefix=/home/axom/axom_tpls -k + +WORKDIR "/home/axom" + +RUN rm -rf axom diff --git a/scripts/docker/dockerfile_gcc-8 b/scripts/docker/dockerfile_gcc-8 new file mode 100644 index 0000000000..c201c57e10 --- /dev/null +++ b/scripts/docker/dockerfile_gcc-8 @@ -0,0 +1,25 @@ +FROM axom/compilers:gcc-8 + +RUN sudo apt-get update -y +RUN sudo apt-get install curl -fy + +RUN sudo apt-get -qq install -y --no-install-recommends gfortran-7 && sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 100 + +RUN git clone --recursive https://github.com/LLNL/axom.git + +RUN git clone --recursive https://github.com/LLNL/RAJA.git + +WORKDIR "/home/axom/RAJA" +RUN mkdir build + +WORKDIR "/home/axom/RAJA/build" +RUN cmake ../. -DENABLE_TESTS=OFF +RUN make +RUN sudo make install + +WORKDIR "/home/axom/axom" +RUN ./scripts/uberenv/uberenv.py --spack-config-dir=./scripts/uberenv/spack_configs/docker --spec=%gcc@8.1.0 --prefix=/home/axom/axom_tpls -k + +WORKDIR "/home/axom" + +RUN rm -rf axom diff --git a/scripts/uberenv/spack_configs/docker/compilers.yaml b/scripts/uberenv/spack_configs/docker/compilers.yaml new file mode 100644 index 0000000000..2e5c7b3926 --- /dev/null +++ b/scripts/uberenv/spack_configs/docker/compilers.yaml @@ -0,0 +1,80 @@ +compilers: +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: ubuntu16.04 + paths: + cc: /usr/bin/gcc + cxx: /usr/bin/g++ + f77: /usr/bin/gfortran + fc: /usr/bin/gfortran + spec: gcc@6.1.0 + target: x86_64 +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: ubuntu16.04 + paths: + cc: /usr/bin/gcc + cxx: /usr/bin/g++ + f77: /usr/bin/gfortran + fc: /usr/bin/gfortran + spec: gcc@7.3.0 + target: x86_64 +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: ubuntu16.04 + paths: + cc: /usr/bin/gcc + cxx: /usr/bin/g++ + f77: /usr/bin/gfortran + fc: /usr/bin/gfortran + spec: gcc@8.1.0 + target: x86_64 +- compiler: + environment: {} + extra_rpaths: [] + flags: + cxxflags: -stdlib=libc++ + modules: [] + operating_system: ubuntu16.04 + paths: + cc: /usr/bin/clang + cxx: /usr/bin/clang++ + f77: /usr/bin/gfortran + fc: /usr/bin/gfortran + spec: clang@6.0.0 + target: x86_64 +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: ubuntu16.04 + paths: + cc: /usr/bin/clang + cxx: /usr/bin/clang++ + f77: /usr/bin/gfortran + fc: /usr/bin/gfortran + spec: clang@5.0.0 + target: x86_64 +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: ubuntu16.04 + paths: + cc: /usr/bin/clang + cxx: /usr/bin/clang++ + f77: /usr/bin/gfortran + fc: /usr/bin/gfortran + spec: clang@4.0.0 + target: x86_64 diff --git a/scripts/uberenv/spack_configs/docker/packages.yaml b/scripts/uberenv/spack_configs/docker/packages.yaml new file mode 100644 index 0000000000..9b43d480df --- /dev/null +++ b/scripts/uberenv/spack_configs/docker/packages.yaml @@ -0,0 +1,79 @@ + +# ------------------------------------------------------------------------- +# This file controls default concretization preferences for Spack. +# +# Settings here are versioned with Spack and are intended to provide +# sensible defaults out of the box. Spack maintainers should edit this +# file to keep it current. +# +# Users can override these settings by editing the following files. +# +# Per-spack-instance settings (overrides defaults): +# $SPACK_ROOT/etc/spack/packages.yaml +# +# Per-user settings (overrides default and site settings): +# ~/.spack/packages.yaml +# ------------------------------------------------------------------------- +packages: + all: + compiler: [gcc, intel, pgi, clang, xl, nag] + providers: + awk: [gawk] + blas: [openblas] + daal: [intel-daal] + elf: [elfutils] + golang: [gcc] + ipp: [intel-ipp] + java: [jdk] + lapack: [openblas] + mkl: [intel-mkl] + mpe: [mpe2] + mpi: [mpich] + opencl: [pocl] + openfoam: [openfoam-com, openfoam-org, foam-extend] + pil: [py-pillow] + scalapack: [netlib-scalapack] + szip: [libszip, libaec] + tbb: [intel-tbb] + jpeg: [libjpeg-turbo, libjpeg] +# Spack may grab for mpi & we don't want to use them + charm: + buildable: False + mpilander: + buildable: False +# System level packages to not build + autotools: + paths: + autotools: /usr/bin/ + buildable: False + bzip2: + paths: + bzip2: /usr/bin/ + buildable: False + gettext: + paths: + gettext: /usr/bin/ + buildable: False + m4: + paths: + m4: /usr/bin/ + buildable: False + pkg-config: + paths: + pkg-config: /usr/bin/ + buildable: False + tar: + paths: + tar: /usr/bin/ + buildable: False + graphviz: + paths: + graphviz: /usr/bin/ + buildable: False + raja: + paths: + raja: /usr/local/share/raja/cmake + buildable: False +# Globally lock in version of CMake + cmake: + version: [3.10.1] From cd7c3243acfcb096d518200ccdfcbef76ceffdef Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 6 Feb 2020 10:24:39 -0800 Subject: [PATCH 004/632] ENH: use CudaKernelFixed and tread_direct policies Raja changed the way cuda kernel launch bounds are calculated, which was leading to a large number of threads being launched in the way policies were defined previously. The large number of threads was bloating the number of registers being used leading to a linking error due max reg count violation. Fixed that by using Raja CudaKernelFixed in conjuction with the "thread direct" policies. --- .../execution/internal/structured_exec.hpp | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/axom/mint/execution/internal/structured_exec.hpp b/src/axom/mint/execution/internal/structured_exec.hpp index d1fc231947..bbd9b2845d 100644 --- a/src/axom/mint/execution/internal/structured_exec.hpp +++ b/src/axom/mint/execution/internal/structured_exec.hpp @@ -97,11 +97,11 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, SYNCHRONOUS > > /* *INDENT-OFF* */ using loop2d_policy = RAJA::KernelPolicy< - RAJA::statement::CudaKernel< + RAJA::statement::CudaKernelFixed< 256, RAJA::statement::Tile<1, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_y_loop, RAJA::statement::Tile<0, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_x_loop, - RAJA::statement::For<1, RAJA::cuda_thread_y_loop, - RAJA::statement::For<0, RAJA::cuda_thread_x_loop, + RAJA::statement::For<1, RAJA::cuda_thread_y_direct, + RAJA::statement::For<0, RAJA::cuda_thread_x_direct, RAJA::statement::Lambda<0> > > @@ -111,13 +111,13 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, SYNCHRONOUS > > >; using loop3d_policy = RAJA::KernelPolicy< - RAJA::statement::CudaKernel< - RAJA::statement::Tile<2, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_z_loop, + RAJA::statement::CudaKernelFixed< 256, + RAJA::statement::Tile<2, RAJA::statement::tile_fixed<4>, RAJA::cuda_block_z_loop, RAJA::statement::Tile<1, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_y_loop, RAJA::statement::Tile<0, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_x_loop, - RAJA::statement::For<2, RAJA::cuda_thread_z_loop, - RAJA::statement::For<1, RAJA::cuda_thread_y_loop, - RAJA::statement::For<0, RAJA::cuda_thread_x_loop, + RAJA::statement::For<2, RAJA::cuda_thread_z_direct, + RAJA::statement::For<1, RAJA::cuda_thread_y_direct, + RAJA::statement::For<0, RAJA::cuda_thread_x_direct, RAJA::statement::Lambda<0> > > @@ -138,11 +138,11 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, ASYNC > > /* *INDENT-OFF* */ using loop2d_policy = RAJA::KernelPolicy < - RAJA::statement::CudaKernelAsync< + RAJA::statement::CudaKernelFixedAsync< 256, RAJA::statement::Tile<1, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_y_loop, RAJA::statement::Tile<0, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_x_loop, - RAJA::statement::For<1, RAJA::cuda_thread_y_loop, - RAJA::statement::For<0, RAJA::cuda_thread_x_loop, + RAJA::statement::For<1, RAJA::cuda_thread_y_direct, + RAJA::statement::For<0, RAJA::cuda_thread_x_direct, RAJA::statement::Lambda<0> > > @@ -152,13 +152,13 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, ASYNC > > >; using loop3d_policy = RAJA::KernelPolicy< - RAJA::statement::CudaKernelAsync< - RAJA::statement::Tile<2, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_z_loop, + RAJA::statement::CudaKernelFixedAsync< 256, + RAJA::statement::Tile<2, RAJA::statement::tile_fixed<4>, RAJA::cuda_block_z_loop, RAJA::statement::Tile<1, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_y_loop, RAJA::statement::Tile<0, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_x_loop, - RAJA::statement::For<2, RAJA::cuda_thread_z_loop, - RAJA::statement::For<1, RAJA::cuda_thread_y_loop, - RAJA::statement::For<0, RAJA::cuda_thread_x_loop, + RAJA::statement::For<2, RAJA::cuda_thread_z_direct, + RAJA::statement::For<1, RAJA::cuda_thread_y_direct, + RAJA::statement::For<0, RAJA::cuda_thread_x_direct, RAJA::statement::Lambda<0> > > From 5b9f435e32c7dcb9a0913cc20396c02fc1fab018 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 6 Feb 2020 12:09:15 -0800 Subject: [PATCH 005/632] ENH: store cuda kernel settings in constexpr vars Don't hard-code cuda kernel parameter settings, store them in constexpr variables settings instead. --- .../execution/internal/structured_exec.hpp | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/axom/mint/execution/internal/structured_exec.hpp b/src/axom/mint/execution/internal/structured_exec.hpp index bbd9b2845d..cba91dbc4c 100644 --- a/src/axom/mint/execution/internal/structured_exec.hpp +++ b/src/axom/mint/execution/internal/structured_exec.hpp @@ -88,6 +88,17 @@ struct structured_exec< OMP_EXEC > }; #endif +// CUDA Kernel settings: +// +// CudaKernel launches 256 threads total +// - In 2D, the launch configuration is 16 x 16 +// - In 3D, the launch configuration is 8 x 8 x 4 +constexpr int CUDA_KERNEL_FIXED_SIZE = 256; +constexpr int TILE_SIZE_2D = 16; +constexpr int TILE_SIZE_X = 8; +constexpr int TILE_SIZE_Y = 8; +constexpr int TILE_SIZE_Z = 4; + //--------------------------------------------------------| CUDA_EXEC |--------- #if defined(AXOM_USE_CUDA) && defined(AXOM_USE_RAJA) @@ -97,9 +108,9 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, SYNCHRONOUS > > /* *INDENT-OFF* */ using loop2d_policy = RAJA::KernelPolicy< - RAJA::statement::CudaKernelFixed< 256, - RAJA::statement::Tile<1, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_y_loop, - RAJA::statement::Tile<0, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_x_loop, + RAJA::statement::CudaKernelFixed< CUDA_KERNEL_FIXED_SIZE, + RAJA::statement::Tile<1, RAJA::statement::tile_fixed< TILE_SIZE_2D >, RAJA::cuda_block_y_loop, + RAJA::statement::Tile<0, RAJA::statement::tile_fixed< TILE_SIZE_2D >, RAJA::cuda_block_x_loop, RAJA::statement::For<1, RAJA::cuda_thread_y_direct, RAJA::statement::For<0, RAJA::cuda_thread_x_direct, RAJA::statement::Lambda<0> @@ -111,10 +122,10 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, SYNCHRONOUS > > >; using loop3d_policy = RAJA::KernelPolicy< - RAJA::statement::CudaKernelFixed< 256, - RAJA::statement::Tile<2, RAJA::statement::tile_fixed<4>, RAJA::cuda_block_z_loop, - RAJA::statement::Tile<1, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_y_loop, - RAJA::statement::Tile<0, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_x_loop, + RAJA::statement::CudaKernelFixed< CUDA_KERNEL_FIXED_SIZE, + RAJA::statement::Tile<2, RAJA::statement::tile_fixed< TILE_SIZE_Z >, RAJA::cuda_block_z_loop, + RAJA::statement::Tile<1, RAJA::statement::tile_fixed< TILE_SIZE_Y >, RAJA::cuda_block_y_loop, + RAJA::statement::Tile<0, RAJA::statement::tile_fixed< TILE_SIZE_X >, RAJA::cuda_block_x_loop, RAJA::statement::For<2, RAJA::cuda_thread_z_direct, RAJA::statement::For<1, RAJA::cuda_thread_y_direct, RAJA::statement::For<0, RAJA::cuda_thread_x_direct, @@ -138,9 +149,9 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, ASYNC > > /* *INDENT-OFF* */ using loop2d_policy = RAJA::KernelPolicy < - RAJA::statement::CudaKernelFixedAsync< 256, - RAJA::statement::Tile<1, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_y_loop, - RAJA::statement::Tile<0, RAJA::statement::tile_fixed<16>, RAJA::cuda_block_x_loop, + RAJA::statement::CudaKernelFixedAsync< CUDA_KERNEL_FIXED_SIZE, + RAJA::statement::Tile<1, RAJA::statement::tile_fixed< TILE_SIZE_2D >, RAJA::cuda_block_y_loop, + RAJA::statement::Tile<0, RAJA::statement::tile_fixed< TILE_SIZE_2D >, RAJA::cuda_block_x_loop, RAJA::statement::For<1, RAJA::cuda_thread_y_direct, RAJA::statement::For<0, RAJA::cuda_thread_x_direct, RAJA::statement::Lambda<0> @@ -152,10 +163,10 @@ struct structured_exec< CUDA_EXEC< BLOCK_SIZE, ASYNC > > >; using loop3d_policy = RAJA::KernelPolicy< - RAJA::statement::CudaKernelFixedAsync< 256, - RAJA::statement::Tile<2, RAJA::statement::tile_fixed<4>, RAJA::cuda_block_z_loop, - RAJA::statement::Tile<1, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_y_loop, - RAJA::statement::Tile<0, RAJA::statement::tile_fixed<8>, RAJA::cuda_block_x_loop, + RAJA::statement::CudaKernelFixedAsync< CUDA_KERNEL_FIXED_SIZE, + RAJA::statement::Tile<2, RAJA::statement::tile_fixed< TILE_SIZE_Z >, RAJA::cuda_block_z_loop, + RAJA::statement::Tile<1, RAJA::statement::tile_fixed< TILE_SIZE_Y >, RAJA::cuda_block_y_loop, + RAJA::statement::Tile<0, RAJA::statement::tile_fixed< TILE_SIZE_X >, RAJA::cuda_block_x_loop, RAJA::statement::For<2, RAJA::cuda_thread_z_direct, RAJA::statement::For<1, RAJA::cuda_thread_y_direct, RAJA::statement::For<0, RAJA::cuda_thread_x_direct, From 5ed7c59057e4bd094609df92fee0497145b8be6f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 6 Feb 2020 12:44:13 -0800 Subject: [PATCH 006/632] DOC: document cuda kernel policy usage fix --- RELEASE-NOTES.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index b12d731067..22795f5663 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -7,6 +7,25 @@ The format of this file is based on [Keep a Changelog](http://keepachangelog.com The Axom project release numbers follow [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] - Release date yyyy-mm-dd + +### Added + +### Removed + +### Deprecated + +### Changed + +### Fixed +- Fixed usage of cuda kernel policies in Mint. Raja v0.11.0 changed the way max threads + launch bounds is calculated. Consequently, a large number of threads was being launched + leading to max registry count violation when linking. We are now using fixed kernel size + of 256 threads (16x16 in 2D and 8x8x4 in 3D). + +### Known Bugs + + ## [Version 0.3.3] - Release date 2020-01-31 ### Added From 36f7faa07dca42cff3178910f2d6a5ef3d8ed205 Mon Sep 17 00:00:00 2001 From: keithhealy <50376825+keithhealy@users.noreply.github.com> Date: Mon, 10 Feb 2020 17:03:38 -0800 Subject: [PATCH 007/632] Set boolean option so job fails when tests fail Setting the option 'failTaskOnFailedTests' of the PublishTestResults task to true will cause that task to be marked as failed when any tests fail. This address the confusion caused when all the Azure build and test tasks fail (and show as green) when one or more tests has failed. --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9dd66635a5..350262608f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -102,3 +102,4 @@ steps: testResultsFormat: 'cTest' testResultsFiles: '**/Test.xml' testRunTitle: '$(TEST_TARGET) Tests' + failTaskOnFailedTests: true From c1ca68744f57265c488d86ee63546a15ccb1749c Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 18 Feb 2020 16:55:16 -0800 Subject: [PATCH 008/632] Fixes CI tests of sidre_lulesh by reducing number of MPI tasks (#167) --- src/axom/sidre/examples/lulesh2/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axom/sidre/examples/lulesh2/CMakeLists.txt b/src/axom/sidre/examples/lulesh2/CMakeLists.txt index c949b5b551..6913dfbe81 100644 --- a/src/axom/sidre/examples/lulesh2/CMakeLists.txt +++ b/src/axom/sidre/examples/lulesh2/CMakeLists.txt @@ -37,12 +37,12 @@ blt_add_executable( if(AXOM_ENABLE_TESTS) if(ENABLE_MPI) blt_add_test(NAME sidre_lulesh2 - COMMAND sidre_lulesh2_ex -s 5 - NUM_MPI_TASKS 8 + COMMAND sidre_lulesh2_ex + NUM_MPI_TASKS 1 NUM_OMP_THREADS 2 ) else() blt_add_test(NAME sidre_lulesh2 - COMMAND sidre_lulesh2_ex -s 5 + COMMAND sidre_lulesh2_ex NUM_OMP_THREADS 2 ) endif() endif() From 8b503b3962f876a98ebd4db95f6334f97c34dd53 Mon Sep 17 00:00:00 2001 From: Chris White Date: Mon, 3 Feb 2020 15:50:08 -0800 Subject: [PATCH 009/632] Upgrade Uberenv/Spack, Move to unified axom spack package that can go into Spack proper, Use exported RAJA targets, Remove OpenMP flags from imported TPL targets --- scripts/llnl_scripts/build_src.py | 2 +- scripts/llnl_scripts/llnl_lc_build_tools.py | 40 +- .../{uberenv-axom => axom}/package.py | 285 +++---- scripts/uberenv/packages/cmake/package.py | 147 ---- scripts/uberenv/packages/py-numpy/packages.py | 59 -- scripts/uberenv/packages/py-shroud/package.py | 12 +- scripts/uberenv/packages/raja/package.py | 40 +- .../packages/uberenv-axom/uberenv-axom.tar.gz | Bin 1536 -> 0 bytes scripts/uberenv/packages/umpire/package.py | 49 +- scripts/uberenv/project.json | 7 +- scripts/uberenv/spack_configs/config.yaml | 1 - .../toss_3_x86_64_ib/packages.yaml | 94 ++- scripts/uberenv/specs.json | 4 - scripts/uberenv/uberenv.py | 749 +++++++++++------- src/axom/core/CMakeLists.txt | 2 +- src/axom/core/tests/CMakeLists.txt | 2 +- src/axom/mint/CMakeLists.txt | 2 +- src/axom/mint/examples/CMakeLists.txt | 2 +- src/axom/mint/tests/CMakeLists.txt | 2 +- src/axom/spin/CMakeLists.txt | 2 +- src/axom/spin/examples/CMakeLists.txt | 3 - src/axom/spin/tests/CMakeLists.txt | 2 +- src/cmake/thirdparty/FindRAJA.cmake | 7 +- .../thirdparty/SetupAxomThirdParty.cmake | 29 +- src/thirdparty/tests/CMakeLists.txt | 2 +- 25 files changed, 799 insertions(+), 745 deletions(-) rename scripts/uberenv/packages/{uberenv-axom => axom}/package.py (67%) delete mode 100644 scripts/uberenv/packages/cmake/package.py delete mode 100644 scripts/uberenv/packages/py-numpy/packages.py delete mode 100644 scripts/uberenv/packages/uberenv-axom/uberenv-axom.tar.gz diff --git a/scripts/llnl_scripts/build_src.py b/scripts/llnl_scripts/build_src.py index 710bf221ab..f65976d4fe 100755 --- a/scripts/llnl_scripts/build_src.py +++ b/scripts/llnl_scripts/build_src.py @@ -71,7 +71,7 @@ def main(): original_wd = os.getcwd() os.chdir(repo_dir) timestamp = get_timestamp() - res = build_and_test_host_configs(repo_dir, job_name, timestamp) + res = build_and_test_host_configs(repo_dir, job_name, timestamp, False) # Archive logs if opts["archive"] != "": diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 5e4eacf543..2447e9db9e 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -270,10 +270,27 @@ def uberenv_install_tpls(prefix,spec,mirror = None): res = sexe(cmd, echo=True, output_file = spack_tpl_build_log) + + # Move files generated by spack in source directory to TPL install directory + repo_dir = get_repo_dir() + for file in ["spack-build-env.txt", "spack-build-out.txt"]: + src = pjoin(repo_dir, file) + dst = pjoin(prefix, "{0}-{1}".format(spec.replace(" ", "_"),file)) + if os.path.exists(src) and not os.path.exists(dst): + shutil.move(src, dst) + + # Copy generated host-configs into TPL install directory + host_configs = get_host_configs_for_current_machine(repo_dir, True) + for host_config in host_configs: + dst = pjoin(prefix, os.path.basename(host_config)) + if os.path.exists(host_config) and not os.path.exists(dst): + shutil.copy2(host_config, dst) + if res != 0: log_failure(prefix,"[ERROR: uberenv/spack build of spec: %s failed]" % spec) return res + ############################################################ # helpers for testing a set of host configs ############################################################ @@ -369,8 +386,8 @@ def build_and_test_host_config(test_root,host_config): return 0 -def build_and_test_host_configs(prefix, job_name, timestamp): - host_configs = get_host_configs_for_current_machine(prefix) +def build_and_test_host_configs(prefix, job_name, timestamp, use_generated_host_configs): + host_configs = get_host_configs_for_current_machine(prefix, use_generated_host_configs) if len(host_configs) == 0: log_failure(prefix,"[ERROR: No host configs found at %s]" % prefix) return 1 @@ -476,8 +493,9 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): return res else: print "[SUCCESS: Finished build tpls for spec %s]\n" % spec + # build the axom against the new tpls - res = build_and_test_host_configs(prefix, job_name, timestamp) + res = build_and_test_host_configs(prefix, job_name, timestamp, True) if res != 0: print "[ERROR: build and test of axom vs tpls test failed.]\n" else: @@ -489,21 +507,15 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): return res -def get_host_configs_for_current_machine(src_dir): +def get_host_configs_for_current_machine(src_dir, use_generated_host_configs): host_configs = [] - # Note: This function is called in two situations: - # (1) To test the checked-in host-configs from a source dir - # In that case, check the 'host-configs' directory - # (2) To test the uberenv-generated host-configs - # In that case, host-configs should be in src_dir - - host_configs_dir = pjoin(src_dir, "host-configs") - if not os.path.isdir(host_configs_dir): - host_configs_dir = src_dir + # Generated host-configs will be at the base of the source repository + host_configs_dir = src_dir + if not use_generated_host_configs: + host_configs_dir = pjoin(src_dir, "host-configs") hostname_base = get_machine_name() - host_configs = glob.glob(pjoin(host_configs_dir, hostname_base + "*.cmake")) return host_configs diff --git a/scripts/uberenv/packages/uberenv-axom/package.py b/scripts/uberenv/packages/axom/package.py similarity index 67% rename from scripts/uberenv/packages/uberenv-axom/package.py rename to scripts/uberenv/packages/axom/package.py index 2bb4c10b98..31251549b6 100644 --- a/scripts/uberenv/packages/uberenv-axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -1,3 +1,8 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + from spack import * import socket @@ -5,16 +10,20 @@ import platform from os.path import join as pjoin +import llnl.util.tty as tty + def cmake_cache_entry(name, value, comment=""): """Generate a string for a cmake cache variable""" return 'set(%s "%s" CACHE PATH "%s")\n\n' % (name,value,comment) + def cmake_cache_option(name, boolean_value, comment=""): """Generate a string for a cmake configuration option""" value = "ON" if boolean_value else "OFF" return 'set(%s %s CACHE BOOL "%s")\n\n' % (name,value,comment) + def get_spec_path(spec, package_name, path_replacements = {}, use_bin = False) : """Extracts the prefix path for the given spack package path_replacements is a dictionary with string replacements for the path. @@ -31,48 +40,62 @@ def get_spec_path(spec, package_name, path_replacements = {}, use_bin = False) : return path -class UberenvAxom(Package): - """Spack Based Uberenv Build for Axom TPLs """ - - # hash for dummy tarfile - version('0.1', '8d378ef62dedc2df5db447b029b71200') +class Axom(Package): + """Axom provides a robust, flexible software infrastructure for the development + of multi-physics applications and computational tools.""" - homepage = "http://lc.llnl.gov/axom" + maintainers = ['white238'] - # variants that allow us to winnow what TPLS we build - variant('devtools', default=False, description="Build development tools (such as sphinx, uncrustify, etc)") + homepage = "https://github.com/LLNL/axom" + url = "https://github.com/LLNL/axom/releases/download/v0.3.2/Axom-v0.3.2.tar.gz" + git = "https://github.com/LLNL/axom.git" - # use ~cmake to skip cmake build and use whatever cmake is in the - # users path - # (given the pain of building cmake on BGQ, this is really only for BGQ) - variant('cmake', default=True, description="Build cmake.") + version('develop', branch='develop', submodules=True, preferred=True) - variant("python", default=False, description="Build python") - variant("mpi", default=True, description="Build MPI support") - variant("mfem", default=True, description="Build mfem") + version('0.3.2', sha256='0acbbf0de7154cbd3a204f91ce40f4b756b17cd5a92e75664afac996364503bd') + version('0.3.1', sha256='fad9964c32d7f843aa6dd144c32a8de0a135febd82a79827b3f24d7665749ac5') - variant("hdf5", default=True, description="Build hdf5") + phases = ["hostconfig", "configure", "build", "install"] - variant("scr", default=False, description="Build SCR") + #----------------------------------------------------------------------- + # Variants + #----------------------------------------------------------------------- + variant('debug', default=False, + description='Build debug instead of optimized version') - variant("raja", default=True, description="Build raja") + variant('devtools', default=False, + description="Build development tools (such as sphinx, uncrustify, etc)") - variant("umpire", default=True, description="Build umpire") - - variant("cuda", default=False, description="Turn on cuda support.") - - variant('openmp', default=True, description='Turn on openmp support.') + variant("python", default=False, description="Build python support") + variant("mpi", default=True, description="Build MPI support") + variant("cuda", default=False, description="Turn on CUDA support.") + variant('openmp', default=True, description='Turn on OpenMP support.') + + variant("mfem", default=False, description="Build with mfem") + variant("hdf5", default=True, description="Build with hdf5") + variant("scr", default=False, description="Build with SCR") + variant("raja", default=True, description="Build with raja") + variant("umpire", default=True, description="Build with umpire") + + #----------------------------------------------------------------------- + # Dependencies + #----------------------------------------------------------------------- + # Basics + depends_on("cmake@3.8.2:", type='build') depends_on("cuda", when="+cuda") + depends_on("mpi", when="+mpi") - depends_on("hdf5~cxx~shared~fortran", when="+hdf5") + # Libraries + depends_on("conduit~shared+python", when="+python") + depends_on("conduit~shared~python", when="~python") + depends_on("conduit~shared+hdf5+python", when="+hdf5+python") + depends_on("conduit~shared~hdf5+python", when="~hdf5+python") + depends_on("conduit~shared+hdf5~python", when="+hdf5~python") + depends_on("conduit~shared~hdf5~python", when="~hdf5~python") - depends_on("conduit~shared+python",when="+python") - depends_on("conduit~shared~python",when="~python") - depends_on("conduit~shared+hdf5+python",when="+hdf5+python") - depends_on("conduit~shared~hdf5+python",when="~hdf5+python") - depends_on("conduit~shared+hdf5~python",when="+hdf5~python") - depends_on("conduit~shared~hdf5~python",when="~hdf5~python") + # HDF5 needs to be the same as Conduit's + depends_on("hdf5@1.8.19:1.8.999~mpi~cxx~shared~fortran", when="+hdf5") depends_on("scr", when="+scr") @@ -86,43 +109,44 @@ class UberenvAxom(Package): depends_on("umpire~openmp+cuda", when="+umpire~openmp+cuda") depends_on("umpire+openmp+cuda", when="+umpire+openmp+cuda") - # builds serial version of mfem that does not depend on Sidre - depends_on("mfem~hypre~metis~mpi~gzstream", when="+mfem") + #depends_on("mfem~mpi", when="+mfem") + depends_on("mfem~mpi~hypre~metis~gzstream", when="+mfem") - # optional tpl builds + depends_on("python", when="+python") - # NOTE: Due to spack defaulting to the newest version given in a package - # The version of CMake is controlled in the /packages.yaml file. - # This is a problem when multiple packages depend on another package and - # the required (or not required) versions don't match - depends_on("cmake", when="+cmake") - - if "darwin" in platform.system().lower(): - depends_on("mpich@3.0.4", when="+mpi") - depends_on("openssl@1.0.2j") + # Devtools + depends_on("python", when="+devtools") + depends_on("doxygen", when="+devtools") + depends_on("uncrustify@0.61", when="+devtools") + depends_on("cppcheck", when="+devtools") + depends_on("graphviz", when="+devtools") + depends_on("py-sphinx", when="+devtools") + depends_on("py-shroud", when="+devtools") - depends_on("python", when="+devtools") - depends_on("doxygen", when="+devtools") - depends_on("uncrustify@0.61",when="+devtools") - depends_on("cppcheck",when="+devtools") - depends_on("graphviz",when="+devtools") - depends_on("python", when="+python") + def _get_sys_type(self, spec): + sys_type = spec.architecture + # if on llnl systems, we can use the SYS_TYPE + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type - depends_on("py-sphinx", when="+devtools") - depends_on("py-shroud", when="+devtools") - depends_on("mpi",when="+mpi") + def _get_host_config_path(self, spec): + host_config_path = "%s-%s-%s.cmake" % (socket.gethostname().rstrip('1234567890'), + self._get_sys_type(spec), + spec.compiler) + #dest_dir = env["SPACK_DEBUG_LOG_DIR"] + dest_dir = self.stage.source_path + host_config_path = os.path.abspath(pjoin(dest_dir, host_config_path)) + return host_config_path - # use dummy tarfile to avoid downloads - def url_for_version(self, version): - dummy_tar_path = os.path.abspath(pjoin(os.path.dirname(__file__))) - dummy_tar_path = pjoin(dummy_tar_path,"uberenv-axom.tar.gz") - url = "file://" + dummy_tar_path - return url + def hostconfig(self, spec, prefix): + """ + This method creates a 'host-config' file that specifies + all of the options used to configure and build Axom. + """ - def install(self, spec, prefix): - dest_dir = env["SPACK_DEBUG_LOG_DIR"] c_compiler = env["SPACK_CC"] cpp_compiler = env["SPACK_CXX"] f_compiler = None @@ -134,13 +158,9 @@ def install(self, spec, prefix): if os.path.isfile(env["SPACK_FC"]): f_compiler = env["SPACK_FC"] - sys_type = spec.architecture - # if on llnl systems, we can use the SYS_TYPE - if env.has_key("SYS_TYPE"): - sys_type = env["SYS_TYPE"] # are we on a specific machine - on_bgq = 'bgq' in sys_type + sys_type = self._get_sys_type(spec) on_blueos = 'blueos' in sys_type on_blueos_p9 = 'p9' in sys_type on_toss = 'toss_3' in sys_type @@ -155,9 +175,8 @@ def install(self, spec, prefix): crash() cmake_exe = cmake_exe.command - host_cfg_fname = "%s-%s-%s.cmake" % (socket.gethostname().rstrip('1234567890'),sys_type,spec.compiler) - host_cfg_fname = pjoin(dest_dir,host_cfg_fname) - cfg = open(host_cfg_fname,"w") + host_config_path = self._get_host_config_path(spec) + cfg = open(host_config_path,"w") cfg.write("#------------------{}\n".format("-"*60)) cfg.write("# !!!! This is a generated file, edit at own risk !!!!\n") cfg.write("#------------------{}\n".format("-"*60)) @@ -178,24 +197,12 @@ def install(self, spec, prefix): cfg.write("# Compilers\n") cfg.write("#------------------{}\n\n".format("-"*60)) - if on_bgq: - cfg.write("# Note: we build TPLs with the serial compiler then use MPI wrappers on bgq\n") - cfg.write("# Serial compilers used by spack:\n") - cfg.write("# C compiler: {0}\n".format(c_compiler)) - cfg.write("# C++ compiler: {0}\n\n".format(cpp_compiler)) - cfg.write(cmake_cache_entry("CMAKE_C_COMPILER", spec['mpi'].prefix.bin.mpiclang)) - cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", spec['mpi'].prefix.bin.mpiclang + "++")) - else: - cfg.write("# C compiler used by spack\n") - cfg.write(cmake_cache_entry("CMAKE_C_COMPILER",c_compiler)) - cfg.write("# C++ compiler used by spack\n") - cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER",cpp_compiler)) + cfg.write(cmake_cache_entry("CMAKE_C_COMPILER",c_compiler)) + cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER",cpp_compiler)) if f_compiler is None: - cfg.write("# No fortran compiler\n\n") cfg.write(cmake_cache_option("ENABLE_FORTRAN",False)) else: - cfg.write("# Fortran compiler used by spack\n") cfg.write(cmake_cache_option("ENABLE_FORTRAN",True)) cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER",f_compiler)) @@ -320,36 +327,27 @@ def install(self, spec, prefix): if "+mpi" in spec: cfg.write(cmake_cache_option("ENABLE_MPI", True)) - if on_bgq: - cfg.write(cmake_cache_option("ENABLE_FIND_MPI", False, - "Use wrapper directly to stop FindMPI returning the wrong linker flags.")) - cfg.write(cmake_cache_option("ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC", True, - "Ensures that tests will be wrapped with srun to run on the backend nodes")) - cfg.write(cmake_cache_entry("BLT_MPI_INCLUDES", - "/usr/local/tools/deg/drivers/V1R2M0/ppc64/comm/gcc/include", - "Pass in an explicit path to help find mpif.h")) - else: - cfg.write(cmake_cache_entry("MPI_C_COMPILER", spec['mpi'].mpicc)) - cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", spec['mpi'].mpicxx)) - if on_blueos or on_blueos_p9: - # clang doesn't come with a fortran wrapper on blueos - - # blueos_p9 - spectrum_prefix = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release" - if spec['mpi'].mpifc == spectrum_prefix + "-clang-8.0.0/bin/mpif90": - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spectrum_prefix + "-xl-2019.06.12/bin/mpif90")) - elif spec['mpi'].mpifc == spectrum_prefix + "-clang-upstream-2019.03.26/bin/mpif90": - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spectrum_prefix + "-xl-2019.06.12/bin/mpif90")) - # blueos - elif spec['mpi'].mpifc == spectrum_prefix + "-clang-upstream-2018.11.09/bin/mpif90": - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spectrum_prefix + "-xl-2018.11.26/bin/mpif90")) - else: - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) + cfg.write(cmake_cache_entry("MPI_C_COMPILER", spec['mpi'].mpicc)) + cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", spec['mpi'].mpicxx)) + if on_blueos or on_blueos_p9: + # clang doesn't come with a fortran wrapper on blueos + + # blueos_p9 + spectrum_prefix = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release" + if spec['mpi'].mpifc == spectrum_prefix + "-clang-8.0.0/bin/mpif90": + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", + spectrum_prefix + "-xl-2019.06.12/bin/mpif90")) + elif spec['mpi'].mpifc == spectrum_prefix + "-clang-upstream-2019.03.26/bin/mpif90": + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", + spectrum_prefix + "-xl-2019.06.12/bin/mpif90")) + # blueos + elif spec['mpi'].mpifc == spectrum_prefix + "-clang-upstream-2018.11.09/bin/mpif90": + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", + spectrum_prefix + "-xl-2018.11.26/bin/mpif90")) else: cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) + else: + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) # Determine MPIEXEC if on_blueos: @@ -384,26 +382,18 @@ def install(self, spec, prefix): cfg.write("# Other machine specifics\n") cfg.write("#------------------{}\n\n".format("-"*60)) - # Enable death tests everwhere but BGQ - if on_bgq or (on_blueos and "+cuda" in spec): + # OpenMP + if "+openmp" in spec: + cfg.write(cmake_cache_option("ENABLE_OPENMP", True)) + + # Enable death tests + if on_blueos and "+cuda" in spec: cfg.write(cmake_cache_option("ENABLE_GTEST_DEATH_TESTS", False)) else: cfg.write(cmake_cache_option("ENABLE_GTEST_DEATH_TESTS", True)) - # BGQ - if on_bgq: - if "xlf" in str(spec.compiler): - cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS", "-WF,-C!", - "Converts C-style comments to Fortran style in preprocessed files")) - - cfg.write("# Manually set up HDF5 library dependencies for BGQ to bypass errors from CMake's FindHDF5\n") - cfg.write(cmake_cache_entry("HDF5_C_LIBRARY_m", "-lm")) - cfg.write(cmake_cache_entry("HDF5_C_LIBRARY_dl", "-ldl")) - - cfg.write(cmake_cache_option("CMAKE_SKIP_RPATH", True)) - # BlueOS - elif on_blueos or on_blueos_p9: + if on_blueos or on_blueos_p9: if "xlf" in f_compiler: cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER_ID", "XL", "All of BlueOS compilers report clang due to nvcc, override to proper compiler family")) @@ -452,21 +442,46 @@ def install(self, spec, prefix): # TOSS3 elif on_toss: - if "gcc@4.9.3" == str(spec.compiler): - cfg.write(cmake_cache_entry("SCR_DIR", - "/usr/gapps/axom/thirdparty_libs/scr-1.2.1/toss_3_x86_64_ib/gcc-4.9.3")) - if ("gfortran" in f_compiler) and ("clang" in cpp_compiler): + clanglibdir = pjoin(os.path.dirname(os.path.dirname(cpp_compiler)), "lib") cfg.write(cmake_cache_entry("BLT_EXE_LINKER_FLAGS", - "-Wl,-rpath,/usr/tce/packages/clang/clang-6.0.0/lib", + "-Wl,-rpath,{0}".format(clanglibdir), "Adds a missing rpath for libraries associated with the fortran compiler")) - if "+openmp" in spec: - cfg.write(cmake_cache_option("ENABLE_OPENMP", True)) - cfg.write("\n") cfg.close() - mkdirp(prefix) - install(host_cfg_fname,prefix) - print "[result host-config file: %s]" % host_cfg_fname + tty.info("Spack generated Axom host-config file: " + host_config_path) + + + def configure(self, spec, prefix): + with working_dir('spack-build', create=True): + host_config_path = self._get_host_config_path(spec) + + cmake_args = [] + cmake_args.extend(std_cmake_args) + cmake_args.extend(["-C", host_config_path, "../src"]) + print("Configuring Axom...") + cmake(*cmake_args) + + def build(self, spec, prefix): + with working_dir('spack-build'): + print("Building Axom...") + make() + + + @run_after('build') + @on_package_attributes(run_tests=True) + def test(self): + with working_dir('spack-build'): + print("Running Axom's Unit Tests...") + make("test") + + + def install(self, spec, prefix): + with working_dir('spack-build'): + make("install") + # install copy of host config for provenance + print("Installing Axom's CMake Host Config File...") + host_config_path = self._get_host_config_path(spec) + install(host_config_path, prefix) diff --git a/scripts/uberenv/packages/cmake/package.py b/scripts/uberenv/packages/cmake/package.py deleted file mode 100644 index d1a0a9f61e..0000000000 --- a/scripts/uberenv/packages/cmake/package.py +++ /dev/null @@ -1,147 +0,0 @@ -############################################################################## -# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# -# This file is part of Spack. -# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. -# LLNL-CODE-647188 -# -# For details, see https://github.com/spack/spack -# Please also see the NOTICE and LICENSE files for our notice and the LGPL. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License (as -# published by the Free Software Foundation) version 2.1, February 1999. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and -# conditions of the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -############################################################################## -from spack import * - - -class Cmake(Package): - """A cross-platform, open-source build system. CMake is a family of - tools designed to build, test and package software.""" - homepage = 'https://www.cmake.org' - url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz' - list_url = 'https://cmake.org/files/' - list_depth = 1 - - version('3.11.4', '72e168b3bad2f9c34dcebbad7af56ff0') - version('3.11.3', '3f923154ed47128f13b08eacd207d9ee') - version('3.11.2', 'd2d554c05fc07cfae7846d2aa205f12a') - version('3.11.1', '12a3177477e4e2c7bc514193d421dafe') - version('3.11.0', 'f3ebc79b5dec85b49abe75958ffa1a03') - version('3.10.2', '732808e17fc14dc8cee50d51518c34eb') - version('3.10.1', '9a726e5ec69618b172aa4b06d18c3998') - version('3.10.0', 'f3f8e70ca3055f3cd288f89ff233057e') - version('3.9.6', '084b1c8b2efc1c1ba432dea37243c0ae') - version('3.9.4', '33769e001bdcd788f565bf378692e5ae') - version('3.9.0', '180e23b4c9b55915d271b315297f6951') - version('3.8.2', 'b5dff61f6a7f1305271ab3f6ae261419') - version('3.8.1', 'e8ef820ddf7a650845252bca846696e7') - version('3.8.0', 'f28cba717ba38ad82a488daed8f45b5b') - version('3.7.2', '79bd7e65cd81ea3aa2619484ad6ff25a') - version('3.7.1', 'd031d5a06e9f1c5367cdfc56fbd2a1c8') - version('3.6.1', 'd6dd661380adacdb12f41b926ec99545') - version('3.6.0', 'aa40fbecf49d99c083415c2411d12db9') - version('3.5.2', '701386a1b5ec95f8d1075ecf96383e02') - version('3.5.1', 'ca051f4a66375c89d1a524e726da0296') - version('3.5.0', '33c5d09d4c33d4ffcc63578a6ba8777e') - version('3.4.3', '4cb3ff35b2472aae70f542116d616e63') - version('3.4.0', 'cd3034e0a44256a0917e254167217fc8') - version('3.3.1', '52638576f4e1e621fed6c3410d3a1b12') - version('3.1.0', '188eb7dc9b1b82b363bc51c0d3f1d461') - version('3.0.2', 'db4c687a31444a929d2fdc36c4dfb95f') - version('2.8.10.2', '097278785da7182ec0aea8769d06860c') - - variant('ownlibs', default=True, description='Use CMake-provided third-party libraries') - variant('qt', default=False, description='Enables the build of cmake-gui') - variant('doc', default=False, description='Enables the generation of html and man page documentation') - variant('openssl', default=True, description="Enables CMake's OpenSSL features") - variant('ncurses', default=True, description='Enables the build of the ncurses gui') - - depends_on('curl', when='~ownlibs') - depends_on('expat', when='~ownlibs') - # depends_on('jsoncpp', when='~ownlibs') # circular dependency - depends_on('zlib', when='~ownlibs') - depends_on('bzip2', when='~ownlibs') - depends_on('xz', when='~ownlibs') - depends_on('libarchive', when='~ownlibs') - depends_on('libuv@1.0.0:', when='~ownlibs') - depends_on('rhash', when='@3.8.0:~ownlibs') - depends_on('qt', when='+qt') - depends_on('python@2.7.11:', when='+doc', type='build') - depends_on('py-sphinx', when='+doc', type='build') - depends_on('openssl', when='+openssl') - depends_on('openssl@:1.0.99', when='@:3.6.9+openssl') - depends_on('ncurses', when='+ncurses') - - # Cannot build with Intel, should be fixed in 3.6.2 - # https://gitlab.kitware.com/cmake/cmake/issues/16226 - patch('intel-c-gnu11.patch', when='@3.6.0:3.6.1') - - conflicts('+qt', when='^qt@5.4.0') # qt-5.4.0 has broken CMake modules - - phases = ['bootstrap', 'build', 'install'] - - def url_for_version(self, version): - """Handle CMake's version-based custom URLs.""" - url = 'https://cmake.org/files/v{0}/cmake-{1}.tar.gz' - return url.format(version.up_to(2), version) - - def bootstrap_args(self): - spec = self.spec - args = [ - '--prefix={0}'.format(self.prefix), - '--parallel={0}'.format(make_jobs) - ] - - if '+ownlibs' in spec: - # Build and link to the CMake-provided third-party libraries - args.append('--no-system-libs') - else: - # Build and link to the Spack-installed third-party libraries - args.append('--system-libs') - - if spec.satisfies('@3.2:'): - # jsoncpp requires CMake to build - # use CMake-provided library to avoid circular dependency - args.append('--no-system-jsoncpp') - - if '+qt' in spec: - args.append('--qt-gui') - else: - args.append('--no-qt-gui') - - if '+doc' in spec: - args.append('--sphinx-html') - args.append('--sphinx-man') - - if '+openssl' in spec: - args.append('--') - args.append('-DCMAKE_USE_OPENSSL=ON') - - return args - - def bootstrap(self, spec, prefix): - bootstrap = Executable('./bootstrap') - bootstrap(*self.bootstrap_args()) - - def build(self, spec, prefix): - make() - - @run_after('build') - @on_package_attributes(run_tests=True) - def test(self): - # Some tests fail, takes forever - make('test') - - def install(self, spec, prefix): - make('install') diff --git a/scripts/uberenv/packages/py-numpy/packages.py b/scripts/uberenv/packages/py-numpy/packages.py deleted file mode 100644 index 715a88f198..0000000000 --- a/scripts/uberenv/packages/py-numpy/packages.py +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################### -# Copyright (c) 2014-2016, Lawrence Livermore National Security, LLC. -# -# Produced at the Lawrence Livermore National Laboratory -# -# LLNL-CODE-666778 -# -# All rights reserved. -# -# This file is part of Conduit. -# -# For details, see: http://software.llnl.gov/conduit/. -# -# Please also read conduit/LICENSE -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the disclaimer below. -# -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the disclaimer (as noted below) in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the LLNS/LLNL nor the names of its contributors may -# be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, -# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################### -from spack import * - -class PyNumpy(Package): - """array processing for numbers, strings, records, and objects.""" - homepage = "https://pypi.python.org/pypi/numpy" - url = "https://pypi.python.org/packages/source/n/numpy/numpy-1.9.1.tar.gz" - - version('1.11.0', 'bc56fb9fc2895aa4961802ffbdb31d0b') - version('1.9.1', '78842b73560ec378142665e712ae4ad9') - - extends('python') - depends_on("py-setuptools") - - def install(self, spec, prefix): - # don't - python('setup.py', 'install') diff --git a/scripts/uberenv/packages/py-shroud/package.py b/scripts/uberenv/packages/py-shroud/package.py index 7eba048c4e..b17c8a0cf9 100644 --- a/scripts/uberenv/packages/py-shroud/package.py +++ b/scripts/uberenv/packages/py-shroud/package.py @@ -5,12 +5,14 @@ class PyShroud(Package): """Create Fortran wrappers for a C++ library.""" homepage = "https://github.com/LLNL/shroud" - url = "https://github.com/LLNL/shroud/archive/v0.10.1.tar.gz" + git = "https://github.com/LLNL/shroud.git" - version('0.10.1', '1469d1c506a4de6eba9d6dbd950645d1') - version('0.10.0', 'c76bc9b1228d53ed0aabeb5806a486c7') - version('0.9.0', 'f6a5ce0602a0c2d1d47de78c04ab302c') - version('0.8.0', 'ec94d6f9cf3246d4370007abd4d270d8') + version('develop', branch='develop') + version('master', branch='master') + version('0.11.0', tag='v0.11.0') + version('0.10.1', tag='v0.10.1') + version('0.9.0', tag='v0.9.0') + version('0.8.0', tag='v0.8.0') extends('python') diff --git a/scripts/uberenv/packages/raja/package.py b/scripts/uberenv/packages/raja/package.py index 1e22b8c6b5..73a060c5e2 100644 --- a/scripts/uberenv/packages/raja/package.py +++ b/scripts/uberenv/packages/raja/package.py @@ -1,44 +1,46 @@ -# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * -import os class Raja(CMakePackage): """RAJA Parallel Framework.""" homepage = "http://software.llnl.gov/RAJA/" - url="https://github.com/LLNL/RAJA/releases/download/v0.11.0/RAJA-v0.11.0.tar.gz" - - version('0.11.0', '2ebeb23f99038072915940af28334079') - version('0.10.1','5d2f4e182cae0c72902c3f4d1b88ced6') - version('0.9.0', '9ff1b7d56bbb6ce4f86183be5b015fda') - version('0.7.0', '18b9654d75ee2f9278b3a8f19f9989fa') + git = "https://github.com/LLNL/RAJA.git" + + version('develop', branch='develop', submodules='True') + version('master', branch='master', submodules='True') + version('0.11.0', tag='v0.11.0', submodules="True") + version('0.10.1', tag='v0.10.1', submodules="True") + version('0.9.0', tag='v0.9.0', submodules="True") + version('0.8.0', tag='v0.8.0', submodules="True") + version('0.7.0', tag='v0.7.0', submodules="True") + version('0.6.0', tag='v0.6.0', submodules="True") + version('0.5.3', tag='v0.5.3', submodules="True") + version('0.5.2', tag='v0.5.2', submodules="True") + version('0.5.1', tag='v0.5.1', submodules="True") + version('0.5.0', tag='v0.5.0', submodules="True") + version('0.4.1', tag='v0.4.1', submodules="True") + version('0.4.0', tag='v0.4.0', submodules="True") variant('cuda', default=False, description='Build with CUDA backend') variant('openmp', default=True, description='Build OpenMP backend') depends_on('cuda', when='+cuda') - depends_on('cmake@3.3:', type='build') + depends_on('cmake@3.8:', type='build') + depends_on('cmake@3.9:', when='+cuda', type='build') def cmake_args(self): spec = self.spec options = [] - - if 'bgq' in os.getenv('SYS_TYPE', ""): - options.extend(['-DBLT_CXX_FLAGS=-stdlib=libc++']) - - if '+openmp' in spec: - options.extend([ - '-DENABLE_OPENMP=On']) - else: - options.extend([ - '-DENABLE_OPENMP=Off']) + options.append('-DENABLE_OPENMP={0}'.format( + 'On' if '+openmp' in spec else 'Off')) if '+cuda' in spec: options.extend([ diff --git a/scripts/uberenv/packages/uberenv-axom/uberenv-axom.tar.gz b/scripts/uberenv/packages/uberenv-axom/uberenv-axom.tar.gz deleted file mode 100644 index 88ad86806b5db1c01a002256d70f2970815c4f32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1536 zcmYezEhwqfE2$`9pdBzUFfcPQQD87MF*PwXK+r&O7*H@YGBq(WG&D0ZGgmM$G&V3d zWl%7nos$qImll^K7BLtYWF!_9Wfte>8Ji>INMS*Iq5w1r1QbZoI;wUw1V%$(Gz11B F1ORVP7LEV_ diff --git a/scripts/uberenv/packages/umpire/package.py b/scripts/uberenv/packages/umpire/package.py index 18a49bf917..b31e8e9692 100644 --- a/scripts/uberenv/packages/umpire/package.py +++ b/scripts/uberenv/packages/umpire/package.py @@ -1,10 +1,10 @@ -# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) + from spack import * -import os class Umpire(CMakePackage): @@ -12,32 +12,44 @@ class Umpire(CMakePackage): architectures""" homepage = 'https://github.com/LLNL/Umpire' - url='https://github.com/LLNL/Umpire/releases/download/v2.1.0/umpire-2.1.0.tar.gz' + git = 'https://github.com/LLNL/Umpire.git' - version('2.1.0', 'ec779f5a241c39a50d75eef1f248f61f') - version('2.0.0', '4ba1c960b16552e0a85f28c244a9c383') - version('1.0.0', '3435e9c9d48f2b05f838eb64fbf66d8e') - version('0.3.2', '2b4138fb4d4272de8c34c073b4c6e88c') + version('develop', branch='develop', submodules='True') + version('master', branch='master', submodules='True') + version('2.1.0', tag='v2.1.0', submodules='True') + version('2.0.0', tag='v2.0.0', submodules='True') + version('1.1.0', tag='v1.1.0', submodules='True') + version('1.0.1', tag='v1.0.1', submodules='True') + version('1.0.0', tag='v1.0.0', submodules='True') + version('0.3.5', tag='v0.3.5', submodules='True') + version('0.3.3', tag='v0.3.3', submodules='True') + version('0.3.2', tag='v0.3.2', submodules='True') + version('0.3.1', tag='v0.3.1', submodules='True') + version('0.3.0', tag='v0.3.0', submodules='True') + version('0.2.4', tag='v0.2.4', submodules='True') + version('0.2.3', tag='v0.2.3', submodules='True') + version('0.2.2', tag='v0.2.2', submodules='True') + version('0.2.1', tag='v0.2.1', submodules='True') + version('0.2.0', tag='v0.2.0', submodules='True') + version('0.1.4', tag='v0.1.4', submodules='True') + version('0.1.3', tag='v0.1.3', submodules='True') variant('cuda', default=False, description='Build with CUDA support') variant('fortran', default=False, description='Build C/Fortran API') - variant('openmp', default=True, description='Build with OpenMP support') + variant('numa', default=False, description='Enable NUMA support') + variant('openmp', default=False, description='Build with OpenMP support') depends_on('cuda', when='+cuda') - depends_on('cmake@3.3:', type='build') + depends_on('cmake@3.8:', type='build') + depends_on('cmake@3.9:', when='+cuda', type='build') + + conflicts('+numa', when='@:0.3.2') def cmake_args(self): spec = self.spec options = [] - if 'bgq' in os.getenv('SYS_TYPE', ""): - options.extend(['-DENABLE_BENCHMARKS:BOOL=OFF', - '-DENABLE_TESTS:BOOL=OFF', - '-DENABLE_EXAMPLES:BOOL=OFF', - '-DENABLE_OPENMP:BOOL=OFF', - '-DBLT_CXX_FLAGS=-stdlib=libc++']) - if '+cuda' in spec: options.extend([ '-DENABLE_CUDA=On', @@ -49,9 +61,10 @@ def cmake_args(self): if '+fortran' in spec: options.append('-DENABLE_FORTRAN=On') + if '+numa' in spec: + options.append('-DENABLE_NUMA=On') + if '+openmp' in spec: options.append('-DENABLE_OPENMP=On') - else: - options.append('-DENABLE_OPENMP=Off') return options diff --git a/scripts/uberenv/project.json b/scripts/uberenv/project.json index cf99edad0e..67554684bc 100644 --- a/scripts/uberenv/project.json +++ b/scripts/uberenv/project.json @@ -1,7 +1,10 @@ { "package_name" : "axom", -"uberenv_package_name" : "uberenv-axom", -"spack_commit": "729bed3fd3e7bd3ecabda3ab25525019f3f83661", +"package_version" : "develop", +"package_final_phase" : "hostconfig", +"package_source_dir" : "../..", +"spack_url": "https://github.com/spack/spack", +"spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6", "spack_activate" : {"py-sphinx" : ["+devtools"], "py-shroud" : ["+devtools"], "py-pyyaml" : ["+devtools"], diff --git a/scripts/uberenv/spack_configs/config.yaml b/scripts/uberenv/spack_configs/config.yaml index 45f7d191f7..962afe918f 100644 --- a/scripts/uberenv/spack_configs/config.yaml +++ b/scripts/uberenv/spack_configs/config.yaml @@ -29,7 +29,6 @@ config: module_roots: tcl: $spack/share/spack/modules lmod: $spack/share/spack/lmod - dotkit: $spack/share/spack/dotkit # Temporary locations Spack can try to use for builds. diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index 9385eb5e3a..6727cdc52f 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -18,74 +18,98 @@ packages: all: compiler: [gcc, intel, pgi, clang, xl, nag] providers: - awk: [gawk] - blas: [openblas] - daal: [intel-daal] - elf: [elfutils] - golang: [gcc] - ipp: [intel-ipp] - java: [jdk] - lapack: [openblas] - mkl: [intel-mkl] - mpe: [mpe2] + blas: [netlib-lapack] + lapack: [netlib-lapack] mpi: [mvapich2] - opencl: [pocl] - openfoam: [openfoam-com, openfoam-org, foam-extend] - pil: [py-pillow] - scalapack: [netlib-scalapack] - szip: [libszip, libaec] - tbb: [intel-tbb] - jpeg: [libjpeg-turbo, libjpeg] + # LLNL toss3 CUDA cuda: paths: - cuda@8.0: /opt/cudatoolkit-8.0 + cuda@10.2: /opt/cudatoolkit/10.2 buildable: False -# LLNL toss3 mvapich2 + +# Lock down which MPI we are using mvapich2: paths: - mvapich2@2.2%gcc@6.1.0 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.2-gcc-6.1.0 - mvapich2@2.2%gcc@7.3.0 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.2-gcc-7.3.0 - mvapich2@2.2%gcc@8.1.0 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.2-gcc-8.1.0 - mvapich2@2.2%intel@18.0.2 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.2-intel-18.0.2 - mvapich2@2.2%intel@19.0.0 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.2-intel-19.0.0 - mvapich2@2.3%clang@4.0.0 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-4.0.0 - mvapich2@2.3%clang@6.0.0 arch=linux-rhel7-x86_64: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-6.0.0 + mvapich2@2.3%gcc@6.1.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0 + mvapich2@2.3%gcc@7.3.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0 + mvapich2@2.3%gcc@8.1.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0 + mvapich2@2.3%intel@18.0.2 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2 + mvapich2@2.3%intel@19.0.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0 + mvapich2@2.3%clang@4.0.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-4.0.0 + mvapich2@2.3%clang@6.0.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-6.0.0 buildable: False # Spack may grab for mpi & we don't want to use them + openmpi: + buildable: False + mpich: + buildable: False + spectrum-mpi: + buildable: False + charmpp: + buildable: False charm: buildable: False + intel-mpi: + buildable: False + intel-parallel-studio: + buildable: False + fujitsu-mpi: + buildable: False mpilander: - buildable: False + buildable: False + mpt: + buildable: False + + # blas is a bit more complicated because its a virtual package so fake it with + # the following per spack docs + netlib-lapack: + paths: + netlib-lapack@3.6.1: /usr + buildable: False + # System level packages to not build - autotools: + autoconf: paths: - autotools: /usr/bin/ + autoconf: /usr buildable: False + automake: + paths: + automake: /usr + buildable: False bzip2: paths: - bzip2: /usr/bin/ + bzip2: /usr buildable: False gettext: paths: - gettext: /usr/bin/ + gettext: /usr + buildable: False + libtool: + paths: + libtool: /usr buildable: False m4: paths: - m4: /usr/bin/ + m4: /usr buildable: False + perl: + paths: + perl: /usr + buildable: False pkg-config: paths: - pkg-config: /usr/bin/ + pkg-config: /usr buildable: False tar: paths: - tar: /usr/bin/ + tar: /usr buildable: False graphviz: paths: - graphviz: /usr/bin/ + graphviz: /usr buildable: False + # Globally lock in version of CMake cmake: version: [3.9.6] diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index effa77bf3f..c8c596dc7b 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -34,10 +34,6 @@ "gcc@7.3.1", "xl@coral~openmp" ], - "bgqos_0": - [ "clang@4.0.0_gfortran~umpire ^zlib~shared", - "clang@4.0.0_xlf~openmp~umpire ^zlib~shared" ], - "darwin-x86_64": [ "clang@9.0.0" ] } diff --git a/scripts/uberenv/uberenv.py b/scripts/uberenv/uberenv.py index fa9c273451..5c92291cbd 100755 --- a/scripts/uberenv/uberenv.py +++ b/scripts/uberenv/uberenv.py @@ -70,13 +70,14 @@ def sexe(cmd,ret_output=False,echo = False): """ Helper for executing shell commands. """ if echo: - print "[exe: %s]" % cmd + print("[exe: {}]".format(cmd)) if ret_output: p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - res =p.communicate()[0] + res = p.communicate()[0] + res = res.decode('utf8') return p.returncode,res else: return subprocess.call(cmd,shell=True) @@ -89,28 +90,39 @@ def parse_args(): action="store_true", dest="install", default=False, - help="Install `package_name` instead of `uberenv_package_name`.") + help="Install `package_name`, not just its dependencies.") + # where to install parser.add_option("--prefix", dest="prefix", default="uberenv_libs", help="destination directory") + # what compiler to use parser.add_option("--spec", dest="spec", default=None, help="spack compiler spec") + # optional location of spack mirror parser.add_option("--mirror", dest="mirror", default=None, help="spack mirror directory") + # flag to create mirror parser.add_option("--create-mirror", action="store_true", dest="create_mirror", default=False, help="Create spack mirror") + + # optional location of spack upstream + parser.add_option("--upstream", + dest="upstream", + default=None, + help="add an external spack instance as upstream") + # this option allows a user to explicitly to select a # group of spack settings files (compilers.yaml , packages.yaml) parser.add_option("--spack-config-dir", @@ -118,6 +130,24 @@ def parse_args(): default=None, help="dir with spack settings files (compilers.yaml, packages.yaml, etc)") + # overrides package_name + parser.add_option("--package-name", + dest="package_name", + default=None, + help="override the default package name") + + # controls after which package phase spack should stop + parser.add_option("--package-final-phase", + dest="package_final_phase", + default=None, + help="override the default phase after which spack should stop") + + # controls source_dir spack should use to build the package + parser.add_option("--package-source-dir", + dest="package_source_dir", + default=None, + help="override the default source dir spack should use") + # a file that holds settings for a specific project # using uberenv.py parser.add_option("--project-json", @@ -175,7 +205,7 @@ def parse_args(): if not opts["spack_config_dir"] is None: opts["spack_config_dir"] = os.path.abspath(opts["spack_config_dir"]) if not os.path.isdir(opts["spack_config_dir"]): - print "[ERROR: invalid spack config dir: %s ]" % opts["spack_config_dir"] + print("[ERROR: invalid spack config dir: {} ]".format(opts["spack_config_dir"])) sys.exit(-1) return opts, extras @@ -188,127 +218,408 @@ def load_json_file(json_file): # reads json file return json.load(open(json_file)) -def uberenv_detect_platform(): - # find supported sets of compilers.yaml, packages,yaml - res = None - if "darwin" in platform.system().lower(): - res = "darwin" - elif "SYS_TYPE" in os.environ.keys(): - sys_type = os.environ["SYS_TYPE"].lower() - res = sys_type - return res +def is_darwin(): + return "darwin" in platform.system().lower() -def uberenv_spack_config_dir(opts, uberenv_dir): - # path to compilers.yaml, which we will for compiler setup for spack - spack_config_dir = opts["spack_config_dir"] - if spack_config_dir is None: - uberenv_plat = uberenv_detect_platform() - if not uberenv_plat is None: - spack_config_dir = os.path.abspath(pjoin(uberenv_dir,"spack_configs",uberenv_plat)) - return spack_config_dir - - -def disable_spack_config_scopes(spack_dir): - # disables all config scopes except "default", which we will - # force our settings into - spack_lib_config = pjoin(spack_dir,"lib","spack","spack","config.py") - print "[disabling config scope (except default) in: %s]" % spack_lib_config - cfg_script = open(spack_lib_config).read() - for cfg_scope_stmt in ["('system', os.path.join(spack.paths.system_etc_path, 'spack')),", - "('site', os.path.join(spack.paths.etc_path, 'spack')),", - "('user', spack.paths.user_config_path)"]: - cfg_script = cfg_script.replace(cfg_scope_stmt, - "#DISABLED BY UBERENV: " + cfg_scope_stmt) - open(spack_lib_config,"w").write(cfg_script) - - - -def patch_spack(spack_dir,uberenv_dir,cfg_dir,pkgs): - # force spack to use only default config scope - disable_spack_config_scopes(spack_dir) - spack_etc_defaults_dir = pjoin(spack_dir,"etc","spack","defaults") - # copy in default config.yaml - config_yaml = os.path.abspath(pjoin(uberenv_dir,"spack_configs","config.yaml")) - sexe("cp %s %s/" % (config_yaml, spack_etc_defaults_dir ), echo=True) - # copy in other settings per platform - if not cfg_dir is None: - print "[copying uberenv compiler and packages settings from %s]" % cfg_dir - - config_yaml = pjoin(cfg_dir,"config.yaml") - compilers_yaml = pjoin(cfg_dir,"compilers.yaml") - packages_yaml = pjoin(cfg_dir,"packages.yaml") - - if os.path.isfile(config_yaml): - sexe("cp %s %s/" % (config_yaml , spack_etc_defaults_dir ), echo=True) - - if os.path.isfile(compilers_yaml): - sexe("cp %s %s/" % (compilers_yaml, spack_etc_defaults_dir ), echo=True) - - if os.path.isfile(packages_yaml): - sexe("cp %s %s/" % (packages_yaml, spack_etc_defaults_dir ), echo=True) - else: - # let spack try to auto find compilers - sexe("spack/bin/spack compiler find", echo=True) - dest_spack_pkgs = pjoin(spack_dir,"var","spack","repos","builtin","packages") - # hot-copy our packages into spack - sexe("cp -Rf %s %s" % (pkgs,dest_spack_pkgs)) +def is_windows(): + return "windows" in platform.system().lower() +class UberEnv(): + """ Base class for package manager """ -def create_spack_mirror(mirror_path,pkg_name,ignore_ssl_errors=False): - """ - Creates a spack mirror for pkg_name at mirror_path. - """ - if not mirror_path: - print "[--create-mirror requires a mirror directory]" + def __init__(self, opts, extra_opts): + self.opts = opts + self.extra_opts = extra_opts + + # load project settings + self.project_opts = load_json_file(opts["project_json"]) + print("[uberenv project settings: {}]".format(str(self.project_opts))) + print("[uberenv options: {}]".format(str(self.opts))) + + def setup_paths_and_dirs(self): + self.uberenv_path = os.path.dirname(os.path.realpath(__file__)) + + def set_from_args_or_json(self,setting): + try: + setting_value = self.project_opts[setting] + except (KeyError): + print("ERROR: {} must at least be defined in project.json".format(setting)) + raise + else: + if self.opts[setting]: + setting_value = self.opts[setting] + return setting_value + + def set_from_json(self,setting): + try: + setting_value = self.project_opts[setting] + except (KeyError): + print("ERROR: {} must at least be defined in project.json".format(setting)) + raise + return setting_value + + def detect_platform(self): + # find supported sets of compilers.yaml, packages,yaml + res = None + if is_darwin(): + res = "darwin" + elif "SYS_TYPE" in os.environ.keys(): + sys_type = os.environ["SYS_TYPE"].lower() + res = sys_type + return res + + +class SpackEnv(UberEnv): + """ Helper to clone spack and install libraries on MacOS an Linux """ + + def __init__(self, opts, extra_opts): + UberEnv.__init__(self,opts,extra_opts) + + self.pkg_name = self.set_from_args_or_json("package_name") + self.pkg_version = self.set_from_json("package_version") + self.pkg_final_phase = self.set_from_args_or_json("package_final_phase") + self.pkg_src_dir = self.set_from_args_or_json("package_source_dir") + + # Some additional setup for macos + if is_darwin(): + if opts["macos_sdk_env_setup"]: + # setup osx deployment target and sdk settings + setup_osx_sdk_env_vars() + else: + print("[skipping MACOSX env var setup]") + + # setup default spec + if opts["spec"] is None: + if is_darwin(): + opts["spec"] = "%clang" + else: + opts["spec"] = "%gcc" + self.opts["spec"] = "@{}{}".format(self.pkg_version,opts["spec"]) + elif not opts["spec"].startswith("@"): + self.opts["spec"] = "@{}{}".format(self.pkg_version,opts["spec"]) + else: + self.opts["spec"] = "{}".format(opts["spec"]) + + print("[spack spec: {}]".format(self.opts["spec"])) + + def setup_paths_and_dirs(self): + # get the current working path, and the glob used to identify the + # package files we want to hot-copy to spack + + UberEnv.setup_paths_and_dirs(self) + + self.pkgs = pjoin(self.uberenv_path, "packages","*") + + # setup destination paths + self.dest_dir = os.path.abspath(self.opts["prefix"]) + self.dest_spack = pjoin(self.dest_dir,"spack") + print("[installing to: {0}]".format(self.dest_dir)) + + # print a warning if the dest path already exists + if not os.path.isdir(self.dest_dir): + os.mkdir(self.dest_dir) + else: + print("[info: destination '{}' already exists]".format(self.dest_dir)) + + if os.path.isdir(self.dest_spack): + print("[info: destination '{}' already exists]".format(self.dest_spack)) + + self.pkg_src_dir = os.path.join(self.uberenv_path,self.pkg_src_dir) + if not os.path.isdir(self.pkg_src_dir): + print("[ERROR: package_source_dir '{}' does not exist]".format(self.pkg_src_dir)) + sys.exit(-1) + + + def find_spack_pkg_path(self,pkg_name): + r,rout = sexe("spack/bin/spack find -p " + pkg_name,ret_output = True) + for l in rout.split("\n"): + # TODO: at least print a warning when several choices exist. This will + # pick the first in the list. + if l.startswith(pkg_name): + return {"name": pkg_name, "path": l.split()[-1]} + print("[ERROR: failed to find package named '{}']".format(pkg_name)) sys.exit(-1) - mirror_path = os.path.abspath(mirror_path) - mirror_cmd = "spack/bin/spack " - if ignore_ssl_errors: - mirror_cmd += "-k " - mirror_cmd += "mirror create -d {} --dependencies {}".format(mirror_path, - pkg_name) - return sexe(mirror_cmd, echo=True) + def read_spack_full_spec(self,pkg_name,spec): + rv, res = sexe("spack/bin/spack spec " + pkg_name + " " + spec, ret_output=True) + for l in res.split("\n"): + if l.startswith(pkg_name) and l.count("@") > 0 and l.count("arch=") > 0: + return l.strip() -def find_spack_mirror(spack_dir, mirror_name): - """ - Returns the path of a site scoped spack mirror with the - given name, or None if no mirror exists. - """ - rv, res = sexe("spack/bin/spack mirror list", ret_output=True) - mirror_path = None - for mirror in res.split('\n'): - if mirror: - parts = mirror.split() - if parts[0] == mirror_name: - mirror_path = parts[1] - return mirror_path - - -def use_spack_mirror(spack_dir, - mirror_name, - mirror_path): - """ - Configures spack to use mirror at a given path. - """ - mirror_path = os.path.abspath(mirror_path) - existing_mirror_path = find_spack_mirror(spack_dir, mirror_name) - if existing_mirror_path and mirror_path != existing_mirror_path: - # Existing mirror has different URL, error out - print "[removing existing spack mirror `%s` @ %s]" % (mirror_name, - existing_mirror_path) - # - # Note: In this case, spack says it removes the mirror, but we still - # get errors when we try to add a new one, sounds like a bug - # - sexe("spack/bin/spack mirror remove --scope=site {} ".format( - mirror_name), echo=True) - existing_mirror_path = None - if not existing_mirror_path: - # Add if not already there - sexe("spack/bin/spack mirror add --scope=site {} {}".format( - mirror_name, mirror_path), echo=True) - print "[using mirror %s]" % mirror_path + def clone_repo(self): + if not os.path.isdir(self.dest_spack): + + # compose clone command for the dest path, spack url and branch + print("[info: cloning spack develop branch from github]") + + os.chdir(self.dest_dir) + + clone_opts = ("-c http.sslVerify=false " + if self.opts["ignore_ssl_errors"] else "") + + spack_branch = self.project_opts.get("spack_branch", "develop") + spack_url = self.project_opts.get("spack_url", "https://github.com/spack/spack.git") + + clone_cmd = "git {} clone -b {} {}".format(clone_opts, spack_branch,spack_url) + sexe(clone_cmd, echo=True) + + # optionally, check out a specific commit + if "spack_commit" in self.project_opts: + sha1 = self.project_opts["spack_commit"] + print("[info: using spack commit {}]".format(sha1)) + os.chdir(pjoin(self.dest_dir,"spack")) + sexe("git checkout {}".format(sha1),echo=True) + + if self.opts["spack_pull"]: + # do a pull to make sure we have the latest + os.chdir(pjoin(self.dest_dir,"spack")) + sexe("git stash", echo=True) + sexe("git pull", echo=True) + + def config_dir(self): + """ path to compilers.yaml, which we will use for spack's compiler setup""" + spack_config_dir = self.opts["spack_config_dir"] + if spack_config_dir is None: + uberenv_plat = self.detect_platform() + if not uberenv_plat is None: + spack_config_dir = os.path.abspath(pjoin(self.uberenv_path,"spack_configs",uberenv_plat)) + return spack_config_dir + + + def disable_spack_config_scopes(self,spack_dir): + # disables all config scopes except "defaults", which we will + # force our settings into + spack_lib_config = pjoin(spack_dir,"lib","spack","spack","config.py") + print("[disabling config scope (except defaults) in: {}]".format(spack_lib_config)) + cfg_script = open(spack_lib_config).read() + for cfg_scope_stmt in ["('system', os.path.join(spack.paths.system_etc_path, 'spack')),", + "('site', os.path.join(spack.paths.etc_path, 'spack')),", + "('user', spack.paths.user_config_path)"]: + cfg_script = cfg_script.replace(cfg_scope_stmt, + "#DISABLED BY UBERENV: " + cfg_scope_stmt) + open(spack_lib_config,"w").write(cfg_script) + + + def patch(self): + + cfg_dir = self.config_dir() + spack_dir = self.dest_spack + + # force spack to use only "defaults" config scope + self.disable_spack_config_scopes(spack_dir) + spack_etc_defaults_dir = pjoin(spack_dir,"etc","spack","defaults") + + # copy in "defaults" config.yaml + config_yaml = os.path.abspath(pjoin(self.uberenv_path,"spack_configs","config.yaml")) + sexe("cp {} {}/".format(config_yaml, spack_etc_defaults_dir ), echo=True) + + # copy in other settings per platform + if not cfg_dir is None: + print("[copying uberenv compiler and packages settings from {0}]".format(cfg_dir)) + + config_yaml = pjoin(cfg_dir,"config.yaml") + compilers_yaml = pjoin(cfg_dir,"compilers.yaml") + packages_yaml = pjoin(cfg_dir,"packages.yaml") + + if os.path.isfile(config_yaml): + sexe("cp {} {}/".format(config_yaml , spack_etc_defaults_dir ), echo=True) + + if os.path.isfile(compilers_yaml): + sexe("cp {} {}/".format(compilers_yaml, spack_etc_defaults_dir ), echo=True) + + if os.path.isfile(packages_yaml): + sexe("cp {} {}/".format(packages_yaml, spack_etc_defaults_dir ), echo=True) + else: + # let spack try to auto find compilers + sexe("spack/bin/spack compiler find", echo=True) + dest_spack_pkgs = pjoin(spack_dir,"var","spack","repos","builtin","packages") + # hot-copy our packages into spack + sexe("cp -Rf {} {}".format(self.pkgs,dest_spack_pkgs)) + + + def clean_build(self): + # clean out any temporary spack build stages + cln_cmd = "spack/bin/spack clean " + res = sexe(cln_cmd, echo=True) + + # clean out any spack cached stuff + cln_cmd = "spack/bin/spack clean --all" + res = sexe(cln_cmd, echo=True) + + # check if we need to force uninstall of selected packages + if self.opts["spack_clean"]: + if self.project_opts.has_key("spack_clean_packages"): + for cln_pkg in self.project_opts["spack_clean_packages"]: + if not self.find_spack_pkg_path(cln_pkg) is None: + unist_cmd = "spack/bin/spack uninstall -f -y --all --dependents " + cln_pkg + res = sexe(unist_cmd, echo=True) + + def show_info(self): + spec_cmd = "spack/bin/spack spec " + self.pkg_name + self.opts["spec"] + return sexe(spec_cmd, echo=True) + + def install(self): + # use the uberenv package to trigger the right builds + # and build an host-config.cmake file + install_cmd = "spack/bin/spack " + if self.opts["ignore_ssl_errors"]: + install_cmd += "-k " + install_cmd += "dev-build -d {} ".format(self.pkg_src_dir) + if not self.opts["install"]: + install_cmd += "-u {} ".format(self.pkg_final_phase) + if self.opts["run_tests"]: + install_cmd += "--test=root " + install_cmd += self.pkg_name + self.opts["spec"] + res = sexe(install_cmd, echo=True) + if res != 0: + return res + + if "spack_activate" in self.project_opts: + print("[activating dependent packages]") + # get the full spack spec for our project + full_spec = self.read_spack_full_spec(self.pkg_name,self.opts["spec"]) + pkg_names = self.project_opts["spack_activate"].keys() + for pkg_name in pkg_names: + pkg_spec_requirements = self.project_opts["spack_activate"][pkg_name] + activate=True + for req in pkg_spec_requirements: + if req not in full_spec: + activate=False + break + if activate: + activate_cmd = "spack/bin/spack activate " + pkg_name + sexe(activate_cmd, echo=True) + # note: this assumes package extends python when +python + # this may fail general cases + if self.opts["install"] and "+python" in full_spec: + activate_cmd = "spack/bin/spack activate " + self.pkg_name + sexe(activate_cmd, echo=True) + # if user opt'd for an install, we want to symlink the final + # install to an easy place: + if self.opts["install"]: + pkg_path = self.find_spack_pkg_path(self.pkg_name) + if self.pkg_name != pkg_path["name"]: + print("[ERROR: Could not find install of {}]".format(self.pkg_name)) + return -1 + else: + pkg_lnk_dir = "{}-install".format(self.pkg_name) + if os.path.islink(pkg_lnk_dir): + os.unlink(pkg_lnk_dir) + print("") + print("[symlinking install to {}]").format(pjoin(self.dest_dir,pkg_lnk_dir)) + os.symlink(pkg_path["path"],os.path.abspath(pkg_lnk_dir)) + hcfg_glob = glob.glob(pjoin(pkg_lnk_dir,"*.cmake")) + if len(hcfg_glob) > 0: + hcfg_path = hcfg_glob[0] + hcfg_fname = os.path.split(hcfg_path)[1] + if os.path.islink(hcfg_fname): + os.unlink(hcfg_fname) + print("[symlinking host config file to {}]".format(pjoin(self.dest_dir,hcfg_fname))) + os.symlink(hcfg_path,hcfg_fname) + print("") + print("[install complete!]") + + def get_mirror_path(self): + mirror_path = self.opts["mirror"] + if not mirror_path: + print("[--create-mirror requires a mirror directory]") + sys.exit(-1) + return os.path.abspath(mirror_path) + + def create_mirror(self): + """ + Creates a spack mirror for pkg_name at mirror_path. + """ + + mirror_path = self.get_mirror_path() + + mirror_cmd = "spack/bin/spack " + if self.opts["ignore_ssl_errors"]: + mirror_cmd += "-k " + mirror_cmd += "mirror create -d {} --dependencies {}".format(mirror_path, + self.pkg_name) + return sexe(mirror_cmd, echo=True) + + def find_spack_mirror(self, mirror_name): + """ + Returns the path of a defaults scoped spack mirror with the + given name, or None if no mirror exists. + """ + rv, res = sexe("spack/bin/spack mirror list", ret_output=True) + mirror_path = None + for mirror in res.split('\n'): + if mirror: + parts = mirror.split() + if parts[0] == mirror_name: + mirror_path = parts[1] + return mirror_path + + def use_mirror(self): + """ + Configures spack to use mirror at a given path. + """ + mirror_name = self.pkg_name + mirror_path = self.get_mirror_path() + existing_mirror_path = self.find_spack_mirror(mirror_name) + + if existing_mirror_path and mirror_path != existing_mirror_path: + # Existing mirror has different URL, error out + print("[removing existing spack mirror `{}` @ {}]".format(mirror_name, + existing_mirror_path)) + # + # Note: In this case, spack says it removes the mirror, but we still + # get errors when we try to add a new one, sounds like a bug + # + sexe("spack/bin/spack mirror remove --scope=defaults {} ".format(mirror_name), + echo=True) + existing_mirror_path = None + if not existing_mirror_path: + # Add if not already there + sexe("spack/bin/spack mirror add --scope=defaults {} {}".format( + mirror_name, mirror_path), echo=True) + print("[using mirror {}]".format(mirror_path)) + + def find_spack_upstream(self, upstream_name): + """ + Returns the path of a defaults scoped spack upstream with the + given name, or None if no upstream exists. + """ + upstream_path = None + + rv, res = sexe('spack/bin/spack config get upstreams', ret_output=True) + if (not res) and ("upstreams:" in res): + res = res.replace(' ', '') + res = res.replace('install_tree:', '') + res = res.replace(':', '') + res = res.splitlines() + res = res[1:] + upstreams = dict(zip(res[::2], res[1::2])) + + for name in upstreams.keys(): + if name == upstream_name: + upstream_path = upstreams[name] + + return upstream_path + + def use_spack_upstream(self): + """ + Configures spack to use upstream at a given path. + """ + upstream_path = self.opts["upstream"] + if not upstream_path: + print("[--create-upstream requires a upstream directory]") + sys.exit(-1) + upstream_path = os.path.abspath(upstream_path) + upstream_name = self.pkg_name + existing_upstream_path = self.find_spack_upstream(upstream_name) + if (not existing_upstream_path) or (upstream_path != os.path.abspath(existing_upstream_path)): + # Existing upstream has different URL, error out + print("[removing existing spack upstream configuration file]") + sexe("rm spack/etc/spack/defaults/upstreams.yaml") + with open('spack/etc/spack/defaults/upstreams.yaml','w+') as upstreams_cfg_file: + upstreams_cfg_file.write("upstreams:\n") + upstreams_cfg_file.write(" {}:\n".format(upstream_name)) + upstreams_cfg_file.write(" install_tree: {}\n".format(upstream_path)) def find_osx_sdks(): @@ -343,119 +654,45 @@ def setup_osx_sdk_env_vars(): sdk_root = sdks[dep_tgt] else: # no valid sdks, error out - print "[ERROR: Could not find OSX SDK @ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/]" + print("[ERROR: Could not find OSX SDK @ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/]") sys.exit(-1) env["MACOSX_DEPLOYMENT_TARGET"] = dep_tgt env["SDKROOT"] = sdk_root - print "[setting MACOSX_DEPLOYMENT_TARGET to %s]" % env["MACOSX_DEPLOYMENT_TARGET"] - print "[setting SDKROOT to %s]" % env[ "SDKROOT" ] + print("[setting MACOSX_DEPLOYMENT_TARGET to {}]".format(env["MACOSX_DEPLOYMENT_TARGET"])) + print("[setting SDKROOT to {}]".format(env[ "SDKROOT"])) -def find_spack_pkg_path(pkg_name): - r,rout = sexe("spack/bin/spack find -p " + pkg_name,ret_output = True) - for l in rout.split("\n"): - if l.startswith(" "): - return {"name": pkg_name, "path": l.split()[-1]} -def read_spack_full_spec(pkg_name,spec): - rv, res = sexe("spack/bin/spack spec " + pkg_name + " " + spec, ret_output=True) - for l in res.split("\n"): - if l.startswith(pkg_name) and l.count("@") > 0 and l.count("arch=") > 0: - return l.strip() def main(): """ - clones and runs spack to setup our third_party libs and - creates a host-config.cmake file that can be used by - our project. + Clones and runs a package manager to setup third_party libs. + Also creates a host-config.cmake file that can be used by our project. """ + # parse args from command line - opts, extras = parse_args() + opts, extra_opts = parse_args() + + # Initialize the environment + env = SpackEnv(opts, extra_opts) + + # Setup the necessary paths and directories + env.setup_paths_and_dirs() + + # Clone the package manager + env.clone_repo() + + os.chdir(env.dest_dir) + + # Patch the package manager, as necessary + env.patch() + + # Clean the build + env.clean_build() + + # Show the spec for what will be built + env.show_info() - # load project settings - project_opts = load_json_file(opts["project_json"]) - if opts["install"]: - uberenv_pkg_name = project_opts["package_name"] - else: - uberenv_pkg_name = project_opts["uberenv_package_name"] - print "[uberenv project settings: %s]" % str(project_opts) - print "[uberenv options: %s]" % str(opts) - if "darwin" in platform.system().lower(): - if opts["macos_sdk_env_setup"]: - # setup osx deployment target and sdk settings - setup_osx_sdk_env_vars() - else: - print "[skipping MACOSX env var setup]" - # setup default spec - if opts["spec"] is None: - if "darwin" in platform.system().lower(): - opts["spec"] = "%clang" - else: - opts["spec"] = "%gcc" - print "[spack spec: %s]" % opts["spec"] - # get the current working path, and the glob used to identify the - # package files we want to hot-copy to spack - uberenv_path = os.path.split(os.path.abspath(__file__))[0] - pkgs = pjoin(uberenv_path, "packages","*") - # setup destination paths - dest_dir = os.path.abspath(opts["prefix"]) - dest_spack = pjoin(dest_dir,"spack") - print "[installing to: %s]" % dest_dir - # print a warning if the dest path already exists - if not os.path.isdir(dest_dir): - os.mkdir(dest_dir) - else: - print "[info: destination '%s' already exists]" % dest_dir - if os.path.isdir(dest_spack): - print "[info: destination '%s' already exists]" % dest_spack - - if not os.path.isdir(dest_spack): - print "[info: cloning spack develop branch from github]" - os.chdir(dest_dir) - # clone spack into the dest path - clone_cmd ="git " - if opts["ignore_ssl_errors"]: - clone_cmd +="-c http.sslVerify=false " - spack_url = "https://github.com/spack/spack.git" - spack_branch = "develop" - if "spack_url" in project_opts: - spack_url = project_opts["spack_url"] - if "spack_branch" in project_opts: - spack_branch = project_opts["spack_branch"] - clone_cmd += "clone -b %s %s" % (spack_branch,spack_url) - sexe(clone_cmd, echo=True) - if "spack_commit" in project_opts: - sha1 = project_opts["spack_commit"] - print "[info: using spack commit %s]" % sha1 - os.chdir(pjoin(dest_dir,"spack")) - sexe("git checkout %s" % sha1,echo=True) - - if opts["spack_pull"]: - # do a pull to make sure we have the latest - os.chdir(pjoin(dest_dir,"spack")) - sexe("git stash", echo=True) - sexe("git pull", echo=True) - - os.chdir(dest_dir) - # twist spack's arms - cfg_dir = uberenv_spack_config_dir(opts, uberenv_path) - patch_spack(dest_spack, uberenv_path, cfg_dir, pkgs) - - # show the spec for what will be built - spec_cmd = "spack/bin/spack spec " + uberenv_pkg_name + opts["spec"] - res = sexe(spec_cmd, echo=True) - - # clean out any temporary spack build stages - cln_cmd = "spack/bin/spack clean " - res = sexe(cln_cmd, echo=True) - - # check if we need to force uninstall of selected packages - if opts["spack_clean"]: - if project_opts.has_key("spack_clean_packages"): - for cln_pkg in project_opts["spack_clean_packages"]: - if not find_spack_pkg_path(cln_pkg) is None: - unist_cmd = "spack/bin/spack uninstall -f -y --all --dependents " + cln_pkg - res = sexe(unist_cmd, echo=True) ########################################################## # we now have an instance of spack configured how we @@ -468,73 +705,17 @@ def main(): # ########################################################## if opts["create_mirror"]: - return create_spack_mirror(opts["mirror"], - uberenv_pkg_name, - opts["ignore_ssl_errors"]) + return env.create_mirror() else: if not opts["mirror"] is None: - use_spack_mirror(dest_spack, - uberenv_pkg_name, - opts["mirror"]) - # use the uberenv package to trigger the right builds - # and build an host-config.cmake file - install_cmd = "spack/bin/spack " - if opts["ignore_ssl_errors"]: - install_cmd += "-k " - install_cmd += "install " - if opts["run_tests"]: - install_cmd += "--test=root " - install_cmd += uberenv_pkg_name + opts["spec"] - res = sexe(install_cmd, echo=True) - if res != 0: - return res - if "spack_activate" in project_opts: - print "[activating dependent packages]" - # get the full spack spec for our project - full_spec = read_spack_full_spec(uberenv_pkg_name,opts["spec"]) - pkg_names = project_opts["spack_activate"].keys() - for pkg_name in pkg_names: - pkg_spec_requirements = project_opts["spack_activate"][pkg_name] - activate=True - for req in pkg_spec_requirements: - if req not in full_spec: - activate=False - break - if activate: - activate_cmd = "spack/bin/spack activate " + pkg_name - sexe(activate_cmd, echo=True) - # note: this assumes package extends python when +python - # this may fail general cases - if opts["install"] and "+python" in full_spec: - activate_cmd = "spack/bin/spack activate " + uberenv_pkg_name - sexe(activate_cmd, echo=True) - # if user opt'd for an install, we want to symlink the final ascent - # install to an easy place: - if opts["install"]: - pkg_path = find_spack_pkg_path(uberenv_pkg_name) - if uberenv_pkg_name != pkg_path["name"]: - print "[ERROR: Could not find install of %s]" % uberenv_pkg_name - return -1 - else: - pkg_lnk_dir = "%s-install" % uberenv_pkg_name - if os.path.islink(pkg_lnk_dir): - os.unlink(pkg_lnk_dir) - print "" - print "[symlinking install to %s]" % pjoin(dest_dir,pkg_lnk_dir) - os.symlink(pkg_path["path"],os.path.abspath(pkg_lnk_dir)) - hcfg_glob = glob.glob(pjoin(pkg_lnk_dir,"*.cmake")) - if len(hcfg_glob) > 0: - hcfg_path = hcfg_glob[0] - hcfg_fname = os.path.split(hcfg_path)[1] - if os.path.islink(hcfg_fname): - os.unlink(hcfg_fname) - print "[symlinking host config file to %s]" % pjoin(dest_dir,hcfg_fname) - os.symlink(hcfg_path,hcfg_fname) - print "" - print "[install complete!]" + env.use_mirror() + + if not opts["upstream"] is None: + env.use_spack_upstream() + + res = env.install() + return res if __name__ == "__main__": sys.exit(main()) - - diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index 923ab11c8b..e08322795d 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -63,7 +63,7 @@ set(core_sources set( core_depends ) blt_list_append( TO core_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) -blt_list_append( TO core_depends ELEMENTS raja IF ${RAJA_FOUND} ) +blt_list_append( TO core_depends ELEMENTS RAJA IF ${RAJA_FOUND} ) blt_list_append( TO core_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) blt_list_append( TO core_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO core_depends ELEMENTS mpi IF ${ENABLE_MPI} ) diff --git a/src/axom/core/tests/CMakeLists.txt b/src/axom/core/tests/CMakeLists.txt index d6353eb2f7..96eb677152 100644 --- a/src/axom/core/tests/CMakeLists.txt +++ b/src/axom/core/tests/CMakeLists.txt @@ -48,7 +48,7 @@ set(utils_tests_depends ) blt_list_append( TO utils_tests_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) -blt_list_append( TO utils_tests_depends ELEMENTS raja IF ${RAJA_FOUD} ) +blt_list_append( TO utils_tests_depends ELEMENTS RAJA IF ${RAJA_FOUD} ) blt_list_append( TO utils_tests_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) #------------------------------------------------------------------------------ diff --git a/src/axom/mint/CMakeLists.txt b/src/axom/mint/CMakeLists.txt index 0131462b45..74e3f91a27 100644 --- a/src/axom/mint/CMakeLists.txt +++ b/src/axom/mint/CMakeLists.txt @@ -121,7 +121,7 @@ blt_list_append( TO mint_dependencies ELEMENTS sidre conduit::conduit IF AXOM_MINT_USE_SIDRE ) -blt_list_append( TO mint_dependencies ELEMENTS raja IF RAJA_FOUND ) +blt_list_append( TO mint_dependencies ELEMENTS RAJA IF RAJA_FOUND ) blt_list_append( TO mint_dependencies ELEMENTS openmp IF ENABLE_OPENMP ) diff --git a/src/axom/mint/examples/CMakeLists.txt b/src/axom/mint/examples/CMakeLists.txt index 6e54e85a93..51b1e88e74 100644 --- a/src/axom/mint/examples/CMakeLists.txt +++ b/src/axom/mint/examples/CMakeLists.txt @@ -29,7 +29,7 @@ set( mint_example_dependencies blt_list_append( TO mint_example_dependencies ELEMENTS sidre conduit::conduit IF ${AXOM_MINT_USE_SIDRE} ) -blt_list_append( TO mint_example_dependencies ELEMENTS raja +blt_list_append( TO mint_example_dependencies ELEMENTS RAJA IF ${RAJA_FOUND} ) blt_list_append( TO mint_example_dependencies ELEMENTS openmp diff --git a/src/axom/mint/tests/CMakeLists.txt b/src/axom/mint/tests/CMakeLists.txt index add342766e..fc6f1dd68a 100644 --- a/src/axom/mint/tests/CMakeLists.txt +++ b/src/axom/mint/tests/CMakeLists.txt @@ -50,7 +50,7 @@ set( mint_test_dependencies blt_list_append( TO mint_test_dependencies ELEMENTS sidre conduit::conduit IF AXOM_MINT_USE_SIDRE ) -blt_list_append( TO mint_test_dependencies ELEMENTS raja IF ${RAJA_FOUND} ) +blt_list_append( TO mint_test_dependencies ELEMENTS RAJA IF ${RAJA_FOUND} ) blt_list_append( TO mint_test_dependencies ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO mint_test_dependencies ELEMENTS cuda IF ${ENABLE_CUDA} ) diff --git a/src/axom/spin/CMakeLists.txt b/src/axom/spin/CMakeLists.txt index f69160788a..bbc83a0955 100644 --- a/src/axom/spin/CMakeLists.txt +++ b/src/axom/spin/CMakeLists.txt @@ -65,7 +65,7 @@ set( spin_depends_on core slic primal slam ) blt_list_append( TO spin_depends_on ELEMENTS sparsehash IF ${SPARSEHASH_FOUND} ) -blt_list_append( TO spin_depends_on ELEMENTS raja IF ${RAJA_FOUND} ) +blt_list_append( TO spin_depends_on ELEMENTS RAJA IF ${RAJA_FOUND} ) blt_list_append( TO spin_depends_on ELEMENTS umpire IF ${UMPIRE_FOUND} ) blt_list_append( TO spin_depends_on ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO spin_depends_on ELEMENTS cuda IF ${ENABLE_CUDA} ) diff --git a/src/axom/spin/examples/CMakeLists.txt b/src/axom/spin/examples/CMakeLists.txt index 58be26f65b..c46314dce7 100644 --- a/src/axom/spin/examples/CMakeLists.txt +++ b/src/axom/spin/examples/CMakeLists.txt @@ -14,9 +14,6 @@ set(spin_example_depends fmt ) - #blt_list_append( TO spin_example_depends ELEMENTS raja IF ${RAJA_FOUND} ) - #blt_list_append( TO spin_example_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) - #blt_list_append( TO spin_example_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO spin_example_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) blt_add_executable( diff --git a/src/axom/spin/tests/CMakeLists.txt b/src/axom/spin/tests/CMakeLists.txt index 4007943ff4..17f8803cf1 100644 --- a/src/axom/spin/tests/CMakeLists.txt +++ b/src/axom/spin/tests/CMakeLists.txt @@ -26,7 +26,7 @@ set( spin_depends fmt ) -blt_list_append( TO spin_depends ELEMENTS raja IF ${RAJA_FOUND} ) +blt_list_append( TO spin_depends ELEMENTS RAJA IF ${RAJA_FOUND} ) blt_list_append( TO spin_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) blt_list_append( TO spin_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO spin_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) diff --git a/src/cmake/thirdparty/FindRAJA.cmake b/src/cmake/thirdparty/FindRAJA.cmake index 9cde30eda4..271d53992c 100644 --- a/src/cmake/thirdparty/FindRAJA.cmake +++ b/src/cmake/thirdparty/FindRAJA.cmake @@ -11,7 +11,6 @@ if (NOT RAJA_DIR) endif() find_package(RAJA REQUIRED) -find_package_handle_standard_args( RAJA DEFAULT_MSG - RAJA_INCLUDE_DIR - RAJA_LIB_DIR - ) +if(TARGET RAJA) + message(STATUS "Found RAJA: ${RAJA_DIR}") +endif() diff --git a/src/cmake/thirdparty/SetupAxomThirdParty.cmake b/src/cmake/thirdparty/SetupAxomThirdParty.cmake index 4af62b7430..9e65461031 100644 --- a/src/cmake/thirdparty/SetupAxomThirdParty.cmake +++ b/src/cmake/thirdparty/SetupAxomThirdParty.cmake @@ -26,10 +26,6 @@ endif() #------------------------------------------------------------------------------ if (RAJA_DIR) include(cmake/thirdparty/FindRAJA.cmake) - blt_register_library( NAME raja - INCLUDES ${RAJA_INCLUDE_DIR} - LIBRARIES ${RAJA_LIB_DIR}/libRAJA.a - TREAT_INCLUDES_AS_SYSTEM ON) else() message(STATUS "RAJA support is OFF" ) endif() @@ -92,10 +88,12 @@ if(EXISTS ${SHROUD_EXECUTABLE}) execute_process(COMMAND ${SHROUD_EXECUTABLE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/SetupShroud.cmake ERROR_VARIABLE SHROUD_cmake_error + RESULT_VARIABLE SHROUD_cmake_result OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(${SHROUD_cmake_error}) - message(FATAL_ERROR "Error from Shroud: ${SHROUD_cmake_error}") + if(NOT "${SHROUD_cmake_result}" STREQUAL "0") + message(FATAL_ERROR "Error code from Shroud: ${SHROUD_cmake_result}\n${SHROUD_cmake_error}") endif() + include(${CMAKE_CURRENT_BINARY_DIR}/SetupShroud.cmake) else() message(STATUS "Shroud support is OFF") @@ -115,3 +113,22 @@ else() message(STATUS "SCR support is OFF") endif() + +# Remove exported OpenMP flags because they are not language agnostic +foreach(_target RAJA camp umpire umpire_alloc) + if(TARGET ${_target}) + get_target_property(_flags ${_target} INTERFACE_COMPILE_OPTIONS) + if ( _flags ) + + message(STATUS "Removing OpenMP Flags from target[${_target}]") + + string( REPLACE "${OpenMP_CXX_FLAGS}" "" + correct_flags "${_flags}" ) + string( REPLACE "${OpenMP_Fortran_FLAGS}" "" + correct_flags "${correct_flags}" ) + + set_target_properties( ${_target} PROPERTIES INTERFACE_COMPILE_OPTIONS + "${correct_flags}" ) + endif() + endif() +endforeach() diff --git a/src/thirdparty/tests/CMakeLists.txt b/src/thirdparty/tests/CMakeLists.txt index 6d70a90a8c..d0a3fa869e 100644 --- a/src/thirdparty/tests/CMakeLists.txt +++ b/src/thirdparty/tests/CMakeLists.txt @@ -34,7 +34,7 @@ endif() #------------------------------------------------------------------------------ if ( RAJA_FOUND ) - set( raja_smoke_dependencies raja gtest ) + set( raja_smoke_dependencies RAJA gtest ) blt_list_append( TO raja_smoke_dependencies ELEMENTS openmp IF ENABLE_OPENMP) From 8bee61e5c6472b368c0cc6b4581e4e56650288ee Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 6 Feb 2020 15:21:39 -0800 Subject: [PATCH 010/632] Remove more BGQ, Update Conduit's package.py, Update Blueos compilers --- ...useqlac-bgqos_0-clang@4.0.0_gfortran.cmake | 102 ------ .../rzuseqlac-bgqos_0-clang@4.0.0_xlf.cmake | 101 ------ scripts/llnl_scripts/llnl_lc_build_tools.py | 50 +-- scripts/uberenv/packages/axom/package.py | 30 +- scripts/uberenv/packages/conduit/package.py | 302 +++++++++++++----- scripts/uberenv/packages/raja/package.py | 7 + .../spack_configs/bgqos_0/compilers.yaml | 27 -- .../spack_configs/bgqos_0/packages.yaml | 79 ----- .../blueos_3_ppc64le_ib/packages.yaml | 87 +++-- .../blueos_3_ppc64le_ib_p9/compilers.yaml | 22 +- .../blueos_3_ppc64le_ib_p9/packages.yaml | 95 ++++-- scripts/uberenv/spack_configs/config.yaml | 4 +- .../toss_3_x86_64_ib/packages.yaml | 7 +- scripts/uberenv/specs.json | 2 +- src/axom/sidre/tests/CMakeLists.txt | 26 +- src/cmake/thirdparty/FindRAJA.cmake | 16 - src/cmake/thirdparty/FindUmpire.cmake | 16 - .../thirdparty/SetupAxomThirdParty.cmake | 74 +++-- 18 files changed, 479 insertions(+), 568 deletions(-) delete mode 100644 host-configs/rzuseqlac-bgqos_0-clang@4.0.0_gfortran.cmake delete mode 100644 host-configs/rzuseqlac-bgqos_0-clang@4.0.0_xlf.cmake delete mode 100644 scripts/uberenv/spack_configs/bgqos_0/compilers.yaml delete mode 100644 scripts/uberenv/spack_configs/bgqos_0/packages.yaml delete mode 100644 src/cmake/thirdparty/FindRAJA.cmake delete mode 100644 src/cmake/thirdparty/FindUmpire.cmake diff --git a/host-configs/rzuseqlac-bgqos_0-clang@4.0.0_gfortran.cmake b/host-configs/rzuseqlac-bgqos_0-clang@4.0.0_gfortran.cmake deleted file mode 100644 index 9a5e5f2b21..0000000000 --- a/host-configs/rzuseqlac-bgqos_0-clang@4.0.0_gfortran.cmake +++ /dev/null @@ -1,102 +0,0 @@ -#------------------------------------------------------------------------------ -# !!!! This is a generated file, edit at own risk !!!! -#------------------------------------------------------------------------------ - -# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -# other Axom Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# SYS_TYPE: bgqos_0 -# Compiler Spec: clang@4.0.0_gfortran -#------------------------------------------------------------------------------ - -# CMake executable path: /collab/usr/global/tools/cmake/bgqos_0/cmake-3.8.2/bin/cmake - -#------------------------------------------------------------------------------ -# Compilers -#------------------------------------------------------------------------------ - -# Note: we build TPLs with the serial compiler then use MPI wrappers on bgq -# Serial compilers used by spack: -# C compiler: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang -# C++ compiler: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang++ - -set(CMAKE_C_COMPILER "/collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/llnl/bin/mpiclang" CACHE PATH "") - -set(CMAKE_CXX_COMPILER "/collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/llnl/bin/mpiclang++" CACHE PATH "") - -# Fortran compiler used by spack -set(ENABLE_FORTRAN ON CACHE BOOL "") - -set(CMAKE_Fortran_COMPILER "/usr/local/tools/toolchain-4.8.4/gnu-linux-4.8.4/bin/powerpc64-bgq-linux-gfortran" CACHE PATH "") - -#------------------------------------------------------------------------------ -# TPLs -#------------------------------------------------------------------------------ - -# Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2019_09_05_21_45_10/clang-4.0.0_gfortran" CACHE PATH "") - -# conduit from uberenv -set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") - -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") - -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") - -# scr not built by uberenv - -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.9.0/share/raja/cmake" CACHE PATH "") - -# umpire not build by uberenv - -# python not built by uberenv - -set(ENABLE_DOCS OFF CACHE BOOL "") - -# shroud not built by uberenv - -# uncrustify not built by uberenv - -# lcov and genhtml not built by uberenv - -# cppcheck not built by uberenv - -#------------------------------------------------------------------------------ -# MPI -#------------------------------------------------------------------------------ - -set(ENABLE_MPI ON CACHE BOOL "") - -set(ENABLE_FIND_MPI OFF CACHE BOOL "Use wrapper directly to stop FindMPI returning the wrong linker flags.") - -set(ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC ON CACHE BOOL "Ensures that tests will be wrapped with srun to run on the backend nodes") - -set(BLT_MPI_INCLUDES "/usr/local/tools/deg/drivers/V1R2M0/ppc64/comm/gcc/include" CACHE PATH "Pass in an explicit path to help find mpif.h") - -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") - -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") - -#------------------------------------------------------------------------------ -# Other machine specifics -#------------------------------------------------------------------------------ - -set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") - -# Manually set up HDF5 library dependencies for BGQ to bypass errors from CMake's FindHDF5 -set(HDF5_C_LIBRARY_m "-lm" CACHE PATH "") - -set(HDF5_C_LIBRARY_dl "-ldl" CACHE PATH "") - -set(CMAKE_SKIP_RPATH ON CACHE BOOL "") - -set(ENABLE_OPENMP ON CACHE BOOL "") - - diff --git a/host-configs/rzuseqlac-bgqos_0-clang@4.0.0_xlf.cmake b/host-configs/rzuseqlac-bgqos_0-clang@4.0.0_xlf.cmake deleted file mode 100644 index f1eea73c19..0000000000 --- a/host-configs/rzuseqlac-bgqos_0-clang@4.0.0_xlf.cmake +++ /dev/null @@ -1,101 +0,0 @@ -#------------------------------------------------------------------------------ -# !!!! This is a generated file, edit at own risk !!!! -#------------------------------------------------------------------------------ -# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -# other Axom Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# SYS_TYPE: bgqos_0 -# Compiler Spec: clang@4.0.0_xlf -#------------------------------------------------------------------------------ - -# CMake executable path: /collab/usr/global/tools/cmake/bgqos_0/cmake-3.8.2/bin/cmake - -#------------------------------------------------------------------------------ -# Compilers -#------------------------------------------------------------------------------ - -# Note: we build TPLs with the serial compiler then use MPI wrappers on bgq -# Serial compilers used by spack: -# C compiler: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang -# C++ compiler: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang++ - -set(CMAKE_C_COMPILER "/collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/llnl/bin/mpiclang" CACHE PATH "") - -set(CMAKE_CXX_COMPILER "/collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/llnl/bin/mpiclang++" CACHE PATH "") - -# Fortran compiler used by spack -set(ENABLE_FORTRAN ON CACHE BOOL "") - -set(CMAKE_Fortran_COMPILER "/opt/ibmcmp/xlf/bg/14.1/bin/bgxlf2003" CACHE PATH "") - -#------------------------------------------------------------------------------ -# TPLs -#------------------------------------------------------------------------------ - -# Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2019_09_05_21_45_10/clang-4.0.0_xlf" CACHE PATH "") - -# conduit from uberenv -set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") - -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") - -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") - -# scr not built by uberenv - -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.9.0/share/raja/cmake" CACHE PATH "") - -# umpire not build by uberenv - -# python not built by uberenv - -set(ENABLE_DOCS OFF CACHE BOOL "") - -# shroud not built by uberenv - -# uncrustify not built by uberenv - -# lcov and genhtml not built by uberenv - -# cppcheck not built by uberenv - -#------------------------------------------------------------------------------ -# MPI -#------------------------------------------------------------------------------ - -set(ENABLE_MPI ON CACHE BOOL "") - -set(ENABLE_FIND_MPI OFF CACHE BOOL "Use wrapper directly to stop FindMPI returning the wrong linker flags.") - -set(ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC ON CACHE BOOL "Ensures that tests will be wrapped with srun to run on the backend nodes") - -set(BLT_MPI_INCLUDES "/usr/local/tools/deg/drivers/V1R2M0/ppc64/comm/gcc/include" CACHE PATH "Pass in an explicit path to help find mpif.h") - -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") - -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") - -#------------------------------------------------------------------------------ -# Other machine specifics -#------------------------------------------------------------------------------ - -set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") - -set(BLT_FORTRAN_FLAGS "-WF,-C!" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") - -# Manually set up HDF5 library dependencies for BGQ to bypass errors from CMake's FindHDF5 -set(HDF5_C_LIBRARY_m "-lm" CACHE PATH "") - -set(HDF5_C_LIBRARY_dl "-ldl" CACHE PATH "") - -set(CMAKE_SKIP_RPATH ON CACHE BOOL "") - - diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 2447e9db9e..b53460c837 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -260,9 +260,9 @@ def uberenv_install_tpls(prefix,spec,mirror = None): """ Calls uberenv to install tpls for a given spec to given prefix. """ - cmd = "python scripts/uberenv/uberenv.py --prefix %s --spec=\"%s\" " % (prefix,spec) + cmd = "python scripts/uberenv/uberenv.py --prefix=\"%s\" --spec=\"%s\" " % (prefix,spec) if not mirror is None: - cmd += "--mirror %s" % mirror + cmd += "--mirror=\"%s\"" % mirror spack_tpl_build_log = pjoin(prefix,"output.log.spack.tpl.build.%s.txt" % spec.replace(" ", "_")) print "[starting tpl install of spec %s]" % spec @@ -272,6 +272,7 @@ def uberenv_install_tpls(prefix,spec,mirror = None): output_file = spack_tpl_build_log) # Move files generated by spack in source directory to TPL install directory + print "[Moving spack generated files to TPL build directory]" repo_dir = get_repo_dir() for file in ["spack-build-env.txt", "spack-build-out.txt"]: src = pjoin(repo_dir, file) @@ -279,13 +280,6 @@ def uberenv_install_tpls(prefix,spec,mirror = None): if os.path.exists(src) and not os.path.exists(dst): shutil.move(src, dst) - # Copy generated host-configs into TPL install directory - host_configs = get_host_configs_for_current_machine(repo_dir, True) - for host_config in host_configs: - dst = pjoin(prefix, os.path.basename(host_config)) - if os.path.exists(host_config) and not os.path.exists(dst): - shutil.copy2(host_config, dst) - if res != 0: log_failure(prefix,"[ERROR: uberenv/spack build of spec: %s failed]" % spec) return res @@ -477,7 +471,16 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): uberenv_create_mirror(prefix,mirror_dir) # write info about this build write_build_info(pjoin(prefix,"info.json"), job_name) + + repo_dir = get_repo_dir() + # Clean previously generated host-configs into TPL install directory + print "[Cleaning previously generated host-configs if they exist]" + host_configs = get_host_configs_for_current_machine(repo_dir, True) + for host_config in host_configs: + os.remove(host_config) + # use uberenv to install for all specs + tpl_build_failed = False for spec in specs: start_time = time.time() res = uberenv_install_tpls(prefix,spec,mirror_dir) @@ -485,21 +488,26 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): print "[build time: {0}]".format(convertSecondsToReadableTime(end_time - start_time)) if res != 0: print "[ERROR: Failed build of tpls for spec %s]\n" % spec - # set perms, then early exit - # set proper perms for installed tpls - set_axom_group_and_perms(prefix) - # set proper perms for the mirror files - set_axom_group_and_perms(mirror_dir) - return res + tpl_build_failed = True else: print "[SUCCESS: Finished build tpls for spec %s]\n" % spec - # build the axom against the new tpls - res = build_and_test_host_configs(prefix, job_name, timestamp, True) - if res != 0: - print "[ERROR: build and test of axom vs tpls test failed.]\n" - else: - print "[SUCCESS: build and test of axom vs tpls test passed.]\n" + # Copy generated host-configs into TPL install directory + print "[Copying spack generated host-configs to TPL build directory]" + host_configs = get_host_configs_for_current_machine(repo_dir, True) + for host_config in host_configs: + dst = pjoin(prefix, os.path.basename(host_config)) + if os.path.exists(host_config) and not os.path.exists(dst): + shutil.copy2(host_config, dst) + + if not tpl_build_failed: + # build the axom against the new tpls + res = build_and_test_host_configs(prefix, job_name, timestamp, True) + if res != 0: + print "[ERROR: build and test of axom vs tpls test failed.]\n" + else: + print "[SUCCESS: build and test of axom vs tpls test passed.]\n" + # set proper perms for installed tpls set_axom_group_and_perms(prefix) # set proper perms for the mirror files diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index 31251549b6..bce2b80ec9 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -89,10 +89,10 @@ class Axom(Package): # Libraries depends_on("conduit~shared+python", when="+python") depends_on("conduit~shared~python", when="~python") - depends_on("conduit~shared+hdf5+python", when="+hdf5+python") - depends_on("conduit~shared~hdf5+python", when="~hdf5+python") - depends_on("conduit~shared+hdf5~python", when="+hdf5~python") - depends_on("conduit~shared~hdf5~python", when="~hdf5~python") + depends_on("conduit~shared+python+hdf5", when="+hdf5+python") + depends_on("conduit~shared+python~hdf5", when="~hdf5+python") + depends_on("conduit~shared~python+hdf5", when="+hdf5~python") + depends_on("conduit~shared~python~hdf5", when="~hdf5~python") # HDF5 needs to be the same as Conduit's depends_on("hdf5@1.8.19:1.8.999~mpi~cxx~shared~fortran", when="+hdf5") @@ -162,7 +162,7 @@ def hostconfig(self, spec, prefix): # are we on a specific machine sys_type = self._get_sys_type(spec) on_blueos = 'blueos' in sys_type - on_blueos_p9 = 'p9' in sys_type + on_blueos_p9 = on_blueos and 'p9' in sys_type on_toss = 'toss_3' in sys_type # cmake @@ -253,14 +253,14 @@ def hostconfig(self, spec, prefix): if "+raja" in spec: raja_dir = get_spec_path(spec, "raja", path_replacements) cfg.write("# raja from uberenv\n") - cfg.write(cmake_cache_entry("RAJA_DIR", raja_dir + "/share/raja/cmake")) + cfg.write(cmake_cache_entry("RAJA_DIR", raja_dir)) else: cfg.write("# raja not build by uberenv\n\n") if "+umpire" in spec: umpire_dir = get_spec_path(spec, "umpire", path_replacements) cfg.write("# umpire from uberenv\n") - cfg.write(cmake_cache_entry("UMPIRE_DIR", umpire_dir + "/share/umpire/cmake")) + cfg.write(cmake_cache_entry("UMPIRE_DIR", umpire_dir)) else: cfg.write("# umpire not build by uberenv\n\n") @@ -331,19 +331,9 @@ def hostconfig(self, spec, prefix): cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", spec['mpi'].mpicxx)) if on_blueos or on_blueos_p9: # clang doesn't come with a fortran wrapper on blueos - - # blueos_p9 - spectrum_prefix = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release" - if spec['mpi'].mpifc == spectrum_prefix + "-clang-8.0.0/bin/mpif90": - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spectrum_prefix + "-xl-2019.06.12/bin/mpif90")) - elif spec['mpi'].mpifc == spectrum_prefix + "-clang-upstream-2019.03.26/bin/mpif90": - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spectrum_prefix + "-xl-2019.06.12/bin/mpif90")) - # blueos - elif spec['mpi'].mpifc == spectrum_prefix + "-clang-upstream-2018.11.09/bin/mpif90": - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spectrum_prefix + "-xl-2018.11.26/bin/mpif90")) + fortran_wrapper = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.12.23/bin/mpif90" + if not os.path.exists(spec['mpi'].mpifc) and "clang" in spec['mpi'].mpifc: + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", fortran_wrapper)) else: cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) else: diff --git a/scripts/uberenv/packages/conduit/package.py b/scripts/uberenv/packages/conduit/package.py index d8fc2fdaf6..103e97c8ef 100644 --- a/scripts/uberenv/packages/conduit/package.py +++ b/scripts/uberenv/packages/conduit/package.py @@ -1,42 +1,30 @@ -############################################################################## -# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. # -# This file is part of Spack. -# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. -# LLNL-CODE-647188 -# -# For details, see https://github.com/spack/spack -# Please also see the NOTICE and LICENSE files for our notice and the LGPL. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License (as -# published by the Free Software Foundation) version 2.1, February 1999. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and -# conditions of the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -############################################################################## +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + from spack import * import socket import os +import glob +import shutil import llnl.util.tty as tty from os import environ as env -def cmake_cache_entry(name, value): +def cmake_cache_entry(name, value, vtype=None): """ Helper that creates CMake cache entry strings used in 'host-config' files. """ - return 'set({0} "{1}" CACHE PATH "")\n\n'.format(name, value) + if vtype is None: + if value == "ON" or value == "OFF": + vtype = "BOOL" + else: + vtype = "PATH" + return 'set({0} "{1}" CACHE {2} "")\n\n'.format(name, value, vtype) class Conduit(Package): @@ -46,15 +34,16 @@ class Conduit(Package): coupling between packages in-core, serialization, and I/O tasks.""" homepage = "http://software.llnl.gov/conduit" - url = "https://github.com/LLNL/conduit/releases/download/v0.5.1/conduit-v0.5.1-src-with-blt.tar.gz" + git = "https://github.com/LLNL/conduit.git" - version('0.5.1', '4aecbd4abb9d7ab8c3a16e4f28fc8871') - version('0.4.0', sha256='c228e6f0ce5a9c0ffb98e0b3d886f2758ace1a4b40d00f3f118542c0747c1f52') - version('0.3.1', 'b98d1476199a46bde197220cd9cde042') - version('0.3.0', '6396f1d1ca16594d7c66d4535d4f898e') - # note: checksums on github automatic release source tars changed ~9/17 - version('0.2.1', 'ed7358af3463ba03f07eddd6a6e626ff') - version('0.2.0', 'a7b398d493fd71b881a217993a9a29d4') + version('master', branch='master', submodules=True, preferred=True) + version('0.5.1', tag='v0.5.1', submodules="True") + version('0.5.0', tag='v0.5.0', submodules="True") + version('0.4.0', tag='v0.4.0', submodules="True") + version('0.3.1', tag='v0.3.1', submodules="True") + version('0.3.0', tag='v0.3.0', submodules="True") + version('0.2.1', tag='v0.2.1', submodules="True") + version('0.2.0', tag='v0.2.0', submodules="True") maintainers = ['cyrush'] @@ -63,17 +52,22 @@ class Conduit(Package): ########################################################################### variant("shared", default=True, description="Build Conduit as shared libs") - - variant("cmake", default=True, - description="Build CMake (if off, attempt to use cmake from PATH)") + variant('test', default=True, description='Enable Conduit unit tests') # variants for python support variant("python", default=True, description="Build Conduit Python support") + variant("fortran", default=True, description="Build Conduit Fortran support") # variants for comm and i/o - variant("mpi", default=False, description="Build Conduit MPI Support") + variant("mpi", default=True, description="Build Conduit MPI Support") variant("hdf5", default=True, description="Build Conduit HDF5 support") + variant("hdf5_compat", default=True, + description="Build Conduit with HDF5 1.8.x (compatibility mode)") variant("silo", default=False, description="Build Conduit Silo support") + variant("adios", default=False, description="Build Conduit ADIOS support") + + # zfp compression + variant("zfp", default=False, description="Build Conduit ZFP support") # variants for dev-tools (docs, etc) variant("doc", default=False, description="Build Conduit's documentation") @@ -89,33 +83,53 @@ class Conduit(Package): # CMake ####################### # cmake 3.8.2 or newer - depends_on("cmake@3.8.2:", when="+cmake") + depends_on("cmake@3.8.2:", type='build') ####################### # Python ####################### - # we need a shared version of python b/c linking with static python lib - # causes duplicate state issues when running compiled python modules. - depends_on("python+shared", when="+python" ) + depends_on("python", when="+python") extends("python", when="+python") depends_on("py-numpy", when="+python", type=('build', 'run')) ####################### # I/O Packages ####################### + + ############### + # HDF5 + ############### # TODO: cxx variant is disabled due to build issue Cyrus # experienced on BGQ. When on, the static build tries # to link against shared libs. # # Use HDF5 1.8, for wider output compatibly # variants reflect we are not using hdf5's mpi or fortran features. - depends_on("hdf5@1.8.19:1.8.999~cxx~mpi~fortran", when="+hdf5+shared") - depends_on("hdf5@1.8.19:1.8.999~shared~cxx~mpi~fortran", when="+hdf5~shared") - + depends_on("hdf5@1.8.19:1.8.999~cxx~mpi~fortran", when="+hdf5+hdf5_compat+shared") + depends_on("hdf5@1.8.19:1.8.999~shared~cxx~mpi~fortran", when="+hdf5+hdf5_compat~shared") + depends_on("hdf5~cxx~mpi~fortran", when="+hdf5~hdf5_compat+shared") + depends_on("hdf5~shared~cxx~mpi~fortran", when="+hdf5~hdf5_compat~shared") + + ############### + # Silo + ############### # we are not using silo's fortran features depends_on("silo~fortran", when="+silo+shared") depends_on("silo~shared~fortran", when="+silo~shared") + ############### + # ADIOS + ############### + depends_on("adios+mpi~hdf5+shared", when="+adios+mpi+shared") + depends_on("adios+mpi~hdf5~shared~blosc", when="+adios+mpi~shared") + depends_on("adios~mpi~hdf5+shared", when="+adios~mpi+shared") + depends_on("adios~mpi~hdf5~shared~blosc", when="+adios~mpi~shared") + + ####################### + # ZFP + ####################### + depends_on("zfp", when="+zfp") + ####################### # MPI ####################### @@ -125,8 +139,15 @@ class Conduit(Package): # Documentation related ####################### depends_on("py-sphinx", when="+python+doc", type='build') + depends_on("py-sphinx-rtd-theme", when="+python+doc", type='build') depends_on("doxygen", when="+doc+doxygen") + # build phases used by this package + phases = ["configure", "build", "install"] + + def setup_build_environment(self, env): + env.set('CTEST_OUTPUT_ON_FAILURE', '1') + def url_for_version(self, version): """ Provide proper url @@ -144,9 +165,9 @@ def url_for_version(self, version): return "https://github.com/LLNL/conduit/releases/download/v{0}/conduit-v{1}-src-with-blt.tar.gz".format(v, v) return url - def install(self, spec, prefix): + def configure(self, spec, prefix): """ - Build and install Conduit. + Configure Conduit. """ with working_dir('spack-build', create=True): py_site_pkgs_dir = None @@ -156,36 +177,84 @@ def install(self, spec, prefix): host_cfg_fname = self.create_host_config(spec, prefix, py_site_pkgs_dir) + # save this filename for + # other package recipe steps to access + self.host_cfg_fname = host_cfg_fname cmake_args = [] - if 'bgq' in os.getenv('SYS_TYPE', ""): - ## Manually set up HDF5 library dependencies for BGQ to bypass errors from CMake's FindHDF5 - cmake_args.append("-DHDF5_C_LIBRARY_m:STRING=-lm") - cmake_args.append("-DHDF5_C_LIBRARY_dl:STRING=-ldl") - if 'blueos_3' in os.getenv('SYS_TYPE', "") and 'xl@coral' in os.getenv('SPACK_COMPILER_SPEC', ""): - # Fix missing std linker flag in xlc compiler - cmake_args.append("-DBLT_FORTRAN_FLAGS:STRING=-WF,-C! -qxlf2003=polymorphic") - - #Conduit can't link C++ into fortran for this spec, but works fine in host code - cmake_args.append('-DENABLE_TESTS=OFF') - cmake_args.append('-DENABLE_EXAMPLES=OFF') - # if we have a static build, we need to avoid any of # spack's default cmake settings related to rpaths # (see: https://github.com/spack/spack/issues/2658) if "+shared" in spec: cmake_args.extend(std_cmake_args) - cmake_args.append('-DBUILD_SHARED_LIBS=ON') else: - cmake_args.append('-DBUILD_SHARED_LIBS=OFF') for arg in std_cmake_args: if arg.count("RPATH") == 0: cmake_args.append(arg) cmake_args.extend(["-C", host_cfg_fname, "../src"]) + print("Configuring Conduit...") cmake(*cmake_args) - make(parallel=False) + + def build(self, spec, prefix): + """ + Build Conduit. + """ + with working_dir('spack-build'): + print("Building Conduit...") + make() + + @run_after('build') + @on_package_attributes(run_tests=True) + def test(self): + with working_dir('spack-build'): + print("Running Conduit Unit Tests...") + make("test") + + def install(self, spec, prefix): + """ + Install Conduit. + """ + with working_dir('spack-build'): make("install") # install copy of host config for provenance - install(host_cfg_fname, prefix) + print("Installing Conduit CMake Host Config File...") + install(self.host_cfg_fname, prefix) + + @run_after('install') + @on_package_attributes(run_tests=True) + def check_install(self): + """ + Checks the spack install of conduit using conduit's + using-with-cmake example + """ + print("Checking Conduit installation...") + spec = self.spec + install_prefix = spec.prefix + example_src_dir = join_path(install_prefix, + "examples", + "conduit", + "using-with-cmake") + print("Checking using-with-cmake example...") + with working_dir("check-conduit-using-with-cmake-example", + create=True): + cmake_args = ["-DCONDUIT_DIR={0}".format(install_prefix), + example_src_dir] + cmake(*cmake_args) + make() + example = Executable('./conduit_example') + example() + print("Checking using-with-make example...") + example_src_dir = join_path(install_prefix, + "examples", + "conduit", + "using-with-make") + example_files = glob.glob(join_path(example_src_dir, "*")) + with working_dir("check-conduit-using-with-make-example", + create=True): + for example_file in example_files: + shutil.copy(example_file, ".") + make("CONDUIT_DIR={0}".format(install_prefix)) + example = Executable('./conduit_example') + example() def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): """ @@ -215,8 +284,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): if self.compiler.fc: # even if this is set, it may not exist so do one more sanity check - if os.path.isfile(env["SPACK_FC"]): - f_compiler = env["SPACK_FC"] + f_compiler = which(env["SPACK_FC"]) ####################################################################### # By directly fetching the names of the actual compilers we appear @@ -229,19 +297,16 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): if "SYS_TYPE" in env: sys_type = env["SYS_TYPE"] + # are we on a specific machine + on_blueos = 'blueos' in sys_type + on_blueos_p9 = on_blueos and 'p9' in sys_type + on_toss = 'toss_3' in sys_type + ############################################## # Find and record what CMake is used ############################################## - if "+cmake" in spec: - cmake_exe = spec['cmake'].command.path - else: - cmake_exe = which("cmake") - if cmake_exe is None: - msg = 'failed to find CMake (and cmake variant is off)' - raise RuntimeError(msg) - cmake_exe = cmake_exe.path - + cmake_exe = spec['cmake'].command.path host_cfg_fname = "%s-%s-%s-conduit.cmake" % (socket.gethostname(), sys_type, spec.compiler) @@ -270,13 +335,39 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER", cpp_compiler)) cfg.write("# fortran compiler used by spack\n") - if f_compiler is not None: + if "+fortran" in spec and f_compiler is not None: cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON")) - cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", f_compiler)) + cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", + f_compiler.path)) else: cfg.write("# no fortran compiler found\n\n") cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF")) + if "+shared" in spec: + cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "ON")) + else: + cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF")) + + ####################### + # Unit Tests + ####################### + if "+test" in spec: + cfg.write(cmake_cache_entry("ENABLE_TESTS", "ON")) + else: + cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF")) + + # extra fun for blueos + if 'blueos_3' in sys_type and "+fortran" in spec: + if 'xl@coral' in os.getenv('SPACK_COMPILER_SPEC', ""): + # Fix missing std linker flag in xlc compiler + cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS", + "-WF,-C! -qxlf2003=polymorphic")) + # Grab lib directory for the current fortran compiler + libdir = os.path.join(os.path.dirname(os.path.dirname(f_compiler)), "lib") + cfg.write(cmake_cache_entry("BLT_EXE_LINKER_FLAGS", + "-Wl,-rpath," + libdir, + "Adds a missing rpath for libraries associated with the fortran compiler")) + ####################### # Python ####################### @@ -297,12 +388,14 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_entry("ENABLE_PYTHON", "OFF")) if "+doc" in spec: - cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON")) + if "+python" in spec: + cfg.write(cmake_cache_entry("ENABLE_DOCS", "ON")) - cfg.write("# sphinx from spack \n") - sphinx_build_exe = join_path(spec['py-sphinx'].prefix.bin, - "sphinx-build") - cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", sphinx_build_exe)) + cfg.write("# sphinx from spack \n") + sphinx_build_exe = join_path(spec['py-sphinx'].prefix.bin, + "sphinx-build") + cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", + sphinx_build_exe)) if "+doxygen" in spec: cfg.write("# doxygen from uberenv\n") doxygen_exe = spec['doxygen'].command.path @@ -317,12 +410,31 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): cfg.write("# MPI Support\n") if "+mpi" in spec: + mpicc_path = spec['mpi'].mpicc + mpicxx_path = spec['mpi'].mpicxx + mpifc_path = spec['mpi'].mpifc + # if we are using compiler wrappers on cray systems + # use those for mpi wrappers, b/c spec['mpi'].mpicxx + # etc make return the spack compiler wrappers + # which can trip up mpi detection in CMake 3.14 + if cpp_compiler == "CC": + mpicc_path = "cc" + mpicxx_path = "CC" + mpifc_path = "ftn" cfg.write(cmake_cache_entry("ENABLE_MPI", "ON")) - cfg.write(cmake_cache_entry("MPI_C_COMPILER", spec['mpi'].mpicc)) - cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", - spec['mpi'].mpicxx)) - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", - spec['mpi'].mpifc)) + cfg.write(cmake_cache_entry("MPI_C_COMPILER", mpicc_path)) + cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", mpicxx_path)) + + if on_blueos or on_blueos_p9: + # clang doesn't come with a fortran wrapper on blueos + fortran_wrapper = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.12.23/bin/mpif90" + if not os.path.exists(spec['mpi'].mpifc) and "clang" in spec['mpi'].mpifc: + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", fortran_wrapper)) + else: + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) + else: + cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) + mpiexe_bin = join_path(spec['mpi'].prefix.bin, 'mpiexec') if os.path.isfile(mpiexe_bin): # starting with cmake 3.10, FindMPI expects MPIEXEC_EXECUTABLE @@ -336,6 +448,15 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): else: cfg.write(cmake_cache_entry("ENABLE_MPI", "OFF")) + ####################### + # ZFP + ####################### + cfg.write("# zfp from spack \n") + if "+zfp" in spec: + cfg.write(cmake_cache_entry("ZFP_DIR", spec['zfp'].prefix)) + else: + cfg.write("# zfp not built by spack \n") + ####################################################################### # I/O Packages ####################################################################### @@ -364,6 +485,17 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): else: cfg.write("# silo not built by spack \n") + ####################### + # ADIOS + ####################### + + cfg.write("# ADIOS from spack \n") + + if "+adios" in spec: + cfg.write(cmake_cache_entry("ADIOS_DIR", spec['adios'].prefix)) + else: + cfg.write("# adios not built by spack \n") + cfg.write("##################################\n") cfg.write("# end spack generated host-config\n") cfg.write("##################################\n") diff --git a/scripts/uberenv/packages/raja/package.py b/scripts/uberenv/packages/raja/package.py index 73a060c5e2..bc4ef4886d 100644 --- a/scripts/uberenv/packages/raja/package.py +++ b/scripts/uberenv/packages/raja/package.py @@ -47,4 +47,11 @@ def cmake_args(self): '-DENABLE_CUDA=On', '-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)]) + # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which is used by the spack compiler wrapper + sys_type = "" + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + if "blueos" in sys_type: + options.extend(['-DENABLE_TESTS=OFF']) + return options diff --git a/scripts/uberenv/spack_configs/bgqos_0/compilers.yaml b/scripts/uberenv/spack_configs/bgqos_0/compilers.yaml deleted file mode 100644 index ed2292b5f9..0000000000 --- a/scripts/uberenv/spack_configs/bgqos_0/compilers.yaml +++ /dev/null @@ -1,27 +0,0 @@ -compilers: -- compiler: - environment: {} - extra_rpaths: [] - flags: {} - modules: [] - operating_system: cnk - paths: - cc: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang - cxx: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang++ - f77: /usr/local/tools/toolchain-4.8.4/gnu-linux-4.8.4/bin/powerpc64-bgq-linux-gfortran - fc: /usr/local/tools/toolchain-4.8.4/gnu-linux-4.8.4/bin/powerpc64-bgq-linux-gfortran - spec: clang@4.0.0_gfortran - target: ppc64 -- compiler: - environment: {} - extra_rpaths: [] - flags: {} - modules: [] - operating_system: cnk - paths: - cc: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang - cxx: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/bin/bgclang++ - f77: /opt/ibmcmp/xlf/bg/14.1/bin/bgxlf - fc: /opt/ibmcmp/xlf/bg/14.1/bin/bgxlf2003 - spec: clang@4.0.0_xlf - target: ppc64 diff --git a/scripts/uberenv/spack_configs/bgqos_0/packages.yaml b/scripts/uberenv/spack_configs/bgqos_0/packages.yaml deleted file mode 100644 index 3473b5f920..0000000000 --- a/scripts/uberenv/spack_configs/bgqos_0/packages.yaml +++ /dev/null @@ -1,79 +0,0 @@ - -# ------------------------------------------------------------------------- -# This file controls default concretization preferences for Spack. -# -# Settings here are versioned with Spack and are intended to provide -# sensible defaults out of the box. Spack maintainers should edit this -# file to keep it current. -# -# Users can override these settings by editing the following files. -# -# Per-spack-instance settings (overrides defaults): -# $SPACK_ROOT/etc/spack/packages.yaml -# -# Per-user settings (overrides default and site settings): -# ~/.spack/packages.yaml -# ------------------------------------------------------------------------- -packages: - all: - compiler: [gcc, intel, pgi, clang, xl, nag] - providers: - awk: [gawk] - blas: [openblas] - daal: [intel-daal] - elf: [elfutils] - golang: [gcc] - ipp: [intel-ipp] - java: [jdk] - lapack: [openblas] - mkl: [intel-mkl] - mpe: [mpe2] - mpi: [mpich] - opencl: [pocl] - openfoam: [openfoam-com, openfoam-org, foam-extend] - pil: [py-pillow] - scalapack: [netlib-scalapack] - szip: [libszip, libaec] - tbb: [intel-tbb] - jpeg: [libjpeg-turbo, libjpeg] -# LLNL mpi - mpich: - paths: - mpich@3.bgq.fastmpi %clang@4.0.0_gfortran arch=bgq-cnk-ppc64: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/llnl - mpich@3.bgq.fastmpi %clang@4.0.0_xlf arch=bgq-cnk-ppc64: /collab/usr/gapps/opnsrc/gnu/dev/lnx-2.12-ppc/bgclang/r284961-stable/llnl - buildable: False -# System level packages to not build - autotools: - paths: - autotools: /usr/bin/ - buildable: False - bzip2: - paths: - bzip2: /usr/bin/ - buildable: False - gettext: - paths: - gettext: /usr/bin/ - buildable: False - m4: - paths: - m4: /usr/bin/ - buildable: False - pkg-config: - paths: - pkg-config: /usr/bin/ - buildable: False - tar: - paths: - tar: /usr/bin/ - buildable: False - graphviz: - paths: - graphviz: /usr/local/bin/ - buildable: False -# On BGQ specifically just use the system CMake - cmake: - version: [3.8.2] - paths: - cmake: /collab/usr/global/tools/cmake/bgqos_0/cmake-3.8.2/ - buildable: False diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml index 91fddb820a..d27dc5a3ad 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml @@ -18,29 +18,16 @@ packages: all: compiler: [gcc, intel, pgi, clang, xl, nag] providers: - awk: [gawk] - blas: [openblas] - daal: [intel-daal] - elf: [elfutils] - golang: [gcc] - ipp: [intel-ipp] - java: [jdk] - lapack: [openblas] - mkl: [intel-mkl] - mpe: [mpe2] + blas: [netlib-lapack] + lapack: [netlib-lapack] mpi: [mvapich2] - opencl: [pocl] - openfoam: [openfoam-com, openfoam-org, foam-extend] - pil: [py-pillow] - scalapack: [netlib-scalapack] - szip: [libszip, libaec] - tbb: [intel-tbb] - jpeg: [libjpeg-turbo, libjpeg] + # LLNL blueos CUDA cuda: paths: cuda@10.1.168: /usr/tce/packages/cuda/cuda-10.1.168 buildable: False + # LLNL blueos mpi # note, we need to fake this as an existing mpi package # so even though this is spectrum mpi, we call it mvapich2 @@ -51,31 +38,83 @@ packages: mvapich2@2.2%clang@upstream_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09 mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26 buildable: False +# Spack may grab for mpi & we don't want to use them + openmpi: + buildable: False + mpich: + buildable: False + spectrum-mpi: + buildable: False + charmpp: + buildable: False + charm: + buildable: False + intel-mpi: + buildable: False + intel-parallel-studio: + buildable: False + fujitsu-mpi: + buildable: False + mpilander: + buildable: False + mpt: + buildable: False + + # blas is a bit more complicated because its a virtual package so fake it with + # the following per spack docs + netlib-lapack: + paths: + netlib-lapack@3.6.1: /usr + buildable: False + # System level packages to not build + autoconf: + paths: + autoconf: /usr + buildable: False + automake: + paths: + automake: /usr + buildable: False bzip2: paths: - bzip2: /usr/bin/ + bzip2: /usr buildable: False gettext: paths: - gettext: /usr/bin/ + gettext: /usr + buildable: False + libtool: + paths: + libtool: /usr buildable: False m4: paths: - m4: /usr/bin/ + m4: /usr buildable: False + perl: + paths: + perl: /usr + buildable: False pkg-config: paths: - pkg-config: /usr/bin/ + pkg-config: /usr buildable: False tar: paths: - tar: /usr/bin/ + tar: /usr buildable: False graphviz: paths: - graphviz: /usr/bin/ + graphviz: /usr buildable: False + +# Globally lock in version of CMake cmake: - version: [3.9.6] + version: [3.9.2] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.9.2 + buildable: False + conduit: + version: [0.5.1] diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml index 0548dfc824..afd35354de 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml @@ -9,7 +9,7 @@ compilers: cc: /usr/tce/packages/gcc/gcc-7.3.1/bin/gcc cxx: /usr/tce/packages/gcc/gcc-7.3.1/bin/g++ f77: /usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran - fc: /usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran spec: gcc@7.3.1 target: ppc64le - compiler: @@ -21,8 +21,8 @@ compilers: paths: cc: /usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang cxx: /usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++ - f77: /usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003 - fc: /usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003 + f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 spec: clang@upstream_xlf target: ppc64le - compiler: @@ -32,10 +32,10 @@ compilers: modules: [] operating_system: rhel7 paths: - cc: /usr/tce/packages/clang/clang-8.0.0/bin/clang - cxx: /usr/tce/packages/clang/clang-8.0.0/bin/clang++ - f77: /usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003 - fc: /usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003 + cc: /usr/tce/packages/clang/clang-8.0.1/bin/clang + cxx: /usr/tce/packages/clang/clang-8.0.1/bin/clang++ + f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 spec: clang@8.0.0_nvcc_xlf target: ppc64le - compiler: @@ -45,10 +45,10 @@ compilers: modules: [] operating_system: rhel7 paths: - cc: /usr/tce/packages/xl/xl-2019.06.12/bin/xlc - cxx: /usr/tce/packages/xl/xl-2019.06.12/bin/xlC - f77: /usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003 - fc: /usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003 + cc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlc + cxx: /usr/tce/packages/xl/xl-2019.12.23/bin/xlC + f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 spec: xl@coral target: ppc64le diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml index 00e3cb50f8..7742bc147c 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml @@ -18,64 +18,103 @@ packages: all: compiler: [gcc, intel, pgi, clang, xl, nag] providers: - awk: [gawk] - blas: [openblas] - daal: [intel-daal] - elf: [elfutils] - golang: [gcc] - ipp: [intel-ipp] - java: [jdk] - lapack: [openblas] - mkl: [intel-mkl] - mpe: [mpe2] + blas: [netlib-lapack] + lapack: [netlib-lapack] mpi: [mvapich2] - opencl: [pocl] - openfoam: [openfoam-com, openfoam-org, foam-extend] - pil: [py-pillow] - scalapack: [netlib-scalapack] - szip: [libszip, libaec] - tbb: [intel-tbb] - jpeg: [libjpeg-turbo, libjpeg] + # LLNL blueos CUDA cuda: paths: - cuda@10.1.168: /usr/tce/packages/cuda/cuda-10.1.168 + cuda@10.1.243: /usr/tce/packages/cuda/cuda-10.1.243 buildable: False + # LLNL blueos mpi # note, we need to fake this as an existing mpi package # so even though this is spectrum mpi, we call it mvapich2 mvapich2: paths: mvapich2@2.2%gcc@7.3.1: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/ - mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/ - mvapich2@2.2%clang@8.0.0_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.0/ - mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/ + mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ + mvapich2@2.2%clang@8.0.0_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/ + mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ + buildable: False +# Spack may grab for mpi & we don't want to use them + openmpi: + buildable: False + mpich: + buildable: False + spectrum-mpi: + buildable: False + charmpp: + buildable: False + charm: buildable: False + intel-mpi: + buildable: False + intel-parallel-studio: + buildable: False + fujitsu-mpi: + buildable: False + mpilander: + buildable: False + mpt: + buildable: False + + # blas is a bit more complicated because its a virtual package so fake it with + # the following per spack docs + netlib-lapack: + paths: + netlib-lapack@3.6.1: /usr + buildable: False + # System level packages to not build + autoconf: + paths: + autoconf: /usr + buildable: False + automake: + paths: + automake: /usr + buildable: False bzip2: paths: - bzip2: /usr/bin/ + bzip2: /usr buildable: False gettext: paths: - gettext: /usr/bin/ + gettext: /usr + buildable: False + libtool: + paths: + libtool: /usr buildable: False m4: paths: - m4: /usr/bin/ + m4: /usr buildable: False + perl: + paths: + perl: /usr + buildable: False pkg-config: paths: - pkg-config: /usr/bin/ + pkg-config: /usr buildable: False tar: paths: - tar: /usr/bin/ + tar: /usr buildable: False graphviz: paths: - graphviz: /usr/bin/ + graphviz: /usr buildable: False + +# Globally lock in version of CMake cmake: - version: [3.9.6] + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False + conduit: + version: [0.5.1] diff --git a/scripts/uberenv/spack_configs/config.yaml b/scripts/uberenv/spack_configs/config.yaml index 962afe918f..270d31ff65 100644 --- a/scripts/uberenv/spack_configs/config.yaml +++ b/scripts/uberenv/spack_configs/config.yaml @@ -43,9 +43,7 @@ config: # # The build stage can be purged with `spack purge --stage`. build_stage: - - $tempdir - - /nfs/tmp2/$user - - $spack/var/spack/stage + - $spack/../builds # Cache directory already downloaded source tarballs and archived diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index 6727cdc52f..2dd489fe7b 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -112,5 +112,10 @@ packages: # Globally lock in version of CMake cmake: - version: [3.9.6] + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False + conduit: + version: [0.5.1] diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index c8c596dc7b..52cd254f7a 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -14,7 +14,7 @@ "__comment__":"##############################################################################", "toss_3_x86_64_ib": - [ "clang@4.0.0+devtools", + [ "clang@4.0.0", "clang@6.0.0", "gcc@6.1.0", "gcc@7.3.0", diff --git a/src/axom/sidre/tests/CMakeLists.txt b/src/axom/sidre/tests/CMakeLists.txt index b2ea89b15b..762f5a9581 100644 --- a/src/axom/sidre/tests/CMakeLists.txt +++ b/src/axom/sidre/tests/CMakeLists.txt @@ -77,20 +77,18 @@ endforeach() #------------------------------------------------------------------------------ # Add gtest C tests #------------------------------------------------------------------------------ -if (ENABLE_FORTRAN) - foreach(test ${gtest_sidre_C_tests}) - get_filename_component( test_name ${test} NAME_WE ) - blt_add_executable( NAME ${test_name}_test - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${sidre_test_depends} gtest - FOLDER axom/sidre/tests - ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name}_test - ) - endforeach() -endif() +foreach(test ${gtest_sidre_C_tests}) + get_filename_component( test_name ${test} NAME_WE ) + blt_add_executable( NAME ${test_name}_test + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${sidre_test_depends} gtest + FOLDER axom/sidre/tests + ) + blt_add_test( NAME ${test_name} + COMMAND ${test_name}_test + ) +endforeach() #------------------------------------------------------------------------------ # Add Fortran tests diff --git a/src/cmake/thirdparty/FindRAJA.cmake b/src/cmake/thirdparty/FindRAJA.cmake deleted file mode 100644 index 271d53992c..0000000000 --- a/src/cmake/thirdparty/FindRAJA.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -# other Axom Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ -# Setup RAJA -#------------------------------------------------------------------------------ - -if (NOT RAJA_DIR) - message(FATAL_ERROR "Could not find RAJA. RAJA_DIR must be explicitly specified when configuring CMake" ) -endif() - -find_package(RAJA REQUIRED) -if(TARGET RAJA) - message(STATUS "Found RAJA: ${RAJA_DIR}") -endif() diff --git a/src/cmake/thirdparty/FindUmpire.cmake b/src/cmake/thirdparty/FindUmpire.cmake deleted file mode 100644 index b4ab30a08c..0000000000 --- a/src/cmake/thirdparty/FindUmpire.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -# other Axom Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ -# Setup UMPIRE -#------------------------------------------------------------------------------ - -if (NOT UMPIRE_DIR) - message(FATAL_ERROR "Could not find Umpire. UMPIRE_DIR must be explicitly specified when configuring CMake" ) -endif() - -find_package(umpire REQUIRED PATHS ${UMPIRE_DIR} ) -find_package_handle_standard_args( UMPIRE DEFAULT_MSG - UMPIRE_INCLUDE_DIRS - ) diff --git a/src/cmake/thirdparty/SetupAxomThirdParty.cmake b/src/cmake/thirdparty/SetupAxomThirdParty.cmake index 9e65461031..3346021c28 100644 --- a/src/cmake/thirdparty/SetupAxomThirdParty.cmake +++ b/src/cmake/thirdparty/SetupAxomThirdParty.cmake @@ -11,11 +11,26 @@ # UMPIRE #------------------------------------------------------------------------------ if (UMPIRE_DIR) - include(cmake/thirdparty/FindUmpire.cmake) - blt_register_library( NAME umpire - INCLUDES ${UMPIRE_INCLUDE_DIRS} - LIBRARIES umpire - TREAT_INCLUDES_AS_SYSTEM ON) + if (NOT EXISTS "${UMPIRE_DIR}") + message(FATAL_ERROR "Given UMPIRE_DIR does not exist: ${UMPIRE_DIR}") + endif() + + if (NOT IS_DIRECTORY "${UMPIRE_DIR}") + message(FATAL_ERROR "Given UMPIRE_DIR is not a directory: ${UMPIRE_DIR}") + endif() + + find_package(umpire REQUIRED PATHS ${UMPIRE_DIR} ) + + message(STATUS "Checking for expected Umpire target 'umpire'") + if (NOT TARGET umpire) + message(FATAL_ERROR "Umpire failed to load: ${UMPIRE_DIR}") + else() + message(STATUS "Umpire loaded: ${UMPIRE_DIR}") + set_property(TARGET umpire + APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES + ${UMPIRE_INCLUDE_DIRS}) + + endif() else() message(STATUS "Umpire support is OFF") endif() @@ -25,7 +40,22 @@ endif() # RAJA #------------------------------------------------------------------------------ if (RAJA_DIR) - include(cmake/thirdparty/FindRAJA.cmake) + if (NOT EXISTS "${RAJA_DIR}") + message(FATAL_ERROR "Given RAJA_DIR does not exist: ${RAJA_DIR}") + endif() + + if (NOT IS_DIRECTORY "${RAJA_DIR}") + message(FATAL_ERROR "Given RAJA_DIR is not a directory: ${RAJA_DIR}") + endif() + + find_package(RAJA REQUIRED PATHS ${RAJA_DIR} ) + + message(STATUS "Checking for expected RAJA target 'RAJA'") + if (NOT TARGET RAJA) + message(FATAL_ERROR "RAJA failed to load: ${RAJA_DIR}") + else() + message(STATUS "RAJA loaded: ${RAJA_DIR}") + endif() else() message(STATUS "RAJA support is OFF" ) endif() @@ -115,20 +145,26 @@ endif() # Remove exported OpenMP flags because they are not language agnostic +set(_props) +if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" ) + list(APPEND _props INTERFACE_LINK_OPTIONS) +endif() +list(APPEND _props INTERFACE_COMPILE_OPTIONS) + foreach(_target RAJA camp umpire umpire_alloc) if(TARGET ${_target}) - get_target_property(_flags ${_target} INTERFACE_COMPILE_OPTIONS) - if ( _flags ) - - message(STATUS "Removing OpenMP Flags from target[${_target}]") - - string( REPLACE "${OpenMP_CXX_FLAGS}" "" - correct_flags "${_flags}" ) - string( REPLACE "${OpenMP_Fortran_FLAGS}" "" - correct_flags "${correct_flags}" ) - - set_target_properties( ${_target} PROPERTIES INTERFACE_COMPILE_OPTIONS - "${correct_flags}" ) - endif() + message(STATUS "Removing OpenMP Flags from target[${_target}]") + + foreach(_prop ${_props}) + get_target_property(_flags ${_target} ${_prop}) + if ( _flags ) + string( REPLACE "${OpenMP_CXX_FLAGS}" "" + correct_flags "${_flags}" ) + string( REPLACE "${OpenMP_Fortran_FLAGS}" "" + correct_flags "${correct_flags}" ) + + set_target_properties( ${_target} PROPERTIES ${_prop} "${correct_flags}" ) + endif() + endforeach() endif() endforeach() From eaa356f713df4000b2fc6b0093edec6c4293104c Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 7 Feb 2020 17:00:32 -0800 Subject: [PATCH 011/632] More work to split off devtools --- scripts/llnl_scripts/build_devtools.py | 79 ++++++++++++ scripts/llnl_scripts/build_tpls.py | 2 +- scripts/llnl_scripts/llnl_lc_build_tools.py | 116 +++++++++++++++--- scripts/uberenv/devtools.json | 10 ++ scripts/uberenv/packages/axom/package.py | 14 +-- .../uberenv/packages/axomdevtools/package.py | 21 ++++ scripts/uberenv/packages/conduit/package.py | 2 +- scripts/uberenv/project.json | 7 +- .../blueos_3_ppc64le_ib_p9/compilers.yaml | 2 +- .../devtools/compilers.yaml | 14 +++ .../devtools/packages.yaml | 100 +++++++++++++++ .../blueos_3_ppc64le_ib_p9/packages.yaml | 6 +- .../toss_3_x86_64_ib/devtools/compilers.yaml | 14 +++ .../toss_3_x86_64_ib/devtools/packages.yaml | 100 +++++++++++++++ .../toss_3_x86_64_ib/packages.yaml | 4 +- scripts/uberenv/specs.json | 2 +- scripts/uberenv/uberenv.py | 25 ++-- .../thirdparty/SetupAxomThirdParty.cmake | 5 +- 18 files changed, 467 insertions(+), 56 deletions(-) create mode 100755 scripts/llnl_scripts/build_devtools.py create mode 100644 scripts/uberenv/devtools.json create mode 100644 scripts/uberenv/packages/axomdevtools/package.py create mode 100644 scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/compilers.yaml create mode 100644 scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml create mode 100644 scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/compilers.yaml create mode 100644 scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml diff --git a/scripts/llnl_scripts/build_devtools.py b/scripts/llnl_scripts/build_devtools.py new file mode 100755 index 0000000000..cfe5775db7 --- /dev/null +++ b/scripts/llnl_scripts/build_devtools.py @@ -0,0 +1,79 @@ +#!/bin/sh +"exec" "python" "-u" "-B" "$0" "$@" + +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) + +""" + file: build_devtools.py + + description: + Builds all Axom Devtools + +""" + +from llnl_lc_build_tools import * + +from optparse import OptionParser + +import os + + +def parse_args(): + "Parses args from command line" + parser = OptionParser() + # Location of source directory to build + parser.add_option("-d", "--directory", + dest="directory", + default="", + help="Location to build all TPL's, timestamp directory will be created (Defaults to shared location)") + # Whether to archive results + parser.add_option("-a", "--archive", + dest="archive", + default="", + help="Archive build results under given name (Defaults to off)") + + ############### + # parse args + ############### + opts, extras = parser.parse_args() + # we want a dict b/c the values could + # be passed without using optparse + opts = vars(opts) + return opts + + +def main(): + opts = parse_args() + + # Determine location to do all the building + if opts["directory"] != "": + build_dir = opts["directory"] + if not os.path.exists(build_dir): + os.makedirs(build_dir) + else: + build_dir = get_shared_devtool_dir() + build_dir = os.path.abspath(build_dir) + + repo_dir = get_repo_dir() + + if opts["archive"] != "": + job_name = opts["archive"] + else: + job_name = get_username() + "/" + os.path.basename(__file__) + + try: + original_wd = os.getcwd() + os.chdir(repo_dir) + + res = build_devtools(build_dir, job_name, get_timestamp()) + finally: + os.chdir(original_wd) + + return res + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/llnl_scripts/build_tpls.py b/scripts/llnl_scripts/build_tpls.py index 2b1b03ecab..29f53ec310 100755 --- a/scripts/llnl_scripts/build_tpls.py +++ b/scripts/llnl_scripts/build_tpls.py @@ -55,7 +55,7 @@ def main(): if not os.path.exists(builds_dir): os.makedirs(builds_dir) else: - builds_dir = get_shared_tpl_builds_dir() + builds_dir = get_shared_libs_dir() builds_dir = os.path.abspath(builds_dir) repo_dir = get_repo_dir() diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index b53460c837..20f6fef4ab 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -248,21 +248,25 @@ def archive_tpl_logs(prefix, job_name, timestamp): set_axom_group_and_perms(archive_dir) -def uberenv_create_mirror(prefix,mirror_path): +def uberenv_create_mirror(prefix, project_file, mirror_path): """ Calls uberenv to create a spack mirror. """ - cmd = "python scripts/uberenv/uberenv.py --prefix %s --mirror %s --create-mirror " % (prefix,mirror_path) + cmd = "python scripts/uberenv/uberenv.py --create-mirror" + cmd += " --prefix=\"{0}\" --mirror=\"{1}\"".format(prefix, mirror_path) + cmd += " --project-json=\"{0}\" ".format(project_file) return sexe(cmd,echo=True,error_prefix="WARNING:") -def uberenv_install_tpls(prefix,spec,mirror = None): +def uberenv_build(prefix, spec, project_file, config_dir, mirror_path): """ Calls uberenv to install tpls for a given spec to given prefix. """ - cmd = "python scripts/uberenv/uberenv.py --prefix=\"%s\" --spec=\"%s\" " % (prefix,spec) - if not mirror is None: - cmd += "--mirror=\"%s\"" % mirror + cmd = "python scripts/uberenv/uberenv.py " + cmd += "--prefix=\"{0}\" --spec=\"{1}\" ".format(prefix, spec) + cmd += "--project-json=\"{0}\" ".format(project_file) + cmd += "--mirror=\"{0}\" ".format(mirror_path) + cmd += "--spack-config-dir=\"{0}\" ".format(config_dir) spack_tpl_build_log = pjoin(prefix,"output.log.spack.tpl.build.%s.txt" % spec.replace(" ", "_")) print "[starting tpl install of spec %s]" % spec @@ -453,6 +457,9 @@ def set_axom_group_and_perms(directory): def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): + project_file = "scripts/uberenv/project.json" + config_dir = "scripts/uberenv/spack_configs/{0}".format(get_system_type()) + specs = get_specs_for_current_machine() print "[Building and testing tpls for specs: " for spec in specs: @@ -460,17 +467,21 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): print "]\n" # Use shared network mirror location otherwise create local one - mirror_dir = get_shared_tpl_mirror_dir() + mirror_dir = get_shared_mirror_dir() if not os.path.exists(mirror_dir): mirror_dir = pjoin(builds_dir,"mirror") print "[using mirror location: %s]" % mirror_dir # unique install location - prefix = pjoin(builds_dir, timestamp) + prefix = pjoin(builds_dir, get_system_type()) + if not os.path.exists(prefix): + os.mkdir(prefix) + prefix = pjoin(prefix, timestamp) + # create a mirror - uberenv_create_mirror(prefix,mirror_dir) + uberenv_create_mirror(prefix, project_file, mirror_dir) # write info about this build - write_build_info(pjoin(prefix,"info.json"), job_name) + write_build_info(pjoin(prefix, "info.json"), job_name) repo_dir = get_repo_dir() # Clean previously generated host-configs into TPL install directory @@ -483,12 +494,13 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): tpl_build_failed = False for spec in specs: start_time = time.time() - res = uberenv_install_tpls(prefix,spec,mirror_dir) + res = uberenv_build(prefix, spec, project_file, config_dir, mirror_dir) end_time = time.time() print "[build time: {0}]".format(convertSecondsToReadableTime(end_time - start_time)) if res != 0: print "[ERROR: Failed build of tpls for spec %s]\n" % spec tpl_build_failed = True + break else: print "[SUCCESS: Finished build tpls for spec %s]\n" % spec @@ -515,6 +527,72 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): return res +def build_devtools(builds_dir, job_name, timestamp): + sys_type = get_system_type() + config_dir = "scripts/uberenv/spack_configs/{0}/devtools".format(sys_type) + project_file = "scripts/uberenv/devtools.json" + + if "toss_3" in sys_type: + compiler_spec = "%gcc@8.1.0" + compiler_dir = "gcc-8.1.0" + elif "blueos" in sys_type: + compiler_spec = "%gcc@8.3.1" + compiler_dir = "gcc-8.3.1" + + print "[Building devtools using compiler spec: {0}]".format(compiler_spec) + + # unique install location + prefix = pjoin(builds_dir, sys_type) + if not os.path.exists(prefix): + os.mkdir(prefix) + prefix = pjoin(prefix, timestamp) + if not os.path.exists(prefix): + os.makedirs(prefix) + + # Use shared mirror + mirror_dir = get_shared_mirror_dir() + print "[Using mirror location: {0}]".format(mirror_dir) + uberenv_create_mirror(prefix, project_file, mirror_dir) + + # write info about this build + write_build_info(pjoin(prefix,"info.json"), job_name) + + # use uberenv to install devtools + start_time = time.time() + res = uberenv_build(prefix, compiler_spec, project_file, config_dir, mirror_dir) + end_time = time.time() + + print "[Build time: {0}]".format(convertSecondsToReadableTime(end_time - start_time)) + if res != 0: + print "[ERROR: Failed build of devtools for spec %s]\n" % compiler_spec + else: + # Only update the latest symlink if successful + link_path = pjoin(builds_dir, sys_type) + link_path = pjoin(link_path, "latest") + install_dir = pjoin(prefix, compiler_dir) + print "[Creating symlink to latest devtools build:\n{0}\n->\n{1}]".format(link_path, install_dir) + if os.path.exists(link_path) or os.path.islink(link_path): + if not os.path.islink(link_path): + print "[ERROR: Latest devtools link path exists and is not a link: {0}".format(link_path) + return 1 + os.unlink(link_path) + os.symlink(install_dir, link_path) + + # Clean up directories we don't need to save + dir_names = ["builds", "spack"] + for dir_name in dir_names: + path_to_be_deleted = pjoin(prefix, dir_name) + print "[Removing path after successful devtools build: {0}]".format(path_to_be_deleted) + if os.path.exists(path_to_be_deleted): + shutil.rmtree(path_to_be_deleted) + + print "[SUCCESS: Finished build devtools for spec %s]\n" % compiler_spec + + # set proper perms for installed devtools + set_axom_group_and_perms(prefix) + + return res + def get_host_configs_for_current_machine(src_dir, use_generated_host_configs): host_configs = [] @@ -566,16 +644,20 @@ def get_archive_base_dir(): return "/usr/WS2/axomdev/archive" -def get_shared_tpl_base_dir(): - return "/usr/WS1/axom/thirdparty_libs" +def get_shared_base_dir(): + return "/usr/WS1/axom" + + +def get_shared_mirror_dir(): + return pjoin(get_shared_base_dir(), "mirror") -def get_shared_tpl_mirror_dir(): - return pjoin(get_shared_tpl_base_dir(), "mirror") +def get_shared_libs_dir(): + return pjoin(get_shared_base_dir(), "libs") -def get_shared_tpl_builds_dir(): - return pjoin(get_shared_tpl_base_dir(), "builds") +def get_shared_devtool_dir(): + return pjoin(get_shared_base_dir(), "devtools") def get_specs_for_current_machine(): diff --git a/scripts/uberenv/devtools.json b/scripts/uberenv/devtools.json new file mode 100644 index 0000000000..dabc47fae6 --- /dev/null +++ b/scripts/uberenv/devtools.json @@ -0,0 +1,10 @@ +{ +"package_name" : "axomdevtools", +"package_version" : "fakeversion", +"package_source_dir" : "../..", +"spack_url": "https://github.com/spack/spack", +"spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6", +"spack_activate" : {"py-sphinx" : [""], + "py-shroud" : [""], + "py-pyyaml" : [""]} +} diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index bce2b80ec9..a1a811e1d6 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -63,9 +63,6 @@ class Axom(Package): variant('debug', default=False, description='Build debug instead of optimized version') - variant('devtools', default=False, - description="Build development tools (such as sphinx, uncrustify, etc)") - variant("python", default=False, description="Build python support") variant("mpi", default=True, description="Build MPI support") @@ -114,15 +111,6 @@ class Axom(Package): depends_on("python", when="+python") - # Devtools - depends_on("python", when="+devtools") - depends_on("doxygen", when="+devtools") - depends_on("uncrustify@0.61", when="+devtools") - depends_on("cppcheck", when="+devtools") - depends_on("graphviz", when="+devtools") - depends_on("py-sphinx", when="+devtools") - depends_on("py-shroud", when="+devtools") - def _get_sys_type(self, spec): sys_type = spec.architecture @@ -264,7 +252,7 @@ def hostconfig(self, spec, prefix): else: cfg.write("# umpire not build by uberenv\n\n") - if "python" in spec or "devtools" in spec: + if "python" in spec: python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) cfg.write("# python from uberenv\n") cfg.write(cmake_cache_entry("PYTHON_EXECUTABLE",pjoin(python_bin_dir, "python"))) diff --git a/scripts/uberenv/packages/axomdevtools/package.py b/scripts/uberenv/packages/axomdevtools/package.py new file mode 100644 index 0000000000..4dd38707f6 --- /dev/null +++ b/scripts/uberenv/packages/axomdevtools/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + +class Axomdevtools(BundlePackage): + """This is a set of tools necessary for the developers of Axom""" + + version('fakeversion') + + maintainers = ['white238'] + + depends_on("python") + depends_on("doxygen") + depends_on("uncrustify@0.61") + depends_on("cppcheck") + depends_on("graphviz") + depends_on("py-sphinx") + depends_on("py-shroud") diff --git a/scripts/uberenv/packages/conduit/package.py b/scripts/uberenv/packages/conduit/package.py index 103e97c8ef..8a29034df7 100644 --- a/scripts/uberenv/packages/conduit/package.py +++ b/scripts/uberenv/packages/conduit/package.py @@ -363,7 +363,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS", "-WF,-C! -qxlf2003=polymorphic")) # Grab lib directory for the current fortran compiler - libdir = os.path.join(os.path.dirname(os.path.dirname(f_compiler)), "lib") + libdir = os.path.join(os.path.dirname(os.path.dirname(f_compiler.path)), "lib") cfg.write(cmake_cache_entry("BLT_EXE_LINKER_FLAGS", "-Wl,-rpath," + libdir, "Adds a missing rpath for libraries associated with the fortran compiler")) diff --git a/scripts/uberenv/project.json b/scripts/uberenv/project.json index 67554684bc..eca9919010 100644 --- a/scripts/uberenv/project.json +++ b/scripts/uberenv/project.json @@ -4,10 +4,5 @@ "package_final_phase" : "hostconfig", "package_source_dir" : "../..", "spack_url": "https://github.com/spack/spack", -"spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6", -"spack_activate" : {"py-sphinx" : ["+devtools"], - "py-shroud" : ["+devtools"], - "py-pyyaml" : ["+devtools"], - "py-numpy" : ["+python"], - "conduit" : ["+python"]} +"spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6" } diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml index afd35354de..80d75373aa 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml @@ -36,7 +36,7 @@ compilers: cxx: /usr/tce/packages/clang/clang-8.0.1/bin/clang++ f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 - spec: clang@8.0.0_nvcc_xlf + spec: clang@8.0.1_nvcc_xlf target: ppc64le - compiler: environment: {} diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/compilers.yaml new file mode 100644 index 0000000000..ec5366e27a --- /dev/null +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/compilers.yaml @@ -0,0 +1,14 @@ +compilers: +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: rhel7 + paths: + cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ + f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + spec: gcc@8.3.1 + target: ppc64le diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml new file mode 100644 index 0000000000..33115862e4 --- /dev/null +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml @@ -0,0 +1,100 @@ + +# ------------------------------------------------------------------------- +# This file controls default concretization preferences for Spack. +# +# Settings here are versioned with Spack and are intended to provide +# sensible defaults out of the box. Spack maintainers should edit this +# file to keep it current. +# +# Users can override these settings by editing the following files. +# +# Per-spack-instance settings (overrides defaults): +# $SPACK_ROOT/etc/spack/packages.yaml +# +# Per-user settings (overrides default and site settings): +# ~/.spack/packages.yaml +# ------------------------------------------------------------------------- +packages: + all: + compiler: [gcc, intel, pgi, clang, xl, nag] + providers: + blas: [netlib-lapack] + lapack: [netlib-lapack] + mpi: [mvapich2] + cuda: + buildable: False + mvapich2: + buildable: False + openmpi: + buildable: False + mpich: + buildable: False + spectrum-mpi: + buildable: False + charmpp: + buildable: False + charm: + buildable: False + intel-mpi: + buildable: False + intel-parallel-studio: + buildable: False + fujitsu-mpi: + buildable: False + mpilander: + buildable: False + mpt: + buildable: False + + # blas is a bit more complicated because its a virtual package so fake it with + # the following per spack docs + netlib-lapack: + paths: + netlib-lapack@3.6.1: /usr + buildable: False + +# System level packages to not build + autoconf: + paths: + autoconf: /usr + buildable: False + automake: + paths: + automake: /usr + buildable: False + bzip2: + paths: + bzip2: /usr + buildable: False + gettext: + paths: + gettext: /usr + buildable: False + libtool: + paths: + libtool: /usr + buildable: False + m4: + paths: + m4: /usr + buildable: False + perl: + paths: + perl: /usr + buildable: False + pkg-config: + paths: + pkg-config: /usr + buildable: False + tar: + paths: + tar: /usr + buildable: False + graphviz: + paths: + graphviz: /usr + buildable: False + +# Globally lock in version of CMake + cmake: + version: [3.9.6] diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml index 7742bc147c..cc670ea8ee 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml @@ -35,7 +35,7 @@ packages: paths: mvapich2@2.2%gcc@7.3.1: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/ mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ - mvapich2@2.2%clang@8.0.0_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/ + mvapich2@2.2%clang@8.0.1_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/ mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ buildable: False # Spack may grab for mpi & we don't want to use them @@ -111,9 +111,9 @@ packages: # Globally lock in version of CMake cmake: - version: [3.14.5] + version: [3.9.6] paths: - cmake: /usr/tce/packages/cmake/cmake-3.14.5 + cmake: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_07_14_31_19/gcc-8.3.1/cmake-3.9.6 buildable: False conduit: diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/compilers.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/compilers.yaml new file mode 100644 index 0000000000..ac0e2c0cb5 --- /dev/null +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/compilers.yaml @@ -0,0 +1,14 @@ +compilers: +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: rhel7 + paths: + cc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-8.1.0/bin/g++ + f77: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran + spec: gcc@8.1.0 + target: x86_64 diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml new file mode 100644 index 0000000000..33115862e4 --- /dev/null +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml @@ -0,0 +1,100 @@ + +# ------------------------------------------------------------------------- +# This file controls default concretization preferences for Spack. +# +# Settings here are versioned with Spack and are intended to provide +# sensible defaults out of the box. Spack maintainers should edit this +# file to keep it current. +# +# Users can override these settings by editing the following files. +# +# Per-spack-instance settings (overrides defaults): +# $SPACK_ROOT/etc/spack/packages.yaml +# +# Per-user settings (overrides default and site settings): +# ~/.spack/packages.yaml +# ------------------------------------------------------------------------- +packages: + all: + compiler: [gcc, intel, pgi, clang, xl, nag] + providers: + blas: [netlib-lapack] + lapack: [netlib-lapack] + mpi: [mvapich2] + cuda: + buildable: False + mvapich2: + buildable: False + openmpi: + buildable: False + mpich: + buildable: False + spectrum-mpi: + buildable: False + charmpp: + buildable: False + charm: + buildable: False + intel-mpi: + buildable: False + intel-parallel-studio: + buildable: False + fujitsu-mpi: + buildable: False + mpilander: + buildable: False + mpt: + buildable: False + + # blas is a bit more complicated because its a virtual package so fake it with + # the following per spack docs + netlib-lapack: + paths: + netlib-lapack@3.6.1: /usr + buildable: False + +# System level packages to not build + autoconf: + paths: + autoconf: /usr + buildable: False + automake: + paths: + automake: /usr + buildable: False + bzip2: + paths: + bzip2: /usr + buildable: False + gettext: + paths: + gettext: /usr + buildable: False + libtool: + paths: + libtool: /usr + buildable: False + m4: + paths: + m4: /usr + buildable: False + perl: + paths: + perl: /usr + buildable: False + pkg-config: + paths: + pkg-config: /usr + buildable: False + tar: + paths: + tar: /usr + buildable: False + graphviz: + paths: + graphviz: /usr + buildable: False + +# Globally lock in version of CMake + cmake: + version: [3.9.6] diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index 2dd489fe7b..2ae6b035f7 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -112,9 +112,9 @@ packages: # Globally lock in version of CMake cmake: - version: [3.14.5] + version: [3.9.6] paths: - cmake: /usr/tce/packages/cmake/cmake-3.14.5 + cmake: /usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_07_14_28_45/gcc-8.1.0/cmake-3.9.6 buildable: False conduit: diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index 52cd254f7a..e1de34db2a 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -30,7 +30,7 @@ "blueos_3_ppc64le_ib_p9": [ "clang@upstream_xlf~openmp", - "clang@8.0.0_nvcc_xlf~openmp+cuda", + "clang@8.0.1_nvcc_xlf~openmp+cuda", "gcc@7.3.1", "xl@coral~openmp" ], diff --git a/scripts/uberenv/uberenv.py b/scripts/uberenv/uberenv.py index 5c92291cbd..66ddb7b9ff 100755 --- a/scripts/uberenv/uberenv.py +++ b/scripts/uberenv/uberenv.py @@ -239,22 +239,25 @@ def __init__(self, opts, extra_opts): def setup_paths_and_dirs(self): self.uberenv_path = os.path.dirname(os.path.realpath(__file__)) - def set_from_args_or_json(self,setting): - try: + def set_from_args_or_json(self, setting, fail_on_undefined=True): + # Command line options take precedence over project file + setting_value = None + if setting in self.project_opts: setting_value = self.project_opts[setting] - except (KeyError): - print("ERROR: {} must at least be defined in project.json".format(setting)) - raise - else: if self.opts[setting]: setting_value = self.opts[setting] + + if fail_on_undefined and setting_value == None: + print("ERROR: '{}' must be defined in the project file or on the command line".format(setting)) + sys.exit(-1) + return setting_value def set_from_json(self,setting): try: setting_value = self.project_opts[setting] except (KeyError): - print("ERROR: {} must at least be defined in project.json".format(setting)) + print("ERROR: '{}' must at least be defined in project.json".format(setting)) raise return setting_value @@ -277,7 +280,7 @@ def __init__(self, opts, extra_opts): self.pkg_name = self.set_from_args_or_json("package_name") self.pkg_version = self.set_from_json("package_version") - self.pkg_final_phase = self.set_from_args_or_json("package_final_phase") + self.pkg_final_phase = self.set_from_args_or_json("package_final_phase", False) self.pkg_src_dir = self.set_from_args_or_json("package_source_dir") # Some additional setup for macos @@ -465,7 +468,7 @@ def install(self): if self.opts["ignore_ssl_errors"]: install_cmd += "-k " install_cmd += "dev-build -d {} ".format(self.pkg_src_dir) - if not self.opts["install"]: + if not self.opts["install"] and self.pkg_final_phase: install_cmd += "-u {} ".format(self.pkg_final_phase) if self.opts["run_tests"]: install_cmd += "--test=root " @@ -488,7 +491,9 @@ def install(self): break if activate: activate_cmd = "spack/bin/spack activate " + pkg_name - sexe(activate_cmd, echo=True) + res = sexe(activate_cmd, echo=True) + if res != 0: + return res # note: this assumes package extends python when +python # this may fail general cases if self.opts["install"] and "+python" in full_spec: diff --git a/src/cmake/thirdparty/SetupAxomThirdParty.cmake b/src/cmake/thirdparty/SetupAxomThirdParty.cmake index 3346021c28..96bb089029 100644 --- a/src/cmake/thirdparty/SetupAxomThirdParty.cmake +++ b/src/cmake/thirdparty/SetupAxomThirdParty.cmake @@ -29,10 +29,11 @@ if (UMPIRE_DIR) set_property(TARGET umpire APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${UMPIRE_INCLUDE_DIRS}) - + set(UMPIRE_FOUND TRUE CACHE BOOL "") endif() else() message(STATUS "Umpire support is OFF") + set(UMPIRE_FOUND FALSE CACHE BOOL "") endif() @@ -55,9 +56,11 @@ if (RAJA_DIR) message(FATAL_ERROR "RAJA failed to load: ${RAJA_DIR}") else() message(STATUS "RAJA loaded: ${RAJA_DIR}") + set(RAJA_FOUND TRUE CACHE BOOL "") endif() else() message(STATUS "RAJA support is OFF" ) + set(RAJA_FOUND FALSE CACHE BOOL "") endif() From 9517e4c7b3a2d7b23b013aed1700eaddcda9b645 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 13 Feb 2020 15:06:38 -0800 Subject: [PATCH 012/632] Link split devtools back into host-configs via spack package.py method, Fix Camp CMake error, Rebuild all devtools and TPLs, Split Devtools/TPLs/Mirror into new directory structure that has sys_type in it --- ..._ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake} | 65 ++++---- ...s_3_ppc64le_ib_p9-clang@upstream_xlf.cmake | 59 ++++--- ...sel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake | 59 ++++--- ...nsel-blueos_3_ppc64le_ib_p9-xl@coral.cmake | 63 ++++---- ...rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake | 71 ++++----- ...rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake | 59 ++++--- .../rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake | 59 ++++--- .../rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake | 59 ++++--- .../rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake | 59 ++++--- ...zgenie-toss_3_x86_64_ib-intel@18.0.2.cmake | 59 ++++--- ...zgenie-toss_3_x86_64_ib-intel@19.0.0.cmake | 59 ++++--- scripts/llnl_scripts/llnl_lc_build_tools.py | 11 +- scripts/uberenv/packages/axom/package.py | 145 ++++++++---------- scripts/uberenv/packages/conduit/package.py | 37 +++-- .../devtools/packages.yaml | 4 - .../blueos_3_ppc64le_ib_p9/packages.yaml | 49 +++++- scripts/uberenv/spack_configs/config.yaml | 2 +- .../toss_3_x86_64_ib/devtools/packages.yaml | 4 - .../toss_3_x86_64_ib/packages.yaml | 49 +++++- .../thirdparty/SetupAxomThirdParty.cmake | 3 + 20 files changed, 493 insertions(+), 482 deletions(-) rename host-configs/{rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.0_nvcc_xlf.cmake => rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake} (64%) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.0_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake similarity index 64% rename from host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.0_nvcc_xlf.cmake rename to host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 134f572aae..fba001ba13 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.0_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -7,79 +7,76 @@ # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ # SYS_TYPE: blueos_3_ppc64le_ib_p9 -# Compiler Spec: clang@8.0.0_nvcc_xlf +# Compiler Spec: clang@8.0.1_nvcc_xlf #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/clang-8.0.0_nvcc_xlf/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack -set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-8.0.0/bin/clang" CACHE PATH "") +set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-8.0.1/bin/clang" CACHE PATH "") -# C++ compiler used by spack -set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-8.0.0/bin/clang++" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-8.0.1/bin/clang++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/clang-8.0.0_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/clang-8.0.1_nvcc_xlf" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +set(ENABLE_MPI ON CACHE BOOL "") -# python not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpicc" CACHE PATH "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpicxx" CACHE PATH "") -# shroud not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpif90" CACHE PATH "") -# uncrustify not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpirun" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") -# cppcheck not built by uberenv +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.0/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.0/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.06.12/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.0/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics @@ -91,7 +88,7 @@ set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report cl set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.06.12/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") #------------------------------------------------------------------------------ # Cuda diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake index 619df73fd9..9cd3247b3b 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake @@ -9,77 +9,74 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: clang@upstream_xlf #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/clang-upstream_xlf/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/clang-upstream_xlf" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +set(ENABLE_MPI ON CACHE BOOL "") -# python not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicc" CACHE PATH "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicxx" CACHE PATH "") -# shroud not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -# uncrustify not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") -# cppcheck not built by uberenv +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.06.12/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics @@ -91,6 +88,6 @@ set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report cl set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.06.12/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake index e7473c2c54..624444d763 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: gcc@7.3.1 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/gcc-7.3.1/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gcc" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/g++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE PATH "") @@ -32,36 +29,15 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/gcc-7.3.1" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv - -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") - -# python not built by uberenv - -set(ENABLE_DOCS OFF CACHE BOOL "") - -# shroud not built by uberenv - -# uncrustify not built by uberenv - -# lcov and genhtml not built by uberenv - -# cppcheck not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") #------------------------------------------------------------------------------ # MPI @@ -82,11 +58,32 @@ set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# Other machine specifics +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") + +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") + +set(ENABLE_DOCS ON CACHE BOOL "") + +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") + +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") + +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake index 2241b90f84..e98a8ea11f 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake @@ -9,77 +9,74 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: xl@coral #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/xl-coral/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack -set(CMAKE_C_COMPILER "/usr/tce/packages/xl/xl-2019.06.12/bin/xlc" CACHE PATH "") +set(CMAKE_C_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlc" CACHE PATH "") -# C++ compiler used by spack -set(CMAKE_CXX_COMPILER "/usr/tce/packages/xl/xl-2019.06.12/bin/xlC" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlC" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.06.12/bin/xlf2003" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_08_34/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/xl-coral" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +set(ENABLE_MPI ON CACHE BOOL "") -# python not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicc" CACHE PATH "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicxx" CACHE PATH "") -# shroud not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -# uncrustify not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") -# cppcheck not built by uberenv +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.06.12/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.03.26/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics @@ -95,6 +92,6 @@ set(CMAKE_CXX_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.06.12/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake index 95ae857ce4..c8e33ff11e 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: clang@4.0.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/clang-4.0.0/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-4.0.0/bin/clang" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-4.0.0/bin/clang++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE PATH "") @@ -32,46 +29,15 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/clang-4.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/clang-4.0.0" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv - -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") - -# python from uberenv -set(PYTHON_EXECUTABLE "${TPL_ROOT}/python-2.7.15/bin/python" CACHE PATH "") - -set(ENABLE_DOCS ON CACHE BOOL "") - -# doxygen from uberenv -set(DOXYGEN_EXECUTABLE "${TPL_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") - -# sphinx 1.7.4 from uberenv -set(SPHINX_EXECUTABLE "${TPL_ROOT}/python-2.7.15/bin/sphinx-build" CACHE PATH "") - -# shroud 0.10.1 from uberenv -set(SHROUD_EXECUTABLE "${TPL_ROOT}/python-2.7.15/bin/shroud" CACHE PATH "") - -# uncrustify from uberenv -set(UNCRUSTIFY_EXECUTABLE "${TPL_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") - -# lcov and genhtml not built by uberenv - -# cppcheck from uberenv -set(CPPCHECK_EXECUTABLE "${TPL_ROOT}/cppcheck-1.81/bin/cppcheck" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") #------------------------------------------------------------------------------ # MPI @@ -90,13 +56,34 @@ set(MPIEXEC "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ -# Other machine specifics +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/clang/clang-6.0.0/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") + +set(ENABLE_DOCS ON CACHE BOOL "") + +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") + +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") + +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/clang/clang-4.0.0/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") + diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake index 61c89a076a..2a98ca5140 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: clang@6.0.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/clang-6.0.0/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-6.0.0/bin/clang" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-6.0.0/bin/clang++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE PATH "") @@ -32,36 +29,15 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/clang-6.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/clang-6.0.0" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv - -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") - -# python not built by uberenv - -set(ENABLE_DOCS OFF CACHE BOOL "") - -# shroud not built by uberenv - -# uncrustify not built by uberenv - -# lcov and genhtml not built by uberenv - -# cppcheck not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") #------------------------------------------------------------------------------ # MPI @@ -79,14 +55,35 @@ set(MPIEXEC "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +#------------------------------------------------------------------------------ +# Devtools +#------------------------------------------------------------------------------ + +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") + +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") + +set(ENABLE_DOCS ON CACHE BOOL "") + +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") + +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") + +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") + #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ +set(ENABLE_OPENMP ON CACHE BOOL "") + set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/clang/clang-6.0.0/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") -set(ENABLE_OPENMP ON CACHE BOOL "") - diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake index f9892cd535..afe8212d1b 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: gcc@6.1.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/gcc-6.1.0/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gcc" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/g++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gfortran" CACHE PATH "") @@ -32,59 +29,59 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/gcc-6.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/gcc-6.1.0" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# python not built by uberenv +set(ENABLE_MPI ON CACHE BOOL "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0/bin/mpicc" CACHE PATH "") -# shroud not built by uberenv +set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0/bin/mpicxx" CACHE PATH "") -# uncrustify not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0/bin/mpif90" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC "/usr/bin/srun" CACHE PATH "") -# cppcheck not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-6.1.0/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-6.1.0/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-6.1.0/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") - set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake index c378dad6b2..55fbe6aed5 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: gcc@7.3.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/gcc-7.3.0/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gcc" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/g++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gfortran" CACHE PATH "") @@ -32,59 +29,59 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/gcc-7.3.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/gcc-7.3.0" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# python not built by uberenv +set(ENABLE_MPI ON CACHE BOOL "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0/bin/mpicc" CACHE PATH "") -# shroud not built by uberenv +set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0/bin/mpicxx" CACHE PATH "") -# uncrustify not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0/bin/mpif90" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC "/usr/bin/srun" CACHE PATH "") -# cppcheck not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-7.3.0/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-7.3.0/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-7.3.0/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") - set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake index 6d82f5cf57..2ddd770c85 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: gcc@8.1.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/gcc-8.1.0/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gcc" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/g++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran" CACHE PATH "") @@ -32,59 +29,59 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/gcc-8.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/gcc-8.1.0" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# python not built by uberenv +set(ENABLE_MPI ON CACHE BOOL "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0/bin/mpicc" CACHE PATH "") -# shroud not built by uberenv +set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0/bin/mpicxx" CACHE PATH "") -# uncrustify not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0/bin/mpif90" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC "/usr/bin/srun" CACHE PATH "") -# cppcheck not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-8.1.0/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-8.1.0/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-gcc-8.1.0/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") - set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake index d9ba458bec..3a483245a0 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: intel@18.0.2 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/intel-18.0.2/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/icc" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/icpc" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/ifort" CACHE PATH "") @@ -32,59 +29,59 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/intel-18.0.2" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/intel-18.0.2" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# python not built by uberenv +set(ENABLE_MPI ON CACHE BOOL "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2/bin/mpicc" CACHE PATH "") -# shroud not built by uberenv +set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2/bin/mpicxx" CACHE PATH "") -# uncrustify not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2/bin/mpif90" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC "/usr/bin/srun" CACHE PATH "") -# cppcheck not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-intel-18.0.2/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-intel-18.0.2/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-intel-18.0.2/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") - set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake index 6112a71cca..d63664eced 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake @@ -9,20 +9,17 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: intel@19.0.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/intel-19.0.0/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack set(CMAKE_C_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/icc" CACHE PATH "") -# C++ compiler used by spack set(CMAKE_CXX_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/icpc" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/ifort" CACHE PATH "") @@ -32,59 +29,59 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2020_01_30_13_06_51/intel-19.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/intel-19.0.0" CACHE PATH "") -# conduit from uberenv set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv -set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# scr not built by uberenv +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0/share/raja/cmake" CACHE PATH "") - -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0/share/umpire/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# python not built by uberenv +set(ENABLE_MPI ON CACHE BOOL "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0/bin/mpicc" CACHE PATH "") -# shroud not built by uberenv +set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0/bin/mpicxx" CACHE PATH "") -# uncrustify not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0/bin/mpif90" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC "/usr/bin/srun" CACHE PATH "") -# cppcheck not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-intel-19.0.0/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-intel-19.0.0/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.2-intel-19.0.0/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") - set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 20f6fef4ab..dd8364fd55 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -494,7 +494,8 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): tpl_build_failed = False for spec in specs: start_time = time.time() - res = uberenv_build(prefix, spec, project_file, config_dir, mirror_dir) + fullspec = "{0}+devtools".format(spec) + res = uberenv_build(prefix, fullspec, project_file, config_dir, mirror_dir) end_time = time.time() print "[build time: {0}]".format(convertSecondsToReadableTime(end_time - start_time)) if res != 0: @@ -578,14 +579,6 @@ def build_devtools(builds_dir, job_name, timestamp): os.unlink(link_path) os.symlink(install_dir, link_path) - # Clean up directories we don't need to save - dir_names = ["builds", "spack"] - for dir_name in dir_names: - path_to_be_deleted = pjoin(prefix, dir_name) - print "[Removing path after successful devtools build: {0}]".format(path_to_be_deleted) - if os.path.exists(path_to_be_deleted): - shutil.rmtree(path_to_be_deleted) - print "[SUCCESS: Finished build devtools for spec %s]\n" % compiler_spec # set proper perms for installed devtools diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index a1a811e1d6..935c5a4f54 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -5,9 +5,10 @@ from spack import * -import socket +import glob import os import platform +import socket from os.path import join as pjoin import llnl.util.tty as tty @@ -34,8 +35,10 @@ def get_spec_path(spec, package_name, path_replacements = {}, use_bin = False) : else: path = spec[package_name].prefix.bin + path = os.path.realpath(path) + for key in path_replacements: - path = path.replace(key,path_replacements[key]) + path = path.replace(key, path_replacements[key]) return path @@ -75,6 +78,9 @@ class Axom(Package): variant("raja", default=True, description="Build with raja") variant("umpire", default=True, description="Build with umpire") + variant("devtools", default=False, + description="Build development tools (such as Sphinx, Uncrustify, etc...)") + #----------------------------------------------------------------------- # Dependencies #----------------------------------------------------------------------- @@ -111,6 +117,14 @@ class Axom(Package): depends_on("python", when="+python") + # Devtools + depends_on("cppcheck", when="+devtools") + depends_on("doxygen", when="+devtools") + depends_on("graphviz", when="+devtools") + depends_on("python", when="+devtools") + depends_on("py-sphinx", when="+devtools") + depends_on("py-shroud", when="+devtools") + depends_on("uncrustify@0.61", when="+devtools") def _get_sys_type(self, spec): sys_type = spec.architecture @@ -206,108 +220,35 @@ def hostconfig(self, spec, prefix): path_replacements = {} if len(prefix_paths) == 2: - tpl_root = pjoin( prefix_paths[0], compiler_str ) + tpl_root = os.path.realpath(pjoin(prefix_paths[0], compiler_str)) path_replacements[tpl_root] = "${TPL_ROOT}" cfg.write("# Root directory for generated TPLs\n") cfg.write(cmake_cache_entry("TPL_ROOT",tpl_root)) conduit_dir = get_spec_path(spec, "conduit", path_replacements) - cfg.write("# conduit from uberenv\n") cfg.write(cmake_cache_entry("CONDUIT_DIR",conduit_dir)) # optional tpls if "+mfem" in spec: mfem_dir = get_spec_path(spec, "mfem", path_replacements) - cfg.write("# mfem from uberenv\n") cfg.write(cmake_cache_entry("MFEM_DIR",mfem_dir)) - else: - cfg.write("# mfem not built by uberenv\n\n") if "+hdf5" in spec: hdf5_dir = get_spec_path(spec, "hdf5", path_replacements) - cfg.write("# hdf5 from uberenv\n") cfg.write(cmake_cache_entry("HDF5_DIR",hdf5_dir)) - else: - cfg.write("# hdf5 not built by uberenv\n\n") if "+scr" in spec: scr_dir = get_spec_path(spec, "scr", path_replacements) - cfg.write("# scr from uberenv\n") cfg.write(cmake_cache_entry("SCR_DIR",scr_dir)) - else: - cfg.write("# scr not built by uberenv\n\n") if "+raja" in spec: raja_dir = get_spec_path(spec, "raja", path_replacements) - cfg.write("# raja from uberenv\n") cfg.write(cmake_cache_entry("RAJA_DIR", raja_dir)) - else: - cfg.write("# raja not build by uberenv\n\n") if "+umpire" in spec: umpire_dir = get_spec_path(spec, "umpire", path_replacements) - cfg.write("# umpire from uberenv\n") cfg.write(cmake_cache_entry("UMPIRE_DIR", umpire_dir)) - else: - cfg.write("# umpire not build by uberenv\n\n") - - if "python" in spec: - python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) - cfg.write("# python from uberenv\n") - cfg.write(cmake_cache_entry("PYTHON_EXECUTABLE",pjoin(python_bin_dir, "python"))) - else: - cfg.write("# python not built by uberenv\n\n") - - # optional tpls (dev tools) - - if "doxygen" in spec or "py-sphinx" in spec: - cfg.write(cmake_cache_option("ENABLE_DOCS", True)) - - if "doxygen" in spec: - doxygen_bin_dir = get_spec_path(spec, "doxygen", path_replacements, use_bin=True) - cfg.write("# doxygen from uberenv\n") - cfg.write(cmake_cache_entry("DOXYGEN_EXECUTABLE", pjoin(doxygen_bin_dir, "doxygen"))) - else: - cfg.write("# doxygen not built by uberenv\n\n") - - if "py-sphinx" in spec: - python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) - cfg.write("# sphinx {} from uberenv\n".format(spec["py-sphinx"].version)) - cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", pjoin(python_bin_dir, "sphinx-build"))) - else: - cfg.write("# sphinx not built by uberenv\n\n") - else: - cfg.write(cmake_cache_option("ENABLE_DOCS", False)) - - if "py-shroud" in spec: - python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) - cfg.write("# shroud {} from uberenv\n".format(spec["py-shroud"].version)) - cfg.write(cmake_cache_entry("SHROUD_EXECUTABLE", pjoin(python_bin_dir, "shroud"))) - else: - cfg.write("# shroud not built by uberenv\n\n") - - if "uncrustify" in spec: - uncrustify_bin_dir = get_spec_path(spec, "uncrustify", path_replacements, use_bin=True) - cfg.write("# uncrustify from uberenv\n") - cfg.write(cmake_cache_entry("UNCRUSTIFY_EXECUTABLE", pjoin(uncrustify_bin_dir, "uncrustify"))) - else: - cfg.write("# uncrustify not built by uberenv\n\n") - - if "lcov" in spec: - lcov_dir = get_spec_path(spec, "lcov", path_replacements) - cfg.write("# lcov and genhtml from uberenv\n") - cfg.write(cmake_cache_entry("LCOV_PATH", pjoin(lcov_dir,"usr","bin","lcov"))) - cfg.write(cmake_cache_entry("GENHTML_PATH",pjoin(lcov_dir,"usr","bin","genhtml"))) - else: - cfg.write("# lcov and genhtml not built by uberenv\n\n") - - if "cppcheck" in spec: - cppcheck_bin_dir = get_spec_path(spec, "cppcheck", path_replacements, use_bin=True) - cfg.write("# cppcheck from uberenv\n") - cfg.write(cmake_cache_entry("CPPCHECK_EXECUTABLE", pjoin(cppcheck_bin_dir, "cppcheck"))) - else: - cfg.write("# cppcheck not built by uberenv\n\n") cfg.write("#------------------{}\n".format("-"*60)) cfg.write("# MPI\n") @@ -346,12 +287,60 @@ def hostconfig(self, spec, prefix): cfg.write(cmake_cache_entry("MPIEXEC_NUMPROC_FLAG", "-np")) cfg.write(cmake_cache_entry("BLT_MPI_COMMAND_APPEND", "mpibind")) else: - # TODO: see if spack has this cfg.write(cmake_cache_entry("MPIEXEC_NUMPROC_FLAG", "-n")) else: cfg.write(cmake_cache_option("ENABLE_MPI", False)) + ################################## + # Devtools + ################################## + + cfg.write("#------------------{}\n".format("-"*60)) + cfg.write("# Devtools\n") + cfg.write("#------------------{}\n\n".format("-"*60)) + + # Add common prefix to path replacement list + if "+devtools" in spec: + # Grab common devtools root and strip the trailing slash + path1 = os.path.realpath(spec["uncrustify"].prefix) + path2 = os.path.realpath(spec["doxygen"].prefix) + devtools_root = os.path.commonprefix([path1, path2])[:-1] + path_replacements[devtools_root] = "${DEVTOOLS_ROOT}" + cfg.write("# Root directory for generated developer tools\n") + cfg.write(cmake_cache_entry("DEVTOOLS_ROOT",devtools_root)) + + + if "python" in spec or "devtools" in spec: + python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) + cfg.write(cmake_cache_entry("PYTHON_EXECUTABLE",pjoin(python_bin_dir, "python"))) + + if "doxygen" in spec or "py-sphinx" in spec: + cfg.write(cmake_cache_option("ENABLE_DOCS", True)) + + if "doxygen" in spec: + doxygen_bin_dir = get_spec_path(spec, "doxygen", path_replacements, use_bin=True) + cfg.write(cmake_cache_entry("DOXYGEN_EXECUTABLE", pjoin(doxygen_bin_dir, "doxygen"))) + + if "py-sphinx" in spec: + python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) + cfg.write(cmake_cache_entry("SPHINX_EXECUTABLE", pjoin(python_bin_dir, "sphinx-build"))) + else: + cfg.write(cmake_cache_option("ENABLE_DOCS", False)) + + if "py-shroud" in spec: + python_bin_dir = get_spec_path(spec, "python", path_replacements, use_bin=True) + cfg.write(cmake_cache_entry("SHROUD_EXECUTABLE", pjoin(python_bin_dir, "shroud"))) + + if "uncrustify" in spec: + uncrustify_bin_dir = get_spec_path(spec, "uncrustify", path_replacements, use_bin=True) + cfg.write(cmake_cache_entry("UNCRUSTIFY_EXECUTABLE", pjoin(uncrustify_bin_dir, "uncrustify"))) + + if "cppcheck" in spec: + cppcheck_bin_dir = get_spec_path(spec, "cppcheck", path_replacements, use_bin=True) + cfg.write(cmake_cache_entry("CPPCHECK_EXECUTABLE", pjoin(cppcheck_bin_dir, "cppcheck"))) + + ################################## # Other machine specifics ################################## @@ -360,7 +349,7 @@ def hostconfig(self, spec, prefix): cfg.write("# Other machine specifics\n") cfg.write("#------------------{}\n\n".format("-"*60)) - # OpenMP + # OpenMP if "+openmp" in spec: cfg.write(cmake_cache_option("ENABLE_OPENMP", True)) diff --git a/scripts/uberenv/packages/conduit/package.py b/scripts/uberenv/packages/conduit/package.py index 8a29034df7..bb749224b0 100644 --- a/scripts/uberenv/packages/conduit/package.py +++ b/scripts/uberenv/packages/conduit/package.py @@ -283,8 +283,10 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): f_compiler = None if self.compiler.fc: - # even if this is set, it may not exist so do one more sanity check - f_compiler = which(env["SPACK_FC"]) + # even if this is set, it may not exist + # do one more sanity check + if os.path.isfile(env["SPACK_FC"]): + f_compiler = env["SPACK_FC"] ####################################################################### # By directly fetching the names of the actual compilers we appear @@ -338,7 +340,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): if "+fortran" in spec and f_compiler is not None: cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "ON")) cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER", - f_compiler.path)) + f_compiler)) else: cfg.write("# no fortran compiler found\n\n") cfg.write(cmake_cache_entry("ENABLE_FORTRAN", "OFF")) @@ -357,16 +359,25 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_entry("ENABLE_TESTS", "OFF")) # extra fun for blueos - if 'blueos_3' in sys_type and "+fortran" in spec: - if 'xl@coral' in os.getenv('SPACK_COMPILER_SPEC', ""): - # Fix missing std linker flag in xlc compiler - cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS", - "-WF,-C! -qxlf2003=polymorphic")) - # Grab lib directory for the current fortran compiler - libdir = os.path.join(os.path.dirname(os.path.dirname(f_compiler.path)), "lib") - cfg.write(cmake_cache_entry("BLT_EXE_LINKER_FLAGS", - "-Wl,-rpath," + libdir, - "Adds a missing rpath for libraries associated with the fortran compiler")) + if on_blueos: + # All of BlueOS compilers report clang due to nvcc, override to proper compiler family + if "xlc" in c_compiler: + cfg.write(cmake_cache_entry("CMAKE_C_COMPILER_ID", "XL")) + if "xlC" in cpp_compiler: + cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER_ID", "XL")) + + if "+fortran" in spec: + if "xlf" in f_compiler: + cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER_ID", "XL")) + + if 'xl@coral' in os.getenv('SPACK_COMPILER_SPEC', ""): + # Fix missing std linker flag in xlc compiler + cfg.write(cmake_cache_entry("BLT_FORTRAN_FLAGS", + "-WF,-C! -qxlf2003=polymorphic")) + # Grab lib directory for the current fortran compiler + libdir = os.path.join(os.path.dirname(os.path.dirname(f_compiler)), "lib") + cfg.write(cmake_cache_entry("BLT_EXE_LINKER_FLAGS", + "-lstdc++ -Wl,-rpath," + libdir)) ####################### # Python diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml index 33115862e4..00b0fe6cea 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml @@ -90,10 +90,6 @@ packages: paths: tar: /usr buildable: False - graphviz: - paths: - graphviz: /usr - buildable: False # Globally lock in version of CMake cmake: diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml index cc670ea8ee..e27e4f1085 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml @@ -104,17 +104,50 @@ packages: paths: tar: /usr buildable: False - graphviz: - paths: - graphviz: /usr - buildable: False -# Globally lock in version of CMake +# Globally lock version of third party libraries + conduit: + version: [0.5.1] + +# Globally lock in versions of Devtools cmake: version: [3.9.6] paths: - cmake: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_07_14_31_19/gcc-8.3.1/cmake-3.9.6 + cmake: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6 buildable: False - conduit: - version: [0.5.1] + cppcheck: + version: [1.87] + paths: + cppcheck: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cppcheck-1.87 + buildable: False + doxygen: + version: [1.8.14] + paths: + doxygen: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/doxygen-1.8.14 + buildable: False + graphviz: + version: [2.42.2] + paths: + graphviz: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/graphviz-2.42.2 + buildable: False + python: + version: [3.7.4] + paths: + python: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/python-3.7.4 + buildable: False + py-shroud: + version: [0.11.0] + paths: + py-shroud: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/python-3.7.4 + buildable: False + py-sphinx: + version: [2.2.0] + paths: + py-sphinx: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/python-3.7.4 + buildable: False + uncrustify: + version: [0.61] + paths: + uncrustify: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/uncrustify-0.61 + buildable: False diff --git a/scripts/uberenv/spack_configs/config.yaml b/scripts/uberenv/spack_configs/config.yaml index 270d31ff65..86f857d16c 100644 --- a/scripts/uberenv/spack_configs/config.yaml +++ b/scripts/uberenv/spack_configs/config.yaml @@ -53,7 +53,7 @@ config: # Cache directory for miscellaneous files, like the package index. # This can be purged with `spack purge --misc-cache` - misc_cache: ~/.spack/cache + misc_cache: ../.spack/misccache # If this is false, tools like curl that use SSL will not verify diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml index 33115862e4..00b0fe6cea 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml @@ -90,10 +90,6 @@ packages: paths: tar: /usr buildable: False - graphviz: - paths: - graphviz: /usr - buildable: False # Globally lock in version of CMake cmake: diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index 2ae6b035f7..e94134e684 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -105,17 +105,50 @@ packages: paths: tar: /usr buildable: False - graphviz: - paths: - graphviz: /usr - buildable: False -# Globally lock in version of CMake +# Globally lock version of third party libraries + conduit: + version: [0.5.1] + +# Globally lock in versions of Devtools cmake: version: [3.9.6] paths: - cmake: /usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_07_14_28_45/gcc-8.1.0/cmake-3.9.6 + cmake: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6 buildable: False - conduit: - version: [0.5.1] + cppcheck: + version: [1.87] + paths: + cppcheck: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cppcheck-1.87 + buildable: False + doxygen: + version: [1.8.14] + paths: + doxygen: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/doxygen-1.8.14 + buildable: False + graphviz: + version: [2.42.2] + paths: + graphviz: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/graphviz-2.42.2 + buildable: False + python: + version: [3.7.4] + paths: + python: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/python-3.7.4 + buildable: False + py-shroud: + version: [0.11.0] + paths: + py-shroud: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/python-3.7.4 + buildable: False + py-sphinx: + version: [2.2.0] + paths: + py-sphinx: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/python-3.7.4 + buildable: False + uncrustify: + version: [0.61] + paths: + uncrustify: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/uncrustify-0.61 + buildable: False diff --git a/src/cmake/thirdparty/SetupAxomThirdParty.cmake b/src/cmake/thirdparty/SetupAxomThirdParty.cmake index 96bb089029..9576cf9326 100644 --- a/src/cmake/thirdparty/SetupAxomThirdParty.cmake +++ b/src/cmake/thirdparty/SetupAxomThirdParty.cmake @@ -58,6 +58,9 @@ if (RAJA_DIR) message(STATUS "RAJA loaded: ${RAJA_DIR}") set(RAJA_FOUND TRUE CACHE BOOL "") endif() + + # Note: camp sets a compile feature that is not available on XL + set_target_properties(camp PROPERTIES INTERFACE_COMPILE_FEATURES "") else() message(STATUS "RAJA support is OFF" ) set(RAJA_FOUND FALSE CACHE BOOL "") From 52c2c97ca343b8e100ff1277ee5605802bfcebd7 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 13 Feb 2020 17:16:06 -0800 Subject: [PATCH 013/632] Undo hack to work around Clang's MPI Fortran wrapper being not there, it now is --- ...3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 6 +++- ...s_3_ppc64le_ib_p9-clang@upstream_xlf.cmake | 6 +++- ...sel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake | 6 +++- ...nsel-blueos_3_ppc64le_ib_p9-xl@coral.cmake | 6 +++- ...rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake | 6 +++- ...rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake | 6 +++- .../rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake | 6 +++- .../rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake | 6 +++- .../rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake | 6 +++- ...zgenie-toss_3_x86_64_ib-intel@18.0.2.cmake | 6 +++- ...zgenie-toss_3_x86_64_ib-intel@19.0.0.cmake | 6 +++- scripts/uberenv/packages/axom/package.py | 29 +++++++++++-------- scripts/uberenv/packages/conduit/package.py | 10 +------ 13 files changed, 73 insertions(+), 32 deletions(-) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index fba001ba13..413ebf2c6a 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake index 9cd3247b3b..3d01f19347 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake index 624444d763..edf77667d5 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake index e98a8ea11f..17c8f769c8 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_13_04_56/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake index c8e33ff11e..29d11be7e7 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/clang-4.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/clang-4.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake index 2a98ca5140..3676ebe3be 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/clang-6.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/clang-6.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake index afe8212d1b..b8caa8c030 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/gcc-6.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/gcc-6.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake index 55fbe6aed5..2c990b7ffe 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/gcc-7.3.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/gcc-7.3.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake index 2ddd770c85..6efda8ac43 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/gcc-8.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/gcc-8.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake index 3a483245a0..125c4111ed 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/intel-18.0.2" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/intel-18.0.2" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake index d63664eced..6219846edb 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake @@ -29,12 +29,16 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_13_01_01/intel-19.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/intel-19.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") +# MFEM not built + set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") +# SCR not built + set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index 935c5a4f54..0ceeebbc78 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -36,7 +36,7 @@ def get_spec_path(spec, package_name, path_replacements = {}, use_bin = False) : path = spec[package_name].prefix.bin path = os.path.realpath(path) - + for key in path_replacements: path = path.replace(key, path_replacements[key]) @@ -66,6 +66,8 @@ class Axom(Package): variant('debug', default=False, description='Build debug instead of optimized version') + variant('fortran', default=True, description="Build with Fortran support") + variant("python", default=False, description="Build python support") variant("mpi", default=True, description="Build MPI support") @@ -202,11 +204,11 @@ def hostconfig(self, spec, prefix): cfg.write(cmake_cache_entry("CMAKE_C_COMPILER",c_compiler)) cfg.write(cmake_cache_entry("CMAKE_CXX_COMPILER",cpp_compiler)) - if f_compiler is None: - cfg.write(cmake_cache_option("ENABLE_FORTRAN",False)) - else: + if "+fortran" in spec or not f_compiler is None: cfg.write(cmake_cache_option("ENABLE_FORTRAN",True)) cfg.write(cmake_cache_entry("CMAKE_Fortran_COMPILER",f_compiler)) + else: + cfg.write(cmake_cache_option("ENABLE_FORTRAN",False)) # TPL locations cfg.write("#------------------{}\n".format("-"*60)) @@ -233,22 +235,32 @@ def hostconfig(self, spec, prefix): if "+mfem" in spec: mfem_dir = get_spec_path(spec, "mfem", path_replacements) cfg.write(cmake_cache_entry("MFEM_DIR",mfem_dir)) + else: + cfg.write("# MFEM not built\n\n") if "+hdf5" in spec: hdf5_dir = get_spec_path(spec, "hdf5", path_replacements) cfg.write(cmake_cache_entry("HDF5_DIR",hdf5_dir)) + else: + cfg.write("# HDF5 not built\n\n") if "+scr" in spec: scr_dir = get_spec_path(spec, "scr", path_replacements) cfg.write(cmake_cache_entry("SCR_DIR",scr_dir)) + else: + cfg.write("# SCR not built\n\n") if "+raja" in spec: raja_dir = get_spec_path(spec, "raja", path_replacements) cfg.write(cmake_cache_entry("RAJA_DIR", raja_dir)) + else: + cfg.write("# RAJA not built\n\n") if "+umpire" in spec: umpire_dir = get_spec_path(spec, "umpire", path_replacements) cfg.write(cmake_cache_entry("UMPIRE_DIR", umpire_dir)) + else: + cfg.write("# Umpire not built\n\n") cfg.write("#------------------{}\n".format("-"*60)) cfg.write("# MPI\n") @@ -258,14 +270,7 @@ def hostconfig(self, spec, prefix): cfg.write(cmake_cache_option("ENABLE_MPI", True)) cfg.write(cmake_cache_entry("MPI_C_COMPILER", spec['mpi'].mpicc)) cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", spec['mpi'].mpicxx)) - if on_blueos or on_blueos_p9: - # clang doesn't come with a fortran wrapper on blueos - fortran_wrapper = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.12.23/bin/mpif90" - if not os.path.exists(spec['mpi'].mpifc) and "clang" in spec['mpi'].mpifc: - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", fortran_wrapper)) - else: - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) - else: + if "+fortran" in spec or not f_compiler is None: cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) # Determine MPIEXEC diff --git a/scripts/uberenv/packages/conduit/package.py b/scripts/uberenv/packages/conduit/package.py index bb749224b0..41b8f2884f 100644 --- a/scripts/uberenv/packages/conduit/package.py +++ b/scripts/uberenv/packages/conduit/package.py @@ -435,15 +435,7 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None): cfg.write(cmake_cache_entry("ENABLE_MPI", "ON")) cfg.write(cmake_cache_entry("MPI_C_COMPILER", mpicc_path)) cfg.write(cmake_cache_entry("MPI_CXX_COMPILER", mpicxx_path)) - - if on_blueos or on_blueos_p9: - # clang doesn't come with a fortran wrapper on blueos - fortran_wrapper = "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.12.23/bin/mpif90" - if not os.path.exists(spec['mpi'].mpifc) and "clang" in spec['mpi'].mpifc: - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", fortran_wrapper)) - else: - cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) - else: + if "+fortran" in spec: cfg.write(cmake_cache_entry("MPI_Fortran_COMPILER", spec['mpi'].mpifc)) mpiexe_bin = join_path(spec['mpi'].prefix.bin, 'mpiexec') From ea885170a5a7a5850fe2e488f0a3522f8965ea73 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 18 Feb 2020 08:42:12 -0800 Subject: [PATCH 014/632] Attempt to fix azure jobs --- .../docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake | 4 ++-- .../docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake | 4 ++-- .../docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake | 4 ++-- .../docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake | 4 ++-- .../docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake | 4 ++-- .../docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake index 663648063a..b29d3e61cf 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@4.0.0.cmake @@ -46,10 +46,10 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") # scr not built by uberenv # raja from uberenv -set(RAJA_DIR "/usr/local/share/raja/cmake/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") # python not built by uberenv diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake index f3784cf67c..16859458df 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@5.0.0.cmake @@ -46,10 +46,10 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") # scr not built by uberenv # raja from uberenv -set(RAJA_DIR "/usr/local/share/raja/cmake/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") # python not built by uberenv diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake index 41474f8158..89469a382d 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-clang@6.0.0.cmake @@ -46,10 +46,10 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") # scr not built by uberenv # raja from uberenv -set(RAJA_DIR "/usr/local/share/raja/cmake/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") # python not built by uberenv diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake index 36190b3be8..2b543476da 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@6.1.0.cmake @@ -50,10 +50,10 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") # scr not built by uberenv # raja from uberenv -set(RAJA_DIR "/usr/local/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") # python not built by uberenv diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake index 030f88c317..3828adf190 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@7.3.0.cmake @@ -50,10 +50,10 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") # scr not built by uberenv # raja from uberenv -set(RAJA_DIR "/usr/local/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") # python not built by uberenv diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake index 4a9f752ad6..d2e8c87e04 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake @@ -50,10 +50,10 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") # scr not built by uberenv # raja from uberenv -set(RAJA_DIR "/usr/local/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") # python not built by uberenv From 7c2eae05e9b0282a6ddca95bb7b43a86728eb6ca Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 18 Feb 2020 12:49:07 -0800 Subject: [PATCH 015/632] Turn on mfem, Move devtools variant to specs.yaml --- ...3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 4 +-- ...s_3_ppc64le_ib_p9-clang@upstream_xlf.cmake | 4 +-- ...sel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake | 4 +-- ...nsel-blueos_3_ppc64le_ib_p9-xl@coral.cmake | 4 +-- ...rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake | 4 +-- ...rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake | 4 +-- .../rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake | 4 +-- .../rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake | 4 +-- .../rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake | 4 +-- ...zgenie-toss_3_x86_64_ib-intel@18.0.2.cmake | 4 +-- ...zgenie-toss_3_x86_64_ib-intel@19.0.0.cmake | 4 +-- scripts/llnl_scripts/llnl_lc_build_tools.py | 2 +- scripts/uberenv/specs.json | 32 +++++++++---------- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 413ebf2c6a..83027b32b4 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake index 3d01f19347..4daa30836d 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake index edf77667d5..1738a8e6ff 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake index 17c8f769c8..4ae5051ab6 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_13_15_16_57/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake index 29d11be7e7..bdff2172bd 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/clang-4.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/clang-4.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake index 3676ebe3be..143ae65534 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/clang-6.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/clang-6.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake index b8caa8c030..42ddcc10e3 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/gcc-6.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/gcc-6.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake index 2c990b7ffe..12de2f3416 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/gcc-7.3.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/gcc-7.3.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake index 6efda8ac43..bfe8508745 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/gcc-8.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/gcc-8.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake index 125c4111ed..40c0f94b1a 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/intel-18.0.2" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/intel-18.0.2" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake index 6219846edb..36307d5b4c 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake @@ -29,11 +29,11 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_13_15_16_22/intel-19.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/intel-19.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# MFEM not built +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index dd8364fd55..babef1770f 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -494,7 +494,7 @@ def full_build_and_test_of_tpls(builds_dir, job_name, timestamp): tpl_build_failed = False for spec in specs: start_time = time.time() - fullspec = "{0}+devtools".format(spec) + fullspec = "{0}".format(spec) res = uberenv_build(prefix, fullspec, project_file, config_dir, mirror_dir) end_time = time.time() print "[build time: {0}]".format(convertSecondsToReadableTime(end_time - start_time)) diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index e1de34db2a..e0850f46f7 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -14,26 +14,26 @@ "__comment__":"##############################################################################", "toss_3_x86_64_ib": - [ "clang@4.0.0", - "clang@6.0.0", - "gcc@6.1.0", - "gcc@7.3.0", - "gcc@8.1.0", - "intel@18.0.2", - "intel@19.0.0" ], + [ "clang@4.0.0+devtools+mfem", + "clang@6.0.0+devtools+mfem", + "gcc@6.1.0+devtools+mfem", + "gcc@7.3.0+devtools+mfem", + "gcc@8.1.0+devtools+mfem", + "intel@18.0.2+devtools+mfem", + "intel@19.0.0+devtools+mfem" ], "blueos_3_ppc64le_ib": - [ "clang@upstream_xlf~openmp", - "clang@upstream_nvcc_xlf~openmp+cuda", - "gcc@4.9.3", - "xl@coral~openmp" ], + [ "clang@upstream_xlf~openmp+devtools+mfem", + "clang@upstream_nvcc_xlf~openmp+cuda+devtools+mfem", + "gcc@4.9.3+devtools+mfem", + "xl@coral~openmp+devtools+mfem" ], "blueos_3_ppc64le_ib_p9": - [ "clang@upstream_xlf~openmp", - "clang@8.0.1_nvcc_xlf~openmp+cuda", - "gcc@7.3.1", - "xl@coral~openmp" ], + [ "clang@upstream_xlf~openmp+devtools+mfem", + "clang@8.0.1_nvcc_xlf~openmp+cuda+devtools+mfem", + "gcc@7.3.1+devtools+mfem", + "xl@coral~openmp+devtools+mfem" ], "darwin-x86_64": - [ "clang@9.0.0" ] + [ "clang@9.0.0+devtools+mfem" ] } From e5415fe06433df9e03e4470c669639bd5d09317c Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 20 Feb 2020 13:51:56 -0800 Subject: [PATCH 016/632] Add sys_type to directory --- scripts/llnl_scripts/llnl_lc_build_tools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index babef1770f..141f563574 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -206,7 +206,8 @@ def archive_tpl_logs(prefix, job_name, timestamp): if not os.path.exists(archive_dir): os.makedirs(archive_dir) - tpl_build_dir = pjoin(prefix, timestamp) + tpl_build_dir = pjoin(prefix, get_system_type()) + tpl_build_dir = pjoin(tpl_build_dir, timestamp) copy_if_exists(pjoin(tpl_build_dir, "info.json"), archive_dir) From 146f2b12fa1ffe4d430a449e13adece30d1a5de2 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 21 Feb 2020 16:28:57 -0800 Subject: [PATCH 017/632] Quick update to docs --- scripts/bamboo/install_webdocs.sh | 106 -------- scripts/bamboo/queue_build.py | 100 -------- scripts/llnl_scripts/find_unused_tpl_dirs.py | 28 +-- src/docs/sphinx/dev_guide/bamboo.rst | 236 ------------------ src/docs/sphinx/dev_guide/component_org.rst | 6 +- .../dev_guide/continuous_integration.rst | 47 ++++ src/docs/sphinx/dev_guide/dev_summary.rst | 23 +- .../dev_guide/{bitbucket.rst => github.rst} | 61 +++-- src/docs/sphinx/dev_guide/index.rst | 4 +- src/docs/sphinx/dev_guide/jira-issue.dot | 16 -- src/docs/sphinx/dev_guide/jira-issue.png | Bin 37878 -> 0 bytes src/docs/sphinx/dev_guide/jira.rst | 235 ----------------- src/docs/sphinx/dev_guide/misc_tasks.rst | 4 +- src/docs/sphinx/dev_guide/pull_requests.rst | 10 +- .../sphinx/quickstart_guide/config_build.rst | 6 +- src/docs/sphinx/quickstart_guide/the_code.rst | 19 +- .../sphinx/quickstart_guide/zero_to_axom.rst | 2 +- 17 files changed, 127 insertions(+), 776 deletions(-) delete mode 100755 scripts/bamboo/install_webdocs.sh delete mode 100755 scripts/bamboo/queue_build.py delete mode 100644 src/docs/sphinx/dev_guide/bamboo.rst create mode 100644 src/docs/sphinx/dev_guide/continuous_integration.rst rename src/docs/sphinx/dev_guide/{bitbucket.rst => github.rst} (87%) delete mode 100644 src/docs/sphinx/dev_guide/jira-issue.dot delete mode 100644 src/docs/sphinx/dev_guide/jira-issue.png delete mode 100644 src/docs/sphinx/dev_guide/jira.rst diff --git a/scripts/bamboo/install_webdocs.sh b/scripts/bamboo/install_webdocs.sh deleted file mode 100755 index fbcf44e0b5..0000000000 --- a/scripts/bamboo/install_webdocs.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -####################################### -# Variables -####################################### - -BUILD_TYPE="Debug" -BUILD_PATH="axom_build" -INSTALL_PATH="axom_install" - -TOOLKIT_WEB_ROOT="/usr/global/web-pages/lc/www/axom" -DOCS_DIR_OLD="${TOOLKIT_WEB_ROOT}/docs_old" -DOCS_DIR="${TOOLKIT_WEB_ROOT}/docs" - -if [[ $HOSTNAME == rz* ]]; then - echo "Error: this job is to be run on the CZ" - exit 1 -else - HOST_CONFIGURATION="host-configs/quartz-toss_3_x86_64_ib-gcc@7.3.0.cmake" -fi - - -####################################### -# Configure -####################################### - -echo "------------------------------Configure Build------------------------------" -./config-build.py -ecc -hc $HOST_CONFIGURATION -bt $BUILD_TYPE -bp $BUILD_PATH -ip $INSTALL_PATH -if [ $? -ne 0 ]; then - echo "Error: config-build.py failed" - exit 1 -fi -echo "-----------------------------------------------------------------------" - - -####################################### -# Build documentation -####################################### - -echo "------------------------------Making docs------------------------------" -cd $BUILD_PATH -make VERBOSE=1 -j16 docs -if [ $? -ne 0 ]; then - echo "Error: 'make docs' failed" - exit 1 -fi -echo "-----------------------------------------------------------------------" - - -####################################### -# make install -####################################### - -echo "--------------------------make install--------------------------------" -make VERBOSE=1 -j16 install -if [ $? -ne 0 ]; then - echo "Error: 'make install' failed" - exit 1 -fi -echo "-----------------------------------------------------------------------" - - -####################################### -# make install -####################################### - -cd .. -echo "---------------------------Installing docs to public-------------------" -if [ -d ${DOCS_DIR_OLD} ]; then - rm -rf ${DOCS_DIR_OLD} - if [ $? -ne 0 ]; then - echo "Warning: 'rm' of docs_old failed" - fi -fi - -if [ -d ${DOCS_DIR} ]; then - mv ${DOCS_DIR} ${DOCS_DIR_OLD} - if [ $? -ne 0 ]; then - echo "Warning: 'mv' docs to docs_old failed" - fi -fi - -cp -R ./${INSTALL_PATH}/docs ${TOOLKIT_WEB_ROOT}/ -if [ $? -ne 0 ]; then - echo "Error: 'cp' failed" - exit 1 -fi - -chgrp -R axom ${DOCS_DIR} -if [ $? -ne 0 ]; then - echo "Error: 'chgrp' failed" - exit 1 -fi - -chmod -R g+r+w+X ${DOCS_DIR} -if [ $? -ne 0 ]; then - echo "Error: 'chmod' failed" - exit 1 -fi - -chmod -R o+r+X ${DOCS_DIR} -if [ $? -ne 0 ]; then - echo "Error: 'chmod' failed" - exit 1 -fi -echo "-----------------------------------------------------------------------" diff --git a/scripts/bamboo/queue_build.py b/scripts/bamboo/queue_build.py deleted file mode 100755 index 3fdfd6391a..0000000000 --- a/scripts/bamboo/queue_build.py +++ /dev/null @@ -1,100 +0,0 @@ -#! /usr/bin/env python - -# Author: Ian Lee, 28 June 2016 -# https://mystash.llnl.gov/projects/ATLASSIAN/repos/scripts/browse/queue_build.py - -import getpass -import logging -import requests -import getopt, sys - -logging.basicConfig(level=logging.DEBUG) -logger = logging.getLogger(__name__) - -def main(argv): - global testPlan - try: - opts, args = getopt.getopt(argv,"h:p",["plan="]) - except getopt.GetoptError: - print 'queue_build.py -p ' - sys.exit(2) -# print "in main" - for opt, arg in opts: - if opt == '-h': - print 'queue_build.py -p ' - sys.exit() - elif opt in ("-p", "--plan"): - testPlan = arg - print testPlan - else: - print 'queue_build.py -p ' - sys.exit() - - -__url_cache__ = {} - -class CZBamboo(requests.Session): - - def __init__(self): - - super(CZBamboo, self).__init__() - self.headers.update({ - # Only accept JSON responses - 'Accept': 'application/json', - # Only accept UTF-8 encoded data - 'Accept-Charset': 'utf-8', - # Always sending JSON - 'Content-Type': "application/json", - }) - - self.login_url = 'https://lc.llnl.gov/dologin.cgi' - self.base_url = 'https://lc.llnl.gov/bamboo/rest/api/latest' - - def build_url(self, *args, **kwargs): - """ - Builds a new API url from scratch. - Adapted from: https://github.com/sigmavirus24/github3.py/blob/develop/github3/session.py - """ - - parts = [kwargs.get('base_url') or self.base_url] - parts.extend(args) - parts = [str(p) for p in parts] - key = tuple(parts) - logger.info('Building a url from %s', key) - - if key not in __url_cache__: - logger.info('Missed the cache building the url') - __url_cache__[key] = '/'.join(parts) - return __url_cache__[key] - - def login(self): - """ - Login to Lorenz with credentials gained via terminal prompt - """ - - username = getpass.getuser() - password = getpass.getpass('Pin & Token: ') - response = self.post(self.login_url, auth=(username, password)) - logger.debug('Server response: %s', response.__dict__) - - def queue(self, plan_key=None): - - if plan_key is not None: - self.post(self.build_url('queue', plan_key)) - response = self.get(self.build_url('queue')) - return response.json() - - -if __name__ == '__main__': - - main(sys.argv[1:]) - msg = "Test plan = " + testPlan -# print msg - bamboo = CZBamboo() - bamboo.login() -# queue = bamboo.queue('ASC-NIG') -# queue = bamboo.queue('ASC-NIG71') - queue = bamboo.queue(testPlan) - print(queue) - - diff --git a/scripts/llnl_scripts/find_unused_tpl_dirs.py b/scripts/llnl_scripts/find_unused_tpl_dirs.py index 06ae21bf8c..cacdcae78c 100755 --- a/scripts/llnl_scripts/find_unused_tpl_dirs.py +++ b/scripts/llnl_scripts/find_unused_tpl_dirs.py @@ -35,7 +35,7 @@ from os.path import join as pjoin -from llnl_lc_build_tools import sexe, get_timestamp, get_shared_tpl_builds_dir +from llnl_lc_build_tools import sexe, get_timestamp, get_shared_libs_dir def unique(lst): @@ -49,9 +49,18 @@ def lc_tpl_root_dirs(): """ Returns list of root dirs Axom have used for tpl installs on LC """ - return [get_shared_tpl_builds_dir(), - "/usr/workspace/wsa/axom/thirdparty_libs/builds/", - "/usr/workspace/wsrzc/axom/thirdparty_libs/builds/"] + root_dirs = [] + for sys_type in ["blueos_3_ppc64le_ib_p9", "blueos_3_ppc64le_ib", "toss_3_x86_64_ib"]: + libs_dir = pjoin(get_shared_libs_dir(), sys_type) + root_dirs.append(root_dir) + + devtools_dir = pjoin(get_shared_devtool_dir(), sys_type) + root_dirs.append(devtools_dir) + + # Add legacy dir until we have moved fully to new directories + root_dirs.append("/usr/WS1/axom/thirdparty_libs/builds") + + return root_dirs def clone_axom(): """ @@ -64,7 +73,7 @@ def clone_axom(): os.mkdir(tmp_dir) os.chdir(tmp_dir) print "[cloning axom into %s]" % pjoin(tmp_dir,"axom") - res = sexe("git clone ssh://git@cz-bitbucket.llnl.gov:7999/atk/axom.git",echo=True) + res = sexe("git clone git@github.com:LLNL/axom.git",echo=True) if res != 0: print "[ERROR: clone of axom repo failed]" sys.exit(res) @@ -187,12 +196,3 @@ def main(): if __name__ == "__main__": main() - - - - - - - - - diff --git a/src/docs/sphinx/dev_guide/bamboo.rst b/src/docs/sphinx/dev_guide/bamboo.rst deleted file mode 100644 index 10fb153ccd..0000000000 --- a/src/docs/sphinx/dev_guide/bamboo.rst +++ /dev/null @@ -1,236 +0,0 @@ -.. ## Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -.. ## other Axom Project Developers. See the top-level COPYRIGHT file for details. -.. ## -.. ## SPDX-License-Identifier: (BSD-3-Clause) - -.. _bamboo-label: - -******************************* -Continuous Integration -******************************* - -*Bamboo* is a continuous integration (CI) tool that is part of the Atlassian -tool suite. The Axom project uses two Bamboo projects, one on the LC -Collaboration Zone (CZ) and one on the LC Restricted Zone (RZ). - -The basic mechanics for managing test plans described in -:ref:`bambooplan-label` is the same for both Bamboo instances. - - -=========================== -CZ Bamboo Project -=========================== - -We use the `Axom CZ Bamboo project `_ -primarily for manually running Bamboo plans on specific branches. For example, -if you are working on a branch and you want to build the branch code and run -tests on several LC platforms on the CZ with a variety of compilers, you can -do this easily. The plans for such branch testing are configured so -that when a new Axom git branch is created and pushed to our Bitbucket project, -the branch will appear in the list of branches on which a plan can be run. - -There are Bamboo plan options for this branch testing. One is a "smoke test" -that will build and run tests on a single platform with our default GNU -compiler. The other is a more comprehensive plan that will build and run tests -on each of the platforms we need to support using the compilers and versions -our users require. - -To run a plan on a specific branch, do the following: - - #. Log into the CZ Bamboo tool. - #. Click on the 'Axom' project. - #. Select the test plan you want to run. - #. Click on the branch you want to build and test. - #. Click 'Run plan' via the 'Run' pulldown menu on the upper right. - -Depending on resource availability and what the plan does, the plan may -take a while to run. When the plan completes, you will receive an email -indicating this and whether everything passed or if there were any failures. -If you need to look at the detailed results (e.g., if a test failed), you -can do the following: - - #. Click the branch name in the plan. - #. Click the run number in the summary. - #. Click the 'artifacts' tab. - #. Click the artifact that you want to see. The test plan artifacts - contain the detailed output generated by Google Test and FRUIT. - -We also have one plan that is scheduled to automatically build and run tests -on the master branch on a select set of platforms and compilers once per week. -This plan may be run manually at any time by selecting the plan and clicking -on 'Run plan' as described above. Each member of the team receives an email -notification indicating passes and failures of builds and tests run by this -plan. - -=========================== -RZ Bamboo Project -=========================== - -We use the `Axom RZ Bamboo project `_ -for the bulk of Axom automated build and test operations. This includes: -nightly scheduled builds and tests of the develop branch on each of the -platform types we support with a variety of compilers, nightly builds of user -documentation installation of this documentation on our LC web pages, and -weekly third-party library builds. - -Similar to our CZ Bamboo plans, each of these plans may be run manually at -any time by selecting the plan and clicking on 'Run plan'. - - -.. _bambooplan-label: - -==================================== -Bamboo Test Plans -==================================== - -A Bamboo plan consists of stages, each of which represents a step in a -build and/or test process. Each stage may contain one or more jobs that can -be run in parallel by Bamboo. For example, you may have a stage that compiles -a code and multiple testing stages which follow that can run in parallel. -Each stage contains specific tasks to run. Currently, Axom plans don't exercise -parallel execution in Bamboo. A typical Axom test plan consists of a set of -stages, one to build the code and run tests for each platform and compiler -combination. The tasks comprising a stage are shell commands that navigate -workspace directories on LC systems, check out the axom code, and run scripts -(that we archive in our source code repo) that encode all of the code -compilation and test execution operations. A final stage parses CTest output. - -.. note:: All of our scripts that are run in Bamboo can be found in - the source directory `axom/scripts/bamboo`. - -To see the specific contents of any particular plan, click on the Axom project -in one of our Bamboo projects and click on a plan. Then, in the 'Actions' -pull-down menu at the upper right, click on 'Configure plan'. Clicking on -the 'Stages' tab will reveal the stages in the plan and clicking on a stage -will show the tasks in the stage, including shell commands, scripts that -are run, etc. - -Creating and configuring a Bamboo plan ----------------------------------------- - -Here are the steps to create and set up a Bamboo plan once you are in the -appropriate Axom Bamboo project (either CZ or RZ): - - #. Click the 'Create' button at the top of the page and choose either - 'Create a new plan' or 'Clone an existing plan'. - - * When you choose to create a new plan, you can define everything about - what the plan does. - - * When you clone an existing plan, you make a copy of the plan and its - entire configuration. - - #. Enter information in all required fields (i.e., required fields are - denoted with a red asterisk). - - * If you clone an existing plan, make sure you choose the correct - **destination project** for the plan. - - * Make sure you link the correct repository and branch to the plan. - - .. note:: This only applies to the CZ Bamboo project since our repo - lives on the CZ Bitbucket server. We could use the Bamboo - plugin to clone the repo as a plan task; however, we - typically do not do this and use the 'script' interface to - clone via the git clone command. Nevertheless, linking - a repo to a plan allows us to set up the plan to run on - any branch in the repo. - - A CZ repo cannot be linked to a plan on the RZ Bamboo - project due to LC security constraints. To set up an - RZ Bamboo plan that is not associated with a repository - choose 'Link new repository' and select 'None' from the - pulldown menu. - - #. Click 'Configure plan'. Bamboo will ask you to configure plan tasks. - - #. Click 'Add task' for each task you wish to add to the plan. Note that - a typical Axom plan includes **script** tasks (either inline or run - from files). - - * Start typing 'script' in the search field and select the script - icon when it appears. - - #. Configure each task. For a 'script' task, this means: - - * Enter a short script description. - - * Choose 'inline' or 'file'. If inline, type in the script commands. - If file, choose the file containing the script to run. - - * Fill in arguments, environment variables, etc. as needed. - - #. Check the box under 'Enable this plan?' - - #. Click the 'Create' button. - -.. important:: After a plan is created, many of its configuration options can - be set or modified using the appropriate option tabs that - appear across the top of the web page when 'Configure plan' is - selected from the 'Actions' pulldown menu. - - -Associating an agent to a Bamboo plan ----------------------------------------- - -Every Bamboo project has *agents* the run Bamboo jobs on LC platforms. When -Bamboo executes a plan, it communicates with an agent associated with it for -the desired platform that runs tasks on the machine. Here are the steps to -associate an agent with a plan: - - #. Log on to the `MyLC` portal for the appropriate network (CZ or RZ). - - #. Switch to the Axom *shared user account* which is the account under which - all Axom plans run. First, click the 'change user' link at the upper right. - Enter 'atk' as the user in the field at the upper left, choose the - account associated with the 'atk' LC username, and check the 'su to user' - box. - - #. Go into the 'bamboo agent management' portlet. You will see a list of - agents and machines that we have. Select the machine you want to create - the agent on and enter a descriptive name (e.g., axom-rzalastor), and - click 'create'. - - #. Finally, to attach the agent to a plan, you must send an email to the - LC Atlassian email list `lc-atlassian-admin@llnl.gov` requesting that - the named agent you created be attached to the plans you want. - -Restarting agents ------------------- - -Occasionally, agents must be restarted. When an agent dies, Bamboo jobs will -be queued and stalled until the agent that should run them is restarted. - -We have 'cron' jobs running on the CZ and RZ to check our agents and restart -those that need it. The crontab files are located in the directory -`axom/scripts/bamboo` in our source code repo. - -Disabling or deleting a Bamboo plan ----------------------------------------- - -Any Bamboo plan may be disabled by selecting the plan, clicking the 'Actions' -pulldown menu and then clicking 'Disable plan'. When a plan is disabled, -its configuration and history is preserved, but it will not run. - -Deleting a plan removes its configuration, history, artifacts, labels, etc. -If the plan is ever needed again after it is deleted, it must be completely -reconstructed from scratch. Therefore, a plan should only be deleted if it -is clear that it will not be needed in the future. A couple of other important -points to note: - - * A plan that is running cannot be deleted -- the plan must be stopped first. - - * A record of a plans results can be preserved, if necessary, before it is - deleted. See `Exporting data for backup `_ for details. - -To delete a Bamboo plan, select it, click the 'Actions' pulldown menu and click -on 'Configure plan'. Then, click the 'Actions' pulldown menu and click -on 'Delete plan'. - -==================================== -Other Bamboo Things... -==================================== - -* Run plan from command line. I believe this can be done using the - `queue_build.py` script in `axom/scripts/bamboo` but am not sure how... - diff --git a/src/docs/sphinx/dev_guide/component_org.rst b/src/docs/sphinx/dev_guide/component_org.rst index c30ef0d2f4..3cead84481 100644 --- a/src/docs/sphinx/dev_guide/component_org.rst +++ b/src/docs/sphinx/dev_guide/component_org.rst @@ -57,7 +57,7 @@ Note that, besides directories, the top-level component directory contains a few files: * **CMakeLists.txt** contains CMake information for the component in the Axom build system. -* **README.md** is the markdown overview file for the component. Its contents appear in the Axom Bitbucket project when you navigate through the source tree. +* **README.md** is the markdown overview file for the component. Its contents appear in the Axom Github project when you navigate through the source tree. The **docs** directory contains the component documentation. Subdirectories in the docs directory are named for each type of documentation. The directories @@ -319,7 +319,7 @@ Documentation Complete documentation for an Axom component consists of several parts described in the following sections. All user documentation is accessible -on the `Axom LC web space `_. +on `Axom Read The Docs page `_. README File ------------ @@ -328,7 +328,7 @@ Each Axom component should have a basic `README.md` markdown file in its top-level directory that briefly describes the role and capabilities of the component. The contents of this file will appear when the component source code is viewed on the -`Axom Bitbucket project `_. +`Axom Github project `_. User Documentation ------------------ diff --git a/src/docs/sphinx/dev_guide/continuous_integration.rst b/src/docs/sphinx/dev_guide/continuous_integration.rst new file mode 100644 index 0000000000..9b8abc93aa --- /dev/null +++ b/src/docs/sphinx/dev_guide/continuous_integration.rst @@ -0,0 +1,47 @@ +.. ## Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +.. ## other Axom Project Developers. See the top-level COPYRIGHT file for details. +.. ## +.. ## SPDX-License-Identifier: (BSD-3-Clause) + +.. _continuous_integration-label: + +******************************* +Continuous Integration +******************************* + +The Axom project uses two CI tools, +`Azure Pipelines `_ +via Github and `Bamboo `_ +on the LC Restricted Zone (RZ). + +.. _azure_pipelines-label: + +=============== +Azure Pipelines +=============== + +Every Pull Request created on Github is automatically run through a series of +CI jobs to ensure that the Axom source builds and passes our unit tests. +These configurations mimic the LC compilers and systems as closely as possible +via Docker containers that have our third-party libraries pre-built on them. + + +.. _bamboo-label: + +========== +RZ Bamboo +========== + +We use the `Axom RZ Bamboo project `_ +primarily for testing the develop branch against the various LC System Types. +There are two types of Bamboo Plans which are automatically triggered to build +and run tests against the develop branch. The first is triggered nightly and +on any repository change on Github that builds and tests the current Axom source +against previously built third-party libraries. The second is triggered nightly +and builds and tests the complete third-party library build and then the Axom source +against those libraries. + +This plan may be run manually at any time by selecting the plan and clicking +on 'Run plan' as described above. Each member of the team receives an email +notification every morning about the current state of all jobs. + diff --git a/src/docs/sphinx/dev_guide/dev_summary.rst b/src/docs/sphinx/dev_guide/dev_summary.rst index f6404e7d97..cf40ec72ad 100644 --- a/src/docs/sphinx/dev_guide/dev_summary.rst +++ b/src/docs/sphinx/dev_guide/dev_summary.rst @@ -16,7 +16,7 @@ Software Development Cycles ====================================================== The Axom team uses a sprint-based development process. We collect -and track issues (bugs, feature requests, tasks, etc.) using ``JIRA`` +and track issues (bugs, feature requests, tasks, etc.) using ``Github`` and define a set of development tasks (i.e., issues) to complete for each sprint. While the team meets to discuss issues and plan which ones will be worked in each sprint, developers of individual Axom components may plan and @@ -24,8 +24,6 @@ schedule work in any way that works for them as long as this is coordinated with other team efforts. Work performed in each sprint work period is tracked as a single unified sprint encompassing activities for the entire project. -See :ref:`jira-label` for more information about how we do issue tracking -and release planning. ====================================================== @@ -50,7 +48,7 @@ See :ref:`semver-label` for a description of semantic versioning. Branch Development ====================================================== -The Axom project has a ``CZ Bitbucket`` project space and the team follows +The Axom project has a ``Github`` project space and the team follows the **Gitflow** branching model for software development and reviews. Gitflow is a common workflow centered around software releases. It makes clear which branches correspond to which phases of development and those phases are @@ -68,7 +66,7 @@ Code Reviews and Acceptance Before any code is merged into one of our main Gitflow branches (i.e., develop or master), it must be adequately tested, documented, and reviewed for acceptance by other team members. The review process is initiated via -a *pull request* on the Axom Bitbucket project. +a *pull request* on the Axom Github project. See :ref:`pullrequest-label` for a description of our review process and how we use pull requests. @@ -105,20 +103,21 @@ Developer-level access to Axom project spaces in these tools requires membership in the LC group 'axomdev'. If you are not in this group, and need to be, please send an email request to 'axom-dev@llnl.gov'. -The main Atlassian tools we use are listed below. Please navigate the links +The main tools we use are listed below. Please navigate the links provided for details about how we use them and helpful information about getting started with them. * **Confluence.** We use the `Axom Confluence space `_ for team discussion (e.g., hashing out design ideas), maintaining meeting notes, etc. -* **Bitbucket.** We use the `Axom Bitbucket project `_ to manage our Git repository which contains the Axom source code, build configurations, scripts, test suites, documentation, etc. +* **Github.** We use the `Axom Github project `_ to manage our issues and Git repository which contains the Axom source code, build configurations, scripts, test suites, documentation, etc. - * See :ref:`bitbucket-label` for more information about how we use Git and Bitbucket. + * See :ref:`github-label` for more information about how we use Git and Github. -* **JIRA.** We use the `Axom JIRA project `_ for issue tracking and release planning. +* **Bamboo.** We use Bamboo for continuous integration to ensure code quality on our LC systems.: `Axom RZ Bamboo project `_ - * See :ref:`jira-label` for more information about how we use JIRA. + * See :ref:`bamboo-label` for more information about how we use Bamboo. -* **Bamboo.** We use two Bamboo projects for continuous integration tasks.: `Axom CZ Bamboo project `_ and `Axom RZ Bamboo project `_ +* **Azure Pipelines.** We use Azure Pipelines for continuous integration to ensure every code change passes a +level of quality before being merged.: `Azure Pipelines `_ - * See :ref:`bamboo-label` for more information about how we use Bamboo. + * See :ref:`azure_pipelines-label` for more information about how we use Azire Pipelines. diff --git a/src/docs/sphinx/dev_guide/bitbucket.rst b/src/docs/sphinx/dev_guide/github.rst similarity index 87% rename from src/docs/sphinx/dev_guide/bitbucket.rst rename to src/docs/sphinx/dev_guide/github.rst index c71a518ab4..cbe39bcadd 100644 --- a/src/docs/sphinx/dev_guide/bitbucket.rst +++ b/src/docs/sphinx/dev_guide/github.rst @@ -3,34 +3,31 @@ .. ## .. ## SPDX-License-Identifier: (BSD-3-Clause) -.. _bitbucket-label: +.. github-label: ****************************************************** -Git/Bitbucket: Version Control and Branch Development +Git/Github: Version Control and Branch Development ****************************************************** This section provides information about getting started with Git and -Bitbucket and describes some mechanics of topic branch development +Github and describes some mechanics of topic branch development on the Axom project. For most project work, we interact with our Git -repository via our `Bitbucket project `_. +repository via our `Github project `_. If you are new to the Git or want to brush up on its features, there are several good sources of information available on the web: * `Atlassian Git Tutorial `_ has a lot of useful stuff. * The `Git Docs `_ is a complete reference for Git commands and options. It also provides some *cheat sheets* you can download. - * `Learn Git Branching `_ is nice for visual, hands-on learners. + * `Learn Git Branching `_ is nice for visual, hands-on learners. * The e-book `Pro Git, by Scott Chacon `_ is an excellent overview guide to using Git effectively. ========= SSH Keys ========= -If you have not used Bitbucket before, you should start by doing two things: - -* `Create an SSH key `_ -* `Add the SSH key to your Bitbucket profile `_. - +If you have not used Github before, you should start by creating and adding your SSH keys to Github. +Github provides a good tutorial `here `_. Performing these two simple steps will make it easier for you to interact with our Git repository without having to repeatedly enter login credentials. @@ -45,12 +42,12 @@ All development work on Axom is performed in a *local workspace copy* of the Git repository. To make a local workspace copy, you clone the repo into a directory that you will work in. This is done by typing:: - $ git clone --recursive ssh://git@cz-bitbucket.llnl.gov:7999/atk/axom.git + $ git clone --recursive git@github.com:LLNL/axom.git .. note:: You don't need to remember the URL for the Axom repo above. It can be - found by going to the Axom repo on our Bitbucket project and - clicking on the 'Clone' action button that appears when you hover - your mouse cursor over the ellipses on the top left of the web page. + found by going to the Axom repo on our Github project and + clicking on the 'Clone or download' button on the upper right hand corner + above the source. The '--recursive' argument above is needed to pull in all Git *submodules* that we use in the project. In particular, you will need the BLT build system, @@ -171,9 +168,9 @@ a *bugfix branch*, etc. The basic workflow for performing development on a topic branch is: #. Create a topic branch off the develop branch and push the new branch - to Bitbucket. + to Github. #. Make changes and commit them to your branch in your local copy of the - repository. Remember to push changes to the main repo on Bitbucket + repository. Remember to push changes to the main repo on Github regularly for backup and so you can easily recover earlier versions of your work if you need to do so. #. If you are working on your topic branch for a while, it is a good idea @@ -202,26 +199,26 @@ Step 1 -- Create a topic branch $ git checkout -b feature//my-cool-new-feature $ git push -u - You can also attach a JIRA issue number to the branch name if the work - you will do on the branch is related to a JIRA issue. Then, Bitbucket + You can also attach a Github issue number to the branch name if the work + you will do on the branch is related to a issue. Then, Github will associate the issue with the commit when you merge your branch to the develop branch. For example,:: - $ git checkout -b bugfix//jira-atk- + $ git checkout -b bugfix//issue-atk- $ git push -u - Alternatively, if your branch addresses multiple JIRA issues, you should - add the appropriate JIRA issue numbers (e.g., ATK-374) to the messages in + Alternatively, if your branch addresses multiple issues, you should + add the appropriate issue numbers (e.g., #374) to the messages in your commits that address them. In each of these examples, the 'git push -u' command pushes the branch to - the Bitbucket server and it will appear in the list of branches you and + the Github server and it will appear in the list of branches you and other developers can see there. Step 2 -- Do development work -------------------------------- - After you've created a topic branch and pushed it to Bitbucket, perform + After you've created a topic branch and pushed it to Github, perform your development work on it; i.e., edit files, add files, etc. Common commands you will use are:: @@ -328,23 +325,23 @@ Step 4 -- Create a pull request ------------------------------------- When your work is complete, and you are ready to merge your topic branch - to the develop branch, you must initiate a pull request in Bitbucket. Go - into the Axom Bitbucket project, select your branch, and click + to the develop branch, you must initiate a pull request in Github. Go + into the Axom Github project, select your branch, and click `Create pull request` in the left column. Make sure you select the correct destination branch. The default destination branch in our project is set up to be the develop branch. So, in most cases, you won't have to do anything special. You must also select appropriate team members to review changes. Our - Bitbucket project is set up to require at least one other developer to + Github project is set up to require at least one other developer to approve the pull request before a merge. .. important:: **You cannot approve your own pull request.** When your pull request is approved (see :ref:`review-label` for more information), you merge your topic branch to the develop branch by - clicking the "merge" button in Bitbucket. If there are no merge conflicts, - the merge will proceed and you are done. If there are conflicts, Bitbucket + clicking the "merge" button in Github. If there are no merge conflicts, + the merge will proceed and you are done. If there are conflicts, Github will indicate this and will not let you merge until all conflicts are resolved. @@ -366,14 +363,14 @@ Step 4 -- Create a pull request $ git commit $ git push - Lastly, complete the merge in Bitbucket by clicking the merge button. + Lastly, complete the merge in Github by clicking the merge button. .. important:: **To keep things tidy, please delete your topic branch in - Bitbucket after it is merged if you no longer need it for - further development. Bitbucket provides an option to + Github after it is merged if you no longer need it for + further development. Github provides an option to automatically delete the source branch of a merge after the merge is complete. Alternatively, you can click on - the Bitbucket branches tab and manually delete the branch.** + the Github branches tab and manually delete the branch.** ================================ Checking Out an Existing Branch diff --git a/src/docs/sphinx/dev_guide/index.rst b/src/docs/sphinx/dev_guide/index.rst index e3926c6693..ab1391c33b 100644 --- a/src/docs/sphinx/dev_guide/index.rst +++ b/src/docs/sphinx/dev_guide/index.rst @@ -41,11 +41,11 @@ changes are made, this guide should be updated accordingly. :maxdepth: 2 dev_summary - jira + continuous_integration release semantic_versioning gitflow_branching - bitbucket + github pull_requests component_org testing diff --git a/src/docs/sphinx/dev_guide/jira-issue.dot b/src/docs/sphinx/dev_guide/jira-issue.dot deleted file mode 100644 index 3700fc73e7..0000000000 --- a/src/docs/sphinx/dev_guide/jira-issue.dot +++ /dev/null @@ -1,16 +0,0 @@ -digraph { - START - Open - In_Progress - Closed - - START -> Open [label="create issue"] - - Open -> In_Progress [label="start progress"] - Open -> Closed [label="close issue (done or won't fix)"] - - In_Progress -> Closed [label="close issue (done or won't fix)"] - - Closed -> Open [label="reopen issue"] - -} diff --git a/src/docs/sphinx/dev_guide/jira-issue.png b/src/docs/sphinx/dev_guide/jira-issue.png deleted file mode 100644 index f9951be6ced933832be6a34f10ec6f31fef84074..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 37878 zcmd43cRZHw|2KY7NwP?BbsSw*rUsq7glM2IpI zAtQU=&!f-xbKk$m@A3QnfA^X1_nYfF&+|Br*Xy}nr{A%osw_H$6HsKFmD#zB_dN+UIvF?!;$ zD(bW?m9>hE@q^4KGc`||^9E*o+EE^8^Na5l_qvkipaf~=s=KdWeWk^}($|#`)5|g` zQ2I46zxx&Q*B^U($2{^r3k}VEZ<_e6P*Xql`(1<>mkJ|02M32v!n2Kz6jA(f-FIJ> z{O^jwFNdjAYCL6kJgYLbDmgKcF+^~`%K7sf1^2sptA+@QY}&MP#flXlK7VGQ{Os)& z!(Tpp_^|ft*A*1K6eFImFZ6Fcd$y68nOP$@D=RC0K9oiiFTrOHZ&gwflDqs}+1h%` z-Me@1+`H#pT1pk)xKVWPUOs$<YC;6RsH%- zE4Yp`c6N5sXtcuDmzvlG1cFYzxg3+8&W_97AuW9)DM@0TtTp5DtwY9aWt!+qo z5Pw8dg$h;A%&>))sJCj>sy){Rc~uS`wC^llQCe1ZU}IR(moJ=KPi0f9?{Dqt`A}R; zzi!=^ZQq~A$9K$54A6pu4{K@$<{JL``LnRLmYtQA)y~dNx%czqy42JA5|fjUJdB|A z6_{I!iBgm=U*7gPYVWP5Plea-y|O$bBO~!-=En8w*PC9ruu@f3wYjCGO8b)J&EjGe z>Y+oO#XhSU+1OMK4S9#Yzg>nuR|gtdE?>TE=iqQFG&Hn9$B)+LpAe+x)6?7A-B%aa z{MKO;>-s(9ahEhUt{EB{va`3pk&=?~B}Hw6xVZ4<&5Q>Q9N1&uwfxEc>kJnzTwvzg zx%?Ibi^`vt*9pODR6R*-As%i%KEH{9CX3;=Jm=l-!Lkv z>EWTMqN0-S(0g>Sy+Eku$^Kgb0jqO!b8FK~lq$7nI63kHaaD)7xw%c-^W6>eTxE)j zi)-IGUUGJEF{^!gV27;iefcLpuQ)i^Pmh>cx8?HrvI^YH$dE1%5emt$sEED%I&LZ3VdUR;>7=qmN=YtD#ksFO^Ij~9P=`u!SyS!?AJC)VH+ zb~p_gV>f8`U!=wtV?pof9XLQIYt!OAT(Bg_$H&L3m+t~^hXQkF` zKNC1Uel?I^j@9AU$IhVDRPj}K4jZlxecwAhJuR%LC}>d;To$$0!LU(L8Tan7ICEjk z$yduyo;*3dI5#Y9`9(Z2Y4j1rFR^Pxjy06iWxS80JXj!rRY3mfnLJmTpI^~KnM;Pv zipRnw^>^T>zvsGeMY~V(o&Oj~w{PD*>fys00zouA#v}ZpclUTMDqv^Y_0@_Dw!B`A z^-51qzaxKNx300VJoZq4T~8Iy#Y>k;+S&xA3{vmOui;2yBv+e${?odv{SB*9j9wSx zv~+ZKia3fVH0HWEL@BzjYj>X#Am7Hu#-`vttJiNxjsNMa#UDz~rDEEWWjQi7Rx;J@ z8S-G)1(l6q>HuY(P++eSF=I~(# zqN!HmmfNGhy!^Y~2=TdVAzU*y#rvQw|2K*;<=zb85Hcm*qPjFyr4MA|e#8uua;y@dG9%LN=}0 zK93&@oZZQX;)i4Di_N2~s=5+CnUs{2_EASqZ~4lVD}Vm_b^oErmMzQ&Z!_P}+<5EZ z!*%bRhJ&$jNwL`PI$jtmrmB&(FbfucZrfQ`PR(-tn zkNN40i*>O+Iqq|lQV#Rjf%IO}GriF!kGfH8>Afy~iT86mb@_5C9$X+r_}XBzNc&=p zOOgh79PqibfsP0x{JaS>|_oAPbVP@v$xkNH)39)Ev{ZI3#G1k-XUa=A|?ao}JP6 z@2{blqULSb_F}m8&Gv_KwyYEsHB~>|DfzaxHr$rFpN)==&c*LJ()rU}tH0;iFT?Rz zk}wHcCqtoVKT!y^ox7uO?h{HM{!a1d$NQ=s1x0lQw%Aaa%u$FgHooLD%C*#Q3YH7tJC$AO~67u%;?x+fvO548?g~@Ya zV(rbFH-Db1DJfaDdhNFP4uzhwx;hTrKN|Oac_t1CI&vKBmloZ3V-Zw(*DJd1x!j%~ zbTaci9R=-lIqJKD+w{n-au$@&3(@Wym!`1RI@ob?soDG8XSwI5hEtXDimgzN>WAMN7-hj-p$` z`zO(~M#|QjC^PDGy|!tUJwNQ8PJ2$ekWpA?y1)~{FRUL0jH7N*w=QyBo z#pn_3UdZgt6|2{%3EZT$9X)bnHLBaqkPz*+CT=D;gD*`A1kKFMMy94Je%C)A9Y`xM z$9fySyDEY9wEBVOiLS`*iV%yLzdZzF;s5Fw8#CM3*vv@Q3wh4pSjDxm18ws#T1xFR ztw)>{Lh@G`Z``<{rlFzY?7RmEQP{gML}`(BBw}0VXm`ai0|Qm`3)71i84n&jh+Ro} zf9+3k(XEv_ndd)oTI6rlJ`}mnX5*IoHvMhf_z?l$Gh*Aeu{Jg~?s4qr9{lqsA^0GE6g#_U z@W=bLVuu3@Q90}K-LEHg*A^&TpJWaW4o-jdsyJ9+Up)CyZ~Q2o%k}F7WZ_YH#l*xk z*!OK9zc@42YybPphK83XkCVnjCA;kyKtj~x$2x|Fv^dp}{K>bLdiLJz(_I1Ee>(jz zI(6#EzoutP71mYOf1y_dOcVO(Q2-8@$kwe|{c4gaIXS$Fii(EsuWg+i{8mzYnA-F2 z7(R%M>}W_jUfa;%ote2S)%dNbqj>oE`0wM+&d#Q2ZhM?Zgk8t`(D+4lb;*W&iO(c( z4@IW4qr*$$j=M#5IdF#>hYbwYDlLq2Z8OOa z?EjivQdYL&@jj>Ww+_AW!O!jtwHJicD9$nC#>?=L>F27~tXJ|_fB*h{T~#qr94$6tNGeJ2y zdzgh3*YA9w+3!q^zlk-!7ljo8D7Kp&w`@o`MfQ{zsLh%!hF%~^N!|LA-@bioesym3 z;NYO?rAq<8Zl-`OIgSHsKtNV%X=x>iafUK=%ZailMgIJGmK-j5#f8yg$rH1j9yXNkOj|2CM&jMTn;{P?J{J0b^nm=;nR5_Jyt)2P%m z)MZgZ;hHlnQ1RH&j_%yKLlF}b%X#;%xUzE9e-6pbhY!uq=!8Ce=s(t5Ber`tHvm=6 zl^!OvlG@jo407JTk0aFK`19ZfY48IcfHFb#>FIVeISH`J-uHw6cl?SnKYbEl`BOG`_I@eC=o>1GF;o0|*U+RmJjef|1% z_3qUiI)^}1VwYZmnabI=QLkRzZEkLE2b}8Sr=g`)R$XucrP9>Y)C(-2xUi7&HQ8V# zdCJSItgMb5KYkEkWn_NF0g#fOf*yGcW#jvIW3b=E(t)0e@V|5y_@|-tWE0_+DgRgf za(E21hN9NiQ~kWucyDsW6mfC!dzEMp4F_;6tIuu`jg7EW6Y!#`SpfwTbOGKzR%8)g z#!ICpnBk_v?}vuo03;FJzFoV2Gx}30`jejJ&!0a{i*BwUzk!~~0D9*(_va1dhziuC z9hVxn7#bRO0Gg&}XOqTy=kDE`FJEpUr4typuQp~GfTR6r*P)plAPLoIMfV+^i*6{z zaX1-_EG#Q1({pp(sB~&aj+A(>;`&*UYxB`l3Kd}J$9rk3hRuK`2lDqzN-~i$2);-N zF+>P4DXD>=xodw~Rsh+4IJ?v3J`2C>z2-?pK0mdhRidJPbnFH5e*@ApGB^NEVo|pl zMX1WkUKHVM>u+RzseoE5D4hcXQs^lg7+BVc@7%eQ3fYHhW%a@>7hOI8+uI)-PQ;s? zW!-Let%tigR2YFMwxF?l`}iF4o55H2ENzpNbRCFHaG4$dEoC8N)u0yn@L|=`ew6u9 z)Ur22ms+xtrl->SBHrZL9v0O##>NrfOEE9>qNDf9ap(SZ!hLmMsNu$y*!!8;Ns%Ku97QT z{XX#I!wBuu`5glTtI;eqqxNuQXJ>!-_>nx>_IJZJZE|8965DW^UT`xpL3Dg$+rFq> z!NbGT2?CkWrUulyoWi(j)q(nFT6L)4nh$oac=zs|kixI`>tw9BNt;SN{T@q2fAr{4 z!wmDXQ&V|bC(nzEmJvlT{HBl33X17ySJ{RWMS_ZMG_c3K$s7;`VF-YWi;EkwpFew6 z^(IJg|2lkXUqccX<=(rh$-mi7d}F7felg3+%I*P>rC+v8B&>3WZCmb}q3fMJ^e3>P zw_z7akAwA0rbJ*`Rckva&MDqQuVr{(g!VmZ}(q zZP)pag`mK785XJ#6T2W5G-qC5qjUgKl4FAcW&fu|W*+>B;sxD7MO&K<0!KMIBMuKe z7gw0my3F0%nHmG4DCur9SBN+ubE%OEq^ncl;ogvXdM;&d%a$$dYuBy>nHvYs18c-{ zUrqt{j0LC|4iBYq8?G=p2)4jPF`t|KBPuU%G~WO9NMCy()pROGF)3vMMYWJDiG$FgoF)N4T&NO`}ZF*GJ5D%fIkpbc~IRsfr>a*ui1jm zwGNF_9dydiaiDS4>C>mBUH<-b5*%wkb9TA#3%w-K?8`rlx-O$-Mfd|ot#)#9vY(r@ znWq>SOu}K6 z>F#sanE7QjNr4Jq1DWOjj#{j|(VJb@S6K9`w0#$K9@@o4oKd$^Zf*+Tjxo=lucUw- zdjaPyPIt5M^6{zjgwqmr>+Z-?IFi-?fP8=N#5OhbLn>pxjLhqXDNc?$C1=-rG|2{3 zkoH+YpeeVdg(;ppw`pqjBjcMn^!Hr4bjkSrHI}rw39+zBJ78tb=g0hLdIAQ}e2cL} zOxTeLL+E{|fM#Z5qO)tsL9~Oqa{!b(X|CbxSLrK1KQJAoQuSs=@saAq-@fr-V{G2G zZCl1^EiIO*;r3oFMk;lwI9yirZs~_mF&q;O>*F9r6~O{0n`tzSBGO-Z0V1UmSSW`B zc|{Ja6OFA3K|d8Y13bV1iO3N-fX`aSz;sF9#xBxvL#Yg4XG4`WTdu|L4S~sMb z2tlIg$W)@ish_(uxYPjT;#ta8>xMUJKKKMP#|+Y@gV8U){3( z*C$I=h1{3R$ef{5p;q0(!)#M`b%jFSd;?Ha1f>`Jsjo4G9}oNnig7ID-@E6kKYu<9 z4IlW~?&k-N((>}+=4M`^8$N%&2~w|k^s34oBk*WT=et+~0ob8vHeqo|ughTxSp zUk*%gM1l9s&bQa6Qgcnq%gbZWRo{=?V=sC*Xq^u(U0ooA)|W@1uN2ej)fo^+wwUCv zhu%kod7{_hI`YOWKUQ`9?Wt}~H(Q1>!-Q_E8M%WF(&w+KN1UO>1k~&mS?;m4;Pmmy zetthcKVJE(n+b@);Yo^fPxoaLGGCaTFw8v9@+vcP6jF>SghAA}aQSr{b^FNgQ6MO4=w zLVu*3tzgR=TQ(LJ7UO(3zJ1pQk5v^jP+D4AB6nS2z1)`Tci>o|) z72MBZ6nhVkS6`n0|aHvl=2aA*-%F{R_7@iW0*i@A_0Z z8kIfR-frvWWBqD(zu=zyd8E?u>`B+hwZJOK2S281bo|y4<;jG!M1(}C6E6!PLB$6j z{|zu*_~VBFq2i{d!o+LC#VrTCR!f+lAFGMnVMaf{upsR*@0`@FXGGv2R@4lVbYWqk z#vHpDR9t`~Nl~cK1nlA4cc7f&XI^#5!JhlDo!t&NVm{c|PfZFubSp$ec`87P=?{kp60=PN3Op2wQ2Ah$liAjMg!)3V zg=lq}XdVCjmG2N(I)DAT4JTzakaL)PaIu7>Ka#bn&AaXd zaQ5>1FI1KiY=ThOhyZh4oh80#0v!3X{Zi28%Ti(Db;Y z>kr450)hJQ%Uw3@Z%FEqt-x>ALDAo{cQ3hI=u>;#XLl1%&BEdqER68h?>uFnKeG~0 z^x7)CL5HU1L$-|H#BjS1gts!B)2egxs7ytW?}+E2tXwEHR{<-EoN3eoRH~l4F|mVf zd8ZZ~4FFm1$g^@J38zB#NCHt?zG8(L&?&A2D{$xW;~+>@_usX{C4nH<-0Plh@CtN^ZBs61cYfRV2QbSQ6)i9@a0IFs@!-%D36nB1TDS3N6fIoJz#JTE zkK43e(l;0aess$io`Uo^!;$;-`SEJXj-5MizJ0qF(wXk0QpXXX4G8E9|M|uoq6Xm@ zL%%dkb%=cQh};$MYQoU=EnBD>8cZl;J*{W%?O_R8T9PC7C>;gZfH<_+*uvhCLSS}mkI>5x1XgQ`}Op&tPK_JltP@5 zn7FuGIFAMPQH1z=;ZYf7UAz$$wH`z#!dctOs$Z&A5-et&Ra5Fh;5P1dvrVFkVL zNZ~Htc%h&C{|o3t<_#(ADj!zsnVEG;wN@FSn}fv~Y_s6v$YTKtyLS&88+gJ8+QpT} z&$Xi!p&}GkhHa`#I=;#6Z{;S^R*OqYIN(l$b>DZ5DkxBTqUi1qu?#LfvEtBsfggxs z3~z>BNeP(HwF@PNa1kK$8xX*RrKLIkxl(XJxp6EGsi@FXI(&sZ;LKlsJO2`ZF8$4$ z?GYJJs&2Q_l;h*!yg|O!A||zJ&kxdu1F`tL>n zxW51Rkzw1em=w3!2RudP_;D`4L|s*s*Ro5v*JgBp+LTjr@z0)}_^_+Btt{YD4I1|m zg~_;Ar(Rp}psn7*(}{Rj0411BP(c|>Ms%Hq20ipLvM*u19fZ0rxks8qg8zx&2Hh)v zTHmN5bTC@Nrlj_eggT(Hmm8S4`*d}gYep*yl-y=10eBI&Onu`r`t>9lc?nki>9c3I z@dUw0Iw5=II1LK|>Wx6=<_r<9tF67WwgFNbqNGcJKi_DG=siz2@D!ch`aiF{!CjUyzo#f&d3KP0dnxSP8+g$B6!E zn?J+g;o&jz_pi#8D?4-Z@_@LZ4lg!#`>-P+V6j4cgQ)(~e4@vIZN&c7N2f=dFhkwj zv15l9f)Nd&l6eD7Y1rn1k#ngq^pI9}7)$9BIb{7dx*uq!~U-?bmh~G6QbC_R2qU$lx7Qaw&1g#dsu%tcz?o4~AeCEy6C~;;RPncaVu=F5 z=OLVK7!uS66G5@-G06)Dl)rO_JxalalZds@paDLhpn5?=cnUKo{q<}8#EPfvI%T9y z?F9T`WMw_9tW04QQVay#G#lwC;@$5`nk}*o9y)1ALvMhXqY44E<}gBYJy`xt^Sz?Px2rneF6EacOnRB zo0-bwB;ZBD48x)3-&JwiL8&Jw(peJ+2r>+O+ z42B_Uh9^c4BzooaQMq;VttqG8>;U?V+ULYdVdvrTX-qj)P@iFMZ~r$u2Y{HM5rkdV zV4HXR`o(}{ij0h$@71KnE1*?!8$y4F3^F=aqtp#QhIrrvh~qnpii^8aD%#&VtX#H| zl?px!eZ?C^EctuYQP?f0<#!;u2l2~!j7<46iLkS?dy!2nAt5n5;j(7!+HQ1TLIDsB zu>bXu51c+0t$^fxpxj42e%$V|;STK{F`4Q8gM!K+(x$tNoj-g2Jkc?Dy z$Q(N~Qr^)jVacP`iR6Z$7!|j-3)Ms`RS*{nebZ;VoR5zWM>xMC1W5Bu7~9bacqz4_-1$o9e@4=!3xs*P}YavC2=c~eZX%&g~ARe`~X0~ zk-VgsovYc{Dz+EQ-$YR++nHb-e0pxiVF|O%G!+#NjGsn@VV&brk5`Vqx{C< zeuxANe3uZcP946H5R}MS`Qbw$`6!?yF?6rg)KqfZTqg%-&N%J5?}OcHj>sNCd}zP7 z0eA}Q>$y-C>=WFd86v9ZG51G~AT7v=w?TO4IX1l*cMd~SFn)J+)k@a&pfM{6&4nPE z^Y(2Ff(&H4L1lnl(#w61xDdgLFR0Sb@L8*Xi?8sF4X{9+KqG^K=_4% zd;sD!z`_Ex&$We!nE310FI`pfSUDI8chzw4K(^`7+d-b5!qy{tEKb4genkk^mf0f`Wn$!4d;N#@SjH|NJ>H?K0cBuW?APaB*>=4z48b36>Vl zorEW_UD{2LbziwqT>*i*kP}b_J;-|fx-QvZJM+5Tj0j03j!P9$s}NyKT+f5zR~vJ1 zWMblwni?a4tu;zZ>z_P%B3W>S80k=`xYw?Y1DGdaHT)!kEc*9vYJlIYAiEgH#~uk# z^q&~i9nu!wzkgr+LrXLM1I}{Qful!RJr*VmU0Eekp1;B(;?g ztO&vXM}mzK%D+5w#7KLXPld_hn;u+Ckr)AFtPL&a&is zVUQLqar~KSvG=NfS<5nOF|MMr0r4FHD~Lp6||2u*?4>H_-rc zCx*;KU7@_y?UUTLtsFqT79m(<1Ca#aEh;La1qPPFW)`1&C=pxr0{CzmLWezqmRQD4 zc)R6g0c(j7u-mGEaqQQpgVxqBQHHn~@PVhed3eYoA^NuBHZvc+gM$O9VBqP#$;rtL zqcm<6U|MPS*{kyaQ8}&?k_>EufoK+Suu3ns=kJGW3UYBZ$%0eg3d@&9b`@{{JhC+e z%%DMrK-`$I0y~Sw&zk-Il7P&xGTDvU)_#yLc`!@XHrn1Ozk=fJ3;3S%GI#0r_LJuTG3SE8hFEy6SL34&bJDn3pmV!3L#;gfj6- z3BiY{3D6RKA|lozElfHRzJ~asu*XWErjuQQj6^tM?z$3?XH^mTA^B61Gs1~4Ln4I< zdPhoehA2&z5oKwtMNZdfi%mQy8bED4x6cA0Y?4TV>x!$}>PU^#abP)y#moKPcU(zK4>Sp)CAJHx=_pB~f8MmmqP&r23ThjVkBS~$ zDpRxc_Vp#cGYL)4P7Q}NHydg`+`a0bBDju2JrUcI)N61r67R%CkRw2Jpou9U@ zJ0mN!*mZG!Z~oHa_1%{mnIV=H18@={&G6(&b@Cz7GBPqVlBa;L;mk_gbtvN>h#+wL z_U&6B2T4>TiFlIdL1ivMZfxX}TssNw_q7)kko;279(j3^izAN~C`S5R6*t5m3pl0D zv*Ss)4-G&MpDScj54RB-O+@vs?rv$A`Dfn1;V4Do7bH>@T7u%j_;Es1iHt%jB#^m= zKnNqk5E3+$41&kWAOXZAG6p~bu@Lh~7HNa|*|XlLL?VEAz>;Ms>m+LO@sS*x=hDKP zhEcV$j4YjmwaC6?+q8DQAI>j96pEdXZ`Gzvn;@cxawa31`>Q581YsGXSz|lif-Ljv zm2r1T_4tOijU0TW2jDjmU4@+9yX z&eJ0?)zE1nfky*1${uk?3I>!Y=m(O*H%YAvALTby;$tP>RMx z^7Jm_fLtL{04SoQJD>q|qF`Z4LLw}Ki<7hJY}6~k0NTBSz;dHNe4?mN0Nkj?q&SX1 zy-*Vfy2pNmU)_r2i4j!#9IX_B2SDOlC@tH=GQz^bh*78^w}wL^8oP`nzrnvr*CIy< z4+i$q;r@#xDX7MY(_KtrR~KuANk@jhPl$b$^*q*WeDE6=EUs{?Euy-Y5lm>#yDmp? zH2#s{sZ$ofm$~)#svybe=iunY0hNNxlpuBvGB(nddb}ZNEQ?q z8VVMQc;|<9&xKh>Vgw>n;rr%|9L}XLDj`~J=l8b`kusOopjX&o>*E{aunN<&18GMD z2F|H4lHTjk`x!K71?p(W&!5ZTy5itoF+R@_xSOi zF;b%t+?+;jBF7DpB%tj|6Weu4$XLNT^2Vi*EsBvC!1K|R=$_U|j=E$LjhXp-jy&vw zrNw;@cU#^>nZ`uWF+9%?%XL;%e)_~y|6F@5f_aEU(m-L|M9-zFNQJ<0K0%4b)hZ8&nDhG-i} zc_A#Lv^1Yd5r!Q+S{^MTCUy{r?I47~stO?m=X8Y5pCPN@HgI9)nfp09FGRDhKL}FQ zdjLM*hh_E0=P)9cY!7EKNi6gx4mlGCx)U(LR-nmkIDxw7yZezjp@9FIU}60Laz=kv za*0rXCm`~F&b+589FqqA{{Gas!$IDf8^eZe5y7Dd1H7H+%6Su>?I~n(?3i%-ui@eC z6h>|Bnx@YLWzi`UMZ44)-JFwB3eC!gT?H6J9r^hW6`tdLp%h^>+?n#|PP86+<)kzc zIGMoKiAVMDGPd{ONp%bgWZZeVksZH@o56D;uy6SE3kU2&$;QKJ#Pw z)Wn3(yLa*gd?0m$s+vElH$aH|m7i)*mCRAvv23^4Rq{LGTNnT0=i{(@BY~e z?9S2=eLOJjQ8#uvWpSoIDgsPp6~zvS0;3;cT##N70cEEAJ-&5&yUnSVX;i0+_0L#J zl{^!}omqHyPzoO@RWHr%<*G|27D-{DGWfgL&Yhf4JwZph#Z>x!s2lRCS0=>A6Lf@p zut@&g&^|y+!);@TnfMcv$sibN!8Y&B?v8_aT*WwNP~dbKMZ6Od5}ao|8GsK~Cj{v~ z{1Uu<^JaDm6=2t7P7s-TI%Pn#%+g7eKsse8eAN}RL+^*FC{krOr6jjW(kO?{oN43V zh5BuP^YlSGIe)Nc$@t9F$$Xo3UwVTUwK4>oHSx?;k(^{gE{%hSXM>}-F2&d~?h3hm zsBJ`pL4wo7b3q1yhibPcu$ha>%NYQ&RneX?6oXaU)V}?U(V=Bt7|npTVUT}wVtB#! zuSwh7D`Gl0cW3s#yY`2P@|P!TE$BEMCC_z&exxRd5!ke-r#b?&E24wn-*TZNZ$;we zZ#nZ;qbz06GkBdxthKeY!fmhDUzo|Rc|cp_hulC0NpKtyF0X)m?G12DW(svxd7Q+OWj4FLSJ@NKzjJcU%Zf|jM&Q`>Gvtuw6G;EmF zAXppWjxmZr(v^UXPtrj++j|{;(eRK0(B^4~xYDr7_^Q+9D^jvXGcz-NFhqpRCzpxa zs1LBa7lz|r!`XP`JU=~pN~v1zkJRc84gREbNKY9Uo{52S2ivI(_XBe{9PUr}18{jW zTifkuwPmQSl4p<3w_8^KzXC%jD*ymopo->ye^&mTnwy(jjoeUOqK+7;6d9&P^kk1> z^h@k~&6BMVoK{ez5j3<%JD7nxs{e3pf(?Lo7qrVRut{@B=rD-%&tA9?01G?!S}>SY zXLq+4B;Znz3<IS0s^?uNL4^(NxT@wj6Wc( z)9jY^th6nlt_u$8>IEJPKRu22doCLHtLasK@OG|oP^51ER^X{bP!$>R#4N-Cg#Y7% z#r=@q1gsy*(@x0uW2c8FbAz4!_%qE=+v~uJP)|F5|Mr8$xik8WD0YT*dp-efVe(9& zKV@y(0>QD71z;e?5LS*n+2v`Lacp;ygdz01(2I_D_eFN7;qkA0QgS~XaR zy2pYm(Z>aj=x+DOxL>io8Ay+ga^j`o4PZkIA!R{nH^Z9zEAln!)Grv2EdgT7u>Q7_ zU?`#u0vT;^+;W%q2!CD#bQKbTMg-|F0t*lX@MMzU_H8-+jvK&g1%&`XoSk#>6#xz- zNsmlEnNhWA$vS|^6C!9udoJ?fFD2?{XlgL!tRiJ?)*&QDLO~&lvy6D;q4I0gX-!#m zp1OK^-r&-N7(?ML25{2%a12shk64*&Chh>kF3SLuihH9ygTc3mC!$*s%TyjN>v{oT zfEaj)wvcfn5^vaIO{MZE<0udb1+a*i8^pwhG7~1hMjw>ObrbxogAgG?qoM-S(|5qi zFzQ#MQY9}S3ZG-wNl#KJb*e(0u&Z=cW0}BIZN3Eus?U2K!6=x=zdET^)q zZ-9zF(|mA~2+P<;7=?S$P?xwKfIJDD@D?=J4(xd1k$|0$5C?T>=jHEvkcT3%)xNg8 zeQ*nq@Dg_1BDo2n(ljz+VQpg*1M>~^Ei)a-D|5J$RHTGZGRceuh9NN}Qnd;PexzV& zfsM@aIyjJ#jp$d})OZSpqY!QhHhOJU1nCd`3J>54`YOc>`ivPi3b8vpraM=X@iWK< z1RTdYoxOOG2IGfF0jJ+xC4(mk!PIjY)+NDyfGsi{0kJbu(fwTm#=iUZW4oGRL8b>Y zYcNrI1F;tkTot=5^_V@J7BDC!Xb2>r@ShY6l{!v`CgCwZs!DznmqBI|5Xu9%Kj)R8 z<%8YIf}AsQY!$Fv{^|PSqN0*wWIh#+-wqh}1RLTPaX)OOU!L8>+)RIRS~@a4WHaM% z-F~>P<{lS^#3N#y0CJ6tk5e%{^v^}03gJu25WyxIIO=pcL;-);GGxk>R#gXc08N2~ z2-x_=e`;T7-~NoOq&u)c2@1xolJnL%IJgBfG@>skAmWGZ?WN(zE`!{u=z09WXjG&> z30a`H+=-43!3Dj-@+CzAixtDwBpD=l4VW5&datz#(XzbLOFIkyn+336!cHfSHt;lL z7-opuJof^T<_iNTkHY{fl)aiIi{a1RR#i(%UImvQ*-3EfNdD1~JXx(vlPKmb(Y(E` zTDZjE{()T|?nsw2mup(=6t6Zsza`u~N$l*oyFf8g(zky#Q9l?j8n zK(+cMyaC-r9n%j1;99Z3)R47Hq3-4cQ`dR<%St%?{i%*$HplVTXLX9WfB(NF4*)XV zqJkA;eODsyp*4z=`bAGqPckyvN(iqWjNrL26nwM} zQsw|}X;e|SnVyKP{~p-xu2E-F@NqIYI5~?Q*Xy#Z`+LwIp<_0@SD{NpkwV}b{S6Ar z!);h~M03D4cZeiUI}7&KO_-O9Qw2*RK+HRLUbR-eJ7UN$$n+KiGa%zo1`Y#Xfq)#t zSU4~)(fRS#3Q$Wz#X@)&CV!V#wfFS&6!ngk{jptagQPq%BS3@7QydK!(A?0@d#;H!r;+&iLarRzlfF0I!)AMVs*k4w7~sgG~lN^=S+y6 zkR`!Cc=*0Ri9qum=xNYyM4-5cup^O#hg{p(cpC|ohK2@`#Y;>|I)H}-g_7%yBQ#qW z?-xg>NM%ETAQMj{d|OpTULSHM*ZBtiW(Odl+R>vhu5M4ukfsH_hKzioK0-MT@En4z z8BnlNrERT%r5N?qy@&|nfTCVJ%dg|4O8U!U&%@FMjg4gM&BOGgA}w5}W?8(5tv#5$E2lIjPC6~;`AH+B=T zp0SZTFCgB`J8GMa$Y3%->W!VA*E zh==RQDtTnl1Q{@LRWuqS`8oxK_1Gk+qPM1h6{2iG#`8u7UWv?{I+OpId}G~@SZ(}^Tbu0c2h)K z>%hDrh9$FS#3JH*bm|V%&T3$Q2ObZ!TOvBAc4xV4J(1-{6(tkvAe7LQR1wJlpx@#0 z_beG~!KAHTynP3F8kqz{$tMs2N5d4^W70h^G4nJouEdf0h2a>!;O9C_OTk`Ghq9O& zm*w*5Ox6ZWf}s8pTbo4kFbjxnM>H=$;!B?og)vBO-FgT@`274l$sXY3k%7$rzEoqw zh7GA=cTf2H%c_Vs5exuZg|Nomf}1NICS1He(a%GQEb%1)Lr5GM=benEB7!6{(WSPF z-H*!1%v=f|7i#rNEIXubGjJdntUdCAmgf>LiczoN(J5mb8POeHP=F@;maL6iA4DT@ zg3&5vL^%=l#iXzZnb*dyA!A^A>FUU@@nK|R4GACPWf(|=j3979QaVVClw$u_~k_9bAQXpn;_;T2%3UuE)S`=n zO&Cd7tT|LEl9vQk%m9nUQFIUpWmi$#wQk?FEubt_j)AhndH&hxIV7`;>md;(54_%l zgf)qz4Kebeq*$mhF3x^C5#T3Tqn*qp_-G{W|?D z>GE{=l_;kqjzlmT!Z75m4ewM>^2a14`N2LXaRxF%jWKNoNLV<6b^<}TJT89RHVPv< zX*Ty{Q;H6qLdc$=0Q_>iaVsSh>L53#dHemJ$; z3nYA%*u1$zo<7tLgbFs$^MKEL^e)t8Bi}<_{y|3CkqkN|%0&?dqQt7L45?U#&PMzJ zcJ|t{V+9VqtQfj4>>kCamoH>rQ@|<&;0mFxYY6nWABTizH$QDpqH%DZvGLJNLa$%| zpgG%yABcb+@qpCs!Ve#aC)+K5IFGo0cv8bzKzn3fisTOb{h3x)8l_<`!BkJtv3P_6 zK}ai^S$X|h22oo~{kC@492I6Ksdr0DOP0^a1jrks^z^d&rPMZf6r6wE{N8E%@ngqK z(dttESbowtb?OnFDH^Ai;_%(OoD5!ku+v)+m5oHoAuK%n90p4+|2>y2BN|GBibP9F zOiag-a1iiS+e{gRY3Qh^EzG`y@)5(mD|EkJhOKE0xzo5Ju^xWz1JF7y#^qm+rX?mK zq-^yvIBnS%Wxx(*%05UlIa`s4J(KnW&tRY~ZY7r=brAB^$F{a7KHlEDtsY_M(j4BZ z1$HBg>uE=Xnt3T}I5)_7pf?9O~-DF_w;haNu3Mlv5 z_by`_EdnzT%t*)SX&7(>zO?*eqp)}H1H2y~9R+3Tp*GITvO>Ho;n8M3%fxlsA*n{M znSkEQ@e-qlQ^%s0>lzrW9GT5F{<%;I5Q7SWR(zG8Tg8ZWY;!58g%>`r2TSxD*kf}S z)4_Ou06{qz7l~Z zfXG`M0G3L}U_abWN!bdT*f})BiaLeiqQ<>JtI13cOhKZ}eBQ}kX@ECi;H52O00vn% z-koO|WiNkcj5%i5eW^cFs4-iq;dOML)@E+JgNlm;KC#CJUI#vW1|YxvRG%>Zy=G~{fuwN1f#JExx^GJgYz(=IE-(?5x(x0;ppyn7e;LL)A)oEk3rk zqBLRSCI9_ibzBu2YNCbhQj3tcirM42la846XxppR+PqL#SlIFSc$jUrj4a8DJ^;tU zEBV;pfbwP_L6Lz)@^6JH_5e80*~KxX9{G1ycUHNLPN%DnYH6j6?%K6!)AJS=NV%_2 zNCLE3?&CLs@H3H*GM-<5L%9%`EmBR~>ebXz_M0~mEqYVm`?KF7SLvJ~L z;>3Bpm0%0>qsBjya&l97R?97$(~`HgK>BGLU~9eiV&Ia_k1E8Q%oGIEipEw7dyF_M z;DDDa&io9M7lI^orU>vP zJ1!#Jk#_gbrwSlGK8rvJDXCqQkJZ%y;9>Xg+$lt;Z6K#J^1N@2&4Cbs zG!Gt((`d!xrVWTt>Cr5Sd1ASmNojnH6jHvpELiyulW2q^$g#OF-)v5cunA| zirP=IoKCY{%w)^&8M$PVfP7X3DeVyu{PxHf!BRh;L%5g+p-3()u znuz}zCjxE(&$o&kK1q zuI_(-`c3bh_?FuC{P3Oeh1ti7HqaD6`@2|u<6T8V87X8gLGlj*DJv+Wlv0dikjxyy zj3hO00U3jYnvoNkGwR*W%|r&vuoPC$>BtZnLday?5b&(HrNu~L&2gLhoCbKQN9P(j zD)n`A=qN1j7EZcPl{}pEogKU|@zr?F!eZB7=UgX-11W=yOV@<5<-R&SmQ@{kW;EIQ z59z6@ih+;C()w-tQw{4Z|0x zJwJc8JvhvxT8J)g>yA{#`Z zpt!#H0szWNAt7L|rhR&l5+K)i!0teQH^&+SEhIWFBKrzk;C4iWLHH!PrF|=SHXAUm zG2Zw5GqxFRCxjl5^^n%2Y9LUzx(^?Da0{8*Z%SI=W?9CWOuFq^Gqi4=ei#W zHPGKso_Da=^&&aBV2tfP7EPU8QLkTL^>J} zp1e6Qgq@?K%_MW-oO^FW{FTDr=wal|Oqec8oOB8Iaqa123_@I+b?@G{Rsq@X7Tbn1 z&zR)9t)lSmyJj6WlsO?{Ntz6kjkR@YZ^YXZF1*?C@zn1pzAeSR%G_z8>1NgQDf^us zYicVpSVqwXZ*%2VKF7VBNBPt|awJ*fc~M&atUoF_jqP>X>G$_1{8c(+{0ch2_5v}9=5812VWLS8OALATK3x-r6M#yK8rWAsB)HmRk zcBzBz1-@ARa!~TpwG|EVxw%nvrU?J)woWmAK$z} zew>Bh>a>Rqu@#;rC4EaAemR@kRCS!D5_4=m3fu3MqWf$*n1-v3K~M@uyjekN_Qh6& zohJY(-s|oY zqX2At6j;)QFuKYN6289vFJw&l>kzZE0`F0MVeHsgyC5wg;fIfv#(x?yq<;+w8(F-( zMHUw9HOT2FjEq`30t2P5K{jDfR>--OfKW_297}1)M9*Sli!nk`iC4mX1{f}cvsk{I z{=nmbto-Pbpvu#&uLfo{Q?;PjJ=%5QXm~d2rT+Db=x44=wk?niy2ob7Gm<%<>$#-Z ziZtl5LS#w4VM?hS8{FWJtP|d(g6@4H!7~d?by*?VD8aDa&b2|aAh-?MOyebY{R?_U^IED&2x3CsGJ;8_L|?= z3Spo=?jc)!sF8H}2%5E*^ljo_w`yo;5TOW0PjX}ahLlf`iG;<(Zee=D4$O#GFvJ%^ zM`2~9-@xV+1`B2syIXka24>l-9M>1aKYVthrnejNU(k~ZA_BUOUxfRW^80398K^7X z&+z=wm!_vJMULRR{se+!yXbzioc~mG>5?mCMA_@XL{CK{(Z8%%-8~9iw2~-h&|5w| zIiPEdcO+uiiS(Q%9Y#woFn-L7kq`-79(w^_I}}`21m%Yvr5_&KOhpUP|p||MH6&i5M7?%?PA5>8Py+o+a^n@@}Af`S%$BvQNPo z^XcCvA=GaHF+fdAYX#-ynY?$Em$kk<)N6hIM~l2)fy6m5tx5!=sU^>b1z9usGmUgZh%L4lQb||8y3eGP(#E&mbZW>=hz2V?8w1N@Up+ zF&J-Iz%~0~Yz`@0i!y(nJE4}fzlf_;3^G@OVJ3(V-SSKamIY*MkgUA1@p|%>NbwHxpxFgna z3xYH8&!OWINebZsRn<15w?L*uGDD*vG8Rx38RSMbVe{tAb^;+pDVu?RF75D36DnkC z9DA;6-HA%PE*lDI&b2@PtFAK*$T1E3{+%q9t+FMOWSa(wLNv+UqL3vCVMvyWh9n{> zl`JhP6N-qkq{WtHj3t$KI017D! zA)lgMQBTy%euF##Ff42|#NS7q@p)~2>eG4u|z-$Z2-Z7RL4 zG22k7&&43uRF8CqebH))PWxbgq0&|6*_g4dD+g}27q34As-AkhL|K+tvNb* z`^KgG4|dOPH}yhS?}lyooM^TqS?sj4dEA$)ejVS2x9wf_U=xB2oP(kPr8!`|hHT&7 zNiwextHEp!EHCsdPkj4!k)-CKCqq&|beS#FIo;M(g&I`REVlVVo?z2G;Yz+et1=NXH7Nq z3lb;|gxnd9kyoXsvGJPl@WzNN+}zz&xh$jg>ui#DMQL7INSKrW@LbfvLx(B{w^$aD z-`aZto0t{Jee}|rT3W04U9e|Xoi&r8W}lTF(8rZ8Xcx-!T{z?rqdgtGBw{}sAFehK z5ea#e~5NW-Y-3M&T(bvjulj1VY1RF3C|&O=Z%ZSL|| z`!M)|N;G*W$xNU?!@$~VUb76y(hZg#AGmJj%#fCrpA-mgkQ{a+lC@6! z`-TdS(kwk*5u&sj(R)kGIre%+8Nlk~AzGSgcEiimDsN+XlxKnT*A2jc8)xRx#&(J~ zNWPeB5eoI1bWni|csLTL{MAK5(PE%Gwc@ij-M!zn1IR2UXka+%#=e)Fo!y#$d-MU~ z4l{TdeVoN4#NxW(`{`#7~D%l(oCPU1}{YRywd0wgHju7 z2Q1G{<3C!^-GB+&G5Avpn@*m5*K5ZW9cx~D^nwK8Me-SJ-E{B@SVILlk7}!|I$s z-NYusKT(Z3y!mqWJJ&DP%idd}DPENYwB@oz(^Lo?%FXigs6E~V0=Hn`!xhpx5Wlxb zZw)^itHz8COKC3SDuQ`X^jp^HmNyG@gi3&~3q{!S-;e6hLgn%^5>Do`v{RS6u6{*N zFvp6E2HtwHpJ+zj?f|Y7xfSd(A@&vMH1@g#EH~}ZqY2%^B;X(h9awhJCWL|byTN4h zbIC`>I_)Xx9X=6elCfIHTA`<$R=Sel>OK4Z3S`rbg=xuSWaD5+d>|Z|s>)?v_MZ*_ARpo~o z=A1*ELLn7Dq#)32?*U$Bw&h68(Mzmj=7cEV*HzwQSCn{2`6555WzPngPpXT=dWI^j zzJcR8CgXz8qewE!A`*Wh46aA!}{p0GgVD9E{oP58qKxG z{A)6T!di&pt<8@wFN~+2Sg1lG4li_}&HjjEU{nHauu)bH*5LQ$s)OQ-%ox%BK+=o~ zd3KShC&!f26eMS4L=xufQ-2dZeFR53wXDAo!iYab6xBbiPnopI&@!yv?e*W=KBA0S z3Grw%5JH$T8vblWTJJJ;agkB-qrN|X-#94ve1y3R0pCuR59`q7sBJmuG3N$^{iJxf zhn^-2+RhiUnpdxBTv<~|>J=QGw&3TZ^;{BZB34zFSqN{pp4+_8)MFlh2Yl=^?e-{c zgQKR#YUzfgffoljO$0Z#V@z4Gczn+zZUx`tp_-;2KHP8A)&b4sHn1qhG@8<(d%W!w zP$Q`kJXo{pS{}T3YL`9?EX}`Uk7A}&i;pPj*{fGrXsD`~@pN=VcAsUa)xu$R5wma$ z1(u=tZ|2d$NZ6RzLNSax>SdmzP7)1ik>!4CB>gC3P0i>4s-XnB@f)Z`3u7{B0i?y| z0y*-$@mZIy+LfrdLO}?{rp?AqzHZ|MzF>ds62zR&Ti94>UjT9Z8MxG>dNIeiNY~1q7&tePEf|nAoN}$! zutAHPM}J?mXc0#1v_%cyQ9Emwzk<3EKRdRARzNnPXi(_wbx#!n$<-TFC9;BLAAY8h z(%z5??FQ6KvmuAH@ZHhGbq#j@eXWG$;nJjDr;R(XIX>R|kxf)Pp|isVpU=;q!H9VR ztwYocTyZU!dMSeQD;H;W*l}HI77eGOqW0KOw71K>2TCkIbrb?f-dl>9s>i(nQY$3l zP#k;YV--CM+@R@noFyiSY{Gc~sjMa@i$!FwmS%C2fxvF*Fb@Oj4y2mUfX_lh4Vm(B z=mQ)X_r)Lz3Q+RGZ-f5OKW=uUk`cR9fO~W6;xl0}bsw41b6}3xW%5BXpZjihHi)@{4&}~+1*QB>H^2tQg*+T>GiJ|TEy6-fF5kA%T1s#q z_nF5G&1Z{#;y0zg9$)pA!HoDm6}*9w9nBB_er2C$8H)+!lv<|^ zJ+8f_H+A-$H_A>S(OQ^8$yIApPb$P!+ z$tn}MAUV)91RpO0psZFJ{9lCRgM^8^fBdE*_#<)7l4B!QH`;KFze0{x)IN`79CoJ- zaQyP){=IuSPv3#`uf}&HlE%v1)n;ctio=tCLuc~nDO-&uzvcCOUs`tLF-SS`7-wR( zZY4&dC0n7Ks`C130Ngwo6BLJ*UeoHrV#2l58csSqOI?(8m7-Z=t8Q#=o@UYBF0obp z83T}7N6I{5)~@E}h7=|Z*$gEQX@CG1hI`4&EuWStwty?ZCbND1e^zb#=FJzre0X&Q z2gqHzC@7fc&z?C?{+E&DF0Wt0*q*Zh`g`#ZExdW#GFVtbjGLX=z${^8?lr}3S~0!l zo${b-1Iu-{;>u4OHF|V3ddjus^l0F8d3Rv?&U<5p7)2L;>eR{Go)Ff=B+g;w%~ot7 z7xBu)i!*5bBQI2$G;JDT_cUwXU4Fb*zkYFk|K3YbnZXb{i~s);linPJO(oZgi6K0? z;Nf;E&brcJbVYZOq4!xCZPj@O!3d+eYMb5t8dP3hKGJ)Cz#o3)Q$ePMI%N2F=dWA^ zRJwmQ=xo`tg8Y2AdHTxQ%VVc2?jXoXT)aKZJ_5kv2uflTP``RbPRB0iQV)9|)7F0h zt#`C|!2CNoih~%AeWuW)f5ikjiMIB{t3u-}ZccwiuOUPJzI=+j{Q^Z_6o@uHp_VD5F1o7cZWL z!cViVIiT_#s!ihi?`K~HMjWd?W?rE4H#!j!RS-?-hC=Uv&vq(9GX<`d^oikLcI}GF zo*?`d(Ein&oM5iv-k~IQL;ME_zrI2e}7dg1uaCrH@*I(Q~o9>=hBlNGGnV$ zBwZ^(m8W<33j4co1Va&Vl6p6(NpZn0-{l55ph|97`$@0NRz zebRJ*J3|mH;q=|FxaX4ndD`ezzkYRR&7o#oj<;ZRI;S&l@xS4HzP|c6Q4ckt>@Z*r zktP`Gls#M1_%%Sa)JTC#+kS<94w$H8=E=t@ITTEhAK<2HLf6E!ayY1P>;1-R22n>~ zP1$p_`QuN#Q4Ahek%m|D>|Y?pP&k*@?L&R2h}pJn>g&&}FU9K?yCwHtVMT_CLP6{k zLZAzfH?(f*@a7V;!7dEM@o4thv|}q5m!x^N_j61i`IBwZSbI78O-Y-=c=(j9hD*oy z{_2fRs2h8l$o-MeyFoaSY-1!L1d!y&>~}KH6ejNc3(c;@icgxfhXp7&(x*MNDzw!% zNd3WkCP5JhA}S?(iJr6`Sg}nFc5dq}@ePrYqmH`UO?Xh|MRvr5^--uIF{T|Z`y7Q( zUI8Mz+vrt%=qEN{EyWw!wmcvmIyo^Vp(#2@77vh)1U$g~P56CBY;4WwDbu`M*#?YG zPri7{e2!~9TNGg&wl6g$MYZC7ZS5XmSWUavf4`009YYw^ks`>1PfH=Deu;*TbIdg+npeEXub|bg-5TU|&Raa)+ERdd**@8V54hxO}{<);cFlO0r%ZHDxf&$Mw)C&N-9L; zkbs^y{@SbQfwgUp96UIK#x~NVfV`w@q_LbYrn%_7Ju5Bk5@EP^Xb6PLkmblqX|;6f zfotVIH$jjW9mNMO>j<+r(^2n#|KSL-OAy!{;)~dDYWz|WkclaDu_cFd~tzMAi6y@CJO9uF~y7TkGZIWs&w zd_Jm_*YP{|AOyfBWWroqbKb=47h~hOiY?o>{~rGVT>v}Q5kS|7%}=YVFLV8nNOy+3 z%S6l#bmqGG;n-wL@6_hf#tTt^mUY6HX|0^5J59-^fE+Klc7u>C`JBk>Pmh4s$nT<- zZ8w4c0C*^;kygzCBiKUM8u0mTw=0(~&*V@VvCX(6;F&pcQ!h8}YW#^C?l0?xEP?BZ z&zyWD{BC*q5j+^|ia_Rb0ruV5K1Mk>ti#wDF?-IO+gr~5t*^M?TKk=8J4roPW-id6|cGmx`M}fmF>Arh#rvH~#Nq zvnOT+fYR2)$JD-3Y)eSEgy?F3x z^$39Qlb0{A(r-+`DEq6i@l(WlP8J1;X%~F^L#U~-W(4m5m0P5@w`69d8{)!)+1dFh zT^Uvf0kWC`&&o+-4o_h@B$JqV#_ahD^~y3R9D#4eL4%>0xK5@Dr%_&GQpdpQvTX@a zHQcj=5C31OkJ>YzR>vG01>{Uyhe|>`yX?99W*EM9gwLfRtt6f>9~$gL^v!C@n0yMG zjd) zXa|JQgJ2a^`OAC-Cb8^;=n;j*U@jq5igVN1FbH&LY8S?;kecKfdcb=n}YKidZRG!Q73 zuYfq;1Q-QRcYhJhL4|SjK_yf4?vN(}e%dWXQG#tOC@k)KMQL_Lh)`IrF;@erpC^i@Qf0R7DP$@^Cf*7bbs zYFjjiED1(VckV2>t9u+CK zK%6$1KvXT76=aI4bWnXwO+~^xt^Ekssp(~9LK|Q+mM=r5+Ee)m&0i*t8@Gzjh1XJ( zDU?A$He^bak6u*vFpv|ZMq&U`C@5LGb4BZ$G7SocCnC}f$%UgyMrF9_#iZ2c04N<4 z`}XgDgc)2@t)Y(Pia`)WOjuAL>wzWZvw1`1!niy1U%~80zI>8TW|oJl0{DkpKa4kv zyIn8F)#e)2H)B3x;>p7Y!-Wr*T=1m9wo4lrXr}-uDa1em-6n_l$pAtQL1`=x)jks@#stw6~u$;0LFff*3eGI!Lwq=d3*Kyk*WuH+OW z_^>=eNjdC775U-n? zsZ)6dkY++sppBOkd$>J1XhKVi)I1Lkn4GN=%r+t~+*G_8JhU|&tRxDYFL9ky6Ho+O zL1^^pGy2=b!a}lW4uARx+$|Ozw%>mS_lb34=?dKk3e=pXD<8lcC9jiwK=yzs+&uOe zkbhCEL!J!#=~uC1HkY4>7yI!W|5L6zNL5|KHgt4smz%EgKtF$Wo5+k4A; z`y*^y9WDGdc>>bqq4MCcg5FaJL+34?dciRD(%7O8jp;|kh6cJXG$E~E)1OB9Eq|=B zwQsd($&&DljQK~4Den?tPKw^&tH*13jt7Dg7Yh8H1g(o-g{QWSL?X6oYz+pE(MZ^) zu8DEx)sab4whCGofhIq_y<+^l?+}C6zmSKAZjQnA^(cmg^Zagc^tXu9@}vi@KjV>@ zBG#)M^@egrMPS$zt(zJ9Jkp!2vI;(1_oIV=$Ltfh>Z2tY1Q2Ags+&^RljI9bF{{S* z%(&SHyCHD`lFybh%SPLzU?IUDRLl;NMF{snkuxE>ikPX@FZ{!@)dv6O+LG!aV58hH zC{tPCVi%>g1eM@Cs4IRp%G7JL#x)=6B2k7RDeBc`z7266nsN**0(ETl8;Ij^X zwb)76&(A?8@_!WyF*@+YZa}O=Z`A7JyuHEwqx0GU`*%H~IiHQ<{q?>E$;By-GkG_K z^JSSyZY6@y6(n2{K9I+2$&o5YmwtJrsSJiM9(8H~i_{Hwjq|~y!%%^W#^HT!E%&1( zj|>pNkdP}%)83G%n7SLW$L7Q#%LYuYK!cjklPqH35#J9`WC2)35yFWqL+#wZxS5pN z3bYm#HU45$z)T=@t-*+qBYj}RtzLc+A@ z3^h>ZOTkuv?id&wZ=i}utwFSaavfiylM&M`X=kh8Y|vl1fi6j)Apn{U-~_z(+FQ_( z*0A70jWdo*lsX`T6i-QVB)Af7L7;=yx(hniUS3B0j#yB1HqshH;+6q*O3sW1Y2fJ! zc!tE9b~Zos6`1&XbZ)CiVzcqdG70NKCl)IvWngYQZ}sRyaTbnx>hMebPDeu_|C(>x@@Q7$xM2 zd?hL%vj^Pmd9v)p?gtx!bjnw6yb)hRTz$xZKGEXD(kwCk$oapYXnyKj1{0xD z82hfd@)c>8eR+NGuXZ>OiBYeF@kC=rYe3lQ5F|?bdoLLV=z1~B4!{^WCeF#Hf6H-5G$$E zrbxU1Dw(Ml<_(}rkR(h=yXMzO2(28HOi<)AuY!R4mQJ_r3eAb zGJ>{))QSs{4P3}bY$@U@BrLqNXpl@7vTzy7c&kIKItw2uCn~X( zr4?pj{=nkxE#U}qE^yF~&rPrd3Rw);N^6jO;J^lc^-RJv#J-ART#`4l3^&dZ0U5`p zkkTSvHV}B>YGH*7{Yqqv^Bpft8ohA^n|10#m|+Ehy6s*Lj_h|4M2{KctFPNbD#(Lh;Va`ZA| zNd?7?VPi;gYHGe;#$fTv(yNHo7BC5cMMHMk8oh~#U!*Y0eV3qyn>{HuoVwC#!&-f| zXHcg46DNWBi-1&XWLu>vF}*RT=`X!|OR$ujzPzHgWTMPw_t$>^jl1iH2bLiqoU_gH z{VoQ5dH;*JTiF9Dxd8vS|EL2kitf^9r`^N=?JoE6$vPSllM84>lI(DDV*#ueA}gu+ z<+cbF*l*#P!VwoD6Q40_RznUY!aNdPe7pq?CONBF0#hZ{wtmv`GNW%3slBLDC_a*S zK6f(0D=l&nk?P9vqY!nn;$a#35_p5=&W#sbd#GAJpinNScNZF14uztP%W%2@wA4T$ zNpp-da{K`A^0y$2_i*!h)Kq*5& z^$iq@|Gg)@xkSkg{c+&*ke2ID{-_%C!=|lP8x^xg|4e$*MXRB)(^%aF>f?%9$Di6W z|E;cB(z&<$w$15!VQike=EyY}7K`#zRD2KHv~JkIq~$F|QKMPooNXFzy8lqW`PYbB z{bo*H_0j#wkQXaIcX~ao$rH03ub=Ky_rtqp`nHGvvVA39;Vtw=(4DjU*`z#MTCyb& zl@@?%tbmM>?Z+P|r7x%bhyttAZq>?R)TmToU)C74=e>bpbz@88CMRipoDnbRz+3%;}RSPM9XnKE*jPo`^M)hCc$pd-USPNKyzeCgc_r?AiWn z>+6TnXMh~l-=@5j(WN)Mj>7N9^SL~2hY=&>R96pEU0(6_2*D^Wvni}mGYcmggjL#m zw2F#$Nq-Dh!^D_GV@NyUHc`PYiMd&qbSu$k&M?GdZ~^w5Y60v5Hg!& zDO+arx{}YJB$j~7T`9qvjOJMlPKu^@VjXsHbPU{CcO1S3-u9S6mf{vMEdY0S%C!#*wTn!T?3-t6o@38J9GsXY+X!jA^?i#t44M$3hwM2sK7 zrtvg6ti5*2cHwO)+ zUFKt?T8)!*zOZlNeBR7|9pMDP?<G1|bUs>e=8(;+COMAghF#ThhdbxRAsf;(or_Eyk&iE5Eai5f0lQBhGWTuv34 zMf6e3EOjSmzdS(Kb(z|-@3Wt2|Ng2Kna3Z@1m8ppH1wTCrb`43AJfAubU}4#;XzI= zE(KU~% zcQcA#&+?=bLpj?W3nAgwTX{Oqrkm+T{piR$9=P@eiUN9bhR)r$0|ElRKK*b=tm^D0 zV_psH-`_f=NSYs*V>&OJ%pI>e&yV?nL{Rq|w^NaY$cBVjZ*6q+?d#+A6h9vXS_^4A z01}i_GMWZgS9`VASY4#-@a>R>oZm&0Z<@d3FCM1Ihq>ekN)IH9oMG9r<%YVB)vGld zbj?;D*TXe)6Uqimhhx*6Vd8c_m^cGRdm(L{mxiig)`;EcBFF}8R$Txxv1y;XOCoF7$L9>etOAmK_uqY`h`C>W0E_Kg= zB-hM22<);wib9a40Si>`elXXZLroRz#dYOX#KXKfKGYavH?L;T)*7uf8sUN`O7sm` zLC>44KyS3WNY$pLb8>YZ0WL=0D95uz+2x`Ck)G491;N#qORfos-ioXGS76bH3*RCD;X;5GH&t5>hon>U|LrQYXkB->i%{1LlvR@9b^vL454`g9&i zt=rl0aK-F>ICu8!^T1@|(wybomK^=@tJz=uFbTPQS;MR{{T;c{MiSo|l$Q_dT6BLkEJH z{e=nZAHE@!ZapJ@|9MgE9U|bl#ULIYN^U zhaOas?sji#YQtdQutyaYRsaApNPrS@sO2_#d*AoZ#^DD`Ae|UEWfp}+7Bmi`xGh`O z@?rh^kFVQu_{51j6%SkG@biaoMQ=jrJnZ5>CzYm7G;Kti1#=6(yW3eWrw`}&wnv22 z@vP`4=*{JPBQQFfhdZFx)baNzbv`hQfymrE0NQpHFv4U zT}a{QsMSzc!5pO4c=8^HZ>NbX5e^$MLgcjdn!DD;aaVK?vA{slC`xnKYzzAAz01!? z>NV=g;)*Nl)eRDj|C5y6=|38>uavb|RA`x~(&Tg6Dy-&v^zeTJ(Q**JK#+7(;u zVG0C;>;62V$Zn>l2a&%D)5baB!%BnODAk@9cegRzJGQ5Q;WT(R$0Ql(+CfUd6L;y? z&#A#y&D@Gv=ll&46^!L1rHnz8%V}H0AKkmt&1{))Ye;`ieS8qWJY0U~G51A9u28~c zDtL~Jzw3a}art??S#~Kgor$S0sWnP#>ve0__FZDGTsueEX@f>l7zhlmMoVauWmQoF zy)rF3{}_@q`U2}L0e3B3g@l~kTr*a!XvVD0A)1b3K^}yDK}|(}Qc+dq{xVMYG{7om zkn8kXpC3gS`xAK*H7!naS3)dzH?cEwG;{L8MT>H;U*7EuN{-Gn!Hi0C*$_=C?Fo5(Zkw`7^!#!Z_Z%D^%TOWTF3fz?c0Je229B!1U<|Cbo{!w=f9% z)L*{Rawz0s03AFdcH_Wj`|q0SHm3mW!p=u`+{toU$4~TX zWC_y$=ZME6YwTUr40PkTctquE?X0#Nz+q}CO&jo`_ -for issue tracking and work planning. In JIRA, you can create, edit and comment -on issues. You can also assign issues to individuals, check on their status, -group them together for sprint development, and search for issues in various -ways. - -This section describes Axom software development cycles and basic issue work -flow. - -.. _releasecycle-label: - -======================================== -Sprint Cycles and Work Planning -======================================== - -The Axom project plans work regularly for sprint development cycles, which -are typically 2 or 3 months long. Although this is long for typical -sprint-based development, we find that it works well for our project where -multiple software components are under development concurrently since it -gives component developers flexibility to plan and coordinate work with other -components in a way that works best for them. - -.. note:: Our sprint development cycles often coincide with software releases, - but not always. We may do multiple releases in a sprint or a single - release may contain work from more than one sprint. Releases are - determined mostly by when it makes sense to push a set of features - out to our users. - -In JIRA, the project maintains two ``Sprints``, called ``Current Sprint`` -and ``Next Sprint``. The current sprint contains JIRA issues that are planned, -in progress, or closed in the current sprint work period. The next sprint -is used to stage issues for future development in the next sprint. The -``Scrum Board`` maintained by the project is called ``Axom Development``; it -contains the two sprints and the project backlog, which contains issues issues -that have been identified but have not been planned for work. - -At the end of the current sprint cycle and before starting the next, the team -meets to discuss any issues encountered in the current sprint. The goal is to -prevent issues that arise during development from being repeated. Then, issues -in the next sprint and the backlog are reviewed for working in the next sprint. -Any issues in the next sprint that will not be worked on during the next -sprint cycle are moved to the backlog. Any issues in the backlog that will be -worked in the next sprint are moved to the next sprint. Next, the team -decides which issues that were not completed in the current sprint should be -moved to the next sprint cycle. Hopefully, there are not many and typically -all unresolved issues will propagate to the next sprint. Any unresolved issues -that will not be worked on the next sprint are moved to the backlog. While -identifying issues for the next sprint, the team should attempt to make sure -that each issue is assigned to a developer to work on. - -Finally, the Current Sprint is 'Completed' by clicking ``Complete Sprint`` on -the upper right of the sprint. JIRA will ask what to do with unresolved issues -and, based on the discussion in the previous paragraph, we move them to the -next sprint. - -Before starting a new sprint cycle, the sprint boards are renamed by swapping -their names; ``Current Sprint`` becomes ``Next Sprint`` and ``Next Sprint`` -becomes ``Current Sprint`` (just like swapping pointers!). Then, -the new sprint is started with the ``Current Sprint`` board. -This involves setting the completion date for the sprint and configuring the -sprint board so that issues are sorted into horizontal "swimlanes" one for -each developer. There are three vertical columns on the sprint board that -intersect the swimlanes to indicate issues that: have not been started, are -in progress, are done. - -Note that as development occurs during a sprint, work will be reviewed and -merged from feature branches to the develop branch using pull requests. -Reviewing work in smaller increments is much easier than reviewing everything -at once. - -.. note:: Developers must close issues in JIRA when they are complete. - -Depending on the need to make changes available to users, we will -merge the develop branch into the master branch and tag a new release on -the master branch. This may happen at the end of a sprint or not. For a -description of how the master and develop branches interact, -see :ref:`gitflow-label`. - - -.. _issueworkflow-label: - -================ -Issue Workflow -================ - -We have customized our JIRA issue workflow to make it simple and easy to -understand. This section explains key elements of the workflow and how to -use it. - -Issue states -------------- - -For the Axom project, each issue has three possible states: - -* Open. - Every issue starts out in an open state. An open issue can - be assigned to someone or left unassigned. When an issue is assigned, this - means that the assignee owns the issue and is responsible for working - on it. An open issue that is left unassigned means that it has not been - been discussed or reviewed, or we have not decided how to act on it. - In general, an open issue is not being worked on. -* In Progress. - An issue in progress is one that is actively being worked on. -* Closed. - When an issue is closed, work on it has been completed, or - a decision has been made that it will not be addressed. - -An 'open' issue can transition to either 'in progress' or 'closed'. An 'in -progress' issue can transition to either 'open' (work on it has stopped, -but it is not finished) or 'closed'. Finally, a 'closed' issue -can be re-opened, which changes its state to 'open'. The complete issue workflow -is shown in the figure below. - -.. figure:: jira-issue.png - - This figure shows allowed state transitions in our JIRA issue workflow. - - -Creating a new issue ---------------------- - -To create a new issue, click the 'Create' button at the top of the Axom -JIRA project page and enter information in the issue fields. Filling in the -fields properly helps team members search through project issues more easily. -Note that issue fields marked with a red asterisk are required -- they must -be set to create a new issue. Other fields are not required, but may be used -to include helpful information. The main issue fields we use are: - - Project - Axom will show up as the default. You shouldn't need - to change this. - Issue Type - We use only three issue types: *Bug*, *New Feature*, and - *Task*. A bug is something broken that needs to be fixed. A new feature - is something that adds functionality, enhances an interface, etc. Task - is a "catch-all" issue type for any other issue. - Summary - Provide a short descriptive summary. A good (and brief) - summary makes it easy to scan a list of issues to find one you are - looking for. - Priority - Select an appropriate issue priority to identify its level - of importance or urgency. Clicking on the question mark to the right of - the priority field provides a description of each option. - Components - Each issue is labeled with the Axom component it applies to. - Component labels also include things like: build system, documentation, - testing, etc. - Assignee - Unless you are certain which team member should be assigned - an issue, leave the issue 'Unassigned', which is the default in our - JIRA configuration. This indicates that the issue - requires discussion and review before we decide how to treat it. - Reporter - Unless you explicitly enter someone in this field, you, as - the issue creator, will be the reporter. This is the correct choice in - almost all cases. - Description - The description field should be used to include important - details about the issue that will help the developer who will work on it. - Environment - The environment field can be useful when an issue affects a particular - compiler or platform. - Epic-link - An *epic* is a special issue type in the Agile methodology that is used to - define a larger body of work that can be comprised of many issues. - **However, that's not what we use epics for. See note below.** - -You may also use the other fields that appear if you think they will help -describe the issue. However, the team seldom uses fields apart from the list -above. - -.. important:: We use epics in JIRA and link our issues to them to get a - convenient label on each each issue when we look at a sprint - board or the issue backlog. We have an epic for each of our - components for this purpose and the epic name matches the - corresponding component name. - -Starting and stopping work on an issue ---------------------------------------- - -When you begin work on an issue, you should note this by changing its state -from 'open' to 'in progress'. There are two ways to perform this transition. -The first is to open the issue and click the 'Start Progress' button at the -top of the issue menu. Alternatively, if the issue is in the 'open' column -on a sprint board, you can drag and drop it into the 'in progress' column. -Either way changes the issue status to 'in progress'. - -If there is still work to do on the issue, but you will stop working on it -for a while, you can click the 'Stop Progress' button at the top of the -issue. Alternatively, if the issue is in the 'in progress' column on a sprint -board, you can drag and drop it into the 'open' column. -Either way changes the issue status to *open*. - -Closing an issue ------------------ - -When work on an issue is complete (including testing, documentation, etc.), -or the issue will not be addressed, it should be closed. To close an issue, -click the 'Close' button and select the appropriate issue resolution. There -are two options: *Done* and *Won't Fix*. 'Done' means that the issue is -resolved. 'Won't Fix' means that the issue will not be addressed for some -reason. - -When closing an issue, adding information to the 'Comment' field is -helpful. For example, when an issue is closed as 'Won't Fix', it is helpful to -enter a brief explanation as to why this is so. - -Issue assignee --------------- - -Note that an assigned issue can be assigned to someone else to work on it. -An assigned issue can also be set back to 'Unassigned' if it needs further -discussion by the team. - -JIRA tips ----------- - -Here are some links to short videos (a couple of minutes each) that -demonstrate how to use JIRA features: - - * `JIRA Instant Search Bar Demo `_ - * `JIRA System Files Demo `_ - * `Creating and Editing JIRA Issues `_ diff --git a/src/docs/sphinx/dev_guide/misc_tasks.rst b/src/docs/sphinx/dev_guide/misc_tasks.rst index d7aea0dced..52d1fa0143 100644 --- a/src/docs/sphinx/dev_guide/misc_tasks.rst +++ b/src/docs/sphinx/dev_guide/misc_tasks.rst @@ -30,9 +30,9 @@ Describe how to run the scripts to install third-party libraries for testing different versions locally on a branch and for installing new libraries for the team to use... -Building and installing TPLs for all compilers on LC CHAOS platforms (CZ):: +Building and installing TPLs for all compilers on the current LC platform you are on:: - $ python ./scripts/uberenv/llnl_install_scripts/llnl_cz_uberenv_install_chaos_5_x86_64_ib_all_compilers.py + $ python ./scripts/llnl_scripts/build_tpls.py -d Questions we need to answer include: diff --git a/src/docs/sphinx/dev_guide/pull_requests.rst b/src/docs/sphinx/dev_guide/pull_requests.rst index 0321e70f6d..be02d01158 100644 --- a/src/docs/sphinx/dev_guide/pull_requests.rst +++ b/src/docs/sphinx/dev_guide/pull_requests.rst @@ -12,7 +12,7 @@ Pull Requests and Code Reviews Before any code is merged into the develop or master branches, it must be tested, documented, reviewed, and accepted. Creating a pull request on -the Axom Bitbucket project to merge a branch into develop or master +the Axom Github project to merge a branch into develop or master initiates the test and review processes. All required build configurations and tests must pass for a pull request to be approved. Also, new tests (unit, integration, etc.) must be created that exercise any new functionality @@ -24,7 +24,7 @@ of the Axom development team other than the originator of the pull request. It is recommended that several team members review pull requests, especially when changes affect APIs, dependencies (within Axom and external), etc. Pull request reviewers can be -selected on Bitbucket when the pull request is created. Changes reviewed by +selected on Github when the pull request is created. Changes reviewed by the team are accepted, rejected, or commented on for improvement; e.g., issues to be addressed, suggested changes, etc. Pull requests can be updated with additional changes and commits as needed. When a pull request is @@ -33,7 +33,7 @@ development, it should be deleted. In addition to successful compilation and test passing, changes to the develop and master branches should be scrutinized in other ways and using -other code health tools we use. See :ref:`bamboo-label` for more information +other code health tools we use. See :ref:`github-label` for more information about using our continuous integration tools. @@ -44,7 +44,7 @@ Pull Request Summary To recap, here is a summary of steps in a pull request: #. When code is ready to be considered for acceptance, create a pull request - on the Axom Bitbucket project. Identify the appropriate reviewers + on the Axom Github project. Identify the appropriate reviewers and add them to the pull request. #. Code must build successfully and all relevant tests must pass, including @@ -58,7 +58,7 @@ To recap, here is a summary of steps in a pull request: #. When a pull request is approved it may be merged. If the merged branch is no longer needed, it should be deleted. This can be done when merging - with Bitbucket. + with Github. .. _review-label: diff --git a/src/docs/sphinx/quickstart_guide/config_build.rst b/src/docs/sphinx/quickstart_guide/config_build.rst index f35bc7f0b4..6a41e1ff90 100644 --- a/src/docs/sphinx/quickstart_guide/config_build.rst +++ b/src/docs/sphinx/quickstart_guide/config_build.rst @@ -32,10 +32,10 @@ Basic requirements: Compilers we support (listed with minimum supported version): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Clang 3.9.1 + * Clang 4.0.0 * GCC 4.9.3 * IBM XL 13 - * Intel 15 + * Intel 18 * Microsoft Visual Studio 2015 * Microsoft Visual Studio 2015 with the Intel toolchain @@ -370,7 +370,7 @@ Please see :ref:`using_in_your_project` for examples of how to use Axom in your .. .. 1. Add Axom as a git submodule to your project, for example: :: .. -.. $ git submodule add ssh://git@cz-bitbucket.llnl.gov:7999/atk/axom.git +.. $ git submodule add git@github.com:LLNL/axom.git .. .. .. note:: .. If you are not using BLT_ in your project, you'll have to issue the diff --git a/src/docs/sphinx/quickstart_guide/the_code.rst b/src/docs/sphinx/quickstart_guide/the_code.rst index 7594ecbc20..1504a89bc0 100644 --- a/src/docs/sphinx/quickstart_guide/the_code.rst +++ b/src/docs/sphinx/quickstart_guide/the_code.rst @@ -9,9 +9,9 @@ The Code Our Git repository contains the Axom source code, documentation, test suites and all files and scripts used for configuring and building the code. The repository lives in our -`CZ Bitbucket project `_. +`Github repository `_. -We use our `JIRA project space `_ for +We use `Github `_ for issue tracking. Please report issues, feature requests, etc. there or send email to the Axom development team. @@ -26,23 +26,24 @@ group ``axom``. If you're not in the group, please send email to SSH keys ^^^^^^^^ -If you have not used Bitbucket before, you will need to -`create an SSH key `_ -and `add the key to your Bitbucket profile `_. +If you have not used Github before, you should start by creating and adding your SSH keys to Github. +Github provides a good tutorial `here `_. +Performing these two simple steps will make it easier for you to interact with +our Git repository without having to repeatedly enter login credentials. Cloning the repo ^^^^^^^^^^^^^^^^ To clone the repo into your local working space, type the following:: - $ git clone --recursive ssh://git@cz-bitbucket.llnl.gov:7999/atk/axom.git + $ git clone --recursive git@github.com:LLNL/axom.git Important notes: * You don't need to remember the URL for the Axom repo above. It can be - found by going to the Axom repo on our Bitbucket project and - clicking on the 'Clone' button that appears when you hover your - mouse cursor over the ellipses at top of the web page on the left. + found by going to the Axom repo on our Github project and + clicking on the 'Clone or download' button that is on the upper right of the Axom Github + page. * The ``--recursive`` argument above is needed to pull in Axom's submodules. This includes our data directory, which is used for testing, as well as our build system called *BLT*, a standalone product that lives in diff --git a/src/docs/sphinx/quickstart_guide/zero_to_axom.rst b/src/docs/sphinx/quickstart_guide/zero_to_axom.rst index 9b3b320c6b..64c5e798ce 100644 --- a/src/docs/sphinx/quickstart_guide/zero_to_axom.rst +++ b/src/docs/sphinx/quickstart_guide/zero_to_axom.rst @@ -14,7 +14,7 @@ The quickest path to install Axom and its dependencies is via `uberenv Date: Sun, 23 Feb 2020 09:35:46 -0800 Subject: [PATCH 018/632] ENH: don't leak umpire in axom mem-management API Slight change to Axom's memory management routines to avoid leaking usage of Umpire. Instead we use the umpire allocator integer IDs to specify an allocator. Resolves in part #175. --- src/axom/core/memory_management.hpp | 75 ++++++++++++----------------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index c60027fc0b..39acfeed79 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -22,6 +22,13 @@ namespace axom { +#ifdef AXOM_USE_UMPIRE +const int DEFAULT_ALLOCATOR_ID = + umpire::ResourceManager::getInstance().getAllocator("HOST").getId(); +#else +constexpr int DEFAULT_ALLOCATOR_ID = 0; +#endif + constexpr int INVALID_ALLOCATOR_ID = -1; /// \name Memory Management Routines @@ -34,7 +41,7 @@ constexpr int INVALID_ALLOCATOR_ID = -1; * \param [in] resource_type the Umpire resource type * \return ID the id of the predefined umpire allocator. */ -inline int getResourceAllocatorID( +inline int getUmpireResourceAllocatorID( umpire::resource::MemoryResourceType resource_type ) { umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); @@ -42,42 +49,32 @@ inline int getResourceAllocatorID( return alloc.getId(); } -/*! - * \brief Returns the umpire allocator associated with the given ID. - * \param [in] allocatorID the ID of the allocator to get. - */ -inline umpire::Allocator getAllocator( int allocatorID ) -{ - return umpire::ResourceManager::getInstance().getAllocator( allocatorID ); -} - -/*! - * \brief Sets the default memory space to use. Default is set to HOST - * \param [in] allocator the umpire::Allocator to make default. - */ -inline void setDefaultAllocator( umpire::Allocator allocator ) -{ - umpire::ResourceManager::getInstance().setDefaultAllocator( allocator ); -} +#endif /*! * \brief Sets the default memory space to use. Default is set to HOST - * \param [in] allocatorID ID of the umpire::Allocator to use. + * \param [in] allocatorID ID of the allocator to use. */ inline void setDefaultAllocator( int allocatorID ) { - setDefaultAllocator( getAllocator( allocatorID ) ); +#ifdef AXOM_USE_UMPIRE + umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); + umpire::Allocator allocator = rm.getAllocator( allocatorID ); + rm.setDefaultAllocator( allocator ); +#endif } /*! * \brief Returns the current default memory space used. */ -inline umpire::Allocator getDefaultAllocator() +inline int getDefaultAllocatorID() { - return umpire::ResourceManager::getInstance().getDefaultAllocator(); -} - +#ifdef AXOM_USE_UMPIRE + return umpire::ResourceManager::getInstance().getDefaultAllocator().getId(); +#else + return DEFAULT_ALLOCATOR_ID; #endif +} /*! * \brief Allocates a chunk of memory of type T. @@ -96,13 +93,8 @@ inline umpire::Allocator getDefaultAllocator() * \return p pointer to the new allocation or a nullptr if allocation failed. */ template < typename T > -#ifdef AXOM_USE_UMPIRE -inline T* allocate( std::size_t n, - umpire::Allocator allocator= - getDefaultAllocator() ) noexcept; -#else -inline T* allocate( std::size_t n ) noexcept; -#endif +inline T* allocate(std::size_t n, int allocID=getDefaultAllocatorID() )noexcept; + /*! * \brief Frees the chunk of memory pointed to by the supplied pointer, p. @@ -150,27 +142,22 @@ inline void copy( void* dst, void* src, std::size_t numbytes ) noexcept; // IMPLEMENTATION //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -#ifdef AXOM_USE_UMPIRE - template < typename T > -inline T* allocate( std::size_t n, umpire::Allocator allocator ) noexcept +inline T* allocate( std::size_t n, int allocID ) noexcept { const std::size_t numbytes = n * sizeof( T ); - return static_cast< T* >( allocator.allocate( numbytes ) ); -} -#else +#ifdef AXOM_USE_UMPIRE -template < typename T > -inline T* allocate( std::size_t n ) noexcept -{ - const std::size_t numbytes = n * sizeof( T ); - return static_cast< T* >( std::malloc( numbytes ) ); -} + umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); + umpire::Allocator allocator = rm.getAllocator( allocID ); + return static_cast< T* >( allocator.allocate( numbytes ) ); +#else + return static_cast< T* >( std::malloc( numbytes ) ); #endif +} //------------------------------------------------------------------------------ template < typename T > inline void deallocate( T*& pointer ) noexcept From 326ff42a64f0ab7b5c5ec865b58711210e4844a6 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 09:41:33 -0800 Subject: [PATCH 019/632] COMP: mem-management API changes in axom/core Reflect mem-management API changes in axom/core. Resolves in part #175. --- .../core/execution/internal/cuda_exec.hpp | 2 +- src/axom/core/execution/internal/omp_exec.hpp | 2 +- src/axom/core/execution/internal/seq_exec.hpp | 2 +- .../core/tests/core_execution_for_all.cpp | 9 +- src/axom/core/tests/core_execution_space.cpp | 10 +- .../core/tests/core_memory_management.cpp | 106 ++++++++---------- 6 files changed, 57 insertions(+), 74 deletions(-) diff --git a/src/axom/core/execution/internal/cuda_exec.hpp b/src/axom/core/execution/internal/cuda_exec.hpp index dc3d3e1e9e..d404437c23 100644 --- a/src/axom/core/execution/internal/cuda_exec.hpp +++ b/src/axom/core/execution/internal/cuda_exec.hpp @@ -57,7 +57,7 @@ struct execution_space< CUDA_EXEC< BLOCK_SIZE, SYNCHRONOUS > > static constexpr bool valid() noexcept { return true; }; static constexpr char* name() noexcept { return (char*)"[CUDA_EXEC]"; }; static int allocatorID() noexcept - { return axom::getResourceAllocatorID(umpire::resource::Unified); }; + { return axom::getUmpireResourceAllocatorID(umpire::resource::Unified); }; }; diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 7941320031..14cced023c 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -48,7 +48,7 @@ struct execution_space< OMP_EXEC > static int allocatorID() noexcept { #ifdef AXOM_USE_UMPIRE - return axom::getResourceAllocatorID(umpire::resource::Host); + return axom::getUmpireResourceAllocatorID(umpire::resource::Host); #else return 0; #endif diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index b260e05d86..b9332431ad 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -56,7 +56,7 @@ struct execution_space< SEQ_EXEC > static int allocatorID() noexcept { #ifdef AXOM_USE_UMPIRE - return axom::getResourceAllocatorID( umpire::resource::Host ); + return axom::getUmpireResourceAllocatorID( umpire::resource::Host ); #else return 0; #endif diff --git a/src/axom/core/tests/core_execution_for_all.cpp b/src/axom/core/tests/core_execution_for_all.cpp index f5ef45cb57..f5f7cab95c 100644 --- a/src/axom/core/tests/core_execution_for_all.cpp +++ b/src/axom/core/tests/core_execution_for_all.cpp @@ -34,10 +34,8 @@ void check_for_all( ) constexpr int N = 256; // STEP 1: set default allocator for the execution space -#ifdef AXOM_USE_UMPIRE - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int currentAllocatorID = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID() ); -#endif // STEP 0: allocate buffer int* a = axom::allocate< int >( N ); @@ -80,9 +78,8 @@ void check_for_all( ) // STEP 5: cleanup axom::deallocate( a ); -#ifdef AXOM_USE_UMPIRE - axom::setDefaultAllocator( current_allocator ); -#endif + + axom::setDefaultAllocator( currentAllocatorID ); } } /* end anonymous namespace */ diff --git a/src/axom/core/tests/core_execution_space.cpp b/src/axom/core/tests/core_execution_space.cpp index cd662c9b65..7920b8f975 100644 --- a/src/axom/core/tests/core_execution_space.cpp +++ b/src/axom/core/tests/core_execution_space.cpp @@ -129,7 +129,7 @@ TEST( core_execution_space, check_seq_exec ) constexpr bool IS_ASYNC = false; - int allocator_id = axom::getResourceAllocatorID( umpire::resource::Host ); + int allocator_id = axom::getUmpireResourceAllocatorID(umpire::resource::Host); check_execution_mappings< axom::SEQ_EXEC, RAJA::loop_exec, RAJA::loop_reduce, @@ -147,7 +147,7 @@ TEST( core_execution_space, check_omp_exec ) constexpr bool IS_ASYNC = false; - int allocator_id = axom::getResourceAllocatorID( umpire::resource::Host ); + int allocator_id = axom::getUmpireResourceAllocatorID(umpire::resource::Host); check_execution_mappings< axom::OMP_EXEC, RAJA::omp_parallel_for_exec, RAJA::omp_reduce, @@ -168,7 +168,8 @@ TEST( core_execution_space, check_cuda_exec ) constexpr bool IS_ASYNC = false; - int allocator_id = axom::getResourceAllocatorID( umpire::resource::Unified ); + int allocator_id = + axom::getUmpireResourceAllocatorID(umpire::resource::Unified); check_execution_mappings< axom::CUDA_EXEC< BLOCK_SIZE >, RAJA::cuda_exec< BLOCK_SIZE >, RAJA::cuda_reduce, @@ -186,7 +187,8 @@ TEST( core_execution_space, check_cuda_exec_async ) constexpr bool IS_ASYNC = true; - int allocator_id = axom::getResourceAllocatorID( umpire::resource::Unified ); + int allocator_id = + axom::getUmpireResourceAllocatorID(umpire::resource::Unified); check_execution_mappings< axom::CUDA_EXEC< BLOCK_SIZE, axom::ASYNC >, RAJA::cuda_exec_async< BLOCK_SIZE >, RAJA::cuda_reduce, diff --git a/src/axom/core/tests/core_memory_management.cpp b/src/axom/core/tests/core_memory_management.cpp index f439e828c2..a890d83d8e 100644 --- a/src/axom/core/tests/core_memory_management.cpp +++ b/src/axom/core/tests/core_memory_management.cpp @@ -17,6 +17,10 @@ // HELPER METHODS //------------------------------------------------------------------------------ +#ifdef AXOM_USE_UMPIRE +#else +#endif + // This value is such that the 64Kb limit on device constant memory is not hit // in check_alloc_realloc_free when reallocating to 3 * SIZE. constexpr int SIZE = 5345; @@ -127,10 +131,8 @@ class CopyTest : }; #ifdef AXOM_USE_UMPIRE -void check_alloc_and_free( - umpire::Allocator allocator= - axom::getAllocator(axom::getResourceAllocatorID(umpire::resource::Host)), - bool hostAccessible=true ) +void check_alloc_and_free( int allocatorID=axom::DEFAULT_ALLOCATOR_ID, + bool hostAccessible=true ) #else void check_alloc_and_free( bool hostAccessible=true) #endif @@ -138,12 +140,12 @@ void check_alloc_and_free( bool hostAccessible=true) for ( int size = 0 ; size <= SIZE ; size = size * 2 + 1 ) { #ifdef AXOM_USE_UMPIRE - int* buffer = axom::allocate< int >( size, allocator ); + int* buffer = axom::allocate< int >( size, allocatorID ); if (size > 0) { umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); - EXPECT_EQ( allocator.getId(), rm.getAllocator( buffer ).getId() ); + EXPECT_EQ( allocatorID, rm.getAllocator( buffer ).getId() ); } #else int* buffer = axom::allocate< int >( size ); @@ -168,10 +170,8 @@ void check_alloc_and_free( bool hostAccessible=true) } #ifdef AXOM_USE_UMPIRE -void check_alloc_realloc_free( - umpire::Allocator allocator= - axom::getAllocator(axom::getResourceAllocatorID(umpire::resource::Host)), - bool hostAccessible=true ) +void check_alloc_realloc_free( int allocatorID=axom::DEFAULT_ALLOCATOR_ID, + bool hostAccessible=true ) #else void check_alloc_realloc_free( bool hostAccessible=true ) #endif @@ -181,12 +181,12 @@ void check_alloc_realloc_free( bool hostAccessible=true ) int buffer_size = size; #ifdef AXOM_USE_UMPIRE - int* buffer = axom::allocate< int >( buffer_size, allocator ); + int* buffer = axom::allocate< int >( buffer_size, allocatorID ); umpire::ResourceManager & rm = umpire::ResourceManager::getInstance(); if (buffer_size > 0) { - ASSERT_EQ(allocator.getId(), rm.getAllocator(buffer).getId()); + ASSERT_EQ( allocatorID, rm.getAllocator(buffer).getId() ); } #else int* buffer = axom::allocate< int >( buffer_size ); @@ -213,7 +213,7 @@ void check_alloc_realloc_free( bool hostAccessible=true ) #ifdef AXOM_USE_UMPIRE if (buffer_size > 0) { - ASSERT_EQ(allocator.getId(), rm.getAllocator(buffer).getId()); + ASSERT_EQ( allocatorID, rm.getAllocator(buffer).getId() ); } #endif @@ -238,7 +238,7 @@ void check_alloc_realloc_free( bool hostAccessible=true ) #ifdef AXOM_USE_UMPIRE if (buffer_size > 0) { - ASSERT_EQ(allocator.getId(), rm.getAllocator(buffer).getId()); + ASSERT_EQ( allocatorID, rm.getAllocator(buffer).getId() ); } #endif @@ -266,45 +266,45 @@ void check_alloc_realloc_free( bool hostAccessible=true ) TEST( core_memory_management, set_get_default_memory_space ) { const int HostAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Host ); - EXPECT_EQ( HostAllocatorID, axom::getDefaultAllocator().getId() ); + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); + EXPECT_EQ( HostAllocatorID, axom::getDefaultAllocatorID() ); #ifdef AXOM_USE_CUDA #ifdef UMPIRE_ENABLE_PINNED const int PinnedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Pinned ); + axom::getUmpireResourceAllocatorID( umpire::resource::Pinned ); - axom::setDefaultAllocator( axom::getAllocator( PinnedAllocatorID ) ); - EXPECT_EQ( PinnedAllocatorID, axom::getDefaultAllocator().getId() ); + axom::setDefaultAllocator( PinnedAllocatorID ); + EXPECT_EQ( PinnedAllocatorID, axom::getDefaultAllocatorID() ); #endif #ifdef UMPIRE_ENABLE_DEVICE const int DeviceAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Device ); - axom::setDefaultAllocator( axom::getAllocator( DeviceAllocatorID ) ); - EXPECT_EQ( DeviceAllocatorID, axom::getDefaultAllocator().getId() ); + axom::getUmpireResourceAllocatorID( umpire::resource::Device ); + axom::setDefaultAllocator( DeviceAllocatorID ); + EXPECT_EQ( DeviceAllocatorID, axom::getDefaultAllocatorID() ); #endif #ifdef UMPIRE_ENABLE_CONST const int ConstantAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Constant ); - axom::setDefaultAllocator( axom::getAllocator( ConstantAllocatorID ) ); - EXPECT_EQ( ConstantAllocatorID, axom::getDefaultAllocator().getId() ); + axom::getUmpireResourceAllocatorID( umpire::resource::Constant ); + axom::setDefaultAllocator( ConstantAllocatorID ); + EXPECT_EQ( ConstantAllocatorID, axom::getDefaultAllocatorID() ); #endif #ifdef UMPIRE_ENABLE_UM const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - EXPECT_EQ( UnifiedAllocatorID, axom::getDefaultAllocator().getId() ); + axom::getUmpireResourceAllocatorID( umpire::resource::Unified ); + axom::setDefaultAllocator( UnifiedAllocatorID ); + EXPECT_EQ( UnifiedAllocatorID, axom::getDefaultAllocatorID() ); #endif #endif // AXOM_USE_CUDA - axom::setDefaultAllocator( axom::getAllocator( HostAllocatorID ) ); - EXPECT_EQ( HostAllocatorID, axom::getDefaultAllocator().getId() ); + axom::setDefaultAllocator( HostAllocatorID ); + EXPECT_EQ( HostAllocatorID, axom::getDefaultAllocatorID() ); } #endif /* AXOM_USE_UMPIRE */ @@ -316,10 +316,8 @@ TEST( core_memory_management, alloc_free ) constexpr bool HOST_ACCESSIBLE = true; const int HostAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Host ); - check_alloc_and_free( axom::getAllocator( HostAllocatorID ), - HOST_ACCESSIBLE - ); + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); + check_alloc_and_free( HostAllocatorID, HOST_ACCESSIBLE ); #ifdef AXOM_USE_CUDA @@ -328,33 +326,25 @@ TEST( core_memory_management, alloc_free ) #ifdef UMPIRE_ENABLE_PINNED const int PinnedAllocatorID = axom::getResourceAllocatorID( umpire::resource::Pinned ); - check_alloc_and_free( axom::getAllocator( PinnedAllocatorID ), - HOST_ACCESSIBLE - ); + check_alloc_and_free( PinnedAllocatorID, HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_DEVICE const int DeviceAllocatorID = axom::getResourceAllocatorID( umpire::resource::Device ); - check_alloc_and_free( axom::getAllocator( DeviceAllocatorID ), - NOT_HOST_ACCESSIBLE - ); + check_alloc_and_free( DeviceAllocatorID, NOT_HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_CONST const int ConstantAllocatorID = axom::getResourceAllocatorID( umpire::resource::Constant ); - check_alloc_and_free( axom::getAllocator( ConstantAllocatorID ), - NOT_HOST_ACCESSIBLE - ); + check_alloc_and_free( ConstantAllocatorID, NOT_HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_UM const int UnifiedAllocatorID = axom::getResourceAllocatorID( umpire::resource::Unified ); - check_alloc_and_free( axom::getAllocator( UnifiedAllocatorID ), - HOST_ACCESSIBLE - ); + check_alloc_and_free( UnifiedAllocatorID, HOST_ACCESSIBLE ); #endif #endif // AXOM_USE_CUDA @@ -371,9 +361,9 @@ TEST( core_memory_management, alloc_realloc_free ) constexpr bool HOST_ACCESSIBLE = true; - check_alloc_realloc_free( axom::getAllocator( umpire::resource::Host ), - HOST_ACCESSIBLE - ); + const int HostAllocatorID = + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); + check_alloc_realloc_free( HostAllocatorID, HOST_ACCESSIBLE ); #ifdef AXOM_USE_CUDA @@ -381,18 +371,14 @@ TEST( core_memory_management, alloc_realloc_free ) #ifdef UMPIRE_ENABLE_PINNED const int PinnedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Pinned ); - check_alloc_realloc_free( axom::getAllocator( PinnedAllocatorID ), - HOST_ACCESSIBLE - ); + axom::getUmpireResourceAllocatorID( umpire::resource::Pinned ); + check_alloc_realloc_free( PinnedAllocatorID, HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_DEVICE const int DeviceAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Device ); - check_alloc_realloc_free( axom::getAllocator( DeviceAllocatorID ), - NOT_HOST_ACCESSIBLE - ); + axom::getUmpireResourceAllocatorID( umpire::resource::Device ); + check_alloc_realloc_free( DeviceAllocatorID, NOT_HOST_ACCESSIBLE ); #endif // Umpire doesn't allow reallocation of Constant memory. @@ -403,10 +389,8 @@ TEST( core_memory_management, alloc_realloc_free ) #ifdef UMPIRE_ENABLE_UM const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - check_alloc_realloc_free( axom::getAllocator( UnifiedAllocatorID ), - HOST_ACCESSIBLE - ); + axom::getUmpireResourceAllocatorID( umpire::resource::Unified ); + check_alloc_realloc_free( UnifiedAllocatorID, HOST_ACCESSIBLE ); #endif From d0274f1112abb8b3ba35bfb9a191a03a01cf680a Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 09:42:36 -0800 Subject: [PATCH 020/632] COMP: mem-management API changes in axom/spin Reflect mem-management API changes in axom/spin Resolves in part #175 --- src/axom/spin/BVH.hpp | 12 ++++++------ src/axom/spin/tests/spin_bvh.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index eaed74073c..bb1ec6bd89 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -378,7 +378,7 @@ template< int NDIMS, typename ExecSpace, typename FloatType > int BVH< NDIMS, ExecSpace, FloatType >::build() { // STEP 0: set the default memory allocator to use for the execution space. - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); @@ -430,7 +430,7 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() } // STEP 6: restore default allocator - axom::setDefaultAllocator( current_allocator ); + axom::setDefaultAllocator( currentAllocatorID ); return BVH_BUILD_OK; } @@ -466,7 +466,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, SLIC_ASSERT( z != nullptr ); // STEP 0: set the default memory allocator to use for the execution space. - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); @@ -628,7 +628,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, } ); // STEP 3: restore default allocator - axom::setDefaultAllocator( current_allocator ); + axom::setDefaultAllocator( currentAllocatorID ); } //------------------------------------------------------------------------------ @@ -650,7 +650,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, SLIC_ASSERT( y != nullptr ); // STEP 0: set the default memory allocator to use for the execution space. - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); @@ -811,7 +811,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, } ); // STEP 3: restore default allocator - axom::setDefaultAllocator( current_allocator ); + axom::setDefaultAllocator( currentAllocatorID ); } //------------------------------------------------------------------------------ diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 598e49f4d1..171a8a0505 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -227,7 +227,7 @@ void check_build_bvh2d( ) constexpr int NUM_BOXES = 2; constexpr int NDIMS = 2; - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int current_allocator = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID()); FloatType* boxes = axom::allocate< FloatType >( 8 ); @@ -266,7 +266,7 @@ void check_build_bvh3d( ) constexpr int NUM_BOXES = 2; constexpr int NDIMS = 3; - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int current_allocator = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID()); FloatType* boxes = axom::allocate< FloatType >( 12 ); @@ -315,7 +315,7 @@ void check_find3d( ) constexpr int NDIMS = 3; constexpr IndexType N = 4; - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int current_allocator = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID()); using PointType = primal::Point< double, NDIMS >; @@ -413,7 +413,7 @@ void check_find2d( ) constexpr int NDIMS = 2; constexpr IndexType N = 4; - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int current_allocator = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID()); using PointType = primal::Point< double, NDIMS >; @@ -502,7 +502,7 @@ void check_single_box2d( ) constexpr int NUM_BOXES = 1; constexpr int NDIMS = 2; - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int current_allocator = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID()); // single bounding box in [0,1] x [0,1] @@ -570,7 +570,7 @@ void check_single_box3d( ) constexpr int NUM_BOXES = 1; constexpr int NDIMS = 3; - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int current_allocator = axom::getDefaultAllocatorID(); axom::setDefaultAllocator( axom::execution_space::allocatorID()); // single bounding box in [0,1] x [0,1] x [0,1] From a2e76971c4e202972599a5f0a6b72b8a09ace233 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 09:43:25 -0800 Subject: [PATCH 021/632] COMP: mem-management API changes in axom/sidre Reflect mem-management API changes in axom/sidre Resolves in part #175 --- src/axom/sidre/core/Buffer.cpp | 4 ++-- src/axom/sidre/core/Group.cpp | 2 +- src/axom/sidre/core/Group.hpp | 3 ++- src/axom/sidre/tests/sidre_buffer.cpp | 22 +++++++++++----------- src/axom/sidre/tests/sidre_group.cpp | 20 +++++++++----------- src/axom/sidre/tests/sidre_view.cpp | 21 +++++++++++---------- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/axom/sidre/core/Buffer.cpp b/src/axom/sidre/core/Buffer.cpp index 90f90c0035..190e560800 100644 --- a/src/axom/sidre/core/Buffer.cpp +++ b/src/axom/sidre/core/Buffer.cpp @@ -29,7 +29,7 @@ int getValidAllocatorID( int allocID ) #ifdef AXOM_USE_UMPIRE if ( allocID == INVALID_ALLOCATOR_ID ) { - allocID = getDefaultAllocator().getId(); + allocID = getDefaultAllocatorID(); } #endif @@ -423,7 +423,7 @@ void* Buffer::allocateBytes(IndexType num_bytes, int allocID) { allocID = getValidAllocatorID(allocID); #ifdef AXOM_USE_UMPIRE - return axom::allocate(num_bytes, getAllocator(allocID)); + return axom::allocate(num_bytes, allocID ); #else return axom::allocate(num_bytes); #endif diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index 5a3ba6861d..75c2cd5ede 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -1677,7 +1677,7 @@ Group::Group(const std::string& name, , m_view_coll(new ViewCollection()) , m_group_coll(new GroupCollection()) #ifdef AXOM_USE_UMPIRE - , m_default_allocator_id(axom::getDefaultAllocator().getId()) + , m_default_allocator_id(axom::getDefaultAllocatorID()) #endif {} diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index 18ef66bd66..239e481c87 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -264,7 +264,8 @@ class Group */ umpire::Allocator getDefaultAllocator() const { - return getAllocator(m_default_allocator_id); + umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); + return rm.getAllocator( m_default_allocator_id ); } /*! diff --git a/src/axom/sidre/tests/sidre_buffer.cpp b/src/axom/sidre/tests/sidre_buffer.cpp index 1e61c8cda5..1412667e46 100644 --- a/src/axom/sidre/tests/sidre_buffer.cpp +++ b/src/axom/sidre/tests/sidre_buffer.cpp @@ -378,7 +378,7 @@ class UmpireTest : public ::testing::TestWithParam void TearDown() override { - int allocID = axom::getResourceAllocatorID( umpire::resource::Host ); + int allocID = axom::getUmpireResourceAllocatorID( umpire::resource::Host ); axom::setDefaultAllocator( allocID ); } @@ -455,7 +455,7 @@ TEST_P(UmpireTest, reallocate) constexpr int SIZE = 100; #if defined(AXOM_USE_CUDA) && defined(UMPIRE_ENABLE_CONST) - if (allocID == axom::getResourceAllocatorID( umpire::resource::Constant ) ) + if (allocID == axom::getUmpireResourceAllocatorID(umpire::resource::Constant)) { return; } @@ -497,7 +497,7 @@ TEST_P(UmpireTest, reallocate_zero) #if defined(AXOM_USE_CUDA) && defined(UMPIRE_ENABLE_CONST) - if (allocID == axom::getResourceAllocatorID( umpire::resource::Constant ) ) + if (allocID == axom::getUmpireResourceAllocatorID(umpire::resource::Constant)) { return; } @@ -513,7 +513,7 @@ TEST_P(UmpireTest, reallocate_zero) buff->reallocate(0); buff->reallocate(SIZE); - ASSERT_EQ(axom::getDefaultAllocator().getId(), + ASSERT_EQ(axom::getDefaultAllocatorID(), rm.getAllocator(buff->getVoidPtr()).getId()); buff->deallocate(); @@ -525,7 +525,7 @@ TEST_P(UmpireTest, reallocate_zero) buff->reallocate(0); buff->reallocate(SIZE); - ASSERT_EQ(axom::getDefaultAllocator().getId(), + ASSERT_EQ(axom::getDefaultAllocatorID(), rm.getAllocator(buff->getVoidPtr()).getId()); buff->deallocate(); } @@ -536,30 +536,30 @@ TEST_P(UmpireTest, reallocate_zero) buff->reallocate(0); buff->reallocate(SIZE); - ASSERT_EQ(axom::getDefaultAllocator().getId(), + ASSERT_EQ(axom::getDefaultAllocatorID(), rm.getAllocator(buff->getVoidPtr()).getId()); buff->deallocate(); } } const int allocators[] = { - axom::getResourceAllocatorID( umpire::resource::Host ) + axom::getUmpireResourceAllocatorID( umpire::resource::Host ) #ifdef AXOM_USE_CUDA #ifdef UMPIRE_ENABLE_PINNED - , axom::getResourceAllocatorID( umpire::resource::Pinned ) + , axom::getUmpireResourceAllocatorID( umpire::resource::Pinned ) #endif #ifdef UMPIRE_ENABLE_DEVICE - , axom::getResourceAllocatorID( umpire::resource::Device ) + , axom::getUmpireResourceAllocatorID( umpire::resource::Device ) #endif #ifdef UMPIRE_ENABLE_CONST - , axom::getResourceAllocatorID( umpire::resource::Constant ) + , axom::getUmpireResourceAllocatorID( umpire::resource::Constant ) #endif #ifdef UMPIRE_ENABLE_UM - , axom::getResourceAllocatorID( umpire::resource::Unified ) + , axom::getUmpireResourceAllocatorID( umpire::resource::Unified ) #endif #endif /* AXOM_USE_CUDA */ diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index b194fb67b4..9d3e80041c 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -2396,17 +2396,15 @@ TEST_P(UmpireTest, root_default_allocator) TEST_P(UmpireTest, get_set_allocator) { - int defaultAllocatorID = axom::getDefaultAllocator().getId(); + int defaultAllocatorID = axom::getDefaultAllocatorID(); ASSERT_EQ(root->getDefaultAllocator().getId(), defaultAllocatorID); ASSERT_EQ(root->getDefaultAllocatorID(), defaultAllocatorID); root->setDefaultAllocator(allocID); - defaultAllocatorID = axom::getDefaultAllocator().getId(); - ASSERT_EQ(root->getDefaultAllocator().getId(), axom::getAllocator( - allocID).getId()); - ASSERT_EQ(root->getDefaultAllocatorID(), allocID); + defaultAllocatorID = axom::getDefaultAllocatorID(); + ASSERT_EQ(root->getDefaultAllocatorID(), defaultAllocatorID ); - root->setDefaultAllocator(axom::getDefaultAllocator()); + root->setDefaultAllocator(rm.getInstance().getAllocator(defaultAllocatorID)); ASSERT_EQ(root->getDefaultAllocator().getId(), defaultAllocatorID); ASSERT_EQ(root->getDefaultAllocatorID(), defaultAllocatorID); } @@ -2470,12 +2468,12 @@ TEST_P(UmpireTest, allocate_default) } const int allocators[] = { - axom::getResourceAllocatorID(umpire::resource::Host) + axom::getUmpireResourceAllocatorID(umpire::resource::Host) #ifdef AXOM_USE_CUDA - , axom::getResourceAllocatorID(umpire::resource::Pinned) - , axom::getResourceAllocatorID(umpire::resource::Device) - , axom::getResourceAllocatorID(umpire::resource::Constant) - , axom::getResourceAllocatorID(umpire::resource::Unified) + , axom::getUmpireResourceAllocatorID(umpire::resource::Pinned) + , axom::getUmpireResourceAllocatorID(umpire::resource::Device) + , axom::getUmpireResourceAllocatorID(umpire::resource::Constant) + , axom::getUmpireResourceAllocatorID(umpire::resource::Unified) #endif }; diff --git a/src/axom/sidre/tests/sidre_view.cpp b/src/axom/sidre/tests/sidre_view.cpp index 241ffc4c3a..dc409d9923 100644 --- a/src/axom/sidre/tests/sidre_view.cpp +++ b/src/axom/sidre/tests/sidre_view.cpp @@ -1695,7 +1695,8 @@ class UmpireTest : public ::testing::TestWithParam void TearDown() override { - const int allocID = axom::getResourceAllocatorID( umpire::resource::Host ); + const int allocID = + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); axom::setDefaultAllocator( allocID ); } @@ -1789,7 +1790,7 @@ TEST_P(UmpireTest, reallocate_zero) { #if defined(AXOM_USE_CUDA) && defined(UMPIRE_ENABLE_CONST) - if (allocID == axom::getResourceAllocatorID( umpire::resource::Constant ) ) + if (allocID == axom::getUmpireResourceAllocatorID(umpire::resource::Constant)) { return; } @@ -1803,7 +1804,7 @@ TEST_P(UmpireTest, reallocate_zero) view->reallocate(0); view->reallocate(SIZE); - ASSERT_EQ(axom::getDefaultAllocator().getId(), + ASSERT_EQ(axom::getDefaultAllocatorID(), rm.getAllocator(view->getVoidPtr()).getId()); root->destroyViewAndData("v"); @@ -1817,7 +1818,7 @@ TEST_P(UmpireTest, reallocate_zero) view->reallocate(0); view->reallocate(SIZE); - ASSERT_EQ(axom::getDefaultAllocator().getId(), + ASSERT_EQ(axom::getDefaultAllocatorID(), rm.getAllocator(view->getVoidPtr()).getId()); root->destroyViewAndData("v"); @@ -1825,24 +1826,24 @@ TEST_P(UmpireTest, reallocate_zero) } const int allocators[] = { - axom::getResourceAllocatorID( umpire::resource::Host ) + axom::getUmpireResourceAllocatorID( umpire::resource::Host ) #ifdef AXOM_USE_CUDA -#ifdef UMPIRE_ENABLE_PINNED - , axom::getResourceAllocatorID( umpire::resource::Pinned ) +#ifdef UMPIRE_ENABLE_PINNED + , axom::getUmpireResourceAllocatorID( umpire::resource::Pinned ) #endif #ifdef UMPIRE_ENABLE_DEVICE - , axom::getResourceAllocatorID( umpire::resource::Device ) + , axom::getUmpireResourceAllocatorID( umpire::resource::Device ) #endif #ifdef UMPIRE_ENABLE_CONST - , axom::getResourceAllocatorID( umpire::resource::Constant ) + , axom::getResourceUmpireAllocatorID( umpire::resource::Constant ) #endif #ifdef UMPIRE_ENABLE_UM - , axom::getResourceAllocatorID( umpire::resource::Unified ) + , axom::getUmpireResourceAllocatorID( umpire::resource::Unified ) #endif #endif /* AXOM_USE_CUDA */ From f59c8e117526ff2cfbe443886212bb8cf7db5341 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 09:50:34 -0800 Subject: [PATCH 022/632] ENH: proper guards for different umpire spaces --- src/axom/sidre/tests/sidre_group.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index 9d3e80041c..07a533fa3b 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -2470,11 +2470,24 @@ TEST_P(UmpireTest, allocate_default) const int allocators[] = { axom::getUmpireResourceAllocatorID(umpire::resource::Host) #ifdef AXOM_USE_CUDA + +#ifdef UMPIRE_ENABLE_PINNED , axom::getUmpireResourceAllocatorID(umpire::resource::Pinned) +#endif + +#ifdef UMPIRE_ENABLE_DEVICE , axom::getUmpireResourceAllocatorID(umpire::resource::Device) +#endif + +#ifdef UMPIRE_ENABLE_CONST , axom::getUmpireResourceAllocatorID(umpire::resource::Constant) +#endif + +#ifdef UMPIRE_ENABLE_UM , axom::getUmpireResourceAllocatorID(umpire::resource::Unified) #endif + +#endif /* AXOM_USE_CUDA */ }; INSTANTIATE_TEST_SUITE_P( From 540a5aab33402342baa6d95ef0fc1d1a126a9b5e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 10:58:56 -0800 Subject: [PATCH 023/632] COMP: mem-management API changes in raja TPL test Reflect mem-management API changes in raja smoke test. Resolves in part #175 --- src/thirdparty/tests/raja_smoke.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/thirdparty/tests/raja_smoke.cpp b/src/thirdparty/tests/raja_smoke.cpp index 2cb4d31885..b5362a26f5 100644 --- a/src/thirdparty/tests/raja_smoke.cpp +++ b/src/thirdparty/tests/raja_smoke.cpp @@ -71,10 +71,10 @@ AXOM_CUDA_TEST( raja_smoke, basic_use ) #endif #if defined(AXOM_USE_CUDA) && defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); + const int prev_allocator = axom::getDefaultAllocatorID(); const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); + axom::getUmpireResourceAllocatorID( umpire::resource::Unified ); + axom::setDefaultAllocator( UnifiedAllocatorID ); std::cout << "Testing RAJA CUDA execution" << std::endl; constexpr int BLOCKSIZE = 256; From de2e11e8d5f7840dc6614998a5e694cbfe397e33 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 11:00:56 -0800 Subject: [PATCH 024/632] COMP: mem-management API changes in axom/mint Reflect mem-management API changes in axom/mint. Resolves in part #175 --- .../user_guide/mint_getting_started.cpp | 6 +- .../tests/mint_execution_cell_traversals.cpp | 59 +++++++++--------- .../tests/mint_execution_face_traversals.cpp | 40 ++++++------- .../tests/mint_execution_node_traversals.cpp | 60 +++++++++---------- 4 files changed, 81 insertions(+), 84 deletions(-) diff --git a/src/axom/mint/examples/user_guide/mint_getting_started.cpp b/src/axom/mint/examples/user_guide/mint_getting_started.cpp index 5b399bbbf6..ae3619f4dd 100644 --- a/src/axom/mint/examples/user_guide/mint_getting_started.cpp +++ b/src/axom/mint/examples/user_guide/mint_getting_started.cpp @@ -67,10 +67,8 @@ int main ( int argc, char** argv ) // sphinx_tutorial_walkthrough_set_memory_start // NOTE: use unified memory if we are using CUDA -#if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) - const int allocID = axom::getResourceAllocatorID( umpire::resource::Unified ); - axom::setDefaultAllocator( axom::getAllocator( allocID) ); -#endif + const int allocID = axom::execution_space< ExecPolicy >::allocatorID(); + axom::setDefaultAllocator( allocID ); // sphinx_tutorial_walkthrough_set_memory_end // sphinx_tutorial_walkthrough_construct_mesh_start diff --git a/src/axom/mint/tests/mint_execution_cell_traversals.cpp b/src/axom/mint/tests/mint_execution_cell_traversals.cpp index 86060a065e..4e36be08ab 100644 --- a/src/axom/mint/tests/mint_execution_cell_traversals.cpp +++ b/src/axom/mint/tests/mint_execution_cell_traversals.cpp @@ -379,12 +379,12 @@ AXOM_CUDA_TEST( mint_execution_cell_traversals, for_all_cells_nodeids ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_cell_nodes< cuda_exec, STRUCTURED_UNIFORM_MESH >(i); check_for_all_cell_nodes< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(i); check_for_all_cell_nodes< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(i); @@ -425,12 +425,12 @@ AXOM_CUDA_TEST( mint_execution_cell_traversals, for_all_cells_coords ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_cell_coords< cuda_exec, STRUCTURED_UNIFORM_MESH >(i); check_for_all_cell_coords< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(i); check_for_all_cell_coords< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(i); @@ -471,12 +471,12 @@ AXOM_CUDA_TEST( mint_execution_cell_traversals, for_all_cells_faceids ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_cell_faces< cuda_exec, STRUCTURED_UNIFORM_MESH >(i); check_for_all_cell_faces< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(i); check_for_all_cell_faces< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(i); @@ -510,12 +510,12 @@ AXOM_CUDA_TEST( mint_execution_cell_traversals, for_all_cells_ij ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_cells_ij< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_cells_ij< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_cells_ij< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -546,13 +546,12 @@ AXOM_CUDA_TEST( mint_execution_cell_traversals, for_all_cells_ijk ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); + using cuda_exec = axom::CUDA_EXEC< 512 >; + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); - using cuda_exec = axom::CUDA_EXEC< 512 >; check_for_all_cells_ijk< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_cells_ijk< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_cells_ijk< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -591,12 +590,12 @@ AXOM_CUDA_TEST( mint_execution_cell_traversals, for_all_cells_index ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_cells_idx< cuda_exec, STRUCTURED_UNIFORM_MESH >(i); check_for_all_cells_idx< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(i); check_for_all_cells_idx< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(i); diff --git a/src/axom/mint/tests/mint_execution_face_traversals.cpp b/src/axom/mint/tests/mint_execution_face_traversals.cpp index 810a372148..8d9c71ae94 100644 --- a/src/axom/mint/tests/mint_execution_face_traversals.cpp +++ b/src/axom/mint/tests/mint_execution_face_traversals.cpp @@ -274,12 +274,12 @@ AXOM_CUDA_TEST( mint_execution_face_traversals, for_all_face_nodeids ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_face_nodes< cuda_exec, STRUCTURED_UNIFORM_MESH >( dim ); check_for_all_face_nodes< cuda_exec, STRUCTURED_CURVILINEAR_MESH >( dim ); check_for_all_face_nodes< cuda_exec, STRUCTURED_RECTILINEAR_MESH >( dim ); @@ -319,12 +319,12 @@ AXOM_CUDA_TEST( mint_execution_face_traversals, for_all_face_coords ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_face_coords< cuda_exec, STRUCTURED_UNIFORM_MESH >( dim ); check_for_all_face_coords< cuda_exec, STRUCTURED_CURVILINEAR_MESH >( dim ); check_for_all_face_coords< cuda_exec, STRUCTURED_RECTILINEAR_MESH >( dim ); @@ -364,12 +364,12 @@ AXOM_CUDA_TEST( mint_execution_face_traversals, for_all_face_cellids ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_face_cells< cuda_exec, STRUCTURED_UNIFORM_MESH >( dim ); check_for_all_face_cells< cuda_exec, STRUCTURED_CURVILINEAR_MESH >( dim ); check_for_all_face_cells< cuda_exec, STRUCTURED_RECTILINEAR_MESH >( dim ); @@ -411,12 +411,12 @@ AXOM_CUDA_TEST( mint_execution_face_traversals, for_all_faces_index ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_faces< cuda_exec, STRUCTURED_UNIFORM_MESH >( dim ); check_for_all_faces< cuda_exec, STRUCTURED_CURVILINEAR_MESH >( dim ); check_for_all_faces< cuda_exec, STRUCTURED_RECTILINEAR_MESH >( dim ); diff --git a/src/axom/mint/tests/mint_execution_node_traversals.cpp b/src/axom/mint/tests/mint_execution_node_traversals.cpp index 460e2e9154..3256b6917a 100644 --- a/src/axom/mint/tests/mint_execution_node_traversals.cpp +++ b/src/axom/mint/tests/mint_execution_node_traversals.cpp @@ -362,12 +362,12 @@ AXOM_CUDA_TEST( mint_execution_node_traversals, for_all_nodes_xyz ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_nodes_xyz< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_nodes_xyz< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_nodes_xyz< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -406,12 +406,12 @@ AXOM_CUDA_TEST( mint_execution_node_traversals, for_all_nodes_xy ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_nodes_xy< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_nodes_xy< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_nodes_xy< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -450,12 +450,12 @@ AXOM_CUDA_TEST( mint_execution_node_traversals, for_all_nodes_x ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_nodes_x< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_nodes_x< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_nodes_x< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -489,12 +489,12 @@ AXOM_CUDA_TEST( mint_execution_node_traversals, for_all_nodes_ijk ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_nodes_ijk< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_nodes_ijk< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_nodes_ijk< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -524,12 +524,12 @@ AXOM_CUDA_TEST( mint_execution_node_traversals, for_all_nodes_ij ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_nodes_ij< cuda_exec, STRUCTURED_UNIFORM_MESH >(); check_for_all_nodes_ij< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(); check_for_all_nodes_ij< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(); @@ -569,12 +569,12 @@ AXOM_CUDA_TEST( mint_execution_node_traversals, for_all_nodes_index ) #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_UMPIRE) - const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); - const umpire::Allocator prev_allocator = axom::getDefaultAllocator(); - axom::setDefaultAllocator( axom::getAllocator( UnifiedAllocatorID ) ); - using cuda_exec = axom::CUDA_EXEC< 512 >; + + const int exec_space_id = axom::execution_space::allocatorID(); + const int prev_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( exec_space_id ); + check_for_all_nodes_idx< cuda_exec, STRUCTURED_UNIFORM_MESH >(i); check_for_all_nodes_idx< cuda_exec, STRUCTURED_CURVILINEAR_MESH >(i); check_for_all_nodes_idx< cuda_exec, STRUCTURED_RECTILINEAR_MESH >(i); From 32654f0b40a4c826d94a245ef0994a8e3d9f3e1e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 11:01:58 -0800 Subject: [PATCH 025/632] COMP: fix CUDA build --- src/axom/core/execution/internal/cuda_exec.hpp | 2 +- src/axom/core/tests/core_memory_management.cpp | 8 ++++---- src/axom/sidre/tests/sidre_view.cpp | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/axom/core/execution/internal/cuda_exec.hpp b/src/axom/core/execution/internal/cuda_exec.hpp index d404437c23..538882dfaa 100644 --- a/src/axom/core/execution/internal/cuda_exec.hpp +++ b/src/axom/core/execution/internal/cuda_exec.hpp @@ -82,7 +82,7 @@ struct execution_space< CUDA_EXEC< BLOCK_SIZE, ASYNC > > return (char*)"[CUDA_EXEC] (async)"; }; static int allocatorID() noexcept - { return axom::getResourceAllocatorID(umpire::resource::Unified); }; + { return axom::getUmpireResourceAllocatorID(umpire::resource::Unified); }; }; } /* namespace axom */ diff --git a/src/axom/core/tests/core_memory_management.cpp b/src/axom/core/tests/core_memory_management.cpp index a890d83d8e..91aec96443 100644 --- a/src/axom/core/tests/core_memory_management.cpp +++ b/src/axom/core/tests/core_memory_management.cpp @@ -325,25 +325,25 @@ TEST( core_memory_management, alloc_free ) #ifdef UMPIRE_ENABLE_PINNED const int PinnedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Pinned ); + axom::getUmpireResourceAllocatorID( umpire::resource::Pinned ); check_alloc_and_free( PinnedAllocatorID, HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_DEVICE const int DeviceAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Device ); + axom::getUmpireResourceAllocatorID( umpire::resource::Device ); check_alloc_and_free( DeviceAllocatorID, NOT_HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_CONST const int ConstantAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Constant ); + axom::getUmpireResourceAllocatorID( umpire::resource::Constant ); check_alloc_and_free( ConstantAllocatorID, NOT_HOST_ACCESSIBLE ); #endif #ifdef UMPIRE_ENABLE_UM const int UnifiedAllocatorID = - axom::getResourceAllocatorID( umpire::resource::Unified ); + axom::getUmpireResourceAllocatorID( umpire::resource::Unified ); check_alloc_and_free( UnifiedAllocatorID, HOST_ACCESSIBLE ); #endif diff --git a/src/axom/sidre/tests/sidre_view.cpp b/src/axom/sidre/tests/sidre_view.cpp index dc409d9923..6b922dba9b 100644 --- a/src/axom/sidre/tests/sidre_view.cpp +++ b/src/axom/sidre/tests/sidre_view.cpp @@ -1758,7 +1758,7 @@ TEST_P(UmpireTest, reallocate) { #if defined(AXOM_USE_CUDA) && defined(UMPIRE_ENABLE_CONST) - if (allocID == axom::getResourceAllocatorID( umpire::resource::Constant ) ) + if (allocID == axom::getUmpireResourceAllocatorID(umpire::resource::Constant)) { return; } @@ -1826,24 +1826,24 @@ TEST_P(UmpireTest, reallocate_zero) } const int allocators[] = { - axom::getUmpireResourceAllocatorID( umpire::resource::Host ) + axom::getUmpireResourceAllocatorID(umpire::resource::Host) #ifdef AXOM_USE_CUDA #ifdef UMPIRE_ENABLE_PINNED - , axom::getUmpireResourceAllocatorID( umpire::resource::Pinned ) + , axom::getUmpireResourceAllocatorID(umpire::resource::Pinned) #endif #ifdef UMPIRE_ENABLE_DEVICE - , axom::getUmpireResourceAllocatorID( umpire::resource::Device ) + , axom::getUmpireResourceAllocatorID(umpire::resource::Device) #endif #ifdef UMPIRE_ENABLE_CONST - , axom::getResourceUmpireAllocatorID( umpire::resource::Constant ) + , axom::getUmpireResourceAllocatorID(umpire::resource::Constant) #endif #ifdef UMPIRE_ENABLE_UM - , axom::getUmpireResourceAllocatorID( umpire::resource::Unified ) + , axom::getUmpireResourceAllocatorID(umpire::resource::Unified) #endif #endif /* AXOM_USE_CUDA */ From 4a89fd9f0085a67c2772abc21541362795ff537b Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 11:09:00 -0800 Subject: [PATCH 026/632] BUGIX: fix typo in sidre_group test Fix typo introduced when applying mem-management API changes. --- src/axom/sidre/tests/sidre_group.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index 07a533fa3b..fbb283d91a 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -2402,7 +2402,7 @@ TEST_P(UmpireTest, get_set_allocator) root->setDefaultAllocator(allocID); defaultAllocatorID = axom::getDefaultAllocatorID(); - ASSERT_EQ(root->getDefaultAllocatorID(), defaultAllocatorID ); + ASSERT_EQ(root->getDefaultAllocatorID(), allocID ); root->setDefaultAllocator(rm.getInstance().getAllocator(defaultAllocatorID)); ASSERT_EQ(root->getDefaultAllocator().getId(), defaultAllocatorID); From 291d2624ca04191f73a58c68708e49cef6ca624f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 23 Feb 2020 09:56:17 -0800 Subject: [PATCH 027/632] DOC: document mem-management API changes Document mem-management API changes in release notes. --- RELEASE-NOTES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 22795f5663..e4a15bc67e 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -16,6 +16,9 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ### Deprecated ### Changed +- Modified the API of Axom's memory management routines to not leak usage of Umpire. Instead of + passing an `umpire::Allocator` object to specify an allocator, we now use the corresponding + integer ID associated with the allocator. ### Fixed - Fixed usage of cuda kernel policies in Mint. Raja v0.11.0 changed the way max threads From 0a1404cd3f7cab68ac82dcd222e220871dbf2d3c Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 26 Feb 2020 16:18:57 -0800 Subject: [PATCH 028/632] STYLE: use axom::DEFAULT_ALLOCATOR_ID instead Use axom::DEFAULT_ALLOCATOR_ID instead of hard-coding 0. --- src/axom/core/execution/internal/omp_exec.hpp | 2 +- src/axom/core/execution/internal/seq_exec.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/axom/core/execution/internal/omp_exec.hpp b/src/axom/core/execution/internal/omp_exec.hpp index 14cced023c..89d116f2e8 100644 --- a/src/axom/core/execution/internal/omp_exec.hpp +++ b/src/axom/core/execution/internal/omp_exec.hpp @@ -50,7 +50,7 @@ struct execution_space< OMP_EXEC > #ifdef AXOM_USE_UMPIRE return axom::getUmpireResourceAllocatorID(umpire::resource::Host); #else - return 0; + return axom::DEFAULT_ALLOCATOR_ID; #endif }; diff --git a/src/axom/core/execution/internal/seq_exec.hpp b/src/axom/core/execution/internal/seq_exec.hpp index b9332431ad..660321bed8 100644 --- a/src/axom/core/execution/internal/seq_exec.hpp +++ b/src/axom/core/execution/internal/seq_exec.hpp @@ -58,7 +58,7 @@ struct execution_space< SEQ_EXEC > #ifdef AXOM_USE_UMPIRE return axom::getUmpireResourceAllocatorID( umpire::resource::Host ); #else - return 0; + return axom::DEFAULT_ALLOCATOR_ID; #endif }; From 3bfa040b93833dbe7b23119880ad20ac9624dc7f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 26 Feb 2020 16:26:07 -0800 Subject: [PATCH 029/632] ENH: remove unneeded AXOM_USE_UMPIRE guards --- src/axom/sidre/core/Buffer.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/axom/sidre/core/Buffer.cpp b/src/axom/sidre/core/Buffer.cpp index 190e560800..c395d54467 100644 --- a/src/axom/sidre/core/Buffer.cpp +++ b/src/axom/sidre/core/Buffer.cpp @@ -26,13 +26,10 @@ namespace sidre */ int getValidAllocatorID( int allocID ) { -#ifdef AXOM_USE_UMPIRE if ( allocID == INVALID_ALLOCATOR_ID ) { allocID = getDefaultAllocatorID(); } -#endif - return allocID; } @@ -422,11 +419,7 @@ void Buffer::detachFromAllViews() void* Buffer::allocateBytes(IndexType num_bytes, int allocID) { allocID = getValidAllocatorID(allocID); -#ifdef AXOM_USE_UMPIRE return axom::allocate(num_bytes, allocID ); -#else - return axom::allocate(num_bytes); -#endif } /* From 8b77fd566dbc5759db74e35f58539232e78e495e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 26 Feb 2020 17:08:38 -0800 Subject: [PATCH 030/632] STYLE: remove unneeded ifdef block --- src/axom/core/tests/core_memory_management.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/axom/core/tests/core_memory_management.cpp b/src/axom/core/tests/core_memory_management.cpp index 91aec96443..e8fbc3ccfe 100644 --- a/src/axom/core/tests/core_memory_management.cpp +++ b/src/axom/core/tests/core_memory_management.cpp @@ -17,10 +17,6 @@ // HELPER METHODS //------------------------------------------------------------------------------ -#ifdef AXOM_USE_UMPIRE -#else -#endif - // This value is such that the 64Kb limit on device constant memory is not hit // in check_alloc_realloc_free when reallocating to 3 * SIZE. constexpr int SIZE = 5345; From b994dd63b8e77bcd953906a845463e12671f894f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 26 Feb 2020 17:29:35 -0800 Subject: [PATCH 031/632] DOC: document how to get an umpire::Allocator Document how to retrieve the corresponding Umpire allocator given the allocator ID. --- src/axom/core/memory_management.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 39acfeed79..828293342f 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -66,13 +66,17 @@ inline void setDefaultAllocator( int allocatorID ) /*! * \brief Returns the current default memory space used. + * \note If Umpire is used, the corresponding umpire allocator can be retrieved by: + * + * umpire::Allocator alloc = umpire::ResourceManager::getInstance().getAllocator( allocID ); + * */ inline int getDefaultAllocatorID() { #ifdef AXOM_USE_UMPIRE return umpire::ResourceManager::getInstance().getDefaultAllocator().getId(); #else - return DEFAULT_ALLOCATOR_ID; + return axom::DEFAULT_ALLOCATOR_ID; #endif } From 9c1ecb5353f48dc910e9b09ba6599c9301499868 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 16 Feb 2020 20:29:17 -0800 Subject: [PATCH 032/632] ENH: define TraversalPredicates singleton This commit adds a singleton class consisting of methods that implement various traversal predicates, used in support of various queries. The singleton works directly on the internal BVHData layout to process BVH bins and is specialized for 2D and 3D. Currently, it supports point-in-bin queries. However, this provides the underlying infrastructure to easily extend the BVH for support of additional queries. This commit resolves in part #135. --- src/axom/spin/CMakeLists.txt | 1 + .../linear_bvh/TraversalPredicates.hpp | 184 ++++++++++++++++++ src/axom/spin/tests/spin_bvh.cpp | 58 ++++++ 3 files changed, 243 insertions(+) create mode 100644 src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp diff --git a/src/axom/spin/CMakeLists.txt b/src/axom/spin/CMakeLists.txt index bbc83a0955..3bc8d7dfb7 100644 --- a/src/axom/spin/CMakeLists.txt +++ b/src/axom/spin/CMakeLists.txt @@ -52,6 +52,7 @@ if ( RAJA_FOUND AND UMPIRE_FOUND ) internal/linear_bvh/math.hpp internal/linear_bvh/RadixTree.hpp internal/linear_bvh/range.hpp + internal/linear_bvh/TraversalPredicates.hpp internal/linear_bvh/vec.hpp ) diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp new file mode 100644 index 0000000000..f773df7c48 --- /dev/null +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -0,0 +1,184 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_SPIN_BVH_TRAVERSALPREDICATES_HPP_ +#define AXOM_SPIN_BVH_TRAVERSALPREDICATES_HPP_ + +#include "axom/spin/internal/linear_bvh/vec.hpp" + +namespace axom +{ +namespace spin +{ +namespace internal +{ +namespace linear_bvh +{ + +template < typename FloatType > +using VecType = internal::linear_bvh::Vec< FloatType, 4 >; + +/*! + * \brief TraversalPredicates is a singleton class that defines different + * predicates for traversing a BVH instance that operate directly on the + * BVH data layout. + * + * \see BVHData + * + * \tparam NDIMS the spatial dimension + * \tparam FloatType the floating point type precision, e.g., double or float. + */ +template < int NDIMS, typename FloatType > +class TraversalPredicates +{ + +public: + + AXOM_STATIC_ASSERT_MSG( ( (NDIMS==2) || (NDIMS==3) ), + "TraversalPredicates are defined for 2D and 3D only" ); + AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, + "A valid FloatingType must be used, e.g., double or float" ); + + ///\name Predicates for Point Queries + /// @{ + + /*! + * \brief Checks if the supplied point is within the left bin. + * + * \param [in] point the coordinates of the point in query. + * \param [in] s1 the 1st segment of the BVH that stores the left bin. + * \param [in] s2 the 2nd segment of the BVH that stores the left bin. + * + * \return status true if the point is inside the left bin, else, false. + * + */ + template < typename PointType > + AXOM_HOST_DEVICE + static inline bool pointInLeftBin( const PointType& point, + const VecType< FloatType >& s1, + const VecType< FloatType >& s2 ) noexcept; + + /*! + * \brief Checks if the supplied point is within the right bin. + * + * \param [in] point the coordinates of the point in query. + * \param [in] s2 the 2nd segment of the BVH that stores the right bin. + * \param [in] s3 the 3rd segment of the BVH that stores the right bin. + * + * \return status true if the point is inside the right bin, else, false. + */ + template < typename PointType > + AXOM_HOST_DEVICE + static inline bool pointInRightBin( const PointType& point, + const VecType< FloatType >& s2, + const VecType< FloatType >& s3 ) noexcept; + + /// @} + +}; + +constexpr int DIMENSION_2 = 2; +constexpr int DIMENSION_3 = 3; + +//------------------------------------------------------------------------------ +// 2D Specialization +//------------------------------------------------------------------------------ +template < typename FloatType > +class TraversalPredicates< DIMENSION_2, FloatType > +{ + +public: + + template < typename PointType > + AXOM_HOST_DEVICE + static inline bool pointInLeftBin( const PointType& point, + const VecType< FloatType >& s1, + const VecType< FloatType >& s2 ) noexcept + { + bool in_left = true; + if ( point[0] < s1[0] ) in_left = false; + if ( point[1] < s1[1] ) in_left = false; + + if ( point[0] > s1[3] ) in_left = false; + if ( point[1] > s2[0] ) in_left = false; + + return in_left; + } + + template < typename PointType > + AXOM_HOST_DEVICE + static inline bool pointInRightBin( const PointType& point, + const VecType< FloatType >& s2, + const VecType< FloatType >& s3 ) noexcept + { + bool in_right = true; + + if ( point[0] < s2[2] ) in_right = false; + if ( point[1] < s2[3] ) in_right = false; + + if ( point[0] > s3[1] ) in_right = false; + if ( point[1] > s3[2] ) in_right = false; + + return in_right; + } + +}; + +//------------------------------------------------------------------------------ +// 3D Specialization +//------------------------------------------------------------------------------ +template < typename FloatType > +class TraversalPredicates< DIMENSION_3, FloatType > +{ + +public: + + template < typename PointType > + AXOM_HOST_DEVICE + static inline bool pointInLeftBin( const PointType& point, + const VecType< FloatType >& s1, + const VecType< FloatType >& s2 ) noexcept + { + + bool in_left = true; + if ( point[0] < s1[0] ) in_left = false; + if ( point[1] < s1[1] ) in_left = false; + if ( point[2] < s1[2] ) in_left = false; + + if ( point[0] > s1[3] ) in_left = false; + if ( point[1] > s2[0] ) in_left = false; + if ( point[2] > s2[1] ) in_left = false; + + return in_left; + } + + template < typename PointType > + AXOM_HOST_DEVICE + static inline bool pointInRightBin( const PointType& point, + const VecType< FloatType >& s2, + const VecType< FloatType >& s3 ) noexcept + { + bool in_right = true; + + if ( point[0] < s2[2] ) in_right = false; + if ( point[1] < s2[3] ) in_right = false; + if ( point[2] < s3[0] ) in_right = false; + + if ( point[0] > s3[1] ) in_right = false; + if ( point[1] > s3[2] ) in_right = false; + if ( point[2] > s3[3] ) in_right = false; + + return in_right; + } + +}; + +} /* namespace linear_bvh */ +} /* namespace internal */ +} /* namespace spin */ +} /* namespace axom */ + + +#endif /* AXOM_SPIN_BVH_TRAVERSALPREDICATES_HPP_ */ diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 171a8a0505..2bd88903e2 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -18,6 +18,8 @@ #include "axom/spin/BVH.hpp" #include "axom/spin/UniformGrid.hpp" +#include "axom/spin/internal/linear_bvh/TraversalPredicates.hpp" + // axom/mint includes #include "axom/mint/mesh/Mesh.hpp" #include "axom/mint/mesh/UniformMesh.hpp" @@ -632,6 +634,62 @@ void check_single_box3d( ) // UNIT TESTS //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +TEST( spin_bvh, traversal_predicates_pointInLeftBin ) +{ + namespace bvh = axom::spin::internal::linear_bvh; + using TraversalPredicates2D = bvh::TraversalPredicates< 2, double >; + using TraversalPredicates3D = bvh::TraversalPredicates< 3, double >; + using VecType = bvh::Vec< double, 4 >; + + VecType in_point, out_point, s1, s2; + + in_point[ 0 ] = in_point[ 1 ] = in_point[ 2 ] = 0.5; + out_point[ 0 ] = out_point[ 1 ] = out_point[ 2 ] = 1.5; + + s1[ 0 ] = 0.; // LeftBin.xmin + s1[ 1 ] = 0.; // LeftBin.ymin + s1[ 2 ] = 0.; // LeftBin.zmin + + s1[ 3 ] = 1.; // LeftBin.xmax + s2[ 0 ] = 1.; // LeftBin.ymax + s2[ 1 ] = 1.; // LeftBin.zmax + + EXPECT_TRUE( TraversalPredicates2D::pointInLeftBin( in_point, s1, s2 ) ); + EXPECT_TRUE( TraversalPredicates3D::pointInLeftBin( in_point, s1, s2 ) ); + + EXPECT_FALSE( TraversalPredicates2D::pointInLeftBin( out_point, s1, s2 ) ); + EXPECT_FALSE( TraversalPredicates3D::pointInLeftBin( out_point, s1, s2 ) ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, traversal_predicates_pointInRightBin ) +{ + namespace bvh = axom::spin::internal::linear_bvh; + using TraversalPredicates2D = bvh::TraversalPredicates< 2, double >; + using TraversalPredicates3D = bvh::TraversalPredicates< 3, double >; + using VecType = bvh::Vec< double, 4 >; + + VecType in_point, out_point, s2, s3; + + in_point[ 0 ] = in_point[ 1 ] = in_point[ 2 ] = 0.5; + out_point[ 0 ] = out_point[ 1 ] = out_point[ 2 ] = 1.5; + + s2[ 2 ] = 0.; // RightBin.xmin + s2[ 3 ] = 0.; // RightBin.ymin + s3[ 0 ] = 0.; // RightBin.zmin + + s3[ 1 ] = 1.; // RightBin.xmax + s3[ 2 ] = 1.; // RightBin.ymax + s3[ 3 ] = 1.; // RightBin.zmax + + EXPECT_TRUE( TraversalPredicates2D::pointInRightBin( in_point, s2, s3 ) ); + EXPECT_TRUE( TraversalPredicates3D::pointInRightBin( in_point, s2, s3 ) ); + + EXPECT_FALSE( TraversalPredicates2D::pointInRightBin( out_point, s2, s3 ) ); + EXPECT_FALSE( TraversalPredicates3D::pointInRightBin( out_point, s2, s3 ) ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, contruct2D_sequential ) { From 1b98102aa7c57708780d5a9bae18b8dbb9868263 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 3 Sep 2019 10:19:43 -0700 Subject: [PATCH 033/632] ENH: generic BVH traversal routine This commit adds a generic routine for traversing the BVH where the inLeft, inRight predicates, as well as, the leaf node action is prescribed by the caller as a lambda or functor. This enables to minimize the code duplication in the BVH::find() routine and streamlines the extension of the BVH to support additional queries. This commit resolves in part #135. --- .../spin/internal/linear_bvh/bvh_traverse.hpp | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 src/axom/spin/internal/linear_bvh/bvh_traverse.hpp diff --git a/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp b/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp new file mode 100644 index 0000000000..b39989659b --- /dev/null +++ b/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp @@ -0,0 +1,148 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_SPIN_BVH_TRAVERSE_HPP_ +#define AXOM_SPIN_BVH_TRAVERSE_HPP_ + +#include "axom/config.hpp" // compile-time definitions +#include "axom/core/Macros.hpp" // for AXOM_HOST_DEVICE +#include "axom/core/Types.hpp" // for axom types +#include "axom/slic.hpp" // for SLIC macros + +#include "axom/spin/internal/linear_bvh/BVHData.hpp" + +namespace axom +{ +namespace spin +{ +namespace internal +{ +namespace linear_bvh +{ + +/*! + * \brief Checks if the node corresponding to the given node ID is a leaf node. + * \param [in] nodeIdx index of the BVH node in query. + * \return status true if the node is a leaf node, otherwise, false. + */ +AXOM_HOST_DEVICE +inline bool leaf_node( const int32& nodeIdx ) +{ + return ( nodeIdx < 0 ); +} + +/*! + * \brief Generic BVH traversal routine. + * + * \param [in] inner_nodes pointer to the BVH bins. + * \param [in] leaf_nodes pointer to the leaf node IDs. + * \param [in] p the primitive in query, e.g., a point, ray, etc. + * \param [in] L functor that defines the check for the left bin + * \param [in] R functor that defines the check for right bin + * \param [in] A functor that defines the leaf action + * + * \note The supplied functors, `L`, `R`, are expected to take the following + * three arguments: + * (1) The supplied primitive, p + * (2) a Vec< FloatType, 4 > of the first segment that defines the BVH bin + * (3) a Vec< FloatType, 4 > of the second segment that defines the BVH bin + * + * \see BVHData for the details on the internal data layout of the BVH. + * + * \note Moreover, the functors `L`, `R` return a boolean status that indicates + * if the specified traversal predicate is satisfied. + * + * \see TraversalPredicates for the collection of defined predicates. + */ +template< typename FloatType, + typename PrimitiveType, + typename InLeftCheck, + typename InRightCheck, + typename LeafAction > +AXOM_HOST_DEVICE +inline void bvh_traverse( const Vec< FloatType,4>* inner_nodes, + const int32* leaf_nodes, + const PrimitiveType& p, + InLeftCheck&& L, + InRightCheck&& R, + LeafAction&& A ) +{ + using vec4_t = Vec< FloatType, 4 >; + + // setup stack + constexpr int32 ISIZE = sizeof(int32); + constexpr int32 STACK_SIZE = 64; + constexpr int32 BARRIER = -2000000000; + int32 todo[ STACK_SIZE ]; + int32 stackptr = 0; + todo[ stackptr ] = BARRIER; + + int32 current_node = 0; + while ( current_node != BARRIER ) + { + + if ( !leaf_node( current_node ) ) + { + const vec4_t first4 = inner_nodes[current_node + 0]; + const vec4_t second4 = inner_nodes[current_node + 1]; + const vec4_t third4 = inner_nodes[current_node + 2]; + + const bool in_left = L( p, first4, second4 ); + const bool in_right = R( p, second4, third4 ); + + if ( !in_left && !in_right ) + { + // pop the stack and continue + current_node = todo[ stackptr ]; + stackptr--; + } + else + { + vec4_t children = inner_nodes[current_node + 3]; + + // memcpy the int bits hidden in the floats + int32 l_child; + memcpy(&l_child, &children[0], ISIZE); + int32 r_child; + memcpy(&r_child, &children[1], ISIZE); + + current_node = (in_left) ? l_child : r_child; + + if (in_left && in_right) + { + stackptr++; + todo[stackptr] = r_child; + // TODO: if we are in both children we could + // go down the "closer" first by perhaps the distance + // from the point to the center of the aabb + } + + } // END else + + } // END if + else + { + // compute leaf index + current_node = -current_node - 1; // swap the neg address + + // execute leaf action + A( current_node, leaf_nodes ); + + current_node = todo[stackptr]; + stackptr--; + } // END else + + } // END while + +} + +} /* namespace linear_bvh */ +} /* namespace internal */ +} /* namespace spin */ +} /* namespace axom */ + + + +#endif /* AXOM_SPIN_BVH_TRAVERSE_HPP_ */ From c190edb540d872baa2cc7cdbeec1dd693e1c1683 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 20 Feb 2020 09:09:51 -0800 Subject: [PATCH 034/632] ENH: use generic BVH traversal in BVH::find() Modify BVH::find() to use the generic BVH traversal routine. Using the generic BVH traversal alleviates some of the code duplication used in traversing the BVH. This commit resolves in part #135. --- src/axom/spin/BVH.hpp | 424 +++++++++++------------------------------- 1 file changed, 112 insertions(+), 312 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index bb1ec6bd89..f412c90dd9 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -21,10 +21,12 @@ // spin includes #include "axom/spin/internal/linear_bvh/aabb.hpp" #include "axom/spin/internal/linear_bvh/vec.hpp" +#include "axom/spin/internal/linear_bvh/bvh_traverse.hpp" #include "axom/spin/internal/linear_bvh/bvh_vtkio.hpp" #include "axom/spin/internal/linear_bvh/BVHData.hpp" #include "axom/spin/internal/linear_bvh/emit_bvh.hpp" #include "axom/spin/internal/linear_bvh/build_radix_tree.hpp" +#include "axom/spin/internal/linear_bvh/TraversalPredicates.hpp" // C/C++ includes #include // for std::ofstream @@ -271,88 +273,6 @@ class BVH DISABLE_MOVE_AND_ASSIGNMENT(BVH); }; -//------------------------------------------------------------------------------ -// BVH IMPLEMENTATION HELPER METHODS -//------------------------------------------------------------------------------ -namespace -{ - -//------------------------------------------------------------------------------ -template< typename FloatType > -AXOM_HOST_DEVICE -bool InLeft( const internal::linear_bvh::Vec< FloatType, 3>& point, - const internal::linear_bvh::Vec< FloatType, 4>& s1, - const internal::linear_bvh::Vec< FloatType, 4>& s2 ) -{ - bool in_left = true; - if ( point[0] < s1[0] ) in_left = false; - if ( point[1] < s1[1] ) in_left = false; - if ( point[2] < s1[2] ) in_left = false; - - if ( point[0] > s1[3] ) in_left = false; - if ( point[1] > s2[0] ) in_left = false; - if ( point[2] > s2[1] ) in_left = false; - - return in_left; -} - -//------------------------------------------------------------------------------ -template< typename FloatType > -AXOM_HOST_DEVICE -bool InLeft( const internal::linear_bvh::Vec< FloatType, 2>& point, - const internal::linear_bvh::Vec< FloatType, 4>& s1, - const internal::linear_bvh::Vec< FloatType, 4>& s2 ) -{ - bool in_left = true; - if ( point[0] < s1[0] ) in_left = false; - if ( point[1] < s1[1] ) in_left = false; - - if ( point[0] > s1[3] ) in_left = false; - if ( point[1] > s2[0] ) in_left = false; - - return in_left; -} - -//------------------------------------------------------------------------------ -template< typename FloatType > -AXOM_HOST_DEVICE -bool InRight( const internal::linear_bvh::Vec< FloatType, 3>& point, - const internal::linear_bvh::Vec< FloatType, 4>& s2, - const internal::linear_bvh::Vec< FloatType, 4>& s3 ) -{ - bool in_right = true; - - if ( point[0] < s2[2] ) in_right = false; - if ( point[1] < s2[3] ) in_right = false; - if ( point[2] < s3[0] ) in_right = false; - - if ( point[0] > s3[1] ) in_right = false; - if ( point[1] > s3[2] ) in_right = false; - if ( point[2] > s3[3] ) in_right = false; - - return in_right; -} - -//------------------------------------------------------------------------------ -template< typename FloatType > -AXOM_HOST_DEVICE -bool InRight( const internal::linear_bvh::Vec< FloatType, 2>& point, - const internal::linear_bvh::Vec< FloatType, 4>& s2, - const internal::linear_bvh::Vec< FloatType, 4>& s3 ) -{ - bool in_right = true; - - if ( point[0] < s2[2] ) in_right = false; - if ( point[1] < s2[3] ) in_right = false; - - if ( point[0] > s3[1] ) in_right = false; - if ( point[1] > s3[2] ) in_right = false; - - return in_right; -} - -} - //------------------------------------------------------------------------------ // BVH IMPLEMENTATION //------------------------------------------------------------------------------ @@ -470,9 +390,12 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); - // STEP 1: count number of candidates for each query point - using vec4_t = internal::linear_bvh::Vec< FloatType, 4 >; + namespace bvh = internal::linear_bvh; + using vec4_t = bvh::Vec< FloatType, 4 >; + using point_t = bvh::Vec< FloatType, NDIMS >; + using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; + // STEP 1: count number of candidates for each query point const vec4_t* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); @@ -485,67 +408,34 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, for_all< ExecSpace >( numPts, AXOM_LAMBDA(IndexType i) { int32 count = 0; - internal::linear_bvh::Vec< FloatType, NDIMS > point; + point_t point; point[0] = x[i]; point[1] = y[i]; point[2] = z[i]; - int32 current_node = 0; - int32 todo[64]; - int32 stackptr = 0; - - constexpr int32 barrier = -2000000000; - todo[stackptr] = barrier; - while (current_node != barrier) - { - if (current_node > -1) - { - const vec4_t first4 = inner_nodes[current_node + 0]; - const vec4_t second4 = inner_nodes[current_node + 1]; - const vec4_t third4 = inner_nodes[current_node + 2]; - - const bool in_left = InLeft( point, first4, second4 ); - const bool in_right = InRight( point, second4, third4 ); - - if (!in_left && !in_right) - { - // pop the stack and continue - current_node = todo[stackptr]; - stackptr--; - } - else - { - vec4_t children = inner_nodes[current_node + 3]; - int32 l_child; - constexpr int32 isize = sizeof(int32); - // memcpy the int bits hidden in the floats - memcpy(&l_child, &children[0], isize); - int32 r_child; - memcpy(&r_child, &children[1], isize); - - current_node = (in_left) ? l_child : r_child; - - if (in_left && in_right) - { - stackptr++; - todo[stackptr] = r_child; - // TODO: if we are in both children we could - // go down the "closer" first by perhaps the distance - // from the point to the center of the aabb - } - - } // END else - - } // END if - else - { - // leaf node - count++; - current_node = todo[stackptr]; - stackptr--; - } - - } // while + auto leftPredicate = []( const point_t& p, + const vec4_t& s1, + const vec4_t& s2 ) -> bool { + return TraversalPredicates::pointInLeftBin( p, s1, s2 ); + }; + + auto rightPredicate = []( const point_t& p, + const vec4_t& s2, + const vec4_t& s3 ) -> bool { + return TraversalPredicates::pointInRightBin( p, s2, s3 ); + }; + + auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { + count++; + }; + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); counts[ i ] = count; total_count += count; @@ -564,66 +454,35 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, { int32 offset = offsets[ i ]; - internal::linear_bvh::Vec< FloatType,NDIMS > point; + point_t point; point[0] = x[i]; point[1] = y[i]; point[2] = z[i]; - int32 current_node = 0; - int32 todo[64]; - int32 stackptr = 0; + auto leftPredicate = []( const point_t& p, + const vec4_t& s1, + const vec4_t& s2 ) -> bool { + return TraversalPredicates::pointInLeftBin( p, s1, s2 ); + }; - constexpr int32 barrier = -2000000000; - todo[stackptr] = barrier; - while (current_node != barrier) - { - if (current_node > -1) - { - const vec4_t first4 = inner_nodes[current_node + 0]; - const vec4_t second4 = inner_nodes[current_node + 1]; - const vec4_t third4 = inner_nodes[current_node + 2]; - - const bool in_left = InLeft( point, first4, second4 ); - const bool in_right = InRight( point, second4, third4 ); - - if (!in_left && !in_right) - { - // pop the stack and continue - current_node = todo[stackptr]; - stackptr--; - } - else - { - vec4_t children = inner_nodes[current_node + 3]; - int32 l_child; - constexpr int32 isize = sizeof(int32); - // memcpy the int bits hidden in the floats - memcpy(&l_child, &children[0], isize); - int32 r_child; - memcpy(&r_child, &children[1], isize); - - current_node = (in_left) ? l_child : r_child; - - if (in_left && in_right) - { - stackptr++; - todo[stackptr] = r_child; - // TODO: if we are in both children we could - // go down the "closer" first by perhaps the distance - // from the point to the center of the aabb - } - } - } - else - { - current_node = -current_node - 1; //swap the neg address - candidates[offset] = leaf_nodes[current_node]; - offset++; - current_node = todo[stackptr]; - stackptr--; - } - - } // while + auto rightPredicate = []( const point_t& p, + const vec4_t& s2, + const vec4_t& s3 ) -> bool { + return TraversalPredicates::pointInRightBin( p, s2, s3 ); + }; + + auto leafAction = [=,&offset]( int32 current_node, const int32* leaf_nodes ) -> void { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; + + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); } ); @@ -654,6 +513,11 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); + namespace bvh = internal::linear_bvh; + using vec4_t = bvh::Vec< FloatType, 4 >; + using point_t = bvh::Vec< FloatType, NDIMS >; + using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; + // STEP 1: count number of candidates for each query point const internal::linear_bvh::Vec< FloatType, 4> *inner_nodes = m_bvh.m_inner_nodes; const int32 *leaf_nodes = m_bvh.m_leaf_nodes; @@ -669,69 +533,36 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) { int32 count = 0; - internal::linear_bvh::Vec< FloatType, NDIMS > point; + point_t point; point[0] = x[i]; point[1] = y[i]; - int32 current_node = 0; - int32 todo[64]; - int32 stackptr = 0; - - constexpr int32 barrier = -2000000000; - todo[stackptr] = barrier; - while (current_node != barrier) - { - if (current_node > -1) - { - const vec4_t first4 = inner_nodes[current_node + 0]; - const vec4_t second4 = inner_nodes[current_node + 1]; - const vec4_t third4 = inner_nodes[current_node + 2]; - - const bool in_left = InLeft( point, first4, second4 ); - const bool in_right = InRight( point, second4, third4 ); - - if (!in_left && !in_right) - { - // pop the stack and continue - current_node = todo[stackptr]; - stackptr--; - } - else - { - vec4_t children = inner_nodes[current_node + 3]; - int32 l_child; - constexpr int32 isize = sizeof(int32); - // memcpy the int bits hidden in the floats - memcpy(&l_child, &children[0], isize); - int32 r_child; - memcpy(&r_child, &children[1], isize); - - current_node = (in_left) ? l_child : r_child; - - if (in_left && in_right) - { - stackptr++; - todo[stackptr] = r_child; - // TODO: if we are in both children we could - // go down the "closer" first by perhaps the distance - // from the point to the center of the aabb - } - - } // END else - - } // END if - else - { - // leaf node - count++; - current_node = todo[stackptr]; - stackptr--; - } - - } // while - - counts[ i ] = count; - total_count += count; + auto leftPredicate = []( const point_t& p, + const vec4_t& s1, + const vec4_t& s2 ) -> bool { + return TraversalPredicates::pointInLeftBin( p, s1, s2 ); + }; + + auto rightPredicate = []( const point_t& p, + const vec4_t& s2, + const vec4_t& s3 ) -> bool { + return TraversalPredicates::pointInRightBin( p, s2, s3 ); + }; + + auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { + count++; + }; + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); + + counts[ i ] = count; + total_count += count; } ); @@ -748,65 +579,34 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, { int32 offset = offsets[ i ]; - internal::linear_bvh::Vec< FloatType,NDIMS > point; + point_t point; point[0] = x[i]; point[1] = y[i]; - int32 current_node = 0; - int32 todo[64]; - int32 stackptr = 0; - - constexpr int32 barrier = -2000000000; - todo[stackptr] = barrier; - while (current_node != barrier) - { - if (current_node > -1) - { - const vec4_t first4 = inner_nodes[current_node + 0]; - const vec4_t second4 = inner_nodes[current_node + 1]; - const vec4_t third4 = inner_nodes[current_node + 2]; - - const bool in_left = InLeft( point, first4, second4 ); - const bool in_right = InRight( point, second4, third4 ); - - if (!in_left && !in_right) - { - // pop the stack and continue - current_node = todo[stackptr]; - stackptr--; - } - else - { - vec4_t children = inner_nodes[current_node + 3]; - int32 l_child; - constexpr int32 isize = sizeof(int32); - // memcpy the int bits hidden in the floats - memcpy(&l_child, &children[0], isize); - int32 r_child; - memcpy(&r_child, &children[1], isize); - - current_node = (in_left) ? l_child : r_child; - - if (in_left && in_right) - { - stackptr++; - todo[stackptr] = r_child; - // TODO: if we are in both children we could - // go down the "closer" first by perhaps the distance - // from the point to the center of the aabb - } - } - } - else - { - current_node = -current_node - 1; //swap the neg address - candidates[offset] = leaf_nodes[current_node]; - offset++; - current_node = todo[stackptr]; - stackptr--; - } - - } // while + auto leftPredicate = []( const point_t& p, + const vec4_t& s1, + const vec4_t& s2 ) -> bool { + return TraversalPredicates::pointInLeftBin( p, s1, s2 ); + }; + + auto rightPredicate = []( const point_t& p, + const vec4_t& s2, + const vec4_t& s3 ) -> bool { + return TraversalPredicates::pointInRightBin( p, s2, s3 ); + }; + + auto leafAction = [=,&offset]( int32 current_node, const int32* leaf_nodes ) -> void { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; + + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); } ); From 226ac510283398190bab4bb7d765cf001cdcc89e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 20 Feb 2020 11:26:12 -0800 Subject: [PATCH 035/632] ENH: hoist out definition of predicate functors Hoist out the definition of the traversal predicate functors. Allows to resuse the predicates during the counting pass and the find phase, instead of redefining them. --- src/axom/spin/BVH.hpp | 89 ++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 56 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index f412c90dd9..5affe23134 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -401,6 +401,18 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); + // STEP 2: define traversal predicates + auto leftPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, + const vec4_t& s1, + const vec4_t& s2 ) -> bool + { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; + + auto rightPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, + const vec4_t& s2, + const vec4_t& s3 ) -> bool + { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; + + // STEP 3: get counts using reduce_policy = typename axom::execution_space< ExecSpace >::reduce_policy; RAJA::ReduceSum< reduce_policy, IndexType > total_count( 0 ); @@ -413,17 +425,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, point[1] = y[i]; point[2] = z[i]; - auto leftPredicate = []( const point_t& p, - const vec4_t& s1, - const vec4_t& s2 ) -> bool { - return TraversalPredicates::pointInLeftBin( p, s1, s2 ); - }; - - auto rightPredicate = []( const point_t& p, - const vec4_t& s2, - const vec4_t& s3 ) -> bool { - return TraversalPredicates::pointInRightBin( p, s2, s3 ); - }; auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { @@ -437,8 +438,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, rightPredicate, leafAction ); - counts[ i ] = count; - total_count += count; + counts[ i ] = count; + total_count += count; } ); @@ -449,7 +450,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, IndexType total_candidates = static_cast< IndexType >( total_count.get() ); candidates = axom::allocate< IndexType >( total_candidates); - // STEP 2: fill in candidates for each point + // STEP 4: fill in candidates for each point for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) { int32 offset = offsets[ i ]; @@ -459,19 +460,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, point[1] = y[i]; point[2] = z[i]; - auto leftPredicate = []( const point_t& p, - const vec4_t& s1, - const vec4_t& s2 ) -> bool { - return TraversalPredicates::pointInLeftBin( p, s1, s2 ); - }; - - auto rightPredicate = []( const point_t& p, - const vec4_t& s2, - const vec4_t& s3 ) -> bool { - return TraversalPredicates::pointInRightBin( p, s2, s3 ); - }; - - auto leafAction = [=,&offset]( int32 current_node, const int32* leaf_nodes ) -> void { + auto leafAction = [=,&offset]( int32 current_node, + const int32* leaf_nodes ) -> void { candidates[offset] = leaf_nodes[current_node]; offset++; }; @@ -519,13 +509,23 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; // STEP 1: count number of candidates for each query point - const internal::linear_bvh::Vec< FloatType, 4> *inner_nodes = m_bvh.m_inner_nodes; - const int32 *leaf_nodes = m_bvh.m_leaf_nodes; + const vec4_t* inner_nodes = m_bvh.m_inner_nodes; + const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); - using vec4_t = internal::linear_bvh::Vec< FloatType, 4 >; + // STEP 2: define traversal predicates + auto leftPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, + const vec4_t& s1, + const vec4_t& s2 ) -> bool + { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; + auto rightPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, + const vec4_t& s2, + const vec4_t& s3 ) -> bool + { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; + + // STEP 3: get counts using reduce_policy = typename axom::execution_space< ExecSpace >::reduce_policy; RAJA::ReduceSum< reduce_policy, IndexType > total_count( 0 ); @@ -537,18 +537,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, point[0] = x[i]; point[1] = y[i]; - auto leftPredicate = []( const point_t& p, - const vec4_t& s1, - const vec4_t& s2 ) -> bool { - return TraversalPredicates::pointInLeftBin( p, s1, s2 ); - }; - - auto rightPredicate = []( const point_t& p, - const vec4_t& s2, - const vec4_t& s3 ) -> bool { - return TraversalPredicates::pointInRightBin( p, s2, s3 ); - }; - auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { count++; @@ -574,7 +562,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, candidates = axom::allocate< IndexType >( total_candidates); - // STEP 2: fill in candidates for each point + // STEP 4: fill in candidates for each point for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) { int32 offset = offsets[ i ]; @@ -583,19 +571,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, point[0] = x[i]; point[1] = y[i]; - auto leftPredicate = []( const point_t& p, - const vec4_t& s1, - const vec4_t& s2 ) -> bool { - return TraversalPredicates::pointInLeftBin( p, s1, s2 ); - }; - - auto rightPredicate = []( const point_t& p, - const vec4_t& s2, - const vec4_t& s3 ) -> bool { - return TraversalPredicates::pointInRightBin( p, s2, s3 ); - }; - - auto leafAction = [=,&offset]( int32 current_node, const int32* leaf_nodes ) -> void { + auto leafAction = [=,&offset]( int32 current_node, + const int32* leaf_nodes ) -> void { candidates[offset] = leaf_nodes[current_node]; offset++; }; From b3b5552308b8a71b9ad24add97bf4c249ab38989 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 20 Feb 2020 17:41:41 -0800 Subject: [PATCH 036/632] ENH: add QueryAccessor singleton class This commit adds a QueryAccessor singleton class to abstract away the access of different query types, e.g., points, rays, etc. --- src/axom/spin/CMakeLists.txt | 1 + .../internal/linear_bvh/QueryAccessor.hpp | 131 ++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 src/axom/spin/internal/linear_bvh/QueryAccessor.hpp diff --git a/src/axom/spin/CMakeLists.txt b/src/axom/spin/CMakeLists.txt index 3bc8d7dfb7..b747641624 100644 --- a/src/axom/spin/CMakeLists.txt +++ b/src/axom/spin/CMakeLists.txt @@ -50,6 +50,7 @@ if ( RAJA_FOUND AND UMPIRE_FOUND ) internal/linear_bvh/BVHData.hpp internal/linear_bvh/emit_bvh.hpp internal/linear_bvh/math.hpp + internal/linear_bvh/QueryAccessor.hpp internal/linear_bvh/RadixTree.hpp internal/linear_bvh/range.hpp internal/linear_bvh/TraversalPredicates.hpp diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp new file mode 100644 index 0000000000..814a86ee23 --- /dev/null +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -0,0 +1,131 @@ +// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_SPIN_BVH_QUERYACCESSOR_HPP_ +#define AXOM_SPIN_BVH_QUERYACCESSOR_HPP_ + +#include "axom/core/Macros.hpp" // for axom macros +#include "axom/core/Types.hpp" // for axom::IndexType + +// C/C++ includes +#include // for std::is_floating_point() + +namespace axom +{ +namespace spin +{ +namespace internal +{ +namespace linear_bvh +{ + +/*! + * \brief QueryAccessor is a singleton class consisting of methods to extract + * the query input information for different input types, e.g., points, rays, + * etc. + * + * \tparam NDIMS the spatial dimension + * \tparam FloatType the floating point precision, e.g., double or float + * + * \pre NDIMS==2 || NDIMS==3 + * \pre std::is_floating_point< FloatType >::value + */ +template < int NDIMS, typename FloatType > +class QueryAccessor +{ +public: + + AXOM_STATIC_ASSERT_MSG( ( (NDIMS==2) || (NDIMS==3) ), + "TraversalPredicates are defined for 2D and 3D only" ); + AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, + "A valid FloatingType must be used, e.g., double or float" ); + + /// \name Query Point Access methods + /// @{ + + /*! + * \brief Gets the coordinates of a query point from the supplied coordinates. + * + * \param [out] point the point where to pack the coordinates + * \param [in] idx the index of the query point w.r.t. the supplied arrays. + * \param [in] x user-supplied array of x-coordinates + * \param [in] y user-supplied array of y-coordinates + * \param [in] z user-supplied array of z-coordinates (3D only) + * + * \tparam PointType the data-structure to hold a point. + * + * \note The PointType must overload the `[]` operator for accessing the + * point coordinates. + */ + template < typename PointType > + AXOM_HOST_DEVICE + static inline void getPoint( PointType& point, + IndexType idx, + const FloatType* x, + const FloatType* y, + const FloatType* z ); + + /// @} +}; + +//------------------------------------------------------------------------------ +// 2D Specialization +//------------------------------------------------------------------------------ +template < typename FloatType > +class QueryAccessor< 2, FloatType > +{ +public: + + template < typename PointType > + AXOM_HOST_DEVICE + static inline void getPoint( PointType& point, + IndexType idx, + const FloatType* x, + const FloatType* y, + const FloatType* AXOM_NOT_USED(z) ) + { + SLIC_ASSERT( x != nullptr ); + SLIC_ASSERT( y != nullptr ); + point[ 0 ] = x[ idx ]; + point[ 1 ] = y[ idx ]; + } + +}; + +//------------------------------------------------------------------------------ +// 3D Specialization +//------------------------------------------------------------------------------ +template < typename FloatType > +class QueryAccessor< 3, FloatType > +{ +public: + + template < typename PointType > + AXOM_HOST_DEVICE + static inline void getPoint( PointType& point, + IndexType idx, + const FloatType* x, + const FloatType* y, + const FloatType* z ) + { + SLIC_ASSERT( x != nullptr ); + SLIC_ASSERT( y != nullptr ); + SLIC_ASSERT( z != nullptr ); + point[ 0 ] = x[ idx ]; + point[ 1 ] = y[ idx ]; + point[ 2 ] = z[ idx ]; + } + +}; + + +} /* namespace linear_bvh */ +} /* namespace internal */ +} /* namespace spin */ +} /* namespace axom */ + + + +#endif /* AXOM_SPIN_BVH_QUERYACCESSOR_HPP_ */ From f6819b03d36f56e5725716beaca29e7a368148f1 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 20 Feb 2020 12:31:35 -0800 Subject: [PATCH 037/632] ENH: centralize the getCounts() pass for the find --- src/axom/spin/BVH.hpp | 157 ++++++++++++++++++++++++++---------------- 1 file changed, 97 insertions(+), 60 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 5affe23134..beb09278a4 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -20,13 +20,14 @@ // spin includes #include "axom/spin/internal/linear_bvh/aabb.hpp" -#include "axom/spin/internal/linear_bvh/vec.hpp" +#include "axom/spin/internal/linear_bvh/build_radix_tree.hpp" #include "axom/spin/internal/linear_bvh/bvh_traverse.hpp" #include "axom/spin/internal/linear_bvh/bvh_vtkio.hpp" #include "axom/spin/internal/linear_bvh/BVHData.hpp" #include "axom/spin/internal/linear_bvh/emit_bvh.hpp" -#include "axom/spin/internal/linear_bvh/build_radix_tree.hpp" +#include "axom/spin/internal/linear_bvh/QueryAccessor.hpp" #include "axom/spin/internal/linear_bvh/TraversalPredicates.hpp" +#include "axom/spin/internal/linear_bvh/vec.hpp" // C/C++ includes #include // for std::ofstream @@ -258,6 +259,26 @@ class BVH private: + /*! + * \brief Makes a BVH traversal and counts the number of candidates for each + * query point. + * + * \param [in] N the total number of points + * \param [out] counts array of length N consisting of the candidate count + * \param [in] leftCheck + * \param [in] rightCheck + * + * \return + */ + template < typename LeftPredicateType, typename RightPredicateType > + IndexType getCounts( LeftPredicateType&& leftCheck, + RightPredicateType&& rightCheck, + IndexType N, + IndexType* counts, + const FloatType* x, + const FloatType* y, + const FloatType* z = nullptr ) const; + /// \name Private Members /// @{ @@ -276,6 +297,74 @@ class BVH //------------------------------------------------------------------------------ // BVH IMPLEMENTATION //------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// PRIVATE HELPER METHOD IMPLEMENTATION +//------------------------------------------------------------------------------ + +template < int NDIMS, typename ExecSpace, typename FloatType > +template < typename LeftPredicate, typename RightPredicate > +IndexType BVH< NDIMS, ExecSpace, FloatType >::getCounts( + LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + IndexType N, + IndexType* counts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) const +{ + // sanity checks + SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); + SLIC_ERROR_IF( x == nullptr, "supplied null pointer for x-coordinates!" ); + SLIC_ERROR_IF( y == nullptr, "supplied null pointer for y-coordinates!" ); + SLIC_ERROR_IF( (z==nullptr && NDIMS==3), + "supplied null pointer for z-coordinates!" ); + + namespace bvh = internal::linear_bvh; + using vec4_t = bvh::Vec< FloatType, 4 >; + using point_t = bvh::Vec< FloatType, NDIMS >; + + // STEP 1: count number of candidates for each query point + const vec4_t* inner_nodes = m_bvh.m_inner_nodes; + const int32* leaf_nodes = m_bvh.m_leaf_nodes; + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + + using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; + RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); + + using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; + for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) + { + int32 count = 0; + point_t point; + QueryAccessor::getPoint( point, i, x, y, z ); + + + auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { + count++; + }; + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftCheck, + rightCheck, + leafAction ); + + counts[ i ] = count; + total_count += count; + + } ); + + return ( total_count.get() ); +} + +//------------------------------------------------------------------------------ +// PUBLIC API IMPLEMENTATION +//------------------------------------------------------------------------------ + template< int NDIMS, typename ExecSpace, typename FloatType > BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, IndexType numItems ) : @@ -413,41 +502,14 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; // STEP 3: get counts - using reduce_policy = - typename axom::execution_space< ExecSpace >::reduce_policy; - RAJA::ReduceSum< reduce_policy, IndexType > total_count( 0 ); - - for_all< ExecSpace >( numPts, AXOM_LAMBDA(IndexType i) - { - int32 count = 0; - point_t point; - point[0] = x[i]; - point[1] = y[i]; - point[2] = z[i]; - - - auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { - count++; - }; - - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftPredicate, - rightPredicate, - leafAction ); - - counts[ i ] = count; - total_count += count; - - } ); + int total_count = getCounts( + leftPredicate, rightPredicate, numPts, counts, x, y, z ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; RAJA::exclusive_scan< exec_policy >( counts, counts+numPts, offsets, RAJA::operators::plus{} ); - IndexType total_candidates = static_cast< IndexType >( total_count.get() ); + IndexType total_candidates = static_cast< IndexType >( total_count ); candidates = axom::allocate< IndexType >( total_candidates); // STEP 4: fill in candidates for each point @@ -526,39 +588,14 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; // STEP 3: get counts - using reduce_policy = - typename axom::execution_space< ExecSpace >::reduce_policy; - RAJA::ReduceSum< reduce_policy, IndexType > total_count( 0 ); - - for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) - { - int32 count = 0; - point_t point; - point[0] = x[i]; - point[1] = y[i]; - - auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { - count++; - }; - - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftPredicate, - rightPredicate, - leafAction ); - - counts[ i ] = count; - total_count += count; - - } ); + int total_count = getCounts( + leftPredicate, rightPredicate, numPts, counts, x, y, nullptr ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; RAJA::exclusive_scan< exec_policy >( counts, counts+numPts, offsets, RAJA::operators::plus{} ); - IndexType total_candidates = static_cast< IndexType >( total_count.get() ); + IndexType total_candidates = static_cast< IndexType >( total_count ); candidates = axom::allocate< IndexType >( total_candidates); From f9429ef6eaa069703bf87ed7540ec666408b9932 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 21 Feb 2020 09:47:56 -0800 Subject: [PATCH 038/632] ENH: unify BVH::find() for 2D and 3D No longer needed to specialize BVH::find() for 2D and 3D. --- src/axom/spin/BVH.hpp | 99 +++---------------------------------------- 1 file changed, 5 insertions(+), 94 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index beb09278a4..1d665a80d5 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -242,13 +242,11 @@ class BVH * \pre y != nullptr if dimension==2 || dimension==3 * \pre z != nullptr if dimension==3 */ - /// @{ - void find( IndexType* offsets, IndexType* counts, IndexType*& candidates, - IndexType numPts, const FloatType* x, const FloatType* y ) const; void find( IndexType* offsets, IndexType* counts, IndexType*& candidates, IndexType numPts, - const FloatType* x, const FloatType* y, const FloatType* z ) const; - /// @} + const FloatType* x, + const FloatType* y, + const FloatType* z=nullptr ) const; /*! * \brief Writes the BVH to the specified VTK file for visualization. @@ -483,6 +481,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, using vec4_t = bvh::Vec< FloatType, 4 >; using point_t = bvh::Vec< FloatType, NDIMS >; using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; + using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; // STEP 1: count number of candidates for each query point const vec4_t* inner_nodes = m_bvh.m_inner_nodes; @@ -518,95 +517,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, int32 offset = offsets[ i ]; point_t point; - point[0] = x[i]; - point[1] = y[i]; - point[2] = z[i]; - - auto leafAction = [=,&offset]( int32 current_node, - const int32* leaf_nodes ) -> void { - candidates[offset] = leaf_nodes[current_node]; - offset++; - }; - - - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftPredicate, - rightPredicate, - leafAction ); - - } ); - - // STEP 3: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); -} - -//------------------------------------------------------------------------------ -template< int NDIMS, typename ExecSpace, typename FloatType > -void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, - IndexType* counts, - IndexType*& candidates, - IndexType numPts, - const FloatType* x, - const FloatType* y ) const -{ - AXOM_STATIC_ASSERT_MSG( NDIMS==2, - "The 2D version of find() must be called on a 2D BVH" ); - - SLIC_ASSERT( offsets != nullptr ); - SLIC_ASSERT( counts != nullptr ); - SLIC_ASSERT( candidates == nullptr ); - SLIC_ASSERT( x != nullptr ); - SLIC_ASSERT( y != nullptr ); - - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - - namespace bvh = internal::linear_bvh; - using vec4_t = bvh::Vec< FloatType, 4 >; - using point_t = bvh::Vec< FloatType, NDIMS >; - using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; - - // STEP 1: count number of candidates for each query point - const vec4_t* inner_nodes = m_bvh.m_inner_nodes; - const int32* leaf_nodes = m_bvh.m_leaf_nodes; - SLIC_ASSERT( inner_nodes != nullptr ); - SLIC_ASSERT( leaf_nodes != nullptr ); - - // STEP 2: define traversal predicates - auto leftPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, - const vec4_t& s1, - const vec4_t& s2 ) -> bool - { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; - - auto rightPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, - const vec4_t& s2, - const vec4_t& s3 ) -> bool - { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; - - // STEP 3: get counts - int total_count = getCounts( - leftPredicate, rightPredicate, numPts, counts, x, y, nullptr ); - - using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; - RAJA::exclusive_scan< exec_policy >( - counts, counts+numPts, offsets, RAJA::operators::plus{} ); - - IndexType total_candidates = static_cast< IndexType >( total_count ); - - candidates = axom::allocate< IndexType >( total_candidates); - - // STEP 4: fill in candidates for each point - for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) - { - int32 offset = offsets[ i ]; - - point_t point; - point[0] = x[i]; - point[1] = y[i]; + QueryAccessor::getPoint( point, i, x, y, z ); auto leafAction = [=,&offset]( int32 current_node, const int32* leaf_nodes ) -> void { From 74c241952de5cc170fb43a6e56c06a07d0957845 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 21 Feb 2020 09:53:11 -0800 Subject: [PATCH 039/632] COMP: remove no longer needed static assert --- src/axom/spin/BVH.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 1d665a80d5..3bdf19b9fb 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -462,15 +462,11 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, const FloatType* y, const FloatType* z ) const { - AXOM_STATIC_ASSERT_MSG( NDIMS==3, - "The 3D version of find() must be called on a 3D BVH" ); - SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); SLIC_ASSERT( candidates == nullptr ); SLIC_ASSERT( x != nullptr ); SLIC_ASSERT( y != nullptr ); - SLIC_ASSERT( z != nullptr ); // STEP 0: set the default memory allocator to use for the execution space. const int currentAllocatorID = axom::getDefaultAllocatorID(); From facbe6556c63e63060c59b1b85c67af7875492c0 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 21 Feb 2020 14:23:27 -0800 Subject: [PATCH 040/632] COMP: fix CUDA build Remove SLIC_ASSERTs and make `getCounts()` public. --- src/axom/spin/BVH.hpp | 4 ++-- src/axom/spin/internal/linear_bvh/QueryAccessor.hpp | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 3bdf19b9fb..52b8b9d392 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -255,8 +255,6 @@ class BVH */ void writeVtkFile( const std::string& fileName ) const; -private: - /*! * \brief Makes a BVH traversal and counts the number of candidates for each * query point. @@ -277,6 +275,8 @@ class BVH const FloatType* y, const FloatType* z = nullptr ) const; +private: + /// \name Private Members /// @{ diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index 814a86ee23..4261e7e4d0 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -86,8 +86,6 @@ class QueryAccessor< 2, FloatType > const FloatType* y, const FloatType* AXOM_NOT_USED(z) ) { - SLIC_ASSERT( x != nullptr ); - SLIC_ASSERT( y != nullptr ); point[ 0 ] = x[ idx ]; point[ 1 ] = y[ idx ]; } @@ -110,9 +108,6 @@ class QueryAccessor< 3, FloatType > const FloatType* y, const FloatType* z ) { - SLIC_ASSERT( x != nullptr ); - SLIC_ASSERT( y != nullptr ); - SLIC_ASSERT( z != nullptr ); point[ 0 ] = x[ idx ]; point[ 1 ] = y[ idx ]; point[ 2 ] = z[ idx ]; From 8f24f6b2c8d9f2f394451e94b3992bdeee10c005 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 21 Feb 2020 17:00:47 -0800 Subject: [PATCH 041/632] ENH: make count traversal internal helper routine Put the count traversal in an intenal, unbound method, (in an anonymous namespace) so that is not made part of the public API. --- src/axom/spin/BVH.hpp | 78 +++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 52b8b9d392..816f8cde19 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -255,28 +255,8 @@ class BVH */ void writeVtkFile( const std::string& fileName ) const; - /*! - * \brief Makes a BVH traversal and counts the number of candidates for each - * query point. - * - * \param [in] N the total number of points - * \param [out] counts array of length N consisting of the candidate count - * \param [in] leftCheck - * \param [in] rightCheck - * - * \return - */ - template < typename LeftPredicateType, typename RightPredicateType > - IndexType getCounts( LeftPredicateType&& leftCheck, - RightPredicateType&& rightCheck, - IndexType N, - IndexType* counts, - const FloatType* x, - const FloatType* y, - const FloatType* z = nullptr ) const; - private: - + /// \name Private Members /// @{ @@ -299,19 +279,42 @@ class BVH //------------------------------------------------------------------------------ // PRIVATE HELPER METHOD IMPLEMENTATION //------------------------------------------------------------------------------ +namespace +{ -template < int NDIMS, typename ExecSpace, typename FloatType > -template < typename LeftPredicate, typename RightPredicate > -IndexType BVH< NDIMS, ExecSpace, FloatType >::getCounts( - LeftPredicate&& leftCheck, - RightPredicate&& rightCheck, - IndexType N, - IndexType* counts, - const FloatType* x, - const FloatType* y, - const FloatType* z ) const +/*! + * \brief Performs a traversal to count the candidates for each query point. + * + * \param [in] leftCheck functor for left bin predicate check. + * \param [in] rightCheck functor for right bin predicate check. + * \param [in] inner_nodes array of vec4s for the BVH inner nodes. + * \param [in] leaf_nodes array of BVH leaf node indices + * \param [in] N the number of user-supplied query points + * \param [out] counts array of candidate counts for each query point. + * \param [in] x user-supplied array of x-coordinates + * \param [in] y user-supplied array of y-coordinates + * \param [in] z user-supplied array of z-coordinates + * + * \return total_count the total count of candidates for all query points. + */ +template < int NDIMS, typename ExecSpace, + typename LeftPredicate, + typename RightPredicate, + typename FloatType > +IndexType bvh_get_counts( + LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + const internal::linear_bvh::Vec< FloatType,4 >* inner_nodes, + const int32* leaf_nodes, + IndexType N, + IndexType* counts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) noexcept { // sanity checks + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); SLIC_ERROR_IF( x == nullptr, "supplied null pointer for x-coordinates!" ); SLIC_ERROR_IF( y == nullptr, "supplied null pointer for y-coordinates!" ); @@ -319,15 +322,9 @@ IndexType BVH< NDIMS, ExecSpace, FloatType >::getCounts( "supplied null pointer for z-coordinates!" ); namespace bvh = internal::linear_bvh; - using vec4_t = bvh::Vec< FloatType, 4 >; using point_t = bvh::Vec< FloatType, NDIMS >; // STEP 1: count number of candidates for each query point - const vec4_t* inner_nodes = m_bvh.m_inner_nodes; - const int32* leaf_nodes = m_bvh.m_leaf_nodes; - SLIC_ASSERT( inner_nodes != nullptr ); - SLIC_ASSERT( leaf_nodes != nullptr ); - using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); @@ -359,6 +356,8 @@ IndexType BVH< NDIMS, ExecSpace, FloatType >::getCounts( return ( total_count.get() ); } +} /* end anonymous namespace */ + //------------------------------------------------------------------------------ // PUBLIC API IMPLEMENTATION //------------------------------------------------------------------------------ @@ -497,8 +496,9 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; // STEP 3: get counts - int total_count = getCounts( - leftPredicate, rightPredicate, numPts, counts, x, y, z ); + int total_count = bvh_get_counts< NDIMS,ExecSpace >( + leftPredicate, rightPredicate, inner_nodes, leaf_nodes, + numPts, counts, x, y, z ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; RAJA::exclusive_scan< exec_policy >( From f59a00a9a0b0851d8758df05c0eac68a5ca7c75e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 22 Feb 2020 18:04:53 -0800 Subject: [PATCH 042/632] ENH: add convenience macros for BVH functors This commit adds two convenience macros intended for internal usage to simplify the way we define traversal predicate functors and the leaf action for traversing the BVH. --- src/axom/spin/BVH.hpp | 65 +++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 816f8cde19..46329997b7 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -279,6 +279,40 @@ class BVH //------------------------------------------------------------------------------ // PRIVATE HELPER METHOD IMPLEMENTATION //------------------------------------------------------------------------------ + +/*! + * \def BVH_PREDICATE + * + * \brief Macro that defines a traversal predicate functor. + * + * \param _predicateName the name of the predicate, e.g., `leftPredicate` + * \param _p the primitive type + * \param _s1 the 1st BVH segment consisting of the BVH bin information + * \param _s2 the 2nd BVH segment consisting of the BVH bin information + * + * \note The BVH_PREDICATE may be instantiated within or outside a kernel. + * + * \note This macro is intended to be used internally by the BVH implementation. + */ +#define BVH_PREDICATE(_predicateName, _p, _s1, _s2 ) \ + auto _predicateName = [] AXOM_HOST_DEVICE( _p, _s1, _s2 ) -> bool + +/*! + * \def BVH_LEAF_ACTION + * + * \brief Macro that defines the leaf action functor for a BVH traversal. + * + * \param _funcName the nem of the functor, .e.g, `leafAction` + * \param _node the BVH node ID + * \param _leafNodes the leafNodes + * + * \note The BVH_LEAF_ACTION macro must be called within a kernel. + * + * \note This macro is intended to be used internally by the BVH implementation. + */ +#define BVH_LEAF_ACTION( _funcName, _node, _leafNodes ) \ + auto _funcName = [&]( _node, _leafNodes ) -> void + namespace { @@ -336,9 +370,10 @@ IndexType bvh_get_counts( QueryAccessor::getPoint( point, i, x, y, z ); - auto leafAction = [&]( int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) -> void { - count++; + BVH_LEAF_ACTION( leafAction, + int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) { + count ++; }; bvh::bvh_traverse( inner_nodes, @@ -361,7 +396,6 @@ IndexType bvh_get_counts( //------------------------------------------------------------------------------ // PUBLIC API IMPLEMENTATION //------------------------------------------------------------------------------ - template< int NDIMS, typename ExecSpace, typename FloatType > BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, IndexType numItems ) : @@ -485,15 +519,15 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, SLIC_ASSERT( leaf_nodes != nullptr ); // STEP 2: define traversal predicates - auto leftPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, - const vec4_t& s1, - const vec4_t& s2 ) -> bool - { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; + BVH_PREDICATE( leftPredicate, const point_t& p, + const vec4_t& s1, const vec4_t& s2 ) { + return TraversalPredicates::pointInLeftBin( p, s1, s2 ); + }; - auto rightPredicate = [] AXOM_HOST_DEVICE ( const point_t& p, - const vec4_t& s2, - const vec4_t& s3 ) -> bool - { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; + BVH_PREDICATE( rightPredicate, const point_t& p, + const vec4_t& s2, const vec4_t& s3 ) { + return TraversalPredicates::pointInRightBin( p, s2, s3 ); + }; // STEP 3: get counts int total_count = bvh_get_counts< NDIMS,ExecSpace >( @@ -515,13 +549,11 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, point_t point; QueryAccessor::getPoint( point, i, x, y, z ); - auto leafAction = [=,&offset]( int32 current_node, - const int32* leaf_nodes ) -> void { + BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { candidates[offset] = leaf_nodes[current_node]; offset++; }; - bvh::bvh_traverse( inner_nodes, leaf_nodes, point, @@ -592,6 +624,9 @@ void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( ofs.close(); } +#undef BVH_PREDICATE +#undef BVH_LEAF_ACTION + } /* namespace primal */ } /* namespace axom */ From 5576752aace41bf59be3d874a645fd20df646503 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 22 Feb 2020 19:07:51 -0800 Subject: [PATCH 043/632] ENH: split BVH implementation into a seperate file --- src/axom/spin/BVH.hpp | 49 +-- src/axom/spin/CMakeLists.txt | 9 +- .../spin/internal/linear_bvh/BVH_impl.hpp | 402 ++++++++++++++++++ 3 files changed, 426 insertions(+), 34 deletions(-) create mode 100644 src/axom/spin/internal/linear_bvh/BVH_impl.hpp diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 46329997b7..6b149b6a11 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -7,46 +7,34 @@ #define AXOM_SPIN_BVH_H_ // axom core includes -#include "axom/config.hpp" // for Axom compile-time definitions -#include "axom/core/Macros.hpp" // for Axom macros -#include "axom/core/memory_management.hpp" // for memory functions -#include "axom/core/Types.hpp" // for fixed bitwidth types - -#include "axom/core/execution/execution_space.hpp" // for execution spaces -#include "axom/core/execution/for_all.hpp" // for generic for_all() - -// slic includes -#include "axom/slic/interface/slic.hpp" // for SLIC macros - -// spin includes -#include "axom/spin/internal/linear_bvh/aabb.hpp" -#include "axom/spin/internal/linear_bvh/build_radix_tree.hpp" -#include "axom/spin/internal/linear_bvh/bvh_traverse.hpp" -#include "axom/spin/internal/linear_bvh/bvh_vtkio.hpp" -#include "axom/spin/internal/linear_bvh/BVHData.hpp" -#include "axom/spin/internal/linear_bvh/emit_bvh.hpp" -#include "axom/spin/internal/linear_bvh/QueryAccessor.hpp" -#include "axom/spin/internal/linear_bvh/TraversalPredicates.hpp" -#include "axom/spin/internal/linear_bvh/vec.hpp" +#include "axom/config.hpp" // for Axom compile-time definitions +#include "axom/core/Macros.hpp" // for Axom macros +#include "axom/core/Types.hpp" // for axom::IndexType + +#include "axom/core/execution/execution_space.hpp" // for execution spaces // C/C++ includes -#include // for std::ofstream -#include // for std::ostringstream -#include // for std::string -#include // for memcpy +#include // for std::is_floating_point() #if !defined(AXOM_USE_RAJA) || !defined(AXOM_USE_UMPIRE) #error *** The spin::BVH class requires RAJA and Umpire *** #endif -// RAJA includes -#include "RAJA/RAJA.hpp" - namespace axom { namespace spin { +// forward declarations +namespace internal +{ +namespace linear_bvh +{ +template < typename FloatType, int NDIMS > +struct BVHData; +} +} + /*! * \brief Enumerates the list of return codes for various BVH operations. */ @@ -272,6 +260,7 @@ class BVH DISABLE_MOVE_AND_ASSIGNMENT(BVH); }; +<<<<<<< HEAD //------------------------------------------------------------------------------ // BVH IMPLEMENTATION //------------------------------------------------------------------------------ @@ -626,9 +615,9 @@ void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( #undef BVH_PREDICATE #undef BVH_LEAF_ACTION - -} /* namespace primal */ +} /* namespace spin */ } /* namespace axom */ +#include "axom/spin/internal/linear_bvh/BVH_impl.hpp" #endif /* AXOM_PRIMAL_BVH_H_ */ diff --git a/src/axom/spin/CMakeLists.txt b/src/axom/spin/CMakeLists.txt index b747641624..78354b9613 100644 --- a/src/axom/spin/CMakeLists.txt +++ b/src/axom/spin/CMakeLists.txt @@ -44,16 +44,17 @@ if ( RAJA_FOUND AND UMPIRE_FOUND ) BVH.hpp ## internal + internal/linear_bvh/BVHData.hpp + internal/linear_bvh/BVH_impl.hpp + internal/linear_bvh/QueryAccessor.hpp + internal/linear_bvh/RadixTree.hpp + internal/linear_bvh/TraversalPredicates.hpp internal/linear_bvh/aabb.hpp internal/linear_bvh/build_radix_tree.hpp internal/linear_bvh/bvh_vtkio.hpp - internal/linear_bvh/BVHData.hpp internal/linear_bvh/emit_bvh.hpp internal/linear_bvh/math.hpp - internal/linear_bvh/QueryAccessor.hpp - internal/linear_bvh/RadixTree.hpp internal/linear_bvh/range.hpp - internal/linear_bvh/TraversalPredicates.hpp internal/linear_bvh/vec.hpp ) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp new file mode 100644 index 0000000000..ea94ba83bf --- /dev/null +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -0,0 +1,402 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_SPIN_BVH_IMPL_HPP_ +#define AXOM_SPIN_BVH_IMPL_HPP_ + +#include "axom/core/memory_management.hpp" // for memory functions +#include "axom/core/Types.hpp" // for fixed bitwidth types + +#include "axom/core/execution/for_all.hpp" // for generic for_all() + +// slic includes +#include "axom/slic/interface/slic.hpp" // for SLIC macros + +// linear bvh includes +#include "axom/spin/internal/linear_bvh/aabb.hpp" +#include "axom/spin/internal/linear_bvh/build_radix_tree.hpp" +#include "axom/spin/internal/linear_bvh/bvh_traverse.hpp" +#include "axom/spin/internal/linear_bvh/bvh_vtkio.hpp" +#include "axom/spin/internal/linear_bvh/BVHData.hpp" +#include "axom/spin/internal/linear_bvh/emit_bvh.hpp" +#include "axom/spin/internal/linear_bvh/QueryAccessor.hpp" +#include "axom/spin/internal/linear_bvh/TraversalPredicates.hpp" +#include "axom/spin/internal/linear_bvh/vec.hpp" + +// RAJA includes +#include "RAJA/RAJA.hpp" + + +// C/C++ includes +#include // for std::ofstream +#include // for std::ostringstream +#include // for std::string +#include // for memcpy + +namespace axom +{ +namespace spin +{ + +//------------------------------------------------------------------------------ +// BVH IMPLEMENTATION +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// PRIVATE HELPER METHOD IMPLEMENTATION +//------------------------------------------------------------------------------ + +/*! + * \def BVH_PREDICATE + * + * \brief Macro that defines a traversal predicate functor. + * + * \param _predicateName the name of the predicate, e.g., `leftPredicate` + * \param _p the primitive type + * \param _s1 the 1st BVH segment consisting of the BVH bin information + * \param _s2 the 2nd BVH segment consisting of the BVH bin information + * + * \note The BVH_PREDICATE may be instantiated within or outside a kernel. + * + * \note This macro is intended to be used internally by the BVH implementation. + */ +#define BVH_PREDICATE(_predicateName, _p, _s1, _s2 ) \ + auto _predicateName = [] AXOM_HOST_DEVICE( _p, _s1, _s2 ) -> bool + +/*! + * \def BVH_LEAF_ACTION + * + * \brief Macro that defines the leaf action functor for a BVH traversal. + * + * \param _funcName the nem of the functor, .e.g, `leafAction` + * \param _node the BVH node ID + * \param _leafNodes the leafNodes + * + * \note The BVH_LEAF_ACTION macro must be called within a kernel. + * + * \note This macro is intended to be used internally by the BVH implementation. + */ +#define BVH_LEAF_ACTION( _funcName, _node, _leafNodes ) \ + auto _funcName = [&]( _node, _leafNodes ) -> void + +namespace +{ + +/*! + * \brief Performs a traversal to count the candidates for each query point. + * + * \param [in] leftCheck functor for left bin predicate check. + * \param [in] rightCheck functor for right bin predicate check. + * \param [in] inner_nodes array of vec4s for the BVH inner nodes. + * \param [in] leaf_nodes array of BVH leaf node indices + * \param [in] N the number of user-supplied query points + * \param [out] counts array of candidate counts for each query point. + * \param [in] x user-supplied array of x-coordinates + * \param [in] y user-supplied array of y-coordinates + * \param [in] z user-supplied array of z-coordinates + * + * \return total_count the total count of candidates for all query points. + */ +template < int NDIMS, typename ExecSpace, + typename LeftPredicate, + typename RightPredicate, + typename FloatType > +IndexType bvh_get_counts( + LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + const internal::linear_bvh::Vec< FloatType,4 >* inner_nodes, + const int32* leaf_nodes, + IndexType N, + IndexType* counts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) noexcept +{ + // sanity checks + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); + SLIC_ERROR_IF( x == nullptr, "supplied null pointer for x-coordinates!" ); + SLIC_ERROR_IF( y == nullptr, "supplied null pointer for y-coordinates!" ); + SLIC_ERROR_IF( (z==nullptr && NDIMS==3), + "supplied null pointer for z-coordinates!" ); + + namespace bvh = internal::linear_bvh; + using point_t = bvh::Vec< FloatType, NDIMS >; + + // STEP 1: count number of candidates for each query point + using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; + RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); + + using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; + for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) + { + int32 count = 0; + point_t point; + QueryAccessor::getPoint( point, i, x, y, z ); + + + BVH_LEAF_ACTION( leafAction, + int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) { + count ++; + }; + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftCheck, + rightCheck, + leafAction ); + + counts[ i ] = count; + total_count += count; + + } ); + + return ( total_count.get() ); +} + +} /* end anonymous namespace */ + +//------------------------------------------------------------------------------ +// PUBLIC API IMPLEMENTATION +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, + IndexType numItems ) : + m_scaleFactor( DEFAULT_SCALE_FACTOR ), + m_numItems( numItems ), + m_boxes( boxes ) +{ + +} + +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +BVH< NDIMS, ExecSpace, FloatType >::~BVH() +{ + m_bvh.deallocate(); +} + +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +int BVH< NDIMS, ExecSpace, FloatType >::build() +{ + // STEP 0: set the default memory allocator to use for the execution space. + umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + axom::setDefaultAllocator( allocatorID ); + + // STEP 1: Handle case when user supplied a single bounding box + int numBoxes = m_numItems; + FloatType* boxesptr = nullptr; + if ( m_numItems == 1 ) + { + numBoxes = 2; + constexpr int32 M = NDIMS * 2; // number of entries for one box + const int N = numBoxes * M; // number of entries for N boxes + boxesptr = axom::allocate< FloatType >( N ); + + const FloatType* myboxes = m_boxes; + + // copy first box and add a fake 2nd box + for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) + { + boxesptr[ i ] = ( i < M ) ? myboxes[ i ] : 0.0; + } ); + + } // END if single item + else + { + boxesptr = const_cast< FloatType* >( m_boxes ); + } + + // STEP 2: Build a RadixTree consisting of the bounding boxes, sorted + // by their corresponding morton code. + internal::linear_bvh::RadixTree< FloatType, NDIMS > radix_tree; + internal::linear_bvh::AABB< FloatType, NDIMS > global_bounds; + internal::linear_bvh::build_radix_tree< ExecSpace >( + boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor ); + + // STEP 3: emit the BVH data-structure from the radix tree + m_bvh.m_bounds = global_bounds; + m_bvh.allocate( numBoxes ); + + // STEP 4: emit the BVH + internal::linear_bvh::emit_bvh< ExecSpace >( radix_tree, m_bvh ); + + radix_tree.deallocate(); + + // STEP 5: deallocate boxesptr if user supplied a single box + if ( m_numItems == 1 ) + { + SLIC_ASSERT( boxesptr != m_boxes ); + axom::deallocate( boxesptr ); + } + + // STEP 6: restore default allocator + axom::setDefaultAllocator( current_allocator ); + return BVH_BUILD_OK; +} + +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +void BVH< NDIMS, ExecSpace, FloatType >::getBounds( FloatType* min, + FloatType* max ) const +{ + SLIC_ASSERT( min != nullptr ); + SLIC_ASSERT( max != nullptr ); + m_bvh.m_bounds.min( min ); + m_bvh.m_bounds.max( max ); +} + +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, + IndexType* counts, + IndexType*& candidates, + IndexType numPts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) const +{ + SLIC_ASSERT( offsets != nullptr ); + SLIC_ASSERT( counts != nullptr ); + SLIC_ASSERT( candidates == nullptr ); + SLIC_ASSERT( x != nullptr ); + SLIC_ASSERT( y != nullptr ); + + // STEP 0: set the default memory allocator to use for the execution space. + umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + axom::setDefaultAllocator( allocatorID ); + + namespace bvh = internal::linear_bvh; + using vec4_t = bvh::Vec< FloatType, 4 >; + using point_t = bvh::Vec< FloatType, NDIMS >; + using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; + using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; + + // STEP 1: count number of candidates for each query point + const vec4_t* inner_nodes = m_bvh.m_inner_nodes; + const int32* leaf_nodes = m_bvh.m_leaf_nodes; + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + + // STEP 2: define traversal predicates + BVH_PREDICATE( leftPredicate, const point_t& p, + const vec4_t& s1, const vec4_t& s2 ) { + return TraversalPredicates::pointInLeftBin( p, s1, s2 ); + }; + + BVH_PREDICATE( rightPredicate, const point_t& p, + const vec4_t& s2, const vec4_t& s3 ) { + return TraversalPredicates::pointInRightBin( p, s2, s3 ); + }; + + // STEP 3: get counts + int total_count = bvh_get_counts< NDIMS,ExecSpace >( + leftPredicate, rightPredicate, inner_nodes, leaf_nodes, + numPts, counts, x, y, z ); + + using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; + RAJA::exclusive_scan< exec_policy >( + counts, counts+numPts, offsets, RAJA::operators::plus{} ); + + IndexType total_candidates = static_cast< IndexType >( total_count ); + candidates = axom::allocate< IndexType >( total_candidates); + + // STEP 4: fill in candidates for each point + for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) + { + int32 offset = offsets[ i ]; + + point_t point; + QueryAccessor::getPoint( point, i, x, y, z ); + + BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; + + bvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); + + } ); + + // STEP 3: restore default allocator + axom::setDefaultAllocator( current_allocator ); +} + +//------------------------------------------------------------------------------ +template < int NDIMS, typename ExecSpace, typename FloatType > +void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( + const std::string& fileName ) const +{ + std::ostringstream nodes; + std::ostringstream cells; + std::ostringstream levels; + + // STEP 0: Write VTK header + std::ofstream ofs; + ofs.open( fileName.c_str() ); + ofs << "# vtk DataFile Version 3.0\n"; + ofs << " BVHTree \n"; + ofs << "ASCII\n"; + ofs << "DATASET UNSTRUCTURED_GRID\n"; + + // STEP 1: write root + int32 numPoints = 0; + int32 numBins = 0; + internal::linear_bvh::write_root( + m_bvh.m_bounds, numPoints, numBins,nodes,cells,levels ); + + + // STEP 2: traverse the BVH and dump each bin + constexpr int32 ROOT = 0; + internal::linear_bvh::write_recursive< FloatType, NDIMS >( + m_bvh.m_inner_nodes, ROOT, 1, numPoints, numBins, nodes, cells, levels ); + + // STEP 3: write nodes + ofs << "POINTS " << numPoints << " double\n"; + ofs << nodes.str() << std::endl; + + // STEP 4: write cells + const int32 nnodes = (NDIMS==2) ? 4 : 8; + ofs << "CELLS " << numBins << " " << numBins*(nnodes+1) << std::endl; + ofs << cells.str() << std::endl; + + // STEP 5: write cell types + ofs << "CELL_TYPES " << numBins << std::endl; + const int32 cellType = (NDIMS==2) ? 9 : 12; + for ( int32 i=0; i < numBins; ++i ) + { + ofs << cellType << std::endl; + } + + // STEP 6: dump level information + ofs << "CELL_DATA " << numBins << std::endl; + ofs << "SCALARS level int\n"; + ofs << "LOOKUP_TABLE default\n"; + ofs << levels.str() << std::endl; + ofs << std::endl; + + // STEP 7: close file + ofs.close(); +} + +#undef BVH_PREDICATE +#undef BVH_LEAF_ACTION + + +} /* namespace spin */ +} /* namespace axom */ + +#endif /* AXOM_SPIN_BVH_IMPL_HPP_ */ From 6baf34f750424c8cb6e55a80dbcf2ce1b06065d9 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 22 Feb 2020 20:28:11 -0800 Subject: [PATCH 044/632] ENH: consistent use of namespace and type aliases --- .../spin/internal/linear_bvh/BVH_impl.hpp | 77 ++++++++++--------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index ea94ba83bf..846dcea72a 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -47,6 +47,13 @@ namespace spin //------------------------------------------------------------------------------ // PRIVATE HELPER METHOD IMPLEMENTATION //------------------------------------------------------------------------------ +namespace lbvh = internal::linear_bvh; + +template < typename FloatType > +using vec4_t = internal::linear_bvh::Vec< FloatType, 4 >; + +template < typename FloatType, int NDIMS > +using point_t = internal::linear_bvh::Vec< FloatType, NDIMS >; /*! * \def BVH_PREDICATE @@ -106,7 +113,7 @@ template < int NDIMS, typename ExecSpace, IndexType bvh_get_counts( LeftPredicate&& leftCheck, RightPredicate&& rightCheck, - const internal::linear_bvh::Vec< FloatType,4 >* inner_nodes, + const vec4_t< FloatType >* inner_nodes, const int32* leaf_nodes, IndexType N, IndexType* counts, @@ -123,18 +130,15 @@ IndexType bvh_get_counts( SLIC_ERROR_IF( (z==nullptr && NDIMS==3), "supplied null pointer for z-coordinates!" ); - namespace bvh = internal::linear_bvh; - using point_t = bvh::Vec< FloatType, NDIMS >; - // STEP 1: count number of candidates for each query point using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); - using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; + using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) { int32 count = 0; - point_t point; + point_t< FloatType, NDIMS > point; QueryAccessor::getPoint( point, i, x, y, z ); @@ -144,12 +148,12 @@ IndexType bvh_get_counts( count ++; }; - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftCheck, - rightCheck, - leafAction ); + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftCheck, + rightCheck, + leafAction ); counts[ i ] = count; total_count += count; @@ -216,9 +220,9 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() // STEP 2: Build a RadixTree consisting of the bounding boxes, sorted // by their corresponding morton code. - internal::linear_bvh::RadixTree< FloatType, NDIMS > radix_tree; - internal::linear_bvh::AABB< FloatType, NDIMS > global_bounds; - internal::linear_bvh::build_radix_tree< ExecSpace >( + lbvh::RadixTree< FloatType, NDIMS > radix_tree; + lbvh::AABB< FloatType, NDIMS > global_bounds; + lbvh::build_radix_tree< ExecSpace >( boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor ); // STEP 3: emit the BVH data-structure from the radix tree @@ -226,7 +230,7 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() m_bvh.allocate( numBoxes ); // STEP 4: emit the BVH - internal::linear_bvh::emit_bvh< ExecSpace >( radix_tree, m_bvh ); + lbvh::emit_bvh< ExecSpace >( radix_tree, m_bvh ); radix_tree.deallocate(); @@ -274,26 +278,28 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); - namespace bvh = internal::linear_bvh; - using vec4_t = bvh::Vec< FloatType, 4 >; - using point_t = bvh::Vec< FloatType, NDIMS >; - using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; - using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; + using PointType = point_t< FloatType, NDIMS >; + using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; + using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; // STEP 1: count number of candidates for each query point - const vec4_t* inner_nodes = m_bvh.m_inner_nodes; + const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); // STEP 2: define traversal predicates - BVH_PREDICATE( leftPredicate, const point_t& p, - const vec4_t& s1, const vec4_t& s2 ) { + BVH_PREDICATE( leftPredicate, + const PointType& p, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 ) { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; - BVH_PREDICATE( rightPredicate, const point_t& p, - const vec4_t& s2, const vec4_t& s3 ) { + BVH_PREDICATE( rightPredicate, + const PointType& p, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 ) { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; @@ -314,7 +320,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, { int32 offset = offsets[ i ]; - point_t point; + PointType point; QueryAccessor::getPoint( point, i, x, y, z ); BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { @@ -322,12 +328,12 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, offset++; }; - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftPredicate, - rightPredicate, - leafAction ); + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); } ); @@ -355,13 +361,12 @@ void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( // STEP 1: write root int32 numPoints = 0; int32 numBins = 0; - internal::linear_bvh::write_root( - m_bvh.m_bounds, numPoints, numBins,nodes,cells,levels ); + lbvh::write_root( m_bvh.m_bounds, numPoints, numBins,nodes,cells,levels ); // STEP 2: traverse the BVH and dump each bin constexpr int32 ROOT = 0; - internal::linear_bvh::write_recursive< FloatType, NDIMS >( + lbvh::write_recursive< FloatType, NDIMS >( m_bvh.m_inner_nodes, ROOT, 1, numPoints, numBins, nodes, cells, levels ); // STEP 3: write nodes From 729aea4e468e56f7b430a16000851a8102e0d869 Mon Sep 17 00:00:00 2001 From: uncrustify-robot Date: Sat, 22 Feb 2020 21:16:22 -0800 Subject: [PATCH 045/632] STYLE: uncrustify spin (except any code in lambdas) --- src/axom/spin/BVH.hpp | 2 +- .../spin/internal/linear_bvh/BVH_impl.hpp | 56 ++++++------- .../internal/linear_bvh/QueryAccessor.hpp | 4 +- .../linear_bvh/TraversalPredicates.hpp | 4 +- .../internal/linear_bvh/build_radix_tree.hpp | 80 +++++++++---------- .../spin/internal/linear_bvh/emit_bvh.hpp | 20 ++--- src/axom/spin/tests/spin_bvh.cpp | 34 ++++---- 7 files changed, 100 insertions(+), 100 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 6b149b6a11..b743ea71e9 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -124,7 +124,7 @@ class BVH AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used for the BVH." ); AXOM_STATIC_ASSERT_MSG( axom::execution_space< ExecSpace >::valid(), - "A valid execution space must be supplied to the BVH." ); + "A valid execution space must be supplied to the BVH." ); /*! diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 846dcea72a..a4e535ae87 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -70,7 +70,7 @@ using point_t = internal::linear_bvh::Vec< FloatType, NDIMS >; * \note This macro is intended to be used internally by the BVH implementation. */ #define BVH_PREDICATE(_predicateName, _p, _s1, _s2 ) \ - auto _predicateName = [] AXOM_HOST_DEVICE( _p, _s1, _s2 ) -> bool + auto _predicateName = [] AXOM_HOST_DEVICE( _p, _s1, _s2 )->bool /*! * \def BVH_LEAF_ACTION @@ -86,7 +86,7 @@ using point_t = internal::linear_bvh::Vec< FloatType, NDIMS >; * \note This macro is intended to be used internally by the BVH implementation. */ #define BVH_LEAF_ACTION( _funcName, _node, _leafNodes ) \ - auto _funcName = [&]( _node, _leafNodes ) -> void + auto _funcName = [&]( _node, _leafNodes )->void namespace { @@ -111,15 +111,15 @@ template < int NDIMS, typename ExecSpace, typename RightPredicate, typename FloatType > IndexType bvh_get_counts( - LeftPredicate&& leftCheck, - RightPredicate&& rightCheck, - const vec4_t< FloatType >* inner_nodes, - const int32* leaf_nodes, - IndexType N, - IndexType* counts, - const FloatType* x, - const FloatType* y, - const FloatType* z ) noexcept + LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + const vec4_t< FloatType >* inner_nodes, + const int32* leaf_nodes, + IndexType N, + IndexType* counts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) noexcept { // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -174,9 +174,7 @@ BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, m_scaleFactor( DEFAULT_SCALE_FACTOR ), m_numItems( numItems ), m_boxes( boxes ) -{ - -} +{} //------------------------------------------------------------------------------ template< int NDIMS, typename ExecSpace, typename FloatType > @@ -223,7 +221,7 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() lbvh::RadixTree< FloatType, NDIMS > radix_tree; lbvh::AABB< FloatType, NDIMS > global_bounds; lbvh::build_radix_tree< ExecSpace >( - boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor ); + boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor ); // STEP 3: emit the BVH data-structure from the radix tree m_bvh.m_bounds = global_bounds; @@ -284,33 +282,35 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, // STEP 1: count number of candidates for each query point const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; - const int32* leaf_nodes = m_bvh.m_leaf_nodes; + const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); // STEP 2: define traversal predicates BVH_PREDICATE( leftPredicate, - const PointType& p, - const vec4_t< FloatType >& s1, - const vec4_t< FloatType >& s2 ) { + const PointType &p, + const vec4_t< FloatType >&s1, + const vec4_t< FloatType >&s2 ) + { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; BVH_PREDICATE( rightPredicate, - const PointType& p, - const vec4_t< FloatType >& s2, - const vec4_t< FloatType >& s3 ) { + const PointType &p, + const vec4_t< FloatType >&s2, + const vec4_t< FloatType >&s3 ) + { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; // STEP 3: get counts int total_count = bvh_get_counts< NDIMS,ExecSpace >( - leftPredicate, rightPredicate, inner_nodes, leaf_nodes, - numPts, counts, x, y, z ); + leftPredicate, rightPredicate, inner_nodes, leaf_nodes, + numPts, counts, x, y, z ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; RAJA::exclusive_scan< exec_policy >( - counts, counts+numPts, offsets, RAJA::operators::plus{} ); + counts, counts+numPts, offsets, RAJA::operators::plus{} ); IndexType total_candidates = static_cast< IndexType >( total_count ); candidates = axom::allocate< IndexType >( total_candidates); @@ -344,7 +344,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, //------------------------------------------------------------------------------ template < int NDIMS, typename ExecSpace, typename FloatType > void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( - const std::string& fileName ) const + const std::string& fileName ) const { std::ostringstream nodes; std::ostringstream cells; @@ -367,7 +367,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( // STEP 2: traverse the BVH and dump each bin constexpr int32 ROOT = 0; lbvh::write_recursive< FloatType, NDIMS >( - m_bvh.m_inner_nodes, ROOT, 1, numPoints, numBins, nodes, cells, levels ); + m_bvh.m_inner_nodes, ROOT, 1, numPoints, numBins, nodes, cells, levels ); // STEP 3: write nodes ofs << "POINTS " << numPoints << " double\n"; @@ -381,7 +381,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( // STEP 5: write cell types ofs << "CELL_TYPES " << numBins << std::endl; const int32 cellType = (NDIMS==2) ? 9 : 12; - for ( int32 i=0; i < numBins; ++i ) + for ( int32 i=0 ; i < numBins ; ++i ) { ofs << cellType << std::endl; } diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index 4261e7e4d0..f160ca6679 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -38,9 +38,9 @@ class QueryAccessor public: AXOM_STATIC_ASSERT_MSG( ( (NDIMS==2) || (NDIMS==3) ), - "TraversalPredicates are defined for 2D and 3D only" ); + "TraversalPredicates are defined for 2D and 3D only" ); AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, - "A valid FloatingType must be used, e.g., double or float" ); + "A valid FloatingType must be used, e.g., double or float" ); /// \name Query Point Access methods /// @{ diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index f773df7c48..289a8a3c26 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -37,9 +37,9 @@ class TraversalPredicates public: AXOM_STATIC_ASSERT_MSG( ( (NDIMS==2) || (NDIMS==3) ), - "TraversalPredicates are defined for 2D and 3D only" ); + "TraversalPredicates are defined for 2D and 3D only" ); AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, - "A valid FloatingType must be used, e.g., double or float" ); + "A valid FloatingType must be used, e.g., double or float" ); ///\name Predicates for Point Queries /// @{ diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index 29886ff73f..615bea983f 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -103,8 +103,8 @@ axom::int64 morton64_encode( axom::float32 x, } template < typename ExecSpace, typename FloatType > -void transform_boxes( const FloatType *boxes, - AABB *aabbs, +void transform_boxes( const FloatType* boxes, + AABB* aabbs, int32 size, FloatType scale_factor ) { @@ -136,8 +136,8 @@ void transform_boxes( const FloatType *boxes, //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType > -void transform_boxes( const FloatType *boxes, - AABB *aabbs, +void transform_boxes( const FloatType* boxes, + AABB* aabbs, int32 size, FloatType scale_factor ) { @@ -167,7 +167,7 @@ void transform_boxes( const FloatType *boxes, //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType > -AABB reduce(AABB *aabbs, int32 size) +AABB reduce(AABB* aabbs, int32 size) { constexpr int NDIMS = 3; @@ -199,10 +199,10 @@ AABB reduce(AABB *aabbs, int32 size) AABB< FloatType, NDIMS > res; Vec< FloatType, NDIMS > mins = - make_vec< FloatType >( xmin.get(), ymin.get(), zmin.get() ); + make_vec< FloatType >( xmin.get(), ymin.get(), zmin.get() ); Vec< FloatType, NDIMS > maxs = - make_vec< FloatType >( xmax.get(), ymax.get(), zmax.get() ); + make_vec< FloatType >( xmax.get(), ymax.get(), zmax.get() ); res.include(mins); res.include(maxs); @@ -211,12 +211,12 @@ AABB reduce(AABB *aabbs, int32 size) //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType > -AABB reduce(AABB *aabbs, int32 size) +AABB reduce(AABB* aabbs, int32 size) { constexpr int NDIMS = 2; using reduce_policy = - typename axom::execution_space< ExecSpace >::reduce_policy; + typename axom::execution_space< ExecSpace >::reduce_policy; RAJA::ReduceMin< reduce_policy, FloatType> xmin(infinity32()); RAJA::ReduceMin< reduce_policy, FloatType> ymin(infinity32()); @@ -248,10 +248,10 @@ AABB reduce(AABB *aabbs, int32 size) //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType > -void get_mcodes( AABB *aabbs, - int32 size, - const AABB< FloatType,2 > &bounds, - uint32* mcodes ) +void get_mcodes( AABB* aabbs, + int32 size, + const AABB< FloatType,2 > &bounds, + uint32* mcodes ) { constexpr int NDIMS = 2; @@ -262,11 +262,11 @@ void get_mcodes( AABB *aabbs, min_coord[0] = bounds.m_x.min(); min_coord[1] = bounds.m_y.min(); - for ( int i = 0; i < NDIMS; ++i ) + for ( int i = 0 ; i < NDIMS ; ++i ) { inv_extent[ i ] = - utilities::isNearlyEqual< FloatType >( extent[i], .0f ) ? - 0.f : 1.f / extent[i]; + utilities::isNearlyEqual< FloatType >( extent[i], .0f ) ? + 0.f : 1.f / extent[i]; } for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) @@ -285,10 +285,10 @@ void get_mcodes( AABB *aabbs, //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType > -void get_mcodes( AABB *aabbs, - int32 size, - const AABB< FloatType,3 > &bounds, - uint32* mcodes ) +void get_mcodes( AABB* aabbs, + int32 size, + const AABB< FloatType,3 > &bounds, + uint32* mcodes ) { constexpr int NDIMS = 3; @@ -301,11 +301,11 @@ void get_mcodes( AABB *aabbs, min_coord[1] = bounds.m_y.min(); min_coord[2] = bounds.m_z.min(); - for ( int i = 0; i < NDIMS; ++i ) + for ( int i = 0 ; i < NDIMS ; ++i ) { inv_extent[ i ] = utilities::isNearlyEqual< FloatType >( extent[i], .0f ) ? - 0.f : 1.f / extent[i]; + 0.f : 1.f / extent[i]; } for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) @@ -345,7 +345,7 @@ void array_counting( IntType* iterator, // result [b,a,c] // template< typename ExecSpace, typename T> -void reorder(int32 *indices, T *&array, int32 size) +void reorder(int32* indices, T*&array, int32 size) { T* temp = axom::allocate< T >( size ); @@ -379,7 +379,7 @@ void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) //------------------------------------------------------------------------------ #if defined(AXOM_USE_CUDA) && defined(AXOM_USE_RAJA) && \ - defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_CUB) + defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_CUB) template < int BLOCK_SIZE > void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, uint32*& mcodes, int32 size, int32* iter ) @@ -388,17 +388,17 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, array_counting< ExecSpace >(iter, size, 0, 1); uint32* mcodes_alt_buf = axom::allocate< uint32 >( size ); - int32* iter_alt_buf = axom::allocate< int32 >( size ); + int32* iter_alt_buf = axom::allocate< int32 >( size ); // create double buffers ::cub::DoubleBuffer< uint32 > d_keys( mcodes, mcodes_alt_buf ); ::cub::DoubleBuffer< int32 > d_values( iter, iter_alt_buf ); // determine temporary device storage requirements - void * d_temp_storage = nullptr; + void* d_temp_storage = nullptr; size_t temp_storage_bytes = 0; ::cub::DeviceRadixSort::SortPairs( d_temp_storage, temp_storage_bytes, - d_keys, d_values, size ); + d_keys, d_values, size ); // Allocate temporary storage d_temp_storage = (void*)axom::allocate< unsigned char >( temp_storage_bytes ); @@ -409,7 +409,7 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, d_keys, d_values, size ); uint32* sorted_keys = d_keys.Current(); - int32* sorted_vals = d_values.Current(); + int32* sorted_vals = d_values.Current(); for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) { @@ -437,7 +437,7 @@ template < typename IntType, typename MCType > AXOM_HOST_DEVICE IntType delta( const IntType &a, const IntType &b, const IntType &inner_size, - const MCType *mcodes ) + const MCType* mcodes ) { bool tie = false; bool out_of_range = (b < 0 || b > inner_size); @@ -453,7 +453,7 @@ AXOM_HOST_DEVICE IntType delta( const IntType &a, int32 count = clz(exor); if (tie) count += 32; - count = (out_of_range) ? - 1 : count; + count = (out_of_range) ? -1 : count; return count; } @@ -468,10 +468,10 @@ void build_tree( RadixTree< FloatType, NDIMS > &data ) // lambda captures of pointers inside a struct. Bad memories // of random segfaults ........ be warned const int32 inner_size = data.m_inner_size; - int32 *lchildren_ptr = data.m_left_children; - int32 *rchildren_ptr = data.m_right_children; - int32 *parent_ptr = data.m_parents; - const uint32 *mcodes_ptr = data.m_mcodes; + int32* lchildren_ptr = data.m_left_children; + int32* rchildren_ptr = data.m_right_children; + int32* parent_ptr = data.m_parents; + const uint32* mcodes_ptr = data.m_mcodes; for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 i) { @@ -569,19 +569,19 @@ void propagate_aabbs( RadixTree< FloatType, NDIMS >& data) // of a huge amount of pain and suffering due so cuda // labda captures of pointers indide a struct. Bad memories // of random segfaults ........ be warned - const int32 *lchildren_ptr = data.m_left_children; - const int32 *rchildren_ptr = data.m_right_children; - const int32 *parent_ptr = data.m_parents; - const AABB< FloatType,NDIMS > *leaf_aabb_ptr = data.m_leaf_aabbs; + const int32* lchildren_ptr = data.m_left_children; + const int32* rchildren_ptr = data.m_right_children; + const int32* parent_ptr = data.m_parents; + const AABB< FloatType,NDIMS >* leaf_aabb_ptr = data.m_leaf_aabbs; - AABB *inner_aabb_ptr = data.m_inner_aabbs; + AABB* inner_aabb_ptr = data.m_inner_aabbs; int32* counters_ptr = axom::allocate(inner_size); array_memset< ExecSpace >(counters_ptr, inner_size, 0); using atomic_policy = - typename axom::execution_space< ExecSpace >::atomic_policy; + typename axom::execution_space< ExecSpace >::atomic_policy; for_all< ExecSpace >( leaf_size, AXOM_LAMBDA(int32 i) { diff --git a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp index f02f13a9f0..9506d2a1f0 100644 --- a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp +++ b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp @@ -61,13 +61,13 @@ void emit_bvh( RadixTree& data, const int32 inner_size = data.m_inner_size; SLIC_ASSERT( inner_size == size-1 ); - const int32 *lchildren_ptr = data.m_left_children; - const int32 *rchildren_ptr = data.m_right_children; + const int32* lchildren_ptr = data.m_left_children; + const int32* rchildren_ptr = data.m_right_children; - const AABB *leaf_aabb_ptr = data.m_leaf_aabbs; - const AABB *inner_aabb_ptr = data.m_inner_aabbs; + const AABB* leaf_aabb_ptr = data.m_leaf_aabbs; + const AABB* inner_aabb_ptr = data.m_inner_aabbs; - Vec *flat_ptr = bvh_data.m_inner_nodes; + Vec* flat_ptr = bvh_data.m_inner_nodes; for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { @@ -149,14 +149,14 @@ void emit_bvh( RadixTree& data, const int32 inner_size = data.m_inner_size; SLIC_ASSERT( inner_size == size-1 ); - const int32 *lchildren_ptr = data.m_left_children; - const int32 *rchildren_ptr = data.m_right_children; + const int32* lchildren_ptr = data.m_left_children; + const int32* rchildren_ptr = data.m_right_children; - const AABB *leaf_aabb_ptr = data.m_leaf_aabbs; - const AABB *inner_aabb_ptr = data.m_inner_aabbs; + const AABB* leaf_aabb_ptr = data.m_leaf_aabbs; + const AABB* inner_aabb_ptr = data.m_inner_aabbs; - Vec *flat_ptr = bvh_data.m_inner_nodes; + Vec* flat_ptr = bvh_data.m_inner_nodes; for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 2bd88903e2..964194fb88 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -246,7 +246,7 @@ void check_build_bvh2d( ) FloatType hi[ NDIMS ]; bvh.getBounds( lo, hi ); - for ( int idim=0; idim < NDIMS; ++idim ) + for ( int idim=0 ; idim < NDIMS ; ++idim ) { EXPECT_DOUBLE_EQ( lo[ idim ], 0.0 ); EXPECT_DOUBLE_EQ( hi[ idim ], 2.0 ); @@ -285,7 +285,7 @@ void check_build_bvh3d( ) FloatType hi[ NDIMS ]; bvh.getBounds( lo, hi ); - for ( int idim=0; idim < NDIMS; ++idim ) + for ( int idim=0 ; idim < NDIMS ; ++idim ) { EXPECT_DOUBLE_EQ( lo[ idim ], 0.0 ); EXPECT_DOUBLE_EQ( hi[ idim ], 2.0 ); @@ -343,7 +343,7 @@ void check_find3d( ) FloatType min[ NDIMS ]; FloatType max[ NDIMS ]; bvh.getBounds( min, max ); - for ( int i=0; i < NDIMS; ++i ) + for ( int i=0 ; i < NDIMS ; ++i ) { EXPECT_DOUBLE_EQ( min[ i ], lo[ i ] ); EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); @@ -359,7 +359,7 @@ void check_find3d( ) spin::UniformGrid< IndexType, NDIMS > ug( lo, hi, res ); - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { PointType q = PointType::make_point( xc[ i ],yc[ i ],zc[ i ] ); const int donorCellIdx = ug.getBinIndex( q ); @@ -371,16 +371,16 @@ void check_find3d( ) // check points that are outside by shifting the query points constexpr double OFFSET = 10.0; - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { - xc[ i ] += OFFSET; - yc[ i ] += OFFSET; - zc[ i ] += OFFSET; + xc[ i ] += OFFSET; + yc[ i ] += OFFSET; + zc[ i ] += OFFSET; } bvh.find( offsets, counts, candidates, ncells, xc, yc, zc ); - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { EXPECT_EQ( counts[ i ], 0 ); } @@ -440,7 +440,7 @@ void check_find2d( ) FloatType min[ NDIMS ]; FloatType max[ NDIMS ]; bvh.getBounds( min, max ); - for ( int i=0; i < NDIMS; ++i ) + for ( int i=0 ; i < NDIMS ; ++i ) { EXPECT_DOUBLE_EQ( min[ i ], lo[ i ] ); EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); @@ -456,7 +456,7 @@ void check_find2d( ) spin::UniformGrid< IndexType, NDIMS > ug( lo, hi, res ); - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { PointType q = PointType::make_point( xc[ i ],yc[ i ] ); const int donorCellIdx = ug.getBinIndex( q ); @@ -468,15 +468,15 @@ void check_find2d( ) // check points that are outside by shifting the query points constexpr double OFFSET = 10.0; - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { - xc[ i ] += OFFSET; - yc[ i ] += OFFSET; + xc[ i ] += OFFSET; + yc[ i ] += OFFSET; } bvh.find( offsets, counts, candidates, ncells, xc, yc ); - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { EXPECT_EQ( counts[ i ], 0 ); } @@ -522,7 +522,7 @@ void check_single_box2d( ) FloatType hi[ NDIMS ]; bvh.getBounds( lo, hi ); - for ( int idim=0; idim < NDIMS; ++idim ) + for ( int idim=0 ; idim < NDIMS ; ++idim ) { EXPECT_DOUBLE_EQ( lo[ idim ], 0.0 ); EXPECT_DOUBLE_EQ( hi[ idim ], 1.0 ); @@ -590,7 +590,7 @@ void check_single_box3d( ) FloatType hi[ NDIMS ]; bvh.getBounds( lo, hi ); - for ( int idim=0; idim < NDIMS; ++idim ) + for ( int idim=0 ; idim < NDIMS ; ++idim ) { EXPECT_DOUBLE_EQ( lo[ idim ], 0.0 ); EXPECT_DOUBLE_EQ( hi[ idim ], 1.0 ); From 218c30781ab57975ca0affd2550a27f3dfaaa1e5 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 24 Feb 2020 12:20:55 -0800 Subject: [PATCH 046/632] DOC: add comment regarding the BVH orgranization --- src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index 289a8a3c26..608ca05d16 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -97,7 +97,9 @@ class TraversalPredicates< DIMENSION_2, FloatType > const VecType< FloatType >& s1, const VecType< FloatType >& s2 ) noexcept { + // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_left = true; + if ( point[0] < s1[0] ) in_left = false; if ( point[1] < s1[1] ) in_left = false; @@ -113,6 +115,7 @@ class TraversalPredicates< DIMENSION_2, FloatType > const VecType< FloatType >& s2, const VecType< FloatType >& s3 ) noexcept { + // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_right = true; if ( point[0] < s2[2] ) in_right = false; @@ -142,7 +145,9 @@ class TraversalPredicates< DIMENSION_3, FloatType > const VecType< FloatType >& s2 ) noexcept { + // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_left = true; + if ( point[0] < s1[0] ) in_left = false; if ( point[1] < s1[1] ) in_left = false; if ( point[2] < s1[2] ) in_left = false; @@ -160,6 +165,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > const VecType< FloatType >& s2, const VecType< FloatType >& s3 ) noexcept { + // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_right = true; if ( point[0] < s2[2] ) in_right = false; From 9510998815994422b1680ca8e21c89472dfe09df Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 27 Feb 2020 13:54:08 -0800 Subject: [PATCH 047/632] COMP: resolve rebase conflicts --- src/axom/spin/BVH.hpp | 355 ------------------ .../spin/internal/linear_bvh/BVH_impl.hpp | 8 +- 2 files changed, 4 insertions(+), 359 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index b743ea71e9..cd02b870ba 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -260,364 +260,9 @@ class BVH DISABLE_MOVE_AND_ASSIGNMENT(BVH); }; -<<<<<<< HEAD -//------------------------------------------------------------------------------ -// BVH IMPLEMENTATION -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// PRIVATE HELPER METHOD IMPLEMENTATION -//------------------------------------------------------------------------------ - -/*! - * \def BVH_PREDICATE - * - * \brief Macro that defines a traversal predicate functor. - * - * \param _predicateName the name of the predicate, e.g., `leftPredicate` - * \param _p the primitive type - * \param _s1 the 1st BVH segment consisting of the BVH bin information - * \param _s2 the 2nd BVH segment consisting of the BVH bin information - * - * \note The BVH_PREDICATE may be instantiated within or outside a kernel. - * - * \note This macro is intended to be used internally by the BVH implementation. - */ -#define BVH_PREDICATE(_predicateName, _p, _s1, _s2 ) \ - auto _predicateName = [] AXOM_HOST_DEVICE( _p, _s1, _s2 ) -> bool - -/*! - * \def BVH_LEAF_ACTION - * - * \brief Macro that defines the leaf action functor for a BVH traversal. - * - * \param _funcName the nem of the functor, .e.g, `leafAction` - * \param _node the BVH node ID - * \param _leafNodes the leafNodes - * - * \note The BVH_LEAF_ACTION macro must be called within a kernel. - * - * \note This macro is intended to be used internally by the BVH implementation. - */ -#define BVH_LEAF_ACTION( _funcName, _node, _leafNodes ) \ - auto _funcName = [&]( _node, _leafNodes ) -> void - -namespace -{ - -/*! - * \brief Performs a traversal to count the candidates for each query point. - * - * \param [in] leftCheck functor for left bin predicate check. - * \param [in] rightCheck functor for right bin predicate check. - * \param [in] inner_nodes array of vec4s for the BVH inner nodes. - * \param [in] leaf_nodes array of BVH leaf node indices - * \param [in] N the number of user-supplied query points - * \param [out] counts array of candidate counts for each query point. - * \param [in] x user-supplied array of x-coordinates - * \param [in] y user-supplied array of y-coordinates - * \param [in] z user-supplied array of z-coordinates - * - * \return total_count the total count of candidates for all query points. - */ -template < int NDIMS, typename ExecSpace, - typename LeftPredicate, - typename RightPredicate, - typename FloatType > -IndexType bvh_get_counts( - LeftPredicate&& leftCheck, - RightPredicate&& rightCheck, - const internal::linear_bvh::Vec< FloatType,4 >* inner_nodes, - const int32* leaf_nodes, - IndexType N, - IndexType* counts, - const FloatType* x, - const FloatType* y, - const FloatType* z ) noexcept -{ - // sanity checks - SLIC_ASSERT( inner_nodes != nullptr ); - SLIC_ASSERT( leaf_nodes != nullptr ); - SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); - SLIC_ERROR_IF( x == nullptr, "supplied null pointer for x-coordinates!" ); - SLIC_ERROR_IF( y == nullptr, "supplied null pointer for y-coordinates!" ); - SLIC_ERROR_IF( (z==nullptr && NDIMS==3), - "supplied null pointer for z-coordinates!" ); - - namespace bvh = internal::linear_bvh; - using point_t = bvh::Vec< FloatType, NDIMS >; - - // STEP 1: count number of candidates for each query point - using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; - RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); - - using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; - for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) - { - int32 count = 0; - point_t point; - QueryAccessor::getPoint( point, i, x, y, z ); - - - BVH_LEAF_ACTION( leafAction, - int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) { - count ++; - }; - - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftCheck, - rightCheck, - leafAction ); - - counts[ i ] = count; - total_count += count; - - } ); - - return ( total_count.get() ); } - -} /* end anonymous namespace */ - -//------------------------------------------------------------------------------ -// PUBLIC API IMPLEMENTATION -//------------------------------------------------------------------------------ -template< int NDIMS, typename ExecSpace, typename FloatType > -BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, - IndexType numItems ) : - m_scaleFactor( DEFAULT_SCALE_FACTOR ), - m_numItems( numItems ), - m_boxes( boxes ) -{ - -} - -//------------------------------------------------------------------------------ -template< int NDIMS, typename ExecSpace, typename FloatType > -BVH< NDIMS, ExecSpace, FloatType >::~BVH() -{ - m_bvh.deallocate(); } -//------------------------------------------------------------------------------ -template< int NDIMS, typename ExecSpace, typename FloatType > -int BVH< NDIMS, ExecSpace, FloatType >::build() -{ - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - - // STEP 1: Handle case when user supplied a single bounding box - int numBoxes = m_numItems; - FloatType* boxesptr = nullptr; - if ( m_numItems == 1 ) - { - numBoxes = 2; - constexpr int32 M = NDIMS * 2; // number of entries for one box - const int N = numBoxes * M; // number of entries for N boxes - boxesptr = axom::allocate< FloatType >( N ); - - const FloatType* myboxes = m_boxes; - - // copy first box and add a fake 2nd box - for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) - { - boxesptr[ i ] = ( i < M ) ? myboxes[ i ] : 0.0; - } ); - - } // END if single item - else - { - boxesptr = const_cast< FloatType* >( m_boxes ); - } - - // STEP 2: Build a RadixTree consisting of the bounding boxes, sorted - // by their corresponding morton code. - internal::linear_bvh::RadixTree< FloatType, NDIMS > radix_tree; - internal::linear_bvh::AABB< FloatType, NDIMS > global_bounds; - internal::linear_bvh::build_radix_tree< ExecSpace >( - boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor ); - - // STEP 3: emit the BVH data-structure from the radix tree - m_bvh.m_bounds = global_bounds; - m_bvh.allocate( numBoxes ); - - // STEP 4: emit the BVH - internal::linear_bvh::emit_bvh< ExecSpace >( radix_tree, m_bvh ); - - radix_tree.deallocate(); - - // STEP 5: deallocate boxesptr if user supplied a single box - if ( m_numItems == 1 ) - { - SLIC_ASSERT( boxesptr != m_boxes ); - axom::deallocate( boxesptr ); - } - - // STEP 6: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); - return BVH_BUILD_OK; -} - -//------------------------------------------------------------------------------ -template< int NDIMS, typename ExecSpace, typename FloatType > -void BVH< NDIMS, ExecSpace, FloatType >::getBounds( FloatType* min, - FloatType* max ) const -{ - SLIC_ASSERT( min != nullptr ); - SLIC_ASSERT( max != nullptr ); - m_bvh.m_bounds.min( min ); - m_bvh.m_bounds.max( max ); -} - -//------------------------------------------------------------------------------ -template< int NDIMS, typename ExecSpace, typename FloatType > -void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, - IndexType* counts, - IndexType*& candidates, - IndexType numPts, - const FloatType* x, - const FloatType* y, - const FloatType* z ) const -{ - SLIC_ASSERT( offsets != nullptr ); - SLIC_ASSERT( counts != nullptr ); - SLIC_ASSERT( candidates == nullptr ); - SLIC_ASSERT( x != nullptr ); - SLIC_ASSERT( y != nullptr ); - - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - - namespace bvh = internal::linear_bvh; - using vec4_t = bvh::Vec< FloatType, 4 >; - using point_t = bvh::Vec< FloatType, NDIMS >; - using TraversalPredicates = bvh::TraversalPredicates< NDIMS, FloatType >; - using QueryAccessor = bvh::QueryAccessor< NDIMS, FloatType >; - - // STEP 1: count number of candidates for each query point - const vec4_t* inner_nodes = m_bvh.m_inner_nodes; - const int32* leaf_nodes = m_bvh.m_leaf_nodes; - SLIC_ASSERT( inner_nodes != nullptr ); - SLIC_ASSERT( leaf_nodes != nullptr ); - - // STEP 2: define traversal predicates - BVH_PREDICATE( leftPredicate, const point_t& p, - const vec4_t& s1, const vec4_t& s2 ) { - return TraversalPredicates::pointInLeftBin( p, s1, s2 ); - }; - - BVH_PREDICATE( rightPredicate, const point_t& p, - const vec4_t& s2, const vec4_t& s3 ) { - return TraversalPredicates::pointInRightBin( p, s2, s3 ); - }; - - // STEP 3: get counts - int total_count = bvh_get_counts< NDIMS,ExecSpace >( - leftPredicate, rightPredicate, inner_nodes, leaf_nodes, - numPts, counts, x, y, z ); - - using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; - RAJA::exclusive_scan< exec_policy >( - counts, counts+numPts, offsets, RAJA::operators::plus{} ); - - IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates); - - // STEP 4: fill in candidates for each point - for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) - { - int32 offset = offsets[ i ]; - - point_t point; - QueryAccessor::getPoint( point, i, x, y, z ); - - BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { - candidates[offset] = leaf_nodes[current_node]; - offset++; - }; - - bvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftPredicate, - rightPredicate, - leafAction ); - - } ); - - // STEP 3: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); -} - -//------------------------------------------------------------------------------ -template < int NDIMS, typename ExecSpace, typename FloatType > -void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( - const std::string& fileName ) const -{ - std::ostringstream nodes; - std::ostringstream cells; - std::ostringstream levels; - - // STEP 0: Write VTK header - std::ofstream ofs; - ofs.open( fileName.c_str() ); - ofs << "# vtk DataFile Version 3.0\n"; - ofs << " BVHTree \n"; - ofs << "ASCII\n"; - ofs << "DATASET UNSTRUCTURED_GRID\n"; - - // STEP 1: write root - int32 numPoints = 0; - int32 numBins = 0; - internal::linear_bvh::write_root( - m_bvh.m_bounds, numPoints, numBins,nodes,cells,levels ); - - - // STEP 2: traverse the BVH and dump each bin - constexpr int32 ROOT = 0; - internal::linear_bvh::write_recursive< FloatType, NDIMS >( - m_bvh.m_inner_nodes, ROOT, 1, numPoints, numBins, nodes, cells, levels ); - - // STEP 3: write nodes - ofs << "POINTS " << numPoints << " double\n"; - ofs << nodes.str() << std::endl; - - // STEP 4: write cells - const int32 nnodes = (NDIMS==2) ? 4 : 8; - ofs << "CELLS " << numBins << " " << numBins*(nnodes+1) << std::endl; - ofs << cells.str() << std::endl; - - // STEP 5: write cell types - ofs << "CELL_TYPES " << numBins << std::endl; - const int32 cellType = (NDIMS==2) ? 9 : 12; - for ( int32 i=0; i < numBins; ++i ) - { - ofs << cellType << std::endl; - } - - // STEP 6: dump level information - ofs << "CELL_DATA " << numBins << std::endl; - ofs << "SCALARS level int\n"; - ofs << "LOOKUP_TABLE default\n"; - ofs << levels.str() << std::endl; - ofs << std::endl; - - // STEP 7: close file - ofs.close(); -} - -#undef BVH_PREDICATE -#undef BVH_LEAF_ACTION -} /* namespace spin */ -} /* namespace axom */ - #include "axom/spin/internal/linear_bvh/BVH_impl.hpp" #endif /* AXOM_PRIMAL_BVH_H_ */ diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index a4e535ae87..772f250c7d 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -188,7 +188,7 @@ template< int NDIMS, typename ExecSpace, typename FloatType > int BVH< NDIMS, ExecSpace, FloatType >::build() { // STEP 0: set the default memory allocator to use for the execution space. - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); @@ -240,7 +240,7 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() } // STEP 6: restore default allocator - axom::setDefaultAllocator( current_allocator ); + axom::setDefaultAllocator( currentAllocatorID ); return BVH_BUILD_OK; } @@ -272,7 +272,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, SLIC_ASSERT( y != nullptr ); // STEP 0: set the default memory allocator to use for the execution space. - umpire::Allocator current_allocator = axom::getDefaultAllocator(); + const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); axom::setDefaultAllocator( allocatorID ); @@ -338,7 +338,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, } ); // STEP 3: restore default allocator - axom::setDefaultAllocator( current_allocator ); + axom::setDefaultAllocator( currentAllocatorID ); } //------------------------------------------------------------------------------ From 898cef37acb621362a9db75c80db1595de1f8ea5 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Mon, 9 Mar 2020 12:24:41 -0700 Subject: [PATCH 048/632] Updates macOS host image on Azure from High Sierra to Mojave See: https://github.com/LLNL/axom/issues/181 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 350262608f..8894010126 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -54,7 +54,7 @@ strategy: TEST_TARGET: 'linux_clang6' HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-clang@6.0.0' osx_gcc: - VM_ImageName: 'macos-10.13' + VM_ImageName: 'macos-10.14' CMAKE_EXTRA_FLAGS: '-DAXOM_ENABLE_SIDRE=Off' TEST_TARGET: 'osx_gcc' windows: From 3d894839acf05811eafa4126eaea83e8c7cde1ac Mon Sep 17 00:00:00 2001 From: "Thomas A. Brunner" Date: Mon, 9 Mar 2020 09:31:33 -0700 Subject: [PATCH 049/632] Don't use gcc's non-standandard abi::__cxa_demangle with clang's libc++ --- src/axom/slic/internal/stacktrace.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/axom/slic/internal/stacktrace.cpp b/src/axom/slic/internal/stacktrace.cpp index 80679a637a..76d2475825 100644 --- a/src/axom/slic/internal/stacktrace.cpp +++ b/src/axom/slic/internal/stacktrace.cpp @@ -13,7 +13,10 @@ #include #else #include // for backtrace() - #include // for abi::__cxa_demangle + #include + #if !defined(_LIBCPP_VERSION) + #include // for abi::__cxa_demangle + #endif #endif constexpr int MAX_FRAMES = 25; @@ -122,9 +125,13 @@ std::string demangle( char* backtraceString, int frame ) *returnOffset = 0; ++returnOffset; - int status; + int status = false; +#if !defined(_LIBCPP_VERSION) char* realName = abi::__cxa_demangle( mangledName, nullptr, nullptr, &status ); +#else + char* realName = mangledName; +#endif // if demangling is successful, output the demangled function name if (status == 0) From 4367e9ae42fde8cd0d288a2f902616b087b58ad6 Mon Sep 17 00:00:00 2001 From: "Thomas A. Brunner" Date: Mon, 9 Mar 2020 11:38:36 -0700 Subject: [PATCH 050/632] Fix freeing of memory we don't own. --- src/axom/slic/internal/stacktrace.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/axom/slic/internal/stacktrace.cpp b/src/axom/slic/internal/stacktrace.cpp index 76d2475825..02d075230b 100644 --- a/src/axom/slic/internal/stacktrace.cpp +++ b/src/axom/slic/internal/stacktrace.cpp @@ -144,7 +144,9 @@ std::string demangle( char* backtraceString, int frame ) oss << "Frame " << frame << ": " << mangledName << std::endl; } +#if !defined(_LIBCPP_VERSION) free(realName); +#endif } // otherwise, print the whole line else From 291c7b920be0760813ad3acb6e2c43b1048587de Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Wed, 6 Nov 2019 09:32:21 -0800 Subject: [PATCH 051/632] AXOM_HOST_DEVICE decorated ctors and methods for intersect_tri3D_tri3D --- src/axom/core/numerics/Determinants.hpp | 4 +- src/axom/core/numerics/matvecops.hpp | 24 +++++++---- src/axom/primal/CMakeLists.txt | 6 +++ src/axom/primal/geometry/NumericArray.hpp | 42 ++++++++++++------- src/axom/primal/geometry/Point.hpp | 16 +++++-- src/axom/primal/geometry/Triangle.hpp | 19 ++++++--- src/axom/primal/geometry/Vector.hpp | 30 +++++++++---- .../operators/detail/intersect_impl.hpp | 37 ++++++++-------- src/axom/primal/operators/intersect.hpp | 3 ++ 9 files changed, 124 insertions(+), 57 deletions(-) diff --git a/src/axom/core/numerics/Determinants.hpp b/src/axom/core/numerics/Determinants.hpp index cce66a48b3..936136f813 100644 --- a/src/axom/core/numerics/Determinants.hpp +++ b/src/axom/core/numerics/Determinants.hpp @@ -9,6 +9,7 @@ #include "axom/core/numerics/LU.hpp" // for lu_decompose() #include "axom/core/numerics/Matrix.hpp" // for Matrix +#include "axom/core/Macros.hpp" namespace axom { @@ -27,7 +28,8 @@ namespace numerics * \return det the determinant of the 2X2 matrix */ template < typename real > -inline real determinant( const real& a00, const real& a01, +inline AXOM_HOST_DEVICE +real determinant( const real& a00, const real& a01, const real& a10, const real& a11 ) { const real det = a00*a11 - a10*a01; diff --git a/src/axom/core/numerics/matvecops.hpp b/src/axom/core/numerics/matvecops.hpp index 4a44531abc..2a0ebb4024 100644 --- a/src/axom/core/numerics/matvecops.hpp +++ b/src/axom/core/numerics/matvecops.hpp @@ -24,6 +24,8 @@ #include // for assert() #include // for sqrt() +#include "axom/core/Macros.hpp" + namespace axom { namespace numerics @@ -85,7 +87,8 @@ inline bool linspace( const T& x0, const T& x1, T* v, int N ); * */ template < typename T > -inline void cross_product( const T* u, const T* v, T* w ); +inline AXOM_HOST_DEVICE +void cross_product( const T* u, const T* v, T* w ); /*! * \brief Computes the dot product of the arrays u and v. @@ -103,7 +106,8 @@ inline void cross_product( const T* u, const T* v, T* w ); * \pre v has at least dim entries */ template < typename T > -inline T dot_product( const T* u, const T* v, int dim); +inline AXOM_HOST_DEVICE +T dot_product( const T* u, const T* v, int dim); /*! * \brief Makes u orthogonal to v. @@ -571,9 +575,11 @@ inline bool linspace( const T& x0, const T& x1, T* v, int N ) template < typename T > inline void cross_product( const T* u, const T* v, T* w ) { - assert( "pre: u pointer is null" && (u != nullptr) ); - assert( "pre: v pointer is null" && (v != nullptr) ); - assert( "pre: w pointer is null" && (w != nullptr) ); + #ifndef AXOM_USE_RAJA + assert( "pre: u pointer is null" && (u != nullptr) ); + assert( "pre: v pointer is null" && (v != nullptr) ); + assert( "pre: w pointer is null" && (w != nullptr) ); + #endif w[ 0 ] = numerics::determinant( u[1], u[2], v[1], v[2] ); @@ -586,9 +592,11 @@ inline void cross_product( const T* u, const T* v, T* w ) template < typename T > inline T dot_product( const T* u, const T* v, int dim) { - assert("pre: u pointer is null" && (u != nullptr)); - assert("pre: v pointer is null" && (v != nullptr)); - assert("pre: dim >= 1" && (dim >= 1)); + #ifndef AXOM_USE_RAJA + assert("pre: u pointer is null" && (u != nullptr)); + assert("pre: v pointer is null" && (v != nullptr)); + assert("pre: dim >= 1" && (dim >= 1)); + #endif T res = u[0]*v[0]; for (int i = 1 ; i < dim ; ++i) diff --git a/src/axom/primal/CMakeLists.txt b/src/axom/primal/CMakeLists.txt index 9b8ede99d6..e46ea22025 100644 --- a/src/axom/primal/CMakeLists.txt +++ b/src/axom/primal/CMakeLists.txt @@ -60,6 +60,8 @@ set( primal_dependencies core slic ) + +blt_list_append( TO primal_dependencies ELEMENTS cuda IF ${ENABLE_CUDA} ) blt_add_library( NAME primal @@ -70,6 +72,10 @@ blt_add_library( OBJECT TRUE ) +if (ENABLE_CUDA) + set_target_properties(primal PROPERTIES CUDA_SEPARABLE_COMPILATION ON) +endif() + axom_write_unified_header(NAME primal HEADERS ${primal_headers}) diff --git a/src/axom/primal/geometry/NumericArray.hpp b/src/axom/primal/geometry/NumericArray.hpp index e0814a93c0..fdfb268059 100644 --- a/src/axom/primal/geometry/NumericArray.hpp +++ b/src/axom/primal/geometry/NumericArray.hpp @@ -12,6 +12,8 @@ #include "axom/slic/interface/slic.hpp" +#include "axom/core/Macros.hpp" + // C/C++ includes #include // For memcpy() #include // For std:: copy and fill @@ -66,6 +68,7 @@ NumericArray< T,SIZE > operator+( const NumericArray< T,SIZE >& lhs, * \result C resulting numeric array from component-wise subtraction. */ template < typename T,int SIZE > +AXOM_HOST_DEVICE NumericArray< T,SIZE > operator-( const NumericArray< T,SIZE >& lhs, const NumericArray< T,SIZE >& rhs ); @@ -201,6 +204,7 @@ class NumericArray * The rest will be set to zero. Defaults is SIZE. * If sz is greater than SIZE, we set all coordinates to val */ + AXOM_HOST_DEVICE explicit NumericArray( T val = T(), int sz = SIZE); /*! @@ -209,17 +213,20 @@ class NumericArray * \param [in] sz number of coordinates. Defaults to SIZE. * \note If sz is greater than SIZE, we only take the first SIZE values. */ + AXOM_HOST_DEVICE NumericArray(const T* vals, int sz = SIZE); /*! * \brief Copy constructor. * \param [in] other The numeric array to copy */ + AXOM_HOST_DEVICE NumericArray( const NumericArray& other ) { *this = other; }; /*! * \brief Destructor. */ + AXOM_HOST_DEVICE ~NumericArray() { } /*! @@ -233,6 +240,7 @@ class NumericArray * \brief Assignment operator. * \param [in] rhs a numeric array instance on the right hand side. */ + AXOM_HOST_DEVICE NumericArray& operator=(const NumericArray& rhs); /*! @@ -241,14 +249,14 @@ class NumericArray * \return \f$ p_i \f$ the value at the given component index. * \pre \f$ 0 \le i < SIZE \f$ */ - const T& operator[](int i) const; - T& operator[](int i); + AXOM_HOST_DEVICE const T& operator[](int i) const; + AXOM_HOST_DEVICE T& operator[](int i); /*! * \brief Returns a pointer to the underlying data. */ - const T* data() const; - T* data(); + AXOM_HOST_DEVICE const T* data() const; + AXOM_HOST_DEVICE T* data(); /*! * @@ -280,6 +288,7 @@ class NumericArray * Subtracts the numeric array arr from this instance (component-wise). * \return A reference to the NumericArray instance after subtraction. */ + AXOM_HOST_DEVICE NumericArray< T,SIZE >& operator-=( const NumericArray< T,SIZE >& arr ); /*! @@ -289,6 +298,7 @@ class NumericArray * \return A reference to the NumericArray instance after scalar * multiplication. */ + AXOM_HOST_DEVICE NumericArray< T,SIZE >& operator*=(double scalar); /*! @@ -298,6 +308,7 @@ class NumericArray * Each element of the numeric array is divided by scalar * \return A reference to the NumericArray instance after scalar division. */ + AXOM_HOST_DEVICE NumericArray< T,SIZE >& operator/=(double scalar); /*! @@ -307,6 +318,7 @@ class NumericArray * \return A reference to the NumericArray instance after cwise * multiplication. */ + AXOM_HOST_DEVICE NumericArray< T,SIZE >& operator*=( const NumericArray< T,SIZE >& arr ); /*! @@ -379,6 +391,7 @@ class NumericArray int argMin() const; private: + AXOM_HOST_DEVICE void verifyIndex(int AXOM_DEBUG_PARAM(idx)) const { SLIC_ASSERT(idx >= 0 && idx < SIZE); @@ -410,12 +423,13 @@ NumericArray< T,SIZE >::NumericArray(T val, int sz) // Fill first nvals coordinates with val ( 0 <= nvals <= SIZE ) const int nvals = axom::utilities::clampVal(sz, 0, SIZE); - std::fill( m_components, m_components+nvals, val ); + for (int i = 0; i < nvals; i++) { + m_components[i] = val; + } // Fill any remaining coordinates with zero - if ( nvals < SIZE ) - { - std::fill( m_components+nvals, m_components+SIZE, T() ); + for (int j = nvals; j < SIZE; j++) { + m_components[j] = T(); } } @@ -428,19 +442,19 @@ NumericArray< T, SIZE >::NumericArray(const T* vals, int sz) const int nvals = axom::utilities::clampVal(sz, 0, SIZE); // Copy first nvals coordinates from vals array ( 0 <= nvals <= SIZE ) - std::copy( vals, vals+nvals, m_components); + for (int i = 0; i < nvals; i++) { + m_components[i] = vals[i]; + } // Fill any remaining coordinates with zero - if ( nvals < SIZE) - { - std::fill( m_components+nvals, m_components+SIZE, T()); + for (int j = nvals; j < SIZE; j++) { + m_components[j] = T(); } - } //------------------------------------------------------------------------------ template < typename T,int SIZE > -inline NumericArray< T,SIZE >& +inline AXOM_HOST_DEVICE NumericArray< T,SIZE >& NumericArray< T,SIZE >::operator=( const NumericArray< T,SIZE >& rhs ) { diff --git a/src/axom/primal/geometry/Point.hpp b/src/axom/primal/geometry/Point.hpp index d21d36e59e..aff8670e4a 100644 --- a/src/axom/primal/geometry/Point.hpp +++ b/src/axom/primal/geometry/Point.hpp @@ -10,6 +10,8 @@ #include "axom/primal/geometry/NumericArray.hpp" +#include "axom/core/Macros.hpp" + // C/C++ includes #include // For memcpy() #include // For print() and operator << @@ -77,12 +79,14 @@ class Point * The rest will be set to zero. Defaults is NDIMS. * If sz is greater than NDIMS, we set all coordinates to val */ + AXOM_HOST_DEVICE explicit Point(T val = T(), int sz = NDIMS) : m_components(val,sz) { } /*! * \brief Constructor from a numeric array * \param [in] arr The numeric array to copy from */ + AXOM_HOST_DEVICE Point(const NumericArray< T,NDIMS >& arr) : m_components(arr) { } /*! @@ -91,17 +95,20 @@ class Point * \param [in] sz num values to copy from the vals array. Defaults to NDIMS. * \note If sz is greater than NDIMS, we only take the first NDIMS values. */ + AXOM_HOST_DEVICE Point(const T* vals, int sz = NDIMS) : m_components(vals,sz) { } /*! * \brief Copy constructor. * \param [in] other The point to copy */ + AXOM_HOST_DEVICE Point( const Point& other) : m_components( other.m_components) { } /*! * \brief Destructor. */ + AXOM_HOST_DEVICE ~Point() { } /*! @@ -127,8 +134,8 @@ class Point * \return p[i] the value at the given component index. * \pre (i >= 0) && (i < ndims) */ - const T& operator[](int i) const { return m_components[i]; } - T& operator[](int i) { return m_components[i]; } + AXOM_HOST_DEVICE const T& operator[](int i) const { return m_components[i]; } + AXOM_HOST_DEVICE T& operator[](int i) { return m_components[i]; } ///@} @@ -146,8 +153,8 @@ class Point /*! * \brief Returns a reference to the underlying NumericArray. */ - const NumericArray< T,NDIMS >& array() const { return m_components; } - NumericArray< T,NDIMS >& array() { return m_components; } + AXOM_HOST_DEVICE const NumericArray< T,NDIMS >& array() const { return m_components; } + AXOM_HOST_DEVICE NumericArray< T,NDIMS >& array() { return m_components; } /*! * \brief Output the point's coordinates to the array @@ -183,6 +190,7 @@ class Point * \param [in] z the z--coordinate of the point. Default is 0.0. * \return p a Point instance with the given coordinates. */ + AXOM_HOST_DEVICE static Point make_point( const T& x, const T& y, const T& z=0.0 ); /*! diff --git a/src/axom/primal/geometry/Triangle.hpp b/src/axom/primal/geometry/Triangle.hpp index 99d9508815..80d3970624 100644 --- a/src/axom/primal/geometry/Triangle.hpp +++ b/src/axom/primal/geometry/Triangle.hpp @@ -14,6 +14,8 @@ #include "axom/slic/interface/slic.hpp" +#include "axom/core/Macros.hpp" + #include // for acos() #include // for std::ostream @@ -56,6 +58,7 @@ class Triangle /*! * \brief Default constructor. Creates a degenerate triangle. */ + AXOM_HOST_DEVICE Triangle() { } /*! @@ -64,6 +67,7 @@ class Triangle * \param [in] B point instance corresponding to vertex B of the triangle. * \param [in] C point instance corresponding to vertex C of the triangle. */ + AXOM_HOST_DEVICE Triangle( const PointType& A, const PointType& B, const PointType& C ); @@ -71,6 +75,7 @@ class Triangle /*! * \brief Destructor */ + AXOM_HOST_DEVICE ~Triangle() { } /*! @@ -78,6 +83,7 @@ class Triangle * \param idx The index of the desired vertex * \pre idx is 0, 1 or 2 */ + AXOM_HOST_DEVICE PointType& operator[](int idx) { SLIC_ASSERT(idx >=0 && idx < NUM_TRI_VERTS); @@ -89,6 +95,7 @@ class Triangle * \param idx The index of the desired vertex * \pre idx is 0, 1 or 2 */ + AXOM_HOST_DEVICE const PointType& operator[](int idx) const { SLIC_ASSERT(idx >=0 && idx < NUM_TRI_VERTS); @@ -100,6 +107,7 @@ class Triangle * \pre This function is only valid when NDIMS = 3 * \return n triangle normal when NDIMS=3, zero vector otherwise */ + AXOM_HOST_DEVICE VectorType normal() const { SLIC_CHECK_MSG(NDIMS==3, "Triangle::normal() is only valid in 3D."); @@ -114,6 +122,7 @@ class Triangle * \brief Returns the area of the triangle * \pre Only defined when dimension NDIMS is 2 or 3 */ + AXOM_HOST_DEVICE double area() const { SLIC_CHECK_MSG( NDIMS == 2 || NDIMS == 3, @@ -241,6 +250,7 @@ class Triangle * \return true iff the triangle is degenerate (0 area) * \see primal::Point */ + AXOM_HOST_DEVICE bool degenerate(double eps = 1.0e-12) const { return axom::utilities::isNearlyEqual(area(), 0.0, eps); @@ -305,12 +315,9 @@ namespace primal template < typename T, int NDIMS > Triangle< T,NDIMS >::Triangle( const PointType& A, const PointType& B, - const PointType& C ) -{ - m_points[0] = A; - m_points[1] = B; - m_points[2] = C; -} + const PointType& C ): + m_points{A,B,C} +{} //------------------------------------------------------------------------------ template < typename T, int NDIMS > diff --git a/src/axom/primal/geometry/Vector.hpp b/src/axom/primal/geometry/Vector.hpp index a2e363b6c5..eeacafd73d 100644 --- a/src/axom/primal/geometry/Vector.hpp +++ b/src/axom/primal/geometry/Vector.hpp @@ -14,6 +14,8 @@ #include "axom/primal/geometry/NumericArray.hpp" #include "axom/primal/geometry/Point.hpp" +#include "axom/core/Macros.hpp" + // C/C++ includes #include // for sqrt() @@ -123,12 +125,14 @@ class Vector * \param [in] sz The number of coordinates to set to val. * The rest will be set to zero. Defaults is NDIMS. */ + AXOM_HOST_DEVICE explicit Vector( T val = T(), int sz = NDIMS) : m_components(val, sz) { } /*! * \brief Constructor from a numeric array * \param [in] arr The numeric array to copy from */ + AXOM_HOST_DEVICE Vector( const NumericArray< T,NDIMS >& arr) : m_components(arr) { } /*! @@ -138,6 +142,7 @@ class Vector * to NDIMS. * If sz is greater than NDIMS, we only take the first NDIMS values. */ + AXOM_HOST_DEVICE Vector(const T* vals, int sz = NDIMS) : m_components(vals, sz) {} /*! @@ -145,12 +150,14 @@ class Vector * \param [in] pt The point containing the vector's coordinates. * \note Equivalent to Vector( Point::zero(), pt) */ + AXOM_HOST_DEVICE Vector(const Point< T,NDIMS > & pt) : m_components( pt.array() ) {} /*! * \brief Copy constructor * \param [in] other The vector to copy */ + AXOM_HOST_DEVICE Vector(const Vector< T,NDIMS > & other) : m_components( other.array() ) {} /*! @@ -160,12 +167,14 @@ class Vector * \pre A.dimension() == B.dimension() * \pre A.dimension() == ndims */ + AXOM_HOST_DEVICE Vector( const Point< T,NDIMS >& A, const Point< T,NDIMS >& B ) : m_components(B.array() - A.array()) {} /*! * \brief Destructor. */ + AXOM_HOST_DEVICE ~Vector() {} /*! @@ -181,20 +190,20 @@ class Vector * \return p[i] the value at the given component index. * \pre (i >= 0) && (i < ndims) */ - const T& operator[](int i) const { return m_components[i]; } - T& operator[](int i) { return m_components[i]; } + AXOM_HOST_DEVICE const T& operator[](int i) const { return m_components[i]; } + AXOM_HOST_DEVICE T& operator[](int i) { return m_components[i]; } /*! * \brief Returns a reference to the underlying NumericArray. */ - const NumericArray< T,NDIMS > & array() const { return m_components; } - NumericArray< T,NDIMS >& array() { return m_components; } + AXOM_HOST_DEVICE const NumericArray< T,NDIMS > & array() const { return m_components; } + AXOM_HOST_DEVICE NumericArray< T,NDIMS >& array() { return m_components; } /*! * \brief Returns a pointer to the underlying data. */ - const T* data() const { return m_components.data(); } - T* data() { return m_components.data(); } + AXOM_HOST_DEVICE const T* data() const { return m_components.data(); } + AXOM_HOST_DEVICE T* data() { return m_components.data(); } /*! * \brief Equality comparison operator for vectors. @@ -235,6 +244,7 @@ class Vector * \pre scalar != 0 * \return A reference to the vector instance after scalar division. */ + AXOM_HOST_DEVICE Vector< T,NDIMS >& operator/=(T scalar); /*! @@ -242,6 +252,7 @@ class Vector * \param [in] v the other vector in the dot product * \return The dot product of the two vectors. */ + AXOM_HOST_DEVICE T dot(const Vector< T,NDIMS >& v ) const; /*! @@ -249,12 +260,14 @@ class Vector * \return n the squared norm. * \see Vector::norm() */ + AXOM_HOST_DEVICE double squared_norm() const; /*! * \brief Computes the \f$ l^2 \f$ norm of this vector instance. * \return n the norm of the vector, a.k.a., magnitude or length. */ + AXOM_HOST_DEVICE double norm() const; /*! @@ -267,6 +280,7 @@ class Vector * \note The unit vector of the zero vector is (1,0,0,...) when normalized. * \post this->norm() == 1.0f */ + AXOM_HOST_DEVICE Vector unitVector() const; /*! @@ -283,6 +297,7 @@ class Vector * \return dotprod the computed dot product. * \pre u.dimension() == v.dimension(). */ + AXOM_HOST_DEVICE static T dot_product( const Vector< T,NDIMS >& u, const Vector< T,NDIMS >& v ); @@ -301,6 +316,7 @@ class Vector * \param [in] v the vector on the left-hand side. * \return C the resulting vector from A x B. */ + AXOM_HOST_DEVICE static Vector< T,3 > cross_product( const Vector< T,3 >& u, const Vector< T,3 >& v ); @@ -389,7 +405,7 @@ inline double Vector< T, NDIMS >::norm() const template < typename T, int NDIMS > inline Vector< T, NDIMS > Vector< T, NDIMS >::unitVector() const { - static const double EPS = 1.0e-50; + constexpr double EPS = 1.0e-50; Vector v( *this); diff --git a/src/axom/primal/operators/detail/intersect_impl.hpp b/src/axom/primal/operators/detail/intersect_impl.hpp index 22d6092985..3bf6444b57 100644 --- a/src/axom/primal/operators/detail/intersect_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_impl.hpp @@ -23,6 +23,8 @@ #include "axom/primal/geometry/Segment.hpp" #include "axom/primal/geometry/Triangle.hpp" +#include "axom/core/Macros.hpp" + namespace axom { namespace primal @@ -38,27 +40,27 @@ typedef primal::Triangle< double, 3 > Triangle3; typedef primal::Triangle< double, 2 > Triangle2; typedef primal::Point< double, 2 > Point2; -bool isGt(double x, double y, double EPS=1.0e-12); -bool isLt(double x, double y, double EPS=1.0e-12); +AXOM_HOST_DEVICE bool isGt(double x, double y, double EPS=1.0e-12); +AXOM_HOST_DEVICE bool isLt(double x, double y, double EPS=1.0e-12); bool isLeq(double x, double y, double EPS=1.0e-12); -bool isLpeq(double x, double y, bool includeEqual = false, +AXOM_HOST_DEVICE bool isLpeq(double x, double y, bool includeEqual = false, double EPS=1.0e-12); -bool isGeq(double x, double y, double EPS=1.0e-12); -bool isGpeq(double x, double y, bool includeEqual = false, +AXOM_HOST_DEVICE bool isGeq(double x, double y, double EPS=1.0e-12); +AXOM_HOST_DEVICE bool isGpeq(double x, double y, bool includeEqual = false, double EPS=1.0e-12); -bool nonzeroSignMatch(double x, double y, double z, double EPS=1.0e-12); -bool twoZeros(double x, double y, double z, double EPS=1.0e-12); -bool oneZeroOthersMatch(double x, double y, double z, double EPS=1.0e-12); -int countZeros(double x, double y, double z, double EPS=1.0e-12); -double twoDcross(const Point2& A, const Point2& B, const Point2& C); +AXOM_HOST_DEVICE bool nonzeroSignMatch(double x, double y, double z, double EPS=1.0e-12); +AXOM_HOST_DEVICE bool twoZeros(double x, double y, double z, double EPS=1.0e-12); +AXOM_HOST_DEVICE bool oneZeroOthersMatch(double x, double y, double z, double EPS=1.0e-12); +AXOM_HOST_DEVICE int countZeros(double x, double y, double z, double EPS=1.0e-12); +AXOM_HOST_DEVICE double twoDcross(const Point2& A, const Point2& B, const Point2& C); -bool checkEdge(const Point2& p1, +AXOM_HOST_DEVICE bool checkEdge(const Point2& p1, const Point2& q1, const Point2& r1, const Point2& p2, const Point2& r2, bool includeBoundary); -bool checkVertex(const Point2& p1, +AXOM_HOST_DEVICE bool checkVertex(const Point2& p1, const Point2& q1, const Point2& r1, const Point2& p2, @@ -66,7 +68,7 @@ bool checkVertex(const Point2& p1, const Point2& r2, bool includeBoundary); -bool intersectPermuted2DTriangles(const Point2& p1, +AXOM_HOST_DEVICE bool intersectPermuted2DTriangles(const Point2& p1, const Point2& q1, const Point2& r1, const Point2& p2, @@ -74,13 +76,13 @@ bool intersectPermuted2DTriangles(const Point2& p1, const Point2& r2, bool includeBoundary); -bool intersectOnePermutedTriangle( +AXOM_HOST_DEVICE bool intersectOnePermutedTriangle( const Point3 &p1, const Point3 &q1, const Point3 &r1, const Point3 &p2, const Point3 &q2, const Point3 &r2, double dp2, double dq2, double dr2, Vector3 &normal, bool includeBoundary); -bool intersectTwoPermutedTriangles(const Point3& p1, +AXOM_HOST_DEVICE bool intersectTwoPermutedTriangles(const Point3& p1, const Point3& q1, const Point3& r1, const Point3& p2, @@ -88,7 +90,7 @@ bool intersectTwoPermutedTriangles(const Point3& p1, const Point3& r2, bool includeBoundary); -bool intersectCoplanar3DTriangles(const Point3& p1, +AXOM_HOST_DEVICE bool intersectCoplanar3DTriangles(const Point3& p1, const Point3& q1, const Point3& r1, const Point3& p2, @@ -97,7 +99,7 @@ bool intersectCoplanar3DTriangles(const Point3& p1, Vector3 normal, bool includeBoundary); -bool TriangleIntersection2D(const Triangle2& t1, +AXOM_HOST_DEVICE bool TriangleIntersection2D(const Triangle2& t1, const Triangle2& t2, bool includeBoundary = false); @@ -123,6 +125,7 @@ bool TriangleIntersection2D(const Triangle2& t1, * Tests, RR-4488, INRIA (2002). https://hal.inria.fr/inria-00072100/ */ template < typename T > +AXOM_HOST_DEVICE bool intersect_tri3D_tri3D( const Triangle< T, 3 >& t1, const Triangle< T, 3 >& t2, bool includeBoundary = false) diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index eccb6e61a6..2346b01796 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -26,6 +26,8 @@ #include "axom/primal/operators/detail/intersect_impl.hpp" #include "axom/primal/operators/detail/intersect_bezier_impl.hpp" +#include "axom/core/Macros.hpp" + namespace axom { namespace primal @@ -40,6 +42,7 @@ namespace primal * triangle boundaries in intersections, specify includeBoundary as true. */ template < typename T > +AXOM_HOST_DEVICE bool intersect( const Triangle< T, 3 >& t1, const Triangle< T, 3 >& t2, const bool includeBoundary = false) From 5716d16124ee212b4917c40ad8aa5ab0151a3570 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Wed, 20 Nov 2019 20:28:46 -0800 Subject: [PATCH 052/632] Uses CUDA_SEPARABLE_COMPILATION flag in blueos9 host-config It seems that there was a conflict with setting the CUDA_SEPARABLE_COMPILATION flag on one of the libraries in axom (primal) and compiling axom's libraries as object libraries. --- src/axom/primal/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/axom/primal/CMakeLists.txt b/src/axom/primal/CMakeLists.txt index e46ea22025..f9bc57c0fc 100644 --- a/src/axom/primal/CMakeLists.txt +++ b/src/axom/primal/CMakeLists.txt @@ -72,10 +72,6 @@ blt_add_library( OBJECT TRUE ) -if (ENABLE_CUDA) - set_target_properties(primal PROPERTIES CUDA_SEPARABLE_COMPILATION ON) -endif() - axom_write_unified_header(NAME primal HEADERS ${primal_headers}) From e8d3f4b82b8413f4de09a384c2db7bb2001031d0 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 21 Jan 2020 16:42:46 -0800 Subject: [PATCH 053/632] RAJAify naiveIntersectionAlgorithm in mesh_tester --- src/tools/CMakeLists.txt | 5 +- src/tools/mesh_tester.cpp | 155 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 154 insertions(+), 6 deletions(-) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 11f9cbc024..bec1269d7d 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -53,8 +53,11 @@ set(mesh_tester_depends blt_list_append(TO mesh_tester_depends ELEMENTS lumberjack mpi IF AXOM_ENABLE_LUMBERJACK) blt_list_append(TO mesh_tester_depends ELEMENTS openmp IF ENABLE_OPENMP) +blt_list_append( TO mesh_tester_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) +blt_list_append( TO mesh_tester_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) +blt_list_append( TO mesh_tester_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) -if(AXOM_ENABLE_QUEST) +if(AXOM_ENABLE_QUEST AND RAJA_FOUND) blt_add_executable( NAME mesh_tester SOURCES ${mesh_tester_sources} diff --git a/src/tools/mesh_tester.cpp b/src/tools/mesh_tester.cpp index ed5eede091..5c17815315 100644 --- a/src/tools/mesh_tester.cpp +++ b/src/tools/mesh_tester.cpp @@ -31,6 +31,24 @@ #include "axom/slic/streams/GenericOutputStream.hpp" #include "axom/slic/interface/slic.hpp" +// RAJA +#ifdef AXOM_USE_RAJA + #include "RAJA/RAJA.hpp" +#endif + +//Testing structured_exec +#include "axom/core/execution/execution_space.hpp" +#include "axom/core/Macros.hpp" + +#if defined (AXOM_USE_RAJA) && defined(AXOM_USE_OPENMP) + using exec = axom::OMP_EXEC; +#elif defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) + constexpr int CUDA_BLOCK_SIZE = 256; + using exec = axom::CUDA_EXEC; +#else + using exec = axom::SEQ_EXEC; +#endif + #include "CLI11/CLI11.hpp" // C/C++ includes @@ -84,6 +102,7 @@ void Input::parse(int argc, char** argv, CLI::App& app) app.add_option("-r,--resolution", resolution, "Resolution of uniform grid. \n" "Set to 1 to run the naive algorithm without a spatial index. \n" + "Set to 2 to run the naive algorithm with the GPU. \n" "Set to less than 1 to use the spatial index with a resolution \n" "of the cube root of the number of triangles.") ->capture_default_str(); @@ -158,7 +177,7 @@ void Input::fixOutfilePath() inline bool pointIsNearlyEqual(Point3& p1, Point3& p2, double EPS); -bool checkTT(Triangle3& t1, Triangle3& t2); +AXOM_HOST_DEVICE bool checkTT(Triangle3& t1, Triangle3& t2); std::vector< std::pair > naiveIntersectionAlgorithm( mint::Mesh* surface_mesh, std::vector & degenerate); @@ -250,6 +269,124 @@ std::vector< std::pair > naiveIntersectionAlgorithm( return retval; } +template < typename ExecSpace > +std::vector< std::pair > naiveIntersectionAlgorithm( + mint::Mesh* surface_mesh, + std::vector & degenerate) +{ + SLIC_INFO("Execution Space is " << + axom::execution_space< ExecSpace >::name()); + + // Get allocator + int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + umpire::Allocator allocator = axom::getAllocator(allocatorID); + + std::vector< std::pair > retval; + + const int ncells = surface_mesh->getNumberOfCells(); + SLIC_INFO("Checking mesh with a total of "<< ncells<< " cells."); + + Triangle3 * tris = axom::allocate (ncells, allocator); + + // Get each triangle in the mesh + for (int i = 0; i < ncells ; i++) + { + Triangle3 t1 = getMeshTriangle(i, surface_mesh); + tris[i] = t1; + if (t1.degenerate()) + { + degenerate.push_back(i); + } + } + + RAJA::RangeSegment row_range(0, ncells); + RAJA::RangeSegment col_range(0, ncells); + + // Kernel policy + #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) + using KERNEL_EXEC_POL = + RAJA::KernelPolicy< + RAJA::statement::CudaKernelFixed + > + > + > + >; + #elif defined(AXOM_USE_RAJA) && defined(AXOM_USE_OPENMP) + using KERNEL_EXEC_POL = RAJA::KernelPolicy< + RAJA::statement::For< 1, RAJA::omp_parallel_for_exec, + RAJA::statement::For< 0, RAJA::loop_exec, + RAJA::statement::Lambda< 0 > + > + > + >; + #else + using KERNEL_EXEC_POL = RAJA::KernelPolicy< + RAJA::statement::For< 1, RAJA::loop_exec, + RAJA::statement::For< 0, RAJA::loop_exec, + RAJA::statement::Lambda< 0 > + > + > + >; + #endif + + using REDUCE_POL = + typename axom::execution_space< ExecSpace >::reduce_policy; + using ATOMIC_POL = + typename axom::execution_space< ExecSpace >::atomic_policy; + + RAJA::ReduceSum< REDUCE_POL, int > numIntersect(0); + + // RAJA loop to find size to initialize (number of intersections) + RAJA::kernel( RAJA::make_tuple(col_range, row_range), + [=] AXOM_HOST_DEVICE (int col, int row) { + if (row > col) + { + if (checkTT (tris[row], tris[col])) + { + numIntersect += 1; + } + } + }); + + // Allocation to hold intersection pairs and counter to know where to store + int * intersections = + axom::allocate (numIntersect.get() * 2, allocator); + int * counter = axom::allocate (1, allocator); + + counter[0] = 0; + + // RAJA loop to populate with intersections + RAJA::kernel( RAJA::make_tuple(col_range, row_range), + [=] AXOM_HOST_DEVICE (int col, int row) { + if (row > col) + { + if (checkTT (tris[row], tris[col])) + { + auto idx = RAJA::atomicAdd(counter, 2); + intersections[idx] = row; + intersections[idx+1] = col; + + } + } + }); + + // Initialize pairs of clashes + for (int i = 0 ; i < numIntersect.get() * 2 ; i = i + 2) + { + retval.push_back(std::make_pair(intersections[i], intersections[i + 1])); + } + + // Deallocate + axom::deallocate(tris); + axom::deallocate(intersections); + axom::deallocate(counter); + + return retval; +} + void announceMeshProblems(int triangleCount, int intersectPairCount, int degenerateCount) @@ -348,11 +485,12 @@ void initializeLogger() * The mesh tester checks a triangulated surface mesh for several problems. * * Currently the mesh tester checks for intersecting triangles. This is - * implemented in two ways. First, a naive algorithm tests each triangle + * implemented in three ways. First, a naive algorithm tests each triangle * against each other triangle. This is easy to understand and verify, - * but slow. A second algorithm uses a UniformGrid to index the bounding - * box of the mesh, and checks each triangle for intersection with the - * triangles in all the bins the triangle's bounding box falls into. + * but slow. Second, the same naive algorithm is run on the GPU. A third + * algorithm uses a UniformGrid to index the bounding box of the mesh, + * and checks each triangle for intersection with the triangles in all the + * bins the triangle's bounding box falls into. * * Currently, the mesh tester works only with Triangle meshes. */ @@ -424,6 +562,13 @@ int main( int argc, char** argv ) // Naive method collisions = naiveIntersectionAlgorithm(surface_mesh, degenerate); } + + else if (params.resolution == 2){ + + //GPU naive method + collisions = naiveIntersectionAlgorithm< exec >(surface_mesh, + degenerate); + } else { // _check_repair_intersections_start From eb3a0daf01df374be074c6088902455e5b19f708 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Thu, 23 Jan 2020 13:27:51 -0800 Subject: [PATCH 054/632] Add compiler guards and make slic assert/checks assert() for device code --- src/axom/core/Macros.hpp | 9 +++++ src/axom/core/numerics/Matrix.hpp | 4 +-- src/axom/core/numerics/matvecops.hpp | 4 --- src/axom/primal/geometry/Vector.hpp | 1 + src/axom/slic/interface/slic_macros.hpp | 15 +++++++-- src/axom/slic/tests/slic_macros.cpp | 8 ++--- src/tools/CMakeLists.txt | 2 +- src/tools/mesh_tester.cpp | 45 +++++++++++++++++-------- 8 files changed, 60 insertions(+), 28 deletions(-) diff --git a/src/axom/core/Macros.hpp b/src/axom/core/Macros.hpp index 15def45766..a464b02918 100644 --- a/src/axom/core/Macros.hpp +++ b/src/axom/core/Macros.hpp @@ -69,6 +69,15 @@ #define AXOM_CUDA_TEST(X, Y) TEST(X, Y) #endif +/*! + * \def AXOM_DEVICE_CODE + * + * \brief Convenience macro used for kernel code + */ +#if defined (__CUDA_ARCH__) +#define AXOM_DEVICE_CODE +#endif + /*! * * \def AXOM_NOT_USED(x) diff --git a/src/axom/core/numerics/Matrix.hpp b/src/axom/core/numerics/Matrix.hpp index 8ea13c8aaa..3c00e8c254 100644 --- a/src/axom/core/numerics/Matrix.hpp +++ b/src/axom/core/numerics/Matrix.hpp @@ -606,7 +606,7 @@ AXOM_HOST_DEVICE Matrix< T >::Matrix( int rows, int cols, T* data, } else { -#if defined(__CUDA_ARCH__) +#if defined(AXOM_DEVICE_CODE) assert(false); #else const int nitems = m_rows * m_cols; @@ -923,7 +923,7 @@ void Matrix< T >::copy( const Matrix< T >& rhs ) template < typename T > AXOM_HOST_DEVICE void Matrix< T >::clear( ) { -#if defined(__CUDA_ARCH__) +#if defined(AXOM_DEVICE_CODE) assert(m_usingExternal); #else if ( !m_usingExternal ) diff --git a/src/axom/core/numerics/matvecops.hpp b/src/axom/core/numerics/matvecops.hpp index 2a0ebb4024..dfeb39532e 100644 --- a/src/axom/core/numerics/matvecops.hpp +++ b/src/axom/core/numerics/matvecops.hpp @@ -575,11 +575,9 @@ inline bool linspace( const T& x0, const T& x1, T* v, int N ) template < typename T > inline void cross_product( const T* u, const T* v, T* w ) { - #ifndef AXOM_USE_RAJA assert( "pre: u pointer is null" && (u != nullptr) ); assert( "pre: v pointer is null" && (v != nullptr) ); assert( "pre: w pointer is null" && (w != nullptr) ); - #endif w[ 0 ] = numerics::determinant( u[1], u[2], v[1], v[2] ); @@ -592,11 +590,9 @@ inline void cross_product( const T* u, const T* v, T* w ) template < typename T > inline T dot_product( const T* u, const T* v, int dim) { - #ifndef AXOM_USE_RAJA assert("pre: u pointer is null" && (u != nullptr)); assert("pre: v pointer is null" && (v != nullptr)); assert("pre: dim >= 1" && (dim >= 1)); - #endif T res = u[0]*v[0]; for (int i = 1 ; i < dim ; ++i) diff --git a/src/axom/primal/geometry/Vector.hpp b/src/axom/primal/geometry/Vector.hpp index eeacafd73d..66e119cf45 100644 --- a/src/axom/primal/geometry/Vector.hpp +++ b/src/axom/primal/geometry/Vector.hpp @@ -182,6 +182,7 @@ class Vector * \return d the dimension (size) of the vector * \post d >= 1. */ + AXOM_HOST_DEVICE int dimension() const { return NDIMS; }; /*! diff --git a/src/axom/slic/interface/slic_macros.hpp b/src/axom/slic/interface/slic_macros.hpp index 64c8be4e32..4de8540b7f 100644 --- a/src/axom/slic/interface/slic_macros.hpp +++ b/src/axom/slic/interface/slic_macros.hpp @@ -106,7 +106,8 @@ /// @} -#ifdef AXOM_DEBUG +// Use complete debug macros when not on device +#if defined(AXOM_DEBUG) && !defined(AXOM_DEVICE_CODE) //----------------------------------------------------------------------------- /// \name ASSERT MACROS @@ -223,6 +224,14 @@ /// @} +// Use assert when on device +#elif defined(AXOM_DEBUG) && defined(AXOM_DEVICE_CODE) + +#define SLIC_ASSERT( EXP ) assert (EXP) +#define SLIC_ASSERT_MSG( EXP, msg ) assert (EXP) +#define SLIC_CHECK( EXP ) assert (EXP) +#define SLIC_CHECK_MSG( EXP, msg ) assert (EXP) + #else // turn off debug macros and asserts #define SLIC_ASSERT( ignore_EXP ) ( (void)0 ) @@ -350,8 +359,8 @@ namespace detail */ struct FalseType { - FalseType() {} - inline operator bool() const { return false; } + AXOM_HOST_DEVICE FalseType() {} + AXOM_HOST_DEVICE inline operator bool() const { return false; } }; static const FalseType false_value; diff --git a/src/axom/slic/tests/slic_macros.cpp b/src/axom/slic/tests/slic_macros.cpp index 64d540a1d8..c5ac3cc2b2 100644 --- a/src/axom/slic/tests/slic_macros.cpp +++ b/src/axom/slic/tests/slic_macros.cpp @@ -224,7 +224,7 @@ TEST( slic_macros, test_assert_macros ) constexpr int val = 42; SLIC_ASSERT( val < 0 ); -#ifdef AXOM_DEBUG +#if defined(AXOM_DEBUG) && !defined(AXOM_DEVICE_CODE) EXPECT_FALSE( slic::internal::is_stream_empty() ); check_level( slic::internal::test_stream.str(), "ERROR" ); check_msg( slic::internal::test_stream.str(), "Failed Assert: val < 0" ); @@ -241,7 +241,7 @@ TEST( slic_macros, test_assert_macros ) EXPECT_TRUE( slic::internal::is_stream_empty() ); SLIC_ASSERT_MSG( val < 0, "val should be negative!" ); -#ifdef AXOM_DEBUG +#if defined(AXOM_DEBUG) && !defined(AXOM_DEVICE_CODE) EXPECT_FALSE( slic::internal::is_stream_empty() ); check_level( slic::internal::test_stream.str(), "ERROR" ); check_msg( slic::internal::test_stream.str(), @@ -264,7 +264,7 @@ TEST( slic_macros, test_check_macros ) constexpr int val = 42; SLIC_CHECK( val < 0 ); -#ifdef AXOM_DEBUG +#if defined(AXOM_DEBUG) && !defined(AXOM_DEVICE_CODE) EXPECT_FALSE( slic::internal::is_stream_empty() ); check_level( slic::internal::test_stream.str(), "WARNING" ); check_msg( slic::internal::test_stream.str(), "Failed Check: val < 0" ); @@ -281,7 +281,7 @@ TEST( slic_macros, test_check_macros ) EXPECT_TRUE( slic::internal::is_stream_empty() ); SLIC_CHECK_MSG( val < 0, "val should be negative!" ); -#ifdef AXOM_DEBUG +#if defined(AXOM_DEBUG) && !defined(AXOM_DEVICE_CODE) EXPECT_FALSE( slic::internal::is_stream_empty() ); check_level( slic::internal::test_stream.str(), "WARNING" ); check_msg( slic::internal::test_stream.str(), diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index bec1269d7d..83b13461a2 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -57,7 +57,7 @@ blt_list_append( TO mesh_tester_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) blt_list_append( TO mesh_tester_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO mesh_tester_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) -if(AXOM_ENABLE_QUEST AND RAJA_FOUND) +if(AXOM_ENABLE_QUEST) blt_add_executable( NAME mesh_tester SOURCES ${mesh_tester_sources} diff --git a/src/tools/mesh_tester.cpp b/src/tools/mesh_tester.cpp index 5c17815315..bde245e0a3 100644 --- a/src/tools/mesh_tester.cpp +++ b/src/tools/mesh_tester.cpp @@ -102,7 +102,7 @@ void Input::parse(int argc, char** argv, CLI::App& app) app.add_option("-r,--resolution", resolution, "Resolution of uniform grid. \n" "Set to 1 to run the naive algorithm without a spatial index. \n" - "Set to 2 to run the naive algorithm with the GPU. \n" + "Set to 2 to run the naive algorithm with raja. \n" "Set to less than 1 to use the spatial index with a resolution \n" "of the cube root of the number of triangles.") ->capture_default_str(); @@ -269,6 +269,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( return retval; } +#if defined(AXOM_USE_RAJA) template < typename ExecSpace > std::vector< std::pair > naiveIntersectionAlgorithm( mint::Mesh* surface_mesh, @@ -278,16 +279,22 @@ std::vector< std::pair > naiveIntersectionAlgorithm( axom::execution_space< ExecSpace >::name()); // Get allocator - int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - umpire::Allocator allocator = axom::getAllocator(allocatorID); + #ifdef AXOM_USE_UMPIRE + int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + umpire::Allocator allocator = axom::getAllocator(allocatorID); + #endif std::vector< std::pair > retval; const int ncells = surface_mesh->getNumberOfCells(); SLIC_INFO("Checking mesh with a total of "<< ncells<< " cells."); - Triangle3 * tris = axom::allocate (ncells, allocator); - + #ifdef AXOM_USE_UMPIRE + Triangle3 * tris = axom::allocate (ncells, allocator); + #else + Triangle3 * tris = axom::allocate (ncells); + #endif + // Get each triangle in the mesh for (int i = 0; i < ncells ; i++) { @@ -303,7 +310,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( RAJA::RangeSegment col_range(0, ncells); // Kernel policy - #if defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) + #if defined(AXOM_USE_CUDA) using KERNEL_EXEC_POL = RAJA::KernelPolicy< RAJA::statement::CudaKernelFixed > naiveIntersectionAlgorithm( > > >; - #elif defined(AXOM_USE_RAJA) && defined(AXOM_USE_OPENMP) + #elif defined(AXOM_USE_OPENMP) using KERNEL_EXEC_POL = RAJA::KernelPolicy< RAJA::statement::For< 1, RAJA::omp_parallel_for_exec, RAJA::statement::For< 0, RAJA::loop_exec, @@ -341,7 +348,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( // RAJA loop to find size to initialize (number of intersections) RAJA::kernel( RAJA::make_tuple(col_range, row_range), - [=] AXOM_HOST_DEVICE (int col, int row) { + AXOM_LAMBDA(int col, int row) { if (row > col) { if (checkTT (tris[row], tris[col])) @@ -352,15 +359,21 @@ std::vector< std::pair > naiveIntersectionAlgorithm( }); // Allocation to hold intersection pairs and counter to know where to store - int * intersections = - axom::allocate (numIntersect.get() * 2, allocator); - int * counter = axom::allocate (1, allocator); + #ifdef AXOM_USE_UMPIRE + int * intersections = + axom::allocate (numIntersect.get() * 2, allocator); + int * counter = axom::allocate (1, allocator); + #else + int * intersections = + axom::allocate (numIntersect.get() * 2); + int * counter = axom::allocate (1); + #endif counter[0] = 0; // RAJA loop to populate with intersections RAJA::kernel( RAJA::make_tuple(col_range, row_range), - [=] AXOM_HOST_DEVICE (int col, int row) { + AXOM_LAMBDA(int col, int row) { if (row > col) { if (checkTT (tris[row], tris[col])) @@ -386,6 +399,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( return retval; } +#endif // defined(AXOM_USE_RAJA) void announceMeshProblems(int triangleCount, int intersectPairCount, @@ -487,7 +501,7 @@ void initializeLogger() * Currently the mesh tester checks for intersecting triangles. This is * implemented in three ways. First, a naive algorithm tests each triangle * against each other triangle. This is easy to understand and verify, - * but slow. Second, the same naive algorithm is run on the GPU. A third + * but slow. Second, the same naive algorithm is run using raja. A third * algorithm uses a UniformGrid to index the bounding box of the mesh, * and checks each triangle for intersection with the triangles in all the * bins the triangle's bounding box falls into. @@ -563,12 +577,15 @@ int main( int argc, char** argv ) collisions = naiveIntersectionAlgorithm(surface_mesh, degenerate); } + #ifdef AXOM_USE_RAJA else if (params.resolution == 2){ - //GPU naive method + // raja naive method collisions = naiveIntersectionAlgorithm< exec >(surface_mesh, degenerate); } + #endif + else { // _check_repair_intersections_start From c5356b1533627f8a98c165300feeee3efa1aff14 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Thu, 30 Jan 2020 14:03:56 -0800 Subject: [PATCH 055/632] First pass runtime policy selection --- src/tools/mesh_tester.cpp | 119 +++++++++++++++++++++++--------------- 1 file changed, 72 insertions(+), 47 deletions(-) diff --git a/src/tools/mesh_tester.cpp b/src/tools/mesh_tester.cpp index bde245e0a3..bef1348d6c 100644 --- a/src/tools/mesh_tester.cpp +++ b/src/tools/mesh_tester.cpp @@ -36,17 +36,24 @@ #include "RAJA/RAJA.hpp" #endif -//Testing structured_exec -#include "axom/core/execution/execution_space.hpp" +// RAJA policies +#include "axom/mint/execution/internal/structured_exec.hpp" + #include "axom/core/Macros.hpp" -#if defined (AXOM_USE_RAJA) && defined(AXOM_USE_OPENMP) - using exec = axom::OMP_EXEC; -#elif defined(AXOM_USE_RAJA) && defined(AXOM_USE_CUDA) +#if defined (AXOM_USE_RAJA) + using seq_exec = axom::SEQ_EXEC; constexpr int CUDA_BLOCK_SIZE = 256; - using exec = axom::CUDA_EXEC; -#else - using exec = axom::SEQ_EXEC; + #if defined(AXOM_USE_OPENMP) + using omp_exec = axom::OMP_EXEC; + #else + using omp_exec = seq_exec; + #endif + #if defined(AXOM_USE_CUDA) + using cuda_exec = axom::CUDA_EXEC; + #else + using cuda_exec = seq_exec; + #endif #endif #include "CLI11/CLI11.hpp" @@ -70,10 +77,15 @@ using UniformGrid3 = spin::UniformGrid; using Vector3 = primal::Vector; using Segment3 = primal::Segment; +enum rajaPolicy { seq = 0, omp = 1, cuda = 2}; + struct Input { + static const std::set s_validPolicies; + std::string stlInput; std::string vtkOutput; + rajaPolicy policy; int resolution; double weldThreshold; @@ -83,6 +95,7 @@ struct Input : stlInput("") , vtkOutput("") , resolution(0) + , policy(seq) , weldThreshold(1e-6) , skipWeld(false) { }; @@ -97,6 +110,18 @@ struct Input void fixOutfilePath(); }; +const std::set Input::s_validPolicies({ + #ifdef AXOM_USE_RAJA + seq + #ifdef AXOM_USE_CUDA + ,cuda + #endif + #ifdef AXOM_USE_OPENMP + ,omp + #endif + #endif +}); + void Input::parse(int argc, char** argv, CLI::App& app) { app.add_option("-r,--resolution", resolution, @@ -107,6 +132,14 @@ void Input::parse(int argc, char** argv, CLI::App& app) "of the cube root of the number of triangles.") ->capture_default_str(); + app.add_option("-p, --policy", policy, + "With \'-r 2\', set policy of the raja kernel. \n" + "Set to 0 to use a sequential policy. \n" + "Set to 1 to use a OpenMP policy. \n" + "Set to 2 to use a CUDA policy.") + ->capture_default_str() + ->check(CLI::IsMember{Input::s_validPolicies}); + app.add_option("-i,--infile", stlInput,"The STL input file") ->required() ->check(CLI::ExistingFile); @@ -137,6 +170,13 @@ void Input::parse(int argc, char** argv, CLI::App& app) "Using parameter values: " <<"\n resolution = " << resolution << (resolution < 1 ? " (use cube root of triangle count)" : "") + << (resolution == 1 ? " (use naive algorithm)" : "") + << (resolution == 2 ? " (use naive algorithm with raja)" : "") + << (resolution == 2 ? "\n policy = " : "") + << (resolution == 2 ? std::to_string(policy) : "") + << (resolution == 2 && policy == seq ? " (use sequential policy)" : "") + << (resolution == 2 && policy == omp ? " (use OpenMP policy)" : "") + << (resolution == 2 && policy == cuda ? " (use CUDA policy)" : "") <<"\n weld threshold = " << weldThreshold <<"\n " << (skipWeld ? "" : "not ") << "skipping weld" <<"\n infile = " << stlInput @@ -201,6 +241,7 @@ inline bool pointIsNearlyEqual(Point3& p1, Point3& p2, double EPS=1.0e-9) axom::utilities::isNearlyEqual(p1[2], p2[2], EPS); } +AXOM_HOST_DEVICE bool checkTT(Triangle3& t1, Triangle3& t2) { if (t2.degenerate()) @@ -309,36 +350,8 @@ std::vector< std::pair > naiveIntersectionAlgorithm( RAJA::RangeSegment row_range(0, ncells); RAJA::RangeSegment col_range(0, ncells); - // Kernel policy - #if defined(AXOM_USE_CUDA) - using KERNEL_EXEC_POL = - RAJA::KernelPolicy< - RAJA::statement::CudaKernelFixed - > - > - > - >; - #elif defined(AXOM_USE_OPENMP) - using KERNEL_EXEC_POL = RAJA::KernelPolicy< - RAJA::statement::For< 1, RAJA::omp_parallel_for_exec, - RAJA::statement::For< 0, RAJA::loop_exec, - RAJA::statement::Lambda< 0 > - > - > - >; - #else - using KERNEL_EXEC_POL = RAJA::KernelPolicy< - RAJA::statement::For< 1, RAJA::loop_exec, - RAJA::statement::For< 0, RAJA::loop_exec, - RAJA::statement::Lambda< 0 > - > - > - >; - #endif - + using KERNEL_POL = + typename axom::mint::internal::structured_exec< ExecSpace >::loop2d_policy; using REDUCE_POL = typename axom::execution_space< ExecSpace >::reduce_policy; using ATOMIC_POL = @@ -346,8 +359,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( RAJA::ReduceSum< REDUCE_POL, int > numIntersect(0); - // RAJA loop to find size to initialize (number of intersections) - RAJA::kernel( RAJA::make_tuple(col_range, row_range), + RAJA::kernel( RAJA::make_tuple(col_range, row_range), AXOM_LAMBDA(int col, int row) { if (row > col) { @@ -356,7 +368,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( numIntersect += 1; } } - }); + }); // Allocation to hold intersection pairs and counter to know where to store #ifdef AXOM_USE_UMPIRE @@ -372,7 +384,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( counter[0] = 0; // RAJA loop to populate with intersections - RAJA::kernel( RAJA::make_tuple(col_range, row_range), + RAJA::kernel( RAJA::make_tuple(col_range, row_range), AXOM_LAMBDA(int col, int row) { if (row > col) { @@ -579,11 +591,24 @@ int main( int argc, char** argv ) #ifdef AXOM_USE_RAJA else if (params.resolution == 2){ - - // raja naive method - collisions = naiveIntersectionAlgorithm< exec >(surface_mesh, - degenerate); - } + + // raja naive method + switch (params.policy) + { + case omp: + collisions = naiveIntersectionAlgorithm< omp_exec >(surface_mesh, + degenerate); + break; + case cuda: + collisions = naiveIntersectionAlgorithm< cuda_exec >(surface_mesh, + degenerate); + break; + case seq: + collisions = naiveIntersectionAlgorithm< seq_exec >(surface_mesh, + degenerate); + break; + } + } // end of resolution == 2 #endif else From 15dd725bd2348a75e3c2cd5f94294e56b789e2d4 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Fri, 21 Feb 2020 16:41:31 -0800 Subject: [PATCH 056/632] Adds some build system and formatting changes --- src/axom/core/numerics/Determinants.hpp | 2 +- src/axom/core/numerics/matvecops.hpp | 12 ++++----- src/axom/primal/CMakeLists.txt | 2 +- src/axom/primal/geometry/NumericArray.hpp | 19 +++++++------- src/axom/primal/geometry/Point.hpp | 4 +-- src/axom/primal/geometry/Triangle.hpp | 12 ++++----- src/axom/primal/geometry/Vector.hpp | 7 +++--- .../operators/detail/intersect_impl.hpp | 25 ++++++++++++------- src/axom/primal/operators/intersect.hpp | 3 +-- src/tools/CMakeLists.txt | 6 ++--- 10 files changed, 48 insertions(+), 44 deletions(-) diff --git a/src/axom/core/numerics/Determinants.hpp b/src/axom/core/numerics/Determinants.hpp index 936136f813..e095748c67 100644 --- a/src/axom/core/numerics/Determinants.hpp +++ b/src/axom/core/numerics/Determinants.hpp @@ -30,7 +30,7 @@ namespace numerics template < typename real > inline AXOM_HOST_DEVICE real determinant( const real& a00, const real& a01, - const real& a10, const real& a11 ) + const real& a10, const real& a11 ) { const real det = a00*a11 - a10*a01; return det; diff --git a/src/axom/core/numerics/matvecops.hpp b/src/axom/core/numerics/matvecops.hpp index dfeb39532e..b92bc32724 100644 --- a/src/axom/core/numerics/matvecops.hpp +++ b/src/axom/core/numerics/matvecops.hpp @@ -575,9 +575,9 @@ inline bool linspace( const T& x0, const T& x1, T* v, int N ) template < typename T > inline void cross_product( const T* u, const T* v, T* w ) { - assert( "pre: u pointer is null" && (u != nullptr) ); - assert( "pre: v pointer is null" && (v != nullptr) ); - assert( "pre: w pointer is null" && (w != nullptr) ); + assert( "pre: u pointer is null" && (u != nullptr) ); + assert( "pre: v pointer is null" && (v != nullptr) ); + assert( "pre: w pointer is null" && (w != nullptr) ); w[ 0 ] = numerics::determinant( u[1], u[2], v[1], v[2] ); @@ -590,9 +590,9 @@ inline void cross_product( const T* u, const T* v, T* w ) template < typename T > inline T dot_product( const T* u, const T* v, int dim) { - assert("pre: u pointer is null" && (u != nullptr)); - assert("pre: v pointer is null" && (v != nullptr)); - assert("pre: dim >= 1" && (dim >= 1)); + assert("pre: u pointer is null" && (u != nullptr)); + assert("pre: v pointer is null" && (v != nullptr)); + assert("pre: dim >= 1" && (dim >= 1)); T res = u[0]*v[0]; for (int i = 1 ; i < dim ; ++i) diff --git a/src/axom/primal/CMakeLists.txt b/src/axom/primal/CMakeLists.txt index f9bc57c0fc..ea86bdafbb 100644 --- a/src/axom/primal/CMakeLists.txt +++ b/src/axom/primal/CMakeLists.txt @@ -61,7 +61,7 @@ set( primal_dependencies slic ) -blt_list_append( TO primal_dependencies ELEMENTS cuda IF ${ENABLE_CUDA} ) +blt_list_append( TO primal_dependencies ELEMENTS cuda IF ENABLE_CUDA ) blt_add_library( NAME primal diff --git a/src/axom/primal/geometry/NumericArray.hpp b/src/axom/primal/geometry/NumericArray.hpp index fdfb268059..80a749efff 100644 --- a/src/axom/primal/geometry/NumericArray.hpp +++ b/src/axom/primal/geometry/NumericArray.hpp @@ -7,13 +7,9 @@ #define NUMERIC_ARRAY_HPP_ #include "axom/core/Macros.hpp" - #include "axom/core/utilities/Utilities.hpp" - #include "axom/slic/interface/slic.hpp" -#include "axom/core/Macros.hpp" - // C/C++ includes #include // For memcpy() #include // For std:: copy and fill @@ -423,12 +419,14 @@ NumericArray< T,SIZE >::NumericArray(T val, int sz) // Fill first nvals coordinates with val ( 0 <= nvals <= SIZE ) const int nvals = axom::utilities::clampVal(sz, 0, SIZE); - for (int i = 0; i < nvals; i++) { + for (auto i = 0; i < nvals; i++) + { m_components[i] = val; } // Fill any remaining coordinates with zero - for (int j = nvals; j < SIZE; j++) { + for (auto j = nvals; j < SIZE; j++) + { m_components[j] = T(); } } @@ -442,19 +440,22 @@ NumericArray< T, SIZE >::NumericArray(const T* vals, int sz) const int nvals = axom::utilities::clampVal(sz, 0, SIZE); // Copy first nvals coordinates from vals array ( 0 <= nvals <= SIZE ) - for (int i = 0; i < nvals; i++) { + for (auto i = 0; i < nvals; i++) + { m_components[i] = vals[i]; } // Fill any remaining coordinates with zero - for (int j = nvals; j < SIZE; j++) { + for (auto j = nvals; j < SIZE; j++) + { m_components[j] = T(); } } //------------------------------------------------------------------------------ template < typename T,int SIZE > -inline AXOM_HOST_DEVICE NumericArray< T,SIZE >& +inline AXOM_HOST_DEVICE +NumericArray< T,SIZE >& NumericArray< T,SIZE >::operator=( const NumericArray< T,SIZE >& rhs ) { diff --git a/src/axom/primal/geometry/Point.hpp b/src/axom/primal/geometry/Point.hpp index aff8670e4a..eebbe0cc5b 100644 --- a/src/axom/primal/geometry/Point.hpp +++ b/src/axom/primal/geometry/Point.hpp @@ -6,12 +6,10 @@ #ifndef POINT_HXX_ #define POINT_HXX_ +#include "axom/core/Macros.hpp" #include "axom/slic/interface/slic.hpp" - #include "axom/primal/geometry/NumericArray.hpp" -#include "axom/core/Macros.hpp" - // C/C++ includes #include // For memcpy() #include // For print() and operator << diff --git a/src/axom/primal/geometry/Triangle.hpp b/src/axom/primal/geometry/Triangle.hpp index 80d3970624..a9599b8d22 100644 --- a/src/axom/primal/geometry/Triangle.hpp +++ b/src/axom/primal/geometry/Triangle.hpp @@ -6,15 +6,15 @@ #ifndef TRIANGLE_HPP_ #define TRIANGLE_HPP_ -#include "axom/core/numerics/Determinants.hpp" // For numerics::determinant() +#include "axom/core/Macros.hpp" +#include "axom/core/numerics/Determinants.hpp" #include "axom/core/utilities/Utilities.hpp" +#include "axom/slic/interface/slic.hpp" + #include "axom/primal/geometry/Point.hpp" #include "axom/primal/geometry/Vector.hpp" -#include "axom/slic/interface/slic.hpp" - -#include "axom/core/Macros.hpp" #include // for acos() #include // for std::ostream @@ -315,8 +315,8 @@ namespace primal template < typename T, int NDIMS > Triangle< T,NDIMS >::Triangle( const PointType& A, const PointType& B, - const PointType& C ): - m_points{A,B,C} + const PointType& C) + : m_points{A,B,C} {} //------------------------------------------------------------------------------ diff --git a/src/axom/primal/geometry/Vector.hpp b/src/axom/primal/geometry/Vector.hpp index 66e119cf45..8f1190f39f 100644 --- a/src/axom/primal/geometry/Vector.hpp +++ b/src/axom/primal/geometry/Vector.hpp @@ -7,15 +7,14 @@ #define VECTOR_HPP_ // axom_utils includes -#include "axom/core/numerics/Determinants.hpp" // for numerics::determinant() -#include "axom/core/numerics/matvecops.hpp" // dot_product()/cross_product() +#include "axom/core/Macros.hpp" +#include "axom/core/numerics/Determinants.hpp" +#include "axom/core/numerics/matvecops.hpp" // Primal includes #include "axom/primal/geometry/NumericArray.hpp" #include "axom/primal/geometry/Point.hpp" -#include "axom/core/Macros.hpp" - // C/C++ includes #include // for sqrt() diff --git a/src/axom/primal/operators/detail/intersect_impl.hpp b/src/axom/primal/operators/detail/intersect_impl.hpp index 3bf6444b57..c972bc7624 100644 --- a/src/axom/primal/operators/detail/intersect_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_impl.hpp @@ -13,6 +13,7 @@ #ifndef PRIMAL_INTERSECT_IMPL_HPP_ #define PRIMAL_INTERSECT_IMPL_HPP_ +#include "axom/core/Macros.hpp" #include "axom/core/numerics/Determinants.hpp" #include "axom/core/utilities/Utilities.hpp" @@ -23,8 +24,6 @@ #include "axom/primal/geometry/Segment.hpp" #include "axom/primal/geometry/Triangle.hpp" -#include "axom/core/Macros.hpp" - namespace axom { namespace primal @@ -54,13 +53,16 @@ AXOM_HOST_DEVICE bool oneZeroOthersMatch(double x, double y, double z, double EP AXOM_HOST_DEVICE int countZeros(double x, double y, double z, double EPS=1.0e-12); AXOM_HOST_DEVICE double twoDcross(const Point2& A, const Point2& B, const Point2& C); -AXOM_HOST_DEVICE bool checkEdge(const Point2& p1, +AXOM_HOST_DEVICE +bool checkEdge(const Point2& p1, const Point2& q1, const Point2& r1, const Point2& p2, const Point2& r2, bool includeBoundary); -AXOM_HOST_DEVICE bool checkVertex(const Point2& p1, + +AXOM_HOST_DEVICE +bool checkVertex(const Point2& p1, const Point2& q1, const Point2& r1, const Point2& p2, @@ -68,7 +70,8 @@ AXOM_HOST_DEVICE bool checkVertex(const Point2& p1, const Point2& r2, bool includeBoundary); -AXOM_HOST_DEVICE bool intersectPermuted2DTriangles(const Point2& p1, +AXOM_HOST_DEVICE +bool intersectPermuted2DTriangles(const Point2& p1, const Point2& q1, const Point2& r1, const Point2& p2, @@ -76,13 +79,15 @@ AXOM_HOST_DEVICE bool intersectPermuted2DTriangles(const Point2& p1, const Point2& r2, bool includeBoundary); -AXOM_HOST_DEVICE bool intersectOnePermutedTriangle( +AXOM_HOST_DEVICE +bool intersectOnePermutedTriangle( const Point3 &p1, const Point3 &q1, const Point3 &r1, const Point3 &p2, const Point3 &q2, const Point3 &r2, double dp2, double dq2, double dr2, Vector3 &normal, bool includeBoundary); -AXOM_HOST_DEVICE bool intersectTwoPermutedTriangles(const Point3& p1, +AXOM_HOST_DEVICE +bool intersectTwoPermutedTriangles(const Point3& p1, const Point3& q1, const Point3& r1, const Point3& p2, @@ -90,7 +95,8 @@ AXOM_HOST_DEVICE bool intersectTwoPermutedTriangles(const Point3& p1, const Point3& r2, bool includeBoundary); -AXOM_HOST_DEVICE bool intersectCoplanar3DTriangles(const Point3& p1, +AXOM_HOST_DEVICE +bool intersectCoplanar3DTriangles(const Point3& p1, const Point3& q1, const Point3& r1, const Point3& p2, @@ -99,7 +105,8 @@ AXOM_HOST_DEVICE bool intersectCoplanar3DTriangles(const Point3& p1, Vector3 normal, bool includeBoundary); -AXOM_HOST_DEVICE bool TriangleIntersection2D(const Triangle2& t1, +AXOM_HOST_DEVICE +bool TriangleIntersection2D(const Triangle2& t1, const Triangle2& t2, bool includeBoundary = false); diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index 2346b01796..e5de9e2b0d 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -12,6 +12,7 @@ #ifndef PRIMAL_INTERSECT_HPP_ #define PRIMAL_INTERSECT_HPP_ +#include "axom/core/Macros.hpp" #include "axom/core/utilities/Utilities.hpp" #include "axom/primal/geometry/BoundingBox.hpp" @@ -26,8 +27,6 @@ #include "axom/primal/operators/detail/intersect_impl.hpp" #include "axom/primal/operators/detail/intersect_bezier_impl.hpp" -#include "axom/core/Macros.hpp" - namespace axom { namespace primal diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 83b13461a2..ade959fa84 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -53,9 +53,9 @@ set(mesh_tester_depends blt_list_append(TO mesh_tester_depends ELEMENTS lumberjack mpi IF AXOM_ENABLE_LUMBERJACK) blt_list_append(TO mesh_tester_depends ELEMENTS openmp IF ENABLE_OPENMP) -blt_list_append( TO mesh_tester_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) -blt_list_append( TO mesh_tester_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) -blt_list_append( TO mesh_tester_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) +blt_list_append(TO mesh_tester_depends ELEMENTS umpire IF UMPIRE_FOUND) +blt_list_append(TO mesh_tester_depends ELEMENTS RAJA IF RAJA_FOUND) +blt_list_append(TO mesh_tester_depends ELEMENTS cuda IF ENABLE_CUDA) if(AXOM_ENABLE_QUEST) blt_add_executable( From 6bdb4f29029a8beaf5fa2b688a58533e79846c32 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Fri, 21 Feb 2020 16:42:09 -0800 Subject: [PATCH 057/632] Reverts change to sidre_lulesh test command line args Uses resolution of 5 for tests, rather than 30 for more reasonable runtime. --- src/axom/sidre/examples/lulesh2/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/axom/sidre/examples/lulesh2/CMakeLists.txt b/src/axom/sidre/examples/lulesh2/CMakeLists.txt index 6913dfbe81..5459e0dd38 100644 --- a/src/axom/sidre/examples/lulesh2/CMakeLists.txt +++ b/src/axom/sidre/examples/lulesh2/CMakeLists.txt @@ -37,11 +37,11 @@ blt_add_executable( if(AXOM_ENABLE_TESTS) if(ENABLE_MPI) blt_add_test(NAME sidre_lulesh2 - COMMAND sidre_lulesh2_ex + COMMAND sidre_lulesh2_ex -s 5 NUM_MPI_TASKS 1 NUM_OMP_THREADS 2 ) else() - blt_add_test(NAME sidre_lulesh2 + blt_add_test(NAME sidre_lulesh2 -s 5 COMMAND sidre_lulesh2_ex NUM_OMP_THREADS 2 ) endif() From 210a3c4a426232370ccad2eb44977b29149d2d4e Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Fri, 21 Feb 2020 16:49:19 -0800 Subject: [PATCH 058/632] Modifies runtime policy setup for mesh_tester The default is the non-raja sequential policy. Other options are raja_seq when RAJA is available and raja_omp and raja_cuda when OpenMP and CUDA are also available, respectively. Also fixes some warnings in mesh_tester. --- src/tools/mesh_tester.cpp | 122 ++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 51 deletions(-) diff --git a/src/tools/mesh_tester.cpp b/src/tools/mesh_tester.cpp index bef1348d6c..864f00ce39 100644 --- a/src/tools/mesh_tester.cpp +++ b/src/tools/mesh_tester.cpp @@ -4,6 +4,7 @@ // SPDX-License-Identifier: (BSD-3-Clause) // Axom includes +#include "axom/core/Macros.hpp" #include "axom/core/utilities/FileUtilities.hpp" #include "axom/core/utilities/Timer.hpp" @@ -39,17 +40,17 @@ // RAJA policies #include "axom/mint/execution/internal/structured_exec.hpp" -#include "axom/core/Macros.hpp" - #if defined (AXOM_USE_RAJA) using seq_exec = axom::SEQ_EXEC; - constexpr int CUDA_BLOCK_SIZE = 256; + #if defined(AXOM_USE_OPENMP) using omp_exec = axom::OMP_EXEC; #else using omp_exec = seq_exec; #endif + #if defined(AXOM_USE_CUDA) + constexpr int CUDA_BLOCK_SIZE = 256; using cuda_exec = axom::CUDA_EXEC; #else using cuda_exec = seq_exec; @@ -77,15 +78,18 @@ using UniformGrid3 = spin::UniformGrid; using Vector3 = primal::Vector; using Segment3 = primal::Segment; -enum rajaPolicy { seq = 0, omp = 1, cuda = 2}; +enum RuntimePolicy { seq = 0, + raja_seq = 1, + raja_omp = 2, + raja_cuda = 3}; struct Input { - static const std::set s_validPolicies; + static const std::set s_validPolicies; std::string stlInput; std::string vtkOutput; - rajaPolicy policy; + RuntimePolicy policy; int resolution; double weldThreshold; @@ -94,8 +98,8 @@ struct Input Input() : stlInput("") , vtkOutput("") - , resolution(0) , policy(seq) + , resolution(0) , weldThreshold(1e-6) , skipWeld(false) { }; @@ -110,15 +114,16 @@ struct Input void fixOutfilePath(); }; -const std::set Input::s_validPolicies({ - #ifdef AXOM_USE_RAJA +const std::set Input::s_validPolicies({ seq - #ifdef AXOM_USE_CUDA - ,cuda - #endif + #ifdef AXOM_USE_RAJA + , raja_seq #ifdef AXOM_USE_OPENMP - ,omp + , raja_omp #endif + #ifdef AXOM_USE_CUDA + , raja_cuda + #endif #endif }); @@ -126,17 +131,24 @@ void Input::parse(int argc, char** argv, CLI::App& app) { app.add_option("-r,--resolution", resolution, "Resolution of uniform grid. \n" - "Set to 1 to run the naive algorithm without a spatial index. \n" - "Set to 2 to run the naive algorithm with raja. \n" + "Set to 1 to run the naive algorithm (without a spatial index). \n" "Set to less than 1 to use the spatial index with a resolution \n" "of the cube root of the number of triangles.") ->capture_default_str(); app.add_option("-p, --policy", policy, - "With \'-r 2\', set policy of the raja kernel. \n" - "Set to 0 to use a sequential policy. \n" - "Set to 1 to use a OpenMP policy. \n" - "Set to 2 to use a CUDA policy.") + "With \'-r 1\', set runtime policy. \n" + "Set to 0 to use the sequential algorithm (w/o RAJA). \n" + #ifdef AXOM_USE_RAJA + "Set to 1 to use the RAJA sequential policy. \n" + #ifdef AXOM_USE_OPENMP + "Set to 2 to use the RAJA OpenMP policy. \n" + #endif + #ifdef AXOM_USE_CUDA + "Set to 3 to use the RAJA CUDA policy." + #endif + #endif + ) ->capture_default_str() ->check(CLI::IsMember{Input::s_validPolicies}); @@ -171,12 +183,12 @@ void Input::parse(int argc, char** argv, CLI::App& app) <<"\n resolution = " << resolution << (resolution < 1 ? " (use cube root of triangle count)" : "") << (resolution == 1 ? " (use naive algorithm)" : "") - << (resolution == 2 ? " (use naive algorithm with raja)" : "") - << (resolution == 2 ? "\n policy = " : "") - << (resolution == 2 ? std::to_string(policy) : "") - << (resolution == 2 && policy == seq ? " (use sequential policy)" : "") - << (resolution == 2 && policy == omp ? " (use OpenMP policy)" : "") - << (resolution == 2 && policy == cuda ? " (use CUDA policy)" : "") + << (resolution == 1 ? "\n policy = " : "") + << (resolution == 1 ? std::to_string(policy) : "") + << (resolution == 1 && policy == seq ? " (use sequential policy)" : "") + << (resolution == 1 && policy == raja_seq ? " (use RAJA sequential policy)" : "") + << (resolution == 1 && policy == raja_omp ? " (use RAJA OpenMP policy)" : "") + << (resolution == 1 && policy == raja_cuda ? " (use RAJA CUDA policy)" : "") <<"\n weld threshold = " << weldThreshold <<"\n " << (skipWeld ? "" : "not ") << "skipping weld" <<"\n infile = " << stlInput @@ -218,22 +230,26 @@ void Input::fixOutfilePath() inline bool pointIsNearlyEqual(Point3& p1, Point3& p2, double EPS); AXOM_HOST_DEVICE bool checkTT(Triangle3& t1, Triangle3& t2); + std::vector< std::pair > naiveIntersectionAlgorithm( mint::Mesh* surface_mesh, std::vector & degenerate); + void announceMeshProblems(int triangleCount, int intersectPairCount, int degenerateCount); + void saveProblemFlagsToMesh(mint::Mesh* surface_mesh, const std::vector< std::pair > & c, const std::vector & d); + bool writeAnnotatedMesh(mint::Mesh* surface_mesh, const std::string & outfile); + bool writeCollisions(const std::vector< std::pair > & c, const std::vector & d, std::string basename); - inline bool pointIsNearlyEqual(Point3& p1, Point3& p2, double EPS=1.0e-9) { return axom::utilities::isNearlyEqual(p1[0], p2[0], EPS) && \ @@ -272,6 +288,8 @@ std::vector< std::pair > naiveIntersectionAlgorithm( mint::Mesh* surface_mesh, std::vector & degenerate) { + SLIC_INFO("Running naive intersection algorithm."); + // For each triangle, check for intersection against // every other triangle with a greater index in the mesh, excluding // degenerate triangles. @@ -316,8 +334,9 @@ std::vector< std::pair > naiveIntersectionAlgorithm( mint::Mesh* surface_mesh, std::vector & degenerate) { - SLIC_INFO("Execution Space is " << - axom::execution_space< ExecSpace >::name()); + SLIC_INFO("Running naive intersection algorithm " + << " in execution Space: " + << axom::execution_space< ExecSpace >::name()); // Get allocator #ifdef AXOM_USE_UMPIRE @@ -336,12 +355,11 @@ std::vector< std::pair > naiveIntersectionAlgorithm( Triangle3 * tris = axom::allocate (ncells); #endif - // Get each triangle in the mesh + // Get each triangle in the mesh and check for degeneracies for (int i = 0; i < ncells ; i++) { - Triangle3 t1 = getMeshTriangle(i, surface_mesh); - tris[i] = t1; - if (t1.degenerate()) + tris[i] = getMeshTriangle(i, surface_mesh); + if (tris[i].degenerate()) { degenerate.push_back(i); } @@ -357,8 +375,9 @@ std::vector< std::pair > naiveIntersectionAlgorithm( using ATOMIC_POL = typename axom::execution_space< ExecSpace >::atomic_policy; - RAJA::ReduceSum< REDUCE_POL, int > numIntersect(0); + RAJA::ReduceSum< REDUCE_POL, int > numIntersect(0); + // Compute the number of intersections RAJA::kernel( RAJA::make_tuple(col_range, row_range), AXOM_LAMBDA(int col, int row) { if (row > col) @@ -393,13 +412,12 @@ std::vector< std::pair > naiveIntersectionAlgorithm( auto idx = RAJA::atomicAdd(counter, 2); intersections[idx] = row; intersections[idx+1] = col; - } } }); // Initialize pairs of clashes - for (int i = 0 ; i < numIntersect.get() * 2 ; i = i + 2) + for (auto i = 0 ; i < numIntersect.get() * 2 ; i += 2) { retval.push_back(std::make_pair(intersections[i], intersections[i + 1])); } @@ -585,32 +603,34 @@ int main( int argc, char** argv ) axom::utilities::Timer timer(true); if (params.resolution == 1) { - // Naive method - collisions = naiveIntersectionAlgorithm(surface_mesh, degenerate); - } - - #ifdef AXOM_USE_RAJA - else if (params.resolution == 2){ - - // raja naive method + // Naive method switch (params.policy) { - case omp: + case seq: + collisions = naiveIntersectionAlgorithm(surface_mesh, degenerate); + #ifdef AXOM_USE_RAJA + case raja_seq: + collisions = naiveIntersectionAlgorithm< seq_exec >(surface_mesh, + degenerate); + break; + #ifdef AXOM_USE_OPENMP + case raja_omp: collisions = naiveIntersectionAlgorithm< omp_exec >(surface_mesh, degenerate); break; - case cuda: + #endif + #ifdef AXOM_USE_CUDA + case raja_cuda: collisions = naiveIntersectionAlgorithm< cuda_exec >(surface_mesh, degenerate); break; - case seq: - collisions = naiveIntersectionAlgorithm< seq_exec >(surface_mesh, - degenerate); + #endif + #endif // AXOM_USE_RAJA + default: + SLIC_ERROR("Unhandled runtime policy case " << params.policy ); break; } - } // end of resolution == 2 - #endif - + } else { // _check_repair_intersections_start From a5c0a292a70b9f0afda26f71448cd91b664cf839 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Mon, 2 Mar 2020 11:23:21 -0800 Subject: [PATCH 059/632] Update umpire allocator usage and AXOM_HOST_DEVICE style changes Change auto to int --- src/axom/primal/geometry/NumericArray.hpp | 22 ++++++---- src/axom/primal/geometry/Point.hpp | 14 +++++-- src/axom/primal/geometry/Vector.hpp | 21 +++++++--- .../operators/detail/intersect_impl.hpp | 40 ++++++++++++++----- src/axom/slic/interface/slic_macros.hpp | 7 +++- src/tools/mesh_tester.cpp | 24 +++-------- 6 files changed, 80 insertions(+), 48 deletions(-) diff --git a/src/axom/primal/geometry/NumericArray.hpp b/src/axom/primal/geometry/NumericArray.hpp index 80a749efff..79180cc5d0 100644 --- a/src/axom/primal/geometry/NumericArray.hpp +++ b/src/axom/primal/geometry/NumericArray.hpp @@ -245,14 +245,20 @@ class NumericArray * \return \f$ p_i \f$ the value at the given component index. * \pre \f$ 0 \le i < SIZE \f$ */ - AXOM_HOST_DEVICE const T& operator[](int i) const; - AXOM_HOST_DEVICE T& operator[](int i); + AXOM_HOST_DEVICE + const T& operator[](int i) const; + + AXOM_HOST_DEVICE + T& operator[](int i); /*! * \brief Returns a pointer to the underlying data. */ - AXOM_HOST_DEVICE const T* data() const; - AXOM_HOST_DEVICE T* data(); + AXOM_HOST_DEVICE + const T* data() const; + + AXOM_HOST_DEVICE + T* data(); /*! * @@ -419,13 +425,13 @@ NumericArray< T,SIZE >::NumericArray(T val, int sz) // Fill first nvals coordinates with val ( 0 <= nvals <= SIZE ) const int nvals = axom::utilities::clampVal(sz, 0, SIZE); - for (auto i = 0; i < nvals; i++) + for (int i = 0; i < nvals; i++) { m_components[i] = val; } // Fill any remaining coordinates with zero - for (auto j = nvals; j < SIZE; j++) + for (int j = nvals; j < SIZE; j++) { m_components[j] = T(); } @@ -440,13 +446,13 @@ NumericArray< T, SIZE >::NumericArray(const T* vals, int sz) const int nvals = axom::utilities::clampVal(sz, 0, SIZE); // Copy first nvals coordinates from vals array ( 0 <= nvals <= SIZE ) - for (auto i = 0; i < nvals; i++) + for (int i = 0; i < nvals; i++) { m_components[i] = vals[i]; } // Fill any remaining coordinates with zero - for (auto j = nvals; j < SIZE; j++) + for (int j = nvals; j < SIZE; j++) { m_components[j] = T(); } diff --git a/src/axom/primal/geometry/Point.hpp b/src/axom/primal/geometry/Point.hpp index eebbe0cc5b..10c09ba62c 100644 --- a/src/axom/primal/geometry/Point.hpp +++ b/src/axom/primal/geometry/Point.hpp @@ -132,8 +132,11 @@ class Point * \return p[i] the value at the given component index. * \pre (i >= 0) && (i < ndims) */ - AXOM_HOST_DEVICE const T& operator[](int i) const { return m_components[i]; } - AXOM_HOST_DEVICE T& operator[](int i) { return m_components[i]; } + AXOM_HOST_DEVICE + const T& operator[](int i) const { return m_components[i]; } + + AXOM_HOST_DEVICE + T& operator[](int i) { return m_components[i]; } ///@} @@ -151,8 +154,11 @@ class Point /*! * \brief Returns a reference to the underlying NumericArray. */ - AXOM_HOST_DEVICE const NumericArray< T,NDIMS >& array() const { return m_components; } - AXOM_HOST_DEVICE NumericArray< T,NDIMS >& array() { return m_components; } + AXOM_HOST_DEVICE + const NumericArray< T,NDIMS >& array() const { return m_components; } + + AXOM_HOST_DEVICE + NumericArray< T,NDIMS >& array() { return m_components; } /*! * \brief Output the point's coordinates to the array diff --git a/src/axom/primal/geometry/Vector.hpp b/src/axom/primal/geometry/Vector.hpp index 8f1190f39f..9420b05fcb 100644 --- a/src/axom/primal/geometry/Vector.hpp +++ b/src/axom/primal/geometry/Vector.hpp @@ -190,20 +190,29 @@ class Vector * \return p[i] the value at the given component index. * \pre (i >= 0) && (i < ndims) */ - AXOM_HOST_DEVICE const T& operator[](int i) const { return m_components[i]; } - AXOM_HOST_DEVICE T& operator[](int i) { return m_components[i]; } + AXOM_HOST_DEVICE + const T& operator[](int i) const { return m_components[i]; } + + AXOM_HOST_DEVICE + T& operator[](int i) { return m_components[i]; } /*! * \brief Returns a reference to the underlying NumericArray. */ - AXOM_HOST_DEVICE const NumericArray< T,NDIMS > & array() const { return m_components; } - AXOM_HOST_DEVICE NumericArray< T,NDIMS >& array() { return m_components; } + AXOM_HOST_DEVICE + const NumericArray< T,NDIMS > & array() const { return m_components; } + + AXOM_HOST_DEVICE + NumericArray< T,NDIMS >& array() { return m_components; } /*! * \brief Returns a pointer to the underlying data. */ - AXOM_HOST_DEVICE const T* data() const { return m_components.data(); } - AXOM_HOST_DEVICE T* data() { return m_components.data(); } + AXOM_HOST_DEVICE + const T* data() const { return m_components.data(); } + + AXOM_HOST_DEVICE + T* data() { return m_components.data(); } /*! * \brief Equality comparison operator for vectors. diff --git a/src/axom/primal/operators/detail/intersect_impl.hpp b/src/axom/primal/operators/detail/intersect_impl.hpp index c972bc7624..1cad2801eb 100644 --- a/src/axom/primal/operators/detail/intersect_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_impl.hpp @@ -39,19 +39,39 @@ typedef primal::Triangle< double, 3 > Triangle3; typedef primal::Triangle< double, 2 > Triangle2; typedef primal::Point< double, 2 > Point2; -AXOM_HOST_DEVICE bool isGt(double x, double y, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool isLt(double x, double y, double EPS=1.0e-12); +AXOM_HOST_DEVICE +bool isGt(double x, double y, double EPS=1.0e-12); + +AXOM_HOST_DEVICE +bool isLt(double x, double y, double EPS=1.0e-12); + bool isLeq(double x, double y, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool isLpeq(double x, double y, bool includeEqual = false, + +AXOM_HOST_DEVICE +bool isLpeq(double x, double y, bool includeEqual = false, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool isGeq(double x, double y, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool isGpeq(double x, double y, bool includeEqual = false, + +AXOM_HOST_DEVICE +bool isGeq(double x, double y, double EPS=1.0e-12); + +AXOM_HOST_DEVICE +bool isGpeq(double x, double y, bool includeEqual = false, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool nonzeroSignMatch(double x, double y, double z, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool twoZeros(double x, double y, double z, double EPS=1.0e-12); -AXOM_HOST_DEVICE bool oneZeroOthersMatch(double x, double y, double z, double EPS=1.0e-12); -AXOM_HOST_DEVICE int countZeros(double x, double y, double z, double EPS=1.0e-12); -AXOM_HOST_DEVICE double twoDcross(const Point2& A, const Point2& B, const Point2& C); + +AXOM_HOST_DEVICE +bool nonzeroSignMatch(double x, double y, double z, double EPS=1.0e-12); + +AXOM_HOST_DEVICE +bool twoZeros(double x, double y, double z, double EPS=1.0e-12); + +AXOM_HOST_DEVICE +bool oneZeroOthersMatch(double x, double y, double z, double EPS=1.0e-12); + +AXOM_HOST_DEVICE +int countZeros(double x, double y, double z, double EPS=1.0e-12); + +AXOM_HOST_DEVICE +double twoDcross(const Point2& A, const Point2& B, const Point2& C); AXOM_HOST_DEVICE bool checkEdge(const Point2& p1, diff --git a/src/axom/slic/interface/slic_macros.hpp b/src/axom/slic/interface/slic_macros.hpp index 4de8540b7f..1f7ff1835b 100644 --- a/src/axom/slic/interface/slic_macros.hpp +++ b/src/axom/slic/interface/slic_macros.hpp @@ -359,8 +359,11 @@ namespace detail */ struct FalseType { - AXOM_HOST_DEVICE FalseType() {} - AXOM_HOST_DEVICE inline operator bool() const { return false; } + AXOM_HOST_DEVICE + FalseType() {} + + AXOM_HOST_DEVICE + inline operator bool() const { return false; } }; static const FalseType false_value; diff --git a/src/tools/mesh_tester.cpp b/src/tools/mesh_tester.cpp index 864f00ce39..c8fd5db9c4 100644 --- a/src/tools/mesh_tester.cpp +++ b/src/tools/mesh_tester.cpp @@ -339,21 +339,15 @@ std::vector< std::pair > naiveIntersectionAlgorithm( << axom::execution_space< ExecSpace >::name()); // Get allocator - #ifdef AXOM_USE_UMPIRE - int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - umpire::Allocator allocator = axom::getAllocator(allocatorID); - #endif + int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + axom::setDefaultAllocator( allocatorID ); std::vector< std::pair > retval; const int ncells = surface_mesh->getNumberOfCells(); SLIC_INFO("Checking mesh with a total of "<< ncells<< " cells."); - #ifdef AXOM_USE_UMPIRE - Triangle3 * tris = axom::allocate (ncells, allocator); - #else - Triangle3 * tris = axom::allocate (ncells); - #endif + Triangle3 * tris = axom::allocate (ncells); // Get each triangle in the mesh and check for degeneracies for (int i = 0; i < ncells ; i++) @@ -390,15 +384,9 @@ std::vector< std::pair > naiveIntersectionAlgorithm( }); // Allocation to hold intersection pairs and counter to know where to store - #ifdef AXOM_USE_UMPIRE - int * intersections = - axom::allocate (numIntersect.get() * 2, allocator); - int * counter = axom::allocate (1, allocator); - #else - int * intersections = - axom::allocate (numIntersect.get() * 2); - int * counter = axom::allocate (1); - #endif + int * intersections = + axom::allocate (numIntersect.get() * 2); + int * counter = axom::allocate (1); counter[0] = 0; From 483ac1df8e4bb3f85392a439a2fa33e8b0e26309 Mon Sep 17 00:00:00 2001 From: Arlie Capps <48997041+agcapps@users.noreply.github.com> Date: Wed, 18 Mar 2020 10:16:07 -0700 Subject: [PATCH 060/632] Feature/capps2/win32sidre (#150) Fixes to allow "zero-to-Axom" on Windows * Code fixes to allow Axom to build using MS Visual Studio - Forward-declare View within AttrValues - Fixes to IOManager - Make sure sidre, conduit, and HDF5 are optional * Updates to uberenv: refactor into a spack-based back-end for use on Unix-like OS and a vcpkg-based back-end for use on Windows * Add example MPI specifications Started, and substantially developed, by Kenny Weiss Co-authored-by: Kenny Weiss --- RELEASE-NOTES.md | 2 + config-build.py | 17 +- host-configs/other/sqa-uno-MSVC-INTEL.cmake | 4 +- scripts/uberenv/uberenv.py | 216 ++++++++++++++---- scripts/uberenv/vcpkg_ports/axom/CONTROL | 4 + .../uberenv/vcpkg_ports/axom/portfile.cmake | 131 +++++++++++ scripts/uberenv/vcpkg_ports/blt/CONTROL | 4 + .../uberenv/vcpkg_ports/blt/portfile.cmake | 31 +++ scripts/uberenv/vcpkg_ports/conduit/CONTROL | 5 + .../vcpkg_ports/conduit/portfile.cmake | 73 ++++++ scripts/uberenv/vcpkg_ports/hdf5/xCONTROL | 5 + src/axom/sidre/CMakeLists.txt | 2 +- src/axom/sidre/core/AttrValues.hpp | 2 + src/axom/sidre/spio/IOManager.cpp | 2 - src/axom/sidre/tests/CMakeLists.txt | 27 ++- src/cmake/thirdparty/FindConduit.cmake | 26 ++- .../thirdparty/SetupAxomThirdParty.cmake | 20 +- 17 files changed, 498 insertions(+), 73 deletions(-) create mode 100644 scripts/uberenv/vcpkg_ports/axom/CONTROL create mode 100644 scripts/uberenv/vcpkg_ports/axom/portfile.cmake create mode 100644 scripts/uberenv/vcpkg_ports/blt/CONTROL create mode 100644 scripts/uberenv/vcpkg_ports/blt/portfile.cmake create mode 100644 scripts/uberenv/vcpkg_ports/conduit/CONTROL create mode 100644 scripts/uberenv/vcpkg_ports/conduit/portfile.cmake create mode 100644 scripts/uberenv/vcpkg_ports/hdf5/xCONTROL diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index e4a15bc67e..887d71abdb 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -25,6 +25,8 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ launch bounds is calculated. Consequently, a large number of threads was being launched leading to max registry count violation when linking. We are now using fixed kernel size of 256 threads (16x16 in 2D and 8x8x4 in 3D). +- Third-party libraries can now build on the Windows platform through uberenv using vcpkg + ("zero-to-axom support on Windows") ### Known Bugs diff --git a/config-build.py b/config-build.py index a31c85e68a..66b1a9bed7 100755 --- a/config-build.py +++ b/config-build.py @@ -37,7 +37,8 @@ def extract_cmake_location(file_path): "Attempting to find cmake on your path...") cmake_path = distutils.spawn.find_executable("cmake") print("Found: {0}".format(cmake_path)) - return cmake_path + ret_cmake_path = "\"{0}\"".format(cmake_path) + return ret_cmake_path def parse_arguments(): @@ -87,6 +88,16 @@ def parse_arguments(): "-x", "--xcode", action="store_true", help="Create an xcode project." ) + # Add supported versions of MS Visual Studio as needed. + msvcversions = {'2017': 'Visual Studio 15 2017', + '201764': 'Visual Studio 15 2017 Win64'} + parser.add_argument( + "--msvc", + type=str, + choices=msvcversions.keys(), + help="Create a MS Visual Studio project." + ) + parser.add_argument( "-ecc", "--exportcompilercommands", @@ -112,6 +123,7 @@ def parse_arguments(): ) args, unknown_args = parser.parse_known_args() + args.msvcversions = msvcversions if unknown_args: print( "[config-build]: Passing the following arguments directly to cmake... %s" @@ -245,6 +257,9 @@ def create_cmake_command_line( if args.xcode: cmakeline += ' -G "Xcode"' + if args.msvc: + cmakeline += ' -G "%s"' % args.msvcversions[args.msvc] + if args.docs_only: cmakeline += " -DENABLE_ALL_COMPONENTS=OFF" cmakeline += " -DAXOM_ENABLE_TESTS=OFF" diff --git a/host-configs/other/sqa-uno-MSVC-INTEL.cmake b/host-configs/other/sqa-uno-MSVC-INTEL.cmake index 85a3cc25b9..36e8c7da5b 100644 --- a/host-configs/other/sqa-uno-MSVC-INTEL.cmake +++ b/host-configs/other/sqa-uno-MSVC-INTEL.cmake @@ -30,11 +30,11 @@ ### Setup Axom components # Disable Sidre until we can successfully link to HDF5 and Conduit on Windows -set(ENABLE_SIDRE OFF CACHE BOOL "") +set(AXOM_ENABLE_SIDRE OFF CACHE BOOL "") #set(HDF5_DIR ... CACHE PATH "") #set(CONDUIT_DIR ... CACHE PATH "") -# Disable Fortran since Visual Studio is not generating modules for our component Fortan interfaces +# Disable Fortran since Visual Studio is not generating modules for our component Fortran interfaces set(ENABLE_FORTRAN OFF CACHE BOOL "") set(ENABLE_DOCS OFF CACHE BOOL "") diff --git a/scripts/uberenv/uberenv.py b/scripts/uberenv/uberenv.py index 66ddb7b9ff..9faad2188e 100755 --- a/scripts/uberenv/uberenv.py +++ b/scripts/uberenv/uberenv.py @@ -70,7 +70,7 @@ def sexe(cmd,ret_output=False,echo = False): """ Helper for executing shell commands. """ if echo: - print("[exe: {}]".format(cmd)) + print("[exe: {0}]".format(cmd)) if ret_output: p = subprocess.Popen(cmd, shell=True, @@ -104,6 +104,12 @@ def parse_args(): default=None, help="spack compiler spec") + # for vcpkg, what architecture to target + parser.add_option("--triplet", + dest="triplet", + default=None, + help="vcpkg architecture triplet") + # optional location of spack mirror parser.add_option("--mirror", dest="mirror", @@ -165,7 +171,7 @@ def parse_args(): # option to force a spack pull parser.add_option("--pull", action="store_true", - dest="spack_pull", + dest="repo_pull", default=False, help="Pull if spack repo already exists") @@ -205,7 +211,7 @@ def parse_args(): if not opts["spack_config_dir"] is None: opts["spack_config_dir"] = os.path.abspath(opts["spack_config_dir"]) if not os.path.isdir(opts["spack_config_dir"]): - print("[ERROR: invalid spack config dir: {} ]".format(opts["spack_config_dir"])) + print("[ERROR: invalid spack config dir: {0} ]".format(opts["spack_config_dir"])) sys.exit(-1) return opts, extras @@ -233,11 +239,23 @@ def __init__(self, opts, extra_opts): # load project settings self.project_opts = load_json_file(opts["project_json"]) - print("[uberenv project settings: {}]".format(str(self.project_opts))) - print("[uberenv options: {}]".format(str(self.opts))) + print("[uberenv project settings: {0}]".format(str(self.project_opts))) + print("[uberenv options: {0}]".format(str(self.opts))) + + # setup main package name + self.pkg_name = self.project_opts["package_name"] def setup_paths_and_dirs(self): - self.uberenv_path = os.path.dirname(os.path.realpath(__file__)) + self.uberenv_path = os.path.split(os.path.abspath(__file__))[0] + + self.dest_dir = os.path.abspath(self.opts["prefix"]) + print("[installing to: {0}]".format(self.dest_dir)) + + # print a warning if the dest path already exists + if not os.path.isdir(self.dest_dir): + os.mkdir(self.dest_dir) + else: + print("[info: destination '{0}' already exists]".format(self.dest_dir)) def set_from_args_or_json(self, setting, fail_on_undefined=True): # Command line options take precedence over project file @@ -248,7 +266,7 @@ def set_from_args_or_json(self, setting, fail_on_undefined=True): setting_value = self.opts[setting] if fail_on_undefined and setting_value == None: - print("ERROR: '{}' must be defined in the project file or on the command line".format(setting)) + print("ERROR: '{0}' must be defined in the project file or on the command line".format(setting)) sys.exit(-1) return setting_value @@ -257,7 +275,7 @@ def set_from_json(self,setting): try: setting_value = self.project_opts[setting] except (KeyError): - print("ERROR: '{}' must at least be defined in project.json".format(setting)) + print("ERROR: '{0}' must at least be defined in project.json".format(setting)) raise return setting_value @@ -272,6 +290,115 @@ def detect_platform(self): return res +class VcpkgEnv(UberEnv): + """ Helper to clone vcpkg and install libraries on Windows """ + + def __init__(self, opts, extra_opts): + UberEnv.__init__(self,opts,extra_opts) + + # setup architecture triplet + self.triplet = opts["triplet"] + if self.triplet is None: + self.triplet = os.getenv("VCPKG_DEFAULT_TRIPLET", "x86-windows") + + def setup_paths_and_dirs(self): + # get the current working path, and the glob used to identify the + # package files we want to hot-copy to vcpkg + + UberEnv.setup_paths_and_dirs(self) + + self.ports = pjoin(self.uberenv_path, "vcpkg_ports","*") + + # setup path for vcpkg repo + self.dest_vcpkg = pjoin(self.dest_dir,"vcpkg") + + if os.path.isdir(self.dest_vcpkg): + print("[info: destination '{0}' already exists]".format(self.dest_vcpkg)) + + def clone_repo(self): + if not os.path.isdir(self.dest_vcpkg): + # compose clone command for the dest path, vcpkg url and branch + vcpkg_branch = self.project_opts.get("vcpkg_branch", "master") + vcpkg_url = self.project_opts.get("vcpkg_url", "https://github.com/microsoft/vcpkg") + + print("[info: cloning vcpkg '{0}' branch from {1} into {2}]" + .format(vcpkg_branch,vcpkg_url, self.dest_vcpkg)) + + os.chdir(self.dest_dir) + + clone_opts = ("-c http.sslVerify=false " + if self.opts["ignore_ssl_errors"] else "") + + clone_cmd = "git {0} clone -b {1} {2}".format(clone_opts, vcpkg_branch,vcpkg_url) + sexe(clone_cmd, echo=True) + + # optionally, check out a specific commit + if "vcpkg_commit" in self.project_opts: + sha1 = self.project_opts["vcpkg_commit"] + print("[info: using vcpkg commit {0}]".format(sha1)) + os.chdir(self.dest_vcpkg) + sexe("git checkout {0}".format(sha1),echo=True) + + if self.opts["repo_pull"]: + # do a pull to make sure we have the latest + os.chdir(self.dest_vcpkg) + sexe("git stash", echo=True) + sexe("git pull", echo=True) + + # Bootstrap vcpkg + os.chdir(self.dest_vcpkg) + print("[info: bootstrapping vcpkg]") + sexe("bootstrap-vcpkg.bat -disableMetrics") + + def patch(self): + """ hot-copy our ports into vcpkg """ + + import distutils + from distutils import dir_util + + src_vcpkg_ports = pjoin(self.uberenv_path, "vcpkg_ports") + dest_vcpkg_ports = pjoin(self.dest_vcpkg,"ports") + + print("[info: copying from {0} to {1}]".format(src_vcpkg_ports,dest_vcpkg_ports)) + distutils.dir_util.copy_tree(src_vcpkg_ports,dest_vcpkg_ports) + + + def clean_build(self): + pass + + def show_info(self): + os.chdir(self.dest_vcpkg) + print("[info: Details for package '{0}']".format(self.pkg_name)) + sexe("vcpkg.exe search " + self.pkg_name, echo=True) + + print("[info: Dependencies for package '{0}']".format(self.pkg_name)) + sexe("vcpkg.exe depend-info " + self.pkg_name, echo=True) + + def create_mirror(self): + pass + + def use_mirror(self): + pass + + def install(self): + + os.chdir(self.dest_vcpkg) + install_cmd = "vcpkg.exe " + install_cmd += "install {0}:{1}".format(self.pkg_name, self.triplet) + + res = sexe(install_cmd, echo=True) + + # Running the install_cmd eventually generates the host config file, + # which we copy to the target directory. + src_hc = pjoin(self.dest_vcpkg, "installed", self.triplet, "include", self.pkg_name, "hc.cmake") + hcfg_fname = pjoin(self.dest_dir, "{0}.{1}.cmake".format(platform.uname()[1], self.triplet)) + print("[info: copying host config file to {0}]".format(hcfg_fname)) + shutil.copy(os.path.abspath(src_hc), hcfg_fname) + print("") + print("[install complete!]") + return res + + class SpackEnv(UberEnv): """ Helper to clone spack and install libraries on MacOS an Linux """ @@ -297,13 +424,13 @@ def __init__(self, opts, extra_opts): opts["spec"] = "%clang" else: opts["spec"] = "%gcc" - self.opts["spec"] = "@{}{}".format(self.pkg_version,opts["spec"]) + self.opts["spec"] = "@{0}{1}".format(self.pkg_version,opts["spec"]) elif not opts["spec"].startswith("@"): - self.opts["spec"] = "@{}{}".format(self.pkg_version,opts["spec"]) + self.opts["spec"] = "@{0}{1}".format(self.pkg_version,opts["spec"]) else: - self.opts["spec"] = "{}".format(opts["spec"]) + self.opts["spec"] = "{0}".format(opts["spec"]) - print("[spack spec: {}]".format(self.opts["spec"])) + print("[spack spec: {0}]".format(self.opts["spec"])) def setup_paths_and_dirs(self): # get the current working path, and the glob used to identify the @@ -322,14 +449,14 @@ def setup_paths_and_dirs(self): if not os.path.isdir(self.dest_dir): os.mkdir(self.dest_dir) else: - print("[info: destination '{}' already exists]".format(self.dest_dir)) + print("[info: destination '{0}' already exists]".format(self.dest_dir)) if os.path.isdir(self.dest_spack): - print("[info: destination '{}' already exists]".format(self.dest_spack)) + print("[info: destination '{0}' already exists]".format(self.dest_spack)) self.pkg_src_dir = os.path.join(self.uberenv_path,self.pkg_src_dir) if not os.path.isdir(self.pkg_src_dir): - print("[ERROR: package_source_dir '{}' does not exist]".format(self.pkg_src_dir)) + print("[ERROR: package_source_dir '{0}' does not exist]".format(self.pkg_src_dir)) sys.exit(-1) @@ -340,7 +467,7 @@ def find_spack_pkg_path(self,pkg_name): # pick the first in the list. if l.startswith(pkg_name): return {"name": pkg_name, "path": l.split()[-1]} - print("[ERROR: failed to find package named '{}']".format(pkg_name)) + print("[ERROR: failed to find package named '{0}']".format(pkg_name)) sys.exit(-1) def read_spack_full_spec(self,pkg_name,spec): @@ -363,15 +490,15 @@ def clone_repo(self): spack_branch = self.project_opts.get("spack_branch", "develop") spack_url = self.project_opts.get("spack_url", "https://github.com/spack/spack.git") - clone_cmd = "git {} clone -b {} {}".format(clone_opts, spack_branch,spack_url) + clone_cmd = "git {0} clone -b {1} {2}".format(clone_opts, spack_branch,spack_url) sexe(clone_cmd, echo=True) # optionally, check out a specific commit if "spack_commit" in self.project_opts: sha1 = self.project_opts["spack_commit"] - print("[info: using spack commit {}]".format(sha1)) + print("[info: using spack commit {0}]".format(sha1)) os.chdir(pjoin(self.dest_dir,"spack")) - sexe("git checkout {}".format(sha1),echo=True) + sexe("git checkout {0}".format(sha1),echo=True) if self.opts["spack_pull"]: # do a pull to make sure we have the latest @@ -393,7 +520,7 @@ def disable_spack_config_scopes(self,spack_dir): # disables all config scopes except "defaults", which we will # force our settings into spack_lib_config = pjoin(spack_dir,"lib","spack","spack","config.py") - print("[disabling config scope (except defaults) in: {}]".format(spack_lib_config)) + print("[disabling config scope (except defaults) in: {0}]".format(spack_lib_config)) cfg_script = open(spack_lib_config).read() for cfg_scope_stmt in ["('system', os.path.join(spack.paths.system_etc_path, 'spack')),", "('site', os.path.join(spack.paths.etc_path, 'spack')),", @@ -414,7 +541,7 @@ def patch(self): # copy in "defaults" config.yaml config_yaml = os.path.abspath(pjoin(self.uberenv_path,"spack_configs","config.yaml")) - sexe("cp {} {}/".format(config_yaml, spack_etc_defaults_dir ), echo=True) + sexe("cp {0} {1}/".format(config_yaml, spack_etc_defaults_dir ), echo=True) # copy in other settings per platform if not cfg_dir is None: @@ -425,19 +552,20 @@ def patch(self): packages_yaml = pjoin(cfg_dir,"packages.yaml") if os.path.isfile(config_yaml): - sexe("cp {} {}/".format(config_yaml , spack_etc_defaults_dir ), echo=True) + sexe("cp {0} {1}/".format(config_yaml , spack_etc_defaults_dir ), echo=True) if os.path.isfile(compilers_yaml): - sexe("cp {} {}/".format(compilers_yaml, spack_etc_defaults_dir ), echo=True) + sexe("cp {0} {1}/".format(compilers_yaml, spack_etc_defaults_dir ), echo=True) if os.path.isfile(packages_yaml): - sexe("cp {} {}/".format(packages_yaml, spack_etc_defaults_dir ), echo=True) + sexe("cp {0} {1}/".format(packages_yaml, spack_etc_defaults_dir ), echo=True) else: # let spack try to auto find compilers sexe("spack/bin/spack compiler find", echo=True) + dest_spack_pkgs = pjoin(spack_dir,"var","spack","repos","builtin","packages") # hot-copy our packages into spack - sexe("cp -Rf {} {}".format(self.pkgs,dest_spack_pkgs)) + sexe("cp -Rf {0} {1}".format(self.pkgs,dest_spack_pkgs)) def clean_build(self): @@ -467,9 +595,9 @@ def install(self): install_cmd = "spack/bin/spack " if self.opts["ignore_ssl_errors"]: install_cmd += "-k " - install_cmd += "dev-build -d {} ".format(self.pkg_src_dir) + install_cmd += "dev-build -d {0} ".format(self.pkg_src_dir) if not self.opts["install"] and self.pkg_final_phase: - install_cmd += "-u {} ".format(self.pkg_final_phase) + install_cmd += "-u {0} ".format(self.pkg_final_phase) if self.opts["run_tests"]: install_cmd += "--test=root " install_cmd += self.pkg_name + self.opts["spec"] @@ -504,14 +632,14 @@ def install(self): if self.opts["install"]: pkg_path = self.find_spack_pkg_path(self.pkg_name) if self.pkg_name != pkg_path["name"]: - print("[ERROR: Could not find install of {}]".format(self.pkg_name)) + print("[ERROR: Could not find install of {0}]".format(self.pkg_name)) return -1 else: - pkg_lnk_dir = "{}-install".format(self.pkg_name) + pkg_lnk_dir = "{0}-install".format(self.pkg_name) if os.path.islink(pkg_lnk_dir): os.unlink(pkg_lnk_dir) print("") - print("[symlinking install to {}]").format(pjoin(self.dest_dir,pkg_lnk_dir)) + print("[symlinking install to {0}]").format(pjoin(self.dest_dir,pkg_lnk_dir)) os.symlink(pkg_path["path"],os.path.abspath(pkg_lnk_dir)) hcfg_glob = glob.glob(pjoin(pkg_lnk_dir,"*.cmake")) if len(hcfg_glob) > 0: @@ -519,7 +647,7 @@ def install(self): hcfg_fname = os.path.split(hcfg_path)[1] if os.path.islink(hcfg_fname): os.unlink(hcfg_fname) - print("[symlinking host config file to {}]".format(pjoin(self.dest_dir,hcfg_fname))) + print("[symlinking host config file to {0}]".format(pjoin(self.dest_dir,hcfg_fname))) os.symlink(hcfg_path,hcfg_fname) print("") print("[install complete!]") @@ -541,8 +669,8 @@ def create_mirror(self): mirror_cmd = "spack/bin/spack " if self.opts["ignore_ssl_errors"]: mirror_cmd += "-k " - mirror_cmd += "mirror create -d {} --dependencies {}".format(mirror_path, - self.pkg_name) + mirror_cmd += "mirror create -d {0} --dependencies {1}".format(mirror_path, + self.pkg_name) return sexe(mirror_cmd, echo=True) def find_spack_mirror(self, mirror_name): @@ -569,20 +697,20 @@ def use_mirror(self): if existing_mirror_path and mirror_path != existing_mirror_path: # Existing mirror has different URL, error out - print("[removing existing spack mirror `{}` @ {}]".format(mirror_name, - existing_mirror_path)) + print("[removing existing spack mirror `{0}` @ {1}]".format(mirror_name, + existing_mirror_path)) # # Note: In this case, spack says it removes the mirror, but we still # get errors when we try to add a new one, sounds like a bug # - sexe("spack/bin/spack mirror remove --scope=defaults {} ".format(mirror_name), + sexe("spack/bin/spack mirror remove --scope=defaults {0} ".format(mirror_name), echo=True) existing_mirror_path = None if not existing_mirror_path: # Add if not already there - sexe("spack/bin/spack mirror add --scope=defaults {} {}".format( + sexe("spack/bin/spack mirror add --scope=defaults {0} {1}".format( mirror_name, mirror_path), echo=True) - print("[using mirror {}]".format(mirror_path)) + print("[using mirror {0}]".format(mirror_path)) def find_spack_upstream(self, upstream_name): """ @@ -623,8 +751,8 @@ def use_spack_upstream(self): sexe("rm spack/etc/spack/defaults/upstreams.yaml") with open('spack/etc/spack/defaults/upstreams.yaml','w+') as upstreams_cfg_file: upstreams_cfg_file.write("upstreams:\n") - upstreams_cfg_file.write(" {}:\n".format(upstream_name)) - upstreams_cfg_file.write(" install_tree: {}\n".format(upstream_path)) + upstreams_cfg_file.write(" {0}:\n".format(upstream_name)) + upstreams_cfg_file.write(" install_tree: {0}\n".format(upstream_path)) def find_osx_sdks(): @@ -664,8 +792,8 @@ def setup_osx_sdk_env_vars(): env["MACOSX_DEPLOYMENT_TARGET"] = dep_tgt env["SDKROOT"] = sdk_root - print("[setting MACOSX_DEPLOYMENT_TARGET to {}]".format(env["MACOSX_DEPLOYMENT_TARGET"])) - print("[setting SDKROOT to {}]".format(env[ "SDKROOT"])) + print("[setting MACOSX_DEPLOYMENT_TARGET to {0}]".format(env["MACOSX_DEPLOYMENT_TARGET"])) + print("[setting SDKROOT to {0}]".format(env[ "SDKROOT"])) @@ -678,8 +806,8 @@ def main(): # parse args from command line opts, extra_opts = parse_args() - # Initialize the environment - env = SpackEnv(opts, extra_opts) + # Initialize the environment -- use vcpkg on windows, spack otherwise + env = SpackEnv(opts, extra_opts) if not is_windows() else VcpkgEnv(opts, extra_opts) # Setup the necessary paths and directories env.setup_paths_and_dirs() diff --git a/scripts/uberenv/vcpkg_ports/axom/CONTROL b/scripts/uberenv/vcpkg_ports/axom/CONTROL new file mode 100644 index 0000000000..a6664fb907 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/axom/CONTROL @@ -0,0 +1,4 @@ +Source: axom +Version: develop +Description: Host-config generator for Axom TPLs +Build-Depends: hdf5, conduit diff --git a/scripts/uberenv/vcpkg_ports/axom/portfile.cmake b/scripts/uberenv/vcpkg_ports/axom/portfile.cmake new file mode 100644 index 0000000000..0eda49493d --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/axom/portfile.cmake @@ -0,0 +1,131 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "${PORT} does not currently support UWP") +endif() + +include(vcpkg_common_functions) + +message(STATUS "Building dependencies for Axom") + +message(STATUS "CURRENT_INSTALLED_DIR -- ${CURRENT_INSTALLED_DIR}") +message(STATUS "PORT -- ${PORT}") + +set(_copyright [=[ +Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +other Axom Project Developers. See the top-level COPYRIGHT file for details. + +SPDX-License-Identifier: (BSD-3-Clause) +]=]) + +# Define a template for emitted TPL-enabled Axom host-config file +set(_host-config_hdr [=[ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# Host-config generated by vcpkg +# +# Port: @PORT@ +# Architecture: @VCPKG_TARGET_ARCHITECTURE@ +# Platform toolset: @VCPKG_PLATFORM_TOOLSET@ +# +# vcpkg root path: @VCPKG_ROOT_PATH@ +# vcpkg target triplet: @TARGET_TRIPLET@ +# vcpkg target triplet file: @TARGET_TRIPLET_FILE@ +# +# CMake system name: @CMAKE_SYSTEM_NAME@ +# CMake system version: @CMAKE_SYSTEM_VERSION@ +# CMake executable path: @CMAKE_COMMAND@ +#------------------------------------------------------------------------------ +# Empty/useless variables: +# VS path: @VCPKG_VISUAL_STUDIO_PATH@ +# VC Package root: @VCPKG_ROOT@ +# Linkage: @VCPKG_CRT_LINKAGE@ +# Library linkage: @VCPKG_CRT_LINKAGE@ +# CMake system name: @VCPKG_CMAKE_SYSTEM_NAME@ +# CMake system version: @VCPKG_CMAKE_SYSTEM_VERSION@ +#------------------------------------------------------------------------------ +# To configure the code using the vcpkg toolchain: +# cmake -C @_hc_file@ ../src +# +# To build the code through the command line: +# cmake --build . --target ALL_BUILD --config Debug [ -- -m:8 [-v:m] ] +# +# To run tests, run either: +# cmake --build . --target RUN_TESTS --config Debug +# ctest -C Debug [-j8] +#------------------------------------------------------------------------------ + +# On Windows, build shared libraries by default. +set(BUILD_SHARED_LIBS ON CACHE BOOL "") +# Static builds require some care and effort to get right. With a static +# build, choose one of +# - disable Google Test and MSVC static MD to MT (see BLT options +# section) or +# - disable one of HDF5, conduit (which uses HDF5), or sidre (which +# uses conduit). + +# Toolchain file +set(CMAKE_TOOLCHAIN_FILE @VCPKG_ROOT_PATH@/scripts/buildsystems/vcpkg.cmake CACHE FILEPATH "") +set(VCPKG_TARGET_TRIPLET @TARGET_TRIPLET@ CACHE STRING "") + +# Set TPLs +set(CONDUIT_DIR @CURRENT_INSTALLED_DIR@/share/conduit CACHE PATH "") +set(HDF5_DIR @CURRENT_INSTALLED_DIR@ CACHE PATH "") + +# Axom options +set(AXOM_ENABLE_TESTS ON CACHE BOOL "") +set(AXOM_ENABLE_DOCS OFF CACHE BOOL "") +set(AXOM_ENABLE_EXAMPLES ON CACHE BOOL "") + +# BLT options +set(ENABLE_FORTRAN OFF CACHE BOOL "") +set(ENABLE_FOLDERS ON CACHE BOOL "") +# Toggle the following to disable gtest if you are compiling with static +# libraries and need HDF5 +set(ENABLE_GTEST ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") +# Toggle the following to disable changing MSVC's /MD to /MT if you are +# compiling with static libraries and need HDF5 +set(BLT_ENABLE_MSVC_STATIC_MD_TO_MT ON CACHE BOOL "") + +# MPI options +set(ENABLE_MPI OFF CACHE BOOL "") +# If MSMPI and no other MPI is installed, turn ENABLE_MPI ON and CMake +# should automatically detect it. If CMake doesn't auto-detect MSMPI, +# or if you need to use another MPI, you will need to specify the MPI +# compiler wrappers and helper settings. +# +# Here are settings that might be appropriate for Intel compiler: +# +# set(MPI_C_COMPILER "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2019.5.281/windows/mpi/intel64/bin/mpicc.bat" CACHE PATH "") +# set(MPI_CXX_COMPILER "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2019.5.281/windows/mpi/intel64/bin/mpicc.bat" CACHE PATH "") +# set(MPI_Fortran_COMPILER "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2019.5.281/windows/mpi/intel64/bin/mpifc.bat" CACHE PATH "") +# set(MPIEXEC "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2019.5.281/windows/mpi/intel64/bin/mpiexec.exe" CACHE PATH "") +# set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") +# + +# cmake options +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "") + +# TODO: +# * Add TPLs: mfem, umpire, raja +# * Add tools: uncrustify, sphinx, doxygen + +]=]) + +# Create a copyright file +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/${PORT} ) +set(_copyright_file ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright) +file(WRITE ${_copyright_file} "${_copyright}") + +# Create a host-config file +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include/${PORT} ) +set(_hc_file ${CURRENT_PACKAGES_DIR}/include/${PORT}/hc.cmake) + +file(WRITE ${_hc_file}.in ${_host-config_hdr}) +configure_file(${_hc_file}.in ${_hc_file} @ONLY) + diff --git a/scripts/uberenv/vcpkg_ports/blt/CONTROL b/scripts/uberenv/vcpkg_ports/blt/CONTROL new file mode 100644 index 0000000000..b3c94ac201 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/blt/CONTROL @@ -0,0 +1,4 @@ +Source: blt +Version: v0.3.0 +Homepage: https://github.com/LLNL/blt +Description: A streamlined CMake build system foundation for developing HPC software diff --git a/scripts/uberenv/vcpkg_ports/blt/portfile.cmake b/scripts/uberenv/vcpkg_ports/blt/portfile.cmake new file mode 100644 index 0000000000..b88b0c63b0 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/blt/portfile.cmake @@ -0,0 +1,31 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "${PORT} does not currently support UWP") +endif() + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO llnl/blt + REF v0.3.0 + SHA512 87056151c358037e94d3aaee6331ecf0fc1abd9385773c02f7e774472cebb30e524bf37411af0a518417b143cb03a96794fb48949594f6c45ed2bfd3658efda2 + HEAD_REF develop +) + +file(MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/include/ + ${CURRENT_PACKAGES_DIR}/share/blt +) + +# Add an empty file to include to make vcpkg happy +file(WRITE ${CURRENT_PACKAGES_DIR}/include/empty.txt "") + +# Copy files over to blt's 'share' directory +set(_src_dir ${SOURCE_PATH}) +set(_dest_dir ${CURRENT_PACKAGES_DIR}/share/blt) + +foreach(_f cmake LICENSE RELEASE-NOTES.md SetupBLT.cmake thirdparty_builtin tests ) + file(COPY ${_src_dir}/${_f} DESTINATION ${_dest_dir} ) +endforeach() + +# Rename the LICENSE file to 'copyright' +file(RENAME ${_dest_dir}/LICENSE ${_dest_dir}/copyright) diff --git a/scripts/uberenv/vcpkg_ports/conduit/CONTROL b/scripts/uberenv/vcpkg_ports/conduit/CONTROL new file mode 100644 index 0000000000..2c2994bbe6 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/conduit/CONTROL @@ -0,0 +1,5 @@ +Source: conduit +Version: v0.5.1 +Homepage: https://github.com/llnl/conduit +Description: Simplified Data Exchange for HPC Simulations +Build-Depends: hdf5, blt diff --git a/scripts/uberenv/vcpkg_ports/conduit/portfile.cmake b/scripts/uberenv/vcpkg_ports/conduit/portfile.cmake new file mode 100644 index 0000000000..fe515a54a8 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/conduit/portfile.cmake @@ -0,0 +1,73 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "${PORT} does not currently support UWP") +endif() + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO llnl/conduit + REF v0.5.1 + SHA512 fcc03c5bceb8b68c351be4df85cfab86ca9f1d2c39db735f375ff5efcd6921d6e9498ccfd96d914891492d376d0c334b5eff5aad5253630d991095c1fea1fb95 + HEAD_REF master +) + +set(_is_shared TRUE) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(_is_shared FALSE) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH}/src + PREFER_NINJA + OPTIONS + -DBLT_SOURCE_DIR=${CURRENT_INSTALLED_DIR}/share/blt + -DCONDUIT_ENABLE_TESTS=OFF + -DENABLE_COVERAGE=OFF + -DENABLE_DOCS=OFF + -DENABLE_EXAMPLES=OFF + -DENABLE_PYTHON=OFF + -DENABLE_TESTS=OFF + -DENABLE_UTILS=OFF + -DBUILD_SHARED_LIBS=${_is_shared} + -DHDF5_DIR=${CURRENT_INSTALLED_DIR} +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake) +vcpkg_copy_pdbs() + + +## shuffle the output directories to make vcpkg happy +# Remove extraneous debug header files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Remove exe files -- vcpkg doesn't like them +# (Future): It might be possible to move them to the vcpkg 'tools' directory +foreach(_dir "bin" "debug/bin") + file(GLOB _exe ${CURRENT_PACKAGES_DIR}/${_dir}/*.exe) + if(_exe) + file(REMOVE ${_exe}) + endif() +endforeach() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + + +# Move/shuffle cmake files to 'share' directory +#file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/conduit ) +#file(COPY ${CURRENT_PACKAGES_DIR}/lib/cmake/ +# DESTINATION ${CURRENT_PACKAGES_DIR}/share/conduit/ ) +#file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/conduit-debug.cmake +# ${CURRENT_PACKAGES_DIR}/share/conduit/) +#file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) +#file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) + +# TODO: Fixup cmake files or config files? + +# Put the license file where vcpkg expects it +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/conduit RENAME copyright) + + diff --git a/scripts/uberenv/vcpkg_ports/hdf5/xCONTROL b/scripts/uberenv/vcpkg_ports/hdf5/xCONTROL new file mode 100644 index 0000000000..f49644c7a0 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/hdf5/xCONTROL @@ -0,0 +1,5 @@ +Source: hdf5 +Version: 1.10.5-8 +Homepage: https://www.hdfgroup.org/downloads/hdf5/ +Description: HDF5 is a data model, library, and file format for storing and managing data +Build-Depends: zlib, szip diff --git a/src/axom/sidre/CMakeLists.txt b/src/axom/sidre/CMakeLists.txt index f0c2b4572c..f0da3a9bb7 100644 --- a/src/axom/sidre/CMakeLists.txt +++ b/src/axom/sidre/CMakeLists.txt @@ -13,7 +13,7 @@ #------------------------------------------------------------------------------ axom_component_requires(NAME Sidre COMPONENTS SLIC - TPLS Conduit) + TPLS Conduit ) #------------------------------------------------------------------------------ # Add the sidre sources diff --git a/src/axom/sidre/core/AttrValues.hpp b/src/axom/sidre/core/AttrValues.hpp index bcb7dc9261..044140ba96 100644 --- a/src/axom/sidre/core/AttrValues.hpp +++ b/src/axom/sidre/core/AttrValues.hpp @@ -34,6 +34,8 @@ namespace axom namespace sidre { +class View; + /*! * \class AttrValue * diff --git a/src/axom/sidre/spio/IOManager.cpp b/src/axom/sidre/spio/IOManager.cpp index a82556d94e..3b2b9c1e36 100644 --- a/src/axom/sidre/spio/IOManager.cpp +++ b/src/axom/sidre/spio/IOManager.cpp @@ -1112,13 +1112,11 @@ void IOManager::writeBlueprintIndexToRootFile(DataStore* datastore, <<"based on group at path " << domain_path); } - #else AXOM_DEBUG_VAR(datastore); AXOM_DEBUG_VAR(domain_path); AXOM_DEBUG_VAR(file_name); AXOM_DEBUG_VAR(mesh_path); - AXOM_DEBUG_VAR(blueprint_name); SLIC_WARNING("Axom configured without hdf5. " <<"writeBlueprintIndexToRootFile() only currently implemented " diff --git a/src/axom/sidre/tests/CMakeLists.txt b/src/axom/sidre/tests/CMakeLists.txt index 762f5a9581..49205de143 100644 --- a/src/axom/sidre/tests/CMakeLists.txt +++ b/src/axom/sidre/tests/CMakeLists.txt @@ -77,18 +77,21 @@ endforeach() #------------------------------------------------------------------------------ # Add gtest C tests #------------------------------------------------------------------------------ -foreach(test ${gtest_sidre_C_tests}) - get_filename_component( test_name ${test} NAME_WE ) - blt_add_executable( NAME ${test_name}_test - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${sidre_test_depends} gtest - FOLDER axom/sidre/tests - ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name}_test - ) -endforeach() +if (ENABLE_FORTRAN) + # Sidre's C API is only built to provide a Fortran interface. + foreach(test ${gtest_sidre_C_tests}) + get_filename_component( test_name ${test} NAME_WE ) + blt_add_executable( NAME ${test_name}_test + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${sidre_test_depends} gtest + FOLDER axom/sidre/tests + ) + blt_add_test( NAME ${test_name} + COMMAND ${test_name}_test + ) + endforeach() +endif() #------------------------------------------------------------------------------ # Add Fortran tests diff --git a/src/cmake/thirdparty/FindConduit.cmake b/src/cmake/thirdparty/FindConduit.cmake index a5c93f5074..4385bbd0d9 100644 --- a/src/cmake/thirdparty/FindConduit.cmake +++ b/src/cmake/thirdparty/FindConduit.cmake @@ -17,11 +17,23 @@ if(NOT CONDUIT_DIR) MESSAGE(FATAL_ERROR "Could not find Conduit. Conduit requires explicit CONDUIT_DIR.") endif() -set(_conduit_config "${CONDUIT_DIR}/lib/cmake/ConduitConfig.cmake") -if(NOT EXISTS ${_conduit_config}) - MESSAGE(FATAL_ERROR "Could not find Conduit cmake include file ${_conduit_config}") -endif() -find_package(Conduit REQUIRED - NO_DEFAULT_PATH - PATHS ${CONDUIT_DIR}/lib/cmake) +if(NOT WIN32) + set(_conduit_config "${CONDUIT_DIR}/lib/cmake/ConduitConfig.cmake") + if(NOT EXISTS ${_conduit_config}) + MESSAGE(FATAL_ERROR "Could not find Conduit cmake include file ${_conduit_config}") + endif() + + find_package(Conduit REQUIRED + NO_DEFAULT_PATH + PATHS ${CONDUIT_DIR}/lib/cmake) +else() + # Allow for several different configurations of Conduit + find_package(Conduit CONFIG + REQUIRED + HINTS ${CONDUIT_DIR}/cmake/conduit + ${CONDUIT_DIR}/lib/cmake/conduit + ${CONDUIT_DIR}/share/cmake/conduit + ${CONDUIT_DIR}/share/conduit + ${CONDUIT_DIR}/cmake) +endif() \ No newline at end of file diff --git a/src/cmake/thirdparty/SetupAxomThirdParty.cmake b/src/cmake/thirdparty/SetupAxomThirdParty.cmake index 9576cf9326..b3ee7f92c7 100644 --- a/src/cmake/thirdparty/SetupAxomThirdParty.cmake +++ b/src/cmake/thirdparty/SetupAxomThirdParty.cmake @@ -91,10 +91,22 @@ endif() #------------------------------------------------------------------------------ if (HDF5_DIR) include(cmake/thirdparty/SetupHDF5.cmake) - blt_register_library( NAME hdf5 - INCLUDES ${HDF5_INCLUDE_DIRS} - LIBRARIES ${HDF5_LIBRARIES} - TREAT_INCLUDES_AS_SYSTEM ON) + if(WIN32 AND TARGET hdf5::hdf5-shared) + if(BUILD_SHARED_LIBS) + blt_register_library(NAME hdf5 + LIBRARIES hdf5::hdf5-shared + TREAT_INCLUDES_AS_SYSTEM ON) + else() + # Placeholder: we don't (yet) support static builds on Windows + blt_register_library(NAME hdf5 + LIBRARIES hdf5::hdf5-static) + endif() + else() + blt_register_library(NAME hdf5 + INCLUDES ${HDF5_INCLUDE_DIRS} + LIBRARIES ${HDF5_LIBRARIES} + TREAT_INCLUDES_AS_SYSTEM ON ) + endif() else() message(STATUS "HDF5 support is OFF") endif() From 07f7006658b8e36fa75706edb308480c92d9c777 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 19 Mar 2020 20:38:59 -0700 Subject: [PATCH 061/632] COMP: avoid variable redefinition warnings Rename std::ostringstream variable used by SLIC macros to avoid compiler warnings due to redefined variables. --- src/axom/slic/interface/slic_macros.hpp | 95 +++++++++++++------------ 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/src/axom/slic/interface/slic_macros.hpp b/src/axom/slic/interface/slic_macros.hpp index 1f7ff1835b..5925949074 100644 --- a/src/axom/slic/interface/slic_macros.hpp +++ b/src/axom/slic/interface/slic_macros.hpp @@ -7,6 +7,7 @@ #define AXOM_SLIC_MACROS_HPP_ #include "axom/config.hpp" +#include "axom/core/Macros.hpp" // for AXOM_HOST_DEVICE macros /*! * \file slic_macros.hpp @@ -30,9 +31,9 @@ */ #define SLIC_ERROR( msg ) \ do { \ - std::ostringstream oss; \ - oss << msg; \ - axom::slic::logErrorMessage( oss.str(),__FILE__, __LINE__); \ + std::ostringstream __oss; \ + __oss << msg; \ + axom::slic::logErrorMessage( __oss.str(),__FILE__, __LINE__); \ } while ( axom::slic::detail::false_value ) /*! @@ -52,9 +53,9 @@ #define SLIC_ERROR_IF( EXP, msg ) \ do { \ if ( EXP ) { \ - std::ostringstream oss; \ - oss << msg; \ - axom::slic::logErrorMessage(oss.str(),__FILE__,__LINE__); \ + std::ostringstream __oss; \ + __oss << msg; \ + axom::slic::logErrorMessage(__oss.str(),__FILE__,__LINE__); \ } \ } while ( axom::slic::detail::false_value ) @@ -77,9 +78,9 @@ */ #define SLIC_WARNING( msg ) \ do { \ - std::ostringstream oss; \ - oss << msg; \ - axom::slic::logWarningMessage(oss.str(),__FILE__, __LINE__ ); \ + std::ostringstream __oss; \ + __oss << msg; \ + axom::slic::logWarningMessage(__oss.str(),__FILE__, __LINE__ ); \ } while ( axom::slic::detail::false_value ) /*! @@ -98,9 +99,9 @@ #define SLIC_WARNING_IF( EXP, msg ) \ do { \ if ( EXP ) { \ - std::ostringstream oss; \ - oss << msg; \ - axom::slic::logWarningMessage(oss.str(),__FILE__,__LINE__ ); \ + std::ostringstream __oss; \ + __oss << msg; \ + axom::slic::logWarningMessage(__oss.str(),__FILE__,__LINE__ ); \ } \ } while ( axom::slic::detail::false_value ) @@ -130,9 +131,9 @@ #define SLIC_ASSERT( EXP ) \ do { \ if ( !(EXP) ) { \ - std::ostringstream oss; \ - oss << "Failed Assert: " << # EXP << std::ends; \ - axom::slic::logErrorMessage(oss.str(),__FILE__,__LINE__ ); \ + std::ostringstream __oss; \ + __oss << "Failed Assert: " << # EXP << std::ends; \ + axom::slic::logErrorMessage(__oss.str(),__FILE__,__LINE__ ); \ } \ } while ( axom::slic::detail::false_value ) @@ -154,9 +155,9 @@ #define SLIC_ASSERT_MSG( EXP, msg ) \ do { \ if ( !(EXP) ) { \ - std::ostringstream oss; \ - oss << "Failed Assert: " << # EXP << std::endl << msg << std::ends; \ - axom::slic::logErrorMessage(oss.str(),__FILE__,__LINE__ ); \ + std::ostringstream __oss; \ + __oss << "Failed Assert: " << # EXP << std::endl << msg << std::ends; \ + axom::slic::logErrorMessage(__oss.str(),__FILE__,__LINE__ ); \ } \ } while ( axom::slic::detail::false_value ) @@ -183,13 +184,13 @@ #define SLIC_CHECK( EXP ) \ do { \ if ( !(EXP) ) { \ - std::ostringstream oss; \ - oss << "Failed Check: " << # EXP << std::ends; \ + std::ostringstream __oss; \ + __oss << "Failed Check: " << # EXP << std::ends; \ if (axom::slic::debug::checksAreErrors) { \ - axom::slic::logErrorMessage( oss.str(),__FILE__, __LINE__); \ + axom::slic::logErrorMessage( __oss.str(),__FILE__, __LINE__); \ } \ else { \ - axom::slic::logWarningMessage( oss.str(),__FILE__, __LINE__); \ + axom::slic::logWarningMessage( __oss.str(),__FILE__, __LINE__); \ } \ } \ } while ( axom::slic::detail::false_value ) @@ -211,13 +212,13 @@ #define SLIC_CHECK_MSG( EXP, msg ) \ do { \ if ( !(EXP) ) { \ - std::ostringstream oss; \ - oss << "Failed Check: " << # EXP << std::endl << msg << std::ends; \ + std::ostringstream __oss; \ + __oss << "Failed Check: " << # EXP << std::endl << msg << std::ends; \ if (axom::slic::debug::checksAreErrors) { \ - axom::slic::logErrorMessage( oss.str(),__FILE__, __LINE__); \ + axom::slic::logErrorMessage( __oss.str(),__FILE__, __LINE__); \ } \ else { \ - axom::slic::logWarningMessage( oss.str(),__FILE__, __LINE__); \ + axom::slic::logWarningMessage( __oss.str(),__FILE__, __LINE__); \ } \ } \ } while ( axom::slic::detail::false_value ) @@ -227,8 +228,8 @@ // Use assert when on device #elif defined(AXOM_DEBUG) && defined(AXOM_DEVICE_CODE) -#define SLIC_ASSERT( EXP ) assert (EXP) -#define SLIC_ASSERT_MSG( EXP, msg ) assert (EXP) +#define SLIC_ASSERT( EXP ) assert (EXP) +#define SLIC_ASSERT_MSG( EXP, msg ) assert (EXP) #define SLIC_CHECK( EXP ) assert (EXP) #define SLIC_CHECK_MSG( EXP, msg ) assert (EXP) @@ -255,10 +256,10 @@ */ #define SLIC_INFO( msg ) \ do { \ - std::ostringstream oss; \ - oss << msg; \ + std::ostringstream __oss; \ + __oss << msg; \ axom::slic::logMessage(axom::slic::message::Info \ - , oss.str() \ + , __oss.str() \ ,__FILE__ \ , __LINE__ ); \ } while ( axom::slic::detail::false_value ) @@ -277,15 +278,15 @@ * */ #define SLIC_INFO_IF( EXP, msg ) \ - do { \ - if ( EXP ) { \ - std::ostringstream oss; \ - oss << msg; \ - axom::slic::logMessage(axom::slic::message::Info \ - , oss.str() \ - ,__FILE__ \ - , __LINE__ ); \ - } \ + do { \ + if ( EXP ) { \ + std::ostringstream __oss; \ + __oss << msg; \ + axom::slic::logMessage(axom::slic::message::Info \ + , __oss.str() \ + ,__FILE__ \ + , __LINE__ ); \ + } \ } while ( axom::slic::detail::false_value ) #ifdef AXOM_DEBUG @@ -304,10 +305,10 @@ */ #define SLIC_DEBUG( msg ) \ do { \ - std::ostringstream oss; \ - oss << msg; \ + std::ostringstream __oss; \ + __oss << msg; \ axom::slic::logMessage(axom::slic::message::Debug \ - , oss.str() \ + , __oss.str() \ ,__FILE__ \ , __LINE__ ); \ } while ( axom::slic::detail::false_value ) @@ -328,10 +329,10 @@ #define SLIC_DEBUG_IF( EXP, msg ) \ do { \ if ( EXP ) { \ - std::ostringstream oss; \ - oss << msg; \ + std::ostringstream __oss; \ + __oss << msg; \ axom::slic::logMessage(axom::slic::message::Debug \ - , oss.str() \ + , __oss.str() \ ,__FILE__ \ , __LINE__ ); \ } \ @@ -361,7 +362,7 @@ struct FalseType { AXOM_HOST_DEVICE FalseType() {} - + AXOM_HOST_DEVICE inline operator bool() const { return false; } }; From fcb018f329bfa61ac1bb61985dd5c71383ab0ef2 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 19 Mar 2020 17:57:48 -0700 Subject: [PATCH 062/632] update to develop blt, guard code checks and global options against including Axom as a subdirectory from another project --- src/CMakeLists.txt | 12 ++++++--- src/cmake/AxomMacros.cmake | 52 ++++++++++++++++++++------------------ src/cmake/blt | 2 +- 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 692f225648..c3a56eb043 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,10 +43,16 @@ else() endif() endif() -if (NOT BLT_CXX_STD) - set(BLT_CXX_STD "c++11" CACHE STRING "") +if (“${PROJECT_SOURCE_DIR}” STREQUAL “${CMAKE_SOURCE_DIR}”) + # Set some default BLT options before loading BLT only if not included in + # another project + if (NOT BLT_CXX_STD) + set(BLT_CXX_STD "c++11" CACHE STRING "") + endif() + + set(ENABLE_ASTYLE OFF CACHE BOOL "") + set(ENABLE_CLANGFORMAT OFF CACHE BOOL "") endif() -set(ENABLE_ASTYLE OFF CACHE BOOL "") include(${BLT_SOURCE_DIR}/SetupBLT.cmake) diff --git a/src/cmake/AxomMacros.cmake b/src/cmake/AxomMacros.cmake index 6dc1e5ae6f..bb998f4b07 100644 --- a/src/cmake/AxomMacros.cmake +++ b/src/cmake/AxomMacros.cmake @@ -26,35 +26,39 @@ macro(axom_add_code_checks) cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN}) - set(_all_sources) - file(GLOB_RECURSE _all_sources - "*.cpp" "*.hpp" "*.cxx" "*.hxx" "*.cc" "*.c" "*.h" "*.hh" - "*.F" "*.f" "*.f90" "*.F90") - - # Check for excludes - if (NOT DEFINED arg_EXCLUDES) - set(_sources ${_all_sources}) - else() - set(_sources) - foreach(_source ${_all_sources}) - set(_to_be_excluded FALSE) - foreach(_exclude ${arg_EXCLUDES}) - if (${_source} MATCHES ${_exclude}) - set(_to_be_excluded TRUE) - break() + # Only do code checks if building Axom by itself and not included in + # another project + if (“${PROJECT_SOURCE_DIR}” STREQUAL “${CMAKE_SOURCE_DIR}”) + set(_all_sources) + file(GLOB_RECURSE _all_sources + "*.cpp" "*.hpp" "*.cxx" "*.hxx" "*.cc" "*.c" "*.h" "*.hh" + "*.F" "*.f" "*.f90" "*.F90") + + # Check for excludes + if (NOT DEFINED arg_EXCLUDES) + set(_sources ${_all_sources}) + else() + set(_sources) + foreach(_source ${_all_sources}) + set(_to_be_excluded FALSE) + foreach(_exclude ${arg_EXCLUDES}) + if (${_source} MATCHES ${_exclude}) + set(_to_be_excluded TRUE) + break() + endif() + endforeach() + + if (NOT ${_to_be_excluded}) + list(APPEND _sources ${_source}) endif() endforeach() + endif() - if (NOT ${_to_be_excluded}) - list(APPEND _sources ${_source}) - endif() - endforeach() + blt_add_code_checks(PREFIX ${arg_PREFIX} + SOURCES ${_sources} + UNCRUSTIFY_CFG_FILE ${PROJECT_SOURCE_DIR}/uncrustify.cfg) endif() - blt_add_code_checks(PREFIX ${arg_PREFIX} - SOURCES ${_sources} - UNCRUSTIFY_CFG_FILE ${PROJECT_SOURCE_DIR}/uncrustify.cfg) - endmacro(axom_add_code_checks) diff --git a/src/cmake/blt b/src/cmake/blt index f0ab9a4abf..0d28f50e69 160000 --- a/src/cmake/blt +++ b/src/cmake/blt @@ -1 +1 @@ -Subproject commit f0ab9a4abfc79cb096f0a836a5127d3ce2424cb9 +Subproject commit 0d28f50e69cbe04c799ac0790e61e2194fa6b59a From 6ce733ddd250b5ab66b82e2ade18df9f78554f70 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 19 Mar 2020 18:06:53 -0700 Subject: [PATCH 063/632] Remove HEADERS_OUTPUT_SUBDIR that hasnt done anything in a very long time --- src/docs/sphinx/dev_guide/component_org.rst | 2 -- src/thirdparty/CMakeLists.txt | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/docs/sphinx/dev_guide/component_org.rst b/src/docs/sphinx/dev_guide/component_org.rst index 3cead84481..70b3d50792 100644 --- a/src/docs/sphinx/dev_guide/component_org.rst +++ b/src/docs/sphinx/dev_guide/component_org.rst @@ -210,8 +210,6 @@ add *sidre* as a library is:: "${sidre_fortran_sources}" HEADERS "${sidre_headers}" - HEADERS_OUTPUT_SUBDIR - sidre DEPENDS_ON ${sidre_depends} ) diff --git a/src/thirdparty/CMakeLists.txt b/src/thirdparty/CMakeLists.txt index 8ff165df20..75cee87d8c 100644 --- a/src/thirdparty/CMakeLists.txt +++ b/src/thirdparty/CMakeLists.txt @@ -13,8 +13,7 @@ #------------------------------------------------------------------------------ blt_add_library(NAME cli11 - HEADERS CLI11/CLI11.hpp - HEADERS_OUTPUT_SUBDIR CLI11) + HEADERS CLI11/CLI11.hpp) target_include_directories(cli11 SYSTEM INTERFACE $) @@ -57,8 +56,7 @@ set(fmt_headers_sources ) blt_add_library(NAME fmt - HEADERS ${fmt_headers} - HEADERS_OUTPUT_SUBDIR fmt) + HEADERS ${fmt_headers}) target_include_directories(fmt SYSTEM INTERFACE $) @@ -140,8 +138,7 @@ if (AXOM_ENABLE_SPARSEHASH) ) blt_add_library(NAME sparsehash - HEADERS ${sparsehash_headers} - HEADERS_OUTPUT_SUBDIR sparsehash) + HEADERS ${sparsehash_headers}) target_include_directories(sparsehash SYSTEM INTERFACE $) From 9b842e8e7792b4143a17bc88d39c2579761c364e Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Mar 2020 14:07:26 -0700 Subject: [PATCH 064/632] Fix weird double-quote character --- src/cmake/AxomMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake/AxomMacros.cmake b/src/cmake/AxomMacros.cmake index bb998f4b07..3d3a000ca2 100644 --- a/src/cmake/AxomMacros.cmake +++ b/src/cmake/AxomMacros.cmake @@ -28,7 +28,7 @@ macro(axom_add_code_checks) # Only do code checks if building Axom by itself and not included in # another project - if (“${PROJECT_SOURCE_DIR}” STREQUAL “${CMAKE_SOURCE_DIR}”) + if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") set(_all_sources) file(GLOB_RECURSE _all_sources "*.cpp" "*.hpp" "*.cxx" "*.hxx" "*.cc" "*.c" "*.h" "*.hh" From 4a3a5ca3a6f16f5516395d343c5823740ef3f455 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 19 Mar 2020 10:29:37 -0700 Subject: [PATCH 065/632] COMP: fix minor warnings on windows Fix various warnings on Windows due to unused variables and type conversion from double to integer. --- src/axom/core/Array.hpp | 3 +- src/axom/core/memory_management.hpp | 3 + src/axom/core/numerics/eigen_solve.hpp | 4 +- src/axom/core/tests/core_array.cpp | 32 +++++------ src/axom/core/tests/core_stack_array.cpp | 6 ++ src/axom/core/tests/utils_utilities.cpp | 56 ++++++++++++------- src/axom/core/utilities/Utilities.hpp | 4 +- src/axom/mint/examples/mint_heat_equation.cpp | 8 +-- .../mint_unstructured_mixed_topology_mesh.cpp | 2 +- ...mint_unstructured_single_topology_mesh.cpp | 2 +- .../mint/execution/internal/for_all_cells.hpp | 8 +-- .../mint/execution/internal/for_all_faces.hpp | 3 +- src/axom/mint/mesh/internal/MeshHelpers.cpp | 12 ++-- .../mint/tests/mint_fem_shape_functions.cpp | 2 +- .../tests/mint_mesh_connectivity_array.cpp | 9 +-- .../mint/tests/mint_mesh_face_relation.cpp | 52 ++++++++--------- .../mint/tests/mint_mesh_field_variable.cpp | 5 +- .../tests/mint_mesh_unstructured_mesh.cpp | 12 ++-- src/axom/mint/tests/mint_test_utilities.hpp | 38 ++++++------- .../primal/examples/primal_introduction.cpp | 2 +- src/axom/primal/geometry/BezierCurve.hpp | 7 ++- .../primal/geometry/OrientedBoundingBox.hpp | 8 +-- src/axom/primal/geometry/Point.hpp | 18 +++--- src/axom/primal/geometry/Polygon.hpp | 2 +- .../primal/tests/primal_bezier_intersect.cpp | 4 +- src/axom/primal/tests/primal_point.cpp | 7 +-- src/axom/quest/InOutOctree.hpp | 27 ++++----- src/axom/quest/MeshTester.cpp | 2 +- src/axom/quest/SignedDistance.hpp | 6 +- .../quest/examples/quest_inout_interface.cpp | 3 +- src/axom/quest/stl/STLReader.cpp | 2 +- .../tests/quest_all_nearest_neighbors.cpp | 16 +++--- .../quest/tests/quest_inout_interface.cpp | 10 ++-- src/axom/quest/tests/quest_test_utilities.hpp | 4 +- src/axom/slam/DynamicSet.hpp | 6 +- src/axom/slam/Map.hpp | 2 +- src/axom/slam/examples/ShockTube.cpp | 6 +- src/axom/slam/examples/UserDocs.cpp | 4 +- .../slam/policies/IndirectionPolicies.hpp | 2 +- src/axom/slic/core/LogStream.cpp | 4 ++ src/axom/slic/core/Logger.cpp | 8 +-- src/axom/spin/BVHTree.hpp | 12 ++-- src/axom/spin/Brood.hpp | 5 +- src/axom/spin/DenseOctreeLevel.hpp | 2 +- src/axom/spin/SparseOctreeLevel.hpp | 4 +- src/axom/spin/UniformGrid.hpp | 4 +- src/axom/spin/examples/spin_introduction.cpp | 20 +++---- src/axom/spin/tests/spin_octree.cpp | 12 ++-- src/tools/mesh_tester.cpp | 42 +++++++------- 49 files changed, 281 insertions(+), 231 deletions(-) diff --git a/src/axom/core/Array.hpp b/src/axom/core/Array.hpp index c48ab24cbc..02d6ae8cf8 100644 --- a/src/axom/core/Array.hpp +++ b/src/axom/core/Array.hpp @@ -745,7 +745,8 @@ inline void Array< T >::dynamicRealloc( IndexType new_num_tuples ) } assert( m_resize_ratio >= 1.0 ); - const IndexType new_capacity = new_num_tuples * m_resize_ratio + 0.5; + const IndexType new_capacity = + static_cast< IndexType >( new_num_tuples * m_resize_ratio + 0.5 ); if ( m_resize_ratio < 1.0 ) { diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 828293342f..562a4e0a97 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -61,6 +61,8 @@ inline void setDefaultAllocator( int allocatorID ) umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); umpire::Allocator allocator = rm.getAllocator( allocatorID ); rm.setDefaultAllocator( allocator ); +#else + static_cast< void >( allocatorID ); // silence compiler warnings #endif } @@ -158,6 +160,7 @@ inline T* allocate( std::size_t n, int allocID ) noexcept return static_cast< T* >( allocator.allocate( numbytes ) ); #else + static_cast< void >( allocID ); // silence compiler warnings return static_cast< T* >( std::malloc( numbytes ) ); #endif diff --git a/src/axom/core/numerics/eigen_solve.hpp b/src/axom/core/numerics/eigen_solve.hpp index 4b82d21f3f..6f9d1938f1 100644 --- a/src/axom/core/numerics/eigen_solve.hpp +++ b/src/axom/core/numerics/eigen_solve.hpp @@ -138,9 +138,9 @@ int eigen_solve(Matrix< T >& A, int k, T* u, T* lambdas, int numIterations) matrix_vector_multiply(A, vec, temp); // make ortho to previous (for stability) - for (int k = 0 ; k < i ; k++) + for (int kk = 0 ; kk < i ; kk++) { - make_orthogonal< T >(temp, u + k*N, N); + make_orthogonal< T >(temp, u + kk*N, N); } res = normalize< T >(temp, N); diff --git a/src/axom/core/tests/core_array.cpp b/src/axom/core/tests/core_array.cpp index 5069b5c607..523724b98d 100644 --- a/src/axom/core/tests/core_array.cpp +++ b/src/axom/core/tests/core_array.cpp @@ -32,7 +32,7 @@ IndexType calc_new_capacity( Array< T > & v, IndexType increase ) IndexType new_num_tuples = v.size() + increase; if ( new_num_tuples > v.capacity() ) { - return new_num_tuples * v.getResizeRatio() + 0.5; + return static_cast< IndexType >( new_num_tuples*v.getResizeRatio() + 0.5 ); } return v.capacity(); @@ -227,7 +227,7 @@ void check_fill( Array< T >& v ) template < typename T > void check_set( Array< T >& v ) { - constexpr T ZERO = 0; + constexpr T ZERO_VAL = 0; const IndexType capacity = v.capacity(); const IndexType size = v.size(); const IndexType num_components = v.numComponents(); @@ -244,7 +244,7 @@ void check_set( Array< T >& v ) } /* Set all the values in the array to zero. */ - v.fill( ZERO ); + v.fill( ZERO_VAL ); /* Set the first half of the tuples in the array to the sequential values in * buffer. */ @@ -272,7 +272,7 @@ void check_set( Array< T >& v ) { for ( IndexType j = 0 ; j < num_components ; ++j ) { - EXPECT_EQ( v( i, j ), ZERO ); + EXPECT_EQ( v( i, j ), ZERO_VAL ); } } @@ -878,16 +878,16 @@ void check_external( Array< T >& v ) //------------------------------------------------------------------------------ TEST( core_array, checkStorage ) { - constexpr IndexType ZERO = 0; + constexpr IndexType ZERO_VAL = 0; for ( IndexType capacity = 2 ; capacity < 512 ; capacity *= 2 ) { for ( IndexType n_components = 1 ; n_components <= 4 ; n_components++ ) { - Array< int > v_int( ZERO, n_components, capacity ); + Array< int > v_int( ZERO_VAL, n_components, capacity ); internal::check_storage( v_int ); - Array< double > v_double( ZERO, n_components, capacity ); + Array< double > v_double( ZERO_VAL, n_components, capacity ); internal::check_storage( v_double ); } } @@ -929,7 +929,7 @@ TEST( core_array, checkSet ) //------------------------------------------------------------------------------ TEST( core_array, checkResize ) { - constexpr IndexType ZERO = 0; + constexpr IndexType ZERO_VAL = 0; for ( double ratio = 1.0 ; ratio <= 2.0 ; ratio += 0.5 ) { @@ -937,11 +937,11 @@ TEST( core_array, checkResize ) { for ( IndexType n_components = 1 ; n_components <= 4 ; n_components++ ) { - Array< int > v_int( ZERO, n_components, capacity ); + Array< int > v_int( ZERO_VAL, n_components, capacity ); v_int.setResizeRatio( ratio ); internal::check_resize( v_int ); - Array< double > v_double( ZERO, n_components, capacity ); + Array< double > v_double( ZERO_VAL, n_components, capacity ); v_double.setResizeRatio( ratio ); internal::check_resize( v_double ); } @@ -961,7 +961,7 @@ TEST( core_array_DeathTest, checkResize ) //------------------------------------------------------------------------------ TEST( core_array, checkInsert ) { - constexpr IndexType ZERO = 0; + constexpr IndexType ZERO_VAL = 0; for ( double ratio = 1.0 ; ratio <= 2.0 ; ratio += 0.5 ) { @@ -969,11 +969,11 @@ TEST( core_array, checkInsert ) { for ( IndexType n_components = 1 ; n_components <= 3 ; n_components++ ) { - Array< int > v_int( ZERO, n_components, capacity ); + Array< int > v_int( ZERO_VAL, n_components, capacity ); v_int.setResizeRatio( ratio ); internal::check_insert( v_int ); - Array< double > v_double( ZERO, n_components, capacity ); + Array< double > v_double( ZERO_VAL, n_components, capacity ); v_double.setResizeRatio( ratio ); internal::check_insert( v_double ); } @@ -984,7 +984,7 @@ TEST( core_array, checkInsert ) //------------------------------------------------------------------------------ TEST( core_array, checkEmplace ) { - constexpr IndexType ZERO = 0; + constexpr IndexType ZERO_VAL = 0; for ( double ratio = 1.0 ; ratio <= 2.0 ; ratio += 0.5 ) { @@ -992,11 +992,11 @@ TEST( core_array, checkEmplace ) { for ( IndexType n_components = 1 ; n_components <= 3 ; n_components++ ) { - Array< int > v_int( ZERO, n_components, capacity ); + Array< int > v_int( ZERO_VAL, n_components, capacity ); v_int.setResizeRatio( ratio ); internal::check_emplace( v_int ); - Array< double > v_double( ZERO, n_components, capacity ); + Array< double > v_double( ZERO_VAL, n_components, capacity ); v_double.setResizeRatio( ratio ); internal::check_emplace( v_double ); } diff --git a/src/axom/core/tests/core_stack_array.cpp b/src/axom/core/tests/core_stack_array.cpp index 17f25fe00d..a43270cde5 100644 --- a/src/axom/core/tests/core_stack_array.cpp +++ b/src/axom/core/tests/core_stack_array.cpp @@ -105,10 +105,16 @@ struct Tensor bool operator==( const Tensor& other ) const { +#ifndef WIN32 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + return x == other.x && y == other.y && z == other.z; + +#ifndef WIN32 #pragma GCC diagnostic pop +#endif } }; diff --git a/src/axom/core/tests/utils_utilities.cpp b/src/axom/core/tests/utils_utilities.cpp index bb9bb17b34..af761b14bf 100644 --- a/src/axom/core/tests/utils_utilities.cpp +++ b/src/axom/core/tests/utils_utilities.cpp @@ -7,6 +7,36 @@ #include "axom/core/utilities/Utilities.hpp" +// C/C++ includes +#include + +//------------------------------------------------------------------------------ +// HELPER METHODS +//------------------------------------------------------------------------------ +template < typename T > +void check_random_real( int offset ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + constexpr T min = 0; + constexpr T max = 1; + + const T curr_min = min - static_cast< T >( offset ); + const T curr_max = max - static_cast< T >( offset ); + + constexpr int MAX_ITERS = 100; + for ( int i=0; i < MAX_ITERS; ++i ) + { + T val = axom::utilities::random_real( curr_min, curr_max ); + EXPECT_GE( val, curr_min ); + EXPECT_LT( val, curr_max ); + } + +} + +//------------------------------------------------------------------------------ +// UNIT TESTS +//------------------------------------------------------------------------------ TEST(core_Utilities,log2) { std::cout<<"Testing log2 functions."<< std::endl; @@ -40,34 +70,21 @@ TEST(core_Utilities,log2) } } +//------------------------------------------------------------------------------ TEST(core_Utilities,random_real) { std::cout<<"Testing random_real functions (non-deterministic)."<< std::endl; - int min = 0; - int max = 1; for (int offset = 0 ; offset < 10 ; ++offset) { - int cur_min = min - offset; - int cur_max = max + offset; - for (int i = 0 ; i < 100 ; ++i) - { - float f_val = axom::utilities::random_real(cur_min, cur_max); - EXPECT_GE(f_val, cur_min); - EXPECT_LT(f_val, cur_max); - - double d_val = axom::utilities::random_real(cur_min, cur_max); - EXPECT_GE(d_val, cur_min); - EXPECT_LT(d_val, cur_max); - - long double ld_val = axom::utilities::random_real(cur_min, - cur_max); - EXPECT_GE(ld_val, cur_min); - EXPECT_LT(ld_val, cur_max); - } + check_random_real< float >( offset ); + check_random_real< double >( offset ); + check_random_real< long double >( offset ); } + } +//------------------------------------------------------------------------------ TEST( core_Utilities,random_real_with_seed ) { std::cout<<"Testing random_real functions (deterministic)."<< std::endl; @@ -94,6 +111,7 @@ TEST( core_Utilities,random_real_with_seed ) } +//------------------------------------------------------------------------------ TEST(core_Utilities,minmax) { std::cout<<"Testing min and max functions."<< std::endl; diff --git a/src/axom/core/utilities/Utilities.hpp b/src/axom/core/utilities/Utilities.hpp index ad7483d45b..b4192ba5da 100644 --- a/src/axom/core/utilities/Utilities.hpp +++ b/src/axom/core/utilities/Utilities.hpp @@ -93,7 +93,7 @@ void swap( T& a, T& b ) template < typename T > inline T log2( T& val) { - return std::log2(val); + return static_cast< T >( std::log2(val) ); } /*! @@ -169,7 +169,7 @@ inline T random_real( const T& a, const T& b ) static std::mt19937_64 mt( rd() ); static std::uniform_real_distribution< T > dist(0.0, 1.0); - double temp = dist(mt); + T temp = dist(mt); return temp * ( b - a ) + a; } diff --git a/src/axom/mint/examples/mint_heat_equation.cpp b/src/axom/mint/examples/mint_heat_equation.cpp index daad46a739..493aa3acb9 100644 --- a/src/axom/mint/examples/mint_heat_equation.cpp +++ b/src/axom/mint/examples/mint_heat_equation.cpp @@ -192,7 +192,7 @@ class HeatEquationSolver int cur_dump = 0; double cur_time = 0.0; - const int num_cycles = std::ceil( t_max / dt ); + const int num_cycles = static_cast< int >( std::ceil( t_max / dt ) ); for (int cycle = 0 ; cycle < num_cycles ; ++cycle ) { if ( cycle == num_cycles - 1 ) @@ -326,10 +326,10 @@ class HeatEquationSolver IndexType Ni, Nj; const double lx = axom::utilities::abs( upper_bound[0] - lower_bound[0] ); - Ni = (lx / h) + 1; + Ni = static_cast< IndexType >( (lx / h) + 1 ); const double ly = axom::utilities::abs( upper_bound[1] - lower_bound[1] ); - Nj = (ly / h) + 1; + Nj = static_cast< IndexType >( (ly / h) + 1 ); UniformMesh* mesh = new UniformMesh( lower_bound, upper_bound, Ni, Nj ); mesh->createField< double >( "temperature", mint::NODE_CENTERED ); @@ -474,7 +474,7 @@ void parse_arguments( Arguments& args, int argc, const char** argv ) std::strcmp( argv[ i ], "-dumpPeriod" ) == 0 ) { SLIC_ERROR_IF( i >= argc - 1, "Not enough arguments." ); - args.period = atof( argv[ i + 1 ] ); + args.period = atoi( argv[ i + 1 ] ); i++; } else diff --git a/src/axom/mint/examples/mint_unstructured_mixed_topology_mesh.cpp b/src/axom/mint/examples/mint_unstructured_mixed_topology_mesh.cpp index b1f617479b..58e6bd0f74 100644 --- a/src/axom/mint/examples/mint_unstructured_mixed_topology_mesh.cpp +++ b/src/axom/mint/examples/mint_unstructured_mixed_topology_mesh.cpp @@ -74,7 +74,7 @@ int main( int AXOM_NOT_USED(argc), char** AXOM_NOT_USED(argv) ) vy[ node_ID ] = utilities::random_real( LO, HI ); vz[ node_ID ] = utilities::random_real( LO, HI ); p_avg[ node_ID ] = 0.0; - cells_per_node[ node_ID ] = 0.0; + cells_per_node[ node_ID ] = 0; node_ID++; } } diff --git a/src/axom/mint/examples/mint_unstructured_single_topology_mesh.cpp b/src/axom/mint/examples/mint_unstructured_single_topology_mesh.cpp index 4f9f162d35..a86669bc56 100644 --- a/src/axom/mint/examples/mint_unstructured_single_topology_mesh.cpp +++ b/src/axom/mint/examples/mint_unstructured_single_topology_mesh.cpp @@ -68,7 +68,7 @@ int main( int AXOM_NOT_USED(argc), char** AXOM_NOT_USED(argv) ) vy[ node_ID ] = utilities::random_real( LO, HI ); vz[ node_ID ] = utilities::random_real( LO, HI ); p_avg[ node_ID ] = 0.0; - cells_per_node[ node_ID ] = 0.0; + cells_per_node[ node_ID ] = 0; node_ID++; } } diff --git a/src/axom/mint/execution/internal/for_all_cells.hpp b/src/axom/mint/execution/internal/for_all_cells.hpp index 88bd4ce737..c96d1a80c1 100644 --- a/src/axom/mint/execution/internal/for_all_cells.hpp +++ b/src/axom/mint/execution/internal/for_all_cells.hpp @@ -220,9 +220,9 @@ inline void for_all_cells_impl( xargs::nodeids, const IndexType n0 = i + j * nodeJp; IndexType cell_connectivity[ 4 ]; - for ( int i = 0; i < 4; ++i ) + for ( int ii = 0; ii < 4; ++ii ) { - cell_connectivity[ i ] = n0 + offsets[ i ]; + cell_connectivity[ ii ] = n0 + offsets[ ii ]; } kernel( cellID, cell_connectivity, 4 ); @@ -239,9 +239,9 @@ inline void for_all_cells_impl( xargs::nodeids, const IndexType n0 = i + j * nodeJp + k * nodeKp; IndexType cell_connectivity[ 8 ]; - for ( int i = 0; i < 8; ++i ) + for ( int ii = 0; ii < 8; ++ii ) { - cell_connectivity[ i ] = n0 + offsets[ i ]; + cell_connectivity[ ii ] = n0 + offsets[ ii ]; } kernel( cellID, cell_connectivity, 8 ); diff --git a/src/axom/mint/execution/internal/for_all_faces.hpp b/src/axom/mint/execution/internal/for_all_faces.hpp index 70ea7bf349..c91ed1401b 100644 --- a/src/axom/mint/execution/internal/for_all_faces.hpp +++ b/src/axom/mint/execution/internal/for_all_faces.hpp @@ -317,12 +317,13 @@ inline void for_all_faces_impl( xargs::nodeids, KernelType&& kernel ) { const IndexType dimension = m.getDimension(); - const IndexType numIFaces = m.getTotalNumFaces( I_DIRECTION ); const IndexType* offsets = m.getCellNodeOffsetsArray(); const IndexType cellNodeOffset3 = offsets[ 3 ]; if ( dimension == 2 ) { + const IndexType numIFaces = m.getTotalNumFaces( I_DIRECTION ); + helpers::for_all_I_faces< ExecPolicy >( xargs::ij(), m, AXOM_LAMBDA( IndexType faceID, IndexType AXOM_NOT_USED(i), IndexType AXOM_NOT_USED(j) ) diff --git a/src/axom/mint/mesh/internal/MeshHelpers.cpp b/src/axom/mint/mesh/internal/MeshHelpers.cpp index afaa844326..039c7669ab 100644 --- a/src/axom/mint/mesh/internal/MeshHelpers.cpp +++ b/src/axom/mint/mesh/internal/MeshHelpers.cpp @@ -114,7 +114,7 @@ bool initFaces(Mesh * mesh, // https://www.vtk.org/wp-content/uploads/2015/04/file-formats.pdf. // This routine selects the face nodes as listed in the registered // cell info to make sure that face normals point outward. - // + // // For every face, sort the node IDs and join them together in a // string with '.' delimiters. This is the key for an associative // array whose value is a list of cell IDs. @@ -155,8 +155,8 @@ bool initFaces(Mesh * mesh, for (FaceBuilderType::value_type v : workface) { FaceTypeCellsNodes theFace = v.second; - faceNodeTotal += theFace.facenodes.size(); - int faceCellCount = theFace.facecells.size(); + faceNodeTotal += static_cast< IndexType >( theFace.facenodes.size() ); + int faceCellCount = static_cast< int >( theFace.facecells.size() ); IndexType * faceCells = theFace.facecells.data(); if (faceCellCount < 1 || faceCellCount > 2) @@ -199,7 +199,7 @@ bool initFaces(Mesh * mesh, std::copy(faceNodes.begin(), faceNodes.end(), f2n + faceNodeOffset); f2noffsets[fidx] = faceNodeOffset; f2ntypes[fidx] = theFace.facetype; - faceNodeOffset += faceNodes.size(); + faceNodeOffset += static_cast< int >( faceNodes.size() ); } f2noffsets[facecount] = faceNodeOffset; @@ -242,7 +242,7 @@ bool initFaces(Mesh * mesh, // *SHOULD* have), copy them in. std::vector & theCells = cell_to_face[cellID]; IndexType * faceIDs = theCells.data(); - int thisCellFaceCount = theCells.size(); + int thisCellFaceCount = static_cast< int >( theCells.size() ); // Copy in values for (int f = 0; f < thisCellFaceCount; ++f) @@ -253,7 +253,7 @@ bool initFaces(Mesh * mesh, // Maintain offset cellFaceCount += thisCellFaceCount; - } + } } c2foffsets[cellcount] = cellFaceCount; diff --git a/src/axom/mint/tests/mint_fem_shape_functions.cpp b/src/axom/mint/tests/mint_fem_shape_functions.cpp index b6d679e281..d4257ba896 100644 --- a/src/axom/mint/tests/mint_fem_shape_functions.cpp +++ b/src/axom/mint/tests/mint_fem_shape_functions.cpp @@ -181,7 +181,7 @@ void partition_of_unity() sf.evaluate( nc, phi ); - double sum=0.0; + sum=0.0; for ( int j=0 ; j < ndofs ; ++j ) { sum += phi[ j ]; diff --git a/src/axom/mint/tests/mint_mesh_connectivity_array.cpp b/src/axom/mint/tests/mint_mesh_connectivity_array.cpp index cff7424ac5..028ab23d29 100644 --- a/src/axom/mint/tests/mint_mesh_connectivity_array.cpp +++ b/src/axom/mint/tests/mint_mesh_connectivity_array.cpp @@ -49,7 +49,7 @@ IndexType calc_ID_capacity( const ConnectivityArray< NO_INDIRECTION >& connec, IndexType new_n_IDs = connec.getNumberOfIDs() + increase; if ( new_n_IDs > connec.getIDCapacity() ) { - return new_n_IDs * connec.getResizeRatio() + 0.5; + return static_cast< IndexType >( new_n_IDs*connec.getResizeRatio() + 0.5 ); } return connec.getIDCapacity(); @@ -71,7 +71,8 @@ IndexType calc_ID_capacity( const ConnectivityArray< INDIRECTION >& connec, IndexType new_n_IDs = connec.getNumberOfIDs() + increase; if ( new_n_IDs > connec.getIDCapacity() ) { - return ((new_n_IDs + 1) * connec.getResizeRatio() + 0.5) - 1; + return ( + static_cast< IndexType >((new_n_IDs+1)*connec.getResizeRatio() + 0.5)-1); } return connec.getIDCapacity(); @@ -91,7 +92,7 @@ IndexType calc_ID_capacity( IndexType new_n_IDs = connec.getNumberOfIDs() + increase; if ( new_n_IDs > connec.getIDCapacity() ) { - return new_n_IDs * connec.getResizeRatio() + 0.5; + return static_cast< IndexType >( new_n_IDs*connec.getResizeRatio()+0.5); } return connec.getIDCapacity(); @@ -127,7 +128,7 @@ IndexType calc_value_capacity( const ConnectivityArray< TYPE >& connec, IndexType new_n_values = connec.getNumberOfValues() + increase; if ( new_n_values > connec.getValueCapacity() ) { - return new_n_values * connec.getResizeRatio() + 0.5; + return static_cast< IndexType >( new_n_values*connec.getResizeRatio()+0.5 ); } return connec.getValueCapacity(); diff --git a/src/axom/mint/tests/mint_mesh_face_relation.cpp b/src/axom/mint/tests/mint_mesh_face_relation.cpp index a74721ead3..14f1d0f890 100644 --- a/src/axom/mint/tests/mint_mesh_face_relation.cpp +++ b/src/axom/mint/tests/mint_mesh_face_relation.cpp @@ -86,7 +86,7 @@ std::vector generateFaceTestCases() new UnstructuredMesh< SINGLE_SHAPE >(TWO_D, TRIANGLE); double trinodes[] = { 0, 0, 1, 0, 0, 1 } ; IndexType tricells[] = { 0, 1, 2 } ; - + tri->appendNodes(trinodes, 3); tri->appendCells(tricells, 1); tests.push_back(new internal::MeshFaceTest @@ -106,7 +106,7 @@ std::vector generateFaceTestCases() double twotrisnodes[] = { 0, 0, 1, 0, 0, 1, 0.8, 1.2 } ; IndexType twotriscells[] = { 0, 1, 2, 1, 3, 2 } ; - + twotris->appendNodes(twotrisnodes, 4); twotris->appendCells(twotriscells, 2); tests.push_back(new internal::MeshFaceTest @@ -173,7 +173,7 @@ std::vector generateFaceTestCases() 0, 2, 3, 1, 5, 4, 2, 5, 3 }; - + fourtris->appendNodes(fourtrisxs, fourtrisys, 6); fourtris->appendCells(fourtriscells, 4); tests.push_back(new internal::MeshFaceTest @@ -204,7 +204,7 @@ std::vector generateFaceTestCases() new UnstructuredMesh< SINGLE_SHAPE >(THREE_D, TRIANGLE); double threeDtrinodes[] = { -1, 0, 0, 0, 1, 0.5, 1.2, -.2, 3 }; IndexType threeDtricells[] = { 0, 1, 2 }; - + threeDtri->appendNodes(threeDtrinodes, 3); threeDtri->appendCells(threeDtricells, 1); tests.push_back(new internal::MeshFaceTest @@ -264,7 +264,7 @@ std::vector generateFaceTestCases() double tettrisys[] = { 0, 0, 1, 1 }; double tettriszs[] = { 0, -.1, 0.2, 1 }; IndexType tettriscells[] = { 0, 2, 1, 0, 1, 3, 1, 2, 3, 2, 0, 3 }; - + tettris->appendNodes(tettrisxs, tettrisys, tettriszs, 4); tettris->appendCells(tettriscells, 4); tests.push_back(new internal::MeshFaceTest @@ -300,7 +300,7 @@ std::vector generateFaceTestCases() 2, 3, 7, 6, 3, 0, 4, 7, 4, 5, 6, 7 }; - + hexquads->appendNodes(hexquadsxs, hexquadsys, hexquadszs, 8); hexquads->appendCells(hexquadscells, 6); tests.push_back(new internal::MeshFaceTest @@ -378,7 +378,7 @@ std::vector generateFaceTestCases() 1, 1, 1 }; IndexType b2btriscells[] = { 0, 1, 2, 0, 2, 1 }; - + b2btris->appendNodes(b2btrisnodes, 3); b2btris->appendCells(b2btriscells, 2); tests.push_back(new internal::MeshFaceTest @@ -527,7 +527,7 @@ std::vector generateFaceTestCases() double crackedtetys[] = { 0, 0, 1, 1, 0.9 }; double crackedtetzs[] = { 0, -.1, 0.2, 1, 1 }; IndexType crackedtetcells[] = { 0, 2, 1, 0, 1, 4, 1, 2, 3, 2, 0, 3 }; - + crackedtet->appendNodes(crackedtetxs, crackedtetys, crackedtetzs, 5); crackedtet->appendCells(crackedtetcells, 4); tests.push_back(new internal::MeshFaceTest @@ -606,10 +606,10 @@ std::vector generateFaceTestCases() double notmanfxs[] = { -1, 0, 0, 0.2, 1 }; double notmanfys[] = { 0, 0, 0, -.6, 0 }; double notmanfzs[] = { 0.6, 0, 1, 0.4, 0.4 }; - IndexType notmanfcells[] = { 0, 1, 2, + IndexType notmanfcells[] = { 0, 1, 2, 3, 1, 2, 4, 1, 2 }; - + notmanf->appendNodes(notmanfxs, notmanfys, notmanfzs, 5); notmanf->appendCells(notmanfcells, 3); tests.push_back(new internal::MeshFaceTest @@ -642,7 +642,7 @@ std::vector generateFaceTestCases() double egregys[] = { 0, 0, 1, 1, 0.8, 0, 0, -0.4, -0.9 }; double egregzs[] = { 0, 0, 0, 0, 0.4, 1, 1, 1.2, 0.5 }; IndexType egregcells[] = { 0, 1, 2, 3, - 0, 1, 4, + 0, 1, 4, 0, 1, 5, 6, 0, 1, 7, 0, 1, 8 } ; @@ -689,7 +689,7 @@ std::vector generateFaceTestCases() double tetys[] = { 0, 0, 1, 1 }; double tetzs[] = { 0, -.1, 0.2, 1 }; IndexType tetcells[] = { 0, 1, 2, 3 }; - + tet->appendNodes(tetxs, tetys, tetzs, 4); tet->appendCells(tetcells, 1); tests.push_back(new internal::MeshFaceTest @@ -717,7 +717,7 @@ std::vector generateFaceTestCases() double hexszs[] = { 0, 0.2, 0, 0, 0, 0, 1, 1, 1, 1, 0.8, 1 }; IndexType hexscells[] = { 0, 1, 4, 3, 6, 7, 10, 9, 1, 2, 5, 4, 7, 8, 11, 10 }; - + hexs->appendNodes(hexsxs, hexsys, hexszs, 12); hexs->appendCells(hexscells, 2); tests.push_back(new internal::MeshFaceTest @@ -755,7 +755,7 @@ std::vector generateFaceTestCases() IndexType hexs3cells[] = { 0, 3, 10, 7, 1, 4, 11, 8, 3, 5, 12, 10, 4, 6, 13, 11, 0, 2, 9, 7, 3, 5, 12, 10 }; - + hexs3->appendNodes(hexs3xs, hexs3ys, hexs3zs, 14); hexs3->appendCells(hexs3cells, 3); tests.push_back(new internal::MeshFaceTest @@ -798,7 +798,7 @@ std::vector generateFaceTestCases() double mtetzs[] = { 0, -.1, 0.2, 1 }; IndexType mtetcells[] = { 0, 1, 2, 3, 0, 2, 1, 3 }; - + mtet->appendNodes(mtetxs, mtetys, mtetzs, 4); mtet->appendCells(mtetcells, 2); tests.push_back(new internal::MeshFaceTest @@ -830,7 +830,7 @@ std::vector generateFaceTestCases() IndexType badtetscells[] = { 0, 1, 2, 3, 0, 3, 2, 4, 0, 3, 2, 5 }; - + badtets->appendNodes(badtetsxs, badtetsys, badtetszs, 6); badtets->appendCells(badtetscells, 3); tests.push_back(new internal::MeshFaceTest @@ -954,14 +954,15 @@ bool checkAndReportFaceNodes(std::map< std::string, FaceTypeNodes > & fn, bool success = true; if (fn.size() > 0) { - int fcount = fn.size(); + int fcount = static_cast< int >( fn.size() ); mesg << fcount << label << std::endl; for (auto fit = fn.begin(), fend = fn.end(); fit != fend; ++fit) { FaceTypeNodes & ftn = fit->second; mesg << "Type " << getCellInfo(ftn.facetype).name << " ("; - mesg << internal::join_ints_into_string(ftn.facenodes.size(), - ftn.facenodes.data(), ' '); + mesg << internal::join_ints_into_string( + static_cast< int >( ftn.facenodes.size() ), + ftn.facenodes.data(), ' '); mesg << ") " << std::endl; } success = false; @@ -977,7 +978,7 @@ bool matchRotateList(std::vector &a, std::vector &b) if (a.size() != b.size() || a.size() < 1) { return false; } bool matches = false; - int elts = a.size(); + int elts = static_cast< int >( a.size() ); for (int offset = 0; offset < elts && !matches; ++offset) { matches = true; @@ -1131,7 +1132,7 @@ void runMeshFaceTest(internal::MeshFaceTest * t) } else if (!initresult && t->initShouldSucceed) { - FAIL() << "test mesh \"" << t->name << + FAIL() << "test mesh \"" << t->name << "\" call to initFaces() failed but should have succeeded."; } else if (initresult && !(t->initShouldSucceed)) @@ -1144,7 +1145,7 @@ void runMeshFaceTest(internal::MeshFaceTest * t) delete [] f2noffsets; delete [] f2ntypes; - FAIL() << "test mesh \"" << t->name << + FAIL() << "test mesh \"" << t->name << "\" call to initFaces() succeeded but should have failed."; } else @@ -1178,8 +1179,9 @@ void runMeshFaceTest(internal::MeshFaceTest * t) if (!neighborsMatched) { errmesg << "Cell " << c << " expected neighbors "; - IndexType facecount = t->cellFaceCount[c]; - for (int i = 0; i < facecount; ++i) + + facecount = t->cellFaceCount[c]; + for (IndexType i = 0; i < facecount; ++i) { errmesg << t->cellNeighbors[c2foffsets[c] + i] << " "; } @@ -1393,7 +1395,7 @@ TEST( mint_mesh_face_relation, tf_faceMatches ) } /*! \brief Test driver for the mesh face relation construction. - * + * * This TEST does the following: * -# generate mesh test sets, each supplied with correct answers, comprising * -# the mesh itself diff --git a/src/axom/mint/tests/mint_mesh_field_variable.cpp b/src/axom/mint/tests/mint_mesh_field_variable.cpp index 1373b891c6..416fbcf916 100644 --- a/src/axom/mint/tests/mint_mesh_field_variable.cpp +++ b/src/axom/mint/tests/mint_mesh_field_variable.cpp @@ -407,7 +407,10 @@ TEST( mint_mesh_field_variable, shrink ) mint::FieldVariable< double > field( "f", SMALL_NUM_TUPLES, NUM_COMPONENTS ); EXPECT_EQ( field.getName(), "f" ); - axom::IndexType capacity = SMALL_NUM_TUPLES * field.getResizeRatio() + 0.5; + const double ratio = field.getResizeRatio(); + axom::IndexType capacity = + static_cast< axom::IndexType >( SMALL_NUM_TUPLES*ratio + 0.5 ); + if ( capacity < axom::Array< axom::IndexType >::MIN_DEFAULT_CAPACITY ) { capacity = axom::Array< axom::IndexType >::MIN_DEFAULT_CAPACITY; diff --git a/src/axom/mint/tests/mint_mesh_unstructured_mesh.cpp b/src/axom/mint/tests/mint_mesh_unstructured_mesh.cpp index 3dfa40ac94..5e7dd1292b 100644 --- a/src/axom/mint/tests/mint_mesh_unstructured_mesh.cpp +++ b/src/axom/mint/tests/mint_mesh_unstructured_mesh.cpp @@ -1305,11 +1305,11 @@ void check_append_cells( const UnstructuredMesh< MIXED_SHAPE >* mesh, /* Check using the other getCell */ for ( IndexType i = 0 ; i < n_cells ; ++i ) { - const IndexType* cell = mesh->getCellNodeIDs( i ); + const IndexType* cellNodeIds = mesh->getCellNodeIDs( i ); IndexType num_nodes = mesh->getNumberOfCellNodes( i ); for ( IndexType j = 0 ; j < num_nodes ; ++j ) { - EXPECT_EQ( cell[ j ], connecValue( i, j ) ); + EXPECT_EQ( cellNodeIds[ j ], connecValue( i, j ) ); } } } @@ -2099,7 +2099,7 @@ void resize_nodes( UnstructuredMesh< TOPO >* mesh ) /* Append one more, should trigger a resize. */ append_node_single( mesh, 1 ); n_nodes++; - node_capacity = n_nodes * resize_ratio + 0.5; + node_capacity = static_cast< IndexType >( n_nodes * resize_ratio + 0.5 ); ASSERT_EQ( n_nodes, mesh->getNumberOfNodes() ); ASSERT_EQ( node_capacity, mesh->getNodeCapacity() ); @@ -2114,7 +2114,7 @@ void resize_nodes( UnstructuredMesh< TOPO >* mesh ) mesh->setNodeResizeRatio( resize_ratio ); append_node_structs( mesh, 100 ); n_nodes += 100; - node_capacity = resize_ratio * n_nodes + 0.5; + node_capacity = static_cast< IndexType >( resize_ratio * n_nodes + 0.5 ); ASSERT_EQ( n_nodes, mesh->getNumberOfNodes() ); ASSERT_EQ( node_capacity, mesh->getNodeCapacity() ); @@ -2195,7 +2195,7 @@ void resize_cells( UnstructuredMesh< TOPO >* mesh ) /* Append one more, should trigger a resize. */ append_cell_single( mesh, 1 ); n_cells++; - cell_capacity = n_cells * resize_ratio + 0.5; + cell_capacity = static_cast< IndexType >( n_cells * resize_ratio + 0.5 ); connec_capacity = mesh->getCellNodesCapacity(); ASSERT_EQ( n_cells, mesh->getNumberOfCells() ); ASSERT_EQ( cell_capacity, mesh->getCellCapacity() ); @@ -2212,7 +2212,7 @@ void resize_cells( UnstructuredMesh< TOPO >* mesh ) mesh->setCellResizeRatio( resize_ratio ); append_cell_multiple( mesh, 100 ); n_cells += 100; - cell_capacity = resize_ratio * n_cells + 0.5; + cell_capacity = static_cast< IndexType >( resize_ratio * n_cells + 0.5 ); ASSERT_EQ( n_cells, mesh->getNumberOfCells() ); ASSERT_EQ( cell_capacity, mesh->getCellCapacity() ); diff --git a/src/axom/mint/tests/mint_test_utilities.hpp b/src/axom/mint/tests/mint_test_utilities.hpp index f9adb6e892..b8b4ebc2c6 100644 --- a/src/axom/mint/tests/mint_test_utilities.hpp +++ b/src/axom/mint/tests/mint_test_utilities.hpp @@ -65,7 +65,7 @@ template < > struct mesh_type< STRUCTURED_RECTILINEAR_MESH, SINGLE_SHAPE > { using MeshType = RectilinearMesh; - static constexpr char* name() { + static constexpr char* name() { return (char*)"STRUCTURED_RECTILINEAR_MESH"; }; }; @@ -120,7 +120,7 @@ Mesh* create_mesh( const UniformMesh& uniform_mesh ) lo[ i ] = uniform_mesh.evaluateCoordinate(0,i); hi[ i ] = uniform_mesh.evaluateCoordinate( N[i]-1, i ); } - UniformMesh* output_mesh = new UniformMesh( lo, hi, N[0], N[1], + UniformMesh* output_mesh = new UniformMesh( lo, hi, N[0], N[1], N[2] ); EXPECT_EQ( output_mesh->getMeshType(), STRUCTURED_UNIFORM_MESH ); @@ -144,7 +144,7 @@ Mesh* create_mesh< STRUCTURED_CURVILINEAR_MESH, SINGLE_SHAPE >( node_dims[ i ] = uniform_mesh.getNodeResolution( i ); } - CurvilinearMesh* output_mesh = new CurvilinearMesh( + CurvilinearMesh* output_mesh = new CurvilinearMesh( node_dims[ I_DIRECTION ], node_dims[ J_DIRECTION ], node_dims[ K_DIRECTION ] ); @@ -239,13 +239,13 @@ Mesh* create_mesh< STRUCTURED_RECTILINEAR_MESH, SINGLE_SHAPE >( //------------------------------------------------------------------------------ template < > -Mesh* create_mesh< PARTICLE_MESH, SINGLE_SHAPE >( +Mesh* create_mesh< PARTICLE_MESH, SINGLE_SHAPE >( const UniformMesh& uniform_mesh ) { const int dimension = uniform_mesh.getDimension(); const IndexType numNodes = uniform_mesh.getNumberOfNodes(); - ParticleMesh* output_mesh = + ParticleMesh* output_mesh = new ParticleMesh( dimension, numNodes ); for ( IndexType inode=0 ; inode < numNodes ; ++inode ) @@ -273,8 +273,8 @@ Mesh* create_mesh< PARTICLE_MESH, SINGLE_SHAPE >( //------------------------------------------------------------------------------ template < > -Mesh* -create_mesh< UNSTRUCTURED_MESH, SINGLE_SHAPE >( +Mesh* +create_mesh< UNSTRUCTURED_MESH, SINGLE_SHAPE >( const UniformMesh& uniform_mesh ) { const int dimension = uniform_mesh.getDimension(); @@ -285,7 +285,7 @@ create_mesh< UNSTRUCTURED_MESH, SINGLE_SHAPE >( CellType cell_type = ( dimension==3 ) ? HEX : ( (dimension==2) ? QUAD : SEGMENT ); - UnstructuredMeshType* output_mesh = + UnstructuredMeshType* output_mesh = new UnstructuredMeshType( dimension, cell_type, numNodes, numCells ); // append nodes @@ -317,8 +317,8 @@ create_mesh< UNSTRUCTURED_MESH, SINGLE_SHAPE >( //------------------------------------------------------------------------------ template < > -Mesh* -create_mesh< UNSTRUCTURED_MESH, MIXED_SHAPE >( +Mesh* +create_mesh< UNSTRUCTURED_MESH, MIXED_SHAPE >( const UniformMesh& uniform_mesh ) { const int dimension = uniform_mesh.getDimension(); @@ -331,12 +331,12 @@ create_mesh< UNSTRUCTURED_MESH, MIXED_SHAPE >( using UnstructuredMeshType = UnstructuredMesh< MIXED_SHAPE >; IndexType node_capacity = numNodes + numCells / 2; - IndexType cell_capacity = numCells * 2.5; + IndexType cell_capacity = static_cast< IndexType >( numCells * 2.5 ); if ( dimension == 3 ) { - node_capacity = numNodes + numCells / 2.0; - cell_capacity = numCells * 3.5; + node_capacity = static_cast< IndexType >( numNodes + numCells / 2.0 ); + cell_capacity = static_cast< IndexType >( numCells * 3.5 ); } UnstructuredMeshType* output_mesh = new UnstructuredMeshType( dimension, @@ -415,38 +415,38 @@ create_mesh< UNSTRUCTURED_MESH, MIXED_SHAPE >( (k + 0.5) * spacing[ 2 ] }; output_mesh->appendNodes( centroid ); - pyramid[0] = uniformCell[0]; + pyramid[0] = uniformCell[0]; pyramid[1] = uniformCell[1]; pyramid[2] = uniformCell[2]; pyramid[3] = uniformCell[3]; pyramid[4] = centerNode; output_mesh->appendCell( pyramid, PYRAMID ); - pyramid[0] = uniformCell[4]; + pyramid[0] = uniformCell[4]; pyramid[1] = uniformCell[7]; pyramid[2] = uniformCell[6]; pyramid[3] = uniformCell[5]; output_mesh->appendCell( pyramid, PYRAMID ); - pyramid[0] = uniformCell[1]; + pyramid[0] = uniformCell[1]; pyramid[1] = uniformCell[5]; pyramid[2] = uniformCell[6]; pyramid[3] = uniformCell[2]; output_mesh->appendCell( pyramid, PYRAMID ); - pyramid[0] = uniformCell[0]; + pyramid[0] = uniformCell[0]; pyramid[1] = uniformCell[3]; pyramid[2] = uniformCell[7]; pyramid[3] = uniformCell[4]; output_mesh->appendCell( pyramid, PYRAMID ); - pyramid[0] = uniformCell[0]; + pyramid[0] = uniformCell[0]; pyramid[1] = uniformCell[4]; pyramid[2] = uniformCell[5]; pyramid[3] = uniformCell[1]; output_mesh->appendCell( pyramid, PYRAMID ); - pyramid[0] = uniformCell[3]; + pyramid[0] = uniformCell[3]; pyramid[1] = uniformCell[2]; pyramid[2] = uniformCell[6]; pyramid[3] = uniformCell[7]; diff --git a/src/axom/primal/examples/primal_introduction.cpp b/src/axom/primal/examples/primal_introduction.cpp index 2fc300ba35..09cc7b184a 100644 --- a/src/axom/primal/examples/primal_introduction.cpp +++ b/src/axom/primal/examples/primal_introduction.cpp @@ -669,7 +669,7 @@ void findTriIntersectionsNaively( std::vector< std::pair > & clashes ) { - int tcount = tris.size(); + int tcount = static_cast< int >( tris.size() ); for (int i = 0 ; i < tcount ; ++i) { diff --git a/src/axom/primal/geometry/BezierCurve.hpp b/src/axom/primal/geometry/BezierCurve.hpp index 24c6602696..4b6f5121c4 100644 --- a/src/axom/primal/geometry/BezierCurve.hpp +++ b/src/axom/primal/geometry/BezierCurve.hpp @@ -150,7 +150,7 @@ class BezierCurve void setOrder( int ord) { m_controlPoints.resize(ord+1); } /*! Returns the order of the Bezier Curve*/ - int getOrder() const { return m_controlPoints.size()-1; } + int getOrder() const { return static_cast< int>(m_controlPoints.size())-1; } /*! Clears the list of control points*/ void clear() @@ -190,14 +190,15 @@ class BezierCurve /*! Returns an axis-aligned bounding box containing the Bezier curve */ BoundingBoxType boundingBox() const { - return BoundingBoxType(m_controlPoints.data(), m_controlPoints.size()); + return BoundingBoxType(m_controlPoints.data(), + static_cast< int >( m_controlPoints.size() ) ); } /*! Returns an oriented bounding box containing the Bezier curve */ OrientedBoundingBoxType orientedBoundingBox() const { return OrientedBoundingBoxType(m_controlPoints.data(), - m_controlPoints.size()); + static_cast< int >(m_controlPoints.size())); } /*! diff --git a/src/axom/primal/geometry/OrientedBoundingBox.hpp b/src/axom/primal/geometry/OrientedBoundingBox.hpp index e88e02e4ee..dd1bb4c01d 100644 --- a/src/axom/primal/geometry/OrientedBoundingBox.hpp +++ b/src/axom/primal/geometry/OrientedBoundingBox.hpp @@ -3,8 +3,8 @@ // // SPDX-License-Identifier: (BSD-3-Clause) -#ifndef ORIENTEDBOUNDINGBOX_HPP_ -#define ORIENTEDBOUNDINGBOX_HPP_ +#ifndef PRIMAL_ORIENTEDBOUNDINGBOX_HPP_ +#define PRIMAL_ORIENTEDBOUNDINGBOX_HPP_ #include @@ -534,7 +534,7 @@ void OrientedBoundingBox< T, NDIMS >::addBox( OrientedBoundingBox< T, } std::vector< Point< T, NDIMS > > res = obb.vertices(); - int size = res.size(); + int size = static_cast< int >( res.size() ); for (int i = 0 ; i < size ; i++) { @@ -660,7 +660,7 @@ bool OrientedBoundingBox< T, NDIMS >::contains( { std::vector< Point< T, NDIMS > > l = otherOBB.vertices(); - int size = l.size(); + int size = static_cast< int >( l.size() ); for (int i = 0 ; i < size ; i++) { diff --git a/src/axom/primal/geometry/Point.hpp b/src/axom/primal/geometry/Point.hpp index 10c09ba62c..0d8a7f90c9 100644 --- a/src/axom/primal/geometry/Point.hpp +++ b/src/axom/primal/geometry/Point.hpp @@ -132,10 +132,10 @@ class Point * \return p[i] the value at the given component index. * \pre (i >= 0) && (i < ndims) */ - AXOM_HOST_DEVICE + AXOM_HOST_DEVICE const T& operator[](int i) const { return m_components[i]; } - - AXOM_HOST_DEVICE + + AXOM_HOST_DEVICE T& operator[](int i) { return m_components[i]; } ///@} @@ -154,10 +154,10 @@ class Point /*! * \brief Returns a reference to the underlying NumericArray. */ - AXOM_HOST_DEVICE + AXOM_HOST_DEVICE const NumericArray< T,NDIMS >& array() const { return m_components; } - - AXOM_HOST_DEVICE + + AXOM_HOST_DEVICE NumericArray< T,NDIMS >& array() { return m_components; } /*! @@ -225,7 +225,7 @@ class Point * \post \f$ P==B\f$ when \f$ \alpha=1.0\f$ * \post The return point, P, and the user-supplied points A, B are collinear. */ - static Point lerp( const Point& A, const Point& B, double alpha); + static Point lerp( const Point& A, const Point& B, T alpha); /*! * \brief Helper function to return a point whose coordinates are all 0 @@ -297,10 +297,10 @@ template < typename T, int NDIMS > inline Point< T,NDIMS > Point< T,NDIMS >::lerp( const Point< T,NDIMS >& A, const Point< T,NDIMS >& B, - double alpha) + T alpha) { PointType res; - const double beta = 1.-alpha; + const T beta = 1.-alpha; for ( int i=0 ; i < NDIMS ; ++i ) { res[ i ] = beta*A[ i ] + alpha*B[ i ]; diff --git a/src/axom/primal/geometry/Polygon.hpp b/src/axom/primal/geometry/Polygon.hpp index 3e928c9477..afc83dc46e 100644 --- a/src/axom/primal/geometry/Polygon.hpp +++ b/src/axom/primal/geometry/Polygon.hpp @@ -71,7 +71,7 @@ class Polygon } /*! Return the number of vertices in the polygon */ - int numVertices() const { return m_vertices.size(); } + int numVertices() const { return static_cast< int >( m_vertices.size() ); } /*! Appends a vertex to the list of vertices */ void addVertex(const PointType& pt) diff --git a/src/axom/primal/tests/primal_bezier_intersect.cpp b/src/axom/primal/tests/primal_bezier_intersect.cpp index 0aebc9544e..51afb0f63c 100644 --- a/src/axom/primal/tests/primal_bezier_intersect.cpp +++ b/src/axom/primal/tests/primal_bezier_intersect.cpp @@ -46,7 +46,7 @@ void checkIntersections(const primal::BezierCurve& curve1, EXPECT_TRUE(std::is_sorted(exp_s.begin(), exp_s.end())); EXPECT_TRUE(std::is_sorted(exp_t.begin(), exp_t.end())); - const int num_exp_intersections = exp_s.size(); + const int num_exp_intersections = static_cast< int >( exp_s.size() ); const bool exp_intersect = (num_exp_intersections > 0); // Intersect the two curves, intersection parameters will be @@ -57,7 +57,7 @@ void checkIntersections(const primal::BezierCurve& curve1, EXPECT_EQ(s.size(), t.size()); // check that we found the expected number of intersection points - const int num_actual_intersections = s.size(); + const int num_actual_intersections = static_cast< int >( s.size() ); EXPECT_EQ(num_exp_intersections, num_actual_intersections); // check that the evaluated intersection points are identical diff --git a/src/axom/primal/tests/primal_point.cpp b/src/axom/primal/tests/primal_point.cpp index 91b8fd0446..ef6144f09d 100644 --- a/src/axom/primal/tests/primal_point.cpp +++ b/src/axom/primal/tests/primal_point.cpp @@ -308,11 +308,10 @@ TEST( primal_point, point_midpoint) //------------------------------------------------------------------------------ TEST( primal_point, point_linear_interpolation) { - static const int DIM = 3; - typedef int CoordType; - typedef primal::Point< CoordType, DIM > QPoint; + constexpr int DIM = 3; + using QPoint = primal::Point< double, DIM >; - QPoint p0(0); + QPoint p0; QPoint p1(100); EXPECT_TRUE(QPoint::lerp(p0,p1, 0) == p0); diff --git a/src/axom/quest/InOutOctree.hpp b/src/axom/quest/InOutOctree.hpp index faab3aabaa..43bd1c0452 100644 --- a/src/axom/quest/InOutOctree.hpp +++ b/src/axom/quest/InOutOctree.hpp @@ -421,7 +421,7 @@ class DynamicGrayBlockData void reserveTriangles(int count) { m_tris.reserve(count); } /** Find the number of triangles associated with this leaf */ - int numTriangles() const { return m_tris.size(); } + int numTriangles() const { return static_cast< int >( m_tris.size() ); } /** Associates the surface triangle with the given index with this block */ void addTriangle(TriangleIndex tInd) { m_tris.push_back(tInd); } @@ -840,10 +840,12 @@ class InOutOctree : public spin::SpatialOctree } } - m_elementSet = MeshElementSet( m_tv_data.size() / NUM_TRI_VERTS ); + m_elementSet = + MeshElementSet( static_cast(m_tv_data.size()) / NUM_TRI_VERTS ); m_triangleToVertexRelation = TriangleVertexRelation(&m_elementSet, &m_vertexSet); - m_triangleToVertexRelation.bindIndices(m_tv_data.size(), &m_tv_data); + m_triangleToVertexRelation.bindIndices( + static_cast(m_tv_data.size()), &m_tv_data); // Delete old mesh, and NULL its pointer @@ -1526,7 +1528,7 @@ void InOutOctree::insertMeshTriangles () if( dynamicLeafData.hasTriangles()) { // Set the leaf data in the octree - blkData.setData( gvRelData.size() ); + blkData.setData( static_cast< int >( gvRelData.size() ) ); // Add the vertex index to the gray blocks vertex relation gvRelData.push_back( dynamicLeafData.vertexIndex() ); @@ -1535,7 +1537,7 @@ void InOutOctree::insertMeshTriangles () std::copy( dynamicLeafData.triangles().begin(), dynamicLeafData.triangles().end(), std::back_inserter(geIndRelData)); - geSizeRelData.push_back( geIndRelData.size()); + geSizeRelData.push_back( static_cast< int >( geIndRelData.size() ) ); QUEST_OCTREE_DEBUG_LOG_IF( DEBUG_BLOCK_1 == blk || DEBUG_BLOCK_2 == blk, @@ -1612,7 +1614,7 @@ void InOutOctree::insertMeshTriangles () // Add all triangles to intersecting children blocks DynamicGrayBlockData::TriangleList& parentTriangles = dynamicLeafData.triangles(); - int numTriangles = parentTriangles.size(); + int numTriangles = static_cast< int >( parentTriangles.size() ); for(int i=0 ; i< numTriangles ; ++i) { TriangleIndex tIdx = parentTriangles[i]; @@ -1678,13 +1680,13 @@ void InOutOctree::insertMeshTriangles () if(!levelLeafMap.empty() ) { // Create the relations from gray leaves to mesh vertices and elements - m_grayLeafsMap[lev] = GrayLeafSet( gvRelData.size() ); + m_grayLeafsMap[lev] = GrayLeafSet( static_cast< int >(gvRelData.size()) ); m_grayLeafToVertexRelationLevelMap[lev] = GrayLeafVertexRelation(&m_grayLeafsMap[lev], &m_meshWrapper.vertexSet()); m_grayLeafToVertexRelationLevelMap[lev]. - bindIndices(gvRelData.size(), &gvRelData); + bindIndices( static_cast< int >(gvRelData.size()), &gvRelData); m_grayLeafToElementRelationLevelMap[lev] = GrayLeafElementRelation(&m_grayLeafsMap[lev], @@ -1692,7 +1694,7 @@ void InOutOctree::insertMeshTriangles () m_grayLeafToElementRelationLevelMap[lev]. bindBeginOffsets(m_grayLeafsMap[lev].size(), &geSizeRelData); m_grayLeafToElementRelationLevelMap[lev]. - bindIndices(geIndRelData.size(), &geIndRelData); + bindIndices( static_cast< int >(geIndRelData.size()), &geIndRelData); } currentLevelData.clear(); @@ -1742,14 +1744,13 @@ void InOutOctree::colorOctreeLeaves() // (or their descendants) is gray while(!uncoloredBlocks.empty()) { - int prevCount = uncoloredBlocks.size(); + int prevCount = static_cast< int >(uncoloredBlocks.size()); AXOM_DEBUG_VAR(prevCount); GridPtVec prevVec; prevVec.swap(uncoloredBlocks); - for(typename GridPtVec::iterator it = prevVec.begin(), - itEnd = prevVec.end() ; - it < itEnd ; ++it) + auto end = prevVec.end(); + for(auto it = prevVec.begin() ; it < end ; ++it) { BlockIndex leafBlk(*it, lev); if(!colorLeafAndNeighbors( leafBlk, (*this)[leafBlk] ) ) diff --git a/src/axom/quest/MeshTester.cpp b/src/axom/quest/MeshTester.cpp index 7b53e93057..9851e2fda5 100644 --- a/src/axom/quest/MeshTester.cpp +++ b/src/axom/quest/MeshTester.cpp @@ -382,7 +382,7 @@ void weldTriMeshVertices(UMesh** surface_mesh,double eps) uniqueVertCount++; newMesh->appendNodes(vert.data()); } - vertex_remap[i] = res.first->second; + vertex_remap[i] = static_cast< int >( res.first->second ); } // Next, add triangles into the new mesh using the unique vertex indices diff --git a/src/axom/quest/SignedDistance.hpp b/src/axom/quest/SignedDistance.hpp index 31a3602cf8..513b503b3f 100644 --- a/src/axom/quest/SignedDistance.hpp +++ b/src/axom/quest/SignedDistance.hpp @@ -380,11 +380,11 @@ inline double SignedDistance< NDIMS >::computeDistance( m_bvhTree->find( pt, buckets ); // STEP 1: get candidate surface elements - int nbuckets = buckets.size(); + int nbuckets = static_cast< int >( buckets.size() ); std::vector< int > candidates; this->getCandidateSurfaceElements( pt, &buckets[0], nbuckets, candidates ); - const int nelems = candidates.size(); + const int nelems = static_cast< int >( candidates.size() ); // STEP 2: process surface elements and compute minimum distance and // corresponding closest point. @@ -596,7 +596,7 @@ void SignedDistance< NDIMS >::getCandidateSurfaceElements( int* indx = new int[ nelems ]; // STEP 1: get flat array of the surface elements and compute distances - int icount = 0; + int icount( static_cast< int >(0) ); for ( int ibin=0 ; ibin < nbins ; ++ibin ) { diff --git a/src/axom/quest/examples/quest_inout_interface.cpp b/src/axom/quest/examples/quest_inout_interface.cpp index b9d4b17ca8..09a20d7f67 100644 --- a/src/axom/quest/examples/quest_inout_interface.cpp +++ b/src/axom/quest/examples/quest_inout_interface.cpp @@ -247,7 +247,8 @@ int main( int argc, char** argv ) const double rate = queryPoints.size() / timer.elapsed(); SLIC_INFO(" query rate: " << rate << " queries per second."); - const double intPercent = (100 * numInside) / queryPoints.size(); + const double intPercent = + (100 * numInside) / static_cast< double >( queryPoints.size() ); SLIC_INFO(" " << numInside << " of " << queryPoints.size() << " (" << intPercent << "%) " << " of the query points were contained in the surface."); diff --git a/src/axom/quest/stl/STLReader.cpp b/src/axom/quest/stl/STLReader.cpp index 918f90d1c8..b07030cbbc 100644 --- a/src/axom/quest/stl/STLReader.cpp +++ b/src/axom/quest/stl/STLReader.cpp @@ -131,7 +131,7 @@ int STLReader::readAsciiSTL() } // Set the number of nodes and faces - m_num_nodes = m_nodes.size() / 3; + m_num_nodes = static_cast< axom::IndexType >( m_nodes.size() ) / 3; m_num_faces = m_num_nodes / 3; ifs.close(); diff --git a/src/axom/quest/tests/quest_all_nearest_neighbors.cpp b/src/axom/quest/tests/quest_all_nearest_neighbors.cpp index 6b1513ec9f..5c56d0863e 100644 --- a/src/axom/quest/tests/quest_all_nearest_neighbors.cpp +++ b/src/axom/quest/tests/quest_all_nearest_neighbors.cpp @@ -242,11 +242,11 @@ TEST(quest_all_nearnbr, cplx_13region_query) } } -void readPointsFile(char* fname, +void readPointsFile(char* filename, std::vector &x, std::vector &y, std::vector &z, std::vector ®ion) { - std::ifstream infile(fname); + std::ifstream infile(filename); std::string theline; double xi, yi, zi; int regioni; @@ -271,9 +271,9 @@ void readPointsFile(char* fname, } } -void writeNeigborsFile(char* fname, int* neighbors, int n) +void writeNeigborsFile(char* filename, int* neighbors, int n) { - std::ofstream outfile(fname); + std::ofstream outfile(filename); if (outfile.good()) { for (int i = 0 ; i < n ; ++i) @@ -298,11 +298,13 @@ TEST(quest_all_nearnbr, file_query) readPointsFile(fname, x, y, z, region); - size_t n = region.size(); + const int n = static_cast< int >( region.size() ); SLIC_INFO("n is " << n); - if (n > 0 && n == x.size() && n == y.size() && n == z.size()) + if ( (n > 0) && (n == static_cast< int >(x.size())) && + (n == static_cast< int >(y.size())) && + (n == static_cast< int >(z.size())) ) { double limit = 2.1; bfneighbor = new int[n]; @@ -310,7 +312,7 @@ TEST(quest_all_nearnbr, file_query) bfsqdst = new double[n]; idxsqdst = new double[n]; - for (size_t i = 0 ; i < n ; ++i) + for ( int i = 0 ; i < n ; ++i) { bfneighbor[i] = -1; idxneighbor[i] = -1; diff --git a/src/axom/quest/tests/quest_inout_interface.cpp b/src/axom/quest/tests/quest_inout_interface.cpp index da3f76c7ea..cdaea9a789 100644 --- a/src/axom/quest/tests/quest_inout_interface.cpp +++ b/src/axom/quest/tests/quest_inout_interface.cpp @@ -47,14 +47,13 @@ class InOutInterfaceTest : public ::testing::Test TEST_F(InOutInterfaceTest, initialize_and_finalize) { - const std::string meshfile = this->meshfile; - EXPECT_TRUE(axom::utilities::filesystem::pathExists(meshfile)); + EXPECT_TRUE(axom::utilities::filesystem::pathExists(this->meshfile)); // InOut begins uninitialized EXPECT_FALSE(axom::quest::inout_initialized()); // Initialize the InOut query - EXPECT_EQ(0, axom::quest::inout_init(meshfile)); + EXPECT_EQ(0, axom::quest::inout_init(this->meshfile)); // InOut should now be initialized EXPECT_TRUE(axom::quest::inout_initialized()); @@ -94,11 +93,10 @@ TEST_F(InOutInterfaceTest, logger_inited) TEST_F(InOutInterfaceTest, initialize_from_mesh) { - const std::string meshfile = this->meshfile; - EXPECT_TRUE(axom::utilities::filesystem::pathExists(meshfile)); + EXPECT_TRUE(axom::utilities::filesystem::pathExists(this->meshfile)); axom::mint::Mesh* mesh = nullptr; - int rc = axom::quest::internal::read_mesh(meshfile, mesh); + int rc = axom::quest::internal::read_mesh(this->meshfile, mesh); EXPECT_EQ(0, rc); // Initialize the InOut query diff --git a/src/axom/quest/tests/quest_test_utilities.hpp b/src/axom/quest/tests/quest_test_utilities.hpp index ac9bb85d12..513706ae6f 100644 --- a/src/axom/quest/tests/quest_test_utilities.hpp +++ b/src/axom/quest/tests/quest_test_utilities.hpp @@ -60,8 +60,8 @@ void getSphereSurfaceMesh( mint::UnstructuredMesh< mint::SINGLE_SHAPE >* mesh, SLIC_ASSERT( mesh->hasMixedCellTypes()==false ); SLIC_ASSERT( mesh->getCellType()==mint::TRIANGLE ); - const double totalNodes = THETA_RES * PHI_RES; - const double totalCells = (2 * THETA_RES) + (THETA_RES * PHI_RES); + const IndexType totalNodes = THETA_RES * PHI_RES; + const IndexType totalCells = (2 * THETA_RES) + (THETA_RES * PHI_RES); mesh->reserve( totalNodes, totalCells ); const double theta_start = 0; diff --git a/src/axom/slam/DynamicSet.hpp b/src/axom/slam/DynamicSet.hpp index 12769ad3a1..acfde2758c 100644 --- a/src/axom/slam/DynamicSet.hpp +++ b/src/axom/slam/DynamicSet.hpp @@ -212,7 +212,7 @@ class DynamicSet */ PositionType size() const { - return m_data.size(); + return static_cast< PositionType >( m_data.size() ); }; @@ -285,7 +285,7 @@ class DynamicSet * \brief Insert an entry at the end of the set with value = ( size()-1 ) */ IndexType insert(){ - return insert(m_data.size()); + return insert( static_cast< IndexType >( m_data.size() ) ); } /** @@ -295,7 +295,7 @@ class DynamicSet IndexType insert(ElementType val) { m_data.push_back(val); - return m_data.size()-1; + return static_cast< IndexType >( m_data.size()-1 ); }; /** diff --git a/src/axom/slam/Map.hpp b/src/axom/slam/Map.hpp index 1c0a482697..c881c09e42 100644 --- a/src/axom/slam/Map.hpp +++ b/src/axom/slam/Map.hpp @@ -231,7 +231,7 @@ class Map : public MapBase, public StridePolicy /** Set each entry in the map to the given value */ void fill(DataType val = DataType()) { - const SetPosition sz = m_data.size(); + const SetPosition sz = static_cast< SetPosition >( m_data.size() ); for(SetPosition idx = SetPosition() ; idx < sz ; ++idx) { diff --git a/src/axom/slam/examples/ShockTube.cpp b/src/axom/slam/examples/ShockTube.cpp index 330618dd3f..98105832d7 100644 --- a/src/axom/slam/examples/ShockTube.cpp +++ b/src/axom/slam/examples/ShockTube.cpp @@ -310,7 +310,8 @@ void CreateShockTubeMesh(ShockTubeMesh* mesh) mesh->relationFaceElem = ShockTubeMesh:: FaceToElemRelation(&mesh->faces, &mesh->elems); - mesh->relationFaceElem.bindIndices(feRelVec.size(), &feRelVec); + mesh->relationFaceElem.bindIndices( static_cast< int >( feRelVec.size() ), + &feRelVec); SLIC_ASSERT(mesh->relationFaceElem.isValid( verboseOutput )); @@ -330,7 +331,8 @@ void CreateShockTubeMesh(ShockTubeMesh* mesh) mesh->relationTubeFace = ShockTubeMesh::TubeElemToFaceRelation(&mesh->tubeElems, &mesh->faces); - mesh->relationTubeFace.bindIndices(efRelVec.size(), &efRelVec); + mesh->relationTubeFace.bindIndices( static_cast< int >( efRelVec.size() ), + &efRelVec); SLIC_ASSERT(mesh->relationTubeFace.isValid( verboseOutput )); } diff --git a/src/axom/slam/examples/UserDocs.cpp b/src/axom/slam/examples/UserDocs.cpp index e60de2917a..7a24bbb634 100644 --- a/src/axom/slam/examples/UserDocs.cpp +++ b/src/axom/slam/examples/UserDocs.cpp @@ -170,7 +170,7 @@ struct SimpleQuadMesh .fromSet( &elems ) .toSet( &verts ) .indices(RelationBuilder::IndicesSetBuilder() - .size( evInds.size() ) + .size( static_cast< int >(evInds.size()) ) .data( evInds.data() ) ); // _quadmesh_example_construct_bdry_relation_end } @@ -186,7 +186,7 @@ struct SimpleQuadMesh .size( verts.size() ) .data( veBegins.data() ) ) .indices( RelationBuilder::IndicesSetBuilder() - .size( veInds.size() ) + .size( static_cast< int >( veInds.size() ) ) .data( veInds.data() ) ); // _quadmesh_example_construct_cobdry_relation_end } diff --git a/src/axom/slam/policies/IndirectionPolicies.hpp b/src/axom/slam/policies/IndirectionPolicies.hpp index c4bf0c4951..95b1aa9bf6 100644 --- a/src/axom/slam/policies/IndirectionPolicies.hpp +++ b/src/axom/slam/policies/IndirectionPolicies.hpp @@ -294,7 +294,7 @@ bool STLVectorIndirection::isValid(PosType size, // Note: it is valid for the data buffer to have extra space PosType firstEltInd = offset; PosType lastEltInd = (size - 1) * stride + offset; - PosType vecSize = m_vecBuf->size(); + PosType vecSize = static_cast< PosType >( m_vecBuf->size() ); bool isRangeValid = (0 <= firstEltInd) && (firstEltInd < vecSize) diff --git a/src/axom/slic/core/LogStream.cpp b/src/axom/slic/core/LogStream.cpp index 98606772f9..28a3b51818 100644 --- a/src/axom/slic/core/LogStream.cpp +++ b/src/axom/slic/core/LogStream.cpp @@ -55,6 +55,10 @@ void LogStream::replaceKey( std::string& msg, //------------------------------------------------------------------------------ std::string LogStream::getTimeStamp( ) { +#ifdef WIN32 +#pragma warning(disable : 4996) // _CRT_SECURE_NO_WARNINGS +#endif + std::time_t t; std::time( &t ); std::string timestamp( std::asctime( std::localtime( &t ) ) ); diff --git a/src/axom/slic/core/Logger.cpp b/src/axom/slic/core/Logger.cpp index 26ce94bd98..9240cd3d14 100644 --- a/src/axom/slic/core/Logger.cpp +++ b/src/axom/slic/core/Logger.cpp @@ -142,7 +142,7 @@ void Logger::addStreamToAllMsgLevels( LogStream* ls ) //------------------------------------------------------------------------------ int Logger::getNumStreamsAtMsgLevel( message::Level level ) { - return m_logStreams[ level ].size( ); + return static_cast< int >( m_logStreams[ level ].size( ) ); } //------------------------------------------------------------------------------ @@ -204,7 +204,7 @@ void Logger::logMessage( message::Level level, } // END if - unsigned nstreams = m_logStreams[ level ].size(); + unsigned nstreams = static_cast< unsigned >( m_logStreams[ level ].size() ); for ( unsigned istream=0 ; istream < nstreams ; ++istream ) { @@ -231,7 +231,7 @@ void Logger::flushStreams() for ( int level=message::Error ; level < message::Num_Levels ; ++level ) { - unsigned nstreams = m_logStreams[ level ].size(); + unsigned nstreams = static_cast< unsigned >( m_logStreams[ level ].size() ); for ( unsigned istream=0 ; istream < nstreams ; ++istream ) { m_logStreams[ level ][ istream ]->flush( ); @@ -248,7 +248,7 @@ void Logger::pushStreams() for ( int level=message::Error ; level < message::Num_Levels ; ++level ) { - unsigned nstreams = m_logStreams[ level ].size(); + unsigned nstreams = static_cast< unsigned >( m_logStreams[ level ].size() ); for ( unsigned istream=0 ; istream < nstreams ; ++istream ) { m_logStreams[ level ][ istream ]->push( ); diff --git a/src/axom/spin/BVHTree.hpp b/src/axom/spin/BVHTree.hpp index 01cc883f78..434fede12e 100644 --- a/src/axom/spin/BVHTree.hpp +++ b/src/axom/spin/BVHTree.hpp @@ -584,7 +584,7 @@ void BVHTree< T,NDIMS >::percolateDown( int parent, int rChild, int lChild ) const BoxType leftBox = m_tree[ lChild ].Box; // STEP 1: pre-allocated space for object at the children - const int numObjects = m_tree[ parent ].ObjectArray.size(); + const int numObjects = static_cast(m_tree[parent].ObjectArray.size()); const int estChildSize = static_cast(0.5 * numObjects); m_tree[ rChild ].ObjectArray.reserve( estChildSize ); m_tree[ lChild ].ObjectArray.reserve( estChildSize ); @@ -684,7 +684,7 @@ template < typename T, int NDIMS > bool BVHTree< T,NDIMS >::shouldRefine( int idx, int threshold ) { SLIC_ASSERT( idx >= 0 && idx < static_cast< int >( m_tree.size() ) ); - const int numObjects = m_tree[ idx ].ObjectArray.size(); + const int numObjects = static_cast< int >( m_tree[ idx ].ObjectArray.size() ); const int level = m_tree[ idx ].Level; if ( (numObjects > threshold) && (level < m_maxNumLevels-1) ) @@ -811,7 +811,7 @@ inline double BVHTree< T,NDIMS >::getMaxSqDistanceToBucket( BoxType::getPoints( m_tree[ bucketIdx ].Box, pnts ); SLIC_ASSERT( pnts.size()==4 || pnts.size()==8 ); - const int npoints = pnts.size(); + const int npoints = static_cast< int >( pnts.size() ); for ( int i=0 ; i < npoints ; ++i ) { dist = std::max( dist, squared_distance( pt, pnts[ i ] ) ); @@ -864,7 +864,7 @@ void BVHTree< T,NDIMS >::find( const PointType& pt, // the estLowerBound and estUpperBound for ( int level=1 ; level < m_numLevels ; ++level ) { - const int nbuckets = buckets_to_check.size(); + const int nbuckets = static_cast< int >( buckets_to_check.size() ); if ( nbuckets==0 ) { /* short-circuit */ @@ -956,7 +956,7 @@ void BVHTree< T,NDIMS >::find( const PointType& pt, // STEP 4: further filter first_set_candidate buckets into the final set // of candidate buckets to pass back to the caller. - const int numCandidates = first_set_candidates.size(); + const int numCandidates = static_cast< int >( first_set_candidates.size() ); candidate_buckets.clear(); candidate_buckets.reserve( numCandidates ); candidate_buckets.push_back( globalClosestBucketIdx ); @@ -997,7 +997,7 @@ int BVHTree< T,NDIMS >::getBucketNumObjects( int bucketIdx ) const { SLIC_ASSERT( bucketIdx >= 0 && bucketIdx < static_cast< int >(m_tree.size()) ); - return ( m_tree[ bucketIdx ].ObjectArray.size() ); + return ( static_cast< int >( m_tree[ bucketIdx ].ObjectArray.size() ) ); } //------------------------------------------------------------------------------ diff --git a/src/axom/spin/Brood.hpp b/src/axom/spin/Brood.hpp index fa0187fd57..e5f9f6f028 100644 --- a/src/axom/spin/Brood.hpp +++ b/src/axom/spin/Brood.hpp @@ -64,7 +64,10 @@ struct Brood */ static GridPt reconstructGridPt(MortonIndexType morton, int offset) { - return MortonizerType::demortonize( (morton << DIM) + offset); + return + static_cast< GridPt >( + MortonizerType::demortonize( + static_cast< MortonIndexType >( (morton< IteratorHelper(OctreeLevelType* octLevel, bool begin) : m_octreeLevel(octLevel), - m_endIdx( octLevel->m_broodCapacity), + m_endIdx( static_cast< MortonIndexType >(octLevel->m_broodCapacity) ), m_offset(0), m_isLevelZero( octLevel->level() == 0) { diff --git a/src/axom/spin/SparseOctreeLevel.hpp b/src/axom/spin/SparseOctreeLevel.hpp index 613bbd8599..851f0ac5aa 100644 --- a/src/axom/spin/SparseOctreeLevel.hpp +++ b/src/axom/spin/SparseOctreeLevel.hpp @@ -376,7 +376,9 @@ class SparseOctreeLevel : public OctreeLevel { if(empty()) return 0; - return (this->m_level == 0) ? 1 : (m_map.size() * Base::BROOD_SIZE); + + return ( (this->m_level == 0) ? + 1 : ( static_cast< int >( m_map.size() ) * Base::BROOD_SIZE ) ); } /** \brief Returns the number of internal blocks in the level */ diff --git a/src/axom/spin/UniformGrid.hpp b/src/axom/spin/UniformGrid.hpp index c6d9f5a056..f863dda95c 100644 --- a/src/axom/spin/UniformGrid.hpp +++ b/src/axom/spin/UniformGrid.hpp @@ -355,7 +355,7 @@ bool UniformGrid< T, NDIMS >::isValidIndex(int index) const template < typename T, int NDIMS > int UniformGrid< T, NDIMS >::getNumBins() const { - return m_bins.size(); + return static_cast< int >( m_bins.size() ); } template < typename T, int NDIMS > @@ -452,7 +452,7 @@ void UniformGrid< T, NDIMS >::insert(const BoxType& BB, const std::vector< int > bidxs = getBinsForBbox(BB); - const int numBins = bidxs.size(); + const int numBins = static_cast< int >( bidxs.size() ); for (int i = 0 ; i < numBins ; ++i) { addObj(obj, bidxs[i]); diff --git a/src/axom/spin/examples/spin_introduction.cpp b/src/axom/spin/examples/spin_introduction.cpp index cc63927716..09864ca6f6 100644 --- a/src/axom/spin/examples/spin_introduction.cpp +++ b/src/axom/spin/examples/spin_introduction.cpp @@ -44,8 +44,8 @@ #include "fmt/fmt.hpp" // almost all our examples are in 3D -const int in3D = 3; -const int in2D = 2; +constexpr int in3D = 3; +constexpr int in2D = 2; // primitives represented by doubles in 3D using BoundingBoxType = axom::primal::BoundingBox; @@ -231,7 +231,7 @@ void findTriIntersectionsNaively( std::vector< std::pair > & clashes ) { - int tcount = tris.size(); + int tcount = static_cast< int >( tris.size() ); for (int i = 0 ; i < tcount ; ++i) { @@ -295,7 +295,7 @@ UniformGridType* buildUniformGrid(std::vector & tris) const PointType & minBBPt = allbbox.getMin(); const PointType & maxBBPt = allbbox.getMax(); - int tcount = tris.size(); + int tcount = static_cast< int >( tris.size() ); // The number of bins along one side of the UniformGrid. // This is a heuristic. @@ -358,7 +358,7 @@ void findTriIntersectionsAccel( UniformGridType* ugrid, std::vector< std::pair > & clashes) { - int tcount = tris.size(); + int tcount = static_cast< int >( tris.size() ); // For each triangle t1, for (int i = 0 ; i < tcount ; ++i) @@ -368,7 +368,7 @@ void findTriIntersectionsAccel( findNeighborCandidates(t1, i, ugrid, neighbors); // Test for intersection between t1 and each of its neighbors. - int ncount = neighbors.size(); + int ncount = static_cast< int >( neighbors.size() ); for (int n = 0 ; n < ncount ; ++n) { int j = neighbors[n]; @@ -400,7 +400,7 @@ void showImplicitGrid() // establish the domain of the ImplicitGrid. IBBox bbox(ISpacePt::zero(), ISpacePt::ones()); // room for one hundred elements in the index - const int numElts = tris.size(); + const int numElts = static_cast< int >( tris.size() ); IGridT grid(bbox, &res, numElts); // load the bounding box of each triangle, along with its index, @@ -481,7 +481,7 @@ void makeTriangles(std::vector & tris) void printPairs(std::string title, std::vector< std::pair > & clashes) { - int ccount = clashes.size(); + int ccount = static_cast< int >( clashes.size() ); std::cout << ccount << title << std::endl; for (int i = 0 ; i < ccount ; ++i) { @@ -516,7 +516,7 @@ BVHTree2DType* buildBVHTree(std::vector & tris) // Initialize BVHTree with the triangles const int MaxBinFill = 1; const int MaxLevels = 4; - int tricount = tris.size(); + int tricount = static_cast< int >( tris.size() ); BVHTree2DType* tree = new BVHTree2DType( tricount, MaxLevels ); for ( int i=0 ; i < tricount ; ++i ) @@ -578,7 +578,7 @@ void findIntersectionsWithCandidates(std::vector & tris, std::vector & intersections) { // Test if ppoint lands in any of its neighbor triangles. - int csize = candidates.size(); + int csize = static_cast< int >( candidates.size() ); for (int i = 0 ; i < csize ; ++i) { Triangle2DType & t = tris[candidates[i]]; diff --git a/src/axom/spin/tests/spin_octree.cpp b/src/axom/spin/tests/spin_octree.cpp index 3a16b41fbd..6daf3316ec 100644 --- a/src/axom/spin/tests/spin_octree.cpp +++ b/src/axom/spin/tests/spin_octree.cpp @@ -161,11 +161,11 @@ TEST( spin_octree, octree_coveringLeafBlocks) // Each child or the root has two valid face neighbors int validNeighborCount = 0; - for(int i=0 ; i< blk.numFaceNeighbors() ; ++i) + for(int j=0 ; j< blk.numFaceNeighbors() ; ++j) { - BlockIndex neighborBlk = blk.faceNeighbor(i); + BlockIndex neighborBlk = blk.faceNeighbor(j); - SLIC_INFO(" Face neighbor " << i << " is " << neighborBlk ); + SLIC_INFO(" Face neighbor " << j << " is " << neighborBlk ); if( octree.coveringLeafBlock(neighborBlk) != BlockIndex::invalid_index() ) validNeighborCount++; @@ -194,14 +194,14 @@ TEST( spin_octree, octree_coveringLeafBlocks) // .. at a coarser level EXPECT_GE( blk.level(), coveringBlock.level()); - for(int i=0 ; i< blk.numFaceNeighbors() ; ++i) + for(int k=0 ; k< blk.numFaceNeighbors() ; ++k) { - BlockIndex neighborBlk = blk.faceNeighbor(i); + BlockIndex neighborBlk = blk.faceNeighbor(k); BlockIndex coveringBlk = octree.coveringLeafBlock(neighborBlk); SLIC_INFO( "\tFace neighbor " - << i << " is " << neighborBlk + << k << " is " << neighborBlk << " -- Covering block is " << coveringBlk << (coveringBlk == BlockIndex::invalid_index() ? " -- invalid_index" : "") ); diff --git a/src/tools/mesh_tester.cpp b/src/tools/mesh_tester.cpp index c8fd5db9c4..761e7428f2 100644 --- a/src/tools/mesh_tester.cpp +++ b/src/tools/mesh_tester.cpp @@ -32,10 +32,10 @@ #include "axom/slic/streams/GenericOutputStream.hpp" #include "axom/slic/interface/slic.hpp" -// RAJA +// RAJA #ifdef AXOM_USE_RAJA #include "RAJA/RAJA.hpp" -#endif +#endif // RAJA policies #include "axom/mint/execution/internal/structured_exec.hpp" @@ -78,8 +78,8 @@ using UniformGrid3 = spin::UniformGrid; using Vector3 = primal::Vector; using Segment3 = primal::Segment; -enum RuntimePolicy { seq = 0, - raja_seq = 1, +enum RuntimePolicy { seq = 0, + raja_seq = 1, raja_omp = 2, raja_cuda = 3}; @@ -120,7 +120,7 @@ const std::set Input::s_validPolicies({ , raja_seq #ifdef AXOM_USE_OPENMP , raja_omp - #endif + #endif #ifdef AXOM_USE_CUDA , raja_cuda #endif @@ -143,7 +143,7 @@ void Input::parse(int argc, char** argv, CLI::App& app) "Set to 1 to use the RAJA sequential policy. \n" #ifdef AXOM_USE_OPENMP "Set to 2 to use the RAJA OpenMP policy. \n" - #endif + #endif #ifdef AXOM_USE_CUDA "Set to 3 to use the RAJA CUDA policy." #endif @@ -208,11 +208,11 @@ void Input::fixOutfilePath() std::string outFileBase = futil::joinPath(futil::getCWD(),inFileStem); // set output file name when not provided - int sz = vtkOutput.size(); + int sz = static_cast< int >( vtkOutput.size() ); if (sz < 1) { vtkOutput = outFileBase; - sz = vtkOutput.size(); + sz = static_cast< int >( vtkOutput.size() ); } // ensure that output file does not end with '.vtk' @@ -335,7 +335,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( std::vector & degenerate) { SLIC_INFO("Running naive intersection algorithm " - << " in execution Space: " + << " in execution Space: " << axom::execution_space< ExecSpace >::name()); // Get allocator @@ -362,14 +362,14 @@ std::vector< std::pair > naiveIntersectionAlgorithm( RAJA::RangeSegment row_range(0, ncells); RAJA::RangeSegment col_range(0, ncells); - using KERNEL_POL = + using KERNEL_POL = typename axom::mint::internal::structured_exec< ExecSpace >::loop2d_policy; using REDUCE_POL = typename axom::execution_space< ExecSpace >::reduce_policy; - using ATOMIC_POL = + using ATOMIC_POL = typename axom::execution_space< ExecSpace >::atomic_policy; - - RAJA::ReduceSum< REDUCE_POL, int > numIntersect(0); + + RAJA::ReduceSum< REDUCE_POL, int > numIntersect(0); // Compute the number of intersections RAJA::kernel( RAJA::make_tuple(col_range, row_range), @@ -387,7 +387,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( int * intersections = axom::allocate (numIntersect.get() * 2); int * counter = axom::allocate (1); - + counter[0] = 0; // RAJA loop to populate with intersections @@ -410,7 +410,7 @@ std::vector< std::pair > naiveIntersectionAlgorithm( retval.push_back(std::make_pair(intersections[i], intersections[i + 1])); } - // Deallocate + // Deallocate axom::deallocate(tris); axom::deallocate(intersections); axom::deallocate(counter); @@ -519,7 +519,7 @@ void initializeLogger() * Currently the mesh tester checks for intersecting triangles. This is * implemented in three ways. First, a naive algorithm tests each triangle * against each other triangle. This is easy to understand and verify, - * but slow. Second, the same naive algorithm is run using raja. A third + * but slow. Second, the same naive algorithm is run using raja. A third * algorithm uses a UniformGrid to index the bounding box of the mesh, * and checks each triangle for intersection with the triangles in all the * bins the triangle's bounding box falls into. @@ -598,18 +598,18 @@ int main( int argc, char** argv ) collisions = naiveIntersectionAlgorithm(surface_mesh, degenerate); #ifdef AXOM_USE_RAJA case raja_seq: - collisions = naiveIntersectionAlgorithm< seq_exec >(surface_mesh, + collisions = naiveIntersectionAlgorithm< seq_exec >(surface_mesh, degenerate); break; #ifdef AXOM_USE_OPENMP case raja_omp: - collisions = naiveIntersectionAlgorithm< omp_exec >(surface_mesh, + collisions = naiveIntersectionAlgorithm< omp_exec >(surface_mesh, degenerate); break; #endif #ifdef AXOM_USE_CUDA case raja_cuda: - collisions = naiveIntersectionAlgorithm< cuda_exec >(surface_mesh, + collisions = naiveIntersectionAlgorithm< cuda_exec >(surface_mesh, degenerate); break; #endif @@ -634,7 +634,9 @@ int main( int argc, char** argv ) << timer.elapsedTimeInSec() << " seconds."); announceMeshProblems(surface_mesh->getNumberOfCells(), - collisions.size(), degenerate.size()); + static_cast< int >( collisions.size() ), + static_cast< int >( degenerate.size() ) + ); saveProblemFlagsToMesh(surface_mesh, collisions, degenerate); From 82599c725b506e01a33462acc39000a387784f07 Mon Sep 17 00:00:00 2001 From: Chris White Date: Sat, 21 Mar 2020 19:45:55 -0700 Subject: [PATCH 066/632] Fix uberenv, Lower Spack's architecture optimization from AVX2 to AVX --- .../rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake | 4 ++-- .../rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake | 4 ++-- .../rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake | 4 ++-- .../rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake | 4 ++-- .../rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake | 4 ++-- .../rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake | 4 ++-- .../rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake | 4 ++-- scripts/llnl_scripts/llnl_lc_build_tools.py | 8 +++++++- .../toss_3_x86_64_ib/devtools/packages.yaml | 3 +++ .../toss_3_x86_64_ib/packages.yaml | 17 ++++++++++------- scripts/uberenv/uberenv.py | 2 +- 11 files changed, 35 insertions(+), 23 deletions(-) diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake index bdff2172bd..fcd4727a35 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/clang-4.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/clang-4.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake index 143ae65534..c8e50d0221 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/clang-6.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/clang-6.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake index 42ddcc10e3..16147f7507 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/gcc-6.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/gcc-6.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake index 12de2f3416..a6c87d5c09 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/gcc-7.3.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/gcc-7.3.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake index bfe8508745..d5c355bfb8 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/gcc-8.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/gcc-8.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake index 40c0f94b1a..6ab2a2f1bf 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/intel-18.0.2" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/intel-18.0.2" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake index 36307d5b4c..79e62b55ce 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_02_18_10_11_15/intel-19.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/intel-19.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_02_13_10_02_04/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 141f563574..c2408033cb 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -105,6 +105,7 @@ def log_success(prefix, msg, timestamp=""): info["timestamp"] = timestamp json.dump(info,open(pjoin(prefix,"success.json"),"w"),indent=2) + def log_failure(prefix, msg, timestamp=""): """ Called when the process failed. @@ -256,7 +257,12 @@ def uberenv_create_mirror(prefix, project_file, mirror_path): cmd = "python scripts/uberenv/uberenv.py --create-mirror" cmd += " --prefix=\"{0}\" --mirror=\"{1}\"".format(prefix, mirror_path) cmd += " --project-json=\"{0}\" ".format(project_file) - return sexe(cmd,echo=True,error_prefix="WARNING:") + res = sexe(cmd, echo=True, error_prefix="WARNING:") + print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" + print "[The above behavior of 'spack --create-mirror' is normal to throw many warnings]" + print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" + set_axom_group_and_perms(mirror_path) + return res def uberenv_build(prefix, spec, project_file, config_dir, mirror_path): diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml index 00b0fe6cea..4b59d44309 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml @@ -16,6 +16,9 @@ # ------------------------------------------------------------------------- packages: all: + # This defaults us to machine specific flags of ivybridge which is allows + # us to run on broadwell as well + target: [ivybridge] compiler: [gcc, intel, pgi, clang, xl, nag] providers: blas: [netlib-lapack] diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index e94134e684..4b27ea4bee 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -16,6 +16,9 @@ # ------------------------------------------------------------------------- packages: all: + # This defaults us to machine specific flags of ivybridge which is allows + # us to run on broadwell as well + target: [ivybridge] compiler: [gcc, intel, pgi, clang, xl, nag] providers: blas: [netlib-lapack] @@ -31,13 +34,13 @@ packages: # Lock down which MPI we are using mvapich2: paths: - mvapich2@2.3%gcc@6.1.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0 - mvapich2@2.3%gcc@7.3.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0 - mvapich2@2.3%gcc@8.1.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0 - mvapich2@2.3%intel@18.0.2 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2 - mvapich2@2.3%intel@19.0.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0 - mvapich2@2.3%clang@4.0.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-4.0.0 - mvapich2@2.3%clang@6.0.0 arch=linux-rhel7-broadwell: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-6.0.0 + mvapich2@2.3%gcc@6.1.0 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0 + mvapich2@2.3%gcc@7.3.0 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0 + mvapich2@2.3%gcc@8.1.0 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0 + mvapich2@2.3%intel@18.0.2 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2 + mvapich2@2.3%intel@19.0.0 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0 + mvapich2@2.3%clang@4.0.0 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-4.0.0 + mvapich2@2.3%clang@6.0.0 arch=linux-rhel7-ivybridge: /usr/tce/packages/mvapich2/mvapich2-2.3-clang-6.0.0 buildable: False # Spack may grab for mpi & we don't want to use them openmpi: diff --git a/scripts/uberenv/uberenv.py b/scripts/uberenv/uberenv.py index 9faad2188e..9479887da1 100755 --- a/scripts/uberenv/uberenv.py +++ b/scripts/uberenv/uberenv.py @@ -500,7 +500,7 @@ def clone_repo(self): os.chdir(pjoin(self.dest_dir,"spack")) sexe("git checkout {0}".format(sha1),echo=True) - if self.opts["spack_pull"]: + if self.opts["repo_pull"]: # do a pull to make sure we have the latest os.chdir(pjoin(self.dest_dir,"spack")) sexe("git stash", echo=True) From 1a147111b7915790a6539541258bc9a10158d7bf Mon Sep 17 00:00:00 2001 From: Chris White Date: Sun, 22 Mar 2020 19:49:02 -0700 Subject: [PATCH 067/632] Fix wording --- scripts/llnl_scripts/llnl_lc_build_tools.py | 2 +- .../spack_configs/toss_3_x86_64_ib/devtools/packages.yaml | 2 +- scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index c2408033cb..9b2e413dba 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -259,7 +259,7 @@ def uberenv_create_mirror(prefix, project_file, mirror_path): cmd += " --project-json=\"{0}\" ".format(project_file) res = sexe(cmd, echo=True, error_prefix="WARNING:") print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" - print "[The above behavior of 'spack --create-mirror' is normal to throw many warnings]" + print "[ It is expected for 'spack --create-mirror' to throw warnings. ]" print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" set_axom_group_and_perms(mirror_path) return res diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml index 4b59d44309..3a6b45c09e 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml @@ -16,7 +16,7 @@ # ------------------------------------------------------------------------- packages: all: - # This defaults us to machine specific flags of ivybridge which is allows + # This defaults us to machine specific flags of ivybridge which allows # us to run on broadwell as well target: [ivybridge] compiler: [gcc, intel, pgi, clang, xl, nag] diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index 4b27ea4bee..3134834fa3 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -16,7 +16,7 @@ # ------------------------------------------------------------------------- packages: all: - # This defaults us to machine specific flags of ivybridge which is allows + # This defaults us to machine specific flags of ivybridge which allows # us to run on broadwell as well target: [ivybridge] compiler: [gcc, intel, pgi, clang, xl, nag] From c0a3d578db16c17bfbc7554c7f1d746c87d55a9f Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 24 Mar 2020 12:04:24 -0700 Subject: [PATCH 068/632] Use real compiler for MFEM instead of Spack's wrapped compiler --- scripts/uberenv/packages/mfem/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/uberenv/packages/mfem/package.py b/scripts/uberenv/packages/mfem/package.py index c32afdabb6..963558d039 100644 --- a/scripts/uberenv/packages/mfem/package.py +++ b/scripts/uberenv/packages/mfem/package.py @@ -263,7 +263,7 @@ def find_optional_library(name, prefix): 'MFEM_DEBUG=%s' % yes_no('+debug'), # NOTE: env['CXX'] is the spack c++ compiler wrapper. The real # compiler is defined by env['SPACK_CXX']. - 'CXX=%s' % env['CXX'], + 'CXX=%s' % env['SPACK_CXX'], 'MFEM_USE_LIBUNWIND=%s' % yes_no('+libunwind'), 'MFEM_USE_GZSTREAM=%s' % yes_no('+gzstream'), 'MFEM_USE_METIS=%s' % yes_no('+metis'), From 8108c2c7d023f14b4289c8aa8be10cf2d1ae08c6 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Wed, 25 Mar 2020 16:26:54 -0700 Subject: [PATCH 069/632] Improves note about expected warnings from 'spack mirror' The note is now before calling 'spack mirror' with a second note to indicate when to stop expecting warnings. --- scripts/llnl_scripts/llnl_lc_build_tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 9b2e413dba..823d799f28 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -257,10 +257,13 @@ def uberenv_create_mirror(prefix, project_file, mirror_path): cmd = "python scripts/uberenv/uberenv.py --create-mirror" cmd += " --prefix=\"{0}\" --mirror=\"{1}\"".format(prefix, mirror_path) cmd += " --project-json=\"{0}\" ".format(project_file) - res = sexe(cmd, echo=True, error_prefix="WARNING:") print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" print "[ It is expected for 'spack --create-mirror' to throw warnings. ]" print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" + res = sexe(cmd, echo=True, error_prefix="WARNING:") + print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" + print "[ End of expected warnings from 'spack --create-mirror' ]" + print "[~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]" set_axom_group_and_perms(mirror_path) return res From 39174d1a58f323e6dac4ec38a8d0773da2feb63a Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Wed, 25 Mar 2020 15:27:30 -0700 Subject: [PATCH 070/632] Adds a blueos9 spec for the XL compiler with nvcc --- .../blueos_3_ppc64le_ib_p9/compilers.yaml | 14 +++++++++++++- .../blueos_3_ppc64le_ib_p9/packages.yaml | 1 + scripts/uberenv/specs.json | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml index 80d75373aa..213669c8f7 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml @@ -51,6 +51,18 @@ compilers: fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 spec: xl@coral target: ppc64le - +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: rhel7 + paths: + cc: /usr/tce/packages/xl/xl-2019.08.20/bin/xlc + cxx: /usr/tce/packages/xl/xl-2019.08.20/bin/xlC + f77: /usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003 + spec: xl@coral_nvcc + target: ppc64le diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml index e27e4f1085..7906801ede 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml @@ -37,6 +37,7 @@ packages: mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ mvapich2@2.2%clang@8.0.1_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/ mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ + mvapich2@2.2%xl@coral_nvcc : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/ buildable: False # Spack may grab for mpi & we don't want to use them openmpi: diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index e0850f46f7..dbb38be8a5 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -32,7 +32,8 @@ [ "clang@upstream_xlf~openmp+devtools+mfem", "clang@8.0.1_nvcc_xlf~openmp+cuda+devtools+mfem", "gcc@7.3.1+devtools+mfem", - "xl@coral~openmp+devtools+mfem" ], + "xl@coral~openmp+devtools+mfem", + "xl@coral_nvcc~openmp+cuda+devtools+mfem" ], "darwin-x86_64": [ "clang@9.0.0+devtools+mfem" ] From 0eac531205f597df522d08f8e3348d46f607ce21 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Wed, 25 Mar 2020 19:48:44 -0700 Subject: [PATCH 071/632] Fixes spec for XL+nvcc host-config Now using 'xl@nvcc' as the spec for the new configuration. Spack used the 'xl@coral_nvcc' compilers for the 'xl@coral' configuration. Perhaps it doesn't use anything after the underscore and the former overwrote the latter? --- .../uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml | 2 +- .../uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml | 2 +- scripts/uberenv/specs.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml index 213669c8f7..6ca37885c8 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/compilers.yaml @@ -62,7 +62,7 @@ compilers: cxx: /usr/tce/packages/xl/xl-2019.08.20/bin/xlC f77: /usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003 fc: /usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003 - spec: xl@coral_nvcc + spec: xl@nvcc target: ppc64le diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml index 7906801ede..cb345a64de 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml @@ -37,7 +37,7 @@ packages: mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ mvapich2@2.2%clang@8.0.1_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/ mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ - mvapich2@2.2%xl@coral_nvcc : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/ + mvapich2@2.2%xl@nvcc : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/ buildable: False # Spack may grab for mpi & we don't want to use them openmpi: diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index dbb38be8a5..8f1bd2b2d3 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -33,7 +33,7 @@ "clang@8.0.1_nvcc_xlf~openmp+cuda+devtools+mfem", "gcc@7.3.1+devtools+mfem", "xl@coral~openmp+devtools+mfem", - "xl@coral_nvcc~openmp+cuda+devtools+mfem" ], + "xl@nvcc~openmp+cuda+devtools+mfem" ], "darwin-x86_64": [ "clang@9.0.0+devtools+mfem" ] From 1d0b2ad82e964f09621fc8892c0816a6809c6c1d Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Wed, 25 Mar 2020 16:36:05 -0700 Subject: [PATCH 072/632] Adds XL+nvcc host-config for LLNL's 'blueos_p9' platform Also updates the other blueos_p9 host-configs. Due to changes in the spack mfem compiler from env['CXX'] to env['SPACK_CXX'] (in a previous commit), this should reduce warnings for nvcc builds that use mfem. --- ...3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 2 +- ...s_3_ppc64le_ib_p9-clang@upstream_xlf.cmake | 2 +- ...sel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake | 2 +- ...nsel-blueos_3_ppc64le_ib_p9-xl@coral.cmake | 2 +- ...ansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake | 122 ++++++++++++++++++ 5 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 83027b32b4..90afaf22cf 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake index 4daa30836d..ed420c675b 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake index 1738a8e6ff..6b6d930631 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake index 4ae5051ab6..0023a7a745 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_02_18_10_07_58/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake new file mode 100644 index 0000000000..954ff14fe9 --- /dev/null +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake @@ -0,0 +1,122 @@ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# SYS_TYPE: blueos_3_ppc64le_ib_p9 +# Compiler Spec: xl@nvcc +#------------------------------------------------------------------------------ +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Compilers +#------------------------------------------------------------------------------ + +set(CMAKE_C_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlc" CACHE PATH "") + +set(CMAKE_CXX_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlC" CACHE PATH "") + +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003" CACHE PATH "") + +#------------------------------------------------------------------------------ +# TPLs +#------------------------------------------------------------------------------ + +# Root directory for generated TPLs +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/xl-nvcc" CACHE PATH "") + +set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") + +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") + +# SCR not built + +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") + +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpicxx" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpif90" CACHE PATH "") + +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpirun" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") + +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Devtools +#------------------------------------------------------------------------------ + +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") + +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") + +set(ENABLE_DOCS ON CACHE BOOL "") + +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") + +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") + +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ + +set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") + +set(CMAKE_C_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") + +set(CMAKE_CXX_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") + +set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") + +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.08.20/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") + +#------------------------------------------------------------------------------ +# Cuda +#------------------------------------------------------------------------------ + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") + +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") + +set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") + +set(AXOM_CUDA_ARCH "sm_70" CACHE PATH "") + +set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") + +set(CMAKE_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE PATH "") + +# nvcc does not like gtest's 'pthreads' flag +set(gtest_disable_pthreads ON CACHE BOOL "") + + From ebaf888cd8da62a442726b5e1dc0bcd65c84517e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 27 Feb 2020 16:36:58 -0800 Subject: [PATCH 073/632] ENH: rename BVH::find() to BVH::findPoints() --- src/axom/spin/BVH.hpp | 10 +++++----- src/axom/spin/internal/linear_bvh/BVH_impl.hpp | 14 +++++++------- src/axom/spin/tests/spin_bvh.cpp | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index cd02b870ba..86e379a343 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -230,11 +230,11 @@ class BVH * \pre y != nullptr if dimension==2 || dimension==3 * \pre z != nullptr if dimension==3 */ - void find( IndexType* offsets, IndexType* counts, - IndexType*& candidates, IndexType numPts, - const FloatType* x, - const FloatType* y, - const FloatType* z=nullptr ) const; + void findPoints( IndexType* offsets, IndexType* counts, + IndexType*& candidates, IndexType numPts, + const FloatType* x, + const FloatType* y, + const FloatType* z=nullptr ) const; /*! * \brief Writes the BVH to the specified VTK file for visualization. diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 772f250c7d..dc82f05171 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -257,13 +257,13 @@ void BVH< NDIMS, ExecSpace, FloatType >::getBounds( FloatType* min, //------------------------------------------------------------------------------ template< int NDIMS, typename ExecSpace, typename FloatType > -void BVH< NDIMS, ExecSpace, FloatType >::find( IndexType* offsets, - IndexType* counts, - IndexType*& candidates, - IndexType numPts, - const FloatType* x, - const FloatType* y, - const FloatType* z ) const +void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, + IndexType* counts, + IndexType*& candidates, + IndexType numPts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) const { SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 964194fb88..e0ca012b4e 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -353,7 +353,7 @@ void check_find3d( ) IndexType* offsets = axom::allocate< IndexType >( ncells ); IndexType* counts = axom::allocate< IndexType >( ncells ); IndexType* candidates = nullptr; - bvh.find( offsets, counts, candidates, ncells, xc, yc, zc ); + bvh.findPoints( offsets, counts, candidates, ncells, xc, yc, zc ); EXPECT_TRUE( candidates != nullptr ); @@ -378,7 +378,7 @@ void check_find3d( ) zc[ i ] += OFFSET; } - bvh.find( offsets, counts, candidates, ncells, xc, yc, zc ); + bvh.findPoints( offsets, counts, candidates, ncells, xc, yc, zc ); for ( IndexType i=0 ; i < ncells ; ++i ) { @@ -450,7 +450,7 @@ void check_find2d( ) IndexType* offsets = axom::allocate< IndexType >( ncells ); IndexType* counts = axom::allocate< IndexType >( ncells ); IndexType* candidates = nullptr; - bvh.find( offsets, counts, candidates, ncells, xc, yc ); + bvh.findPoints( offsets, counts, candidates, ncells, xc, yc ); EXPECT_TRUE( candidates != nullptr ); @@ -474,7 +474,7 @@ void check_find2d( ) yc[ i ] += OFFSET; } - bvh.find( offsets, counts, candidates, ncells, xc, yc ); + bvh.findPoints( offsets, counts, candidates, ncells, xc, yc ); for ( IndexType i=0 ; i < ncells ; ++i ) { @@ -538,7 +538,7 @@ void check_single_box2d( ) IndexType* offsets = axom::allocate< IndexType >( NUM_BOXES ); IndexType* counts = axom::allocate< IndexType >( NUM_BOXES ); IndexType* candidates = nullptr; - bvh.find( offsets, counts, candidates, NUM_BOXES, xc, yc ); + bvh.findPoints( offsets, counts, candidates, NUM_BOXES, xc, yc ); EXPECT_TRUE( candidates != nullptr ); EXPECT_EQ( counts[ 0 ], 1 ); EXPECT_EQ( 0, candidates[ offsets[ 0 ] ] ); @@ -546,7 +546,7 @@ void check_single_box2d( ) // shift centroid outside of the BVH, should return no candidates. xc[ 0 ] += 10.0; yc[ 0 ] += 10.0; - bvh.find( offsets, counts, candidates, NUM_BOXES, xc, yc ); + bvh.findPoints( offsets, counts, candidates, NUM_BOXES, xc, yc ); EXPECT_EQ( counts[ 0 ], 0 ); axom::deallocate( xc ); @@ -607,7 +607,7 @@ void check_single_box3d( ) IndexType* offsets = axom::allocate< IndexType >( NUM_BOXES ); IndexType* counts = axom::allocate< IndexType >( NUM_BOXES ); IndexType* candidates = nullptr; - bvh.find( offsets, counts, candidates, NUM_BOXES, xc, yc, zc ); + bvh.findPoints( offsets, counts, candidates, NUM_BOXES, xc, yc, zc ); EXPECT_TRUE( candidates != nullptr ); EXPECT_EQ( counts[ 0 ], 1 ); EXPECT_EQ( 0, candidates[ offsets[ 0 ] ] ); @@ -615,7 +615,7 @@ void check_single_box3d( ) // shift centroid outside of the BVH, should return no candidates. xc[ 0 ] += 10.0; yc[ 0 ] += 10.0; - bvh.find( offsets, counts, candidates, NUM_BOXES, xc, yc, zc ); + bvh.findPoints( offsets, counts, candidates, NUM_BOXES, xc, yc, zc ); EXPECT_EQ( counts[ 0 ], 0 ); axom::deallocate( xc ); From a27be49c7a36982db5d3af2744b7b20bc495a7e9 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 28 Feb 2020 09:59:29 -0800 Subject: [PATCH 074/632] STYLE: organize primal instersection operators Organize primal's intersection operators by the primitive that is intersected on the left-hand-side. --- src/axom/primal/operators/intersect.hpp | 186 ++++++++++++++---------- 1 file changed, 110 insertions(+), 76 deletions(-) diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index e5de9e2b0d..b9f5463d58 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -32,6 +32,9 @@ namespace axom namespace primal { +/// \name Triangle Intersection Routines +/// @{ + /*! * \brief Tests if 3D Triangles t1 and t2 intersect. * \return status true iff t1 intersects with t2, otherwise, false. @@ -65,82 +68,6 @@ bool intersect( const Triangle< T, 2 >& t1, return detail::intersect_tri2D_tri2D< T >(t1, t2, includeBoundary); } -/*! - * \brief Computes the intersection of the given ray, R, with the segment, S. - * ip returns the intersection point on S. - * \return status true iff R intersects with S, otherwise, false. - */ -template < typename T > -bool intersect( const Ray< T,2 >& R, const Segment< T,2 >& S, Point< T,2 >& ip ) -{ - return detail::intersect_ray_seg(R, S, ip); -} - -/*! - * \brief Computes the intersection of the given ray, R, with the Box, bb. - * ip the point of intersection on R. - * \return status true iff bb intersects with R, otherwise, false. - * - * Computes Ray Box intersection using the slab method from pg 180 of - * Real Time Collision Detection by Christer Ericson. - */ -template < typename T, int DIM > -bool intersect( const Ray< T,DIM > & R, - const BoundingBox< T,DIM > & bb, - Point< T,DIM > & ip) -{ - return detail::intersect_ray_bbox(R, bb, ip); -} - -/*! - * \brief Computes the intersection of the given segment, S, with the Box, bb. - * ip the point of intersection on S. - * \return status true iff bb intersects with S, otherwise, false. - * - * Computes Segment Box intersection using the slab method from pg 180 of - * Real Time Collision Detection by Christer Ericson. - * WIP: More test cases for this - */ -template < typename T, int DIM > -bool intersect( const Segment< T,DIM > & S, - const BoundingBox< T,DIM > & bb, - Point< T,DIM > & ip) -{ - return detail::intersect_seg_bbox(S, bb, ip); -} - -/*! - * \brief Determines if two axis aligned bounding boxes intersect - * \param [in] bb1 user-supplied axis aligned bounding box. - * \param [in] bb2 user-supplied axis aligned bounding box. - * \return true iff bb1 intersects with bb2, otherwise, false. - */ -template < typename T, int DIM > -bool intersect( const BoundingBox< T, DIM >& bb1, - const BoundingBox< T, DIM >& bb2) -{ - return bb1.intersectsWith(bb2); -} - -/*! - * \brief Determines if two spheres intersect. - * - * \param [in] s1 user-supplied sphere object to check for intersection. - * \param [in] s2 user-supplied sphere object to check for intersection. - * \param [in] TOL tolerance used for intersection check (optional) - * - * \note If TOL is not supplied, the default is 1.e-9. - * - * \return status true iff s1 intersects with s2, otherwise, false. - */ -template < typename T, int DIM > -bool intersect( const Sphere< T,DIM >& s1, - const Sphere< T,DIM >& s2, - double TOL=1.e-9 ) -{ - return s1.intersectsWith( s2, TOL ); -} - /*! * \brief Determines if a triangle and a bounding box intersect * \param [in] tri user-supplied triangle (with three vertices). @@ -274,6 +201,107 @@ bool intersect(const Triangle< T, 3 >& tri, const Segment< T,3 >& seg, return retval; } +/// @} + +/// \name Ray Intersection Routines +/// @{ + +/*! + * \brief Computes the intersection of the given ray, R, with the segment, S. + * ip returns the intersection point on S. + * \return status true iff R intersects with S, otherwise, false. + */ +template < typename T > +bool intersect( const Ray< T,2 >& R, const Segment< T,2 >& S, Point< T,2 >& ip ) +{ + return detail::intersect_ray_seg(R, S, ip); +} + +/*! + * \brief Computes the intersection of the given ray, R, with the Box, bb. + * ip the point of intersection on R. + * \return status true iff bb intersects with R, otherwise, false. + * + * Computes Ray Box intersection using the slab method from pg 180 of + * Real Time Collision Detection by Christer Ericson. + */ +template < typename T, int DIM > +bool intersect( const Ray< T,DIM > & R, + const BoundingBox< T,DIM > & bb, + Point< T,DIM > & ip) +{ + return detail::intersect_ray_bbox(R, bb, ip); +} + +/// @} + +/// \name Segment Intersection Routines +/// @{ + +/*! + * \brief Computes the intersection of the given segment, S, with the Box, bb. + * ip the point of intersection on S. + * \return status true iff bb intersects with S, otherwise, false. + * + * Computes Segment Box intersection using the slab method from pg 180 of + * Real Time Collision Detection by Christer Ericson. + * WIP: More test cases for this + */ +template < typename T, int DIM > +bool intersect( const Segment< T,DIM > & S, + const BoundingBox< T,DIM > & bb, + Point< T,DIM > & ip) +{ + return detail::intersect_seg_bbox(S, bb, ip); +} + +/// @} + +/// \name Axis-Aligned Bounding Box Intersection Routines +/// @{ + +/*! + * \brief Determines if two axis aligned bounding boxes intersect + * \param [in] bb1 user-supplied axis aligned bounding box. + * \param [in] bb2 user-supplied axis aligned bounding box. + * \return true iff bb1 intersects with bb2, otherwise, false. + */ +template < typename T, int DIM > +bool intersect( const BoundingBox< T, DIM >& bb1, + const BoundingBox< T, DIM >& bb2) +{ + return bb1.intersectsWith(bb2); +} + +/// @} + +/// \name Sphere Intersection Routines +/// @{ + +/*! + * \brief Determines if two spheres intersect. + * + * \param [in] s1 user-supplied sphere object to check for intersection. + * \param [in] s2 user-supplied sphere object to check for intersection. + * \param [in] TOL tolerance used for intersection check (optional) + * + * \note If TOL is not supplied, the default is 1.e-9. + * + * \return status true iff s1 intersects with s2, otherwise, false. + */ +template < typename T, int DIM > +bool intersect( const Sphere< T,DIM >& s1, + const Sphere< T,DIM >& s2, + double TOL=1.e-9 ) +{ + return s1.intersectsWith( s2, TOL ); +} + +/// @} + +/// \name Oriented Bounding Box Intersection Routines +/// @{ + template < typename T > bool intersect(const OrientedBoundingBox< T, 1 > & b1, const OrientedBoundingBox< T, 1 >& b2) @@ -308,6 +336,10 @@ bool intersect(const OrientedBoundingBox< T, 3 >& b1, return detail::intersect_obb3D_obb3D(b1, b2, EPS); } +/// @} + +/// \name Bezier Curve Intersection Routines +/// @{ /*! * \brief Tests if two Bezier Curves \a c1 and \a c2 intersect. @@ -357,6 +389,8 @@ bool intersect( const BezierCurve< T, NDIMS>& c1, offset, scale, offset, scale); } +/// @} + } /* namespace primal */ } /* namespace axom */ From e9f368e6a75f0481afafef5990042c7f706bd615 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 28 Feb 2020 10:52:17 -0800 Subject: [PATCH 075/632] ENH: split ray intersection routines Move the ray intersection routines to a seperate file. --- src/axom/primal/CMakeLists.txt | 1 + .../operators/detail/intersect_impl.hpp | 119 -------------- .../operators/detail/intersect_ray_impl.hpp | 145 ++++++++++++++++++ src/axom/primal/operators/intersect.hpp | 1 + 4 files changed, 147 insertions(+), 119 deletions(-) create mode 100644 src/axom/primal/operators/detail/intersect_ray_impl.hpp diff --git a/src/axom/primal/CMakeLists.txt b/src/axom/primal/CMakeLists.txt index ea86bdafbb..250ede1211 100644 --- a/src/axom/primal/CMakeLists.txt +++ b/src/axom/primal/CMakeLists.txt @@ -44,6 +44,7 @@ set( primal_headers operators/detail/clip_impl.hpp operators/detail/intersect_bezier_impl.hpp + operators/detail/intersect_ray_impl.hpp operators/detail/intersect_impl.hpp ) diff --git a/src/axom/primal/operators/detail/intersect_impl.hpp b/src/axom/primal/operators/detail/intersect_impl.hpp index 1cad2801eb..68b7d8c60f 100644 --- a/src/axom/primal/operators/detail/intersect_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_impl.hpp @@ -615,125 +615,6 @@ inline int countZeros(double x, double y, double z, double EPS) /*! @} */ -/*! - * \brief Computes the intersection of the given ray, R, with the segment, S. - * ip returns the intersection point on S. - * \return status true iff R intersects with S, otherwise, false. - */ -template < typename T > -bool intersect_ray_seg( const primal::Ray< T,2 >& R, - const primal::Segment< T,2 >& S, - primal::Point< T,2 >& ip ) -{ - // STEP 0: Construct a ray from the segment, i.e., represent the - // segment in parametric form S(t1)=A+td, t \in [0,1] - Ray< T,2 > R2( S ); - - // Step 1: Equating R(t0)=S(t1) yields a system of two equations and - // two unknowns, namely, t0 and t1. We can solve this system directly - // using Cramer's Rule. - const double denom = numerics::determinant( - R.direction()[0], (-1.0)*R2.direction()[0], - R.direction()[1], (-1.0)*R2.direction()[1] ); - - // STEP 2: if denom is zero, the system is singular, which implies that the - // ray and the segment are parallel - const double parepsilon = 1.0e-9; - if ( axom::utilities::isNearlyEqual( denom, 0.0, parepsilon ) ) - { - - // ray and segment are parallel - return false; - - } - - // STEP 3: Solve for t0 and t1 directly using cramer's rule - const double alpha = S.source()[0] - R.origin()[0]; - const double beta = S.source()[1] - R.origin()[1]; - - const double t0 = numerics::determinant( alpha, (-1.0)*R2.direction()[0], - beta, - (-1.0)*R2.direction()[1] )/denom; - - const double t1 = numerics::determinant( R.direction()[0], alpha, - R.direction()[1], beta )/denom; - - // STEP 4: Define lower/upper threshold - const double tlow = 0.0-1.0e-9; - const double thigh = 1.0+1.0e-9; - - // STEP 5: Necessary and sufficient criteria for an intersection between - // ray, R(t0), and a finite segment S(t1) are: - // 1. t0 >= tlow w.r.t. the ray R(t0). - // 2. tlow >= t1 >= thigh w.r.t. the segment S(t1). - if ( (t0 >= tlow) && (t1 >= tlow) && (t1 <= thigh) ) - { - ip = R2.at( t1 ); - return true; - } - - // STEP 6: Ray does not intersect the segment - return false; -} - -/*! - * \brief Computes the intersection of the given ray, R, with the Box, bb. - * ip the point of intersection on R. - * \return status true iff bb intersects with R, otherwise, false. - * - * Computes Ray Box intersection using the slab method from pg 180 of - * Real Time Collision Detection by Christer Ericson. - */ -template < typename T, int DIM > -bool intersect_ray_bbox(const primal::Ray< T,DIM > & R, - const primal::BoundingBox< T,DIM > & bb, - primal::Point< T,DIM > & ip) -{ - T tmin = std::numeric_limits< T >::min(); - SLIC_ASSERT(tmin>=0.0); - T tmax = std::numeric_limits< T >::max(); - - for (int i=0 ; i::min(), - 1.0e-9 )) - { - T pointDim = R.origin()[i]; - if ((pointDimbb.getMax()[i])) - { - return false; - } - } - else - { - T ood = (static_cast< T >(1.0)) / (R.direction()[i]); - T t1 = ((bb.getMin()[i]- R.origin()[i])*ood); - T t2 = ((bb.getMax()[i]- R.origin()[i])*ood); - - if (t1>t2) - { - std::swap(t1,t2); - } - - tmin = axom::utilities::max(tmin, t1); - tmax = axom::utilities::min(tmax, t2); - - if (tmin > tmax) - { - return false; - } - } - } - - for (int i = 0 ; i < DIM ; i++) - { - ip.data()[i] = R.origin()[i] + R.direction()[i] * tmin; - } - - return true; -} - /*! * \brief Computes the intersection of the given segment, S, with the Box, bb. * ip the point of intersection on S. diff --git a/src/axom/primal/operators/detail/intersect_ray_impl.hpp b/src/axom/primal/operators/detail/intersect_ray_impl.hpp new file mode 100644 index 0000000000..8a0b6c7c04 --- /dev/null +++ b/src/axom/primal/operators/detail/intersect_ray_impl.hpp @@ -0,0 +1,145 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef PRIMAL_INTERSECT_RAY_HPP_ +#define PRIMAL_INTERSECT_RAY_HPP_ + +// primal includes +#include "axom/primal/geometry/Point.hpp" +#include "axom/primal/geometry/Ray.hpp" +#include "axom/primal/geometry/Segment.hpp" +#include "axom/primal/geometry/BoundingBox.hpp" + +namespace axom +{ +namespace primal +{ +namespace detail +{ + +/*! + * \brief Computes the intersection of the given ray, R, with the segment, S. + * ip returns the intersection point on S. + * \return status true iff R intersects with S, otherwise, false. + */ +template < typename T > +bool intersect_ray_seg( const primal::Ray< T,2 >& R, + const primal::Segment< T,2 >& S, + primal::Point< T,2 >& ip ) +{ + // STEP 0: Construct a ray from the segment, i.e., represent the + // segment in parametric form S(t1)=A+td, t \in [0,1] + Ray< T,2 > R2( S ); + + // Step 1: Equating R(t0)=S(t1) yields a system of two equations and + // two unknowns, namely, t0 and t1. We can solve this system directly + // using Cramer's Rule. + const double denom = numerics::determinant( + R.direction()[0], (-1.0)*R2.direction()[0], + R.direction()[1], (-1.0)*R2.direction()[1] ); + + // STEP 2: if denom is zero, the system is singular, which implies that the + // ray and the segment are parallel + const double parepsilon = 1.0e-9; + if ( axom::utilities::isNearlyEqual( denom, 0.0, parepsilon ) ) + { + + // ray and segment are parallel + return false; + + } + + // STEP 3: Solve for t0 and t1 directly using cramer's rule + const double alpha = S.source()[0] - R.origin()[0]; + const double beta = S.source()[1] - R.origin()[1]; + + const double t0 = numerics::determinant( alpha, (-1.0)*R2.direction()[0], + beta, + (-1.0)*R2.direction()[1] )/denom; + + const double t1 = numerics::determinant( R.direction()[0], alpha, + R.direction()[1], beta )/denom; + + // STEP 4: Define lower/upper threshold + const double tlow = 0.0-1.0e-9; + const double thigh = 1.0+1.0e-9; + + // STEP 5: Necessary and sufficient criteria for an intersection between + // ray, R(t0), and a finite segment S(t1) are: + // 1. t0 >= tlow w.r.t. the ray R(t0). + // 2. tlow >= t1 >= thigh w.r.t. the segment S(t1). + if ( (t0 >= tlow) && (t1 >= tlow) && (t1 <= thigh) ) + { + ip = R2.at( t1 ); + return true; + } + + // STEP 6: Ray does not intersect the segment + return false; +} + +/*! + * \brief Computes the intersection of the given ray, R, with the Box, bb. + * ip the point of intersection on R. + * \return status true iff bb intersects with R, otherwise, false. + * + * Computes Ray Box intersection using the slab method from pg 180 of + * Real Time Collision Detection by Christer Ericson. + */ +template < typename T, int DIM > +bool intersect_ray_bbox(const primal::Ray< T,DIM > & R, + const primal::BoundingBox< T,DIM > & bb, + primal::Point< T,DIM > & ip) +{ + T tmin = std::numeric_limits< T >::min(); + SLIC_ASSERT(tmin>=0.0); + T tmax = std::numeric_limits< T >::max(); + + for (int i=0 ; i::min(), + 1.0e-9 )) + { + T pointDim = R.origin()[i]; + if ((pointDimbb.getMax()[i])) + { + return false; + } + } + else + { + T ood = (static_cast< T >(1.0)) / (R.direction()[i]); + T t1 = ((bb.getMin()[i]- R.origin()[i])*ood); + T t2 = ((bb.getMax()[i]- R.origin()[i])*ood); + + if (t1>t2) + { + std::swap(t1,t2); + } + + tmin = axom::utilities::max(tmin, t1); + tmax = axom::utilities::min(tmax, t2); + + if (tmin > tmax) + { + return false; + } + } + } + + for (int i = 0 ; i < DIM ; i++) + { + ip.data()[i] = R.origin()[i] + R.direction()[i] * tmin; + } + + return true; +} + +} /* namespace detail */ +} /* namespace primal */ +} /* namespace axom */ + +#endif diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index b9f5463d58..da7a38144c 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -25,6 +25,7 @@ #include "axom/primal/geometry/BezierCurve.hpp" #include "axom/primal/operators/detail/intersect_impl.hpp" +#include "axom/primal/operators/detail/intersect_ray_impl.hpp" #include "axom/primal/operators/detail/intersect_bezier_impl.hpp" namespace axom From e3257cf081950b941d740dd4eddb921929cbbc00 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 28 Feb 2020 10:59:25 -0800 Subject: [PATCH 076/632] ENH: consistent naming of intersect_ray mehtods --- .../primal/operators/detail/intersect_ray_impl.hpp | 12 ++++++------ src/axom/primal/operators/intersect.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/axom/primal/operators/detail/intersect_ray_impl.hpp b/src/axom/primal/operators/detail/intersect_ray_impl.hpp index 8a0b6c7c04..cb649aa30e 100644 --- a/src/axom/primal/operators/detail/intersect_ray_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_ray_impl.hpp @@ -25,9 +25,9 @@ namespace detail * \return status true iff R intersects with S, otherwise, false. */ template < typename T > -bool intersect_ray_seg( const primal::Ray< T,2 >& R, - const primal::Segment< T,2 >& S, - primal::Point< T,2 >& ip ) +bool intersect_ray( const primal::Ray< T,2 >& R, + const primal::Segment< T,2 >& S, + primal::Point< T,2 >& ip ) { // STEP 0: Construct a ray from the segment, i.e., represent the // segment in parametric form S(t1)=A+td, t \in [0,1] @@ -89,9 +89,9 @@ bool intersect_ray_seg( const primal::Ray< T,2 >& R, * Real Time Collision Detection by Christer Ericson. */ template < typename T, int DIM > -bool intersect_ray_bbox(const primal::Ray< T,DIM > & R, - const primal::BoundingBox< T,DIM > & bb, - primal::Point< T,DIM > & ip) +bool intersect_ray( const primal::Ray< T,DIM > & R, + const primal::BoundingBox< T,DIM > & bb, + primal::Point< T,DIM > & ip ) { T tmin = std::numeric_limits< T >::min(); SLIC_ASSERT(tmin>=0.0); diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index da7a38144c..fa971e4dd3 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -215,7 +215,7 @@ bool intersect(const Triangle< T, 3 >& tri, const Segment< T,3 >& seg, template < typename T > bool intersect( const Ray< T,2 >& R, const Segment< T,2 >& S, Point< T,2 >& ip ) { - return detail::intersect_ray_seg(R, S, ip); + return detail::intersect_ray(R, S, ip); } /*! @@ -231,7 +231,7 @@ bool intersect( const Ray< T,DIM > & R, const BoundingBox< T,DIM > & bb, Point< T,DIM > & ip) { - return detail::intersect_ray_bbox(R, bb, ip); + return detail::intersect_ray(R, bb, ip); } /// @} From a220dab5f9f9dfa5378ca4c57067793b99439af6 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 29 Feb 2020 17:14:53 -0800 Subject: [PATCH 077/632] ENH: add portable floating point traits class Add standardized and portable floating point traits class that allows querying lowest(), min() and max() values for a given floating point on either host or device. The functionality that this class provides is equivalent to that of std::numeric_limits, however, these functions are host/device decorated and therefore can be called from device code as well. --- src/axom/core/CMakeLists.txt | 3 +- .../core/numerics/floating_point_limits.hpp | 84 +++++++++++++++++++ src/axom/core/tests/CMakeLists.txt | 1 + .../tests/numerics_floating_point_limits.cpp | 58 +++++++++++++ 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/axom/core/numerics/floating_point_limits.hpp create mode 100644 src/axom/core/tests/numerics_floating_point_limits.cpp diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index e08322795d..602ab4e242 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -21,11 +21,12 @@ set(core_headers numerics/internal/matrix_norms.hpp numerics/Determinants.hpp - numerics/jacobi_eigensolve.hpp numerics/LU.hpp numerics/Matrix.hpp numerics/eigen_solve.hpp numerics/eigen_sort.hpp + numerics/floating_point_limits.hpp + numerics/jacobi_eigensolve.hpp numerics/linear_solve.hpp numerics/matvecops.hpp numerics/polynomial_solvers.hpp diff --git a/src/axom/core/numerics/floating_point_limits.hpp b/src/axom/core/numerics/floating_point_limits.hpp new file mode 100644 index 0000000000..6146b06518 --- /dev/null +++ b/src/axom/core/numerics/floating_point_limits.hpp @@ -0,0 +1,84 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_NUMERICS_FLOATING_POINT_LIMITS_HPP_ +#define AXOM_NUMERICS_FLOATING_POINT_LIMITS_HPP_ + +#include "axom/core/Macros.hpp" // for Axom macros + +#include // for std::is_floating_point +#include // for floating point limits + +namespace axom +{ +namespace numerics +{ + +/*! + * \brief Traits class for floating point types to query limit information. + * + * The floating_point_limits class is traits class providing a standardized + * and portable way to query the following information on either host/device: + *
    + *
  • lowest() -- returns the lowest finite value
  • + *
  • min() -- returns the smallest finite value
  • + *
  • max() -- returns the largest finite value
  • + *
+ * + * \tparam T the floating point type, e.g., float, double, or long double. + */ +template < typename T > +struct floating_point_limits +{ + AXOM_STATIC_ASSERT_MSG( std::is_floating_point< T >::value, + "floating_point_limits< T > must be used with a floating type!" ); +}; + +//------------------------------------------------------------------------------ +template < > +struct floating_point_limits< float > +{ + AXOM_HOST_DEVICE + static constexpr float lowest() { return -FLT_MAX; }; + + AXOM_HOST_DEVICE + static constexpr float min() { return FLT_MIN; }; + + AXOM_HOST_DEVICE + static constexpr float max() { return FLT_MAX; }; +}; + +//------------------------------------------------------------------------------ +template < > +struct floating_point_limits< double > +{ + AXOM_HOST_DEVICE + static constexpr double lowest() { return -DBL_MAX; }; + + AXOM_HOST_DEVICE + static constexpr double min() { return DBL_MIN; }; + + AXOM_HOST_DEVICE + static constexpr double max() { return DBL_MAX; }; +}; + +//------------------------------------------------------------------------------ +template < > +struct floating_point_limits< long double > +{ + AXOM_HOST_DEVICE + static constexpr long double lowest() { return -LDBL_MAX; }; + + AXOM_HOST_DEVICE + static constexpr long double min() { return LDBL_MIN; }; + + AXOM_HOST_DEVICE + static constexpr long double max() { return LDBL_MAX; }; +}; + +} /* namespace numerics */ +} /* namespace axom */ + +#endif /* AXOM_NUMERICS_FLOATING_POINT_LIMITS_HPP_ */ diff --git a/src/axom/core/tests/CMakeLists.txt b/src/axom/core/tests/CMakeLists.txt index 96eb677152..487fac6166 100644 --- a/src/axom/core/tests/CMakeLists.txt +++ b/src/axom/core/tests/CMakeLists.txt @@ -27,6 +27,7 @@ set(gtest_utils_tests numerics_determinants.cpp numerics_eigen_solve.cpp numerics_eigen_sort.cpp + numerics_floating_point_limits.cpp numerics_jacobi_eigensolve.cpp numerics_linear_solve.cpp numerics_lu.cpp diff --git a/src/axom/core/tests/numerics_floating_point_limits.cpp b/src/axom/core/tests/numerics_floating_point_limits.cpp new file mode 100644 index 0000000000..31e5e855ed --- /dev/null +++ b/src/axom/core/tests/numerics_floating_point_limits.cpp @@ -0,0 +1,58 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +// axom includes +#include "axom/core/Macros.hpp" +#include "axom/core/numerics/floating_point_limits.hpp" + +// gtest includes +#include "gtest/gtest.h" + +// C/C++ includes +#include // for std::is_floating_point + +//------------------------------------------------------------------------------ +// HELPER METHODS +//------------------------------------------------------------------------------ +template < typename T > +void check_type_limits( const std::string& typeName ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + SCOPED_TRACE( "Testing [" + typeName + "]" ); + + EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::lowest(), + std::numeric_limits< T >::lowest() ); + + EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::min(), + std::numeric_limits< T >::min() ); + + EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::max(), + std::numeric_limits< T >::max() ); +} + +//------------------------------------------------------------------------------ +// UNIT TESTS +//------------------------------------------------------------------------------ +TEST( numerics_floating_point_limits, consistency_with_standard_numeric_limits ) +{ + check_type_limits< float >( "float" ); + check_type_limits< double >( "double" ); + check_type_limits< long double >( "long double" ); +} + +//------------------------------------------------------------------------------ +int main(int argc, char* argv[]) +{ + int result = 0; + + ::testing::InitGoogleTest(&argc, argv); + + // finalized when exiting main scope + + result = RUN_ALL_TESTS(); + + return result; +} From c2976034b92ce09d596e483841cf516bd279071f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 28 Feb 2020 14:14:31 -0800 Subject: [PATCH 078/632] ENH: refactor ray/AABB intersection for GPUs --- .../operators/detail/intersect_ray_impl.hpp | 216 ++++++++++++++---- 1 file changed, 176 insertions(+), 40 deletions(-) diff --git a/src/axom/primal/operators/detail/intersect_ray_impl.hpp b/src/axom/primal/operators/detail/intersect_ray_impl.hpp index cb649aa30e..987d7ba98f 100644 --- a/src/axom/primal/operators/detail/intersect_ray_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_ray_impl.hpp @@ -6,12 +6,16 @@ #ifndef PRIMAL_INTERSECT_RAY_HPP_ #define PRIMAL_INTERSECT_RAY_HPP_ +// numerics includes +#include "axom/core/numerics/floating_point_limits.hpp" + // primal includes #include "axom/primal/geometry/Point.hpp" #include "axom/primal/geometry/Ray.hpp" #include "axom/primal/geometry/Segment.hpp" #include "axom/primal/geometry/BoundingBox.hpp" +#include // for std::is_floating_point< T >() namespace axom { namespace primal @@ -25,10 +29,12 @@ namespace detail * \return status true iff R intersects with S, otherwise, false. */ template < typename T > -bool intersect_ray( const primal::Ray< T,2 >& R, - const primal::Segment< T,2 >& S, - primal::Point< T,2 >& ip ) +inline bool intersect_ray( const primal::Ray< T,2 >& R, + const primal::Segment< T,2 >& S, + primal::Point< T,2 >& ip ) { + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + // STEP 0: Construct a ray from the segment, i.e., represent the // segment in parametric form S(t1)=A+td, t \in [0,1] Ray< T,2 > R2( S ); @@ -80,6 +86,151 @@ bool intersect_ray( const primal::Ray< T,2 >& R, return false; } +/*! + * \brief Helper routine for ray / AABB intersection test + * + * \param [in] x0 coordinate component of the ray origin. + * \param [in] n normal component of the ray direction. + * \param [in] min the AABB min coordinate along a direction. + * \param [in] max the AABB max coordinate along a drection. + * + * \param [in,out] tmin + * \param [in,out] tmax + * + * \param [in] TOL + * + * \return + */ +template < typename T > +AXOM_HOST_DEVICE +inline bool intersect_ray_bbox_test( const T& x0, + const T& n, + const T& min, + const T& max, + T& tmin, + T& tmax, + T TOL ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + constexpr T ZERO = 0.0f; + + bool status = true; + + if ( axom::utilities::isNearlyEqual( n, ZERO, TOL ) ) + { + status = ( ( (x0 < min) || (x0 > max) ) ? false : true ); + } + else + { + const T invn = static_cast< T >( 1.0 ) / n; + T t1 = ( min - x0 ) * invn; + T t2 = ( max - x0 ) * invn; + + if ( t1 > t2 ) + { + axom::utilities::swap( t1, t2 ); + } + + tmin = axom::utilities::max( tmin, t1 ); + tmax = axom::utilities::min( tmax, t2 ); + + status = ( ( tmin > tmax ) ? false : true ); + } + + return status; + +} + +/*! + * \brief + * + * \param [in] x0 + * \param [in] n + * \param [in] xmin + * \param [in] xmax + * \param [in] ymin + * \param [in] ymax + * + * \param [out] t + * + * \param [in] TOL optional tolerance. Defaults to 1.e-9 if not specified. + * + * \return status true if the ray intersects the bounding box, otherwise, false. + */ +template < typename T > +AXOM_HOST_DEVICE +inline bool intersect_ray( const T* x0, + const T* n, + const T& xmin, + const T& xmax, + const T& ymin, + const T& ymax, + T& t, + T TOL=1.e-9 ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + SLIC_ASSERT( x0 != nullptr ); + SLIC_ASSERT( n != nullptr ); + + t = 0.0f; + T tmax = axom::numerics::floating_point_limits< T >::max(); + + bool status = true; + status = status && intersect_ray_bbox_test( x0[0],n[0],xmin,xmax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( x0[1],n[1],ymin,ymax,t,tmax,TOL ); + + return status; +} + +/*! + * \brief + * + * \param [in] x0 + * \param [in] n + * \param [in] xmin + * \param [in] xmax + * \param [in] ymin + * \param [in] ymax + * \param [in] zmin + * \param [in] zmax + * + * \param [out] t + * + * \param [in] TOL optional tolerance. Defaults to 1.e-9 if not specified. + * + * \return status true if the ray intersects the bounding box, otherwise, false. + */ +template < typename T > +AXOM_HOST_DEVICE +inline bool intersect_ray( const T* x0, + const T* n, + const T& xmin, + const T& xmax, + const T& ymin, + const T& ymax, + const T& zmin, + const T& zmax, + T& t, + T TOL=1.e-9) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + SLIC_ASSERT( x0 != nullptr ); + SLIC_ASSERT( n != nullptr ); + + t = 0.0f; + T tmax = axom::numerics::floating_point_limits< T >::max(); + + bool status = true; + status = status && intersect_ray_bbox_test( x0[0],n[0],xmin,xmax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( x0[1],n[1],ymin,ymax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( x0[2],n[2],zmin,zmax,t,tmax,TOL ); + + return status; +} + /*! * \brief Computes the intersection of the given ray, R, with the Box, bb. * ip the point of intersection on R. @@ -89,53 +240,38 @@ bool intersect_ray( const primal::Ray< T,2 >& R, * Real Time Collision Detection by Christer Ericson. */ template < typename T, int DIM > -bool intersect_ray( const primal::Ray< T,DIM > & R, - const primal::BoundingBox< T,DIM > & bb, - primal::Point< T,DIM > & ip ) +inline bool intersect_ray( const primal::Ray< T,DIM > & R, + const primal::BoundingBox< T,DIM > & bb, + primal::Point< T,DIM > & ip, + T TOL=1.e-9 ) { + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + T tmin = std::numeric_limits< T >::min(); - SLIC_ASSERT(tmin>=0.0); T tmax = std::numeric_limits< T >::max(); - for (int i=0 ; i::min(), - 1.0e-9 )) - { - T pointDim = R.origin()[i]; - if ((pointDimbb.getMax()[i])) - { - return false; - } - } - else - { - T ood = (static_cast< T >(1.0)) / (R.direction()[i]); - T t1 = ((bb.getMin()[i]- R.origin()[i])*ood); - T t2 = ((bb.getMax()[i]- R.origin()[i])*ood); - - if (t1>t2) - { - std::swap(t1,t2); - } - - tmin = axom::utilities::max(tmin, t1); - tmax = axom::utilities::min(tmax, t2); - - if (tmin > tmax) - { - return false; - } - } + intersects = intersect_ray_bbox_test( R.origin()[ i ], + R.direction()[ i ], + bb.getMin()[ i ], + bb.getMax()[ i ], + tmin, + tmax, + TOL ); + } - for (int i = 0 ; i < DIM ; i++) + if ( intersects ) { - ip.data()[i] = R.origin()[i] + R.direction()[i] * tmin; + for (int i = 0 ; i < DIM ; i++) + { + ip.data()[i] = R.origin()[i] + R.direction()[i] * tmin; + } } - return true; + return intersects; } } /* namespace detail */ From c29ed70f3b0d3b701118d9df42ec4c14d6fa7de0 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 28 Feb 2020 15:31:12 -0800 Subject: [PATCH 079/632] ENH: add ray/AABB intersection tests --- src/axom/primal/tests/CMakeLists.txt | 13 +- .../primal/tests/primal_ray_intersect.cpp | 350 ++++++++++++++++++ 2 files changed, 357 insertions(+), 6 deletions(-) create mode 100644 src/axom/primal/tests/primal_ray_intersect.cpp diff --git a/src/axom/primal/tests/CMakeLists.txt b/src/axom/primal/tests/CMakeLists.txt index 7a03e0945d..4b884888d5 100644 --- a/src/axom/primal/tests/CMakeLists.txt +++ b/src/axom/primal/tests/CMakeLists.txt @@ -7,25 +7,26 @@ #------------------------------------------------------------------------------ set( primal_tests + primal_bezier_curve.cpp + primal_bezier_intersect.cpp primal_boundingbox.cpp - primal_orientedboundingbox.cpp primal_clip.cpp primal_closest_point.cpp + primal_compute_bounding_box.cpp primal_in_sphere.cpp - primal_intersect_impl.cpp primal_intersect.cpp + primal_intersect_impl.cpp primal_numeric_array.cpp - primal_compute_bounding_box.cpp primal_orientation.cpp + primal_orientedboundingbox.cpp primal_plane.cpp primal_point.cpp + primal_ray_intersect.cpp primal_sphere.cpp primal_squared_distance.cpp - primal_triangle.cpp primal_tetrahedron.cpp + primal_triangle.cpp primal_vector.cpp - primal_bezier_curve.cpp - primal_bezier_intersect.cpp ) set(primal_test_depends fmt primal slic mint gtest) diff --git a/src/axom/primal/tests/primal_ray_intersect.cpp b/src/axom/primal/tests/primal_ray_intersect.cpp new file mode 100644 index 0000000000..00ab7dcaaa --- /dev/null +++ b/src/axom/primal/tests/primal_ray_intersect.cpp @@ -0,0 +1,350 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#include "axom/primal/operators/detail/intersect_ray_impl.hpp" + +#include "axom/core/numerics/Matrix.hpp" // for numerics::Matrix +#include "axom/core/numerics/matvecops.hpp" // for matrix-vector operators + +#include "gtest/gtest.h" + +// C/C++ includes +#include + +// namespace aliases +namespace primal = axom::primal; +namespace numerics = axom::numerics; + +//------------------------------------------------------------------------------ +// UNIT TESTS +//------------------------------------------------------------------------------ +TEST( primal_ray_intersect, ray_aabb_intersection_2D ) +{ + constexpr int N = 3; + constexpr double LO = 0.0f; + constexpr double HI = 1.0f; + +// Defines the test box: +#define TEST_BOX2D LO,HI,LO,HI + + double x[ N ]; + numerics::linspace( LO, HI, x, N ); + + // test BOTTOM (-y) + { + const double n0[] = { 0.0, 1.0 }; + const double n1[] = { 0.0, -1.0 }; + const double y0 = -1.0f; + for ( int i=0; i < N; ++i ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x[i], y0 }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + } + } + + // test RIGHT (+x) + { + const double n0[] = { -1.0, 0.0 }; + const double n1[] = { 1.0, 0.0 }; + const double x0 = 2.0f; + for ( int i=0; i < N; ++i ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x0, x[ i ] }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + } + } + + // test TOP (+y) + { + const double n0[] = { 0.0, -1.0 }; + const double n1[] = { 0.0, 1.0 }; + const double y0 = 2.0f; + for ( int i=0; i < N; ++i ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x[ i ], y0 }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + } + } + + // test LEFT (-x) + { + const double n0[] = { 1.0, 0.0 }; + const double n1[] = { -1.0, 0.0 }; + const double x0 = -1.0f; + for ( int i=0; i < N; ++i ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x0, x[ i ] }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + } + } + + // Test a bunch of rays emitted from the box center + constexpr int NUM_ANGLES = 20; + double angles[ NUM_ANGLES ]; + numerics::linspace( 0.0, 360.0, angles, NUM_ANGLES ); + + numerics::Matrix< double > rotation_matrix( 2, 2 ); + + constexpr double PI_OVER_180 = M_PI / 180.0; + const double xc[] = { 0.5, 0.5 }; + const double e1[] = { 1.0, 0.0 }; + for( int i=0; i < NUM_ANGLES; ++i ) + { + const double t = angles[ i ] * PI_OVER_180; + const double cost = cos( t ); + const double sint = sin( t ); + + rotation_matrix( 0,0 ) = cost; rotation_matrix( 0,1 ) = -sint; + rotation_matrix( 1,0 ) = sint; rotation_matrix( 1,1 ) = cost; + + double n[ 2 ]; + numerics::matrix_vector_multiply( rotation_matrix, e1, n ); + + double inv_n[ ] = { -n[ 0 ], -n[ 1 ] }; + + double tmin = 0.0; + double tmax = 0.0; + EXPECT_TRUE( primal::detail::intersect_ray(xc,n,TEST_BOX2D,tmin,tmax) ); + EXPECT_TRUE( primal::detail::intersect_ray(xc,inv_n,TEST_BOX2D,tmin,tmax) ); + } + +#undef TEST_BOX2D +} + +//------------------------------------------------------------------------------ +TEST( primal_ray_intersect, ray_aabb_intersection_3D ) +{ + constexpr int N = 3; + constexpr double LO = 0.0f; + constexpr double HI = 1.0f; + +// Defines the test box: +#define TEST_BOX3D LO,HI,LO,HI,LO,HI + + double x[ N ]; + numerics::linspace( LO, HI, x, N ); + + // test BOTTOM (-z) + { + + const double n0[] = { 0.0, 0.0, 1.0 }; + const double n1[] = { 0.0, 0.0, -1.0 }; + const double z0 = -1.0f; + + for ( int i=0; i < N; ++i ) + { + for ( int j=0; j < N; ++j ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x[i], x[j], z0 }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + } // END for all j + } // END for all i + + } + + // test TOP (+z) + { + + const double n0[] = { 0.0, 0.0, -1.0 }; + const double n1[] = { 0.0, 0.0, 1.0 }; + const double z0 = 2.0f; + + for ( int i=0; i < N; ++i ) + { + for ( int j=0; j < N; ++j ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x[i], x[j], z0 }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + } // END for all j + } // END for all i + + } + + // test LEFT (-y) + { + + const double n0[] = { 0.0, 1.0, 0.0 }; + const double n1[] = { 0.0, -1.0, 0.0 }; + const double y0 = -1.0f; + + for ( int i=0; i < N; ++i ) + { + for ( int j=0; j < N; ++j ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x[ i ], y0, x[ j ] }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + } // END for all j + } // END for all i + + } + + // test RIGHT (+y) + { + + const double n0[] = { 0.0, -1.0, 0.0 }; + const double n1[] = { 0.0, 1.0, 0.0 }; + const double y0 = 2.0f; + + for ( int i=0; i < N; ++i ) + { + for ( int j=0; j < N; ++j ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x[ i ], y0, x[ j ] }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + } // END for all j + } // END for all i + + } + + // test BACK (-x) + { + + const double n0[] = { 1.0, 0.0, 0.0 }; + const double n1[] = { -1.0, 0.0, 0.0 }; + const double x0 = -1.0f; + + for ( int i=0; i < N; ++i ) + { + for ( int j=0; j < N; ++j ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x0, x[ i ], x[ j ] }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + } // END for all j + } // END for all i + + } + + // test FRONT (+x) + { + + const double n0[] = { -1.0, 0.0, 0.0 }; + const double n1[] = { 1.0, 0.0, 0.0 }; + const double x0 = 2.0f; + + for ( int i=0; i < N; ++i ) + { + for ( int j=0; j < N; ++j ) + { + double tmin = 0.0; + double tmax = 0.0; + + double s[] = { x0, x[ i ], x[ j ] }; + EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + } // END for all j + } // END for all i + + } + + // Test a bunch of rays emitted from the box center + constexpr int NUM_ANGLES = 20; + double angles[ NUM_ANGLES ]; + numerics::linspace( 0.0, 360.0, angles, NUM_ANGLES ); + + numerics::Matrix< double > Rx(3,3); Rx(0,0) = 1.0; + numerics::Matrix< double > Ry(3,3); Ry(1,1) = 1.0; + numerics::Matrix< double > Rz(3,3); Rz(2,2) = 1.0; + + constexpr double PI_OVER_180 = M_PI / 180.0; + const double xc[] = { 0.5, 0.5, 0.5 }; + const double e1[] = { 1.0, 0.0, 0.0 }; + const double e2[] = { 0.0, 1.0, 0.0 }; + const double e3[] = { 0.0, 0.0, 1.0 }; + for( int i=0; i < NUM_ANGLES; ++i ) + { + const double t = angles[ i ] * PI_OVER_180; + const double cost = cos( t ); + const double sint = sin( t ); + + double tmin = 0.0; + double tmax = 0.0; + + // Update Rx + Rx(1,1)=cost; Rx(1,2)= -sint; + Rx(2,1)=sint; Rx(2,2)= cost; + + double nx[ 3 ]; + numerics::matrix_vector_multiply( Rx, e1, nx ); + EXPECT_TRUE( primal::detail::intersect_ray(xc,nx,TEST_BOX3D,tmin,tmax) ); + + // Update Ry + Ry(0,0)=cost; Ry(0,2)=sint; + Ry(2,0)=-sint; Ry(2,2)=cost; + + double ny[ 3 ]; + numerics::matrix_vector_multiply( Ry, e2, ny ); + EXPECT_TRUE( primal::detail::intersect_ray(xc,ny,TEST_BOX3D,tmin,tmax) ); + + // Update Rz + Rz(0,0)=cost; Rz(0,1)=-sint; + Rz(1,0)=sint; Rz(1,1)=cost; + + double nz[ 3 ]; + numerics::matrix_vector_multiply( Rz, e3, nz ); + EXPECT_TRUE( primal::detail::intersect_ray(xc,nz,TEST_BOX3D,tmin,tmax) ); + } + + + +#undef TEST_BOX3D +} + +//------------------------------------------------------------------------------ +#include "axom/slic/core/UnitTestLogger.hpp" +using axom::slic::UnitTestLogger; + +int main(int argc, char* argv[]) +{ + int result = 0; + + ::testing::InitGoogleTest(&argc, argv); + + UnitTestLogger logger; // create & initialize test logger, + + // finalized when exiting main scope + + result = RUN_ALL_TESTS(); + + return result; +} + + + From 11df672dc2c01540d31c6ae4d66da8ab2d2c6dbe Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 29 Feb 2020 18:11:46 -0800 Subject: [PATCH 080/632] BUGFIX: primal tests do not depend on mint --- src/axom/primal/tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axom/primal/tests/CMakeLists.txt b/src/axom/primal/tests/CMakeLists.txt index 4b884888d5..638fdf443c 100644 --- a/src/axom/primal/tests/CMakeLists.txt +++ b/src/axom/primal/tests/CMakeLists.txt @@ -29,7 +29,7 @@ set( primal_tests primal_vector.cpp ) -set(primal_test_depends fmt primal slic mint gtest) +set(primal_test_depends fmt primal slic gtest) foreach ( test ${primal_tests} ) From 532f18d5140d7d2c94e742caed98861e840bd788 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 2 Mar 2020 14:25:03 -0800 Subject: [PATCH 081/632] DOC: improve docs for ray intersection operators --- .../operators/detail/intersect_ray_impl.hpp | 68 +++++++++++-------- src/axom/primal/operators/intersect.hpp | 26 +++++-- 2 files changed, 60 insertions(+), 34 deletions(-) diff --git a/src/axom/primal/operators/detail/intersect_ray_impl.hpp b/src/axom/primal/operators/detail/intersect_ray_impl.hpp index 987d7ba98f..5b4bc13f5e 100644 --- a/src/axom/primal/operators/detail/intersect_ray_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_ray_impl.hpp @@ -87,19 +87,22 @@ inline bool intersect_ray( const primal::Ray< T,2 >& R, } /*! - * \brief Helper routine for ray / AABB intersection test + * \brief Helper routine for ray / AABB intersection test. * * \param [in] x0 coordinate component of the ray origin. * \param [in] n normal component of the ray direction. * \param [in] min the AABB min coordinate along a direction. * \param [in] max the AABB max coordinate along a drection. * - * \param [in,out] tmin - * \param [in,out] tmax + * \param [in,out] tmin length of closest intersection point (computed) + * \param [in,out] tmax length of farthest intersection point (computed) * - * \param [in] TOL + * \param [in] TOL user-supplied tolerance. * - * \return + * \return status true if the ray intersects, otherwise false. + * + * \note This routine is called by the intersect ray/AABB methods for each + * spatial dimension. */ template < typename T > AXOM_HOST_DEVICE @@ -143,17 +146,15 @@ inline bool intersect_ray_bbox_test( const T& x0, } /*! - * \brief - * - * \param [in] x0 - * \param [in] n - * \param [in] xmin - * \param [in] xmax - * \param [in] ymin - * \param [in] ymax - * - * \param [out] t + * \brief Checks if a specified ray intersects with the supplied bounding box. * + * \param [in] x0 the source point of the ray + * \param [in] n the ray diection + * \param [in] xmin x-coordinate of the lower bounding box corner + * \param [in] xmax x-coordinate of the upper bounding box corner + * \param [in] ymin y-coordinate of the lower bounding box corner + * \param [in] ymax y-coordinate of the upper bounding box corner + * \param [out] t length of intersection point from the ray source point. * \param [in] TOL optional tolerance. Defaults to 1.e-9 if not specified. * * \return status true if the ray intersects the bounding box, otherwise, false. @@ -185,19 +186,17 @@ inline bool intersect_ray( const T* x0, } /*! - * \brief - * - * \param [in] x0 - * \param [in] n - * \param [in] xmin - * \param [in] xmax - * \param [in] ymin - * \param [in] ymax - * \param [in] zmin - * \param [in] zmax - * - * \param [out] t + * \brief Checks if a specified ray intersects with the supplied bounding box. * + * \param [in] x0 the source point of the ray + * \param [in] n the ray direction + * \param [in] xmin x-coordinate of the lower bounding box corner + * \param [in] xmax x-coordinate of the upper bounding box corner + * \param [in] ymin y-coordinate of the lower bounding box corner + * \param [in] ymax y-coordinate of the upper bounding box corner + * \param [in] zmin z-coordinate of the lower bounding box corner + * \param [in] zmax z-coordinate of the upper bounding box corner + * \param [out] t length of intersection point from the ray source point. * \param [in] TOL optional tolerance. Defaults to 1.e-9 if not specified. * * \return status true if the ray intersects the bounding box, otherwise, false. @@ -233,11 +232,20 @@ inline bool intersect_ray( const T* x0, /*! * \brief Computes the intersection of the given ray, R, with the Box, bb. - * ip the point of intersection on R. + * + * \param [in] R the specified ray + * \param [in] bb the user-supplied axis-aligned bounding box + * + * \param [out] ip the intersection point where R intersects bb. + * * \return status true iff bb intersects with R, otherwise, false. * - * Computes Ray Box intersection using the slab method from pg 180 of - * Real Time Collision Detection by Christer Ericson. + * \see primal::Ray + * \see primal::Segment + * \see primal::BoundingBox + * + * \note Computes Ray Box intersection using the slab method from pg 180 of + * Real Time Collision Detection by Christer Ericson. */ template < typename T, int DIM > inline bool intersect_ray( const primal::Ray< T,DIM > & R, diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index fa971e4dd3..9e6999561d 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -209,8 +209,17 @@ bool intersect(const Triangle< T, 3 >& tri, const Segment< T,3 >& seg, /*! * \brief Computes the intersection of the given ray, R, with the segment, S. - * ip returns the intersection point on S. + * + * \param [in] R the specified ray + * \param [in] S the segment to check + * + * \param [out] ip the intersection point on S, valid only if status=true. + * * \return status true iff R intersects with S, otherwise, false. + * + * \see primal::Ray + * \see primal::Segment + * \see primal::Point */ template < typename T > bool intersect( const Ray< T,2 >& R, const Segment< T,2 >& S, Point< T,2 >& ip ) @@ -220,11 +229,20 @@ bool intersect( const Ray< T,2 >& R, const Segment< T,2 >& S, Point< T,2 >& ip ) /*! * \brief Computes the intersection of the given ray, R, with the Box, bb. - * ip the point of intersection on R. + * + * \param [in] R the specified ray + * \param [in] bb the user-supplied axis-aligned bounding box + * + * \param [out] ip the intersection point where R intersects bb. + * * \return status true iff bb intersects with R, otherwise, false. * - * Computes Ray Box intersection using the slab method from pg 180 of - * Real Time Collision Detection by Christer Ericson. + * \see primal::Ray + * \see primal::Segment + * \see primal::BoundingBox + * + * \note Computes Ray Box intersection using the slab method from pg 180 of + * Real Time Collision Detection by Christer Ericson. */ template < typename T, int DIM > bool intersect( const Ray< T,DIM > & R, From 7877f925582e12d3b660fd212b3c45e6b4f0e6bd Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 3 Mar 2020 12:43:10 -0800 Subject: [PATCH 082/632] ENH: simplify low-level API for ray-AABB methods Change API to use primitive types instead of arrays for low-level ray-AABB intersection methods. This alleviates the need to pack these arrays on the GPU and makes the interface data-structure agnostic. --- .../operators/detail/intersect_ray_impl.hpp | 45 ++--- .../primal/tests/primal_ray_intersect.cpp | 160 ++++++++++++------ 2 files changed, 132 insertions(+), 73 deletions(-) diff --git a/src/axom/primal/operators/detail/intersect_ray_impl.hpp b/src/axom/primal/operators/detail/intersect_ray_impl.hpp index 5b4bc13f5e..dca37afc57 100644 --- a/src/axom/primal/operators/detail/intersect_ray_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_ray_impl.hpp @@ -16,6 +16,7 @@ #include "axom/primal/geometry/BoundingBox.hpp" #include // for std::is_floating_point< T >() + namespace axom { namespace primal @@ -148,8 +149,10 @@ inline bool intersect_ray_bbox_test( const T& x0, /*! * \brief Checks if a specified ray intersects with the supplied bounding box. * - * \param [in] x0 the source point of the ray - * \param [in] n the ray diection + * \param [in] x0 x-coordinate of the ray source point + * \param [in] nx x-component of the ray normal + * \param [in] y0 y-coordinate of the ray source point + * \param [in] ny y-component of the ray normal * \param [in] xmin x-coordinate of the lower bounding box corner * \param [in] xmax x-coordinate of the upper bounding box corner * \param [in] ymin y-coordinate of the lower bounding box corner @@ -161,8 +164,10 @@ inline bool intersect_ray_bbox_test( const T& x0, */ template < typename T > AXOM_HOST_DEVICE -inline bool intersect_ray( const T* x0, - const T* n, +inline bool intersect_ray( const T& x0, + const T& nx, + const T& y0, + const T& ny, const T& xmin, const T& xmax, const T& ymin, @@ -172,15 +177,12 @@ inline bool intersect_ray( const T* x0, { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); - SLIC_ASSERT( x0 != nullptr ); - SLIC_ASSERT( n != nullptr ); - t = 0.0f; T tmax = axom::numerics::floating_point_limits< T >::max(); bool status = true; - status = status && intersect_ray_bbox_test( x0[0],n[0],xmin,xmax,t,tmax,TOL ); - status = status && intersect_ray_bbox_test( x0[1],n[1],ymin,ymax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( x0,nx,xmin,xmax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( y0,ny,ymin,ymax,t,tmax,TOL ); return status; } @@ -188,8 +190,12 @@ inline bool intersect_ray( const T* x0, /*! * \brief Checks if a specified ray intersects with the supplied bounding box. * - * \param [in] x0 the source point of the ray - * \param [in] n the ray direction + * \param [in] x0 x-coordinate of the ray source point + * \param [in] nx x-component of the ray normal + * \param [in] y0 y-coordinate of the ray source point + * \param [in] ny y-component of the ray normal + * \param [in] z0 z-coordinate of the ray source point + * \param [in] nz z-component of the ray normal * \param [in] xmin x-coordinate of the lower bounding box corner * \param [in] xmax x-coordinate of the upper bounding box corner * \param [in] ymin y-coordinate of the lower bounding box corner @@ -203,8 +209,12 @@ inline bool intersect_ray( const T* x0, */ template < typename T > AXOM_HOST_DEVICE -inline bool intersect_ray( const T* x0, - const T* n, +inline bool intersect_ray( const T& x0, + const T& nx, + const T& y0, + const T& ny, + const T& z0, + const T& nz, const T& xmin, const T& xmax, const T& ymin, @@ -216,16 +226,13 @@ inline bool intersect_ray( const T* x0, { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); - SLIC_ASSERT( x0 != nullptr ); - SLIC_ASSERT( n != nullptr ); - t = 0.0f; T tmax = axom::numerics::floating_point_limits< T >::max(); bool status = true; - status = status && intersect_ray_bbox_test( x0[0],n[0],xmin,xmax,t,tmax,TOL ); - status = status && intersect_ray_bbox_test( x0[1],n[1],ymin,ymax,t,tmax,TOL ); - status = status && intersect_ray_bbox_test( x0[2],n[2],zmin,zmax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( x0,nx,xmin,xmax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( y0,ny,ymin,ymax,t,tmax,TOL ); + status = status && intersect_ray_bbox_test( z0,nz,zmin,zmax,t,tmax,TOL ); return status; } diff --git a/src/axom/primal/tests/primal_ray_intersect.cpp b/src/axom/primal/tests/primal_ray_intersect.cpp index 00ab7dcaaa..1ad6abb105 100644 --- a/src/axom/primal/tests/primal_ray_intersect.cpp +++ b/src/axom/primal/tests/primal_ray_intersect.cpp @@ -26,6 +26,8 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) constexpr double LO = 0.0f; constexpr double HI = 1.0f; + using namespace primal::detail; + // Defines the test box: #define TEST_BOX2D LO,HI,LO,HI @@ -35,64 +37,72 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) // test BOTTOM (-y) { const double n0[] = { 0.0, 1.0 }; - const double n1[] = { 0.0, -1.0 }; const double y0 = -1.0f; for ( int i=0; i < N; ++i ) { double tmin = 0.0; double tmax = 0.0; - double s[] = { x[i], y0 }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + const double sx = x[i]; + const double sy = y0; + const double nx = n0[0]; + const double ny = n0[1]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,TEST_BOX2D,tmin,tmax) ); } } // test RIGHT (+x) { const double n0[] = { -1.0, 0.0 }; - const double n1[] = { 1.0, 0.0 }; const double x0 = 2.0f; for ( int i=0; i < N; ++i ) { double tmin = 0.0; double tmax = 0.0; - double s[] = { x0, x[ i ] }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + const double sx = x0; + const double sy = x[ i ]; + const double nx = n0[0]; + const double ny = n0[1]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,TEST_BOX2D,tmin,tmax) ); } } // test TOP (+y) { const double n0[] = { 0.0, -1.0 }; - const double n1[] = { 0.0, 1.0 }; const double y0 = 2.0f; for ( int i=0; i < N; ++i ) { double tmin = 0.0; double tmax = 0.0; - double s[] = { x[ i ], y0 }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + const double sx = x[ i ]; + const double sy = y0; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,TEST_BOX2D,tmin,tmax) ); } } // test LEFT (-x) { const double n0[] = { 1.0, 0.0 }; - const double n1[] = { -1.0, 0.0 }; const double x0 = -1.0f; for ( int i=0; i < N; ++i ) { double tmin = 0.0; double tmax = 0.0; - double s[] = { x0, x[ i ] }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX2D,tmin,tmax) ); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX2D,tmin,tmax) ); + const double sx = x0; + const double sy = x[ i ]; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,TEST_BOX2D,tmin,tmax) ); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,TEST_BOX2D,tmin,tmax) ); } } @@ -118,12 +128,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) double n[ 2 ]; numerics::matrix_vector_multiply( rotation_matrix, e1, n ); - double inv_n[ ] = { -n[ 0 ], -n[ 1 ] }; - double tmin = 0.0; double tmax = 0.0; - EXPECT_TRUE( primal::detail::intersect_ray(xc,n,TEST_BOX2D,tmin,tmax) ); - EXPECT_TRUE( primal::detail::intersect_ray(xc,inv_n,TEST_BOX2D,tmin,tmax) ); + const double x0 = xc[ 0 ]; + const double y0 = xc[ 1 ]; + const double nx = n[ 0 ]; + const double ny = n[ 1 ]; + EXPECT_TRUE( intersect_ray(x0,nx,y0,ny,TEST_BOX2D,tmin,tmax) ); + EXPECT_TRUE( intersect_ray(x0,-nx,y0,-ny,TEST_BOX2D,tmin,tmax) ); } #undef TEST_BOX2D @@ -136,6 +148,8 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) constexpr double LO = 0.0f; constexpr double HI = 1.0f; + using namespace primal::detail; + // Defines the test box: #define TEST_BOX3D LO,HI,LO,HI,LO,HI @@ -146,7 +160,6 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) { const double n0[] = { 0.0, 0.0, 1.0 }; - const double n1[] = { 0.0, 0.0, -1.0 }; const double z0 = -1.0f; for ( int i=0; i < N; ++i ) @@ -156,9 +169,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; - double s[] = { x[i], x[j], z0 }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + const double sx = x[i]; + const double sy = x[j]; + const double sz = z0; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + const double nz = n0[ 2 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,sz,nz,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,sz,-nz,TEST_BOX3D,tmin,tmax)); } // END for all j } // END for all i @@ -168,7 +186,6 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) { const double n0[] = { 0.0, 0.0, -1.0 }; - const double n1[] = { 0.0, 0.0, 1.0 }; const double z0 = 2.0f; for ( int i=0; i < N; ++i ) @@ -178,9 +195,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; - double s[] = { x[i], x[j], z0 }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + const double sx = x[i]; + const double sy = x[j]; + const double sz = z0; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + const double nz = n0[ 2 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,sz,nz,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,sz,-nz,TEST_BOX3D,tmin,tmax)); } // END for all j } // END for all i @@ -190,7 +212,6 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) { const double n0[] = { 0.0, 1.0, 0.0 }; - const double n1[] = { 0.0, -1.0, 0.0 }; const double y0 = -1.0f; for ( int i=0; i < N; ++i ) @@ -200,9 +221,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; - double s[] = { x[ i ], y0, x[ j ] }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + const double sx = x[i]; + const double sy = y0; + const double sz = x[j]; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + const double nz = n0[ 2 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,sz,nz,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,sz,-nz,TEST_BOX3D,tmin,tmax)); } // END for all j } // END for all i @@ -212,7 +238,6 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) { const double n0[] = { 0.0, -1.0, 0.0 }; - const double n1[] = { 0.0, 1.0, 0.0 }; const double y0 = 2.0f; for ( int i=0; i < N; ++i ) @@ -222,9 +247,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; - double s[] = { x[ i ], y0, x[ j ] }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + const double sx = x[i]; + const double sy = y0; + const double sz = x[j]; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + const double nz = n0[ 2 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,sz,nz,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,sz,-nz,TEST_BOX3D,tmin,tmax)); } // END for all j } // END for all i @@ -234,7 +264,6 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) { const double n0[] = { 1.0, 0.0, 0.0 }; - const double n1[] = { -1.0, 0.0, 0.0 }; const double x0 = -1.0f; for ( int i=0; i < N; ++i ) @@ -244,9 +273,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; - double s[] = { x0, x[ i ], x[ j ] }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + const double sx = x0; + const double sy = x[i]; + const double sz = x[j]; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + const double nz = n0[ 2 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,sz,nz,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,sz,-nz,TEST_BOX3D,tmin,tmax)); } // END for all j } // END for all i @@ -256,7 +290,6 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) { const double n0[] = { -1.0, 0.0, 0.0 }; - const double n1[] = { 1.0, 0.0, 0.0 }; const double x0 = 2.0f; for ( int i=0; i < N; ++i ) @@ -266,9 +299,14 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; - double s[] = { x0, x[ i ], x[ j ] }; - EXPECT_TRUE( primal::detail::intersect_ray(s,n0,TEST_BOX3D,tmin,tmax)); - EXPECT_FALSE( primal::detail::intersect_ray(s,n1,TEST_BOX3D,tmin,tmax)); + const double sx = x0; + const double sy = x[i]; + const double sz = x[j]; + const double nx = n0[ 0 ]; + const double ny = n0[ 1 ]; + const double nz = n0[ 2 ]; + EXPECT_TRUE( intersect_ray(sx,nx,sy,ny,sz,nz,TEST_BOX3D,tmin,tmax)); + EXPECT_FALSE( intersect_ray(sx,-nx,sy,-ny,sz,-nz,TEST_BOX3D,tmin,tmax)); } // END for all j } // END for all i @@ -288,6 +326,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double e1[] = { 1.0, 0.0, 0.0 }; const double e2[] = { 0.0, 1.0, 0.0 }; const double e3[] = { 0.0, 0.0, 1.0 }; + double n[3]; for( int i=0; i < NUM_ANGLES; ++i ) { const double t = angles[ i ] * PI_OVER_180; @@ -297,33 +336,46 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) double tmin = 0.0; double tmax = 0.0; + double nx = 0.0; + double ny = 0.0; + double nz = 0.0; + + const double x0 = xc[ 0 ]; + const double y0 = xc[ 1 ]; + const double z0 = xc[ 2 ]; + // Update Rx Rx(1,1)=cost; Rx(1,2)= -sint; Rx(2,1)=sint; Rx(2,2)= cost; - double nx[ 3 ]; - numerics::matrix_vector_multiply( Rx, e1, nx ); - EXPECT_TRUE( primal::detail::intersect_ray(xc,nx,TEST_BOX3D,tmin,tmax) ); + numerics::matrix_vector_multiply( Rx, e1, n ); + nx = n[ 0 ]; + ny = n[ 1 ]; + nz = n[ 2 ]; + EXPECT_TRUE( intersect_ray(x0,nx,y0,ny,z0,nz,TEST_BOX3D,tmin,tmax) ); // Update Ry Ry(0,0)=cost; Ry(0,2)=sint; Ry(2,0)=-sint; Ry(2,2)=cost; - double ny[ 3 ]; - numerics::matrix_vector_multiply( Ry, e2, ny ); - EXPECT_TRUE( primal::detail::intersect_ray(xc,ny,TEST_BOX3D,tmin,tmax) ); + numerics::matrix_vector_multiply( Ry, e2, n ); + nx = n[ 0 ]; + ny = n[ 1 ]; + nz = n[ 2 ]; + EXPECT_TRUE( intersect_ray(x0,nx,y0,ny,z0,nz,TEST_BOX3D,tmin,tmax) ); // Update Rz Rz(0,0)=cost; Rz(0,1)=-sint; Rz(1,0)=sint; Rz(1,1)=cost; - double nz[ 3 ]; - numerics::matrix_vector_multiply( Rz, e3, nz ); - EXPECT_TRUE( primal::detail::intersect_ray(xc,nz,TEST_BOX3D,tmin,tmax) ); + numerics::matrix_vector_multiply( Rz, e3, n ); + nx = n[ 0 ]; + ny = n[ 1 ]; + nz = n[ 2 ]; + EXPECT_TRUE( intersect_ray(x0,nx,y0,ny,z0,nz,TEST_BOX3D,tmin,tmax) ); } - #undef TEST_BOX3D } From 254b05a1fced059434ced66b34a8584424aacbb4 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 2 Mar 2020 14:43:36 -0800 Subject: [PATCH 083/632] ENH: add ray intersection traversal predicates --- .../linear_bvh/TraversalPredicates.hpp | 169 ++++++++++++++++-- 1 file changed, 156 insertions(+), 13 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index 608ca05d16..2484e4b4b7 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -8,6 +8,8 @@ #include "axom/spin/internal/linear_bvh/vec.hpp" +#include "axom/primal/operators/detail/intersect_ray_impl.hpp" + namespace axom { namespace spin @@ -41,6 +43,8 @@ class TraversalPredicates AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used, e.g., double or float" ); + using vec4_t = VecType< FloatType >; + ///\name Predicates for Point Queries /// @{ @@ -52,13 +56,12 @@ class TraversalPredicates * \param [in] s2 the 2nd segment of the BVH that stores the left bin. * * \return status true if the point is inside the left bin, else, false. - * */ template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, - const VecType< FloatType >& s1, - const VecType< FloatType >& s2 ) noexcept; + const vec4_t& s1, + const vec4_t& s2 ) noexcept; /*! * \brief Checks if the supplied point is within the right bin. @@ -72,9 +75,43 @@ class TraversalPredicates template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInRightBin( const PointType& point, - const VecType< FloatType >& s2, - const VecType< FloatType >& s3 ) noexcept; + const vec4_t& s2, + const vec4_t& s3 ) noexcept; + + /// @} + + ///\name Predicates for Ray Intersection Queries + /// @{ + + /*! + * \brief Checks if the specified ray intersects with the left bin. + * + * \param [in] r the ray in query + * \param [in] s1 the 1st segment of the BVH that stores the left bin. + * \param [in] s2 the 2nd segment of the BVH that stores the left bin. + * + * \return status true if the ray intersects the left bin, else, false. + */ + template < typename RayType > + AXOM_HOST_DEVICE + static inline bool rayIntersectsLeftBin( const RayType& r, + const vec4_t& s1, + const vec4_t& s2 ) noexcept; + /*! + * \brief Checks if the specified ray intersects with the right bin. + * + * \param [in] r the ray in query + * \param [in] s2 the 2nd segment of the BVH that stores the right bin. + * \param [in] s3 the 3rd segment of the BVH that stores the right bin. + * + * \return status true if the ray intersects the right bin, else, false. + */ + template < typename RayType > + AXOM_HOST_DEVICE + static inline bool rayIntersectsRightBin( const RayType& r, + const vec4_t& s2, + const vec4_t& s3 ) noexcept; /// @} }; @@ -91,11 +128,13 @@ class TraversalPredicates< DIMENSION_2, FloatType > public: + using vec4_t = VecType< FloatType >; + template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, - const VecType< FloatType >& s1, - const VecType< FloatType >& s2 ) noexcept + const vec4_t& s1, + const vec4_t& s2 ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_left = true; @@ -112,8 +151,8 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInRightBin( const PointType& point, - const VecType< FloatType >& s2, - const VecType< FloatType >& s3 ) noexcept + const vec4_t& s2, + const vec4_t& s3 ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_right = true; @@ -127,6 +166,52 @@ class TraversalPredicates< DIMENSION_2, FloatType > return in_right; } + template < typename RayType > + AXOM_HOST_DEVICE + static inline bool rayIntersectsLeftBin( const RayType& r, + const vec4_t& s1, + const vec4_t& s2 ) noexcept + { + const FloatType& x0 = r[ 0 ]; + const FloatType& y0 = r[ 1 ]; + const FloatType& nx = r[ 2 ]; + const FloatType& ny = r[ 3 ]; + + // extract left bin, see BVHData.hpp for the internal BVH layout + const FloatType& xmin = s1[ 0 ]; + const FloatType& xmax = s1[ 3 ]; + const FloatType& ymin = s1[ 1 ]; + const FloatType& ymax = s2[ 0 ]; + + // TODO: in the future we should take `t` into account and organize + // candidate bins in a priority queue. + double t = 0.0; + return primal::detail::intersect_ray( x0,nx,y0,ny,xmin,xmax,ymin,ymax,t ); + } + + template < typename RayType > + AXOM_HOST_DEVICE + static inline bool rayIntersectsRightBin( const RayType& r, + const vec4_t& s2, + const vec4_t& s3 ) noexcept + { + const FloatType& x0 = r[ 0 ]; + const FloatType& y0 = r[ 1 ]; + const FloatType& nx = r[ 2 ]; + const FloatType& ny = r[ 3 ]; + + // extract right bin, see BVHData.hpp for the internal BVH layout + const FloatType& xmin = s2[ 2 ]; + const FloatType& xmax = s3[ 1 ]; + const FloatType& ymin = s2[ 3 ]; + const FloatType& ymax = s3[ 2 ]; + + // TODO: in the future we should take `t` into account and organize + // candidate bins in a priority queue. + double t = 0.0; + return primal::detail::intersect_ray( x0,nx,y0,ny,xmin,xmax,ymin,ymax,t ); + } + }; //------------------------------------------------------------------------------ @@ -138,11 +223,13 @@ class TraversalPredicates< DIMENSION_3, FloatType > public: + using vec4_t = VecType< FloatType >; + template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, - const VecType< FloatType >& s1, - const VecType< FloatType >& s2 ) noexcept + const vec4_t& s1, + const vec4_t& s2 ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. @@ -162,8 +249,8 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInRightBin( const PointType& point, - const VecType< FloatType >& s2, - const VecType< FloatType >& s3 ) noexcept + const vec4_t& s2, + const vec4_t& s3 ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_right = true; @@ -179,6 +266,62 @@ class TraversalPredicates< DIMENSION_3, FloatType > return in_right; } + template < typename RayType > + AXOM_HOST_DEVICE + static inline bool rayIntersectsLeftBin( const RayType& r, + const vec4_t& s1, + const vec4_t& s2 ) noexcept + { + const FloatType& x0 = r[ 0 ]; + const FloatType& y0 = r[ 1 ]; + const FloatType& z0 = r[ 2 ]; + const FloatType& nx = r[ 3 ]; + const FloatType& ny = r[ 4 ]; + const FloatType& nz = r[ 5 ]; + + // extract left bin, see BVHData.hpp for the internal BVH layout + const FloatType& xmin = s1[ 0 ]; + const FloatType& xmax = s1[ 3 ]; + const FloatType& ymin = s1[ 1 ]; + const FloatType& ymax = s2[ 0 ]; + const FloatType& zmin = s1[ 2 ]; + const FloatType& zmax = s2[ 1 ]; + + // TODO: in the future we should take `t` into account and organize + // candidate bins in a priority queue. + double t = 0.0; + return primal::detail::intersect_ray( + x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); + } + + template < typename RayType > + AXOM_HOST_DEVICE + static inline bool rayIntersectsRightBin( const RayType& r, + const vec4_t& s2, + const vec4_t& s3 ) noexcept + { + const FloatType& x0 = r[ 0 ]; + const FloatType& y0 = r[ 1 ]; + const FloatType& z0 = r[ 2 ]; + const FloatType& nx = r[ 3 ]; + const FloatType& ny = r[ 4 ]; + const FloatType& nz = r[ 5 ]; + + // extract right bin, see BVHData.hpp for the internal BVH layout + const FloatType& xmin = s2[ 2 ]; + const FloatType& xmax = s3[ 1 ]; + const FloatType& ymin = s2[ 3 ]; + const FloatType& ymax = s3[ 2 ]; + const FloatType& zmin = s3[ 0 ]; + const FloatType& zmax = s3[ 3 ]; + + // TODO: in the future we should take `t` into account and organize + // candidate bins in a priority queue. + double t = 0.0; + return primal::detail::intersect_ray( + x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); + } + }; } /* namespace linear_bvh */ From 3a73578e7b504582b98d50f064aca86d60a7f0af Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 4 Mar 2020 14:08:27 -0800 Subject: [PATCH 084/632] BUGFIX: use FloatType consistently --- src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index 2484e4b4b7..2d1581a4d2 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -185,7 +185,7 @@ class TraversalPredicates< DIMENSION_2, FloatType > // TODO: in the future we should take `t` into account and organize // candidate bins in a priority queue. - double t = 0.0; + FloatType t = 0.0; return primal::detail::intersect_ray( x0,nx,y0,ny,xmin,xmax,ymin,ymax,t ); } @@ -208,7 +208,7 @@ class TraversalPredicates< DIMENSION_2, FloatType > // TODO: in the future we should take `t` into account and organize // candidate bins in a priority queue. - double t = 0.0; + FloatType t = 0.0; return primal::detail::intersect_ray( x0,nx,y0,ny,xmin,xmax,ymin,ymax,t ); } @@ -289,7 +289,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > // TODO: in the future we should take `t` into account and organize // candidate bins in a priority queue. - double t = 0.0; + FloatType t = 0.0; return primal::detail::intersect_ray( x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); } @@ -317,7 +317,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > // TODO: in the future we should take `t` into account and organize // candidate bins in a priority queue. - double t = 0.0; + FloatType t = 0.0; return primal::detail::intersect_ray( x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); } From 440bb95d92087ed4ccb1319a7df27e5c3d43dfd6 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 4 Mar 2020 11:20:58 -0800 Subject: [PATCH 085/632] ENH: ray intersection traversal predicate tests Add basic tests for the ray intersection query traversal predicates. --- src/axom/spin/tests/spin_bvh.cpp | 93 ++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index e0ca012b4e..025d25ab77 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -18,6 +18,7 @@ #include "axom/spin/BVH.hpp" #include "axom/spin/UniformGrid.hpp" +#include "axom/spin/internal/linear_bvh/QueryAccessor.hpp" #include "axom/spin/internal/linear_bvh/TraversalPredicates.hpp" // axom/mint includes @@ -634,6 +635,98 @@ void check_single_box3d( ) // UNIT TESTS //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +TEST( spin_bvh, traversal_predicates_rayIntersectsLeftBin ) +{ + namespace bvh = axom::spin::internal::linear_bvh; + using TraversalPredicates2D = bvh::TraversalPredicates< 2, double >; + using TraversalPredicates3D = bvh::TraversalPredicates< 3, double >; + using VecType = bvh::Vec< double, 4 >; + using RayType = bvh::Vec< double, 6 >; + + VecType s1, s2; + s1[ 0 ] = 0.; // LeftBin.xmin + s1[ 1 ] = 0.; // LeftBin.ymin + s1[ 2 ] = 0.; // LeftBin.zmin + + s1[ 3 ] = 1.; // LeftBin.xmax + s2[ 0 ] = 1.; // LeftBin.ymax + s2[ 1 ] = 1.; // LeftBin.zmax + + RayType ray2d; + ray2d[ 0 ] = -1.0; + ray2d[ 1 ] = -1.0; + ray2d[ 2 ] = 1.0; + ray2d[ 3 ] = 1.0; + EXPECT_TRUE( TraversalPredicates2D::rayIntersectsLeftBin( ray2d, s1, s2 ) ); + + // flip normal + ray2d[ 2 ] = -1.0; + ray2d[ 3 ] = -1.0; + EXPECT_FALSE( TraversalPredicates2D::rayIntersectsLeftBin( ray2d, s1, s2 ) ); + + RayType ray3d; + ray3d[ 0 ] = -1.0; + ray3d[ 1 ] = -1.0; + ray3d[ 2 ] = -1.0; + ray3d[ 3 ] = 1.0; + ray3d[ 4 ] = 1.0; + ray3d[ 5 ] = 1.0; + EXPECT_TRUE( TraversalPredicates3D::rayIntersectsLeftBin( ray3d, s1, s2) ); + + // flip normal + ray3d[ 3 ] = -1.0; + ray3d[ 4 ] = -1.0; + ray3d[ 5 ] = -1.0; + EXPECT_FALSE( TraversalPredicates3D::rayIntersectsLeftBin( ray3d, s1, s2 ) ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, traversal_predicates_rayIntersectsRightBin ) +{ + namespace bvh = axom::spin::internal::linear_bvh; + using TraversalPredicates2D = bvh::TraversalPredicates< 2, double >; + using TraversalPredicates3D = bvh::TraversalPredicates< 3, double >; + using VecType = bvh::Vec< double, 4 >; + using RayType = bvh::Vec< double, 6 >; + + VecType s2, s3; + s2[ 2 ] = 0.; // RightBin.xmin + s2[ 3 ] = 0.; // RightBin.ymin + s3[ 0 ] = 0.; // RightBin.zmin + + s3[ 1 ] = 1.; // RightBin.xmax + s3[ 2 ] = 1.; // RightBin.ymax + s3[ 3 ] = 1.; // RightBin.zmax + + RayType ray2d; + ray2d[ 0 ] = -1.0; + ray2d[ 1 ] = -1.0; + ray2d[ 2 ] = 1.0; + ray2d[ 3 ] = 1.0; + EXPECT_TRUE( TraversalPredicates2D::rayIntersectsRightBin( ray2d, s2, s3 ) ); + + // flip normal + ray2d[ 2 ] = -1.0; + ray2d[ 3 ] = -1.0; + EXPECT_FALSE( TraversalPredicates2D::rayIntersectsRightBin( ray2d, s2, s3 ) ); + + RayType ray3d; + ray3d[ 0 ] = -1.0; + ray3d[ 1 ] = -1.0; + ray3d[ 2 ] = -1.0; + ray3d[ 3 ] = 1.0; + ray3d[ 4 ] = 1.0; + ray3d[ 5 ] = 1.0; + EXPECT_TRUE( TraversalPredicates3D::rayIntersectsRightBin( ray3d, s2, s3) ); + + // flip normal + ray3d[ 3 ] = -1.0; + ray3d[ 4 ] = -1.0; + ray3d[ 5 ] = -1.0; + EXPECT_FALSE( TraversalPredicates3D::rayIntersectsRightBin( ray3d, s2, s3 ) ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, traversal_predicates_pointInLeftBin ) { From 67cec3662d7b675f4403e15d5a57d686289e4873 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 2 Mar 2020 16:02:58 -0800 Subject: [PATCH 086/632] ENH: add QueryAccessor::getRay method --- .../internal/linear_bvh/QueryAccessor.hpp | 74 ++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index f160ca6679..e6a1dc651d 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -42,7 +42,7 @@ class QueryAccessor AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used, e.g., double or float" ); - /// \name Query Point Access methods + /// \name Point Query Access Methods /// @{ /*! @@ -68,6 +68,40 @@ class QueryAccessor const FloatType* z ); /// @} + + /// \name Ray Query Access Methods + /// @{ + + /*! + * \brief Gets the ray defined by a source point and normal direction. + * + * \param [out] ray the ray where to pack the source point and normal. + * \param [in] idx the index of the ray w.r.t. the supplied arrays. + * \param [in] x0 array of the x-coordinate source point locations. + * \param [in] nx array of x-components of the ray normal directions. + * \param [in] y0 array of the y-coordinate source point locations. + * \param [in] ny array of y-components of the ray normal directions. + * \param [in] z0 array of of the z-coorindate source point locations. + * \param [in] nz array of z-components of the ray normal directions. + * + * \tparam RayType the data-structure to hold a ray. + * + * \note The RayType must overload the `[]` operator for accessing the + * ray source point coordinates and normal direction information, such that, + * the first NDIMS locations store the source points coordinates followed + * by the normal direction. + */ + template < typename RayType > + AXOM_HOST_DEVICE + static inline void getRay( RayType& ray, + IndexType idx, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* z0, + const FloatType* nz ); + /// @} }; //------------------------------------------------------------------------------ @@ -90,6 +124,24 @@ class QueryAccessor< 2, FloatType > point[ 1 ] = y[ idx ]; } + template < typename RayType > + AXOM_HOST_DEVICE + static inline void getRay( RayType& ray, + IndexType idx, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* AXOM_NOT_USED(z0), + const FloatType* AXOM_NOT_USED(nz) ) + { + ray[ 0 ] = x0[ idx ]; + ray[ 1 ] = y0[ idx ]; + + ray[ 2 ] = nx[ idx ]; + ray[ 3 ] = ny[ idx ]; + } + }; //------------------------------------------------------------------------------ @@ -113,6 +165,26 @@ class QueryAccessor< 3, FloatType > point[ 2 ] = z[ idx ]; } + template < typename RayType > + AXOM_HOST_DEVICE + static inline void getRay( RayType& ray, + IndexType idx, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* z0, + const FloatType* nz ) + { + ray[ 0 ] = x0[ idx ]; + ray[ 1 ] = y0[ idx ]; + ray[ 2 ] = z0[ idx ]; + + ray[ 2 ] = nx[ idx ]; + ray[ 3 ] = ny[ idx ]; + ray[ 4 ] = nz[ idx ]; + } + }; From f788af9ebde7dd79a87078b3effd4f0b0f2a81e6 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 29 Feb 2020 17:21:17 -0800 Subject: [PATCH 087/632] ENH: add BVH::findRays() method --- src/axom/spin/BVH.hpp | 49 ++++- .../spin/internal/linear_bvh/BVH_impl.hpp | 194 +++++++++++++++++- 2 files changed, 229 insertions(+), 14 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 86e379a343..595db80bc5 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -200,8 +200,7 @@ class BVH void getBounds( FloatType* min, FloatType* max ) const; /*! - * \brief Finds the candidate geometric entities that contain each of the - * given query points. + * \brief Finds the candidate bins that contain each of the query points. * * \param [out] offsets offset to the candidates array for each query point * \param [out] counts stores the number of candidates per query point @@ -212,7 +211,7 @@ class BVH * \param [in] z array of z-coordinates, may be nullptr if 2D * * \note offsets and counts are pointers to arrays of size numPts that are - * pre-allocated by the caller before calling find(). + * pre-allocated by the caller before calling findPoints(). * * \note The candidates array is allocated internally by the method and * ownership of the memory is transferred to the caller. Consequently, the @@ -236,6 +235,48 @@ class BVH const FloatType* y, const FloatType* z=nullptr ) const; + /*! + * \brief Finds the candidate bins that intersect the given rays. + * + * \param [out] offsets offset to the candidates array for each ray + * \param [out] counts stores the number of candidates for each ray + * \param [out] candidates array of candidate IDs for each ray + * \param [in] numRays the total number of rays + * \param [in] x0 array consisting the ray source point x-coordinates. + * \param [in] nx array consisting the ray normal x-components. + * \param [in] y0 array consisting the ray source point y-coordinates + * \param [in] ny array consisting the ray normal y-components + * \param [in] z0 array consisting the ray source point z-coorindates (in 3D) + * \param [in] nz array consisting the ray normal z-components (in 3D) + * + * \note offsets and counts are arrays of size numRays that are pre-allocated + * by the caller, prior to the calling findRays(). + * + * \note After the call to findRays(), the ith ray has: + * * counts[ i ] candidates + * * candidates stored in [ offsets[ i ], offsets[i]+counts[i] ] + * + * \pre offsets != nullptr + * \pre counts != nullptr + * \pre candidates == nullptr + * \pre x0 != nullptr + * \pre nx != nullptr + * \pre y0 != nullptr + * \pre ny != nullptr + * \pre z0 != nullptr if dimension==3 + * \pre nz != nullptr if dimension==3 + */ + void findRays( IndexType* offsets, + IndexType* counts, + IndexType*& candidates, + IndexType numRays, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* z0=nullptr, + const FloatType* nz=nullptr ) const; + /*! * \brief Writes the BVH to the specified VTK file for visualization. * \param [in] fileName the name of VTK file. @@ -265,4 +306,4 @@ class BVH #include "axom/spin/internal/linear_bvh/BVH_impl.hpp" -#endif /* AXOM_PRIMAL_BVH_H_ */ +#endif /* AXOM_SPIN_BVH_H_ */ diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index dc82f05171..e27b46f46d 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -55,6 +55,9 @@ using vec4_t = internal::linear_bvh::Vec< FloatType, 4 >; template < typename FloatType, int NDIMS > using point_t = internal::linear_bvh::Vec< FloatType, NDIMS >; +template < typename FloatType, int NDIMS > +using ray_t = internal::linear_bvh::Vec< FloatType, NDIMS*2 >; + /*! * \def BVH_PREDICATE * @@ -110,16 +113,15 @@ template < int NDIMS, typename ExecSpace, typename LeftPredicate, typename RightPredicate, typename FloatType > -IndexType bvh_get_counts( - LeftPredicate&& leftCheck, - RightPredicate&& rightCheck, - const vec4_t< FloatType >* inner_nodes, - const int32* leaf_nodes, - IndexType N, - IndexType* counts, - const FloatType* x, - const FloatType* y, - const FloatType* z ) noexcept +IndexType bvh_get_counts( LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + const vec4_t< FloatType >* inner_nodes, + const int32* leaf_nodes, + IndexType N, + IndexType* counts, + const FloatType* x, + const FloatType* y, + const FloatType* z ) noexcept { // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -163,6 +165,87 @@ IndexType bvh_get_counts( return ( total_count.get() ); } +/*! + * \brief Performs a traversal to count the number of candidates for each ray. + * + * \param [in] leftCheck traversal predicate functor for left bin check. + * \param [in] rightCheck traversal predicate functor for right bin check. + * \param [in] inner_nodes array of vec4s for the BVH inner nodes. + * \param [in] leaf_nodes array of BVH leaf node indices + * \param [in] N the number of user-supplied rays in query. + * \param [out] counts array of length N with candidate counts for each ray. + * \param [in] x0 array of length N with ray source point x-coordinates. + * \param [in] nx array of length N with ray normal x-components. + * \param [in] y0 array of length N with ray source point y-coordinates. + * \param [in] ny array of length N with ray normal y-components. + * \param [in] z0 array of length N with ray source point z-coordinates. + * \param [in] nz array of length N with ray normal z-components. + * + * \return total_count the aggregate number of candidates for all rays. + */ +template < int NDIMS, typename ExecSpace, + typename LeftPredicate, + typename RightPredicate, + typename FloatType > +IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + const vec4_t< FloatType >* inner_nodes, + const int32* leaf_nodes, + IndexType N, + IndexType* counts, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* z0, + const FloatType* nz ) noexcept +{ + // sanity checks + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); + SLIC_ERROR_IF( x0 == nullptr, "ray source x-coordinates array is null!" ); + SLIC_ERROR_IF( nx == nullptr, "ray normal x-components array is null!" ); + SLIC_ERROR_IF( y0 == nullptr, "ray source y-coordinates array is null!" ); + SLIC_ERROR_IF( ny == nullptr, "ray normal y-components array is null!" ); + SLIC_ERROR_IF( (z0==nullptr && NDIMS==3), + "ray source z-coordinates array is null!" ); + SLIC_ERROR_IF( (nz==nullptr && NDIMS==3), + "ray normal z-components is null!" ); + + // STEP 1: count number of candidates for each query point + using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; + RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); + + using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; + for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) + { + int32 count = 0; + ray_t< FloatType, NDIMS > ray; + QueryAccessor::getRay( ray, i, x0, nx, y0, ny, z0, nz ); + + + BVH_LEAF_ACTION( leafAction, + int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) { + count ++; + }; + + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + ray, + leftCheck, + rightCheck, + leafAction ); + + counts[ i ] = count; + total_count += count; + + } ); + + return ( total_count.get() ); +} + } /* end anonymous namespace */ //------------------------------------------------------------------------------ @@ -341,6 +424,97 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, axom::setDefaultAllocator( currentAllocatorID ); } +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, + IndexType* counts, + IndexType*& candidates, + IndexType numRays, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* z0, + const FloatType* nz ) const +{ + SLIC_ASSERT( offsets != nullptr ); + SLIC_ASSERT( counts != nullptr ); + SLIC_ASSERT( candidates == nullptr ); + SLIC_ASSERT( x0 != nullptr ); + SLIC_ASSERT( nx != nullptr ); + SLIC_ASSERT( y0 != nullptr ); + SLIC_ASSERT( ny != nullptr ); + + // STEP 0: set the default memory allocator to use for the execution space. + const int currentAllocatorID = axom::getDefaultAllocatorID(); + const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + axom::setDefaultAllocator( allocatorID ); + + using RayType = ray_t< FloatType, NDIMS >; + using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; + using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; + + // STEP 1: count number of candidates for each query point + const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; + const int32* leaf_nodes = m_bvh.m_leaf_nodes; + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + + // STEP 2: define traversal predicates + BVH_PREDICATE( leftPredicate, + const RayType &r, + const vec4_t< FloatType >&s1, + const vec4_t< FloatType >&s2 ) + { + return TraversalPredicates::rayIntersectsLeftBin( r, s1, s2 ); + }; + + BVH_PREDICATE( rightPredicate, + const RayType &r, + const vec4_t< FloatType >&s2, + const vec4_t< FloatType >&s3 ) + { + return TraversalPredicates::rayIntersectsRightBin( r, s2, s3 ); + }; + + // STEP 3: get counts + int total_count = bvh_get_raycounts< NDIMS,ExecSpace >( + leftPredicate, rightPredicate, inner_nodes, leaf_nodes, + numRays, counts, x0, nx, y0, ny, z0, nz ); + + using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; + RAJA::exclusive_scan< exec_policy >( + counts, counts+numRays, offsets, RAJA::operators::plus{} ); + + IndexType total_candidates = static_cast< IndexType >( total_count ); + candidates = axom::allocate< IndexType >( total_candidates); + + // STEP 4: fill in candidates for each point + for_all< ExecSpace >( numRays, AXOM_LAMBDA (IndexType i) + { + int32 offset = offsets[ i ]; + + RayType ray; + QueryAccessor::getRay( ray, i, x0, nx, y0, ny, z0, nz ); + + BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; + + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + ray, + leftPredicate, + rightPredicate, + leafAction ); + + } ); + + // STEP 3: restore default allocator + axom::setDefaultAllocator( currentAllocatorID ); +} + //------------------------------------------------------------------------------ template < int NDIMS, typename ExecSpace, typename FloatType > void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( From 5884e3ff5748d3b612324a86359fe3779da4a57d Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 4 Mar 2020 11:38:40 -0800 Subject: [PATCH 088/632] ENH: rename BVH find tests to find_points Rename the BVH find test to find_points for clarity. --- src/axom/spin/tests/spin_bvh.cpp | 41 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 025d25ab77..018c9e2a26 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -313,7 +313,7 @@ void check_build_bvh3d( ) * */ template < typename ExecSpace, typename FloatType > -void check_find3d( ) +void check_find_points3d( ) { constexpr int NDIMS = 3; constexpr IndexType N = 4; @@ -411,7 +411,7 @@ void check_find3d( ) * */ template < typename ExecSpace, typename FloatType > -void check_find2d( ) +void check_find_points2d( ) { constexpr int NDIMS = 2; constexpr IndexType N = 4; @@ -798,17 +798,17 @@ TEST( spin_bvh, contruct3D_sequential ) } //------------------------------------------------------------------------------ -TEST( spin_bvh, find_3d_sequential ) +TEST( spin_bvh, find_points_3d_sequential ) { - check_find3d< axom::SEQ_EXEC, float >( ); - check_find3d< axom::SEQ_EXEC, double >( ); + check_find_points3d< axom::SEQ_EXEC, float >( ); + check_find_points3d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ -TEST( spin_bvh, find_2d_sequential ) +TEST( spin_bvh, find_points_2d_sequential ) { - check_find2d< axom::SEQ_EXEC, float >( ); - check_find2d< axom::SEQ_EXEC, double >( ); + check_find_points2d< axom::SEQ_EXEC, float >( ); + check_find_points2d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ @@ -842,17 +842,17 @@ TEST( spin_bvh, contruct3D_omp ) } //------------------------------------------------------------------------------ -TEST( spin_bvh, find_3d_omp ) +TEST( spin_bvh, find_points_3d_omp ) { - check_find3d< axom::OMP_EXEC, float >( ); - check_find3d< axom::OMP_EXEC, double >( ); + check_find_points3d< axom::OMP_EXEC, float >( ); + check_find_points3d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ -TEST( spin_bvh, find_2d_omp ) +TEST( spin_bvh, find_points_2d_omp ) { - check_find2d< axom::OMP_EXEC, float >( ); - check_find2d< axom::OMP_EXEC, double >( ); + check_find_points2d< axom::OMP_EXEC, float >( ); + check_find_points2d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ @@ -894,23 +894,23 @@ AXOM_CUDA_TEST( spin_bvh, contruct3D_cuda ) } //------------------------------------------------------------------------------ -AXOM_CUDA_TEST( spin_bvh, find_3d_cuda ) +AXOM_CUDA_TEST( spin_bvh, find_points_3d_cuda ) { constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_find3d< exec, float >( ); - check_find3d< exec, double >( ); + check_find_points3d< exec, float >( ); + check_find_points3d< exec, double >( ); } //------------------------------------------------------------------------------ -AXOM_CUDA_TEST( spin_bvh, find_2d_cuda ) +AXOM_CUDA_TEST( spin_bvh, find_points_2d_cuda ) { constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_find2d< exec, float >( ); - check_find2d< exec, double >( ); + check_find_points2d< exec, float >( ); + check_find_points2d< exec, double >( ); } //------------------------------------------------------------------------------ @@ -933,7 +933,6 @@ AXOM_CUDA_TEST( spin_bvh, single_box3d_cuda ) check_single_box3d< exec, double >( ); } - #endif //------------------------------------------------------------------------------ From ccb3fbe1557e4957a116e12625fd14792d274490 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 4 Mar 2020 12:49:29 -0800 Subject: [PATCH 089/632] ENH: add tests for BVH::findRays() --- src/axom/spin/tests/spin_bvh.cpp | 478 ++++++++++++++++++++++++++++++- 1 file changed, 477 insertions(+), 1 deletion(-) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 018c9e2a26..b83e0a1b2b 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -31,7 +31,10 @@ #include "gtest/gtest.h" using namespace axom; -namespace xargs = mint::xargs; +namespace xargs = mint::xargs; + +// Uncomment the following for debugging +//#define VTK_DEBUG //------------------------------------------------------------------------------ // HELPER METHODS @@ -39,6 +42,183 @@ namespace xargs = mint::xargs; namespace { +//------------------------------------------------------------------------------ +template < typename FloatType > +void dump_ray( const std::string& file, + FloatType t, + FloatType x0, + FloatType nx, + FloatType y0, + FloatType ny, + FloatType z0=0.0, + FloatType nz=0.0 ) +{ + std::ofstream ofs( file.c_str() ); + + ofs << "# vtk DataFile Version 3.0\n"; + ofs << "Ray Data\n"; + ofs << "ASCII\n"; + ofs << "DATASET UNSTRUCTURED_GRID\n"; + + ofs << "POINTS 2 double\n"; + ofs << x0 << " " << y0 << " " << z0 << std::endl; + + ofs << (x0 + t*nx) << " "; + ofs << (y0 + t*ny) << " "; + ofs << (z0 + t*nz) << std::endl; + + ofs << "CELLS 1 3\n"; + ofs << "2 0 1\n"; + + ofs << "CELL_TYPES 1\n"; + ofs << "3\n"; + + ofs << "CELL_DATA 1\n"; + ofs << "VECTORS normal double\n"; + ofs << nx << " " << ny << " " << nz << std::endl; + + ofs.close(); +} + +//------------------------------------------------------------------------------ + +/*! + * \brief Give a 2D mesh object, this method generates an array of axis-aligned + * bounding boxes corresponding to each constituent cell of the mesh and + * a corresponding centroid. + * + * \param [in] mesh pointer to the mesh object. + * \param [out] aabbs flat array of bounding boxes [xmin,ymin,xmax,ymax....] + * + * \note The intent of this method is to generate synthetic input test data + * to test the functionality of the BVH. + * + * \warning This method allocates aabbs internally. The caller is responsible + * for properly deallocating aabbs. + * + * \pre aabbs == nullptr + * \post aabbs != nullptr + */ +template < typename FloatType > +void generate_aabbs2d( const mint::Mesh* mesh, FloatType*& aabbs ) +{ + // sanity checks + EXPECT_TRUE( aabbs == nullptr ); + + // calculate some constants + constexpr int ndims = 2; + constexpr int stride = 2 * ndims; + + EXPECT_EQ( ndims, mesh->getDimension() ); + + // allocate output arrays + const IndexType ncells = mesh->getNumberOfCells(); + aabbs = axom::allocate< FloatType >( ncells * stride ); + + using exec_policy = axom::SEQ_EXEC; + mint::for_all_cells< exec_policy, xargs::coords >( + mesh, AXOM_LAMBDA( IndexType cellIdx, + numerics::Matrix< double >& coords, + const IndexType* AXOM_NOT_USED(nodeIds) ) + { + + spin::internal::linear_bvh::Range< double > xrange; + spin::internal::linear_bvh::Range< double > yrange; + + for ( IndexType inode=0; inode < 4; ++inode ) + { + const double* node = coords.getColumn( inode ); + + xrange.include( node[ mint::X_COORDINATE ] ); + yrange.include( node[ mint::Y_COORDINATE ] ); + } // END for all cells nodes + + const IndexType offset = cellIdx * stride ; + aabbs[ offset ] = xrange.min(); + aabbs[ offset + 1 ] = yrange.min(); + aabbs[ offset + 2 ] = xrange.max(); + aabbs[ offset + 3 ] = yrange.max(); + + } ); + + // post-condition sanity checks + EXPECT_TRUE( aabbs != nullptr ); + +} + +//------------------------------------------------------------------------------ + +/*! + * \brief Give a 3D mesh object, this method generates an array of axis-aligned + * bounding boxes (AABBS) corresponding to each constituent cell of the mesh + * and a corresponding centroid. + * + * \param [in] mesh pointer to the mesh object. + * \param [out] aabbs flat array of AABBS [xmin,ymin,zmin,xmax,ymax,zmax....] + * + * \note The intent of this method is to generate synthetic input test data + * to test the functionality of the BVH. + * + * \warning This method allocates aabbs internally. The caller is responsible + * for properly deallocating aabbs. + * + * \pre aabbs == nullptr + * \pre xc != nullptr + * \pre yc != nullptr + * \pre zc != nullptr + * + * \post aabbs != nullptr + */ +template < typename FloatType > +void generate_aabbs3d( const mint::Mesh* mesh, FloatType*& aabbs ) +{ + // sanity checks + EXPECT_TRUE( aabbs == nullptr ); + + // calculate some constants + constexpr int ndims = 3; + constexpr int stride = 2 * ndims; + + EXPECT_EQ( ndims, mesh->getDimension() ); + + // allocate output arrays + const IndexType ncells = mesh->getNumberOfCells(); + aabbs = axom::allocate< FloatType >( ncells * stride ); + + using exec_policy = axom::SEQ_EXEC; + mint::for_all_cells< exec_policy, xargs::coords >( + mesh, AXOM_LAMBDA( IndexType cellIdx, + numerics::Matrix< double >& coords, + const IndexType* AXOM_NOT_USED(nodeIds) ) + { + + spin::internal::linear_bvh::Range< double > xrange; + spin::internal::linear_bvh::Range< double > yrange; + spin::internal::linear_bvh::Range< double > zrange; + + for ( IndexType inode=0; inode < 8; ++inode ) + { + const double* node = coords.getColumn( inode ); + + xrange.include( node[ mint::X_COORDINATE ] ); + yrange.include( node[ mint::Y_COORDINATE ] ); + zrange.include( node[ mint::Z_COORDINATE ] ); + } // END for all cells nodes + + const IndexType offset = cellIdx * stride ; + aabbs[ offset ] = xrange.min(); + aabbs[ offset + 1 ] = yrange.min(); + aabbs[ offset + 2 ] = zrange.min(); + aabbs[ offset + 3 ] = xrange.max(); + aabbs[ offset + 4 ] = yrange.max(); + aabbs[ offset + 5 ] = zrange.max(); + + } ); + + // post-condition sanity checks + EXPECT_TRUE( aabbs != nullptr ); +} + //------------------------------------------------------------------------------ /*! @@ -296,6 +476,254 @@ void check_build_bvh3d( ) axom::setDefaultAllocator( current_allocator ); } +//------------------------------------------------------------------------------ +template < typename ExecSpace, typename FloatType > +void check_find_rays3d() +{ + constexpr int NDIMS = 3; + constexpr IndexType N = 2; + + const int current_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( axom::execution_space< ExecSpace >::allocatorID()); + + // setup query rays: both rays are source at (-1.0,-1.0) but point in + // opposite directions. The first ray is setup such that it intersects + // three bounding boxes of the mesh. + FloatType* x0 = axom::allocate< FloatType >( N ); + FloatType* y0 = axom::allocate< FloatType >( N ); + FloatType* z0 = axom::allocate< FloatType >( N ); + x0[ 0 ] = x0[ 1 ] = y0[ 0 ] = y0[ 1 ] = z0[ 0 ] = z0[ 1 ] = -1.0; + + FloatType* nx = axom::allocate< FloatType >( N ); + FloatType* ny = axom::allocate< FloatType >( N ); + FloatType* nz = axom::allocate< FloatType >( N ); + nx[ 0 ] = ny[ 0 ] = nz[ 0 ] = 1.0; + nx[ 1 ] = ny[ 1 ] = nz[ 1 ] = -1.0; + +#ifdef VTK_DEBUG + FloatType t = 5.0; + dump_ray( "ray0.vtk", t, x0[0], nx[0], y0[0], ny[0], z0[0], nz[0] ); + dump_ray( "ray1.vtk", t, x0[1], nx[1], y0[1], ny[1], z0[1], nz[1] ); +#endif + + // setup a test mesh + double lo[ NDIMS ] = { 0.0, 0.0, 0.0 }; + double hi[ NDIMS ] = { 3.0, 3.0, 3.0 }; + mint::UniformMesh mesh( lo, hi, 4, 4, 4 ); + const IndexType ncells = mesh.getNumberOfCells(); + FloatType* aabbs = nullptr; + generate_aabbs3d( &mesh, aabbs ); + EXPECT_TRUE( aabbs != nullptr ); + + // construct the BVH + spin::BVH< NDIMS, ExecSpace, FloatType > bvh( aabbs, ncells ); + bvh.setScaleFactor( 1.0 ); // i.e., no scaling + bvh.build( ); + + // check BVH bounding box + FloatType min[ NDIMS ]; + FloatType max[ NDIMS ]; + bvh.getBounds( min, max ); + for ( int i=0 ; i < NDIMS ; ++i ) + { + EXPECT_DOUBLE_EQ( min[ i ], lo[ i ] ); + EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); + } + + // traverse the BVH to find the candidates for all the centroids + IndexType* offsets = axom::allocate< IndexType >( N ); + IndexType* counts = axom::allocate< IndexType >( N ); + IndexType* candidates = nullptr; + bvh.findRays( offsets, counts, candidates, N, x0, nx, y0, ny, z0, nz ); + EXPECT_TRUE( candidates != nullptr ); + + // flag cells that are found by the ray ID + int* iblank = mesh.createField< int >( "iblank", mint::CELL_CENTERED ); + mint::for_all_cells< ExecSpace >( &mesh, AXOM_LAMBDA(IndexType cellIdx) + { + iblank[ cellIdx ] = -1; + } ); + + for ( int i=0; i < N; ++i ) + { + IndexType ncounts = counts[ i ]; + IndexType offset = offsets[ i ]; + for ( int j=0; j < ncounts; ++j ) + { + IndexType idx = candidates[ offset + j ]; + iblank[ idx ] = i; + } // END for all cells the ray hits + } // END for all rays + +#ifdef VTK_DEBUG + mint::write_vtk( &mesh, "uniform_mesh.vtk" ); +#endif + + // check answer with results verified manually by inspection + constexpr int INTERSECTS_RAY = 0; + constexpr int DOES_NOT_INTERSECT_RAY = -1; + constexpr int EXPECTED_RAY1_INTERSECTIONS = 14; + EXPECT_EQ( counts[ 0 ], EXPECTED_RAY1_INTERSECTIONS ); + EXPECT_EQ( counts[ 1 ], 0 ); + + for ( IndexType i=0; i < ncells; ++i ) + { + switch( i ) + { + case 0: + case 1: + case 3: + case 4: + case 5: + case 7: + case 8: + case 9: + case 10: + case 12: + case 13: + case 14: + case 16: + case 17: + EXPECT_EQ( iblank[ i ], INTERSECTS_RAY ); + break; + default: + EXPECT_EQ( iblank[ i ], DOES_NOT_INTERSECT_RAY ); + } + } // END for all mesh cells + + // deallocate + axom::deallocate( offsets ); + axom::deallocate( candidates ); + axom::deallocate( counts ); + axom::deallocate( aabbs ); + + axom::deallocate( x0 ); + axom::deallocate( nx ); + axom::deallocate( y0 ); + axom::deallocate( ny ); + axom::deallocate( z0 ); + axom::deallocate( nz ); + + axom::setDefaultAllocator( current_allocator ); +} + +//------------------------------------------------------------------------------ + +template < typename ExecSpace, typename FloatType > +void check_find_rays2d() +{ + constexpr int NDIMS = 2; + constexpr IndexType N = 2; + + const int current_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( axom::execution_space< ExecSpace >::allocatorID()); + + // setup query rays: both rays are source at (-1.0,-1.0) but point in + // opposite directions. The first ray is setup such that it intersects + // three bounding boxes of the mesh. + FloatType* x0 = axom::allocate< FloatType >( N ); + FloatType* y0 = axom::allocate< FloatType >( N ); + x0[ 0 ] = x0[ 1 ] = y0[ 0 ] = y0[ 1 ] = -1.0; + + FloatType* nx = axom::allocate< FloatType >( N ); + FloatType* ny = axom::allocate< FloatType >( N ); + nx[ 0 ] = ny[ 0 ] = 1.0; + nx[ 1 ] = ny[ 1 ] = -1.0; + +#ifdef VTK_DEBUG + FloatType t = 5.0; + dump_ray( "ray0.vtk", t, x0[0], nx[0], y0[0], ny[0] ); + dump_ray( "ray1.vtk", t, x0[1], nx[1], y0[1], ny[1] ); +#endif + + // setup a test mesh + double lo[ NDIMS ] = { 0.0, 0.0 }; + double hi[ NDIMS ] = { 3.0, 3.0 }; + mint::UniformMesh mesh( lo, hi, 4, 4 ); + const IndexType ncells = mesh.getNumberOfCells(); + FloatType* aabbs = nullptr; + generate_aabbs2d( &mesh, aabbs ); + EXPECT_TRUE( aabbs != nullptr ); + + // construct the BVH + spin::BVH< NDIMS, ExecSpace, FloatType > bvh( aabbs, ncells ); + bvh.setScaleFactor( 1.0 ); // i.e., no scaling + bvh.build( ); + + // check BVH bounding box + FloatType min[ NDIMS ]; + FloatType max[ NDIMS ]; + bvh.getBounds( min, max ); + for ( int i=0 ; i < NDIMS ; ++i ) + { + EXPECT_DOUBLE_EQ( min[ i ], lo[ i ] ); + EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); + } + + // traverse the BVH to find the candidates for all the centroids + IndexType* offsets = axom::allocate< IndexType >( N ); + IndexType* counts = axom::allocate< IndexType >( N ); + IndexType* candidates = nullptr; + bvh.findRays( offsets, counts, candidates, N, x0, nx, y0, ny ); + EXPECT_TRUE( candidates != nullptr ); + + // flag cells that are found by the ray ID + int* iblank = mesh.createField< int >( "iblank", mint::CELL_CENTERED ); + mint::for_all_cells< ExecSpace >( &mesh, AXOM_LAMBDA(IndexType cellIdx) + { + iblank[ cellIdx ] = -1; + } ); + + for ( int i=0; i < N; ++i ) + { + IndexType ncounts = counts[ i ]; + IndexType offset = offsets[ i ]; + for ( int j=0; j < ncounts; ++j ) + { + IndexType idx = candidates[ offset + j ]; + iblank[ idx ] = i; + } // END for all cells the ray hits + } // END for all rays + +#ifdef VTK_DEBUG + mint::write_vtk( &mesh, "uniform_mesh.vtk" ); +#endif + + // check answer with results verified manually by inspection + constexpr int INTERSECTS_RAY = 0; + constexpr int DOES_NOT_INTERSECT_RAY = -1; + constexpr int EXPECTED_RAY1_INTERSECTIONS = 7; + EXPECT_EQ( counts[ 0 ], EXPECTED_RAY1_INTERSECTIONS ); + EXPECT_EQ( counts[ 1 ], 0 ); + + for ( IndexType i=0; i < ncells; ++i ) + { + + if ( i==2 || i==6 ) + { + EXPECT_EQ( iblank[ i ], DOES_NOT_INTERSECT_RAY ); + } + else + { + EXPECT_EQ( iblank[ i ], INTERSECTS_RAY ); + } + + } // END for all mesh cells + + // deallocate + axom::deallocate( offsets ); + axom::deallocate( candidates ); + axom::deallocate( counts ); + axom::deallocate( aabbs ); + + axom::deallocate( x0 ); + axom::deallocate( nx ); + axom::deallocate( y0 ); + axom::deallocate( ny ); + + axom::setDefaultAllocator( current_allocator ); +} + //------------------------------------------------------------------------------ /*! @@ -797,6 +1225,20 @@ TEST( spin_bvh, contruct3D_sequential ) check_build_bvh3d< axom::SEQ_EXEC, double >( ); } +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_rays_3d_sequential ) +{ + check_find_rays3d< axom::SEQ_EXEC, float >( ); + check_find_rays3d< axom::SEQ_EXEC, double >( ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_rays_2d_sequential ) +{ + check_find_rays2d< axom::SEQ_EXEC, float >( ); + check_find_rays2d< axom::SEQ_EXEC, double >( ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_3d_sequential ) { @@ -841,6 +1283,20 @@ TEST( spin_bvh, contruct3D_omp ) check_build_bvh3d< axom::OMP_EXEC, double >( ); } +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_rays_3d_omp ) +{ + check_find_rays3d< axom::OMP_EXEC, float >( ); + check_find_rays3d< axom::OMP_EXEC, double >( ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_rays_2d_omp ) +{ + check_find_rays2d< axom::OMP_EXEC, float >( ); + check_find_rays2d< axom::OMP_EXEC, double >( ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_3d_omp ) { @@ -893,6 +1349,26 @@ AXOM_CUDA_TEST( spin_bvh, contruct3D_cuda ) check_build_bvh3d< exec, double >( ); } +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_rays_3d_cuda ) +{ + constexpr int BLOCK_SIZE = 256; + using exec = axom::CUDA_EXEC< BLOCK_SIZE >; + + check_find_rays3d< exec, float >( ); + check_find_rays3d< exec, double >( ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_rays_2d_cuda ) +{ + constexpr int BLOCK_SIZE = 256; + using exec = axom::CUDA_EXEC< BLOCK_SIZE >; + + check_find_rays2d< exec, float >( ); + check_find_rays2d< exec, double >( ); +} + //------------------------------------------------------------------------------ AXOM_CUDA_TEST( spin_bvh, find_points_3d_cuda ) { From 684bbcf5742dfc55fbbac87bf2a2bc1593671da9 Mon Sep 17 00:00:00 2001 From: uncrustify-robot Date: Wed, 4 Mar 2020 17:26:22 -0800 Subject: [PATCH 090/632] STYLE: uncrustify primal --- .../primal/tests/primal_ray_intersect.cpp | 39 +++++++++---------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/axom/primal/tests/primal_ray_intersect.cpp b/src/axom/primal/tests/primal_ray_intersect.cpp index 1ad6abb105..8c45685e0e 100644 --- a/src/axom/primal/tests/primal_ray_intersect.cpp +++ b/src/axom/primal/tests/primal_ray_intersect.cpp @@ -38,7 +38,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) { const double n0[] = { 0.0, 1.0 }; const double y0 = -1.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { double tmin = 0.0; double tmax = 0.0; @@ -56,7 +56,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) { const double n0[] = { -1.0, 0.0 }; const double x0 = 2.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { double tmin = 0.0; double tmax = 0.0; @@ -74,7 +74,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) { const double n0[] = { 0.0, -1.0 }; const double y0 = 2.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { double tmin = 0.0; double tmax = 0.0; @@ -92,7 +92,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) { const double n0[] = { 1.0, 0.0 }; const double x0 = -1.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { double tmin = 0.0; double tmax = 0.0; @@ -116,7 +116,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_2D ) constexpr double PI_OVER_180 = M_PI / 180.0; const double xc[] = { 0.5, 0.5 }; const double e1[] = { 1.0, 0.0 }; - for( int i=0; i < NUM_ANGLES; ++i ) + for( int i=0 ; i < NUM_ANGLES ; ++i ) { const double t = angles[ i ] * PI_OVER_180; const double cost = cos( t ); @@ -162,9 +162,9 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double n0[] = { 0.0, 0.0, 1.0 }; const double z0 = -1.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { - for ( int j=0; j < N; ++j ) + for ( int j=0 ; j < N ; ++j ) { double tmin = 0.0; double tmax = 0.0; @@ -188,9 +188,9 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double n0[] = { 0.0, 0.0, -1.0 }; const double z0 = 2.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { - for ( int j=0; j < N; ++j ) + for ( int j=0 ; j < N ; ++j ) { double tmin = 0.0; double tmax = 0.0; @@ -214,9 +214,9 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double n0[] = { 0.0, 1.0, 0.0 }; const double y0 = -1.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { - for ( int j=0; j < N; ++j ) + for ( int j=0 ; j < N ; ++j ) { double tmin = 0.0; double tmax = 0.0; @@ -240,9 +240,9 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double n0[] = { 0.0, -1.0, 0.0 }; const double y0 = 2.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { - for ( int j=0; j < N; ++j ) + for ( int j=0 ; j < N ; ++j ) { double tmin = 0.0; double tmax = 0.0; @@ -266,9 +266,9 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double n0[] = { 1.0, 0.0, 0.0 }; const double x0 = -1.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { - for ( int j=0; j < N; ++j ) + for ( int j=0 ; j < N ; ++j ) { double tmin = 0.0; double tmax = 0.0; @@ -292,9 +292,9 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double n0[] = { -1.0, 0.0, 0.0 }; const double x0 = 2.0f; - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { - for ( int j=0; j < N; ++j ) + for ( int j=0 ; j < N ; ++j ) { double tmin = 0.0; double tmax = 0.0; @@ -327,7 +327,7 @@ TEST( primal_ray_intersect, ray_aabb_intersection_3D ) const double e2[] = { 0.0, 1.0, 0.0 }; const double e3[] = { 0.0, 0.0, 1.0 }; double n[3]; - for( int i=0; i < NUM_ANGLES; ++i ) + for( int i=0 ; i < NUM_ANGLES ; ++i ) { const double t = angles[ i ] * PI_OVER_180; const double cost = cos( t ); @@ -397,6 +397,3 @@ int main(int argc, char* argv[]) return result; } - - - From b0fe423dc0b25406a56f553b2ec9b08f92513d47 Mon Sep 17 00:00:00 2001 From: uncrustify-robot Date: Wed, 4 Mar 2020 17:36:20 -0800 Subject: [PATCH 091/632] STYLE: uncrustify spin (except code in lambdas) --- .../internal/linear_bvh/QueryAccessor.hpp | 28 +++++++++---------- .../linear_bvh/TraversalPredicates.hpp | 4 +-- src/axom/spin/tests/spin_bvh.cpp | 12 ++++---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index e6a1dc651d..8c94e51ce2 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -127,13 +127,13 @@ class QueryAccessor< 2, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline void getRay( RayType& ray, - IndexType idx, - const FloatType* x0, - const FloatType* nx, - const FloatType* y0, - const FloatType* ny, - const FloatType* AXOM_NOT_USED(z0), - const FloatType* AXOM_NOT_USED(nz) ) + IndexType idx, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* AXOM_NOT_USED(z0), + const FloatType* AXOM_NOT_USED(nz) ) { ray[ 0 ] = x0[ idx ]; ray[ 1 ] = y0[ idx ]; @@ -168,13 +168,13 @@ class QueryAccessor< 3, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline void getRay( RayType& ray, - IndexType idx, - const FloatType* x0, - const FloatType* nx, - const FloatType* y0, - const FloatType* ny, - const FloatType* z0, - const FloatType* nz ) + IndexType idx, + const FloatType* x0, + const FloatType* nx, + const FloatType* y0, + const FloatType* ny, + const FloatType* z0, + const FloatType* nz ) { ray[ 0 ] = x0[ idx ]; ray[ 1 ] = y0[ idx ]; diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index 2d1581a4d2..b9e4f7e008 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -291,7 +291,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > // candidate bins in a priority queue. FloatType t = 0.0; return primal::detail::intersect_ray( - x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); + x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); } template < typename RayType > @@ -319,7 +319,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > // candidate bins in a priority queue. FloatType t = 0.0; return primal::detail::intersect_ray( - x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); + x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); } }; diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index b83e0a1b2b..bac6c1858b 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -544,11 +544,11 @@ void check_find_rays3d() iblank[ cellIdx ] = -1; } ); - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { IndexType ncounts = counts[ i ]; IndexType offset = offsets[ i ]; - for ( int j=0; j < ncounts; ++j ) + for ( int j=0 ; j < ncounts ; ++j ) { IndexType idx = candidates[ offset + j ]; iblank[ idx ] = i; @@ -566,7 +566,7 @@ void check_find_rays3d() EXPECT_EQ( counts[ 0 ], EXPECTED_RAY1_INTERSECTIONS ); EXPECT_EQ( counts[ 1 ], 0 ); - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { switch( i ) { @@ -674,11 +674,11 @@ void check_find_rays2d() iblank[ cellIdx ] = -1; } ); - for ( int i=0; i < N; ++i ) + for ( int i=0 ; i < N ; ++i ) { IndexType ncounts = counts[ i ]; IndexType offset = offsets[ i ]; - for ( int j=0; j < ncounts; ++j ) + for ( int j=0 ; j < ncounts ; ++j ) { IndexType idx = candidates[ offset + j ]; iblank[ idx ] = i; @@ -696,7 +696,7 @@ void check_find_rays2d() EXPECT_EQ( counts[ 0 ], EXPECTED_RAY1_INTERSECTIONS ); EXPECT_EQ( counts[ 1 ], 0 ); - for ( IndexType i=0; i < ncells; ++i ) + for ( IndexType i=0 ; i < ncells ; ++i ) { if ( i==2 || i==6 ) From dd3be8383609f630622b435eda6b7a92e30e01f2 Mon Sep 17 00:00:00 2001 From: uncrustify-robot Date: Wed, 4 Mar 2020 17:41:36 -0800 Subject: [PATCH 092/632] STYLE: uncrustify axom/core --- src/axom/core/memory_management.hpp | 9 ++++++--- src/axom/core/numerics/floating_point_limits.hpp | 2 +- src/axom/core/tests/core_execution_space.cpp | 4 ++-- src/axom/core/tests/core_memory_management.cpp | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/axom/core/memory_management.hpp b/src/axom/core/memory_management.hpp index 562a4e0a97..f8b75ed1ef 100644 --- a/src/axom/core/memory_management.hpp +++ b/src/axom/core/memory_management.hpp @@ -68,9 +68,11 @@ inline void setDefaultAllocator( int allocatorID ) /*! * \brief Returns the current default memory space used. - * \note If Umpire is used, the corresponding umpire allocator can be retrieved by: + * \note If Umpire is used, the corresponding umpire allocator can be retrieved + * by: * - * umpire::Allocator alloc = umpire::ResourceManager::getInstance().getAllocator( allocID ); + * umpire::Allocator alloc = + * umpire::ResourceManager::getInstance().getAllocator( allocID ); * */ inline int getDefaultAllocatorID() @@ -99,7 +101,8 @@ inline int getDefaultAllocatorID() * \return p pointer to the new allocation or a nullptr if allocation failed. */ template < typename T > -inline T* allocate(std::size_t n, int allocID=getDefaultAllocatorID() )noexcept; +inline T* allocate(std::size_t n, + int allocID=getDefaultAllocatorID() ) noexcept; /*! diff --git a/src/axom/core/numerics/floating_point_limits.hpp b/src/axom/core/numerics/floating_point_limits.hpp index 6146b06518..fbe661811d 100644 --- a/src/axom/core/numerics/floating_point_limits.hpp +++ b/src/axom/core/numerics/floating_point_limits.hpp @@ -33,7 +33,7 @@ template < typename T > struct floating_point_limits { AXOM_STATIC_ASSERT_MSG( std::is_floating_point< T >::value, - "floating_point_limits< T > must be used with a floating type!" ); + "floating_point_limits< T > must be used with a floating type!" ); }; //------------------------------------------------------------------------------ diff --git a/src/axom/core/tests/core_execution_space.cpp b/src/axom/core/tests/core_execution_space.cpp index 7920b8f975..324d254831 100644 --- a/src/axom/core/tests/core_execution_space.cpp +++ b/src/axom/core/tests/core_execution_space.cpp @@ -169,7 +169,7 @@ TEST( core_execution_space, check_cuda_exec ) constexpr bool IS_ASYNC = false; int allocator_id = - axom::getUmpireResourceAllocatorID(umpire::resource::Unified); + axom::getUmpireResourceAllocatorID(umpire::resource::Unified); check_execution_mappings< axom::CUDA_EXEC< BLOCK_SIZE >, RAJA::cuda_exec< BLOCK_SIZE >, RAJA::cuda_reduce, @@ -188,7 +188,7 @@ TEST( core_execution_space, check_cuda_exec_async ) constexpr bool IS_ASYNC = true; int allocator_id = - axom::getUmpireResourceAllocatorID(umpire::resource::Unified); + axom::getUmpireResourceAllocatorID(umpire::resource::Unified); check_execution_mappings< axom::CUDA_EXEC< BLOCK_SIZE, axom::ASYNC >, RAJA::cuda_exec_async< BLOCK_SIZE >, RAJA::cuda_reduce, diff --git a/src/axom/core/tests/core_memory_management.cpp b/src/axom/core/tests/core_memory_management.cpp index e8fbc3ccfe..f93ede9190 100644 --- a/src/axom/core/tests/core_memory_management.cpp +++ b/src/axom/core/tests/core_memory_management.cpp @@ -312,7 +312,7 @@ TEST( core_memory_management, alloc_free ) constexpr bool HOST_ACCESSIBLE = true; const int HostAllocatorID = - axom::getUmpireResourceAllocatorID( umpire::resource::Host ); + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); check_alloc_and_free( HostAllocatorID, HOST_ACCESSIBLE ); #ifdef AXOM_USE_CUDA @@ -358,7 +358,7 @@ TEST( core_memory_management, alloc_realloc_free ) constexpr bool HOST_ACCESSIBLE = true; const int HostAllocatorID = - axom::getUmpireResourceAllocatorID( umpire::resource::Host ); + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); check_alloc_realloc_free( HostAllocatorID, HOST_ACCESSIBLE ); #ifdef AXOM_USE_CUDA From 1131fbf2643cbb892a2a34ddc5f6b57debb187a7 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 18 Mar 2020 15:48:11 -0700 Subject: [PATCH 093/632] BUGFIX: remove BVH tests with single precision The parallel BVH tests using single precision were failing, specifically, the BVH::findRays() test were failing on the GPU b/c of RAJA::scan() may not always work correctly in parallel. --- src/axom/spin/tests/spin_bvh.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index bac6c1858b..d15bdc23df 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1214,56 +1214,48 @@ TEST( spin_bvh, traversal_predicates_pointInRightBin ) //------------------------------------------------------------------------------ TEST( spin_bvh, contruct2D_sequential ) { - check_build_bvh2d< axom::SEQ_EXEC, float >( ); check_build_bvh2d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, contruct3D_sequential ) { - check_build_bvh3d< axom::SEQ_EXEC, float >( ); check_build_bvh3d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_3d_sequential ) { - check_find_rays3d< axom::SEQ_EXEC, float >( ); check_find_rays3d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_2d_sequential ) { - check_find_rays2d< axom::SEQ_EXEC, float >( ); check_find_rays2d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_3d_sequential ) { - check_find_points3d< axom::SEQ_EXEC, float >( ); check_find_points3d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_2d_sequential ) { - check_find_points2d< axom::SEQ_EXEC, float >( ); check_find_points2d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box2d_sequential ) { - check_single_box2d< axom::SEQ_EXEC, float >( ); check_single_box2d< axom::SEQ_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box3d_sequential ) { - check_single_box3d< axom::SEQ_EXEC, float >( ); check_single_box3d< axom::SEQ_EXEC, double >( ); } @@ -1272,56 +1264,48 @@ TEST( spin_bvh, single_box3d_sequential ) TEST( spin_bvh, contruct2D_omp ) { - check_build_bvh2d< axom::OMP_EXEC, float >( ); check_build_bvh2d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, contruct3D_omp ) { - check_build_bvh3d< axom::OMP_EXEC, float >( ); check_build_bvh3d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_3d_omp ) { - check_find_rays3d< axom::OMP_EXEC, float >( ); check_find_rays3d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_2d_omp ) { - check_find_rays2d< axom::OMP_EXEC, float >( ); check_find_rays2d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_3d_omp ) { - check_find_points3d< axom::OMP_EXEC, float >( ); check_find_points3d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_2d_omp ) { - check_find_points2d< axom::OMP_EXEC, float >( ); check_find_points2d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box2d_omp ) { - check_single_box2d< axom::OMP_EXEC, float >( ); check_single_box2d< axom::OMP_EXEC, double >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box3d_omp ) { - check_single_box3d< axom::OMP_EXEC, float >( ); check_single_box3d< axom::OMP_EXEC, double >( ); } @@ -1335,7 +1319,6 @@ AXOM_CUDA_TEST( spin_bvh, contruct2D_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_build_bvh2d< exec, float >( ); check_build_bvh2d< exec, double >( ); } @@ -1345,7 +1328,6 @@ AXOM_CUDA_TEST( spin_bvh, contruct3D_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_build_bvh3d< exec, float >( ); check_build_bvh3d< exec, double >( ); } @@ -1355,7 +1337,6 @@ TEST( spin_bvh, find_rays_3d_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_find_rays3d< exec, float >( ); check_find_rays3d< exec, double >( ); } @@ -1365,7 +1346,6 @@ TEST( spin_bvh, find_rays_2d_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_find_rays2d< exec, float >( ); check_find_rays2d< exec, double >( ); } @@ -1375,7 +1355,6 @@ AXOM_CUDA_TEST( spin_bvh, find_points_3d_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_find_points3d< exec, float >( ); check_find_points3d< exec, double >( ); } @@ -1385,7 +1364,6 @@ AXOM_CUDA_TEST( spin_bvh, find_points_2d_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_find_points2d< exec, float >( ); check_find_points2d< exec, double >( ); } @@ -1395,7 +1373,6 @@ AXOM_CUDA_TEST( spin_bvh, single_box2d_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_single_box2d< exec, float >( ); check_single_box2d< exec, double >( ); } @@ -1405,7 +1382,6 @@ AXOM_CUDA_TEST( spin_bvh, single_box3d_cuda ) constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; - check_single_box3d< exec, float >( ); check_single_box3d< exec, double >( ); } From e55ee4c77753e00853f5297b687b36de8bdc397c Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 18 Mar 2020 15:58:57 -0700 Subject: [PATCH 094/632] ENH: prevent use of the BVH with single precision Add a static assert to prevent use of the BVH with single precision. --- src/axom/spin/BVH.hpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 595db80bc5..52057b906f 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -14,7 +14,7 @@ #include "axom/core/execution/execution_space.hpp" // for execution spaces // C/C++ includes -#include // for std::is_floating_point() +#include // for std::is_floating_point(), std::is_same() #if !defined(AXOM_USE_RAJA) || !defined(AXOM_USE_UMPIRE) #error *** The spin::BVH class requires RAJA and Umpire *** @@ -117,15 +117,21 @@ enum BVHReturnCodes template < int NDIMS, typename ExecSpace, typename FloatType = double > class BVH { -public: +private: + // compile time checks AXOM_STATIC_ASSERT_MSG( ( (NDIMS==2) || (NDIMS==3) ), - "The BVH class may be used only in 2D or 3D." ); + "The BVH class may be used only in 2D or 3D." ); AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used for the BVH." ); - AXOM_STATIC_ASSERT_MSG( axom::execution_space< ExecSpace >::valid(), - "A valid execution space must be supplied to the BVH." ); + // NOTE: prevent instantiating the BVH with single precision since the + // parallel scans require do not properly work in single precision. + constexpr static bool is_double = std::is_same< FloatType, double >::value; + AXOM_STATIC_ASSERT_MSG( is_double, "BVH requires double precision!" ); + AXOM_STATIC_ASSERT_MSG( axom::execution_space< ExecSpace >::valid(), + "A valid execution space must be supplied to the BVH." ); +public: /*! * \brief Default constructor. Disabled. From fc5d7fe59dd47f05980d585e7b1562770ab80cd3 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 20 Mar 2020 17:44:00 -0700 Subject: [PATCH 095/632] BUGFIX: use AXOM_CUDA_TEST appropriately --- src/axom/spin/tests/spin_bvh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index d15bdc23df..3e7228be46 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1332,7 +1332,7 @@ AXOM_CUDA_TEST( spin_bvh, contruct3D_cuda ) } //------------------------------------------------------------------------------ -TEST( spin_bvh, find_rays_3d_cuda ) +AXOM_CUDA_TEST( spin_bvh, find_rays_3d_cuda ) { constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; @@ -1341,7 +1341,7 @@ TEST( spin_bvh, find_rays_3d_cuda ) } //------------------------------------------------------------------------------ -TEST( spin_bvh, find_rays_2d_cuda ) +AXOM_CUDA_TEST( spin_bvh, find_rays_2d_cuda ) { constexpr int BLOCK_SIZE = 256; using exec = axom::CUDA_EXEC< BLOCK_SIZE >; From 964f5b636621c2d7e7f5da3f396474a81299827e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 18 Mar 2020 17:28:52 -0700 Subject: [PATCH 096/632] DOC: document ray find feature in release notes Document the new ray find feature and associated changes in the release notes. --- RELEASE-NOTES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 887d71abdb..9ac36a40b7 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,12 +10,23 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ## [Unreleased] - Release date yyyy-mm-dd ### Added +- Added a portable floating_point_limits traits class, to return min(), max(), lowest() of + a `float` or `double` type. The functionality is equivalent to that provided by + std::numeric_limits, but, the code is host/device decorated accordinlgy such that it + can also be called on the device. +- Added initial support for ray queries using the BVH. The caller may now supply a set of rays to + a BVH and the BVH will return a set of candidate BVH bins that intersect each ray. ### Removed ### Deprecated ### Changed +- The BVH may now only be instantiated with double precision floating point types. This is due to + an issue with the parallel scan algorithms, used internally, which may not work properly with + single precision. This issue was discovered by the new tests for the ray find feature. +- Modified the API for the BVH to accomodate different query types. The queries are now + more explicitly called `BVH::findPoints()` and `BVH::findRays()`. - Modified the API of Axom's memory management routines to not leak usage of Umpire. Instead of passing an `umpire::Allocator` object to specify an allocator, we now use the corresponding integer ID associated with the allocator. From 0c72dc74b87c1b92b439c67ed1a557274c860ee5 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 24 Mar 2020 10:31:19 -0700 Subject: [PATCH 097/632] ENH: add floating_point_limits< T >::epsilon() --- RELEASE-NOTES.md | 4 ++-- src/axom/core/numerics/floating_point_limits.hpp | 16 +++++++++++++--- .../tests/numerics_floating_point_limits.cpp | 3 +++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9ac36a40b7..6e8d74ce14 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,8 +10,8 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ## [Unreleased] - Release date yyyy-mm-dd ### Added -- Added a portable floating_point_limits traits class, to return min(), max(), lowest() of - a `float` or `double` type. The functionality is equivalent to that provided by +- Added a portable floating_point_limits traits class, to return min(), max(), lowest() + and epsilon() of a `float` or `double` type. The functionality is equivalent to that provided by std::numeric_limits, but, the code is host/device decorated accordinlgy such that it can also be called on the device. - Added initial support for ray queries using the BVH. The caller may now supply a set of rays to diff --git a/src/axom/core/numerics/floating_point_limits.hpp b/src/axom/core/numerics/floating_point_limits.hpp index fbe661811d..feafb9cf42 100644 --- a/src/axom/core/numerics/floating_point_limits.hpp +++ b/src/axom/core/numerics/floating_point_limits.hpp @@ -22,9 +22,10 @@ namespace numerics * The floating_point_limits class is traits class providing a standardized * and portable way to query the following information on either host/device: *
    - *
  • lowest() -- returns the lowest finite value
  • - *
  • min() -- returns the smallest finite value
  • - *
  • max() -- returns the largest finite value
  • + *
  • lowest() -- returns the lowest finite value
  • + *
  • min() -- returns the smallest finite value
  • + *
  • max() -- returns the largest finite value
  • + *
  • epsilon() -- returns difference between 1.0 and the next value
  • *
* * \tparam T the floating point type, e.g., float, double, or long double. @@ -48,6 +49,9 @@ struct floating_point_limits< float > AXOM_HOST_DEVICE static constexpr float max() { return FLT_MAX; }; + + AXOM_HOST_DEVICE + static constexpr float epsilon() { return FLT_EPSILON; }; }; //------------------------------------------------------------------------------ @@ -62,6 +66,9 @@ struct floating_point_limits< double > AXOM_HOST_DEVICE static constexpr double max() { return DBL_MAX; }; + + AXOM_HOST_DEVICE + static constexpr double epsilon() { return DBL_EPSILON; }; }; //------------------------------------------------------------------------------ @@ -76,6 +83,9 @@ struct floating_point_limits< long double > AXOM_HOST_DEVICE static constexpr long double max() { return LDBL_MAX; }; + + AXOM_HOST_DEVICE + static constexpr long double epsilon() { return LDBL_EPSILON; }; }; } /* namespace numerics */ diff --git a/src/axom/core/tests/numerics_floating_point_limits.cpp b/src/axom/core/tests/numerics_floating_point_limits.cpp index 31e5e855ed..12905c45de 100644 --- a/src/axom/core/tests/numerics_floating_point_limits.cpp +++ b/src/axom/core/tests/numerics_floating_point_limits.cpp @@ -31,6 +31,9 @@ void check_type_limits( const std::string& typeName ) EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::max(), std::numeric_limits< T >::max() ); + + EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::epsilon(), + std::numeric_limits< T >::epsilon() ); } //------------------------------------------------------------------------------ From 6e428a40f3cb369d97ee30eb153f08303afd5a10 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 24 Mar 2020 10:40:33 -0700 Subject: [PATCH 098/632] ENH: change toleranace for ray/box intersect Use floating_point_limits< T >::epsilon() for the default tolerance used in ray/box intersection tests. --- src/axom/primal/operators/detail/intersect_ray_impl.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axom/primal/operators/detail/intersect_ray_impl.hpp b/src/axom/primal/operators/detail/intersect_ray_impl.hpp index dca37afc57..4b5deecb26 100644 --- a/src/axom/primal/operators/detail/intersect_ray_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_ray_impl.hpp @@ -173,7 +173,7 @@ inline bool intersect_ray( const T& x0, const T& ymin, const T& ymax, T& t, - T TOL=1.e-9 ) + T TOL=numerics::floating_point_limits::epsilon() ) { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); @@ -222,7 +222,7 @@ inline bool intersect_ray( const T& x0, const T& zmin, const T& zmax, T& t, - T TOL=1.e-9) + T TOL=numerics::floating_point_limits::epsilon() ) { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); @@ -258,7 +258,7 @@ template < typename T, int DIM > inline bool intersect_ray( const primal::Ray< T,DIM > & R, const primal::BoundingBox< T,DIM > & bb, primal::Point< T,DIM > & ip, - T TOL=1.e-9 ) + T TOL=numerics::floating_point_limits::epsilon() ) { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); From e534ca51aced9eb92bec645c026f73df903f6d0a Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 24 Mar 2020 12:12:21 -0700 Subject: [PATCH 099/632] ENH: add BVH::getScaleFactor() method --- src/axom/spin/BVH.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 52057b906f..40afd1408f 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -186,6 +186,13 @@ class BVH void setScaleFactor( FloatType scale_factor ) { m_scaleFactor = scale_factor; }; + /*! + * \brief Returns the scale factor used when constructing the BVH. + * \return scale_factor the scale factor + */ + FloatType getScaleFacor( ) const + { return m_scaleFactor; }; + /*! * \brief Generates the BVH * \return status set to BVH_BUILD_OK on success. From fdf4ff9361c77f9c4d29b3ddb2ecfae3ce5a4f5a Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 24 Mar 2020 14:35:54 -0700 Subject: [PATCH 100/632] ENH: user-supplied tolerance for ray queries Adds support for setting a user-supplied tolerance for ray queries --- src/axom/spin/BVH.hpp | 17 ++++++ .../spin/internal/linear_bvh/BVH_impl.hpp | 22 +++++--- .../linear_bvh/TraversalPredicates.hpp | 56 +++++++++++-------- 3 files changed, 64 insertions(+), 31 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 40afd1408f..226c2625b6 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -193,6 +193,22 @@ class BVH FloatType getScaleFacor( ) const { return m_scaleFactor; }; + /*! + * \brief Sets the tolerance used for querying the BVH. + * \param [in] TOL the tolerance to use. + * + * \note Default tolerance set to floating_point_limits::epsilon() + */ + void setTolerance( FloatType TOL ) + { m_Tolernace = TOL; }; + + /*! + * \brief Returns the tolerance value used for BVH queries. + * \return TOL the tolerance + */ + FloatType getTolerance() const + { return m_Tolernace; }; + /*! * \brief Generates the BVH * \return status set to BVH_BUILD_OK on success. @@ -302,6 +318,7 @@ class BVH /// \name Private Members /// @{ + FloatType m_Tolernace; FloatType m_scaleFactor; IndexType m_numItems; const FloatType* m_boxes; diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index e27b46f46d..7dd94df8ab 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -6,13 +6,13 @@ #ifndef AXOM_SPIN_BVH_IMPL_HPP_ #define AXOM_SPIN_BVH_IMPL_HPP_ -#include "axom/core/memory_management.hpp" // for memory functions -#include "axom/core/Types.hpp" // for fixed bitwidth types - -#include "axom/core/execution/for_all.hpp" // for generic for_all() +#include "axom/core/Types.hpp" // fixed bitwidth types +#include "axom/core/execution/for_all.hpp" // for generic for_all() +#include "axom/core/memory_management.hpp" // for memory functions +#include "axom/core/numerics/floating_point_limits.hpp" // floating_point_limits // slic includes -#include "axom/slic/interface/slic.hpp" // for SLIC macros +#include "axom/slic/interface/slic.hpp" // for SLIC macros // linear bvh includes #include "axom/spin/internal/linear_bvh/aabb.hpp" @@ -35,6 +35,9 @@ #include // for std::string #include // for memcpy +// namespace aliases +namespace numerics = axom::numerics; + namespace axom { namespace spin @@ -73,7 +76,7 @@ using ray_t = internal::linear_bvh::Vec< FloatType, NDIMS*2 >; * \note This macro is intended to be used internally by the BVH implementation. */ #define BVH_PREDICATE(_predicateName, _p, _s1, _s2 ) \ - auto _predicateName = [] AXOM_HOST_DEVICE( _p, _s1, _s2 )->bool + auto _predicateName = [=] AXOM_HOST_DEVICE( _p, _s1, _s2 )->bool /*! * \def BVH_LEAF_ACTION @@ -254,6 +257,7 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, template< int NDIMS, typename ExecSpace, typename FloatType > BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, IndexType numItems ) : + m_Tolernace( numerics::floating_point_limits< FloatType >::epsilon() ), m_scaleFactor( DEFAULT_SCALE_FACTOR ), m_numItems( numItems ), m_boxes( boxes ) @@ -445,6 +449,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, SLIC_ASSERT( y0 != nullptr ); SLIC_ASSERT( ny != nullptr ); + const FloatType TOL = m_Tolernace; + // STEP 0: set the default memory allocator to use for the execution space. const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); @@ -466,7 +472,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, const vec4_t< FloatType >&s1, const vec4_t< FloatType >&s2 ) { - return TraversalPredicates::rayIntersectsLeftBin( r, s1, s2 ); + return TraversalPredicates::rayIntersectsLeftBin( r, s1, s2, TOL ); }; BVH_PREDICATE( rightPredicate, @@ -474,7 +480,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, const vec4_t< FloatType >&s2, const vec4_t< FloatType >&s3 ) { - return TraversalPredicates::rayIntersectsRightBin( r, s2, s3 ); + return TraversalPredicates::rayIntersectsRightBin( r, s2, s3, TOL ); }; // STEP 3: get counts diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index b9e4f7e008..5f317db209 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -8,6 +8,7 @@ #include "axom/spin/internal/linear_bvh/vec.hpp" +#include "axom/core/numerics/floating_point_limits.hpp" #include "axom/primal/operators/detail/intersect_ray_impl.hpp" namespace axom @@ -61,7 +62,7 @@ class TraversalPredicates AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, const vec4_t& s1, - const vec4_t& s2 ) noexcept; + const vec4_t& s2 ) noexcept; /*! * \brief Checks if the supplied point is within the right bin. @@ -89,14 +90,16 @@ class TraversalPredicates * \param [in] r the ray in query * \param [in] s1 the 1st segment of the BVH that stores the left bin. * \param [in] s2 the 2nd segment of the BVH that stores the left bin. + * \param [in] TOL optional user-supplied tolerance. Default set to epsilon(). * * \return status true if the ray intersects the left bin, else, false. */ template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsLeftBin( const RayType& r, - const vec4_t& s1, - const vec4_t& s2 ) noexcept; + static inline bool rayIntersectsLeftBin( + const RayType& r, const vec4_t& s1, const vec4_t& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept; /*! * \brief Checks if the specified ray intersects with the right bin. @@ -104,14 +107,17 @@ class TraversalPredicates * \param [in] r the ray in query * \param [in] s2 the 2nd segment of the BVH that stores the right bin. * \param [in] s3 the 3rd segment of the BVH that stores the right bin. + * \param [in] TOL optional user-supplied tolerance. Default set to epsilon(). * * \return status true if the ray intersects the right bin, else, false. */ template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsRightBin( const RayType& r, - const vec4_t& s2, - const vec4_t& s3 ) noexcept; + static inline bool rayIntersectsRightBin( + const RayType& r, const vec4_t& s2, const vec4_t& s3, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept; + /// @} }; @@ -168,9 +174,10 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsLeftBin( const RayType& r, - const vec4_t& s1, - const vec4_t& s2 ) noexcept + static inline bool rayIntersectsLeftBin( + const RayType& r, const vec4_t& s1, const vec4_t& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -186,14 +193,15 @@ class TraversalPredicates< DIMENSION_2, FloatType > // TODO: in the future we should take `t` into account and organize // candidate bins in a priority queue. FloatType t = 0.0; - return primal::detail::intersect_ray( x0,nx,y0,ny,xmin,xmax,ymin,ymax,t ); + return primal::detail::intersect_ray(x0,nx,y0,ny,xmin,xmax,ymin,ymax,t,TOL); } template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsRightBin( const RayType& r, - const vec4_t& s2, - const vec4_t& s3 ) noexcept + static inline bool rayIntersectsRightBin( + const RayType& r, const vec4_t& s2, const vec4_t& s3, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -209,7 +217,7 @@ class TraversalPredicates< DIMENSION_2, FloatType > // TODO: in the future we should take `t` into account and organize // candidate bins in a priority queue. FloatType t = 0.0; - return primal::detail::intersect_ray( x0,nx,y0,ny,xmin,xmax,ymin,ymax,t ); + return primal::detail::intersect_ray(x0,nx,y0,ny,xmin,xmax,ymin,ymax,t,TOL); } }; @@ -268,9 +276,10 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsLeftBin( const RayType& r, - const vec4_t& s1, - const vec4_t& s2 ) noexcept + static inline bool rayIntersectsLeftBin( + const RayType& r, const vec4_t& s1, const vec4_t& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -291,14 +300,15 @@ class TraversalPredicates< DIMENSION_3, FloatType > // candidate bins in a priority queue. FloatType t = 0.0; return primal::detail::intersect_ray( - x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); + x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t, TOL ); } template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsRightBin( const RayType& r, - const vec4_t& s2, - const vec4_t& s3 ) noexcept + static inline bool rayIntersectsRightBin( + const RayType& r, const vec4_t& s2, const vec4_t& s3, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -319,7 +329,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > // candidate bins in a priority queue. FloatType t = 0.0; return primal::detail::intersect_ray( - x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t ); + x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t, TOL ); } }; From eb9d726e2e5c658f5e74ec04c7d4f61ee2755393 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 24 Mar 2020 15:27:49 -0700 Subject: [PATCH 101/632] COMP: resolve ambiguous namespace with gcc6/gcc7 --- src/axom/spin/internal/linear_bvh/BVH_impl.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 7dd94df8ab..2fbc00a9b1 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -35,14 +35,15 @@ #include // for std::string #include // for memcpy -// namespace aliases -namespace numerics = axom::numerics; namespace axom { namespace spin { +template < typename FloatType > +using floating_point_limits = axom::numerics::floating_point_limits; + //------------------------------------------------------------------------------ // BVH IMPLEMENTATION //------------------------------------------------------------------------------ @@ -257,7 +258,7 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, template< int NDIMS, typename ExecSpace, typename FloatType > BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, IndexType numItems ) : - m_Tolernace( numerics::floating_point_limits< FloatType >::epsilon() ), + m_Tolernace( floating_point_limits::epsilon() ), m_scaleFactor( DEFAULT_SCALE_FACTOR ), m_numItems( numItems ), m_boxes( boxes ) From e2447312eb92ea7f0dac0fe6bb18870468ea7011 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 25 Mar 2020 11:01:11 -0700 Subject: [PATCH 102/632] ENH: add unit tests for the QueryAccessor --- src/axom/spin/tests/spin_bvh.cpp | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 3e7228be46..a003cf9d6c 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1062,6 +1062,71 @@ void check_single_box3d( ) //------------------------------------------------------------------------------ // UNIT TESTS //------------------------------------------------------------------------------ +TEST( spin_bvh, query_point_accessor ) +{ + constexpr double VAL = 42.0; + constexpr IndexType ID = 0; + + double x[] = { VAL }; + double y[] = { VAL+1.5 }; + double z[] = { VAL+2.5 }; + + namespace bvh = axom::spin::internal::linear_bvh; + using QueryAccessor2D = bvh::QueryAccessor< 2, double >; + using QueryAccessor3D = bvh::QueryAccessor< 3, double >; + using Point2D = bvh::Vec< double, 2 >; + using Point3D = bvh::Vec< double, 3 >; + + Point2D test_point2d; + QueryAccessor2D::getPoint( test_point2d, ID, x, y, nullptr ); + EXPECT_DOUBLE_EQ( test_point2d[0], x[ ID ] ); + EXPECT_DOUBLE_EQ( test_point2d[1], y[ ID ] ); + + Point3D test_point3d; + QueryAccessor3D::getPoint( test_point3d, 0, x, y, z ); + EXPECT_DOUBLE_EQ( test_point3d[0], x[ ID ] ); + EXPECT_DOUBLE_EQ( test_point3d[1], y[ ID ] ); + EXPECT_DOUBLE_EQ( test_point3d[2], z[ ID ] ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, query_ray_accessor ) +{ + constexpr double VAL = 42.0; + constexpr IndexType ID = 0; + + double x[] = { VAL }; + double y[] = { VAL+1.5 }; + double z[] = { VAL+2.5 }; + + double nx[] = { VAL }; + double ny[] = { VAL+1.5 }; + double nz[] = { VAL+2.5 }; + + namespace bvh = axom::spin::internal::linear_bvh; + using QueryAccessor2D = bvh::QueryAccessor< 2, double >; + using QueryAccessor3D = bvh::QueryAccessor< 3, double >; + using Ray2D = bvh::Vec< double, 4 >; + using Ray3D = bvh::Vec< double, 6 >; + + Ray2D ray2d; + QueryAccessor2D::getRay( ray2d, ID, x, nx, y, ny, nullptr, nullptr ); + EXPECT_DOUBLE_EQ( ray2d[0], x[ ID ] ); + EXPECT_DOUBLE_EQ( ray2d[1], y[ ID ] ); + + EXPECT_DOUBLE_EQ( ray2d[2], nx[ ID ] ); + EXPECT_DOUBLE_EQ( ray2d[3], ny[ ID ] ); + + Ray3D ray3d; + QueryAccessor3D::getRay( ray3d, ID, x, nx, y, ny, z, nz ); + EXPECT_DOUBLE_EQ( ray3d[0], x[ ID ] ); + EXPECT_DOUBLE_EQ( ray3d[1], y[ ID ] ); + EXPECT_DOUBLE_EQ( ray3d[2], z[ ID ] ); + + EXPECT_DOUBLE_EQ( ray3d[3], nx[ ID ] ); + EXPECT_DOUBLE_EQ( ray3d[4], ny[ ID ] ); + EXPECT_DOUBLE_EQ( ray3d[5], nz[ ID ] ); +} //------------------------------------------------------------------------------ TEST( spin_bvh, traversal_predicates_rayIntersectsLeftBin ) From a834546624a0092c63a26ccd7a6c7478cb09bbb5 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 25 Mar 2020 13:08:57 -0700 Subject: [PATCH 103/632] BUGFIX: fix typo in 3D QueryAccessor::getRay() Fix typo leading to erroneous initialization of the query ray data. Also, correct the find_rays_3d test accordingly. --- src/axom/spin/internal/linear_bvh/QueryAccessor.hpp | 6 +++--- src/axom/spin/tests/spin_bvh.cpp | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index 8c94e51ce2..a752cec37b 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -180,9 +180,9 @@ class QueryAccessor< 3, FloatType > ray[ 1 ] = y0[ idx ]; ray[ 2 ] = z0[ idx ]; - ray[ 2 ] = nx[ idx ]; - ray[ 3 ] = ny[ idx ]; - ray[ 4 ] = nz[ idx ]; + ray[ 3 ] = nx[ idx ]; + ray[ 4 ] = ny[ idx ]; + ray[ 5 ] = nz[ idx ]; } }; diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index a003cf9d6c..a9269c4a8a 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -562,7 +562,7 @@ void check_find_rays3d() // check answer with results verified manually by inspection constexpr int INTERSECTS_RAY = 0; constexpr int DOES_NOT_INTERSECT_RAY = -1; - constexpr int EXPECTED_RAY1_INTERSECTIONS = 14; + constexpr int EXPECTED_RAY1_INTERSECTIONS = 15; EXPECT_EQ( counts[ 0 ], EXPECTED_RAY1_INTERSECTIONS ); EXPECT_EQ( counts[ 1 ], 0 ); @@ -574,9 +574,6 @@ void check_find_rays3d() case 1: case 3: case 4: - case 5: - case 7: - case 8: case 9: case 10: case 12: @@ -584,6 +581,10 @@ void check_find_rays3d() case 14: case 16: case 17: + case 22: + case 23: + case 25: + case 26: EXPECT_EQ( iblank[ i ], INTERSECTS_RAY ); break; default: From 84ceace266ca7c1ac6544767619c0d99f9ae95a1 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 25 Mar 2020 17:53:30 -0700 Subject: [PATCH 104/632] ENH: fix warnings in floating_point_limits test Don't use EXPECT_DOUBLE_EQ() for this test since that hinders the ability to test `long doulbe` floating point types. Rewrote the test using EXPECT_TRUE(). --- .../tests/numerics_floating_point_limits.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/axom/core/tests/numerics_floating_point_limits.cpp b/src/axom/core/tests/numerics_floating_point_limits.cpp index 12905c45de..2a56c3296c 100644 --- a/src/axom/core/tests/numerics_floating_point_limits.cpp +++ b/src/axom/core/tests/numerics_floating_point_limits.cpp @@ -5,6 +5,7 @@ // axom includes #include "axom/core/Macros.hpp" +#include "axom/core/utilities/Utilities.hpp" #include "axom/core/numerics/floating_point_limits.hpp" // gtest includes @@ -23,17 +24,20 @@ void check_type_limits( const std::string& typeName ) SCOPED_TRACE( "Testing [" + typeName + "]" ); - EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::lowest(), - std::numeric_limits< T >::lowest() ); + const T EPS = axom::numerics::floating_point_limits< T >::epsilon(); + const T LOWEST = axom::numerics::floating_point_limits< T >::lowest(); + const T MIN = axom::numerics::floating_point_limits< T >::min(); + const T MAX = axom::numerics::floating_point_limits< T >::max(); - EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::min(), - std::numeric_limits< T >::min() ); + const T STD_EPS = std::numeric_limits< T >::epsilon(); + const T STD_LOWEST = std::numeric_limits< T >::lowest(); + const T STD_MIN = std::numeric_limits< T >::min(); + const T STD_MAX = std::numeric_limits< T >::max(); - EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::max(), - std::numeric_limits< T >::max() ); - - EXPECT_DOUBLE_EQ( axom::numerics::floating_point_limits< T >::epsilon(), - std::numeric_limits< T >::epsilon() ); + EXPECT_TRUE( axom::utilities::isNearlyEqual( LOWEST, STD_LOWEST, EPS ) ); + EXPECT_TRUE( axom::utilities::isNearlyEqual( MIN, STD_MIN, EPS ) ); + EXPECT_TRUE( axom::utilities::isNearlyEqual( MAX, STD_MAX, EPS ) ); + EXPECT_TRUE( axom::utilities::isNearlyEqual( EPS, STD_EPS, EPS ) ); } //------------------------------------------------------------------------------ From 1f3e5e62fe7dced73dd60325b6b46c6b9e7a2f02 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 26 Mar 2020 09:21:41 -0700 Subject: [PATCH 105/632] ENH: lift double precision restriction for the BVH Re-allow use of the BVH with single precision as well and re-instate single precision tests. --- src/axom/spin/BVH.hpp | 5 ----- src/axom/spin/tests/spin_bvh.cpp | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 226c2625b6..12a22c15f4 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -124,11 +124,6 @@ class BVH "The BVH class may be used only in 2D or 3D." ); AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used for the BVH." ); - - // NOTE: prevent instantiating the BVH with single precision since the - // parallel scans require do not properly work in single precision. - constexpr static bool is_double = std::is_same< FloatType, double >::value; - AXOM_STATIC_ASSERT_MSG( is_double, "BVH requires double precision!" ); AXOM_STATIC_ASSERT_MSG( axom::execution_space< ExecSpace >::valid(), "A valid execution space must be supplied to the BVH." ); public: diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index a9269c4a8a..613ee9e999 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1281,48 +1281,56 @@ TEST( spin_bvh, traversal_predicates_pointInRightBin ) TEST( spin_bvh, contruct2D_sequential ) { check_build_bvh2d< axom::SEQ_EXEC, double >( ); + check_build_bvh2d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, contruct3D_sequential ) { check_build_bvh3d< axom::SEQ_EXEC, double >( ); + check_build_bvh3d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_3d_sequential ) { check_find_rays3d< axom::SEQ_EXEC, double >( ); + check_find_rays3d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_2d_sequential ) { check_find_rays2d< axom::SEQ_EXEC, double >( ); + check_find_rays2d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_3d_sequential ) { check_find_points3d< axom::SEQ_EXEC, double >( ); + check_find_points3d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_2d_sequential ) { check_find_points2d< axom::SEQ_EXEC, double >( ); + check_find_points2d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box2d_sequential ) { check_single_box2d< axom::SEQ_EXEC, double >( ); + check_single_box2d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box3d_sequential ) { check_single_box3d< axom::SEQ_EXEC, double >( ); + check_single_box3d< axom::SEQ_EXEC, float >( ); } //------------------------------------------------------------------------------ @@ -1331,42 +1339,49 @@ TEST( spin_bvh, single_box3d_sequential ) TEST( spin_bvh, contruct2D_omp ) { check_build_bvh2d< axom::OMP_EXEC, double >( ); + check_build_bvh2d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, contruct3D_omp ) { check_build_bvh3d< axom::OMP_EXEC, double >( ); + check_build_bvh3d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_3d_omp ) { check_find_rays3d< axom::OMP_EXEC, double >( ); + check_find_rays3d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_2d_omp ) { check_find_rays2d< axom::OMP_EXEC, double >( ); + check_find_rays2d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_3d_omp ) { check_find_points3d< axom::OMP_EXEC, double >( ); + check_find_points3d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, find_points_2d_omp ) { check_find_points2d< axom::OMP_EXEC, double >( ); + check_find_points2d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ TEST( spin_bvh, single_box2d_omp ) { check_single_box2d< axom::OMP_EXEC, double >( ); + check_single_box2d< axom::OMP_EXEC, float >( ); } //------------------------------------------------------------------------------ @@ -1386,6 +1401,7 @@ AXOM_CUDA_TEST( spin_bvh, contruct2D_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_build_bvh2d< exec, double >( ); + check_build_bvh2d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1395,6 +1411,7 @@ AXOM_CUDA_TEST( spin_bvh, contruct3D_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_build_bvh3d< exec, double >( ); + check_build_bvh3d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1404,6 +1421,7 @@ AXOM_CUDA_TEST( spin_bvh, find_rays_3d_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_find_rays3d< exec, double >( ); + check_find_rays3d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1413,6 +1431,7 @@ AXOM_CUDA_TEST( spin_bvh, find_rays_2d_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_find_rays2d< exec, double >( ); + check_find_rays2d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1422,6 +1441,7 @@ AXOM_CUDA_TEST( spin_bvh, find_points_3d_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_find_points3d< exec, double >( ); + check_find_points3d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1431,6 +1451,7 @@ AXOM_CUDA_TEST( spin_bvh, find_points_2d_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_find_points2d< exec, double >( ); + check_find_points2d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1440,6 +1461,7 @@ AXOM_CUDA_TEST( spin_bvh, single_box2d_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_single_box2d< exec, double >( ); + check_single_box2d< exec, float >( ); } //------------------------------------------------------------------------------ @@ -1449,6 +1471,7 @@ AXOM_CUDA_TEST( spin_bvh, single_box3d_cuda ) using exec = axom::CUDA_EXEC< BLOCK_SIZE >; check_single_box3d< exec, double >( ); + check_single_box3d< exec, float >( ); } #endif From 6908df6fcac91ef2574f2634a618e45b1760ef5f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 26 Mar 2020 09:30:17 -0700 Subject: [PATCH 106/632] ENH: update RELEASE-NOTES --- RELEASE-NOTES.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 6e8d74ce14..93a2b2d8c2 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -12,7 +12,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ### Added - Added a portable floating_point_limits traits class, to return min(), max(), lowest() and epsilon() of a `float` or `double` type. The functionality is equivalent to that provided by - std::numeric_limits, but, the code is host/device decorated accordinlgy such that it + std::numeric_limits, but, the code is host/device decorated accordingly such that it can also be called on the device. - Added initial support for ray queries using the BVH. The caller may now supply a set of rays to a BVH and the BVH will return a set of candidate BVH bins that intersect each ray. @@ -22,9 +22,6 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ### Deprecated ### Changed -- The BVH may now only be instantiated with double precision floating point types. This is due to - an issue with the parallel scan algorithms, used internally, which may not work properly with - single precision. This issue was discovered by the new tests for the ray find feature. - Modified the API for the BVH to accomodate different query types. The queries are now more explicitly called `BVH::findPoints()` and `BVH::findRays()`. - Modified the API of Axom's memory management routines to not leak usage of Umpire. Instead of From 1827916b4741f3d7402397a4bfd98d132cd3b656 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 26 Mar 2020 14:14:30 -0700 Subject: [PATCH 107/632] Fix CMake example --- src/examples/using-with-cmake/FindAxom.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/using-with-cmake/FindAxom.cmake b/src/examples/using-with-cmake/FindAxom.cmake index 77152bddc7..5bb0c66b5b 100644 --- a/src/examples/using-with-cmake/FindAxom.cmake +++ b/src/examples/using-with-cmake/FindAxom.cmake @@ -24,7 +24,7 @@ set(AXOM_INCLUDE_DIRS ${AXOM_DIR}/include) # NOTE: fmt, CLI11 and sparsehash are useful open-source projects that Axom # uses internally and we export for other codes use as well -set(AXOM_LIBRARIES sparsehash CLI11 fmt axom ) +set(AXOM_LIBRARIES sparsehash cli11 fmt axom ) foreach(_library ${AXOM_LIBRARIES}) From 7981f9882e7e9555587f7475fc475be635ff0345 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 26 Mar 2020 16:21:47 -0700 Subject: [PATCH 108/632] ENH: simple Sidre Array example Addresses in part #188 --- src/axom/sidre/examples/CMakeLists.txt | 3 +- src/axom/sidre/examples/sidre_array.cpp | 101 ++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 src/axom/sidre/examples/sidre_array.cpp diff --git a/src/axom/sidre/examples/CMakeLists.txt b/src/axom/sidre/examples/CMakeLists.txt index 4ad5341202..27b65a91de 100644 --- a/src/axom/sidre/examples/CMakeLists.txt +++ b/src/axom/sidre/examples/CMakeLists.txt @@ -16,6 +16,7 @@ set(example_sources if(ENABLE_MPI) set (example_parallel_sources + sidre_array.cpp sidre_createdatastore.cpp) else() list(APPEND example_sources sidre_createdatastore.cpp) @@ -75,7 +76,7 @@ if(ENABLE_MPI) FOLDER axom/sidre/examples) if(AXOM_ENABLE_TESTS) - blt_add_test( NAME ${exe_name} + blt_add_test( NAME ${exe_name} COMMAND ${exe_name}_ex NUM_MPI_TASKS 1 ) diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp new file mode 100644 index 0000000000..c37b263e3b --- /dev/null +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -0,0 +1,101 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +// Axom includes +#include "axom/core.hpp" // for Axom types and macros +#include "axom/sidre.hpp" // for sidre +#include "axom/slic.hpp" // for logging with slic + +// MPI includes +#include + +// C/C++ includes +#include + +// aliases +namespace sidre = axom::sidre; +namespace slic = axom::slic; + +int main ( int argc, char** argv ) +{ + MPI_Init( &argc, &argv ); + MPI_Comm problem_comm = MPI_COMM_WORLD; + + int nranks = -1; + int myrank = -1; + MPI_Comm_rank( problem_comm, &myrank ); + MPI_Comm_size( problem_comm, &nranks ); + + slic::UnitTestLogger logger; + + // STEP 0: create the data store + sidre::DataStore* dataStore1 = new sidre::DataStore(); + sidre::Group* root1 = dataStore1->getRoot(); + + // STEP 1: create an array with some data + constexpr axom::IndexType NUM_NODES = 10; + constexpr axom::IndexType DIMENSION = 4; + sidre::Array< int > nodes_1( + root1->createView("nodes_1/data"),NUM_NODES,DIMENSION); + + int value = 0; + for ( axom::IndexType i=0; i < NUM_NODES; ++i ) + { + for ( axom::IndexType j=0; j < DIMENSION; ++j ) + { + nodes_1( i,j ) = value; + ++value; + } // END for all components + } // END for all nodes + +// DEBUG + SLIC_INFO( "Here is the array data in DataStore_1:\n" ); + root1->print(); + std::cout << std::endl; +// END DEBUG + + // STEP 2: save the array data in to a file + sidre::IOManager sidre_io( problem_comm ); + sidre_io.write( root1, nranks, "mesh", "sidre_hdf5" ); + + // STEP 3: read the data from the file into a new DataStore + sidre::DataStore* dataStore2 = new sidre::DataStore(); + sidre::Group* root2 = dataStore2->getRoot(); + sidre_io.read( root2, "mesh.root"); + +// DEBUG + SLIC_INFO( "Here is the array data in DataStore_2:\n" ); + root2->print(); + std::cout << std::endl; +// END DEBUG + + sidre::Array< int > nodes_2(root2->getView("nodes_1/data") ); + SLIC_ASSERT( nodes_2.size() == NUM_NODES ); + SLIC_ASSERT( nodes_2.numComponents() == DIMENSION ); + + // STEP 4: ensure the data is correct + int expected_value = 0; + for ( axom::IndexType i=0; i < NUM_NODES; ++i ) + { + for ( axom::IndexType j=0; j < DIMENSION; ++j ) + { + SLIC_ASSERT( nodes_2(i,j) == expected_value ); + ++expected_value; + } // END for all components + } // END for all nodes + + // STEP 5: delete the datastores + delete dataStore2; + dataStore2 = nullptr; + + delete dataStore1; + dataStore1 = nullptr; + + MPI_Finalize(); + return 0; +} + + + From 892293c68b2351b51ac68d7ac8e1b29ffaf74cbb Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 26 Mar 2020 16:50:54 -0700 Subject: [PATCH 109/632] ENH: add external array sidre example Addresses in part #188 --- src/axom/sidre/examples/CMakeLists.txt | 3 +- .../sidre/examples/sidre_external_array.cpp | 151 ++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 src/axom/sidre/examples/sidre_external_array.cpp diff --git a/src/axom/sidre/examples/CMakeLists.txt b/src/axom/sidre/examples/CMakeLists.txt index 27b65a91de..3eaef88ee5 100644 --- a/src/axom/sidre/examples/CMakeLists.txt +++ b/src/axom/sidre/examples/CMakeLists.txt @@ -17,7 +17,8 @@ set(example_sources if(ENABLE_MPI) set (example_parallel_sources sidre_array.cpp - sidre_createdatastore.cpp) + sidre_createdatastore.cpp + sidre_external_array.cpp) else() list(APPEND example_sources sidre_createdatastore.cpp) endif() diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp new file mode 100644 index 0000000000..35b65b8273 --- /dev/null +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -0,0 +1,151 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +// Axom includes +#include "axom/core.hpp" // for Axom types and macros +#include "axom/sidre.hpp" // for sidre +#include "axom/slic.hpp" // for logging with slic + +// MPI includes +#include + +// C/C++ includes +#include + +// aliases +namespace sidre = axom::sidre; +namespace slic = axom::slic; + +//------------------------------------------------------------------------------ +void sidre_write( MPI_Comm comm, + const std::string& file, + int* data, + axom::IndexType numTuples, + axom::IndexType numComponents ) +{ + SLIC_ASSERT( comm != MPI_COMM_NULL ); + SLIC_ASSERT( data != nullptr ); + SLIC_ASSERT( !file.empty( ) ); + + int nranks = -1; + MPI_Comm_size( comm, &nranks ); + + sidre::DataStore ds; + sidre::Group* root = ds.getRoot(); + sidre::View* view = root->createView( "data" ); + + sidre::IndexType shape[2]; + shape[ 0 ] = numTuples; + shape[ 1 ] = numComponents; + + view->setExternalDataPtr( sidre::INT32_ID, 2, shape, data ); + +// DEBUG + SLIC_INFO( "Here is the data that is begin dumped:" ); + root->print(); + std::cout << std::endl; +// DEBUG + + + // STEP 2: save the array data in to a file + sidre::IOManager sidre_io( comm ); + sidre_io.write( root, nranks, file, "sidre_hdf5" ); +} + +//------------------------------------------------------------------------------ +void sidre_read( MPI_Comm comm, + const std::string& file, + int*& data, + axom::IndexType& numTuples, + axom::IndexType& numComponents ) +{ + SLIC_ASSERT( comm != MPI_COMM_NULL ); + SLIC_ASSERT( data == nullptr ); + SLIC_ASSERT( !file.empty( ) ); + + int nranks = -1; + MPI_Comm_size( comm, &nranks ); + + sidre::DataStore ds; + sidre::Group* root = ds.getRoot(); + + sidre::IOManager sidre_io( comm ); + sidre_io.read( root, file ); + +// DEBUG + SLIC_INFO( "Here is the data that was read back:" ); + root->print(); + std::cout << std::endl; +// DEBUG + + SLIC_ASSERT( root->hasChildView("data") ); + sidre::View* view = root->getView( "data" ); + + sidre::IndexType shape[2]; + view->getShape( 2, shape ); + numTuples = shape[ 0 ]; + numComponents = shape[ 1 ]; + + axom::IndexType nelems = view->getNumElements(); + SLIC_ASSERT( nelems==(numTuples*numComponents) ); + + data = axom::allocate< int >(nelems); + SLIC_ASSERT( data != nullptr ); + + memcpy( data, view->getVoidPtr(), nelems*sizeof(int) ); +} + +//------------------------------------------------------------------------------ +int main ( int argc, char** argv ) +{ + MPI_Init( &argc, &argv ); + MPI_Comm problem_comm = MPI_COMM_WORLD; + + slic::UnitTestLogger logger; + + // STEP 0: create some data + constexpr axom::IndexType NUM_NODES = 10; + constexpr axom::IndexType DIMENSION = 4; + constexpr axom::IndexType NSIZE = NUM_NODES * DIMENSION; + + int* data = axom::allocate< int >( NSIZE ); + SLIC_ASSERT( data != nullptr ); + + for ( int i=0; i < NSIZE; ++i ) + { + data[ i ] = (i+1) * 10; + } + + // STEP 1: dump the data to a file using sidre + SLIC_INFO( "Writting data..." ); + sidre_write( problem_comm, "mesh", data, NUM_NODES, DIMENSION ); + SLIC_INFO( "[DONE]" ); + + // STEP 2: read the data from a file using sidre + int* data2 = nullptr; + axom::IndexType ntuples = -1; + axom::IndexType ncomp = -1; + + SLIC_INFO( "Reading data..." ); + sidre_read( problem_comm, "mesh.root", data2, ntuples, ncomp ); + SLIC_INFO( "[DONE]" ); + + // STEP 3: check the data + SLIC_ASSERT( ntuples == NUM_NODES ); + SLIC_ASSERT( ncomp == DIMENSION ); + for ( int i=0; i < NSIZE; ++i ) + { + SLIC_ASSERT( data[ i ] == data2[ i ] ); + } + + // STEP 4: deallocate + axom::deallocate( data ); + axom::deallocate( data2 ); + + MPI_Finalize(); + return 0; +} + + From 88331d2ef5e51f7cd86a873ea8b58a9c521c8e76 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 27 Mar 2020 10:11:50 -0700 Subject: [PATCH 110/632] BUGFIX: fix sidre_read for external data --- .../sidre/examples/sidre_external_array.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 35b65b8273..943bd34ace 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -74,12 +74,6 @@ void sidre_read( MPI_Comm comm, sidre::IOManager sidre_io( comm ); sidre_io.read( root, file ); -// DEBUG - SLIC_INFO( "Here is the data that was read back:" ); - root->print(); - std::cout << std::endl; -// DEBUG - SLIC_ASSERT( root->hasChildView("data") ); sidre::View* view = root->getView( "data" ); @@ -93,8 +87,17 @@ void sidre_read( MPI_Comm comm, data = axom::allocate< int >(nelems); SLIC_ASSERT( data != nullptr ); + SLIC_ASSERT( view->isDescribed() ); + SLIC_ASSERT( view->isExternal() ); - memcpy( data, view->getVoidPtr(), nelems*sizeof(int) ); + view->setExternalDataPtr( data ); + sidre_io.loadExternalData(root,file); + +// DEBUG + SLIC_INFO( "Here is the data that was read back:" ); + root->print(); + std::cout << std::endl; +// DEBUG } //------------------------------------------------------------------------------ From bd746f501201bdbee5e793a36aead67b1c66486b Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 27 Mar 2020 11:25:40 -0700 Subject: [PATCH 111/632] DOC: add comments to external array sidre --- src/axom/sidre/examples/sidre_external_array.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 943bd34ace..1f64222a15 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -76,7 +76,10 @@ void sidre_read( MPI_Comm comm, SLIC_ASSERT( root->hasChildView("data") ); sidre::View* view = root->getView( "data" ); + SLIC_ASSERT( view->isDescribed() ); + SLIC_ASSERT( view->isExternal() ); + // get the array shape information sidre::IndexType shape[2]; view->getShape( 2, shape ); numTuples = shape[ 0 ]; @@ -85,12 +88,14 @@ void sidre_read( MPI_Comm comm, axom::IndexType nelems = view->getNumElements(); SLIC_ASSERT( nelems==(numTuples*numComponents) ); + // allocate external data data = axom::allocate< int >(nelems); SLIC_ASSERT( data != nullptr ); - SLIC_ASSERT( view->isDescribed() ); - SLIC_ASSERT( view->isExternal() ); + // set external data for the view view->setExternalDataPtr( data ); + + // load the external data sidre_io.loadExternalData(root,file); // DEBUG From 366dc7fbea681ecf2b7a4ba327990ef412f40e78 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 27 Mar 2020 15:24:04 -0700 Subject: [PATCH 112/632] COMP: fix cuda build Don't #include "axom/core.hpp" to avoid requiring linking RAJA and CUDA in the sidre_array and sidre_external_array examples, which, do not require it. --- src/axom/sidre/examples/sidre_array.cpp | 4 +++- src/axom/sidre/examples/sidre_external_array.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp index c37b263e3b..1a51818df3 100644 --- a/src/axom/sidre/examples/sidre_array.cpp +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -4,7 +4,9 @@ // SPDX-License-Identifier: (BSD-3-Clause) // Axom includes -#include "axom/core.hpp" // for Axom types and macros +#include "axom/core/Types.hpp" // for Axom types +#include "axom/core/Macros.hpp" // for Axom macros + #include "axom/sidre.hpp" // for sidre #include "axom/slic.hpp" // for logging with slic diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 1f64222a15..43fcf519a0 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -4,7 +4,9 @@ // SPDX-License-Identifier: (BSD-3-Clause) // Axom includes -#include "axom/core.hpp" // for Axom types and macros +#include "axom/core/Types.hpp" // for Axom types +#include "axom/core/Macros.hpp" // for Axom macros + #include "axom/sidre.hpp" // for sidre #include "axom/slic.hpp" // for logging with slic From 126b2167db4f28d3145f45a411150e8e07b8f3f9 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Fri, 27 Mar 2020 16:15:54 -0700 Subject: [PATCH 113/632] New abstract base class sidre::ItemCollection is parent of MapCollection and ListCollection --- src/axom/sidre/CMakeLists.txt | 1 + src/axom/sidre/core/DataStore.cpp | 2 +- src/axom/sidre/core/Group.cpp | 24 +- src/axom/sidre/core/Group.hpp | 8 +- src/axom/sidre/core/ItemCollection.hpp | 217 +++++++++++++++ src/axom/sidre/core/ListCollection.hpp | 366 +++++++++++++++++++++++++ src/axom/sidre/core/MapCollection.hpp | 3 +- 7 files changed, 609 insertions(+), 12 deletions(-) create mode 100644 src/axom/sidre/core/ItemCollection.hpp create mode 100644 src/axom/sidre/core/ListCollection.hpp diff --git a/src/axom/sidre/CMakeLists.txt b/src/axom/sidre/CMakeLists.txt index f0da3a9bb7..f77d762f6d 100644 --- a/src/axom/sidre/CMakeLists.txt +++ b/src/axom/sidre/CMakeLists.txt @@ -27,6 +27,7 @@ set(sidre_headers core/Attribute.hpp core/AttrValues.hpp core/Iterator.hpp + core/ListCollection.hpp core/MapCollection.hpp core/SidreTypes.hpp core/SidreDataTypeIds.h diff --git a/src/axom/sidre/core/DataStore.cpp b/src/axom/sidre/core/DataStore.cpp index 0956f8a84d..e4ff22004f 100644 --- a/src/axom/sidre/core/DataStore.cpp +++ b/src/axom/sidre/core/DataStore.cpp @@ -110,7 +110,7 @@ DataStore::DataStore() conduit::utils::set_warning_handler( DataStoreConduitWarningHandler ); conduit::utils::set_info_handler( DataStoreConduitInfoHandler ); - m_RootGroup = new Group("", this); + m_RootGroup = new Group("", this, false); m_RootGroup->m_parent = m_RootGroup; }; diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index 75c2cd5ede..6cdb83a902 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -13,6 +13,7 @@ #endif // Sidre headers +#include "ListCollection.hpp" #include "MapCollection.hpp" #include "Buffer.hpp" #include "DataStore.hpp" @@ -904,7 +905,7 @@ Group* Group::createGroup( const std::string& path ) return nullptr; } - Group* new_group = new(std::nothrow) Group(intpath, group->getDataStore()); + Group* new_group = new(std::nothrow) Group(intpath, group->getDataStore(), false); if ( new_group == nullptr ) { return nullptr; @@ -1669,17 +1670,28 @@ void Group::loadExternalData(const hid_t& h5_id) ************************************************************************* */ Group::Group(const std::string& name, - DataStore* datastore) + DataStore* datastore, + bool is_list) : m_name(name) , m_index(InvalidIndex) , m_parent(nullptr) , m_datastore(datastore) - , m_view_coll(new ViewCollection()) - , m_group_coll(new GroupCollection()) + , m_view_coll(0) + , m_group_coll(0) #ifdef AXOM_USE_UMPIRE , m_default_allocator_id(axom::getDefaultAllocatorID()) #endif -{} +{ + if (is_list) + { + m_view_coll = new ListCollection(); + m_group_coll = new ListCollection(); + } else + { + m_view_coll = new MapCollection(); + m_group_coll = new MapCollection(); + } +} /* ************************************************************************* @@ -1705,7 +1717,7 @@ Group::~Group() */ View* Group::attachView(View* view) { - if ( view == nullptr || hasChildView(view->getName()) ) + if ( view == nullptr || (!view->getName().empty() && hasChildView(view->getName())) ) { return nullptr; } diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index 239e481c87..ac3e433fb6 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -55,7 +55,7 @@ namespace sidre class Buffer; class Group; class DataStore; -template class MapCollection; +template class ItemCollection; /*! * \class Group @@ -1438,7 +1438,7 @@ class Group * attachGroup must be called on a newly created Group to insert it * into the hierarchy. The root group is an exception to this rule. */ - Group(const std::string& name, DataStore* datastore); + Group(const std::string& name, DataStore* datastore, bool is_list); /*! * \brief Destructor destroys all Views and child Groups. @@ -1615,9 +1615,9 @@ class Group /////////////////////////////////////////////////////////////////// // - using ViewCollection = MapCollection; + using ViewCollection = ItemCollection; // - using GroupCollection = MapCollection; + using GroupCollection = ItemCollection; /////////////////////////////////////////////////////////////////// /// Collection of Views diff --git a/src/axom/sidre/core/ItemCollection.hpp b/src/axom/sidre/core/ItemCollection.hpp new file mode 100644 index 0000000000..86b8c07359 --- /dev/null +++ b/src/axom/sidre/core/ItemCollection.hpp @@ -0,0 +1,217 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +/*! + ****************************************************************************** + * + * \file ItemCollection.hpp + * + * \brief Header file for Collection classes. + * + * Each of these classes holds a collection of items of a fixed + * type that can be accessed by string name or sidre::IndexType. + * + * The primary intent is to decouple the implementation of the + * collections from the Group class which owns collections of + * View and child Group objects. They may have other uses, + * so they are not dependent on the Group class. Each class is + * templated on the item type so that the same class can be used + * to hold either View or Group object pointers without + * having to code a separate class for each. + * + * By having various collections that obey the same interface, + * we can explore alternative collection implementations for + * performance (insertion, lookup, etc.) and memory overhead. + * The collection used by the Group class can be changed via + * the collection type alias in the Group class header file. + * + * To try another collection, encapsulate it in a new class with + * the API described below or pass it as a template parameter to + * an existing class below if that works. + * + * \attention These classes should be robust against any potential + * user interaction. They don't report errors and leave + * checking of return values to calling code. + * + * \attention Template parameter type must provide a method + * "getName()" that returns a reference to a string object. + * + * \attention The common interface each collection class provides + * is as follows: + * + * \verbatim + * + * - // Return number of items in collection. + * + * size_t getNumItems() const; + * + * - // Return first valid item index (i.e., smallest index over + * // all items). + * // sidre::InvalidIndex returned if no items in collection + * + * IndexType getFirstValidIndex() const; + * + * - // Return next valid item index after given index (i.e., smallest + * // index over all indices larger than given one). + * // sidre::InvalidIndex returned + * + * IndexType getNextValidIndex(IndexType idx) const; + * + * - // Return true if item with given name in collection; else false. + * + * bool hasItem(const std::string& name) const; + * + * - // Return true if item with given index in collection; else false. + * + * bool hasItem(IndexType idx) const; + * + * - // Return pointer to item with given name (nullptr if none). + * + * TYPE* getItem(const std::string& name); + * TYPE const* getItem(const std::string& name) const ; + * + * - // Return pointer to item with given index (nullptr if none). + * + * TYPE* getItem(IndexType idx); + * TYPE const* getItem(IndexType idx) const; + * + * - // Return name of object with given index + * // (sidre::InvalidName if none). + * + * std::string getItemName(IndexType idx) const; + * + * - // Return index of object with given name + * // (sidre::InvalidName if none). + * + * IndexType getItemIndex(const std::string& name) const; + * + * - // Insert item with given name; return index if insertion + * // succeeded, and InvalidIndex otherwise. + * + * IndexType insertItem(TYPE* item, const std::string& name); + * + * - // Remove item with given name if it exists and return a + * // pointer to it. If it doesn't exist, return nullptr. + * + * TYPE* removeItem(const std::string& name); + * + * - // Remove item with given name if it exists and return a + * // pointer to it. If it doesn't exist, return nullptr. + * + * TYPE* removeItem(IndexType idx); + * + * - // Remove all items (items not destroyed). + * + * void removeAllItems(); + * + * - // Clear all items and destroy them. + * + * void deleteAllItems(); + * + * \endverbatim + * + ****************************************************************************** + */ + +#ifndef SIDRE_ITEMCOLLECTIONS_HPP_ +#define SIDRE_ITEMCOLLECTIONS_HPP_ + +// Other axom headers +#include "axom/config.hpp" +#include "axom/core/Types.hpp" + +// Sidre project headers +#include "SidreTypes.hpp" + +namespace axom +{ +namespace sidre +{ + +//////////////////////////////////////////////////////////////////////// +// +// ItemCollection keeps an index constant for each item +// as long as it remains in the collection; i.e., don't shift indices +// around. It has the additional benefit that users can hold on to +// item indices without them being changed without notice. +// +//////////////////////////////////////////////////////////////////////// + +/*! + ************************************************************************* + * + * \class ItemCollection + * + * \brief ItemCollection is an abstract base class template for holding + * a collection of items of template parameter type TYPE. Derived + * child classes can determine how to specifically store the items. + * + ************************************************************************* + */ +template< typename TYPE > +class ItemCollection +{ +public: + + virtual ~ItemCollection() {} + + // + // Default compiler-generated ctor, dtor, copy ctor, and copy assignment + // operator suffice for this class. + // + + /// + virtual size_t getNumItems() const = 0; + + /// + virtual IndexType getFirstValidIndex() const = 0; + + /// + virtual IndexType getNextValidIndex(IndexType idx) const = 0; + + /// + virtual bool hasItem(const std::string& name) const = 0; + + /// + virtual bool hasItem(IndexType idx) const = 0; + + /// + virtual TYPE* getItem(const std::string& name) = 0; + + /// + virtual TYPE const* getItem(const std::string& name) const = 0; + + /// + virtual TYPE* getItem(IndexType idx) = 0; + + /// + virtual TYPE const* getItem(IndexType idx) const = 0; + + /// + virtual const std::string& getItemName(IndexType idx) const = 0; + + /// + virtual IndexType getItemIndex(const std::string& name) const = 0; + + /// + virtual IndexType insertItem(TYPE* item, const std::string& name) = 0; + + /// + virtual TYPE* removeItem(const std::string& name) = 0; + + /// + virtual TYPE* removeItem(IndexType idx) = 0; + + /// + virtual void removeAllItems() = 0; + +private: + +}; + +} /* end namespace sidre */ +} /* end namespace axom */ + +#endif /* SIDRE_ITEMCOLLECTIONS_HPP_ */ diff --git a/src/axom/sidre/core/ListCollection.hpp b/src/axom/sidre/core/ListCollection.hpp new file mode 100644 index 0000000000..c716564841 --- /dev/null +++ b/src/axom/sidre/core/ListCollection.hpp @@ -0,0 +1,366 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +/*! + ****************************************************************************** + * + * \file ListCollection.hpp + * + * \brief Header file for Collection classes. + * + * Each of these classes holds a collection of items of a fixed + * type that can be accessed by an iterator or sidre::IndexType. + * + * The primary intent is to decouple the implementation of the + * collections from the Group class which owns collections of + * View and child Group objects. They may have other uses, + * so they are not dependent on the Group class. Each class is + * templated on the item type so that the same class can be used + * to hold either View or Group object pointers without + * having to code a separate class for each. + * + * By having various collections that obey the same interface, + * we can explore alternative collection implementations for + * performance (insertion, lookup, etc.) and memory overhead. + * The collection used by the Group class can be changed via + * the collection type alias in the Group class header file. + * + * To try another collection, encapsulate it in a new class with + * the API described below or pass it as a template parameter to + * an existing class below if that works. + * + * \attention These classes should be robust against any potential + * user interaction. They don't report errors and leave + * checking of return values to calling code. + * + * \attention Template parameter type must provide a method + * "getName()" that returns a reference to a string object. + * + * \attention The common interface each collection class provides + * is as follows: + * + * \verbatim + * + * - // Return number of items in collection. + * + * size_t getNumItems() const; + * + * - // Return first valid item index (i.e., smallest index over + * // all items). + * // sidre::InvalidIndex returned if no items in collection + * + * IndexType getFirstValidIndex() const; + * + * - // Return next valid item index after given index (i.e., smallest + * // index over all indices larger than given one). + * // sidre::InvalidIndex returned + * + * IndexType getNextValidIndex(IndexType idx) const; + * + * - // Return true if item with given name in collection; else false. + * + * bool hasItem(const std::string& name) const; + * + * - // Return true if item with given index in collection; else false. + * + * bool hasItem(IndexType idx) const; + * + * - // Return pointer to item with given name (nullptr if none). + * + * TYPE* getItem(const std::string& name); + * TYPE const* getItem(const std::string& name) const ; + * + * - // Return pointer to item with given index (nullptr if none). + * + * TYPE* getItem(IndexType idx); + * TYPE const* getItem(IndexType idx) const; + * + * - // Return name of object with given index + * // (sidre::InvalidName if none). + * + * std::string getItemName(IndexType idx) const; + * + * - // Return index of object with given name + * // (sidre::InvalidName if none). + * + * IndexType getItemIndex(const std::string& name) const; + * + * - // Insert item with given name; return index if insertion + * // succeeded, and InvalidIndex otherwise. + * + * IndexType insertItem(TYPE* item, const std::string& name); + * + * - // Remove item with given name if it exists and return a + * // pointer to it. If it doesn't exist, return nullptr. + * + * TYPE* removeItem(const std::string& name); + * + * - // Remove item with given name if it exists and return a + * // pointer to it. If it doesn't exist, return nullptr. + * + * TYPE* removeItem(IndexType idx); + * + * - // Remove all items (items not destroyed). + * + * void removeAllItems(); + * + * - // Clear all items and destroy them. + * + * void deleteAllItems(); + * + * \endverbatim + * + ****************************************************************************** + */ + +#ifndef SIDRE_LISTCOLLECTIONS_HPP_ +#define SIDRE_LISTCOLLECTIONS_HPP_ + +// Standard C++ headers +#include +#include +#include +#include +#include + +// Other axom headers +#include "axom/config.hpp" +#include "axom/core/Types.hpp" + +// Sidre project headers +#include "SidreTypes.hpp" +#include "ItemCollection.hpp" + + + +namespace axom +{ +namespace sidre +{ + +//////////////////////////////////////////////////////////////////////// +// +// ListCollection keeps an index constant for each item +// as long as it remains in the collection; i.e., don't shift indices +// around. It has the additional benefit that users can hold on to +// item indices without them being changed without notice. +// +//////////////////////////////////////////////////////////////////////// + +/*! + ************************************************************************* + * + * \class ListCollection + * + * \brief ListCollection is a container class template for holding + * a collection of items of template parameter type TYPE, using + * a list container. + * + ************************************************************************* + */ +template +class ListCollection : public ItemCollection +{ +public: + + // + // Default compiler-generated ctor, dtor, copy ctor, and copy assignment + // operator suffice for this class. + // + + /// + size_t getNumItems() const + { + return m_items.size() - m_free_ids.size(); + } + + /// + IndexType getFirstValidIndex() const; + + /// + IndexType getNextValidIndex(IndexType idx) const; + + /// + bool hasItem(const std::string& name) const + { + SLIC_ERROR(" "); + return false; + } + + /// + bool hasItem(IndexType idx) const + { + return (idx >= 0 && + static_cast(idx) < m_items.size() && + m_items[static_cast(idx)]); + } + + /// + TYPE* getItem(const std::string& name) + { + SLIC_ERROR(" "); + return 0; + } + + /// + TYPE const* getItem(const std::string& name) const + { + SLIC_ERROR(" "); + return 0; + } + + /// + TYPE* getItem(IndexType idx) + { + return ( hasItem(idx) ? m_items[static_cast(idx)] : nullptr ); + } + + /// + TYPE const* getItem(IndexType idx) const + { + return ( hasItem(idx) ? m_items[static_cast(idx)] : nullptr ); + } + + /// + const std::string& getItemName(IndexType idx) const + { + return InvalidName; + } + + /// + IndexType getItemIndex(const std::string& name) const + { + SLIC_ERROR(" "); + return 0; + } + + /// + IndexType insertItem(TYPE* item, const std::string& name); + + /// + TYPE* removeItem(const std::string& name); + + /// + TYPE* removeItem(IndexType idx); + + /// + void removeAllItems() + { + m_items.clear(); + while ( !m_free_ids.empty() ) + { + m_free_ids.pop(); + } + m_index_list.clear(); + } + +private: + std::vector m_items; + std::stack< IndexType > m_free_ids; + + std::list< IndexType > m_index_list; + +}; + +template +IndexType ListCollection::getFirstValidIndex() const +{ + IndexType idx = 0; + while ( static_cast(idx) < m_items.size() && + m_items[static_cast(idx)] == nullptr ) + { + idx++; + } + return ( (static_cast(idx) < m_items.size()) ? idx : InvalidIndex ); +} + +template +IndexType ListCollection::getNextValidIndex(IndexType idx) const +{ + if (idx == InvalidIndex) + { + return InvalidIndex; + } + + idx++; + while ( static_cast(idx) < m_items.size() && + m_items[static_cast(idx)] == nullptr ) + { + idx++; + } + return ( (static_cast(idx) < m_items.size()) ? idx : InvalidIndex ); +} + + +template +IndexType ListCollection::insertItem(TYPE* item, + const std::string& name) +{ + bool use_recycled_index = false; + IndexType idx = m_items.size(); + if ( !m_free_ids.empty() ) + { + idx = m_free_ids.top(); + m_free_ids.pop(); + use_recycled_index = true; + } + + if ( name.empty() ) + { + m_index_list.push_back(idx); + // name was inserted into map + if ( use_recycled_index ) + { + m_items[idx] = item; + } + else + { + m_items.push_back(item); + } + return idx; + } + else + { + // name was NOT inserted into map, return free index if necessary + if ( use_recycled_index ) + { + m_free_ids.push(idx); + } + return InvalidIndex; + } +} + +template +TYPE* ListCollection::removeItem(const std::string& name) +{ + SLIC_ERROR( " " ); + return 0; +} + +template +TYPE* ListCollection::removeItem(IndexType idx) +{ + TYPE* ret_val = nullptr; + if ( hasItem(idx) ) + { + for (auto itr = m_index_list.begin(); itr != m_index_list.end(); ++itr) + { + if (*itr == idx) + { + ret_val = m_items[idx]; + m_index_list.erase(itr); + m_items[idx] = nullptr; + m_free_ids.push(idx); + } + } + } + + return ret_val; +} + +} /* end namespace sidre */ +} /* end namespace axom */ + +#endif /* SIDRE_LIST_COLLECTIONS_HPP_ */ diff --git a/src/axom/sidre/core/MapCollection.hpp b/src/axom/sidre/core/MapCollection.hpp index 6a509bde24..f6b186a2fa 100644 --- a/src/axom/sidre/core/MapCollection.hpp +++ b/src/axom/sidre/core/MapCollection.hpp @@ -130,6 +130,7 @@ // Sidre project headers #include "SidreTypes.hpp" +#include "ItemCollection.hpp" #if defined(AXOM_USE_SPARSEHASH) #include @@ -168,7 +169,7 @@ namespace sidre ************************************************************************* */ template -class MapCollection +class MapCollection : public ItemCollection { public: From c98fe34ad8bdd0470bd335c9a41b4658b91b86c5 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sat, 28 Mar 2020 22:27:06 -0700 Subject: [PATCH 114/632] BUGFIX: fix sidre array example Add MPI barriers to synchronize all ranks after write() and read(). --- src/axom/sidre/examples/sidre_array.cpp | 2 ++ src/axom/sidre/examples/sidre_external_array.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp index 1a51818df3..f438d87af8 100644 --- a/src/axom/sidre/examples/sidre_array.cpp +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -61,11 +61,13 @@ int main ( int argc, char** argv ) // STEP 2: save the array data in to a file sidre::IOManager sidre_io( problem_comm ); sidre_io.write( root1, nranks, "mesh", "sidre_hdf5" ); + MPI_Barrier( problem_comm ); // STEP 3: read the data from the file into a new DataStore sidre::DataStore* dataStore2 = new sidre::DataStore(); sidre::Group* root2 = dataStore2->getRoot(); sidre_io.read( root2, "mesh.root"); + MPI_Barrier( problem_comm ); // DEBUG SLIC_INFO( "Here is the array data in DataStore_2:\n" ); diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 43fcf519a0..2040ba59e5 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -54,6 +54,7 @@ void sidre_write( MPI_Comm comm, // STEP 2: save the array data in to a file sidre::IOManager sidre_io( comm ); sidre_io.write( root, nranks, file, "sidre_hdf5" ); + MPI_Barrier( comm ); } //------------------------------------------------------------------------------ @@ -75,6 +76,7 @@ void sidre_read( MPI_Comm comm, sidre::IOManager sidre_io( comm ); sidre_io.read( root, file ); + MPI_Barrier( comm ); SLIC_ASSERT( root->hasChildView("data") ); sidre::View* view = root->getView( "data" ); @@ -99,6 +101,7 @@ void sidre_read( MPI_Comm comm, // load the external data sidre_io.loadExternalData(root,file); + MPI_Barrier( comm ); // DEBUG SLIC_INFO( "Here is the data that was read back:" ); From fd1918e912e623589c091ad5a52304f4a60809fd Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Mon, 30 Mar 2020 09:53:09 -0700 Subject: [PATCH 115/632] Add MPI barriers and some documentation clarification in IOManager --- src/axom/sidre/spio/IOManager.cpp | 5 ++++- src/axom/sidre/spio/IOManager.hpp | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/axom/sidre/spio/IOManager.cpp b/src/axom/sidre/spio/IOManager.cpp index 3b2b9c1e36..007df06300 100644 --- a/src/axom/sidre/spio/IOManager.cpp +++ b/src/axom/sidre/spio/IOManager.cpp @@ -257,10 +257,10 @@ void IOManager::write(sidre::Group* datagroup, int num_files, } (void)m_baton->pass(); + MPI_Barrier(m_mpi_comm); #ifdef AXOM_USE_SCR if (m_use_scr) { - MPI_Barrier(m_mpi_comm); int valid = 1; SCR_Complete_checkpoint(valid); } @@ -280,6 +280,8 @@ void IOManager::read( const std::string& protocol, bool preserve_contents) { + MPI_Barrier(m_mpi_comm); + if (protocol == "sidre_hdf5") { #ifdef AXOM_USE_HDF5 @@ -331,6 +333,7 @@ void IOManager::read(sidre::Group* datagroup, bool preserve_contents, bool read_with_scr) { + MPI_Barrier(m_mpi_comm); if (!read_with_scr) { diff --git a/src/axom/sidre/spio/IOManager.hpp b/src/axom/sidre/spio/IOManager.hpp index e42d603d03..425413e44a 100644 --- a/src/axom/sidre/spio/IOManager.hpp +++ b/src/axom/sidre/spio/IOManager.hpp @@ -68,6 +68,8 @@ class IOManager * The Group, including all of its child groups and views, is written * to files according to the given protocol. * + * This is an MPI collective call. + * * valid protocols: * * sidre_hdf5 @@ -224,7 +226,11 @@ class IOManager const std::string& mesh_path); /*! - * \brief read from input files + * \brief read from input file + * + * This is an MPI collective call. Calling code may also need to add + * an MPI barrier after this call if invoking subsequent operations that + * may change the inpt files. * * \param group Group to fill with input data * \param file_string base name of input files @@ -239,6 +245,10 @@ class IOManager /*! * \brief read from a root file * + * This is an MPI collective call. Calling code may also need to add + * an MPI barrier after this call if invoking subsequent operations that + * may change the inpt files. + * * \param group Group to fill with input data * \param root_file root file containing input data * \param preserve_contents Preserves group's existing contents if true From c3d6935ca9ed40bfde7ac408a93a8a483cf0372f Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Tue, 31 Mar 2020 10:06:44 -0700 Subject: [PATCH 116/632] Remove barriers from sidre examples now that they have been added inside IOManager methods. --- src/axom/sidre/examples/sidre_array.cpp | 2 -- src/axom/sidre/examples/sidre_external_array.cpp | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp index f438d87af8..1a51818df3 100644 --- a/src/axom/sidre/examples/sidre_array.cpp +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -61,13 +61,11 @@ int main ( int argc, char** argv ) // STEP 2: save the array data in to a file sidre::IOManager sidre_io( problem_comm ); sidre_io.write( root1, nranks, "mesh", "sidre_hdf5" ); - MPI_Barrier( problem_comm ); // STEP 3: read the data from the file into a new DataStore sidre::DataStore* dataStore2 = new sidre::DataStore(); sidre::Group* root2 = dataStore2->getRoot(); sidre_io.read( root2, "mesh.root"); - MPI_Barrier( problem_comm ); // DEBUG SLIC_INFO( "Here is the array data in DataStore_2:\n" ); diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 2040ba59e5..43fcf519a0 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -54,7 +54,6 @@ void sidre_write( MPI_Comm comm, // STEP 2: save the array data in to a file sidre::IOManager sidre_io( comm ); sidre_io.write( root, nranks, file, "sidre_hdf5" ); - MPI_Barrier( comm ); } //------------------------------------------------------------------------------ @@ -76,7 +75,6 @@ void sidre_read( MPI_Comm comm, sidre::IOManager sidre_io( comm ); sidre_io.read( root, file ); - MPI_Barrier( comm ); SLIC_ASSERT( root->hasChildView("data") ); sidre::View* view = root->getView( "data" ); @@ -101,7 +99,6 @@ void sidre_read( MPI_Comm comm, // load the external data sidre_io.loadExternalData(root,file); - MPI_Barrier( comm ); // DEBUG SLIC_INFO( "Here is the data that was read back:" ); From 01d5f301f96d2bb1bcbd8b15e761369cca826f3a Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Tue, 31 Mar 2020 11:53:05 -0700 Subject: [PATCH 117/632] Re-insert barrier in sidre_array --- src/axom/sidre/examples/sidre_array.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp index 1a51818df3..a2d7c764f5 100644 --- a/src/axom/sidre/examples/sidre_array.cpp +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -66,6 +66,7 @@ int main ( int argc, char** argv ) sidre::DataStore* dataStore2 = new sidre::DataStore(); sidre::Group* root2 = dataStore2->getRoot(); sidre_io.read( root2, "mesh.root"); + MPI_Barrier(problem_comm); // DEBUG SLIC_INFO( "Here is the array data in DataStore_2:\n" ); From 2df601c16bcb09b0882202ff744b567e25698f3d Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Tue, 31 Mar 2020 14:08:45 -0700 Subject: [PATCH 118/632] Give unique file names for I/O in sidre array examples --- src/axom/sidre/examples/sidre_array.cpp | 5 ++--- src/axom/sidre/examples/sidre_external_array.cpp | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp index a2d7c764f5..558c526185 100644 --- a/src/axom/sidre/examples/sidre_array.cpp +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -60,13 +60,12 @@ int main ( int argc, char** argv ) // STEP 2: save the array data in to a file sidre::IOManager sidre_io( problem_comm ); - sidre_io.write( root1, nranks, "mesh", "sidre_hdf5" ); + sidre_io.write( root1, nranks, "sidre_array_mesh", "sidre_hdf5" ); // STEP 3: read the data from the file into a new DataStore sidre::DataStore* dataStore2 = new sidre::DataStore(); sidre::Group* root2 = dataStore2->getRoot(); - sidre_io.read( root2, "mesh.root"); - MPI_Barrier(problem_comm); + sidre_io.read( root2, "sidre_array_mesh.root"); // DEBUG SLIC_INFO( "Here is the array data in DataStore_2:\n" ); diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 43fcf519a0..583d992d62 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -130,7 +130,7 @@ int main ( int argc, char** argv ) // STEP 1: dump the data to a file using sidre SLIC_INFO( "Writting data..." ); - sidre_write( problem_comm, "mesh", data, NUM_NODES, DIMENSION ); + sidre_write( problem_comm, "sidre_external_array_mesh", data, NUM_NODES, DIMENSION ); SLIC_INFO( "[DONE]" ); // STEP 2: read the data from a file using sidre @@ -139,7 +139,7 @@ int main ( int argc, char** argv ) axom::IndexType ncomp = -1; SLIC_INFO( "Reading data..." ); - sidre_read( problem_comm, "mesh.root", data2, ntuples, ncomp ); + sidre_read( problem_comm, "sidre_external_array_mesh.root", data2, ntuples, ncomp ); SLIC_INFO( "[DONE]" ); // STEP 3: check the data From 11a4df59e06b418361efe9ca004702958f67945a Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 2 Apr 2020 20:36:20 -0700 Subject: [PATCH 119/632] Add devtools to rzmanta, Update specs for rzmanta, Build TPLs for rzmanta --- ...s_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake} | 75 +++++------ ...ueos_3_ppc64le_ib-clang@upstream_xlf.cmake | 71 +++++----- ...manta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake} | 76 ++++++----- ...rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake | 72 +++++------ .../rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake | 122 ++++++++++++++++++ .../blueos_3_ppc64le_ib/compilers.yaml | 50 ++++--- .../devtools/compilers.yaml | 14 ++ .../devtools/packages.yaml | 96 ++++++++++++++ .../blueos_3_ppc64le_ib/packages.yaml | 62 +++++++-- scripts/uberenv/specs.json | 7 +- 10 files changed, 460 insertions(+), 185 deletions(-) rename host-configs/{rzmanta-blueos_3_ppc64le_ib-clang@upstream_nvcc_xlf.cmake => rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake} (61%) rename host-configs/{rzmanta-blueos_3_ppc64le_ib-gcc@4.9.3.cmake => rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake} (52%) create mode 100644 host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake create mode 100644 scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/compilers.yaml create mode 100644 scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_nvcc_xlf.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake similarity index 61% rename from host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_nvcc_xlf.cmake rename to host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake index e1a10c8fe0..c70a3df1dc 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_nvcc_xlf.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake @@ -5,83 +5,82 @@ # other Axom Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ - #------------------------------------------------------------------------------ # SYS_TYPE: blueos_3_ppc64le_ib -# Compiler Spec: clang@upstream_nvcc_xlf +# Compiler Spec: clang@8.0.1_nvcc_xlf +#------------------------------------------------------------------------------ +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ - -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/clang-upstream_nvcc_xlf/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack -set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang" CACHE PATH "") +set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-8.0.1/bin/clang" CACHE PATH "") -# C++ compiler used by spack -set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang++" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-8.0.1/bin/clang++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/clang-upstream_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/clang-8.0.1_nvcc_xlf" CACHE PATH "") -# conduit from uberenv -set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") +set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") + +# SCR not built -# scr not built by uberenv +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.9.0/share/raja/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(ENABLE_MPI ON CACHE BOOL "") -# python not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpicc" CACHE PATH "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpicxx" CACHE PATH "") -# shroud not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpif90" CACHE PATH "") -# uncrustify not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpirun" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") -# cppcheck not built by uberenv +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics @@ -93,7 +92,7 @@ set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report cl set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2018.11.26/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") #------------------------------------------------------------------------------ # Cuda @@ -105,6 +104,8 @@ set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") +set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") + set(AXOM_CUDA_ARCH "sm_60" CACHE PATH "") set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake index 18710e68d3..44bca0f3f5 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake @@ -5,83 +5,82 @@ # other Axom Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ - #------------------------------------------------------------------------------ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: clang@upstream_xlf #------------------------------------------------------------------------------ - -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/clang-upstream_xlf/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +#------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack -set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang" CACHE PATH "") +set(CMAKE_C_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang" CACHE PATH "") -# C++ compiler used by spack -set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang++" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/clang-upstream_xlf" CACHE PATH "") -# conduit from uberenv -set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") +set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# scr not built by uberenv +# SCR not built -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.9.0/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# python not built by uberenv +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -set(ENABLE_DOCS OFF CACHE BOOL "") +set(ENABLE_MPI ON CACHE BOOL "") -# shroud not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicc" CACHE PATH "") -# uncrustify not built by uberenv +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicxx" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -# cppcheck not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") + +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics @@ -93,6 +92,6 @@ set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report cl set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2018.11.26/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@4.9.3.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake similarity index 52% rename from host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@4.9.3.cmake rename to host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake index d9438b5245..878ab6db52 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@4.9.3.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake @@ -1,95 +1,93 @@ #------------------------------------------------------------------------------ # !!!! This is a generated file, edit at own risk !!!! #------------------------------------------------------------------------------ - # Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and # other Axom Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ - #------------------------------------------------------------------------------ # SYS_TYPE: blueos_3_ppc64le_ib -# Compiler Spec: gcc@4.9.3 +# Compiler Spec: gcc@7.3.1 +#------------------------------------------------------------------------------ +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ - -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/gcc-4.9.3/cmake-3.9.6/bin/cmake #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack -set(CMAKE_C_COMPILER "/usr/tcetmp/packages/gcc/gcc-4.9.3/bin/gcc" CACHE PATH "") +set(CMAKE_C_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gcc" CACHE PATH "") -# C++ compiler used by spack -set(CMAKE_CXX_COMPILER "/usr/tcetmp/packages/gcc/gcc-4.9.3/bin/g++" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/g++" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tcetmp/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/gcc-4.9.3" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/gcc-7.3.1" CACHE PATH "") -# conduit from uberenv -set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") +set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") + +# SCR not built -# scr not built by uberenv +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.9.0/share/raja/cmake" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(ENABLE_MPI ON CACHE BOOL "") -# python not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpicc" CACHE PATH "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpicxx" CACHE PATH "") -# shroud not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpif90" CACHE PATH "") -# uncrustify not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpirun" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") -# cppcheck not built by uberenv +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-4.9.3/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-4.9.3/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-4.9.3/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-4.9.3/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics #------------------------------------------------------------------------------ -set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") - set(ENABLE_OPENMP ON CACHE BOOL "") +set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake index 5897fce305..8b84bfd3e5 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake @@ -1,88 +1,86 @@ #------------------------------------------------------------------------------ # !!!! This is a generated file, edit at own risk !!!! #------------------------------------------------------------------------------ - # Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and # other Axom Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ - #------------------------------------------------------------------------------ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: xl@coral #------------------------------------------------------------------------------ - -# CMake executable path: /usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/xl-coral/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +#------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Compilers #------------------------------------------------------------------------------ -# C compiler used by spack -set(CMAKE_C_COMPILER "/usr/tce/packages/xl/xl-2018.11.26/bin/xlc" CACHE PATH "") +set(CMAKE_C_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlc" CACHE PATH "") -# C++ compiler used by spack -set(CMAKE_CXX_COMPILER "/usr/tce/packages/xl/xl-2018.11.26/bin/xlC" CACHE PATH "") +set(CMAKE_CXX_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlC" CACHE PATH "") -# Fortran compiler used by spack set(ENABLE_FORTRAN ON CACHE BOOL "") -set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACHE PATH "") #------------------------------------------------------------------------------ # TPLs #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/thirdparty_libs/builds/2019_11_21_10_31_52/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/xl-coral" CACHE PATH "") -# conduit from uberenv -set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") +set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") -# mfem from uberenv set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") -# hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") -# scr not built by uberenv +# SCR not built -# raja from uberenv -set(RAJA_DIR "${TPL_ROOT}/raja-0.9.0/share/raja/cmake" CACHE PATH "") +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") + +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ -# umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0/share/umpire/cmake" CACHE PATH "") +set(ENABLE_MPI ON CACHE BOOL "") -# python not built by uberenv +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicc" CACHE PATH "") -set(ENABLE_DOCS OFF CACHE BOOL "") +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpicxx" CACHE PATH "") -# shroud not built by uberenv +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -# uncrustify not built by uberenv +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") -# lcov and genhtml not built by uberenv +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") -# cppcheck not built by uberenv +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ -# MPI +# Devtools #------------------------------------------------------------------------------ -set(ENABLE_MPI ON CACHE BOOL "") +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") -set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26/bin/mpicc" CACHE PATH "") +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") -set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26/bin/mpicxx" CACHE PATH "") +set(ENABLE_DOCS ON CACHE BOOL "") -set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26/bin/mpif90" CACHE PATH "") +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26/bin/mpirun" CACHE PATH "") +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") -set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") -set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") #------------------------------------------------------------------------------ # Other machine specifics @@ -98,6 +96,6 @@ set(CMAKE_CXX_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") -set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2018.11.26/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake new file mode 100644 index 0000000000..18bf79545c --- /dev/null +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake @@ -0,0 +1,122 @@ +#------------------------------------------------------------------------------ +# !!!! This is a generated file, edit at own risk !!!! +#------------------------------------------------------------------------------ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# SYS_TYPE: blueos_3_ppc64le_ib +# Compiler Spec: xl@nvcc +#------------------------------------------------------------------------------ +# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Compilers +#------------------------------------------------------------------------------ + +set(CMAKE_C_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlc" CACHE PATH "") + +set(CMAKE_CXX_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlC" CACHE PATH "") + +set(ENABLE_FORTRAN ON CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003" CACHE PATH "") + +#------------------------------------------------------------------------------ +# TPLs +#------------------------------------------------------------------------------ + +# Root directory for generated TPLs +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/xl-nvcc" CACHE PATH "") + +set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") + +set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") + +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") + +# SCR not built + +set(RAJA_DIR "${TPL_ROOT}/raja-0.11.0" CACHE PATH "") + +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") + +#------------------------------------------------------------------------------ +# MPI +#------------------------------------------------------------------------------ + +set(ENABLE_MPI ON CACHE BOOL "") + +set(MPI_C_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpicc" CACHE PATH "") + +set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpicxx" CACHE PATH "") + +set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpif90" CACHE PATH "") + +set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpirun" CACHE PATH "") + +set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") + +set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Devtools +#------------------------------------------------------------------------------ + +# Root directory for generated developer tools +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") + +set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") + +set(ENABLE_DOCS ON CACHE BOOL "") + +set(DOXYGEN_EXECUTABLE "${DEVTOOLS_ROOT}/doxygen-1.8.14/bin/doxygen" CACHE PATH "") + +set(SPHINX_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/sphinx-build" CACHE PATH "") + +set(SHROUD_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/shroud" CACHE PATH "") + +set(UNCRUSTIFY_EXECUTABLE "${DEVTOOLS_ROOT}/uncrustify-0.61/bin/uncrustify" CACHE PATH "") + +set(CPPCHECK_EXECUTABLE "${DEVTOOLS_ROOT}/cppcheck-1.87/bin/cppcheck" CACHE PATH "") + +#------------------------------------------------------------------------------ +# Other machine specifics +#------------------------------------------------------------------------------ + +set(ENABLE_GTEST_DEATH_TESTS OFF CACHE BOOL "") + +set(CMAKE_Fortran_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") + +set(CMAKE_C_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") + +set(CMAKE_CXX_COMPILER_ID "XL" CACHE PATH "All of BlueOS compilers report clang due to nvcc, override to proper compiler family") + +set(BLT_FORTRAN_FLAGS "-WF,-C! -qxlf2003=polymorphic" CACHE PATH "Converts C-style comments to Fortran style in preprocessed files") + +set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.08.20/lib" CACHE PATH "Adds a missing rpath for libraries associated with the fortran compiler") + +#------------------------------------------------------------------------------ +# Cuda +#------------------------------------------------------------------------------ + +set(ENABLE_CUDA ON CACHE BOOL "") + +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") + +set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") + +set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") + +set(AXOM_CUDA_ARCH "sm_60" CACHE PATH "") + +set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") + +set(CMAKE_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE PATH "") + +# nvcc does not like gtest's 'pthreads' flag +set(gtest_disable_pthreads ON CACHE BOOL "") + + diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/compilers.yaml index 84b69b0260..6ca37885c8 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/compilers.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/compilers.yaml @@ -6,11 +6,11 @@ compilers: modules: [] operating_system: rhel7 paths: - cc: /usr/tcetmp/packages/gcc/gcc-4.9.3/bin/gcc - cxx: /usr/tcetmp/packages/gcc/gcc-4.9.3/bin/g++ - f77: /usr/tcetmp/packages/gcc/gcc-4.9.3/bin/gfortran - fc: /usr/tcetmp/packages/gcc/gcc-4.9.3/bin/gfortran - spec: gcc@4.9.3 + cc: /usr/tce/packages/gcc/gcc-7.3.1/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-7.3.1/bin/g++ + f77: /usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran + spec: gcc@7.3.1 target: ppc64le - compiler: environment: {} @@ -19,10 +19,10 @@ compilers: modules: [] operating_system: rhel7 paths: - cc: /usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang - cxx: /usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang++ - f77: /usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003 - fc: /usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003 + cc: /usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang + cxx: /usr/tce/packages/clang/clang-upstream-2019.08.15/bin/clang++ + f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 spec: clang@upstream_xlf target: ppc64le - compiler: @@ -32,11 +32,11 @@ compilers: modules: [] operating_system: rhel7 paths: - cc: /usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang - cxx: /usr/tce/packages/clang/clang-upstream-2018.11.09/bin/clang++ - f77: /usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003 - fc: /usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003 - spec: clang@upstream_nvcc_xlf + cc: /usr/tce/packages/clang/clang-8.0.1/bin/clang + cxx: /usr/tce/packages/clang/clang-8.0.1/bin/clang++ + f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + spec: clang@8.0.1_nvcc_xlf target: ppc64le - compiler: environment: {} @@ -45,12 +45,24 @@ compilers: modules: [] operating_system: rhel7 paths: - cc: /usr/tce/packages/xl/xl-2018.11.26/bin/xlc - cxx: /usr/tce/packages/xl/xl-2018.11.26/bin/xlC - f77: /usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003 - fc: /usr/tce/packages/xl/xl-2018.11.26/bin/xlf2003 + cc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlc + cxx: /usr/tce/packages/xl/xl-2019.12.23/bin/xlC + f77: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003 spec: xl@coral target: ppc64le - +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: rhel7 + paths: + cc: /usr/tce/packages/xl/xl-2019.08.20/bin/xlc + cxx: /usr/tce/packages/xl/xl-2019.08.20/bin/xlC + f77: /usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003 + fc: /usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003 + spec: xl@nvcc + target: ppc64le diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/compilers.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/compilers.yaml new file mode 100644 index 0000000000..ec5366e27a --- /dev/null +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/compilers.yaml @@ -0,0 +1,14 @@ +compilers: +- compiler: + environment: {} + extra_rpaths: [] + flags: {} + modules: [] + operating_system: rhel7 + paths: + cc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gcc + cxx: /usr/tce/packages/gcc/gcc-8.3.1/bin/g++ + f77: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + fc: /usr/tce/packages/gcc/gcc-8.3.1/bin/gfortran + spec: gcc@8.3.1 + target: ppc64le diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml new file mode 100644 index 0000000000..00b0fe6cea --- /dev/null +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml @@ -0,0 +1,96 @@ + +# ------------------------------------------------------------------------- +# This file controls default concretization preferences for Spack. +# +# Settings here are versioned with Spack and are intended to provide +# sensible defaults out of the box. Spack maintainers should edit this +# file to keep it current. +# +# Users can override these settings by editing the following files. +# +# Per-spack-instance settings (overrides defaults): +# $SPACK_ROOT/etc/spack/packages.yaml +# +# Per-user settings (overrides default and site settings): +# ~/.spack/packages.yaml +# ------------------------------------------------------------------------- +packages: + all: + compiler: [gcc, intel, pgi, clang, xl, nag] + providers: + blas: [netlib-lapack] + lapack: [netlib-lapack] + mpi: [mvapich2] + cuda: + buildable: False + mvapich2: + buildable: False + openmpi: + buildable: False + mpich: + buildable: False + spectrum-mpi: + buildable: False + charmpp: + buildable: False + charm: + buildable: False + intel-mpi: + buildable: False + intel-parallel-studio: + buildable: False + fujitsu-mpi: + buildable: False + mpilander: + buildable: False + mpt: + buildable: False + + # blas is a bit more complicated because its a virtual package so fake it with + # the following per spack docs + netlib-lapack: + paths: + netlib-lapack@3.6.1: /usr + buildable: False + +# System level packages to not build + autoconf: + paths: + autoconf: /usr + buildable: False + automake: + paths: + automake: /usr + buildable: False + bzip2: + paths: + bzip2: /usr + buildable: False + gettext: + paths: + gettext: /usr + buildable: False + libtool: + paths: + libtool: /usr + buildable: False + m4: + paths: + m4: /usr + buildable: False + perl: + paths: + perl: /usr + buildable: False + pkg-config: + paths: + pkg-config: /usr + buildable: False + tar: + paths: + tar: /usr + buildable: False + +# Globally lock in version of CMake + cmake: + version: [3.9.6] diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml index d27dc5a3ad..424b0af879 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml @@ -25,7 +25,7 @@ packages: # LLNL blueos CUDA cuda: paths: - cuda@10.1.168: /usr/tce/packages/cuda/cuda-10.1.168 + cuda@10.1.243: /usr/tce/packages/cuda/cuda-10.1.243 buildable: False # LLNL blueos mpi @@ -33,10 +33,11 @@ packages: # so even though this is spectrum mpi, we call it mvapich2 mvapich2: paths: - mvapich2@2.2%gcc@4.9.3: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-4.9.3 - mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09 - mvapich2@2.2%clang@upstream_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2018.11.09 - mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2018.11.26 + mvapich2@2.2%gcc@7.3.1: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/ + mvapich2@2.2%clang@upstream_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ + mvapich2@2.2%clang@8.0.1_nvcc_xlf: /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/ + mvapich2@2.2%xl@coral : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/ + mvapich2@2.2%xl@nvcc : /usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/ buildable: False # Spack may grab for mpi & we don't want to use them openmpi: @@ -104,17 +105,50 @@ packages: paths: tar: /usr buildable: False - graphviz: - paths: - graphviz: /usr - buildable: False -# Globally lock in version of CMake +# Globally lock version of third party libraries + conduit: + version: [0.5.1] + +# Globally lock in versions of Devtools cmake: - version: [3.9.2] + version: [3.9.6] paths: - cmake: /usr/tce/packages/cmake/cmake-3.9.2 + cmake: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6 buildable: False - conduit: - version: [0.5.1] + cppcheck: + version: [1.87] + paths: + cppcheck: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cppcheck-1.87 + buildable: False + doxygen: + version: [1.8.14] + paths: + doxygen: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/doxygen-1.8.14 + buildable: False + graphviz: + version: [2.42.2] + paths: + graphviz: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/graphviz-2.42.2 + buildable: False + python: + version: [3.7.4] + paths: + python: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/python-3.7.4 + buildable: False + py-shroud: + version: [0.11.0] + paths: + py-shroud: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/python-3.7.4 + buildable: False + py-sphinx: + version: [2.2.0] + paths: + py-sphinx: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/python-3.7.4 + buildable: False + uncrustify: + version: [0.61] + paths: + uncrustify: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/uncrustify-0.61 + buildable: False diff --git a/scripts/uberenv/specs.json b/scripts/uberenv/specs.json index 8f1bd2b2d3..23c8ca9073 100644 --- a/scripts/uberenv/specs.json +++ b/scripts/uberenv/specs.json @@ -24,9 +24,10 @@ "blueos_3_ppc64le_ib": [ "clang@upstream_xlf~openmp+devtools+mfem", - "clang@upstream_nvcc_xlf~openmp+cuda+devtools+mfem", - "gcc@4.9.3+devtools+mfem", - "xl@coral~openmp+devtools+mfem" ], + "clang@8.0.1_nvcc_xlf~openmp+cuda+devtools+mfem", + "gcc@7.3.1+devtools+mfem", + "xl@coral~openmp+devtools+mfem", + "xl@nvcc~openmp+cuda+devtools+mfem" ], "blueos_3_ppc64le_ib_p9": [ "clang@upstream_xlf~openmp+devtools+mfem", From 750f029466da830bc3596c688d9dcaeadfe7e897 Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 2 Apr 2020 21:34:27 -0700 Subject: [PATCH 120/632] drop job slots down slightly --- scripts/azure-pipelines/linux-build_and_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/azure-pipelines/linux-build_and_test.sh b/scripts/azure-pipelines/linux-build_and_test.sh index f791f08d61..3e2270eae8 100755 --- a/scripts/azure-pipelines/linux-build_and_test.sh +++ b/scripts/azure-pipelines/linux-build_and_test.sh @@ -28,9 +28,9 @@ if [[ "$DO_BUILD" == "yes" ]] ; then or_die ./config-build.py -hc /home/axom/axom/host-configs/docker/${HOST_CONFIG}.cmake -DENABLE_GTEST_DEATH_TESTS=ON or_die cd build-$HOST_CONFIG-debug if [[ ${CMAKE_EXTRA_FLAGS} == *COVERAGE* ]] ; then - or_die make -j 10 + or_die make -j 8 else - or_die make -j 10 VERBOSE=1 + or_die make -j 8 VERBOSE=1 fi if [[ "${DO_TEST}" == "yes" ]] ; then make CTEST_OUTPUT_ON_FAILURE=1 test ARGS='-T Test -VV -j8' From dd1e98683243ca861f02ff38ee6180eb7eccc09a Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 2 Apr 2020 21:58:04 -0700 Subject: [PATCH 121/632] Putting job slots back to trigger build --- scripts/azure-pipelines/linux-build_and_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/azure-pipelines/linux-build_and_test.sh b/scripts/azure-pipelines/linux-build_and_test.sh index 3e2270eae8..f791f08d61 100755 --- a/scripts/azure-pipelines/linux-build_and_test.sh +++ b/scripts/azure-pipelines/linux-build_and_test.sh @@ -28,9 +28,9 @@ if [[ "$DO_BUILD" == "yes" ]] ; then or_die ./config-build.py -hc /home/axom/axom/host-configs/docker/${HOST_CONFIG}.cmake -DENABLE_GTEST_DEATH_TESTS=ON or_die cd build-$HOST_CONFIG-debug if [[ ${CMAKE_EXTRA_FLAGS} == *COVERAGE* ]] ; then - or_die make -j 8 + or_die make -j 10 else - or_die make -j 8 VERBOSE=1 + or_die make -j 10 VERBOSE=1 fi if [[ "${DO_TEST}" == "yes" ]] ; then make CTEST_OUTPUT_ON_FAILURE=1 test ARGS='-T Test -VV -j8' From 00e317d2a30cb8f57c544f1371763ec3cc0d7a0b Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 2 Apr 2020 22:18:00 -0700 Subject: [PATCH 122/632] Reorder compilers and remove clang-5 in hopes we dont run out of space --- azure-pipelines.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8894010126..2b47a62f6b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,13 +18,6 @@ strategy: COMPILER: 'g++' TEST_TARGET: 'linux_gcc6' HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@6.1.0' - linux_gcc8: - VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/tpls:gcc-8' - CMAKE_EXTRA_FLAGS: '' - COMPILER: 'g++' - TEST_TARGET: 'linux_gcc8' - HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@8.1.0' linux_gcc7: VM_ImageName: 'ubuntu-16.04' Compiler_ImageName: 'axom/tpls:gcc-7' @@ -32,6 +25,13 @@ strategy: COMPILER: 'g++' TEST_TARGET: 'linux_gcc7' HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@7.3.0' + linux_gcc8: + VM_ImageName: 'ubuntu-16.04' + Compiler_ImageName: 'axom/tpls:gcc-8' + CMAKE_EXTRA_FLAGS: '' + COMPILER: 'g++' + TEST_TARGET: 'linux_gcc8' + HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@8.1.0' linux_clang4: VM_ImageName: 'ubuntu-16.04' Compiler_ImageName: 'axom/tpls:clang-4' @@ -39,13 +39,6 @@ strategy: COMPILER: 'clang++' TEST_TARGET: 'linux_clang4' HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-clang@4.0.0' - linux_clang5: - VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/tpls:clang-5' - CMAKE_EXTRA_FLAGS: '' - COMPILER: 'clang++' - TEST_TARGET: 'linux_clang5' - HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-clang@5.0.0' linux_clang6: VM_ImageName: 'ubuntu-16.04' Compiler_ImageName: 'axom/tpls:clang-6' From cd8d384b3a08fafb053472c2bf3350e39cd5fcad Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 2 Apr 2020 22:30:55 -0700 Subject: [PATCH 123/632] Fix clean option --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2b47a62f6b..684b2aaf5b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -60,7 +60,7 @@ pool: steps: - checkout: self - clean: boolean + clean: true submodules: recursive - task: CMake@1 inputs: From 64e3261301478d91f2901ec5752d9d7823df991a Mon Sep 17 00:00:00 2001 From: Chris White Date: Thu, 2 Apr 2020 23:20:19 -0700 Subject: [PATCH 124/632] Another test to save space --- azure-pipelines.yml | 3 ++- scripts/azure-pipelines/linux-build_and_test.sh | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 684b2aaf5b..9f224c483a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,6 +8,7 @@ variables: DO_BUILD: 'yes' DO_TEST: 'yes' + DO_CLEAN: 'yes' strategy: matrix: @@ -86,7 +87,7 @@ steps: - script: | echo " -e $TEST_TARGET -e $COMPILER -e $DO_BUILD -e $DO_TEST -e $CMAKE_EXTRA_FLAGS $(Compiler_ImageName) ./scripts/azure-pipelines/linux-build_and_test.sh" docker run --rm --user='root' -v `pwd`:/home/axom/axom $(Compiler_ImageName) chown -R axom /home/axom - docker run --rm -v `pwd`:/home/axom/axom -e TEST_TARGET -e COMPILER -e DO_BUILD -e DO_TEST -e HOST_CONFIG -e CMAKE_EXTRA_FLAGS $(Compiler_ImageName) ./axom/scripts/azure-pipelines/linux-build_and_test.sh + docker run --rm -v `pwd`:/home/axom/axom -e TEST_TARGET -e COMPILER -e DO_BUILD -e DO_TEST -e DO_CLEAN -e HOST_CONFIG -e CMAKE_EXTRA_FLAGS $(Compiler_ImageName) ./axom/scripts/azure-pipelines/linux-build_and_test.sh condition: eq( variables['Agent.OS'], 'Linux') displayName: '$(TEST_TARGET) Build & Test' diff --git a/scripts/azure-pipelines/linux-build_and_test.sh b/scripts/azure-pipelines/linux-build_and_test.sh index f791f08d61..3d2845f4d1 100755 --- a/scripts/azure-pipelines/linux-build_and_test.sh +++ b/scripts/azure-pipelines/linux-build_and_test.sh @@ -43,4 +43,8 @@ fi find ./axom/sidre -type d -exec chmod 755 {} \; find ./axom/sidre -type f -exec chmod 644 {} \; +if [[ "$DO_CLEAN" == "yes" ]] ; then + make clean +fi + exit 0 From 209d19533eb09aa696d7c5827007b7e3bae8c2da Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 3 Apr 2020 12:53:33 -0700 Subject: [PATCH 125/632] Adding echos --- scripts/azure-pipelines/linux-build_and_test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/azure-pipelines/linux-build_and_test.sh b/scripts/azure-pipelines/linux-build_and_test.sh index 3d2845f4d1..cf125fd84f 100755 --- a/scripts/azure-pipelines/linux-build_and_test.sh +++ b/scripts/azure-pipelines/linux-build_and_test.sh @@ -25,18 +25,22 @@ echo HOST_CONFIG echo $HOST_CONFIG if [[ "$DO_BUILD" == "yes" ]] ; then + echo "~~~~~~ RUNNING CMAKE ~~~~~~~~" or_die ./config-build.py -hc /home/axom/axom/host-configs/docker/${HOST_CONFIG}.cmake -DENABLE_GTEST_DEATH_TESTS=ON or_die cd build-$HOST_CONFIG-debug + echo "~~~~~~ BUILDING ~~~~~~~~" if [[ ${CMAKE_EXTRA_FLAGS} == *COVERAGE* ]] ; then or_die make -j 10 else or_die make -j 10 VERBOSE=1 fi if [[ "${DO_TEST}" == "yes" ]] ; then + echo "~~~~~~ RUNNING TESTS ~~~~~~~~" make CTEST_OUTPUT_ON_FAILURE=1 test ARGS='-T Test -VV -j8' fi if [[ "${DO_MEMCHECK}" == "yes" ]] ; then - or_die ctest -T memcheck + echo "~~~~~~ RUNNING MEMCHECK ~~~~~~~~" + or_die ctest -T memcheck fi fi @@ -44,6 +48,7 @@ find ./axom/sidre -type d -exec chmod 755 {} \; find ./axom/sidre -type f -exec chmod 644 {} \; if [[ "$DO_CLEAN" == "yes" ]] ; then + echo "~~~~~~ CLEANING BUILD DIRECTORY ~~~~~~~~" make clean fi From 689a1321c2c60c537c7d9bce82b6752b75e73b03 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 3 Apr 2020 14:03:16 -0700 Subject: [PATCH 126/632] Turn off cleaning and disable gcc-6 build --- azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9f224c483a..0b15397e96 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,11 +8,12 @@ variables: DO_BUILD: 'yes' DO_TEST: 'yes' - DO_CLEAN: 'yes' + DO_CLEAN: 'no' strategy: matrix: linux_gcc6: + enabled: false VM_ImageName: 'ubuntu-16.04' Compiler_ImageName: 'axom/tpls:gcc-6' CMAKE_EXTRA_FLAGS: '' From 5ae3fef587536fc6a2757d12a14f28d53fb0eb68 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 3 Apr 2020 14:07:44 -0700 Subject: [PATCH 127/632] Try 2 to disable job --- azure-pipelines.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0b15397e96..1034d80b2f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,14 +12,14 @@ variables: strategy: matrix: - linux_gcc6: - enabled: false - VM_ImageName: 'ubuntu-16.04' - Compiler_ImageName: 'axom/tpls:gcc-6' - CMAKE_EXTRA_FLAGS: '' - COMPILER: 'g++' - TEST_TARGET: 'linux_gcc6' - HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@6.1.0' +# Temporarily disabled due to running out of space +# linux_gcc6: +# VM_ImageName: 'ubuntu-16.04' +# Compiler_ImageName: 'axom/tpls:gcc-6' +# CMAKE_EXTRA_FLAGS: '' +# COMPILER: 'g++' +# TEST_TARGET: 'linux_gcc6' +# HOST_CONFIG: 'docker-linux-ubuntu16.04-x86_64-gcc@6.1.0' linux_gcc7: VM_ImageName: 'ubuntu-16.04' Compiler_ImageName: 'axom/tpls:gcc-7' From 1da11c8eb940e8256400f793d25d8db3b33f50fb Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 31 Mar 2020 15:36:44 -0700 Subject: [PATCH 128/632] Specifies Axom's uberenv vcpkg url and commit --- scripts/uberenv/project.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/uberenv/project.json b/scripts/uberenv/project.json index eca9919010..243d743312 100644 --- a/scripts/uberenv/project.json +++ b/scripts/uberenv/project.json @@ -4,5 +4,7 @@ "package_final_phase" : "hostconfig", "package_source_dir" : "../..", "spack_url": "https://github.com/spack/spack", -"spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6" +"spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6", +"vcpkg_url": "https://github.com/microsoft/vcpkg", +"vcpkg_commit": "b79f7675aaa82eb6c5a96ae764fb1ce379a9d5d6" } From 4280a45196dda4ce23d8ba3be538147f415991e0 Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 31 Mar 2020 15:49:28 -0700 Subject: [PATCH 129/632] Changes uberenv 'triplet' command line argument to 'vcpkg_triplet` Uberenv can now get the `vcpkg_triplet` from a command line argument or from the `project.json` file. --- scripts/uberenv/uberenv.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/uberenv/uberenv.py b/scripts/uberenv/uberenv.py index 9479887da1..198561961e 100755 --- a/scripts/uberenv/uberenv.py +++ b/scripts/uberenv/uberenv.py @@ -106,7 +106,7 @@ def parse_args(): # for vcpkg, what architecture to target parser.add_option("--triplet", - dest="triplet", + dest="vcpkg_triplet", default=None, help="vcpkg architecture triplet") @@ -297,9 +297,10 @@ def __init__(self, opts, extra_opts): UberEnv.__init__(self,opts,extra_opts) # setup architecture triplet - self.triplet = opts["triplet"] - if self.triplet is None: - self.triplet = os.getenv("VCPKG_DEFAULT_TRIPLET", "x86-windows") + self.vcpkg_triplet = self.set_from_args_or_json("vcpkg_triplet", False) + print("triplet: {}".format(self.vcpkg_triplet)) + if self.vcpkg_triplet is None: + self.vcpkg_triplet = os.getenv("VCPKG_DEFAULT_TRIPLET", "x86-windows") def setup_paths_and_dirs(self): # get the current working path, and the glob used to identify the @@ -384,14 +385,14 @@ def install(self): os.chdir(self.dest_vcpkg) install_cmd = "vcpkg.exe " - install_cmd += "install {0}:{1}".format(self.pkg_name, self.triplet) + install_cmd += "install {0}:{1}".format(self.pkg_name, self.vcpkg_triplet) res = sexe(install_cmd, echo=True) # Running the install_cmd eventually generates the host config file, # which we copy to the target directory. - src_hc = pjoin(self.dest_vcpkg, "installed", self.triplet, "include", self.pkg_name, "hc.cmake") - hcfg_fname = pjoin(self.dest_dir, "{0}.{1}.cmake".format(platform.uname()[1], self.triplet)) + src_hc = pjoin(self.dest_vcpkg, "installed", self.vcpkg_triplet, "include", self.pkg_name, "hc.cmake") + hcfg_fname = pjoin(self.dest_dir, "{0}.{1}.cmake".format(platform.uname()[1], self.vcpkg_triplet)) print("[info: copying host config file to {0}]".format(hcfg_fname)) shutil.copy(os.path.abspath(src_hc), hcfg_fname) print("") From fa2f88397e413c86796f923c7cd0a6eeaf54770d Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 31 Mar 2020 15:50:32 -0700 Subject: [PATCH 130/632] Sets Axom's default 'vcpkg_triplet' in uberenv --- scripts/uberenv/project.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/uberenv/project.json b/scripts/uberenv/project.json index 243d743312..9cf9464867 100644 --- a/scripts/uberenv/project.json +++ b/scripts/uberenv/project.json @@ -6,5 +6,6 @@ "spack_url": "https://github.com/spack/spack", "spack_commit": "d98b433a3c14af5aaba03fd439f6e47cb970bac6", "vcpkg_url": "https://github.com/microsoft/vcpkg", -"vcpkg_commit": "b79f7675aaa82eb6c5a96ae764fb1ce379a9d5d6" +"vcpkg_commit": "b79f7675aaa82eb6c5a96ae764fb1ce379a9d5d6", +"vcpkg_triplet": "x64-windows" } From 38f07648963ca0040fc891ea381afdc907fd10d5 Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 31 Mar 2020 21:42:55 -0700 Subject: [PATCH 131/632] Fixes 'cmake' path in config-build on Windows --- config-build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config-build.py b/config-build.py index 66b1a9bed7..d310625c13 100755 --- a/config-build.py +++ b/config-build.py @@ -32,7 +32,7 @@ def extract_cmake_location(file_path): content = file_handle.readlines() for line in content: if line.lower().startswith(cmake_line_prefix): - return line.split(" ")[4].strip() + return line.partition(":")[2].strip() print("Could not find a cmake entry in host config file.\n" "Attempting to find cmake on your path...") cmake_path = distutils.spawn.find_executable("cmake") @@ -220,6 +220,7 @@ def create_cmake_command_line( args, unknown_args, buildpath, hostconfigpath, installpath ): cmakeline = extract_cmake_location(hostconfigpath) + cmakeline = os.path.normpath(cmakeline) # Fixes path for Windows assert cmakeline != None, ("No cmake executable found on path") assert executable_exists(cmakeline), ( "['%s'] invalid path to cmake executable or file does not have execute permissions" @@ -242,7 +243,7 @@ def create_cmake_command_line( os.chmod(ccmake_file, st.st_mode | stat.S_IEXEC) # Add cache file option - cmakeline += " -C %s" % hostconfigpath + cmakeline = '"{0}" -C {1}'.format(cmakeline,hostconfigpath) # Add build type (opt or debug) cmakeline += " -DCMAKE_BUILD_TYPE=" + args.buildtype # Set install dir From 979e37771403d8271020812fce555b0dd35dc7dd Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 31 Mar 2020 22:26:27 -0700 Subject: [PATCH 132/632] Reorganizes MSVC host-config generated by vcpkg --- .../uberenv/vcpkg_ports/axom/portfile.cmake | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/scripts/uberenv/vcpkg_ports/axom/portfile.cmake b/scripts/uberenv/vcpkg_ports/axom/portfile.cmake index 0eda49493d..8b03315416 100644 --- a/scripts/uberenv/vcpkg_ports/axom/portfile.cmake +++ b/scripts/uberenv/vcpkg_ports/axom/portfile.cmake @@ -36,45 +36,32 @@ set(_host-config_hdr [=[ # vcpkg target triplet: @TARGET_TRIPLET@ # vcpkg target triplet file: @TARGET_TRIPLET_FILE@ # -# CMake system name: @CMAKE_SYSTEM_NAME@ -# CMake system version: @CMAKE_SYSTEM_VERSION@ # CMake executable path: @CMAKE_COMMAND@ #------------------------------------------------------------------------------ -# Empty/useless variables: -# VS path: @VCPKG_VISUAL_STUDIO_PATH@ -# VC Package root: @VCPKG_ROOT@ -# Linkage: @VCPKG_CRT_LINKAGE@ -# Library linkage: @VCPKG_CRT_LINKAGE@ -# CMake system name: @VCPKG_CMAKE_SYSTEM_NAME@ -# CMake system version: @VCPKG_CMAKE_SYSTEM_VERSION@ -#------------------------------------------------------------------------------ # To configure the code using the vcpkg toolchain: -# cmake -C @_hc_file@ ../src +# cmake -C @_hc_file@ \ +# -G \ +# ../src # +# For x86 MSVC builds, use "Visual Studio 2017" as the generator +# For x64 MSVC builds, use "Visual Studio 2017 Win64" as the genererator +#------------------------------------------------------------------------------ # To build the code through the command line: # cmake --build . --target ALL_BUILD --config Debug [ -- -m:8 [-v:m] ] # # To run tests, run either: # cmake --build . --target RUN_TESTS --config Debug # ctest -C Debug [-j8] +# +# For release builds, use 'Release' in the configuration instead of 'Debug' #------------------------------------------------------------------------------ -# On Windows, build shared libraries by default. -set(BUILD_SHARED_LIBS ON CACHE BOOL "") -# Static builds require some care and effort to get right. With a static -# build, choose one of -# - disable Google Test and MSVC static MD to MT (see BLT options -# section) or -# - disable one of HDF5, conduit (which uses HDF5), or sidre (which -# uses conduit). - # Toolchain file -set(CMAKE_TOOLCHAIN_FILE @VCPKG_ROOT_PATH@/scripts/buildsystems/vcpkg.cmake CACHE FILEPATH "") -set(VCPKG_TARGET_TRIPLET @TARGET_TRIPLET@ CACHE STRING "") +set(CMAKE_TOOLCHAIN_FILE "@VCPKG_ROOT_PATH@/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "") +set(VCPKG_TARGET_TRIPLET "@TARGET_TRIPLET@" CACHE STRING "") -# Set TPLs -set(CONDUIT_DIR @CURRENT_INSTALLED_DIR@/share/conduit CACHE PATH "") -set(HDF5_DIR @CURRENT_INSTALLED_DIR@ CACHE PATH "") +# CMake options +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "") # Axom options set(AXOM_ENABLE_TESTS ON CACHE BOOL "") @@ -84,16 +71,35 @@ set(AXOM_ENABLE_EXAMPLES ON CACHE BOOL "") # BLT options set(ENABLE_FORTRAN OFF CACHE BOOL "") set(ENABLE_FOLDERS ON CACHE BOOL "") + +#------------------------------------------------------------------------------ +# Static vs. Dynamic builds +#------------------------------------------------------------------------------ +# Note: Static builds require some care and effort to get right with MSVC. +# With a static build, choose one of +# - disable Google Test and MSVC static MD to MT (see BLT options +# section) or +# - disable one of HDF5, conduit (which uses HDF5), or sidre (which +# uses conduit). +#------------------------------------------------------------------------------ + +# On Windows, build shared libraries by default. +set(BUILD_SHARED_LIBS ON CACHE BOOL "") + # Toggle the following to disable gtest if you are compiling with static # libraries and need HDF5 set(ENABLE_GTEST ON CACHE BOOL "") set(ENABLE_GTEST_DEATH_TESTS ON CACHE BOOL "") + # Toggle the following to disable changing MSVC's /MD to /MT if you are # compiling with static libraries and need HDF5 set(BLT_ENABLE_MSVC_STATIC_MD_TO_MT ON CACHE BOOL "") +#------------------------------------------------------------------------------ # MPI options +#------------------------------------------------------------------------------ set(ENABLE_MPI OFF CACHE BOOL "") + # If MSMPI and no other MPI is installed, turn ENABLE_MPI ON and CMake # should automatically detect it. If CMake doesn't auto-detect MSMPI, # or if you need to use another MPI, you will need to specify the MPI @@ -106,10 +112,12 @@ set(ENABLE_MPI OFF CACHE BOOL "") # set(MPI_Fortran_COMPILER "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2019.5.281/windows/mpi/intel64/bin/mpifc.bat" CACHE PATH "") # set(MPIEXEC "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2019.5.281/windows/mpi/intel64/bin/mpiexec.exe" CACHE PATH "") # set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") -# -# cmake options -set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "") +#------------------------------------------------------------------------------ +# Set TPLs +#------------------------------------------------------------------------------ +set(CONDUIT_DIR "@CURRENT_INSTALLED_DIR@/share/conduit" CACHE PATH "") +set(HDF5_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "") # TODO: # * Add TPLs: mfem, umpire, raja From 99e93f20d2c06b56c3b319bdabdf18de9684ca00 Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Tue, 31 Mar 2020 22:41:26 -0700 Subject: [PATCH 133/632] Removes unused hdf5 vcpkg port files --- scripts/uberenv/vcpkg_ports/hdf5/xCONTROL | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 scripts/uberenv/vcpkg_ports/hdf5/xCONTROL diff --git a/scripts/uberenv/vcpkg_ports/hdf5/xCONTROL b/scripts/uberenv/vcpkg_ports/hdf5/xCONTROL deleted file mode 100644 index f49644c7a0..0000000000 --- a/scripts/uberenv/vcpkg_ports/hdf5/xCONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: hdf5 -Version: 1.10.5-8 -Homepage: https://www.hdfgroup.org/downloads/hdf5/ -Description: HDF5 is a data model, library, and file format for storing and managing data -Build-Depends: zlib, szip From f106066d88e0c64a0cb16b1a9d8dee8f5ce04677 Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Thu, 2 Apr 2020 23:11:43 -0700 Subject: [PATCH 134/632] Adds vcpkg port for mfem@4.0 Includes patch to export mfem's global variables --- scripts/uberenv/vcpkg_ports/mfem/CONTROL | 4 + .../vcpkg_ports/mfem/export-extern-vars.patch | 184 ++++++++++++++++++ .../uberenv/vcpkg_ports/mfem/portfile.cmake | 80 ++++++++ 3 files changed, 268 insertions(+) create mode 100644 scripts/uberenv/vcpkg_ports/mfem/CONTROL create mode 100644 scripts/uberenv/vcpkg_ports/mfem/export-extern-vars.patch create mode 100644 scripts/uberenv/vcpkg_ports/mfem/portfile.cmake diff --git a/scripts/uberenv/vcpkg_ports/mfem/CONTROL b/scripts/uberenv/vcpkg_ports/mfem/CONTROL new file mode 100644 index 0000000000..61101a11d5 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/mfem/CONTROL @@ -0,0 +1,4 @@ +Source: mfem +Version: v4.0 +Homepage: http://mfem.org +Description: Lightweight, general, scalable C++ library for finite element methods diff --git a/scripts/uberenv/vcpkg_ports/mfem/export-extern-vars.patch b/scripts/uberenv/vcpkg_ports/mfem/export-extern-vars.patch new file mode 100644 index 0000000000..6ef3a36435 --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/mfem/export-extern-vars.patch @@ -0,0 +1,184 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f016de2e2..c30a400c7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -383,6 +383,13 @@ set(MFEM_INSTALL_DIR ${CMAKE_INSTALL_PREFIX} CACHE PATH + + # Declaring the library + add_library(mfem ${SOURCES} ${HEADERS} ${MASTER_HEADERS}) ++ ++# Generate export symbols and add to list of header files ++include(GenerateExportHeader) ++set(_export_header ${CMAKE_CURRENT_SOURCE_DIR}/mfem_export.h) ++generate_export_header(mfem EXPORT_FILE_NAME ${_export_header}) ++list(APPEND ${HEADERS} ${_export_header}) ++ + # message(STATUS "TPL_LIBRARIES = ${TPL_LIBRARIES}") + if (CMAKE_VERSION VERSION_GREATER 2.8.11) + target_link_libraries(mfem PUBLIC ${TPL_LIBRARIES}) +@@ -521,7 +528,7 @@ foreach(Header mfem.hpp mfem-performance.hpp) + install(FILES ${PROJECT_BINARY_DIR}/InstallHeaders/${Header} + DESTINATION ${INSTALL_INCLUDE_DIR}) + endforeach() +-install(FILES ${MASTER_HEADERS} DESTINATION ${INSTALL_INCLUDE_DIR}/mfem) ++install(FILES ${MASTER_HEADERS} mfem_export.h DESTINATION ${INSTALL_INCLUDE_DIR}/mfem) + + # Install the headers; currently, the miniapps headers are excluded + install(DIRECTORY ${MFEM_SOURCE_DIRS} +diff --git a/fem/fe.hpp b/fem/fe.hpp +index b7b80c4ce..d8c8f93c4 100644 +--- a/fem/fe.hpp ++++ b/fem/fe.hpp +@@ -13,6 +13,7 @@ + #define MFEM_FE + + #include "../config/config.hpp" ++#include "../mfem_export.h" + #include "../general/array.hpp" + #include "../linalg/linalg.hpp" + #include "intrules.hpp" +@@ -1795,7 +1796,7 @@ public: + ~Poly_1D(); + }; + +-extern Poly_1D poly1d; ++MFEM_EXPORT extern Poly_1D poly1d; + + class TensorBasisElement + { +diff --git a/fem/geom.hpp b/fem/geom.hpp +index 819814e04..e92b08043 100644 +--- a/fem/geom.hpp ++++ b/fem/geom.hpp +@@ -13,6 +13,7 @@ + #define MFEM_GEOM + + #include "../config/config.hpp" ++#include "../mfem_export.h" + #include "../linalg/densemat.hpp" + #include "intrules.hpp" + +@@ -116,7 +117,7 @@ template <> struct Geometry::Constants + static const int InvOrient[NumOrient]; + }; + +-template <> struct Geometry::Constants ++template <> struct MFEM_EXPORT Geometry::Constants + { + static const int Dimension = 1; + static const int NumVert = 2; +@@ -128,7 +129,7 @@ template <> struct Geometry::Constants + static const int InvOrient[NumOrient]; + }; + +-template <> struct Geometry::Constants ++template <> struct MFEM_EXPORT Geometry::Constants + { + static const int Dimension = 2; + static const int NumVert = 3; +@@ -154,7 +155,7 @@ template <> struct Geometry::Constants + static const int InvOrient[NumOrient]; + }; + +-template <> struct Geometry::Constants ++template <> struct MFEM_EXPORT Geometry::Constants + { + static const int Dimension = 2; + static const int NumVert = 4; +@@ -174,7 +175,7 @@ template <> struct Geometry::Constants + static const int InvOrient[NumOrient]; + }; + +-template <> struct Geometry::Constants ++template <> struct MFEM_EXPORT Geometry::Constants + { + static const int Dimension = 3; + static const int NumVert = 4; +@@ -192,7 +193,7 @@ template <> struct Geometry::Constants + }; + }; + +-template <> struct Geometry::Constants ++template <> struct MFEM_EXPORT Geometry::Constants + { + static const int Dimension = 3; + static const int NumVert = 8; +@@ -210,7 +211,7 @@ template <> struct Geometry::Constants + }; + }; + +-template <> struct Geometry::Constants ++template <> struct MFEM_EXPORT Geometry::Constants + { + static const int Dimension = 3; + static const int NumVert = 6; +@@ -229,7 +230,7 @@ template <> struct Geometry::Constants + }; + + // Defined in fe.cpp to ensure construction after 'mfem::WedgeFE'. +-extern Geometry Geometries; ++MFEM_EXPORT extern Geometry Geometries; + + + class RefinedGeometry +@@ -272,7 +273,7 @@ public: + ~GeometryRefiner(); + }; + +-extern GeometryRefiner GlobGeometryRefiner; ++MFEM_EXPORT extern GeometryRefiner GlobGeometryRefiner; + + } + +diff --git a/fem/intrules.hpp b/fem/intrules.hpp +index c8bd6dcdc..df759eeb7 100644 +--- a/fem/intrules.hpp ++++ b/fem/intrules.hpp +@@ -13,6 +13,7 @@ + #define MFEM_INTRULES + + #include "../config/config.hpp" ++#include "../mfem_export.h" + #include "../general/array.hpp" + + namespace mfem +@@ -365,10 +366,10 @@ public: + }; + + /// A global object with all integration rules (defined in intrules.cpp) +-extern IntegrationRules IntRules; ++MFEM_EXPORT extern IntegrationRules IntRules; + + /// A global object with all refined integration rules +-extern IntegrationRules RefinedIntRules; ++MFEM_EXPORT extern IntegrationRules RefinedIntRules; + + } + +diff --git a/general/globals.hpp b/general/globals.hpp +index 076ab579c..b32c624b3 100644 +--- a/general/globals.hpp ++++ b/general/globals.hpp +@@ -13,6 +13,7 @@ + #define MFEM_GLOBALS_HPP + + #include "../config/config.hpp" ++#include "../mfem_export.h" + #include + + #ifdef MFEM_USE_MPI +@@ -61,12 +62,12 @@ public: + /** @brief Global stream used by the library for standard output. Initially it + uses the same std::streambuf as std::cout, however that can be changed. + @sa OutStream. */ +-extern OutStream out; ++extern MFEM_EXPORT OutStream out; + /** @brief Global stream used by the library for standard error output. + Initially it uses the same std::streambuf as std::cerr, however that can be + changed. + @sa OutStream. */ +-extern OutStream err; ++extern MFEM_EXPORT OutStream err; + + + /** @brief Construct a string of the form "" where the diff --git a/scripts/uberenv/vcpkg_ports/mfem/portfile.cmake b/scripts/uberenv/vcpkg_ports/mfem/portfile.cmake new file mode 100644 index 0000000000..8fc003699e --- /dev/null +++ b/scripts/uberenv/vcpkg_ports/mfem/portfile.cmake @@ -0,0 +1,80 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "${PORT} does not currently support UWP") +endif() + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mfem/mfem + REF v4.0 + SHA512 c1ef3ba4369a5d2a28c3bcf26f07798f9d4d4903549c884feae88f52ed7ec0bbc1ad23ed325cf2bfed4a8dacb08ecea23ed9702d603526fb9777f3c518fda3a1 + HEAD_REF master + PATCHES + "./export-extern-vars.patch" +) + +set(_is_shared TRUE) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(_is_shared FALSE) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DMFEM_ENABLE_EXAMPLES=OFF + -DMFEM_ENABLE_MINIAPPS=OFF + -DMFEM_ENABLE_TESTING=OFF + -DBUILD_SHARED_LIBS=${_is_shared} + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=${_is_shared} +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake) +vcpkg_copy_pdbs() + + +## shuffle the output directories to make vcpkg happy +# Remove extraneous debug header files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Move CMake config files up a directory +set(_config_dir "${CURRENT_PACKAGES_DIR}/share/mfem") +file(GLOB _cmake_files "${_config_dir}/mfem/*.cmake") +foreach(_f ${_cmake_files}) + get_filename_component(_name ${_f} NAME) + file(RENAME ${_f} ${_config_dir}/${_name}) +endforeach() +file(REMOVE_RECURSE "${_config_dir}/mfem") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + # Note: Not tested + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +else() + # Move dll files from lib to bin directory + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin ) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin ) + + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/mfem.dll + ${CURRENT_PACKAGES_DIR}/bin/mfem.dll) + + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/mfem.dll + ${CURRENT_PACKAGES_DIR}/debug/bin/mfem.dll) + + # Update paths to dlls in CMake config files + foreach(_c debug release) + set(_f ${_config_dir}/MFEMTargets-${_c}.cmake) + file(READ ${_f} _fdata) + string(REPLACE "lib/mfem.dll" "bin/mfem.dll" _fdata "${_fdata}") + file(WRITE ${_f} "${_fdata}") + endforeach() +endif() + + +# Put the license file where vcpkg expects it +file(INSTALL ${SOURCE_PATH}/LICENSE + DESTINATION ${CURRENT_PACKAGES_DIR}/share/mfem + RENAME copyright) + + From ece1d2a89d4af2b970b384012fffdbc36d9d0b29 Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Thu, 2 Apr 2020 23:15:15 -0700 Subject: [PATCH 135/632] Adds mfem dependency to axom's vcpkg port I set up as a vcpkg 'feature' (equivalent of spack's variants) to support making this dependency optional in the future. --- scripts/uberenv/vcpkg_ports/axom/CONTROL | 7 ++++++- scripts/uberenv/vcpkg_ports/axom/portfile.cmake | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/uberenv/vcpkg_ports/axom/CONTROL b/scripts/uberenv/vcpkg_ports/axom/CONTROL index a6664fb907..2bb2f5de17 100644 --- a/scripts/uberenv/vcpkg_ports/axom/CONTROL +++ b/scripts/uberenv/vcpkg_ports/axom/CONTROL @@ -1,4 +1,9 @@ Source: axom Version: develop Description: Host-config generator for Axom TPLs -Build-Depends: hdf5, conduit +Build-Depends: hdf5, conduit, mfem +Default-Features: hdf5, conduit, mfem + +Feature: mfem +Description: Adds basic (serial) mfem support to Axom +Build-Depends: mfem diff --git a/scripts/uberenv/vcpkg_ports/axom/portfile.cmake b/scripts/uberenv/vcpkg_ports/axom/portfile.cmake index 8b03315416..ccc68e248d 100644 --- a/scripts/uberenv/vcpkg_ports/axom/portfile.cmake +++ b/scripts/uberenv/vcpkg_ports/axom/portfile.cmake @@ -118,6 +118,7 @@ set(ENABLE_MPI OFF CACHE BOOL "") #------------------------------------------------------------------------------ set(CONDUIT_DIR "@CURRENT_INSTALLED_DIR@/share/conduit" CACHE PATH "") set(HDF5_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "") +set(MFEM_DIR "@CURRENT_INSTALLED_DIR@" CACHE PATH "") # TODO: # * Add TPLs: mfem, umpire, raja From e2f80ea3f479a17cd387be7b88874e2ea4a8d683 Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Thu, 2 Apr 2020 23:18:18 -0700 Subject: [PATCH 136/632] Improves logic for loading mfem's CMake config in FindMFEM --- src/cmake/thirdparty/FindMFEM.cmake | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cmake/thirdparty/FindMFEM.cmake b/src/cmake/thirdparty/FindMFEM.cmake index ac1d971b38..d098e2f394 100644 --- a/src/cmake/thirdparty/FindMFEM.cmake +++ b/src/cmake/thirdparty/FindMFEM.cmake @@ -15,12 +15,26 @@ if (NOT MFEM_DIR) message(FATAL_ERROR "Cannot find MFEM. MFEM_DIR is not defined. ") endif() -if(EXISTS "${MFEM_DIR}/MFEMConfig.cmake") - include("${MFEM_DIR}/MFEMConfig.cmake") +# Using the CMake build system on Windows, and make-based system otherwise +set(_use_mfem_config FALSE) +if(WIN32) + set(_use_mfem_config TRUE) +endif() + +if(_use_mfem_config) + # Allow for several different configurations of MFEM + find_package(mfem CONFIG + REQUIRED + HINTS ${MFEM_DIR}/cmake/mfem + ${MFEM_DIR}/lib/cmake/mfem + ${MFEM_DIR}/share/cmake/mfem + ${MFEM_DIR}/share/mfem + ${MFEM_DIR}/mfem) + if(NOT MEFM_LIBRARY) set(MFEM_LIBRARY ${MFEM_LIBRARIES}) endif() - + else() find_path( MFEM_INCLUDE_DIRS mfem.hpp From 936f2a37d90adfe52b844ea99bb1bd8d096f865c Mon Sep 17 00:00:00 2001 From: Kenny Weiss Date: Thu, 2 Apr 2020 23:19:40 -0700 Subject: [PATCH 137/632] Improves FOLDER support for Axom's CMake targets --- src/axom/CMakeLists.txt | 18 ++++++++++++++++++ src/axom/quest/tests/CMakeLists.txt | 1 + src/cmake/AxomMacros.cmake | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/src/axom/CMakeLists.txt b/src/axom/CMakeLists.txt index ad4f3f74fb..f72e4be58a 100644 --- a/src/axom/CMakeLists.txt +++ b/src/axom/CMakeLists.txt @@ -60,3 +60,21 @@ else() message(STATUS "AXOM_DATA_DIR: ") endif() +#------------------------------------------------------------------------------ +# Fix FOLDER property for some targets +#------------------------------------------------------------------------------ +if(TARGET axom) + set_target_properties(axom PROPERTIES FOLDER "axom") +endif() + +# If Axom is the main project, set FOLDER property for top-level check targets +if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") + set(_code_check_targets "docs" "doxygen_docs" + "check" "style" + "uncrustify_check" "uncrustify_style" ) + foreach(_tgt ${_code_check_targets}) + if(TARGET ${_tgt}) + set_target_properties(${_tgt} PROPERTIES FOLDER "axom/code_checks") + endif() + endforeach() +endif() diff --git a/src/axom/quest/tests/CMakeLists.txt b/src/axom/quest/tests/CMakeLists.txt index 0a60a16e99..460a1a39fd 100644 --- a/src/axom/quest/tests/CMakeLists.txt +++ b/src/axom/quest/tests/CMakeLists.txt @@ -56,6 +56,7 @@ if(MFEM_FOUND) SOURCES ${test_name}.cpp OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${quest_tests_depends} mfem core + FOLDER axom/quest/tests ) string(STRIP "${AXOM_DISABLE_UNUSED_PARAMETER_WARNINGS}" MFEM_COMPILE_FLAGS) diff --git a/src/cmake/AxomMacros.cmake b/src/cmake/AxomMacros.cmake index 3d3a000ca2..5aa7f719eb 100644 --- a/src/cmake/AxomMacros.cmake +++ b/src/cmake/AxomMacros.cmake @@ -57,6 +57,14 @@ macro(axom_add_code_checks) blt_add_code_checks(PREFIX ${arg_PREFIX} SOURCES ${_sources} UNCRUSTIFY_CFG_FILE ${PROJECT_SOURCE_DIR}/uncrustify.cfg) + + # Set FOLDER property for code check targets + foreach(_suffix uncrustify_check uncrustify_style) + set(_tgt ${arg_PREFIX}_${_suffix}) + if(TARGET ${_tgt}) + set_target_properties(${_tgt} PROPERTIES FOLDER "axom/code_checks") + endif() + endforeach() endif() endmacro(axom_add_code_checks) From 253d0928bb22786b24d7e8ebc3d12f02566abf59 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 6 Apr 2020 15:56:39 -0700 Subject: [PATCH 138/632] BUGFIX: add missing bvh_traverse.hpp header The internal header, bvh_traverse.hpp, was not listed in CMakeLists and therefore, it was not being installed in the specified install prefix. Consequently, an application using the BVH and pointing to an Axom install prefix would result in a "cannot open include" compiler error. Fixed that. --- RELEASE-NOTES.md | 2 ++ src/axom/spin/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 93a2b2d8c2..ba28ed2aaf 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -29,6 +29,8 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ integer ID associated with the allocator. ### Fixed +- Fixed issue with missing the bvh_traverse.hpp from the install prefix, which was preventing + applications from using the BVH when pointing to an Axom install prefix. - Fixed usage of cuda kernel policies in Mint. Raja v0.11.0 changed the way max threads launch bounds is calculated. Consequently, a large number of threads was being launched leading to max registry count violation when linking. We are now using fixed kernel size diff --git a/src/axom/spin/CMakeLists.txt b/src/axom/spin/CMakeLists.txt index 78354b9613..f40bbae9c4 100644 --- a/src/axom/spin/CMakeLists.txt +++ b/src/axom/spin/CMakeLists.txt @@ -51,6 +51,7 @@ if ( RAJA_FOUND AND UMPIRE_FOUND ) internal/linear_bvh/TraversalPredicates.hpp internal/linear_bvh/aabb.hpp internal/linear_bvh/build_radix_tree.hpp + internal/linear_bvh/bvh_traverse.hpp internal/linear_bvh/bvh_vtkio.hpp internal/linear_bvh/emit_bvh.hpp internal/linear_bvh/math.hpp From 02be81d7749008a9f7b29c5bfeec473a46b81d46 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 31 Mar 2020 12:03:15 -0700 Subject: [PATCH 139/632] primal BoundingBox intersection methods --- .../detail/intersect_bounding_box_impl.hpp | 127 ++++++++++++++++++ src/axom/primal/operators/intersect.hpp | 1 + 2 files changed, 128 insertions(+) create mode 100644 src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp diff --git a/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp b/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp new file mode 100644 index 0000000000..6d452eec93 --- /dev/null +++ b/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp @@ -0,0 +1,127 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef PRIMAL_INTERSECT_BOUNDING_BOX_HPP_ +#define PRIMAL_INTERSECT_BOUNDING_BOX_HPP_ + +#include "axom/core/Macros.hpp" + +#include // for std::is_floating_point< T >() + +namespace axom +{ +namespace primal +{ +namespace detail +{ + +/*! + * \brief Helper routine for AABB / AABB intersection test. + * + * \param [in] min1 the 1st AABB min coordinate along a direction. + * \param [in] max1 the 1st AABB max coordinate along a drection. + * \param [in] min2 the 2nd AABB min coordinate along a direction. + * \param [in] max2 the 2nd AABB max coordinate along a drection. + * + * \return status true if the AABB's intersect, otherwise false. + * + * \note This routine is called by the intersect AABB/AABB methods for each + * spatial dimension. + */ +template < typename T > +AXOM_HOST_DEVICE +inline bool intersect_bbox_bbox_test( const T& min1, + const T& max1, + const T& min2, + const T& max2 ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + bool status = ( ( max1 < min2 || min1 > max2 ) ? false : true ); + return status; +} + +/*! + * \brief Checks if a specified bounding box intersects with the supplied + * bounding box. + * + * \param [in] xmin1 x-coordinate of the specified lower bounding box corner + * \param [in] xmax1 x-coordinate of the specified upper bounding box corner + * \param [in] ymin1 y-coordinate of the specified lower bounding box corner + * \param [in] ymax1 y-coordinate of the specified upper bounding box corner + * \param [in] xmin2 x-coordinate of the supplied lower bounding box corner + * \param [in] xmax2 x-coordinate of the supplied upper bounding box corner + * \param [in] ymin2 y-coordinate of the supplied lower bounding box corner + * \param [in] ymax2 y-coordinate of the supplied upper bounding box corner + * + * \return status true if the bounding boxes intersect, otherwise, false. + */ +template < typename T > +AXOM_HOST_DEVICE +inline bool intersect_bounding_box( const T& xmin1, + const T& xmax1, + const T& ymin1, + const T& ymax1, + const T& xmin2, + const T& xmax2, + const T& ymin2, + const T& ymax2 ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + bool status = true; + status = status && intersect_bbox_bbox_test( xmin1, xmax1, xmin2, xmax2 ); + status = status && intersect_bbox_bbox_test( ymin1, ymax1, ymin2, ymax2 ); + return status; +} + +/*! + * \brief Checks if a specified bounding box intersects with the supplied + * bounding box. + * + * \param [in] xmin1 x-coordinate of the specified lower bounding box corner + * \param [in] xmax1 x-coordinate of the specified upper bounding box corner + * \param [in] ymin1 y-coordinate of the specified lower bounding box corner + * \param [in] ymax1 y-coordinate of the specified upper bounding box corner + * \param [in] zmin1 z-coordinate of the specified lower bounding box corner + * \param [in] zmax1 z-coordinate of the specified upper bounding box corner + * \param [in] xmin2 x-coordinate of the supplied lower bounding box corner + * \param [in] xmax2 x-coordinate of the supplied upper bounding box corner + * \param [in] ymin2 y-coordinate of the supplied lower bounding box corner + * \param [in] ymax2 y-coordinate of the supplied upper bounding box corner + * \param [in] zmin2 z-coordinate of the supplied lower bounding box corner + * \param [in] zmax2 z-coordinate of the supplied upper bounding box corner + * + * \return status true if the bounding boxes intersect, otherwise, false. + */ +template < typename T > +AXOM_HOST_DEVICE +inline bool intersect_bounding_box( const T& xmin1, + const T& xmax1, + const T& ymin1, + const T& ymax1, + const T& zmin1, + const T& zmax1, + const T& xmin2, + const T& xmax2, + const T& ymin2, + const T& ymax2, + const T& zmin2, + const T& zmax2 ) +{ + AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); + + bool status = true; + status = status && intersect_bbox_bbox_test( xmin1, xmax1, xmin2, xmax2 ); + status = status && intersect_bbox_bbox_test( ymin1, ymax1, ymin2, ymax2 ); + status = status && intersect_bbox_bbox_test( zmin1, zmax1, zmin2, zmax2 ); + return status; +} + +} /* namespace detail */ +} /* namespace primal */ +} /* namespace axom */ + +#endif \ No newline at end of file diff --git a/src/axom/primal/operators/intersect.hpp b/src/axom/primal/operators/intersect.hpp index 9e6999561d..13e905ee6f 100644 --- a/src/axom/primal/operators/intersect.hpp +++ b/src/axom/primal/operators/intersect.hpp @@ -26,6 +26,7 @@ #include "axom/primal/operators/detail/intersect_impl.hpp" #include "axom/primal/operators/detail/intersect_ray_impl.hpp" +#include "axom/primal/operators/detail/intersect_bounding_box_impl.hpp" #include "axom/primal/operators/detail/intersect_bezier_impl.hpp" namespace axom From 36a3e5bf03c33ba2fce45d4f567d75f5841bb792 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 31 Mar 2020 17:04:19 -0700 Subject: [PATCH 140/632] primal BoundingBox intersection tests --- src/axom/primal/CMakeLists.txt | 1 + src/axom/primal/tests/CMakeLists.txt | 1 + .../tests/primal_bounding_box_intersect.cpp | 118 ++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 src/axom/primal/tests/primal_bounding_box_intersect.cpp diff --git a/src/axom/primal/CMakeLists.txt b/src/axom/primal/CMakeLists.txt index 250ede1211..1a164af2b3 100644 --- a/src/axom/primal/CMakeLists.txt +++ b/src/axom/primal/CMakeLists.txt @@ -45,6 +45,7 @@ set( primal_headers operators/detail/clip_impl.hpp operators/detail/intersect_bezier_impl.hpp operators/detail/intersect_ray_impl.hpp + operators/detail/intersect_bounding_box_impl.hpp operators/detail/intersect_impl.hpp ) diff --git a/src/axom/primal/tests/CMakeLists.txt b/src/axom/primal/tests/CMakeLists.txt index 638fdf443c..e5d49e2626 100644 --- a/src/axom/primal/tests/CMakeLists.txt +++ b/src/axom/primal/tests/CMakeLists.txt @@ -22,6 +22,7 @@ set( primal_tests primal_plane.cpp primal_point.cpp primal_ray_intersect.cpp + primal_bounding_box_intersect.cpp primal_sphere.cpp primal_squared_distance.cpp primal_tetrahedron.cpp diff --git a/src/axom/primal/tests/primal_bounding_box_intersect.cpp b/src/axom/primal/tests/primal_bounding_box_intersect.cpp new file mode 100644 index 0000000000..4e5e7f5d26 --- /dev/null +++ b/src/axom/primal/tests/primal_bounding_box_intersect.cpp @@ -0,0 +1,118 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#include "axom/primal/operators/detail/intersect_bounding_box_impl.hpp" + +#include "gtest/gtest.h" + +//------------------------------------------------------------------------------ +// UNIT TESTS +//------------------------------------------------------------------------------ +TEST( primal_bounding_box_intersect, aabb_aabb_adjacent ) +{ + constexpr double LO = 0.0f; + constexpr double HI = 1.0f; + constexpr int NUM_OFFSETS = 3; + const double OFFSETS[] = { -1.0f, 0.0f, 1.0f }; + + using namespace axom::primal::detail; + + // Check 2D adjacent and self-intersecting bounding boxes for intersection + for ( int i = 0; i < NUM_OFFSETS; i++ ) + { + for ( int j = 0; j < NUM_OFFSETS; j++ ) + { + EXPECT_TRUE( intersect_bounding_box( LO + OFFSETS[i], HI + OFFSETS[i], + LO + OFFSETS[j], HI + OFFSETS[j], + LO, HI, LO, HI ) ); + } + } + + // Check 3D adjacent and self-intersecting bounding boxes for intersection + for ( int i = 0; i < NUM_OFFSETS; i++ ) + { + for ( int j = 0; j < NUM_OFFSETS; j++ ) + { + for ( int k = 0; k < NUM_OFFSETS; k++ ) + { + EXPECT_TRUE( intersect_bounding_box( LO + OFFSETS[i], HI + OFFSETS[i], + LO + OFFSETS[j], HI + OFFSETS[j], + LO + OFFSETS[k], HI + OFFSETS[k], + LO, HI, LO, HI, LO, HI ) ); + } + } + } + +} + +//------------------------------------------------------------------------------ +TEST( primal_bounding_box_intersect, aabb_aabb_non_intersecting ) +{ + constexpr double LO = 0.0f; + constexpr double HI = 1.0f; + constexpr int NUM_OFFSETS = 3; + const double OFFSETS[] = { -1.01f, 0.0f, 1.01f }; + + using namespace axom::primal::detail; + + // Check 2D bounding boxes for non-intersection + for ( int i = 0; i < NUM_OFFSETS; i++ ) + { + for ( int j = 0; j < NUM_OFFSETS; j++ ) + { + // Ignore identity box + if ( i != 1 && j != 1 ) + { + EXPECT_FALSE( intersect_bounding_box( LO + OFFSETS[i], + HI + OFFSETS[i], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO, HI, LO, HI ) ); + } + } + } + + // Check 3D bounding boxes for non-intersection + for ( int i = 0; i < NUM_OFFSETS; i++ ) + { + for ( int j = 0; j < NUM_OFFSETS; j++ ) + { + for ( int k = 0; k < NUM_OFFSETS; k++ ) + { + // Ignore identity box + if ( i != 1 && j != 1 ) + { + EXPECT_FALSE( intersect_bounding_box( LO + OFFSETS[i], + HI + OFFSETS[i], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO, HI, LO, HI, LO, HI ) ); + } + } + } + } + +} + +//------------------------------------------------------------------------------ +#include "axom/slic/core/UnitTestLogger.hpp" +using axom::slic::UnitTestLogger; + +int main(int argc, char* argv[]) +{ + int result = 0; + + ::testing::InitGoogleTest(&argc, argv); + + UnitTestLogger logger; // create & initialize test logger, + + // finalized when exiting main scope + + result = RUN_ALL_TESTS(); + + return result; +} \ No newline at end of file From d0971f6b173c2d78549950c1f8f21a9f3ae8d814 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 31 Mar 2020 17:41:17 -0700 Subject: [PATCH 141/632] findBoundingBoxes declaration --- src/axom/spin/BVH.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 12a22c15f4..9b38df7734 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -301,6 +301,48 @@ class BVH const FloatType* z0=nullptr, const FloatType* nz=nullptr ) const; + /*! + * \brief Finds the candidate bins that intersect the given bounding boxes. + * + * \param [out] offsets offset to the candidates array for each bounding box + * \param [out] counts stores the number of candidates for each bounding box + * \param [out] candidates array of candidate IDs for each bounding box + * \param [in] numBoxes the total number of bounding boxes + * \param [in] xmin array of x-coordinates of lower bounding box corner + * \param [in] xmax array of x-coordinates of upper bounding box corner + * \param [in] ymin array of y-coordinates of lower bounding box corner + * \param [in] ymax array of y-coordinates of upper bounding box corner + * \param [in] zmin array of z-coordinates of lower bounding box corner, + * may be nullptr if 2D + * \param [in] zmax array of z-coordinates of upper bounding box corner, + * may be nullptr if 2D + * + * \note offsets and counts are pointers to arrays of size numBoxes that are + * pre-allocated by the caller before calling findBoundingBoxes(). + * + * \note After the call to findBoundingBoxes(), the ith bounding box has: + * * counts[ i ] candidates + * * candidates stored in [ offsets[ i ], offsets[i]+counts[i] ] + * + * \pre offsets != nullptr + * \pre counts != nullptr + * \pre candidates == nullptr + * \pre xmin != nullptr + * \pre xmax != nullptr + * \pre ymin != nullptr + * \pre ymax != nullptr + * \pre zmin != nullptr if dimension==3 + * \pre zmax != nullptr if dimension==3 + */ + void findBoundingBoxes( IndexType* offsets, IndexType* counts, + IndexType*& candidates, IndexType numBoxes, + const FloatType* xmin, + const FloatType* xmax, + const FloatType* ymin, + const FloatType* ymax, + const FloatType* zmin=nullptr, + const FloatType* zmax=nullptr ) const; + /*! * \brief Writes the BVH to the specified VTK file for visualization. * \param [in] fileName the name of VTK file. From d4e165766fd8906e274845ce8ea253bc49ee84bd Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Mon, 6 Apr 2020 14:28:49 -0700 Subject: [PATCH 142/632] Bounding Box QueryAccessor methods --- .../internal/linear_bvh/QueryAccessor.hpp | 74 ++++++++++++++++++- src/axom/spin/tests/spin_bvh.cpp | 42 +++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index a752cec37b..b8998bfc00 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -102,6 +102,41 @@ class QueryAccessor const FloatType* z0, const FloatType* nz ); /// @} + +/// \name Bounding Box Query Access Methods + /// @{ + + /*! + * \brief Gets the bounding box defined by lower and upper bound corners. + * + * \param [out] box the bounding box where to pack the min and max point + * \param [in] idx the index of the bounding box w.r.t. the supplied arrays. + * \param [in] xmin array of x-coordinate of the lower bounding box corner + * \param [in] xmax array of x-coordinate of the upper bounding box corner + * \param [in] ymin array of y-coordinate of the lower bounding box corner + * \param [in] ymax array of y-coordinate of the upper bounding box corner + * \param [in] zmin array of z-coordinate of the lower bounding box corner + * \param [in] zmax array of z-coordinate of the upper bounding box corner + * + * \tparam BoundingBoxType the data-structure to hold a Bounding Box. + * + * \note The BoundingBoxType must overload the `[]` operator for accessing + * the lower and upper bound corner coordinates, such that, + * the first NDIMS locations store the lower bound coordinate min followed + * by the upper bound coordinate max. + */ + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline void getBoundingBox( BoundingBoxType& box, + IndexType idx, + const FloatType* xmin, + const FloatType* xmax, + const FloatType* ymin, + const FloatType* ymax, + const FloatType* zmin, + const FloatType* zmax ); + /// @} + }; //------------------------------------------------------------------------------ @@ -142,6 +177,24 @@ class QueryAccessor< 2, FloatType > ray[ 3 ] = ny[ idx ]; } + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline void getBoundingBox( BoundingBoxType& box, + IndexType idx, + const FloatType* xmin, + const FloatType* xmax, + const FloatType* ymin, + const FloatType* ymax, + const FloatType* AXOM_NOT_USED(zmin), + const FloatType* AXOM_NOT_USED(zmax) ) + { + box[ 0 ] = xmin[ idx ]; + box[ 1 ] = ymin[ idx ]; + + box[ 2 ] = xmax[ idx ]; + box[ 3 ] = ymax[ idx ]; + } + }; //------------------------------------------------------------------------------ @@ -185,8 +238,27 @@ class QueryAccessor< 3, FloatType > ray[ 5 ] = nz[ idx ]; } -}; + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline void getBoundingBox( BoundingBoxType& box, + IndexType idx, + const FloatType* xmin, + const FloatType* xmax, + const FloatType* ymin, + const FloatType* ymax, + const FloatType* zmin, + const FloatType* zmax ) + { + box[ 0 ] = xmin[ idx ]; + box[ 1 ] = ymin[ idx ]; + box[ 2 ] = zmin[ idx ]; + box[ 3 ] = xmax[ idx ]; + box[ 4 ] = ymax[ idx ]; + box[ 5 ] = zmax[ idx ]; + } + +}; } /* namespace linear_bvh */ } /* namespace internal */ diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 613ee9e999..108c2ffcfc 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1129,6 +1129,48 @@ TEST( spin_bvh, query_ray_accessor ) EXPECT_DOUBLE_EQ( ray3d[5], nz[ ID ] ); } +TEST( spin_bvh, query_bounding_box_accessor ) +{ + constexpr double VAL = 42.0; + constexpr IndexType ID = 0; + + double xmin[] = { VAL }; + double ymin[] = { VAL+1.5 }; + double zmin[] = { VAL+2.5 }; + + double xmax[] = { VAL }; + double ymax[] = { VAL+1.5 }; + double zmax[] = { VAL+2.5 }; + + namespace bvh = axom::spin::internal::linear_bvh; + using QueryAccessor2D = bvh::QueryAccessor< 2, double >; + using QueryAccessor3D = bvh::QueryAccessor< 3, double >; + using BoundingBox2D = bvh::Vec< double, 4 >; + using BoundingBox3D = bvh::Vec< double, 6 >; + + BoundingBox2D box2D; + QueryAccessor2D::getBoundingBox( box2D, ID, xmin, xmax, + ymin, ymax, nullptr, nullptr ); + + EXPECT_DOUBLE_EQ( box2D[0], xmin[ ID ] ); + EXPECT_DOUBLE_EQ( box2D[1], ymin[ ID ] ); + + EXPECT_DOUBLE_EQ( box2D[2], xmax[ ID ] ); + EXPECT_DOUBLE_EQ( box2D[3], ymax[ ID ] ); + + BoundingBox3D box3D; + QueryAccessor3D::getBoundingBox( box3D, ID, xmin, xmax, + ymin, ymax, zmin, zmax ); + + EXPECT_DOUBLE_EQ( box3D[0], xmin[ ID ] ); + EXPECT_DOUBLE_EQ( box3D[1], ymin[ ID ] ); + EXPECT_DOUBLE_EQ( box3D[2], zmin[ ID ] ); + + EXPECT_DOUBLE_EQ( box3D[3], xmax[ ID ] ); + EXPECT_DOUBLE_EQ( box3D[4], ymax[ ID ] ); + EXPECT_DOUBLE_EQ( box3D[5], zmax[ ID ] ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, traversal_predicates_rayIntersectsLeftBin ) { From 81403722ed045df0ae600047a408b4f54b728083 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Mon, 6 Apr 2020 16:01:28 -0700 Subject: [PATCH 143/632] Bounding Box TraversalPredicates --- .../linear_bvh/TraversalPredicates.hpp | 136 ++++++++++++++++++ src/axom/spin/tests/spin_bvh.cpp | 100 +++++++++++++ 2 files changed, 236 insertions(+) diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index 5f317db209..d0463c38e3 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -10,6 +10,7 @@ #include "axom/core/numerics/floating_point_limits.hpp" #include "axom/primal/operators/detail/intersect_ray_impl.hpp" +#include "axom/primal/operators/detail/intersect_bounding_box_impl.hpp" namespace axom { @@ -120,6 +121,41 @@ class TraversalPredicates /// @} + ///\name Predicates for Bounding Box Intersection Queries + /// @{ + + /*! + * \brief Checks if the specified bounding box intersects with the left bin. + * + * \param [in] b the bounding box in the query + * \param [in] s1 the 1st segment of the BVH that stores the left bin. + * \param [in] s2 the 2nd segment of the BVH that stores the left bin. + * + * \return status true if the bounding box intersects the left bin, + * else, false. + */ + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline bool boundingBoxIntersectsLeftBin( + const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept; + + /*! + * \brief Checks if the specified bounding box intersects with the right bin. + * + * \param [in] b the bounding box in the query + * \param [in] s2 the 2nd segment of the BVH that stores the right bin. + * \param [in] s3 the 3rd segment of the BVH that stores the right bin. + * + * \return status true if the bounding box intersects the right bin, + * else, false. + */ + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline bool boundingBoxIntersectsRightBin( + const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept; + + /// @} + }; constexpr int DIMENSION_2 = 2; @@ -220,6 +256,50 @@ class TraversalPredicates< DIMENSION_2, FloatType > return primal::detail::intersect_ray(x0,nx,y0,ny,xmin,xmax,ymin,ymax,t,TOL); } + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline bool boundingBoxIntersectsLeftBin( + const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept + { + const FloatType& box_xmin = b[ 0 ]; + const FloatType& box_ymin = b[ 1 ]; + const FloatType& box_xmax = b[ 2 ]; + const FloatType& box_ymax = b[ 3 ]; + + // extract left bin, see BVHData.hpp for the internal BVH layout + const FloatType& bin_xmin = s1[ 0 ]; + const FloatType& bin_xmax = s1[ 3 ]; + const FloatType& bin_ymin = s1[ 1 ]; + const FloatType& bin_ymax = s2[ 0 ]; + + return primal::detail::intersect_bounding_box( box_xmin, box_xmax, + box_ymin, box_ymax, + bin_xmin, bin_xmax, + bin_ymin, bin_ymax ); + } + + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline bool boundingBoxIntersectsRightBin( + const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept + { + const FloatType& box_xmin = b[ 0 ]; + const FloatType& box_ymin = b[ 1 ]; + const FloatType& box_xmax = b[ 2 ]; + const FloatType& box_ymax = b[ 3 ]; + + // extract right bin, see BVHData.hpp for the internal BVH layout + const FloatType& bin_xmin = s2[ 2 ]; + const FloatType& bin_xmax = s3[ 1 ]; + const FloatType& bin_ymin = s2[ 3 ]; + const FloatType& bin_ymax = s3[ 2 ]; + + return primal::detail::intersect_bounding_box( box_xmin, box_xmax, + box_ymin, box_ymax, + bin_xmin, bin_xmax, + bin_ymin, bin_ymax ); + } + }; //------------------------------------------------------------------------------ @@ -332,6 +412,62 @@ class TraversalPredicates< DIMENSION_3, FloatType > x0,nx,y0,ny,z0,nz,xmin,xmax,ymin,ymax,zmin,zmax,t, TOL ); } + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline bool boundingBoxIntersectsLeftBin( + const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept + { + const FloatType& box_xmin = b[ 0 ]; + const FloatType& box_ymin = b[ 1 ]; + const FloatType& box_zmin = b[ 2 ]; + const FloatType& box_xmax = b[ 3 ]; + const FloatType& box_ymax = b[ 4 ]; + const FloatType& box_zmax = b[ 5 ]; + + // extract left bin, see BVHData.hpp for the internal BVH layout + const FloatType& bin_xmin = s1[ 0 ]; + const FloatType& bin_xmax = s1[ 3 ]; + const FloatType& bin_ymin = s1[ 1 ]; + const FloatType& bin_ymax = s2[ 0 ]; + const FloatType& bin_zmin = s1[ 2 ]; + const FloatType& bin_zmax = s2[ 1 ]; + + return primal::detail::intersect_bounding_box( box_xmin, box_xmax, + box_ymin, box_ymax, + box_zmin, box_zmax, + bin_xmin, bin_xmax, + bin_ymin, bin_ymax, + bin_zmin, bin_zmax ); + } + + template < typename BoundingBoxType > + AXOM_HOST_DEVICE + static inline bool boundingBoxIntersectsRightBin( + const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept + { + const FloatType& box_xmin = b[ 0 ]; + const FloatType& box_ymin = b[ 1 ]; + const FloatType& box_zmin = b[ 2 ]; + const FloatType& box_xmax = b[ 3 ]; + const FloatType& box_ymax = b[ 4 ]; + const FloatType& box_zmax = b[ 5 ]; + + // extract right bin, see BVHData.hpp for the internal BVH layout + const FloatType& bin_xmin = s2[ 2 ]; + const FloatType& bin_xmax = s3[ 1 ]; + const FloatType& bin_ymin = s2[ 3 ]; + const FloatType& bin_ymax = s3[ 2 ]; + const FloatType& bin_zmin = s3[ 0 ]; + const FloatType& bin_zmax = s3[ 3 ]; + + return primal::detail::intersect_bounding_box( box_xmin, box_xmax, + box_ymin, box_ymax, + box_zmin, box_zmax, + bin_xmin, bin_xmax, + bin_ymin, bin_ymax, + bin_zmin, bin_zmax ); + } + }; } /* namespace linear_bvh */ diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 108c2ffcfc..aefca6d34d 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1171,6 +1171,106 @@ TEST( spin_bvh, query_bounding_box_accessor ) EXPECT_DOUBLE_EQ( box3D[5], zmax[ ID ] ); } +//------------------------------------------------------------------------------ +TEST( spin_bvh, traversal_predicates_boundingBoxIntersectsLeftBin ) +{ + namespace bvh = axom::spin::internal::linear_bvh; + using TraversalPredicates2D = bvh::TraversalPredicates< 2, double >; + using TraversalPredicates3D = bvh::TraversalPredicates< 3, double >; + using BoundingBox2D = bvh::Vec< double, 4 >; + using BoundingBox3D = bvh::Vec< double, 6 >; + + BoundingBox2D s1, s2; + s1[ 0 ] = 0.; // LeftBin.xmin + s1[ 1 ] = 0.; // LeftBin.ymin + s1[ 2 ] = 0.; // LeftBin.zmin + + s1[ 3 ] = 1.; // LeftBin.xmax + s2[ 0 ] = 1.; // LeftBin.ymax + s2[ 1 ] = 1.; // LeftBin.zmax + + BoundingBox2D box2d; + box2d[ 0 ] = -1.0; + box2d[ 1 ] = -1.0; + box2d[ 2 ] = 1.0; + box2d[ 3 ] = 1.0; + EXPECT_TRUE( TraversalPredicates2D::boundingBoxIntersectsLeftBin( box2d, s1, + s2 ) ); + + // non-intersecting + box2d[ 2 ] = -0.5; + box2d[ 3 ] = -0.5; + EXPECT_FALSE( TraversalPredicates2D::boundingBoxIntersectsLeftBin( box2d, s1, + s2 ) ); + + BoundingBox3D box3d; + box3d[ 0 ] = -1.0; + box3d[ 1 ] = -1.0; + box3d[ 2 ] = -1.0; + box3d[ 3 ] = 1.0; + box3d[ 4 ] = 1.0; + box3d[ 5 ] = 1.0; + EXPECT_TRUE( TraversalPredicates3D::boundingBoxIntersectsLeftBin( box3d, s1, + s2) ); + + // non-intersecting + box3d[ 3 ] = -0.5; + box3d[ 4 ] = -0.5; + box3d[ 5 ] = -0.5; + EXPECT_FALSE( TraversalPredicates3D::boundingBoxIntersectsLeftBin( box3d, s1, + s2 ) ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, traversal_predicates_boundingBoxIntersectsRightBin ) +{ + namespace bvh = axom::spin::internal::linear_bvh; + using TraversalPredicates2D = bvh::TraversalPredicates< 2, double >; + using TraversalPredicates3D = bvh::TraversalPredicates< 3, double >; + using BoundingBox2D = bvh::Vec< double, 4 >; + using BoundingBox3D = bvh::Vec< double, 6 >; + + BoundingBox2D s2, s3; + s2[ 2 ] = 0.; // RightBin.xmin + s2[ 3 ] = 0.; // RightBin.ymin + s3[ 0 ] = 0.; // RightBin.zmin + + s3[ 1 ] = 1.; // RightBin.xmax + s3[ 2 ] = 1.; // RightBin.ymax + s3[ 3 ] = 1.; // RightBin.zmax + + BoundingBox2D box2d; + box2d[ 0 ] = -1.0; + box2d[ 1 ] = -1.0; + box2d[ 2 ] = 1.0; + box2d[ 3 ] = 1.0; + EXPECT_TRUE( TraversalPredicates2D::boundingBoxIntersectsRightBin( box2d, s2, + s3 ) ); + + // non-intersecting + box2d[ 2 ] = -0.5; + box2d[ 3 ] = -0.5; + EXPECT_FALSE( TraversalPredicates2D::boundingBoxIntersectsRightBin( box2d, s2, + s3 ) ); + + BoundingBox3D box3d; + box3d[ 0 ] = -1.0; + box3d[ 1 ] = -1.0; + box3d[ 2 ] = -1.0; + box3d[ 3 ] = 1.0; + box3d[ 4 ] = 1.0; + box3d[ 5 ] = 1.0; + EXPECT_TRUE( TraversalPredicates3D::boundingBoxIntersectsRightBin( box3d, s2, + s3) ); + + // non-intersecting + box3d[ 3 ] = -0.5; + box3d[ 4 ] = -0.5; + box3d[ 5 ] = -0.5; + EXPECT_FALSE( TraversalPredicates3D::boundingBoxIntersectsRightBin( box3d, s2, + s3 ) ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, traversal_predicates_rayIntersectsLeftBin ) { From 087957f9c7777564336f18708efa6cfe51d5e9cf Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Mon, 6 Apr 2020 16:57:57 -0700 Subject: [PATCH 144/632] findBoundingBoxes implementation --- .../spin/internal/linear_bvh/BVH_impl.hpp | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 2fbc00a9b1..3460b4cbab 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -62,6 +62,9 @@ using point_t = internal::linear_bvh::Vec< FloatType, NDIMS >; template < typename FloatType, int NDIMS > using ray_t = internal::linear_bvh::Vec< FloatType, NDIMS*2 >; +template < typename FloatType, int NDIMS > +using bounding_box_t = internal::linear_bvh::Vec< FloatType, NDIMS*2 >; + /*! * \def BVH_PREDICATE * @@ -250,6 +253,93 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, return ( total_count.get() ); } +/*! + * \brief Performs a traversal to count the number of candidates for each + * bounding box. + * + * \param [in] leftCheck traversal predicate functor for left bin check. + * \param [in] rightCheck traversal predicate functor for right bin check. + * \param [in] inner_nodes array of vec4s for the BVH inner nodes. + * \param [in] leaf_nodes array of BVH leaf node indices + * \param [in] N the number of user-supplied bounding boxes in query. + * \param [out] counts array of length N with candidate counts for each box. + * \param [in] xmin array of x-coordinate of the lower bounding box corner + * \param [in] xmax array of x-coordinate of the upper bounding box corner + * \param [in] ymin array of y-coordinate of the lower bounding box corner + * \param [in] ymax array of y-coordinate of the upper bounding box corner + * \param [in] zmin array of z-coordinate of the lower bounding box corner + * \param [in] zmax array of z-coordinate of the upper bounding box corner + * + * \return total_count the aggregate number of candidates for all bounding + * boxes. + */ +template < int NDIMS, typename ExecSpace, + typename LeftPredicate, + typename RightPredicate, + typename FloatType > +IndexType bvh_get_boxcounts( LeftPredicate&& leftCheck, + RightPredicate&& rightCheck, + const vec4_t< FloatType >* inner_nodes, + const int32* leaf_nodes, + IndexType N, + IndexType* counts, + const FloatType* xmin, + const FloatType* xmax, + const FloatType* ymin, + const FloatType* ymax, + const FloatType* zmin, + const FloatType* zmax ) noexcept +{ + // sanity checks + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); + SLIC_ERROR_IF( xmin == nullptr, + "bounding box lower x-coordinates array is null!" ); + SLIC_ERROR_IF( xmax == nullptr, + "bounding box upper x-coordinates array is null!" ); + SLIC_ERROR_IF( ymin == nullptr, + "bounding box lower y-coordinates array is null!" ); + SLIC_ERROR_IF( ymax == nullptr, + "bounding box upper y-coordinates array is null!" ); + SLIC_ERROR_IF( (zmin==nullptr && NDIMS==3), + "bounding box lower z-coordinates array is null!" ); + SLIC_ERROR_IF( (zmax==nullptr && NDIMS==3), + "bounding box upper z-coordinates array is null!" ); + + // STEP 1: count number of candidates for each query point + using reduce_pol = typename axom::execution_space< ExecSpace >::reduce_policy; + RAJA::ReduceSum< reduce_pol, IndexType > total_count( 0 ); + + using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; + for_all< ExecSpace >( N, AXOM_LAMBDA(IndexType i) + { + int32 count = 0; + bounding_box_t< FloatType, NDIMS > box; + QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, zmax ); + + + BVH_LEAF_ACTION( leafAction, + int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) { + count ++; + }; + + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + box, + leftCheck, + rightCheck, + leafAction ); + + counts[ i ] = count; + total_count += count; + + } ); + + return ( total_count.get() ); +} + } /* end anonymous namespace */ //------------------------------------------------------------------------------ @@ -522,6 +612,96 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, axom::setDefaultAllocator( currentAllocatorID ); } +//------------------------------------------------------------------------------ +template< int NDIMS, typename ExecSpace, typename FloatType > +void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( + IndexType* offsets, IndexType* counts, + IndexType*& candidates, IndexType numBoxes, + const FloatType* xmin, + const FloatType* xmax, + const FloatType* ymin, + const FloatType* ymax, + const FloatType* zmin, + const FloatType* zmax ) const +{ + SLIC_ASSERT( offsets != nullptr ); + SLIC_ASSERT( counts != nullptr ); + SLIC_ASSERT( candidates == nullptr ); + SLIC_ASSERT( xmin != nullptr ); + SLIC_ASSERT( xmax != nullptr ); + SLIC_ASSERT( ymin != nullptr ); + SLIC_ASSERT( ymax != nullptr ); + + // STEP 0: set the default memory allocator to use for the execution space. + const int currentAllocatorID = axom::getDefaultAllocatorID(); + const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); + axom::setDefaultAllocator( allocatorID ); + + using BoundingBoxType = bounding_box_t< FloatType, NDIMS >; + using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; + using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; + + // STEP 1: count number of candidates for each query point + const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; + const int32* leaf_nodes = m_bvh.m_leaf_nodes; + SLIC_ASSERT( inner_nodes != nullptr ); + SLIC_ASSERT( leaf_nodes != nullptr ); + + // STEP 2: define traversal predicates + BVH_PREDICATE( leftPredicate, + const BoundingBoxType &b, + const vec4_t< FloatType >&s1, + const vec4_t< FloatType >&s2 ) + { + return TraversalPredicates::boundingBoxIntersectsLeftBin( b, s1, s2 ); + }; + + BVH_PREDICATE( rightPredicate, + const BoundingBoxType &b, + const vec4_t< FloatType >&s2, + const vec4_t< FloatType >&s3 ) + { + return TraversalPredicates::boundingBoxIntersectsRightBin( b, s2, s3 ); + }; + + // STEP 3: get counts + int total_count = bvh_get_boxcounts< NDIMS,ExecSpace >( + leftPredicate, rightPredicate, inner_nodes, leaf_nodes, + numBoxes, counts, xmin, xmax, ymin, ymax, zmin, zmax ); + + using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; + RAJA::exclusive_scan< exec_policy >( + counts, counts+numBoxes, offsets, RAJA::operators::plus{} ); + + IndexType total_candidates = static_cast< IndexType >( total_count ); + candidates = axom::allocate< IndexType >( total_candidates); + + // STEP 4: fill in candidates for each bounding box + for_all< ExecSpace >( numBoxes, AXOM_LAMBDA (IndexType i) + { + int32 offset = offsets[ i ]; + + BoundingBoxType box; + QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, zmax ); + + BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; + + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + box, + leftPredicate, + rightPredicate, + leafAction ); + + } ); + + // STEP 3: restore default allocator + axom::setDefaultAllocator( currentAllocatorID ); +} + //------------------------------------------------------------------------------ template < int NDIMS, typename ExecSpace, typename FloatType > void BVH< NDIMS, ExecSpace, FloatType >::writeVtkFile( From deba4e7fdb87a2170c07d7be7cc4c5dbdb7a89e0 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 7 Apr 2020 11:24:30 -0700 Subject: [PATCH 145/632] findBoundingBoxes Unit Tests --- src/axom/spin/tests/spin_bvh.cpp | 287 ++++++++++++++++++++++++++++++- 1 file changed, 286 insertions(+), 1 deletion(-) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index aefca6d34d..dea61af7ff 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -476,6 +476,243 @@ void check_build_bvh3d( ) axom::setDefaultAllocator( current_allocator ); } +//------------------------------------------------------------------------------ +template < typename ExecSpace, typename FloatType > +void check_find_bounding_boxes3d() +{ + constexpr int NDIMS = 3; + constexpr IndexType N = 2; + + const int current_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( axom::execution_space< ExecSpace >::allocatorID()); + + // setup query bounding boxes: both boxes have lower left min at + // (-1.0,-1.0,-1.0) but different upper right max. + // The first bounding box is setup such that it intersects + // 18 bounding boxes of the mesh. + FloatType* xmin = axom::allocate< FloatType >( N ); + FloatType* ymin = axom::allocate< FloatType >( N ); + FloatType* zmin = axom::allocate< FloatType >( N ); + xmin[ 0 ] = xmin[ 1 ] = ymin[ 0 ] = ymin[ 1 ] = zmin[ 0 ] = zmin[ 1 ] = -1.0; + + FloatType* xmax = axom::allocate< FloatType >( N ); + FloatType* ymax = axom::allocate< FloatType >( N ); + FloatType* zmax = axom::allocate< FloatType >( N ); + xmax[ 0 ] = 2.5; + ymax[ 0 ] = 2.5; + zmax[ 0 ] = 1.5; + xmax[ 1 ] = ymax[ 1 ] = zmax[ 1 ] = -0.5; + + // setup a test mesh (3 x 3 x 3) + double lo[ NDIMS ] = { 0.0, 0.0, 0.0 }; + double hi[ NDIMS ] = { 3.0, 3.0, 3.0 }; + mint::UniformMesh mesh( lo, hi, 4, 4, 4 ); + const IndexType ncells = mesh.getNumberOfCells(); + FloatType* aabbs = nullptr; + generate_aabbs3d( &mesh, aabbs ); + EXPECT_TRUE( aabbs != nullptr ); + + // construct the BVH + spin::BVH< NDIMS, ExecSpace, FloatType > bvh( aabbs, ncells ); + bvh.setScaleFactor( 1.0 ); // i.e., no scaling + bvh.build( ); + + // check BVH bounding box + FloatType min[ NDIMS ]; + FloatType max[ NDIMS ]; + bvh.getBounds( min, max ); + for ( int i=0 ; i < NDIMS ; ++i ) + { + EXPECT_DOUBLE_EQ( min[ i ], lo[ i ] ); + EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); + } + + // traverse the BVH to find the candidates for all the centroids + IndexType* offsets = axom::allocate< IndexType >( N ); + IndexType* counts = axom::allocate< IndexType >( N ); + IndexType* candidates = nullptr; + bvh.findBoundingBoxes( offsets, counts, candidates, N, xmin, xmax, + ymin, ymax, zmin, zmax ); + EXPECT_TRUE( candidates != nullptr ); + + // flag cells that are found by the ray ID + int* iblank = mesh.createField< int >( "iblank", mint::CELL_CENTERED ); + mint::for_all_cells< ExecSpace >( &mesh, AXOM_LAMBDA(IndexType cellIdx) + { + iblank[ cellIdx ] = -1; + } ); + + for ( int i=0 ; i < N ; ++i ) + { + IndexType ncounts = counts[ i ]; + IndexType offset = offsets[ i ]; + for ( int j=0 ; j < ncounts ; ++j ) + { + IndexType idx = candidates[ offset + j ]; + iblank[ idx ] = i; + } // END for all cells the bounding box intersects + } // END for all bounding boxes + + // check answer with results verified manually by inspection + constexpr int INTERSECTS_BB = 0; + constexpr int DOES_NOT_INTERSECT_BB = -1; + constexpr int EXPECTED_BB1_INTERSECTIONS = 18; + EXPECT_EQ( counts[ 0 ], EXPECTED_BB1_INTERSECTIONS ); + EXPECT_EQ( counts[ 1 ], 0 ); + + for ( IndexType i=0 ; i < ncells ; ++i ) + { + switch( i ) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + EXPECT_EQ( iblank[ i ], INTERSECTS_BB ); + break; + default: + EXPECT_EQ( iblank[ i ], DOES_NOT_INTERSECT_BB ); + } + } // END for all mesh cells + + // deallocate + axom::deallocate( offsets ); + axom::deallocate( candidates ); + axom::deallocate( counts ); + axom::deallocate( aabbs ); + + axom::deallocate( xmin ); + axom::deallocate( xmax ); + axom::deallocate( ymin ); + axom::deallocate( ymax ); + axom::deallocate( zmin ); + axom::deallocate( zmax ); + + axom::setDefaultAllocator( current_allocator ); +} + +//------------------------------------------------------------------------------ + +template < typename ExecSpace, typename FloatType > +void check_find_bounding_boxes2d() +{ + constexpr int NDIMS = 2; + constexpr IndexType N = 2; + + const int current_allocator = axom::getDefaultAllocatorID(); + axom::setDefaultAllocator( axom::execution_space< ExecSpace >::allocatorID()); + + // setup query bounding boxes: both boxes are source at (-1.0,-1.0) but have + // different max (upper right). The first box is setup to intersect six + // bounding boxes of the mesh. + FloatType* xmin = axom::allocate< FloatType >( N ); + FloatType* ymin = axom::allocate< FloatType >( N ); + xmin[ 0 ] = xmin[ 1 ] = ymin[ 0 ] = ymin[ 1 ] = -1.0; + + FloatType* xmax = axom::allocate< FloatType >( N ); + FloatType* ymax = axom::allocate< FloatType >( N ); + xmax[ 0 ] = 2.5; + ymax[ 0 ] = 1.5; + xmax[ 1 ] = ymax[ 1 ] = -0.1; + + // setup a test mesh (3 x 3) + double lo[ NDIMS ] = { 0.0, 0.0 }; + double hi[ NDIMS ] = { 3.0, 3.0 }; + mint::UniformMesh mesh( lo, hi, 4, 4 ); + const IndexType ncells = mesh.getNumberOfCells(); + FloatType* aabbs = nullptr; + generate_aabbs2d( &mesh, aabbs ); + EXPECT_TRUE( aabbs != nullptr ); + + // construct the BVH + spin::BVH< NDIMS, ExecSpace, FloatType > bvh( aabbs, ncells ); + bvh.setScaleFactor( 1.0 ); // i.e., no scaling + bvh.build( ); + + // check BVH bounding box + FloatType min[ NDIMS ]; + FloatType max[ NDIMS ]; + bvh.getBounds( min, max ); + for ( int i=0 ; i < NDIMS ; ++i ) + { + EXPECT_DOUBLE_EQ( min[ i ], lo[ i ] ); + EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); + } + + // traverse the BVH to find the candidates for all the centroids + IndexType* offsets = axom::allocate< IndexType >( N ); + IndexType* counts = axom::allocate< IndexType >( N ); + IndexType* candidates = nullptr; + bvh.findBoundingBoxes( offsets, counts, candidates, N, xmin, xmax, ymin, ymax ); + EXPECT_TRUE( candidates != nullptr ); + + // flag cells that are found by the bounding box ID + int* iblank = mesh.createField< int >( "iblank", mint::CELL_CENTERED ); + mint::for_all_cells< ExecSpace >( &mesh, AXOM_LAMBDA(IndexType cellIdx) + { + iblank[ cellIdx ] = -1; + } ); + + for ( int i=0 ; i < N ; ++i ) + { + IndexType ncounts = counts[ i ]; + IndexType offset = offsets[ i ]; + for ( int j=0 ; j < ncounts ; ++j ) + { + IndexType idx = candidates[ offset + j ]; + iblank[ idx ] = i; + } // END for all cells the bounding boxes intersects with + } // END for all bounding boxes + + // check answer with results verified manually by inspection + constexpr int INTERSECTS_BB = 0; + constexpr int DOES_NOT_INTERSECT_BB = -1; + constexpr int EXPECTED_BB1_INTERSECTIONS = 6; + EXPECT_EQ( counts[ 0 ], EXPECTED_BB1_INTERSECTIONS ); + EXPECT_EQ( counts[ 1 ], 0 ); + + for ( IndexType i=0 ; i < ncells ; ++i ) + { + + if ( i==6 || i==7 || i==8) + { + EXPECT_EQ( iblank[ i ], DOES_NOT_INTERSECT_BB ); + } + else + { + EXPECT_EQ( iblank[ i ], INTERSECTS_BB ); + } + + } // END for all mesh cells + + // deallocate + axom::deallocate( offsets ); + axom::deallocate( candidates ); + axom::deallocate( counts ); + axom::deallocate( aabbs ); + + axom::deallocate( xmin ); + axom::deallocate( xmax ); + axom::deallocate( ymin ); + axom::deallocate( ymax ); + + axom::setDefaultAllocator( current_allocator ); +} + //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType > void check_find_rays3d() @@ -621,7 +858,7 @@ void check_find_rays2d() // setup query rays: both rays are source at (-1.0,-1.0) but point in // opposite directions. The first ray is setup such that it intersects - // three bounding boxes of the mesh. + // seven bounding boxes of the mesh. FloatType* x0 = axom::allocate< FloatType >( N ); FloatType* y0 = axom::allocate< FloatType >( N ); x0[ 0 ] = x0[ 1 ] = y0[ 0 ] = y0[ 1 ] = -1.0; @@ -1433,6 +1670,20 @@ TEST( spin_bvh, contruct3D_sequential ) check_build_bvh3d< axom::SEQ_EXEC, float >( ); } +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_bounding_boxes_3d_sequential ) +{ + check_find_bounding_boxes3d< axom::SEQ_EXEC, double >( ); + check_find_bounding_boxes3d< axom::SEQ_EXEC, float >( ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_bounding_boxes_2d_sequential ) +{ + check_find_bounding_boxes2d< axom::SEQ_EXEC, double >( ); + check_find_bounding_boxes2d< axom::SEQ_EXEC, float >( ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_3d_sequential ) { @@ -1491,6 +1742,20 @@ TEST( spin_bvh, contruct3D_omp ) check_build_bvh3d< axom::OMP_EXEC, float >( ); } +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_bounding_boxes_3d_omp ) +{ + check_find_bounding_boxes3d< axom::OMP_EXEC, double >( ); + check_find_bounding_boxes3d< axom::OMP_EXEC, float >( ); +} + +//------------------------------------------------------------------------------ +TEST( spin_bvh, find_bounding_boxes_2d_omp ) +{ + check_find_bounding_boxes2d< axom::OMP_EXEC, double >( ); + check_find_bounding_boxes2d< axom::OMP_EXEC, float >( ); +} + //------------------------------------------------------------------------------ TEST( spin_bvh, find_rays_3d_omp ) { @@ -1556,6 +1821,26 @@ AXOM_CUDA_TEST( spin_bvh, contruct3D_cuda ) check_build_bvh3d< exec, float >( ); } +//------------------------------------------------------------------------------ +AXOM_CUDA_TEST( spin_bvh, find_bounding_boxes_3d_cuda ) +{ + constexpr int BLOCK_SIZE = 256; + using exec = axom::CUDA_EXEC< BLOCK_SIZE >; + + check_find_bounding_boxes3d< exec, double >( ); + check_find_bounding_boxes3d< exec, float >( ); +} + +//------------------------------------------------------------------------------ +AXOM_CUDA_TEST( spin_bvh, find_bounding_boxes_2d_cuda ) +{ + constexpr int BLOCK_SIZE = 256; + using exec = axom::CUDA_EXEC< BLOCK_SIZE >; + + check_find_bounding_boxes2d< exec, double >( ); + check_find_bounding_boxes2d< exec, float >( ); +} + //------------------------------------------------------------------------------ AXOM_CUDA_TEST( spin_bvh, find_rays_3d_cuda ) { From 7a53a81e0454f13df96f3097f0b9221274d50226 Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Wed, 8 Apr 2020 13:18:46 -0700 Subject: [PATCH 146/632] Address PR comments -- Uncrustify primal and spin -- BoundingBox's intersectWith calls intersect_bbox_bbox_test -- Add entry into Release Notes --- RELEASE-NOTES.md | 3 + src/axom/primal/geometry/BoundingBox.hpp | 18 +-- .../detail/intersect_bounding_box_impl.hpp | 40 +++---- .../tests/primal_bounding_box_intersect.cpp | 103 +++++++++--------- src/axom/spin/BVH.hpp | 4 +- .../spin/internal/linear_bvh/BVH_impl.hpp | 43 +++++--- .../internal/linear_bvh/QueryAccessor.hpp | 24 ++-- .../linear_bvh/TraversalPredicates.hpp | 56 +++++----- src/axom/spin/tests/spin_bvh.cpp | 47 ++++---- 9 files changed, 178 insertions(+), 160 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index ba28ed2aaf..1b948eaa70 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -16,6 +16,9 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ can also be called on the device. - Added initial support for ray queries using the BVH. The caller may now supply a set of rays to a BVH and the BVH will return a set of candidate BVH bins that intersect each ray. +- Added initial support for bounding box queries using the BVH. The caller may + now supply a set of bounding boxes to a BVH and the BVH will return a set of + candidate BVH bins that intersect each bounding box. ### Removed diff --git a/src/axom/primal/geometry/BoundingBox.hpp b/src/axom/primal/geometry/BoundingBox.hpp index 9f7c1af280..8fa60cebeb 100644 --- a/src/axom/primal/geometry/BoundingBox.hpp +++ b/src/axom/primal/geometry/BoundingBox.hpp @@ -13,6 +13,8 @@ #include "axom/primal/geometry/Point.hpp" #include "axom/primal/geometry/Vector.hpp" +#include "axom/primal/operators/detail/intersect_bounding_box_impl.hpp" + namespace axom { namespace primal @@ -435,21 +437,19 @@ template < typename OtherType > bool BoundingBox< T,NDIMS >::intersectsWith( const BoundingBox< OtherType, NDIMS >& otherBB ) const { + bool status = true; + // AABBs cannot intersect if they are separated along any dimension for ( int i=0 ; i < NDIMS ; ++i ) { - if ( (m_max[ i ] < otherBB.m_min[ i ]) || - (m_min[ i ] > otherBB.m_max[ i ]) ) - { - - return false; - - } // END if - + status = status && detail::intersect_bbox_bbox_test( m_min[ i ], + m_max[ i ], + otherBB.m_min[ i ], + otherBB.m_max[ i ] ); } // END for all dimensions - return true; + return status; } //------------------------------------------------------------------------------ diff --git a/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp b/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp index 6d452eec93..df560b4f79 100644 --- a/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp @@ -38,7 +38,7 @@ inline bool intersect_bbox_bbox_test( const T& min1, const T& max2 ) { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); - + bool status = ( ( max1 < min2 || min1 > max2 ) ? false : true ); return status; } @@ -61,13 +61,13 @@ inline bool intersect_bbox_bbox_test( const T& min1, template < typename T > AXOM_HOST_DEVICE inline bool intersect_bounding_box( const T& xmin1, - const T& xmax1, - const T& ymin1, - const T& ymax1, - const T& xmin2, - const T& xmax2, - const T& ymin2, - const T& ymax2 ) + const T& xmax1, + const T& ymin1, + const T& ymax1, + const T& xmin2, + const T& xmax2, + const T& ymin2, + const T& ymax2 ) { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); @@ -99,17 +99,17 @@ inline bool intersect_bounding_box( const T& xmin1, template < typename T > AXOM_HOST_DEVICE inline bool intersect_bounding_box( const T& xmin1, - const T& xmax1, - const T& ymin1, - const T& ymax1, - const T& zmin1, - const T& zmax1, - const T& xmin2, - const T& xmax2, - const T& ymin2, - const T& ymax2, - const T& zmin2, - const T& zmax2 ) + const T& xmax1, + const T& ymin1, + const T& ymax1, + const T& zmin1, + const T& zmax1, + const T& xmin2, + const T& xmax2, + const T& ymin2, + const T& ymax2, + const T& zmin2, + const T& zmax2 ) { AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); @@ -124,4 +124,4 @@ inline bool intersect_bounding_box( const T& xmin1, } /* namespace primal */ } /* namespace axom */ -#endif \ No newline at end of file +#endif diff --git a/src/axom/primal/tests/primal_bounding_box_intersect.cpp b/src/axom/primal/tests/primal_bounding_box_intersect.cpp index 4e5e7f5d26..f21a09314e 100644 --- a/src/axom/primal/tests/primal_bounding_box_intersect.cpp +++ b/src/axom/primal/tests/primal_bounding_box_intersect.cpp @@ -20,29 +20,32 @@ TEST( primal_bounding_box_intersect, aabb_aabb_adjacent ) using namespace axom::primal::detail; // Check 2D adjacent and self-intersecting bounding boxes for intersection - for ( int i = 0; i < NUM_OFFSETS; i++ ) + for ( int i = 0 ; i < NUM_OFFSETS ; i++ ) { - for ( int j = 0; j < NUM_OFFSETS; j++ ) - { - EXPECT_TRUE( intersect_bounding_box( LO + OFFSETS[i], HI + OFFSETS[i], - LO + OFFSETS[j], HI + OFFSETS[j], - LO, HI, LO, HI ) ); - } + for ( int j = 0 ; j < NUM_OFFSETS ; j++ ) + { + EXPECT_TRUE( intersect_bounding_box( LO + OFFSETS[i], HI + OFFSETS[i], + LO + OFFSETS[j], HI + OFFSETS[j], + LO, HI, LO, HI ) ); + } } // Check 3D adjacent and self-intersecting bounding boxes for intersection - for ( int i = 0; i < NUM_OFFSETS; i++ ) + for ( int i = 0 ; i < NUM_OFFSETS ; i++ ) { - for ( int j = 0; j < NUM_OFFSETS; j++ ) - { - for ( int k = 0; k < NUM_OFFSETS; k++ ) - { - EXPECT_TRUE( intersect_bounding_box( LO + OFFSETS[i], HI + OFFSETS[i], - LO + OFFSETS[j], HI + OFFSETS[j], - LO + OFFSETS[k], HI + OFFSETS[k], - LO, HI, LO, HI, LO, HI ) ); - } - } + for ( int j = 0 ; j < NUM_OFFSETS ; j++ ) + { + for ( int k = 0 ; k < NUM_OFFSETS ; k++ ) + { + EXPECT_TRUE( intersect_bounding_box( LO + OFFSETS[i], + HI + OFFSETS[i], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO + OFFSETS[k], + HI + OFFSETS[k], + LO, HI, LO, HI, LO, HI ) ); + } + } } } @@ -58,42 +61,42 @@ TEST( primal_bounding_box_intersect, aabb_aabb_non_intersecting ) using namespace axom::primal::detail; // Check 2D bounding boxes for non-intersection - for ( int i = 0; i < NUM_OFFSETS; i++ ) + for ( int i = 0 ; i < NUM_OFFSETS ; i++ ) { - for ( int j = 0; j < NUM_OFFSETS; j++ ) - { - // Ignore identity box - if ( i != 1 && j != 1 ) - { + for ( int j = 0 ; j < NUM_OFFSETS ; j++ ) + { + // Ignore identity box + if ( i != 1 && j != 1 ) + { EXPECT_FALSE( intersect_bounding_box( LO + OFFSETS[i], - HI + OFFSETS[i], - LO + OFFSETS[j], - HI + OFFSETS[j], - LO, HI, LO, HI ) ); - } - } + HI + OFFSETS[i], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO, HI, LO, HI ) ); + } + } } - + // Check 3D bounding boxes for non-intersection - for ( int i = 0; i < NUM_OFFSETS; i++ ) + for ( int i = 0 ; i < NUM_OFFSETS ; i++ ) { - for ( int j = 0; j < NUM_OFFSETS; j++ ) - { - for ( int k = 0; k < NUM_OFFSETS; k++ ) - { - // Ignore identity box - if ( i != 1 && j != 1 ) - { - EXPECT_FALSE( intersect_bounding_box( LO + OFFSETS[i], - HI + OFFSETS[i], - LO + OFFSETS[j], - HI + OFFSETS[j], - LO + OFFSETS[j], - HI + OFFSETS[j], - LO, HI, LO, HI, LO, HI ) ); - } - } - } + for ( int j = 0 ; j < NUM_OFFSETS ; j++ ) + { + for ( int k = 0 ; k < NUM_OFFSETS ; k++ ) + { + // Ignore identity box + if ( i != 1 && j != 1 ) + { + EXPECT_FALSE( intersect_bounding_box( LO + OFFSETS[i], + HI + OFFSETS[i], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO + OFFSETS[j], + HI + OFFSETS[j], + LO, HI, LO, HI, LO, HI ) ); + } + } + } } } @@ -115,4 +118,4 @@ int main(int argc, char* argv[]) result = RUN_ALL_TESTS(); return result; -} \ No newline at end of file +} diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 9b38df7734..93e1e41bfd 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -121,11 +121,11 @@ class BVH // compile time checks AXOM_STATIC_ASSERT_MSG( ( (NDIMS==2) || (NDIMS==3) ), - "The BVH class may be used only in 2D or 3D." ); + "The BVH class may be used only in 2D or 3D." ); AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used for the BVH." ); AXOM_STATIC_ASSERT_MSG( axom::execution_space< ExecSpace >::valid(), - "A valid execution space must be supplied to the BVH." ); + "A valid execution space must be supplied to the BVH." ); public: /*! diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 3460b4cbab..e3a7422e80 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -152,9 +152,10 @@ IndexType bvh_get_counts( LeftPredicate&& leftCheck, BVH_LEAF_ACTION( leafAction, - int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) { - count ++; + int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) + { + count++; }; lbvh::bvh_traverse( inner_nodes, @@ -233,9 +234,10 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, BVH_LEAF_ACTION( leafAction, - int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) { - count ++; + int32 AXOM_NOT_USED(current_node), + const int32* AXOM_NOT_USED(leaf_nodes) ) + { + count++; }; lbvh::bvh_traverse( inner_nodes, @@ -294,13 +296,13 @@ IndexType bvh_get_boxcounts( LeftPredicate&& leftCheck, SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); SLIC_ERROR_IF( counts == nullptr, "supplied null pointer for counts!" ); - SLIC_ERROR_IF( xmin == nullptr, + SLIC_ERROR_IF( xmin == nullptr, "bounding box lower x-coordinates array is null!" ); SLIC_ERROR_IF( xmax == nullptr, "bounding box upper x-coordinates array is null!" ); - SLIC_ERROR_IF( ymin == nullptr, + SLIC_ERROR_IF( ymin == nullptr, "bounding box lower y-coordinates array is null!" ); - SLIC_ERROR_IF( ymax == nullptr, + SLIC_ERROR_IF( ymax == nullptr, "bounding box upper y-coordinates array is null!" ); SLIC_ERROR_IF( (zmin==nullptr && NDIMS==3), "bounding box lower z-coordinates array is null!" ); @@ -316,13 +318,15 @@ IndexType bvh_get_boxcounts( LeftPredicate&& leftCheck, { int32 count = 0; bounding_box_t< FloatType, NDIMS > box; - QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, zmax ); + QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, + zmax ); BVH_LEAF_ACTION( leafAction, int32 AXOM_NOT_USED(current_node), - const int32* AXOM_NOT_USED(leaf_nodes) ) { - count ++; + const int32* AXOM_NOT_USED(leaf_nodes) ) + { + count++; }; lbvh::bvh_traverse( inner_nodes, @@ -501,7 +505,9 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, PointType point; QueryAccessor::getPoint( point, i, x, y, z ); - BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { + BVH_LEAF_ACTION( leafAction, int32 current_node, + const int32* leaf_nodes ) + { candidates[offset] = leaf_nodes[current_node]; offset++; }; @@ -594,7 +600,9 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, RayType ray; QueryAccessor::getRay( ray, i, x0, nx, y0, ny, z0, nz ); - BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { + BVH_LEAF_ACTION( leafAction, int32 current_node, + const int32* leaf_nodes ) + { candidates[offset] = leaf_nodes[current_node]; offset++; }; @@ -682,9 +690,12 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( int32 offset = offsets[ i ]; BoundingBoxType box; - QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, zmax ); + QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, + zmax ); - BVH_LEAF_ACTION( leafAction, int32 current_node, const int32* leaf_nodes ) { + BVH_LEAF_ACTION( leafAction, int32 current_node, + const int32* leaf_nodes ) + { candidates[offset] = leaf_nodes[current_node]; offset++; }; diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index b8998bfc00..21fd0f6548 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -104,7 +104,7 @@ class QueryAccessor /// @} /// \name Bounding Box Query Access Methods - /// @{ +/// @{ /*! * \brief Gets the bounding box defined by lower and upper bound corners. @@ -188,11 +188,11 @@ class QueryAccessor< 2, FloatType > const FloatType* AXOM_NOT_USED(zmin), const FloatType* AXOM_NOT_USED(zmax) ) { - box[ 0 ] = xmin[ idx ]; - box[ 1 ] = ymin[ idx ]; + box[ 0 ] = xmin[ idx ]; + box[ 1 ] = ymin[ idx ]; - box[ 2 ] = xmax[ idx ]; - box[ 3 ] = ymax[ idx ]; + box[ 2 ] = xmax[ idx ]; + box[ 3 ] = ymax[ idx ]; } }; @@ -249,15 +249,15 @@ class QueryAccessor< 3, FloatType > const FloatType* zmin, const FloatType* zmax ) { - box[ 0 ] = xmin[ idx ]; - box[ 1 ] = ymin[ idx ]; - box[ 2 ] = zmin[ idx ]; + box[ 0 ] = xmin[ idx ]; + box[ 1 ] = ymin[ idx ]; + box[ 2 ] = zmin[ idx ]; - box[ 3 ] = xmax[ idx ]; - box[ 4 ] = ymax[ idx ]; - box[ 5 ] = zmax[ idx ]; + box[ 3 ] = xmax[ idx ]; + box[ 4 ] = ymax[ idx ]; + box[ 5 ] = zmax[ idx ]; } - + }; } /* namespace linear_bvh */ diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index d0463c38e3..59b1de2c59 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -98,9 +98,9 @@ class TraversalPredicates template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsLeftBin( - const RayType& r, const vec4_t& s1, const vec4_t& s2, - FloatType TOL=numerics::floating_point_limits::epsilon() - ) noexcept; + const RayType& r, const vec4_t& s1, const vec4_t& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept; /*! * \brief Checks if the specified ray intersects with the right bin. @@ -115,13 +115,13 @@ class TraversalPredicates template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsRightBin( - const RayType& r, const vec4_t& s2, const vec4_t& s3, - FloatType TOL=numerics::floating_point_limits::epsilon() - ) noexcept; + const RayType& r, const vec4_t& s2, const vec4_t& s3, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept; /// @} - ///\name Predicates for Bounding Box Intersection Queries + ///\name Predicates for Bounding Box Intersection Queries /// @{ /*! @@ -131,13 +131,13 @@ class TraversalPredicates * \param [in] s1 the 1st segment of the BVH that stores the left bin. * \param [in] s2 the 2nd segment of the BVH that stores the left bin. * - * \return status true if the bounding box intersects the left bin, + * \return status true if the bounding box intersects the left bin, * else, false. */ template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsLeftBin( - const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept; + const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept; /*! * \brief Checks if the specified bounding box intersects with the right bin. @@ -152,7 +152,7 @@ class TraversalPredicates template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsRightBin( - const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept; + const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept; /// @} @@ -211,9 +211,9 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsLeftBin( - const RayType& r, const vec4_t& s1, const vec4_t& s2, - FloatType TOL=numerics::floating_point_limits::epsilon() - ) noexcept + const RayType& r, const vec4_t& s1, const vec4_t& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -235,9 +235,9 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsRightBin( - const RayType& r, const vec4_t& s2, const vec4_t& s3, - FloatType TOL=numerics::floating_point_limits::epsilon() - ) noexcept + const RayType& r, const vec4_t& s2, const vec4_t& s3, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -259,7 +259,7 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsLeftBin( - const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept + const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; @@ -281,12 +281,12 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsRightBin( - const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept + const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; const FloatType& box_xmax = b[ 2 ]; - const FloatType& box_ymax = b[ 3 ]; + const FloatType& box_ymax = b[ 3 ]; // extract right bin, see BVHData.hpp for the internal BVH layout const FloatType& bin_xmin = s2[ 2 ]; @@ -357,9 +357,9 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsLeftBin( - const RayType& r, const vec4_t& s1, const vec4_t& s2, - FloatType TOL=numerics::floating_point_limits::epsilon() - ) noexcept + const RayType& r, const vec4_t& s1, const vec4_t& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -386,9 +386,9 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsRightBin( - const RayType& r, const vec4_t& s2, const vec4_t& s3, - FloatType TOL=numerics::floating_point_limits::epsilon() - ) noexcept + const RayType& r, const vec4_t& s2, const vec4_t& s3, + FloatType TOL=numerics::floating_point_limits::epsilon() + ) noexcept { const FloatType& x0 = r[ 0 ]; const FloatType& y0 = r[ 1 ]; @@ -415,7 +415,7 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsLeftBin( - const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept + const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; @@ -443,14 +443,14 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsRightBin( - const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept + const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; const FloatType& box_zmin = b[ 2 ]; const FloatType& box_xmax = b[ 3 ]; const FloatType& box_ymax = b[ 4 ]; - const FloatType& box_zmax = b[ 5 ]; + const FloatType& box_zmax = b[ 5 ]; // extract right bin, see BVHData.hpp for the internal BVH layout const FloatType& bin_xmin = s2[ 2 ]; diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index dea61af7ff..4b7588cf07 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -117,15 +117,15 @@ void generate_aabbs2d( const mint::Mesh* mesh, FloatType*& aabbs ) using exec_policy = axom::SEQ_EXEC; mint::for_all_cells< exec_policy, xargs::coords >( - mesh, AXOM_LAMBDA( IndexType cellIdx, - numerics::Matrix< double >& coords, - const IndexType* AXOM_NOT_USED(nodeIds) ) + mesh, AXOM_LAMBDA( IndexType cellIdx, + numerics::Matrix< double >&coords, + const IndexType* AXOM_NOT_USED(nodeIds) ) { spin::internal::linear_bvh::Range< double > xrange; spin::internal::linear_bvh::Range< double > yrange; - for ( IndexType inode=0; inode < 4; ++inode ) + for ( IndexType inode=0 ; inode < 4 ; ++inode ) { const double* node = coords.getColumn( inode ); @@ -133,7 +133,7 @@ void generate_aabbs2d( const mint::Mesh* mesh, FloatType*& aabbs ) yrange.include( node[ mint::Y_COORDINATE ] ); } // END for all cells nodes - const IndexType offset = cellIdx * stride ; + const IndexType offset = cellIdx * stride; aabbs[ offset ] = xrange.min(); aabbs[ offset + 1 ] = yrange.min(); aabbs[ offset + 2 ] = xrange.max(); @@ -187,16 +187,16 @@ void generate_aabbs3d( const mint::Mesh* mesh, FloatType*& aabbs ) using exec_policy = axom::SEQ_EXEC; mint::for_all_cells< exec_policy, xargs::coords >( - mesh, AXOM_LAMBDA( IndexType cellIdx, - numerics::Matrix< double >& coords, - const IndexType* AXOM_NOT_USED(nodeIds) ) + mesh, AXOM_LAMBDA( IndexType cellIdx, + numerics::Matrix< double >&coords, + const IndexType* AXOM_NOT_USED(nodeIds) ) { spin::internal::linear_bvh::Range< double > xrange; spin::internal::linear_bvh::Range< double > yrange; spin::internal::linear_bvh::Range< double > zrange; - for ( IndexType inode=0; inode < 8; ++inode ) + for ( IndexType inode=0 ; inode < 8 ; ++inode ) { const double* node = coords.getColumn( inode ); @@ -205,7 +205,7 @@ void generate_aabbs3d( const mint::Mesh* mesh, FloatType*& aabbs ) zrange.include( node[ mint::Z_COORDINATE ] ); } // END for all cells nodes - const IndexType offset = cellIdx * stride ; + const IndexType offset = cellIdx * stride; aabbs[ offset ] = xrange.min(); aabbs[ offset + 1 ] = yrange.min(); aabbs[ offset + 2 ] = zrange.min(); @@ -267,9 +267,9 @@ void generate_aabbs_and_centroids2d( const mint::Mesh* mesh, using exec_policy = axom::SEQ_EXEC; mint::for_all_cells< exec_policy, xargs::coords >( - mesh, AXOM_LAMBDA( IndexType cellIdx, - numerics::Matrix< double >& coords, - const IndexType* AXOM_NOT_USED(nodeIds) ) + mesh, AXOM_LAMBDA( IndexType cellIdx, + numerics::Matrix< double >&coords, + const IndexType* AXOM_NOT_USED(nodeIds) ) { spin::internal::linear_bvh::Range< double > xrange; @@ -278,7 +278,7 @@ void generate_aabbs_and_centroids2d( const mint::Mesh* mesh, double xsum = 0.0; double ysum = 0.0; - for ( IndexType inode=0; inode < 4; ++inode ) + for ( IndexType inode=0 ; inode < 4 ; ++inode ) { const double* node = coords.getColumn( inode ); xsum += node[ mint::X_COORDINATE ]; @@ -290,7 +290,7 @@ void generate_aabbs_and_centroids2d( const mint::Mesh* mesh, xc[ cellIdx ] = xsum * ONE_OVER_4; yc[ cellIdx ] = ysum * ONE_OVER_4; - const IndexType offset = cellIdx * stride ; + const IndexType offset = cellIdx * stride; aabbs[ offset ] = xrange.min(); aabbs[ offset + 1 ] = yrange.min(); aabbs[ offset + 2 ] = xrange.max(); @@ -355,9 +355,9 @@ void generate_aabbs_and_centroids3d( const mint::Mesh* mesh, using exec_policy = axom::SEQ_EXEC; mint::for_all_cells< exec_policy, xargs::coords >( - mesh, AXOM_LAMBDA( IndexType cellIdx, - numerics::Matrix< double >& coords, - const IndexType* AXOM_NOT_USED(nodeIds) ) + mesh, AXOM_LAMBDA( IndexType cellIdx, + numerics::Matrix< double >&coords, + const IndexType* AXOM_NOT_USED(nodeIds) ) { spin::internal::linear_bvh::Range< double > xrange; @@ -368,7 +368,7 @@ void generate_aabbs_and_centroids3d( const mint::Mesh* mesh, double ysum = 0.0; double zsum = 0.0; - for ( IndexType inode=0; inode < 8; ++inode ) + for ( IndexType inode=0 ; inode < 8 ; ++inode ) { const double* node = coords.getColumn( inode ); xsum += node[ mint::X_COORDINATE ]; @@ -384,7 +384,7 @@ void generate_aabbs_and_centroids3d( const mint::Mesh* mesh, yc[ cellIdx ] = ysum * ONE_OVER_8; zc[ cellIdx ] = zsum * ONE_OVER_8; - const IndexType offset = cellIdx * stride ; + const IndexType offset = cellIdx * stride; aabbs[ offset ] = xrange.min(); aabbs[ offset + 1 ] = yrange.min(); aabbs[ offset + 2 ] = zrange.min(); @@ -657,7 +657,8 @@ void check_find_bounding_boxes2d() IndexType* offsets = axom::allocate< IndexType >( N ); IndexType* counts = axom::allocate< IndexType >( N ); IndexType* candidates = nullptr; - bvh.findBoundingBoxes( offsets, counts, candidates, N, xmin, xmax, ymin, ymax ); + bvh.findBoundingBoxes( offsets, counts, candidates, N, xmin, xmax, ymin, + ymax ); EXPECT_TRUE( candidates != nullptr ); // flag cells that are found by the bounding box ID @@ -1398,14 +1399,14 @@ TEST( spin_bvh, query_bounding_box_accessor ) BoundingBox3D box3D; QueryAccessor3D::getBoundingBox( box3D, ID, xmin, xmax, ymin, ymax, zmin, zmax ); - + EXPECT_DOUBLE_EQ( box3D[0], xmin[ ID ] ); EXPECT_DOUBLE_EQ( box3D[1], ymin[ ID ] ); EXPECT_DOUBLE_EQ( box3D[2], zmin[ ID ] ); EXPECT_DOUBLE_EQ( box3D[3], xmax[ ID ] ); EXPECT_DOUBLE_EQ( box3D[4], ymax[ ID ] ); - EXPECT_DOUBLE_EQ( box3D[5], zmax[ ID ] ); + EXPECT_DOUBLE_EQ( box3D[5], zmax[ ID ] ); } //------------------------------------------------------------------------------ From 352f8a69890d31e53071678b0292334ea81af8a0 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Thu, 9 Apr 2020 15:47:29 -0700 Subject: [PATCH 147/632] Add functionality and test for putting nameless groups and views into a Group with the list format --- src/axom/sidre/core/Group.cpp | 76 +++++++++++++++++--------- src/axom/sidre/core/Group.hpp | 4 +- src/axom/sidre/core/ListCollection.hpp | 31 ++++------- src/axom/sidre/tests/sidre_group.cpp | 71 ++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 46 deletions(-) diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index 6cdb83a902..83ee27ab92 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -171,32 +171,41 @@ const View* Group::getView( const std::string& path ) const View* Group::createView( const std::string& path ) { std::string intpath(path); - bool create_groups_in_path = true; - Group* group = walkPath( intpath, create_groups_in_path ); - if ( group == nullptr ) - { - SLIC_CHECK_MSG(group != nullptr, - SIDRE_GROUP_LOG_PREPEND - << "Could not find or create path '" << path << "'." - << "There is already a view with that name." ); - return nullptr; + Group* group; + if (intpath.empty()) + { + group = this; } - else if ( intpath.empty() || group->hasChildView(intpath) || - group->hasChildGroup(intpath) ) + else { - SLIC_CHECK_MSG(!intpath.empty(), - SIDRE_GROUP_LOG_PREPEND - << "Cannot create a View with an empty path."); - SLIC_CHECK_MSG(!group->hasChildView(intpath), - SIDRE_GROUP_LOG_PREPEND - << "Cannot create View with name '" << intpath << "'. " - << "There is already a View with that name." ); - SLIC_CHECK_MSG(!group->hasChildGroup(intpath), - SIDRE_GROUP_LOG_PREPEND - << "Cannot create View with name '" << intpath << "'. " - << "There is already has a Group with that name." ); - return nullptr; + bool create_groups_in_path = true; + group = walkPath( intpath, create_groups_in_path ); + + if ( group == nullptr ) + { + SLIC_CHECK_MSG(group != nullptr, + SIDRE_GROUP_LOG_PREPEND + << "Could not find or create path '" << path << "'." + << "There is already a view with that name." ); + return nullptr; + } + else if ( intpath.empty() || group->hasChildView(intpath) || + group->hasChildGroup(intpath) ) + { + SLIC_CHECK_MSG(!intpath.empty(), + SIDRE_GROUP_LOG_PREPEND + << "Cannot create a View with an empty path."); + SLIC_CHECK_MSG(!group->hasChildView(intpath), + SIDRE_GROUP_LOG_PREPEND + << "Cannot create View with name '" << intpath << "'. " + << "There is already a View with that name." ); + SLIC_CHECK_MSG(!group->hasChildGroup(intpath), + SIDRE_GROUP_LOG_PREPEND + << "Cannot create View with name '" << intpath << "'. " + << "There is already has a Group with that name." ); + return nullptr; + } } View* view = new(std::nothrow) View(intpath); @@ -873,7 +882,7 @@ const Group* Group::getGroup( const std::string& path ) const * ************************************************************************* */ -Group* Group::createGroup( const std::string& path ) +Group* Group::createGroup( const std::string& path, bool is_list ) { std::string intpath(path); bool create_groups_in_path = true; @@ -905,7 +914,7 @@ Group* Group::createGroup( const std::string& path ) return nullptr; } - Group* new_group = new(std::nothrow) Group(intpath, group->getDataStore(), false); + Group* new_group = new(std::nothrow) Group(intpath, group->getDataStore(), is_list); if ( new_group == nullptr ) { return nullptr; @@ -917,6 +926,21 @@ Group* Group::createGroup( const std::string& path ) return group->attachGroup(new_group); } +Group* Group::createUnnamedGroup( bool is_list ) +{ + Group* new_group = new(std::nothrow) Group("", getDataStore(), is_list); + if ( new_group == nullptr ) + { + return nullptr; + } + +#ifdef AXOM_USE_UMPIRE + new_group->setDefaultAllocator(getDefaultAllocator()); +#endif + return attachGroup(new_group); +} + + /* ************************************************************************* * @@ -1804,7 +1828,7 @@ void Group::destroyViewAndData( View* view ) */ Group* Group::attachGroup(Group* group) { - if ( group == nullptr || hasChildGroup(group->getName()) ) + if ( group == nullptr || (!group->getName().empty() && hasChildGroup(group->getName())) ) { return nullptr; } diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index ac3e433fb6..79d76edbd4 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -979,7 +979,9 @@ class Group * \return pointer to created Group object or nullptr if new * Group is not created. */ - Group* createGroup( const std::string& path ); + Group* createGroup( const std::string& path, bool is_list = false ); + + Group* createUnnamedGroup( bool is_list = false ); /*! * \brief Destroy child Group in this Group with given name or path. diff --git a/src/axom/sidre/core/ListCollection.hpp b/src/axom/sidre/core/ListCollection.hpp index c716564841..8d952fa5ca 100644 --- a/src/axom/sidre/core/ListCollection.hpp +++ b/src/axom/sidre/core/ListCollection.hpp @@ -296,8 +296,13 @@ IndexType ListCollection::getNextValidIndex(IndexType idx) const template IndexType ListCollection::insertItem(TYPE* item, - const std::string& name) + const std::string& name) { + SLIC_WARNING_IF(!name.empty(), + "Item " << name << " added to Group " + << "which holds items in list format. " + << "The name of this item will be ignored."); + bool use_recycled_index = false; IndexType idx = m_items.size(); if ( !m_free_ids.empty() ) @@ -307,29 +312,17 @@ IndexType ListCollection::insertItem(TYPE* item, use_recycled_index = true; } - if ( name.empty() ) + m_index_list.push_back(idx); + + if ( use_recycled_index ) { - m_index_list.push_back(idx); - // name was inserted into map - if ( use_recycled_index ) - { - m_items[idx] = item; - } - else - { - m_items.push_back(item); - } - return idx; + m_items[idx] = item; } else { - // name was NOT inserted into map, return free index if necessary - if ( use_recycled_index ) - { - m_free_ids.push(idx); - } - return InvalidIndex; + m_items.push_back(item); } + return idx; } template diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index fbb283d91a..2d94de6e7e 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -461,6 +461,77 @@ TEST(sidre_group,get_first_and_next_group_index) delete ds; } +TEST(sidre_group, child_lists) +{ + DataStore* ds = new DataStore(); + Group* root = ds->getRoot(); + + Group* parent = root->createGroup("parent", true); + for (IndexType i = 0; i < 10; ++i) { + Group* unnamed_group = parent->createUnnamedGroup(); + unnamed_group->createViewScalar("val", i); + } + + for (IndexType i = 0; i < 15; ++i) { + View* unnamed_view; + if (i % 3 == 0) { + unnamed_view = parent->createView(""); + } else if (i % 3 == 1) { + unnamed_view = parent->createViewScalar("", i*i); + } else { + unnamed_view = parent->createViewString("", "foo"); + } + if (!unnamed_view->isApplied()) { + unnamed_view->apply(INT_ID, i); + unnamed_view->allocate(INT_ID, i); + int* vdata = unnamed_view->getData(); + for (IndexType j = 0; j < i; ++j) { + vdata[j] = j + 3; + } + } + } + + std::set scalars; + + for (IndexType idx = parent->getFirstValidGroupIndex() ; + indexIsValid(idx) ; + idx = parent->getNextValidGroupIndex(idx)) + { + Group* unnamed_group = parent->getGroup(idx); + View* val_view = unnamed_group->getView("val"); + IndexType val = val_view->getScalar(); + EXPECT_TRUE(val >= 0 && val < 10); + + scalars.insert(val); + } + + EXPECT_TRUE(scalars.size() == 10); + + for (IndexType idx = parent->getFirstValidViewIndex() ; + indexIsValid(idx) ; + idx = parent->getNextValidViewIndex(idx)) + { + View* unnamed_view = parent->getView(idx); + if (idx % 3 == 0) { + EXPECT_EQ(unnamed_view->getTypeID(), INT_ID); + IndexType num_elems = unnamed_view->getNumElements(); + EXPECT_EQ(num_elems, idx); + int* vdata = unnamed_view->getData(); + for (IndexType j = 0; j < num_elems; ++j) { + EXPECT_EQ(vdata[j], j+3); + } + } else if (idx % 3 == 1) { + EXPECT_TRUE(unnamed_view->isScalar()); + IndexType val = unnamed_view->getScalar(); + EXPECT_EQ(val, idx*idx); + } else { + EXPECT_TRUE(unnamed_view->isString()); + std::string vstr = unnamed_view->getString(); + EXPECT_EQ(vstr, std::string("foo")); + } + } +} + //------------------------------------------------------------------------------ // Iterate Views with getFirstValidViewIndex, getNextValidViewIndex //------------------------------------------------------------------------------ From 461eb7e080453ff8c8cebd7de29f86dd93a81c74 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Thu, 9 Apr 2020 17:06:45 -0700 Subject: [PATCH 148/632] Fix destroy operations in ListCollection --- src/axom/sidre/core/ListCollection.hpp | 1 + src/axom/sidre/tests/sidre_group.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/axom/sidre/core/ListCollection.hpp b/src/axom/sidre/core/ListCollection.hpp index 8d952fa5ca..5ef34321ae 100644 --- a/src/axom/sidre/core/ListCollection.hpp +++ b/src/axom/sidre/core/ListCollection.hpp @@ -346,6 +346,7 @@ TYPE* ListCollection::removeItem(IndexType idx) m_index_list.erase(itr); m_items[idx] = nullptr; m_free_ids.push(idx); + break; } } } diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index 2d94de6e7e..2038062e59 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -506,6 +506,21 @@ TEST(sidre_group, child_lists) } EXPECT_TRUE(scalars.size() == 10); + EXPECT_TRUE(parent->hasGroup(6)); + EXPECT_FALSE(parent->hasGroup(20)); + + for (IndexType idx = parent->getFirstValidGroupIndex() ; + indexIsValid(idx) ; + idx = parent->getNextValidGroupIndex(idx)) + { + if (idx % 2 == 1) + { + parent->destroyGroup(idx); + } + } + + (void) parent->createUnnamedGroup(); + EXPECT_EQ(parent->getNumGroups(), 6); for (IndexType idx = parent->getFirstValidViewIndex() ; indexIsValid(idx) ; @@ -530,6 +545,9 @@ TEST(sidre_group, child_lists) EXPECT_EQ(vstr, std::string("foo")); } } + + root->destroyGroup("parent"); + } //------------------------------------------------------------------------------ From 777540a025e519621310cd8fe903940b5f68221c Mon Sep 17 00:00:00 2001 From: Brian Manh Hien Han Date: Tue, 14 Apr 2020 10:16:33 -0700 Subject: [PATCH 149/632] Added note about scaling AABBs for fuzzy Bounding Box Intersections ; additional code & comment cleanup --- src/axom/primal/geometry/BoundingBox.hpp | 8 +++---- .../detail/intersect_bounding_box_impl.hpp | 23 +++++++++---------- .../tests/primal_bounding_box_intersect.cpp | 12 +++++----- src/axom/spin/tests/spin_bvh.cpp | 6 ++--- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/axom/primal/geometry/BoundingBox.hpp b/src/axom/primal/geometry/BoundingBox.hpp index 8fa60cebeb..b42bc547cd 100644 --- a/src/axom/primal/geometry/BoundingBox.hpp +++ b/src/axom/primal/geometry/BoundingBox.hpp @@ -443,10 +443,10 @@ bool BoundingBox< T,NDIMS >::intersectsWith( for ( int i=0 ; i < NDIMS ; ++i ) { - status = status && detail::intersect_bbox_bbox_test( m_min[ i ], - m_max[ i ], - otherBB.m_min[ i ], - otherBB.m_max[ i ] ); + status = status && detail::intersect_bbox_bbox( m_min[ i ], + m_max[ i ], + otherBB.m_min[ i ], + otherBB.m_max[ i ] ); } // END for all dimensions return status; diff --git a/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp b/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp index df560b4f79..dc07f0f23a 100644 --- a/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp +++ b/src/axom/primal/operators/detail/intersect_bounding_box_impl.hpp @@ -29,15 +29,16 @@ namespace detail * * \note This routine is called by the intersect AABB/AABB methods for each * spatial dimension. + * \note This routine does not have a tolerance parameter for fuzzy + * intersection, but the AABBs can be scaled to achieve the same thing. */ template < typename T > AXOM_HOST_DEVICE -inline bool intersect_bbox_bbox_test( const T& min1, - const T& max1, - const T& min2, - const T& max2 ) +inline bool intersect_bbox_bbox( const T& min1, + const T& max1, + const T& min2, + const T& max2 ) { - AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); bool status = ( ( max1 < min2 || min1 > max2 ) ? false : true ); return status; @@ -69,11 +70,10 @@ inline bool intersect_bounding_box( const T& xmin1, const T& ymin2, const T& ymax2 ) { - AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); bool status = true; - status = status && intersect_bbox_bbox_test( xmin1, xmax1, xmin2, xmax2 ); - status = status && intersect_bbox_bbox_test( ymin1, ymax1, ymin2, ymax2 ); + status = status && intersect_bbox_bbox( xmin1, xmax1, xmin2, xmax2 ); + status = status && intersect_bbox_bbox( ymin1, ymax1, ymin2, ymax2 ); return status; } @@ -111,12 +111,11 @@ inline bool intersect_bounding_box( const T& xmin1, const T& zmin2, const T& zmax2 ) { - AXOM_STATIC_ASSERT( std::is_floating_point< T >::value ); bool status = true; - status = status && intersect_bbox_bbox_test( xmin1, xmax1, xmin2, xmax2 ); - status = status && intersect_bbox_bbox_test( ymin1, ymax1, ymin2, ymax2 ); - status = status && intersect_bbox_bbox_test( zmin1, zmax1, zmin2, zmax2 ); + status = status && intersect_bbox_bbox( xmin1, xmax1, xmin2, xmax2 ); + status = status && intersect_bbox_bbox( ymin1, ymax1, ymin2, ymax2 ); + status = status && intersect_bbox_bbox( zmin1, zmax1, zmin2, zmax2 ); return status; } diff --git a/src/axom/primal/tests/primal_bounding_box_intersect.cpp b/src/axom/primal/tests/primal_bounding_box_intersect.cpp index f21a09314e..1df2b0a955 100644 --- a/src/axom/primal/tests/primal_bounding_box_intersect.cpp +++ b/src/axom/primal/tests/primal_bounding_box_intersect.cpp @@ -12,10 +12,10 @@ //------------------------------------------------------------------------------ TEST( primal_bounding_box_intersect, aabb_aabb_adjacent ) { - constexpr double LO = 0.0f; - constexpr double HI = 1.0f; + constexpr double LO = 0.0; + constexpr double HI = 1.0; constexpr int NUM_OFFSETS = 3; - const double OFFSETS[] = { -1.0f, 0.0f, 1.0f }; + const double OFFSETS[] = { -1.0, 0.0, 1.0 }; using namespace axom::primal::detail; @@ -53,10 +53,10 @@ TEST( primal_bounding_box_intersect, aabb_aabb_adjacent ) //------------------------------------------------------------------------------ TEST( primal_bounding_box_intersect, aabb_aabb_non_intersecting ) { - constexpr double LO = 0.0f; - constexpr double HI = 1.0f; + constexpr double LO = 0.0; + constexpr double HI = 1.0; constexpr int NUM_OFFSETS = 3; - const double OFFSETS[] = { -1.01f, 0.0f, 1.01f }; + const double OFFSETS[] = { -1.01, 0.0, 1.01 }; using namespace axom::primal::detail; diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 4b7588cf07..944bed7daf 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -527,7 +527,7 @@ void check_find_bounding_boxes3d() EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); } - // traverse the BVH to find the candidates for all the centroids + // traverse the BVH to find the candidates for all the bounding boxes IndexType* offsets = axom::allocate< IndexType >( N ); IndexType* counts = axom::allocate< IndexType >( N ); IndexType* candidates = nullptr; @@ -535,7 +535,7 @@ void check_find_bounding_boxes3d() ymin, ymax, zmin, zmax ); EXPECT_TRUE( candidates != nullptr ); - // flag cells that are found by the ray ID + // flag cells that are found by the bounding box ID int* iblank = mesh.createField< int >( "iblank", mint::CELL_CENTERED ); mint::for_all_cells< ExecSpace >( &mesh, AXOM_LAMBDA(IndexType cellIdx) { @@ -653,7 +653,7 @@ void check_find_bounding_boxes2d() EXPECT_DOUBLE_EQ( max[ i ], hi[ i ] ); } - // traverse the BVH to find the candidates for all the centroids + // traverse the BVH to find the candidates for all the bounding boxes IndexType* offsets = axom::allocate< IndexType >( N ); IndexType* counts = axom::allocate< IndexType >( N ); IndexType* candidates = nullptr; From 760e2d7ddffcfbea02f07195610f0b94ed5c9210 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 7 Apr 2020 13:24:18 -0700 Subject: [PATCH 150/632] ENH: add NVTXRange utility Add simple NVTXRange utility class that works in conjunction with the NVIDIA Tools Extension to annotate code for profilers etc. --- src/axom/core/CMakeLists.txt | 4 +- src/axom/core/utilities/NVTXRange.cpp | 75 ++++++++++++++ src/axom/core/utilities/NVTXRange.hpp | 138 ++++++++++++++++++++++++++ 3 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 src/axom/core/utilities/NVTXRange.cpp create mode 100644 src/axom/core/utilities/NVTXRange.hpp diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index 602ab4e242..8b4fb9e9a0 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -13,6 +13,7 @@ set(core_headers ## utilities utilities/FileUtilities.hpp + utilities/NVTXRange.hpp utilities/Timer.hpp utilities/Utilities.hpp utilities/About.hpp @@ -51,6 +52,7 @@ set(core_headers set(core_sources utilities/FileUtilities.cpp + utilities/NVTXRange.cpp utilities/Utilities.cpp utilities/About.cpp @@ -65,7 +67,7 @@ set(core_sources set( core_depends ) blt_list_append( TO core_depends ELEMENTS umpire IF ${UMPIRE_FOUND} ) blt_list_append( TO core_depends ELEMENTS RAJA IF ${RAJA_FOUND} ) -blt_list_append( TO core_depends ELEMENTS cuda IF ${ENABLE_CUDA} ) +blt_list_append( TO core_depends ELEMENTS cuda nvToolsExt IF ${ENABLE_CUDA} ) blt_list_append( TO core_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO core_depends ELEMENTS mpi IF ${ENABLE_MPI} ) diff --git a/src/axom/core/utilities/NVTXRange.cpp b/src/axom/core/utilities/NVTXRange.cpp new file mode 100644 index 0000000000..f73d3b1911 --- /dev/null +++ b/src/axom/core/utilities/NVTXRange.cpp @@ -0,0 +1,75 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#include "axom/core/utilities/NVTXRange.hpp" + +#include "axom/config.hpp" // for axom compile-time definitions + +// C/C++ includes +#include + +// CUDA NVTX includes +#ifdef AXOM_USE_CUDA +#include +#include +#include +#endif + +namespace axom +{ + +NVTXRange::NVTXRange( const std::string& name, + NVTXColor color, + NVTXCategory category ) : + m_name( name ), + m_color( color ), + m_category( category ), + m_active( false ) +{ + assert( !m_name.empty() ); + start(); + assert( m_active ); +} + +//------------------------------------------------------------------------------ +NVTXRange::~NVTXRange() +{ + stop(); +} + +//------------------------------------------------------------------------------ +void NVTXRange::start() +{ + assert( !m_active ); +#ifdef AXOM_USE_CUDA + + nvtxEventAttributes_t eventAttrib = {0}; + eventAttrib.version = NVTX_VERSION; + eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; + eventAttrib.category = static_cast< uint32_t >( m_category ); + eventAttrib.colorType = NVTX_COLOR_ARGB; + eventAttrib.color = static_cast< uint32_t>( m_color ); + eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; + eventAttrib.message.ascii = m_name.c_str(); + + nvtxRangePushEx(&eventAttrib); + +#endif + m_active = true; +} + +//------------------------------------------------------------------------------ +void NVTXRange::stop() +{ + if ( m_active ) + { +#ifdef AXOM_USE_CUDA + nvtxRangePop(); + m_active = false; +#endif + } +} + +} /* namespace axom */ diff --git a/src/axom/core/utilities/NVTXRange.hpp b/src/axom/core/utilities/NVTXRange.hpp new file mode 100644 index 0000000000..8d2c3337aa --- /dev/null +++ b/src/axom/core/utilities/NVTXRange.hpp @@ -0,0 +1,138 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_NVTXRANGE_HPP_ +#define AXOM_NVTXRANGE_HPP_ + +#include "axom/core/Macros.hpp" // for axom macros + +// C/C++ includes +#include // for std::string + +namespace axom +{ + +/*! + * \brief Predefined set of NVTX colors to use with NVTXRange. + */ +enum class NVTXColor : uint32_t +{ + BLACK = 0x00000000, + GREEN = 0x0000FF00, + LIME = 0x00BFFF00, + RED = 0x00FF0000, + BLUE = 0x000000FF, + YELLOW = 0x00FFFF00, + CYAN = 0x0000FFFF, + MAGENTA = 0x00FF00FF, + WHITE = 0x00FFFFFF, + ORANGE = 0x00FFA500, + PINK = 0x00FF69B4 +}; + +/*! + * \brief Predefined set of user-specified categories to use with NVTXRange. + */ +enum class NVTXCategory : uint32_t +{ + ANY = 0, /*!< wildcard used to annotate generic sections */ + PACKING, /*!< used to annotate code that is doing packing */ + MEMTRANSFER, /*!< used to annotate code that is doing memory transfer */ +}; + +/*! + * \brief Default NVTX color to use. Set to GREEN. + */ +constexpr NVTXColor DEFAULT_NVTX_COLOR = NVTXColor::GREEN; + +/*! + * \brief Default NVTX category to use. Set to ANY. + */ +constexpr NVTXCategory DEFAULT_NVTX_CATEGORY = NVTXCategory::ANY; + +/*! + * \class NVTXRange + * + * \brief NVTXRange is a simple utility class to annotate code. + * + * The NVTXRange class is a simple utility class that can be used in + * conjunction with the NVIDIA Tools Extension library to allow developers + * to easily mark and annotate code in order to provide additional information + * to NVIDIA performance tools, such as, nvprof, nvvp and Nsight. + * + * \see https://docs.nvidia.com/cuda/profiler-users-guide/index.html#nvtx + * + * \note NVTXRange uses the RAII idiom, consequently the range is started + * when the NVTXRange object is instantiated and stopped when the object + * goes out of scope. + * + * \thanks Jason Burmark (burmark1@llnl.gov) for his original implementation + * that inspired the implementation of this class. + * + * Usage Example: + * \code + * + * // use scope to auto-start and stop a range + * { // begin scope resolution + * axom::NVTXRage range ("foo" ); + * foor(); + * } // end scope resoltuion + * + * \endcode + * + */ +class NVTXRange +{ +public: + + /*! + * \brief Default constructor. Disabled. + */ + NVTXRange() = delete; + + /*! + * \brief Creates an NVTXRage instance with the given name. + * + * \param [in] name the name to associate with the range + * \param [in] color the color to associate with the range (optional) + * \param [in] category the category to associate with the range (optional) + * + * \pre name.empty() == false + */ + NVTXRange( const std::string& name, + NVTXColor color = DEFAULT_NVTX_COLOR, + NVTXCategory category= DEFAULT_NVTX_CATEGORY ); + + /*! + * \brief Destructor. + */ + ~NVTXRange(); + +private: + + /*! + * \brief Starts an NVTX range. + * \note Called by the constructor. + */ + void start(); + + /*! + * \brief Stops the NVTX range. + * \note Called by the destructor. + */ + void stop(); + + std::string m_name; + NVTXColor m_color; + NVTXCategory m_category; + bool m_active; + + DISABLE_COPY_AND_ASSIGNMENT(NVTXRange); + DISABLE_MOVE_AND_ASSIGNMENT(NVTXRange); +}; + +} /* namespace axom */ + +#endif /* AXOM_NVTXRANGE_HPP_ */ From c0d1d1635183d13aff483083eb0bdb409f1f1bd2 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 7 Apr 2020 15:33:12 -0700 Subject: [PATCH 151/632] COMP: fix warnings when compiled w/out CUDA --- src/axom/core/utilities/NVTXRange.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/axom/core/utilities/NVTXRange.cpp b/src/axom/core/utilities/NVTXRange.cpp index f73d3b1911..263252e3e5 100644 --- a/src/axom/core/utilities/NVTXRange.cpp +++ b/src/axom/core/utilities/NVTXRange.cpp @@ -55,7 +55,10 @@ void NVTXRange::start() eventAttrib.message.ascii = m_name.c_str(); nvtxRangePushEx(&eventAttrib); - +#else + /* silence compiler warnings regarding unused variables */ + static_cast< void >( m_color ); + static_cast< void >( m_category ); #endif m_active = true; } @@ -67,8 +70,8 @@ void NVTXRange::stop() { #ifdef AXOM_USE_CUDA nvtxRangePop(); - m_active = false; #endif + m_active = false; } } From 912da0b4cd64a8f004fa52f13b00531056498b91 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 8 Apr 2020 12:00:46 -0700 Subject: [PATCH 152/632] ENH: Axom CMake option to enable annotations This commit adds a CMake option to enable annotations that can facilitate performance evaluation with various tools, e.g., nvvp, etc. and Caliper in the future. By default this option is enabled. --- src/axom/config.hpp.in | 6 ++++++ src/cmake/AxomOptions.cmake | 1 + 2 files changed, 7 insertions(+) diff --git a/src/axom/config.hpp.in b/src/axom/config.hpp.in index c8da060aab..e9269303c9 100644 --- a/src/axom/config.hpp.in +++ b/src/axom/config.hpp.in @@ -31,6 +31,12 @@ #define AXOM_BIN_DIR "@AXOM_BIN_DIR@" #cmakedefine AXOM_DATA_DIR "@AXOM_DATA_DIR@" +/* + * Indicates whether Axom is compiled with Annotations that can facilitate + * evaluation of performance with various performance tools. + */ +#cmakedefine AXOM_ENABLE_ANNOTATIONS + /* * Platform specific definitions */ diff --git a/src/cmake/AxomOptions.cmake b/src/cmake/AxomOptions.cmake index b500c6652c..fb532287cd 100644 --- a/src/cmake/AxomOptions.cmake +++ b/src/cmake/AxomOptions.cmake @@ -6,6 +6,7 @@ # Defines CMake options for Axom's build system #------------------------------------------------------------------------------ +option(AXOM_ENABLE_ANNOTATIONS "Enables code annotations to facilitate performance evaluation." ON) option(AXOM_ENABLE_SPARSEHASH "Enables Sparsehash." ON) option(AXOM_ENABLE_ALL_COMPONENTS "Enables all components by default" ON) option(AXOM_USE_64BIT_INDEXTYPE "Use 64-bit integers for axom::IndexType" OFF) From 767fd9f3e8ec9b60a4bda73852bae1ef3d59b010 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 8 Apr 2020 16:01:28 -0700 Subject: [PATCH 153/632] ENH: add axom NVTX macros for annotating code This commit adds two macros that can be used to annotate code: (a) AXOM_NVTX_FUNCTION, which can be used to annotate a function range and (b) AXOM_NVTX_SECTION which can be used to annotate code blocks at a much finer granularity of a function. --- src/axom/core/utilities/NVTXRange.hpp | 97 +++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/axom/core/utilities/NVTXRange.hpp b/src/axom/core/utilities/NVTXRange.hpp index 8d2c3337aa..32d08622c3 100644 --- a/src/axom/core/utilities/NVTXRange.hpp +++ b/src/axom/core/utilities/NVTXRange.hpp @@ -52,6 +52,103 @@ constexpr NVTXColor DEFAULT_NVTX_COLOR = NVTXColor::GREEN; */ constexpr NVTXCategory DEFAULT_NVTX_CATEGORY = NVTXCategory::ANY; +// Forward Declarations +class NVTXRange; + +/// \name AXOM NVTX Macros +///@{ + +/*! + * \def AXOM_NVTX_SECTION + * + * \brief The AXOM_NVTX_SECTION macro is used to annotate sections of code + * + * \note In contrast to the AXOM_NVTX_FUNCTION macro, the AXOM_NVTX_SECTION + * macro is used to annotate sections of code, at a much finer granularity, + * within a given function. + * + * \warning Variables declared within a given AXOM_NVTX_SECTION are only defined + * within the scope of the AXOM_NVTX_SECTION. + * + * \warning An AXOM_NVTX_SECTION cannot be called in a nested fashion, i.e., + * within another AXOM_NVTX_SECTION + * + * \note You may have multiple AXOM_NVTX_SECTION defined within a function and + * this macro can be used in conjunction with the AXOM_NVTX_FUNCTION macro. + * + * \Usage Example: + * \code + * + * void foo( ) + * { + * AXOM_NVTX_FUNCTION( "foo"" ); + * + * // STEP 0: Run kernel A + * AXOM_NVTX_SECTION( "kernelA", + * + * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType i) + * { + * .. + * } ); + * + * ); // END NVTX SECTION for kernel A + * + * // STEP 1: Run kernel B + * AXOM_NVTX_SECTION( "kernelB", + * + * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType i) + * { + * ... + * } ); + * + * ); // END NVTX SECTION for kernel B + * + * } + * \endcode + * + */ +#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) +#define AXOM_NVTX_SECTION( __name__, ... ) \ + do { \ + axom::NVTXRange r(__name__); \ + __VA_ARGS__ \ + } while( false ) +#else +#define AXOM_NVTX_SECTION( __name__, ... ) \ + do { \ + __VA_ARGS__ \ + } while( false ) +#endif + +/*! + * \def AXOM_NVTX_FUNCTION( name ) + * + * \brief The AXOM_NVTX_FUNCTION macro is used to annotate a function. + * \param [in] name a user-supplied name that will be given to the range. + * + * \note Typically, the AXOM_NVTX_FUNCTION macro is placed in the beginning of + * the function to annotate. + * + * \warning The AXOM_NVTX_FUNCTION can be called once within a (function) scope. + * + * Usage Example: + * \code + * void foo( ) + * { + * AXOM_NVTX_FUNCTION( "foo" ); + * ... + * } + * \endcode + * + */ +#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) +#define AXOM_NVTX_FUNCTION( __name__ ) axom::NVTXRange __func_range(__name__) +#else +#define AXOM_NVTX_FUNCTION( __name__ ) +#endif + +///@} + /*! * \class NVTXRange * From 603a4a6d60bafce5923e5ccf1e5e4fae93e9e272 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 8 Apr 2020 16:51:52 -0700 Subject: [PATCH 154/632] ENH: add NVTX annotations to the BVH --- .../spin/internal/linear_bvh/BVH_impl.hpp | 11 + .../internal/linear_bvh/build_radix_tree.hpp | 107 ++++--- .../spin/internal/linear_bvh/emit_bvh.hpp | 276 +++++++++--------- 3 files changed, 231 insertions(+), 163 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index e3a7422e80..4aa2bfc32e 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -10,6 +10,7 @@ #include "axom/core/execution/for_all.hpp" // for generic for_all() #include "axom/core/memory_management.hpp" // for memory functions #include "axom/core/numerics/floating_point_limits.hpp" // floating_point_limits +#include "axom/core/utilities/NVTXRange.hpp" // for NVTX annotations // slic includes #include "axom/slic/interface/slic.hpp" // for SLIC macros @@ -130,6 +131,8 @@ IndexType bvh_get_counts( LeftPredicate&& leftCheck, const FloatType* y, const FloatType* z ) noexcept { + AXOM_NVTX_FUNCTION( "bvh_get_counts" ); + // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); @@ -208,6 +211,8 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, const FloatType* z0, const FloatType* nz ) noexcept { + AXOM_NVTX_FUNCTION( "bvh_get_raycounts" ); + // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); @@ -369,6 +374,8 @@ BVH< NDIMS, ExecSpace, FloatType >::~BVH() template< int NDIMS, typename ExecSpace, typename FloatType > int BVH< NDIMS, ExecSpace, FloatType >::build() { + AXOM_NVTX_FUNCTION( "BVH::build" ); + // STEP 0: set the default memory allocator to use for the execution space. const int currentAllocatorID = axom::getDefaultAllocatorID(); const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); @@ -447,6 +454,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, const FloatType* y, const FloatType* z ) const { + AXOM_NVTX_FUNCTION( "BVH::findPoints" ); + SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); SLIC_ASSERT( candidates == nullptr ); @@ -538,6 +547,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, const FloatType* z0, const FloatType* nz ) const { + AXOM_NVTX_FUNCTION( "BVH::findRays" ); + SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); SLIC_ASSERT( candidates == nullptr ); diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index 615bea983f..8cfca3eaed 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -9,6 +9,8 @@ #include "axom/core/execution/execution_space.hpp" #include "axom/core/execution/for_all.hpp" +#include "axom/core/utilities/NVTXRange.hpp" // for NVTX annotations + #include "axom/spin/internal/linear_bvh/BVHData.hpp" #include "axom/spin/internal/linear_bvh/RadixTree.hpp" #include "axom/spin/internal/linear_bvh/vec.hpp" @@ -108,6 +110,8 @@ void transform_boxes( const FloatType* boxes, int32 size, FloatType scale_factor ) { + AXOM_NVTX_FUNCTION( "transform_boxes3D" ); + constexpr int NDIMS = 3; constexpr int STRIDE = 2 * NDIMS; @@ -141,6 +145,8 @@ void transform_boxes( const FloatType* boxes, int32 size, FloatType scale_factor ) { + AXOM_NVTX_FUNCTION( "transform_boxes2D" ); + constexpr int NDIMS = 2; constexpr int STRIDE = 2 * NDIMS; @@ -169,6 +175,8 @@ void transform_boxes( const FloatType* boxes, template < typename ExecSpace, typename FloatType > AABB reduce(AABB* aabbs, int32 size) { + AXOM_NVTX_FUNCTION( "reduce_abbs3D" ); + constexpr int NDIMS = 3; using reduce_policy = @@ -213,6 +221,8 @@ AABB reduce(AABB* aabbs, int32 size) template < typename ExecSpace, typename FloatType > AABB reduce(AABB* aabbs, int32 size) { + AXOM_NVTX_FUNCTION( "reduce_abbs2D" ); + constexpr int NDIMS = 2; using reduce_policy = @@ -253,6 +263,8 @@ void get_mcodes( AABB* aabbs, const AABB< FloatType,2 > &bounds, uint32* mcodes ) { + AXOM_NVTX_FUNCTION( "get_mcodes2D" ); + constexpr int NDIMS = 2; Vec< FloatType,NDIMS > extent, inv_extent, min_coord; @@ -290,6 +302,8 @@ void get_mcodes( AABB* aabbs, const AABB< FloatType,3 > &bounds, uint32* mcodes ) { + AXOM_NVTX_FUNCTION( "get_mcodes3D" ); + constexpr int NDIMS = 3; Vec< FloatType, NDIMS > extent, inv_extent, min_coord; @@ -331,6 +345,8 @@ void array_counting( IntType* iterator, const IntType& start, const IntType& step) { + AXOM_NVTX_FUNCTION( "array_counting" ); + for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { iterator[ i ] = start + i * step; @@ -347,6 +363,8 @@ void array_counting( IntType* iterator, template< typename ExecSpace, typename T> void reorder(int32* indices, T*&array, int32 size) { + AXOM_NVTX_FUNCTION( "reorder" ); + T* temp = axom::allocate< T >( size ); for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) @@ -364,15 +382,20 @@ void reorder(int32* indices, T*&array, int32 size) template < typename ExecSpace > void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) { + AXOM_NVTX_FUNCTION( "custom_sort" ); + array_counting< ExecSpace >(iter, size, 0, 1); - std::stable_sort( iter, - iter + size, - [=](int32 i1, int32 i2) - { - return mcodes[i1] < mcodes[i2]; - } ); + AXOM_NVTX_SECTION( "cpu_sort", + + std::stable_sort( iter, + iter + size, + [=](int32 i1, int32 i2) + { + return mcodes[i1] < mcodes[i2]; + } ); + ); reorder< ExecSpace >(iter, mcodes, size); } @@ -384,43 +407,49 @@ template < int BLOCK_SIZE > void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, uint32*& mcodes, int32 size, int32* iter ) { + AXOM_NVTX_FUNCTION( "custom_sort" ); + using ExecSpace = typename axom::CUDA_EXEC< BLOCK_SIZE >; array_counting< ExecSpace >(iter, size, 0, 1); - uint32* mcodes_alt_buf = axom::allocate< uint32 >( size ); - int32* iter_alt_buf = axom::allocate< int32 >( size ); + AXOM_NVTX_SECTION( "gpu_cub_sort", - // create double buffers - ::cub::DoubleBuffer< uint32 > d_keys( mcodes, mcodes_alt_buf ); - ::cub::DoubleBuffer< int32 > d_values( iter, iter_alt_buf ); + uint32* mcodes_alt_buf = axom::allocate< uint32 >( size ); + int32* iter_alt_buf = axom::allocate< int32 >( size ); - // determine temporary device storage requirements - void* d_temp_storage = nullptr; - size_t temp_storage_bytes = 0; - ::cub::DeviceRadixSort::SortPairs( d_temp_storage, temp_storage_bytes, - d_keys, d_values, size ); + // create double buffers + ::cub::DoubleBuffer< uint32 > d_keys( mcodes, mcodes_alt_buf ); + ::cub::DoubleBuffer< int32 > d_values( iter, iter_alt_buf ); - // Allocate temporary storage - d_temp_storage = (void*)axom::allocate< unsigned char >( temp_storage_bytes ); + // determine temporary device storage requirements + void* d_temp_storage = nullptr; + size_t temp_storage_bytes = 0; + ::cub::DeviceRadixSort::SortPairs( d_temp_storage, temp_storage_bytes, + d_keys, d_values, size ); + // Allocate temporary storage + d_temp_storage = (void*)axom::allocate< unsigned char >( temp_storage_bytes ); - // Run sorting operation - ::cub::DeviceRadixSort::SortPairs( d_temp_storage, temp_storage_bytes, - d_keys, d_values, size ); - uint32* sorted_keys = d_keys.Current(); - int32* sorted_vals = d_values.Current(); + // Run sorting operation + ::cub::DeviceRadixSort::SortPairs( d_temp_storage, temp_storage_bytes, + d_keys, d_values, size ); - for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) - { - mcodes[ i ] = sorted_keys[ i ]; - iter[ i ] = sorted_vals[ i ]; - } ); + uint32* sorted_keys = d_keys.Current(); + int32* sorted_vals = d_values.Current(); + + for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) + { + mcodes[ i ] = sorted_keys[ i ]; + iter[ i ] = sorted_vals[ i ]; + } ); + + // Free temporary storage + axom::deallocate( d_temp_storage ); + axom::deallocate( mcodes_alt_buf ); + axom::deallocate( iter_alt_buf ); - // Free temporary storage - axom::deallocate( d_temp_storage ); - axom::deallocate( mcodes_alt_buf ); - axom::deallocate( iter_alt_buf ); + ); } #endif @@ -428,6 +457,8 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, template < typename ExecSpace > void sort_mcodes( uint32*& mcodes, int32 size, int32* iter ) { + AXOM_NVTX_FUNCTION( "sort_mcodes" ); + // dispatch custom_sort( ExecSpace(), mcodes, size, iter ); } @@ -461,6 +492,8 @@ AXOM_HOST_DEVICE IntType delta( const IntType &a, template < typename ExecSpace, typename FloatType, int NDIMS > void build_tree( RadixTree< FloatType, NDIMS > &data ) { + AXOM_NVTX_FUNCTION( "build_tree" ); + // http://research.nvidia.com/sites/default/files/publications/karras2012hpg_paper.pdf // Pointers and vars are redeclared because I have a faint memory @@ -551,6 +584,8 @@ void build_tree( RadixTree< FloatType, NDIMS > &data ) template< typename ExecSpace, typename T> static void array_memset(T* array, const int32 size, const T val) { + AXOM_NVTX_FUNCTION( "array_memset" ); + for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) { array[ i ] = val; @@ -561,6 +596,8 @@ static void array_memset(T* array, const int32 size, const T val) template < typename ExecSpace, typename FloatType, int NDIMS > void propagate_aabbs( RadixTree< FloatType, NDIMS >& data) { + AXOM_NVTX_FUNCTION( "propagate_abbs" ); + const int inner_size = data.m_inner_size; const int leaf_size = data.m_inner_size + 1; SLIC_ASSERT( leaf_size == data.m_size ); @@ -639,11 +676,15 @@ void build_radix_tree( const FloatType* boxes, RadixTree< FloatType, NDIMS >& radix_tree, FloatType scale_factor ) { + AXOM_NVTX_FUNCTION( "build_radix_tree" ); + // sanity checks SLIC_ASSERT( boxes !=nullptr ); SLIC_ASSERT( size > 0 ); - radix_tree.allocate( size ); + AXOM_NVTX_SECTION( "allocate_radix_tree" , + radix_tree.allocate( size ); + ); // copy so we don't reorder the input transform_boxes< ExecSpace >( boxes, radix_tree.m_leaf_aabbs, diff --git a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp index 9506d2a1f0..e394e884db 100644 --- a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp +++ b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp @@ -8,8 +8,10 @@ #define AXOM_SPIN_EMIT_BVH_H_ // axom core includes -#include "axom/core/Types.hpp" // for fixed bitwidth types -#include "axom/core/memory_management.hpp" // for alloc()/free() +#include "axom/core/Types.hpp" // for fixed bitwidth types +#include "axom/core/memory_management.hpp" // for alloc()/free() +#include "axom/core/utilities/NVTXRange.hpp" // for NVTX annotations +#include "axom/slic/interface/slic_macros.hpp" // for SLIC_ASSERT() #include "axom/core/execution/execution_space.hpp" #include "axom/core/execution/for_all.hpp" @@ -57,6 +59,8 @@ template < typename ExecSpace, typename FloatType > void emit_bvh( RadixTree& data, BVHData< FloatType, 3 >& bvh_data ) { + AXOM_NVTX_FUNCTION( "emit_bvh3D" ); + const int32 size = data.m_size; const int32 inner_size = data.m_inner_size; SLIC_ASSERT( inner_size == size-1 ); @@ -69,74 +73,79 @@ void emit_bvh( RadixTree& data, Vec* flat_ptr = bvh_data.m_inner_nodes; - for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) - { - Vec vec1; - Vec vec2; - Vec vec3; - Vec vec4; - - AABB l_aabb, r_aabb; - - int32 lchild = lchildren_ptr[node]; - if(lchild >= inner_size) + AXOM_NVTX_SECTION( "emit_bvh_parents", + for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { - l_aabb = leaf_aabb_ptr[lchild - inner_size]; - lchild = -(lchild - inner_size + 1); - } - else - { - l_aabb = inner_aabb_ptr[lchild]; - // do the offset now - lchild *= 4; - } - - int32 rchild = rchildren_ptr[node]; - if(rchild >= inner_size) - { - r_aabb = leaf_aabb_ptr[rchild - inner_size]; - rchild = -(rchild - inner_size + 1); - } - else - { - r_aabb = inner_aabb_ptr[rchild]; - // do the offset now - rchild *= 4; - } - vec1[0] = l_aabb.m_x.min(); - vec1[1] = l_aabb.m_y.min(); - vec1[2] = l_aabb.m_z.min(); - - vec1[3] = l_aabb.m_x.max(); - vec2[0] = l_aabb.m_y.max(); - vec2[1] = l_aabb.m_z.max(); - - vec2[2] = r_aabb.m_x.min(); - vec2[3] = r_aabb.m_y.min(); - vec3[0] = r_aabb.m_z.min(); - - vec3[1] = r_aabb.m_x.max(); - vec3[2] = r_aabb.m_y.max(); - vec3[3] = r_aabb.m_z.max(); - - const int32 out_offset = node * 4; - flat_ptr[out_offset + 0] = vec1; - flat_ptr[out_offset + 1] = vec2; - flat_ptr[out_offset + 2] = vec3; - - constexpr int32 isize = sizeof(int32); - // memcopy so we do not truncate the ints - memcpy(&vec4[0], &lchild, isize); - memcpy(&vec4[1], &rchild, isize); - flat_ptr[out_offset + 3] = vec4; - }); + Vec vec1; + Vec vec2; + Vec vec3; + Vec vec4; + + AABB l_aabb, r_aabb; + + int32 lchild = lchildren_ptr[node]; + if(lchild >= inner_size) + { + l_aabb = leaf_aabb_ptr[lchild - inner_size]; + lchild = -(lchild - inner_size + 1); + } + else + { + l_aabb = inner_aabb_ptr[lchild]; + // do the offset now + lchild *= 4; + } + + int32 rchild = rchildren_ptr[node]; + if(rchild >= inner_size) + { + r_aabb = leaf_aabb_ptr[rchild - inner_size]; + rchild = -(rchild - inner_size + 1); + } + else + { + r_aabb = inner_aabb_ptr[rchild]; + // do the offset now + rchild *= 4; + } + vec1[0] = l_aabb.m_x.min(); + vec1[1] = l_aabb.m_y.min(); + vec1[2] = l_aabb.m_z.min(); + + vec1[3] = l_aabb.m_x.max(); + vec2[0] = l_aabb.m_y.max(); + vec2[1] = l_aabb.m_z.max(); + + vec2[2] = r_aabb.m_x.min(); + vec2[3] = r_aabb.m_y.min(); + vec3[0] = r_aabb.m_z.min(); + + vec3[1] = r_aabb.m_x.max(); + vec3[2] = r_aabb.m_y.max(); + vec3[3] = r_aabb.m_z.max(); + + const int32 out_offset = node * 4; + flat_ptr[out_offset + 0] = vec1; + flat_ptr[out_offset + 1] = vec2; + flat_ptr[out_offset + 2] = vec3; + + constexpr int32 isize = sizeof(int32); + // memcopy so we do not truncate the ints + memcpy(&vec4[0], &lchild, isize); + memcpy(&vec4[1], &rchild, isize); + flat_ptr[out_offset + 3] = vec4; + } ); + ); int32* radix_tree_leafs = data.m_leafs; int32* bvh_leafs = bvh_data.m_leaf_nodes; - for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) - { - bvh_leafs[ i ] = radix_tree_leafs[ i ]; - } ); + + AXOM_NVTX_SECTION( "emit_bvh_leafs", + for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) + { + bvh_leafs[ i ] = radix_tree_leafs[ i ]; + } ); + ); } @@ -145,6 +154,8 @@ template < typename ExecSpace, typename FloatType > void emit_bvh( RadixTree& data, BVHData< FloatType, 2 >& bvh_data ) { + AXOM_NVTX_FUNCTION( "emit_bvh2D" ); + const int32 size = data.m_size; const int32 inner_size = data.m_inner_size; SLIC_ASSERT( inner_size == size-1 ); @@ -158,74 +169,79 @@ void emit_bvh( RadixTree& data, Vec* flat_ptr = bvh_data.m_inner_nodes; - for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) - { - Vec vec1; - Vec vec2; - Vec vec3; - Vec vec4; - - AABB l_aabb, r_aabb; - - int32 lchild = lchildren_ptr[node]; - if(lchild >= inner_size) + AXOM_NVTX_SECTION( "emit_bvh_parents", + for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { - l_aabb = leaf_aabb_ptr[lchild - inner_size]; - lchild = -(lchild - inner_size + 1); - } - else - { - l_aabb = inner_aabb_ptr[lchild]; - // do the offset now - lchild *= 4; - } - - int32 rchild = rchildren_ptr[node]; - if(rchild >= inner_size) - { - r_aabb = leaf_aabb_ptr[rchild - inner_size]; - rchild = -(rchild - inner_size + 1); - } - else - { - r_aabb = inner_aabb_ptr[rchild]; - // do the offset now - rchild *= 4; - } - vec1[0] = l_aabb.m_x.min(); - vec1[1] = l_aabb.m_y.min(); - vec1[2] = 0.0; - - vec1[3] = l_aabb.m_x.max(); - vec2[0] = l_aabb.m_y.max(); - vec2[1] = 0.0; - - vec2[2] = r_aabb.m_x.min(); - vec2[3] = r_aabb.m_y.min(); - vec3[0] = 0.0; - - vec3[1] = r_aabb.m_x.max(); - vec3[2] = r_aabb.m_y.max(); - vec3[3] = 0.0; - - const int32 out_offset = node * 4; - flat_ptr[out_offset + 0] = vec1; - flat_ptr[out_offset + 1] = vec2; - flat_ptr[out_offset + 2] = vec3; - - constexpr int32 isize = sizeof(int32); - // memcopy so we do not truncate the ints - memcpy(&vec4[0], &lchild, isize); - memcpy(&vec4[1], &rchild, isize); - flat_ptr[out_offset + 3] = vec4; - } ); + Vec vec1; + Vec vec2; + Vec vec3; + Vec vec4; + + AABB l_aabb, r_aabb; + + int32 lchild = lchildren_ptr[node]; + if(lchild >= inner_size) + { + l_aabb = leaf_aabb_ptr[lchild - inner_size]; + lchild = -(lchild - inner_size + 1); + } + else + { + l_aabb = inner_aabb_ptr[lchild]; + // do the offset now + lchild *= 4; + } + + int32 rchild = rchildren_ptr[node]; + if(rchild >= inner_size) + { + r_aabb = leaf_aabb_ptr[rchild - inner_size]; + rchild = -(rchild - inner_size + 1); + } + else + { + r_aabb = inner_aabb_ptr[rchild]; + // do the offset now + rchild *= 4; + } + vec1[0] = l_aabb.m_x.min(); + vec1[1] = l_aabb.m_y.min(); + vec1[2] = 0.0; + + vec1[3] = l_aabb.m_x.max(); + vec2[0] = l_aabb.m_y.max(); + vec2[1] = 0.0; + + vec2[2] = r_aabb.m_x.min(); + vec2[3] = r_aabb.m_y.min(); + vec3[0] = 0.0; + + vec3[1] = r_aabb.m_x.max(); + vec3[2] = r_aabb.m_y.max(); + vec3[3] = 0.0; + + const int32 out_offset = node * 4; + flat_ptr[out_offset + 0] = vec1; + flat_ptr[out_offset + 1] = vec2; + flat_ptr[out_offset + 2] = vec3; + + constexpr int32 isize = sizeof(int32); + // memcopy so we do not truncate the ints + memcpy(&vec4[0], &lchild, isize); + memcpy(&vec4[1], &rchild, isize); + flat_ptr[out_offset + 3] = vec4; + } ); + ); int32* radix_tree_leafs = data.m_leafs; int32* bvh_leafs = bvh_data.m_leaf_nodes; - for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) - { - bvh_leafs[ i ] = radix_tree_leafs[ i ]; - } ); + + AXOM_NVTX_SECTION( "emit_bvh_leafs", + for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) + { + bvh_leafs[ i ] = radix_tree_leafs[ i ]; + } ); + ); } From 134df15068ec99a95e1320d2eb198a2f018359ac Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 10 Apr 2020 20:28:08 -0700 Subject: [PATCH 155/632] ENH: make category a uint32_t instead of an enum --- src/axom/core/utilities/NVTXRange.cpp | 2 +- src/axom/core/utilities/NVTXRange.hpp | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/axom/core/utilities/NVTXRange.cpp b/src/axom/core/utilities/NVTXRange.cpp index 263252e3e5..f48a4ef009 100644 --- a/src/axom/core/utilities/NVTXRange.cpp +++ b/src/axom/core/utilities/NVTXRange.cpp @@ -22,7 +22,7 @@ namespace axom NVTXRange::NVTXRange( const std::string& name, NVTXColor color, - NVTXCategory category ) : + uint32_t category ) : m_name( name ), m_color( color ), m_category( category ), diff --git a/src/axom/core/utilities/NVTXRange.hpp b/src/axom/core/utilities/NVTXRange.hpp index 32d08622c3..6f133ad54f 100644 --- a/src/axom/core/utilities/NVTXRange.hpp +++ b/src/axom/core/utilities/NVTXRange.hpp @@ -32,25 +32,21 @@ enum class NVTXColor : uint32_t PINK = 0x00FF69B4 }; -/*! - * \brief Predefined set of user-specified categories to use with NVTXRange. - */ -enum class NVTXCategory : uint32_t -{ - ANY = 0, /*!< wildcard used to annotate generic sections */ - PACKING, /*!< used to annotate code that is doing packing */ - MEMTRANSFER, /*!< used to annotate code that is doing memory transfer */ -}; /*! * \brief Default NVTX color to use. Set to GREEN. */ constexpr NVTXColor DEFAULT_NVTX_COLOR = NVTXColor::GREEN; +/*! + * \brief Wildcard used for category + */ +constexpr uint32_t NVTX_ANY_CATEGORY = 0; + /*! * \brief Default NVTX category to use. Set to ANY. */ -constexpr NVTXCategory DEFAULT_NVTX_CATEGORY = NVTXCategory::ANY; +constexpr uint32_t DEFAULT_NVTX_CATEGORY = NVTX_ANY_CATEGORY; // Forward Declarations class NVTXRange; @@ -200,7 +196,7 @@ class NVTXRange */ NVTXRange( const std::string& name, NVTXColor color = DEFAULT_NVTX_COLOR, - NVTXCategory category= DEFAULT_NVTX_CATEGORY ); + uint32_t category= DEFAULT_NVTX_CATEGORY ); /*! * \brief Destructor. @@ -223,7 +219,7 @@ class NVTXRange std::string m_name; NVTXColor m_color; - NVTXCategory m_category; + uint32_t m_category; bool m_active; DISABLE_COPY_AND_ASSIGNMENT(NVTXRange); From 4f3e5b1fcb264db973f2d68df9b08d331f15a853 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 10 Apr 2020 21:06:17 -0700 Subject: [PATCH 156/632] ENH: move NVTX macros in a seperate header Move the NVTX macros in a seperate header under "axom/core/utilities/nvtx". --- src/axom/core/CMakeLists.txt | 2 + src/axom/core/utilities/NVTXRange.hpp | 93 ------------------- src/axom/core/utilities/nvtx/Macros.hpp | 117 ++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 93 deletions(-) create mode 100644 src/axom/core/utilities/nvtx/Macros.hpp diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index 8b4fb9e9a0..b52be93db0 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -18,6 +18,8 @@ set(core_headers utilities/Utilities.hpp utilities/About.hpp + utilities/nvtx/Macros.hpp + ## numerics numerics/internal/matrix_norms.hpp diff --git a/src/axom/core/utilities/NVTXRange.hpp b/src/axom/core/utilities/NVTXRange.hpp index 6f133ad54f..4e3f0414ac 100644 --- a/src/axom/core/utilities/NVTXRange.hpp +++ b/src/axom/core/utilities/NVTXRange.hpp @@ -51,99 +51,6 @@ constexpr uint32_t DEFAULT_NVTX_CATEGORY = NVTX_ANY_CATEGORY; // Forward Declarations class NVTXRange; -/// \name AXOM NVTX Macros -///@{ - -/*! - * \def AXOM_NVTX_SECTION - * - * \brief The AXOM_NVTX_SECTION macro is used to annotate sections of code - * - * \note In contrast to the AXOM_NVTX_FUNCTION macro, the AXOM_NVTX_SECTION - * macro is used to annotate sections of code, at a much finer granularity, - * within a given function. - * - * \warning Variables declared within a given AXOM_NVTX_SECTION are only defined - * within the scope of the AXOM_NVTX_SECTION. - * - * \warning An AXOM_NVTX_SECTION cannot be called in a nested fashion, i.e., - * within another AXOM_NVTX_SECTION - * - * \note You may have multiple AXOM_NVTX_SECTION defined within a function and - * this macro can be used in conjunction with the AXOM_NVTX_FUNCTION macro. - * - * \Usage Example: - * \code - * - * void foo( ) - * { - * AXOM_NVTX_FUNCTION( "foo"" ); - * - * // STEP 0: Run kernel A - * AXOM_NVTX_SECTION( "kernelA", - * - * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType i) - * { - * .. - * } ); - * - * ); // END NVTX SECTION for kernel A - * - * // STEP 1: Run kernel B - * AXOM_NVTX_SECTION( "kernelB", - * - * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType i) - * { - * ... - * } ); - * - * ); // END NVTX SECTION for kernel B - * - * } - * \endcode - * - */ -#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) -#define AXOM_NVTX_SECTION( __name__, ... ) \ - do { \ - axom::NVTXRange r(__name__); \ - __VA_ARGS__ \ - } while( false ) -#else -#define AXOM_NVTX_SECTION( __name__, ... ) \ - do { \ - __VA_ARGS__ \ - } while( false ) -#endif - -/*! - * \def AXOM_NVTX_FUNCTION( name ) - * - * \brief The AXOM_NVTX_FUNCTION macro is used to annotate a function. - * \param [in] name a user-supplied name that will be given to the range. - * - * \note Typically, the AXOM_NVTX_FUNCTION macro is placed in the beginning of - * the function to annotate. - * - * \warning The AXOM_NVTX_FUNCTION can be called once within a (function) scope. - * - * Usage Example: - * \code - * void foo( ) - * { - * AXOM_NVTX_FUNCTION( "foo" ); - * ... - * } - * \endcode - * - */ -#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) -#define AXOM_NVTX_FUNCTION( __name__ ) axom::NVTXRange __func_range(__name__) -#else -#define AXOM_NVTX_FUNCTION( __name__ ) -#endif - -///@} /*! * \class NVTXRange diff --git a/src/axom/core/utilities/nvtx/Macros.hpp b/src/axom/core/utilities/nvtx/Macros.hpp new file mode 100644 index 0000000000..32e733c0d7 --- /dev/null +++ b/src/axom/core/utilities/nvtx/Macros.hpp @@ -0,0 +1,117 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_NVTX_MACROS_HPP_ +#define AXOM_NVTX_MACROS_HPP_ + +#include "axom/core/utilities/NVTXRange.hpp" + +/*! + * \file + * + * \brief Defines NVTX Macros that can be used to annotate functions and + * sections of the code. These macros use the NVIDIA Tools Extension library + * to provide additional information to NVIDIA performance tools, e.g., + * nvprof, nvvp, Nsight, thereby, facilitate developers in performance + * evaluation. + * + */ + +/// \name AXOM NVTX Macros +///@{ + +/*! + * \def AXOM_NVTX_SECTION + * + * \brief The AXOM_NVTX_SECTION macro is used to annotate sections of code + * + * \note In contrast to the AXOM_NVTX_FUNCTION macro, the AXOM_NVTX_SECTION + * macro is used to annotate sections of code, at a much finer granularity, + * within a given function. + * + * \warning Variables declared within a given AXOM_NVTX_SECTION are only defined + * within the scope of the AXOM_NVTX_SECTION. + * + * \warning An AXOM_NVTX_SECTION cannot be called in a nested fashion, i.e., + * within another AXOM_NVTX_SECTION + * + * \note You may have multiple AXOM_NVTX_SECTION defined within a function and + * this macro can be used in conjunction with the AXOM_NVTX_FUNCTION macro. + * + * \Usage Example: + * \code + * + * void foo( ) + * { + * AXOM_NVTX_FUNCTION( "foo"" ); + * + * // STEP 0: Run kernel A + * AXOM_NVTX_SECTION( "kernelA", + * + * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType i) + * { + * .. + * } ); + * + * ); // END NVTX SECTION for kernel A + * + * // STEP 1: Run kernel B + * AXOM_NVTX_SECTION( "kernelB", + * + * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType i) + * { + * ... + * } ); + * + * ); // END NVTX SECTION for kernel B + * + * } + * \endcode + * + */ +#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) +#define AXOM_NVTX_SECTION( __name__, ... ) \ + do { \ + axom::NVTXRange r(__name__); \ + __VA_ARGS__ \ + } while( false ) +#else +#define AXOM_NVTX_SECTION( __name__, ... ) \ + do { \ + __VA_ARGS__ \ + } while( false ) +#endif + +/*! + * \def AXOM_NVTX_FUNCTION( name ) + * + * \brief The AXOM_NVTX_FUNCTION macro is used to annotate a function. + * \param [in] name a user-supplied name that will be given to the range. + * + * \note Typically, the AXOM_NVTX_FUNCTION macro is placed in the beginning of + * the function to annotate. + * + * \warning The AXOM_NVTX_FUNCTION can be called once within a (function) scope. + * + * Usage Example: + * \code + * void foo( ) + * { + * AXOM_NVTX_FUNCTION( "foo" ); + * ... + * } + * \endcode + * + */ +#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) +#define AXOM_NVTX_FUNCTION( __name__ ) axom::NVTXRange __func_range(__name__) +#else +#define AXOM_NVTX_FUNCTION( __name__ ) +#endif + +///@} + + +#endif /* AXOM_NVTX_MACROS_HPP_ */ From dffe1e6daa7b80493e2c4e5b0301dfa2585e81d1 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 10 Apr 2020 21:29:54 -0700 Subject: [PATCH 157/632] COMP: update include paths to NVTX macros --- src/axom/spin/internal/linear_bvh/BVH_impl.hpp | 2 +- src/axom/spin/internal/linear_bvh/build_radix_tree.hpp | 2 +- src/axom/spin/internal/linear_bvh/emit_bvh.hpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 4aa2bfc32e..7d209bc3a0 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -10,7 +10,7 @@ #include "axom/core/execution/for_all.hpp" // for generic for_all() #include "axom/core/memory_management.hpp" // for memory functions #include "axom/core/numerics/floating_point_limits.hpp" // floating_point_limits -#include "axom/core/utilities/NVTXRange.hpp" // for NVTX annotations +#include "axom/core/utilities/nvtx/Macros.hpp" // for NVTX annotations // slic includes #include "axom/slic/interface/slic.hpp" // for SLIC macros diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index 8cfca3eaed..eca8f9879f 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -9,7 +9,7 @@ #include "axom/core/execution/execution_space.hpp" #include "axom/core/execution/for_all.hpp" -#include "axom/core/utilities/NVTXRange.hpp" // for NVTX annotations +#include "axom/core/utilities/nvtx/Macros.hpp" // for NVTX annotations #include "axom/spin/internal/linear_bvh/BVHData.hpp" #include "axom/spin/internal/linear_bvh/RadixTree.hpp" diff --git a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp index e394e884db..30461d4db4 100644 --- a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp +++ b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp @@ -8,10 +8,10 @@ #define AXOM_SPIN_EMIT_BVH_H_ // axom core includes -#include "axom/core/Types.hpp" // for fixed bitwidth types -#include "axom/core/memory_management.hpp" // for alloc()/free() -#include "axom/core/utilities/NVTXRange.hpp" // for NVTX annotations -#include "axom/slic/interface/slic_macros.hpp" // for SLIC_ASSERT() +#include "axom/core/Types.hpp" // for fixed bitwidth types +#include "axom/core/memory_management.hpp" // for alloc()/free() +#include "axom/core/utilities/nvtx/Macros.hpp" // for NVTX annotations +#include "axom/slic/interface/slic_macros.hpp" // for SLIC_ASSERT() #include "axom/core/execution/execution_space.hpp" #include "axom/core/execution/for_all.hpp" From 1581db896be47544b0118ee6f4568ebac26b59f9 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 10 Apr 2020 21:34:36 -0700 Subject: [PATCH 158/632] ENH: move NVTXRange class to utlities/nvtx/Range --- src/axom/core/CMakeLists.txt | 5 +++-- src/axom/core/utilities/{NVTXRange.cpp => nvtx/Range.cpp} | 0 src/axom/core/utilities/{NVTXRange.hpp => nvtx/Range.hpp} | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename src/axom/core/utilities/{NVTXRange.cpp => nvtx/Range.cpp} (100%) rename src/axom/core/utilities/{NVTXRange.hpp => nvtx/Range.hpp} (100%) diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index b52be93db0..8d99f7ebb9 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -13,12 +13,12 @@ set(core_headers ## utilities utilities/FileUtilities.hpp - utilities/NVTXRange.hpp utilities/Timer.hpp utilities/Utilities.hpp utilities/About.hpp utilities/nvtx/Macros.hpp + utilities/nvtx/Range.hpp ## numerics numerics/internal/matrix_norms.hpp @@ -54,10 +54,11 @@ set(core_headers set(core_sources utilities/FileUtilities.cpp - utilities/NVTXRange.cpp utilities/Utilities.cpp utilities/About.cpp + utilities/nvtx/Range.cpp + numerics/polynomial_solvers.cpp Types.cpp ) diff --git a/src/axom/core/utilities/NVTXRange.cpp b/src/axom/core/utilities/nvtx/Range.cpp similarity index 100% rename from src/axom/core/utilities/NVTXRange.cpp rename to src/axom/core/utilities/nvtx/Range.cpp diff --git a/src/axom/core/utilities/NVTXRange.hpp b/src/axom/core/utilities/nvtx/Range.hpp similarity index 100% rename from src/axom/core/utilities/NVTXRange.hpp rename to src/axom/core/utilities/nvtx/Range.hpp From babbc12481bab9a16adde18b20e52639dde9004d Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 10 Apr 2020 23:02:03 -0700 Subject: [PATCH 159/632] ENH: axom::nvtx::Range class refactor Refactor the axom::nvtx::Range class such that it is in its proper namespace and rename accordingly. --- src/axom/core/utilities/nvtx/Macros.hpp | 6 ++-- src/axom/core/utilities/nvtx/Range.cpp | 17 +++++----- src/axom/core/utilities/nvtx/Range.hpp | 41 +++++++++++++------------ 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/axom/core/utilities/nvtx/Macros.hpp b/src/axom/core/utilities/nvtx/Macros.hpp index 32e733c0d7..62a37c42bf 100644 --- a/src/axom/core/utilities/nvtx/Macros.hpp +++ b/src/axom/core/utilities/nvtx/Macros.hpp @@ -6,7 +6,7 @@ #ifndef AXOM_NVTX_MACROS_HPP_ #define AXOM_NVTX_MACROS_HPP_ -#include "axom/core/utilities/NVTXRange.hpp" +#include "axom/core/utilities/nvtx/Range.hpp" /*! * \file @@ -74,7 +74,7 @@ #if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) #define AXOM_NVTX_SECTION( __name__, ... ) \ do { \ - axom::NVTXRange r(__name__); \ + axom::nvtx::Range r(__name__); \ __VA_ARGS__ \ } while( false ) #else @@ -106,7 +106,7 @@ * */ #if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) -#define AXOM_NVTX_FUNCTION( __name__ ) axom::NVTXRange __func_range(__name__) +#define AXOM_NVTX_FUNCTION( __name__ ) axom::nvtx::Range __func_range(__name__) #else #define AXOM_NVTX_FUNCTION( __name__ ) #endif diff --git a/src/axom/core/utilities/nvtx/Range.cpp b/src/axom/core/utilities/nvtx/Range.cpp index f48a4ef009..b6e87909ac 100644 --- a/src/axom/core/utilities/nvtx/Range.cpp +++ b/src/axom/core/utilities/nvtx/Range.cpp @@ -3,7 +3,7 @@ // // SPDX-License-Identifier: (BSD-3-Clause) -#include "axom/core/utilities/NVTXRange.hpp" +#include "axom/core/utilities/nvtx/Range.hpp" #include "axom/config.hpp" // for axom compile-time definitions @@ -19,10 +19,11 @@ namespace axom { +namespace nvtx +{ + -NVTXRange::NVTXRange( const std::string& name, - NVTXColor color, - uint32_t category ) : +Range::Range( const std::string& name, Color color, uint32_t category ) : m_name( name ), m_color( color ), m_category( category ), @@ -34,13 +35,13 @@ NVTXRange::NVTXRange( const std::string& name, } //------------------------------------------------------------------------------ -NVTXRange::~NVTXRange() +Range::~Range() { stop(); } //------------------------------------------------------------------------------ -void NVTXRange::start() +void Range::start() { assert( !m_active ); #ifdef AXOM_USE_CUDA @@ -64,7 +65,7 @@ void NVTXRange::start() } //------------------------------------------------------------------------------ -void NVTXRange::stop() +void Range::stop() { if ( m_active ) { @@ -75,4 +76,6 @@ void NVTXRange::stop() } } +} /* namespace nvtx */ + } /* namespace axom */ diff --git a/src/axom/core/utilities/nvtx/Range.hpp b/src/axom/core/utilities/nvtx/Range.hpp index 4e3f0414ac..ae1eb0b29b 100644 --- a/src/axom/core/utilities/nvtx/Range.hpp +++ b/src/axom/core/utilities/nvtx/Range.hpp @@ -13,11 +13,13 @@ namespace axom { +namespace nvtx +{ /*! * \brief Predefined set of NVTX colors to use with NVTXRange. */ -enum class NVTXColor : uint32_t +enum class Color : uint32_t { BLACK = 0x00000000, GREEN = 0x0000FF00, @@ -36,26 +38,23 @@ enum class NVTXColor : uint32_t /*! * \brief Default NVTX color to use. Set to GREEN. */ -constexpr NVTXColor DEFAULT_NVTX_COLOR = NVTXColor::GREEN; +constexpr Color DEFAULT_COLOR = Color::GREEN; /*! * \brief Wildcard used for category */ -constexpr uint32_t NVTX_ANY_CATEGORY = 0; +constexpr uint32_t ANY_CATEGORY = 0; /*! * \brief Default NVTX category to use. Set to ANY. */ -constexpr uint32_t DEFAULT_NVTX_CATEGORY = NVTX_ANY_CATEGORY; - -// Forward Declarations -class NVTXRange; +constexpr uint32_t DEFAULT_CATEGORY = ANY_CATEGORY; /*! - * \class NVTXRange + * \class Range * - * \brief NVTXRange is a simple utility class to annotate code. + * \brief Range is a simple utility class to annotate code. * * The NVTXRange class is a simple utility class that can be used in * conjunction with the NVIDIA Tools Extension library to allow developers @@ -68,8 +67,8 @@ class NVTXRange; * when the NVTXRange object is instantiated and stopped when the object * goes out of scope. * - * \thanks Jason Burmark (burmark1@llnl.gov) for his original implementation - * that inspired the implementation of this class. + * \remark Thanks to Jason Burmark (burmark1@llnl.gov) for his original + * implementation that inspired the implementation of this class. * * Usage Example: * \code @@ -83,14 +82,14 @@ class NVTXRange; * \endcode * */ -class NVTXRange +class Range { public: /*! * \brief Default constructor. Disabled. */ - NVTXRange() = delete; + Range() = delete; /*! * \brief Creates an NVTXRage instance with the given name. @@ -101,14 +100,14 @@ class NVTXRange * * \pre name.empty() == false */ - NVTXRange( const std::string& name, - NVTXColor color = DEFAULT_NVTX_COLOR, - uint32_t category= DEFAULT_NVTX_CATEGORY ); + Range( const std::string& name, + Color color = DEFAULT_COLOR, + uint32_t category= DEFAULT_CATEGORY ); /*! * \brief Destructor. */ - ~NVTXRange(); + ~Range(); private: @@ -125,14 +124,16 @@ class NVTXRange void stop(); std::string m_name; - NVTXColor m_color; + Color m_color; uint32_t m_category; bool m_active; - DISABLE_COPY_AND_ASSIGNMENT(NVTXRange); - DISABLE_MOVE_AND_ASSIGNMENT(NVTXRange); + DISABLE_COPY_AND_ASSIGNMENT(Range); + DISABLE_MOVE_AND_ASSIGNMENT(Range); }; +} /* namespace nvtx */ + } /* namespace axom */ #endif /* AXOM_NVTXRANGE_HPP_ */ From 6c64c1201ab30b47eaffced6f3b6851071e6130f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 13 Apr 2020 14:02:03 -0700 Subject: [PATCH 160/632] ENH: interface to set NVTX settings from This commit adds an interface to set the various NVTX settings e.g., color and category from a host code. The nvtx::Range class is also refactored to use the prescribed settings when an NVTX range is created. A simple test is added to test this functionality. A host code may now set the desired NVTX setting as follows: ``` axom::nvtx::set_color( axom::nvtx::Color::BLUE ); axom::nvtx::set_category( 3 ); ``` Then, all NVTX ranges that are created by Axom, will be created using the prescribed color and category settings. --- src/axom/core/CMakeLists.txt | 8 +- src/axom/core/tests/CMakeLists.txt | 1 + src/axom/core/tests/utils_nvtx_settings.cpp | 84 +++++++++++++++ src/axom/core/utilities/nvtx/Range.cpp | 16 ++- src/axom/core/utilities/nvtx/Range.hpp | 43 +------- src/axom/core/utilities/nvtx/interface.cpp | 66 ++++++++++++ src/axom/core/utilities/nvtx/interface.hpp | 109 ++++++++++++++++++++ 7 files changed, 274 insertions(+), 53 deletions(-) create mode 100644 src/axom/core/tests/utils_nvtx_settings.cpp create mode 100644 src/axom/core/utilities/nvtx/interface.cpp create mode 100644 src/axom/core/utilities/nvtx/interface.hpp diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index 8d99f7ebb9..d5a593cd5a 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -17,6 +17,7 @@ set(core_headers utilities/Utilities.hpp utilities/About.hpp + utilities/nvtx/interface.hpp utilities/nvtx/Macros.hpp utilities/nvtx/Range.hpp @@ -57,6 +58,7 @@ set(core_sources utilities/Utilities.cpp utilities/About.cpp + utilities/nvtx/interface.cpp utilities/nvtx/Range.cpp numerics/polynomial_solvers.cpp @@ -64,7 +66,7 @@ set(core_sources ) #------------------------------------------------------------------------------ -# Make/Install the library +# Set library dependencies #------------------------------------------------------------------------------ set( core_depends ) @@ -74,6 +76,10 @@ blt_list_append( TO core_depends ELEMENTS cuda nvToolsExt IF ${ENABLE_CUDA} ) blt_list_append( TO core_depends ELEMENTS openmp IF ${ENABLE_OPENMP} ) blt_list_append( TO core_depends ELEMENTS mpi IF ${ENABLE_MPI} ) +#------------------------------------------------------------------------------ +# Make/Install the library +#------------------------------------------------------------------------------ + blt_add_library( NAME core SOURCES ${core_sources} HEADERS ${core_headers} diff --git a/src/axom/core/tests/CMakeLists.txt b/src/axom/core/tests/CMakeLists.txt index 487fac6166..99b5bfc183 100644 --- a/src/axom/core/tests/CMakeLists.txt +++ b/src/axom/core/tests/CMakeLists.txt @@ -20,6 +20,7 @@ set(gtest_utils_tests utils_TaskTimer.cpp utils_endianness.cpp utils_fileUtilities.cpp + utils_nvtx_settings.cpp utils_utilities.cpp utils_about.cpp diff --git a/src/axom/core/tests/utils_nvtx_settings.cpp b/src/axom/core/tests/utils_nvtx_settings.cpp new file mode 100644 index 0000000000..81b38824e2 --- /dev/null +++ b/src/axom/core/tests/utils_nvtx_settings.cpp @@ -0,0 +1,84 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#include "axom/core/utilities/nvtx/interface.hpp" + +#include "gtest/gtest.h" + +//------------------------------------------------------------------------------ +// HELPER METHODS +//------------------------------------------------------------------------------ +namespace +{ + +//------------------------------------------------------------------------------ +void check_defaults() +{ + EXPECT_EQ( axom::nvtx::DEFAULT_COLOR, axom::nvtx::get_color() ); + EXPECT_EQ( axom::nvtx::DEFAULT_CATEGORY, axom::nvtx::get_category() ); +} + +//------------------------------------------------------------------------------ +void check_set_color( axom::nvtx::Color newColor ) +{ + axom::nvtx::set_color( newColor ); + EXPECT_EQ( newColor, axom::nvtx::get_color() ); +} + +//------------------------------------------------------------------------------ +void check_set_category( uint32_t newCategory ) +{ + axom::nvtx::set_category( newCategory ); + EXPECT_EQ( newCategory, axom::nvtx::get_category() ); +} + +} /* end anonymous namespace */ + +//------------------------------------------------------------------------------ +// UNIT TESTS +//------------------------------------------------------------------------------ +TEST( utils_nvtx_settings, default_settings ) +{ + check_defaults(); +} + +//------------------------------------------------------------------------------ +TEST( utils_nvtx_settings, set_color ) +{ + check_set_color( axom::nvtx::Color::BLACK ); + check_set_color( axom::nvtx::Color::BLUE ); + check_set_color( axom::nvtx::Color::YELLOW ); +} + +//------------------------------------------------------------------------------ +TEST( utils_nvtx_settings, set_category ) +{ + constexpr uint32_t MAX_CATEGORY = 42; + for ( uint32_t icategory=1; icategory < MAX_CATEGORY; ++icategory ) + { + check_set_category( icategory ); + } +} + +//------------------------------------------------------------------------------ +TEST( utils_nvtx_settings, set_and_reset ) +{ + check_set_color( axom::nvtx::Color::BLUE ); + + constexpr uint32_t MY_CATEGORY = 42; + check_set_category( MY_CATEGORY ); + + axom::nvtx::reset( ); + + check_defaults(); +} + +//------------------------------------------------------------------------------ +int main( int argc, char** argv ) +{ + ::testing::InitGoogleTest( &argc, argv ); + int result = RUN_ALL_TESTS(); + return( result ); +} diff --git a/src/axom/core/utilities/nvtx/Range.cpp b/src/axom/core/utilities/nvtx/Range.cpp index b6e87909ac..765d03747d 100644 --- a/src/axom/core/utilities/nvtx/Range.cpp +++ b/src/axom/core/utilities/nvtx/Range.cpp @@ -6,6 +6,7 @@ #include "axom/core/utilities/nvtx/Range.hpp" #include "axom/config.hpp" // for axom compile-time definitions +#include "axom/core/utilities/nvtx/interface.hpp" // C/C++ includes #include @@ -23,10 +24,8 @@ namespace nvtx { -Range::Range( const std::string& name, Color color, uint32_t category ) : +Range::Range( const std::string& name ) : m_name( name ), - m_color( color ), - m_category( category ), m_active( false ) { assert( !m_name.empty() ); @@ -44,23 +43,20 @@ Range::~Range() void Range::start() { assert( !m_active ); -#ifdef AXOM_USE_CUDA +#ifdef AXOM_USE_CUDA nvtxEventAttributes_t eventAttrib = {0}; eventAttrib.version = NVTX_VERSION; eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; - eventAttrib.category = static_cast< uint32_t >( m_category ); + eventAttrib.category = nvtx::get_category(); eventAttrib.colorType = NVTX_COLOR_ARGB; - eventAttrib.color = static_cast< uint32_t>( m_color ); + eventAttrib.color = static_cast< uint32_t>( nvtx::get_color() ); eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; eventAttrib.message.ascii = m_name.c_str(); nvtxRangePushEx(&eventAttrib); -#else - /* silence compiler warnings regarding unused variables */ - static_cast< void >( m_color ); - static_cast< void >( m_category ); #endif + m_active = true; } diff --git a/src/axom/core/utilities/nvtx/Range.hpp b/src/axom/core/utilities/nvtx/Range.hpp index ae1eb0b29b..2110b1e69e 100644 --- a/src/axom/core/utilities/nvtx/Range.hpp +++ b/src/axom/core/utilities/nvtx/Range.hpp @@ -16,41 +16,6 @@ namespace axom namespace nvtx { -/*! - * \brief Predefined set of NVTX colors to use with NVTXRange. - */ -enum class Color : uint32_t -{ - BLACK = 0x00000000, - GREEN = 0x0000FF00, - LIME = 0x00BFFF00, - RED = 0x00FF0000, - BLUE = 0x000000FF, - YELLOW = 0x00FFFF00, - CYAN = 0x0000FFFF, - MAGENTA = 0x00FF00FF, - WHITE = 0x00FFFFFF, - ORANGE = 0x00FFA500, - PINK = 0x00FF69B4 -}; - - -/*! - * \brief Default NVTX color to use. Set to GREEN. - */ -constexpr Color DEFAULT_COLOR = Color::GREEN; - -/*! - * \brief Wildcard used for category - */ -constexpr uint32_t ANY_CATEGORY = 0; - -/*! - * \brief Default NVTX category to use. Set to ANY. - */ -constexpr uint32_t DEFAULT_CATEGORY = ANY_CATEGORY; - - /*! * \class Range * @@ -95,14 +60,10 @@ class Range * \brief Creates an NVTXRage instance with the given name. * * \param [in] name the name to associate with the range - * \param [in] color the color to associate with the range (optional) - * \param [in] category the category to associate with the range (optional) * * \pre name.empty() == false */ - Range( const std::string& name, - Color color = DEFAULT_COLOR, - uint32_t category= DEFAULT_CATEGORY ); + Range( const std::string& name ); /*! * \brief Destructor. @@ -124,8 +85,6 @@ class Range void stop(); std::string m_name; - Color m_color; - uint32_t m_category; bool m_active; DISABLE_COPY_AND_ASSIGNMENT(Range); diff --git a/src/axom/core/utilities/nvtx/interface.cpp b/src/axom/core/utilities/nvtx/interface.cpp new file mode 100644 index 0000000000..a972f74bd2 --- /dev/null +++ b/src/axom/core/utilities/nvtx/interface.cpp @@ -0,0 +1,66 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + + +#include "axom/core/utilities/nvtx/interface.hpp" + +namespace axom +{ +namespace nvtx +{ + +/*! + * \brief Internal data-structure to hold the NVTX settings. + */ +static struct settings_t +{ + uint32_t color; /*!< the associated color with an NVTX Range */ + uint32_t category; /*!< the associated category with an NVTX Range */ + + + settings_t( ) : + color( static_cast< uint32_t >( DEFAULT_COLOR ) ), + category( DEFAULT_CATEGORY ) + { } + +} Settings; + +//------------------------------------------------------------------------------ +// NVTX interface implementation +//------------------------------------------------------------------------------ + +void set_color( Color c ) +{ + Settings.color = static_cast< uint32_t >( c ); +} + +//------------------------------------------------------------------------------ +Color get_color( ) +{ + return static_cast< Color >( Settings.color ); +} + +//------------------------------------------------------------------------------ +void set_category( uint32_t category ) +{ + Settings.category = category; +} + +//------------------------------------------------------------------------------ +uint32_t get_category( ) +{ + return Settings.category; +} + +//------------------------------------------------------------------------------ +void reset() +{ + set_color( DEFAULT_COLOR ); + set_category( DEFAULT_CATEGORY ); +} + +} /* namespace nvtx */ + +} /* namespace axom */ diff --git a/src/axom/core/utilities/nvtx/interface.hpp b/src/axom/core/utilities/nvtx/interface.hpp new file mode 100644 index 0000000000..b7dbb1d92b --- /dev/null +++ b/src/axom/core/utilities/nvtx/interface.hpp @@ -0,0 +1,109 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_NVTX_INTERFACE_HPP_ +#define AXOM_NVTX_INTERFACE_HPP_ + +#include "axom/core/utilities/nvtx/Macros.hpp" + +namespace axom +{ +namespace nvtx +{ + +/*! + * \brief Predefined set of NVTX colors to use with NVTXRange. + */ +enum class Color : uint32_t +{ + BLACK = 0x00000000, + GREEN = 0x0000FF00, + LIME = 0x00BFFF00, + RED = 0x00FF0000, + BLUE = 0x000000FF, + YELLOW = 0x00FFFF00, + CYAN = 0x0000FFFF, + MAGENTA = 0x00FF00FF, + WHITE = 0x00FFFFFF, + ORANGE = 0x00FFA500, + PINK = 0x00FF69B4 +}; + +/// \name Glocal Definitions +/// @{ + +/*! + * \brief Wildcard used for category + */ +constexpr uint32_t ANY_CATEGORY = 0; + +/// @} + +/// \name Default Settings +/// @{ + +/*! + * \brief Default NVTX color to use. Set to GREEN. + */ +constexpr Color DEFAULT_COLOR = Color::GREEN; + +/*! + * \brief Default NVTX category to use. Set to ANY. + */ +constexpr uint32_t DEFAULT_CATEGORY = ANY_CATEGORY; + +/// @} + +/// \name NVTX API Functions +/// @{ + +/*! + * \brief Sets the color to use with NVTX. + * \param [in] c the color to use. + * + * \note If not set, axom::nvtx::DEFAULT_COLOR is used. + * + * \post axom::nvtx::get_color() == c + */ +void set_color( Color c ); + +/*! + * \brief Returns the color use by NVTX + * \return Color the color used by NVTX + * \see nvtx::Color + */ +Color get_color( ); + +/*! + * \brief Set the category to use with NVTX. + * \param [in] category the user-prescribed number for the category to use. + * + * \note If note set, axom::nvtx::DEFAULT_CATEGORY is used. + * + * \post axom::nvtx::get_category() == category + */ +void set_category( uint32_t category ); + +/*! + * \brief Get the category used with NVTX. + * \return category the category used with NVTX. + */ +uint32_t get_category( ); + +/*! + * \brief Resets the NVTX setting to the defaults. + * + * \post axom::nvtx::get_category() == axom::nvtx::DEFAULT_CATEGORY + * \post axom::nvtx::get_color() == axom::nvtx::DEFAULT_COLOR + */ +void reset(); + +/// @} + +} /* namespace nvtx */ + +} /* namespace axom */ + +#endif /* AXOM_NVTX_INTERFACE_HPP_ */ From 4522cf103879186aca1ca38742890e9c74f8ee78 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 13 Apr 2020 15:51:46 -0700 Subject: [PATCH 161/632] ENH: initial generic Axom annotation macros Add initial implementation for generic Axom annotation macros that can be used throughout Axom. Placeholders for future integration with Caliper are in place. The macros fall back to the NVTX macros otherwise. --- src/axom/core/CMakeLists.txt | 1 + src/axom/core/utilities/AnnotationMacros.hpp | 99 ++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/axom/core/utilities/AnnotationMacros.hpp diff --git a/src/axom/core/CMakeLists.txt b/src/axom/core/CMakeLists.txt index d5a593cd5a..874ece186f 100644 --- a/src/axom/core/CMakeLists.txt +++ b/src/axom/core/CMakeLists.txt @@ -12,6 +12,7 @@ set(core_headers ## utilities + utilities/AnnotationMacros.hpp utilities/FileUtilities.hpp utilities/Timer.hpp utilities/Utilities.hpp diff --git a/src/axom/core/utilities/AnnotationMacros.hpp b/src/axom/core/utilities/AnnotationMacros.hpp new file mode 100644 index 0000000000..173048a172 --- /dev/null +++ b/src/axom/core/utilities/AnnotationMacros.hpp @@ -0,0 +1,99 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#ifndef AXOM_ANNOTATION_MACROS_HPP_ +#define AXOM_ANNOTATION_MACROS_HPP_ + +#include "axom/config.hpp" + +#ifndef AXOM_USE_CALIPER +#include "axom/core/utilities/nvtx/interface.hpp" +#endif + +/*! + * \def AXOM_ANNOTATE_FUNCTION( name ) + * + * \brief The AXOM_ANNOTATE_FUNCTION is used to annotate a function. + * + * \param [in] name a user-supplied name to annotate the function. + * + * \note Typically, the AXOM_ANNOTATE_FUNCTION is placed in the beginning of + * the function to annotate. + * + * + * \warning The AXOM_ANNOTATE_FUNCTION can only be called once within a given + * (function) scope. + * + * + * Usage Example: + * \code + * void foo( ) + * { + * AXOM_ANNOTATE_FUNCTION( "foo" ); + * ... + * } + * \endcode + */ +#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) +#error "Support for Caliper has not yet been implemented in Axom!" +#elif defined(AXOM_ENABLE_ANNOTATIONS) +#define AXOM_ANNOTATE_FUNCTION(__func_name__) AXOM_NVTX_FUNCTION(__func_name__) +#else +#define AXOM_ANNOTATE_FUNCTION(__func_name__) +#endif + +/*! + * \def AXOM_ANNOTATE_SECTION( name ) + * + * \brief The AXOM_ANNOTATE_SECTION maacro is used to annotate sections of code. + * + * \note In contrast to the AXOM_ANNOTATE_FUNCTION, the AXOM_ANNOTATE_SECTION + * macro is used to annotate sections of code at a much finer granularity + * within a given function and it may be use in conjunction with the + * AXOM_ANNOTATE_FUNCTION macro. + * + * \warning Variables declared within an AXOM_ANNOTATE_SECTION are only defined + * within the scope of the annotated section. + * + * \warning The AXOM_ANNOTATE_SECTION macro may not be called in a nested + * fashion, i.e., within another AXOM_ANNOTATE_SECTION + * + * Usage Example: + * \code + * void foo( ) + * { + * AXOM_ANNOTATE_FUNCTION( "foo" ); + * + * AXOM_ANNOTATE_SECTION( "kernel_A", + * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType idx) + * { + * ... + * } ); + * ); + * + * AXOM_ANNOTATE_SECTION( "kernel_B", + * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType idx) + * { + * ... + * } ); + * ); + * + * } + * \endcode + * + */ +#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) +#error "Support for Caliper has not yet been implemented in Axom!" +#elif defined(AXOM_ENABLE_ANNOTATIONS) +#define AXOM_ANNOTATE_SECTION(__name__, ... ) \ + AXOM_NVTX_SECTION( __name__ , __VA_ARGS__ ) +#else +#define AXOM_ANNOTATE_SECTION(__name__,...) \ + do { \ + __VA_ARGS__ \ + } while( false ) +#endif + +#endif From 637ba217472adbb9404d12d1a9e62ae589ddddb4 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 13 Apr 2020 16:21:37 -0700 Subject: [PATCH 162/632] ENH: use generic macros to annotate the BVH Use the generic macros to annotate the BVH instead of the NVTX macros. --- src/axom/spin/internal/linear_bvh/BVHData.hpp | 4 ++ .../spin/internal/linear_bvh/BVH_impl.hpp | 12 +++--- .../spin/internal/linear_bvh/RadixTree.hpp | 6 +++ .../internal/linear_bvh/build_radix_tree.hpp | 40 +++++++++---------- .../spin/internal/linear_bvh/emit_bvh.hpp | 20 +++++----- 5 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVHData.hpp b/src/axom/spin/internal/linear_bvh/BVHData.hpp index 7ee81bf4cc..77596a260f 100644 --- a/src/axom/spin/internal/linear_bvh/BVHData.hpp +++ b/src/axom/spin/internal/linear_bvh/BVHData.hpp @@ -10,6 +10,8 @@ #include "axom/core/Types.hpp" // for fixed bitwidth types #include "axom/core/memory_management.hpp" // for alloc()/free() +#include "axom/core/utilities/AnnotationMacros.hpp" // for annotations + // spin includes #include "axom/spin/internal/linear_bvh/vec.hpp" #include "axom/spin/internal/linear_bvh/aabb.hpp" @@ -66,12 +68,14 @@ struct BVHData void allocate( int32 size ) { + AXOM_ANNOTATE_FUNCTION( "BVHData::allocate" ); m_inner_nodes = axom::allocate< Vec< FloatType,4 > >( (size-1)*4 ); m_leaf_nodes = axom::allocate< int32 >( size ); } void deallocate() { + AXOM_ANNOTATE_FUNCTION( "BVHData::deallocate" ); axom::deallocate( m_inner_nodes ); axom::deallocate( m_leaf_nodes ); } diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 7d209bc3a0..60c0507618 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -10,7 +10,7 @@ #include "axom/core/execution/for_all.hpp" // for generic for_all() #include "axom/core/memory_management.hpp" // for memory functions #include "axom/core/numerics/floating_point_limits.hpp" // floating_point_limits -#include "axom/core/utilities/nvtx/Macros.hpp" // for NVTX annotations +#include "axom/core/utilities/AnnotationMacros.hpp" // for annotations // slic includes #include "axom/slic/interface/slic.hpp" // for SLIC macros @@ -131,7 +131,7 @@ IndexType bvh_get_counts( LeftPredicate&& leftCheck, const FloatType* y, const FloatType* z ) noexcept { - AXOM_NVTX_FUNCTION( "bvh_get_counts" ); + AXOM_ANNOTATE_FUNCTION( "bvh_get_counts" ); // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -211,7 +211,7 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, const FloatType* z0, const FloatType* nz ) noexcept { - AXOM_NVTX_FUNCTION( "bvh_get_raycounts" ); + AXOM_ANNOTATE_FUNCTION( "bvh_get_raycounts" ); // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -374,7 +374,7 @@ BVH< NDIMS, ExecSpace, FloatType >::~BVH() template< int NDIMS, typename ExecSpace, typename FloatType > int BVH< NDIMS, ExecSpace, FloatType >::build() { - AXOM_NVTX_FUNCTION( "BVH::build" ); + AXOM_ANNOTATE_FUNCTION( "BVH::build" ); // STEP 0: set the default memory allocator to use for the execution space. const int currentAllocatorID = axom::getDefaultAllocatorID(); @@ -454,7 +454,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, const FloatType* y, const FloatType* z ) const { - AXOM_NVTX_FUNCTION( "BVH::findPoints" ); + AXOM_ANNOTATE_FUNCTION( "BVH::findPoints" ); SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); @@ -547,7 +547,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, const FloatType* z0, const FloatType* nz ) const { - AXOM_NVTX_FUNCTION( "BVH::findRays" ); + AXOM_ANNOTATE_FUNCTION( "BVH::findRays" ); SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); diff --git a/src/axom/spin/internal/linear_bvh/RadixTree.hpp b/src/axom/spin/internal/linear_bvh/RadixTree.hpp index 6f6ed9d61a..3fddf2c8f8 100644 --- a/src/axom/spin/internal/linear_bvh/RadixTree.hpp +++ b/src/axom/spin/internal/linear_bvh/RadixTree.hpp @@ -9,6 +9,8 @@ #include "axom/core/memory_management.hpp" #include "axom/spin/internal/linear_bvh/aabb.hpp" +#include "axom/core/utilities/AnnotationMacros.hpp" // for annotations + namespace axom { namespace spin @@ -42,6 +44,8 @@ struct RadixTree void allocate( int32 size ) { + AXOM_ANNOTATE_FUNCTION("RadixTree::allocate"); + m_size = size; m_inner_size = m_size-1; @@ -57,6 +61,8 @@ struct RadixTree void deallocate() { + AXOM_ANNOTATE_FUNCTION("RadixTree::deallocate"); + m_inner_size = 0; m_size = 0; diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index eca8f9879f..10eab0c47d 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -9,7 +9,7 @@ #include "axom/core/execution/execution_space.hpp" #include "axom/core/execution/for_all.hpp" -#include "axom/core/utilities/nvtx/Macros.hpp" // for NVTX annotations +#include "axom/core/utilities/AnnotationMacros.hpp" // for annotations #include "axom/spin/internal/linear_bvh/BVHData.hpp" #include "axom/spin/internal/linear_bvh/RadixTree.hpp" @@ -110,7 +110,7 @@ void transform_boxes( const FloatType* boxes, int32 size, FloatType scale_factor ) { - AXOM_NVTX_FUNCTION( "transform_boxes3D" ); + AXOM_ANNOTATE_FUNCTION( "transform_boxes3D" ); constexpr int NDIMS = 3; constexpr int STRIDE = 2 * NDIMS; @@ -145,7 +145,7 @@ void transform_boxes( const FloatType* boxes, int32 size, FloatType scale_factor ) { - AXOM_NVTX_FUNCTION( "transform_boxes2D" ); + AXOM_ANNOTATE_FUNCTION( "transform_boxes2D" ); constexpr int NDIMS = 2; constexpr int STRIDE = 2 * NDIMS; @@ -175,7 +175,7 @@ void transform_boxes( const FloatType* boxes, template < typename ExecSpace, typename FloatType > AABB reduce(AABB* aabbs, int32 size) { - AXOM_NVTX_FUNCTION( "reduce_abbs3D" ); + AXOM_ANNOTATE_FUNCTION( "reduce_abbs3D" ); constexpr int NDIMS = 3; @@ -221,7 +221,7 @@ AABB reduce(AABB* aabbs, int32 size) template < typename ExecSpace, typename FloatType > AABB reduce(AABB* aabbs, int32 size) { - AXOM_NVTX_FUNCTION( "reduce_abbs2D" ); + AXOM_ANNOTATE_FUNCTION( "reduce_abbs2D" ); constexpr int NDIMS = 2; @@ -263,7 +263,7 @@ void get_mcodes( AABB* aabbs, const AABB< FloatType,2 > &bounds, uint32* mcodes ) { - AXOM_NVTX_FUNCTION( "get_mcodes2D" ); + AXOM_ANNOTATE_FUNCTION( "get_mcodes2D" ); constexpr int NDIMS = 2; @@ -302,7 +302,7 @@ void get_mcodes( AABB* aabbs, const AABB< FloatType,3 > &bounds, uint32* mcodes ) { - AXOM_NVTX_FUNCTION( "get_mcodes3D" ); + AXOM_ANNOTATE_FUNCTION( "get_mcodes3D" ); constexpr int NDIMS = 3; @@ -345,7 +345,7 @@ void array_counting( IntType* iterator, const IntType& start, const IntType& step) { - AXOM_NVTX_FUNCTION( "array_counting" ); + AXOM_ANNOTATE_FUNCTION( "array_counting" ); for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { @@ -363,7 +363,7 @@ void array_counting( IntType* iterator, template< typename ExecSpace, typename T> void reorder(int32* indices, T*&array, int32 size) { - AXOM_NVTX_FUNCTION( "reorder" ); + AXOM_ANNOTATE_FUNCTION( "reorder" ); T* temp = axom::allocate< T >( size ); @@ -382,11 +382,11 @@ void reorder(int32* indices, T*&array, int32 size) template < typename ExecSpace > void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) { - AXOM_NVTX_FUNCTION( "custom_sort" ); + AXOM_ANNOTATE_FUNCTION( "custom_sort" ); array_counting< ExecSpace >(iter, size, 0, 1); - AXOM_NVTX_SECTION( "cpu_sort", + AXOM_ANNOTATE_SECTION( "cpu_sort", std::stable_sort( iter, iter + size, @@ -407,12 +407,12 @@ template < int BLOCK_SIZE > void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, uint32*& mcodes, int32 size, int32* iter ) { - AXOM_NVTX_FUNCTION( "custom_sort" ); + AXOM_ANNOTATE_FUNCTION( "custom_sort" ); using ExecSpace = typename axom::CUDA_EXEC< BLOCK_SIZE >; array_counting< ExecSpace >(iter, size, 0, 1); - AXOM_NVTX_SECTION( "gpu_cub_sort", + AXOM_ANNOTATE_SECTION( "gpu_cub_sort", uint32* mcodes_alt_buf = axom::allocate< uint32 >( size ); int32* iter_alt_buf = axom::allocate< int32 >( size ); @@ -457,7 +457,7 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, template < typename ExecSpace > void sort_mcodes( uint32*& mcodes, int32 size, int32* iter ) { - AXOM_NVTX_FUNCTION( "sort_mcodes" ); + AXOM_ANNOTATE_FUNCTION( "sort_mcodes" ); // dispatch custom_sort( ExecSpace(), mcodes, size, iter ); @@ -492,7 +492,7 @@ AXOM_HOST_DEVICE IntType delta( const IntType &a, template < typename ExecSpace, typename FloatType, int NDIMS > void build_tree( RadixTree< FloatType, NDIMS > &data ) { - AXOM_NVTX_FUNCTION( "build_tree" ); + AXOM_ANNOTATE_FUNCTION( "build_tree" ); // http://research.nvidia.com/sites/default/files/publications/karras2012hpg_paper.pdf @@ -584,7 +584,7 @@ void build_tree( RadixTree< FloatType, NDIMS > &data ) template< typename ExecSpace, typename T> static void array_memset(T* array, const int32 size, const T val) { - AXOM_NVTX_FUNCTION( "array_memset" ); + AXOM_ANNOTATE_FUNCTION( "array_memset" ); for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) { @@ -596,7 +596,7 @@ static void array_memset(T* array, const int32 size, const T val) template < typename ExecSpace, typename FloatType, int NDIMS > void propagate_aabbs( RadixTree< FloatType, NDIMS >& data) { - AXOM_NVTX_FUNCTION( "propagate_abbs" ); + AXOM_ANNOTATE_FUNCTION( "propagate_abbs" ); const int inner_size = data.m_inner_size; const int leaf_size = data.m_inner_size + 1; @@ -676,15 +676,13 @@ void build_radix_tree( const FloatType* boxes, RadixTree< FloatType, NDIMS >& radix_tree, FloatType scale_factor ) { - AXOM_NVTX_FUNCTION( "build_radix_tree" ); + AXOM_ANNOTATE_FUNCTION( "build_radix_tree" ); // sanity checks SLIC_ASSERT( boxes !=nullptr ); SLIC_ASSERT( size > 0 ); - AXOM_NVTX_SECTION( "allocate_radix_tree" , - radix_tree.allocate( size ); - ); + radix_tree.allocate( size ); // copy so we don't reorder the input transform_boxes< ExecSpace >( boxes, radix_tree.m_leaf_aabbs, diff --git a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp index 30461d4db4..51106bc227 100644 --- a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp +++ b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp @@ -8,10 +8,10 @@ #define AXOM_SPIN_EMIT_BVH_H_ // axom core includes -#include "axom/core/Types.hpp" // for fixed bitwidth types -#include "axom/core/memory_management.hpp" // for alloc()/free() -#include "axom/core/utilities/nvtx/Macros.hpp" // for NVTX annotations -#include "axom/slic/interface/slic_macros.hpp" // for SLIC_ASSERT() +#include "axom/core/Types.hpp" // for fixed bitwidth types +#include "axom/core/memory_management.hpp" // for alloc()/free() +#include "axom/core/utilities/AnnotationMacros.hpp" // for annotations +#include "axom/slic/interface/slic_macros.hpp" // for SLIC_ASSERT() #include "axom/core/execution/execution_space.hpp" #include "axom/core/execution/for_all.hpp" @@ -59,7 +59,7 @@ template < typename ExecSpace, typename FloatType > void emit_bvh( RadixTree& data, BVHData< FloatType, 3 >& bvh_data ) { - AXOM_NVTX_FUNCTION( "emit_bvh3D" ); + AXOM_ANNOTATE_FUNCTION( "emit_bvh3D" ); const int32 size = data.m_size; const int32 inner_size = data.m_inner_size; @@ -73,7 +73,7 @@ void emit_bvh( RadixTree& data, Vec* flat_ptr = bvh_data.m_inner_nodes; - AXOM_NVTX_SECTION( "emit_bvh_parents", + AXOM_ANNOTATE_SECTION( "emit_bvh_parents", for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { Vec vec1; @@ -140,7 +140,7 @@ void emit_bvh( RadixTree& data, int32* radix_tree_leafs = data.m_leafs; int32* bvh_leafs = bvh_data.m_leaf_nodes; - AXOM_NVTX_SECTION( "emit_bvh_leafs", + AXOM_ANNOTATE_SECTION( "emit_bvh_leafs", for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { bvh_leafs[ i ] = radix_tree_leafs[ i ]; @@ -154,7 +154,7 @@ template < typename ExecSpace, typename FloatType > void emit_bvh( RadixTree& data, BVHData< FloatType, 2 >& bvh_data ) { - AXOM_NVTX_FUNCTION( "emit_bvh2D" ); + AXOM_ANNOTATE_FUNCTION( "emit_bvh2D" ); const int32 size = data.m_size; const int32 inner_size = data.m_inner_size; @@ -169,7 +169,7 @@ void emit_bvh( RadixTree& data, Vec* flat_ptr = bvh_data.m_inner_nodes; - AXOM_NVTX_SECTION( "emit_bvh_parents", + AXOM_ANNOTATE_SECTION( "emit_bvh_parents", for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { Vec vec1; @@ -236,7 +236,7 @@ void emit_bvh( RadixTree& data, int32* radix_tree_leafs = data.m_leafs; int32* bvh_leafs = bvh_data.m_leaf_nodes; - AXOM_NVTX_SECTION( "emit_bvh_leafs", + AXOM_ANNOTATE_SECTION( "emit_bvh_leafs", for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { bvh_leafs[ i ] = radix_tree_leafs[ i ]; From 5d252e188eb01237ad55f176470441b153d591f6 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 13 Apr 2020 18:07:47 -0700 Subject: [PATCH 163/632] ENH: disable annotations by default --- src/cmake/AxomOptions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake/AxomOptions.cmake b/src/cmake/AxomOptions.cmake index fb532287cd..ea41361d68 100644 --- a/src/cmake/AxomOptions.cmake +++ b/src/cmake/AxomOptions.cmake @@ -6,7 +6,7 @@ # Defines CMake options for Axom's build system #------------------------------------------------------------------------------ -option(AXOM_ENABLE_ANNOTATIONS "Enables code annotations to facilitate performance evaluation." ON) +option(AXOM_ENABLE_ANNOTATIONS "Enables code annotations to facilitate performance evaluation." OFF) option(AXOM_ENABLE_SPARSEHASH "Enables Sparsehash." ON) option(AXOM_ENABLE_ALL_COMPONENTS "Enables all components by default" ON) option(AXOM_USE_64BIT_INDEXTYPE "Use 64-bit integers for axom::IndexType" OFF) From 47caffb1dbfd4c354e7f0506473345e3e10fde86 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 13 Apr 2020 18:16:53 -0700 Subject: [PATCH 164/632] DOC: update RELEASE-NOTES for annotation capabilty --- RELEASE-NOTES.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1b948eaa70..708ff3a1e9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,6 +10,20 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ## [Unreleased] - Release date yyyy-mm-dd ### Added +- Added new CMake option, `AXOM_ENABLE_ANNOTATIONS`, to enable/disable code + annoations in Axom. Default is OFF. +- Added Axom annotation macros. The macros can be used to annotate functions, + using the `AXOM_ANNOTATE_FUNCTION` macro, or at a more fine grain level, + different sections of code can be annotated by wrapping them within an + `AXOM_ANNOTATE_SECTION` block. As a first cut, this works with NVTX tools. + However, the hooks are in place to add support for Caliper in the future. +- Added a simple interface to NVTX that allows an application to set the color + and category for NVTX ranges corresponding to annotated code in Axom. The + application can now call `axom::nvtx:set_color()` and + `axom::nvtx::set_category()` to set the corresponding parameters respectively. + This facilitates in the performance evaluation by allowing developers to easily + filter out calls by category or visually by setting a different color to use + in GUI tools, such as, NVVP and NSight. - Added a portable floating_point_limits traits class, to return min(), max(), lowest() and epsilon() of a `float` or `double` type. The functionality is equivalent to that provided by std::numeric_limits, but, the code is host/device decorated accordingly such that it From 09332f38c6f65e1817aebe2b141cba4d5621c7f7 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 14 Apr 2020 12:48:52 -0700 Subject: [PATCH 165/632] DOC: fix minor typos in documentation --- RELEASE-NOTES.md | 2 +- src/axom/core/utilities/AnnotationMacros.hpp | 2 +- src/axom/core/utilities/nvtx/Range.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 708ff3a1e9..d498a7ad53 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,7 +11,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ### Added - Added new CMake option, `AXOM_ENABLE_ANNOTATIONS`, to enable/disable code - annoations in Axom. Default is OFF. + annotations in Axom. Default is OFF. - Added Axom annotation macros. The macros can be used to annotate functions, using the `AXOM_ANNOTATE_FUNCTION` macro, or at a more fine grain level, different sections of code can be annotated by wrapping them within an diff --git a/src/axom/core/utilities/AnnotationMacros.hpp b/src/axom/core/utilities/AnnotationMacros.hpp index 173048a172..a1396cc20b 100644 --- a/src/axom/core/utilities/AnnotationMacros.hpp +++ b/src/axom/core/utilities/AnnotationMacros.hpp @@ -47,7 +47,7 @@ /*! * \def AXOM_ANNOTATE_SECTION( name ) * - * \brief The AXOM_ANNOTATE_SECTION maacro is used to annotate sections of code. + * \brief The AXOM_ANNOTATE_SECTION macro is used to annotate sections of code. * * \note In contrast to the AXOM_ANNOTATE_FUNCTION, the AXOM_ANNOTATE_SECTION * macro is used to annotate sections of code at a much finer granularity diff --git a/src/axom/core/utilities/nvtx/Range.hpp b/src/axom/core/utilities/nvtx/Range.hpp index 2110b1e69e..659059d8e8 100644 --- a/src/axom/core/utilities/nvtx/Range.hpp +++ b/src/axom/core/utilities/nvtx/Range.hpp @@ -41,7 +41,7 @@ namespace nvtx * // use scope to auto-start and stop a range * { // begin scope resolution * axom::NVTXRage range ("foo" ); - * foor(); + * foo(); * } // end scope resoltuion * * \endcode From ddae4198d224e4ed9cb2cf4d04c578f6473db6d9 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 14 Apr 2020 13:49:47 -0700 Subject: [PATCH 166/632] ENH: rename axom annotation macros Rename annotation macros to: * AXOM_PERF_MARK_SECTION * AXOM_PERF_MARK_FUNCTION --- RELEASE-NOTES.md | 4 +- src/axom/core/utilities/AnnotationMacros.hpp | 38 +++++++++---------- src/axom/spin/internal/linear_bvh/BVHData.hpp | 4 +- .../spin/internal/linear_bvh/BVH_impl.hpp | 10 ++--- .../spin/internal/linear_bvh/RadixTree.hpp | 4 +- .../internal/linear_bvh/build_radix_tree.hpp | 34 ++++++++--------- .../spin/internal/linear_bvh/emit_bvh.hpp | 12 +++--- 7 files changed, 53 insertions(+), 53 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index d498a7ad53..c4dba7cdaa 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -13,9 +13,9 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ - Added new CMake option, `AXOM_ENABLE_ANNOTATIONS`, to enable/disable code annotations in Axom. Default is OFF. - Added Axom annotation macros. The macros can be used to annotate functions, - using the `AXOM_ANNOTATE_FUNCTION` macro, or at a more fine grain level, + using the `AXOM_PERF_MARK_FUNCTION` macro, or at a more fine grain level, different sections of code can be annotated by wrapping them within an - `AXOM_ANNOTATE_SECTION` block. As a first cut, this works with NVTX tools. + `AXOM_PERF_MARK_SECTION` block. As a first cut, this works with NVTX tools. However, the hooks are in place to add support for Caliper in the future. - Added a simple interface to NVTX that allows an application to set the color and category for NVTX ranges corresponding to annotated code in Axom. The diff --git a/src/axom/core/utilities/AnnotationMacros.hpp b/src/axom/core/utilities/AnnotationMacros.hpp index a1396cc20b..c81e89a292 100644 --- a/src/axom/core/utilities/AnnotationMacros.hpp +++ b/src/axom/core/utilities/AnnotationMacros.hpp @@ -13,17 +13,17 @@ #endif /*! - * \def AXOM_ANNOTATE_FUNCTION( name ) + * \def AXOM_PERF_MARK_FUNCTION( name ) * - * \brief The AXOM_ANNOTATE_FUNCTION is used to annotate a function. + * \brief The AXOM_PERF_MARK_FUNCTION is used to annotate a function. * * \param [in] name a user-supplied name to annotate the function. * - * \note Typically, the AXOM_ANNOTATE_FUNCTION is placed in the beginning of + * \note Typically, the AXOM_PERF_MARK_FUNCTION is placed in the beginning of * the function to annotate. * * - * \warning The AXOM_ANNOTATE_FUNCTION can only be called once within a given + * \warning The AXOM_PERF_MARK_FUNCTION can only be called once within a given * (function) scope. * * @@ -31,7 +31,7 @@ * \code * void foo( ) * { - * AXOM_ANNOTATE_FUNCTION( "foo" ); + * AXOM_PERF_MARK_FUNCTION( "foo" ); * ... * } * \endcode @@ -39,41 +39,41 @@ #if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) #error "Support for Caliper has not yet been implemented in Axom!" #elif defined(AXOM_ENABLE_ANNOTATIONS) -#define AXOM_ANNOTATE_FUNCTION(__func_name__) AXOM_NVTX_FUNCTION(__func_name__) +#define AXOM_PERF_MARK_FUNCTION(__func_name__) AXOM_NVTX_FUNCTION(__func_name__) #else -#define AXOM_ANNOTATE_FUNCTION(__func_name__) +#define AXOM_PERF_MARK_FUNCTION(__func_name__) #endif /*! - * \def AXOM_ANNOTATE_SECTION( name ) + * \def AXOM_PERF_MARK_SECTION( name ) * - * \brief The AXOM_ANNOTATE_SECTION macro is used to annotate sections of code. + * \brief The AXOM_PERF_MARK_SECTION macro is used to annotate sections of code. * - * \note In contrast to the AXOM_ANNOTATE_FUNCTION, the AXOM_ANNOTATE_SECTION + * \note In contrast to the AXOM_PERF_MARK_FUNCTION, the AXOM_PERF_MARK_SECTION * macro is used to annotate sections of code at a much finer granularity * within a given function and it may be use in conjunction with the - * AXOM_ANNOTATE_FUNCTION macro. + * AXOM_PERF_MARK_FUNCTION macro. * - * \warning Variables declared within an AXOM_ANNOTATE_SECTION are only defined + * \warning Variables declared within an AXOM_PERF_MARK_SECTION are only defined * within the scope of the annotated section. * - * \warning The AXOM_ANNOTATE_SECTION macro may not be called in a nested - * fashion, i.e., within another AXOM_ANNOTATE_SECTION + * \warning The AXOM_PERF_MARK_SECTION macro may not be called in a nested + * fashion, i.e., within another AXOM_PERF_MARK_SECTION * * Usage Example: * \code * void foo( ) * { - * AXOM_ANNOTATE_FUNCTION( "foo" ); + * AXOM_PERF_MARK_FUNCTION( "foo" ); * - * AXOM_ANNOTATE_SECTION( "kernel_A", + * AXOM_PERF_MARK_SECTION( "kernel_A", * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType idx) * { * ... * } ); * ); * - * AXOM_ANNOTATE_SECTION( "kernel_B", + * AXOM_PERF_MARK_SECTION( "kernel_B", * axom::for_all( 0, N, AXOM_LAMBDA(axom::IndexType idx) * { * ... @@ -87,10 +87,10 @@ #if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) #error "Support for Caliper has not yet been implemented in Axom!" #elif defined(AXOM_ENABLE_ANNOTATIONS) -#define AXOM_ANNOTATE_SECTION(__name__, ... ) \ +#define AXOM_PERF_MARK_SECTION(__name__, ... ) \ AXOM_NVTX_SECTION( __name__ , __VA_ARGS__ ) #else -#define AXOM_ANNOTATE_SECTION(__name__,...) \ +#define AXOM_PERF_MARK_SECTION(__name__,...) \ do { \ __VA_ARGS__ \ } while( false ) diff --git a/src/axom/spin/internal/linear_bvh/BVHData.hpp b/src/axom/spin/internal/linear_bvh/BVHData.hpp index 77596a260f..8d208dcb45 100644 --- a/src/axom/spin/internal/linear_bvh/BVHData.hpp +++ b/src/axom/spin/internal/linear_bvh/BVHData.hpp @@ -68,14 +68,14 @@ struct BVHData void allocate( int32 size ) { - AXOM_ANNOTATE_FUNCTION( "BVHData::allocate" ); + AXOM_PERF_MARK_FUNCTION( "BVHData::allocate" ); m_inner_nodes = axom::allocate< Vec< FloatType,4 > >( (size-1)*4 ); m_leaf_nodes = axom::allocate< int32 >( size ); } void deallocate() { - AXOM_ANNOTATE_FUNCTION( "BVHData::deallocate" ); + AXOM_PERF_MARK_FUNCTION( "BVHData::deallocate" ); axom::deallocate( m_inner_nodes ); axom::deallocate( m_leaf_nodes ); } diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 60c0507618..acab9e94c0 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -131,7 +131,7 @@ IndexType bvh_get_counts( LeftPredicate&& leftCheck, const FloatType* y, const FloatType* z ) noexcept { - AXOM_ANNOTATE_FUNCTION( "bvh_get_counts" ); + AXOM_PERF_MARK_FUNCTION( "bvh_get_counts" ); // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -211,7 +211,7 @@ IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, const FloatType* z0, const FloatType* nz ) noexcept { - AXOM_ANNOTATE_FUNCTION( "bvh_get_raycounts" ); + AXOM_PERF_MARK_FUNCTION( "bvh_get_raycounts" ); // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -374,7 +374,7 @@ BVH< NDIMS, ExecSpace, FloatType >::~BVH() template< int NDIMS, typename ExecSpace, typename FloatType > int BVH< NDIMS, ExecSpace, FloatType >::build() { - AXOM_ANNOTATE_FUNCTION( "BVH::build" ); + AXOM_PERF_MARK_FUNCTION( "BVH::build" ); // STEP 0: set the default memory allocator to use for the execution space. const int currentAllocatorID = axom::getDefaultAllocatorID(); @@ -454,7 +454,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, const FloatType* y, const FloatType* z ) const { - AXOM_ANNOTATE_FUNCTION( "BVH::findPoints" ); + AXOM_PERF_MARK_FUNCTION( "BVH::findPoints" ); SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); @@ -547,7 +547,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, const FloatType* z0, const FloatType* nz ) const { - AXOM_ANNOTATE_FUNCTION( "BVH::findRays" ); + AXOM_PERF_MARK_FUNCTION( "BVH::findRays" ); SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); diff --git a/src/axom/spin/internal/linear_bvh/RadixTree.hpp b/src/axom/spin/internal/linear_bvh/RadixTree.hpp index 3fddf2c8f8..a570508d18 100644 --- a/src/axom/spin/internal/linear_bvh/RadixTree.hpp +++ b/src/axom/spin/internal/linear_bvh/RadixTree.hpp @@ -44,7 +44,7 @@ struct RadixTree void allocate( int32 size ) { - AXOM_ANNOTATE_FUNCTION("RadixTree::allocate"); + AXOM_PERF_MARK_FUNCTION("RadixTree::allocate"); m_size = size; m_inner_size = m_size-1; @@ -61,7 +61,7 @@ struct RadixTree void deallocate() { - AXOM_ANNOTATE_FUNCTION("RadixTree::deallocate"); + AXOM_PERF_MARK_FUNCTION("RadixTree::deallocate"); m_inner_size = 0; m_size = 0; diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index 10eab0c47d..682e09ba75 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -110,7 +110,7 @@ void transform_boxes( const FloatType* boxes, int32 size, FloatType scale_factor ) { - AXOM_ANNOTATE_FUNCTION( "transform_boxes3D" ); + AXOM_PERF_MARK_FUNCTION( "transform_boxes3D" ); constexpr int NDIMS = 3; constexpr int STRIDE = 2 * NDIMS; @@ -145,7 +145,7 @@ void transform_boxes( const FloatType* boxes, int32 size, FloatType scale_factor ) { - AXOM_ANNOTATE_FUNCTION( "transform_boxes2D" ); + AXOM_PERF_MARK_FUNCTION( "transform_boxes2D" ); constexpr int NDIMS = 2; constexpr int STRIDE = 2 * NDIMS; @@ -175,7 +175,7 @@ void transform_boxes( const FloatType* boxes, template < typename ExecSpace, typename FloatType > AABB reduce(AABB* aabbs, int32 size) { - AXOM_ANNOTATE_FUNCTION( "reduce_abbs3D" ); + AXOM_PERF_MARK_FUNCTION( "reduce_abbs3D" ); constexpr int NDIMS = 3; @@ -221,7 +221,7 @@ AABB reduce(AABB* aabbs, int32 size) template < typename ExecSpace, typename FloatType > AABB reduce(AABB* aabbs, int32 size) { - AXOM_ANNOTATE_FUNCTION( "reduce_abbs2D" ); + AXOM_PERF_MARK_FUNCTION( "reduce_abbs2D" ); constexpr int NDIMS = 2; @@ -263,7 +263,7 @@ void get_mcodes( AABB* aabbs, const AABB< FloatType,2 > &bounds, uint32* mcodes ) { - AXOM_ANNOTATE_FUNCTION( "get_mcodes2D" ); + AXOM_PERF_MARK_FUNCTION( "get_mcodes2D" ); constexpr int NDIMS = 2; @@ -302,7 +302,7 @@ void get_mcodes( AABB* aabbs, const AABB< FloatType,3 > &bounds, uint32* mcodes ) { - AXOM_ANNOTATE_FUNCTION( "get_mcodes3D" ); + AXOM_PERF_MARK_FUNCTION( "get_mcodes3D" ); constexpr int NDIMS = 3; @@ -345,7 +345,7 @@ void array_counting( IntType* iterator, const IntType& start, const IntType& step) { - AXOM_ANNOTATE_FUNCTION( "array_counting" ); + AXOM_PERF_MARK_FUNCTION( "array_counting" ); for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { @@ -363,7 +363,7 @@ void array_counting( IntType* iterator, template< typename ExecSpace, typename T> void reorder(int32* indices, T*&array, int32 size) { - AXOM_ANNOTATE_FUNCTION( "reorder" ); + AXOM_PERF_MARK_FUNCTION( "reorder" ); T* temp = axom::allocate< T >( size ); @@ -382,11 +382,11 @@ void reorder(int32* indices, T*&array, int32 size) template < typename ExecSpace > void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) { - AXOM_ANNOTATE_FUNCTION( "custom_sort" ); + AXOM_PERF_MARK_FUNCTION( "custom_sort" ); array_counting< ExecSpace >(iter, size, 0, 1); - AXOM_ANNOTATE_SECTION( "cpu_sort", + AXOM_PERF_MARK_SECTION( "cpu_sort", std::stable_sort( iter, iter + size, @@ -407,12 +407,12 @@ template < int BLOCK_SIZE > void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, uint32*& mcodes, int32 size, int32* iter ) { - AXOM_ANNOTATE_FUNCTION( "custom_sort" ); + AXOM_PERF_MARK_FUNCTION( "custom_sort" ); using ExecSpace = typename axom::CUDA_EXEC< BLOCK_SIZE >; array_counting< ExecSpace >(iter, size, 0, 1); - AXOM_ANNOTATE_SECTION( "gpu_cub_sort", + AXOM_PERF_MARK_SECTION( "gpu_cub_sort", uint32* mcodes_alt_buf = axom::allocate< uint32 >( size ); int32* iter_alt_buf = axom::allocate< int32 >( size ); @@ -457,7 +457,7 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, template < typename ExecSpace > void sort_mcodes( uint32*& mcodes, int32 size, int32* iter ) { - AXOM_ANNOTATE_FUNCTION( "sort_mcodes" ); + AXOM_PERF_MARK_FUNCTION( "sort_mcodes" ); // dispatch custom_sort( ExecSpace(), mcodes, size, iter ); @@ -492,7 +492,7 @@ AXOM_HOST_DEVICE IntType delta( const IntType &a, template < typename ExecSpace, typename FloatType, int NDIMS > void build_tree( RadixTree< FloatType, NDIMS > &data ) { - AXOM_ANNOTATE_FUNCTION( "build_tree" ); + AXOM_PERF_MARK_FUNCTION( "build_tree" ); // http://research.nvidia.com/sites/default/files/publications/karras2012hpg_paper.pdf @@ -584,7 +584,7 @@ void build_tree( RadixTree< FloatType, NDIMS > &data ) template< typename ExecSpace, typename T> static void array_memset(T* array, const int32 size, const T val) { - AXOM_ANNOTATE_FUNCTION( "array_memset" ); + AXOM_PERF_MARK_FUNCTION( "array_memset" ); for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) { @@ -596,7 +596,7 @@ static void array_memset(T* array, const int32 size, const T val) template < typename ExecSpace, typename FloatType, int NDIMS > void propagate_aabbs( RadixTree< FloatType, NDIMS >& data) { - AXOM_ANNOTATE_FUNCTION( "propagate_abbs" ); + AXOM_PERF_MARK_FUNCTION( "propagate_abbs" ); const int inner_size = data.m_inner_size; const int leaf_size = data.m_inner_size + 1; @@ -676,7 +676,7 @@ void build_radix_tree( const FloatType* boxes, RadixTree< FloatType, NDIMS >& radix_tree, FloatType scale_factor ) { - AXOM_ANNOTATE_FUNCTION( "build_radix_tree" ); + AXOM_PERF_MARK_FUNCTION( "build_radix_tree" ); // sanity checks SLIC_ASSERT( boxes !=nullptr ); diff --git a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp index 51106bc227..b36ed8a880 100644 --- a/src/axom/spin/internal/linear_bvh/emit_bvh.hpp +++ b/src/axom/spin/internal/linear_bvh/emit_bvh.hpp @@ -59,7 +59,7 @@ template < typename ExecSpace, typename FloatType > void emit_bvh( RadixTree& data, BVHData< FloatType, 3 >& bvh_data ) { - AXOM_ANNOTATE_FUNCTION( "emit_bvh3D" ); + AXOM_PERF_MARK_FUNCTION( "emit_bvh3D" ); const int32 size = data.m_size; const int32 inner_size = data.m_inner_size; @@ -73,7 +73,7 @@ void emit_bvh( RadixTree& data, Vec* flat_ptr = bvh_data.m_inner_nodes; - AXOM_ANNOTATE_SECTION( "emit_bvh_parents", + AXOM_PERF_MARK_SECTION( "emit_bvh_parents", for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { Vec vec1; @@ -140,7 +140,7 @@ void emit_bvh( RadixTree& data, int32* radix_tree_leafs = data.m_leafs; int32* bvh_leafs = bvh_data.m_leaf_nodes; - AXOM_ANNOTATE_SECTION( "emit_bvh_leafs", + AXOM_PERF_MARK_SECTION( "emit_bvh_leafs", for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { bvh_leafs[ i ] = radix_tree_leafs[ i ]; @@ -154,7 +154,7 @@ template < typename ExecSpace, typename FloatType > void emit_bvh( RadixTree& data, BVHData< FloatType, 2 >& bvh_data ) { - AXOM_ANNOTATE_FUNCTION( "emit_bvh2D" ); + AXOM_PERF_MARK_FUNCTION( "emit_bvh2D" ); const int32 size = data.m_size; const int32 inner_size = data.m_inner_size; @@ -169,7 +169,7 @@ void emit_bvh( RadixTree& data, Vec* flat_ptr = bvh_data.m_inner_nodes; - AXOM_ANNOTATE_SECTION( "emit_bvh_parents", + AXOM_PERF_MARK_SECTION( "emit_bvh_parents", for_all< ExecSpace >( inner_size, AXOM_LAMBDA (int32 node) { Vec vec1; @@ -236,7 +236,7 @@ void emit_bvh( RadixTree& data, int32* radix_tree_leafs = data.m_leafs; int32* bvh_leafs = bvh_data.m_leaf_nodes; - AXOM_ANNOTATE_SECTION( "emit_bvh_leafs", + AXOM_PERF_MARK_SECTION( "emit_bvh_leafs", for_all< ExecSpace >( size, AXOM_LAMBDA(int32 i) { bvh_leafs[ i ] = radix_tree_leafs[ i ]; From 25446e1d6cd0d2f71120c4203f5ad8ba4fa5ec32 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 14 Apr 2020 17:09:38 -0700 Subject: [PATCH 167/632] ENH: add markers to BVH::findBoundingBoxes --- src/axom/spin/internal/linear_bvh/BVH_impl.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index acab9e94c0..2e508b8c55 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -297,6 +297,8 @@ IndexType bvh_get_boxcounts( LeftPredicate&& leftCheck, const FloatType* zmin, const FloatType* zmax ) noexcept { + AXOM_PERF_MARK_FUNCTION( "bvh_get_boxcounts" ); + // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); @@ -643,6 +645,8 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( const FloatType* zmin, const FloatType* zmax ) const { + AXOM_PERF_MARK_FUNCTION( "BVH::findBoundingBoxes" ); + SLIC_ASSERT( offsets != nullptr ); SLIC_ASSERT( counts != nullptr ); SLIC_ASSERT( candidates == nullptr ); From 18a4cd920264dbfced664021a70b8e8a971e13a4 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Fri, 17 Apr 2020 17:01:59 -0700 Subject: [PATCH 168/632] Documentation for Collection headers --- src/axom/sidre/core/ItemCollection.hpp | 49 ++++--------- src/axom/sidre/core/ListCollection.hpp | 98 ++++++++++++-------------- src/axom/sidre/core/MapCollection.hpp | 36 ++++------ 3 files changed, 74 insertions(+), 109 deletions(-) diff --git a/src/axom/sidre/core/ItemCollection.hpp b/src/axom/sidre/core/ItemCollection.hpp index 86b8c07359..31fd3cf0dd 100644 --- a/src/axom/sidre/core/ItemCollection.hpp +++ b/src/axom/sidre/core/ItemCollection.hpp @@ -8,38 +8,29 @@ * * \file ItemCollection.hpp * - * \brief Header file for Collection classes. + * \brief Header file for ItemCollection. * - * Each of these classes holds a collection of items of a fixed + * This is a templated abstract base class defining an interface for + * classes holding a collection of items of a fixed * type that can be accessed by string name or sidre::IndexType. * * The primary intent is to decouple the implementation of the * collections from the Group class which owns collections of * View and child Group objects. They may have other uses, - * so they are not dependent on the Group class. Each class is - * templated on the item type so that the same class can be used + * so they are not dependent on the Group class. THis class is + * templated on the item type so that derived classes can be used * to hold either View or Group object pointers without * having to code a separate class for each. * - * By having various collections that obey the same interface, - * we can explore alternative collection implementations for - * performance (insertion, lookup, etc.) and memory overhead. - * The collection used by the Group class can be changed via - * the collection type alias in the Group class header file. - * - * To try another collection, encapsulate it in a new class with - * the API described below or pass it as a template parameter to - * an existing class below if that works. + * Derived implemenations of this class can be used to explore + * alternative collection implementations for performance + * (insertion, lookup, etc.) and memory overhead. * * \attention These classes should be robust against any potential * user interaction. They don't report errors and leave * checking of return values to calling code. * - * \attention Template parameter type must provide a method - * "getName()" that returns a reference to a string object. - * - * \attention The common interface each collection class provides - * is as follows: + * \attention The interface defined by this class is as follows: * * \verbatim * @@ -47,15 +38,14 @@ * * size_t getNumItems() const; * - * - // Return first valid item index (i.e., smallest index over - * // all items). + * - // Return first valid item index for iteration. * // sidre::InvalidIndex returned if no items in collection * * IndexType getFirstValidIndex() const; * - * - // Return next valid item index after given index (i.e., smallest - * // index over all indices larger than given one). - * // sidre::InvalidIndex returned + * - // Return next valid item index for iteration. + * // sidre::InvalidIndex returned if there are no more items + * // to be iterated over. * * IndexType getNextValidIndex(IndexType idx) const; * @@ -83,7 +73,7 @@ * std::string getItemName(IndexType idx) const; * * - // Return index of object with given name - * // (sidre::InvalidName if none). + * // (sidre::InvalidIndex if none). * * IndexType getItemIndex(const std::string& name) const; * @@ -97,7 +87,7 @@ * * TYPE* removeItem(const std::string& name); * - * - // Remove item with given name if it exists and return a + * - // Remove item with given index if it exists and return a * // pointer to it. If it doesn't exist, return nullptr. * * TYPE* removeItem(IndexType idx); @@ -130,15 +120,6 @@ namespace axom namespace sidre { -//////////////////////////////////////////////////////////////////////// -// -// ItemCollection keeps an index constant for each item -// as long as it remains in the collection; i.e., don't shift indices -// around. It has the additional benefit that users can hold on to -// item indices without them being changed without notice. -// -//////////////////////////////////////////////////////////////////////// - /*! ************************************************************************* * diff --git a/src/axom/sidre/core/ListCollection.hpp b/src/axom/sidre/core/ListCollection.hpp index 5ef34321ae..d72fbd7f7e 100644 --- a/src/axom/sidre/core/ListCollection.hpp +++ b/src/axom/sidre/core/ListCollection.hpp @@ -8,38 +8,24 @@ * * \file ListCollection.hpp * - * \brief Header file for Collection classes. - * - * Each of these classes holds a collection of items of a fixed - * type that can be accessed by an iterator or sidre::IndexType. - * - * The primary intent is to decouple the implementation of the - * collections from the Group class which owns collections of - * View and child Group objects. They may have other uses, - * so they are not dependent on the Group class. Each class is - * templated on the item type so that the same class can be used - * to hold either View or Group object pointers without - * having to code a separate class for each. - * - * By having various collections that obey the same interface, - * we can explore alternative collection implementations for - * performance (insertion, lookup, etc.) and memory overhead. - * The collection used by the Group class can be changed via - * the collection type alias in the Group class header file. - * - * To try another collection, encapsulate it in a new class with - * the API described below or pass it as a template parameter to - * an existing class below if that works. - * - * \attention These classes should be robust against any potential - * user interaction. They don't report errors and leave - * checking of return values to calling code. + * \brief Header file for ListCollection. + * + * This is an implementation of ItemCollection to hold a + * collection of items of a fixed type. This implementation + * is intended to hold items that may have no name. If they do + * have names, those names are ignored. To satisfy the parent + * class interface, methods to access items by name are provided + * but the return null or invalid return values. * - * \attention Template parameter type must provide a method - * "getName()" that returns a reference to a string object. + * This class is templated on the item type so that the same + * class can be used to hold either View or Group object pointers + * without having to code a separate class for each. * - * \attention The common interface each collection class provides - * is as follows: + * \attention This class should be robust against any potential + * user interaction. It doesn't report errors and leaves + * checking of return values to calling code. + * + * \attention The interface is as follows: * * \verbatim * @@ -47,19 +33,18 @@ * * size_t getNumItems() const; * - * - // Return first valid item index (i.e., smallest index over - * // all items). + * - // Return first item index for iteration. * // sidre::InvalidIndex returned if no items in collection * * IndexType getFirstValidIndex() const; * - * - // Return next valid item index after given index (i.e., smallest - * // index over all indices larger than given one). - * // sidre::InvalidIndex returned + * - // Return next valid item index for iteration. + * // sidre::InvalidIndex returned if there are no further items * * IndexType getNextValidIndex(IndexType idx) const; * - * - // Return true if item with given name in collection; else false. + * - // Return false because this class cannot identify items + * // by name. * * bool hasItem(const std::string& name) const; * @@ -67,7 +52,8 @@ * * bool hasItem(IndexType idx) const; * - * - // Return pointer to item with given name (nullptr if none). + * - // Return false because this class cannot identify items + * // by name. * * TYPE* getItem(const std::string& name); * TYPE const* getItem(const std::string& name) const ; @@ -77,27 +63,28 @@ * TYPE* getItem(IndexType idx); * TYPE const* getItem(IndexType idx) const; * - * - // Return name of object with given index - * // (sidre::InvalidName if none). + * - // Return sidre::InvalidName because this class cannot + * // identify items by name. * * std::string getItemName(IndexType idx) const; * - * - // Return index of object with given name - * // (sidre::InvalidName if none). + * - // Return sidre::InvalidIndex because this class cannot + * // identify items by name. * * IndexType getItemIndex(const std::string& name) const; * - * - // Insert item with given name; return index if insertion - * // succeeded, and InvalidIndex otherwise. + * - // Insert item; the name argument will be ignored. + * // Return index if insertion succeeded, and InvalidIndex + * // otherwise. * * IndexType insertItem(TYPE* item, const std::string& name); * - * - // Remove item with given name if it exists and return a - * // pointer to it. If it doesn't exist, return nullptr. + * - // Return nullptr because this class cannot identify items + * // by name. No item will be removed. * * TYPE* removeItem(const std::string& name); * - * - // Remove item with given name if it exists and return a + * - // Remove item with given index if it exists and return a * // pointer to it. If it doesn't exist, return nullptr. * * TYPE* removeItem(IndexType idx); @@ -185,7 +172,8 @@ class ListCollection : public ItemCollection /// bool hasItem(const std::string& name) const { - SLIC_ERROR(" "); + (void)name; + SLIC_WARNING("ListCollection::hasItem cannot identify items by name"); return false; } @@ -200,14 +188,16 @@ class ListCollection : public ItemCollection /// TYPE* getItem(const std::string& name) { - SLIC_ERROR(" "); + (void)name; + SLIC_WARNING("ListCollection::getItem cannot identify items by name"); return 0; } /// TYPE const* getItem(const std::string& name) const { - SLIC_ERROR(" "); + (void)name; + SLIC_WARNING("ListCollection::getItem cannot identify items by name"); return 0; } @@ -226,13 +216,16 @@ class ListCollection : public ItemCollection /// const std::string& getItemName(IndexType idx) const { + (void)idx; + SLIC_WARNING("ListCollection::getItemName Items do not have names"); return InvalidName; } /// IndexType getItemIndex(const std::string& name) const { - SLIC_ERROR(" "); + (void)name; + SLIC_WARNING("ListCollection::getItemIndex cannot identify items by name"); return 0; } @@ -328,8 +321,9 @@ IndexType ListCollection::insertItem(TYPE* item, template TYPE* ListCollection::removeItem(const std::string& name) { - SLIC_ERROR( " " ); - return 0; + (void)name; + SLIC_WARNING("ListCollection::removeItem cannot identify items by name"); + return 0; } template diff --git a/src/axom/sidre/core/MapCollection.hpp b/src/axom/sidre/core/MapCollection.hpp index f6b186a2fa..46dd3260f8 100644 --- a/src/axom/sidre/core/MapCollection.hpp +++ b/src/axom/sidre/core/MapCollection.hpp @@ -8,38 +8,28 @@ * * \file MapCollection.hpp * - * \brief Header file for Collection classes. + * \brief Header file for MapCollection. * - * Each of these classes holds a collection of items of a fixed - * type that can be accessed by string name or sidre::IndexType. + * MapCollection is an implemenation of ItemCollection to + * hold a collection of items of a fixed type that can be accessed + * accessed by string name or sidre::IndexType. * * The primary intent is to decouple the implementation of the - * collections from the Group class which owns collections of - * View and child Group objects. They may have other uses, - * so they are not dependent on the Group class. Each class is - * templated on the item type so that the same class can be used + * collection of times from the Group class which owns collections of + * View and child Group objects. This may have other uses, + * so it is not dependent on the Group class. This class is + * templated on the item type so that it can be used * to hold either View or Group object pointers without * having to code a separate class for each. * - * By having various collections that obey the same interface, - * we can explore alternative collection implementations for - * performance (insertion, lookup, etc.) and memory overhead. - * The collection used by the Group class can be changed via - * the collection type alias in the Group class header file. - * - * To try another collection, encapsulate it in a new class with - * the API described below or pass it as a template parameter to - * an existing class below if that works. - * - * \attention These classes should be robust against any potential - * user interaction. They don't report errors and leave + * \attention This class should be robust against any potential + * user interaction. It doesn't report errors and leaves * checking of return values to calling code. * * \attention Template parameter type must provide a method * "getName()" that returns a reference to a string object. * - * \attention The common interface each collection class provides - * is as follows: + * \attention The interface is as follows: * * \verbatim * @@ -83,7 +73,7 @@ * std::string getItemName(IndexType idx) const; * * - // Return index of object with given name - * // (sidre::InvalidName if none). + * // (sidre::InvalidIndex if none). * * IndexType getItemIndex(const std::string& name) const; * @@ -97,7 +87,7 @@ * * TYPE* removeItem(const std::string& name); * - * - // Remove item with given name if it exists and return a + * - // Remove item with given index if it exists and return a * // pointer to it. If it doesn't exist, return nullptr. * * TYPE* removeItem(IndexType idx); From c755be79cef47663c04d101892f2fc449f44e865 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 20 Apr 2020 16:57:30 -0700 Subject: [PATCH 169/632] ENH: Enable annotations in our CUDA CI builds --- .../rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 2 ++ host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake | 2 ++ 2 files changed, 4 insertions(+) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 90afaf22cf..0174fe485b 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -106,6 +106,8 @@ set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") +set(AXOM_ENABLE_ANNOTATIONS ON CACHE BOOL "") + set(AXOM_CUDA_ARCH "sm_70" CACHE PATH "") set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake index 954ff14fe9..ba50c54b83 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake @@ -110,6 +110,8 @@ set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") +set(AXOM_ENABLE_ANNOTATIONS ON CACHE BOOL "") + set(AXOM_CUDA_ARCH "sm_70" CACHE PATH "") set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") From 7a226875b867f54d6fd3ed3a521cc87d8f7f4861 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 20 Apr 2020 17:01:47 -0700 Subject: [PATCH 170/632] ENH: enable annotations for CUDA builds in uberenv Update the uberenv spack package for Axom to enable annotations in CUDA builds. --- scripts/uberenv/packages/axom/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index 0ceeebbc78..ce3664f8d4 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -397,6 +397,8 @@ def hostconfig(self, spec, prefix): cfg.write(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True)) + cfg.write(cmake_cache_option("AXOM_ENABLE_ANNOTATIONS",True)) + if on_blueos_p9: cfg.write(cmake_cache_entry("AXOM_CUDA_ARCH", "sm_70")) else: From 2982f27d22f8dfc7cf1ab1981437f2e3e712f1d4 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Mon, 20 Apr 2020 17:30:44 -0700 Subject: [PATCH 171/632] ENH: rename def variable in config for consistency Rename the macro defined variable in the config corresponding to the `AXOM_ENABLE_ANNOTATIONS` option for consistency. --- src/axom/config.hpp.in | 2 +- src/axom/core/utilities/AnnotationMacros.hpp | 8 ++++---- src/axom/core/utilities/nvtx/Macros.hpp | 4 ++-- src/cmake/AxomConfig.cmake | 5 +++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/axom/config.hpp.in b/src/axom/config.hpp.in index e9269303c9..c92f885cc9 100644 --- a/src/axom/config.hpp.in +++ b/src/axom/config.hpp.in @@ -35,7 +35,7 @@ * Indicates whether Axom is compiled with Annotations that can facilitate * evaluation of performance with various performance tools. */ -#cmakedefine AXOM_ENABLE_ANNOTATIONS +#cmakedefine AXOM_USE_ANNOTATIONS /* * Platform specific definitions diff --git a/src/axom/core/utilities/AnnotationMacros.hpp b/src/axom/core/utilities/AnnotationMacros.hpp index c81e89a292..be77364e0b 100644 --- a/src/axom/core/utilities/AnnotationMacros.hpp +++ b/src/axom/core/utilities/AnnotationMacros.hpp @@ -36,9 +36,9 @@ * } * \endcode */ -#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) +#if defined(AXOM_USE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) #error "Support for Caliper has not yet been implemented in Axom!" -#elif defined(AXOM_ENABLE_ANNOTATIONS) +#elif defined(AXOM_USE_ANNOTATIONS) #define AXOM_PERF_MARK_FUNCTION(__func_name__) AXOM_NVTX_FUNCTION(__func_name__) #else #define AXOM_PERF_MARK_FUNCTION(__func_name__) @@ -84,9 +84,9 @@ * \endcode * */ -#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) +#if defined(AXOM_USE_ANNOTATIONS) && defined(AXOM_USE_CALIPER) #error "Support for Caliper has not yet been implemented in Axom!" -#elif defined(AXOM_ENABLE_ANNOTATIONS) +#elif defined(AXOM_USE_ANNOTATIONS) #define AXOM_PERF_MARK_SECTION(__name__, ... ) \ AXOM_NVTX_SECTION( __name__ , __VA_ARGS__ ) #else diff --git a/src/axom/core/utilities/nvtx/Macros.hpp b/src/axom/core/utilities/nvtx/Macros.hpp index 62a37c42bf..ba8c330037 100644 --- a/src/axom/core/utilities/nvtx/Macros.hpp +++ b/src/axom/core/utilities/nvtx/Macros.hpp @@ -71,7 +71,7 @@ * \endcode * */ -#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) +#if defined(AXOM_USE_ANNOTATIONS) && defined(AXOM_USE_CUDA) #define AXOM_NVTX_SECTION( __name__, ... ) \ do { \ axom::nvtx::Range r(__name__); \ @@ -105,7 +105,7 @@ * \endcode * */ -#if defined(AXOM_ENABLE_ANNOTATIONS) && defined(AXOM_USE_CUDA) +#if defined(AXOM_USE_ANNOTATIONS) && defined(AXOM_USE_CUDA) #define AXOM_NVTX_FUNCTION( __name__ ) axom::nvtx::Range __func_range(__name__) #else #define AXOM_NVTX_FUNCTION( __name__ ) diff --git a/src/cmake/AxomConfig.cmake b/src/cmake/AxomConfig.cmake index 0a00071e32..cdb408bdf3 100644 --- a/src/cmake/AxomConfig.cmake +++ b/src/cmake/AxomConfig.cmake @@ -34,6 +34,11 @@ foreach(comp ${AXOM_COMPONENTS_ENABLED}) set(AXOM_USE_${comp_uc} TRUE) endforeach() +## Add compile-time options to the config file +if ( AXOM_ENABLE_ANNOTATIONS ) + set( AXOM_USE_ANNOTATIONS TRUE ) +endif() + convert_to_native_escaped_file_path(${PROJECT_SOURCE_DIR} AXOM_SRC_DIR) convert_to_native_escaped_file_path(${CMAKE_BINARY_DIR} AXOM_BIN_DIR) From 037ceb3819b091568d54f8194dcf1c0c8e8f3000 Mon Sep 17 00:00:00 2001 From: shroud-robot Date: Tue, 21 Apr 2020 17:36:21 -0700 Subject: [PATCH 172/632] Shroud-0.11.0 - make generate; make uncrustify_style --- .../quest/interface/c_fortran/typesQUEST.h | 6 +- .../quest/interface/c_fortran/wrapQUEST.cpp | 150 +-- .../quest/interface/c_fortran/wrapQUEST.h | 5 +- .../quest/interface/c_fortran/wrapfquest.F | 12 +- .../quest/interface/python/pyQUESTmodule.cpp | 107 +- .../quest/interface/python/pyQUESTmodule.hpp | 3 - .../sidre/interface/c_fortran/typesSidre.h | 22 +- .../sidre/interface/c_fortran/wrapBuffer.cpp | 73 +- .../sidre/interface/c_fortran/wrapBuffer.h | 32 +- .../interface/c_fortran/wrapDataStore.cpp | 100 +- .../sidre/interface/c_fortran/wrapDataStore.h | 39 +- .../sidre/interface/c_fortran/wrapGroup.cpp | 1000 +++++++++-------- .../sidre/interface/c_fortran/wrapGroup.h | 304 ++--- .../sidre/interface/c_fortran/wrapSidre.cpp | 13 +- .../sidre/interface/c_fortran/wrapSidre.h | 5 +- .../sidre/interface/c_fortran/wrapView.cpp | 397 +++---- src/axom/sidre/interface/c_fortran/wrapView.h | 127 ++- .../sidre/interface/c_fortran/wrapfsidre.F | 466 ++++---- .../sidre/interface/yaml/sidre_types.yaml | 28 +- .../spio/interface/c_fortran/typesSPIO.h | 13 +- .../interface/c_fortran/wrapIOManager.cpp | 247 ++-- .../spio/interface/c_fortran/wrapIOManager.h | 60 +- .../spio/interface/c_fortran/wrapSPIO.cpp | 12 +- .../spio/interface/c_fortran/wrapfspio.f | 70 +- .../sidre/spio/interface/yaml/spio_types.yaml | 10 +- src/axom/slic/interface/c_fortran/typesSLIC.h | 6 +- .../slic/interface/c_fortran/wrapSLIC.cpp | 135 ++- src/axom/slic/interface/c_fortran/wrapSLIC.h | 19 +- src/axom/slic/interface/c_fortran/wrapfslic.f | 20 +- 29 files changed, 1792 insertions(+), 1689 deletions(-) diff --git a/src/axom/quest/interface/c_fortran/typesQUEST.h b/src/axom/quest/interface/c_fortran/typesQUEST.h index 0339c2fc45..8eb0fbf038 100644 --- a/src/axom/quest/interface/c_fortran/typesQUEST.h +++ b/src/axom/quest/interface/c_fortran/typesQUEST.h @@ -15,14 +15,14 @@ extern "C" { #endif -struct s_QUE_SHROUD_capsule_data +struct s_QUEST_SHROUD_capsule_data { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_QUE_SHROUD_capsule_data QUE_SHROUD_capsule_data; +typedef struct s_QUEST_SHROUD_capsule_data QUEST_SHROUD_capsule_data; -void QUEST_SHROUD_memory_destructor(QUE_SHROUD_capsule_data* cap); +void QUEST_SHROUD_memory_destructor(QUEST_SHROUD_capsule_data* cap); #ifdef __cplusplus } diff --git a/src/axom/quest/interface/c_fortran/wrapQUEST.cpp b/src/axom/quest/interface/c_fortran/wrapQUEST.cpp index d492b1c3a2..aa976c2e7b 100644 --- a/src/axom/quest/interface/c_fortran/wrapQUEST.cpp +++ b/src/axom/quest/interface/c_fortran/wrapQUEST.cpp @@ -6,7 +6,7 @@ // // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapQUEST.h" -#include +#include #include #include "axom/quest/interface/inout.hpp" #include "axom/quest/interface/signed_distance.hpp" @@ -23,12 +23,12 @@ extern "C" { #ifdef AXOM_USE_MPI int QUEST_inout_init_mpi(const char* fileName, MPI_Fint comm) { -// splicer begin function.inout_init_mpi - const std::string SH_fileName(fileName); + // splicer begin function.inout_init_mpi + const std::string SHCXX_fileName(fileName); MPI_Comm SHCXX_comm = MPI_Comm_f2c(comm); - int SHC_rv = axom::quest::inout_init(SH_fileName, SHCXX_comm); + int SHC_rv = axom::quest::inout_init(SHCXX_fileName, SHCXX_comm); return SHC_rv; -// splicer end function.inout_init_mpi + // splicer end function.inout_init_mpi } #endif // ifdef AXOM_USE_MPI @@ -36,126 +36,126 @@ int QUEST_inout_init_mpi(const char* fileName, MPI_Fint comm) int QUEST_inout_init_mpi_bufferify(const char* fileName, int LfileName, MPI_Fint comm) { -// splicer begin function.inout_init_mpi_bufferify - const std::string SH_fileName(fileName, LfileName); + // splicer begin function.inout_init_mpi_bufferify + const std::string SHCXX_fileName(fileName, LfileName); MPI_Comm SHCXX_comm = MPI_Comm_f2c(comm); - int SHC_rv = axom::quest::inout_init(SH_fileName, SHCXX_comm); + int SHC_rv = axom::quest::inout_init(SHCXX_fileName, SHCXX_comm); return SHC_rv; -// splicer end function.inout_init_mpi_bufferify + // splicer end function.inout_init_mpi_bufferify } #endif // ifdef AXOM_USE_MPI #ifndef AXOM_USE_MPI int QUEST_inout_init_serial(const char* fileName) { -// splicer begin function.inout_init_serial - const std::string SH_fileName(fileName); - int SHC_rv = axom::quest::inout_init(SH_fileName); + // splicer begin function.inout_init_serial + const std::string SHCXX_fileName(fileName); + int SHC_rv = axom::quest::inout_init(SHCXX_fileName); return SHC_rv; -// splicer end function.inout_init_serial + // splicer end function.inout_init_serial } #endif // ifndef AXOM_USE_MPI #ifndef AXOM_USE_MPI int QUEST_inout_init_serial_bufferify(const char* fileName, int LfileName) { -// splicer begin function.inout_init_serial_bufferify - const std::string SH_fileName(fileName, LfileName); - int SHC_rv = axom::quest::inout_init(SH_fileName); + // splicer begin function.inout_init_serial_bufferify + const std::string SHCXX_fileName(fileName, LfileName); + int SHC_rv = axom::quest::inout_init(SHCXX_fileName); return SHC_rv; -// splicer end function.inout_init_serial_bufferify + // splicer end function.inout_init_serial_bufferify } #endif // ifndef AXOM_USE_MPI bool QUEST_inout_initialized() { -// splicer begin function.inout_initialized + // splicer begin function.inout_initialized bool SHC_rv = axom::quest::inout_initialized(); return SHC_rv; -// splicer end function.inout_initialized + // splicer end function.inout_initialized } int QUEST_inout_set_verbose(bool verbosity) { -// splicer begin function.inout_set_verbose + // splicer begin function.inout_set_verbose int SHC_rv = axom::quest::inout_set_verbose(verbosity); return SHC_rv; -// splicer end function.inout_set_verbose + // splicer end function.inout_set_verbose } int QUEST_inout_set_vertex_weld_threshold(double thresh) { -// splicer begin function.inout_set_vertex_weld_threshold + // splicer begin function.inout_set_vertex_weld_threshold int SHC_rv = axom::quest::inout_set_vertex_weld_threshold(thresh); return SHC_rv; -// splicer end function.inout_set_vertex_weld_threshold + // splicer end function.inout_set_vertex_weld_threshold } bool QUEST_inout_evaluate_0(double x, double y) { -// splicer begin function.inout_evaluate_0 + // splicer begin function.inout_evaluate_0 bool SHC_rv = axom::quest::inout_evaluate(x, y); return SHC_rv; -// splicer end function.inout_evaluate_0 + // splicer end function.inout_evaluate_0 } bool QUEST_inout_evaluate_1(double x, double y, double z) { -// splicer begin function.inout_evaluate_1 + // splicer begin function.inout_evaluate_1 bool SHC_rv = axom::quest::inout_evaluate(x, y, z); return SHC_rv; -// splicer end function.inout_evaluate_1 + // splicer end function.inout_evaluate_1 } int QUEST_inout_mesh_min_bounds(double* coords) { -// splicer begin function.inout_mesh_min_bounds + // splicer begin function.inout_mesh_min_bounds int SHC_rv = axom::quest::inout_mesh_min_bounds(coords); return SHC_rv; -// splicer end function.inout_mesh_min_bounds + // splicer end function.inout_mesh_min_bounds } int QUEST_inout_mesh_max_bounds(double* coords) { -// splicer begin function.inout_mesh_max_bounds + // splicer begin function.inout_mesh_max_bounds int SHC_rv = axom::quest::inout_mesh_max_bounds(coords); return SHC_rv; -// splicer end function.inout_mesh_max_bounds + // splicer end function.inout_mesh_max_bounds } int QUEST_inout_mesh_center_of_mass(double* coords) { -// splicer begin function.inout_mesh_center_of_mass + // splicer begin function.inout_mesh_center_of_mass int SHC_rv = axom::quest::inout_mesh_center_of_mass(coords); return SHC_rv; -// splicer end function.inout_mesh_center_of_mass + // splicer end function.inout_mesh_center_of_mass } int QUEST_inout_get_dimension() { -// splicer begin function.inout_get_dimension + // splicer begin function.inout_get_dimension int SHC_rv = axom::quest::inout_get_dimension(); return SHC_rv; -// splicer end function.inout_get_dimension + // splicer end function.inout_get_dimension } int QUEST_inout_finalize() { -// splicer begin function.inout_finalize + // splicer begin function.inout_finalize int SHC_rv = axom::quest::inout_finalize(); return SHC_rv; -// splicer end function.inout_finalize + // splicer end function.inout_finalize } #ifdef AXOM_USE_MPI int QUEST_signed_distance_init_mpi(const char* file, MPI_Fint comm) { -// splicer begin function.signed_distance_init_mpi - const std::string SH_file(file); + // splicer begin function.signed_distance_init_mpi + const std::string SHCXX_file(file); MPI_Comm SHCXX_comm = MPI_Comm_f2c(comm); - int SHC_rv = axom::quest::signed_distance_init(SH_file, SHCXX_comm); + int SHC_rv = axom::quest::signed_distance_init(SHCXX_file, SHCXX_comm); return SHC_rv; -// splicer end function.signed_distance_init_mpi + // splicer end function.signed_distance_init_mpi } #endif // ifdef AXOM_USE_MPI @@ -163,119 +163,119 @@ int QUEST_signed_distance_init_mpi(const char* file, MPI_Fint comm) int QUEST_signed_distance_init_mpi_bufferify(const char* file, int Lfile, MPI_Fint comm) { -// splicer begin function.signed_distance_init_mpi_bufferify - const std::string SH_file(file, Lfile); + // splicer begin function.signed_distance_init_mpi_bufferify + const std::string SHCXX_file(file, Lfile); MPI_Comm SHCXX_comm = MPI_Comm_f2c(comm); - int SHC_rv = axom::quest::signed_distance_init(SH_file, SHCXX_comm); + int SHC_rv = axom::quest::signed_distance_init(SHCXX_file, SHCXX_comm); return SHC_rv; -// splicer end function.signed_distance_init_mpi_bufferify + // splicer end function.signed_distance_init_mpi_bufferify } #endif // ifdef AXOM_USE_MPI #ifndef AXOM_USE_MPI int QUEST_signed_distance_init_serial(const char* file) { -// splicer begin function.signed_distance_init_serial - const std::string SH_file(file); - int SHC_rv = axom::quest::signed_distance_init(SH_file); + // splicer begin function.signed_distance_init_serial + const std::string SHCXX_file(file); + int SHC_rv = axom::quest::signed_distance_init(SHCXX_file); return SHC_rv; -// splicer end function.signed_distance_init_serial + // splicer end function.signed_distance_init_serial } #endif // ifndef AXOM_USE_MPI #ifndef AXOM_USE_MPI int QUEST_signed_distance_init_serial_bufferify(const char* file, int Lfile) { -// splicer begin function.signed_distance_init_serial_bufferify - const std::string SH_file(file, Lfile); - int SHC_rv = axom::quest::signed_distance_init(SH_file); + // splicer begin function.signed_distance_init_serial_bufferify + const std::string SHCXX_file(file, Lfile); + int SHC_rv = axom::quest::signed_distance_init(SHCXX_file); return SHC_rv; -// splicer end function.signed_distance_init_serial_bufferify + // splicer end function.signed_distance_init_serial_bufferify } #endif // ifndef AXOM_USE_MPI bool QUEST_signed_distance_initialized() { -// splicer begin function.signed_distance_initialized + // splicer begin function.signed_distance_initialized bool SHC_rv = axom::quest::signed_distance_initialized(); return SHC_rv; -// splicer end function.signed_distance_initialized + // splicer end function.signed_distance_initialized } void QUEST_signed_distance_get_mesh_bounds(double* lo, double* hi) { -// splicer begin function.signed_distance_get_mesh_bounds + // splicer begin function.signed_distance_get_mesh_bounds axom::quest::signed_distance_get_mesh_bounds(lo, hi); return; -// splicer end function.signed_distance_get_mesh_bounds + // splicer end function.signed_distance_get_mesh_bounds } void QUEST_signed_distance_set_dimension(int dim) { -// splicer begin function.signed_distance_set_dimension + // splicer begin function.signed_distance_set_dimension axom::quest::signed_distance_set_dimension(dim); return; -// splicer end function.signed_distance_set_dimension + // splicer end function.signed_distance_set_dimension } void QUEST_signed_distance_set_closed_surface(bool status) { -// splicer begin function.signed_distance_set_closed_surface + // splicer begin function.signed_distance_set_closed_surface axom::quest::signed_distance_set_closed_surface(status); return; -// splicer end function.signed_distance_set_closed_surface + // splicer end function.signed_distance_set_closed_surface } void QUEST_signed_distance_set_max_levels(int maxLevels) { -// splicer begin function.signed_distance_set_max_levels + // splicer begin function.signed_distance_set_max_levels axom::quest::signed_distance_set_max_levels(maxLevels); return; -// splicer end function.signed_distance_set_max_levels + // splicer end function.signed_distance_set_max_levels } void QUEST_signed_distance_set_max_occupancy(int maxOccupancy) { -// splicer begin function.signed_distance_set_max_occupancy + // splicer begin function.signed_distance_set_max_occupancy axom::quest::signed_distance_set_max_occupancy(maxOccupancy); return; -// splicer end function.signed_distance_set_max_occupancy + // splicer end function.signed_distance_set_max_occupancy } void QUEST_signed_distance_set_verbose(bool status) { -// splicer begin function.signed_distance_set_verbose + // splicer begin function.signed_distance_set_verbose axom::quest::signed_distance_set_verbose(status); return; -// splicer end function.signed_distance_set_verbose + // splicer end function.signed_distance_set_verbose } void QUEST_signed_distance_use_shared_memory(bool status) { -// splicer begin function.signed_distance_use_shared_memory + // splicer begin function.signed_distance_use_shared_memory axom::quest::signed_distance_use_shared_memory(status); return; -// splicer end function.signed_distance_use_shared_memory + // splicer end function.signed_distance_use_shared_memory } double QUEST_signed_distance_evaluate(double x, double y, double z) { -// splicer begin function.signed_distance_evaluate + // splicer begin function.signed_distance_evaluate double SHC_rv = axom::quest::signed_distance_evaluate(x, y, z); return SHC_rv; -// splicer end function.signed_distance_evaluate + // splicer end function.signed_distance_evaluate } void QUEST_signed_distance_finalize() { -// splicer begin function.signed_distance_finalize + // splicer begin function.signed_distance_finalize axom::quest::signed_distance_finalize(); return; -// splicer end function.signed_distance_finalize + // splicer end function.signed_distance_finalize } -// Release C++ allocated memory. -void QUEST_SHROUD_memory_destructor(QUE_SHROUD_capsule_data* cap) +// Release library allocated memory. +void QUEST_SHROUD_memory_destructor(QUEST_SHROUD_capsule_data* cap) { cap->addr = NULL; cap->idtor = 0; // avoid deleting again diff --git a/src/axom/quest/interface/c_fortran/wrapQUEST.h b/src/axom/quest/interface/c_fortran/wrapQUEST.h index 99893b3181..535e4cb6c9 100644 --- a/src/axom/quest/interface/c_fortran/wrapQUEST.h +++ b/src/axom/quest/interface/c_fortran/wrapQUEST.h @@ -7,7 +7,7 @@ // SPDX-License-Identifier: (BSD-3-Clause) /** * \file wrapQUEST.h - * \brief Shroud generated wrapper for QUEST library + * \brief Shroud generated wrapper for quest namespace */ // For C users and C++ implementation @@ -18,6 +18,9 @@ #include "mpi.h" #endif #include "typesQUEST.h" +#ifndef __cplusplus +#include +#endif // splicer begin CXX_declarations // splicer end CXX_declarations diff --git a/src/axom/quest/interface/c_fortran/wrapfquest.F b/src/axom/quest/interface/c_fortran/wrapfquest.F index f2fd98973d..aaf43a1388 100644 --- a/src/axom/quest/interface/c_fortran/wrapfquest.F +++ b/src/axom/quest/interface/c_fortran/wrapfquest.F @@ -7,7 +7,7 @@ ! SPDX-License-Identifier: (BSD-3-Clause) !> !! \file wrapfquest.F -!! \brief Shroud generated wrapper for QUEST library +!! \brief Shroud generated wrapper for quest namespace !< ! splicer begin file_top #include @@ -351,10 +351,10 @@ function quest_inout_set_verbose(verbosity) & result(SHT_rv) use iso_c_binding, only : C_BOOL, C_INT logical, value, intent(IN) :: verbosity - logical(C_BOOL) SH_verbosity integer(C_INT) :: SHT_rv - SH_verbosity = verbosity ! coerce to C_BOOL ! splicer begin function.inout_set_verbose + logical(C_BOOL) SH_verbosity + SH_verbosity = verbosity ! coerce to C_BOOL SHT_rv = c_inout_set_verbose(SH_verbosity) ! splicer end function.inout_set_verbose end function quest_inout_set_verbose @@ -421,9 +421,9 @@ end function quest_signed_distance_initialized subroutine quest_signed_distance_set_closed_surface(status) use iso_c_binding, only : C_BOOL logical, value, intent(IN) :: status + ! splicer begin function.signed_distance_set_closed_surface logical(C_BOOL) SH_status SH_status = status ! coerce to C_BOOL - ! splicer begin function.signed_distance_set_closed_surface call c_signed_distance_set_closed_surface(SH_status) ! splicer end function.signed_distance_set_closed_surface end subroutine quest_signed_distance_set_closed_surface @@ -431,9 +431,9 @@ end subroutine quest_signed_distance_set_closed_surface subroutine quest_signed_distance_set_verbose(status) use iso_c_binding, only : C_BOOL logical, value, intent(IN) :: status + ! splicer begin function.signed_distance_set_verbose logical(C_BOOL) SH_status SH_status = status ! coerce to C_BOOL - ! splicer begin function.signed_distance_set_verbose call c_signed_distance_set_verbose(SH_status) ! splicer end function.signed_distance_set_verbose end subroutine quest_signed_distance_set_verbose @@ -441,9 +441,9 @@ end subroutine quest_signed_distance_set_verbose subroutine quest_signed_distance_use_shared_memory(status) use iso_c_binding, only : C_BOOL logical, value, intent(IN) :: status + ! splicer begin function.signed_distance_use_shared_memory logical(C_BOOL) SH_status SH_status = status ! coerce to C_BOOL - ! splicer begin function.signed_distance_use_shared_memory call c_signed_distance_use_shared_memory(SH_status) ! splicer end function.signed_distance_use_shared_memory end subroutine quest_signed_distance_use_shared_memory diff --git a/src/axom/quest/interface/python/pyQUESTmodule.cpp b/src/axom/quest/interface/python/pyQUESTmodule.cpp index ef05ca15ac..4c99c8c905 100644 --- a/src/axom/quest/interface/python/pyQUESTmodule.cpp +++ b/src/axom/quest/interface/python/pyQUESTmodule.cpp @@ -19,6 +19,7 @@ #endif #if PY_MAJOR_VERSION >= 3 +#define PyInt_AsLong PyLong_AsLong #define PyInt_FromLong PyLong_FromLong #define PyString_FromString PyUnicode_FromString #define PyString_FromStringAndSize PyUnicode_FromStringAndSize @@ -30,6 +31,7 @@ PyObject* PY_error_obj; // splicer begin additional_functions // splicer end additional_functions +#ifdef AXOM_USE_MPI static PyObject* PY_inout_init_mpi( PyObject* SHROUD_UNUSED(self), @@ -44,6 +46,7 @@ PY_inout_init_mpi( "comm", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO:inout_init", const_cast(SHT_kwlist), &fileName, @@ -51,12 +54,14 @@ PY_inout_init_mpi( return NULL; const std::string SH_fileName(fileName); MPI_Comm SH_comm = MPI_Comm_f2c(comm); - int SHC_rv = axom::quest::inout_init(SH_fileName, SH_comm); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + int SHCXX_rv = axom::quest::inout_init(SH_fileName, SH_comm); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.inout_init_mpi } +#endif // ifdef AXOM_USE_MPI +#ifndef AXOM_USE_MPI static PyObject* PY_inout_init_serial( PyObject* SHROUD_UNUSED(self), @@ -69,16 +74,18 @@ PY_inout_init_serial( "fileName", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:inout_init", const_cast(SHT_kwlist), &fileName)) return NULL; const std::string SH_fileName(fileName); - int SHC_rv = axom::quest::inout_init(SH_fileName); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + int SHCXX_rv = axom::quest::inout_init(SH_fileName); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.inout_init_serial } +#endif // ifndef AXOM_USE_MPI static char PY_inout_initialized__doc__[] = "documentation" @@ -91,9 +98,17 @@ PY_inout_initialized( PyObject* SHROUD_UNUSED(kwds)) { // splicer begin function.inout_initialized - bool SHC_rv = axom::quest::inout_initialized(); - PyObject* SHTPy_rv = PyBool_FromLong(SHC_rv); + PyObject* SHTPy_rv = NULL; + + bool SHCXX_rv = axom::quest::inout_initialized(); + SHTPy_rv = PyBool_FromLong(SHCXX_rv); + if (SHTPy_rv == NULL) + goto fail; return (PyObject*) SHTPy_rv; + +fail: + Py_XDECREF(SHTPy_rv); + return NULL; // splicer end function.inout_initialized } @@ -113,14 +128,15 @@ PY_inout_set_verbose( "verbosity", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!:inout_set_verbose", const_cast(SHT_kwlist), &PyBool_Type, &SHPy_verbosity)) return NULL; bool verbosity = PyObject_IsTrue(SHPy_verbosity); - int SHC_rv = axom::quest::inout_set_verbose(verbosity); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + int SHCXX_rv = axom::quest::inout_set_verbose(verbosity); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.inout_set_verbose } @@ -141,13 +157,14 @@ PY_inout_set_vertex_weld_threshold( "thresh", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "d:inout_set_vertex_weld_threshold", const_cast(SHT_kwlist), &thresh)) return NULL; - int SHC_rv = axom::quest::inout_set_vertex_weld_threshold(thresh); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + int SHCXX_rv = axom::quest::inout_set_vertex_weld_threshold(thresh); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.inout_set_vertex_weld_threshold } @@ -173,7 +190,8 @@ PY_inout_evaluate_1( "z", NULL }; - bool SHC_rv; + bool SHCXX_rv; + PyObject* SHTPy_rv = NULL; if (args != NULL) SH_nargs += PyTuple_Size(args); @@ -185,14 +203,23 @@ PY_inout_evaluate_1( switch (SH_nargs) { case 2: - SHC_rv = axom::quest::inout_evaluate(x, y); + SHCXX_rv = axom::quest::inout_evaluate(x, y); break; case 3: - SHC_rv = axom::quest::inout_evaluate(x, y, z); + SHCXX_rv = axom::quest::inout_evaluate(x, y, z); break; + default: + PyErr_SetString(PyExc_ValueError, "Wrong number of arguments"); + return NULL; } - PyObject* SHTPy_rv = PyBool_FromLong(SHC_rv); + SHTPy_rv = PyBool_FromLong(SHCXX_rv); + if (SHTPy_rv == NULL) + goto fail; return (PyObject*) SHTPy_rv; + +fail: + Py_XDECREF(SHTPy_rv); + return NULL; // splicer end function.inout_evaluate } @@ -207,8 +234,10 @@ PY_inout_get_dimension( PyObject* SHROUD_UNUSED(kwds)) { // splicer begin function.inout_get_dimension - int SHC_rv = axom::quest::inout_get_dimension(); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + PyObject* SHTPy_rv = NULL; + + int SHCXX_rv = axom::quest::inout_get_dimension(); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.inout_get_dimension } @@ -224,12 +253,15 @@ PY_inout_finalize( PyObject* SHROUD_UNUSED(kwds)) { // splicer begin function.inout_finalize - int SHC_rv = axom::quest::inout_finalize(); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + PyObject* SHTPy_rv = NULL; + + int SHCXX_rv = axom::quest::inout_finalize(); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.inout_finalize } +#ifdef AXOM_USE_MPI static PyObject* PY_signed_distance_init_mpi( PyObject* SHROUD_UNUSED(self), @@ -244,6 +276,7 @@ PY_signed_distance_init_mpi( "comm", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO:signed_distance_init", const_cast(SHT_kwlist), &file, @@ -251,12 +284,14 @@ PY_signed_distance_init_mpi( return NULL; const std::string SH_file(file); MPI_Comm SH_comm = MPI_Comm_f2c(comm); - int SHC_rv = axom::quest::signed_distance_init(SH_file, SH_comm); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + int SHCXX_rv = axom::quest::signed_distance_init(SH_file, SH_comm); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.signed_distance_init_mpi } +#endif // ifdef AXOM_USE_MPI +#ifndef AXOM_USE_MPI static PyObject* PY_signed_distance_init_serial( PyObject* SHROUD_UNUSED(self), @@ -269,16 +304,18 @@ PY_signed_distance_init_serial( "file", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:signed_distance_init", const_cast(SHT_kwlist), &file)) return NULL; const std::string SH_file(file); - int SHC_rv = axom::quest::signed_distance_init(SH_file); - PyObject* SHTPy_rv = PyInt_FromLong(SHC_rv); + int SHCXX_rv = axom::quest::signed_distance_init(SH_file); + SHTPy_rv = PyInt_FromLong(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.signed_distance_init_serial } +#endif // ifndef AXOM_USE_MPI static char PY_signed_distance_initialized__doc__[] = "documentation" @@ -291,9 +328,17 @@ PY_signed_distance_initialized( PyObject* SHROUD_UNUSED(kwds)) { // splicer begin function.signed_distance_initialized - bool SHC_rv = axom::quest::signed_distance_initialized(); - PyObject* SHTPy_rv = PyBool_FromLong(SHC_rv); + PyObject* SHTPy_rv = NULL; + + bool SHCXX_rv = axom::quest::signed_distance_initialized(); + SHTPy_rv = PyBool_FromLong(SHCXX_rv); + if (SHTPy_rv == NULL) + goto fail; return (PyObject*) SHTPy_rv; + +fail: + Py_XDECREF(SHTPy_rv); + return NULL; // splicer end function.signed_distance_initialized } @@ -480,12 +525,13 @@ PY_signed_distance_evaluate( "z", NULL }; + PyObject* SHTPy_rv = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "ddd:signed_distance_evaluate", const_cast(SHT_kwlist), &x, &y, &z)) return NULL; - double SHC_rv = axom::quest::signed_distance_evaluate(x, y, z); - PyObject* SHTPy_rv = PyFloat_FromDouble(SHC_rv); + double SHCXX_rv = axom::quest::signed_distance_evaluate(x, y, z); + SHTPy_rv = PyFloat_FromDouble(SHCXX_rv); return (PyObject*) SHTPy_rv; // splicer end function.signed_distance_evaluate } @@ -523,6 +569,7 @@ PY_inout_init( if (kwds != NULL) SHT_nargs += PyDict_Size(args); PyObject* rvobj; +#ifdef AXOM_USE_MPI if (SHT_nargs == 2) { rvobj = PY_inout_init_mpi(self, args, kwds); @@ -536,6 +583,8 @@ PY_inout_init( } PyErr_Clear(); } +#endif // ifdef AXOM_USE_MPI +#ifndef AXOM_USE_MPI if (SHT_nargs == 1) { rvobj = PY_inout_init_serial(self, args, kwds); @@ -549,6 +598,7 @@ PY_inout_init( } PyErr_Clear(); } +#endif // ifndef AXOM_USE_MPI PyErr_SetString(PyExc_TypeError, "wrong arguments multi-dispatch"); return NULL; // splicer end function.inout_init @@ -571,6 +621,7 @@ PY_signed_distance_init( if (kwds != NULL) SHT_nargs += PyDict_Size(args); PyObject* rvobj; +#ifdef AXOM_USE_MPI if (SHT_nargs == 2) { rvobj = PY_signed_distance_init_mpi(self, args, kwds); @@ -584,6 +635,8 @@ PY_signed_distance_init( } PyErr_Clear(); } +#endif // ifdef AXOM_USE_MPI +#ifndef AXOM_USE_MPI if (SHT_nargs == 1) { rvobj = PY_signed_distance_init_serial(self, args, kwds); @@ -597,6 +650,7 @@ PY_signed_distance_init( } PyErr_Clear(); } +#endif // ifndef AXOM_USE_MPI PyErr_SetString(PyExc_TypeError, "wrong arguments multi-dispatch"); return NULL; // splicer end function.signed_distance_init @@ -721,7 +775,6 @@ initquest(void) return RETVAL; struct module_state* st = GETSTATE(m); - PY_error_obj = PyErr_NewException((char*) error_name, NULL, NULL); if (PY_error_obj == NULL) return RETVAL; diff --git a/src/axom/quest/interface/python/pyQUESTmodule.hpp b/src/axom/quest/interface/python/pyQUESTmodule.hpp index eeaf126109..a98f0e1f47 100644 --- a/src/axom/quest/interface/python/pyQUESTmodule.hpp +++ b/src/axom/quest/interface/python/pyQUESTmodule.hpp @@ -14,9 +14,6 @@ // splicer begin header.C_declaration // splicer end header.C_declaration -// helper functions - - extern PyObject* PY_error_obj; #if PY_MAJOR_VERSION >= 3 diff --git a/src/axom/sidre/interface/c_fortran/typesSidre.h b/src/axom/sidre/interface/c_fortran/typesSidre.h index ebb99b53f4..650beffe31 100644 --- a/src/axom/sidre/interface/c_fortran/typesSidre.h +++ b/src/axom/sidre/interface/c_fortran/typesSidre.h @@ -15,42 +15,42 @@ extern "C" { #endif -struct s_SIDRE_buffer +struct s_SIDRE_Buffer { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SIDRE_buffer SIDRE_buffer; +typedef struct s_SIDRE_Buffer SIDRE_Buffer; -struct s_SIDRE_datastore +struct s_SIDRE_DataStore { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SIDRE_datastore SIDRE_datastore; +typedef struct s_SIDRE_DataStore SIDRE_DataStore; -struct s_SIDRE_group +struct s_SIDRE_Group { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SIDRE_group SIDRE_group; +typedef struct s_SIDRE_Group SIDRE_Group; -struct s_SIDRE_view +struct s_SIDRE_View { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SIDRE_view SIDRE_view; +typedef struct s_SIDRE_View SIDRE_View; -struct s_SID_SHROUD_capsule_data +struct s_SIDRE_SHROUD_capsule_data { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SID_SHROUD_capsule_data SID_SHROUD_capsule_data; +typedef struct s_SIDRE_SHROUD_capsule_data SIDRE_SHROUD_capsule_data; -void SIDRE_SHROUD_memory_destructor(SID_SHROUD_capsule_data* cap); +void SIDRE_SHROUD_memory_destructor(SIDRE_SHROUD_capsule_data* cap); #ifdef __cplusplus } diff --git a/src/axom/sidre/interface/c_fortran/wrapBuffer.cpp b/src/axom/sidre/interface/c_fortran/wrapBuffer.cpp index 972a359616..5c4c997eae 100644 --- a/src/axom/sidre/interface/c_fortran/wrapBuffer.cpp +++ b/src/axom/sidre/interface/c_fortran/wrapBuffer.cpp @@ -7,7 +7,6 @@ // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapBuffer.h" #include "axom/sidre/core/Buffer.hpp" -#include "axom/sidre/core/SidreTypes.hpp" // splicer begin class.Buffer.CXX_definitions // splicer end class.Buffer.CXX_definitions @@ -17,124 +16,124 @@ extern "C" { // splicer begin class.Buffer.C_definitions // splicer end class.Buffer.C_definitions -SIDRE_IndexType SIDRE_buffer_get_index(const SIDRE_buffer* self) +SIDRE_IndexType SIDRE_Buffer_get_index(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_index const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_index axom::sidre::IndexType SHC_rv = SH_this->getIndex(); return SHC_rv; -// splicer end class.Buffer.method.get_index + // splicer end class.Buffer.method.get_index } -size_t SIDRE_buffer_get_num_views(const SIDRE_buffer* self) +size_t SIDRE_Buffer_get_num_views(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_num_views const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_num_views size_t SHC_rv = SH_this->getNumViews(); return SHC_rv; -// splicer end class.Buffer.method.get_num_views + // splicer end class.Buffer.method.get_num_views } -void* SIDRE_buffer_get_void_ptr(SIDRE_buffer* self) +void* SIDRE_Buffer_get_void_ptr(SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_void_ptr axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_void_ptr void* SHC_rv = SH_this->getVoidPtr(); return SHC_rv; -// splicer end class.Buffer.method.get_void_ptr + // splicer end class.Buffer.method.get_void_ptr } -int SIDRE_buffer_get_type_id(const SIDRE_buffer* self) +int SIDRE_Buffer_get_type_id(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_type_id const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_type_id axom::sidre::TypeID SHCXX_rv = SH_this->getTypeID(); int SHC_rv = static_cast(SHCXX_rv); return SHC_rv; -// splicer end class.Buffer.method.get_type_id + // splicer end class.Buffer.method.get_type_id } -size_t SIDRE_buffer_get_num_elements(const SIDRE_buffer* self) +size_t SIDRE_Buffer_get_num_elements(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_num_elements const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_num_elements size_t SHC_rv = SH_this->getNumElements(); return SHC_rv; -// splicer end class.Buffer.method.get_num_elements + // splicer end class.Buffer.method.get_num_elements } -size_t SIDRE_buffer_get_total_bytes(const SIDRE_buffer* self) +size_t SIDRE_Buffer_get_total_bytes(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_total_bytes const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_total_bytes size_t SHC_rv = SH_this->getTotalBytes(); return SHC_rv; -// splicer end class.Buffer.method.get_total_bytes + // splicer end class.Buffer.method.get_total_bytes } -size_t SIDRE_buffer_get_bytes_per_element(const SIDRE_buffer* self) +size_t SIDRE_Buffer_get_bytes_per_element(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.get_bytes_per_element const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.get_bytes_per_element size_t SHC_rv = SH_this->getBytesPerElement(); return SHC_rv; -// splicer end class.Buffer.method.get_bytes_per_element + // splicer end class.Buffer.method.get_bytes_per_element } -void SIDRE_buffer_describe(SIDRE_buffer* self, int type, +void SIDRE_Buffer_describe(SIDRE_Buffer* self, int type, SIDRE_IndexType num_elems) { -// splicer begin class.Buffer.method.describe axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.describe axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->describe(SHCXX_type, num_elems); return; -// splicer end class.Buffer.method.describe + // splicer end class.Buffer.method.describe } -void SIDRE_buffer_allocate_existing(SIDRE_buffer* self) +void SIDRE_Buffer_allocate_existing(SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.allocate_existing axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.allocate_existing SH_this->allocate(); return; -// splicer end class.Buffer.method.allocate_existing + // splicer end class.Buffer.method.allocate_existing } -void SIDRE_buffer_allocate_from_type(SIDRE_buffer* self, int type, +void SIDRE_Buffer_allocate_from_type(SIDRE_Buffer* self, int type, SIDRE_IndexType num_elems) { -// splicer begin class.Buffer.method.allocate_from_type axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.allocate_from_type axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->allocate(SHCXX_type, num_elems); return; -// splicer end class.Buffer.method.allocate_from_type + // splicer end class.Buffer.method.allocate_from_type } -void SIDRE_buffer_reallocate(SIDRE_buffer* self, SIDRE_IndexType num_elems) +void SIDRE_Buffer_reallocate(SIDRE_Buffer* self, SIDRE_IndexType num_elems) { -// splicer begin class.Buffer.method.reallocate axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.reallocate SH_this->reallocate(num_elems); return; -// splicer end class.Buffer.method.reallocate + // splicer end class.Buffer.method.reallocate } -void SIDRE_buffer_print(const SIDRE_buffer* self) +void SIDRE_Buffer_print(const SIDRE_Buffer* self) { -// splicer begin class.Buffer.method.print const axom::sidre::Buffer* SH_this = static_cast(self->addr); + // splicer begin class.Buffer.method.print SH_this->print(); return; -// splicer end class.Buffer.method.print + // splicer end class.Buffer.method.print } } // extern "C" diff --git a/src/axom/sidre/interface/c_fortran/wrapBuffer.h b/src/axom/sidre/interface/c_fortran/wrapBuffer.h index ffb78416cd..36bbef40ba 100644 --- a/src/axom/sidre/interface/c_fortran/wrapBuffer.h +++ b/src/axom/sidre/interface/c_fortran/wrapBuffer.h @@ -14,9 +14,15 @@ #ifndef WRAPBUFFER_H #define WRAPBUFFER_H +#include "typesSidre.h" +#ifdef __cplusplus +#include +#include +#include "axom/sidre/core/SidreTypes.hpp" +#else #include #include "axom/sidre/interface/SidreTypes.h" -#include "typesSidre.h" +#endif // splicer begin class.Buffer.CXX_declarations // splicer end class.Buffer.CXX_declarations @@ -28,31 +34,31 @@ extern "C" { // splicer begin class.Buffer.C_declarations // splicer end class.Buffer.C_declarations -SIDRE_IndexType SIDRE_buffer_get_index(const SIDRE_buffer* self); +SIDRE_IndexType SIDRE_Buffer_get_index(const SIDRE_Buffer* self); -size_t SIDRE_buffer_get_num_views(const SIDRE_buffer* self); +size_t SIDRE_Buffer_get_num_views(const SIDRE_Buffer* self); -void* SIDRE_buffer_get_void_ptr(SIDRE_buffer* self); +void* SIDRE_Buffer_get_void_ptr(SIDRE_Buffer* self); -int SIDRE_buffer_get_type_id(const SIDRE_buffer* self); +int SIDRE_Buffer_get_type_id(const SIDRE_Buffer* self); -size_t SIDRE_buffer_get_num_elements(const SIDRE_buffer* self); +size_t SIDRE_Buffer_get_num_elements(const SIDRE_Buffer* self); -size_t SIDRE_buffer_get_total_bytes(const SIDRE_buffer* self); +size_t SIDRE_Buffer_get_total_bytes(const SIDRE_Buffer* self); -size_t SIDRE_buffer_get_bytes_per_element(const SIDRE_buffer* self); +size_t SIDRE_Buffer_get_bytes_per_element(const SIDRE_Buffer* self); -void SIDRE_buffer_describe(SIDRE_buffer* self, int type, +void SIDRE_Buffer_describe(SIDRE_Buffer* self, int type, SIDRE_IndexType num_elems); -void SIDRE_buffer_allocate_existing(SIDRE_buffer* self); +void SIDRE_Buffer_allocate_existing(SIDRE_Buffer* self); -void SIDRE_buffer_allocate_from_type(SIDRE_buffer* self, int type, +void SIDRE_Buffer_allocate_from_type(SIDRE_Buffer* self, int type, SIDRE_IndexType num_elems); -void SIDRE_buffer_reallocate(SIDRE_buffer* self, SIDRE_IndexType num_elems); +void SIDRE_Buffer_reallocate(SIDRE_Buffer* self, SIDRE_IndexType num_elems); -void SIDRE_buffer_print(const SIDRE_buffer* self); +void SIDRE_Buffer_print(const SIDRE_Buffer* self); #ifdef __cplusplus } diff --git a/src/axom/sidre/interface/c_fortran/wrapDataStore.cpp b/src/axom/sidre/interface/c_fortran/wrapDataStore.cpp index e2a829b0c0..80c0a4aac0 100644 --- a/src/axom/sidre/interface/c_fortran/wrapDataStore.cpp +++ b/src/axom/sidre/interface/c_fortran/wrapDataStore.cpp @@ -6,12 +6,12 @@ // // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapDataStore.h" -#include +#include #include #include "axom/sidre/core/Buffer.hpp" #include "axom/sidre/core/DataStore.hpp" #include "axom/sidre/core/Group.hpp" -#include "axom/sidre/core/SidreTypes.hpp" +#include "axom/sidre/interface/SidreTypes.h" // splicer begin class.DataStore.CXX_definitions // splicer end class.DataStore.CXX_definitions @@ -21,57 +21,57 @@ extern "C" { // splicer begin class.DataStore.C_definitions // splicer end class.DataStore.C_definitions -SIDRE_datastore* SIDRE_datastore_new(SIDRE_datastore* SHC_rv) +SIDRE_DataStore* SIDRE_DataStore_new(SIDRE_DataStore* SHC_rv) { -// splicer begin class.DataStore.method.new + // splicer begin class.DataStore.method.new axom::sidre::DataStore* SHCXX_rv = new axom::sidre::DataStore(); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.DataStore.method.new + // splicer end class.DataStore.method.new } -void SIDRE_datastore_delete(SIDRE_datastore* self) +void SIDRE_DataStore_delete(SIDRE_DataStore* self) { -// splicer begin class.DataStore.method.delete axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.delete delete SH_this; self->addr = NULL; return; -// splicer end class.DataStore.method.delete + // splicer end class.DataStore.method.delete } -SIDRE_group* SIDRE_datastore_get_root(SIDRE_datastore* self, - SIDRE_group* SHC_rv) +SIDRE_Group* SIDRE_DataStore_get_root(SIDRE_DataStore* self, + SIDRE_Group* SHC_rv) { -// splicer begin class.DataStore.method.get_root axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.get_root axom::sidre::Group* SHCXX_rv = SH_this->getRoot(); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.DataStore.method.get_root + // splicer end class.DataStore.method.get_root } -size_t SIDRE_datastore_get_num_buffers(const SIDRE_datastore* self) +size_t SIDRE_DataStore_get_num_buffers(const SIDRE_DataStore* self) { -// splicer begin class.DataStore.method.get_num_buffers const axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.get_num_buffers size_t SHC_rv = SH_this->getNumBuffers(); return SHC_rv; -// splicer end class.DataStore.method.get_num_buffers + // splicer end class.DataStore.method.get_num_buffers } -SIDRE_buffer* SIDRE_datastore_get_buffer(SIDRE_datastore* self, +SIDRE_Buffer* SIDRE_DataStore_get_buffer(SIDRE_DataStore* self, SIDRE_IndexType idx, - SIDRE_buffer* SHC_rv) + SIDRE_Buffer* SHC_rv) { -// splicer begin class.DataStore.method.get_buffer axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.get_buffer axom::sidre::Buffer* SHCXX_rv = SH_this->getBuffer(idx); // C_error_pattern if (SHCXX_rv == nullptr) @@ -84,30 +84,30 @@ SIDRE_buffer* SIDRE_datastore_get_buffer(SIDRE_datastore* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.DataStore.method.get_buffer + // splicer end class.DataStore.method.get_buffer } -SIDRE_buffer* SIDRE_datastore_create_buffer_empty(SIDRE_datastore* self, - SIDRE_buffer* SHC_rv) +SIDRE_Buffer* SIDRE_DataStore_create_buffer_empty(SIDRE_DataStore* self, + SIDRE_Buffer* SHC_rv) { -// splicer begin class.DataStore.method.create_buffer_empty axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.create_buffer_empty axom::sidre::Buffer* SHCXX_rv = SH_this->createBuffer(); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.DataStore.method.create_buffer_empty + // splicer end class.DataStore.method.create_buffer_empty } -SIDRE_buffer* SIDRE_datastore_create_buffer_from_type(SIDRE_datastore* self, +SIDRE_Buffer* SIDRE_DataStore_create_buffer_from_type(SIDRE_DataStore* self, int type, SIDRE_IndexType num_elems, - SIDRE_buffer* SHC_rv) + SIDRE_Buffer* SHC_rv) { -// splicer begin class.DataStore.method.create_buffer_from_type axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.create_buffer_from_type axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_rv = SH_this->createBuffer(SHCXX_type, num_elems); // C_error_pattern @@ -121,38 +121,39 @@ SIDRE_buffer* SIDRE_datastore_create_buffer_from_type(SIDRE_datastore* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.DataStore.method.create_buffer_from_type + // splicer end class.DataStore.method.create_buffer_from_type } -void SIDRE_datastore_destroy_buffer(SIDRE_datastore* self, SIDRE_IndexType id) +void SIDRE_DataStore_destroy_buffer(SIDRE_DataStore* self, SIDRE_IndexType id) { -// splicer begin class.DataStore.method.destroy_buffer axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.destroy_buffer SH_this->destroyBuffer(id); return; -// splicer end class.DataStore.method.destroy_buffer + // splicer end class.DataStore.method.destroy_buffer } -bool SIDRE_datastore_generate_blueprint_index(SIDRE_datastore* self, +bool SIDRE_DataStore_generate_blueprint_index(SIDRE_DataStore* self, const char* domain_path, const char* mesh_name, const char* index_path, int num_domains) { -// splicer begin class.DataStore.method.generate_blueprint_index axom::sidre::DataStore* SH_this = static_cast(self->addr); - const std::string SH_domain_path(domain_path); - const std::string SH_mesh_name(mesh_name); - const std::string SH_index_path(index_path); - bool SHC_rv = SH_this->generateBlueprintIndex(SH_domain_path, SH_mesh_name, - SH_index_path, num_domains); + // splicer begin class.DataStore.method.generate_blueprint_index + const std::string SHCXX_domain_path(domain_path); + const std::string SHCXX_mesh_name(mesh_name); + const std::string SHCXX_index_path(index_path); + bool SHC_rv = SH_this->generateBlueprintIndex(SHCXX_domain_path, + SHCXX_mesh_name, + SHCXX_index_path, num_domains); return SHC_rv; -// splicer end class.DataStore.method.generate_blueprint_index + // splicer end class.DataStore.method.generate_blueprint_index } -bool SIDRE_datastore_generate_blueprint_index_bufferify(SIDRE_datastore* self, +bool SIDRE_DataStore_generate_blueprint_index_bufferify(SIDRE_DataStore* self, const char* domain_path, int Ldomain_path, const char* mesh_name, @@ -161,26 +162,27 @@ bool SIDRE_datastore_generate_blueprint_index_bufferify(SIDRE_datastore* self, int Lindex_path, int num_domains) { -// splicer begin class.DataStore.method.generate_blueprint_index_bufferify axom::sidre::DataStore* SH_this = static_cast(self->addr); - const std::string SH_domain_path(domain_path, Ldomain_path); - const std::string SH_mesh_name(mesh_name, Lmesh_name); - const std::string SH_index_path(index_path, Lindex_path); - bool SHC_rv = SH_this->generateBlueprintIndex(SH_domain_path, SH_mesh_name, - SH_index_path, num_domains); + // splicer begin class.DataStore.method.generate_blueprint_index_bufferify + const std::string SHCXX_domain_path(domain_path, Ldomain_path); + const std::string SHCXX_mesh_name(mesh_name, Lmesh_name); + const std::string SHCXX_index_path(index_path, Lindex_path); + bool SHC_rv = SH_this->generateBlueprintIndex(SHCXX_domain_path, + SHCXX_mesh_name, + SHCXX_index_path, num_domains); return SHC_rv; -// splicer end class.DataStore.method.generate_blueprint_index_bufferify + // splicer end class.DataStore.method.generate_blueprint_index_bufferify } -void SIDRE_datastore_print(const SIDRE_datastore* self) +void SIDRE_DataStore_print(const SIDRE_DataStore* self) { -// splicer begin class.DataStore.method.print const axom::sidre::DataStore* SH_this = static_cast(self->addr); + // splicer begin class.DataStore.method.print SH_this->print(); return; -// splicer end class.DataStore.method.print + // splicer end class.DataStore.method.print } } // extern "C" diff --git a/src/axom/sidre/interface/c_fortran/wrapDataStore.h b/src/axom/sidre/interface/c_fortran/wrapDataStore.h index 6ceb9e969d..5b7ceb4d28 100644 --- a/src/axom/sidre/interface/c_fortran/wrapDataStore.h +++ b/src/axom/sidre/interface/c_fortran/wrapDataStore.h @@ -14,9 +14,16 @@ #ifndef WRAPDATASTORE_H #define WRAPDATASTORE_H +#include "typesSidre.h" +#ifdef __cplusplus +#include +#include +#include "axom/sidre/core/SidreTypes.hpp" +#else +#include #include #include "axom/sidre/interface/SidreTypes.h" -#include "typesSidre.h" +#endif // splicer begin class.DataStore.CXX_declarations // splicer end class.DataStore.CXX_declarations @@ -28,36 +35,36 @@ extern "C" { // splicer begin class.DataStore.C_declarations // splicer end class.DataStore.C_declarations -SIDRE_datastore* SIDRE_datastore_new(SIDRE_datastore* SHC_rv); +SIDRE_DataStore* SIDRE_DataStore_new(SIDRE_DataStore* SHC_rv); -void SIDRE_datastore_delete(SIDRE_datastore* self); +void SIDRE_DataStore_delete(SIDRE_DataStore* self); -SIDRE_group* SIDRE_datastore_get_root(SIDRE_datastore* self, - SIDRE_group* SHC_rv); +SIDRE_Group* SIDRE_DataStore_get_root(SIDRE_DataStore* self, + SIDRE_Group* SHC_rv); -size_t SIDRE_datastore_get_num_buffers(const SIDRE_datastore* self); +size_t SIDRE_DataStore_get_num_buffers(const SIDRE_DataStore* self); -SIDRE_buffer* SIDRE_datastore_get_buffer(SIDRE_datastore* self, +SIDRE_Buffer* SIDRE_DataStore_get_buffer(SIDRE_DataStore* self, SIDRE_IndexType idx, - SIDRE_buffer* SHC_rv); + SIDRE_Buffer* SHC_rv); -SIDRE_buffer* SIDRE_datastore_create_buffer_empty(SIDRE_datastore* self, - SIDRE_buffer* SHC_rv); +SIDRE_Buffer* SIDRE_DataStore_create_buffer_empty(SIDRE_DataStore* self, + SIDRE_Buffer* SHC_rv); -SIDRE_buffer* SIDRE_datastore_create_buffer_from_type(SIDRE_datastore* self, +SIDRE_Buffer* SIDRE_DataStore_create_buffer_from_type(SIDRE_DataStore* self, int type, SIDRE_IndexType num_elems, - SIDRE_buffer* SHC_rv); + SIDRE_Buffer* SHC_rv); -void SIDRE_datastore_destroy_buffer(SIDRE_datastore* self, SIDRE_IndexType id); +void SIDRE_DataStore_destroy_buffer(SIDRE_DataStore* self, SIDRE_IndexType id); -bool SIDRE_datastore_generate_blueprint_index(SIDRE_datastore* self, +bool SIDRE_DataStore_generate_blueprint_index(SIDRE_DataStore* self, const char* domain_path, const char* mesh_name, const char* index_path, int num_domains); -bool SIDRE_datastore_generate_blueprint_index_bufferify(SIDRE_datastore* self, +bool SIDRE_DataStore_generate_blueprint_index_bufferify(SIDRE_DataStore* self, const char* domain_path, int Ldomain_path, const char* mesh_name, @@ -66,7 +73,7 @@ bool SIDRE_datastore_generate_blueprint_index_bufferify(SIDRE_datastore* self, int Lindex_path, int num_domains); -void SIDRE_datastore_print(const SIDRE_datastore* self); +void SIDRE_DataStore_print(const SIDRE_DataStore* self); #ifdef __cplusplus } diff --git a/src/axom/sidre/interface/c_fortran/wrapGroup.cpp b/src/axom/sidre/interface/c_fortran/wrapGroup.cpp index cae042aa7b..3ae2158a04 100644 --- a/src/axom/sidre/interface/c_fortran/wrapGroup.cpp +++ b/src/axom/sidre/interface/c_fortran/wrapGroup.cpp @@ -7,13 +7,12 @@ // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapGroup.h" #include -#include #include #include "axom/sidre/core/Buffer.hpp" #include "axom/sidre/core/DataStore.hpp" #include "axom/sidre/core/Group.hpp" -#include "axom/sidre/core/SidreTypes.hpp" #include "axom/sidre/core/View.hpp" +#include "axom/sidre/interface/SidreTypes.h" // splicer begin class.Group.CXX_definitions // splicer end class.Group.CXX_definitions @@ -27,215 +26,224 @@ extern "C" { // dest will not be NULL terminated. static void ShroudStrCopy(char* dest, int ndest, const char* src, int nsrc) { - int nm = nsrc < ndest ? nsrc : ndest; - std::memcpy(dest,src,nm); - if(ndest > nm) - std::memset(dest+nm,' ',ndest-nm); + if (src == NULL) + { + std::memset(dest,' ',ndest); // convert NULL pointer to blank filled string + } + else + { + if (nsrc < 0) + nsrc = std::strlen(src); + int nm = nsrc < ndest ? nsrc : ndest; + std::memcpy(dest,src,nm); + if(ndest > nm) + std::memset(dest+nm,' ',ndest-nm); // blank fill + } } // splicer begin class.Group.C_definitions // splicer end class.Group.C_definitions -SIDRE_IndexType SIDRE_group_get_index(SIDRE_group* self) +SIDRE_IndexType SIDRE_Group_get_index(SIDRE_Group* self) { -// splicer begin class.Group.method.get_index axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_index axom::sidre::IndexType SHC_rv = SH_this->getIndex(); return SHC_rv; -// splicer end class.Group.method.get_index + // splicer end class.Group.method.get_index } -const char* SIDRE_group_get_name(const SIDRE_group* self) +const char* SIDRE_Group_get_name(const SIDRE_Group* self) { -// splicer begin class.Group.method.get_name const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_name const std::string & SHCXX_rv = SH_this->getName(); const char* SHC_rv = SHCXX_rv.c_str(); return SHC_rv; -// splicer end class.Group.method.get_name + // splicer end class.Group.method.get_name } -void SIDRE_group_get_name_bufferify(const SIDRE_group* self, char* SHF_rv, +void SIDRE_Group_get_name_bufferify(const SIDRE_Group* self, char* SHF_rv, int NSHF_rv) { -// splicer begin class.Group.method.get_name_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_name_bufferify const std::string & SHCXX_rv = SH_this->getName(); if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.Group.method.get_name_bufferify + // splicer end class.Group.method.get_name_bufferify } -void SIDRE_group_get_path_bufferify(const SIDRE_group* self, char* SHF_rv, +void SIDRE_Group_get_path_bufferify(const SIDRE_Group* self, char* SHF_rv, int NSHF_rv) { -// splicer begin class.Group.method.get_path_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_path_bufferify std::string SHCXX_rv = SH_this->getPath(); if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.Group.method.get_path_bufferify + // splicer end class.Group.method.get_path_bufferify } -void SIDRE_group_get_path_name_bufferify(const SIDRE_group* self, char* SHF_rv, +void SIDRE_Group_get_path_name_bufferify(const SIDRE_Group* self, char* SHF_rv, int NSHF_rv) { -// splicer begin class.Group.method.get_path_name_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_path_name_bufferify std::string SHCXX_rv = SH_this->getPathName(); if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.Group.method.get_path_name_bufferify + // splicer end class.Group.method.get_path_name_bufferify } -SIDRE_group* SIDRE_group_get_parent(const SIDRE_group* self, - SIDRE_group* SHC_rv) +SIDRE_Group* SIDRE_Group_get_parent(const SIDRE_Group* self, + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.get_parent const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_parent const axom::sidre::Group* SHCXX_rv = SH_this->getParent(); SHC_rv->addr = static_cast(const_cast(SHCXX_rv)); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_parent + // splicer end class.Group.method.get_parent } -size_t SIDRE_group_get_num_groups(const SIDRE_group* self) +size_t SIDRE_Group_get_num_groups(const SIDRE_Group* self) { -// splicer begin class.Group.method.get_num_groups const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_num_groups size_t SHC_rv = SH_this->getNumGroups(); return SHC_rv; -// splicer end class.Group.method.get_num_groups + // splicer end class.Group.method.get_num_groups } -size_t SIDRE_group_get_num_views(const SIDRE_group* self) +size_t SIDRE_Group_get_num_views(const SIDRE_Group* self) { -// splicer begin class.Group.method.get_num_views const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_num_views size_t SHC_rv = SH_this->getNumViews(); return SHC_rv; -// splicer end class.Group.method.get_num_views + // splicer end class.Group.method.get_num_views } -SIDRE_datastore* SIDRE_group_get_data_store(const SIDRE_group* self, - SIDRE_datastore* SHC_rv) +SIDRE_DataStore* SIDRE_Group_get_data_store(const SIDRE_Group* self, + SIDRE_DataStore* SHC_rv) { -// splicer begin class.Group.method.get_data_store const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_data_store const axom::sidre::DataStore* SHCXX_rv = SH_this->getDataStore(); SHC_rv->addr = static_cast(const_cast(SHCXX_rv)); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_data_store + // splicer end class.Group.method.get_data_store } -bool SIDRE_group_has_view(const SIDRE_group* self, const char* path) +bool SIDRE_Group_has_view(const SIDRE_Group* self, const char* path) { -// splicer begin class.Group.method.has_view const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - bool SHC_rv = SH_this->hasView(SH_path); + // splicer begin class.Group.method.has_view + const std::string SHCXX_path(path); + bool SHC_rv = SH_this->hasView(SHCXX_path); return SHC_rv; -// splicer end class.Group.method.has_view + // splicer end class.Group.method.has_view } -bool SIDRE_group_has_view_bufferify(const SIDRE_group* self, const char* path, +bool SIDRE_Group_has_view_bufferify(const SIDRE_Group* self, const char* path, int Lpath) { -// splicer begin class.Group.method.has_view_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - bool SHC_rv = SH_this->hasView(SH_path); + // splicer begin class.Group.method.has_view_bufferify + const std::string SHCXX_path(path, Lpath); + bool SHC_rv = SH_this->hasView(SHCXX_path); return SHC_rv; -// splicer end class.Group.method.has_view_bufferify + // splicer end class.Group.method.has_view_bufferify } -bool SIDRE_group_has_child_view(const SIDRE_group* self, const char* name) +bool SIDRE_Group_has_child_view(const SIDRE_Group* self, const char* name) { -// splicer begin class.Group.method.has_child_view const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name); - bool SHC_rv = SH_this->hasChildView(SH_name); + // splicer begin class.Group.method.has_child_view + const std::string SHCXX_name(name); + bool SHC_rv = SH_this->hasChildView(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.has_child_view + // splicer end class.Group.method.has_child_view } -bool SIDRE_group_has_child_view_bufferify(const SIDRE_group* self, +bool SIDRE_Group_has_child_view_bufferify(const SIDRE_Group* self, const char* name, int Lname) { -// splicer begin class.Group.method.has_child_view_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name, Lname); - bool SHC_rv = SH_this->hasChildView(SH_name); + // splicer begin class.Group.method.has_child_view_bufferify + const std::string SHCXX_name(name, Lname); + bool SHC_rv = SH_this->hasChildView(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.has_child_view_bufferify + // splicer end class.Group.method.has_child_view_bufferify } -SIDRE_IndexType SIDRE_group_get_view_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_view_index(const SIDRE_Group* self, const char* name) { -// splicer begin class.Group.method.get_view_index const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name); - axom::sidre::IndexType SHC_rv = SH_this->getViewIndex(SH_name); + // splicer begin class.Group.method.get_view_index + const std::string SHCXX_name(name); + axom::sidre::IndexType SHC_rv = SH_this->getViewIndex(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.get_view_index + // splicer end class.Group.method.get_view_index } -SIDRE_IndexType SIDRE_group_get_view_index_bufferify(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_view_index_bufferify(const SIDRE_Group* self, const char* name, int Lname) { -// splicer begin class.Group.method.get_view_index_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name, Lname); - axom::sidre::IndexType SHC_rv = SH_this->getViewIndex(SH_name); + // splicer begin class.Group.method.get_view_index_bufferify + const std::string SHCXX_name(name, Lname); + axom::sidre::IndexType SHC_rv = SH_this->getViewIndex(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.get_view_index_bufferify + // splicer end class.Group.method.get_view_index_bufferify } -const char* SIDRE_group_get_view_name(const SIDRE_group* self, +const char* SIDRE_Group_get_view_name(const SIDRE_Group* self, SIDRE_IndexType idx) { -// splicer begin class.Group.method.get_view_name const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_view_name const std::string & SHCXX_rv = SH_this->getViewName(idx); // C_error_pattern if (!axom::sidre::nameIsValid(SHCXX_rv)) @@ -245,16 +253,16 @@ const char* SIDRE_group_get_view_name(const SIDRE_group* self, const char* SHC_rv = SHCXX_rv.c_str(); return SHC_rv; -// splicer end class.Group.method.get_view_name + // splicer end class.Group.method.get_view_name } -void SIDRE_group_get_view_name_bufferify(const SIDRE_group* self, +void SIDRE_Group_get_view_name_bufferify(const SIDRE_Group* self, SIDRE_IndexType idx, char* SHF_rv, int NSHF_rv) { -// splicer begin class.Group.method.get_view_name_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_view_name_bufferify const std::string & SHCXX_rv = SH_this->getViewName(idx); // C_error_pattern if (!axom::sidre::nameIsValid(SHCXX_rv)) @@ -265,23 +273,23 @@ void SIDRE_group_get_view_name_bufferify(const SIDRE_group* self, if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.Group.method.get_view_name_bufferify + // splicer end class.Group.method.get_view_name_bufferify } -SIDRE_view* SIDRE_group_get_view_from_name(SIDRE_group* self, const char* path, - SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_get_view_from_name(SIDRE_Group* self, const char* path, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.get_view_from_name axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = SH_this->getView(SH_path); + // splicer begin class.Group.method.get_view_from_name + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = SH_this->getView(SHCXX_path); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -293,30 +301,30 @@ SIDRE_view* SIDRE_group_get_view_from_name(SIDRE_group* self, const char* path, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_view_from_name + // splicer end class.Group.method.get_view_from_name } -SIDRE_view* SIDRE_group_get_view_from_name_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_get_view_from_name_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.get_view_from_name_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = SH_this->getView(SH_path); + // splicer begin class.Group.method.get_view_from_name_bufferify + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = SH_this->getView(SHCXX_path); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_view_from_name_bufferify + // splicer end class.Group.method.get_view_from_name_bufferify } -SIDRE_view* SIDRE_group_get_view_from_index(SIDRE_group* self, +SIDRE_View* SIDRE_Group_get_view_from_index(SIDRE_Group* self, const SIDRE_IndexType idx, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.get_view_from_index axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_view_from_index axom::sidre::View* SHCXX_rv = SH_this->getView(idx); // C_error_pattern if (SHCXX_rv == nullptr) @@ -329,37 +337,37 @@ SIDRE_view* SIDRE_group_get_view_from_index(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_view_from_index + // splicer end class.Group.method.get_view_from_index } -SIDRE_IndexType SIDRE_group_get_first_valid_view_index(const SIDRE_group* self) +SIDRE_IndexType SIDRE_Group_get_first_valid_view_index(const SIDRE_Group* self) { -// splicer begin class.Group.method.get_first_valid_view_index const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_first_valid_view_index axom::sidre::IndexType SHC_rv = SH_this->getFirstValidViewIndex(); return SHC_rv; -// splicer end class.Group.method.get_first_valid_view_index + // splicer end class.Group.method.get_first_valid_view_index } -SIDRE_IndexType SIDRE_group_get_next_valid_view_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_next_valid_view_index(const SIDRE_Group* self, SIDRE_IndexType idx) { -// splicer begin class.Group.method.get_next_valid_view_index const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_next_valid_view_index axom::sidre::IndexType SHC_rv = SH_this->getNextValidViewIndex(idx); return SHC_rv; -// splicer end class.Group.method.get_next_valid_view_index + // splicer end class.Group.method.get_next_valid_view_index } -SIDRE_view* SIDRE_group_create_view_empty(SIDRE_group* self, const char* path, - SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_empty(SIDRE_Group* self, const char* path, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_empty axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path); + // splicer begin class.Group.method.create_view_empty + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -371,33 +379,33 @@ SIDRE_view* SIDRE_group_create_view_empty(SIDRE_group* self, const char* path, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_empty + // splicer end class.Group.method.create_view_empty } -SIDRE_view* SIDRE_group_create_view_empty_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_empty_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_empty_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path); + // splicer begin class.Group.method.create_view_empty_bufferify + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_empty_bufferify + // splicer end class.Group.method.create_view_empty_bufferify } -SIDRE_view* SIDRE_group_create_view_from_type(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type(SIDRE_Group* self, const char* path, int type, SIDRE_IndexType num_elems, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_type axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_from_type + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, num_elems); // C_error_pattern if (SHCXX_rv == nullptr) @@ -410,39 +418,39 @@ SIDRE_view* SIDRE_group_create_view_from_type(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_type + // splicer end class.Group.method.create_view_from_type } -SIDRE_view* SIDRE_group_create_view_from_type_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type_bufferify(SIDRE_Group* self, const char* path, int Lpath, int type, SIDRE_IndexType num_elems, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_type_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_from_type_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, num_elems); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_type_bufferify + // splicer end class.Group.method.create_view_from_type_bufferify } -SIDRE_view* SIDRE_group_create_view_from_shape(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape(SIDRE_Group* self, const char* path, int type, int ndims, SIDRE_IndexType* shape, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_shape axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_from_shape + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, ndims, - shape); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, + ndims, shape); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -454,39 +462,39 @@ SIDRE_view* SIDRE_group_create_view_from_shape(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_shape + // splicer end class.Group.method.create_view_from_shape } -SIDRE_view* SIDRE_group_create_view_from_shape_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape_bufferify(SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, SIDRE_IndexType* shape, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_shape_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_from_shape_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, ndims, - shape); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, + ndims, shape); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_shape_bufferify + // splicer end class.Group.method.create_view_from_shape_bufferify } -SIDRE_view* SIDRE_group_create_view_into_buffer(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_into_buffer(SIDRE_Group* self, const char* path, - SIDRE_buffer* buff, - SIDRE_view* SHC_rv) + SIDRE_Buffer* buff, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_into_buffer axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_into_buffer + const std::string SHCXX_path(path); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_buff); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_buff); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -498,40 +506,40 @@ SIDRE_view* SIDRE_group_create_view_into_buffer(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_into_buffer + // splicer end class.Group.method.create_view_into_buffer } -SIDRE_view* SIDRE_group_create_view_into_buffer_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_into_buffer_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_buffer* buff, - SIDRE_view* SHC_rv) + SIDRE_Buffer* buff, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_into_buffer_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_into_buffer_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_buff); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_buff); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_into_buffer_bufferify + // splicer end class.Group.method.create_view_into_buffer_bufferify } -SIDRE_view* SIDRE_group_create_view_from_type_and_buffer(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type_and_buffer(SIDRE_Group* self, const char* path, int type, - SIDRE_IndexType num_elems, SIDRE_buffer* buff, - SIDRE_view* SHC_rv) + SIDRE_IndexType num_elems, SIDRE_Buffer* buff, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_type_and_buffer axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_from_type_and_buffer + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, num_elems, SHCXX_buff); // C_error_pattern if (SHCXX_rv == nullptr) @@ -544,41 +552,41 @@ SIDRE_view* SIDRE_group_create_view_from_type_and_buffer(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_type_and_buffer + // splicer end class.Group.method.create_view_from_type_and_buffer } -SIDRE_view* SIDRE_group_create_view_from_type_and_buffer_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, - SIDRE_IndexType num_elems, SIDRE_buffer* buff, SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_from_type_and_buffer_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, + SIDRE_IndexType num_elems, SIDRE_Buffer* buff, SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_type_and_buffer_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_from_type_and_buffer_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, num_elems, SHCXX_buff); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_type_and_buffer_bufferify + // splicer end class.Group.method.create_view_from_type_and_buffer_bufferify } -SIDRE_view* SIDRE_group_create_view_from_shape_and_buffer(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape_and_buffer(SIDRE_Group* self, const char* path, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_buffer* buff, - SIDRE_view* SHC_rv) + SIDRE_IndexType* shape, SIDRE_Buffer* buff, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_shape_and_buffer axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_from_shape_and_buffer + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, ndims, - shape, SHCXX_buff); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, + ndims, shape, SHCXX_buff); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -590,36 +598,37 @@ SIDRE_view* SIDRE_group_create_view_from_shape_and_buffer(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_shape_and_buffer + // splicer end class.Group.method.create_view_from_shape_and_buffer } -SIDRE_view* SIDRE_group_create_view_from_shape_and_buffer_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_buffer* buff, SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_from_shape_and_buffer_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, + SIDRE_IndexType* shape, SIDRE_Buffer* buff, SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_shape_and_buffer_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin + // class.Group.method.create_view_from_shape_and_buffer_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, ndims, - shape, SHCXX_buff); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, + ndims, shape, SHCXX_buff); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_shape_and_buffer_bufferify + // splicer end class.Group.method.create_view_from_shape_and_buffer_bufferify } -SIDRE_view* SIDRE_group_create_view_external(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_external(SIDRE_Group* self, const char* path, void* external_ptr, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_external axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, external_ptr); + // splicer begin class.Group.method.create_view_external + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, external_ptr); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -631,36 +640,36 @@ SIDRE_view* SIDRE_group_create_view_external(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_external + // splicer end class.Group.method.create_view_external } -SIDRE_view* SIDRE_group_create_view_external_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_external_bufferify(SIDRE_Group* self, const char* path, int Lpath, void* external_ptr, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_external_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, external_ptr); + // splicer begin class.Group.method.create_view_external_bufferify + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, external_ptr); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_external_bufferify + // splicer end class.Group.method.create_view_external_bufferify } -SIDRE_view* SIDRE_group_create_view_from_type_external(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type_external(SIDRE_Group* self, const char* path, int type, SIDRE_IndexType num_elems, void* external_ptr, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_type_external axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_from_type_external + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, num_elems, external_ptr); // C_error_pattern if (SHCXX_rv == nullptr) @@ -673,38 +682,38 @@ SIDRE_view* SIDRE_group_create_view_from_type_external(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_type_external + // splicer end class.Group.method.create_view_from_type_external } -SIDRE_view* SIDRE_group_create_view_from_type_external_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, - SIDRE_IndexType num_elems, void* external_ptr, SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_from_type_external_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, + SIDRE_IndexType num_elems, void* external_ptr, SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_type_external_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_from_type_external_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, num_elems, external_ptr); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_type_external_bufferify + // splicer end class.Group.method.create_view_from_type_external_bufferify } -SIDRE_view* SIDRE_group_create_view_from_shape_external(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape_external(SIDRE_Group* self, const char* path, int type, int ndims, SIDRE_IndexType* shape, void* external_ptr, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_shape_external axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_from_shape_external + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, ndims, - shape, external_ptr); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, + ndims, shape, external_ptr); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -716,36 +725,36 @@ SIDRE_view* SIDRE_group_create_view_from_shape_external(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_shape_external + // splicer end class.Group.method.create_view_from_shape_external } -SIDRE_view* SIDRE_group_create_view_from_shape_external_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, int ndims, - SIDRE_IndexType* shape, void* external_ptr, SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_from_shape_external_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, + SIDRE_IndexType* shape, void* external_ptr, SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_from_shape_external_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_from_shape_external_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createView(SH_path, SHCXX_type, ndims, - shape, external_ptr); + axom::sidre::View* SHCXX_rv = SH_this->createView(SHCXX_path, SHCXX_type, + ndims, shape, external_ptr); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_from_shape_external_bufferify + // splicer end class.Group.method.create_view_from_shape_external_bufferify } -SIDRE_view* SIDRE_group_create_view_and_allocate_nelems(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_and_allocate_nelems(SIDRE_Group* self, const char* path, int type, SIDRE_IndexType num_elems, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_and_allocate_nelems axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_and_allocate_nelems + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SH_path, + axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SHCXX_path, SHCXX_type, num_elems); // C_error_pattern @@ -759,37 +768,37 @@ SIDRE_view* SIDRE_group_create_view_and_allocate_nelems(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_and_allocate_nelems + // splicer end class.Group.method.create_view_and_allocate_nelems } -SIDRE_view* SIDRE_group_create_view_and_allocate_nelems_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, - SIDRE_IndexType num_elems, SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_and_allocate_nelems_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, + SIDRE_IndexType num_elems, SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_and_allocate_nelems_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_and_allocate_nelems_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SH_path, + axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SHCXX_path, SHCXX_type, num_elems); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_and_allocate_nelems_bufferify + // splicer end class.Group.method.create_view_and_allocate_nelems_bufferify } -SIDRE_view* SIDRE_group_create_view_and_allocate_shape(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_and_allocate_shape(SIDRE_Group* self, const char* path, int type, int ndims, SIDRE_IndexType* shape, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_and_allocate_shape axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); + // splicer begin class.Group.method.create_view_and_allocate_shape + const std::string SHCXX_path(path); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SH_path, + axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SHCXX_path, SHCXX_type, ndims, shape); // C_error_pattern @@ -803,34 +812,35 @@ SIDRE_view* SIDRE_group_create_view_and_allocate_shape(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_and_allocate_shape + // splicer end class.Group.method.create_view_and_allocate_shape } -SIDRE_view* SIDRE_group_create_view_and_allocate_shape_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_create_view_and_allocate_shape_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, + SIDRE_IndexType* shape, SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_and_allocate_shape_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); + // splicer begin class.Group.method.create_view_and_allocate_shape_bufferify + const std::string SHCXX_path(path, Lpath); axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); - axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SH_path, + axom::sidre::View* SHCXX_rv = SH_this->createViewAndAllocate(SHCXX_path, SHCXX_type, ndims, shape); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_and_allocate_shape_bufferify + // splicer end class.Group.method.create_view_and_allocate_shape_bufferify } -SIDRE_view* SIDRE_group_create_view_scalar_int(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_int(SIDRE_Group* self, const char* path, int value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_int axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_int + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = + SH_this->createViewScalar(SHCXX_path, value); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -842,32 +852,34 @@ SIDRE_view* SIDRE_group_create_view_scalar_int(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_int + // splicer end class.Group.method.create_view_scalar_int } -SIDRE_view* SIDRE_group_create_view_scalar_int_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_int(SIDRE_Group* self, const char* path, int Lpath, int value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_int_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_bufferify_int + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = + SH_this->createViewScalar(SHCXX_path, value); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_int_bufferify + // splicer end class.Group.method.create_view_scalar_bufferify_int } -SIDRE_view* SIDRE_group_create_view_scalar_long(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_long(SIDRE_Group* self, const char* path, long value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_long axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_long + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SHCXX_path, + value); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -879,33 +891,34 @@ SIDRE_view* SIDRE_group_create_view_scalar_long(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_long + // splicer end class.Group.method.create_view_scalar_long } -SIDRE_view* SIDRE_group_create_view_scalar_long_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_long(SIDRE_Group* self, const char* path, int Lpath, long value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_long_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_bufferify_long + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SHCXX_path, + value); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_long_bufferify + // splicer end class.Group.method.create_view_scalar_bufferify_long } -SIDRE_view* SIDRE_group_create_view_scalar_float(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_float(SIDRE_Group* self, const char* path, float value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_float axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = - SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_float + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SHCXX_path, + value); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -917,36 +930,36 @@ SIDRE_view* SIDRE_group_create_view_scalar_float(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_float + // splicer end class.Group.method.create_view_scalar_float } -SIDRE_view* SIDRE_group_create_view_scalar_float_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_float(SIDRE_Group* self, const char* path, int Lpath, float value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_float_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = - SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_bufferify_float + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SHCXX_path, + value); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_float_bufferify + // splicer end class.Group.method.create_view_scalar_bufferify_float } -SIDRE_view* SIDRE_group_create_view_scalar_double(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_double(SIDRE_Group* self, const char* path, double value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_double axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::View* SHCXX_rv = - SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_double + const std::string SHCXX_path(path); + axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SHCXX_path, + value); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -958,35 +971,36 @@ SIDRE_view* SIDRE_group_create_view_scalar_double(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_double + // splicer end class.Group.method.create_view_scalar_double } -SIDRE_view* SIDRE_group_create_view_scalar_double_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_double(SIDRE_Group* self, const char* path, int Lpath, double value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_scalar_double_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::View* SHCXX_rv = - SH_this->createViewScalar(SH_path, value); + // splicer begin class.Group.method.create_view_scalar_bufferify_double + const std::string SHCXX_path(path, Lpath); + axom::sidre::View* SHCXX_rv = SH_this->createViewScalar(SHCXX_path, + value); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_scalar_double_bufferify + // splicer end class.Group.method.create_view_scalar_bufferify_double } -SIDRE_view* SIDRE_group_create_view_string(SIDRE_group* self, const char* path, +SIDRE_View* SIDRE_Group_create_view_string(SIDRE_Group* self, const char* path, const char* value, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_string axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - const std::string SH_value(value); - axom::sidre::View* SHCXX_rv = SH_this->createViewString(SH_path, SH_value); + // splicer begin class.Group.method.create_view_string + const std::string SHCXX_path(path); + const std::string SHCXX_value(value); + axom::sidre::View* SHCXX_rv = SH_this->createViewString(SHCXX_path, + SHCXX_value); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -998,179 +1012,180 @@ SIDRE_view* SIDRE_group_create_view_string(SIDRE_group* self, const char* path, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_string + // splicer end class.Group.method.create_view_string } -SIDRE_view* SIDRE_group_create_view_string_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_string_bufferify(SIDRE_Group* self, const char* path, int Lpath, const char* value, int Lvalue, - SIDRE_view* SHC_rv) + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.create_view_string_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - const std::string SH_value(value, Lvalue); - axom::sidre::View* SHCXX_rv = SH_this->createViewString(SH_path, SH_value); + // splicer begin class.Group.method.create_view_string_bufferify + const std::string SHCXX_path(path, Lpath); + const std::string SHCXX_value(value, Lvalue); + axom::sidre::View* SHCXX_rv = SH_this->createViewString(SHCXX_path, + SHCXX_value); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_view_string_bufferify + // splicer end class.Group.method.create_view_string_bufferify } -void SIDRE_group_destroy_view(SIDRE_group* self, const char* path) +void SIDRE_Group_destroy_view(SIDRE_Group* self, const char* path) { -// splicer begin class.Group.method.destroy_view axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - SH_this->destroyView(SH_path); + // splicer begin class.Group.method.destroy_view + const std::string SHCXX_path(path); + SH_this->destroyView(SHCXX_path); return; -// splicer end class.Group.method.destroy_view + // splicer end class.Group.method.destroy_view } -void SIDRE_group_destroy_view_bufferify(SIDRE_group* self, const char* path, +void SIDRE_Group_destroy_view_bufferify(SIDRE_Group* self, const char* path, int Lpath) { -// splicer begin class.Group.method.destroy_view_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - SH_this->destroyView(SH_path); + // splicer begin class.Group.method.destroy_view_bufferify + const std::string SHCXX_path(path, Lpath); + SH_this->destroyView(SHCXX_path); return; -// splicer end class.Group.method.destroy_view_bufferify + // splicer end class.Group.method.destroy_view_bufferify } -void SIDRE_group_destroy_view_and_data_name(SIDRE_group* self, const char* path) +void SIDRE_Group_destroy_view_and_data_name(SIDRE_Group* self, const char* path) { -// splicer begin class.Group.method.destroy_view_and_data_name axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - SH_this->destroyViewAndData(SH_path); + // splicer begin class.Group.method.destroy_view_and_data_name + const std::string SHCXX_path(path); + SH_this->destroyViewAndData(SHCXX_path); return; -// splicer end class.Group.method.destroy_view_and_data_name + // splicer end class.Group.method.destroy_view_and_data_name } -void SIDRE_group_destroy_view_and_data_name_bufferify(SIDRE_group* self, +void SIDRE_Group_destroy_view_and_data_name_bufferify(SIDRE_Group* self, const char* path, int Lpath) { -// splicer begin class.Group.method.destroy_view_and_data_name_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - SH_this->destroyViewAndData(SH_path); + // splicer begin class.Group.method.destroy_view_and_data_name_bufferify + const std::string SHCXX_path(path, Lpath); + SH_this->destroyViewAndData(SHCXX_path); return; -// splicer end class.Group.method.destroy_view_and_data_name_bufferify + // splicer end class.Group.method.destroy_view_and_data_name_bufferify } -void SIDRE_group_destroy_view_and_data_index(SIDRE_group* self, +void SIDRE_Group_destroy_view_and_data_index(SIDRE_Group* self, SIDRE_IndexType idx) { -// splicer begin class.Group.method.destroy_view_and_data_index axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.destroy_view_and_data_index SH_this->destroyViewAndData(idx); return; -// splicer end class.Group.method.destroy_view_and_data_index + // splicer end class.Group.method.destroy_view_and_data_index } -SIDRE_view* SIDRE_group_move_view(SIDRE_group* self, SIDRE_view* view, - SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_move_view(SIDRE_Group* self, SIDRE_View* view, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.move_view axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.move_view axom::sidre::View* SHCXX_view = static_cast(view->addr); axom::sidre::View* SHCXX_rv = SH_this->moveView(SHCXX_view); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.move_view + // splicer end class.Group.method.move_view } -SIDRE_view* SIDRE_group_copy_view(SIDRE_group* self, SIDRE_view* view, - SIDRE_view* SHC_rv) +SIDRE_View* SIDRE_Group_copy_view(SIDRE_Group* self, SIDRE_View* view, + SIDRE_View* SHC_rv) { -// splicer begin class.Group.method.copy_view axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.copy_view axom::sidre::View* SHCXX_view = static_cast(view->addr); axom::sidre::View* SHCXX_rv = SH_this->copyView(SHCXX_view); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.copy_view + // splicer end class.Group.method.copy_view } -bool SIDRE_group_has_group(SIDRE_group* self, const char* path) +bool SIDRE_Group_has_group(SIDRE_Group* self, const char* path) { -// splicer begin class.Group.method.has_group axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - bool SHC_rv = SH_this->hasGroup(SH_path); + // splicer begin class.Group.method.has_group + const std::string SHCXX_path(path); + bool SHC_rv = SH_this->hasGroup(SHCXX_path); return SHC_rv; -// splicer end class.Group.method.has_group + // splicer end class.Group.method.has_group } -bool SIDRE_group_has_group_bufferify(SIDRE_group* self, const char* path, +bool SIDRE_Group_has_group_bufferify(SIDRE_Group* self, const char* path, int Lpath) { -// splicer begin class.Group.method.has_group_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - bool SHC_rv = SH_this->hasGroup(SH_path); + // splicer begin class.Group.method.has_group_bufferify + const std::string SHCXX_path(path, Lpath); + bool SHC_rv = SH_this->hasGroup(SHCXX_path); return SHC_rv; -// splicer end class.Group.method.has_group_bufferify + // splicer end class.Group.method.has_group_bufferify } -bool SIDRE_group_has_child_group(SIDRE_group* self, const char* name) +bool SIDRE_Group_has_child_group(SIDRE_Group* self, const char* name) { -// splicer begin class.Group.method.has_child_group axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name); - bool SHC_rv = SH_this->hasChildGroup(SH_name); + // splicer begin class.Group.method.has_child_group + const std::string SHCXX_name(name); + bool SHC_rv = SH_this->hasChildGroup(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.has_child_group + // splicer end class.Group.method.has_child_group } -bool SIDRE_group_has_child_group_bufferify(SIDRE_group* self, const char* name, +bool SIDRE_Group_has_child_group_bufferify(SIDRE_Group* self, const char* name, int Lname) { -// splicer begin class.Group.method.has_child_group_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name, Lname); - bool SHC_rv = SH_this->hasChildGroup(SH_name); + // splicer begin class.Group.method.has_child_group_bufferify + const std::string SHCXX_name(name, Lname); + bool SHC_rv = SH_this->hasChildGroup(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.has_child_group_bufferify + // splicer end class.Group.method.has_child_group_bufferify } -SIDRE_IndexType SIDRE_group_get_group_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_group_index(const SIDRE_Group* self, const char* name) { -// splicer begin class.Group.method.get_group_index const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name); - axom::sidre::IndexType SHC_rv = SH_this->getGroupIndex(SH_name); + // splicer begin class.Group.method.get_group_index + const std::string SHCXX_name(name); + axom::sidre::IndexType SHC_rv = SH_this->getGroupIndex(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.get_group_index + // splicer end class.Group.method.get_group_index } -SIDRE_IndexType SIDRE_group_get_group_index_bufferify(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_group_index_bufferify(const SIDRE_Group* self, const char* name, int Lname) { -// splicer begin class.Group.method.get_group_index_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_name(name, Lname); - axom::sidre::IndexType SHC_rv = SH_this->getGroupIndex(SH_name); + // splicer begin class.Group.method.get_group_index_bufferify + const std::string SHCXX_name(name, Lname); + axom::sidre::IndexType SHC_rv = SH_this->getGroupIndex(SHCXX_name); return SHC_rv; -// splicer end class.Group.method.get_group_index_bufferify + // splicer end class.Group.method.get_group_index_bufferify } -const char* SIDRE_group_get_group_name(const SIDRE_group* self, +const char* SIDRE_Group_get_group_name(const SIDRE_Group* self, SIDRE_IndexType idx) { -// splicer begin class.Group.method.get_group_name const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_group_name const std::string & SHCXX_rv = SH_this->getGroupName(idx); // C_error_pattern if (!axom::sidre::nameIsValid(SHCXX_rv)) @@ -1180,16 +1195,16 @@ const char* SIDRE_group_get_group_name(const SIDRE_group* self, const char* SHC_rv = SHCXX_rv.c_str(); return SHC_rv; -// splicer end class.Group.method.get_group_name + // splicer end class.Group.method.get_group_name } -void SIDRE_group_get_group_name_bufferify(const SIDRE_group* self, +void SIDRE_Group_get_group_name_bufferify(const SIDRE_Group* self, SIDRE_IndexType idx, char* SHF_rv, int NSHF_rv) { -// splicer begin class.Group.method.get_group_name_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_group_name_bufferify const std::string & SHCXX_rv = SH_this->getGroupName(idx); // C_error_pattern if (!axom::sidre::nameIsValid(SHCXX_rv)) @@ -1200,24 +1215,24 @@ void SIDRE_group_get_group_name_bufferify(const SIDRE_group* self, if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.Group.method.get_group_name_bufferify + // splicer end class.Group.method.get_group_name_bufferify } -SIDRE_group* SIDRE_group_get_group_from_name(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_get_group_from_name(SIDRE_Group* self, const char* path, - SIDRE_group* SHC_rv) + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.get_group_from_name axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::Group* SHCXX_rv = SH_this->getGroup(SH_path); + // splicer begin class.Group.method.get_group_from_name + const std::string SHCXX_path(path); + axom::sidre::Group* SHCXX_rv = SH_this->getGroup(SHCXX_path); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -1229,30 +1244,30 @@ SIDRE_group* SIDRE_group_get_group_from_name(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_group_from_name + // splicer end class.Group.method.get_group_from_name } -SIDRE_group* SIDRE_group_get_group_from_name_bufferify(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_get_group_from_name_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_group* SHC_rv) + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.get_group_from_name_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::Group* SHCXX_rv = SH_this->getGroup(SH_path); + // splicer begin class.Group.method.get_group_from_name_bufferify + const std::string SHCXX_path(path, Lpath); + axom::sidre::Group* SHCXX_rv = SH_this->getGroup(SHCXX_path); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_group_from_name_bufferify + // splicer end class.Group.method.get_group_from_name_bufferify } -SIDRE_group* SIDRE_group_get_group_from_index(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_get_group_from_index(SIDRE_Group* self, SIDRE_IndexType idx, - SIDRE_group* SHC_rv) + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.get_group_from_index axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_group_from_index axom::sidre::Group* SHCXX_rv = SH_this->getGroup(idx); // C_error_pattern if (SHCXX_rv == nullptr) @@ -1265,37 +1280,37 @@ SIDRE_group* SIDRE_group_get_group_from_index(SIDRE_group* self, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.get_group_from_index + // splicer end class.Group.method.get_group_from_index } -SIDRE_IndexType SIDRE_group_get_first_valid_group_index(const SIDRE_group* self) +SIDRE_IndexType SIDRE_Group_get_first_valid_group_index(const SIDRE_Group* self) { -// splicer begin class.Group.method.get_first_valid_group_index const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_first_valid_group_index axom::sidre::IndexType SHC_rv = SH_this->getFirstValidGroupIndex(); return SHC_rv; -// splicer end class.Group.method.get_first_valid_group_index + // splicer end class.Group.method.get_first_valid_group_index } -SIDRE_IndexType SIDRE_group_get_next_valid_group_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_next_valid_group_index(const SIDRE_Group* self, SIDRE_IndexType idx) { -// splicer begin class.Group.method.get_next_valid_group_index const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.get_next_valid_group_index axom::sidre::IndexType SHC_rv = SH_this->getNextValidGroupIndex(idx); return SHC_rv; -// splicer end class.Group.method.get_next_valid_group_index + // splicer end class.Group.method.get_next_valid_group_index } -SIDRE_group* SIDRE_group_create_group(SIDRE_group* self, const char* path, - SIDRE_group* SHC_rv) +SIDRE_Group* SIDRE_Group_create_group(SIDRE_Group* self, const char* path, + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.create_group axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - axom::sidre::Group* SHCXX_rv = SH_this->createGroup(SH_path); + // splicer begin class.Group.method.create_group + const std::string SHCXX_path(path); + axom::sidre::Group* SHCXX_rv = SH_this->createGroup(SHCXX_path); // C_error_pattern if (SHCXX_rv == nullptr) { @@ -1307,207 +1322,206 @@ SIDRE_group* SIDRE_group_create_group(SIDRE_group* self, const char* path, SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_group + // splicer end class.Group.method.create_group } -SIDRE_group* SIDRE_group_create_group_bufferify(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_create_group_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_group* SHC_rv) + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.create_group_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - axom::sidre::Group* SHCXX_rv = SH_this->createGroup(SH_path); + // splicer begin class.Group.method.create_group_bufferify + const std::string SHCXX_path(path, Lpath); + axom::sidre::Group* SHCXX_rv = SH_this->createGroup(SHCXX_path); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.create_group_bufferify + // splicer end class.Group.method.create_group_bufferify } -void SIDRE_group_destroy_group_name(SIDRE_group* self, const char* path) +void SIDRE_Group_destroy_group_name(SIDRE_Group* self, const char* path) { -// splicer begin class.Group.method.destroy_group_name axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path); - SH_this->destroyGroup(SH_path); + // splicer begin class.Group.method.destroy_group_name + const std::string SHCXX_path(path); + SH_this->destroyGroup(SHCXX_path); return; -// splicer end class.Group.method.destroy_group_name + // splicer end class.Group.method.destroy_group_name } -void SIDRE_group_destroy_group_name_bufferify(SIDRE_group* self, +void SIDRE_Group_destroy_group_name_bufferify(SIDRE_Group* self, const char* path, int Lpath) { -// splicer begin class.Group.method.destroy_group_name_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_path(path, Lpath); - SH_this->destroyGroup(SH_path); + // splicer begin class.Group.method.destroy_group_name_bufferify + const std::string SHCXX_path(path, Lpath); + SH_this->destroyGroup(SHCXX_path); return; -// splicer end class.Group.method.destroy_group_name_bufferify + // splicer end class.Group.method.destroy_group_name_bufferify } -void SIDRE_group_destroy_group_index(SIDRE_group* self, SIDRE_IndexType idx) +void SIDRE_Group_destroy_group_index(SIDRE_Group* self, SIDRE_IndexType idx) { -// splicer begin class.Group.method.destroy_group_index axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.destroy_group_index SH_this->destroyGroup(idx); return; -// splicer end class.Group.method.destroy_group_index + // splicer end class.Group.method.destroy_group_index } -SIDRE_group* SIDRE_group_move_group(SIDRE_group* self, SIDRE_group* grp, - SIDRE_group* SHC_rv) +SIDRE_Group* SIDRE_Group_move_group(SIDRE_Group* self, SIDRE_Group* grp, + SIDRE_Group* SHC_rv) { -// splicer begin class.Group.method.move_group axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.move_group axom::sidre::Group* SHCXX_grp = static_cast(grp->addr); axom::sidre::Group* SHCXX_rv = SH_this->moveGroup(SHCXX_grp); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.Group.method.move_group + // splicer end class.Group.method.move_group } -void SIDRE_group_print(const SIDRE_group* self) +void SIDRE_Group_print(const SIDRE_Group* self) { -// splicer begin class.Group.method.print const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.print SH_this->print(); return; -// splicer end class.Group.method.print + // splicer end class.Group.method.print } -bool SIDRE_group_is_equivalent_to(const SIDRE_group* self, - const SIDRE_group* other) +bool SIDRE_Group_is_equivalent_to(const SIDRE_Group* self, SIDRE_Group* other) { -// splicer begin class.Group.method.is_equivalent_to const axom::sidre::Group* SH_this = static_cast(self->addr); + // splicer begin class.Group.method.is_equivalent_to const axom::sidre::Group* SHCXX_other = static_cast(other->addr); bool SHC_rv = SH_this->isEquivalentTo(SHCXX_other); return SHC_rv; -// splicer end class.Group.method.is_equivalent_to + // splicer end class.Group.method.is_equivalent_to } -void SIDRE_group_save(const SIDRE_group* self, const char* file_path, +void SIDRE_Group_save(const SIDRE_Group* self, const char* file_path, const char* protocol) { -// splicer begin class.Group.method.save const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path); - const std::string SH_protocol(protocol); - SH_this->save(SH_file_path, SH_protocol); + // splicer begin class.Group.method.save + const std::string SHCXX_file_path(file_path); + const std::string SHCXX_protocol(protocol); + SH_this->save(SHCXX_file_path, SHCXX_protocol); return; -// splicer end class.Group.method.save + // splicer end class.Group.method.save } -void SIDRE_group_save_bufferify(const SIDRE_group* self, const char* file_path, +void SIDRE_Group_save_bufferify(const SIDRE_Group* self, const char* file_path, int Lfile_path, const char* protocol, int Lprotocol) { -// splicer begin class.Group.method.save_bufferify const axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path, Lfile_path); - const std::string SH_protocol(protocol, Lprotocol); - SH_this->save(SH_file_path, SH_protocol); + // splicer begin class.Group.method.save_bufferify + const std::string SHCXX_file_path(file_path, Lfile_path); + const std::string SHCXX_protocol(protocol, Lprotocol); + SH_this->save(SHCXX_file_path, SHCXX_protocol); return; -// splicer end class.Group.method.save_bufferify + // splicer end class.Group.method.save_bufferify } -void SIDRE_group_load_0(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_0(SIDRE_Group* self, const char* file_path, const char* protocol) { -// splicer begin class.Group.method.load_0 axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path); - const std::string SH_protocol(protocol); - SH_this->load(SH_file_path, SH_protocol); + // splicer begin class.Group.method.load_0 + const std::string SHCXX_file_path(file_path); + const std::string SHCXX_protocol(protocol); + SH_this->load(SHCXX_file_path, SHCXX_protocol); return; -// splicer end class.Group.method.load_0 + // splicer end class.Group.method.load_0 } -void SIDRE_group_load_0_bufferify(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_0_bufferify(SIDRE_Group* self, const char* file_path, int Lfile_path, const char* protocol, int Lprotocol) { -// splicer begin class.Group.method.load_0_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path, Lfile_path); - const std::string SH_protocol(protocol, Lprotocol); - SH_this->load(SH_file_path, SH_protocol); + // splicer begin class.Group.method.load_0_bufferify + const std::string SHCXX_file_path(file_path, Lfile_path); + const std::string SHCXX_protocol(protocol, Lprotocol); + SH_this->load(SHCXX_file_path, SHCXX_protocol); return; -// splicer end class.Group.method.load_0_bufferify + // splicer end class.Group.method.load_0_bufferify } -void SIDRE_group_load_1(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_1(SIDRE_Group* self, const char* file_path, const char* protocol, bool preserve_contents) { -// splicer begin class.Group.method.load_1 axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path); - const std::string SH_protocol(protocol); - SH_this->load(SH_file_path, SH_protocol, preserve_contents); + // splicer begin class.Group.method.load_1 + const std::string SHCXX_file_path(file_path); + const std::string SHCXX_protocol(protocol); + SH_this->load(SHCXX_file_path, SHCXX_protocol, preserve_contents); return; -// splicer end class.Group.method.load_1 + // splicer end class.Group.method.load_1 } -void SIDRE_group_load_1_bufferify(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_1_bufferify(SIDRE_Group* self, const char* file_path, int Lfile_path, const char* protocol, int Lprotocol, bool preserve_contents) { -// splicer begin class.Group.method.load_1_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path, Lfile_path); - const std::string SH_protocol(protocol, Lprotocol); - SH_this->load(SH_file_path, SH_protocol, preserve_contents); + // splicer begin class.Group.method.load_1_bufferify + const std::string SHCXX_file_path(file_path, Lfile_path); + const std::string SHCXX_protocol(protocol, Lprotocol); + SH_this->load(SHCXX_file_path, SHCXX_protocol, preserve_contents); return; -// splicer end class.Group.method.load_1_bufferify + // splicer end class.Group.method.load_1_bufferify } -void SIDRE_group_load_external_data(SIDRE_group* self, const char* file_path) +void SIDRE_Group_load_external_data(SIDRE_Group* self, const char* file_path) { -// splicer begin class.Group.method.load_external_data axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path); - SH_this->loadExternalData(SH_file_path); + // splicer begin class.Group.method.load_external_data + const std::string SHCXX_file_path(file_path); + SH_this->loadExternalData(SHCXX_file_path); return; -// splicer end class.Group.method.load_external_data + // splicer end class.Group.method.load_external_data } -void SIDRE_group_load_external_data_bufferify(SIDRE_group* self, +void SIDRE_Group_load_external_data_bufferify(SIDRE_Group* self, const char* file_path, int Lfile_path) { -// splicer begin class.Group.method.load_external_data_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_file_path(file_path, Lfile_path); - SH_this->loadExternalData(SH_file_path); + // splicer begin class.Group.method.load_external_data_bufferify + const std::string SHCXX_file_path(file_path, Lfile_path); + SH_this->loadExternalData(SHCXX_file_path); return; -// splicer end class.Group.method.load_external_data_bufferify + // splicer end class.Group.method.load_external_data_bufferify } -bool SIDRE_group_rename(SIDRE_group* self, const char* new_name) +bool SIDRE_Group_rename(SIDRE_Group* self, const char* new_name) { -// splicer begin class.Group.method.rename axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_new_name(new_name); - bool SHC_rv = SH_this->rename(SH_new_name); + // splicer begin class.Group.method.rename + const std::string SHCXX_new_name(new_name); + bool SHC_rv = SH_this->rename(SHCXX_new_name); return SHC_rv; -// splicer end class.Group.method.rename + // splicer end class.Group.method.rename } -bool SIDRE_group_rename_bufferify(SIDRE_group* self, const char* new_name, +bool SIDRE_Group_rename_bufferify(SIDRE_Group* self, const char* new_name, int Lnew_name) { -// splicer begin class.Group.method.rename_bufferify axom::sidre::Group* SH_this = static_cast(self->addr); - const std::string SH_new_name(new_name, Lnew_name); - bool SHC_rv = SH_this->rename(SH_new_name); + // splicer begin class.Group.method.rename_bufferify + const std::string SHCXX_new_name(new_name, Lnew_name); + bool SHC_rv = SH_this->rename(SHCXX_new_name); return SHC_rv; -// splicer end class.Group.method.rename_bufferify + // splicer end class.Group.method.rename_bufferify } } // extern "C" diff --git a/src/axom/sidre/interface/c_fortran/wrapGroup.h b/src/axom/sidre/interface/c_fortran/wrapGroup.h index 94910d3544..ed036da163 100644 --- a/src/axom/sidre/interface/c_fortran/wrapGroup.h +++ b/src/axom/sidre/interface/c_fortran/wrapGroup.h @@ -14,9 +14,16 @@ #ifndef WRAPGROUP_H #define WRAPGROUP_H +#include "typesSidre.h" +#ifdef __cplusplus +#include +#include +#include "axom/sidre/core/SidreTypes.hpp" +#else +#include #include #include "axom/sidre/interface/SidreTypes.h" -#include "typesSidre.h" +#endif // splicer begin class.Group.CXX_declarations // splicer end class.Group.CXX_declarations @@ -28,349 +35,348 @@ extern "C" { // splicer begin class.Group.C_declarations // splicer end class.Group.C_declarations -SIDRE_IndexType SIDRE_group_get_index(SIDRE_group* self); +SIDRE_IndexType SIDRE_Group_get_index(SIDRE_Group* self); -const char* SIDRE_group_get_name(const SIDRE_group* self); +const char* SIDRE_Group_get_name(const SIDRE_Group* self); -void SIDRE_group_get_name_bufferify(const SIDRE_group* self, char* SHF_rv, +void SIDRE_Group_get_name_bufferify(const SIDRE_Group* self, char* SHF_rv, int NSHF_rv); -void SIDRE_group_get_path_bufferify(const SIDRE_group* self, char* SHF_rv, +void SIDRE_Group_get_path_bufferify(const SIDRE_Group* self, char* SHF_rv, int NSHF_rv); -void SIDRE_group_get_path_name_bufferify(const SIDRE_group* self, char* SHF_rv, +void SIDRE_Group_get_path_name_bufferify(const SIDRE_Group* self, char* SHF_rv, int NSHF_rv); -SIDRE_group* SIDRE_group_get_parent(const SIDRE_group* self, - SIDRE_group* SHC_rv); +SIDRE_Group* SIDRE_Group_get_parent(const SIDRE_Group* self, + SIDRE_Group* SHC_rv); -size_t SIDRE_group_get_num_groups(const SIDRE_group* self); +size_t SIDRE_Group_get_num_groups(const SIDRE_Group* self); -size_t SIDRE_group_get_num_views(const SIDRE_group* self); +size_t SIDRE_Group_get_num_views(const SIDRE_Group* self); -SIDRE_datastore* SIDRE_group_get_data_store(const SIDRE_group* self, - SIDRE_datastore* SHC_rv); +SIDRE_DataStore* SIDRE_Group_get_data_store(const SIDRE_Group* self, + SIDRE_DataStore* SHC_rv); -bool SIDRE_group_has_view(const SIDRE_group* self, const char* path); +bool SIDRE_Group_has_view(const SIDRE_Group* self, const char* path); -bool SIDRE_group_has_view_bufferify(const SIDRE_group* self, const char* path, +bool SIDRE_Group_has_view_bufferify(const SIDRE_Group* self, const char* path, int Lpath); -bool SIDRE_group_has_child_view(const SIDRE_group* self, const char* name); +bool SIDRE_Group_has_child_view(const SIDRE_Group* self, const char* name); -bool SIDRE_group_has_child_view_bufferify(const SIDRE_group* self, +bool SIDRE_Group_has_child_view_bufferify(const SIDRE_Group* self, const char* name, int Lname); -SIDRE_IndexType SIDRE_group_get_view_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_view_index(const SIDRE_Group* self, const char* name); -SIDRE_IndexType SIDRE_group_get_view_index_bufferify(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_view_index_bufferify(const SIDRE_Group* self, const char* name, int Lname); -const char* SIDRE_group_get_view_name(const SIDRE_group* self, +const char* SIDRE_Group_get_view_name(const SIDRE_Group* self, SIDRE_IndexType idx); -void SIDRE_group_get_view_name_bufferify(const SIDRE_group* self, +void SIDRE_Group_get_view_name_bufferify(const SIDRE_Group* self, SIDRE_IndexType idx, char* SHF_rv, int NSHF_rv); -SIDRE_view* SIDRE_group_get_view_from_name(SIDRE_group* self, const char* path, - SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_get_view_from_name(SIDRE_Group* self, const char* path, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_get_view_from_name_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_get_view_from_name_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_get_view_from_index(SIDRE_group* self, +SIDRE_View* SIDRE_Group_get_view_from_index(SIDRE_Group* self, const SIDRE_IndexType idx, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_IndexType SIDRE_group_get_first_valid_view_index(const SIDRE_group* self); +SIDRE_IndexType SIDRE_Group_get_first_valid_view_index(const SIDRE_Group* self); -SIDRE_IndexType SIDRE_group_get_next_valid_view_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_next_valid_view_index(const SIDRE_Group* self, SIDRE_IndexType idx); -SIDRE_view* SIDRE_group_create_view_empty(SIDRE_group* self, const char* path, - SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_empty(SIDRE_Group* self, const char* path, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_empty_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_empty_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_type(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type(SIDRE_Group* self, const char* path, int type, SIDRE_IndexType num_elems, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_type_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type_bufferify(SIDRE_Group* self, const char* path, int Lpath, int type, SIDRE_IndexType num_elems, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_shape(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape(SIDRE_Group* self, const char* path, int type, int ndims, SIDRE_IndexType* shape, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_shape_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape_bufferify(SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, SIDRE_IndexType* shape, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_into_buffer(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_into_buffer(SIDRE_Group* self, const char* path, - SIDRE_buffer* buff, - SIDRE_view* SHC_rv); + SIDRE_Buffer* buff, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_into_buffer_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_into_buffer_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_buffer* buff, - SIDRE_view* SHC_rv); + SIDRE_Buffer* buff, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_type_and_buffer(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type_and_buffer(SIDRE_Group* self, const char* path, int type, - SIDRE_IndexType num_elems, SIDRE_buffer* buff, - SIDRE_view* SHC_rv); + SIDRE_IndexType num_elems, SIDRE_Buffer* buff, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_type_and_buffer_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, - SIDRE_IndexType num_elems, SIDRE_buffer* buff, SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_from_type_and_buffer_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, + SIDRE_IndexType num_elems, SIDRE_Buffer* buff, SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_shape_and_buffer(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape_and_buffer(SIDRE_Group* self, const char* path, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_buffer* buff, - SIDRE_view* SHC_rv); + SIDRE_IndexType* shape, SIDRE_Buffer* buff, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_shape_and_buffer_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_buffer* buff, SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_from_shape_and_buffer_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, + SIDRE_IndexType* shape, SIDRE_Buffer* buff, SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_external(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_external(SIDRE_Group* self, const char* path, void* external_ptr, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_external_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_external_bufferify(SIDRE_Group* self, const char* path, int Lpath, void* external_ptr, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_type_external(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_type_external(SIDRE_Group* self, const char* path, int type, SIDRE_IndexType num_elems, void* external_ptr, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_type_external_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, - SIDRE_IndexType num_elems, void* external_ptr, SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_from_type_external_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, + SIDRE_IndexType num_elems, void* external_ptr, SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_shape_external(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_from_shape_external(SIDRE_Group* self, const char* path, int type, int ndims, SIDRE_IndexType* shape, void* external_ptr, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_from_shape_external_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, int ndims, - SIDRE_IndexType* shape, void* external_ptr, SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_from_shape_external_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, + SIDRE_IndexType* shape, void* external_ptr, SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_and_allocate_nelems(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_and_allocate_nelems(SIDRE_Group* self, const char* path, int type, SIDRE_IndexType num_elems, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_and_allocate_nelems_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, - SIDRE_IndexType num_elems, SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_and_allocate_nelems_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, + SIDRE_IndexType num_elems, SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_and_allocate_shape(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_and_allocate_shape(SIDRE_Group* self, const char* path, int type, int ndims, SIDRE_IndexType* shape, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_and_allocate_shape_bufferify( - SIDRE_group* self, const char* path, int Lpath, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_create_view_and_allocate_shape_bufferify( + SIDRE_Group* self, const char* path, int Lpath, int type, int ndims, + SIDRE_IndexType* shape, SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_int(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_int(SIDRE_Group* self, const char* path, int value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_int_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_int(SIDRE_Group* self, const char* path, int Lpath, int value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_long(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_long(SIDRE_Group* self, const char* path, long value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_long_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_long(SIDRE_Group* self, const char* path, int Lpath, long value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_float(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_float(SIDRE_Group* self, const char* path, float value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_float_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_float(SIDRE_Group* self, const char* path, int Lpath, float value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_double(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_double(SIDRE_Group* self, const char* path, double value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_scalar_double_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_scalar_bufferify_double(SIDRE_Group* self, const char* path, int Lpath, double value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_string(SIDRE_group* self, const char* path, +SIDRE_View* SIDRE_Group_create_view_string(SIDRE_Group* self, const char* path, const char* value, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_create_view_string_bufferify(SIDRE_group* self, +SIDRE_View* SIDRE_Group_create_view_string_bufferify(SIDRE_Group* self, const char* path, int Lpath, const char* value, int Lvalue, - SIDRE_view* SHC_rv); + SIDRE_View* SHC_rv); -void SIDRE_group_destroy_view(SIDRE_group* self, const char* path); +void SIDRE_Group_destroy_view(SIDRE_Group* self, const char* path); -void SIDRE_group_destroy_view_bufferify(SIDRE_group* self, const char* path, +void SIDRE_Group_destroy_view_bufferify(SIDRE_Group* self, const char* path, int Lpath); -void SIDRE_group_destroy_view_and_data_name(SIDRE_group* self, +void SIDRE_Group_destroy_view_and_data_name(SIDRE_Group* self, const char* path); -void SIDRE_group_destroy_view_and_data_name_bufferify(SIDRE_group* self, +void SIDRE_Group_destroy_view_and_data_name_bufferify(SIDRE_Group* self, const char* path, int Lpath); -void SIDRE_group_destroy_view_and_data_index(SIDRE_group* self, +void SIDRE_Group_destroy_view_and_data_index(SIDRE_Group* self, SIDRE_IndexType idx); -SIDRE_view* SIDRE_group_move_view(SIDRE_group* self, SIDRE_view* view, - SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_move_view(SIDRE_Group* self, SIDRE_View* view, + SIDRE_View* SHC_rv); -SIDRE_view* SIDRE_group_copy_view(SIDRE_group* self, SIDRE_view* view, - SIDRE_view* SHC_rv); +SIDRE_View* SIDRE_Group_copy_view(SIDRE_Group* self, SIDRE_View* view, + SIDRE_View* SHC_rv); -bool SIDRE_group_has_group(SIDRE_group* self, const char* path); +bool SIDRE_Group_has_group(SIDRE_Group* self, const char* path); -bool SIDRE_group_has_group_bufferify(SIDRE_group* self, const char* path, +bool SIDRE_Group_has_group_bufferify(SIDRE_Group* self, const char* path, int Lpath); -bool SIDRE_group_has_child_group(SIDRE_group* self, const char* name); +bool SIDRE_Group_has_child_group(SIDRE_Group* self, const char* name); -bool SIDRE_group_has_child_group_bufferify(SIDRE_group* self, const char* name, +bool SIDRE_Group_has_child_group_bufferify(SIDRE_Group* self, const char* name, int Lname); -SIDRE_IndexType SIDRE_group_get_group_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_group_index(const SIDRE_Group* self, const char* name); -SIDRE_IndexType SIDRE_group_get_group_index_bufferify(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_group_index_bufferify(const SIDRE_Group* self, const char* name, int Lname); -const char* SIDRE_group_get_group_name(const SIDRE_group* self, +const char* SIDRE_Group_get_group_name(const SIDRE_Group* self, SIDRE_IndexType idx); -void SIDRE_group_get_group_name_bufferify(const SIDRE_group* self, +void SIDRE_Group_get_group_name_bufferify(const SIDRE_Group* self, SIDRE_IndexType idx, char* SHF_rv, int NSHF_rv); -SIDRE_group* SIDRE_group_get_group_from_name(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_get_group_from_name(SIDRE_Group* self, const char* path, - SIDRE_group* SHC_rv); + SIDRE_Group* SHC_rv); -SIDRE_group* SIDRE_group_get_group_from_name_bufferify(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_get_group_from_name_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_group* SHC_rv); + SIDRE_Group* SHC_rv); -SIDRE_group* SIDRE_group_get_group_from_index(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_get_group_from_index(SIDRE_Group* self, SIDRE_IndexType idx, - SIDRE_group* SHC_rv); + SIDRE_Group* SHC_rv); -SIDRE_IndexType SIDRE_group_get_first_valid_group_index(const SIDRE_group* self); +SIDRE_IndexType SIDRE_Group_get_first_valid_group_index(const SIDRE_Group* self); -SIDRE_IndexType SIDRE_group_get_next_valid_group_index(const SIDRE_group* self, +SIDRE_IndexType SIDRE_Group_get_next_valid_group_index(const SIDRE_Group* self, SIDRE_IndexType idx); -SIDRE_group* SIDRE_group_create_group(SIDRE_group* self, const char* path, - SIDRE_group* SHC_rv); +SIDRE_Group* SIDRE_Group_create_group(SIDRE_Group* self, const char* path, + SIDRE_Group* SHC_rv); -SIDRE_group* SIDRE_group_create_group_bufferify(SIDRE_group* self, +SIDRE_Group* SIDRE_Group_create_group_bufferify(SIDRE_Group* self, const char* path, int Lpath, - SIDRE_group* SHC_rv); + SIDRE_Group* SHC_rv); -void SIDRE_group_destroy_group_name(SIDRE_group* self, const char* path); +void SIDRE_Group_destroy_group_name(SIDRE_Group* self, const char* path); -void SIDRE_group_destroy_group_name_bufferify(SIDRE_group* self, +void SIDRE_Group_destroy_group_name_bufferify(SIDRE_Group* self, const char* path, int Lpath); -void SIDRE_group_destroy_group_index(SIDRE_group* self, SIDRE_IndexType idx); +void SIDRE_Group_destroy_group_index(SIDRE_Group* self, SIDRE_IndexType idx); -SIDRE_group* SIDRE_group_move_group(SIDRE_group* self, SIDRE_group* grp, - SIDRE_group* SHC_rv); +SIDRE_Group* SIDRE_Group_move_group(SIDRE_Group* self, SIDRE_Group* grp, + SIDRE_Group* SHC_rv); -void SIDRE_group_print(const SIDRE_group* self); +void SIDRE_Group_print(const SIDRE_Group* self); -bool SIDRE_group_is_equivalent_to(const SIDRE_group* self, - const SIDRE_group* other); +bool SIDRE_Group_is_equivalent_to(const SIDRE_Group* self, SIDRE_Group* other); -void SIDRE_group_save(const SIDRE_group* self, const char* file_path, +void SIDRE_Group_save(const SIDRE_Group* self, const char* file_path, const char* protocol); -void SIDRE_group_save_bufferify(const SIDRE_group* self, const char* file_path, +void SIDRE_Group_save_bufferify(const SIDRE_Group* self, const char* file_path, int Lfile_path, const char* protocol, int Lprotocol); -void SIDRE_group_load_0(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_0(SIDRE_Group* self, const char* file_path, const char* protocol); -void SIDRE_group_load_0_bufferify(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_0_bufferify(SIDRE_Group* self, const char* file_path, int Lfile_path, const char* protocol, int Lprotocol); -void SIDRE_group_load_1(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_1(SIDRE_Group* self, const char* file_path, const char* protocol, bool preserve_contents); -void SIDRE_group_load_1_bufferify(SIDRE_group* self, const char* file_path, +void SIDRE_Group_load_1_bufferify(SIDRE_Group* self, const char* file_path, int Lfile_path, const char* protocol, int Lprotocol, bool preserve_contents); -void SIDRE_group_load_external_data(SIDRE_group* self, const char* file_path); +void SIDRE_Group_load_external_data(SIDRE_Group* self, const char* file_path); -void SIDRE_group_load_external_data_bufferify(SIDRE_group* self, +void SIDRE_Group_load_external_data_bufferify(SIDRE_Group* self, const char* file_path, int Lfile_path); -bool SIDRE_group_rename(SIDRE_group* self, const char* new_name); +bool SIDRE_Group_rename(SIDRE_Group* self, const char* new_name); -bool SIDRE_group_rename_bufferify(SIDRE_group* self, const char* new_name, +bool SIDRE_Group_rename_bufferify(SIDRE_Group* self, const char* new_name, int Lnew_name); #ifdef __cplusplus diff --git a/src/axom/sidre/interface/c_fortran/wrapSidre.cpp b/src/axom/sidre/interface/c_fortran/wrapSidre.cpp index 316940143f..640e16cde8 100644 --- a/src/axom/sidre/interface/c_fortran/wrapSidre.cpp +++ b/src/axom/sidre/interface/c_fortran/wrapSidre.cpp @@ -6,11 +6,12 @@ // // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapSidre.h" -#include +#include #include -#include "axom/sidre/core/DataStore.hpp" #include "typesSidre.h" +#include "axom/sidre/core/DataStore.hpp" + // splicer begin CXX_definitions // splicer end CXX_definitions @@ -43,13 +44,13 @@ void sidre_c_loc_(void* addr, void** out) bool SIDRE_name_is_valid(const char* name) { -// splicer begin function.name_is_valid + // splicer begin function.name_is_valid return name != NULL; -// splicer end function.name_is_valid + // splicer end function.name_is_valid } -// Release C++ allocated memory. -void SIDRE_SHROUD_memory_destructor(SID_SHROUD_capsule_data* cap) +// Release library allocated memory. +void SIDRE_SHROUD_memory_destructor(SIDRE_SHROUD_capsule_data* cap) { void* ptr = cap->addr; switch (cap->idtor) diff --git a/src/axom/sidre/interface/c_fortran/wrapSidre.h b/src/axom/sidre/interface/c_fortran/wrapSidre.h index b1737e5fb6..7b7301a048 100644 --- a/src/axom/sidre/interface/c_fortran/wrapSidre.h +++ b/src/axom/sidre/interface/c_fortran/wrapSidre.h @@ -7,7 +7,7 @@ // SPDX-License-Identifier: (BSD-3-Clause) /** * \file wrapSidre.h - * \brief Shroud generated wrapper for Sidre library + * \brief Shroud generated wrapper for sidre namespace */ // For C users and C++ implementation @@ -15,6 +15,9 @@ #define WRAPSIDRE_H #include "typesSidre.h" +#ifndef __cplusplus +#include +#endif // splicer begin CXX_declarations // splicer end CXX_declarations diff --git a/src/axom/sidre/interface/c_fortran/wrapView.cpp b/src/axom/sidre/interface/c_fortran/wrapView.cpp index 10c930cc82..2f5a3f6390 100644 --- a/src/axom/sidre/interface/c_fortran/wrapView.cpp +++ b/src/axom/sidre/interface/c_fortran/wrapView.cpp @@ -7,12 +7,11 @@ // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapView.h" #include -#include #include #include "axom/sidre/core/Buffer.hpp" #include "axom/sidre/core/Group.hpp" -#include "axom/sidre/core/SidreTypes.hpp" #include "axom/sidre/core/View.hpp" +#include "axom/sidre/interface/SidreTypes.h" // splicer begin class.View.CXX_definitions // splicer end class.View.CXX_definitions @@ -26,629 +25,631 @@ extern "C" { // dest will not be NULL terminated. static void ShroudStrCopy(char* dest, int ndest, const char* src, int nsrc) { - int nm = nsrc < ndest ? nsrc : ndest; - std::memcpy(dest,src,nm); - if(ndest > nm) - std::memset(dest+nm,' ',ndest-nm); + if (src == NULL) + { + std::memset(dest,' ',ndest); // convert NULL pointer to blank filled string + } + else + { + if (nsrc < 0) + nsrc = std::strlen(src); + int nm = nsrc < ndest ? nsrc : ndest; + std::memcpy(dest,src,nm); + if(ndest > nm) + std::memset(dest+nm,' ',ndest-nm); // blank fill + } } // splicer begin class.View.C_definitions // splicer end class.View.C_definitions -SIDRE_IndexType SIDRE_view_get_index(SIDRE_view* self) +SIDRE_IndexType SIDRE_View_get_index(SIDRE_View* self) { -// splicer begin class.View.method.get_index axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_index axom::sidre::IndexType SHC_rv = SH_this->getIndex(); return SHC_rv; -// splicer end class.View.method.get_index + // splicer end class.View.method.get_index } -const char* SIDRE_view_get_name(const SIDRE_view* self) +const char* SIDRE_View_get_name(const SIDRE_View* self) { -// splicer begin class.View.method.get_name const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_name const std::string & SHCXX_rv = SH_this->getName(); const char* SHC_rv = SHCXX_rv.c_str(); return SHC_rv; -// splicer end class.View.method.get_name + // splicer end class.View.method.get_name } -void SIDRE_view_get_name_bufferify(const SIDRE_view* self, char* SHF_rv, +void SIDRE_View_get_name_bufferify(const SIDRE_View* self, char* SHF_rv, int NSHF_rv) { -// splicer begin class.View.method.get_name_bufferify const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_name_bufferify const std::string & SHCXX_rv = SH_this->getName(); if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.View.method.get_name_bufferify + // splicer end class.View.method.get_name_bufferify } -void SIDRE_view_get_path_bufferify(const SIDRE_view* self, char* SHF_rv, +void SIDRE_View_get_path_bufferify(const SIDRE_View* self, char* SHF_rv, int NSHF_rv) { -// splicer begin class.View.method.get_path_bufferify const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_path_bufferify std::string SHCXX_rv = SH_this->getPath(); if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.View.method.get_path_bufferify + // splicer end class.View.method.get_path_bufferify } -void SIDRE_view_get_path_name_bufferify(const SIDRE_view* self, char* SHF_rv, +void SIDRE_View_get_path_name_bufferify(const SIDRE_View* self, char* SHF_rv, int NSHF_rv) { -// splicer begin class.View.method.get_path_name_bufferify const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_path_name_bufferify std::string SHCXX_rv = SH_this->getPathName(); if (SHCXX_rv.empty()) { - std::memset(SHF_rv, ' ', NSHF_rv); + ShroudStrCopy(SHF_rv, NSHF_rv, NULL, 0); } else { ShroudStrCopy(SHF_rv, NSHF_rv, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end class.View.method.get_path_name_bufferify + // splicer end class.View.method.get_path_name_bufferify } -SIDRE_group* SIDRE_view_get_owning_group(SIDRE_view* self, SIDRE_group* SHC_rv) +SIDRE_Group* SIDRE_View_get_owning_group(SIDRE_View* self, SIDRE_Group* SHC_rv) { -// splicer begin class.View.method.get_owning_group axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_owning_group axom::sidre::Group* SHCXX_rv = SH_this->getOwningGroup(); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.View.method.get_owning_group + // splicer end class.View.method.get_owning_group } -bool SIDRE_view_has_buffer(const SIDRE_view* self) +bool SIDRE_View_has_buffer(const SIDRE_View* self) { -// splicer begin class.View.method.has_buffer const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.has_buffer bool SHC_rv = SH_this->hasBuffer(); return SHC_rv; -// splicer end class.View.method.has_buffer + // splicer end class.View.method.has_buffer } -SIDRE_buffer* SIDRE_view_get_buffer(SIDRE_view* self, SIDRE_buffer* SHC_rv) +SIDRE_Buffer* SIDRE_View_get_buffer(SIDRE_View* self, SIDRE_Buffer* SHC_rv) { -// splicer begin class.View.method.get_buffer axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_buffer axom::sidre::Buffer* SHCXX_rv = SH_this->getBuffer(); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.View.method.get_buffer + // splicer end class.View.method.get_buffer } -bool SIDRE_view_is_external(const SIDRE_view* self) +bool SIDRE_View_is_external(const SIDRE_View* self) { -// splicer begin class.View.method.is_external const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_external bool SHC_rv = SH_this->isExternal(); return SHC_rv; -// splicer end class.View.method.is_external + // splicer end class.View.method.is_external } -bool SIDRE_view_is_allocated(SIDRE_view* self) +bool SIDRE_View_is_allocated(SIDRE_View* self) { -// splicer begin class.View.method.is_allocated axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_allocated bool SHC_rv = SH_this->isAllocated(); return SHC_rv; -// splicer end class.View.method.is_allocated + // splicer end class.View.method.is_allocated } -bool SIDRE_view_is_applied(const SIDRE_view* self) +bool SIDRE_View_is_applied(const SIDRE_View* self) { -// splicer begin class.View.method.is_applied const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_applied bool SHC_rv = SH_this->isApplied(); return SHC_rv; -// splicer end class.View.method.is_applied + // splicer end class.View.method.is_applied } -bool SIDRE_view_is_described(const SIDRE_view* self) +bool SIDRE_View_is_described(const SIDRE_View* self) { -// splicer begin class.View.method.is_described const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_described bool SHC_rv = SH_this->isDescribed(); return SHC_rv; -// splicer end class.View.method.is_described + // splicer end class.View.method.is_described } -bool SIDRE_view_is_empty(const SIDRE_view* self) +bool SIDRE_View_is_empty(const SIDRE_View* self) { -// splicer begin class.View.method.is_empty const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_empty bool SHC_rv = SH_this->isEmpty(); return SHC_rv; -// splicer end class.View.method.is_empty + // splicer end class.View.method.is_empty } -bool SIDRE_view_is_opaque(const SIDRE_view* self) +bool SIDRE_View_is_opaque(const SIDRE_View* self) { -// splicer begin class.View.method.is_opaque const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_opaque bool SHC_rv = SH_this->isOpaque(); return SHC_rv; -// splicer end class.View.method.is_opaque + // splicer end class.View.method.is_opaque } -bool SIDRE_view_is_scalar(const SIDRE_view* self) +bool SIDRE_View_is_scalar(const SIDRE_View* self) { -// splicer begin class.View.method.is_scalar const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_scalar bool SHC_rv = SH_this->isScalar(); return SHC_rv; -// splicer end class.View.method.is_scalar + // splicer end class.View.method.is_scalar } -bool SIDRE_view_is_string(const SIDRE_view* self) +bool SIDRE_View_is_string(const SIDRE_View* self) { -// splicer begin class.View.method.is_string const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.is_string bool SHC_rv = SH_this->isString(); return SHC_rv; -// splicer end class.View.method.is_string + // splicer end class.View.method.is_string } -int SIDRE_view_get_type_id(const SIDRE_view* self) +int SIDRE_View_get_type_id(const SIDRE_View* self) { -// splicer begin class.View.method.get_type_id const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_type_id axom::sidre::TypeID SHCXX_rv = SH_this->getTypeID(); int SHC_rv = static_cast(SHCXX_rv); return SHC_rv; -// splicer end class.View.method.get_type_id + // splicer end class.View.method.get_type_id } -size_t SIDRE_view_get_total_bytes(const SIDRE_view* self) +size_t SIDRE_View_get_total_bytes(const SIDRE_View* self) { -// splicer begin class.View.method.get_total_bytes const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_total_bytes size_t SHC_rv = SH_this->getTotalBytes(); return SHC_rv; -// splicer end class.View.method.get_total_bytes + // splicer end class.View.method.get_total_bytes } -size_t SIDRE_view_get_num_elements(const SIDRE_view* self) +size_t SIDRE_View_get_num_elements(const SIDRE_View* self) { -// splicer begin class.View.method.get_num_elements const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_num_elements size_t SHC_rv = SH_this->getNumElements(); return SHC_rv; -// splicer end class.View.method.get_num_elements + // splicer end class.View.method.get_num_elements } -size_t SIDRE_view_get_bytes_per_element(const SIDRE_view* self) +size_t SIDRE_View_get_bytes_per_element(const SIDRE_View* self) { -// splicer begin class.View.method.get_bytes_per_element const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_bytes_per_element size_t SHC_rv = SH_this->getBytesPerElement(); return SHC_rv; -// splicer end class.View.method.get_bytes_per_element + // splicer end class.View.method.get_bytes_per_element } -size_t SIDRE_view_get_offset(const SIDRE_view* self) +size_t SIDRE_View_get_offset(const SIDRE_View* self) { -// splicer begin class.View.method.get_offset const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_offset size_t SHC_rv = SH_this->getOffset(); return SHC_rv; -// splicer end class.View.method.get_offset + // splicer end class.View.method.get_offset } -size_t SIDRE_view_get_stride(const SIDRE_view* self) +size_t SIDRE_View_get_stride(const SIDRE_View* self) { -// splicer begin class.View.method.get_stride const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_stride size_t SHC_rv = SH_this->getStride(); return SHC_rv; -// splicer end class.View.method.get_stride + // splicer end class.View.method.get_stride } -int SIDRE_view_get_num_dimensions(const SIDRE_view* self) +int SIDRE_View_get_num_dimensions(const SIDRE_View* self) { -// splicer begin class.View.method.get_num_dimensions const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_num_dimensions int SHC_rv = SH_this->getNumDimensions(); return SHC_rv; -// splicer end class.View.method.get_num_dimensions + // splicer end class.View.method.get_num_dimensions } -int SIDRE_view_get_shape(const SIDRE_view* self, int ndims, +int SIDRE_View_get_shape(const SIDRE_View* self, int ndims, SIDRE_IndexType* shape) { -// splicer begin class.View.method.get_shape const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_shape int SHC_rv = SH_this->getShape(ndims, shape); return SHC_rv; -// splicer end class.View.method.get_shape + // splicer end class.View.method.get_shape } -void SIDRE_view_allocate_simple(SIDRE_view* self) +void SIDRE_View_allocate_simple(SIDRE_View* self) { -// splicer begin class.View.method.allocate_simple axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.allocate_simple SH_this->allocate(); return; -// splicer end class.View.method.allocate_simple + // splicer end class.View.method.allocate_simple } -void SIDRE_view_allocate_from_type(SIDRE_view* self, int type, +void SIDRE_View_allocate_from_type(SIDRE_View* self, int type, SIDRE_IndexType num_elems) { -// splicer begin class.View.method.allocate_from_type axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.allocate_from_type axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->allocate(SHCXX_type, num_elems); return; -// splicer end class.View.method.allocate_from_type + // splicer end class.View.method.allocate_from_type } -void SIDRE_view_reallocate(SIDRE_view* self, SIDRE_IndexType num_elems) +void SIDRE_View_reallocate(SIDRE_View* self, SIDRE_IndexType num_elems) { -// splicer begin class.View.method.reallocate axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.reallocate SH_this->reallocate(num_elems); return; -// splicer end class.View.method.reallocate + // splicer end class.View.method.reallocate } -void SIDRE_view_attach_buffer_only(SIDRE_view* self, SIDRE_buffer* buff) +void SIDRE_View_attach_buffer_only(SIDRE_View* self, SIDRE_Buffer* buff) { -// splicer begin class.View.method.attach_buffer_only axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.attach_buffer_only axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); SH_this->attachBuffer(SHCXX_buff); return; -// splicer end class.View.method.attach_buffer_only + // splicer end class.View.method.attach_buffer_only } -void SIDRE_view_attach_buffer_type(SIDRE_view* self, int type, +void SIDRE_View_attach_buffer_type(SIDRE_View* self, int type, SIDRE_IndexType num_elems, - SIDRE_buffer* buff) + SIDRE_Buffer* buff) { -// splicer begin class.View.method.attach_buffer_type axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.attach_buffer_type axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); SH_this->attachBuffer(SHCXX_type, num_elems, SHCXX_buff); return; -// splicer end class.View.method.attach_buffer_type + // splicer end class.View.method.attach_buffer_type } -void SIDRE_view_attach_buffer_shape(SIDRE_view* self, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_buffer* buff) +void SIDRE_View_attach_buffer_shape(SIDRE_View* self, int type, int ndims, + SIDRE_IndexType* shape, SIDRE_Buffer* buff) { -// splicer begin class.View.method.attach_buffer_shape axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.attach_buffer_shape axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); axom::sidre::Buffer* SHCXX_buff = static_cast(buff->addr); SH_this->attachBuffer(SHCXX_type, ndims, shape, SHCXX_buff); return; -// splicer end class.View.method.attach_buffer_shape + // splicer end class.View.method.attach_buffer_shape } -void SIDRE_view_apply_0(SIDRE_view* self) +void SIDRE_View_apply_0(SIDRE_View* self) { -// splicer begin class.View.method.apply_0 axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_0 SH_this->apply(); return; -// splicer end class.View.method.apply_0 + // splicer end class.View.method.apply_0 } -void SIDRE_view_apply_nelems(SIDRE_view* self, SIDRE_IndexType num_elems) +void SIDRE_View_apply_nelems(SIDRE_View* self, SIDRE_IndexType num_elems) { -// splicer begin class.View.method.apply_nelems axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_nelems SH_this->apply(num_elems); return; -// splicer end class.View.method.apply_nelems + // splicer end class.View.method.apply_nelems } -void SIDRE_view_apply_nelems_offset(SIDRE_view* self, SIDRE_IndexType num_elems, +void SIDRE_View_apply_nelems_offset(SIDRE_View* self, SIDRE_IndexType num_elems, SIDRE_IndexType offset) { -// splicer begin class.View.method.apply_nelems_offset axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_nelems_offset SH_this->apply(num_elems, offset); return; -// splicer end class.View.method.apply_nelems_offset + // splicer end class.View.method.apply_nelems_offset } -void SIDRE_view_apply_nelems_offset_stride(SIDRE_view* self, +void SIDRE_View_apply_nelems_offset_stride(SIDRE_View* self, SIDRE_IndexType num_elems, SIDRE_IndexType offset, SIDRE_IndexType stride) { -// splicer begin class.View.method.apply_nelems_offset_stride axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_nelems_offset_stride SH_this->apply(num_elems, offset, stride); return; -// splicer end class.View.method.apply_nelems_offset_stride + // splicer end class.View.method.apply_nelems_offset_stride } -void SIDRE_view_apply_type_nelems(SIDRE_view* self, int type, +void SIDRE_View_apply_type_nelems(SIDRE_View* self, int type, SIDRE_IndexType num_elems) { -// splicer begin class.View.method.apply_type_nelems axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_type_nelems axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->apply(SHCXX_type, num_elems); return; -// splicer end class.View.method.apply_type_nelems + // splicer end class.View.method.apply_type_nelems } -void SIDRE_view_apply_type_nelems_offset(SIDRE_view* self, int type, +void SIDRE_View_apply_type_nelems_offset(SIDRE_View* self, int type, SIDRE_IndexType num_elems, SIDRE_IndexType offset) { -// splicer begin class.View.method.apply_type_nelems_offset axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_type_nelems_offset axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->apply(SHCXX_type, num_elems, offset); return; -// splicer end class.View.method.apply_type_nelems_offset + // splicer end class.View.method.apply_type_nelems_offset } -void SIDRE_view_apply_type_nelems_offset_stride(SIDRE_view* self, int type, +void SIDRE_View_apply_type_nelems_offset_stride(SIDRE_View* self, int type, SIDRE_IndexType num_elems, SIDRE_IndexType offset, SIDRE_IndexType stride) { -// splicer begin class.View.method.apply_type_nelems_offset_stride axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_type_nelems_offset_stride axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->apply(SHCXX_type, num_elems, offset, stride); return; -// splicer end class.View.method.apply_type_nelems_offset_stride + // splicer end class.View.method.apply_type_nelems_offset_stride } -void SIDRE_view_apply_type_shape(SIDRE_view* self, int type, int ndims, +void SIDRE_View_apply_type_shape(SIDRE_View* self, int type, int ndims, SIDRE_IndexType* shape) { -// splicer begin class.View.method.apply_type_shape axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.apply_type_shape axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->apply(SHCXX_type, ndims, shape); return; -// splicer end class.View.method.apply_type_shape + // splicer end class.View.method.apply_type_shape } -void SIDRE_view_set_scalar_int(SIDRE_view* self, int value) +void SIDRE_View_set_scalar_int(SIDRE_View* self, int value) { -// splicer begin class.View.method.set_scalar_int axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_scalar_int SH_this->setScalar(value); return; -// splicer end class.View.method.set_scalar_int + // splicer end class.View.method.set_scalar_int } -void SIDRE_view_set_scalar_long(SIDRE_view* self, long value) +void SIDRE_View_set_scalar_long(SIDRE_View* self, long value) { -// splicer begin class.View.method.set_scalar_long axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_scalar_long SH_this->setScalar(value); return; -// splicer end class.View.method.set_scalar_long + // splicer end class.View.method.set_scalar_long } -void SIDRE_view_set_scalar_float(SIDRE_view* self, float value) +void SIDRE_View_set_scalar_float(SIDRE_View* self, float value) { -// splicer begin class.View.method.set_scalar_float axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_scalar_float SH_this->setScalar(value); return; -// splicer end class.View.method.set_scalar_float + // splicer end class.View.method.set_scalar_float } -void SIDRE_view_set_scalar_double(SIDRE_view* self, double value) +void SIDRE_View_set_scalar_double(SIDRE_View* self, double value) { -// splicer begin class.View.method.set_scalar_double axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_scalar_double SH_this->setScalar(value); return; -// splicer end class.View.method.set_scalar_double + // splicer end class.View.method.set_scalar_double } -void SIDRE_view_set_string(SIDRE_view* self, const char* value) +void SIDRE_View_set_string(SIDRE_View* self, const char* value) { -// splicer begin class.View.method.set_string axom::sidre::View* SH_this = static_cast(self->addr); - const std::string SH_value(value); - SH_this->setString(SH_value); + // splicer begin class.View.method.set_string + const std::string SHCXX_value(value); + SH_this->setString(SHCXX_value); return; -// splicer end class.View.method.set_string + // splicer end class.View.method.set_string } -void SIDRE_view_set_string_bufferify(SIDRE_view* self, const char* value, +void SIDRE_View_set_string_bufferify(SIDRE_View* self, const char* value, int Lvalue) { -// splicer begin class.View.method.set_string_bufferify axom::sidre::View* SH_this = static_cast(self->addr); - const std::string SH_value(value, Lvalue); - SH_this->setString(SH_value); + // splicer begin class.View.method.set_string_bufferify + const std::string SHCXX_value(value, Lvalue); + SH_this->setString(SHCXX_value); return; -// splicer end class.View.method.set_string_bufferify + // splicer end class.View.method.set_string_bufferify } -void SIDRE_view_set_external_data_ptr_only(SIDRE_view* self, void* external_ptr) +void SIDRE_View_set_external_data_ptr_only(SIDRE_View* self, void* external_ptr) { -// splicer begin class.View.method.set_external_data_ptr_only axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_external_data_ptr_only SH_this->setExternalDataPtr(external_ptr); return; -// splicer end class.View.method.set_external_data_ptr_only + // splicer end class.View.method.set_external_data_ptr_only } -void SIDRE_view_set_external_data_ptr_type(SIDRE_view* self, int type, +void SIDRE_View_set_external_data_ptr_type(SIDRE_View* self, int type, SIDRE_IndexType num_elems, void* external_ptr) { -// splicer begin class.View.method.set_external_data_ptr_type axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_external_data_ptr_type axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->setExternalDataPtr(SHCXX_type, num_elems, external_ptr); return; -// splicer end class.View.method.set_external_data_ptr_type + // splicer end class.View.method.set_external_data_ptr_type } -void SIDRE_view_set_external_data_ptr_shape(SIDRE_view* self, int type, +void SIDRE_View_set_external_data_ptr_shape(SIDRE_View* self, int type, int ndims, SIDRE_IndexType* shape, void* external_ptr) { -// splicer begin class.View.method.set_external_data_ptr_shape axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.set_external_data_ptr_shape axom::sidre::TypeID SHCXX_type = axom::sidre::getTypeID(type); SH_this->setExternalDataPtr(SHCXX_type, ndims, shape, external_ptr); return; -// splicer end class.View.method.set_external_data_ptr_shape + // splicer end class.View.method.set_external_data_ptr_shape } -const char* SIDRE_view_get_string(SIDRE_view* self) +const char* SIDRE_View_get_string(SIDRE_View* self) { -// splicer begin class.View.method.get_string axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_string const char* SHC_rv = SH_this->getString(); return SHC_rv; -// splicer end class.View.method.get_string + // splicer end class.View.method.get_string } -void SIDRE_view_get_string_bufferify(SIDRE_view* self, char* name, int Nname) +void SIDRE_View_get_string_bufferify(SIDRE_View* self, char* name, int Nname) { -// splicer begin class.View.method.get_string_bufferify axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_string_bufferify const char* SHC_rv = SH_this->getString(); - if (SHC_rv == NULL) - { - std::memset(name, ' ', Nname); - } - else - { - ShroudStrCopy(name, Nname, SHC_rv, std::strlen(SHC_rv)); - } + ShroudStrCopy(name, Nname, SHC_rv, -1); return; -// splicer end class.View.method.get_string_bufferify + // splicer end class.View.method.get_string_bufferify } -int SIDRE_view_get_data_int(SIDRE_view* self) +int SIDRE_View_get_data_int(SIDRE_View* self) { -// splicer begin class.View.method.get_data_int axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_data_int int SHC_rv = SH_this->getData(); return SHC_rv; -// splicer end class.View.method.get_data_int + // splicer end class.View.method.get_data_int } -long SIDRE_view_get_data_long(SIDRE_view* self) +long SIDRE_View_get_data_long(SIDRE_View* self) { -// splicer begin class.View.method.get_data_long axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_data_long long SHC_rv = SH_this->getData(); return SHC_rv; -// splicer end class.View.method.get_data_long + // splicer end class.View.method.get_data_long } -float SIDRE_view_get_data_float(SIDRE_view* self) +float SIDRE_View_get_data_float(SIDRE_View* self) { -// splicer begin class.View.method.get_data_float axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_data_float float SHC_rv = SH_this->getData(); return SHC_rv; -// splicer end class.View.method.get_data_float + // splicer end class.View.method.get_data_float } -double SIDRE_view_get_data_double(SIDRE_view* self) +double SIDRE_View_get_data_double(SIDRE_View* self) { -// splicer begin class.View.method.get_data_double axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_data_double double SHC_rv = SH_this->getData(); return SHC_rv; -// splicer end class.View.method.get_data_double + // splicer end class.View.method.get_data_double } -void* SIDRE_view_get_void_ptr(const SIDRE_view* self) +void* SIDRE_View_get_void_ptr(const SIDRE_View* self) { -// splicer begin class.View.method.get_void_ptr const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.get_void_ptr void* SHC_rv = SH_this->getVoidPtr(); return SHC_rv; -// splicer end class.View.method.get_void_ptr + // splicer end class.View.method.get_void_ptr } -void SIDRE_view_print(const SIDRE_view* self) +void SIDRE_View_print(const SIDRE_View* self) { -// splicer begin class.View.method.print const axom::sidre::View* SH_this = static_cast(self->addr); + // splicer begin class.View.method.print SH_this->print(); return; -// splicer end class.View.method.print + // splicer end class.View.method.print } -bool SIDRE_view_rename(SIDRE_view* self, const char* new_name) +bool SIDRE_View_rename(SIDRE_View* self, const char* new_name) { -// splicer begin class.View.method.rename axom::sidre::View* SH_this = static_cast(self->addr); - const std::string SH_new_name(new_name); - bool SHC_rv = SH_this->rename(SH_new_name); + // splicer begin class.View.method.rename + const std::string SHCXX_new_name(new_name); + bool SHC_rv = SH_this->rename(SHCXX_new_name); return SHC_rv; -// splicer end class.View.method.rename + // splicer end class.View.method.rename } -bool SIDRE_view_rename_bufferify(SIDRE_view* self, const char* new_name, +bool SIDRE_View_rename_bufferify(SIDRE_View* self, const char* new_name, int Lnew_name) { -// splicer begin class.View.method.rename_bufferify axom::sidre::View* SH_this = static_cast(self->addr); - const std::string SH_new_name(new_name, Lnew_name); - bool SHC_rv = SH_this->rename(SH_new_name); + // splicer begin class.View.method.rename_bufferify + const std::string SHCXX_new_name(new_name, Lnew_name); + bool SHC_rv = SH_this->rename(SHCXX_new_name); return SHC_rv; -// splicer end class.View.method.rename_bufferify + // splicer end class.View.method.rename_bufferify } } // extern "C" diff --git a/src/axom/sidre/interface/c_fortran/wrapView.h b/src/axom/sidre/interface/c_fortran/wrapView.h index 35f13bf9ed..7360d525cd 100644 --- a/src/axom/sidre/interface/c_fortran/wrapView.h +++ b/src/axom/sidre/interface/c_fortran/wrapView.h @@ -14,9 +14,16 @@ #ifndef WRAPVIEW_H #define WRAPVIEW_H +#include "typesSidre.h" +#ifdef __cplusplus +#include +#include +#include "axom/sidre/core/SidreTypes.hpp" +#else +#include #include #include "axom/sidre/interface/SidreTypes.h" -#include "typesSidre.h" +#endif // splicer begin class.View.CXX_declarations // splicer end class.View.CXX_declarations @@ -28,144 +35,144 @@ extern "C" { // splicer begin class.View.C_declarations // splicer end class.View.C_declarations -SIDRE_IndexType SIDRE_view_get_index(SIDRE_view* self); +SIDRE_IndexType SIDRE_View_get_index(SIDRE_View* self); -const char* SIDRE_view_get_name(const SIDRE_view* self); +const char* SIDRE_View_get_name(const SIDRE_View* self); -void SIDRE_view_get_name_bufferify(const SIDRE_view* self, char* SHF_rv, +void SIDRE_View_get_name_bufferify(const SIDRE_View* self, char* SHF_rv, int NSHF_rv); -void SIDRE_view_get_path_bufferify(const SIDRE_view* self, char* SHF_rv, +void SIDRE_View_get_path_bufferify(const SIDRE_View* self, char* SHF_rv, int NSHF_rv); -void SIDRE_view_get_path_name_bufferify(const SIDRE_view* self, char* SHF_rv, +void SIDRE_View_get_path_name_bufferify(const SIDRE_View* self, char* SHF_rv, int NSHF_rv); -SIDRE_group* SIDRE_view_get_owning_group(SIDRE_view* self, SIDRE_group* SHC_rv); +SIDRE_Group* SIDRE_View_get_owning_group(SIDRE_View* self, SIDRE_Group* SHC_rv); -bool SIDRE_view_has_buffer(const SIDRE_view* self); +bool SIDRE_View_has_buffer(const SIDRE_View* self); -SIDRE_buffer* SIDRE_view_get_buffer(SIDRE_view* self, SIDRE_buffer* SHC_rv); +SIDRE_Buffer* SIDRE_View_get_buffer(SIDRE_View* self, SIDRE_Buffer* SHC_rv); -bool SIDRE_view_is_external(const SIDRE_view* self); +bool SIDRE_View_is_external(const SIDRE_View* self); -bool SIDRE_view_is_allocated(SIDRE_view* self); +bool SIDRE_View_is_allocated(SIDRE_View* self); -bool SIDRE_view_is_applied(const SIDRE_view* self); +bool SIDRE_View_is_applied(const SIDRE_View* self); -bool SIDRE_view_is_described(const SIDRE_view* self); +bool SIDRE_View_is_described(const SIDRE_View* self); -bool SIDRE_view_is_empty(const SIDRE_view* self); +bool SIDRE_View_is_empty(const SIDRE_View* self); -bool SIDRE_view_is_opaque(const SIDRE_view* self); +bool SIDRE_View_is_opaque(const SIDRE_View* self); -bool SIDRE_view_is_scalar(const SIDRE_view* self); +bool SIDRE_View_is_scalar(const SIDRE_View* self); -bool SIDRE_view_is_string(const SIDRE_view* self); +bool SIDRE_View_is_string(const SIDRE_View* self); -int SIDRE_view_get_type_id(const SIDRE_view* self); +int SIDRE_View_get_type_id(const SIDRE_View* self); -size_t SIDRE_view_get_total_bytes(const SIDRE_view* self); +size_t SIDRE_View_get_total_bytes(const SIDRE_View* self); -size_t SIDRE_view_get_num_elements(const SIDRE_view* self); +size_t SIDRE_View_get_num_elements(const SIDRE_View* self); -size_t SIDRE_view_get_bytes_per_element(const SIDRE_view* self); +size_t SIDRE_View_get_bytes_per_element(const SIDRE_View* self); -size_t SIDRE_view_get_offset(const SIDRE_view* self); +size_t SIDRE_View_get_offset(const SIDRE_View* self); -size_t SIDRE_view_get_stride(const SIDRE_view* self); +size_t SIDRE_View_get_stride(const SIDRE_View* self); -int SIDRE_view_get_num_dimensions(const SIDRE_view* self); +int SIDRE_View_get_num_dimensions(const SIDRE_View* self); -int SIDRE_view_get_shape(const SIDRE_view* self, int ndims, +int SIDRE_View_get_shape(const SIDRE_View* self, int ndims, SIDRE_IndexType* shape); -void SIDRE_view_allocate_simple(SIDRE_view* self); +void SIDRE_View_allocate_simple(SIDRE_View* self); -void SIDRE_view_allocate_from_type(SIDRE_view* self, int type, +void SIDRE_View_allocate_from_type(SIDRE_View* self, int type, SIDRE_IndexType num_elems); -void SIDRE_view_reallocate(SIDRE_view* self, SIDRE_IndexType num_elems); +void SIDRE_View_reallocate(SIDRE_View* self, SIDRE_IndexType num_elems); -void SIDRE_view_attach_buffer_only(SIDRE_view* self, SIDRE_buffer* buff); +void SIDRE_View_attach_buffer_only(SIDRE_View* self, SIDRE_Buffer* buff); -void SIDRE_view_attach_buffer_type(SIDRE_view* self, int type, +void SIDRE_View_attach_buffer_type(SIDRE_View* self, int type, SIDRE_IndexType num_elems, - SIDRE_buffer* buff); + SIDRE_Buffer* buff); -void SIDRE_view_attach_buffer_shape(SIDRE_view* self, int type, int ndims, - SIDRE_IndexType* shape, SIDRE_buffer* buff); +void SIDRE_View_attach_buffer_shape(SIDRE_View* self, int type, int ndims, + SIDRE_IndexType* shape, SIDRE_Buffer* buff); -void SIDRE_view_apply_0(SIDRE_view* self); +void SIDRE_View_apply_0(SIDRE_View* self); -void SIDRE_view_apply_nelems(SIDRE_view* self, SIDRE_IndexType num_elems); +void SIDRE_View_apply_nelems(SIDRE_View* self, SIDRE_IndexType num_elems); -void SIDRE_view_apply_nelems_offset(SIDRE_view* self, SIDRE_IndexType num_elems, +void SIDRE_View_apply_nelems_offset(SIDRE_View* self, SIDRE_IndexType num_elems, SIDRE_IndexType offset); -void SIDRE_view_apply_nelems_offset_stride(SIDRE_view* self, +void SIDRE_View_apply_nelems_offset_stride(SIDRE_View* self, SIDRE_IndexType num_elems, SIDRE_IndexType offset, SIDRE_IndexType stride); -void SIDRE_view_apply_type_nelems(SIDRE_view* self, int type, +void SIDRE_View_apply_type_nelems(SIDRE_View* self, int type, SIDRE_IndexType num_elems); -void SIDRE_view_apply_type_nelems_offset(SIDRE_view* self, int type, +void SIDRE_View_apply_type_nelems_offset(SIDRE_View* self, int type, SIDRE_IndexType num_elems, SIDRE_IndexType offset); -void SIDRE_view_apply_type_nelems_offset_stride(SIDRE_view* self, int type, +void SIDRE_View_apply_type_nelems_offset_stride(SIDRE_View* self, int type, SIDRE_IndexType num_elems, SIDRE_IndexType offset, SIDRE_IndexType stride); -void SIDRE_view_apply_type_shape(SIDRE_view* self, int type, int ndims, +void SIDRE_View_apply_type_shape(SIDRE_View* self, int type, int ndims, SIDRE_IndexType* shape); -void SIDRE_view_set_scalar_int(SIDRE_view* self, int value); +void SIDRE_View_set_scalar_int(SIDRE_View* self, int value); -void SIDRE_view_set_scalar_long(SIDRE_view* self, long value); +void SIDRE_View_set_scalar_long(SIDRE_View* self, long value); -void SIDRE_view_set_scalar_float(SIDRE_view* self, float value); +void SIDRE_View_set_scalar_float(SIDRE_View* self, float value); -void SIDRE_view_set_scalar_double(SIDRE_view* self, double value); +void SIDRE_View_set_scalar_double(SIDRE_View* self, double value); -void SIDRE_view_set_string(SIDRE_view* self, const char* value); +void SIDRE_View_set_string(SIDRE_View* self, const char* value); -void SIDRE_view_set_string_bufferify(SIDRE_view* self, const char* value, +void SIDRE_View_set_string_bufferify(SIDRE_View* self, const char* value, int Lvalue); -void SIDRE_view_set_external_data_ptr_only(SIDRE_view* self, +void SIDRE_View_set_external_data_ptr_only(SIDRE_View* self, void* external_ptr); -void SIDRE_view_set_external_data_ptr_type(SIDRE_view* self, int type, +void SIDRE_View_set_external_data_ptr_type(SIDRE_View* self, int type, SIDRE_IndexType num_elems, void* external_ptr); -void SIDRE_view_set_external_data_ptr_shape(SIDRE_view* self, int type, +void SIDRE_View_set_external_data_ptr_shape(SIDRE_View* self, int type, int ndims, SIDRE_IndexType* shape, void* external_ptr); -const char* SIDRE_view_get_string(SIDRE_view* self); +const char* SIDRE_View_get_string(SIDRE_View* self); -void SIDRE_view_get_string_bufferify(SIDRE_view* self, char* name, int Nname); +void SIDRE_View_get_string_bufferify(SIDRE_View* self, char* name, int Nname); -int SIDRE_view_get_data_int(SIDRE_view* self); +int SIDRE_View_get_data_int(SIDRE_View* self); -long SIDRE_view_get_data_long(SIDRE_view* self); +long SIDRE_View_get_data_long(SIDRE_View* self); -float SIDRE_view_get_data_float(SIDRE_view* self); +float SIDRE_View_get_data_float(SIDRE_View* self); -double SIDRE_view_get_data_double(SIDRE_view* self); +double SIDRE_View_get_data_double(SIDRE_View* self); -void* SIDRE_view_get_void_ptr(const SIDRE_view* self); +void* SIDRE_View_get_void_ptr(const SIDRE_View* self); -void SIDRE_view_print(const SIDRE_view* self); +void SIDRE_View_print(const SIDRE_View* self); -bool SIDRE_view_rename(SIDRE_view* self, const char* new_name); +bool SIDRE_View_rename(SIDRE_View* self, const char* new_name); -bool SIDRE_view_rename_bufferify(SIDRE_view* self, const char* new_name, +bool SIDRE_View_rename_bufferify(SIDRE_View* self, const char* new_name, int Lnew_name); #ifdef __cplusplus diff --git a/src/axom/sidre/interface/c_fortran/wrapfsidre.F b/src/axom/sidre/interface/c_fortran/wrapfsidre.F index a2e084586d..c0de9ee467 100644 --- a/src/axom/sidre/interface/c_fortran/wrapfsidre.F +++ b/src/axom/sidre/interface/c_fortran/wrapfsidre.F @@ -7,7 +7,7 @@ ! SPDX-License-Identifier: (BSD-3-Clause) !> !! \file wrapfsidre.F -!! \brief Shroud generated wrapper for Sidre library +!! \brief Shroud generated wrapper for sidre namespace !< ! splicer begin file_top #include "axom/config.hpp" @@ -47,9 +47,6 @@ module axom_sidre integer, parameter :: invalid_index = -1_SIDRE_IndexType ! splicer end module_top - ! splicer begin class.Buffer.module_top - ! splicer end class.Buffer.module_top - type, bind(C) :: SHROUD_buffer_capsule type(C_PTR) :: addr = C_NULL_PTR ! address of C++ memory integer(C_INT) :: idtor = 0 ! index of destructor @@ -86,9 +83,6 @@ module axom_sidre ! splicer end class.Buffer.type_bound_procedure_part end type SidreBuffer - ! splicer begin class.Group.module_top - ! splicer end class.Group.module_top - type, bind(C) :: SHROUD_group_capsule type(C_PTR) :: addr = C_NULL_PTR ! address of C++ memory integer(C_INT) :: idtor = 0 ! index of destructor @@ -312,9 +306,6 @@ module axom_sidre ! splicer end class.Group.type_bound_procedure_part end type SidreGroup - ! splicer begin class.View.module_top - ! splicer end class.View.module_top - type, bind(C) :: SHROUD_view_capsule type(C_PTR) :: addr = C_NULL_PTR ! address of C++ memory integer(C_INT) :: idtor = 0 ! index of destructor @@ -487,9 +478,6 @@ module axom_sidre ! splicer end class.View.type_bound_procedure_part end type SidreView - ! splicer begin class.DataStore.module_top - ! splicer end class.DataStore.module_top - type, bind(C) :: SHROUD_datastore_capsule type(C_PTR) :: addr = C_NULL_PTR ! address of C++ memory integer(C_INT) :: idtor = 0 ! index of destructor @@ -543,7 +531,7 @@ module axom_sidre pure function c_buffer_get_index(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_index") + bind(C, name="SIDRE_Buffer_get_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_buffer_capsule implicit none @@ -553,7 +541,7 @@ end function c_buffer_get_index pure function c_buffer_get_num_views(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_num_views") + bind(C, name="SIDRE_Buffer_get_num_views") use iso_c_binding, only : C_SIZE_T import :: SHROUD_buffer_capsule implicit none @@ -563,7 +551,7 @@ end function c_buffer_get_num_views function c_buffer_get_void_ptr(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_void_ptr") + bind(C, name="SIDRE_Buffer_get_void_ptr") use iso_c_binding, only : C_PTR import :: SHROUD_buffer_capsule implicit none @@ -573,7 +561,7 @@ end function c_buffer_get_void_ptr pure function c_buffer_get_type_id(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_type_id") + bind(C, name="SIDRE_Buffer_get_type_id") use iso_c_binding, only : C_INT import :: SHROUD_buffer_capsule implicit none @@ -583,7 +571,7 @@ end function c_buffer_get_type_id pure function c_buffer_get_num_elements(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_num_elements") + bind(C, name="SIDRE_Buffer_get_num_elements") use iso_c_binding, only : C_SIZE_T import :: SHROUD_buffer_capsule implicit none @@ -593,7 +581,7 @@ end function c_buffer_get_num_elements pure function c_buffer_get_total_bytes(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_total_bytes") + bind(C, name="SIDRE_Buffer_get_total_bytes") use iso_c_binding, only : C_SIZE_T import :: SHROUD_buffer_capsule implicit none @@ -603,7 +591,7 @@ end function c_buffer_get_total_bytes pure function c_buffer_get_bytes_per_element(self) & result(SHT_rv) & - bind(C, name="SIDRE_buffer_get_bytes_per_element") + bind(C, name="SIDRE_Buffer_get_bytes_per_element") use iso_c_binding, only : C_SIZE_T import :: SHROUD_buffer_capsule implicit none @@ -612,7 +600,7 @@ pure function c_buffer_get_bytes_per_element(self) & end function c_buffer_get_bytes_per_element subroutine c_buffer_describe(self, type, num_elems) & - bind(C, name="SIDRE_buffer_describe") + bind(C, name="SIDRE_Buffer_describe") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_buffer_capsule implicit none @@ -622,14 +610,14 @@ subroutine c_buffer_describe(self, type, num_elems) & end subroutine c_buffer_describe subroutine c_buffer_allocate_existing(self) & - bind(C, name="SIDRE_buffer_allocate_existing") + bind(C, name="SIDRE_Buffer_allocate_existing") import :: SHROUD_buffer_capsule implicit none type(SHROUD_buffer_capsule), intent(IN) :: self end subroutine c_buffer_allocate_existing subroutine c_buffer_allocate_from_type(self, type, num_elems) & - bind(C, name="SIDRE_buffer_allocate_from_type") + bind(C, name="SIDRE_Buffer_allocate_from_type") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_buffer_capsule implicit none @@ -639,7 +627,7 @@ subroutine c_buffer_allocate_from_type(self, type, num_elems) & end subroutine c_buffer_allocate_from_type subroutine c_buffer_reallocate(self, num_elems) & - bind(C, name="SIDRE_buffer_reallocate") + bind(C, name="SIDRE_Buffer_reallocate") use iso_c_binding, only : C_INT64_T import :: SHROUD_buffer_capsule implicit none @@ -648,7 +636,7 @@ subroutine c_buffer_reallocate(self, num_elems) & end subroutine c_buffer_reallocate subroutine c_buffer_print(self) & - bind(C, name="SIDRE_buffer_print") + bind(C, name="SIDRE_Buffer_print") import :: SHROUD_buffer_capsule implicit none type(SHROUD_buffer_capsule), intent(IN) :: self @@ -659,7 +647,7 @@ end subroutine c_buffer_print function c_group_get_index(self) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_index") + bind(C, name="SIDRE_Group_get_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -669,7 +657,7 @@ end function c_group_get_index pure function c_group_get_name(self) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_name") + bind(C, name="SIDRE_Group_get_name") use iso_c_binding, only : C_PTR import :: SHROUD_group_capsule implicit none @@ -678,7 +666,7 @@ pure function c_group_get_name(self) & end function c_group_get_name subroutine c_group_get_name_bufferify(self, SHF_rv, NSHF_rv) & - bind(C, name="SIDRE_group_get_name_bufferify") + bind(C, name="SIDRE_Group_get_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -688,7 +676,7 @@ subroutine c_group_get_name_bufferify(self, SHF_rv, NSHF_rv) & end subroutine c_group_get_name_bufferify subroutine c_group_get_path_bufferify(self, SHF_rv, NSHF_rv) & - bind(C, name="SIDRE_group_get_path_bufferify") + bind(C, name="SIDRE_Group_get_path_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -699,7 +687,7 @@ end subroutine c_group_get_path_bufferify subroutine c_group_get_path_name_bufferify(self, SHF_rv, & NSHF_rv) & - bind(C, name="SIDRE_group_get_path_name_bufferify") + bind(C, name="SIDRE_Group_get_path_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -710,7 +698,7 @@ end subroutine c_group_get_path_name_bufferify function c_group_get_parent(self, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_parent") + bind(C, name="SIDRE_Group_get_parent") use iso_c_binding, only : C_PTR import :: SHROUD_group_capsule implicit none @@ -721,7 +709,7 @@ end function c_group_get_parent pure function c_group_get_num_groups(self) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_num_groups") + bind(C, name="SIDRE_Group_get_num_groups") use iso_c_binding, only : C_SIZE_T import :: SHROUD_group_capsule implicit none @@ -731,7 +719,7 @@ end function c_group_get_num_groups pure function c_group_get_num_views(self) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_num_views") + bind(C, name="SIDRE_Group_get_num_views") use iso_c_binding, only : C_SIZE_T import :: SHROUD_group_capsule implicit none @@ -741,7 +729,7 @@ end function c_group_get_num_views function c_group_get_data_store(self, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_data_store") + bind(C, name="SIDRE_Group_get_data_store") use iso_c_binding, only : C_PTR import :: SHROUD_datastore_capsule, SHROUD_group_capsule implicit none @@ -752,7 +740,7 @@ end function c_group_get_data_store pure function c_group_has_view(self, path) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_view") + bind(C, name="SIDRE_Group_has_view") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_group_capsule implicit none @@ -763,7 +751,7 @@ end function c_group_has_view pure function c_group_has_view_bufferify(self, path, Lpath) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_view_bufferify") + bind(C, name="SIDRE_Group_has_view_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -775,7 +763,7 @@ end function c_group_has_view_bufferify pure function c_group_has_child_view(self, name) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_child_view") + bind(C, name="SIDRE_Group_has_child_view") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_group_capsule implicit none @@ -787,7 +775,7 @@ end function c_group_has_child_view pure function c_group_has_child_view_bufferify(self, name, & Lname) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_child_view_bufferify") + bind(C, name="SIDRE_Group_has_child_view_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -799,7 +787,7 @@ end function c_group_has_child_view_bufferify pure function c_group_get_view_index(self, name) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_view_index") + bind(C, name="SIDRE_Group_get_view_index") use iso_c_binding, only : C_CHAR, C_INT64_T import :: SHROUD_group_capsule implicit none @@ -811,7 +799,7 @@ end function c_group_get_view_index pure function c_group_get_view_index_bufferify(self, name, & Lname) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_view_index_bufferify") + bind(C, name="SIDRE_Group_get_view_index_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T import :: SHROUD_group_capsule implicit none @@ -823,7 +811,7 @@ end function c_group_get_view_index_bufferify pure function c_group_get_view_name(self, idx) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_view_name") + bind(C, name="SIDRE_Group_get_view_name") use iso_c_binding, only : C_INT64_T, C_PTR import :: SHROUD_group_capsule implicit none @@ -834,7 +822,7 @@ end function c_group_get_view_name subroutine c_group_get_view_name_bufferify(self, idx, SHF_rv, & NSHF_rv) & - bind(C, name="SIDRE_group_get_view_name_bufferify") + bind(C, name="SIDRE_Group_get_view_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T import :: SHROUD_group_capsule implicit none @@ -846,7 +834,7 @@ end subroutine c_group_get_view_name_bufferify function c_group_get_view_from_name(self, path, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_view_from_name") + bind(C, name="SIDRE_Group_get_view_from_name") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -859,7 +847,7 @@ end function c_group_get_view_from_name function c_group_get_view_from_name_bufferify(self, path, Lpath, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_view_from_name_bufferify") + bind(C, name="SIDRE_Group_get_view_from_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -872,7 +860,7 @@ end function c_group_get_view_from_name_bufferify function c_group_get_view_from_index(self, idx, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_view_from_index") + bind(C, name="SIDRE_Group_get_view_from_index") use iso_c_binding, only : C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -884,7 +872,7 @@ end function c_group_get_view_from_index pure function c_group_get_first_valid_view_index(self) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_first_valid_view_index") + bind(C, name="SIDRE_Group_get_first_valid_view_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -894,7 +882,7 @@ end function c_group_get_first_valid_view_index pure function c_group_get_next_valid_view_index(self, idx) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_next_valid_view_index") + bind(C, name="SIDRE_Group_get_next_valid_view_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -905,7 +893,7 @@ end function c_group_get_next_valid_view_index function c_group_create_view_empty(self, path, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_empty") + bind(C, name="SIDRE_Group_create_view_empty") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -918,7 +906,7 @@ end function c_group_create_view_empty function c_group_create_view_empty_bufferify(self, path, Lpath, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_empty_bufferify") + bind(C, name="SIDRE_Group_create_view_empty_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -932,7 +920,7 @@ end function c_group_create_view_empty_bufferify function c_group_create_view_from_type(self, path, type, & num_elems, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_type") + bind(C, name="SIDRE_Group_create_view_from_type") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -947,7 +935,7 @@ end function c_group_create_view_from_type function c_group_create_view_from_type_bufferify(self, path, & Lpath, type, num_elems, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_type_bufferify") + bind(C, name="SIDRE_Group_create_view_from_type_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -963,7 +951,7 @@ end function c_group_create_view_from_type_bufferify function c_group_create_view_from_shape(self, path, type, ndims, & shape, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_shape") + bind(C, name="SIDRE_Group_create_view_from_shape") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -979,7 +967,7 @@ end function c_group_create_view_from_shape function c_group_create_view_from_shape_bufferify(self, path, & Lpath, type, ndims, shape, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_shape_bufferify") + bind(C, name="SIDRE_Group_create_view_from_shape_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -996,7 +984,7 @@ end function c_group_create_view_from_shape_bufferify function c_group_create_view_into_buffer(self, path, buff, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_into_buffer") + bind(C, name="SIDRE_Group_create_view_into_buffer") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_buffer_capsule, SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1010,7 +998,7 @@ end function c_group_create_view_into_buffer function c_group_create_view_into_buffer_bufferify(self, path, & Lpath, buff, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_into_buffer_bufferify") + bind(C, name="SIDRE_Group_create_view_into_buffer_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_buffer_capsule, SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1025,7 +1013,7 @@ end function c_group_create_view_into_buffer_bufferify function c_group_create_view_from_type_and_buffer(self, path, & type, num_elems, buff, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_type_and_buffer") + bind(C, name="SIDRE_Group_create_view_from_type_and_buffer") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_buffer_capsule, SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1041,7 +1029,7 @@ end function c_group_create_view_from_type_and_buffer function c_group_create_view_from_type_and_buffer_bufferify( & self, path, Lpath, type, num_elems, buff, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_type_and_buffer_bufferify") + bind(C, name="SIDRE_Group_create_view_from_type_and_buffer_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_buffer_capsule, SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1058,7 +1046,7 @@ end function c_group_create_view_from_type_and_buffer_bufferify function c_group_create_view_from_shape_and_buffer(self, path, & type, ndims, shape, buff, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_shape_and_buffer") + bind(C, name="SIDRE_Group_create_view_from_shape_and_buffer") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_buffer_capsule, SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1075,7 +1063,7 @@ end function c_group_create_view_from_shape_and_buffer function c_group_create_view_from_shape_and_buffer_bufferify( & self, path, Lpath, type, ndims, shape, buff, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_shape_and_buffer_bufferify") + bind(C, name="SIDRE_Group_create_view_from_shape_and_buffer_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_buffer_capsule, SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1093,7 +1081,7 @@ end function c_group_create_view_from_shape_and_buffer_bufferify function c_group_create_view_external(self, path, external_ptr, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_external") + bind(C, name="SIDRE_Group_create_view_external") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1107,7 +1095,7 @@ end function c_group_create_view_external function c_group_create_view_external_bufferify(self, path, & Lpath, external_ptr, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_external_bufferify") + bind(C, name="SIDRE_Group_create_view_external_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1122,7 +1110,7 @@ end function c_group_create_view_external_bufferify function c_group_create_view_from_type_external(self, path, & type, num_elems, external_ptr, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_type_external") + bind(C, name="SIDRE_Group_create_view_from_type_external") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1138,7 +1126,7 @@ end function c_group_create_view_from_type_external function c_group_create_view_from_type_external_bufferify(self, & path, Lpath, type, num_elems, external_ptr, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_type_external_bufferify") + bind(C, name="SIDRE_Group_create_view_from_type_external_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1155,7 +1143,7 @@ end function c_group_create_view_from_type_external_bufferify function c_group_create_view_from_shape_external(self, path, & type, ndims, shape, external_ptr, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_shape_external") + bind(C, name="SIDRE_Group_create_view_from_shape_external") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1172,7 +1160,7 @@ end function c_group_create_view_from_shape_external function c_group_create_view_from_shape_external_bufferify(self, & path, Lpath, type, ndims, shape, external_ptr, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_from_shape_external_bufferify") + bind(C, name="SIDRE_Group_create_view_from_shape_external_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1190,7 +1178,7 @@ end function c_group_create_view_from_shape_external_bufferify function c_group_create_view_and_allocate_nelems(self, path, & type, num_elems, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_and_allocate_nelems") + bind(C, name="SIDRE_Group_create_view_and_allocate_nelems") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1205,7 +1193,7 @@ end function c_group_create_view_and_allocate_nelems function c_group_create_view_and_allocate_nelems_bufferify(self, & path, Lpath, type, num_elems, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_and_allocate_nelems_bufferify") + bind(C, name="SIDRE_Group_create_view_and_allocate_nelems_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1221,7 +1209,7 @@ end function c_group_create_view_and_allocate_nelems_bufferify function c_group_create_view_and_allocate_shape(self, path, & type, ndims, shape, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_and_allocate_shape") + bind(C, name="SIDRE_Group_create_view_and_allocate_shape") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1237,7 +1225,7 @@ end function c_group_create_view_and_allocate_shape function c_group_create_view_and_allocate_shape_bufferify(self, & path, Lpath, type, ndims, shape, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_and_allocate_shape_bufferify") + bind(C, name="SIDRE_Group_create_view_and_allocate_shape_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1254,7 +1242,7 @@ end function c_group_create_view_and_allocate_shape_bufferify function c_group_create_view_scalar_int(self, path, value, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_int") + bind(C, name="SIDRE_Group_create_view_scalar_int") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1265,10 +1253,10 @@ function c_group_create_view_scalar_int(self, path, value, & type(C_PTR) SHT_rv end function c_group_create_view_scalar_int - function c_group_create_view_scalar_int_bufferify(self, path, & + function c_group_create_view_scalar_bufferify_int(self, path, & Lpath, value, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_int_bufferify") + bind(C, name="SIDRE_Group_create_view_scalar_bufferify_int") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1278,12 +1266,12 @@ function c_group_create_view_scalar_int_bufferify(self, path, & integer(C_INT), value, intent(IN) :: value type(SHROUD_view_capsule), intent(OUT) :: SHT_crv type(C_PTR) SHT_rv - end function c_group_create_view_scalar_int_bufferify + end function c_group_create_view_scalar_bufferify_int function c_group_create_view_scalar_long(self, path, value, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_long") + bind(C, name="SIDRE_Group_create_view_scalar_long") use iso_c_binding, only : C_CHAR, C_LONG, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1294,10 +1282,10 @@ function c_group_create_view_scalar_long(self, path, value, & type(C_PTR) SHT_rv end function c_group_create_view_scalar_long - function c_group_create_view_scalar_long_bufferify(self, path, & + function c_group_create_view_scalar_bufferify_long(self, path, & Lpath, value, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_long_bufferify") + bind(C, name="SIDRE_Group_create_view_scalar_bufferify_long") use iso_c_binding, only : C_CHAR, C_INT, C_LONG, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1307,12 +1295,12 @@ function c_group_create_view_scalar_long_bufferify(self, path, & integer(C_LONG), value, intent(IN) :: value type(SHROUD_view_capsule), intent(OUT) :: SHT_crv type(C_PTR) SHT_rv - end function c_group_create_view_scalar_long_bufferify + end function c_group_create_view_scalar_bufferify_long function c_group_create_view_scalar_float(self, path, value, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_float") + bind(C, name="SIDRE_Group_create_view_scalar_float") use iso_c_binding, only : C_CHAR, C_FLOAT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1323,10 +1311,10 @@ function c_group_create_view_scalar_float(self, path, value, & type(C_PTR) SHT_rv end function c_group_create_view_scalar_float - function c_group_create_view_scalar_float_bufferify(self, path, & + function c_group_create_view_scalar_bufferify_float(self, path, & Lpath, value, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_float_bufferify") + bind(C, name="SIDRE_Group_create_view_scalar_bufferify_float") use iso_c_binding, only : C_CHAR, C_FLOAT, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1336,12 +1324,12 @@ function c_group_create_view_scalar_float_bufferify(self, path, & real(C_FLOAT), value, intent(IN) :: value type(SHROUD_view_capsule), intent(OUT) :: SHT_crv type(C_PTR) SHT_rv - end function c_group_create_view_scalar_float_bufferify + end function c_group_create_view_scalar_bufferify_float function c_group_create_view_scalar_double(self, path, value, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_double") + bind(C, name="SIDRE_Group_create_view_scalar_double") use iso_c_binding, only : C_CHAR, C_DOUBLE, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1352,10 +1340,10 @@ function c_group_create_view_scalar_double(self, path, value, & type(C_PTR) SHT_rv end function c_group_create_view_scalar_double - function c_group_create_view_scalar_double_bufferify(self, path, & + function c_group_create_view_scalar_bufferify_double(self, path, & Lpath, value, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_scalar_double_bufferify") + bind(C, name="SIDRE_Group_create_view_scalar_bufferify_double") use iso_c_binding, only : C_CHAR, C_DOUBLE, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1365,11 +1353,11 @@ function c_group_create_view_scalar_double_bufferify(self, path, & real(C_DOUBLE), value, intent(IN) :: value type(SHROUD_view_capsule), intent(OUT) :: SHT_crv type(C_PTR) SHT_rv - end function c_group_create_view_scalar_double_bufferify + end function c_group_create_view_scalar_bufferify_double function c_group_create_view_string(self, path, value, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_string") + bind(C, name="SIDRE_Group_create_view_string") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1383,7 +1371,7 @@ end function c_group_create_view_string function c_group_create_view_string_bufferify(self, path, Lpath, & value, Lvalue, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_view_string_bufferify") + bind(C, name="SIDRE_Group_create_view_string_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1397,7 +1385,7 @@ function c_group_create_view_string_bufferify(self, path, Lpath, & end function c_group_create_view_string_bufferify subroutine c_group_destroy_view(self, path) & - bind(C, name="SIDRE_group_destroy_view") + bind(C, name="SIDRE_Group_destroy_view") use iso_c_binding, only : C_CHAR import :: SHROUD_group_capsule implicit none @@ -1406,7 +1394,7 @@ subroutine c_group_destroy_view(self, path) & end subroutine c_group_destroy_view subroutine c_group_destroy_view_bufferify(self, path, Lpath) & - bind(C, name="SIDRE_group_destroy_view_bufferify") + bind(C, name="SIDRE_Group_destroy_view_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1416,7 +1404,7 @@ subroutine c_group_destroy_view_bufferify(self, path, Lpath) & end subroutine c_group_destroy_view_bufferify subroutine c_group_destroy_view_and_data_name(self, path) & - bind(C, name="SIDRE_group_destroy_view_and_data_name") + bind(C, name="SIDRE_Group_destroy_view_and_data_name") use iso_c_binding, only : C_CHAR import :: SHROUD_group_capsule implicit none @@ -1426,7 +1414,7 @@ end subroutine c_group_destroy_view_and_data_name subroutine c_group_destroy_view_and_data_name_bufferify(self, & path, Lpath) & - bind(C, name="SIDRE_group_destroy_view_and_data_name_bufferify") + bind(C, name="SIDRE_Group_destroy_view_and_data_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1436,7 +1424,7 @@ subroutine c_group_destroy_view_and_data_name_bufferify(self, & end subroutine c_group_destroy_view_and_data_name_bufferify subroutine c_group_destroy_view_and_data_index(self, idx) & - bind(C, name="SIDRE_group_destroy_view_and_data_index") + bind(C, name="SIDRE_Group_destroy_view_and_data_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1446,7 +1434,7 @@ end subroutine c_group_destroy_view_and_data_index function c_group_move_view(self, view, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_move_view") + bind(C, name="SIDRE_Group_move_view") use iso_c_binding, only : C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1458,7 +1446,7 @@ end function c_group_move_view function c_group_copy_view(self, view, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_copy_view") + bind(C, name="SIDRE_Group_copy_view") use iso_c_binding, only : C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1470,7 +1458,7 @@ end function c_group_copy_view function c_group_has_group(self, path) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_group") + bind(C, name="SIDRE_Group_has_group") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_group_capsule implicit none @@ -1481,7 +1469,7 @@ end function c_group_has_group function c_group_has_group_bufferify(self, path, Lpath) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_group_bufferify") + bind(C, name="SIDRE_Group_has_group_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1493,7 +1481,7 @@ end function c_group_has_group_bufferify function c_group_has_child_group(self, name) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_child_group") + bind(C, name="SIDRE_Group_has_child_group") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_group_capsule implicit none @@ -1504,7 +1492,7 @@ end function c_group_has_child_group function c_group_has_child_group_bufferify(self, name, Lname) & result(SHT_rv) & - bind(C, name="SIDRE_group_has_child_group_bufferify") + bind(C, name="SIDRE_Group_has_child_group_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1516,7 +1504,7 @@ end function c_group_has_child_group_bufferify pure function c_group_get_group_index(self, name) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_group_index") + bind(C, name="SIDRE_Group_get_group_index") use iso_c_binding, only : C_CHAR, C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1528,7 +1516,7 @@ end function c_group_get_group_index pure function c_group_get_group_index_bufferify(self, name, & Lname) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_group_index_bufferify") + bind(C, name="SIDRE_Group_get_group_index_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1540,7 +1528,7 @@ end function c_group_get_group_index_bufferify pure function c_group_get_group_name(self, idx) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_group_name") + bind(C, name="SIDRE_Group_get_group_name") use iso_c_binding, only : C_INT64_T, C_PTR import :: SHROUD_group_capsule implicit none @@ -1551,7 +1539,7 @@ end function c_group_get_group_name subroutine c_group_get_group_name_bufferify(self, idx, SHF_rv, & NSHF_rv) & - bind(C, name="SIDRE_group_get_group_name_bufferify") + bind(C, name="SIDRE_Group_get_group_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1563,7 +1551,7 @@ end subroutine c_group_get_group_name_bufferify function c_group_get_group_from_name(self, path, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_group_from_name") + bind(C, name="SIDRE_Group_get_group_from_name") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_group_capsule implicit none @@ -1576,7 +1564,7 @@ end function c_group_get_group_from_name function c_group_get_group_from_name_bufferify(self, path, & Lpath, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_group_from_name_bufferify") + bind(C, name="SIDRE_Group_get_group_from_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule implicit none @@ -1589,7 +1577,7 @@ end function c_group_get_group_from_name_bufferify function c_group_get_group_from_index(self, idx, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_group_from_index") + bind(C, name="SIDRE_Group_get_group_from_index") use iso_c_binding, only : C_INT64_T, C_PTR import :: SHROUD_group_capsule implicit none @@ -1601,7 +1589,7 @@ end function c_group_get_group_from_index pure function c_group_get_first_valid_group_index(self) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_first_valid_group_index") + bind(C, name="SIDRE_Group_get_first_valid_group_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1611,7 +1599,7 @@ end function c_group_get_first_valid_group_index pure function c_group_get_next_valid_group_index(self, idx) & result(SHT_rv) & - bind(C, name="SIDRE_group_get_next_valid_group_index") + bind(C, name="SIDRE_Group_get_next_valid_group_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1622,7 +1610,7 @@ end function c_group_get_next_valid_group_index function c_group_create_group(self, path, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_group") + bind(C, name="SIDRE_Group_create_group") use iso_c_binding, only : C_CHAR, C_PTR import :: SHROUD_group_capsule implicit none @@ -1635,7 +1623,7 @@ end function c_group_create_group function c_group_create_group_bufferify(self, path, Lpath, & SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_create_group_bufferify") + bind(C, name="SIDRE_Group_create_group_bufferify") use iso_c_binding, only : C_CHAR, C_INT, C_PTR import :: SHROUD_group_capsule implicit none @@ -1647,7 +1635,7 @@ function c_group_create_group_bufferify(self, path, Lpath, & end function c_group_create_group_bufferify subroutine c_group_destroy_group_name(self, path) & - bind(C, name="SIDRE_group_destroy_group_name") + bind(C, name="SIDRE_Group_destroy_group_name") use iso_c_binding, only : C_CHAR import :: SHROUD_group_capsule implicit none @@ -1657,7 +1645,7 @@ end subroutine c_group_destroy_group_name subroutine c_group_destroy_group_name_bufferify(self, path, & Lpath) & - bind(C, name="SIDRE_group_destroy_group_name_bufferify") + bind(C, name="SIDRE_Group_destroy_group_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1667,7 +1655,7 @@ subroutine c_group_destroy_group_name_bufferify(self, path, & end subroutine c_group_destroy_group_name_bufferify subroutine c_group_destroy_group_index(self, idx) & - bind(C, name="SIDRE_group_destroy_group_index") + bind(C, name="SIDRE_Group_destroy_group_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_group_capsule implicit none @@ -1677,7 +1665,7 @@ end subroutine c_group_destroy_group_index function c_group_move_group(self, grp, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_group_move_group") + bind(C, name="SIDRE_Group_move_group") use iso_c_binding, only : C_PTR import :: SHROUD_group_capsule implicit none @@ -1688,7 +1676,7 @@ function c_group_move_group(self, grp, SHT_crv) & end function c_group_move_group subroutine c_group_print(self) & - bind(C, name="SIDRE_group_print") + bind(C, name="SIDRE_Group_print") import :: SHROUD_group_capsule implicit none type(SHROUD_group_capsule), intent(IN) :: self @@ -1696,7 +1684,7 @@ end subroutine c_group_print pure function c_group_is_equivalent_to(self, other) & result(SHT_rv) & - bind(C, name="SIDRE_group_is_equivalent_to") + bind(C, name="SIDRE_Group_is_equivalent_to") use iso_c_binding, only : C_BOOL import :: SHROUD_group_capsule implicit none @@ -1706,7 +1694,7 @@ pure function c_group_is_equivalent_to(self, other) & end function c_group_is_equivalent_to subroutine c_group_save(self, file_path, protocol) & - bind(C, name="SIDRE_group_save") + bind(C, name="SIDRE_Group_save") use iso_c_binding, only : C_CHAR import :: SHROUD_group_capsule implicit none @@ -1717,7 +1705,7 @@ end subroutine c_group_save subroutine c_group_save_bufferify(self, file_path, Lfile_path, & protocol, Lprotocol) & - bind(C, name="SIDRE_group_save_bufferify") + bind(C, name="SIDRE_Group_save_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1729,7 +1717,7 @@ subroutine c_group_save_bufferify(self, file_path, Lfile_path, & end subroutine c_group_save_bufferify subroutine c_group_load_0(self, file_path, protocol) & - bind(C, name="SIDRE_group_load_0") + bind(C, name="SIDRE_Group_load_0") use iso_c_binding, only : C_CHAR import :: SHROUD_group_capsule implicit none @@ -1740,7 +1728,7 @@ end subroutine c_group_load_0 subroutine c_group_load_0_bufferify(self, file_path, Lfile_path, & protocol, Lprotocol) & - bind(C, name="SIDRE_group_load_0_bufferify") + bind(C, name="SIDRE_Group_load_0_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1753,7 +1741,7 @@ end subroutine c_group_load_0_bufferify subroutine c_group_load_1(self, file_path, protocol, & preserve_contents) & - bind(C, name="SIDRE_group_load_1") + bind(C, name="SIDRE_Group_load_1") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_group_capsule implicit none @@ -1765,7 +1753,7 @@ end subroutine c_group_load_1 subroutine c_group_load_1_bufferify(self, file_path, Lfile_path, & protocol, Lprotocol, preserve_contents) & - bind(C, name="SIDRE_group_load_1_bufferify") + bind(C, name="SIDRE_Group_load_1_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1778,7 +1766,7 @@ subroutine c_group_load_1_bufferify(self, file_path, Lfile_path, & end subroutine c_group_load_1_bufferify subroutine c_group_load_external_data(self, file_path) & - bind(C, name="SIDRE_group_load_external_data") + bind(C, name="SIDRE_Group_load_external_data") use iso_c_binding, only : C_CHAR import :: SHROUD_group_capsule implicit none @@ -1788,7 +1776,7 @@ end subroutine c_group_load_external_data subroutine c_group_load_external_data_bufferify(self, file_path, & Lfile_path) & - bind(C, name="SIDRE_group_load_external_data_bufferify") + bind(C, name="SIDRE_Group_load_external_data_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1799,7 +1787,7 @@ end subroutine c_group_load_external_data_bufferify function c_group_rename(self, new_name) & result(SHT_rv) & - bind(C, name="SIDRE_group_rename") + bind(C, name="SIDRE_Group_rename") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_group_capsule implicit none @@ -1810,7 +1798,7 @@ end function c_group_rename function c_group_rename_bufferify(self, new_name, Lnew_name) & result(SHT_rv) & - bind(C, name="SIDRE_group_rename_bufferify") + bind(C, name="SIDRE_Group_rename_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_group_capsule implicit none @@ -1825,7 +1813,7 @@ end function c_group_rename_bufferify function c_view_get_index(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_index") + bind(C, name="SIDRE_View_get_index") use iso_c_binding, only : C_INT64_T import :: SHROUD_view_capsule implicit none @@ -1835,7 +1823,7 @@ end function c_view_get_index pure function c_view_get_name(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_name") + bind(C, name="SIDRE_View_get_name") use iso_c_binding, only : C_PTR import :: SHROUD_view_capsule implicit none @@ -1844,7 +1832,7 @@ pure function c_view_get_name(self) & end function c_view_get_name subroutine c_view_get_name_bufferify(self, SHF_rv, NSHF_rv) & - bind(C, name="SIDRE_view_get_name_bufferify") + bind(C, name="SIDRE_View_get_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_view_capsule implicit none @@ -1854,7 +1842,7 @@ subroutine c_view_get_name_bufferify(self, SHF_rv, NSHF_rv) & end subroutine c_view_get_name_bufferify subroutine c_view_get_path_bufferify(self, SHF_rv, NSHF_rv) & - bind(C, name="SIDRE_view_get_path_bufferify") + bind(C, name="SIDRE_View_get_path_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_view_capsule implicit none @@ -1864,7 +1852,7 @@ subroutine c_view_get_path_bufferify(self, SHF_rv, NSHF_rv) & end subroutine c_view_get_path_bufferify subroutine c_view_get_path_name_bufferify(self, SHF_rv, NSHF_rv) & - bind(C, name="SIDRE_view_get_path_name_bufferify") + bind(C, name="SIDRE_View_get_path_name_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_view_capsule implicit none @@ -1875,7 +1863,7 @@ end subroutine c_view_get_path_name_bufferify function c_view_get_owning_group(self, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_owning_group") + bind(C, name="SIDRE_View_get_owning_group") use iso_c_binding, only : C_PTR import :: SHROUD_group_capsule, SHROUD_view_capsule implicit none @@ -1886,7 +1874,7 @@ end function c_view_get_owning_group pure function c_view_has_buffer(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_has_buffer") + bind(C, name="SIDRE_View_has_buffer") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1896,7 +1884,7 @@ end function c_view_has_buffer function c_view_get_buffer(self, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_buffer") + bind(C, name="SIDRE_View_get_buffer") use iso_c_binding, only : C_PTR import :: SHROUD_buffer_capsule, SHROUD_view_capsule implicit none @@ -1907,7 +1895,7 @@ end function c_view_get_buffer pure function c_view_is_external(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_external") + bind(C, name="SIDRE_View_is_external") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1917,7 +1905,7 @@ end function c_view_is_external function c_view_is_allocated(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_allocated") + bind(C, name="SIDRE_View_is_allocated") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1927,7 +1915,7 @@ end function c_view_is_allocated pure function c_view_is_applied(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_applied") + bind(C, name="SIDRE_View_is_applied") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1937,7 +1925,7 @@ end function c_view_is_applied pure function c_view_is_described(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_described") + bind(C, name="SIDRE_View_is_described") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1947,7 +1935,7 @@ end function c_view_is_described pure function c_view_is_empty(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_empty") + bind(C, name="SIDRE_View_is_empty") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1957,7 +1945,7 @@ end function c_view_is_empty pure function c_view_is_opaque(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_opaque") + bind(C, name="SIDRE_View_is_opaque") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1967,7 +1955,7 @@ end function c_view_is_opaque pure function c_view_is_scalar(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_scalar") + bind(C, name="SIDRE_View_is_scalar") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1977,7 +1965,7 @@ end function c_view_is_scalar pure function c_view_is_string(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_is_string") + bind(C, name="SIDRE_View_is_string") use iso_c_binding, only : C_BOOL import :: SHROUD_view_capsule implicit none @@ -1987,7 +1975,7 @@ end function c_view_is_string pure function c_view_get_type_id(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_type_id") + bind(C, name="SIDRE_View_get_type_id") use iso_c_binding, only : C_INT import :: SHROUD_view_capsule implicit none @@ -1997,7 +1985,7 @@ end function c_view_get_type_id pure function c_view_get_total_bytes(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_total_bytes") + bind(C, name="SIDRE_View_get_total_bytes") use iso_c_binding, only : C_SIZE_T import :: SHROUD_view_capsule implicit none @@ -2007,7 +1995,7 @@ end function c_view_get_total_bytes pure function c_view_get_num_elements(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_num_elements") + bind(C, name="SIDRE_View_get_num_elements") use iso_c_binding, only : C_SIZE_T import :: SHROUD_view_capsule implicit none @@ -2017,7 +2005,7 @@ end function c_view_get_num_elements pure function c_view_get_bytes_per_element(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_bytes_per_element") + bind(C, name="SIDRE_View_get_bytes_per_element") use iso_c_binding, only : C_SIZE_T import :: SHROUD_view_capsule implicit none @@ -2027,7 +2015,7 @@ end function c_view_get_bytes_per_element pure function c_view_get_offset(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_offset") + bind(C, name="SIDRE_View_get_offset") use iso_c_binding, only : C_SIZE_T import :: SHROUD_view_capsule implicit none @@ -2037,7 +2025,7 @@ end function c_view_get_offset pure function c_view_get_stride(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_stride") + bind(C, name="SIDRE_View_get_stride") use iso_c_binding, only : C_SIZE_T import :: SHROUD_view_capsule implicit none @@ -2047,7 +2035,7 @@ end function c_view_get_stride pure function c_view_get_num_dimensions(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_num_dimensions") + bind(C, name="SIDRE_View_get_num_dimensions") use iso_c_binding, only : C_INT import :: SHROUD_view_capsule implicit none @@ -2057,7 +2045,7 @@ end function c_view_get_num_dimensions function c_view_get_shape(self, ndims, shape) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_shape") + bind(C, name="SIDRE_View_get_shape") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2068,14 +2056,14 @@ function c_view_get_shape(self, ndims, shape) & end function c_view_get_shape subroutine c_view_allocate_simple(self) & - bind(C, name="SIDRE_view_allocate_simple") + bind(C, name="SIDRE_View_allocate_simple") import :: SHROUD_view_capsule implicit none type(SHROUD_view_capsule), intent(IN) :: self end subroutine c_view_allocate_simple subroutine c_view_allocate_from_type(self, type, num_elems) & - bind(C, name="SIDRE_view_allocate_from_type") + bind(C, name="SIDRE_View_allocate_from_type") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2085,7 +2073,7 @@ subroutine c_view_allocate_from_type(self, type, num_elems) & end subroutine c_view_allocate_from_type subroutine c_view_reallocate(self, num_elems) & - bind(C, name="SIDRE_view_reallocate") + bind(C, name="SIDRE_View_reallocate") use iso_c_binding, only : C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2094,7 +2082,7 @@ subroutine c_view_reallocate(self, num_elems) & end subroutine c_view_reallocate subroutine c_view_attach_buffer_only(self, buff) & - bind(C, name="SIDRE_view_attach_buffer_only") + bind(C, name="SIDRE_View_attach_buffer_only") import :: SHROUD_buffer_capsule, SHROUD_view_capsule implicit none type(SHROUD_view_capsule), intent(IN) :: self @@ -2103,7 +2091,7 @@ end subroutine c_view_attach_buffer_only subroutine c_view_attach_buffer_type(self, type, num_elems, & buff) & - bind(C, name="SIDRE_view_attach_buffer_type") + bind(C, name="SIDRE_View_attach_buffer_type") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_buffer_capsule, SHROUD_view_capsule implicit none @@ -2115,7 +2103,7 @@ end subroutine c_view_attach_buffer_type subroutine c_view_attach_buffer_shape(self, type, ndims, shape, & buff) & - bind(C, name="SIDRE_view_attach_buffer_shape") + bind(C, name="SIDRE_View_attach_buffer_shape") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_buffer_capsule, SHROUD_view_capsule implicit none @@ -2127,14 +2115,14 @@ subroutine c_view_attach_buffer_shape(self, type, ndims, shape, & end subroutine c_view_attach_buffer_shape subroutine c_view_apply_0(self) & - bind(C, name="SIDRE_view_apply_0") + bind(C, name="SIDRE_View_apply_0") import :: SHROUD_view_capsule implicit none type(SHROUD_view_capsule), intent(IN) :: self end subroutine c_view_apply_0 subroutine c_view_apply_nelems(self, num_elems) & - bind(C, name="SIDRE_view_apply_nelems") + bind(C, name="SIDRE_View_apply_nelems") use iso_c_binding, only : C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2143,7 +2131,7 @@ subroutine c_view_apply_nelems(self, num_elems) & end subroutine c_view_apply_nelems subroutine c_view_apply_nelems_offset(self, num_elems, offset) & - bind(C, name="SIDRE_view_apply_nelems_offset") + bind(C, name="SIDRE_View_apply_nelems_offset") use iso_c_binding, only : C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2154,7 +2142,7 @@ end subroutine c_view_apply_nelems_offset subroutine c_view_apply_nelems_offset_stride(self, num_elems, & offset, stride) & - bind(C, name="SIDRE_view_apply_nelems_offset_stride") + bind(C, name="SIDRE_View_apply_nelems_offset_stride") use iso_c_binding, only : C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2165,7 +2153,7 @@ subroutine c_view_apply_nelems_offset_stride(self, num_elems, & end subroutine c_view_apply_nelems_offset_stride subroutine c_view_apply_type_nelems(self, type, num_elems) & - bind(C, name="SIDRE_view_apply_type_nelems") + bind(C, name="SIDRE_View_apply_type_nelems") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2176,7 +2164,7 @@ end subroutine c_view_apply_type_nelems subroutine c_view_apply_type_nelems_offset(self, type, & num_elems, offset) & - bind(C, name="SIDRE_view_apply_type_nelems_offset") + bind(C, name="SIDRE_View_apply_type_nelems_offset") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2188,7 +2176,7 @@ end subroutine c_view_apply_type_nelems_offset subroutine c_view_apply_type_nelems_offset_stride(self, type, & num_elems, offset, stride) & - bind(C, name="SIDRE_view_apply_type_nelems_offset_stride") + bind(C, name="SIDRE_View_apply_type_nelems_offset_stride") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2200,7 +2188,7 @@ subroutine c_view_apply_type_nelems_offset_stride(self, type, & end subroutine c_view_apply_type_nelems_offset_stride subroutine c_view_apply_type_shape(self, type, ndims, shape) & - bind(C, name="SIDRE_view_apply_type_shape") + bind(C, name="SIDRE_View_apply_type_shape") use iso_c_binding, only : C_INT, C_INT64_T import :: SHROUD_view_capsule implicit none @@ -2211,7 +2199,7 @@ subroutine c_view_apply_type_shape(self, type, ndims, shape) & end subroutine c_view_apply_type_shape subroutine c_view_set_scalar_int(self, value) & - bind(C, name="SIDRE_view_set_scalar_int") + bind(C, name="SIDRE_View_set_scalar_int") use iso_c_binding, only : C_INT import :: SHROUD_view_capsule implicit none @@ -2220,7 +2208,7 @@ subroutine c_view_set_scalar_int(self, value) & end subroutine c_view_set_scalar_int subroutine c_view_set_scalar_long(self, value) & - bind(C, name="SIDRE_view_set_scalar_long") + bind(C, name="SIDRE_View_set_scalar_long") use iso_c_binding, only : C_LONG import :: SHROUD_view_capsule implicit none @@ -2229,7 +2217,7 @@ subroutine c_view_set_scalar_long(self, value) & end subroutine c_view_set_scalar_long subroutine c_view_set_scalar_float(self, value) & - bind(C, name="SIDRE_view_set_scalar_float") + bind(C, name="SIDRE_View_set_scalar_float") use iso_c_binding, only : C_FLOAT import :: SHROUD_view_capsule implicit none @@ -2238,7 +2226,7 @@ subroutine c_view_set_scalar_float(self, value) & end subroutine c_view_set_scalar_float subroutine c_view_set_scalar_double(self, value) & - bind(C, name="SIDRE_view_set_scalar_double") + bind(C, name="SIDRE_View_set_scalar_double") use iso_c_binding, only : C_DOUBLE import :: SHROUD_view_capsule implicit none @@ -2247,7 +2235,7 @@ subroutine c_view_set_scalar_double(self, value) & end subroutine c_view_set_scalar_double subroutine c_view_set_string(self, value) & - bind(C, name="SIDRE_view_set_string") + bind(C, name="SIDRE_View_set_string") use iso_c_binding, only : C_CHAR import :: SHROUD_view_capsule implicit none @@ -2256,7 +2244,7 @@ subroutine c_view_set_string(self, value) & end subroutine c_view_set_string subroutine c_view_set_string_bufferify(self, value, Lvalue) & - bind(C, name="SIDRE_view_set_string_bufferify") + bind(C, name="SIDRE_View_set_string_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_view_capsule implicit none @@ -2266,7 +2254,7 @@ subroutine c_view_set_string_bufferify(self, value, Lvalue) & end subroutine c_view_set_string_bufferify subroutine c_view_set_external_data_ptr_only(self, external_ptr) & - bind(C, name="SIDRE_view_set_external_data_ptr_only") + bind(C, name="SIDRE_View_set_external_data_ptr_only") use iso_c_binding, only : C_PTR import :: SHROUD_view_capsule implicit none @@ -2276,7 +2264,7 @@ end subroutine c_view_set_external_data_ptr_only subroutine c_view_set_external_data_ptr_type(self, type, & num_elems, external_ptr) & - bind(C, name="SIDRE_view_set_external_data_ptr_type") + bind(C, name="SIDRE_View_set_external_data_ptr_type") use iso_c_binding, only : C_INT, C_INT64_T, C_PTR import :: SHROUD_view_capsule implicit none @@ -2288,7 +2276,7 @@ end subroutine c_view_set_external_data_ptr_type subroutine c_view_set_external_data_ptr_shape(self, type, ndims, & shape, external_ptr) & - bind(C, name="SIDRE_view_set_external_data_ptr_shape") + bind(C, name="SIDRE_View_set_external_data_ptr_shape") use iso_c_binding, only : C_INT, C_INT64_T, C_PTR import :: SHROUD_view_capsule implicit none @@ -2301,7 +2289,7 @@ end subroutine c_view_set_external_data_ptr_shape function c_view_get_string(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_string") + bind(C, name="SIDRE_View_get_string") use iso_c_binding, only : C_PTR import :: SHROUD_view_capsule implicit none @@ -2310,7 +2298,7 @@ function c_view_get_string(self) & end function c_view_get_string subroutine c_view_get_string_bufferify(self, name, Nname) & - bind(C, name="SIDRE_view_get_string_bufferify") + bind(C, name="SIDRE_View_get_string_bufferify") use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_view_capsule implicit none @@ -2321,7 +2309,7 @@ end subroutine c_view_get_string_bufferify function c_view_get_data_int(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_data_int") + bind(C, name="SIDRE_View_get_data_int") use iso_c_binding, only : C_INT import :: SHROUD_view_capsule implicit none @@ -2331,7 +2319,7 @@ end function c_view_get_data_int function c_view_get_data_long(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_data_long") + bind(C, name="SIDRE_View_get_data_long") use iso_c_binding, only : C_LONG import :: SHROUD_view_capsule implicit none @@ -2341,7 +2329,7 @@ end function c_view_get_data_long function c_view_get_data_float(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_data_float") + bind(C, name="SIDRE_View_get_data_float") use iso_c_binding, only : C_FLOAT import :: SHROUD_view_capsule implicit none @@ -2351,7 +2339,7 @@ end function c_view_get_data_float function c_view_get_data_double(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_data_double") + bind(C, name="SIDRE_View_get_data_double") use iso_c_binding, only : C_DOUBLE import :: SHROUD_view_capsule implicit none @@ -2361,7 +2349,7 @@ end function c_view_get_data_double pure function c_view_get_void_ptr(self) & result(SHT_rv) & - bind(C, name="SIDRE_view_get_void_ptr") + bind(C, name="SIDRE_View_get_void_ptr") use iso_c_binding, only : C_PTR import :: SHROUD_view_capsule implicit none @@ -2370,7 +2358,7 @@ pure function c_view_get_void_ptr(self) & end function c_view_get_void_ptr subroutine c_view_print(self) & - bind(C, name="SIDRE_view_print") + bind(C, name="SIDRE_View_print") import :: SHROUD_view_capsule implicit none type(SHROUD_view_capsule), intent(IN) :: self @@ -2378,7 +2366,7 @@ end subroutine c_view_print function c_view_rename(self, new_name) & result(SHT_rv) & - bind(C, name="SIDRE_view_rename") + bind(C, name="SIDRE_View_rename") use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_view_capsule implicit none @@ -2389,7 +2377,7 @@ end function c_view_rename function c_view_rename_bufferify(self, new_name, Lnew_name) & result(SHT_rv) & - bind(C, name="SIDRE_view_rename_bufferify") + bind(C, name="SIDRE_View_rename_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_view_capsule implicit none @@ -2404,7 +2392,7 @@ end function c_view_rename_bufferify function c_datastore_new(SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_new") + bind(C, name="SIDRE_DataStore_new") use iso_c_binding, only : C_PTR import :: SHROUD_datastore_capsule implicit none @@ -2413,7 +2401,7 @@ function c_datastore_new(SHT_crv) & end function c_datastore_new subroutine c_datastore_delete(self) & - bind(C, name="SIDRE_datastore_delete") + bind(C, name="SIDRE_DataStore_delete") import :: SHROUD_datastore_capsule implicit none type(SHROUD_datastore_capsule), intent(IN) :: self @@ -2421,7 +2409,7 @@ end subroutine c_datastore_delete function c_datastore_get_root(self, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_get_root") + bind(C, name="SIDRE_DataStore_get_root") use iso_c_binding, only : C_PTR import :: SHROUD_datastore_capsule, SHROUD_group_capsule implicit none @@ -2432,7 +2420,7 @@ end function c_datastore_get_root pure function c_datastore_get_num_buffers(self) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_get_num_buffers") + bind(C, name="SIDRE_DataStore_get_num_buffers") use iso_c_binding, only : C_SIZE_T import :: SHROUD_datastore_capsule implicit none @@ -2442,7 +2430,7 @@ end function c_datastore_get_num_buffers function c_datastore_get_buffer(self, idx, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_get_buffer") + bind(C, name="SIDRE_DataStore_get_buffer") use iso_c_binding, only : C_INT64_T, C_PTR import :: SHROUD_buffer_capsule, SHROUD_datastore_capsule implicit none @@ -2454,7 +2442,7 @@ end function c_datastore_get_buffer function c_datastore_create_buffer_empty(self, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_create_buffer_empty") + bind(C, name="SIDRE_DataStore_create_buffer_empty") use iso_c_binding, only : C_PTR import :: SHROUD_buffer_capsule, SHROUD_datastore_capsule implicit none @@ -2466,7 +2454,7 @@ end function c_datastore_create_buffer_empty function c_datastore_create_buffer_from_type(self, type, & num_elems, SHT_crv) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_create_buffer_from_type") + bind(C, name="SIDRE_DataStore_create_buffer_from_type") use iso_c_binding, only : C_INT, C_INT64_T, C_PTR import :: SHROUD_buffer_capsule, SHROUD_datastore_capsule implicit none @@ -2478,7 +2466,7 @@ function c_datastore_create_buffer_from_type(self, type, & end function c_datastore_create_buffer_from_type subroutine c_datastore_destroy_buffer(self, id) & - bind(C, name="SIDRE_datastore_destroy_buffer") + bind(C, name="SIDRE_DataStore_destroy_buffer") use iso_c_binding, only : C_INT64_T import :: SHROUD_datastore_capsule implicit none @@ -2489,7 +2477,7 @@ end subroutine c_datastore_destroy_buffer function c_datastore_generate_blueprint_index(self, domain_path, & mesh_name, index_path, num_domains) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_generate_blueprint_index") + bind(C, name="SIDRE_DataStore_generate_blueprint_index") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_datastore_capsule implicit none @@ -2505,7 +2493,7 @@ function c_datastore_generate_blueprint_index_bufferify(self, & domain_path, Ldomain_path, mesh_name, Lmesh_name, & index_path, Lindex_path, num_domains) & result(SHT_rv) & - bind(C, name="SIDRE_datastore_generate_blueprint_index_bufferify") + bind(C, name="SIDRE_DataStore_generate_blueprint_index_bufferify") use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_datastore_capsule implicit none @@ -2521,7 +2509,7 @@ function c_datastore_generate_blueprint_index_bufferify(self, & end function c_datastore_generate_blueprint_index_bufferify subroutine c_datastore_print(self) & - bind(C, name="SIDRE_datastore_print") + bind(C, name="SIDRE_DataStore_print") import :: SHROUD_datastore_capsule implicit none type(SHROUD_datastore_capsule), intent(IN) :: self @@ -2777,9 +2765,9 @@ function group_get_parent(obj) & result(SHT_rv) use iso_c_binding, only : C_PTR class(SidreGroup) :: obj - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.Group.method.get_parent + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_parent(obj%cxxmem, SHT_rv%cxxmem) ! splicer end class.Group.method.get_parent end function group_get_parent @@ -2808,9 +2796,9 @@ function group_get_data_store(obj) & result(SHT_rv) use iso_c_binding, only : C_PTR class(SidreGroup) :: obj - type(C_PTR) :: SHT_prv type(SidreDataStore) :: SHT_rv ! splicer begin class.Group.method.get_data_store + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_data_store(obj%cxxmem, SHT_rv%cxxmem) ! splicer end class.Group.method.get_data_store end function group_get_data_store @@ -2880,9 +2868,9 @@ function group_get_view_from_name(obj, path) & use iso_c_binding, only : C_INT, C_PTR class(SidreGroup) :: obj character(len=*), intent(IN) :: path - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.get_view_from_name + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_view_from_name_bufferify(obj%cxxmem, path, & len_trim(path, kind=C_INT), SHT_rv%cxxmem) ! splicer end class.Group.method.get_view_from_name @@ -2893,9 +2881,9 @@ function group_get_view_from_index_int32_t(obj, idx) & use iso_c_binding, only : C_INT32_T, C_INT64_T, C_PTR class(SidreGroup) :: obj integer(C_INT32_T), value, intent(IN) :: idx - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.get_view_from_index_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_view_from_index(obj%cxxmem, & int(idx, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.Group.method.get_view_from_index_int32_t @@ -2906,9 +2894,9 @@ function group_get_view_from_index_int64_t(obj, idx) & use iso_c_binding, only : C_INT64_T, C_PTR class(SidreGroup) :: obj integer(C_INT64_T), value, intent(IN) :: idx - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.get_view_from_index_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_view_from_index(obj%cxxmem, & int(idx, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.Group.method.get_view_from_index_int64_t @@ -2953,9 +2941,9 @@ function group_create_view_empty(obj, path) & use iso_c_binding, only : C_INT, C_PTR class(SidreGroup) :: obj character(len=*), intent(IN) :: path - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_empty + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_empty_bufferify(obj%cxxmem, path, & len_trim(path, kind=C_INT), SHT_rv%cxxmem) ! splicer end class.Group.method.create_view_empty @@ -2969,9 +2957,9 @@ function group_create_view_from_type_int32_t(obj, path, type, & character(len=*), intent(IN) :: path integer(C_INT), value, intent(IN) :: type integer(C_INT32_T), value, intent(IN) :: num_elems - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_type_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_type_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), SHT_rv%cxxmem) @@ -2986,9 +2974,9 @@ function group_create_view_from_type_int64_t(obj, path, type, & character(len=*), intent(IN) :: path integer(C_INT), value, intent(IN) :: type integer(C_INT64_T), value, intent(IN) :: num_elems - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_type_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_type_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), SHT_rv%cxxmem) @@ -3003,9 +2991,9 @@ function group_create_view_from_shape(obj, path, type, ndims, shape) & integer(C_INT), value, intent(IN) :: type integer(C_INT), value, intent(IN) :: ndims integer(C_INT64_T), intent(IN) :: shape(*) - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_shape + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_shape_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, ndims, shape, & SHT_rv%cxxmem) @@ -3018,9 +3006,9 @@ function group_create_view_into_buffer(obj, path, buff) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path type(SidreBuffer), intent(IN) :: buff - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_into_buffer + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_into_buffer_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), buff%cxxmem, & SHT_rv%cxxmem) @@ -3036,9 +3024,9 @@ function group_create_view_from_type_and_buffer_int32_t(obj, path, & integer(C_INT), value, intent(IN) :: type integer(C_INT32_T), value, intent(IN) :: num_elems type(SidreBuffer), intent(IN) :: buff - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_type_and_buffer_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_type_and_buffer_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), buff%cxxmem, SHT_rv%cxxmem) @@ -3054,9 +3042,9 @@ function group_create_view_from_type_and_buffer_int64_t(obj, path, & integer(C_INT), value, intent(IN) :: type integer(C_INT64_T), value, intent(IN) :: num_elems type(SidreBuffer), intent(IN) :: buff - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_type_and_buffer_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_type_and_buffer_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), buff%cxxmem, SHT_rv%cxxmem) @@ -3073,9 +3061,9 @@ function group_create_view_from_shape_and_buffer(obj, path, type, & integer(C_INT), value, intent(IN) :: ndims integer(C_INT64_T), intent(IN) :: shape(*) type(SidreBuffer), intent(IN) :: buff - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_shape_and_buffer + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_shape_and_buffer_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, ndims, shape, & buff%cxxmem, SHT_rv%cxxmem) @@ -3088,9 +3076,9 @@ function group_create_view_external(obj, path, external_ptr) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path type(C_PTR), value, intent(IN) :: external_ptr - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_external + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_external_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), external_ptr, & SHT_rv%cxxmem) @@ -3106,9 +3094,9 @@ function group_create_view_from_type_external_int32_t(obj, path, & integer(C_INT), value, intent(IN) :: type integer(C_INT32_T), value, intent(IN) :: num_elems type(C_PTR), value, intent(IN) :: external_ptr - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_type_external_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_type_external_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), external_ptr, SHT_rv%cxxmem) @@ -3124,9 +3112,9 @@ function group_create_view_from_type_external_int64_t(obj, path, & integer(C_INT), value, intent(IN) :: type integer(C_INT64_T), value, intent(IN) :: num_elems type(C_PTR), value, intent(IN) :: external_ptr - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_type_external_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_type_external_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), external_ptr, SHT_rv%cxxmem) @@ -3143,9 +3131,9 @@ function group_create_view_from_shape_external(obj, path, type, & integer(C_INT), value, intent(IN) :: ndims integer(C_INT64_T), intent(IN) :: shape(*) type(C_PTR), value, intent(IN) :: external_ptr - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_from_shape_external + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_from_shape_external_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, ndims, shape, & external_ptr, SHT_rv%cxxmem) @@ -3160,9 +3148,9 @@ function group_create_view_and_allocate_nelems_int32_t(obj, path, & character(len=*), intent(IN) :: path integer(C_INT), value, intent(IN) :: type integer(C_INT32_T), value, intent(IN) :: num_elems - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_and_allocate_nelems_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_and_allocate_nelems_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), SHT_rv%cxxmem) @@ -3177,9 +3165,9 @@ function group_create_view_and_allocate_nelems_int64_t(obj, path, & character(len=*), intent(IN) :: path integer(C_INT), value, intent(IN) :: type integer(C_INT64_T), value, intent(IN) :: num_elems - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_and_allocate_nelems_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_and_allocate_nelems_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, & int(num_elems, C_INT64_t), SHT_rv%cxxmem) @@ -3195,9 +3183,9 @@ function group_create_view_and_allocate_shape(obj, path, type, & integer(C_INT), value, intent(IN) :: type integer(C_INT), value, intent(IN) :: ndims integer(C_INT64_T), intent(IN) :: shape(*) - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_and_allocate_shape + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_and_allocate_shape_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), type, ndims, shape, & SHT_rv%cxxmem) @@ -3210,10 +3198,10 @@ function group_create_view_scalar_int(obj, path, value) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path integer(C_INT), value, intent(IN) :: value - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_scalar_int - SHT_prv = c_group_create_view_scalar_int_bufferify(obj%cxxmem, & + type(C_PTR) :: SHT_prv + SHT_prv = c_group_create_view_scalar_bufferify_int(obj%cxxmem, & path, len_trim(path, kind=C_INT), value, SHT_rv%cxxmem) ! splicer end class.Group.method.create_view_scalar_int end function group_create_view_scalar_int @@ -3224,10 +3212,10 @@ function group_create_view_scalar_long(obj, path, value) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path integer(C_LONG), value, intent(IN) :: value - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_scalar_long - SHT_prv = c_group_create_view_scalar_long_bufferify(obj%cxxmem, & + type(C_PTR) :: SHT_prv + SHT_prv = c_group_create_view_scalar_bufferify_long(obj%cxxmem, & path, len_trim(path, kind=C_INT), value, SHT_rv%cxxmem) ! splicer end class.Group.method.create_view_scalar_long end function group_create_view_scalar_long @@ -3238,10 +3226,10 @@ function group_create_view_scalar_float(obj, path, value) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path real(C_FLOAT), value, intent(IN) :: value - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_scalar_float - SHT_prv = c_group_create_view_scalar_float_bufferify(obj%cxxmem, & + type(C_PTR) :: SHT_prv + SHT_prv = c_group_create_view_scalar_bufferify_float(obj%cxxmem, & path, len_trim(path, kind=C_INT), value, SHT_rv%cxxmem) ! splicer end class.Group.method.create_view_scalar_float end function group_create_view_scalar_float @@ -3252,10 +3240,10 @@ function group_create_view_scalar_double(obj, path, value) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path real(C_DOUBLE), value, intent(IN) :: value - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_scalar_double - SHT_prv = c_group_create_view_scalar_double_bufferify(obj%cxxmem, & + type(C_PTR) :: SHT_prv + SHT_prv = c_group_create_view_scalar_bufferify_double(obj%cxxmem, & path, len_trim(path, kind=C_INT), value, SHT_rv%cxxmem) ! splicer end class.Group.method.create_view_scalar_double end function group_create_view_scalar_double @@ -3266,9 +3254,9 @@ function group_create_view_string(obj, path, value) & class(SidreGroup) :: obj character(len=*), intent(IN) :: path character(len=*), intent(IN) :: value - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.create_view_string + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_view_string_bufferify(obj%cxxmem, path, & len_trim(path, kind=C_INT), value, & len_trim(value, kind=C_INT), SHT_rv%cxxmem) @@ -3320,9 +3308,9 @@ function group_move_view(obj, view) & use iso_c_binding, only : C_PTR class(SidreGroup) :: obj type(SidreView), intent(IN) :: view - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.move_view + type(C_PTR) :: SHT_prv SHT_prv = c_group_move_view(obj%cxxmem, view%cxxmem, & SHT_rv%cxxmem) ! splicer end class.Group.method.move_view @@ -3333,9 +3321,9 @@ function group_copy_view(obj, view) & use iso_c_binding, only : C_PTR class(SidreGroup) :: obj type(SidreView), intent(IN) :: view - type(C_PTR) :: SHT_prv type(SidreView) :: SHT_rv ! splicer begin class.Group.method.copy_view + type(C_PTR) :: SHT_prv SHT_prv = c_group_copy_view(obj%cxxmem, view%cxxmem, & SHT_rv%cxxmem) ! splicer end class.Group.method.copy_view @@ -3406,9 +3394,9 @@ function group_get_group_from_name(obj, path) & use iso_c_binding, only : C_INT, C_PTR class(SidreGroup) :: obj character(len=*), intent(IN) :: path - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.Group.method.get_group_from_name + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_group_from_name_bufferify(obj%cxxmem, & path, len_trim(path, kind=C_INT), SHT_rv%cxxmem) ! splicer end class.Group.method.get_group_from_name @@ -3419,9 +3407,9 @@ function group_get_group_from_index_int32_t(obj, idx) & use iso_c_binding, only : C_INT32_T, C_INT64_T, C_PTR class(SidreGroup) :: obj integer(C_INT32_T), value, intent(IN) :: idx - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.Group.method.get_group_from_index_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_group_from_index(obj%cxxmem, & int(idx, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.Group.method.get_group_from_index_int32_t @@ -3432,9 +3420,9 @@ function group_get_group_from_index_int64_t(obj, idx) & use iso_c_binding, only : C_INT64_T, C_PTR class(SidreGroup) :: obj integer(C_INT64_T), value, intent(IN) :: idx - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.Group.method.get_group_from_index_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_group_get_group_from_index(obj%cxxmem, & int(idx, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.Group.method.get_group_from_index_int64_t @@ -3479,9 +3467,9 @@ function group_create_group(obj, path) & use iso_c_binding, only : C_INT, C_PTR class(SidreGroup) :: obj character(len=*), intent(IN) :: path - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.Group.method.create_group + type(C_PTR) :: SHT_prv SHT_prv = c_group_create_group_bufferify(obj%cxxmem, path, & len_trim(path, kind=C_INT), SHT_rv%cxxmem) ! splicer end class.Group.method.create_group @@ -3522,9 +3510,9 @@ function group_move_group(obj, grp) & use iso_c_binding, only : C_PTR class(SidreGroup) :: obj type(SidreGroup), intent(IN) :: grp - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.Group.method.move_group + type(C_PTR) :: SHT_prv SHT_prv = c_group_move_group(obj%cxxmem, grp%cxxmem, & SHT_rv%cxxmem) ! splicer end class.Group.method.move_group @@ -3578,9 +3566,9 @@ subroutine group_load_1(obj, file_path, protocol, preserve_contents) character(len=*), intent(IN) :: file_path character(len=*), intent(IN) :: protocol logical, value, intent(IN) :: preserve_contents + ! splicer begin class.Group.method.load_1 logical(C_BOOL) SH_preserve_contents SH_preserve_contents = preserve_contents ! coerce to C_BOOL - ! splicer begin class.Group.method.load_1 call c_group_load_1_bufferify(obj%cxxmem, file_path, & len_trim(file_path, kind=C_INT), protocol, & len_trim(protocol, kind=C_INT), SH_preserve_contents) @@ -4931,9 +4919,9 @@ function view_get_owning_group(obj) & result(SHT_rv) use iso_c_binding, only : C_PTR class(SidreView) :: obj - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.View.method.get_owning_group + type(C_PTR) :: SHT_prv SHT_prv = c_view_get_owning_group(obj%cxxmem, SHT_rv%cxxmem) ! splicer end class.View.method.get_owning_group end function view_get_owning_group @@ -4952,9 +4940,9 @@ function view_get_buffer(obj) & result(SHT_rv) use iso_c_binding, only : C_PTR class(SidreView) :: obj - type(C_PTR) :: SHT_prv type(SidreBuffer) :: SHT_rv ! splicer begin class.View.method.get_buffer + type(C_PTR) :: SHT_prv SHT_prv = c_view_get_buffer(obj%cxxmem, SHT_rv%cxxmem) ! splicer end class.View.method.get_buffer end function view_get_buffer @@ -6473,9 +6461,9 @@ end subroutine view_set_array_data_ptr_double_4d function datastore_new() & result(SHT_rv) use iso_c_binding, only : C_PTR - type(C_PTR) :: SHT_prv type(SidreDataStore) :: SHT_rv ! splicer begin class.DataStore.method.new + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_new(SHT_rv%cxxmem) ! splicer end class.DataStore.method.new end function datastore_new @@ -6491,9 +6479,9 @@ function datastore_get_root(obj) & result(SHT_rv) use iso_c_binding, only : C_PTR class(SidreDataStore) :: obj - type(C_PTR) :: SHT_prv type(SidreGroup) :: SHT_rv ! splicer begin class.DataStore.method.get_root + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_get_root(obj%cxxmem, SHT_rv%cxxmem) ! splicer end class.DataStore.method.get_root end function datastore_get_root @@ -6513,9 +6501,9 @@ function datastore_get_buffer_int32_t(obj, idx) & use iso_c_binding, only : C_INT32_T, C_INT64_T, C_PTR class(SidreDataStore) :: obj integer(C_INT32_T), value, intent(IN) :: idx - type(C_PTR) :: SHT_prv type(SidreBuffer) :: SHT_rv ! splicer begin class.DataStore.method.get_buffer_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_get_buffer(obj%cxxmem, & int(idx, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.DataStore.method.get_buffer_int32_t @@ -6526,9 +6514,9 @@ function datastore_get_buffer_int64_t(obj, idx) & use iso_c_binding, only : C_INT64_T, C_PTR class(SidreDataStore) :: obj integer(C_INT64_T), value, intent(IN) :: idx - type(C_PTR) :: SHT_prv type(SidreBuffer) :: SHT_rv ! splicer begin class.DataStore.method.get_buffer_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_get_buffer(obj%cxxmem, & int(idx, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.DataStore.method.get_buffer_int64_t @@ -6538,9 +6526,9 @@ function datastore_create_buffer_empty(obj) & result(SHT_rv) use iso_c_binding, only : C_PTR class(SidreDataStore) :: obj - type(C_PTR) :: SHT_prv type(SidreBuffer) :: SHT_rv ! splicer begin class.DataStore.method.create_buffer_empty + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_create_buffer_empty(obj%cxxmem, & SHT_rv%cxxmem) ! splicer end class.DataStore.method.create_buffer_empty @@ -6553,9 +6541,9 @@ function datastore_create_buffer_from_type_int32_t(obj, type, & class(SidreDataStore) :: obj integer(C_INT), value, intent(IN) :: type integer(C_INT32_T), value, intent(IN) :: num_elems - type(C_PTR) :: SHT_prv type(SidreBuffer) :: SHT_rv ! splicer begin class.DataStore.method.create_buffer_from_type_int32_t + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_create_buffer_from_type(obj%cxxmem, type, & int(num_elems, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.DataStore.method.create_buffer_from_type_int32_t @@ -6568,9 +6556,9 @@ function datastore_create_buffer_from_type_int64_t(obj, type, & class(SidreDataStore) :: obj integer(C_INT), value, intent(IN) :: type integer(C_INT64_T), value, intent(IN) :: num_elems - type(C_PTR) :: SHT_prv type(SidreBuffer) :: SHT_rv ! splicer begin class.DataStore.method.create_buffer_from_type_int64_t + type(C_PTR) :: SHT_prv SHT_prv = c_datastore_create_buffer_from_type(obj%cxxmem, type, & int(num_elems, C_INT64_t), SHT_rv%cxxmem) ! splicer end class.DataStore.method.create_buffer_from_type_int64_t diff --git a/src/axom/sidre/interface/yaml/sidre_types.yaml b/src/axom/sidre/interface/yaml/sidre_types.yaml index 35e250c337..002508b0e9 100644 --- a/src/axom/sidre/interface/yaml/sidre_types.yaml +++ b/src/axom/sidre/interface/yaml/sidre_types.yaml @@ -5,8 +5,8 @@ # other Axom Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) -# Types generated by Shroud for library Sidre -declarations: +# Types generated by Shroud for library 'Sidre' +typemap: - namespace: axom declarations: axom - namespace: sidre @@ -14,9 +14,9 @@ declarations: - type: Buffer fields: base: shadow - cxx_header: axom/sidre/core/Buffer.hpp - cxx_type: axom::sidre::Buffer - c_type: SIDRE_buffer + wrap_header: + - typesSidre.h + c_type: SIDRE_Buffer f_module_name: axom_sidre f_derived_type: SidreBuffer f_capsule_data_type: SHROUD_buffer_capsule @@ -24,9 +24,9 @@ declarations: - type: DataStore fields: base: shadow - cxx_header: axom/sidre/core/DataStore.hpp - cxx_type: axom::sidre::DataStore - c_type: SIDRE_datastore + wrap_header: + - typesSidre.h + c_type: SIDRE_DataStore f_module_name: axom_sidre f_derived_type: SidreDataStore f_capsule_data_type: SHROUD_datastore_capsule @@ -34,9 +34,9 @@ declarations: - type: Group fields: base: shadow - cxx_header: axom/sidre/core/Group.hpp - cxx_type: axom::sidre::Group - c_type: SIDRE_group + wrap_header: + - typesSidre.h + c_type: SIDRE_Group f_module_name: axom_sidre f_derived_type: SidreGroup f_capsule_data_type: SHROUD_group_capsule @@ -44,9 +44,9 @@ declarations: - type: View fields: base: shadow - cxx_header: axom/sidre/core/View.hpp - cxx_type: axom::sidre::View - c_type: SIDRE_view + wrap_header: + - typesSidre.h + c_type: SIDRE_View f_module_name: axom_sidre f_derived_type: SidreView f_capsule_data_type: SHROUD_view_capsule diff --git a/src/axom/sidre/spio/interface/c_fortran/typesSPIO.h b/src/axom/sidre/spio/interface/c_fortran/typesSPIO.h index b734385dc7..d22d46ec30 100644 --- a/src/axom/sidre/spio/interface/c_fortran/typesSPIO.h +++ b/src/axom/sidre/spio/interface/c_fortran/typesSPIO.h @@ -4,8 +4,7 @@ // Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // -// SPDX-License-Identifier (BSD-3-Clause) -// +// SPDX-License-Identifier: (BSD-3-Clause) // For C users and C++ implementation #ifndef TYPESSPIO_H @@ -16,21 +15,21 @@ extern "C" { #endif -struct s_SPIO_iomanager +struct s_SPIO_IOManager { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SPIO_iomanager SPIO_iomanager; +typedef struct s_SPIO_IOManager SPIO_IOManager; -struct s_SPI_SHROUD_capsule_data +struct s_SPIO_SHROUD_capsule_data { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SPI_SHROUD_capsule_data SPI_SHROUD_capsule_data; +typedef struct s_SPIO_SHROUD_capsule_data SPIO_SHROUD_capsule_data; -void SPIO_SHROUD_memory_destructor(SPI_SHROUD_capsule_data* cap); +void SPIO_SHROUD_memory_destructor(SPIO_SHROUD_capsule_data* cap); #ifdef __cplusplus } diff --git a/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.cpp b/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.cpp index 37ed5eae37..6ba92d9884 100644 --- a/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.cpp +++ b/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.cpp @@ -4,13 +4,10 @@ // Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // -// SPDX-License-Identifier (BSD-3-Clause) -// +// SPDX-License-Identifier: (BSD-3-Clause) #include "wrapIOManager.h" -#include +#include #include -#include "axom/sidre/core/DataStore.hpp" -#include "axom/sidre/core/Group.hpp" #include "axom/sidre/spio/IOManager.hpp" // splicer begin class.IOManager.CXX_definitions @@ -21,323 +18,325 @@ extern "C" { // splicer begin class.IOManager.C_definitions // splicer end class.IOManager.C_definitions -SPIO_iomanager* SPIO_iomanager_new_0(MPI_Fint com, SPIO_iomanager* SHC_rv) +SPIO_IOManager* SPIO_IOManager_new_0(MPI_Fint com, SPIO_IOManager* SHC_rv) { -// splicer begin class.IOManager.method.new_0 + // splicer begin class.IOManager.method.new_0 MPI_Comm SHCXX_com = MPI_Comm_f2c(com); axom::sidre::IOManager* SHCXX_rv = new axom::sidre::IOManager(SHCXX_com); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.IOManager.method.new_0 + // splicer end class.IOManager.method.new_0 } -SPIO_iomanager* SPIO_iomanager_new_1(MPI_Fint com, bool use_scr, - SPIO_iomanager* SHC_rv) +SPIO_IOManager* SPIO_IOManager_new_1(MPI_Fint com, bool use_scr, + SPIO_IOManager* SHC_rv) { -// splicer begin class.IOManager.method.new_1 + // splicer begin class.IOManager.method.new_1 MPI_Comm SHCXX_com = MPI_Comm_f2c(com); axom::sidre::IOManager* SHCXX_rv = new axom::sidre::IOManager(SHCXX_com, use_scr); SHC_rv->addr = static_cast(SHCXX_rv); SHC_rv->idtor = 0; return SHC_rv; -// splicer end class.IOManager.method.new_1 + // splicer end class.IOManager.method.new_1 } -void SPIO_iomanager_delete(SPIO_iomanager* self) +void SPIO_IOManager_delete(SPIO_IOManager* self) { -// splicer begin class.IOManager.method.delete axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.delete delete SH_this; self->addr = NULL; return; -// splicer end class.IOManager.method.delete + // splicer end class.IOManager.method.delete } -void SPIO_iomanager_write(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_write(SPIO_IOManager* self, SIDRE_Group* group, int num_files, const char* file_string, const char* protocol) { -// splicer begin class.IOManager.method.write axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.write axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_string(file_string); - const std::string SH_protocol(protocol); - SH_this->write(SHCXX_group, num_files, SH_file_string, SH_protocol); + const std::string SHCXX_file_string(file_string); + const std::string SHCXX_protocol(protocol); + SH_this->write(SHCXX_group, num_files, SHCXX_file_string, SHCXX_protocol); return; -// splicer end class.IOManager.method.write + // splicer end class.IOManager.method.write } -void SPIO_iomanager_write_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_write_bufferify(SPIO_IOManager* self, SIDRE_Group* group, int num_files, const char* file_string, int Lfile_string, const char* protocol, int Lprotocol) { -// splicer begin class.IOManager.method.write_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.write_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_string(file_string, Lfile_string); - const std::string SH_protocol(protocol, Lprotocol); - SH_this->write(SHCXX_group, num_files, SH_file_string, SH_protocol); + const std::string SHCXX_file_string(file_string, Lfile_string); + const std::string SHCXX_protocol(protocol, Lprotocol); + SH_this->write(SHCXX_group, num_files, SHCXX_file_string, SHCXX_protocol); return; -// splicer end class.IOManager.method.write_bufferify + // splicer end class.IOManager.method.write_bufferify } -void SPIO_iomanager_write_group_to_root_file(SPIO_iomanager* self, - SIDRE_group* group, +void SPIO_IOManager_write_group_to_root_file(SPIO_IOManager* self, + SIDRE_Group* group, const char* file_name) { -// splicer begin class.IOManager.method.write_group_to_root_file axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.write_group_to_root_file axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_name(file_name); - SH_this->writeGroupToRootFile(SHCXX_group, SH_file_name); + const std::string SHCXX_file_name(file_name); + SH_this->writeGroupToRootFile(SHCXX_group, SHCXX_file_name); return; -// splicer end class.IOManager.method.write_group_to_root_file + // splicer end class.IOManager.method.write_group_to_root_file } -void SPIO_iomanager_write_group_to_root_file_bufferify(SPIO_iomanager* self, - SIDRE_group* group, +void SPIO_IOManager_write_group_to_root_file_bufferify(SPIO_IOManager* self, + SIDRE_Group* group, const char* file_name, int Lfile_name) { -// splicer begin class.IOManager.method.write_group_to_root_file_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.write_group_to_root_file_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_name(file_name, Lfile_name); - SH_this->writeGroupToRootFile(SHCXX_group, SH_file_name); + const std::string SHCXX_file_name(file_name, Lfile_name); + SH_this->writeGroupToRootFile(SHCXX_group, SHCXX_file_name); return; -// splicer end class.IOManager.method.write_group_to_root_file_bufferify + // splicer end class.IOManager.method.write_group_to_root_file_bufferify } -void SPIO_iomanager_write_blueprint_index_to_root_file(SPIO_iomanager* self, - SIDRE_datastore* datastore, const char* domain_path, const char* file_name, +void SPIO_IOManager_write_blueprint_index_to_root_file(SPIO_IOManager* self, + SIDRE_DataStore* datastore, const char* domain_path, const char* file_name, const char* mesh_path) { -// splicer begin class.IOManager.method.write_blueprint_index_to_root_file axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.write_blueprint_index_to_root_file axom::sidre::DataStore* SHCXX_datastore = static_cast(datastore->addr); - const std::string SH_domain_path(domain_path); - const std::string SH_file_name(file_name); - const std::string SH_mesh_path(mesh_path); - SH_this->writeBlueprintIndexToRootFile(SHCXX_datastore, SH_domain_path, - SH_file_name, SH_mesh_path); + const std::string SHCXX_domain_path(domain_path); + const std::string SHCXX_file_name(file_name); + const std::string SHCXX_mesh_path(mesh_path); + SH_this->writeBlueprintIndexToRootFile(SHCXX_datastore, SHCXX_domain_path, + SHCXX_file_name, SHCXX_mesh_path); return; -// splicer end class.IOManager.method.write_blueprint_index_to_root_file + // splicer end class.IOManager.method.write_blueprint_index_to_root_file } -void SPIO_iomanager_write_blueprint_index_to_root_file_bufferify( - SPIO_iomanager* self, SIDRE_datastore* datastore, const char* domain_path, +void SPIO_IOManager_write_blueprint_index_to_root_file_bufferify( + SPIO_IOManager* self, SIDRE_DataStore* datastore, const char* domain_path, int Ldomain_path, const char* file_name, int Lfile_name, const char* mesh_path, int Lmesh_path) { -// splicer begin -// class.IOManager.method.write_blueprint_index_to_root_file_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin + // class.IOManager.method.write_blueprint_index_to_root_file_bufferify axom::sidre::DataStore* SHCXX_datastore = static_cast(datastore->addr); - const std::string SH_domain_path(domain_path, Ldomain_path); - const std::string SH_file_name(file_name, Lfile_name); - const std::string SH_mesh_path(mesh_path, Lmesh_path); - SH_this->writeBlueprintIndexToRootFile(SHCXX_datastore, SH_domain_path, - SH_file_name, SH_mesh_path); + const std::string SHCXX_domain_path(domain_path, Ldomain_path); + const std::string SHCXX_file_name(file_name, Lfile_name); + const std::string SHCXX_mesh_path(mesh_path, Lmesh_path); + SH_this->writeBlueprintIndexToRootFile(SHCXX_datastore, SHCXX_domain_path, + SHCXX_file_name, SHCXX_mesh_path); return; -// splicer end -// class.IOManager.method.write_blueprint_index_to_root_file_bufferify + // splicer end + // class.IOManager.method.write_blueprint_index_to_root_file_bufferify } -void SPIO_iomanager_read_0(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_0(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, const char* protocol) { -// splicer begin class.IOManager.method.read_0 axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_0 axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_string(file_string); - const std::string SH_protocol(protocol); - SH_this->read(SHCXX_group, SH_file_string, SH_protocol); + const std::string SHCXX_file_string(file_string); + const std::string SHCXX_protocol(protocol); + SH_this->read(SHCXX_group, SHCXX_file_string, SHCXX_protocol); return; -// splicer end class.IOManager.method.read_0 + // splicer end class.IOManager.method.read_0 } -void SPIO_iomanager_read_0_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_0_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, int Lfile_string, const char* protocol, int Lprotocol) { -// splicer begin class.IOManager.method.read_0_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_0_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_string(file_string, Lfile_string); - const std::string SH_protocol(protocol, Lprotocol); - SH_this->read(SHCXX_group, SH_file_string, SH_protocol); + const std::string SHCXX_file_string(file_string, Lfile_string); + const std::string SHCXX_protocol(protocol, Lprotocol); + SH_this->read(SHCXX_group, SHCXX_file_string, SHCXX_protocol); return; -// splicer end class.IOManager.method.read_0_bufferify + // splicer end class.IOManager.method.read_0_bufferify } -void SPIO_iomanager_read_1(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_1(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, const char* protocol, bool preserve_contents) { -// splicer begin class.IOManager.method.read_1 axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_1 axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_string(file_string); - const std::string SH_protocol(protocol); - SH_this->read(SHCXX_group, SH_file_string, SH_protocol, preserve_contents); + const std::string SHCXX_file_string(file_string); + const std::string SHCXX_protocol(protocol); + SH_this->read(SHCXX_group, SHCXX_file_string, SHCXX_protocol, + preserve_contents); return; -// splicer end class.IOManager.method.read_1 + // splicer end class.IOManager.method.read_1 } -void SPIO_iomanager_read_1_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_1_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, int Lfile_string, const char* protocol, int Lprotocol, bool preserve_contents) { -// splicer begin class.IOManager.method.read_1_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_1_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_file_string(file_string, Lfile_string); - const std::string SH_protocol(protocol, Lprotocol); - SH_this->read(SHCXX_group, SH_file_string, SH_protocol, preserve_contents); + const std::string SHCXX_file_string(file_string, Lfile_string); + const std::string SHCXX_protocol(protocol, Lprotocol); + SH_this->read(SHCXX_group, SHCXX_file_string, SHCXX_protocol, + preserve_contents); return; -// splicer end class.IOManager.method.read_1_bufferify + // splicer end class.IOManager.method.read_1_bufferify } -void SPIO_iomanager_read_2(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_2(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file) { -// splicer begin class.IOManager.method.read_2 axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_2 axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file); - SH_this->read(SHCXX_group, SH_root_file); + const std::string SHCXX_root_file(root_file); + SH_this->read(SHCXX_group, SHCXX_root_file); return; -// splicer end class.IOManager.method.read_2 + // splicer end class.IOManager.method.read_2 } -void SPIO_iomanager_read_2_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_2_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, int Lroot_file) { -// splicer begin class.IOManager.method.read_2_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_2_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file, Lroot_file); - SH_this->read(SHCXX_group, SH_root_file); + const std::string SHCXX_root_file(root_file, Lroot_file); + SH_this->read(SHCXX_group, SHCXX_root_file); return; -// splicer end class.IOManager.method.read_2_bufferify + // splicer end class.IOManager.method.read_2_bufferify } -void SPIO_iomanager_read_3(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_3(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, bool preserve_contents) { -// splicer begin class.IOManager.method.read_3 axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_3 axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file); - SH_this->read(SHCXX_group, SH_root_file, preserve_contents); + const std::string SHCXX_root_file(root_file); + SH_this->read(SHCXX_group, SHCXX_root_file, preserve_contents); return; -// splicer end class.IOManager.method.read_3 + // splicer end class.IOManager.method.read_3 } -void SPIO_iomanager_read_3_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_3_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, int Lroot_file, bool preserve_contents) { -// splicer begin class.IOManager.method.read_3_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_3_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file, Lroot_file); - SH_this->read(SHCXX_group, SH_root_file, preserve_contents); + const std::string SHCXX_root_file(root_file, Lroot_file); + SH_this->read(SHCXX_group, SHCXX_root_file, preserve_contents); return; -// splicer end class.IOManager.method.read_3_bufferify + // splicer end class.IOManager.method.read_3_bufferify } -void SPIO_iomanager_read_4(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_4(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, bool preserve_contents, bool use_scr) { -// splicer begin class.IOManager.method.read_4 axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_4 axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file); - SH_this->read(SHCXX_group, SH_root_file, preserve_contents, use_scr); + const std::string SHCXX_root_file(root_file); + SH_this->read(SHCXX_group, SHCXX_root_file, preserve_contents, use_scr); return; -// splicer end class.IOManager.method.read_4 + // splicer end class.IOManager.method.read_4 } -void SPIO_iomanager_read_4_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_4_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, int Lroot_file, bool preserve_contents, bool use_scr) { -// splicer begin class.IOManager.method.read_4_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.read_4_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file, Lroot_file); - SH_this->read(SHCXX_group, SH_root_file, preserve_contents, use_scr); + const std::string SHCXX_root_file(root_file, Lroot_file); + SH_this->read(SHCXX_group, SHCXX_root_file, preserve_contents, use_scr); return; -// splicer end class.IOManager.method.read_4_bufferify + // splicer end class.IOManager.method.read_4_bufferify } -void SPIO_iomanager_load_external_data(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_load_external_data(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file) { -// splicer begin class.IOManager.method.load_external_data axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.load_external_data axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file); - SH_this->loadExternalData(SHCXX_group, SH_root_file); + const std::string SHCXX_root_file(root_file); + SH_this->loadExternalData(SHCXX_group, SHCXX_root_file); return; -// splicer end class.IOManager.method.load_external_data + // splicer end class.IOManager.method.load_external_data } -void SPIO_iomanager_load_external_data_bufferify(SPIO_iomanager* self, - SIDRE_group* group, +void SPIO_IOManager_load_external_data_bufferify(SPIO_IOManager* self, + SIDRE_Group* group, const char* root_file, int Lroot_file) { -// splicer begin class.IOManager.method.load_external_data_bufferify axom::sidre::IOManager* SH_this = static_cast(self->addr); + // splicer begin class.IOManager.method.load_external_data_bufferify axom::sidre::Group* SHCXX_group = static_cast(group->addr); - const std::string SH_root_file(root_file, Lroot_file); - SH_this->loadExternalData(SHCXX_group, SH_root_file); + const std::string SHCXX_root_file(root_file, Lroot_file); + SH_this->loadExternalData(SHCXX_group, SHCXX_root_file); return; -// splicer end class.IOManager.method.load_external_data_bufferify + // splicer end class.IOManager.method.load_external_data_bufferify } } // extern "C" diff --git a/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.h b/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.h index 13e360ba3c..5f3244b07e 100644 --- a/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.h +++ b/src/axom/sidre/spio/interface/c_fortran/wrapIOManager.h @@ -4,8 +4,7 @@ // Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // -// SPDX-License-Identifier (BSD-3-Clause) -// +// SPDX-License-Identifier: (BSD-3-Clause) /** * \file wrapIOManager.h * \brief Shroud generated wrapper for IOManager class @@ -19,6 +18,9 @@ #include "axom/sidre/interface/c_fortran/wrapGroup.h" #include "mpi.h" #include "typesSPIO.h" +#ifndef __cplusplus +#include +#endif // splicer begin class.IOManager.CXX_declarations // splicer end class.IOManager.CXX_declarations @@ -30,82 +32,82 @@ extern "C" { // splicer begin class.IOManager.C_declarations // splicer end class.IOManager.C_declarations -SPIO_iomanager* SPIO_iomanager_new_0(MPI_Fint com, SPIO_iomanager* SHC_rv); +SPIO_IOManager* SPIO_IOManager_new_0(MPI_Fint com, SPIO_IOManager* SHC_rv); -SPIO_iomanager* SPIO_iomanager_new_1(MPI_Fint com, bool use_scr, - SPIO_iomanager* SHC_rv); +SPIO_IOManager* SPIO_IOManager_new_1(MPI_Fint com, bool use_scr, + SPIO_IOManager* SHC_rv); -void SPIO_iomanager_delete(SPIO_iomanager* self); +void SPIO_IOManager_delete(SPIO_IOManager* self); -void SPIO_iomanager_write(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_write(SPIO_IOManager* self, SIDRE_Group* group, int num_files, const char* file_string, const char* protocol); -void SPIO_iomanager_write_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_write_bufferify(SPIO_IOManager* self, SIDRE_Group* group, int num_files, const char* file_string, int Lfile_string, const char* protocol, int Lprotocol); -void SPIO_iomanager_write_group_to_root_file(SPIO_iomanager* self, - SIDRE_group* group, +void SPIO_IOManager_write_group_to_root_file(SPIO_IOManager* self, + SIDRE_Group* group, const char* file_name); -void SPIO_iomanager_write_group_to_root_file_bufferify(SPIO_iomanager* self, - SIDRE_group* group, +void SPIO_IOManager_write_group_to_root_file_bufferify(SPIO_IOManager* self, + SIDRE_Group* group, const char* file_name, int Lfile_name); -void SPIO_iomanager_write_blueprint_index_to_root_file(SPIO_iomanager* self, - SIDRE_datastore* datastore, const char* domain_path, const char* file_name, +void SPIO_IOManager_write_blueprint_index_to_root_file(SPIO_IOManager* self, + SIDRE_DataStore* datastore, const char* domain_path, const char* file_name, const char* mesh_path); -void SPIO_iomanager_write_blueprint_index_to_root_file_bufferify( - SPIO_iomanager* self, SIDRE_datastore* datastore, const char* domain_path, +void SPIO_IOManager_write_blueprint_index_to_root_file_bufferify( + SPIO_IOManager* self, SIDRE_DataStore* datastore, const char* domain_path, int Ldomain_path, const char* file_name, int Lfile_name, const char* mesh_path, int Lmesh_path); -void SPIO_iomanager_read_0(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_0(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, const char* protocol); -void SPIO_iomanager_read_0_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_0_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, int Lfile_string, const char* protocol, int Lprotocol); -void SPIO_iomanager_read_1(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_1(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, const char* protocol, bool preserve_contents); -void SPIO_iomanager_read_1_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_1_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* file_string, int Lfile_string, const char* protocol, int Lprotocol, bool preserve_contents); -void SPIO_iomanager_read_2(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_2(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file); -void SPIO_iomanager_read_2_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_2_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, int Lroot_file); -void SPIO_iomanager_read_3(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_3(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, bool preserve_contents); -void SPIO_iomanager_read_3_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_3_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, int Lroot_file, bool preserve_contents); -void SPIO_iomanager_read_4(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_4(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, bool preserve_contents, bool use_scr); -void SPIO_iomanager_read_4_bufferify(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_read_4_bufferify(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file, int Lroot_file, bool preserve_contents, bool use_scr); -void SPIO_iomanager_load_external_data(SPIO_iomanager* self, SIDRE_group* group, +void SPIO_IOManager_load_external_data(SPIO_IOManager* self, SIDRE_Group* group, const char* root_file); -void SPIO_iomanager_load_external_data_bufferify(SPIO_iomanager* self, - SIDRE_group* group, +void SPIO_IOManager_load_external_data_bufferify(SPIO_IOManager* self, + SIDRE_Group* group, const char* root_file, int Lroot_file); diff --git a/src/axom/sidre/spio/interface/c_fortran/wrapSPIO.cpp b/src/axom/sidre/spio/interface/c_fortran/wrapSPIO.cpp index 1e1e3e6216..d171614615 100644 --- a/src/axom/sidre/spio/interface/c_fortran/wrapSPIO.cpp +++ b/src/axom/sidre/spio/interface/c_fortran/wrapSPIO.cpp @@ -4,12 +4,12 @@ // Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // -// SPDX-License-Identifier (BSD-3-Clause) -// -#include -#include "axom/sidre/spio/IOManager.hpp" +// SPDX-License-Identifier: (BSD-3-Clause) +#include #include "typesSPIO.h" +#include "axom/sidre/spio/IOManager.hpp" + // splicer begin CXX_definitions // splicer end CXX_definitions @@ -18,8 +18,8 @@ extern "C" { // splicer begin C_definitions // splicer end C_definitions -// Release C++ allocated memory. -void SPIO_SHROUD_memory_destructor(SPI_SHROUD_capsule_data* cap) +// Release library allocated memory. +void SPIO_SHROUD_memory_destructor(SPIO_SHROUD_capsule_data* cap) { void* ptr = cap->addr; switch (cap->idtor) diff --git a/src/axom/sidre/spio/interface/c_fortran/wrapfspio.f b/src/axom/sidre/spio/interface/c_fortran/wrapfspio.f index d596f453c2..56dd86f176 100644 --- a/src/axom/sidre/spio/interface/c_fortran/wrapfspio.f +++ b/src/axom/sidre/spio/interface/c_fortran/wrapfspio.f @@ -4,11 +4,10 @@ ! Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and ! other Axom Project Developers. See the top-level COPYRIGHT file for details. ! -! SPDX-License-Identifier (BSD-3-Clause) -! +! SPDX-License-Identifier: (BSD-3-Clause) !> !! \file wrapfspio.f -!! \brief Shroud generated wrapper for SPIO library +!! \brief Shroud generated wrapper for sidre namespace !< ! splicer begin file_top ! splicer end file_top @@ -21,9 +20,6 @@ module axom_spio ! splicer begin module_top ! splicer end module_top - ! splicer begin class.IOManager.module_top - ! splicer end class.IOManager.module_top - type, bind(C) :: SHROUD_iomanager_capsule type(C_PTR) :: addr = C_NULL_PTR ! address of C++ memory integer(C_INT) :: idtor = 0 ! index of destructor @@ -64,7 +60,7 @@ module axom_spio function c_iomanager_new_0(com, SHT_crv) & result(SHT_rv) & - bind(C, name="SPIO_iomanager_new_0") + bind(C, name="SPIO_IOManager_new_0") use iso_c_binding, only : C_INT, C_PTR import :: SHROUD_iomanager_capsule implicit none @@ -75,7 +71,7 @@ end function c_iomanager_new_0 function c_iomanager_new_1(com, use_scr, SHT_crv) & result(SHT_rv) & - bind(C, name="SPIO_iomanager_new_1") + bind(C, name="SPIO_IOManager_new_1") use iso_c_binding, only : C_BOOL, C_INT, C_PTR import :: SHROUD_iomanager_capsule implicit none @@ -86,7 +82,7 @@ function c_iomanager_new_1(com, use_scr, SHT_crv) & end function c_iomanager_new_1 subroutine c_iomanager_delete(self) & - bind(C, name="SPIO_iomanager_delete") + bind(C, name="SPIO_IOManager_delete") import :: SHROUD_iomanager_capsule implicit none type(SHROUD_iomanager_capsule), intent(IN) :: self @@ -94,7 +90,7 @@ end subroutine c_iomanager_delete subroutine c_iomanager_write(self, group, num_files, & file_string, protocol) & - bind(C, name="SPIO_iomanager_write") + bind(C, name="SPIO_IOManager_write") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -108,7 +104,7 @@ end subroutine c_iomanager_write subroutine c_iomanager_write_bufferify(self, group, num_files, & file_string, Lfile_string, protocol, Lprotocol) & - bind(C, name="SPIO_iomanager_write_bufferify") + bind(C, name="SPIO_IOManager_write_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -124,7 +120,7 @@ end subroutine c_iomanager_write_bufferify subroutine c_iomanager_write_group_to_root_file(self, group, & file_name) & - bind(C, name="SPIO_iomanager_write_group_to_root_file") + bind(C, name="SPIO_IOManager_write_group_to_root_file") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR import :: SHROUD_iomanager_capsule @@ -136,7 +132,7 @@ end subroutine c_iomanager_write_group_to_root_file subroutine c_iomanager_write_group_to_root_file_bufferify(self, & group, file_name, Lfile_name) & - bind(C, name="SPIO_iomanager_write_group_to_root_file_bufferify") + bind(C, name="SPIO_IOManager_write_group_to_root_file_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -149,7 +145,7 @@ end subroutine c_iomanager_write_group_to_root_file_bufferify subroutine c_iomanager_write_blueprint_index_to_root_file(self, & datastore, domain_path, file_name, mesh_path) & - bind(C, name="SPIO_iomanager_write_blueprint_index_to_root_file") + bind(C, name="SPIO_IOManager_write_blueprint_index_to_root_file") use axom_sidre, only : SHROUD_datastore_capsule use iso_c_binding, only : C_CHAR import :: SHROUD_iomanager_capsule @@ -164,7 +160,7 @@ end subroutine c_iomanager_write_blueprint_index_to_root_file subroutine c_iomanager_write_blueprint_index_to_root_file_bufferify( & self, datastore, domain_path, Ldomain_path, file_name, & Lfile_name, mesh_path, Lmesh_path) & - bind(C, name="SPIO_iomanager_write_blueprint_index_to_root_file_bufferify") + bind(C, name="SPIO_IOManager_write_blueprint_index_to_root_file_bufferify") use axom_sidre, only : SHROUD_datastore_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -181,7 +177,7 @@ end subroutine c_iomanager_write_blueprint_index_to_root_file_bufferify subroutine c_iomanager_read_0(self, group, file_string, & protocol) & - bind(C, name="SPIO_iomanager_read_0") + bind(C, name="SPIO_IOManager_read_0") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR import :: SHROUD_iomanager_capsule @@ -194,7 +190,7 @@ end subroutine c_iomanager_read_0 subroutine c_iomanager_read_0_bufferify(self, group, & file_string, Lfile_string, protocol, Lprotocol) & - bind(C, name="SPIO_iomanager_read_0_bufferify") + bind(C, name="SPIO_IOManager_read_0_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -209,7 +205,7 @@ end subroutine c_iomanager_read_0_bufferify subroutine c_iomanager_read_1(self, group, file_string, & protocol, preserve_contents) & - bind(C, name="SPIO_iomanager_read_1") + bind(C, name="SPIO_IOManager_read_1") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_iomanager_capsule @@ -224,7 +220,7 @@ end subroutine c_iomanager_read_1 subroutine c_iomanager_read_1_bufferify(self, group, & file_string, Lfile_string, protocol, Lprotocol, & preserve_contents) & - bind(C, name="SPIO_iomanager_read_1_bufferify") + bind(C, name="SPIO_IOManager_read_1_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -239,7 +235,7 @@ subroutine c_iomanager_read_1_bufferify(self, group, & end subroutine c_iomanager_read_1_bufferify subroutine c_iomanager_read_2(self, group, root_file) & - bind(C, name="SPIO_iomanager_read_2") + bind(C, name="SPIO_IOManager_read_2") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR import :: SHROUD_iomanager_capsule @@ -251,7 +247,7 @@ end subroutine c_iomanager_read_2 subroutine c_iomanager_read_2_bufferify(self, group, root_file, & Lroot_file) & - bind(C, name="SPIO_iomanager_read_2_bufferify") + bind(C, name="SPIO_IOManager_read_2_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -264,7 +260,7 @@ end subroutine c_iomanager_read_2_bufferify subroutine c_iomanager_read_3(self, group, root_file, & preserve_contents) & - bind(C, name="SPIO_iomanager_read_3") + bind(C, name="SPIO_IOManager_read_3") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_iomanager_capsule @@ -277,7 +273,7 @@ end subroutine c_iomanager_read_3 subroutine c_iomanager_read_3_bufferify(self, group, root_file, & Lroot_file, preserve_contents) & - bind(C, name="SPIO_iomanager_read_3_bufferify") + bind(C, name="SPIO_IOManager_read_3_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -291,7 +287,7 @@ end subroutine c_iomanager_read_3_bufferify subroutine c_iomanager_read_4(self, group, root_file, & preserve_contents, use_scr) & - bind(C, name="SPIO_iomanager_read_4") + bind(C, name="SPIO_IOManager_read_4") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_BOOL, C_CHAR import :: SHROUD_iomanager_capsule @@ -305,7 +301,7 @@ end subroutine c_iomanager_read_4 subroutine c_iomanager_read_4_bufferify(self, group, root_file, & Lroot_file, preserve_contents, use_scr) & - bind(C, name="SPIO_iomanager_read_4_bufferify") + bind(C, name="SPIO_IOManager_read_4_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_BOOL, C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -320,7 +316,7 @@ end subroutine c_iomanager_read_4_bufferify subroutine c_iomanager_load_external_data(self, group, & root_file) & - bind(C, name="SPIO_iomanager_load_external_data") + bind(C, name="SPIO_IOManager_load_external_data") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR import :: SHROUD_iomanager_capsule @@ -332,7 +328,7 @@ end subroutine c_iomanager_load_external_data subroutine c_iomanager_load_external_data_bufferify(self, group, & root_file, Lroot_file) & - bind(C, name="SPIO_iomanager_load_external_data_bufferify") + bind(C, name="SPIO_IOManager_load_external_data_bufferify") use axom_sidre, only : SHROUD_group_capsule use iso_c_binding, only : C_CHAR, C_INT import :: SHROUD_iomanager_capsule @@ -345,6 +341,9 @@ end subroutine c_iomanager_load_external_data_bufferify ! splicer begin class.IOManager.additional_interfaces ! splicer end class.IOManager.additional_interfaces + + ! splicer begin additional_interfaces + ! splicer end additional_interfaces end interface interface iomanager_new @@ -358,9 +357,9 @@ function iomanager_new_0(com) & result(SHT_rv) use iso_c_binding, only : C_PTR integer, value, intent(IN) :: com - type(C_PTR) :: SHT_prv type(iomanager) :: SHT_rv ! splicer begin class.IOManager.method.new_0 + type(C_PTR) :: SHT_prv SHT_prv = c_iomanager_new_0(com, SHT_rv%cxxmem) ! splicer end class.IOManager.method.new_0 end function iomanager_new_0 @@ -370,11 +369,11 @@ function iomanager_new_1(com, use_scr) & use iso_c_binding, only : C_BOOL, C_PTR integer, value, intent(IN) :: com logical, value, intent(IN) :: use_scr + type(iomanager) :: SHT_rv + ! splicer begin class.IOManager.method.new_1 logical(C_BOOL) SH_use_scr type(C_PTR) :: SHT_prv - type(iomanager) :: SHT_rv SH_use_scr = use_scr ! coerce to C_BOOL - ! splicer begin class.IOManager.method.new_1 SHT_prv = c_iomanager_new_1(com, SH_use_scr, SHT_rv%cxxmem) ! splicer end class.IOManager.method.new_1 end function iomanager_new_1 @@ -455,9 +454,9 @@ subroutine iomanager_read_1(obj, group, file_string, protocol, & character(len=*), intent(IN) :: file_string character(len=*), intent(IN) :: protocol logical, value, intent(IN) :: preserve_contents + ! splicer begin class.IOManager.method.read_1 logical(C_BOOL) SH_preserve_contents SH_preserve_contents = preserve_contents ! coerce to C_BOOL - ! splicer begin class.IOManager.method.read_1 call c_iomanager_read_1_bufferify(obj%cxxmem, group%cxxmem, & file_string, len_trim(file_string, kind=C_INT), protocol, & len_trim(protocol, kind=C_INT), SH_preserve_contents) @@ -484,9 +483,9 @@ subroutine iomanager_read_3(obj, group, root_file, & type(SidreGroup), intent(IN) :: group character(len=*), intent(IN) :: root_file logical, value, intent(IN) :: preserve_contents + ! splicer begin class.IOManager.method.read_3 logical(C_BOOL) SH_preserve_contents SH_preserve_contents = preserve_contents ! coerce to C_BOOL - ! splicer begin class.IOManager.method.read_3 call c_iomanager_read_3_bufferify(obj%cxxmem, group%cxxmem, & root_file, len_trim(root_file, kind=C_INT), & SH_preserve_contents) @@ -501,12 +500,12 @@ subroutine iomanager_read_4(obj, group, root_file, & type(SidreGroup), intent(IN) :: group character(len=*), intent(IN) :: root_file logical, value, intent(IN) :: preserve_contents - logical(C_BOOL) SH_preserve_contents logical, value, intent(IN) :: use_scr + ! splicer begin class.IOManager.method.read_4 + logical(C_BOOL) SH_preserve_contents logical(C_BOOL) SH_use_scr SH_preserve_contents = preserve_contents ! coerce to C_BOOL SH_use_scr = use_scr ! coerce to C_BOOL - ! splicer begin class.IOManager.method.read_4 call c_iomanager_read_4_bufferify(obj%cxxmem, group%cxxmem, & root_file, len_trim(root_file, kind=C_INT), & SH_preserve_contents, SH_use_scr) @@ -551,6 +550,9 @@ end function iomanager_associated ! splicer begin class.IOManager.additional_functions ! splicer end class.IOManager.additional_functions + ! splicer begin additional_functions + ! splicer end additional_functions + function iomanager_eq(a,b) result (rv) use iso_c_binding, only: c_associated type(iomanager), intent(IN) ::a,b diff --git a/src/axom/sidre/spio/interface/yaml/spio_types.yaml b/src/axom/sidre/spio/interface/yaml/spio_types.yaml index 342164b17f..22ffd96307 100644 --- a/src/axom/sidre/spio/interface/yaml/spio_types.yaml +++ b/src/axom/sidre/spio/interface/yaml/spio_types.yaml @@ -5,8 +5,8 @@ # other Axom Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (BSD-3-Clause) -# Types generated by Shroud for library SPIO -declarations: +# Types generated by Shroud for library 'SPIO' +typemap: - namespace: axom declarations: axom - namespace: sidre @@ -14,9 +14,9 @@ declarations: - type: IOManager fields: base: shadow - cxx_header: axom/sidre/spio/IOManager.hpp - cxx_type: axom::sidre::IOManager - c_type: SPIO_iomanager + wrap_header: + - typesSPIO.h + c_type: SPIO_IOManager f_module_name: axom_spio f_derived_type: iomanager f_capsule_data_type: SHROUD_iomanager_capsule diff --git a/src/axom/slic/interface/c_fortran/typesSLIC.h b/src/axom/slic/interface/c_fortran/typesSLIC.h index cc1e734ed6..605cd4e2cc 100644 --- a/src/axom/slic/interface/c_fortran/typesSLIC.h +++ b/src/axom/slic/interface/c_fortran/typesSLIC.h @@ -15,14 +15,14 @@ extern "C" { #endif -struct s_SLI_SHROUD_capsule_data +struct s_SLIC_SHROUD_capsule_data { void* addr; /* address of C++ memory */ int idtor; /* index of destructor */ }; -typedef struct s_SLI_SHROUD_capsule_data SLI_SHROUD_capsule_data; +typedef struct s_SLIC_SHROUD_capsule_data SLIC_SHROUD_capsule_data; -void SLIC_SHROUD_memory_destructor(SLI_SHROUD_capsule_data* cap); +void SLIC_SHROUD_memory_destructor(SLIC_SHROUD_capsule_data* cap); #ifdef __cplusplus } diff --git a/src/axom/slic/interface/c_fortran/wrapSLIC.cpp b/src/axom/slic/interface/c_fortran/wrapSLIC.cpp index 3589ff6296..0855d3b2e7 100644 --- a/src/axom/slic/interface/c_fortran/wrapSLIC.cpp +++ b/src/axom/slic/interface/c_fortran/wrapSLIC.cpp @@ -6,8 +6,8 @@ // // SPDX-License-Identifier: (BSD-3-Clause) #include "wrapSLIC.h" +#include #include -#include #include #include "axom/slic/interface/slic.hpp" #include "typesSLIC.h" @@ -24,202 +24,213 @@ extern "C" { // dest will not be NULL terminated. static void ShroudStrCopy(char* dest, int ndest, const char* src, int nsrc) { - int nm = nsrc < ndest ? nsrc : ndest; - std::memcpy(dest,src,nm); - if(ndest > nm) - std::memset(dest+nm,' ',ndest-nm); + if (src == NULL) + { + std::memset(dest,' ',ndest); // convert NULL pointer to blank filled string + } + else + { + if (nsrc < 0) + nsrc = std::strlen(src); + int nm = nsrc < ndest ? nsrc : ndest; + std::memcpy(dest,src,nm); + if(ndest > nm) + std::memset(dest+nm,' ',ndest-nm); // blank fill + } } // splicer begin C_definitions // splicer end C_definitions void SLIC_initialize() { -// splicer begin function.initialize + // splicer begin function.initialize axom::slic::initialize(); return; -// splicer end function.initialize + // splicer end function.initialize } bool SLIC_is_initialized() { -// splicer begin function.is_initialized + // splicer begin function.is_initialized bool SHC_rv = axom::slic::isInitialized(); return SHC_rv; -// splicer end function.is_initialized + // splicer end function.is_initialized } void SLIC_create_logger(const char* name, char imask) { -// splicer begin function.create_logger - const std::string SH_name(name); - axom::slic::createLogger(SH_name, imask); + // splicer begin function.create_logger + const std::string SHCXX_name(name); + axom::slic::createLogger(SHCXX_name, imask); return; -// splicer end function.create_logger + // splicer end function.create_logger } void SLIC_create_logger_bufferify(const char* name, int Lname, char imask) { -// splicer begin function.create_logger_bufferify - const std::string SH_name(name, Lname); - axom::slic::createLogger(SH_name, imask); + // splicer begin function.create_logger_bufferify + const std::string SHCXX_name(name, Lname); + axom::slic::createLogger(SHCXX_name, imask); return; -// splicer end function.create_logger_bufferify + // splicer end function.create_logger_bufferify } bool SLIC_activate_logger(const char* name) { -// splicer begin function.activate_logger - const std::string SH_name(name); - bool SHC_rv = axom::slic::activateLogger(SH_name); + // splicer begin function.activate_logger + const std::string SHCXX_name(name); + bool SHC_rv = axom::slic::activateLogger(SHCXX_name); return SHC_rv; -// splicer end function.activate_logger + // splicer end function.activate_logger } bool SLIC_activate_logger_bufferify(const char* name, int Lname) { -// splicer begin function.activate_logger_bufferify - const std::string SH_name(name, Lname); - bool SHC_rv = axom::slic::activateLogger(SH_name); + // splicer begin function.activate_logger_bufferify + const std::string SHCXX_name(name, Lname); + bool SHC_rv = axom::slic::activateLogger(SHCXX_name); return SHC_rv; -// splicer end function.activate_logger_bufferify + // splicer end function.activate_logger_bufferify } void SLIC_get_active_logger_name_bufferify(char* name, int Nname) { -// splicer begin function.get_active_logger_name_bufferify + // splicer begin function.get_active_logger_name_bufferify std::string SHCXX_rv = axom::slic::getActiveLoggerName(); if (SHCXX_rv.empty()) { - std::memset(name, ' ', Nname); + ShroudStrCopy(name, Nname, NULL, 0); } else { ShroudStrCopy(name, Nname, SHCXX_rv.data(), SHCXX_rv.size()); } return; -// splicer end function.get_active_logger_name_bufferify + // splicer end function.get_active_logger_name_bufferify } int SLIC_get_logging_msg_level() { -// splicer begin function.get_logging_msg_level + // splicer begin function.get_logging_msg_level axom::slic::message::Level SHCXX_rv = axom::slic::getLoggingMsgLevel(); int SHC_rv = static_cast(SHCXX_rv); return SHC_rv; -// splicer end function.get_logging_msg_level + // splicer end function.get_logging_msg_level } void SLIC_set_logging_msg_level(int level) { -// splicer begin function.set_logging_msg_level + // splicer begin function.set_logging_msg_level axom::slic::message::Level SHCXX_level = static_cast(level); axom::slic::setLoggingMsgLevel(SHCXX_level); return; -// splicer end function.set_logging_msg_level + // splicer end function.set_logging_msg_level } void SLIC_set_abort_on_error(bool status) { -// splicer begin function.set_abort_on_error + // splicer begin function.set_abort_on_error axom::slic::setAbortOnError(status); return; -// splicer end function.set_abort_on_error + // splicer end function.set_abort_on_error } void SLIC_enable_abort_on_error() { -// splicer begin function.enable_abort_on_error + // splicer begin function.enable_abort_on_error axom::slic::enableAbortOnError(); return; -// splicer end function.enable_abort_on_error + // splicer end function.enable_abort_on_error } void SLIC_disable_abort_on_error() { -// splicer begin function.disable_abort_on_error + // splicer begin function.disable_abort_on_error axom::slic::disableAbortOnError(); return; -// splicer end function.disable_abort_on_error + // splicer end function.disable_abort_on_error } bool SLIC_is_abort_on_errors_enabled() { -// splicer begin function.is_abort_on_errors_enabled + // splicer begin function.is_abort_on_errors_enabled bool SHC_rv = axom::slic::isAbortOnErrorsEnabled(); return SHC_rv; -// splicer end function.is_abort_on_errors_enabled + // splicer end function.is_abort_on_errors_enabled } void SLIC_set_abort_on_warning(bool status) { -// splicer begin function.set_abort_on_warning + // splicer begin function.set_abort_on_warning axom::slic::setAbortOnWarning(status); return; -// splicer end function.set_abort_on_warning + // splicer end function.set_abort_on_warning } void SLIC_enable_abort_on_warning() { -// splicer begin function.enable_abort_on_warning + // splicer begin function.enable_abort_on_warning axom::slic::enableAbortOnWarning(); return; -// splicer end function.enable_abort_on_warning + // splicer end function.enable_abort_on_warning } void SLIC_disable_abort_on_warning() { -// splicer begin function.disable_abort_on_warning + // splicer begin function.disable_abort_on_warning axom::slic::disableAbortOnWarning(); return; -// splicer end function.disable_abort_on_warning + // splicer end function.disable_abort_on_warning } bool SLIC_is_abort_on_warnings_enabled() { -// splicer begin function.is_abort_on_warnings_enabled + // splicer begin function.is_abort_on_warnings_enabled bool SHC_rv = axom::slic::isAbortOnWarningsEnabled(); return SHC_rv; -// splicer end function.is_abort_on_warnings_enabled + // splicer end function.is_abort_on_warnings_enabled } void SLIC_log_message(int level, const char* message, const char* fileName, int line, bool filter) { -// splicer begin function.log_message + // splicer begin function.log_message axom::slic::message::Level SHCXX_level = static_cast(level); - const std::string SH_message(message); - const std::string SH_fileName(fileName); - axom::slic::logMessage(SHCXX_level, SH_message, SH_fileName, line, filter); + const std::string SHCXX_message(message); + const std::string SHCXX_fileName(fileName); + axom::slic::logMessage(SHCXX_level, SHCXX_message, SHCXX_fileName, line, + filter); return; -// splicer end function.log_message + // splicer end function.log_message } void SLIC_log_message_bufferify(int level, const char* message, int Lmessage, const char* fileName, int LfileName, int line, bool filter) { -// splicer begin function.log_message_bufferify + // splicer begin function.log_message_bufferify axom::slic::message::Level SHCXX_level = static_cast(level); - const std::string SH_message(message, Lmessage); - const std::string SH_fileName(fileName, LfileName); - axom::slic::logMessage(SHCXX_level, SH_message, SH_fileName, line, filter); + const std::string SHCXX_message(message, Lmessage); + const std::string SHCXX_fileName(fileName, LfileName); + axom::slic::logMessage(SHCXX_level, SHCXX_message, SHCXX_fileName, line, + filter); return; -// splicer end function.log_message_bufferify + // splicer end function.log_message_bufferify } void SLIC_finalize() { -// splicer begin function.finalize + // splicer begin function.finalize axom::slic::finalize(); return; -// splicer end function.finalize + // splicer end function.finalize } -// Release C++ allocated memory. -void SLIC_SHROUD_memory_destructor(SLI_SHROUD_capsule_data* cap) +// Release library allocated memory. +void SLIC_SHROUD_memory_destructor(SLIC_SHROUD_capsule_data* cap) { cap->addr = NULL; cap->idtor = 0; // avoid deleting again diff --git a/src/axom/slic/interface/c_fortran/wrapSLIC.h b/src/axom/slic/interface/c_fortran/wrapSLIC.h index 1f74e3317b..d49b1f6337 100644 --- a/src/axom/slic/interface/c_fortran/wrapSLIC.h +++ b/src/axom/slic/interface/c_fortran/wrapSLIC.h @@ -7,7 +7,7 @@ // SPDX-License-Identifier: (BSD-3-Clause) /** * \file wrapSLIC.h - * \brief Shroud generated wrapper for SLIC library + * \brief Shroud generated wrapper for slic namespace */ // For C users and C++ implementation @@ -15,6 +15,9 @@ #define WRAPSLIC_H #include "typesSLIC.h" +#ifndef __cplusplus +#include +#endif // splicer begin CXX_declarations // splicer end CXX_declarations @@ -23,14 +26,14 @@ extern "C" { #endif -// Level -enum SLIC_Level +// axom::slic::message::Level +enum SLIC_message_Level { - SLIC_Error, - SLIC_Warning, - SLIC_Info, - SLIC_Debug, - SLIC_Num_Levels + SLIC_message_Error, + SLIC_message_Warning, + SLIC_message_Info, + SLIC_message_Debug, + SLIC_message_Num_Levels }; // splicer begin C_declarations diff --git a/src/axom/slic/interface/c_fortran/wrapfslic.f b/src/axom/slic/interface/c_fortran/wrapfslic.f index 10b9f44e71..649f50a080 100644 --- a/src/axom/slic/interface/c_fortran/wrapfslic.f +++ b/src/axom/slic/interface/c_fortran/wrapfslic.f @@ -7,7 +7,7 @@ ! SPDX-License-Identifier: (BSD-3-Clause) !> !! \file wrapfslic.f -!! \brief Shroud generated wrapper for SLIC library +!! \brief Shroud generated wrapper for slic namespace !< ! splicer begin file_top ! splicer end file_top @@ -20,12 +20,12 @@ module axom_slic ! splicer begin module_top ! splicer end module_top - ! Level - integer(C_INT), parameter :: level_error = 0 - integer(C_INT), parameter :: level_warning = 1 - integer(C_INT), parameter :: level_info = 2 - integer(C_INT), parameter :: level_debug = 3 - integer(C_INT), parameter :: level_num_levels = 4 + ! enum axom::slic::message::Level + integer(C_INT), parameter :: message_error = 0 + integer(C_INT), parameter :: message_warning = 1 + integer(C_INT), parameter :: message_info = 2 + integer(C_INT), parameter :: message_debug = 3 + integer(C_INT), parameter :: message_num_levels = 4 interface @@ -229,9 +229,9 @@ end subroutine slic_get_active_logger_name subroutine slic_set_abort_on_error(status) use iso_c_binding, only : C_BOOL logical, value, intent(IN) :: status + ! splicer begin function.set_abort_on_error logical(C_BOOL) SH_status SH_status = status ! coerce to C_BOOL - ! splicer begin function.set_abort_on_error call c_set_abort_on_error(SH_status) ! splicer end function.set_abort_on_error end subroutine slic_set_abort_on_error @@ -248,9 +248,9 @@ end function slic_is_abort_on_errors_enabled subroutine slic_set_abort_on_warning(status) use iso_c_binding, only : C_BOOL logical, value, intent(IN) :: status + ! splicer begin function.set_abort_on_warning logical(C_BOOL) SH_status SH_status = status ! coerce to C_BOOL - ! splicer begin function.set_abort_on_warning call c_set_abort_on_warning(SH_status) ! splicer end function.set_abort_on_warning end subroutine slic_set_abort_on_warning @@ -271,9 +271,9 @@ subroutine slic_log_message(level, message, fileName, line, filter) character(len=*), intent(IN) :: fileName integer(C_INT), value, intent(IN) :: line logical, value, intent(IN) :: filter + ! splicer begin function.log_message logical(C_BOOL) SH_filter SH_filter = filter ! coerce to C_BOOL - ! splicer begin function.log_message call c_log_message_bufferify(level, message, & len_trim(message, kind=C_INT), fileName, & len_trim(fileName, kind=C_INT), line, SH_filter) From f35fec8e13f46bdeaa42bf14f2ea9b028bb2c0eb Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Tue, 21 Apr 2020 18:29:01 -0700 Subject: [PATCH 173/632] Remove old file that should not of been added --- .../sidre/interface/old/sidre_shroud.yaml | 739 ------------------ 1 file changed, 739 deletions(-) delete mode 100644 src/axom/sidre/interface/old/sidre_shroud.yaml diff --git a/src/axom/sidre/interface/old/sidre_shroud.yaml b/src/axom/sidre/interface/old/sidre_shroud.yaml deleted file mode 100644 index 9faf223cc5..0000000000 --- a/src/axom/sidre/interface/old/sidre_shroud.yaml +++ /dev/null @@ -1,739 +0,0 @@ -# -# API for Sidre -# -copyright: - - - - Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and - - other Axom Project Developers. See the top-level COPYRIGHT file for details. - - - - "SPDX-License-Identifier: (BSD-3-Clause)" - -library: Sidre -# cxx_header: each class has its own header file -namespace: axom sidre - -options: - C_line_length: 1000 - F_module_per_class: False - F_module_name_library_template: axom_{library_lower} -# wrap_python: True - -format: - C_prefix: SIDRE_ - # Any C++ function which returns a string will be wrapped in - # Fortran as a subroutine with an additional character argument - # for the result. -# F_string_result_as_arg: name - F_filename_suffix: F - -declarations: -- decl: typedef int64_t IndexType - fields: - # defined in SidreTypes.hpp - c_header : axom/sidre/interface/SidreTypes.h - c_type : SIDRE_IndexType - -- decl: typedef int TypeID - fields: - # enum for types - c_header : axom/sidre/interface/SidreTypes.h - cxx_header : axom/sidre/core/SidreTypes.hpp - c_to_cxx : axom::sidre::getTypeID({c_var}) - cxx_to_c : static_cast({cxx_var}) - -# XXX -# parameters: -# InvalidID: IDTYPE -1 - -- decl: class Buffer - cxx_header: axom/sidre/core/Buffer.hpp - format: - F_derived_name: SidreBuffer - -- decl: class Group - cxx_header: axom/sidre/core/Group.hpp - format: - F_derived_name: SidreGroup - -- decl: class View - cxx_header: axom/sidre/core/View.hpp - format: - F_derived_name: SidreView - - #################################################################### -- decl: class DataStore - cxx_header: axom/sidre/core/DataStore.hpp - format: - F_derived_name: SidreDataStore - - declarations: - - decl: DataStore() +name(new) - - decl: ~DataStore() +name(delete) - - decl: Group * getRoot() - - # Methods to query, access, create and destroy Buffers. - - decl: size_t getNumBuffers() const -# - decl: bool hasBuffer( IndexType idx ) const - - decl: Buffer * getBuffer( IndexType idx ) - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - decl: Buffer * createBuffer() - format: - function_suffix: _empty - - decl: Buffer * createBuffer( TypeID type, IndexType num_elems ) - format: - function_suffix: _from_type - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - decl: void destroyBuffer( IndexType id ) - fortran_generic: - - decl: (int32_t id) - fortran_suffix: int32_t - - decl: (int64_t id) - fortran_suffix: int64_t - - # Method for generateing Blueprint - - decl: bool generateBlueprintIndex( const std::string& domain_path, - const std::string& mesh_name, - const std::string& index_path, - int num_domains ) - - # Methods for iterating over Buffers in DataStore -# - decl: IndexType getFirstValidBufferIndex() const -# - decl: IndexType getNextValidBufferIndex(IndexType idx) const; -# fortran_generic: -# - decl: (int32_t idx) -# fortran_suffix: int32_t -# - decl: (int64_t idx) -# fortran_suffix: int64_t - - - decl: void print() const -# - decl: void print(std::ostream& os) const - - python: - type: [ init, richcompare ] - -#################################################################### -- decl: class Group - declarations: - # Basic query and accessor methods. - - decl: IndexType getIndex() - - decl: const std::string& getName() const +len(MAXNAMESIZE) - - decl: std::string getPath() const +len(MAXNAMESIZE) - - decl: std::string getPathName() const +len(MAXNAMESIZE) -# - decl: Group* getParent() - - decl: const Group* getParent() const - - decl: size_t getNumGroups() const - - decl: size_t getNumViews() const -# - decl: DataStore* getDataStore() const - - decl: const DataStore* getDataStore() const - - # View query methods. - - decl: bool hasView( const string& path ) const - - decl: bool hasChildView( const string& name ) const -# - decl: bool hasView( IndexType idx ) const -# fortran_generic: -# - decl: (int32_t idx) -# fortran_suffix: int32_t -# - decl: (int64_t idx) -# fortran_suffix: int64_t - - decl: IndexType getViewIndex(const std::string &name) const - - decl: const std::string& getViewName(IndexType idx) const +len(MAXNAMESIZE) - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t - C_error_pattern: C_invalid_name - PY_error_pattern: PY_invalid_name_idx - - # View access and iteration methods. - - decl: View *getView( const std::string& path ) - format: - function_suffix: _from_name - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none -# - decl: View const * getView( const std::string& path ) const - - decl: View *getView( const IndexType idx ) - format: - function_suffix: _from_index - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none -# - decl: View const *getView( const IndexType idx ) const -# fortran_generic: -# - decl: (int32_t idx) -# fortran_suffix: int32_t -# - decl: (int64_t idx) -# fortran_suffix: int64_t - - decl: IndexType getFirstValidViewIndex() const - - decl: IndexType getNextValidViewIndex(IndexType idx) const - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t - - # Methods to create a View that has no associated data. - - decl: View *createView( const string& path ) - format: - function_suffix: _empty - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createView( const std::string& path, - TypeID type, - IndexType num_elems ) - format: - function_suffix: _from_type - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createView( const std::string& path, - TypeID type, - int ndims, - IndexType * shape+dimension) - format: - function_suffix: _from_shape - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - -# - decl: View *createView( const std::string& path, const DataType& dtype) - - # Methods to create a View with a Buffer attached. - - decl: View *createView( const std::string& path, - Buffer *buff) - format: - function_suffix: _into_buffer - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createView( const std::string& path, - TypeID type, - IndexType num_elems, - Buffer *buff) - format: - function_suffix: _from_type_and_buffer - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createView( const std::string& path, - TypeID type, - int ndims, - IndexType * shape+dimension, - Buffer * buff) - format: - function_suffix: _from_shape_and_buffer - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - # Methods to create a View with externally-owned data attached. - - decl: View * createView( const std::string& path, - void * external_ptr) - format: - function_suffix: _external - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createView( const std::string& path, - TypeID type, - IndexType num_elems, - void * external_ptr) - format: - function_suffix: _from_type_external - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createView( const std::string& path, - TypeID type, - int ndims, - IndexType * shape+dimension, - void * external_ptr) - format: - function_suffix: _from_shape_external - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - # Methods to create a View and allocate data for it. - - decl: View *createViewAndAllocate( const std::string& path, - TypeID type, - IndexType num_elems) - format: - function_suffix: _nelems - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createViewAndAllocate( const std::string& path, - TypeID type, - int ndims, - IndexType *shape+dimension) - format: - function_suffix: _shape - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - -# - decl: View *createViewAndAllocate( const std::string& path, const DataType& dtype) - - - decl: | - template - View *createViewScalar( const std::string& path, ScalarType value) - cxx_template: - - instantiation: - - instantiation: - - instantiation: - - instantiation: - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - - decl: View *createViewString( const std::string& path, - const std::string& value) - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - # View destruction methods. - - decl: void destroyView( const std::string &path ) -# - decl: void destroyView( IndexType idx ) -# fortran_generic: -# - decl: (int32_t idx) -# fortran_suffix: int32_t -# - decl: (int64_t idx) -# fortran_suffix: int64_t -# - decl: void destroyViews() - - decl: void destroyViewAndData(const std::string &path) - format: - function_suffix: _name - - decl: void destroyViewAndData(IndexType idx) - format: - function_suffix: _index - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t -# - decl: void destroyViewsAndData() - - # View move and copy methods. - - decl: View *moveView(View *view) - - decl: View *copyView(View *view) - - # Child Group query methods. - - decl: bool hasGroup( const string& path ) - - decl: bool hasChildGroup( const string& name ) -# - decl: bool hasGroup( IndexType idx ) -# fortran_generic: -# - decl: (int32_t idx) -# fortran_suffix: int32_t -# - decl: (int64_t idx) -# fortran_suffix: int64_t - - decl: IndexType getGroupIndex(const std::string &name) const - - decl: const std::string& getGroupName(IndexType idx) const +len(MAXNAMESIZE) - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t - C_error_pattern: C_invalid_name - PY_error_pattern: PY_invalid_name_idx - - # Group access and iteration methods. - - decl: Group * getGroup( const std::string& path ) - format: - function_suffix: _from_name - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none -# - decl: Group const * getGroup( const std::string& path ) const - - decl: Group * getGroup( IndexType idx) - format: - function_suffix: _from_index - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none -# - decl: Group const * getGroup(IndexType idx) const -# fortran_generic: -# - decl: (int32_t idx) -# fortran_suffix: int32_t -# - decl: (int64_t idx) -# fortran_suffix: int64_t - - decl: IndexType getFirstValidGroupIndex() const - - decl: IndexType getNextValidGroupIndex(IndexType idx) const - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t - - # Child Group creation and destruction methods. - - decl: Group *createGroup( const string& path ) - C_error_pattern: C_null_to_error_capsule - PY_error_pattern: PY_null_to_none - - decl: void destroyGroup(const std::string &path) - format: - function_suffix: _name - - decl: void destroyGroup(IndexType idx) - format: - function_suffix: _index - fortran_generic: - - decl: (int32_t idx) - fortran_suffix: int32_t - - decl: (int64_t idx) - fortran_suffix: int64_t -# - decl: void destroyGroups() - - # Group move and copy methods - - decl: Group *moveGroup(Group *grp) -# - decl: Group *copyGroup(Group *grp) - - # Group print methods. - - decl: void print() const -# - decl: void printTree( const int level ) const - -# - decl: void createNativeLayout(Node &) const - - decl: bool isEquivalentTo(const Group * other) const - - # Group I/O methods - - decl: void save(const std::string& file_path, - const std::string& protocol) const - - decl: void load(const std::string& file_path, - const std::string& protocol, - bool preserve_contents = false) - - decl: void loadExternalData(const std::string& file_path) -# - decl: void save(const hid_t& h5_id) const -# format: -# function_suffix: _hdf -# - decl: void load(const hid_t& h5_id) -# format: -# function_suffix: _hdf - - - decl: bool rename( const string& new_name ) - - python: - type: [ init, richcompare ] - -#################################################################### -- decl: class Buffer - declarations: - # Basic query and accessor methods - - decl: IndexType getIndex() const - - decl: size_t getNumViews() const - - # Methods to query and access Buffer data - - decl: void* getVoidPtr() - - decl: TypeID getTypeID() const - - decl: size_t getNumElements() const - - decl: size_t getTotalBytes() const - - decl: size_t getBytesPerElement() const - - # Data description and allocation methods - - decl: Buffer* describe(TypeID type, IndexType num_elems) - return_this: True - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - -# - decl: Buffer* describe(const DataType& dtype) - - - decl: Buffer* allocate() - format: - function_suffix: _existing - return_this: True - - - decl: Buffer* allocate(TypeID type, IndexType num_elems) - format: - function_suffix: _from_type - return_this: True - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - - - decl: Buffer* reallocate(IndexType num_elems) - return_this: True - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - - - decl: void print() const - - python: - type: [ init, richcompare ] - -#################################################################### -- decl: class View - declarations: - - # View query and accessor methods - - decl: IndexType getIndex() - - decl: const std::string& getName() const +len(MAXNAMESIZE) - - decl: std::string getPath() const +len(MAXNAMESIZE) - - decl: std::string getPathName() const +len(MAXNAMESIZE) - - decl: Group* getOwningGroup() -# - decl: Group const* getOwningGroup() const - - decl: bool hasBuffer() const - - decl: Buffer* getBuffer() -# - decl: Buffer const* getBuffer() const - - decl: bool isExternal() const - - decl: bool isAllocated() - - decl: bool isApplied() const - - decl: bool isDescribed() const - - decl: bool isEmpty() const - - decl: bool isOpaque() const - - decl: bool isScalar() const - - decl: bool isString() const - - decl: TypeID getTypeID() const - - decl: size_t getTotalBytes() const - - decl: size_t getNumElements() const - - decl: size_t getBytesPerElement() const - - decl: size_t getOffset() const - - decl: size_t getStride() const - - decl: int getNumDimensions() const - - decl: int getShape(int ndims, IndexType * shape+dimension+intent(OUT) ) const -# - decl: const Schema& getSchema() const -# - decl: Node& getNode() -# - decl: const Node& getNode() const - - # View allocation methods - - decl: View* allocate() - format: - function_suffix: _simple - return_this: True - - - decl: View* allocate(TypeID type, IndexType num_elems) - format: - function_suffix: _from_type - return_this: True - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - -# - decl: View* allocate(const DataType& dtype) - - - decl: View * reallocate(IndexType num_elems) - return_this: True - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - -# - decl: View* reallocate(const DataType& dtype) - - # Attach Buffer object to data view. - - decl: View* attachBuffer(Buffer * buff) - return_this: True - format: - function_suffix: _only - - - decl: View* attachBuffer(TypeID type, - IndexType num_elems, - Buffer * buff) - return_this: True - format: - function_suffix: _type - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - - - decl: View* attachBuffer(TypeID type, - int ndims, - IndexType * shape+dimension, - Buffer * buff) - return_this: True - format: - function_suffix: _shape - -# - decl: Buffer * detachBuffer() - - - decl: View* apply() - return_this: True - - - decl: View* apply(IndexType num_elems, - IndexType offset = 0, - IndexType stride = 1) - default_arg_suffix: - - _nelems - - _nelems_offset - - _nelems_offset_stride - return_this: True - - - decl: View* apply(TypeID type, - IndexType num_elems, - IndexType offset = 0, - IndexType stride = 1) - default_arg_suffix: - - _type_nelems - - _type_nelems_offset - - _type_nelems_offset_stride - return_this: True - - - decl: View * apply( TypeID type, int ndims, IndexType * shape+dimension ) - format: - function_suffix: _type_shape - return_this: True -# - decl: View* apply(const DataType& dtype) - - # Methods to set data in a view (scalar, string, or external data). - - decl: | - template - void setScalar(ScalarType value) - cxx_template: - - instantiation: - - instantiation: - - instantiation: - - instantiation: - - - decl: View * setString(const std::string& value) - return_this: True - - - decl: View * setExternalDataPtr(void * external_ptr) - return_this: True - format: - function_suffix: _only - - - decl: View * setExternalDataPtr(TypeID type, - IndexType num_elems, - void * external_ptr) - return_this: True - format: - function_suffix: _type - fortran_generic: - - decl: (int32_t num_elems) - fortran_suffix: int32_t - - decl: (int64_t num_elems) - fortran_suffix: int64_t - - - decl: View * setExternalDataPtr(TypeID type, - int ndims, - IndexType * shape+dimension, - void * external_ptr) - return_this: True - format: - function_suffix: _shape - - # Methods to retrieve data in a view. - - decl: const char * getString() +len(MAXNAMESIZE) - format: - F_string_result_as_arg: name - - - decl: | - template - DataType getData() - cxx_template: - - instantiation: - - instantiation: - - instantiation: - - instantiation: - - - decl: void * getVoidPtr() const - - # print methods - - decl: void print() const -# - decl: void createNativeLayout(Node &) const - - decl: bool rename( const string& new_name ) - - python: - type: [ init, richcompare ] - - -###################################################################### - -- decl: bool nameIsValid(const std::string& name) - # The concept of a valid name is different for C++, C and Fortran - options: - F_string_len_trim: false - format: - C_code: return name != NULL; - F_code: '{F_result} = name .ne. " "' - - -###################################################################### -patterns: - C_invalid_name: | - if (! axom::sidre::nameIsValid({cxx_var})) {{ - return SIDRE_InvalidName; - }} - # return a blank field string if an error occurs - C_invalid_name_buf: | - if (! axom::sidre::nameIsValid({cxx_var})) {{ - std::memset({c_var}, ' ', {c_var_len}); - return; - }} - # Fill in capsule then return NULL instead of pointer to capsule. - C_null_to_error_capsule: | - if ({cxx_var} == nullptr) {{ - {c_var}->addr = NULL; - {c_var}->idtor = 0; - return NULL; - }} - PY_invalid_name: | - if (! axom::sidre::nameIsValid({cxx_var})) {{ - PyErr_SetString(PyExc_KeyError, "XXX - need name"); - return NULL; - }} - # report the invalid index, assume local variable idx - PY_invalid_name_idx: | - if (! axom::sidre::nameIsValid({cxx_var})) {{ - Py_RETURN_NONE; - }} -# PyErr_SetObject(PyExc_KeyError, PyInt_FromLong(idx)); -# return NULL; - # Convert NULL to None - PY_null_to_none: | - if ({cxx_var} == nullptr) {{ - Py_RETURN_NONE; - }} - - - -# Files which contain code to be inserted into generated code -splicer: - c: - - c_fortran/csidresplicer.c - f: - - c_fortran/fsidresplicer.f - - genfsidresplicer.f From fc502f03fb5357ccc05303ccb72cd1e25aec8a44 Mon Sep 17 00:00:00 2001 From: Lee Taylor Date: Thu, 23 Apr 2020 12:36:32 -0700 Subject: [PATCH 174/632] Update RELEASE-NOTES.md for Shroud changes Add reminders in shroud.yaml files that debug option is available. Remove check on PYTHON_EXECUTABLE while checking for SHROUD_EXECUTABLE. Installed Shroud knows which Python to use. --- RELEASE-NOTES.md | 5 +++++ src/axom/quest/interface/quest_shroud.yaml | 1 + src/axom/sidre/interface/sidre_shroud.yaml | 1 + src/axom/sidre/spio/interface/spio_shroud.yaml | 1 + src/axom/slic/interface/slic_shroud.yaml | 3 +-- src/cmake/thirdparty/SetupAxomThirdParty.cmake | 3 --- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1b948eaa70..f66b1e8785 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -30,6 +30,11 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ - Modified the API of Axom's memory management routines to not leak usage of Umpire. Instead of passing an `umpire::Allocator` object to specify an allocator, we now use the corresponding integer ID associated with the allocator. +- All names in the C API now preserve the case of the C++ function. + ex. `SIDRE_datastore_new` is now `SIDRE_DataStore_new`. +- Fortran API in slic module. `axom::slic::message` Level enums are changed + from *enum-name_enumerator* to *namespace_enumerator*. + ex. `level_error` is now `message_error`. ### Fixed - Fixed issue with missing the bvh_traverse.hpp from the install prefix, which was preventing diff --git a/src/axom/quest/interface/quest_shroud.yaml b/src/axom/quest/interface/quest_shroud.yaml index a4aa98fd88..f5fb267dc8 100644 --- a/src/axom/quest/interface/quest_shroud.yaml +++ b/src/axom/quest/interface/quest_shroud.yaml @@ -14,6 +14,7 @@ cxx_header: axom/quest/interface/inout.hpp axom/quest/interface/signed_distance. namespace: axom quest options: +# debug: True C_line_length: 1000 F_module_name_library_template: axom_{library_lower} # F_module_per_class: False diff --git a/src/axom/sidre/interface/sidre_shroud.yaml b/src/axom/sidre/interface/sidre_shroud.yaml index b5722be308..7b4d6f6127 100644 --- a/src/axom/sidre/interface/sidre_shroud.yaml +++ b/src/axom/sidre/interface/sidre_shroud.yaml @@ -13,6 +13,7 @@ library: Sidre namespace: axom sidre options: +# debug: True C_line_length: 1000 F_module_per_class: False F_module_name_library_template: axom_{library_lower} diff --git a/src/axom/sidre/spio/interface/spio_shroud.yaml b/src/axom/sidre/spio/interface/spio_shroud.yaml index d70171e4d8..151e447d3f 100644 --- a/src/axom/sidre/spio/interface/spio_shroud.yaml +++ b/src/axom/sidre/spio/interface/spio_shroud.yaml @@ -12,6 +12,7 @@ library: SPIO namespace: axom sidre options: +# debug: True C_line_length: 1000 F_module_name_library_template: axom_{library_lower} F_module_per_class: False diff --git a/src/axom/slic/interface/slic_shroud.yaml b/src/axom/slic/interface/slic_shroud.yaml index b687c9f5de..2c12eda1d2 100644 --- a/src/axom/slic/interface/slic_shroud.yaml +++ b/src/axom/slic/interface/slic_shroud.yaml @@ -13,12 +13,11 @@ cxx_header: axom/slic/interface/slic.hpp namespace: axom slic options: +# debug: True C_line_length: 1000 F_module_name_library_template: axom_{library_lower} # Change the default template for Fortran functions to include the library name. F_name_impl_template: "{library_lower}_{F_name_scope}{underscore_name}{function_suffix}" -# C_enum_member_template: "{C_prefix}{enum_member_name}" -# F_enum_member_template: "{enum_name}_{enum_member_name}" format: C_prefix: SLIC_ diff --git a/src/cmake/thirdparty/SetupAxomThirdParty.cmake b/src/cmake/thirdparty/SetupAxomThirdParty.cmake index b3ee7f92c7..8e0aaff846 100644 --- a/src/cmake/thirdparty/SetupAxomThirdParty.cmake +++ b/src/cmake/thirdparty/SetupAxomThirdParty.cmake @@ -130,9 +130,6 @@ endif() # Shroud - Generates C/Fortran/Python bindings #------------------------------------------------------------------------------ if(EXISTS ${SHROUD_EXECUTABLE}) - if(NOT EXISTS ${PYTHON_EXECUTABLE}) - message(FATAL_ERROR "Shroud requires PYTHON_EXECUTABLE and SHROUD_EXECUTABLE to be defined and exist.") - endif() execute_process(COMMAND ${SHROUD_EXECUTABLE} --cmake ${CMAKE_CURRENT_BINARY_DIR}/SetupShroud.cmake ERROR_VARIABLE SHROUD_cmake_error From 14ee1de45b1d407c3abe1c505cf8e267c82930f6 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Fri, 24 Apr 2020 11:16:16 -0700 Subject: [PATCH 175/632] Add documentation in Group and clean up logic and warnings for unnamed Groups and Views. --- src/axom/sidre/core/Group.cpp | 32 +++++++++++++++++++--- src/axom/sidre/core/Group.hpp | 40 +++++++++++++++++++++++++--- src/axom/sidre/tests/sidre_group.cpp | 20 +++++++++++++- 3 files changed, 85 insertions(+), 7 deletions(-) diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index 83ee27ab92..e73fedffca 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -174,8 +174,19 @@ View* Group::createView( const std::string& path ) Group* group; if (intpath.empty()) - { - group = this; + { + SLIC_CHECK_MSG(m_is_list, + SIDRE_GROUP_LOG_PREPEND + << "Could not create View with empty string " + << "for the path." ); + if (m_is_list) + { + group = this; + } + else + { + return nullptr; + } } else { @@ -928,7 +939,21 @@ Group* Group::createGroup( const std::string& path, bool is_list ) Group* Group::createUnnamedGroup( bool is_list ) { - Group* new_group = new(std::nothrow) Group("", getDataStore(), is_list); + SLIC_CHECK_MSG(m_is_list, + SIDRE_GROUP_LOG_PREPEND + << "Cannot create an unnamed Group when not using " + << "list format."); + + Group* new_group; + if (m_is_list) + { + new_group = new(std::nothrow) Group("", getDataStore(), is_list); + } + else + { + new_group = nullptr; + } + if ( new_group == nullptr ) { return nullptr; @@ -1700,6 +1725,7 @@ Group::Group(const std::string& name, , m_index(InvalidIndex) , m_parent(nullptr) , m_datastore(datastore) + , m_is_list(is_list) , m_view_coll(0) , m_group_coll(0) #ifdef AXOM_USE_UMPIRE diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index 79d76edbd4..3c9d285bd0 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -106,6 +106,11 @@ template class ItemCollection; * children of the current Group because an index has no meaning outside * of the indexed group. None of these methods is marked with "Child". * + * A Group can optionally be created to hold items in a "list format". In + * this format, any number of child Group or View items can be created with + * empty strings for their names, and none of the methods that access + * child items by name or path will return a valid pointer. + * * \attention when Views or Groups are created, destroyed, copied, or moved, * indices of other Views and Groups in associated Group objects may * become invalid. This is analogous to iterator invalidation for STL @@ -427,6 +432,10 @@ class Group * \brief Create an undescribed (i.e., empty) View object with given name * or path in this Group. * + * If path is an empty string, an unnamed view can be created only if + * this Group was created to hold items in a list format. Otherwise + * an empty string will result in a nullptr being returned. + * * \return pointer to new View object or nullptr if one is not created. */ View* createView( const std::string& path ); @@ -478,8 +487,12 @@ class Group //! of these methods, the Buffer must be allocated and it must be compatible //! with the View data description. //! -//! Each of these methods is a no-op if the given View name is an -//! empty string or the Group already has a View with given name or path. +//! Each of these methods is a no-op if Group already has a View or child +//! Group with the given name or path. +//! +//! If this Group was created to hold items in list format, the path can +//! be an empty string. Otherwise an empty string for the path will result +//! in a no-op. //! //! Also, calling one of these methods with a null Buffer pointer is //! similar to creating a View with no data association. @@ -976,11 +989,24 @@ class Group * If name is an empty string or Group already has a child Group with * given name or path, method is a no-op. * + * The optional is_list argument is used to determine if the created + * child Group will hold items in list format. + * * \return pointer to created Group object or nullptr if new * Group is not created. */ Group* createGroup( const std::string& path, bool is_list = false ); + /* + * \brief Create a child Group within this Group with no name. + * + * This is intended only to be called when this Group holds items in list + * format. If this Group does not use list format, this method is a + * no-op. + * + * \return pointer to created Group object or nullptr if new Group is + * not created. + */ Group* createUnnamedGroup( bool is_list = false ); /*! @@ -1439,6 +1465,11 @@ class Group * * attachGroup must be called on a newly created Group to insert it * into the hierarchy. The root group is an exception to this rule. + * + * The boolean argument is_list, if true, allows the Group to hold its + * childe items in list format, which allows those items to have empty + * strings for names. If not in list format, all items must have unique + * non-empty strings for names. */ Group(const std::string& name, DataStore* datastore, bool is_list); @@ -1612,6 +1643,9 @@ class Group /// This Group object lives in the tree of this DataStore object. DataStore* m_datastore; + /// This identifies whether this Group holds items in list format. + bool m_is_list; + /// Character used to denote a path string passed to get/create calls. static const char s_path_delimiter; @@ -1619,7 +1653,7 @@ class Group // using ViewCollection = ItemCollection; // - using GroupCollection = ItemCollection; + using GroupCollection = ItemCollection; /////////////////////////////////////////////////////////////////// /// Collection of Views diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index 2038062e59..bb380cd52a 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -466,12 +466,16 @@ TEST(sidre_group, child_lists) DataStore* ds = new DataStore(); Group* root = ds->getRoot(); + // parent is a Group in list format. Group* parent = root->createGroup("parent", true); + + // Create 10 unnamed Groups as children of parent. for (IndexType i = 0; i < 10; ++i) { Group* unnamed_group = parent->createUnnamedGroup(); unnamed_group->createViewScalar("val", i); } + // Create 15 unnamed Views as children of parent. for (IndexType i = 0; i < 15; ++i) { View* unnamed_view; if (i % 3 == 0) { @@ -491,8 +495,18 @@ TEST(sidre_group, child_lists) } } + // Create Group not in list format, show that it can't create + // unnamed children. + Group* not_list = root->createGroup("not_list", false); + Group* dummy_group = not_list->createUnnamedGroup(); + View* dummy_view = not_list->createView(""); + EXPECT_EQ(not_list->getNumGroups(), 0); + EXPECT_EQ(not_list->getNumViews(), 0); + EXPECT_TRUE(dummy_group == nullptr); + EXPECT_TRUE(dummy_view == nullptr); + + // Access data from unnamed Groups held by parent. std::set scalars; - for (IndexType idx = parent->getFirstValidGroupIndex() ; indexIsValid(idx) ; idx = parent->getNextValidGroupIndex(idx)) @@ -509,6 +523,7 @@ TEST(sidre_group, child_lists) EXPECT_TRUE(parent->hasGroup(6)); EXPECT_FALSE(parent->hasGroup(20)); + // Destroy five of the unnamed Groups held by parent. for (IndexType idx = parent->getFirstValidGroupIndex() ; indexIsValid(idx) ; idx = parent->getNextValidGroupIndex(idx)) @@ -519,9 +534,11 @@ TEST(sidre_group, child_lists) } } + // Add one more unnamed Group, so there should be six child Groups. (void) parent->createUnnamedGroup(); EXPECT_EQ(parent->getNumGroups(), 6); + // Access data from the unnamed Views. for (IndexType idx = parent->getFirstValidViewIndex() ; indexIsValid(idx) ; idx = parent->getNextValidViewIndex(idx)) @@ -548,6 +565,7 @@ TEST(sidre_group, child_lists) root->destroyGroup("parent"); + delete ds; } //------------------------------------------------------------------------------ From 9fd13bfbcd5bcc6d3dbc626a4182e1b400d72737 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Fri, 24 Apr 2020 11:19:46 -0700 Subject: [PATCH 176/632] Uncrustify sidre files --- src/axom/sidre/core/Group.cpp | 14 +++--- src/axom/sidre/core/Group.hpp | 2 +- src/axom/sidre/core/ListCollection.hpp | 12 +++--- src/axom/sidre/core/MapCollection.hpp | 2 +- src/axom/sidre/examples/sidre_array.cpp | 37 ++++++++-------- .../sidre/examples/sidre_external_array.cpp | 14 +++--- src/axom/sidre/tests/sidre_group.cpp | 43 +++++++++++++------ src/axom/sidre/tests/sidre_view.cpp | 2 +- 8 files changed, 71 insertions(+), 55 deletions(-) diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index e73fedffca..4d1eb2dbb7 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -925,7 +925,8 @@ Group* Group::createGroup( const std::string& path, bool is_list ) return nullptr; } - Group* new_group = new(std::nothrow) Group(intpath, group->getDataStore(), is_list); + Group* new_group = new(std::nothrow) Group(intpath, + group->getDataStore(), is_list); if ( new_group == nullptr ) { return nullptr; @@ -952,7 +953,7 @@ Group* Group::createUnnamedGroup( bool is_list ) else { new_group = nullptr; - } + } if ( new_group == nullptr ) { @@ -1736,7 +1737,8 @@ Group::Group(const std::string& name, { m_view_coll = new ListCollection(); m_group_coll = new ListCollection(); - } else + } + else { m_view_coll = new MapCollection(); m_group_coll = new MapCollection(); @@ -1767,7 +1769,8 @@ Group::~Group() */ View* Group::attachView(View* view) { - if ( view == nullptr || (!view->getName().empty() && hasChildView(view->getName())) ) + if ( view == nullptr || + (!view->getName().empty() && hasChildView(view->getName())) ) { return nullptr; } @@ -1854,7 +1857,8 @@ void Group::destroyViewAndData( View* view ) */ Group* Group::attachGroup(Group* group) { - if ( group == nullptr || (!group->getName().empty() && hasChildGroup(group->getName())) ) + if ( group == nullptr || + (!group->getName().empty() && hasChildGroup(group->getName())) ) { return nullptr; } diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index 3c9d285bd0..de43e710fb 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -1644,7 +1644,7 @@ class Group DataStore* m_datastore; /// This identifies whether this Group holds items in list format. - bool m_is_list; + bool m_is_list; /// Character used to denote a path string passed to get/create calls. static const char s_path_delimiter; diff --git a/src/axom/sidre/core/ListCollection.hpp b/src/axom/sidre/core/ListCollection.hpp index d72fbd7f7e..a83b37b9ab 100644 --- a/src/axom/sidre/core/ListCollection.hpp +++ b/src/axom/sidre/core/ListCollection.hpp @@ -63,13 +63,13 @@ * TYPE* getItem(IndexType idx); * TYPE const* getItem(IndexType idx) const; * - * - // Return sidre::InvalidName because this class cannot + * - // Return sidre::InvalidName because this class cannot * // identify items by name. * * std::string getItemName(IndexType idx) const; * * - // Return sidre::InvalidIndex because this class cannot - * // identify items by name. + * // identify items by name. * * IndexType getItemIndex(const std::string& name) const; * @@ -293,8 +293,8 @@ IndexType ListCollection::insertItem(TYPE* item, { SLIC_WARNING_IF(!name.empty(), "Item " << name << " added to Group " - << "which holds items in list format. " - << "The name of this item will be ignored."); + << "which holds items in list format. " + << "The name of this item will be ignored."); bool use_recycled_index = false; IndexType idx = m_items.size(); @@ -321,7 +321,7 @@ IndexType ListCollection::insertItem(TYPE* item, template TYPE* ListCollection::removeItem(const std::string& name) { - (void)name; + (void)name; SLIC_WARNING("ListCollection::removeItem cannot identify items by name"); return 0; } @@ -332,7 +332,7 @@ TYPE* ListCollection::removeItem(IndexType idx) TYPE* ret_val = nullptr; if ( hasItem(idx) ) { - for (auto itr = m_index_list.begin(); itr != m_index_list.end(); ++itr) + for (auto itr = m_index_list.begin() ; itr != m_index_list.end() ; ++itr) { if (*itr == idx) { diff --git a/src/axom/sidre/core/MapCollection.hpp b/src/axom/sidre/core/MapCollection.hpp index 46dd3260f8..f7668d5199 100644 --- a/src/axom/sidre/core/MapCollection.hpp +++ b/src/axom/sidre/core/MapCollection.hpp @@ -10,7 +10,7 @@ * * \brief Header file for MapCollection. * - * MapCollection is an implemenation of ItemCollection to + * MapCollection is an implemenation of ItemCollection to * hold a collection of items of a fixed type that can be accessed * accessed by string name or sidre::IndexType. * diff --git a/src/axom/sidre/examples/sidre_array.cpp b/src/axom/sidre/examples/sidre_array.cpp index 558c526185..4efa0e799f 100644 --- a/src/axom/sidre/examples/sidre_array.cpp +++ b/src/axom/sidre/examples/sidre_array.cpp @@ -40,12 +40,12 @@ int main ( int argc, char** argv ) constexpr axom::IndexType NUM_NODES = 10; constexpr axom::IndexType DIMENSION = 4; sidre::Array< int > nodes_1( - root1->createView("nodes_1/data"),NUM_NODES,DIMENSION); + root1->createView("nodes_1/data"),NUM_NODES,DIMENSION); int value = 0; - for ( axom::IndexType i=0; i < NUM_NODES; ++i ) + for ( axom::IndexType i=0 ; i < NUM_NODES ; ++i ) { - for ( axom::IndexType j=0; j < DIMENSION; ++j ) + for ( axom::IndexType j=0 ; j < DIMENSION ; ++j ) { nodes_1( i,j ) = value; ++value; @@ -68,25 +68,25 @@ int main ( int argc, char** argv ) sidre_io.read( root2, "sidre_array_mesh.root"); // DEBUG - SLIC_INFO( "Here is the array data in DataStore_2:\n" ); - root2->print(); - std::cout << std::endl; + SLIC_INFO( "Here is the array data in DataStore_2:\n" ); + root2->print(); + std::cout << std::endl; // END DEBUG - sidre::Array< int > nodes_2(root2->getView("nodes_1/data") ); - SLIC_ASSERT( nodes_2.size() == NUM_NODES ); - SLIC_ASSERT( nodes_2.numComponents() == DIMENSION ); + sidre::Array< int > nodes_2(root2->getView("nodes_1/data") ); + SLIC_ASSERT( nodes_2.size() == NUM_NODES ); + SLIC_ASSERT( nodes_2.numComponents() == DIMENSION ); // STEP 4: ensure the data is correct - int expected_value = 0; - for ( axom::IndexType i=0; i < NUM_NODES; ++i ) + int expected_value = 0; + for ( axom::IndexType i=0 ; i < NUM_NODES ; ++i ) + { + for ( axom::IndexType j=0 ; j < DIMENSION ; ++j ) { - for ( axom::IndexType j=0; j < DIMENSION; ++j ) - { - SLIC_ASSERT( nodes_2(i,j) == expected_value ); - ++expected_value; - } // END for all components - } // END for all nodes + SLIC_ASSERT( nodes_2(i,j) == expected_value ); + ++expected_value; + } // END for all components + } // END for all nodes // STEP 5: delete the datastores delete dataStore2; @@ -98,6 +98,3 @@ int main ( int argc, char** argv ) MPI_Finalize(); return 0; } - - - diff --git a/src/axom/sidre/examples/sidre_external_array.cpp b/src/axom/sidre/examples/sidre_external_array.cpp index 583d992d62..394766c52a 100644 --- a/src/axom/sidre/examples/sidre_external_array.cpp +++ b/src/axom/sidre/examples/sidre_external_array.cpp @@ -36,7 +36,7 @@ void sidre_write( MPI_Comm comm, sidre::DataStore ds; sidre::Group* root = ds.getRoot(); - sidre::View* view = root->createView( "data" ); + sidre::View* view = root->createView( "data" ); sidre::IndexType shape[2]; shape[ 0 ] = numTuples; @@ -123,14 +123,15 @@ int main ( int argc, char** argv ) int* data = axom::allocate< int >( NSIZE ); SLIC_ASSERT( data != nullptr ); - for ( int i=0; i < NSIZE; ++i ) + for ( int i=0 ; i < NSIZE ; ++i ) { data[ i ] = (i+1) * 10; } // STEP 1: dump the data to a file using sidre SLIC_INFO( "Writting data..." ); - sidre_write( problem_comm, "sidre_external_array_mesh", data, NUM_NODES, DIMENSION ); + sidre_write( problem_comm, "sidre_external_array_mesh", data, NUM_NODES, + DIMENSION ); SLIC_INFO( "[DONE]" ); // STEP 2: read the data from a file using sidre @@ -139,13 +140,14 @@ int main ( int argc, char** argv ) axom::IndexType ncomp = -1; SLIC_INFO( "Reading data..." ); - sidre_read( problem_comm, "sidre_external_array_mesh.root", data2, ntuples, ncomp ); + sidre_read( problem_comm, "sidre_external_array_mesh.root", data2, ntuples, + ncomp ); SLIC_INFO( "[DONE]" ); // STEP 3: check the data SLIC_ASSERT( ntuples == NUM_NODES ); SLIC_ASSERT( ncomp == DIMENSION ); - for ( int i=0; i < NSIZE; ++i ) + for ( int i=0 ; i < NSIZE ; ++i ) { SLIC_ASSERT( data[ i ] == data2[ i ] ); } @@ -157,5 +159,3 @@ int main ( int argc, char** argv ) MPI_Finalize(); return 0; } - - diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index bb380cd52a..a30ca7aa51 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -470,26 +470,35 @@ TEST(sidre_group, child_lists) Group* parent = root->createGroup("parent", true); // Create 10 unnamed Groups as children of parent. - for (IndexType i = 0; i < 10; ++i) { + for (IndexType i = 0 ; i < 10 ; ++i) + { Group* unnamed_group = parent->createUnnamedGroup(); unnamed_group->createViewScalar("val", i); } // Create 15 unnamed Views as children of parent. - for (IndexType i = 0; i < 15; ++i) { + for (IndexType i = 0 ; i < 15 ; ++i) + { View* unnamed_view; - if (i % 3 == 0) { + if (i % 3 == 0) + { unnamed_view = parent->createView(""); - } else if (i % 3 == 1) { + } + else if (i % 3 == 1) + { unnamed_view = parent->createViewScalar("", i*i); - } else { + } + else + { unnamed_view = parent->createViewString("", "foo"); } - if (!unnamed_view->isApplied()) { + if (!unnamed_view->isApplied()) + { unnamed_view->apply(INT_ID, i); unnamed_view->allocate(INT_ID, i); int* vdata = unnamed_view->getData(); - for (IndexType j = 0; j < i; ++j) { + for (IndexType j = 0 ; j < i ; ++j) + { vdata[j] = j + 3; } } @@ -500,8 +509,8 @@ TEST(sidre_group, child_lists) Group* not_list = root->createGroup("not_list", false); Group* dummy_group = not_list->createUnnamedGroup(); View* dummy_view = not_list->createView(""); - EXPECT_EQ(not_list->getNumGroups(), 0); - EXPECT_EQ(not_list->getNumViews(), 0); + EXPECT_EQ(not_list->getNumGroups(), 0); + EXPECT_EQ(not_list->getNumViews(), 0); EXPECT_TRUE(dummy_group == nullptr); EXPECT_TRUE(dummy_view == nullptr); @@ -544,22 +553,28 @@ TEST(sidre_group, child_lists) idx = parent->getNextValidViewIndex(idx)) { View* unnamed_view = parent->getView(idx); - if (idx % 3 == 0) { + if (idx % 3 == 0) + { EXPECT_EQ(unnamed_view->getTypeID(), INT_ID); IndexType num_elems = unnamed_view->getNumElements(); EXPECT_EQ(num_elems, idx); int* vdata = unnamed_view->getData(); - for (IndexType j = 0; j < num_elems; ++j) { + for (IndexType j = 0 ; j < num_elems ; ++j) + { EXPECT_EQ(vdata[j], j+3); } - } else if (idx % 3 == 1) { + } + else if (idx % 3 == 1) + { EXPECT_TRUE(unnamed_view->isScalar()); IndexType val = unnamed_view->getScalar(); EXPECT_EQ(val, idx*idx); - } else { + } + else + { EXPECT_TRUE(unnamed_view->isString()); std::string vstr = unnamed_view->getString(); - EXPECT_EQ(vstr, std::string("foo")); + EXPECT_EQ(vstr, std::string("foo")); } } diff --git a/src/axom/sidre/tests/sidre_view.cpp b/src/axom/sidre/tests/sidre_view.cpp index 6b922dba9b..1386158ab3 100644 --- a/src/axom/sidre/tests/sidre_view.cpp +++ b/src/axom/sidre/tests/sidre_view.cpp @@ -1696,7 +1696,7 @@ class UmpireTest : public ::testing::TestWithParam void TearDown() override { const int allocID = - axom::getUmpireResourceAllocatorID( umpire::resource::Host ); + axom::getUmpireResourceAllocatorID( umpire::resource::Host ); axom::setDefaultAllocator( allocID ); } From 07ddb232b84e25ec31619fa42e6d9dd7d0ab1e21 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 24 Apr 2020 19:00:22 -0700 Subject: [PATCH 177/632] BUGFIX: use cub sort when using CUDA_EXEC async Fix template specialization of custom_sort() routine, that is used internally by the BVH to sort the supplied AABBs according to their morton index, to dispacth to the CUB sort, when the specified execution policy is CUDA_EXEC async. Resolves #230. --- src/axom/spin/internal/linear_bvh/build_radix_tree.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index 682e09ba75..ab711eca99 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -403,13 +403,13 @@ void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) //------------------------------------------------------------------------------ #if defined(AXOM_USE_CUDA) && defined(AXOM_USE_RAJA) && \ defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_CUB) -template < int BLOCK_SIZE > -void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE >, +template < int BLOCK_SIZE, axom::ExecutionMode EXEC_MODE > +void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, uint32*& mcodes, int32 size, int32* iter ) { AXOM_PERF_MARK_FUNCTION( "custom_sort" ); - using ExecSpace = typename axom::CUDA_EXEC< BLOCK_SIZE >; + using ExecSpace = typename axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >; array_counting< ExecSpace >(iter, size, 0, 1); AXOM_PERF_MARK_SECTION( "gpu_cub_sort", From db1f0e542b60902674b851f745a66c4334047c7f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Fri, 24 Apr 2020 19:08:10 -0700 Subject: [PATCH 178/632] ENH: document fix for BVH async in release notes --- RELEASE-NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 5e24f77c8c..f42346f508 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -51,6 +51,10 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ex. `level_error` is now `message_error`. ### Fixed +- Fixed issue where the BVH would dispatch to the CPU sort() routine when the + specified execution policy was CUDA_EXEC async. Now, when the execution policy + is CUDA_EXEC the code would correctly dispatch to the GPU sort, using CUB + (when CUB is enabled), regardless of whether it's synchronous or asynchronous. - Fixed issue with missing the bvh_traverse.hpp from the install prefix, which was preventing applications from using the BVH when pointing to an Axom install prefix. - Fixed usage of cuda kernel policies in Mint. Raja v0.11.0 changed the way max threads From 4f199c6c939072399f76bb5cb510185ed64fd0da Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 28 Apr 2020 13:47:28 -0700 Subject: [PATCH 179/632] ENH: update blt for changes related to CUDA This commits updates blt in order to use some the updated registered CUDA library, which includes the path to the NVIDIA SDK in the link flags. This aslo resolves a build issue on blueos where linking to "nvToolsExt" was failing b/c the library was not found. --- src/cmake/blt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake/blt b/src/cmake/blt index 0d28f50e69..f0ec653ac5 160000 --- a/src/cmake/blt +++ b/src/cmake/blt @@ -1 +1 @@ -Subproject commit 0d28f50e69cbe04c799ac0790e61e2194fa6b59a +Subproject commit f0ec653ac5323a652d39f6b37c5179fda5e6695e From 9bb390a7c3448fa6ed7d484a85426113d5f05703 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 28 Apr 2020 15:57:20 -0700 Subject: [PATCH 180/632] ENH: update docker gcc8 host-config Updates to reflect chages to gcc8 docker image: * cmake is changed to 3.10.1 * mpich is now set to 3.3.2 * umpire is now set to 2.1.0 * hdf5 is now set to 1.8.21 --- ...docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake index d2e8c87e04..f740374f7c 100644 --- a/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake +++ b/host-configs/docker/docker-linux-ubuntu16.04-x86_64-gcc@8.1.0.cmake @@ -14,7 +14,7 @@ # Compiler Spec: gcc@8.1.0 ################################## -# CMake executable path: /home/axom/axom_tpls/gcc-8.1.0/cmake-3.9.6/bin/cmake +# CMake executable path: /home/axom/axom_tpls/gcc-8.1.0/cmake-3.10.1/bin/cmake ############## # Compilers @@ -45,7 +45,7 @@ set(CONDUIT_DIR "${TPL_ROOT}/conduit-master" CACHE PATH "") set(MFEM_DIR "${TPL_ROOT}/mfem-4.0" CACHE PATH "") # hdf5 from uberenv -set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") +set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.21" CACHE PATH "") # scr not built by uberenv @@ -53,7 +53,7 @@ set(HDF5_DIR "${TPL_ROOT}/hdf5-1.8.19" CACHE PATH "") set(RAJA_DIR "/usr/local/share/raja" CACHE PATH "") # umpire from uberenv -set(UMPIRE_DIR "${TPL_ROOT}/umpire-1.0.0" CACHE PATH "") +set(UMPIRE_DIR "${TPL_ROOT}/umpire-2.1.0" CACHE PATH "") # python not built by uberenv @@ -73,13 +73,13 @@ set(ENABLE_DOCS OFF CACHE BOOL "") set(ENABLE_MPI ON CACHE BOOL "") -set(MPI_C_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpicc" CACHE PATH "") +set(MPI_C_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.3.2/bin/mpicc" CACHE PATH "") -set(MPI_CXX_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpic++" CACHE PATH "") +set(MPI_CXX_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.3.2/bin/mpic++" CACHE PATH "") -set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpif90" CACHE PATH "") +set(MPI_Fortran_COMPILER "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.3.2/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.2.1/bin/mpiexec" CACHE PATH "") +set(MPIEXEC "/home/axom/axom_tpls/gcc-8.1.0/mpich-3.3.2/bin/mpiexec" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") From 1502fb42c8bdcce31c1425dc700464686f836de1 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 28 Apr 2020 16:50:45 -0700 Subject: [PATCH 181/632] Update cmake path to system level --- scripts/uberenv/packages/axom/package.py | 6 +++++- .../blueos_3_ppc64le_ib/devtools/packages.yaml | 5 ++++- .../spack_configs/blueos_3_ppc64le_ib/packages.yaml | 11 +++++------ .../blueos_3_ppc64le_ib_p9/devtools/packages.yaml | 5 ++++- .../blueos_3_ppc64le_ib_p9/packages.yaml | 11 +++++------ .../toss_3_x86_64_ib/devtools/packages.yaml | 5 ++++- .../spack_configs/toss_3_x86_64_ib/packages.yaml | 11 +++++------ 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index ce3664f8d4..109dd12a54 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -178,6 +178,7 @@ def hostconfig(self, spec, prefix): #error could not find cmake! crash() cmake_exe = cmake_exe.command + cmake_exe = os.path.realpath(cmake_exe) host_config_path = self._get_host_config_path(spec) cfg = open(host_config_path,"w") @@ -433,7 +434,10 @@ def configure(self, spec, prefix): cmake_args = [] cmake_args.extend(std_cmake_args) - cmake_args.extend(["-C", host_config_path, "../src"]) + cmake_args.extend(["-C", host_config_path]) + if self.run_tests == False: + cmake_args.extend(["-DENABLE_TESTS=OFF"]) + cmake_args.extend(["../src"]) print("Configuring Axom...") cmake(*cmake_args) diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml index 00b0fe6cea..2402a3df98 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/devtools/packages.yaml @@ -93,4 +93,7 @@ packages: # Globally lock in version of CMake cmake: - version: [3.9.6] + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml index 424b0af879..18fdf7fe2a 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib/packages.yaml @@ -81,6 +81,11 @@ packages: paths: bzip2: /usr buildable: False + cmake: + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False gettext: paths: gettext: /usr @@ -111,12 +116,6 @@ packages: version: [0.5.1] # Globally lock in versions of Devtools - cmake: - version: [3.9.6] - paths: - cmake: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6 - buildable: False - cppcheck: version: [1.87] paths: diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml index 00b0fe6cea..2402a3df98 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/devtools/packages.yaml @@ -93,4 +93,7 @@ packages: # Globally lock in version of CMake cmake: - version: [3.9.6] + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False diff --git a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml index cb345a64de..4f223e96f5 100644 --- a/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml +++ b/scripts/uberenv/spack_configs/blueos_3_ppc64le_ib_p9/packages.yaml @@ -81,6 +81,11 @@ packages: paths: bzip2: /usr buildable: False + cmake: + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False gettext: paths: gettext: /usr @@ -111,12 +116,6 @@ packages: version: [0.5.1] # Globally lock in versions of Devtools - cmake: - version: [3.9.6] - paths: - cmake: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6 - buildable: False - cppcheck: version: [1.87] paths: diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml index 3a6b45c09e..aa7ed8df27 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/devtools/packages.yaml @@ -96,4 +96,7 @@ packages: # Globally lock in version of CMake cmake: - version: [3.9.6] + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False diff --git a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml index 3134834fa3..f08a6723e8 100644 --- a/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml +++ b/scripts/uberenv/spack_configs/toss_3_x86_64_ib/packages.yaml @@ -84,6 +84,11 @@ packages: paths: bzip2: /usr buildable: False + cmake: + version: [3.14.5] + paths: + cmake: /usr/tce/packages/cmake/cmake-3.14.5 + buildable: False gettext: paths: gettext: /usr @@ -114,12 +119,6 @@ packages: version: [0.5.1] # Globally lock in versions of Devtools - cmake: - version: [3.9.6] - paths: - cmake: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6 - buildable: False - cppcheck: version: [1.87] paths: From 6990c0441a427945d01f8579e89261177704ba55 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 28 Apr 2020 20:42:06 -0700 Subject: [PATCH 182/632] update blt, move misccache into timedate build dir, update working rzgenie host-configs --- host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake | 8 ++++---- host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake | 8 ++++---- host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake | 8 ++++---- host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake | 8 ++++---- host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake | 8 ++++---- host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake | 8 ++++---- host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake | 8 ++++---- scripts/uberenv/spack_configs/config.yaml | 2 +- src/cmake/blt | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake index fcd4727a35..6cb87aee78 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@4.0.0.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: clang@4.0.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/clang-4.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/clang-4.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-clang-4.0.0/bin/mp set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-clang-4.0.0/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake index c8e50d0221..52511a015e 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-clang@6.0.0.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: clang@6.0.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-4.9.3/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/clang-6.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/clang-6.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-clang-6.0.0/bin/mp set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-clang-6.0.0/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake index 16147f7507..5c04dbe8fa 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@6.1.0.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: gcc@6.1.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-6.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/gcc-6.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/gcc-6.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0/bin/mpic set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-6.1.0/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake index a6c87d5c09..4c8122a989 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@7.3.0.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: gcc@7.3.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/gcc-7.3.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/gcc-7.3.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0/bin/mpic set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-7.3.0/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake index d5c355bfb8..bea4603665 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-gcc@8.1.0.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: gcc@8.1.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-8.1.0/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/gcc-8.1.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/gcc-8.1.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0/bin/mpic set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-gcc-8.1.0/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake index 6ab2a2f1bf..7f520a01b0 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@18.0.2.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: intel@18.0.2 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-18.0.2/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/intel-18.0.2" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/intel-18.0.2" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2/bin/m set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-18.0.2/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake index 79e62b55ce..ee3f702cf7 100644 --- a/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake +++ b/host-configs/rzgenie-toss_3_x86_64_ib-intel@19.0.0.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: toss_3_x86_64_ib # Compiler Spec: intel@19.0.0 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/toss_3_x86_64_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/intel/intel-19.0.0/bin/ifort" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_03_20_22_04_40/intel-19.0.0" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/toss_3_x86_64_ib/2020_04_28_18_37_10/intel-19.0.0" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0/bin/m set(MPI_Fortran_COMPILER "/usr/tce/packages/mvapich2/mvapich2-2.3-intel-19.0.0/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/bin/srun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/bin/srun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") @@ -64,7 +64,7 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_03_20_16_52_14/gcc-8.1.0" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/toss_3_x86_64_ib/2020_04_27_21_23_14/gcc-8.1.0" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/scripts/uberenv/spack_configs/config.yaml b/scripts/uberenv/spack_configs/config.yaml index 86f857d16c..be4403d0c8 100644 --- a/scripts/uberenv/spack_configs/config.yaml +++ b/scripts/uberenv/spack_configs/config.yaml @@ -53,7 +53,7 @@ config: # Cache directory for miscellaneous files, like the package index. # This can be purged with `spack purge --misc-cache` - misc_cache: ../.spack/misccache + misc_cache: .spack/misccache # If this is false, tools like curl that use SSL will not verify diff --git a/src/cmake/blt b/src/cmake/blt index f0ec653ac5..431b3ff98a 160000 --- a/src/cmake/blt +++ b/src/cmake/blt @@ -1 +1 @@ -Subproject commit f0ec653ac5323a652d39f6b37c5179fda5e6695e +Subproject commit 431b3ff98a4749f1b63279b15daa529a592ee732 From c9ad1a2b218d29b32b861ff619f3b44a4ad04107 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 28 Apr 2020 22:43:49 -0700 Subject: [PATCH 183/632] blueos host-configs --- ...l-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 8 ++++---- ...sel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake | 8 ++++---- .../rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake | 8 ++++---- .../rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake | 8 ++++---- .../rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake | 8 ++++---- ...anta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake | 10 ++++++---- ...zmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake | 8 ++++---- .../rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake | 8 ++++---- .../rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake | 8 ++++---- host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake | 10 ++++++---- 10 files changed, 44 insertions(+), 40 deletions(-) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 0174fe485b..8b1b710adf 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: clang@8.0.1_nvcc_xlf #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_04_28_18_56_37/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake index ed420c675b..08a8265e07 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: clang@upstream_xlf #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_04_28_18_56_37/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake index 6b6d930631..1cdbd773b0 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: gcc@7.3.1 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_04_28_18_56_37/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake index 0023a7a745..c960826dbb 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: xl@coral #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_04_28_18_56_37/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake index ba50c54b83..6cf5afc9f6 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib_p9 # Compiler Spec: xl@nvcc #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_03_25_18_01_31/xl-nvcc" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/xl-nvcc" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_02_13_10_02_22/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib_p9/2020_04_28_18_56_37/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake index c70a3df1dc..64c8fc2b74 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: clang@8.0.1_nvcc_xlf #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-8.0.1/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_28_18_56_31/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") @@ -106,6 +106,8 @@ set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") +set(AXOM_ENABLE_ANNOTATIONS ON CACHE BOOL "") + set(AXOM_CUDA_ARCH "sm_60" CACHE PATH "") set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake index 44bca0f3f5..c98fe96247 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: clang@upstream_xlf #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_28_18_56_31/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake index 878ab6db52..d94fa44ad9 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: gcc@7.3.1 #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-gcc-7.3.1/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_28_18_56_31/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake index 8b84bfd3e5..f7ccb6d0f1 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: xl@coral #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-clang-upstream-2019.08.15/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_28_18_56_31/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake index 18bf79545c..11dc05c0a7 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake @@ -9,7 +9,7 @@ # SYS_TYPE: blueos_3_ppc64le_ib # Compiler Spec: xl@nvcc #------------------------------------------------------------------------------ -# CMake executable path: /usr/WS1/axom/devtools/blueos_3_ppc64le_ib/latest/cmake-3.9.6/bin/cmake +# CMake executable path: /usr/tce/packages/cmake/cmake-3.14.5/bin/cmake #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_02_19_22_50/xl-nvcc" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/xl-nvcc" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -55,7 +55,7 @@ set(MPI_CXX_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-releas set(MPI_Fortran_COMPILER "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpif90" CACHE PATH "") -set(MPIEXEC "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpirun" CACHE PATH "") +set(MPIEXEC_EXECUTABLE "/usr/tce/packages/spectrum-mpi/spectrum-mpi-rolling-release-xl-2019.08.20/bin/mpirun" CACHE PATH "") set(MPIEXEC_NUMPROC_FLAG "-np" CACHE PATH "") @@ -66,7 +66,7 @@ set(BLT_MPI_COMMAND_APPEND "mpibind" CACHE PATH "") #------------------------------------------------------------------------------ # Root directory for generated developer tools -set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_02_14_30_58/gcc-8.3.1" CACHE PATH "") +set(DEVTOOLS_ROOT "/usr/WS1/axom/devtools/blueos_3_ppc64le_ib/2020_04_28_18_56_31/gcc-8.3.1" CACHE PATH "") set(PYTHON_EXECUTABLE "${DEVTOOLS_ROOT}/python-3.7.4/bin/python" CACHE PATH "") @@ -110,6 +110,8 @@ set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "") +set(AXOM_ENABLE_ANNOTATIONS ON CACHE BOOL "") + set(AXOM_CUDA_ARCH "sm_60" CACHE PATH "") set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") From 5586cd5707072e67d7aba4a65a915e62642e173a Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 29 Apr 2020 14:05:50 -0700 Subject: [PATCH 184/632] Update blt --- src/cmake/blt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmake/blt b/src/cmake/blt index 431b3ff98a..0ae6bd21f1 160000 --- a/src/cmake/blt +++ b/src/cmake/blt @@ -1 +1 @@ -Subproject commit 431b3ff98a4749f1b63279b15daa529a592ee732 +Subproject commit 0ae6bd21f1ef6eccdf7066bbea09cc78c3c74508 From 1f27372a4c0c305025c317a75a3df410c1be1c53 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 29 Apr 2020 18:03:55 -0700 Subject: [PATCH 185/632] Add arch to raja and umpire, fix cuda path in axom --- scripts/uberenv/packages/axom/package.py | 9 +++++++-- scripts/uberenv/packages/raja/package.py | 20 ++++++++++++++++---- scripts/uberenv/packages/umpire/package.py | 16 ++++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index 109dd12a54..fde1ceb57d 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -393,8 +393,13 @@ def hostconfig(self, spec, prefix): cfg.write("#------------------{}\n\n".format("-"*60)) cfg.write(cmake_cache_option("ENABLE_CUDA", True)) - cfg.write(cmake_cache_entry("CUDA_TOOLKIT_ROOT_DIR", "/usr/tce/packages/cuda/cuda-10.1.168")) - cfg.write(cmake_cache_entry("CMAKE_CUDA_COMPILER", "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc")) + + cudatoolkitdir = spec['cuda'].prefix + cfg.write(cmake_cache_entry("CUDA_TOOLKIT_ROOT_DIR", + cudatoolkitdir)) + cudacompiler = "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" + cfg.write(cmake_cache_entry("CMAKE_CUDA_COMPILER", + cudacompiler)) cfg.write(cmake_cache_option("CUDA_SEPARABLE_COMPILATION", True)) diff --git a/scripts/uberenv/packages/raja/package.py b/scripts/uberenv/packages/raja/package.py index bc4ef4886d..c8cf2e715e 100644 --- a/scripts/uberenv/packages/raja/package.py +++ b/scripts/uberenv/packages/raja/package.py @@ -35,23 +35,35 @@ class Raja(CMakePackage): depends_on('cmake@3.8:', type='build') depends_on('cmake@3.9:', when='+cuda', type='build') + def _get_sys_type(self, spec): + sys_type = spec.architecture + # if on llnl systems, we can use the SYS_TYPE + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + def cmake_args(self): spec = self.spec + sys_type = self._get_sys_type(spec) + on_blueos = 'blueos' in sys_type + on_blueos_p9 = on_blueos and 'p9' in sys_type options = [] options.append('-DENABLE_OPENMP={0}'.format( 'On' if '+openmp' in spec else 'Off')) if '+cuda' in spec: + if on_blueos_p9: + options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_70']) + elif on_blueos: + options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_60']) + options.extend([ '-DENABLE_CUDA=On', '-DCUDA_TOOLKIT_ROOT_DIR=%s' % (spec['cuda'].prefix)]) # Work around spack adding -march=ppc64le to SPACK_TARGET_ARGS which is used by the spack compiler wrapper - sys_type = "" - if "SYS_TYPE" in env: - sys_type = env["SYS_TYPE"] - if "blueos" in sys_type: + if on_blueos: options.extend(['-DENABLE_TESTS=OFF']) return options diff --git a/scripts/uberenv/packages/umpire/package.py b/scripts/uberenv/packages/umpire/package.py index b31e8e9692..baefa9734e 100644 --- a/scripts/uberenv/packages/umpire/package.py +++ b/scripts/uberenv/packages/umpire/package.py @@ -45,12 +45,28 @@ class Umpire(CMakePackage): conflicts('+numa', when='@:0.3.2') + def _get_sys_type(self, spec): + sys_type = spec.architecture + # if on llnl systems, we can use the SYS_TYPE + if "SYS_TYPE" in env: + sys_type = env["SYS_TYPE"] + return sys_type + def cmake_args(self): spec = self.spec options = [] if '+cuda' in spec: + sys_type = self._get_sys_type(spec) + on_blueos = 'blueos' in sys_type + on_blueos_p9 = on_blueos and 'p9' in sys_type + + if on_blueos_p9: + options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_70']) + elif on_blueos: + options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_60']) + options.extend([ '-DENABLE_CUDA=On', '-DENABLE_DEVICE_CONST=On', From d7fd1b7ebfe6a7b961d48ae8ebc4a368ee3237ff Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 29 Apr 2020 18:06:36 -0700 Subject: [PATCH 186/632] small formatting fix --- scripts/uberenv/packages/raja/package.py | 1 + scripts/uberenv/packages/umpire/package.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/uberenv/packages/raja/package.py b/scripts/uberenv/packages/raja/package.py index c8cf2e715e..93a0d818f3 100644 --- a/scripts/uberenv/packages/raja/package.py +++ b/scripts/uberenv/packages/raja/package.py @@ -44,6 +44,7 @@ def _get_sys_type(self, spec): def cmake_args(self): spec = self.spec + sys_type = self._get_sys_type(spec) on_blueos = 'blueos' in sys_type on_blueos_p9 = on_blueos and 'p9' in sys_type diff --git a/scripts/uberenv/packages/umpire/package.py b/scripts/uberenv/packages/umpire/package.py index baefa9734e..4fec9717e9 100644 --- a/scripts/uberenv/packages/umpire/package.py +++ b/scripts/uberenv/packages/umpire/package.py @@ -55,13 +55,13 @@ def _get_sys_type(self, spec): def cmake_args(self): spec = self.spec + sys_type = self._get_sys_type(spec) + on_blueos = 'blueos' in sys_type + on_blueos_p9 = on_blueos and 'p9' in sys_type + options = [] if '+cuda' in spec: - sys_type = self._get_sys_type(spec) - on_blueos = 'blueos' in sys_type - on_blueos_p9 = on_blueos and 'p9' in sys_type - if on_blueos_p9: options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_70']) elif on_blueos: From f97a67a096792dc5fb24bc955662792be88705b7 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 29 Apr 2020 18:24:13 -0700 Subject: [PATCH 187/632] Use RAJA's CUDA_ARCH logic --- scripts/uberenv/packages/raja/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/uberenv/packages/raja/package.py b/scripts/uberenv/packages/raja/package.py index 93a0d818f3..077defecb1 100644 --- a/scripts/uberenv/packages/raja/package.py +++ b/scripts/uberenv/packages/raja/package.py @@ -55,9 +55,9 @@ def cmake_args(self): if '+cuda' in spec: if on_blueos_p9: - options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_70']) + options.extend(['-DCUDA_ARCH=sm_70']) elif on_blueos: - options.extend(['-DCMAKE_CUDA_FLAGS:STRING=-arch sm_60']) + options.extend(['-DCUDA_ARCH=sm_60']) options.extend([ '-DENABLE_CUDA=On', From baaa66a079e3ac06959e76547b7a4a865fecc8c7 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 29 Apr 2020 20:38:49 -0700 Subject: [PATCH 188/632] Add manta and ansel host-configs --- .../rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 4 ++-- .../rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake | 2 +- host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake | 2 +- host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake | 2 +- host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake | 4 ++-- .../rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake | 4 ++-- .../rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake | 2 +- host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake | 2 +- host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake | 2 +- host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake | 4 ++-- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 8b1b710adf..2341ff1b69 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_29_19_35_53/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -100,7 +100,7 @@ set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CAC set(ENABLE_CUDA ON CACHE BOOL "") -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake index 08a8265e07..f7e94ae6f1 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@upstream_xlf.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_29_19_35_53/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake index 1cdbd773b0..e04ebab51d 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-gcc@7.3.1.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_29_19_35_53/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake index c960826dbb..cc3d20c756 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@coral.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_29_19_35_53/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake index 6cf5afc9f6..3af208f84d 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_28_20_17_54/xl-nvcc" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib_p9/2020_04_29_19_35_53/xl-nvcc" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -104,7 +104,7 @@ set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.08.20/lib" CAC set(ENABLE_CUDA ON CACHE BOOL "") -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake index 64c8fc2b74..b748c9ddc4 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@8.0.1_nvcc_xlf.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/clang-8.0.1_nvcc_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_29_19_36_16/clang-8.0.1_nvcc_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -100,7 +100,7 @@ set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.12.23/lib" CAC set(ENABLE_CUDA ON CACHE BOOL "") -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake index c98fe96247..2d6a9ade80 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-clang@upstream_xlf.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/clang-upstream_xlf" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_29_19_36_16/clang-upstream_xlf" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake index d94fa44ad9..b95db2fdc6 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-gcc@7.3.1.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/gcc/gcc-7.3.1/bin/gfortran" CACHE #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/gcc-7.3.1" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_29_19_36_16/gcc-7.3.1" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake index f7ccb6d0f1..aeb74ab36e 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@coral.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.12.23/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/xl-coral" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_29_19_36_16/xl-coral" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") diff --git a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake index 11dc05c0a7..51d4d3ed66 100644 --- a/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake +++ b/host-configs/rzmanta-blueos_3_ppc64le_ib-xl@nvcc.cmake @@ -29,7 +29,7 @@ set(CMAKE_Fortran_COMPILER "/usr/tce/packages/xl/xl-2019.08.20/bin/xlf2003" CACH #------------------------------------------------------------------------------ # Root directory for generated TPLs -set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_28_19_43_01/xl-nvcc" CACHE PATH "") +set(TPL_ROOT "/usr/WS1/axom/libs/blueos_3_ppc64le_ib/2020_04_29_19_36_16/xl-nvcc" CACHE PATH "") set(CONDUIT_DIR "${TPL_ROOT}/conduit-0.5.1" CACHE PATH "") @@ -104,7 +104,7 @@ set(BLT_EXE_LINKER_FLAGS "-Wl,-rpath,/usr/tce/packages/xl/xl-2019.08.20/lib" CAC set(ENABLE_CUDA ON CACHE BOOL "") -set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.168" CACHE PATH "") +set(CUDA_TOOLKIT_ROOT_DIR "/usr/tce/packages/cuda/cuda-10.1.243" CACHE PATH "") set(CMAKE_CUDA_COMPILER "${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc" CACHE PATH "") From 5535c9e99574ec2f1b522eecea4d448b4c0444de Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Thu, 30 Apr 2020 11:16:02 -0700 Subject: [PATCH 189/632] Add boolean query methods for collection types --- src/axom/sidre/core/Group.hpp | 15 +++++++++++++++ src/axom/sidre/tests/sidre_group.cpp | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index de43e710fb..4e00aa16dd 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -1156,6 +1156,21 @@ class Group */ bool isEquivalentTo(const Group* other, bool checkName = true) const; + /*! + * \brief Return true if this Group holds items in map format. + */ + bool usingMap() + { + return !m_is_list; + } + + /*! + * \brief Return true if this Group holds items in list format. + */ + bool usingList() + { + return m_is_list; + } //@{ /*! diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index a30ca7aa51..fc41b371c5 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -509,6 +509,7 @@ TEST(sidre_group, child_lists) Group* not_list = root->createGroup("not_list", false); Group* dummy_group = not_list->createUnnamedGroup(); View* dummy_view = not_list->createView(""); + EXPECT_TRUE(not_list->usingMap()); EXPECT_EQ(not_list->getNumGroups(), 0); EXPECT_EQ(not_list->getNumViews(), 0); EXPECT_TRUE(dummy_group == nullptr); @@ -528,6 +529,7 @@ TEST(sidre_group, child_lists) scalars.insert(val); } + EXPECT_TRUE(parent->usingList()); EXPECT_TRUE(scalars.size() == 10); EXPECT_TRUE(parent->hasGroup(6)); EXPECT_FALSE(parent->hasGroup(20)); From 9c304b60ef9f6d2ef5088d0fe162d3d497241910 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Thu, 30 Apr 2020 11:27:28 -0700 Subject: [PATCH 190/632] Fix some typos --- src/axom/sidre/core/Group.cpp | 4 ++-- src/axom/sidre/core/Group.hpp | 2 +- src/axom/sidre/core/ItemCollection.hpp | 2 +- src/axom/sidre/core/ListCollection.hpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index 4d1eb2dbb7..809a2890fd 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -1727,8 +1727,8 @@ Group::Group(const std::string& name, , m_parent(nullptr) , m_datastore(datastore) , m_is_list(is_list) - , m_view_coll(0) - , m_group_coll(0) + , m_view_coll(nullptr) + , m_group_coll(nullptr) #ifdef AXOM_USE_UMPIRE , m_default_allocator_id(axom::getDefaultAllocatorID()) #endif diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index 4e00aa16dd..8a1da056f5 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -1482,7 +1482,7 @@ class Group * into the hierarchy. The root group is an exception to this rule. * * The boolean argument is_list, if true, allows the Group to hold its - * childe items in list format, which allows those items to have empty + * child items in list format, which allows those items to have empty * strings for names. If not in list format, all items must have unique * non-empty strings for names. */ diff --git a/src/axom/sidre/core/ItemCollection.hpp b/src/axom/sidre/core/ItemCollection.hpp index 31fd3cf0dd..ead571fd78 100644 --- a/src/axom/sidre/core/ItemCollection.hpp +++ b/src/axom/sidre/core/ItemCollection.hpp @@ -17,7 +17,7 @@ * The primary intent is to decouple the implementation of the * collections from the Group class which owns collections of * View and child Group objects. They may have other uses, - * so they are not dependent on the Group class. THis class is + * so they are not dependent on the Group class. This class is * templated on the item type so that derived classes can be used * to hold either View or Group object pointers without * having to code a separate class for each. diff --git a/src/axom/sidre/core/ListCollection.hpp b/src/axom/sidre/core/ListCollection.hpp index a83b37b9ab..df7cff02ac 100644 --- a/src/axom/sidre/core/ListCollection.hpp +++ b/src/axom/sidre/core/ListCollection.hpp @@ -15,7 +15,7 @@ * is intended to hold items that may have no name. If they do * have names, those names are ignored. To satisfy the parent * class interface, methods to access items by name are provided - * but the return null or invalid return values. + * but they return null or invalid return values. * * This class is templated on the item type so that the same * class can be used to hold either View or Group object pointers From 496f047d6b1b73dd0cd618ef84f9239a9fafb9b2 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Thu, 30 Apr 2020 13:08:06 -0700 Subject: [PATCH 191/632] Fix boolean method names --- src/axom/sidre/core/Group.hpp | 4 ++-- src/axom/sidre/tests/sidre_group.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/axom/sidre/core/Group.hpp b/src/axom/sidre/core/Group.hpp index 8a1da056f5..6c3bcb7c8c 100644 --- a/src/axom/sidre/core/Group.hpp +++ b/src/axom/sidre/core/Group.hpp @@ -1159,7 +1159,7 @@ class Group /*! * \brief Return true if this Group holds items in map format. */ - bool usingMap() + bool isUsingMap() const { return !m_is_list; } @@ -1167,7 +1167,7 @@ class Group /*! * \brief Return true if this Group holds items in list format. */ - bool usingList() + bool isUsingList() const { return m_is_list; } diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index fc41b371c5..205f0b02e5 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -509,7 +509,7 @@ TEST(sidre_group, child_lists) Group* not_list = root->createGroup("not_list", false); Group* dummy_group = not_list->createUnnamedGroup(); View* dummy_view = not_list->createView(""); - EXPECT_TRUE(not_list->usingMap()); + EXPECT_TRUE(not_list->isUsingMap()); EXPECT_EQ(not_list->getNumGroups(), 0); EXPECT_EQ(not_list->getNumViews(), 0); EXPECT_TRUE(dummy_group == nullptr); @@ -529,7 +529,7 @@ TEST(sidre_group, child_lists) scalars.insert(val); } - EXPECT_TRUE(parent->usingList()); + EXPECT_TRUE(parent->isUsingList()); EXPECT_TRUE(scalars.size() == 10); EXPECT_TRUE(parent->hasGroup(6)); EXPECT_FALSE(parent->hasGroup(20)); From 93d4dc760eb0d85b878441719a029dc3ccb5521c Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 19 Apr 2020 18:20:44 -0700 Subject: [PATCH 192/632] Sets up and exports 'axom-config.cmake' to simplify importing axom into other packages --- src/cmake/AxomConfig.cmake | 46 +++++++++++++++++++++++ src/cmake/axom-config.cmake.in | 69 ++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 src/cmake/axom-config.cmake.in diff --git a/src/cmake/AxomConfig.cmake b/src/cmake/AxomConfig.cmake index cdb408bdf3..9685116fa1 100644 --- a/src/cmake/AxomConfig.cmake +++ b/src/cmake/AxomConfig.cmake @@ -76,3 +76,49 @@ configure_file( ) install(FILES ${CMAKE_BINARY_DIR}/include/axom/config.hpp DESTINATION include/axom) + +#------------------------------------------------------------------------------ +# Generate axom-config.cmake for importing Axom into other CMake packages +#------------------------------------------------------------------------------ + +# Set up some paths, preserve existing cache values (if present) +set(AXOM_INSTALL_INCLUDE_DIR "include" CACHE STRING "") +set(AXOM_INSTALL_CONFIG_DIR "lib" CACHE STRING "") +set(AXOM_INSTALL_LIB_DIR "lib" CACHE STRING "") +set(AXOM_INSTALL_BIN_DIR "bin" CACHE STRING "") +set(AXOM_INSTALL_CMAKE_MODULE_DIR "${AXOM_INSTALL_CONFIG_DIR}/cmake" CACHE STRING "") + +convert_to_native_escaped_file_path(${CMAKE_INSTALL_PREFIX} AXOM_INSTALL_PREFIX) +set(AXOM_INSTALL_PREFIX ${AXOM_INSTALL_PREFIX} CACHE STRING "" FORCE) + + +include(CMakePackageConfigHelpers) + +# Add version helper +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/axom-config-version.cmake + VERSION ${AXOM_VERSION_FULL} + COMPATIBILITY AnyNewerVersion +) + +# Set up cmake package config file +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/axom-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/axom-config.cmake + INSTALL_DESTINATION + ${AXOM_INSTALL_CONFIG_DIR} + PATH_VARS + AXOM_INSTALL_INCLUDE_DIR + AXOM_INSTALL_LIB_DIR + AXOM_INSTALL_BIN_DIR + AXOM_INSTALL_CMAKE_MODULE_DIR + ) + +# Install config files +install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/axom-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/axom-config-version.cmake + DESTINATION + ${AXOM_INSTALL_CMAKE_MODULE_DIR} +) diff --git a/src/cmake/axom-config.cmake.in b/src/cmake/axom-config.cmake.in new file mode 100644 index 0000000000..7e812f7bbb --- /dev/null +++ b/src/cmake/axom-config.cmake.in @@ -0,0 +1,69 @@ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ + +cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + +@PACKAGE_INIT@ + +if(NOT AXOM_FOUND) + + #---------------------------------------------------------------------------- + # Set version and paths + #---------------------------------------------------------------------------- + + set(AXOM_VERSION "@AXOM_VERSION_FULL@") + + set(AXOM_INSTALL_PREFIX "@AXOM_INSTALL_PREFIX@") + set(AXOM_INCLUDE_DIRS "${AXOM_INSTALL_PREFIX}/include/axom") + + #---------------------------------------------------------------------------- + # User configuration options and features + #---------------------------------------------------------------------------- + + set(AXOM_ENABLE_FORTRAN "@ENABLE_FORTRAN@") + + set(AXOM_ENABLE_LUMBERJACK "@AXOM_ENABLE_LUMBERJACK@") + set(AXOM_ENABLE_SLIC "@AXOM_ENABLE_SLIC@") + set(AXOM_ENABLE_SLAM "@AXOM_ENABLE_SLAM@") + set(AXOM_ENABLE_MINT "@AXOM_ENABLE_MINT@") + set(AXOM_ENABLE_PRIMAL "@AXOM_ENABLE_PRIMAL@") + set(AXOM_ENABLE_SPIN "@AXOM_ENABLE_SPIN@") + set(AXOM_ENABLE_SIDRE "@AXOM_ENABLE_SIDRE@") + set(AXOM_ENABLE_QUEST "@AXOM_ENABLE_QUEST@") + + set(AXOM_USE_CLI11 "@AXOM_USE_CLI11@") + set(AXOM_USE_CONDUIT "@AXOM_USE_CONDUIT@") + set(AXOM_USE_CUDA "@AXOM_USE_CUDA@") + set(AXOM_USE_FMT "@AXOM_USE_FMT@") + set(AXOM_USE_HDF5 "@AXOM_USE_HDF5@") + set(AXOM_USE_MFEM "@AXOM_USE_MFEM@") + set(AXOM_USE_MPI "@AXOM_USE_MPI@") + set(AXOM_USE_OPENMP "@AXOM_USE_OPENMP@") + set(AXOM_USE_RAJA "@AXOM_USE_RAJA@") + set(AXOM_USE_SCR "@AXOM_USE_SCR@") + set(AXOM_USE_SPARSEHASH "@AXOM_USE_SPARSEHASH@") + set(AXOM_USE_UMPIRE "@AXOM_USE_UMPIRE@") + + set(AXOM_CONDUIT_DIR "@CONDUIT_DIR@") + set(AXOM_HDF5_DIR "@HDF5_DIR@") + set(AXOM_MFEM_DIR "@MFEM_DIR@") + set(AXOM_RAJA_DIR "@RAJA_DIR@") + set(AXOM_SCR_DIR "@SCR_DIR@") + set(AXOM_UMPIRE_DIR "@UMPIRE_DIR@") + + set(AXOM_DATA_DIR "@AXOM_DATA_DIR@") + + #---------------------------------------------------------------------------- + # Include targets exported by cmake + #---------------------------------------------------------------------------- + get_filename_component(AXOM_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + include(${AXOM_CMAKE_CONFIG_DIR}/axom-targets.cmake) + + + set(AXOM_FOUND TRUE) + +endif() + From a0b4ceddfb266230eabb56028362f2fa2d1b905a Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Sun, 19 Apr 2020 18:22:31 -0700 Subject: [PATCH 193/632] Axom's built-in TPLs are now exported into the generated 'axom-targets.cmake' The current built-in TPLs are: cli11, fmt and sparsehash. Previously, they were exported into their own generated files '-targets.cmake' --- src/thirdparty/CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/thirdparty/CMakeLists.txt b/src/thirdparty/CMakeLists.txt index 75cee87d8c..6fccefd65b 100644 --- a/src/thirdparty/CMakeLists.txt +++ b/src/thirdparty/CMakeLists.txt @@ -19,11 +19,11 @@ target_include_directories(cli11 SYSTEM INTERFACE $) install(TARGETS cli11 - EXPORT cli11-targets + EXPORT axom-targets INCLUDES DESTINATION include) install(DIRECTORY ${PROJECT_SOURCE_DIR}/thirdparty/CLI11 DESTINATION include ) -install(EXPORT cli11-targets DESTINATION lib/cmake) +install(EXPORT axom-targets DESTINATION lib/cmake) set(CLI11_FOUND TRUE CACHE INTERNAL "") mark_as_advanced(CLI11_FOUND) @@ -66,12 +66,12 @@ set(FMT_EXCEPTIONS FALSE PARENT_SCOPE) set(FMT_HEADER_ONLY TRUE PARENT_SCOPE) install(TARGETS fmt - EXPORT fmt-targets + EXPORT axom-targets INCLUDES DESTINATION include) install(DIRECTORY ${PROJECT_SOURCE_DIR}/thirdparty/fmt DESTINATION include ) -install(EXPORT fmt-targets DESTINATION lib/cmake) +install(EXPORT axom-targets DESTINATION lib/cmake) set(FMT_FOUND TRUE CACHE INTERNAL "") mark_as_advanced(FMT_FOUND) @@ -153,13 +153,13 @@ if (AXOM_ENABLE_SPARSEHASH) endif() install(TARGETS sparsehash - EXPORT sparsehash-targets + EXPORT axom-targets INCLUDES DESTINATION include) install(DIRECTORY ${PROJECT_SOURCE_DIR}/thirdparty/sparsehash DESTINATION include) - install(EXPORT sparsehash-targets DESTINATION lib/cmake) + install(EXPORT axom-targets DESTINATION lib/cmake) else() message(STATUS "Could not configure sparsehash") From b644fbaa57a6bc96374b618058380ed35a63c0bb Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Mon, 20 Apr 2020 13:38:01 -0700 Subject: [PATCH 194/632] Updates examples that use installed axom Adds a host-config file to 'using-with-cmake' example to use the same compiler and TPLs that were used to build axom. Also adds exported fmt library to this example. Adds a new 'using-with-blt' example that shows how to use an installed axom with a blt-based build system. --- src/examples/CMakeLists.txt | 53 ++++++++-- src/examples/using-with-blt/CMakeLists.txt | 99 +++++++++++++++++++ src/examples/using-with-blt/example.cpp | 29 ++++++ .../using-with-blt/host-config.cmake.in | 28 ++++++ src/examples/using-with-cmake/CMakeLists.txt | 62 +++++++++--- src/examples/using-with-cmake/FindAxom.cmake | 47 --------- src/examples/using-with-cmake/example.cpp | 12 ++- .../using-with-cmake/host-config.cmake.in | 22 +++++ 8 files changed, 284 insertions(+), 68 deletions(-) create mode 100644 src/examples/using-with-blt/CMakeLists.txt create mode 100644 src/examples/using-with-blt/example.cpp create mode 100644 src/examples/using-with-blt/host-config.cmake.in delete mode 100644 src/examples/using-with-cmake/FindAxom.cmake create mode 100644 src/examples/using-with-cmake/host-config.cmake.in diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 0f2367a8fe..265aa536bf 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -3,14 +3,51 @@ # # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ -# Example for using Axom from a CMake project +# Examples for using Axom within other build systems: Make, CMake, BLT #------------------------------------------------------------------------------ +# Note: Installed to 'examples/axom' to avoid name conflicts with other libs. +# This will crop up if we use spack to install axom as a python extension. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# install 'using-with-make' example (no configuration, so just copy files) +#------------------------------------------------------------------------------ +install( + DIRECTORY + using-with-make + DESTINATION + examples/axom +) + +#------------------------------------------------------------------------------ +# configure and install 'using-with-cmake' example +#------------------------------------------------------------------------------ +configure_file( + using-with-cmake/host-config.cmake.in + ${CMAKE_BINARY_DIR}/examples/using-with-cmake/host-config.cmake) + +install( + FILES + using-with-cmake/CMakeLists.txt + using-with-cmake/example.cpp + ${CMAKE_BINARY_DIR}/examples/using-with-cmake/host-config.cmake + DESTINATION + examples/axom/using-with-cmake +) + +#------------------------------------------------------------------------------ +# configure and install 'using-with-blt' example +#------------------------------------------------------------------------------ +configure_file( + using-with-blt/host-config.cmake.in + ${CMAKE_BINARY_DIR}/examples/using-with-blt/host-config.cmake) -# install using examples -install(DIRECTORY using-with-cmake using-with-make - DESTINATION examples/axom) -# note: this is installed to examples/axom to avoid name conflicts with other -# libs (this will crop up if we use spack to install axom as a python -# extension) - +install( + FILES + using-with-blt/CMakeLists.txt + using-with-blt/example.cpp + ${CMAKE_BINARY_DIR}/examples/using-with-blt/host-config.cmake + DESTINATION + examples/axom/using-with-blt +) diff --git a/src/examples/using-with-blt/CMakeLists.txt b/src/examples/using-with-blt/CMakeLists.txt new file mode 100644 index 0000000000..f35593e5f4 --- /dev/null +++ b/src/examples/using-with-blt/CMakeLists.txt @@ -0,0 +1,99 @@ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# Example that shows how to use an installed instance of Axom +# in a BLT-based build system. +# +# Required configuration variables are stored in a CMake cache file +# called 'host-config.cmake' in the same directory +# +# This file defines paths to BLT, axom and optionally conduit. +# It also contains information about the compiler used to build axom. +#------------------------------------------------------------------------------ +# +# To build: +# mkdir build +# cd build +# cmake -C ../host-config.cmake .. +# make +# ./bin/example +# +#------------------------------------------------------------------------------ + +cmake_minimum_required(VERSION 3.8) + +project(using_with_blt) + +# Define some config options +option(EXAMPLE_VERBOSE_OUTPUT "Verbose output about imported targets" OFF) + +# Simple function to check validity of a path variable, e.g. `FOO_DIR` +# and a required file under it of the form `${FOO_DIR}/some/subpath/file` +function(check_var_and_path) + set(_variable ${ARGV0}) + set(_file ${ARGV1}) + + if(NOT DEFINED ${_variable}) + message(FATAL_ERROR "Required variable '${_variable}' not provided." + " Please supply '${_variable}' to configuration." ) + endif() + + if(NOT EXISTS ${_file}) + message (FATAL_ERROR "Path '${_variable}' does not contain required" + " file '${_file}'.") + endif() +endfunction() + + + +#------------------------------------------------------------------------------ +# Set up BLT with validity checks +#------------------------------------------------------------------------------ + +# Check that path to BLT is provided and valid +check_var_and_path(BLT_SOURCE_DIR ${BLT_SOURCE_DIR}/SetupBLT.cmake) + +include(${BLT_SOURCE_DIR}/SetupBLT.cmake) + + +#------------------------------------------------------------------------------ +# Check for AXOM_DIR and use CMake's find_package to import axom's targets +#------------------------------------------------------------------------------ +check_var_and_path(AXOM_DIR ${AXOM_DIR}/lib/cmake/axom-config.cmake) + +find_package(axom REQUIRED + NO_DEFAULT_PATH + PATHS ${AXOM_DIR}/lib/cmake) + +#------------------------------------------------------------------------------ +# Check for CONDUIT_DIR -- required if Axom was built with Conduit +# Note: 'AXOM_USE_CONDUIT' variable is provided by Axom's config file +#------------------------------------------------------------------------------ +if(AXOM_USE_CONDUIT) + check_var_and_path(CONDUIT_DIR ${CONDUIT_DIR}/lib/cmake/ConduitConfig.cmake) + + find_package(Conduit REQUIRED + NO_DEFAULT_PATH + PATHS ${CONDUIT_DIR}/lib/cmake) +endif() + +#------------------------------------------------------------------------------ +# Set up example target that depends on axom +#------------------------------------------------------------------------------ + +blt_add_executable(NAME example + SOURCES example.cpp + DEPENDS_ON axom fmt) + + +#------------------------------------------------------------------------------ +# Optionally, print out information about imported targets +#------------------------------------------------------------------------------ +if(EXAMPLE_VERBOSE_OUTPUT) + foreach(_target axom cli11 fmt sparsehash conduit::conduit example) + blt_print_target_properties(TARGET ${_target}) + endforeach() +endif() + diff --git a/src/examples/using-with-blt/example.cpp b/src/examples/using-with-blt/example.cpp new file mode 100644 index 0000000000..1ddf402448 --- /dev/null +++ b/src/examples/using-with-blt/example.cpp @@ -0,0 +1,29 @@ +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +// other Axom Project Developers. See the top-level COPYRIGHT file for details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + + +//----------------------------------------------------------------------------- +/// +/// file: example.cpp +/// +//----------------------------------------------------------------------------- + +#include "axom/core/utilities/About.hpp" +#include "fmt/fmt.hpp" + +#include + +int main(int argc, char **argv) +{ + // Using fmt library exported by axom + std::cout << fmt::format( + "Example of using and installed version of axom v{}.{}.{}-{}", + AXOM_VERSION_MAJOR, AXOM_VERSION_MINOR, + AXOM_VERSION_PATCH, AXOM_VERSION_EXTRA) << std::endl << std::endl; + + // Uses installed axom library + axom::about(); +} + diff --git a/src/examples/using-with-blt/host-config.cmake.in b/src/examples/using-with-blt/host-config.cmake.in new file mode 100644 index 0000000000..ee407fbf8f --- /dev/null +++ b/src/examples/using-with-blt/host-config.cmake.in @@ -0,0 +1,28 @@ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# Host-config for 'using-with-blt' example. +# Defines configuration variables from Axom's build. +# +# For simplicity, we ignore extra details, like OpenMP and MPI +#------------------------------------------------------------------------------ + +# Config related to compiler +set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE PATH "") +set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "") +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE CACHE BOOL "") + +# Config related to BLT +set(BLT_SOURCE_DIR "@BLT_SOURCE_DIR@" CACHE PATH "") +set(BLT_CXX_STD c++11 CACHE STRING "") +set(ENABLE_DOCS FALSE CACHE BOOL "") +set(ENABLE_EXAMPLES FALSE CACHE BOOL "") +set(ENABLE_TESTS FALSE CACHE BOOL "") + +# Paths to Axom and other TPLs +set(AXOM_DIR "@CMAKE_INSTALL_PREFIX@" CACHE PATH "") +set(CONDUIT_DIR "@CONDUIT_DIR@" CACHE PATH "") + diff --git a/src/examples/using-with-cmake/CMakeLists.txt b/src/examples/using-with-cmake/CMakeLists.txt index 595863c5f6..027d4a7ed2 100644 --- a/src/examples/using-with-cmake/CMakeLists.txt +++ b/src/examples/using-with-cmake/CMakeLists.txt @@ -3,32 +3,71 @@ # # SPDX-License-Identifier: (BSD-3-Clause) #------------------------------------------------------------------------------ -# Example that shows how to use an installed instance of Axom in another -# CMake-based build system. +# Example that shows how to use an installed instance of Axom +# in a CMake-based build system. +# +# Required configuration variables are stored in a CMake cache file +# called 'host-config.cmake' in the same directory +# +# This file defines paths to axom and optionally conduit. +# It also contains information about the compiler used to build axom. #------------------------------------------------------------------------------ # # To build: # mkdir build # cd build -# cmake -DAXOM_DIR={axom install path} ../ +# cmake -C ../host-config.cmake .. # make # ./example # -# Note: -# If you use features that leverage external third party libraries -# (ex: Conduit features), the imported CMake targets will handle linking -# these libraries, however you may need to add additional include -# include directories to use their headers. -# #------------------------------------------------------------------------------ cmake_minimum_required(VERSION 3.8) project(using_with_cmake) -include("FindAxom.cmake") +# Simple function to check validity of a path variable, e.g. `FOO_DIR` +# and a required file under it of the form `${FOO_DIR}/some/subpath/file` +function(check_var_and_path) + set(_variable ${ARGV0}) + set(_file ${ARGV1}) + + if(NOT DEFINED ${_variable}) + message(FATAL_ERROR "Required variable '${_variable}' not provided." + " Please supply '${_variable}' to configuration." ) + endif() + + if(NOT EXISTS ${_file}) + message (FATAL_ERROR "Path '${_variable}' does not contain required" + " file '${_file}'.") + endif() +endfunction() + + +#------------------------------------------------------------------------------ +# Check for AXOM_DIR and use CMake's find_package to import axom's targets +#------------------------------------------------------------------------------ +check_var_and_path(AXOM_DIR ${AXOM_DIR}/lib/cmake/axom-config.cmake) -# create our example +find_package(axom REQUIRED + NO_DEFAULT_PATH + PATHS ${AXOM_DIR}/lib/cmake) + +#------------------------------------------------------------------------------ +# Check for CONDUIT_DIR -- required if Axom was built with Conduit +# Note: 'AXOM_USE_CONDUIT' variable is provided by Axom's config file +#------------------------------------------------------------------------------ +if(AXOM_USE_CONDUIT) + check_var_and_path(CONDUIT_DIR ${CONDUIT_DIR}/lib/cmake/ConduitConfig.cmake) + + find_package(Conduit REQUIRED + NO_DEFAULT_PATH + PATHS ${CONDUIT_DIR}/lib/cmake) +endif() + +#------------------------------------------------------------------------------ +# Set up example target that depends on axom +#------------------------------------------------------------------------------ add_executable(example example.cpp) # setup the axom include path @@ -36,4 +75,5 @@ target_include_directories(example PRIVATE ${AXOM_INCLUDE_DIRS}) # link to axom targets target_link_libraries(example axom) +target_link_libraries(example fmt) diff --git a/src/examples/using-with-cmake/FindAxom.cmake b/src/examples/using-with-cmake/FindAxom.cmake deleted file mode 100644 index 5bb0c66b5b..0000000000 --- a/src/examples/using-with-cmake/FindAxom.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and -# other Axom Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (BSD-3-Clause) -#------------------------------------------------------------------------------ -# Setup Axom -#------------------------------------------------------------------------------ -# Expects AXOM_DIR to point to an Axom installation. -# -# This file defines the following CMake variables: -# AXOM_FOUND - If Axom was found -# AXOM_INCLUDE_DIRS - The Axom include directories -# AXOM_LIBRARIES - The Axom libraries -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Check for AXOM_DIR -#------------------------------------------------------------------------------ -if(NOT AXOM_DIR) - MESSAGE(FATAL_ERROR "Could not find Axom. Axom requires explicit AXOM_DIR.") -endif() - -set(AXOM_INCLUDE_DIRS ${AXOM_DIR}/include) - -# NOTE: fmt, CLI11 and sparsehash are useful open-source projects that Axom -# uses internally and we export for other codes use as well -set(AXOM_LIBRARIES sparsehash cli11 fmt axom ) - -foreach(_library ${AXOM_LIBRARIES}) - - set(_target_file ${AXOM_DIR}/lib/cmake/${_library}-targets.cmake) - - if(NOT EXISTS ${_target_file}) - MESSAGE(FATAL_ERROR "Could not find Axom CMake exported target file (${_target_file})") - endif() - - include(${_target_file}) - -endforeach() - -#------------------------------------------------------------------------------ -# Sets AXOM_FOUND if AXOM_INCLUDE_DIRS and AXOM_LIBRARIES are not empty -#------------------------------------------------------------------------------ -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(AXOM DEFAULT_MSG - AXOM_INCLUDE_DIRS - AXOM_LIBRARIES ) diff --git a/src/examples/using-with-cmake/example.cpp b/src/examples/using-with-cmake/example.cpp index 493ed0ab88..1ddf402448 100644 --- a/src/examples/using-with-cmake/example.cpp +++ b/src/examples/using-with-cmake/example.cpp @@ -10,12 +10,20 @@ /// //----------------------------------------------------------------------------- -#include - #include "axom/core/utilities/About.hpp" +#include "fmt/fmt.hpp" + +#include int main(int argc, char **argv) { + // Using fmt library exported by axom + std::cout << fmt::format( + "Example of using and installed version of axom v{}.{}.{}-{}", + AXOM_VERSION_MAJOR, AXOM_VERSION_MINOR, + AXOM_VERSION_PATCH, AXOM_VERSION_EXTRA) << std::endl << std::endl; + + // Uses installed axom library axom::about(); } diff --git a/src/examples/using-with-cmake/host-config.cmake.in b/src/examples/using-with-cmake/host-config.cmake.in new file mode 100644 index 0000000000..44940fc4d1 --- /dev/null +++ b/src/examples/using-with-cmake/host-config.cmake.in @@ -0,0 +1,22 @@ +# Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and +# other Axom Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (BSD-3-Clause) +#------------------------------------------------------------------------------ +# Host-config for 'using-with-cmake' example. +# Defines configuration variables from Axom's build. +# +# For simplicity, we ignore extra details, like OpenMP and MPI +#------------------------------------------------------------------------------ + +# Config related to compiler +set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" CACHE PATH "") +set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" CACHE PATH "") +set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "") +set(CMAKE_CXX_STANDARD 11 CACHE STRING "") +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE CACHE BOOL "") + +# Paths to Axom and other TPLs +set(AXOM_DIR "@CMAKE_INSTALL_PREFIX@" CACHE PATH "") +set(CONDUIT_DIR "@CONDUIT_DIR@" CACHE PATH "") + From 3e64eebe840374e88f5ca55ec1edf11e02560dff Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Mon, 20 Apr 2020 13:45:13 -0700 Subject: [PATCH 195/632] Updates 'zero-to-axom' guide in user docs Reflects changes to using an installed axom from CMake and adds a section for the new BLT-based example. --- src/docs/sphinx/quickstart_guide/zero_to_axom.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/docs/sphinx/quickstart_guide/zero_to_axom.rst b/src/docs/sphinx/quickstart_guide/zero_to_axom.rst index 64c5e798ce..764c271372 100644 --- a/src/docs/sphinx/quickstart_guide/zero_to_axom.rst +++ b/src/docs/sphinx/quickstart_guide/zero_to_axom.rst @@ -28,7 +28,7 @@ Using Axom in Your Project -------------------------- The install includes examples that demonstrate how to use Axom -in a CMake-based and Makefile-based build systems. +in CMake-based, BLT-based and Makefile-based build systems. CMake-based build system example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -36,10 +36,20 @@ CMake-based build system example .. literalinclude:: ../../../examples/using-with-cmake/CMakeLists.txt :language: cmake - :lines: 26-39 + :lines: 47-78 See: ``examples/axom/using-with-cmake`` +BLT-based build system example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +.. literalinclude:: ../../../examples/using-with-blt/CMakeLists.txt + :language: cmake + :lines: 51-88 + +See: ``examples/axom/using-with-blt`` + Makefile-based build system example ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 0966667117188d6c98f69bcacc5d18daeaa4605a Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Mon, 20 Apr 2020 13:50:40 -0700 Subject: [PATCH 196/632] Updates RELEASE-NOTES --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f42346f508..f2e9ab7650 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -33,6 +33,8 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ - Added initial support for bounding box queries using the BVH. The caller may now supply a set of bounding boxes to a BVH and the BVH will return a set of candidate BVH bins that intersect each bounding box. +- Added an `axom-config.cmake` file to axom's installation to streamline incorporating axom + into user applications. See `/examples/axom` for example usages. ### Removed From ef915ba4e67d5d80b529991be8ca9742bc1237b4 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Tue, 28 Apr 2020 15:47:35 -0700 Subject: [PATCH 197/632] Modifies axom-config per PR review --- src/cmake/axom-config.cmake.in | 45 ++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/cmake/axom-config.cmake.in b/src/cmake/axom-config.cmake.in index 7e812f7bbb..6974e921f5 100644 --- a/src/cmake/axom-config.cmake.in +++ b/src/cmake/axom-config.cmake.in @@ -14,47 +14,54 @@ if(NOT AXOM_FOUND) # Set version and paths #---------------------------------------------------------------------------- - set(AXOM_VERSION "@AXOM_VERSION_FULL@") + set(AXOM_VERSION "@AXOM_VERSION_FULL@") + set(AXOM_VERSION_MAJOR "@AXOM_VERSION_MAJOR@") + set(AXOM_VERSION_MINOR "@AXOM_VERSION_MINOR@") + set(AXOM_VERSION_PATCH "@AXOM_VERSION_PATCH@") set(AXOM_INSTALL_PREFIX "@AXOM_INSTALL_PREFIX@") - set(AXOM_INCLUDE_DIRS "${AXOM_INSTALL_PREFIX}/include/axom") + set(AXOM_INCLUDE_DIRS "${AXOM_INSTALL_PREFIX}/include") #---------------------------------------------------------------------------- # User configuration options and features #---------------------------------------------------------------------------- + # Language features set(AXOM_ENABLE_FORTRAN "@ENABLE_FORTRAN@") + set(AXOM_USE_CUDA "@AXOM_USE_CUDA@") + set(AXOM_USE_MPI "@AXOM_USE_MPI@") + set(AXOM_USE_OPENMP "@AXOM_USE_OPENMP@") + # Axom components set(AXOM_ENABLE_LUMBERJACK "@AXOM_ENABLE_LUMBERJACK@") - set(AXOM_ENABLE_SLIC "@AXOM_ENABLE_SLIC@") - set(AXOM_ENABLE_SLAM "@AXOM_ENABLE_SLAM@") set(AXOM_ENABLE_MINT "@AXOM_ENABLE_MINT@") set(AXOM_ENABLE_PRIMAL "@AXOM_ENABLE_PRIMAL@") - set(AXOM_ENABLE_SPIN "@AXOM_ENABLE_SPIN@") - set(AXOM_ENABLE_SIDRE "@AXOM_ENABLE_SIDRE@") set(AXOM_ENABLE_QUEST "@AXOM_ENABLE_QUEST@") + set(AXOM_ENABLE_SIDRE "@AXOM_ENABLE_SIDRE@") + set(AXOM_ENABLE_SLAM "@AXOM_ENABLE_SLAM@") + set(AXOM_ENABLE_SLIC "@AXOM_ENABLE_SLIC@") + set(AXOM_ENABLE_SPIN "@AXOM_ENABLE_SPIN@") + # Axom built-in TPLs set(AXOM_USE_CLI11 "@AXOM_USE_CLI11@") - set(AXOM_USE_CONDUIT "@AXOM_USE_CONDUIT@") - set(AXOM_USE_CUDA "@AXOM_USE_CUDA@") set(AXOM_USE_FMT "@AXOM_USE_FMT@") + set(AXOM_USE_SPARSEHASH "@AXOM_USE_SPARSEHASH@") + + # Axom external TPLs + set(AXOM_USE_CONDUIT "@AXOM_USE_CONDUIT@") set(AXOM_USE_HDF5 "@AXOM_USE_HDF5@") set(AXOM_USE_MFEM "@AXOM_USE_MFEM@") - set(AXOM_USE_MPI "@AXOM_USE_MPI@") - set(AXOM_USE_OPENMP "@AXOM_USE_OPENMP@") set(AXOM_USE_RAJA "@AXOM_USE_RAJA@") set(AXOM_USE_SCR "@AXOM_USE_SCR@") - set(AXOM_USE_SPARSEHASH "@AXOM_USE_SPARSEHASH@") set(AXOM_USE_UMPIRE "@AXOM_USE_UMPIRE@") - set(AXOM_CONDUIT_DIR "@CONDUIT_DIR@") - set(AXOM_HDF5_DIR "@HDF5_DIR@") - set(AXOM_MFEM_DIR "@MFEM_DIR@") - set(AXOM_RAJA_DIR "@RAJA_DIR@") - set(AXOM_SCR_DIR "@SCR_DIR@") - set(AXOM_UMPIRE_DIR "@UMPIRE_DIR@") - - set(AXOM_DATA_DIR "@AXOM_DATA_DIR@") + # Paths to Axom's external TPLs + if(AXOM_USE_CONDUIT) set(AXOM_CONDUIT_DIR "@CONDUIT_DIR@") endif() + if(AXOM_USE_HDF5) set(AXOM_HDF5_DIR "@HDF5_DIR@") endif() + if(AXOM_USE_MFEM) set(AXOM_MFEM_DIR "@MFEM_DIR@") endif() + if(AXOM_USE_RAJA) set(AXOM_RAJA_DIR "@RAJA_DIR@") endif() + if(AXOM_USE_SCR) set(AXOM_SCR_DIR "@SCR_DIR@") endif() + if(AXOM_USE_UMPIRE) set(AXOM_UMPIRE_DIR "@UMPIRE_DIR@") endif() #---------------------------------------------------------------------------- # Include targets exported by cmake From 207a081021e923b0bf936c6ac5967af0c2b7970a Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Tue, 28 Apr 2020 21:35:12 -0700 Subject: [PATCH 198/632] Fixes some warnings in sphinx docs --- src/docs/sphinx/dev_guide/dev_summary.rst | 2 +- src/docs/sphinx/dev_guide/index.rst | 1 - src/docs/sphinx/quickstart_guide/the_code.rst | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/docs/sphinx/dev_guide/dev_summary.rst b/src/docs/sphinx/dev_guide/dev_summary.rst index cf40ec72ad..c01b4750d4 100644 --- a/src/docs/sphinx/dev_guide/dev_summary.rst +++ b/src/docs/sphinx/dev_guide/dev_summary.rst @@ -118,6 +118,6 @@ getting started with them. * See :ref:`bamboo-label` for more information about how we use Bamboo. * **Azure Pipelines.** We use Azure Pipelines for continuous integration to ensure every code change passes a -level of quality before being merged.: `Azure Pipelines `_ + level of quality before being merged.: `Azure Pipelines `_ * See :ref:`azure_pipelines-label` for more information about how we use Azire Pipelines. diff --git a/src/docs/sphinx/dev_guide/index.rst b/src/docs/sphinx/dev_guide/index.rst index ab1391c33b..f9381c68be 100644 --- a/src/docs/sphinx/dev_guide/index.rst +++ b/src/docs/sphinx/dev_guide/index.rst @@ -49,7 +49,6 @@ changes are made, this guide should be updated accordingly. pull_requests component_org testing - bamboo misc_tasks diff --git a/src/docs/sphinx/quickstart_guide/the_code.rst b/src/docs/sphinx/quickstart_guide/the_code.rst index 1504a89bc0..0d88edb243 100644 --- a/src/docs/sphinx/quickstart_guide/the_code.rst +++ b/src/docs/sphinx/quickstart_guide/the_code.rst @@ -27,7 +27,7 @@ SSH keys ^^^^^^^^ If you have not used Github before, you should start by creating and adding your SSH keys to Github. -Github provides a good tutorial `here `_. +Github provides a `good tutorial `_. Performing these two simple steps will make it easier for you to interact with our Git repository without having to repeatedly enter login credentials. From 95c2058c7b1ce0a81028f0fd9471de9e5b6908cd Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 11:51:05 -0700 Subject: [PATCH 199/632] axom-config imports targets for axom's dependencies Includes a workaround to clear exported openmp flags. --- src/cmake/axom-config.cmake.in | 70 ++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 8 deletions(-) diff --git a/src/cmake/axom-config.cmake.in b/src/cmake/axom-config.cmake.in index 6974e921f5..5ef5e02945 100644 --- a/src/cmake/axom-config.cmake.in +++ b/src/cmake/axom-config.cmake.in @@ -23,7 +23,7 @@ if(NOT AXOM_FOUND) set(AXOM_INCLUDE_DIRS "${AXOM_INSTALL_PREFIX}/include") #---------------------------------------------------------------------------- - # User configuration options and features + # Set user configuration options and features #---------------------------------------------------------------------------- # Language features @@ -55,13 +55,54 @@ if(NOT AXOM_FOUND) set(AXOM_USE_SCR "@AXOM_USE_SCR@") set(AXOM_USE_UMPIRE "@AXOM_USE_UMPIRE@") - # Paths to Axom's external TPLs - if(AXOM_USE_CONDUIT) set(AXOM_CONDUIT_DIR "@CONDUIT_DIR@") endif() - if(AXOM_USE_HDF5) set(AXOM_HDF5_DIR "@HDF5_DIR@") endif() - if(AXOM_USE_MFEM) set(AXOM_MFEM_DIR "@MFEM_DIR@") endif() - if(AXOM_USE_RAJA) set(AXOM_RAJA_DIR "@RAJA_DIR@") endif() - if(AXOM_USE_SCR) set(AXOM_SCR_DIR "@SCR_DIR@") endif() - if(AXOM_USE_UMPIRE) set(AXOM_UMPIRE_DIR "@UMPIRE_DIR@") endif() + #---------------------------------------------------------------------------- + # Bring in required dependencies for this axom configuration + #---------------------------------------------------------------------------- + include(CMakeFindDependencyMacro) + + # conduit + if(AXOM_USE_CONDUIT) + set(AXOM_CONDUIT_DIR "@CONDUIT_DIR@") + if(NOT CONDUIT_DIR) + set(CONDUIT_DIR ${AXOM_CONDUIT_DIR}) + endif() + find_dependency(Conduit REQUIRED NO_DEFAULT_PATH PATHS "${CONDUIT_DIR}/lib/cmake") + endif() + + # hdf5 + if(AXOM_USE_HDF5) + set(AXOM_HDF5_DIR "@HDF5_DIR@") + # Note: Targets not imported + endif() + + # mfem + if(AXOM_USE_MFEM) + set(AXOM_MFEM_DIR "@MFEM_DIR@") + # Note: Targets not imported + endif() + + # raja + if(AXOM_USE_RAJA) + set(AXOM_RAJA_DIR "@RAJA_DIR@") + if(NOT RAJA_DIR) + set(RAJA_DIR ${AXOM_RAJA_DIR}) + endif() + find_dependency(RAJA REQUIRED NO_DEFAULT_PATH PATHS "${RAJA_DIR}/share/raja/cmake") + endif() + + # scr + if(AXOM_USE_SCR) + set(AXOM_SCR_DIR "@SCR_DIR@") + endif() + + # umpire + if(AXOM_USE_UMPIRE) + set(AXOM_UMPIRE_DIR "@UMPIRE_DIR@") + if(NOT UMPIRE_DIR) + set(UMPIRE_DIR ${AXOM_UMPIRE_DIR}) + endif() + find_dependency(umpire REQUIRED NO_DEFAULT_PATH PATHS "${UMPIRE_DIR}/share/umpire/cmake") + endif() #---------------------------------------------------------------------------- # Include targets exported by cmake @@ -69,7 +110,20 @@ if(NOT AXOM_FOUND) get_filename_component(AXOM_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${AXOM_CMAKE_CONFIG_DIR}/axom-targets.cmake) + # HACK: Clear interface_compile_options so that we don't export OpenMP + # This can be removed when we fix how axom/blt's treatment of OpenMP + if(AXOM_USE_OPENMP) + set(_fix_tgts axom) + if(AXOM_USE_RAJA) + list(APPEND _fix_tgts RAJA) + endif() + set_target_properties(${_fix_tgts} PROPERTIES INTERFACE_COMPILE_OPTIONS "") + unset(_fix_tgts) + endif() + #---------------------------------------------------------------------------- + # Indicate that axom is correctly set up + #---------------------------------------------------------------------------- set(AXOM_FOUND TRUE) endif() From eea66041d740210c327fc03f5381f5101f0291d1 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 11:54:36 -0700 Subject: [PATCH 200/632] Updates build system for axom's exported cmake and blt examples These can now bring in axom, as configured using only AXOM_DIR (and BLT_SOURCE_DIR for the blt-based example). --- src/examples/using-with-blt/CMakeLists.txt | 44 ++++--------------- .../using-with-blt/host-config.cmake.in | 6 ++- src/examples/using-with-cmake/CMakeLists.txt | 44 +++++-------------- .../using-with-cmake/host-config.cmake.in | 6 ++- 4 files changed, 27 insertions(+), 73 deletions(-) diff --git a/src/examples/using-with-blt/CMakeLists.txt b/src/examples/using-with-blt/CMakeLists.txt index f35593e5f4..d204d3d610 100644 --- a/src/examples/using-with-blt/CMakeLists.txt +++ b/src/examples/using-with-blt/CMakeLists.txt @@ -6,10 +6,8 @@ # Example that shows how to use an installed instance of Axom # in a BLT-based build system. # -# Required configuration variables are stored in a CMake cache file -# called 'host-config.cmake' in the same directory -# -# This file defines paths to BLT, axom and optionally conduit. +# Configuration variables are stored in a CMake cache file 'host-config.cmake' +# which defines paths to blt, axom and possibly other TPLs. # It also contains information about the compiler used to build axom. #------------------------------------------------------------------------------ # @@ -29,31 +27,15 @@ project(using_with_blt) # Define some config options option(EXAMPLE_VERBOSE_OUTPUT "Verbose output about imported targets" OFF) -# Simple function to check validity of a path variable, e.g. `FOO_DIR` -# and a required file under it of the form `${FOO_DIR}/some/subpath/file` -function(check_var_and_path) - set(_variable ${ARGV0}) - set(_file ${ARGV1}) - - if(NOT DEFINED ${_variable}) - message(FATAL_ERROR "Required variable '${_variable}' not provided." - " Please supply '${_variable}' to configuration." ) - endif() - - if(NOT EXISTS ${_file}) - message (FATAL_ERROR "Path '${_variable}' does not contain required" - " file '${_file}'.") - endif() -endfunction() - - #------------------------------------------------------------------------------ # Set up BLT with validity checks #------------------------------------------------------------------------------ # Check that path to BLT is provided and valid -check_var_and_path(BLT_SOURCE_DIR ${BLT_SOURCE_DIR}/SetupBLT.cmake) +if(NOT DEFINED BLT_SOURCE_DIR OR NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake) + message(FATAL_ERROR "Missing required 'BLT_SOURCE_DIR' variable pointing to a valid blt") +endif() include(${BLT_SOURCE_DIR}/SetupBLT.cmake) @@ -61,24 +43,14 @@ include(${BLT_SOURCE_DIR}/SetupBLT.cmake) #------------------------------------------------------------------------------ # Check for AXOM_DIR and use CMake's find_package to import axom's targets #------------------------------------------------------------------------------ -check_var_and_path(AXOM_DIR ${AXOM_DIR}/lib/cmake/axom-config.cmake) +if(NOT DEFINED AXOM_DIR OR NOT EXISTS ${AXOM_DIR}/lib/cmake/axom-config.cmake) + message(FATAL_ERROR "Missing required 'AXOM_DIR' variable pointing to an installed axom") +endif() find_package(axom REQUIRED NO_DEFAULT_PATH PATHS ${AXOM_DIR}/lib/cmake) -#------------------------------------------------------------------------------ -# Check for CONDUIT_DIR -- required if Axom was built with Conduit -# Note: 'AXOM_USE_CONDUIT' variable is provided by Axom's config file -#------------------------------------------------------------------------------ -if(AXOM_USE_CONDUIT) - check_var_and_path(CONDUIT_DIR ${CONDUIT_DIR}/lib/cmake/ConduitConfig.cmake) - - find_package(Conduit REQUIRED - NO_DEFAULT_PATH - PATHS ${CONDUIT_DIR}/lib/cmake) -endif() - #------------------------------------------------------------------------------ # Set up example target that depends on axom #------------------------------------------------------------------------------ diff --git a/src/examples/using-with-blt/host-config.cmake.in b/src/examples/using-with-blt/host-config.cmake.in index ee407fbf8f..7d9ded51a7 100644 --- a/src/examples/using-with-blt/host-config.cmake.in +++ b/src/examples/using-with-blt/host-config.cmake.in @@ -22,7 +22,9 @@ set(ENABLE_DOCS FALSE CACHE BOOL "") set(ENABLE_EXAMPLES FALSE CACHE BOOL "") set(ENABLE_TESTS FALSE CACHE BOOL "") -# Paths to Axom and other TPLs +# Needed to deal with bug related to Fortran + OpenMP +set(ENABLE_FORTRAN "@ENABLE_FORTRAN@" CACHE PATH "") + +# Path to Axom set(AXOM_DIR "@CMAKE_INSTALL_PREFIX@" CACHE PATH "") -set(CONDUIT_DIR "@CONDUIT_DIR@" CACHE PATH "") diff --git a/src/examples/using-with-cmake/CMakeLists.txt b/src/examples/using-with-cmake/CMakeLists.txt index 027d4a7ed2..10f900c78b 100644 --- a/src/examples/using-with-cmake/CMakeLists.txt +++ b/src/examples/using-with-cmake/CMakeLists.txt @@ -6,10 +6,8 @@ # Example that shows how to use an installed instance of Axom # in a CMake-based build system. # -# Required configuration variables are stored in a CMake cache file -# called 'host-config.cmake' in the same directory -# -# This file defines paths to axom and optionally conduit. +# Configuration variables are stored in a CMake cache file 'host-config.cmake' +# which defines paths to axom and possibly other TPLs. # It also contains information about the compiler used to build axom. #------------------------------------------------------------------------------ # @@ -26,44 +24,24 @@ cmake_minimum_required(VERSION 3.8) project(using_with_cmake) -# Simple function to check validity of a path variable, e.g. `FOO_DIR` -# and a required file under it of the form `${FOO_DIR}/some/subpath/file` -function(check_var_and_path) - set(_variable ${ARGV0}) - set(_file ${ARGV1}) - - if(NOT DEFINED ${_variable}) - message(FATAL_ERROR "Required variable '${_variable}' not provided." - " Please supply '${_variable}' to configuration." ) - endif() - - if(NOT EXISTS ${_file}) - message (FATAL_ERROR "Path '${_variable}' does not contain required" - " file '${_file}'.") - endif() -endfunction() - +# Note: For the time being, we need to enable Fortran if Axom was configured using +# Fortran and OpenMP due to a bug with how Axom exports OpenMP flags +if(ENABLE_FORTRAN) + enable_language(Fortran) +endif() + #------------------------------------------------------------------------------ # Check for AXOM_DIR and use CMake's find_package to import axom's targets #------------------------------------------------------------------------------ -check_var_and_path(AXOM_DIR ${AXOM_DIR}/lib/cmake/axom-config.cmake) +if(NOT DEFINED AXOM_DIR OR NOT EXISTS ${AXOM_DIR}/lib/cmake/axom-config.cmake) + message(FATAL_ERROR "Missing required 'AXOM_DIR' variable pointing to an installed axom") +endif() find_package(axom REQUIRED NO_DEFAULT_PATH PATHS ${AXOM_DIR}/lib/cmake) -#------------------------------------------------------------------------------ -# Check for CONDUIT_DIR -- required if Axom was built with Conduit -# Note: 'AXOM_USE_CONDUIT' variable is provided by Axom's config file -#------------------------------------------------------------------------------ -if(AXOM_USE_CONDUIT) - check_var_and_path(CONDUIT_DIR ${CONDUIT_DIR}/lib/cmake/ConduitConfig.cmake) - - find_package(Conduit REQUIRED - NO_DEFAULT_PATH - PATHS ${CONDUIT_DIR}/lib/cmake) -endif() #------------------------------------------------------------------------------ # Set up example target that depends on axom diff --git a/src/examples/using-with-cmake/host-config.cmake.in b/src/examples/using-with-cmake/host-config.cmake.in index 44940fc4d1..a98bb8af15 100644 --- a/src/examples/using-with-cmake/host-config.cmake.in +++ b/src/examples/using-with-cmake/host-config.cmake.in @@ -16,7 +16,9 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "") set(CMAKE_CXX_STANDARD 11 CACHE STRING "") set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE CACHE BOOL "") -# Paths to Axom and other TPLs +# Needed to deal with bug related to Fortran + OpenMP +set(ENABLE_FORTRAN "@ENABLE_FORTRAN@" CACHE PATH "") + +# Path to Axom set(AXOM_DIR "@CMAKE_INSTALL_PREFIX@" CACHE PATH "") -set(CONDUIT_DIR "@CONDUIT_DIR@" CACHE PATH "") From 9aba01ce0bb9aba20735696f03bf9baefba72af2 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 12:12:51 -0700 Subject: [PATCH 201/632] Tests installed axom examples as part of llnl CI plans --- scripts/llnl_scripts/llnl_lc_build_tools.py | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 823d799f28..b7d534ee92 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -148,6 +148,8 @@ def copy_build_dir_files(build_dir, archive_spec_dir): copy_if_exists(pjoin(build_dir, "output.log.make.test.txt"), archive_spec_dir) copy_if_exists(pjoin(build_dir, "output.log.make.install.txt"), archive_spec_dir) copy_if_exists(pjoin(build_dir, "output.log.make.docs.txt"), archive_spec_dir) + copy_if_exists(pjoin(build_dir, "output.log.install_example.cmake.txt"), archive_spec_dir) + copy_if_exists(pjoin(build_dir, "output.log.install_example.blt.txt"), archive_spec_dir) # Note: There should only be one of these per spec last_test_logs = glob.glob(pjoin(build_dir, "Testing", "Temporary", "LastTest*.log")) @@ -386,6 +388,69 @@ def build_and_test_host_config(test_root,host_config): sexe("ls %s/include" % install_dir, echo=True, error_prefix="WARNING:") sexe("ls %s/lib" % install_dir, echo=True, error_prefix="WARNING:") sexe("ls %s/bin" % install_dir, echo=True, error_prefix="WARNING:") + + # test the installation using installed cmake examples + should_test_installed_cmake_example = True + should_test_installed_blt_example = True + + if should_test_installed_cmake_example: + install_example_dir = pjoin(install_dir, "examples", "axom", "using-with-cmake") + install_example_output_file = pjoin(build_dir,"output.log.install_example.cmake.txt") + print "[testing installed 'using-with-cmake' example]" + print "[log file: %s]" % install_example_output_file + + example_commands = [ + "cd {0}".format(install_example_dir), + "rm -rf build", + "mkdir build", + "cd build", + """echo "[Configuring '{}' example]" """.format("using-with-cmake"), + "cmake -C ../host-config.cmake ..", + """echo "[Building '{}' example]" """.format("using-with-cmake"), + "make ", + """echo "[Running '{}' example]" """.format("using-with-cmake"), + "./example", + """echo "[Done]" """ + ] + + res = sexe(" && ".join(example_commands), + output_file = install_example_output_file, + echo=True) + + if res != 0: + print "[ERROR: Installed 'using-with-cmake' example for host-config: %s failed]\n\n" % host_config + return res + + + if should_test_installed_blt_example: + install_example_dir = pjoin(install_dir, "examples", "axom", "using-with-blt") + install_example_output_file = pjoin(build_dir,"output.log.install_example.blt.txt") + print "[testing installed 'using-with-blt' example]" + print "[log file: %s]" % install_example_output_file + + example_commands = [ + "cd {0}".format(install_example_dir), + "rm -rf build", + "mkdir build", + "cd build", + """echo "[Configuring '{}' example]" """.format("using-with-blt"), + "cmake -C ../host-config.cmake ..", + """echo "[Building '{}' example]" """.format("using-with-blt"), + "make ", + """echo "[Running '{}' example]" """.format("using-with-blt"), + "./bin/example", + """echo "[Done]" """ + ] + + res = sexe(" && ".join(example_commands), + output_file = install_example_output_file, + echo=True) + + if res != 0: + print "[ERROR: Installed 'using-with-blt' example for host-config: %s failed]\n\n" % host_config + return res + + print "[SUCCESS: Build, test, and install for host-config: %s complete]\n" % host_config set_axom_group_and_perms(build_dir) From aa5e385bfe2c6ea38333d5a6f9c77abac4c1905c Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 12:54:21 -0700 Subject: [PATCH 202/632] Increase internal build parallelism for llnl CI jobs --- scripts/llnl_scripts/llnl_lc_build_tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index b7d534ee92..4fc302973e 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -347,7 +347,7 @@ def build_and_test_host_config(test_root,host_config): print "[starting unit tests]" print "[log file: %s]" % tst_output_file - tst_cmd = "cd %s && make CTEST_OUTPUT_ON_FAILURE=1 test ARGS=\"-T Test -VV -j8\"" % build_dir + tst_cmd = "cd %s && make CTEST_OUTPUT_ON_FAILURE=1 test ARGS=\"-T Test -VV -j16\"" % build_dir res = sexe(tst_cmd, output_file = tst_output_file, @@ -362,7 +362,7 @@ def build_and_test_host_config(test_root,host_config): print "[starting docs generation]" print "[log file: %s]" % docs_output_file - res = sexe("cd %s && make docs " % build_dir, + res = sexe("cd %s && make -j16 docs " % build_dir, output_file = docs_output_file, echo=True) @@ -375,7 +375,7 @@ def build_and_test_host_config(test_root,host_config): print "[starting install]" print "[log file: %s]" % inst_output_file - res = sexe("cd %s && make install " % build_dir, + res = sexe("cd %s && make -j16 install " % build_dir, output_file = inst_output_file, echo=True) From 29dbc51f533c3980ed38bb7b6896fb0b2c1d0a65 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 14:36:00 -0700 Subject: [PATCH 203/632] Removed need for Fortran in Axom's installed examples Resolved by removing export of OpenMP flags. --- src/examples/using-with-blt/host-config.cmake.in | 3 --- src/examples/using-with-cmake/CMakeLists.txt | 7 ------- src/examples/using-with-cmake/host-config.cmake.in | 3 --- 3 files changed, 13 deletions(-) diff --git a/src/examples/using-with-blt/host-config.cmake.in b/src/examples/using-with-blt/host-config.cmake.in index 7d9ded51a7..7c856f49cb 100644 --- a/src/examples/using-with-blt/host-config.cmake.in +++ b/src/examples/using-with-blt/host-config.cmake.in @@ -22,9 +22,6 @@ set(ENABLE_DOCS FALSE CACHE BOOL "") set(ENABLE_EXAMPLES FALSE CACHE BOOL "") set(ENABLE_TESTS FALSE CACHE BOOL "") -# Needed to deal with bug related to Fortran + OpenMP -set(ENABLE_FORTRAN "@ENABLE_FORTRAN@" CACHE PATH "") - # Path to Axom set(AXOM_DIR "@CMAKE_INSTALL_PREFIX@" CACHE PATH "") diff --git a/src/examples/using-with-cmake/CMakeLists.txt b/src/examples/using-with-cmake/CMakeLists.txt index 10f900c78b..810daeed64 100644 --- a/src/examples/using-with-cmake/CMakeLists.txt +++ b/src/examples/using-with-cmake/CMakeLists.txt @@ -24,13 +24,6 @@ cmake_minimum_required(VERSION 3.8) project(using_with_cmake) -# Note: For the time being, we need to enable Fortran if Axom was configured using -# Fortran and OpenMP due to a bug with how Axom exports OpenMP flags -if(ENABLE_FORTRAN) - enable_language(Fortran) -endif() - - #------------------------------------------------------------------------------ # Check for AXOM_DIR and use CMake's find_package to import axom's targets #------------------------------------------------------------------------------ diff --git a/src/examples/using-with-cmake/host-config.cmake.in b/src/examples/using-with-cmake/host-config.cmake.in index a98bb8af15..3412123c26 100644 --- a/src/examples/using-with-cmake/host-config.cmake.in +++ b/src/examples/using-with-cmake/host-config.cmake.in @@ -16,9 +16,6 @@ set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@" CACHE PATH "") set(CMAKE_CXX_STANDARD 11 CACHE STRING "") set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE CACHE BOOL "") -# Needed to deal with bug related to Fortran + OpenMP -set(ENABLE_FORTRAN "@ENABLE_FORTRAN@" CACHE PATH "") - # Path to Axom set(AXOM_DIR "@CMAKE_INSTALL_PREFIX@" CACHE PATH "") From 92bf9378aec0fa3366a7952c5ffa06efbc462a35 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 15:00:13 -0700 Subject: [PATCH 204/632] Temporarily disables tests for installed examples in cuda-enabled configurations --- scripts/llnl_scripts/llnl_lc_build_tools.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/llnl_scripts/llnl_lc_build_tools.py b/scripts/llnl_scripts/llnl_lc_build_tools.py index 4fc302973e..7f60dcea7d 100755 --- a/scripts/llnl_scripts/llnl_lc_build_tools.py +++ b/scripts/llnl_scripts/llnl_lc_build_tools.py @@ -390,8 +390,12 @@ def build_and_test_host_config(test_root,host_config): sexe("ls %s/bin" % install_dir, echo=True, error_prefix="WARNING:") # test the installation using installed cmake examples - should_test_installed_cmake_example = True - should_test_installed_blt_example = True + # TODO: enable tests for installed examples in device configurations + # TODO: enable tests for installed makefile-based example + is_device_build = "nvcc" in host_config + should_test_installed_cmake_example = not is_device_build + should_test_installed_blt_example = not is_device_build + should_test_installed_make_example = False if should_test_installed_cmake_example: install_example_dir = pjoin(install_dir, "examples", "axom", "using-with-cmake") From b9250772bee1ab856891a2d3f3763d483a375d40 Mon Sep 17 00:00:00 2001 From: Kenneth Weiss Date: Thu, 30 Apr 2020 15:12:44 -0700 Subject: [PATCH 205/632] Clean up some comments and documentation --- src/cmake/axom-config.cmake.in | 9 +++++---- src/docs/sphinx/quickstart_guide/zero_to_axom.rst | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cmake/axom-config.cmake.in b/src/cmake/axom-config.cmake.in index 5ef5e02945..d5ea533363 100644 --- a/src/cmake/axom-config.cmake.in +++ b/src/cmake/axom-config.cmake.in @@ -72,13 +72,13 @@ if(NOT AXOM_FOUND) # hdf5 if(AXOM_USE_HDF5) set(AXOM_HDF5_DIR "@HDF5_DIR@") - # Note: Targets not imported + # Note: Targets not currently imported endif() # mfem if(AXOM_USE_MFEM) set(AXOM_MFEM_DIR "@MFEM_DIR@") - # Note: Targets not imported + # Note: Targets not currently imported endif() # raja @@ -93,6 +93,7 @@ if(NOT AXOM_FOUND) # scr if(AXOM_USE_SCR) set(AXOM_SCR_DIR "@SCR_DIR@") + # Note: Targets not currently imported endif() # umpire @@ -110,8 +111,8 @@ if(NOT AXOM_FOUND) get_filename_component(AXOM_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) include(${AXOM_CMAKE_CONFIG_DIR}/axom-targets.cmake) - # HACK: Clear interface_compile_options so that we don't export OpenMP - # This can be removed when we fix how axom/blt's treatment of OpenMP + # HACK: Clear INTERFACE_COMPILE_OPTIONS to avoid requiring OpenMP in user code + # This can (hopefully) be removed when we fix axom/blt's treatment of OpenMP if(AXOM_USE_OPENMP) set(_fix_tgts axom) if(AXOM_USE_RAJA) diff --git a/src/docs/sphinx/quickstart_guide/zero_to_axom.rst b/src/docs/sphinx/quickstart_guide/zero_to_axom.rst index 764c271372..46956e337f 100644 --- a/src/docs/sphinx/quickstart_guide/zero_to_axom.rst +++ b/src/docs/sphinx/quickstart_guide/zero_to_axom.rst @@ -36,7 +36,7 @@ CMake-based build system example .. literalinclude:: ../../../examples/using-with-cmake/CMakeLists.txt :language: cmake - :lines: 47-78 + :lines: 27-50 See: ``examples/axom/using-with-cmake`` @@ -46,7 +46,7 @@ BLT-based build system example .. literalinclude:: ../../../examples/using-with-blt/CMakeLists.txt :language: cmake - :lines: 51-88 + :lines: 31-61 See: ``examples/axom/using-with-blt`` @@ -56,6 +56,6 @@ Makefile-based build system example .. literalinclude:: ../../../examples/using-with-make/Makefile :language: make - :lines: 21-25 + :lines: 20-25 See: ``examples/axom/using-with-make`` From 87ef3db53c1d28fdb48688c7673d9098200b17a6 Mon Sep 17 00:00:00 2001 From: "Noah S. Elliott" Date: Fri, 1 May 2020 17:04:11 -0700 Subject: [PATCH 206/632] Make importConduitTree handle lists --- src/axom/sidre/core/Group.cpp | 21 ++------ src/axom/sidre/tests/sidre_group.cpp | 75 ++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 17 deletions(-) diff --git a/src/axom/sidre/core/Group.cpp b/src/axom/sidre/core/Group.cpp index 809a2890fd..a22198f07a 100644 --- a/src/axom/sidre/core/Group.cpp +++ b/src/axom/sidre/core/Group.cpp @@ -2141,7 +2141,7 @@ bool Group::importConduitTree(const conduit::Node &node, bool preserve_contents) // DataType node_dtype = node.dtype(); - if(node_dtype.is_object()) + if(node_dtype.is_object() || node_dtype.is_list()) { conduit::NodeConstIterator itr = node.children(); while (itr.has_next()) @@ -2150,7 +2150,7 @@ bool Group::importConduitTree(const conduit::Node &node, bool preserve_contents) std::string cld_name = itr.name(); DataType cld_dtype = cld_node.dtype(); - if(cld_dtype.is_object()) + if(cld_dtype.is_object() || cld_dtype.is_list()) { // create group Group* grp = createGroup(cld_name); @@ -2208,12 +2208,6 @@ bool Group::importConduitTree(const conduit::Node &node, bool preserve_contents) cld_dtype.number_of_elements()); } } - else if (cld_dtype.is_list()) - { - SLIC_WARNING(SIDRE_GROUP_LOG_PREPEND - << "Group cannot import Conduit list " << cld_name); - success = false; - } else { // All Nodes should have one of the above datatypes, so if @@ -2244,9 +2238,8 @@ bool Group::importConduitTreeExternal(conduit::Node &node, destroyViews(); } - // DataType node_dtype = node.dtype(); - if(node_dtype.is_object()) + if(node_dtype.is_object() || node_dtype.is_list()) { conduit::NodeIterator itr = node.children(); while (itr.has_next()) @@ -2255,7 +2248,7 @@ bool Group::importConduitTreeExternal(conduit::Node &node, std::string cld_name = itr.name(); DataType cld_dtype = cld_node.dtype(); - if(cld_dtype.is_object()) + if(cld_dtype.is_object() || cld_dtype.is_list()) { // create group Group* grp = createGroup(cld_name); @@ -2290,12 +2283,6 @@ bool Group::importConduitTreeExternal(conduit::Node &node, view->apply(cld_dtype); } } - else if (cld_dtype.is_list()) - { - SLIC_WARNING(SIDRE_GROUP_LOG_PREPEND - << "Group cannot import Conduit list " << cld_name); - success = false; - } else { // All Nodes should have one of the above datatypes, so if diff --git a/src/axom/sidre/tests/sidre_group.cpp b/src/axom/sidre/tests/sidre_group.cpp index 205f0b02e5..c0b95c3b80 100644 --- a/src/axom/sidre/tests/sidre_group.cpp +++ b/src/axom/sidre/tests/sidre_group.cpp @@ -2486,6 +2486,81 @@ TEST(sidre_group,import_conduit_external) } +//------------------------------------------------------------------------------ +TEST(sidre_group,import_conduit_lists) +{ + conduit::Node input; + + input["fields/a/i0"] = (conduit::int64)(100); + input["fields/a/d0"] = (conduit::float64)(3000.00); + input["fields/b/s0"] = "foo"; + + int ndata = 10; + std::vector ivec(ndata); + input["fields/c/int10"].set(&ivec[0], ndata); + conduit::int64_array iarray = input["fields/c/int10"].as_int64_array(); + for (int i = 0 ; i < ndata ; ++i) + { + iarray[i] = (conduit::int64)i; + } + + conduit::Node &list_item0 = input["list"].append(); + list_item0.set((conduit::int64)(12)); + conduit::Node &list_item1 = input["list"].append(); + list_item1.set((conduit::float64)(75.75)); + conduit::Node &list_item2 = input["list"].append(); + list_item2.set("list_string"); + conduit::Node &list_item3 = input["list"].append(); + list_item3["val1"] = (conduit::int64)(2); + list_item3["val2"] = (conduit::float64)(4.0); + + DataStore ds; + + EXPECT_TRUE(ds.getRoot()->importConduitTree(input)); + + EXPECT_EQ(ds.getRoot()->getView( + "fields/a/i0")->getData(),100); + EXPECT_NEAR(ds.getRoot()->getView( + "fields/a/d0")->getData(),3000.00,1e-12); + EXPECT_EQ(ds.getRoot()->getView("fields/b/s0")->getString(), + std::string("foo")); + + conduit::int64* sidre_data_ptr = + ds.getRoot()->getView("fields/c/int10")->getData(); + + for(int j=0 ; j< ndata ; j++) + { + EXPECT_EQ(iarray[j],sidre_data_ptr[j]); + } + + Group* list = ds.getRoot()->getGroup("list"); + for (IndexType idx = list->getFirstValidGroupIndex() ; + indexIsValid(idx) ; + idx = list->getNextValidGroupIndex(idx)) + { + Group* child = list->getGroup(idx); + EXPECT_EQ(child->getView("val1")->getData(),2); + EXPECT_NEAR(child->getView("val2")->getData(),4.0,1e-12); + } + + for (IndexType idx = list->getFirstValidGroupIndex() ; + indexIsValid(idx) ; + idx = list->getNextValidGroupIndex(idx)) + { + View* view = list->getView(idx); + const conduit::Schema& schema = view->getSchema(); + if (schema.dtype().is_int64()) { + EXPECT_EQ(view->getData(),12); + } + if (schema.dtype().is_float64()) { + EXPECT_NEAR(view->getData(),75.75,1e-12); + } + if (schema.dtype().is_string()) { + EXPECT_EQ(view->getString(),std::string("list_string")); + } + } +} + #ifdef AXOM_USE_UMPIRE From 3c23d56624e84cb4488ff57f36e4db2ec8f2e32e Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 29 Mar 2020 13:51:59 -0700 Subject: [PATCH 207/632] ENH: ability to specify an allocator to the BVH Adds the ability to specify and use a supplied allocator to the BVH. The allocator is specified as an optional argument when the BVH is constructed. --- src/axom/spin/BVH.hpp | 9 +++- src/axom/spin/internal/linear_bvh/BVHData.hpp | 6 +-- .../spin/internal/linear_bvh/BVH_impl.hpp | 38 ++++----------- .../spin/internal/linear_bvh/RadixTree.hpp | 19 ++++---- .../internal/linear_bvh/build_radix_tree.hpp | 46 +++++++++++-------- 5 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 93e1e41bfd..9172a1d962 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -140,6 +140,7 @@ class BVH * * \param [in] boxes buffer consisting of bounding boxes for each entity. * \param [in] numItems the total number of items to store in the BVH. + * \param [in] allocatorID specify the ID of the allocator to use. Optional. * * \note boxes is an array of length 2*dimension*numItems, that stores the * two corners of the axis-aligned bounding box corresponding to a given @@ -157,6 +158,10 @@ class BVH * double zmax = boxes[ offset+5 ]; * \endcode * + * \note If an allocatorID is not specified, the code will use the default + * allocator ID for the execution space specified via the template argument + * when the BVH object is instantiated. + * * \warning The supplied boxes array must point to a buffer in a memory space * that is compatible with the execution space. For example, when using * CUDA_EXEC, boxes must be in unified memory or GPU memory. The code @@ -165,7 +170,8 @@ class BVH * \pre boxes != nullptr * \pre numItems > 0 */ - BVH( const FloatType* boxes, IndexType numItems ); + BVH( const FloatType* boxes, IndexType numItems, + int allocatorID=axom::execution_space< ExecSpace >::allocatorID() ); /*! * \brief Destructor. @@ -355,6 +361,7 @@ class BVH /// \name Private Members /// @{ + int m_AllocatorID; FloatType m_Tolernace; FloatType m_scaleFactor; IndexType m_numItems; diff --git a/src/axom/spin/internal/linear_bvh/BVHData.hpp b/src/axom/spin/internal/linear_bvh/BVHData.hpp index 8d208dcb45..dd7bbe22dc 100644 --- a/src/axom/spin/internal/linear_bvh/BVHData.hpp +++ b/src/axom/spin/internal/linear_bvh/BVHData.hpp @@ -66,11 +66,11 @@ struct BVHData m_leaf_nodes( nullptr ) {} - void allocate( int32 size ) + void allocate( int32 size, int allocID ) { AXOM_PERF_MARK_FUNCTION( "BVHData::allocate" ); - m_inner_nodes = axom::allocate< Vec< FloatType,4 > >( (size-1)*4 ); - m_leaf_nodes = axom::allocate< int32 >( size ); + m_inner_nodes = axom::allocate< Vec< FloatType,4 > >( (size-1)*4, allocID ); + m_leaf_nodes = axom::allocate< int32 >( size, allocID ); } void deallocate() diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 2e508b8c55..7b9d5bb107 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -358,7 +358,9 @@ IndexType bvh_get_boxcounts( LeftPredicate&& leftCheck, //------------------------------------------------------------------------------ template< int NDIMS, typename ExecSpace, typename FloatType > BVH< NDIMS, ExecSpace, FloatType >::BVH( const FloatType* boxes, - IndexType numItems ) : + IndexType numItems, + int allocatorID ) : + m_AllocatorID( allocatorID ), m_Tolernace( floating_point_limits::epsilon() ), m_scaleFactor( DEFAULT_SCALE_FACTOR ), m_numItems( numItems ), @@ -378,11 +380,6 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() { AXOM_PERF_MARK_FUNCTION( "BVH::build" ); - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - // STEP 1: Handle case when user supplied a single bounding box int numBoxes = m_numItems; FloatType* boxesptr = nullptr; @@ -391,7 +388,7 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() numBoxes = 2; constexpr int32 M = NDIMS * 2; // number of entries for one box const int N = numBoxes * M; // number of entries for N boxes - boxesptr = axom::allocate< FloatType >( N ); + boxesptr = axom::allocate< FloatType >( N, m_AllocatorID ); const FloatType* myboxes = m_boxes; @@ -411,12 +408,13 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() // by their corresponding morton code. lbvh::RadixTree< FloatType, NDIMS > radix_tree; lbvh::AABB< FloatType, NDIMS > global_bounds; - lbvh::build_radix_tree< ExecSpace >( - boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor ); + lbvh::build_radix_tree< ExecSpace >( + boxesptr, numBoxes, global_bounds, radix_tree, m_scaleFactor, + m_AllocatorID ); // STEP 3: emit the BVH data-structure from the radix tree m_bvh.m_bounds = global_bounds; - m_bvh.allocate( numBoxes ); + m_bvh.allocate( numBoxes, m_AllocatorID ); // STEP 4: emit the BVH lbvh::emit_bvh< ExecSpace >( radix_tree, m_bvh ); @@ -430,8 +428,6 @@ int BVH< NDIMS, ExecSpace, FloatType >::build() axom::deallocate( boxesptr ); } - // STEP 6: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); return BVH_BUILD_OK; } @@ -464,11 +460,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, SLIC_ASSERT( x != nullptr ); SLIC_ASSERT( y != nullptr ); - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - using PointType = point_t< FloatType, NDIMS >; using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; @@ -506,7 +497,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, counts, counts+numPts, offsets, RAJA::operators::plus{} ); IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates); + candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); // STEP 4: fill in candidates for each point for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) @@ -532,8 +523,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, } ); - // STEP 3: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); } //------------------------------------------------------------------------------ @@ -561,11 +550,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, const FloatType TOL = m_Tolernace; - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - using RayType = ray_t< FloatType, NDIMS >; using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; @@ -603,7 +587,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, counts, counts+numRays, offsets, RAJA::operators::plus{} ); IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates); + candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); // STEP 4: fill in candidates for each point for_all< ExecSpace >( numRays, AXOM_LAMBDA (IndexType i) @@ -629,8 +613,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, } ); - // STEP 3: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); } //------------------------------------------------------------------------------ diff --git a/src/axom/spin/internal/linear_bvh/RadixTree.hpp b/src/axom/spin/internal/linear_bvh/RadixTree.hpp index a570508d18..e69b7fb9f3 100644 --- a/src/axom/spin/internal/linear_bvh/RadixTree.hpp +++ b/src/axom/spin/internal/linear_bvh/RadixTree.hpp @@ -42,21 +42,22 @@ struct RadixTree uint32* m_mcodes; AABB< FloatType, NDIMS >* m_leaf_aabbs; - void allocate( int32 size ) + void allocate( int32 size, int allocID ) { AXOM_PERF_MARK_FUNCTION("RadixTree::allocate"); m_size = size; m_inner_size = m_size-1; - m_left_children = axom::allocate( m_inner_size ); - m_right_children = axom::allocate( m_inner_size ); - m_parents = axom::allocate( m_size + m_inner_size ); - m_inner_aabbs = axom::allocate< AABB< FloatType,NDIMS > >(m_inner_size); - - m_leafs = axom::allocate< int32 >( m_size ); - m_mcodes = axom::allocate< uint32 >( m_size ); - m_leaf_aabbs = axom::allocate< AABB< FloatType,NDIMS > >( m_size ); + m_left_children = axom::allocate( m_inner_size, allocID ); + m_right_children = axom::allocate( m_inner_size, allocID ); + m_parents = axom::allocate( (m_size+m_inner_size), allocID ); + m_inner_aabbs = + axom::allocate< AABB< FloatType,NDIMS > >( m_inner_size,allocID ); + + m_leafs = axom::allocate< int32 >( m_size, allocID ); + m_mcodes = axom::allocate< uint32 >( m_size, allocID ); + m_leaf_aabbs = axom::allocate< AABB< FloatType,NDIMS > >( m_size, allocID ); } void deallocate() diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index ab711eca99..3388dae0b2 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -361,11 +361,11 @@ void array_counting( IntType* iterator, // result [b,a,c] // template< typename ExecSpace, typename T> -void reorder(int32* indices, T*&array, int32 size) +void reorder(int32* indices, T*&array, int32 size, int allocatorID) { AXOM_PERF_MARK_FUNCTION( "reorder" ); - T* temp = axom::allocate< T >( size ); + T* temp = axom::allocate< T >( size, allocatorID ); for_all< ExecSpace >( size, AXOM_LAMBDA (int32 i) { @@ -380,7 +380,8 @@ void reorder(int32* indices, T*&array, int32 size) //------------------------------------------------------------------------------ template < typename ExecSpace > -void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) +void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter, + int allocatorID ) { AXOM_PERF_MARK_FUNCTION( "custom_sort" ); @@ -397,7 +398,7 @@ void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) ); - reorder< ExecSpace >(iter, mcodes, size); + reorder< ExecSpace >(iter, mcodes, size, allocatorID ); } //------------------------------------------------------------------------------ @@ -405,7 +406,8 @@ void custom_sort( ExecSpace, uint32*& mcodes, int32 size, int32* iter ) defined(RAJA_ENABLE_CUDA) && defined(AXOM_USE_CUB) template < int BLOCK_SIZE, axom::ExecutionMode EXEC_MODE > void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, - uint32*& mcodes, int32 size, int32* iter ) + uint32*& mcodes, int32 size, int32* iter, + int allocatorID ) { AXOM_PERF_MARK_FUNCTION( "custom_sort" ); @@ -414,8 +416,8 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, AXOM_PERF_MARK_SECTION( "gpu_cub_sort", - uint32* mcodes_alt_buf = axom::allocate< uint32 >( size ); - int32* iter_alt_buf = axom::allocate< int32 >( size ); + uint32* mcodes_alt_buf = axom::allocate< uint32 >( size, allocatorID ); + int32* iter_alt_buf = axom::allocate< int32 >( size, allocatorID ); // create double buffers ::cub::DoubleBuffer< uint32 > d_keys( mcodes, mcodes_alt_buf ); @@ -428,7 +430,8 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, d_keys, d_values, size ); // Allocate temporary storage - d_temp_storage = (void*)axom::allocate< unsigned char >( temp_storage_bytes ); + d_temp_storage = + (void*)axom::allocate< unsigned char >( temp_storage_bytes, allocatorID ); // Run sorting operation @@ -455,12 +458,12 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, //------------------------------------------------------------------------------ template < typename ExecSpace > -void sort_mcodes( uint32*& mcodes, int32 size, int32* iter ) +void sort_mcodes( uint32*& mcodes, int32 size, int32* iter, int allocatorID ) { AXOM_PERF_MARK_FUNCTION( "sort_mcodes" ); // dispatch - custom_sort( ExecSpace(), mcodes, size, iter ); + custom_sort( ExecSpace(), mcodes, size, iter, allocatorID ); } //------------------------------------------------------------------------------ @@ -594,7 +597,7 @@ static void array_memset(T* array, const int32 size, const T val) //------------------------------------------------------------------------------ template < typename ExecSpace, typename FloatType, int NDIMS > -void propagate_aabbs( RadixTree< FloatType, NDIMS >& data) +void propagate_aabbs( RadixTree< FloatType, NDIMS >& data, int allocatorID ) { AXOM_PERF_MARK_FUNCTION( "propagate_abbs" ); @@ -613,7 +616,7 @@ void propagate_aabbs( RadixTree< FloatType, NDIMS >& data) AABB* inner_aabb_ptr = data.m_inner_aabbs; - int32* counters_ptr = axom::allocate(inner_size); + int32* counters_ptr = axom::allocate(inner_size, allocatorID ); array_memset< ExecSpace >(counters_ptr, inner_size, 0); @@ -674,7 +677,8 @@ void build_radix_tree( const FloatType* boxes, int size, AABB< FloatType, NDIMS >& bounds, RadixTree< FloatType, NDIMS >& radix_tree, - FloatType scale_factor ) + FloatType scale_factor, + int allocatorID ) { AXOM_PERF_MARK_FUNCTION( "build_radix_tree" ); @@ -682,7 +686,7 @@ void build_radix_tree( const FloatType* boxes, SLIC_ASSERT( boxes !=nullptr ); SLIC_ASSERT( size > 0 ); - radix_tree.allocate( size ); + radix_tree.allocate( size, allocatorID ); // copy so we don't reorder the input transform_boxes< ExecSpace >( boxes, radix_tree.m_leaf_aabbs, @@ -696,13 +700,19 @@ void build_radix_tree( const FloatType* boxes, // allows us to gather / sort other arrays. get_mcodes< ExecSpace >( radix_tree.m_leaf_aabbs, size, bounds, radix_tree.m_mcodes ); - sort_mcodes< ExecSpace >( radix_tree.m_mcodes, size, - radix_tree.m_leafs ); - reorder< ExecSpace >( radix_tree.m_leafs, radix_tree.m_leaf_aabbs, size ); + sort_mcodes< ExecSpace >( radix_tree.m_mcodes, + size, + radix_tree.m_leafs, + allocatorID ); + + reorder< ExecSpace >( radix_tree.m_leafs, + radix_tree.m_leaf_aabbs, + size, + allocatorID ); build_tree< ExecSpace >( radix_tree ); - propagate_aabbs< ExecSpace >( radix_tree ); + propagate_aabbs< ExecSpace >( radix_tree, allocatorID ); } From 99317acf99867d387a38569fb995e9405304b89a Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 14 Apr 2020 09:49:12 -0700 Subject: [PATCH 208/632] ENH: add BVH::getAllocatorID() and update tests Add a getter method to return the Allocator ID for the BVH and update the BVH constructor test to ensure that the BVH allocator ID is initialized correctly when no allocator is supplied by the caller. --- src/axom/spin/BVH.hpp | 7 +++++++ src/axom/spin/tests/spin_bvh.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 9172a1d962..0301220939 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -178,6 +178,13 @@ class BVH */ ~BVH(); + /*! + * \brief Get the ID of the allocator used by the BVH. + * \return allocatorID the ID of the allocator used by the BVH. + */ + int getAllocatorID( ) const + { return m_AllocatorID; }; + /*! * \brief Sets the scale factor for scaling the supplied bounding boxes. * \param [in] scale_factor the scale factor diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index 944bed7daf..af2c4ec2c6 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -420,6 +420,10 @@ void check_build_bvh2d( ) boxes[ 6 ] = boxes[ 7 ] = 2.; spin::BVH< NDIMS, ExecSpace, FloatType > bvh( boxes, NUM_BOXES ); + + int allocatorID = bvh.getAllocatorID(); + EXPECT_EQ( allocatorID, axom::execution_space< ExecSpace >::allocatorID() ); + bvh.setScaleFactor( 1.0 ); // i.e., no scaling bvh.build( ); @@ -459,6 +463,10 @@ void check_build_bvh3d( ) boxes[ 9 ] = boxes[ 10 ] = boxes[ 11 ] = 2.; spin::BVH< NDIMS, ExecSpace, FloatType > bvh( boxes, NUM_BOXES ); + + int allocatorID = bvh.getAllocatorID(); + EXPECT_EQ( allocatorID, axom::execution_space< ExecSpace >::allocatorID() ); + bvh.setScaleFactor( 1.0 ); // i.e., no scaling bvh.build( ); From 5f1f8356f1448f28cf2ebe10207fd554741ad3e3 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 15 Apr 2020 09:53:40 -0700 Subject: [PATCH 209/632] ENH: use supplied allocator in findBoundingBoxes Change coding in findBoundingBoxes to use the supplied allocator instead of relying on UM. --- src/axom/spin/internal/linear_bvh/BVH_impl.hpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 7b9d5bb107..8b996d47a7 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -637,11 +637,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( SLIC_ASSERT( ymin != nullptr ); SLIC_ASSERT( ymax != nullptr ); - // STEP 0: set the default memory allocator to use for the execution space. - const int currentAllocatorID = axom::getDefaultAllocatorID(); - const int allocatorID = axom::execution_space< ExecSpace >::allocatorID(); - axom::setDefaultAllocator( allocatorID ); - using BoundingBoxType = bounding_box_t< FloatType, NDIMS >; using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; @@ -679,7 +674,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( counts, counts+numBoxes, offsets, RAJA::operators::plus{} ); IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates); + candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); // STEP 4: fill in candidates for each bounding box for_all< ExecSpace >( numBoxes, AXOM_LAMBDA (IndexType i) @@ -706,8 +701,6 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( } ); - // STEP 3: restore default allocator - axom::setDefaultAllocator( currentAllocatorID ); } //------------------------------------------------------------------------------ From 6b6a0b163de013f96ae7d19b4c2d66f690fa6ed4 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 15 Apr 2020 18:46:32 -0700 Subject: [PATCH 210/632] ENH: add more fine grain annotations Add more fine grain annotations to distinguish between compute time and allocation/de-allocation time. --- .../spin/internal/linear_bvh/BVH_impl.hpp | 190 ++++++++++-------- .../internal/linear_bvh/build_radix_tree.hpp | 21 +- 2 files changed, 124 insertions(+), 87 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index 8b996d47a7..c734bcb3ba 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -131,7 +131,7 @@ IndexType bvh_get_counts( LeftPredicate&& leftCheck, const FloatType* y, const FloatType* z ) noexcept { - AXOM_PERF_MARK_FUNCTION( "bvh_get_counts" ); + AXOM_PERF_MARK_FUNCTION( "bvh_get_pointcounts" ); // sanity checks SLIC_ASSERT( inner_nodes != nullptr ); @@ -464,7 +464,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; - // STEP 1: count number of candidates for each query point + // STEP 1: Grab BVH pointers const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); @@ -488,40 +488,48 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, }; // STEP 3: get counts - int total_count = bvh_get_counts< NDIMS,ExecSpace >( - leftPredicate, rightPredicate, inner_nodes, leaf_nodes, - numPts, counts, x, y, z ); + int total_count = 0; + AXOM_PERF_MARK_SECTION( "PASS[1]:count_traversal", + total_count = bvh_get_counts< NDIMS,ExecSpace >( leftPredicate, + rightPredicate, inner_nodes, leaf_nodes, numPts, counts, x, y, z ); + ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; - RAJA::exclusive_scan< exec_policy >( - counts, counts+numPts, offsets, RAJA::operators::plus{} ); + AXOM_PERF_MARK_SECTION( "exclusive_scan", + RAJA::exclusive_scan< exec_policy >( + counts, counts+numPts, offsets, RAJA::operators::plus{} ); + ); - IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); + AXOM_PERF_MARK_SECTION( "allocate_candidates", + IndexType total_candidates = static_cast< IndexType >( total_count ); + candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); + ); // STEP 4: fill in candidates for each point - for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) - { - int32 offset = offsets[ i ]; + AXOM_PERF_MARK_SECTION( "PASS[2]:fill_traversal", + for_all< ExecSpace >( numPts, AXOM_LAMBDA (IndexType i) + { + int32 offset = offsets[ i ]; - PointType point; - QueryAccessor::getPoint( point, i, x, y, z ); + PointType point; + QueryAccessor::getPoint( point, i, x, y, z ); - BVH_LEAF_ACTION( leafAction, int32 current_node, - const int32* leaf_nodes ) - { - candidates[offset] = leaf_nodes[current_node]; - offset++; - }; + BVH_LEAF_ACTION( leafAction, int32 current_node, + const int32* leaf_nodes ) + { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; - lbvh::bvh_traverse( inner_nodes, - leaf_nodes, - point, - leftPredicate, - rightPredicate, - leafAction ); + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + point, + leftPredicate, + rightPredicate, + leafAction ); - } ); + } ); + ); } @@ -554,7 +562,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; - // STEP 1: count number of candidates for each query point + // STEP 1: Grab BVH pointers const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); @@ -578,40 +586,49 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, }; // STEP 3: get counts - int total_count = bvh_get_raycounts< NDIMS,ExecSpace >( - leftPredicate, rightPredicate, inner_nodes, leaf_nodes, - numRays, counts, x0, nx, y0, ny, z0, nz ); + int total_count = 0; + AXOM_PERF_MARK_SECTION( "PASS[1]:count_traversal", + total_count = bvh_get_raycounts< NDIMS,ExecSpace >( leftPredicate, + rightPredicate, inner_nodes, leaf_nodes, numRays, counts, x0, nx, y0, ny, + z0, nz ); + ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; - RAJA::exclusive_scan< exec_policy >( - counts, counts+numRays, offsets, RAJA::operators::plus{} ); + AXOM_PERF_MARK_SECTION( "exclusive_scan", + RAJA::exclusive_scan< exec_policy >( + counts, counts+numRays, offsets, RAJA::operators::plus{} ); + ); - IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); + AXOM_PERF_MARK_SECTION( "allocate_candidates", + IndexType total_candidates = static_cast< IndexType >( total_count ); + candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); + ); // STEP 4: fill in candidates for each point - for_all< ExecSpace >( numRays, AXOM_LAMBDA (IndexType i) - { - int32 offset = offsets[ i ]; + AXOM_PERF_MARK_SECTION( "PASS[2}:fill_traversal", + for_all< ExecSpace >( numRays, AXOM_LAMBDA (IndexType i) + { + int32 offset = offsets[ i ]; - RayType ray; - QueryAccessor::getRay( ray, i, x0, nx, y0, ny, z0, nz ); + RayType ray; + QueryAccessor::getRay( ray, i, x0, nx, y0, ny, z0, nz ); - BVH_LEAF_ACTION( leafAction, int32 current_node, - const int32* leaf_nodes ) - { - candidates[offset] = leaf_nodes[current_node]; - offset++; - }; + BVH_LEAF_ACTION( leafAction, int32 current_node, + const int32* leaf_nodes ) + { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; - lbvh::bvh_traverse( inner_nodes, - leaf_nodes, - ray, - leftPredicate, - rightPredicate, - leafAction ); + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + ray, + leftPredicate, + rightPredicate, + leafAction ); - } ); + } ); + ); } @@ -641,7 +658,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( using TraversalPredicates = lbvh::TraversalPredicates< NDIMS, FloatType >; using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; - // STEP 1: count number of candidates for each query point + // STEP 1: Grab BVH pointers const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); @@ -665,41 +682,50 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( }; // STEP 3: get counts - int total_count = bvh_get_boxcounts< NDIMS,ExecSpace >( - leftPredicate, rightPredicate, inner_nodes, leaf_nodes, - numBoxes, counts, xmin, xmax, ymin, ymax, zmin, zmax ); + int total_count = 0; + AXOM_PERF_MARK_SECTION( "PASS[1]:count_traversal", + total_count = bvh_get_boxcounts< NDIMS,ExecSpace >( leftPredicate, + rightPredicate, inner_nodes, leaf_nodes, numBoxes, counts, xmin, xmax, + ymin, ymax, zmin, zmax ); + ); using exec_policy = typename axom::execution_space< ExecSpace >::loop_policy; - RAJA::exclusive_scan< exec_policy >( - counts, counts+numBoxes, offsets, RAJA::operators::plus{} ); + AXOM_PERF_MARK_SECTION( "exclusive_scan", + RAJA::exclusive_scan< exec_policy >( + counts, counts+numBoxes, offsets, RAJA::operators::plus{} ); + ); - IndexType total_candidates = static_cast< IndexType >( total_count ); - candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); + AXOM_PERF_MARK_SECTION( "allocate_candidates", + IndexType total_candidates = static_cast< IndexType >( total_count ); + candidates = axom::allocate< IndexType >( total_candidates, m_AllocatorID ); + ); // STEP 4: fill in candidates for each bounding box - for_all< ExecSpace >( numBoxes, AXOM_LAMBDA (IndexType i) - { - int32 offset = offsets[ i ]; - - BoundingBoxType box; - QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, - zmax ); - - BVH_LEAF_ACTION( leafAction, int32 current_node, - const int32* leaf_nodes ) + AXOM_PERF_MARK_SECTION( "PASS[2}:fill_traversal", + for_all< ExecSpace >( numBoxes, AXOM_LAMBDA (IndexType i) { - candidates[offset] = leaf_nodes[current_node]; - offset++; - }; + int32 offset = offsets[ i ]; + + BoundingBoxType box; + QueryAccessor::getBoundingBox( box, i, xmin, xmax, ymin, ymax, zmin, + zmax ); + + BVH_LEAF_ACTION( leafAction, int32 current_node, + const int32* leaf_nodes ) + { + candidates[offset] = leaf_nodes[current_node]; + offset++; + }; + + lbvh::bvh_traverse( inner_nodes, + leaf_nodes, + box, + leftPredicate, + rightPredicate, + leafAction ); - lbvh::bvh_traverse( inner_nodes, - leaf_nodes, - box, - leftPredicate, - rightPredicate, - leafAction ); - - } ); + } ); + ); } diff --git a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp index 3388dae0b2..546c5a0f4a 100644 --- a/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp +++ b/src/axom/spin/internal/linear_bvh/build_radix_tree.hpp @@ -414,17 +414,24 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, using ExecSpace = typename axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >; array_counting< ExecSpace >(iter, size, 0, 1); - AXOM_PERF_MARK_SECTION( "gpu_cub_sort", + // temporary buffers + uint32* mcodes_alt_buf = nullptr; + int32* iter_alt_buf = nullptr; + void* d_temp_storage = nullptr; - uint32* mcodes_alt_buf = axom::allocate< uint32 >( size, allocatorID ); - int32* iter_alt_buf = axom::allocate< int32 >( size, allocatorID ); + AXOM_PERF_MARK_SECTION( "allocate_cub_buffers", + + mcodes_alt_buf = axom::allocate< uint32 >( size, allocatorID ); + iter_alt_buf = axom::allocate< int32 >( size, allocatorID ); + ); + + AXOM_PERF_MARK_SECTION( "gpu_cub_sort", // create double buffers ::cub::DoubleBuffer< uint32 > d_keys( mcodes, mcodes_alt_buf ); ::cub::DoubleBuffer< int32 > d_values( iter, iter_alt_buf ); // determine temporary device storage requirements - void* d_temp_storage = nullptr; size_t temp_storage_bytes = 0; ::cub::DeviceRadixSort::SortPairs( d_temp_storage, temp_storage_bytes, d_keys, d_values, size ); @@ -447,12 +454,16 @@ void custom_sort( axom::CUDA_EXEC< BLOCK_SIZE, EXEC_MODE >, iter[ i ] = sorted_vals[ i ]; } ); + ); + + AXOM_PERF_MARK_SECTION( "free_cub_buffers", + // Free temporary storage axom::deallocate( d_temp_storage ); axom::deallocate( mcodes_alt_buf ); axom::deallocate( iter_alt_buf ); - ); + } #endif From 8bd5a692b403c1ff6bae78c86d1c8f45467b7109 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 15 Apr 2020 18:55:38 -0700 Subject: [PATCH 211/632] DOC: doc BVH updates to use supplied allocator Document updates to the BVH that enable using a supplied allocator. --- RELEASE-NOTES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index f2e9ab7650..e5214e4f28 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,6 +10,11 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ## [Unreleased] - Release date yyyy-mm-dd ### Added +- Added the ability to specify a user-supplied allocator ID to use with the + BVH. This allows the application to use a device allocator for the BVH and + avoid use of UM on the GPU, which can hinder perfomrmance, or use a pool + allocator to mitigate the latencies associated with allocation/deallocation. + The allocator ID is specified as an optional argument to the BVH constructor. - Added new CMake option, `AXOM_ENABLE_ANNOTATIONS`, to enable/disable code annotations in Axom. Default is OFF. - Added Axom annotation macros. The macros can be used to annotate functions, From d8a5ad7b7f965d6079ef0ba68b4939cc7b7ea9b9 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Wed, 15 Apr 2020 20:01:59 -0700 Subject: [PATCH 212/632] DOC: correct BVH usage example in doxygen --- src/axom/spin/BVH.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 0301220939..4299b1df50 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -103,7 +103,7 @@ enum BVHReturnCodes * * // find candidates in parallel, allocates and populates the supplied * // candidates array - * bvh.find( offsets, counts, candidates, numPoints, qx, qy, qz ); + * bvh.findPoints( offsets, counts, candidates, numPoints, qx, qy, qz ); * SLIC_ASSERT( candidates != nullptr ); * * ... From 8d0ed7f15fafddb8332ad8fe5b68e5a8d258107f Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 19 Apr 2020 19:46:14 -0700 Subject: [PATCH 213/632] ENH: add test using a pool allocator with the BVH --- src/axom/spin/tests/spin_bvh.cpp | 71 +++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/src/axom/spin/tests/spin_bvh.cpp b/src/axom/spin/tests/spin_bvh.cpp index af2c4ec2c6..fd64bacc0a 100644 --- a/src/axom/spin/tests/spin_bvh.cpp +++ b/src/axom/spin/tests/spin_bvh.cpp @@ -1809,7 +1809,7 @@ TEST( spin_bvh, single_box3d_omp ) #endif //------------------------------------------------------------------------------ -#ifdef AXOM_USE_CUDA +#if defined(AXOM_USE_CUDA) && defined(AXOM_USE_RAJA) && defined(AXOM_USE_UMPIRE) AXOM_CUDA_TEST( spin_bvh, contruct2D_cuda ) { @@ -1910,7 +1910,74 @@ AXOM_CUDA_TEST( spin_bvh, single_box3d_cuda ) check_single_box3d< exec, float >( ); } -#endif +//------------------------------------------------------------------------------ +AXOM_CUDA_TEST( spin_bvh, use_device_pool_allocator ) +{ + // Create a pool allocator on the device + constexpr size_t POOL_SIZE = (1024 * 1024 * 1024) + 1; + umpire::ResourceManager& rm = umpire::ResourceManager::getInstance(); + umpire::Allocator allocator = rm.getAllocator(umpire::resource::Device); + + umpire::Allocator pool_allocator = + rm.makeAllocator< umpire::strategy::DynamicPool >( + "DEVICE_POOL", allocator, POOL_SIZE ); + + const int allocID = pool_allocator.getId(); + + // aliases & constants + constexpr int NDIMS = 3; + + constexpr int BLOCK_SIZE = 256; + using exec = axom::CUDA_EXEC< BLOCK_SIZE >; + + constexpr int NUM_BOXES = 1; + + using FloatType = double; + + // single bounding box in [0,1] x [0,1] x [0,1] + FloatType* boxes = axom::allocate< FloatType >( 6, allocID ); + axom::for_all< exec >( 0, 6, AXOM_LAMBDA( axom::IndexType idx ) + { + boxes[ idx ] = (idx < 3) ? 0.0 : 1.0; + } ); + + // construct a BVH with a single box + spin::BVH< NDIMS, exec, FloatType > bvh( boxes, NUM_BOXES, allocID ); + EXPECT_EQ( bvh.getAllocatorID(), allocID ); + + bvh.setScaleFactor( 1.0 ); // i.e., no scaling + bvh.build( ); + + // run the find algorithm w/ the centroid of the bounding box as input. + // Should return one and only one candidate that corresponds to the + // single bounding box. + FloatType* xc = axom::allocate< FloatType >( NUM_BOXES, allocID ); + FloatType* yc = axom::allocate< FloatType >( NUM_BOXES, allocID ); + FloatType* zc = axom::allocate< FloatType >( NUM_BOXES, allocID ); + axom::for_all< exec >( 0, 1, AXOM_LAMBDA(axom::IndexType idx) + { + xc[ idx ] = yc[ idx ] = zc[ idx ] = 0.5; + } ); + + IndexType* offsets = axom::allocate< IndexType >( NUM_BOXES, allocID ); + IndexType* counts = axom::allocate< IndexType >( NUM_BOXES, allocID ); + IndexType* candidates = nullptr; + bvh.findPoints( offsets, counts, candidates, NUM_BOXES, xc, yc, zc ); + EXPECT_TRUE( candidates != nullptr ); + + // Ensure the BVH uses interally the supplied pool allocator + EXPECT_EQ( rm.getAllocator(candidates).getId(), allocID ); + + axom::deallocate( xc ); + axom::deallocate( yc ); + axom::deallocate( zc ); + axom::deallocate( boxes ); + axom::deallocate( offsets ); + axom::deallocate( counts ); + axom::deallocate( candidates ); +} + +#endif /* AXOM_USE_CUDA && AXOM_USE_RAJA && AXOM_USE_UMPIRE */ //------------------------------------------------------------------------------ #include "axom/slic/core/UnitTestLogger.hpp" From ba508280f8f5ab1362a17518b4e83ec4711fec8c Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 19 Apr 2020 20:05:51 -0700 Subject: [PATCH 214/632] ENH: turn on CUB when Axom is using CUDA --- .../rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake | 2 ++ host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake | 2 ++ 2 files changed, 4 insertions(+) diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake index 2341ff1b69..ac27bc7210 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-clang@8.0.1_nvcc_xlf.cmake @@ -110,6 +110,8 @@ set(AXOM_ENABLE_ANNOTATIONS ON CACHE BOOL "") set(AXOM_CUDA_ARCH "sm_70" CACHE PATH "") +set(AXOM_USE_CUB ON CACHE BOOL "") + set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") set(CMAKE_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE PATH "") diff --git a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake index 3af208f84d..947a7799f0 100644 --- a/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake +++ b/host-configs/rzansel-blueos_3_ppc64le_ib_p9-xl@nvcc.cmake @@ -114,6 +114,8 @@ set(AXOM_ENABLE_ANNOTATIONS ON CACHE BOOL "") set(AXOM_CUDA_ARCH "sm_70" CACHE PATH "") +set(AXOM_USE_CUB ON CACHE BOOL "") + set(CMAKE_CUDA_FLAGS "-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G" CACHE PATH "") set(CMAKE_CUDA_HOST_COMPILER "${MPI_CXX_COMPILER}" CACHE PATH "") From ab737657f24c967d83c3ecb64e86c5f6d3699c80 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Sun, 19 Apr 2020 20:06:39 -0700 Subject: [PATCH 215/632] ENH: enable CUB in spack autogenerated hostconfigs Update Axom's spack package to enable CUB in the auto-generated host-configs when CUDA is enabled. --- scripts/uberenv/packages/axom/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/uberenv/packages/axom/package.py b/scripts/uberenv/packages/axom/package.py index fde1ceb57d..2811b00b07 100644 --- a/scripts/uberenv/packages/axom/package.py +++ b/scripts/uberenv/packages/axom/package.py @@ -407,8 +407,10 @@ def hostconfig(self, spec, prefix): if on_blueos_p9: cfg.write(cmake_cache_entry("AXOM_CUDA_ARCH", "sm_70")) + cfg.write(cmake_cache_option("AXOM_USE_CUB",True)) else: cfg.write(cmake_cache_entry("AXOM_CUDA_ARCH", "sm_60")) + cfg.write(cmake_cache_option("AXOM_USE_CUB",True)) cfg.write(cmake_cache_entry("CMAKE_CUDA_FLAGS" ,"-restrict -arch ${AXOM_CUDA_ARCH} -std=c++11 --expt-extended-lambda -G")) From 24cf5dfe4f5eaf02271f702f244c9e8189f2012a Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Tue, 21 Apr 2020 20:10:04 -0700 Subject: [PATCH 216/632] DOC: update copyright date --- src/axom/spin/internal/linear_bvh/QueryAccessor.hpp | 2 +- src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp | 2 +- src/axom/spin/internal/linear_bvh/bvh_traverse.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp index 21fd0f6548..3b7bcca33f 100644 --- a/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp +++ b/src/axom/spin/internal/linear_bvh/QueryAccessor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index 59b1de2c59..bc5c76f09d 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // // SPDX-License-Identifier: (BSD-3-Clause) diff --git a/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp b/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp index b39989659b..bd51088bbc 100644 --- a/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp +++ b/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2019, Lawrence Livermore National Security, LLC and +// Copyright (c) 2017-2020, Lawrence Livermore National Security, LLC and // other Axom Project Developers. See the top-level COPYRIGHT file for details. // // SPDX-License-Identifier: (BSD-3-Clause) From 831c52317a467f9e6e47ca6bfebf33f097894d9d Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 30 Apr 2020 14:01:15 -0700 Subject: [PATCH 217/632] DOC: clarify requirement for umpire allocator ID --- RELEASE-NOTES.md | 4 ++-- src/axom/spin/BVH.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index e5214e4f28..797ff9bc87 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -10,7 +10,7 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ ## [Unreleased] - Release date yyyy-mm-dd ### Added -- Added the ability to specify a user-supplied allocator ID to use with the +- Added the ability to specify an [Umpire] allocator ID to use with the BVH. This allows the application to use a device allocator for the BVH and avoid use of UM on the GPU, which can hinder perfomrmance, or use a pool allocator to mitigate the latencies associated with allocation/deallocation. @@ -358,4 +358,4 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/ [Scalable Checkpoint Restart (SCR)]: https://computation.llnl.gov/projects/scalable-checkpoint-restart-for-mpi [SU2 Mesh file format]: https://su2code.github.io/docs/Mesh-File/ - +[Umpire]: https://github.com/LLNL/Umpire diff --git a/src/axom/spin/BVH.hpp b/src/axom/spin/BVH.hpp index 4299b1df50..a15616c0c7 100644 --- a/src/axom/spin/BVH.hpp +++ b/src/axom/spin/BVH.hpp @@ -140,7 +140,7 @@ class BVH * * \param [in] boxes buffer consisting of bounding boxes for each entity. * \param [in] numItems the total number of items to store in the BVH. - * \param [in] allocatorID specify the ID of the allocator to use. Optional. + * \param [in] allocatorID Umpire allocator ID to use (optional) * * \note boxes is an array of length 2*dimension*numItems, that stores the * two corners of the axis-aligned bounding box corresponding to a given From e4c5efa81146048befd5a827f4342d9666b88337 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 30 Apr 2020 16:10:56 -0700 Subject: [PATCH 218/632] ENH: define and use vec4_t template alias --- src/axom/spin/internal/linear_bvh/BVHData.hpp | 9 +- .../spin/internal/linear_bvh/BVH_impl.hpp | 39 ++++---- .../linear_bvh/TraversalPredicates.hpp | 94 ++++++++++++------- .../spin/internal/linear_bvh/bvh_traverse.hpp | 16 ++-- .../spin/internal/linear_bvh/bvh_vtkio.hpp | 18 ++-- 5 files changed, 101 insertions(+), 75 deletions(-) diff --git a/src/axom/spin/internal/linear_bvh/BVHData.hpp b/src/axom/spin/internal/linear_bvh/BVHData.hpp index dd7bbe22dc..bb12c7d3d1 100644 --- a/src/axom/spin/internal/linear_bvh/BVHData.hpp +++ b/src/axom/spin/internal/linear_bvh/BVHData.hpp @@ -22,6 +22,11 @@ namespace spin { namespace internal { + +// Internal datatype used to store each of the 4 segments of a BVH node. +template < typename FloatType > +using vec4_t = linear_bvh::Vec< FloatType, 4 >; + namespace linear_bvh { @@ -46,7 +51,7 @@ namespace linear_bvh * \endverbatim * * \note The internal data layout is organized in a flat buffer of 4 segments, - * where each segment is a Vec< FloatType, 4 > type, that stores the left + * where each segment is a vec4_t< FloatType > type, that stores the left * and right boxes of a given node, as well as, the IDs of the right and * left children, as illustrated above. * @@ -57,7 +62,7 @@ namespace linear_bvh template < typename FloatType, int NDIMS > struct BVHData { - Vec< FloatType, 4 >* m_inner_nodes; // BVH bins including leafs + vec4_t< FloatType >* m_inner_nodes; // BVH bins including leafs int32* m_leaf_nodes; // leaf data AABB< FloatType, NDIMS > m_bounds; diff --git a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp index c734bcb3ba..63efaea308 100644 --- a/src/axom/spin/internal/linear_bvh/BVH_impl.hpp +++ b/src/axom/spin/internal/linear_bvh/BVH_impl.hpp @@ -54,9 +54,6 @@ using floating_point_limits = axom::numerics::floating_point_limits; //------------------------------------------------------------------------------ namespace lbvh = internal::linear_bvh; -template < typename FloatType > -using vec4_t = internal::linear_bvh::Vec< FloatType, 4 >; - template < typename FloatType, int NDIMS > using point_t = internal::linear_bvh::Vec< FloatType, NDIMS >; @@ -123,7 +120,7 @@ template < int NDIMS, typename ExecSpace, typename FloatType > IndexType bvh_get_counts( LeftPredicate&& leftCheck, RightPredicate&& rightCheck, - const vec4_t< FloatType >* inner_nodes, + const internal::vec4_t< FloatType >* inner_nodes, const int32* leaf_nodes, IndexType N, IndexType* counts, @@ -200,7 +197,7 @@ template < int NDIMS, typename ExecSpace, typename FloatType > IndexType bvh_get_raycounts( LeftPredicate&& leftCheck, RightPredicate&& rightCheck, - const vec4_t< FloatType >* inner_nodes, + const internal::vec4_t< FloatType >* inner_nodes, const int32* leaf_nodes, IndexType N, IndexType* counts, @@ -286,7 +283,7 @@ template < int NDIMS, typename ExecSpace, typename FloatType > IndexType bvh_get_boxcounts( LeftPredicate&& leftCheck, RightPredicate&& rightCheck, - const vec4_t< FloatType >* inner_nodes, + const internal::vec4_t< FloatType >* inner_nodes, const int32* leaf_nodes, IndexType N, IndexType* counts, @@ -465,7 +462,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; // STEP 1: Grab BVH pointers - const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; + const internal::vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); @@ -473,16 +470,16 @@ void BVH< NDIMS, ExecSpace, FloatType >::findPoints( IndexType* offsets, // STEP 2: define traversal predicates BVH_PREDICATE( leftPredicate, const PointType &p, - const vec4_t< FloatType >&s1, - const vec4_t< FloatType >&s2 ) + const internal::vec4_t< FloatType >&s1, + const internal::vec4_t< FloatType >&s2 ) { return TraversalPredicates::pointInLeftBin( p, s1, s2 ); }; BVH_PREDICATE( rightPredicate, const PointType &p, - const vec4_t< FloatType >&s2, - const vec4_t< FloatType >&s3 ) + const internal::vec4_t< FloatType >&s2, + const internal::vec4_t< FloatType >&s3 ) { return TraversalPredicates::pointInRightBin( p, s2, s3 ); }; @@ -563,7 +560,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; // STEP 1: Grab BVH pointers - const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; + const internal::vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); @@ -571,16 +568,16 @@ void BVH< NDIMS, ExecSpace, FloatType >::findRays( IndexType* offsets, // STEP 2: define traversal predicates BVH_PREDICATE( leftPredicate, const RayType &r, - const vec4_t< FloatType >&s1, - const vec4_t< FloatType >&s2 ) + const internal::vec4_t< FloatType >&s1, + const internal::vec4_t< FloatType >&s2 ) { return TraversalPredicates::rayIntersectsLeftBin( r, s1, s2, TOL ); }; BVH_PREDICATE( rightPredicate, const RayType &r, - const vec4_t< FloatType >&s2, - const vec4_t< FloatType >&s3 ) + const internal::vec4_t< FloatType >&s2, + const internal::vec4_t< FloatType >&s3 ) { return TraversalPredicates::rayIntersectsRightBin( r, s2, s3, TOL ); }; @@ -659,7 +656,7 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( using QueryAccessor = lbvh::QueryAccessor< NDIMS, FloatType >; // STEP 1: Grab BVH pointers - const vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; + const internal::vec4_t< FloatType >* inner_nodes = m_bvh.m_inner_nodes; const int32* leaf_nodes = m_bvh.m_leaf_nodes; SLIC_ASSERT( inner_nodes != nullptr ); SLIC_ASSERT( leaf_nodes != nullptr ); @@ -667,16 +664,16 @@ void BVH< NDIMS, ExecSpace, FloatType >::findBoundingBoxes( // STEP 2: define traversal predicates BVH_PREDICATE( leftPredicate, const BoundingBoxType &b, - const vec4_t< FloatType >&s1, - const vec4_t< FloatType >&s2 ) + const internal::vec4_t< FloatType >&s1, + const internal::vec4_t< FloatType >&s2 ) { return TraversalPredicates::boundingBoxIntersectsLeftBin( b, s1, s2 ); }; BVH_PREDICATE( rightPredicate, const BoundingBoxType &b, - const vec4_t< FloatType >&s2, - const vec4_t< FloatType >&s3 ) + const internal::vec4_t< FloatType >&s2, + const internal::vec4_t< FloatType >&s3 ) { return TraversalPredicates::boundingBoxIntersectsRightBin( b, s2, s3 ); }; diff --git a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp index bc5c76f09d..f7a1dbec1b 100644 --- a/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp +++ b/src/axom/spin/internal/linear_bvh/TraversalPredicates.hpp @@ -7,6 +7,7 @@ #define AXOM_SPIN_BVH_TRAVERSALPREDICATES_HPP_ #include "axom/spin/internal/linear_bvh/vec.hpp" +#include "axom/spin/internal/linear_bvh/BVHData.hpp" #include "axom/core/numerics/floating_point_limits.hpp" #include "axom/primal/operators/detail/intersect_ray_impl.hpp" @@ -21,9 +22,6 @@ namespace internal namespace linear_bvh { -template < typename FloatType > -using VecType = internal::linear_bvh::Vec< FloatType, 4 >; - /*! * \brief TraversalPredicates is a singleton class that defines different * predicates for traversing a BVH instance that operate directly on the @@ -45,8 +43,6 @@ class TraversalPredicates AXOM_STATIC_ASSERT_MSG( std::is_floating_point< FloatType >::value, "A valid FloatingType must be used, e.g., double or float" ); - using vec4_t = VecType< FloatType >; - ///\name Predicates for Point Queries /// @{ @@ -62,8 +58,8 @@ class TraversalPredicates template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, - const vec4_t& s1, - const vec4_t& s2 ) noexcept; + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 ) noexcept; /*! * \brief Checks if the supplied point is within the right bin. @@ -77,8 +73,8 @@ class TraversalPredicates template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInRightBin( const PointType& point, - const vec4_t& s2, - const vec4_t& s3 ) noexcept; + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 ) noexcept; /// @} @@ -97,9 +93,11 @@ class TraversalPredicates */ template < typename RayType > AXOM_HOST_DEVICE - static inline bool rayIntersectsLeftBin( - const RayType& r, const vec4_t& s1, const vec4_t& s2, - FloatType TOL=numerics::floating_point_limits::epsilon() + static inline bool rayIntersectsLeftBin( + const RayType& r, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2, + FloatType TOL=numerics::floating_point_limits::epsilon() ) noexcept; /*! @@ -115,7 +113,9 @@ class TraversalPredicates template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsRightBin( - const RayType& r, const vec4_t& s2, const vec4_t& s3, + const RayType& r, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3, FloatType TOL=numerics::floating_point_limits::epsilon() ) noexcept; @@ -137,7 +137,10 @@ class TraversalPredicates template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsLeftBin( - const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept; + const BoundingBoxType& b, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 + ) noexcept; /*! * \brief Checks if the specified bounding box intersects with the right bin. @@ -152,7 +155,10 @@ class TraversalPredicates template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsRightBin( - const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept; + const BoundingBoxType& b, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 + ) noexcept; /// @} @@ -170,13 +176,11 @@ class TraversalPredicates< DIMENSION_2, FloatType > public: - using vec4_t = VecType< FloatType >; - template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, - const vec4_t& s1, - const vec4_t& s2 ) noexcept + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_left = true; @@ -193,8 +197,8 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInRightBin( const PointType& point, - const vec4_t& s2, - const vec4_t& s3 ) noexcept + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_right = true; @@ -211,7 +215,9 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsLeftBin( - const RayType& r, const vec4_t& s1, const vec4_t& s2, + const RayType& r, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2, FloatType TOL=numerics::floating_point_limits::epsilon() ) noexcept { @@ -235,7 +241,9 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsRightBin( - const RayType& r, const vec4_t& s2, const vec4_t& s3, + const RayType& r, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3, FloatType TOL=numerics::floating_point_limits::epsilon() ) noexcept { @@ -259,7 +267,10 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsLeftBin( - const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept + const BoundingBoxType& b, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 + ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; @@ -281,7 +292,10 @@ class TraversalPredicates< DIMENSION_2, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsRightBin( - const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept + const BoundingBoxType& b, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 + ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; @@ -311,13 +325,12 @@ class TraversalPredicates< DIMENSION_3, FloatType > public: - using vec4_t = VecType< FloatType >; - template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInLeftBin( const PointType& point, - const vec4_t& s1, - const vec4_t& s2 ) noexcept + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 + ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. @@ -337,8 +350,9 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename PointType > AXOM_HOST_DEVICE static inline bool pointInRightBin( const PointType& point, - const vec4_t& s2, - const vec4_t& s3 ) noexcept + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 + ) noexcept { // NOTE: See BVHData.hpp for how the BVH bin is organized in the segments. bool in_right = true; @@ -357,7 +371,9 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsLeftBin( - const RayType& r, const vec4_t& s1, const vec4_t& s2, + const RayType& r, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2, FloatType TOL=numerics::floating_point_limits::epsilon() ) noexcept { @@ -386,7 +402,9 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename RayType > AXOM_HOST_DEVICE static inline bool rayIntersectsRightBin( - const RayType& r, const vec4_t& s2, const vec4_t& s3, + const RayType& r, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3, FloatType TOL=numerics::floating_point_limits::epsilon() ) noexcept { @@ -415,7 +433,10 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsLeftBin( - const BoundingBoxType& b, const vec4_t& s1, const vec4_t& s2 ) noexcept + const BoundingBoxType& b, + const vec4_t< FloatType >& s1, + const vec4_t< FloatType >& s2 + ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; @@ -443,7 +464,10 @@ class TraversalPredicates< DIMENSION_3, FloatType > template < typename BoundingBoxType > AXOM_HOST_DEVICE static inline bool boundingBoxIntersectsRightBin( - const BoundingBoxType& b, const vec4_t& s2, const vec4_t& s3 ) noexcept + const BoundingBoxType& b, + const vec4_t< FloatType >& s2, + const vec4_t< FloatType >& s3 + ) noexcept { const FloatType& box_xmin = b[ 0 ]; const FloatType& box_ymin = b[ 1 ]; diff --git a/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp b/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp index bd51088bbc..770f65e685 100644 --- a/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp +++ b/src/axom/spin/internal/linear_bvh/bvh_traverse.hpp @@ -46,8 +46,8 @@ inline bool leaf_node( const int32& nodeIdx ) * \note The supplied functors, `L`, `R`, are expected to take the following * three arguments: * (1) The supplied primitive, p - * (2) a Vec< FloatType, 4 > of the first segment that defines the BVH bin - * (3) a Vec< FloatType, 4 > of the second segment that defines the BVH bin + * (2) a vec4_t< FloatType > of the first segment that defines the BVH bin + * (3) a vec4_t< FloatType > of the second segment that defines the BVH bin * * \see BVHData for the details on the internal data layout of the BVH. * @@ -62,14 +62,14 @@ template< typename FloatType, typename InRightCheck, typename LeafAction > AXOM_HOST_DEVICE -inline void bvh_traverse( const Vec< FloatType,4>* inner_nodes, +inline void bvh_traverse( const vec4_t< FloatType >* inner_nodes, const int32* leaf_nodes, const PrimitiveType& p, InLeftCheck&& L, InRightCheck&& R, LeafAction&& A ) { - using vec4_t = Vec< FloatType, 4 >; + using VecType = vec4_t< FloatType >; // setup stack constexpr int32 ISIZE = sizeof(int32); @@ -85,9 +85,9 @@ inline void bvh_traverse( const Vec< FloatType,4>* inner_nodes, if ( !leaf_node( current_node ) ) { - const vec4_t first4 = inner_nodes[current_node + 0]; - const vec4_t second4 = inner_nodes[current_node + 1]; - const vec4_t third4 = inner_nodes[current_node + 2]; + const VecType first4 = inner_nodes[current_node + 0]; + const VecType second4 = inner_nodes[current_node + 1]; + const VecType third4 = inner_nodes[current_node + 2]; const bool in_left = L( p, first4, second4 ); const bool in_right = R( p, second4, third4 ); @@ -100,7 +100,7 @@ inline void bvh_traverse( const Vec< FloatType,4>* inner_nodes, } else { - vec4_t children = inner_nodes[current_node + 3]; + VecType children = inner_nodes[current_node + 3]; // memcpy the int bits hidden in the floats int32 l_child; diff --git a/src/axom/spin/internal/linear_bvh/bvh_vtkio.hpp b/src/axom/spin/internal/linear_bvh/bvh_vtkio.hpp index 496ed1060a..57a8028329 100644 --- a/src/axom/spin/internal/linear_bvh/bvh_vtkio.hpp +++ b/src/axom/spin/internal/linear_bvh/bvh_vtkio.hpp @@ -85,8 +85,8 @@ void write_box3d( const FloatType& xmin, //------------------------------------------------------------------------------ template < typename FloatType, int NDIMS > -void write_leftbox( const Vec< FloatType, 4 >& first, - const Vec< FloatType, 4 >& second, +void write_leftbox( const vec4_t< FloatType >& first, + const vec4_t< FloatType >& second, int32& numPoints, int32& numBins, std::ostringstream& nodes, @@ -117,8 +117,8 @@ void write_leftbox( const Vec< FloatType, 4 >& first, //------------------------------------------------------------------------------ template < typename FloatType, int NDIMS > -void write_righbox( const Vec< FloatType, 4 >& second, - const Vec< FloatType, 4 >& third, +void write_righbox( const vec4_t< FloatType >& second, + const vec4_t< FloatType >& third, int32& numPoints, int32& numBins, std::ostringstream& nodes, @@ -188,7 +188,7 @@ void write_root( const AABB< FloatType, 3 >& root, //------------------------------------------------------------------------------ template < typename FloatType, int NDIMS > -void write_recursive( Vec< FloatType, 4 >* inner_nodes, +void write_recursive( vec4_t< FloatType >* inner_nodes, int32 current_node, int32 level, int32& numPoints, @@ -198,15 +198,15 @@ void write_recursive( Vec< FloatType, 4 >* inner_nodes, std::ostringstream& levels ) { // STEP 0: get the flat BVH layout - const Vec< FloatType, 4> first4 = inner_nodes[current_node + 0]; - const Vec< FloatType, 4> second4 = inner_nodes[current_node + 1]; - const Vec< FloatType, 4> third4 = inner_nodes[current_node + 2]; + const vec4_t< FloatType > first4 = inner_nodes[current_node + 0]; + const vec4_t< FloatType > second4 = inner_nodes[current_node + 1]; + const vec4_t< FloatType > third4 = inner_nodes[current_node + 2]; // STEP 1: extract children information int32 l_child; int32 r_child; constexpr int32 isize = sizeof(int32); - Vec< FloatType, 4 > children = inner_nodes[current_node + 3]; + vec4_t< FloatType > children = inner_nodes[current_node + 3]; memcpy(&l_child,&children[0],isize); memcpy(&r_child,&children[1],isize); From 0ede14b94f3e4ba2a5e7ea10d405325bb094c756 Mon Sep 17 00:00:00 2001 From: George Zagaris Date: Thu, 30 Apr 2020 17:11:15 -0700 Subject: [PATCH 219/632] ENH: name Axom CMake options consistently This commit renames the AXOM_USE_CUB and AXOM_USE_MPI3 options to AXOM_ENABLE_CUB and AXOM_ENABLE_MPI3, respectively, for constitency with the rest of the CMake Axom options. Moreover, it adds logic in AxomConfig.cmake to handle Axom compile time options when generating the axom/config.hpp --- src/cmake/AxomConfig.cmake | 12 +++++++++--- src/cmake/AxomOptions.cmake | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cmake/AxomConfig.cmake b/src/cmake/AxomConfig.cmake index 9685116fa1..1752eb321a 100644 --- a/src/cmake/AxomConfig.cmake +++ b/src/cmake/AxomConfig.cmake @@ -35,9 +35,15 @@ foreach(comp ${AXOM_COMPONENTS_ENABLED}) endforeach() ## Add compile-time options to the config file -if ( AXOM_ENABLE_ANNOTATIONS ) - set( AXOM_USE_ANNOTATIONS TRUE ) -endif() +## Check for options of the form AXOM_ENABLE_