Skip to content

Commit

Permalink
Merge 52ade2b into c45ee07
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Aug 5, 2020
2 parents c45ee07 + 52ade2b commit 63e55f5
Show file tree
Hide file tree
Showing 25 changed files with 1,427 additions and 63 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
(https://llnl-conduit.readthedocs.io/en/latest/blueprint_mesh.html#julia-amr-examples) for more details.
- Added `blueprint::mesh::examples::venn` example that demonstrates different ways to encode volume fraction based multi-material fields. See the Venn Blueprint docs
(https://llnl-conduit.readthedocs.io/en/latest/blueprint_mesh.html#venn) for more details.
- Added `blueprint::mesh::number_of_domains` property method for trees that conform to the mesh blueprint.
- Added MPI mesh blueprint methods, `blueprint::mpi::mesh::verify` and `blueprint::mpi::mesh::number_of_domains` (available in the `conduit_blueprint_mpi` library)


### Fixed
Expand All @@ -52,6 +54,7 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
- DataArray<T>::to_json(std::ostring &) is deprecated in favor DataArray<T>::to_json_stream. to_json(std::ostring &) will be removed in a future release.
- Schema::to_json and Schema::save variants with detailed (bool) arg are deprecated. The detailed arg was never used. These methods will be removed in a future release.
- Node::print() now prints yaml instead of json.
- The string return variants of `about` methods now return yaml strings instead of json strings.
- Sphinx Docs code examples and outputs are now included using start-after and end-before style includes.

#### Relay
Expand All @@ -62,7 +65,8 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s


#### Blueprint
- Refactored the Polygonal and Polyhedral mesh blueprint specification to leverage one-to-many concepts and to allow more zero-copy use cases.
- Refactored the Polygonal and Polyhedral mesh blueprint specification to leverage one-to-many concepts and to allow more zero-copy use cases.
- The `conduit_blueprint_mpi` library now depends on `conduit_relay_mpi`.


## [0.5.1] - Released 2020-01-18
Expand Down
45 changes: 45 additions & 0 deletions src/libs/blueprint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,48 @@ if(PYTHON_FOUND)
add_subdirectory(python)
endif()


################################################################
# If we have mpi, add the conduit blueprint mpi library
################################################################
if(MPI_FOUND)
#
# Specify blueprint mpi sources
#
set(conduit_blueprint_mpi_sources
conduit_blueprint_mpi.cpp
conduit_blueprint_mpi_mesh.cpp
conduit_blueprint_mpi_mesh_examples.cpp)

#
# Specify blueprint mpi headers
#
set(conduit_blueprint_mpi_headers
conduit_blueprint_mpi.hpp
conduit_blueprint_mpi_mesh.hpp
conduit_blueprint_mpi_mesh_examples.hpp
${CMAKE_CURRENT_BINARY_DIR}/conduit_blueprint_exports.h)


#
# Specify blueprint mpi deps
#
set(conduit_blueprint_mpi_deps conduit conduit_blueprint mpi conduit_relay_mpi)

#
# setup conduit blueprint mpi lib
#
add_compiled_library(NAME conduit_blueprint_mpi
EXPORT conduit
HEADERS ${conduit_blueprint_mpi_sources}
SOURCES ${conduit_blueprint_mpi_headers}
DEPENDS_ON ${conduit_blueprint_mpi_deps}
HEADERS_DEST_DIR include/conduit
FOLDER libs)

blt_add_target_compile_flags(TO conduit_blueprint_mpi FLAGS "-DCONDUIT_BLUEPRINT_MPI_ENABLED")


endif() # end if MPI_FOUND


2 changes: 1 addition & 1 deletion src/libs/blueprint/conduit_blueprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ about()
{
Node n;
blueprint::about(n);
return n.to_json();
return n.to_yaml();
}

//---------------------------------------------------------------------------//
Expand Down
43 changes: 23 additions & 20 deletions src/libs/blueprint/conduit_blueprint_exports.h.in
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2014-2019, Lawrence Livermore National Security, LLC.
//
//
// Produced at the Lawrence Livermore National Laboratory
//
//
// LLNL-CODE-666778
//
//
// All rights reserved.
//
// This file is part of Conduit.
//
//
// 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
//
// 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,
//
// * 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
// 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,
// 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
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//-----------------------------------------------------------------------------
Expand All @@ -54,12 +54,15 @@
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// -- define proper lib exports for various platforms --
// -- define proper lib exports for various platforms --
//-----------------------------------------------------------------------------

#cmakedefine CONDUIT_WINDOWS_DLL_EXPORTS "${CONDUIT_WINDOWS_DLL_EXPORTS}"

#if defined(CONDUIT_BLUEPRINT_EXPORTS) || defined(conduit_blueprint_EXPORTS)
#if defined(CONDUIT_BLUEPRINT_EXPORTS) || \
defined(conduit_blueprint_EXPORTS) || \
defined(CONDUIT_BLUEPRINT_MPI_EXPORTS) || \
defined(conduit_blueprint_mpi_EXPORTS)
/* define catch all def */
#define CONDUIT_BLUEPRINT_EXPORTS_DEFINED 1
#endif
Expand Down
19 changes: 19 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,25 @@ bool mesh::is_multi_domain(const conduit::Node &n)
return !n.has_child("coordsets");
}

//-------------------------------------------------------------------------
index_t
mesh::number_of_domains(const conduit::Node &n)
{
// this is a blueprint property, we can assume it will be called
// only when mesh verify is true. Given that - it is easy to
// answer the number of domains

if(!is_multi_domain(n))
{
return 1;
}
else
{
return n.number_of_children();
}
}



//-------------------------------------------------------------------------
void mesh::to_multi_domain(const conduit::Node &n,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ bool CONDUIT_BLUEPRINT_API verify(const conduit::Node &n,
//-------------------------------------------------------------------------
bool CONDUIT_BLUEPRINT_API is_multi_domain(const conduit::Node &n);

//-------------------------------------------------------------------------
index_t CONDUIT_BLUEPRINT_API number_of_domains(const conduit::Node &n);

//-------------------------------------------------------------------------
void CONDUIT_BLUEPRINT_API to_multi_domain(const conduit::Node &n,
conduit::Node &dest);
Expand Down
3 changes: 3 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mesh_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2310,6 +2310,9 @@ void spiral(index_t ndoms,
std::string domain_name = oss.str();

Node &dom = res[domain_name];
// set cycle and domain id
dom["state/cycle"] = 0;
dom["state/domain_id"] = d;

// create a rectilinear coordset
dom["coordsets/coords/type"] = "rectilinear";
Expand Down
140 changes: 140 additions & 0 deletions src/libs/blueprint/conduit_blueprint_mpi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2014-2019, 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.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

//-----------------------------------------------------------------------------
///
/// file: conduit_blueprint_mpi.cpp
///
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// std lib includes
//-----------------------------------------------------------------------------
#include <string.h>
#include <math.h>

//-----------------------------------------------------------------------------
// conduit includes
//-----------------------------------------------------------------------------
#include "conduit_blueprint.hpp"
#include "conduit_blueprint_mpi.hpp"


//-----------------------------------------------------------------------------
// -- begin conduit:: --
//-----------------------------------------------------------------------------
namespace conduit
{

//-----------------------------------------------------------------------------
// -- begin conduit::blueprint --
//-----------------------------------------------------------------------------
namespace blueprint
{


//-----------------------------------------------------------------------------
// -- begin conduit::blueprint::mpi --
//-----------------------------------------------------------------------------
namespace mpi
{



//---------------------------------------------------------------------------//
std::string
about()
{
Node n;
blueprint::about(n);
return n.to_yaml();
}

//---------------------------------------------------------------------------//
void
about(Node &n)
{
n.reset();
n["protocols/mesh"] = "enabled";
}

//---------------------------------------------------------------------------//
bool
verify(const std::string &protocol,
const Node &n,
Node &info,
MPI_Comm comm)
{
bool res = false;
info.reset();

std::string p_curr;
std::string p_next;
conduit::utils::split_path(protocol,p_curr,p_next);

if(p_curr == "mesh")
{
res = conduit::blueprint::mpi::mesh::verify(n,info,comm);
}

return res;
}


}
//-----------------------------------------------------------------------------
// -- end conduit::blueprint::mpi --
//-----------------------------------------------------------------------------


}
//-----------------------------------------------------------------------------
// -- end conduit::blueprint --
//-----------------------------------------------------------------------------

}
//-----------------------------------------------------------------------------
// -- end conduit:: --
//-----------------------------------------------------------------------------

0 comments on commit 63e55f5

Please sign in to comment.